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A,GACA,uBAAyB,OAAO,KAAK,EAAQ,UAC7C,MAEG,EACD,QACA,GACC,EAAiB,IACjB,EAAiB,GAAa,UAE/B,KAAI,GAAe,KAAO,EAAiB,GAAa,WAEvD,EAAS,QAAQ,OAAS,GAC7B,EAAiB,KAChB,GACA,sCACA,EAAS,QAAQ,KAAI,GAAK,KAAO,KAG/B,QAAS,EAAQ,UACpB,EAAiB,KAAK,GAAI,IAQ5B,EAAO,IACN,iBAAiB,MAAQ,EAAiB,KAAK,SAAW,YAGvD,EAAe,OAAS,EAAG,CAE9B,EAAO,IAAI,iBAAiB,+BAAiC,IAG7D,IAAK,MAAM,KAAe,EAAgB,CACzC,MAAM,EAAS,QAAQ,gBAAgB,GAAa,MAAK,GACjD,EAAK,aAAe,SAAW,EAAK,aAAe,OAAS,EAAK,KAEpD,EAAiB,GAAa,MAAM,IAAI,UAE5D,EAAO,IAAI,kBAAkB,IAC7B,EAAO,IACN,QAAQ,qBACP,EACA,EAAQ,OAAS,MAAQ,QAG3B,EAAO,IACN,kBACC,EAAO,MAAK,IACX,GAAI,EACH,OAAO,EAAK,IAAM,EAAK,CACxB,OAKH,EAAO,IACN,QAAQ,qBACP,EACA,EAAQ,OAAS,MAAQ,OAI7B,CAEA,EAAO,IACN,iBACC,KACC,EACA,4HACA,GAGJ,MACM,EAAQ,QACZ,EAAO,IACN,iBACC,qEAMA,QAAS,EAAQ,UACpB,EAAO,IAAI,iBAAiB,kBAAoB,EAAc,UAG3D,EAAQ,UACX,EAAO,IACN,iBACC,YACC,EAAQ,SACR,oBACA,EAAQ,SACR,OAGJ,GACC,IAGI,EAAS,OAAS,EAAS,QAAQ,QAAQ,eAAe,GAClE,CArYA,OAAO,QAAU,CAChB,wBACA,kCACA,kCACA,sBACA,0BACA,oCACA","file":"/npm/polyfill-library@4.8.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/polyfill-library@4.8.0/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nconst toposort = require(\"toposort\").array;\nconst UA = require(\"@financial-times/polyfill-useragent-normaliser\");\nconst sources = require(\"./sources\");\nconst appVersion = require(\"../package.json\").version;\nconst streamFromPromise = require(\"stream-from-promise\");\nconst streamFromString = require(\"from2-string\");\nconst mergeStream = require(\"merge2\");\nconst streamToString = require(\"stream-to-string\");\nconst normalizeUserAgent = UA.normalize;\nconst LRUCache = require(\"mnemonist/lru-cache\");\nconst cache = new LRUCache(1000);\n\nmodule.exports = {\n\tlistAliases,\n\tlistAllPolyfills,\n\tdescribePolyfill,\n\tgetOptions,\n\tgetPolyfills,\n\tgetPolyfillString,\n\tnormalizeUserAgent\n};\n\n/**\n * Get a list of all the aliases which exist within the collection of polyfill sources.\n * @returns {Promise<Object>} A promise which resolves with an object mapping all the aliases within the collection to the polyfills they include.\n */\nfunction listAliases() {\n\treturn sources.listAliases();\n}\n\n/**\n * Get a list of all the polyfills which exist within the collection of polyfill sources.\n * @returns {Promise<Array>} A promise which resolves with an array of all the polyfills within the collection.\n */\nfunction listAllPolyfills() {\n\treturn sources.listPolyfills();\n}\n\n/**\n * Get the metadata for a specific polyfill within the collection of polyfill sources.\n * @param {String} featureName - The name of a polyfill whose metadata should be returned.\n * @returns {Promise<Object|undefined>} A promise which resolves with the metadata or with `undefined` if no metadata exists for the polyfill.\n */\nfunction describePolyfill(featureName) {\n\treturn sources.getPolyfillMeta(featureName);\n}\n\nfunction hasProperty(property, object) {\n\treturn Object.prototype.hasOwnProperty.call(object, property);\n}\n\n/**\n * Create an options object for use with `getPolyfills` or `getPolyfillString`.\n * @param {object} options_ - Valid keys are uaString, minify, unknown, excludes, rum and features.\n * @param {Boolean} [options_.minify=true] - Whether to return the minified or raw implementation of the polyfills.\n * @param {'ignore'|'polyfill'} [options_.unknown='polyfill'] - Whether to return all polyfills or no polyfills if the user-agent is unknown or unsupported.\n * @param {Object} [options_.features={}] - Which features should be returned if the user-agent does not support them natively.\n * @param {false|String} [options_.callback=false] - Name of the JavaScript function to call after the polyfill bundle is loaded.\n * @param {Array<String>} [options_.excludes=[]] - Which features should be excluded from the returned object.\n * @param {String} [options_.uaString=''] - The user-agent string to check each feature against.\n * @param {Boolean} [options_.rum=false] - Whether to add a script to the polyfill bundle which reports anonymous usage data\n * @return {Object} options - options_ merged with the defaults option values.\n */\nfunction getOptions(options_ = {}) {\n\tconst options = {\n\t\tcallback:\n\t\t\thasProperty(\"callback\", options_) &&\n\t\t\ttypeof options_.callback === \"string\" &&\n\t\t\t/^[\\w.]+$/.test(options_.callback)\n\t\t\t\t? options_.callback\n\t\t\t\t: false,\n\t\tuaString: hasProperty(\"uaString\", options_) ? options_.uaString : \"\",\n\t\tminify: hasProperty(\"minify\", options_) ? options_.minify : true,\n\t\tunknown: hasProperty(\"unknown\", options_) ? options_.unknown : \"polyfill\",\n\t\tfeatures: hasProperty(\"features\", options_) ? options_.features : {},\n\t\texcludes: hasProperty(\"excludes\", options_) ? options_.excludes : [],\n\t\trum: hasProperty(\"rum\", options_) ? options_.rum : false\n\t};\n\n\t// Normalise flags\n\tfor (const k of Object.keys(options.features)) {\n\t\tif (!options.features[k].flags) {\n\t\t\toptions.features[k].flags = new Set();\n\t\t} else if (options.features[k].flags.constructor !== Set) {\n\t\t\toptions.features[k].flags = new Set(options.features[k].flags);\n\t\t}\n\t}\n\n\treturn options;\n}\n\nfunction getNormalisedUA(uaString) {\n\tlet ua = cache.get(uaString);\n\tif (ua === undefined) {\n\t\tua = new UA(uaString);\n\t\tcache.set(uaString, ua);\n\t}\n\treturn ua;\n}\n\n/**\n * Given a set of features that should be polyfilled in 'options.features'\n * (with flags i.e. `{<featurename>: {flags:Set[<flaglist>]}, ...}`),\n * determine which have a configuration valid for the given options.uaString,\n * and return a promise of set of canonical (unaliased) features (with flags) and polyfills.\n *\n * @param {object} options_ - Valid keys are uaString, minify, unknown, excludes, rum and features.\n * @param {Boolean} [options_.minify=true] - Whether to return the minified or raw implementation of the polyfills.\n * @param {'ignore'|'polyfill'} [options_.unknown='polyfill'] - Whether to return all polyfills or no polyfills if the user-agent is unknown or unsupported.\n * @param {Object} [options_.features={}] - Which features should be returned if the user-agent does not support them natively.\n * @param {Array<String>} [options_.excludes=[]] - Which features should be excluded from the returned object.\n * @param {String} [options_.uaString=''] - The user-agent string to check each feature against.\n * @param {Boolean} [options_.rum=false] - Whether to add a script to the polyfill bundle which reports anonymous usage data.\n * @return {Promise<Object>} - Canonicalised feature definitions filtered for UA\n */\nasync function getPolyfills(options_) {\n\tconst options = getOptions(options_);\n\tlet ua = getNormalisedUA(options.uaString);\n\tconst featureNames = new Set(Object.keys(options.features));\n\tconst targetedFeatures = Object.create(null);\n\n\t/*\n\t\tA feature would be removed in these scenarios:\n\t\t- If it has been specified to be excluded from the bundle via the exlcudes option.\n\t\t- If the feature is not meant to be in the bundle it does not target the browser.\n\t\t\t\tTargeting a browser happens if the feature has the always option applied or\n\t\t\t\tthe browser is unsupported/unknown and the unknown option is set to polyfill\n\t\t\t\tor the browser version is within the semver range specified in the features config.toml file.\n\t*/\n\tfunction removeFeature(featureName) {\n\t\tfeatureNames.delete(featureName);\n\t\tif (targetedFeatures[featureName]) {\n\t\t\tdelete targetedFeatures[featureName];\n\t\t}\n\t}\n\n\tfunction addFeature(featureName, featureFlags, featureProperties) {\n\t\ttargetedFeatures[featureName] = Object.assign(Object.create(null), featureFlags, featureProperties);\n\t\tfeatureNames.add(featureName);\n\t}\n\n\tfor (const featureName of featureNames) {\n\t\t// Remove feature if it exists in the `excludes` array.\n\t\tif (options.excludes.includes(featureName)) {\n\t\t\tremoveFeature(featureName);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst feature = targetedFeatures[featureName] || options.features[featureName];\n\t\tconst properties = {\n\t\t\taliasOf: new Set((feature.aliasOf || [])),\n\t\t\tdependencyOf: new Set((feature.dependencyOf || [])),\n\t\t\tflags: new Set(feature.flags || [])\n\t\t};\n\n\t\t// If featureName is an alias for a group of features\n\t\t// Add each feature.\n\t\tconst alias = await sources.getConfigAliases(featureName);\n\t\tif (alias) {\n\t\t\tconst aliasProperties = {\n\t\t\t\taliasOf: new Set(properties.aliasOf),\n\t\t\t\tdependencyOf: new Set(properties.dependencyOf),\n\t\t\t\tflags: new Set(properties.flags)\n\t\t\t};\n\t\t\taliasProperties.aliasOf.add(featureName);\n\t\t\tfor (const aliasedFeature of alias) {\n\t\t\t\taddFeature(aliasedFeature, feature, aliasProperties);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If always flag is set, then the feature should be targeted at the browser.\n\t\tlet targeted = feature.flags.has(\"always\");\n\n\t\t// If not already targeted, then set targeted to true if the browser is unknown/unsupported\n\t\t// and the unknown option is set the serve polyfills.\n\t\tif (!targeted) {\n\t\t\tconst unknownOverride = options.unknown === \"polyfill\" && ua.isUnknown();\n\t\t\tif (unknownOverride) {\n\t\t\t\ttargeted = true;\n\t\t\t\tproperties.flags.add(\"gated\");\n\t\t\t}\n\t\t}\n\n\t\tconst meta = await sources.getPolyfillMeta(featureName);\n\t\tif (!meta) {\n\t\t\t// this is a bit strange but the best thing I could come up with.\n\t\t\t// by adding the feature, it will show up as an \"unrecognized\" polyfill\n\t\t\t// which I think is better than just pretending it doesn't exsist.\n\t\t\taddFeature(featureName);\n\t\t\tcontinue;\n\t\t}\n\t\t// If not already targeted, check to see if the polyfill's configuration states it should target\n\t\t// this browser version.\n\t\tif (!targeted) {\n\t\t\tconst isBrowserMatch = meta.browsers &&\n\t\t\t\tmeta.browsers[ua.getFamily()] &&\n\t\t\t\tua.satisfies(meta.browsers[ua.getFamily()]);\n\n\t\t\ttargeted = isBrowserMatch;\n\t\t}\n\n\t\tif (targeted) {\n\t\t\taddFeature(featureName, feature, properties);\n\t\t\tconst deps = meta.dependencies;\n\t\t\t// If feature has dependency then add the dependencies as well.\n\t\t\tif (deps) {\n\t\t\t\tconst dependencyProperties = {\n\t\t\t\t\taliasOf: new Set(properties.aliasOf),\n\t\t\t\t\tdependencyOf: new Set(properties.dependencyOf).add(featureName),\n\t\t\t\t\tflags: new Set(properties.flags)\n\t\t\t\t};\n\t\t\t\tfor (const dep of deps) {\n\t\t\t\t\taddFeature(dep, feature, dependencyProperties);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tremoveFeature(featureName);\n\t\t}\n\t}\n\treturn Promise.resolve(targetedFeatures);\n}\n\n/**\n * Create a polyfill bundle.\n * @param {object} options_ - Valid keys are uaString, minify, unknown, excludes, rum and features.\n * @param {Boolean} [options_.minify=true] - Whether to return the minified or raw implementation of the polyfills.\n * @param {'ignore'|'polyfill'} [options_.unknown='polyfill'] - Whether to return all polyfills or no polyfills if the user-agent is unknown or unsupported.\n * @param {Object} [options_.features={}] - Which features should be returned if the user-agent does not support them natively.\n * @param {Array<String>} [options_.excludes=[]] - Which features should be excluded from the returned object.\n * @param {String} [options_.uaString=''] - The user-agent string to check each feature against.\n * @param {Boolean} [options_.rum=false] - Whether to add a script to the polyfill bundle which reports anonymous usage data.\n * @param {Boolean} [options_.stream=false] - Whether to return a stream or a string of the polyfill bundle.\n * @return {Promise<String> | ReadStream} - Polyfill bundle as either a utf-8 stream or a promise of a utf-8 string.\n */\nfunction getPolyfillString(options_) {\n\tconst options = getOptions(options_);\n\tconst lf = options.minify ? \"\" : \"\\n\";\n\tconst allWarnText =\n\t\t\"Using the `all` alias with polyfill.io is a very bad idea. In a future version of the service, `all` will deliver the same behaviour as `default`, so we recommend using `default` instead.\";\n\tconst appVersionText = \"Polyfill service \" +\n\t\t(process.env.NODE_ENV === \"production\"\n\t\t\t? \"v\" + appVersion\n\t\t\t: \"DEVELOPMENT MODE - for live use set NODE_ENV to 'production'\")\n\tconst output = mergeStream();\n\tconst explainerComment = [];\n\t// Build a polyfill bundle of polyfill sources sorted in dependency order\n\tgetPolyfills(options).then(targetedFeatures => {\n\t\tconst warnings = {\n\t\t\tunknown: []\n\t\t};\n\t\tconst featureNodes = [];\n\t\tconst featureEdges = [];\n\n\t\tPromise.all(\n\t\t\tObject.keys(targetedFeatures).map(featureName => {\n\t\t\t\tconst feature = targetedFeatures[featureName];\n\t\t\t\treturn sources.getPolyfillMeta(featureName).then(polyfill => {\n\t\t\t\t\tif (!polyfill) {\n\t\t\t\t\t\twarnings.unknown.push(featureName);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfeatureNodes.push(featureName);\n\n\t\t\t\t\t\tif (polyfill.dependencies) {\n\t\t\t\t\t\t\tfor (const depName of polyfill.dependencies) {\n\t\t\t\t\t\t\t\tif (depName in targetedFeatures) {\n\t\t\t\t\t\t\t\t\tfeatureEdges.push([depName, featureName]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfeature.comment =\n\t\t\t\t\t\t\tfeatureName +\n\t\t\t\t\t\t\t\", License: \" +\n\t\t\t\t\t\t\t(polyfill.license || \"CC0\") +\n\t\t\t\t\t\t\t(feature.dependencyOf.size || feature.aliasOf.size\n\t\t\t\t\t\t\t\t? ' (required by \"' +\n\t\t\t\t\t\t\t\t\t[...feature.dependencyOf, ...feature.aliasOf].join('\", \"') +\n\t\t\t\t\t\t\t\t\t'\")'\n\t\t\t\t\t\t\t\t: \"\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t})\n\t\t).then(() => {\n\t\t\t// Sort the features alphabetically, so ones with no dependencies\n\t\t\t// turn up in the same order\n\t\t\tfeatureNodes.sort((a, b) => a.localeCompare(b));\n\t\t\tfeatureEdges.sort(([, a], [, b]) => a.localeCompare(b));\n\n\t\t\tconst sortedFeatures = toposort(featureNodes, featureEdges);\n\n\t\t\tif (!options.minify) {\n\t\t\t\texplainerComment.push(\n\t\t\t\t\tappVersionText,\n\t\t\t\t\t\"For detailed credits and licence information see https://github.com/financial-times/polyfill-service.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Features requested: \" + Object.keys(options.features),\n\t\t\t\t\t\"\"\n\t\t\t\t,\n\t\t\t\t\t...sortedFeatures\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\tfeatureName =>\n\t\t\t\t\t\t\t\ttargetedFeatures[featureName] &&\n\t\t\t\t\t\t\t\ttargetedFeatures[featureName].comment\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.map(featureName => \"- \" + targetedFeatures[featureName].comment)\n\t\t\t\t);\n\t\t\t\tif (warnings.unknown.length > 0) {\n\t\t\t\t\texplainerComment.push(\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\"These features were not recognised:\",\n\t\t\t\t\t\twarnings.unknown.map(s => \"- \" + s)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (\"all\" in options.features) {\n\t\t\t\t\texplainerComment.push(\"\", allWarnText);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\texplainerComment.push(\n\t\t\t\t\tappVersionText,\n\t\t\t\t\t\"Disable minification (remove `.min` from URL path) for more info\"\n\t\t\t\t);\n\t\t\t}\n\t\t\toutput.add(\n\t\t\t\tstreamFromString(\"/* \" + explainerComment.join(\"\\n * \") + \" */\\n\\n\")\n\t\t\t);\n\n\t\t\tif (sortedFeatures.length > 0) {\n\t\t\t\t// Outer closure hides private features from global scope\n\t\t\t\toutput.add(streamFromString(\"(function(self, undefined) {\" + lf));\n\n\t\t\t\t// Using the graph, stream all the polyfill sources in dependency order\n\t\t\t\tfor (const featureName of sortedFeatures) {\n\t\t\t\t\tconst detect = sources.getPolyfillMeta(featureName).then(meta => {\n\t\t\t\t\t\treturn meta.detectSource ? \"if (!(\" + meta.detectSource + \")) {\" + lf : \"\";\n\t\t\t\t\t});\n\t\t\t\t\tconst wrapInDetect = targetedFeatures[featureName].flags.has(\"gated\");\n\t\t\t\t\tif (wrapInDetect) {\n\t\t\t\t\t\toutput.add(streamFromPromise(detect));\n\t\t\t\t\t\toutput.add(\n\t\t\t\t\t\t\tsources.streamPolyfillSource(\n\t\t\t\t\t\t\t\tfeatureName,\n\t\t\t\t\t\t\t\toptions.minify ? \"min\" : \"raw\"\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\toutput.add(\n\t\t\t\t\t\t\tstreamFromPromise(\n\t\t\t\t\t\t\t\tdetect.then(wrap => {\n\t\t\t\t\t\t\t\t\tif (wrap) {\n\t\t\t\t\t\t\t\t\t\treturn lf + \"}\" + lf + lf;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutput.add(\n\t\t\t\t\t\t\tsources.streamPolyfillSource(\n\t\t\t\t\t\t\t\tfeatureName,\n\t\t\t\t\t\t\t\toptions.minify ? \"min\" : \"raw\"\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invoke the closure, passing the global object as the only argument\n\t\t\t\toutput.add(\n\t\t\t\t\tstreamFromString(\n\t\t\t\t\t\t\"})\" +\n\t\t\t\t\t\t\tlf +\n\t\t\t\t\t\t\t\"('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\" +\n\t\t\t\t\t\t\tlf\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (!options.minify) {\n\t\t\t\t\toutput.add(\n\t\t\t\t\t\tstreamFromString(\n\t\t\t\t\t\t\t\"\\n/* No polyfills needed for current settings and browser */\\n\\n\"\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\"all\" in options.features) {\n\t\t\t\toutput.add(streamFromString(\"\\nconsole.log('\" + allWarnText + \"');\\n\"));\n\t\t\t}\n\n\t\t\tif (options.callback) {\n\t\t\t\toutput.add(\n\t\t\t\t\tstreamFromString(\n\t\t\t\t\t\t\"\\ntypeof \" +\n\t\t\t\t\t\t\toptions.callback +\n\t\t\t\t\t\t\t\"==='function' && \" +\n\t\t\t\t\t\t\toptions.callback +\n\t\t\t\t\t\t\t\"();\"\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n\n\treturn options_.stream ? output : Promise.resolve(streamToString(output));\n}\n"]}