Generate content for associated-domains dictionary in the entitlements file.

@param {Object} pluginPreferences - list of hosts from conig.xml
@return {Object} associated-domains dictionary content
345411
function generateAssociatedDomainsContent(pluginPreferences) {
  var domainsList = [];

  // generate list of host links
  pluginPreferences.hosts.forEach(function(host) {
    var link = domainsListEntryForHost(host);
    if (domainsList.indexOf(link) == -1) {
      domainsList.push(link);
    }
  });

  return domainsList;
}
129737
function(options) {
    var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
    if (options.trustedDomains) {
      if (typeof options.trustedDomains === "string") {
        domains = [ options.trustedDomains ];
      } else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
        domains = options.trustedDomains;
      }
    }
    if (domains && domains.length) {
      for (i = 0, len = domains.length; i < len; i++) {
        if (_hasOwn.call(domains, i) && domains[i] && typeof domains[i] === "string") {
          domain = _extractDomain(domains[i]);
          if (!domain) {
            continue;
          }
          if (domain === "*") {
            trustedOriginsExpanded.length = 0;
            trustedOriginsExpanded.push(domain);
            break;
          }
          trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, _window.location.protocol + "//" + domain ]);
        }
      }
    }
    if (trustedOriginsExpanded.length) {
      str += "trustedOrigins=" + _encodeURIComponent(trustedOriginsExpanded.join(","));
    }
    if (options.forceEnhancedClipboard === true) {
      str += (str ? "&" : "") + "forceEnhancedClipboard=true";
    }
    if (typeof options.swfObjectId === "string" && options.swfObjectId) {
      str += (str ? "&" : "") + "swfObjectId=" + _encodeURIComponent(options.swfObjectId);
    }
    if (typeof options.jsVersion === "string" && options.jsVersion) {
      str += (str ? "&" : "") + "jsVersion=" + _encodeURIComponent(options.jsVersion);
    }
    return str;
  }
201023
function removePreviousAssociatedDomains(preferences, domains) {
    const output = [];
    const linkDomains = preferences.linkDomain;

    if (!domains) return output;
    for (let i = 0; i < domains.length; i++) {
      let domain = domains[i];
      if (domain.indexOf("applinks:") === 0) {
        domain = domain.replace("applinks:", "");
        if (isBranchAssociatedDomains(domain, linkDomains)) {
          output.push(`applinks:${domain}`);
        }
      } else if (isBranchAssociatedDomains(domain, linkDomains)) {
        output.push(domain);
      }
    }

    return output;
  }
327762
def get_domains(custom_headers:nil)
      response = get_domains_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
1227818
function(plugins) {
    var pluginData = {};
    plugins.forEach(function(plugin) {
      plugin.getData(function(data) {
        if (data) {
          for (var attribute in data) { pluginData[attribute] = data[attribute]; }
        }
      });
      segmentUtils.setOrigin(plugin.originName);
      segmentUtils.setPluginData(pluginData);
    });
  }
17659
function(tokenService, domainPrefix) {
  var tokenUrl = tokenService.replace(/\{DOMAIN_PREFIX\}/, domainPrefix);
  log.debug('token Url: '+ tokenUrl);
  return tokenUrl;
}
46570
function updateAssociatedDomains(preferences) {
    const domainList = [];
    const prefix = "applinks:";
    const linkDomains = preferences.linkDomain;

    for (let i = 0; i < linkDomains.length; i++) {
      const linkDomain = linkDomains[i];

      // add link domain to associated domain
      domainList.push(prefix + linkDomain);

      // app.link link domains need -alternate associated domains as well (for Deep Views)
      if (linkDomain.indexOf("app.link") !== -1) {
        const first = linkDomain.split(".")[0];
        const second = linkDomain.split(".")[1];
        const rest = linkDomain
          .split(".")
          .slice(2)
          .join(".");
        const alternate = `${first}-alternate`;

        domainList.push(`${prefix + alternate}.${second}.${rest}`);
      }
    }

    return domainList;
  }
384427
function(pluginName, defaultOptions) {
		
		var self = this,
			options = $.extend(true, {}, defaultOptions);
		
		// if the plugin options were isolated in a property named after the
		// plugin, use them (prevents conflicts with other plugins)
		var pluginOptions = self.__options[pluginName];
		
		// if not, try to get them as regular options
		if (!pluginOptions){
			
			pluginOptions = {};
			
			$.each(defaultOptions, function(optionName, value) {
				
				var o = self.__options[optionName];
				
				if (o !== undefined) {
					pluginOptions[optionName] = o;
				}
			});
		}
		
		// let's merge the default options and the ones that were provided. We'd want
		// to do a deep copy but not let jQuery merge arrays, so we'll do a shallow
		// extend on two levels, that will be enough if options are not more than 1
		// level deep
		$.each(options, function(optionName, value) {
			
			if (pluginOptions[optionName] !== undefined) {
				
				if ((		typeof value == 'object'
						&&	!(value instanceof Array)
						&&	value != null
					)
					&&
					(		typeof pluginOptions[optionName] == 'object'
						&&	!(pluginOptions[optionName] instanceof Array)
						&&	pluginOptions[optionName] != null
					)
				) {
					$.extend(options[optionName], pluginOptions[optionName]);
				}
				else {
					options[optionName] = pluginOptions[optionName];
				}
			}
		});
		
		return options;
	}
791794
function parseAndroidPreferences(preferences, configData){
        var type = 'preference';

        _.each(preferences, function (preference) {
            // Extract pre-defined preferences (deprecated)
            var target,
                prefData;

            if(preference.attrib.name.match(/^android-manifest\//)){
                // Extract manifest Xpath preferences
                var parts = preference.attrib.name.split("/"),
                    destination = parts.pop();
                parts.shift();

                prefData = {
                    parent: parts.join("/") || "./",
                    type: type,
                    destination: destination,
                    data: preference
                };
                target = "AndroidManifest.xml";
            }

            if(prefData){
                if(!configData[target]) {
                    configData[target] = [];
                }
                configData[target].push(prefData);
            }
        });
    }
243728
private String getOldToken(Context appContext) {
        String jsonData = preferenceProvider.get(appContext).getString(String.format(REGISTRAR_PREFERENCE_TEMPLATE, senderId), "");
        if (jsonData.isEmpty()) {
            return "";
        }
        
        JsonObject jsonedPreferences = new JsonParser().parse(jsonData).getAsJsonObject();
        try {
            return jsonedPreferences.get("deviceToken").getAsString();
        } catch (Exception ignore) {
            //There was something wrong with the deviceToken or the jsonPreferences.  
            //This probably means that there isn't an oldToken.  Let's log and return an empty String
            Log.w(TAG, ignore.getMessage(), ignore);
            return "";
        }
        
    }
35589
function getDefaultPlugins (options) {
  var scope = Core.scope;
  var customNameFunc = options.generateScopedName;
  var defaultNameFunc = process.env.NODE_ENV === 'production' ?
      generateShortName :
      generateLongName;

  scope.generateScopedName = customNameFunc || defaultNameFunc;

  return [
    Core.values
    , Core.localByDefault
    , Core.extractImports
    , scope
  ];
}
266326
function getPlugins (options) {
  var plugins = options.use || options.u;
  if (!plugins) {
    plugins = getDefaultPlugins(options);
  }
  else {
    if (typeof plugins === 'string') {
      plugins = [plugins];
    }
  }

  var postcssBefore = options.postcssBefore || options.before || [];
  var postcssAfter = options.postcssAfter || options.after || [];
  plugins = (Array.isArray(postcssBefore) ? postcssBefore : [postcssBefore]).concat(plugins).concat(postcssAfter);

  // load plugins by name (if a string is used)
  return plugins.map(function requirePlugin (name) {
    // assume not strings are already required plugins
    if (typeof name !== 'string') {
      return name;
    }

    var plugin = module.parent.require(name);

    // custom scoped name generation
    if (name === 'postcss-modules-scope') {
      options[name] = options[name] || {};
      if (!options[name].generateScopedName) {
        options[name].generateScopedName = generateLongName;
      }
    }

    if (name in options) {
      plugin = plugin(options[name]);
    }
    else {
      plugin = plugin.postcss || plugin();
    }

    return plugin;
  });
}
1366387
function constructHostsList(xmlPreferences) {
  var hostsList = [];

  // look for defined hosts
  var xmlHostList = xmlPreferences['host'];
  if (xmlHostList == null || xmlHostList.length == 0) {
    return [];
  }

  xmlHostList.forEach(function(xmlElement) {
    var host = constructHostEntry(xmlElement);
    if (host) {
      hostsList.push(host);
    }
  });

  return hostsList;
}
1046778
function addAssociatedDomains(preferences) {
    const files = getEntitlementFiles(preferences);

    for (let i = 0; i < files.length; i++) {
      const file = files[i];
      let entitlements = getEntitlements(file);

      entitlements = updateEntitlements(entitlements, preferences);
      setEntitlements(file, entitlements);
    }
  }
921358
function jssPreset() {
  return {
    plugins: [
      functions(),
      global(),
      nested(),
      camelCase(),
      defaultUnit(),
      // Disable the vendor prefixer server-side, it does nothing.
      // This way, we can get a performance boost.
      // In the documentation, we are using `autoprefixer` to solve this problem.
      typeof window === 'undefined' ? null : vendorPrefixer(),
      propsSort(),
    ],
  };
}
698337
function activateUniversalLinksInAndroid(cordovaContext, pluginPreferences) {
  // inject preferenes into AndroidManifest.xml
  androidManifestWriter.writePreferences(cordovaContext, pluginPreferences);

  // generate html file with the <link> tags that you should inject on the website.
  androidWebHook.generate(cordovaContext, pluginPreferences);
}
249288
function writePreferences(cordovaContext, pluginPreferences) {
  var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'AndroidManifest.xml');
  var manifestSource = xmlHelper.readXmlAsJson(pathToManifest);
  var cleanManifest;
  var updatedManifest;

  // remove old intent-filters
  cleanManifest = removeOldOptions(manifestSource);

  // inject intent-filters based on plugin preferences
  updatedManifest = injectOptions(cleanManifest, pluginPreferences);

  // save new version of the AndroidManifest
  xmlHelper.writeJsonAsXml(updatedManifest, pathToManifest);
}