{"version":3,"file":"es-module-shims.js","sources":["../dist/es-module-shims.js"],"sourcesContent":["/* ES Module Shims 1.3.6 */\n(function () {\n\n const edge = navigator.userAgent.match(/Edge\\/\\d\\d\\.\\d+$/);\r\n\r\n let baseUrl;\r\n\r\n function createBlob (source, type = 'text/javascript') {\r\n return URL.createObjectURL(new Blob([source], { type }));\r\n }\r\n\r\n const noop = () => {};\r\n\r\n const baseEl = document.querySelector('base[href]');\r\n if (baseEl)\r\n baseUrl = baseEl.href;\r\n\r\n if (!baseUrl && typeof location !== 'undefined') {\r\n baseUrl = location.href.split('#')[0].split('?')[0];\r\n const lastSepIndex = baseUrl.lastIndexOf('/');\r\n if (lastSepIndex !== -1)\r\n baseUrl = baseUrl.slice(0, lastSepIndex + 1);\r\n }\r\n\r\n function isURL (url) {\r\n try {\r\n new URL(url);\r\n return true;\r\n }\r\n catch {\r\n return false;\r\n }\r\n }\r\n\r\n const backslashRegEx = /\\\\/g;\r\n function resolveIfNotPlainOrUrl (relUrl, parentUrl) {\r\n // strip off any trailing query params or hashes\r\n parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];\r\n if (relUrl.indexOf('\\\\') !== -1)\r\n relUrl = relUrl.replace(backslashRegEx, '/');\r\n // protocol-relative\r\n if (relUrl[0] === '/' && relUrl[1] === '/') {\r\n return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;\r\n }\r\n // relative-url\r\n else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||\r\n relUrl.length === 1 && (relUrl += '/')) ||\r\n relUrl[0] === '/') {\r\n const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);\r\n // Disabled, but these cases will give inconsistent results for deep backtracking\r\n //if (parentUrl[parentProtocol.length] !== '/')\r\n // throw new Error('Cannot resolve');\r\n // read pathname from parent URL\r\n // pathname taken to be part after leading \"/\"\r\n let pathname;\r\n if (parentUrl[parentProtocol.length + 1] === '/') {\r\n // resolving to a :// so we need to read out the auth and host\r\n if (parentProtocol !== 'file:') {\r\n pathname = parentUrl.slice(parentProtocol.length + 2);\r\n pathname = pathname.slice(pathname.indexOf('/') + 1);\r\n }\r\n else {\r\n pathname = parentUrl.slice(8);\r\n }\r\n }\r\n else {\r\n // resolving to :/ so pathname is the /... part\r\n pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));\r\n }\r\n\r\n if (relUrl[0] === '/')\r\n return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;\r\n\r\n // join together and split for removal of .. and . segments\r\n // looping the string instead of anything fancy for perf reasons\r\n // '../../../../../z' resolved to 'x/y' is just 'z'\r\n const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;\r\n\r\n const output = [];\r\n let segmentIndex = -1;\r\n for (let i = 0; i < segmented.length; i++) {\r\n // busy reading a segment - only terminate on '/'\r\n if (segmentIndex !== -1) {\r\n if (segmented[i] === '/') {\r\n output.push(segmented.slice(segmentIndex, i + 1));\r\n segmentIndex = -1;\r\n }\r\n }\r\n\r\n // new segment - check if it is relative\r\n else if (segmented[i] === '.') {\r\n // ../ segment\r\n if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {\r\n output.pop();\r\n i += 2;\r\n }\r\n // ./ segment\r\n else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {\r\n i += 1;\r\n }\r\n else {\r\n // the start of a new segment as below\r\n segmentIndex = i;\r\n }\r\n }\r\n // it is the start of a new segment\r\n else {\r\n segmentIndex = i;\r\n }\r\n }\r\n // finish reading out the last segment\r\n if (segmentIndex !== -1)\r\n output.push(segmented.slice(segmentIndex));\r\n return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');\r\n }\r\n }\r\n\r\n /*\r\n * Import maps implementation\r\n *\r\n * To make lookups fast we pre-resolve the entire import map\r\n * and then match based on backtracked hash lookups\r\n *\r\n */\r\n function resolveUrl (relUrl, parentUrl) {\r\n return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));\r\n }\r\n\r\n function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {\r\n for (let p in packages) {\r\n const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;\r\n if (outPackages[resolvedLhs]) {\r\n throw new Error(`Dynamic import map rejected: Overrides entry \"${resolvedLhs}\" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);\r\n }\r\n let target = packages[p];\r\n if (typeof target !== 'string') \r\n continue;\r\n const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);\r\n if (mapped) {\r\n outPackages[resolvedLhs] = mapped;\r\n continue;\r\n }\r\n targetWarning(p, packages[p], 'bare specifier did not resolve');\r\n }\r\n }\r\n\r\n function resolveAndComposeImportMap (json, baseUrl, parentMap) {\r\n const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };\r\n\r\n if (json.imports)\r\n resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);\r\n\r\n if (json.scopes)\r\n for (let s in json.scopes) {\r\n const resolvedScope = resolveUrl(s, baseUrl);\r\n resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);\r\n }\r\n\r\n return outMap;\r\n }\r\n\r\n function getMatch (path, matchObj) {\r\n if (matchObj[path])\r\n return path;\r\n let sepIndex = path.length;\r\n do {\r\n const segment = path.slice(0, sepIndex + 1);\r\n if (segment in matchObj)\r\n return segment;\r\n } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)\r\n }\r\n\r\n function applyPackages (id, packages) {\r\n const pkgName = getMatch(id, packages);\r\n if (pkgName) {\r\n const pkg = packages[pkgName];\r\n if (pkg === null) return;\r\n if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')\r\n targetWarning(pkgName, pkg, \"should have a trailing '/'\");\r\n else\r\n return pkg + id.slice(pkgName.length);\r\n }\r\n }\r\n\r\n function targetWarning (match, target, msg) {\r\n console.warn(\"Package target \" + msg + \", resolving target '\" + target + \"' for \" + match);\r\n }\r\n\r\n function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {\r\n let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);\r\n while (scopeUrl) {\r\n const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);\r\n if (packageResolution)\r\n return packageResolution;\r\n scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);\r\n }\r\n return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;\r\n }\n\n const optionsScript = document.querySelector('script[type=esms-options]');\r\n\r\n const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : self.esmsInitOptions ? self.esmsInitOptions : {};\r\n\r\n let shimMode = !!esmsInitOptions.shimMode;\r\n const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);\r\n\r\n const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;\r\n\r\n let nonce = esmsInitOptions.nonce;\r\n\r\n if (!nonce) {\r\n const nonceElement = document.querySelector('script[nonce]');\r\n if (nonceElement)\r\n nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');\r\n }\r\n\r\n const onerror = globalHook(esmsInitOptions.onerror || noop);\r\n const onpolyfill = globalHook(esmsInitOptions.onpolyfill || noop);\r\n\r\n const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions;\r\n\r\n const fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;\r\n\r\n function globalHook (name) {\r\n return typeof name === 'string' ? self[name] : name;\r\n }\r\n\r\n const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];\r\n const cssModulesEnabled = enable.includes('css-modules');\r\n const jsonModulesEnabled = enable.includes('json-modules');\r\n\r\n function setShimMode () {\r\n shimMode = true;\r\n }\n\n let err;\r\n window.addEventListener('error', _err => err = _err);\r\n function dynamicImportScript (url, { errUrl = url } = {}) {\r\n err = undefined;\r\n const src = createBlob(`import*as m from'${url}';self._esmsi=m`);\r\n const s = Object.assign(document.createElement('script'), { type: 'module', src });\r\n s.setAttribute('nonce', nonce);\r\n s.setAttribute('noshim', '');\r\n const p = new Promise((resolve, reject) => {\r\n // Safari is unique in supporting module script error events\r\n s.addEventListener('error', cb);\r\n s.addEventListener('load', cb);\r\n\r\n function cb (_err) {\r\n document.head.removeChild(s);\r\n if (self._esmsi) {\r\n resolve(self._esmsi, baseUrl);\r\n self._esmsi = undefined;\r\n }\r\n else {\r\n reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading or executing the graph of ${errUrl} (check the console for ${src}).`));\r\n err = undefined;\r\n }\r\n }\r\n });\r\n document.head.appendChild(s);\r\n return p;\r\n }\r\n\r\n let dynamicImport = dynamicImportScript;\r\n\r\n const supportsDynamicImportCheck = dynamicImportScript(createBlob('export default u=>import(u)')).then(_dynamicImport => {\r\n if (_dynamicImport)\r\n dynamicImport = _dynamicImport.default;\r\n return !!_dynamicImport;\r\n }, noop);\n\n // support browsers without dynamic import support (eg Firefox 6x)\r\n let supportsJsonAssertions = false;\r\n let supportsCssAssertions = false;\r\n\r\n let supportsImportMeta = false;\r\n let supportsImportMaps = false;\r\n\r\n let supportsDynamicImport = false;\r\n\r\n const featureDetectionPromise = Promise.resolve(supportsDynamicImportCheck).then(_supportsDynamicImport => {\r\n if (!_supportsDynamicImport)\r\n return;\r\n supportsDynamicImport = true;\r\n\r\n return Promise.all([\r\n dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),\r\n cssModulesEnabled && dynamicImport(createBlob('import\"data:text/css,{}\"assert{type:\"css\"}')).then(() => supportsCssAssertions = true, noop),\r\n jsonModulesEnabled && dynamicImport(createBlob('import\"data:text/json,{}\"assert{type:\"json\"}')).then(() => supportsJsonAssertions = true, noop),\r\n new Promise(resolve => {\r\n self._$s = v => {\r\n document.head.removeChild(iframe);\r\n if (v) supportsImportMaps = true;\r\n delete self._$s;\r\n resolve();\r\n };\r\n const iframe = document.createElement('iframe');\r\n iframe.style.display = 'none';\r\n document.head.appendChild(iframe);\r\n iframe.src = createBlob(`