es-module-shims.wasm.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. /* ES Module Shims Wasm 1.4.7 */
  2. (function () {
  3. const noop = () => {};
  4. const optionsScript = document.querySelector('script[type=esms-options]');
  5. const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : self.esmsInitOptions ? self.esmsInitOptions : {};
  6. let shimMode = !!esmsInitOptions.shimMode;
  7. const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
  8. const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
  9. let nonce = esmsInitOptions.nonce;
  10. const mapOverrides = esmsInitOptions.mapOverrides;
  11. if (!nonce) {
  12. const nonceElement = document.querySelector('script[nonce]');
  13. if (nonceElement)
  14. nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
  15. }
  16. const onerror = globalHook(esmsInitOptions.onerror || noop);
  17. const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => console.info(`OK: ^ TypeError module failure has been polyfilled`);
  18. const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions;
  19. const fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
  20. function globalHook (name) {
  21. return typeof name === 'string' ? self[name] : name;
  22. }
  23. const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
  24. const cssModulesEnabled = enable.includes('css-modules');
  25. const jsonModulesEnabled = enable.includes('json-modules');
  26. function setShimMode () {
  27. shimMode = true;
  28. }
  29. const edge = !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
  30. const baseUrl = document.baseURI;
  31. function createBlob (source, type = 'text/javascript') {
  32. return URL.createObjectURL(new Blob([source], { type }));
  33. }
  34. const eoop = err => setTimeout(() => { throw err });
  35. const throwError = err => { (window.reportError || window.safari && console.error || eoop)(err), void onerror(err); };
  36. function isURL (url) {
  37. try {
  38. new URL(url);
  39. return true;
  40. }
  41. catch (_) {
  42. return false;
  43. }
  44. }
  45. const backslashRegEx = /\\/g;
  46. /*
  47. * Import maps implementation
  48. *
  49. * To make lookups fast we pre-resolve the entire import map
  50. * and then match based on backtracked hash lookups
  51. *
  52. */
  53. function resolveUrl (relUrl, parentUrl) {
  54. return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
  55. }
  56. function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
  57. // strip off any trailing query params or hashes
  58. parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];
  59. if (relUrl.indexOf('\\') !== -1)
  60. relUrl = relUrl.replace(backslashRegEx, '/');
  61. // protocol-relative
  62. if (relUrl[0] === '/' && relUrl[1] === '/') {
  63. return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
  64. }
  65. // relative-url
  66. else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
  67. relUrl.length === 1 && (relUrl += '/')) ||
  68. relUrl[0] === '/') {
  69. const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
  70. // Disabled, but these cases will give inconsistent results for deep backtracking
  71. //if (parentUrl[parentProtocol.length] !== '/')
  72. // throw new Error('Cannot resolve');
  73. // read pathname from parent URL
  74. // pathname taken to be part after leading "/"
  75. let pathname;
  76. if (parentUrl[parentProtocol.length + 1] === '/') {
  77. // resolving to a :// so we need to read out the auth and host
  78. if (parentProtocol !== 'file:') {
  79. pathname = parentUrl.slice(parentProtocol.length + 2);
  80. pathname = pathname.slice(pathname.indexOf('/') + 1);
  81. }
  82. else {
  83. pathname = parentUrl.slice(8);
  84. }
  85. }
  86. else {
  87. // resolving to :/ so pathname is the /... part
  88. pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
  89. }
  90. if (relUrl[0] === '/')
  91. return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
  92. // join together and split for removal of .. and . segments
  93. // looping the string instead of anything fancy for perf reasons
  94. // '../../../../../z' resolved to 'x/y' is just 'z'
  95. const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
  96. const output = [];
  97. let segmentIndex = -1;
  98. for (let i = 0; i < segmented.length; i++) {
  99. // busy reading a segment - only terminate on '/'
  100. if (segmentIndex !== -1) {
  101. if (segmented[i] === '/') {
  102. output.push(segmented.slice(segmentIndex, i + 1));
  103. segmentIndex = -1;
  104. }
  105. continue;
  106. }
  107. // new segment - check if it is relative
  108. else if (segmented[i] === '.') {
  109. // ../ segment
  110. if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
  111. output.pop();
  112. i += 2;
  113. continue;
  114. }
  115. // ./ segment
  116. else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
  117. i += 1;
  118. continue;
  119. }
  120. }
  121. // it is the start of a new segment
  122. while (segmented[i] === '/') i++;
  123. segmentIndex = i;
  124. }
  125. // finish reading out the last segment
  126. if (segmentIndex !== -1)
  127. output.push(segmented.slice(segmentIndex));
  128. return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
  129. }
  130. }
  131. function resolveAndComposeImportMap (json, baseUrl, parentMap) {
  132. const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
  133. if (json.imports)
  134. resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
  135. if (json.scopes)
  136. for (let s in json.scopes) {
  137. const resolvedScope = resolveUrl(s, baseUrl);
  138. resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
  139. }
  140. return outMap;
  141. }
  142. function getMatch (path, matchObj) {
  143. if (matchObj[path])
  144. return path;
  145. let sepIndex = path.length;
  146. do {
  147. const segment = path.slice(0, sepIndex + 1);
  148. if (segment in matchObj)
  149. return segment;
  150. } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
  151. }
  152. function applyPackages (id, packages) {
  153. const pkgName = getMatch(id, packages);
  154. if (pkgName) {
  155. const pkg = packages[pkgName];
  156. if (pkg === null) return;
  157. return pkg + id.slice(pkgName.length);
  158. }
  159. }
  160. function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
  161. let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
  162. while (scopeUrl) {
  163. const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
  164. if (packageResolution)
  165. return packageResolution;
  166. scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
  167. }
  168. return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
  169. }
  170. function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
  171. for (let p in packages) {
  172. const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
  173. if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
  174. throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
  175. }
  176. let target = packages[p];
  177. if (typeof target !== 'string')
  178. continue;
  179. const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
  180. if (mapped) {
  181. outPackages[resolvedLhs] = mapped;
  182. continue;
  183. }
  184. console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
  185. }
  186. }
  187. let supportsDynamicImportCheck = false;
  188. let dynamicImport;
  189. try {
  190. dynamicImport = (0, eval)('u=>import(u)');
  191. supportsDynamicImportCheck = true;
  192. }
  193. catch (e) {}
  194. if (!supportsDynamicImportCheck) {
  195. let err;
  196. window.addEventListener('error', _err => err = _err);
  197. dynamicImport = (url, { errUrl = url }) => {
  198. err = undefined;
  199. const src = createBlob(`import*as m from'${url}';self._esmsi=m;`);
  200. const s = Object.assign(document.createElement('script'), { type: 'module', src });
  201. s.setAttribute('noshim', '');
  202. s.setAttribute('nonce', nonce);
  203. document.head.appendChild(s);
  204. return new Promise((resolve, reject) => {
  205. s.addEventListener('load', () => {
  206. document.head.removeChild(s);
  207. if (self._esmsi) {
  208. resolve(self._esmsi, baseUrl);
  209. self._esmsi = null;
  210. }
  211. else {
  212. reject(err.error || new Error(`Error loading or executing the graph of ${errUrl} (check the console for ${src}).`));
  213. err = undefined;
  214. }
  215. });
  216. });
  217. };
  218. }
  219. // support browsers without dynamic import support (eg Firefox 6x)
  220. let supportsJsonAssertions = false;
  221. let supportsCssAssertions = false;
  222. let supportsImportMeta = false;
  223. let supportsImportMaps = false;
  224. let supportsDynamicImport = false;
  225. const featureDetectionPromise = Promise.resolve(supportsDynamicImportCheck).then(_supportsDynamicImport => {
  226. if (!_supportsDynamicImport)
  227. return;
  228. supportsDynamicImport = true;
  229. return Promise.all([
  230. dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),
  231. cssModulesEnabled && dynamicImport(createBlob('import"data:text/css,{}"assert{type:"css"}')).then(() => supportsCssAssertions = true, noop),
  232. jsonModulesEnabled && dynamicImport(createBlob('import"data:text/json,{}"assert{type:"json"}')).then(() => supportsJsonAssertions = true, noop),
  233. new Promise(resolve => {
  234. self._$s = v => {
  235. document.head.removeChild(iframe);
  236. if (v) supportsImportMaps = true;
  237. delete self._$s;
  238. resolve();
  239. };
  240. const iframe = document.createElement('iframe');
  241. iframe.style.display = 'none';
  242. iframe.srcdoc = `<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`;
  243. document.head.appendChild(iframe);
  244. })
  245. ]);
  246. });
  247. /* es-module-lexer 0.10.0 */
  248. const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!C)return init.then(()=>parse(E));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const D=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,D,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const w=[],J=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let D;C.ip()&&(D=k(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),w.push({n:D,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=E.slice(C.es(),C.ee()),Q=A[0];J.push('"'===Q||"'"===Q?k(A):A);}function k(A){try{return (0,eval)(A)}catch(A){}}return [w,J,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAn9/AGAAAX9gAABgAX8AYAN/f38Bf2ACf38BfwMqKQABAgMDAwMDAwMDAwMDAwMAAAQEBAUEBQAAAAAEBAAGBwACAAAABwMGBAUBcAEBAQUDAQABBg8CfwFBkPIAC38AQZDyAAsHZBEGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJhaQAIAmlkAAkCaXAACgJlcwALAmVlAAwCcmkADQJyZQAOAWYADwVwYXJzZQAQC19faGVhcF9iYXNlAwEK/jMpaAEBf0EAIAA2AtQJQQAoArAJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgLYCUEAIAA2AtwJQQBBADYCtAlBAEEANgLECUEAQQA2ArwJQQBBADYCuAlBAEEANgLMCUEAQQA2AsAJIAELnwEBA39BACgCxAkhBEEAQQAoAtwJIgU2AsQJQQAgBDYCyAlBACAFQSBqNgLcCSAEQRxqQbQJIAQbIAU2AgBBACgCqAkhBEEAKAKkCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGGyAEIANGGzYCDCAFIAM2AhQgBUEANgIQIAUgAjYCBCAFQQA2AhwgBUEAKAKkCSADRjoAGAtIAQF/QQAoAswJIgJBCGpBuAkgAhtBACgC3AkiAjYCAEEAIAI2AswJQQAgAkEMajYC3AkgAkEANgIIIAIgATYCBCAC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NACACQSlHDQFBACgC/AlBAC8B6glBAnRqKAIAEBlFDQEMAgtBACgC/AlBAC8B6gkiA0ECdGooAgAQGg0BIAFBgBBqIANqLQAADQELIAQQGw0AIAJFDQBBASEEIAJBL0ZBAC0A9AlBAEdxRQ0BCxAcQQAhBAtBACAEOgD0CQwEC0EALwHsCUH//wNGQQAvAeoJRXFBAC0A0AlFcSEDDAYLEB1BACEDDAULIARBoAFHDQELQQBBAToAhAoLQQBBACgCiAo2AvAJC0EAKAKICiECDAALCyABQYDaAGokACADCx0AAkBBACgCsAkgAEcNAEEBDwsgAEF+ai8BABAeC6YGAQR/QQBBACgCiAoiAEEMaiIBNgKICkEBECEhAgJAAkACQAJAAkBBACgCiAoiAyABRw0AIAIQJUUNAQsCQAJAAkACQAJAIAJBn39qDgwGAQMIAQcBAQEBAQQACwJAAkAgAkEqRg0AIAJB9gBGDQUgAkH7AEcNAkEAIANBAmo2AogKQQEQISEDQQAoAogKIQEDQAJAAkAgA0H//wNxIgJBIkYNACACQSdGDQAgAhAkGkEAKAKICiECDAELIAIQF0EAQQAoAogKQQJqIgI2AogKC0EBECEaAkAgASACECYiA0EsRw0AQQBBACgCiApBAmo2AogKQQEQISEDC0EAKAKICiECAkAgA0H9AEYNACACIAFGDQUgAiEBIAJBACgCjApNDQEMBQsLQQAgAkECajYCiAoMAQtBACADQQJqNgKICkEBECEaQQAoAogKIgIgAhAmGgtBARAhIQILQQAoAogKIQMCQCACQeYARw0AIANBAmpBnghBBhAoDQBBACADQQhqNgKICiAAQQEQIRAiDwtBACADQX5qNgKICgwDCxAdDwsCQCADKQACQuyAhIOwjsA5Ug0AIAMvAQoQHkUNAEEAIANBCmo2AogKQQEQISECQQAoAogKIQMgAhAkGiADQQAoAogKEAJBAEEAKAKICkF+ajYCiAoPC0EAIANBBGoiAzYCiAoLQQAgA0EEaiICNgKICkEAQQA6AOQJA0BBACACQQJqNgKICkEBECEhA0EAKAKICiECAkAgAxAkQSByQfsARw0AQQBBACgCiApBfmo2AogKDwtBACgCiAoiAyACRg0BIAIgAxACAkBBARAhIgJBLEYNAAJAIAJBPUcNAEEAQQAoAogKQX5qNgKICg8LQQBBACgCiApBfmo2AogKDwtBACgCiAohAgwACwsPC0EAIANBCmo2AogKQQEQIRpBACgCiAohAwtBACADQRBqNgKICgJAQQEQISICQSpHDQBBAEEAKAKICkECajYCiApBARAhIQILQQAoAogKIQMgAhAkGiADQQAoAogKEAJBAEEAKAKICkF+ajYCiAoPCyADIANBDmoQAgurBgEEf0EAQQAoAogKIgBBDGoiATYCiAoCQAJAAkACQAJAAkACQAJAAkACQEEBECEiAkFZag4IAggBAgEBAQcACyACQSJGDQEgAkH7AEYNAgtBACgCiAogAUYNBwtBAC8B6gkNAUEAKAKICiECQQAoAowKIQMDQCACIANPDQQCQAJAIAIvAQAiAUEnRg0AIAFBIkcNAQsgACABECIPC0EAIAJBAmoiAjYCiAoMAAsLQQAoAogKIQJBAC8B6gkNAQJAA0ACQAJAAkAgAkEAKAKMCk8NAEEBECEiAkEiRg0BIAJBJ0YNASACQf0ARw0CQQBBACgCiApBAmo2AogKC0EBECEaQQAoAogKIgIpAABC5oDIg/CNwDZSDQZBACACQQhqNgKICkEBECEiAkEiRg0DIAJBJ0YNAwwGCyACEBcLQQBBACgCiApBAmoiAjYCiAoMAAsLIAAgAhAiDAULQQBBACgCiApBfmo2AogKDwtBACACQX5qNgKICg8LEB0PC0EAQQAoAogKQQJqNgKICkEBECFB7QBHDQFBACgCiAoiAkECakGWCEEGECgNAUEAKALwCS8BAEEuRg0BIAAgACACQQhqQQAoAqgJEAEPC0EAKAL8CUEALwHqCSICQQJ0akEAKAKICjYCAEEAIAJBAWo7AeoJQQAoAvAJLwEAQS5GDQBBAEEAKAKICiIBQQJqNgKICkEBECEhAiAAQQAoAogKQQAgARABQQBBAC8B6AkiAUEBajsB6AlBACgCgAogAUECdGpBACgCxAk2AgACQCACQSJGDQAgAkEnRg0AQQBBACgCiApBfmo2AogKDwsgAhAXQQBBACgCi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QAhAkEAQQAoAogKIgBBAmo2AogKIAAvAQIiAA0ADAILCyAAIQILIAJB//8DcQtoAQJ/QQEhAQJAAkAgAEFfaiICQQVLDQBBASACdEExcQ0BCyAAQfj/A3FBKEYNACAAQUZqQf//A3FBBkkNAAJAIABBpX9qIgJBA0sNACACQQFHDQELIABBhX9qQf//A3FBBEkhAQsgAQuLAQECfwJAQQAoAogKIgIvAQAiA0HhAEcNAEEAIAJBBGo2AogKQQEQISECQQAoAogKIQACQAJAIAJBIkYNACACQSdGDQAgAhAkGkEAKAKICiEBDAELIAIQF0EAQQAoAogKQQJqIgE2AogKC0EBECEhA0EAKAKICiECCwJAIAIgAEYNACAAIAEQAgsgAwtyAQR/QQAoAogKIQBBACgCjAohAQJAAkADQCAAQQJqIQIgACABTw0BAkACQCACLwEAIgNBpH9qDgIBBAALIAIhACADQXZqDgQCAQECAQsgAEEEaiEADAALC0EAIAI2AogKEB1BAA8LQQAgAjYCiApB3QALSQEDf0EAIQMCQCACRQ0AAkADQCAALQAAIgQgAS0AACIFRw0BIAFBAWohASAAQQFqIQAgAkF/aiICDQAMAgsLIAQgBWshAwsgAwsLwgECAEGACAukAQAAeABwAG8AcgB0AG0AcABvAHIAdABlAHQAYQBmAHIAbwBtAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBpAG4AcwB0AGEAbgB0AHkAcgBlAHQAdQByAGQAZQBiAHUAZwBnAGUAYQB3AGEAaQB0AGgAcgB3AGgAaQBsAGUAZgBvAHIAaQBmAGMAYQB0AGMAZgBpAG4AYQBsAGwAZQBsAHMAAEGkCQsQAQAAAAIAAAAABAAAEDkAAA==","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),A=>A.charCodeAt(0)))).then(WebAssembly.instantiate).then(({exports:A})=>{C=A;});var E;
  249. async function defaultResolve (id, parentUrl) {
  250. return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl);
  251. }
  252. async function _resolve (id, parentUrl) {
  253. const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
  254. return {
  255. r: resolveImportMap(importMap, urlResolved || id, parentUrl),
  256. // b = bare specifier
  257. b: !urlResolved && !isURL(id)
  258. };
  259. }
  260. const resolve = resolveHook ? async (id, parentUrl) => ({ r: await resolveHook(id, parentUrl, defaultResolve), b: false }) : _resolve;
  261. const registry = {};
  262. async function loadAll (load, seen) {
  263. if (load.b || seen[load.u])
  264. return;
  265. seen[load.u] = 1;
  266. await load.L;
  267. await Promise.all(load.d.map(dep => loadAll(dep, seen)));
  268. if (!load.n)
  269. load.n = load.d.some(dep => dep.n);
  270. }
  271. let importMap = { imports: {}, scopes: {} };
  272. let importMapSrcOrLazy = false;
  273. let baselinePassthrough;
  274. const initPromise = featureDetectionPromise.then(() => {
  275. // shim mode is determined on initialization, no late shim mode
  276. if (!shimMode) {
  277. if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
  278. setShimMode();
  279. }
  280. else {
  281. let seenScript = false;
  282. for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
  283. if (!seenScript) {
  284. if (script.type === 'module')
  285. seenScript = true;
  286. }
  287. else if (script.type === 'importmap') {
  288. importMapSrcOrLazy = true;
  289. break;
  290. }
  291. }
  292. }
  293. }
  294. baselinePassthrough = supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false;
  295. if (shimMode || !baselinePassthrough) {
  296. new MutationObserver(mutations => {
  297. for (const mutation of mutations) {
  298. if (mutation.type !== 'childList') continue;
  299. for (const node of mutation.addedNodes) {
  300. if (node.tagName === 'SCRIPT') {
  301. if (node.type === (shimMode ? 'module-shim' : 'module'))
  302. processScript(node);
  303. if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
  304. processImportMap(node);
  305. }
  306. else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload'))
  307. processPreload(node);
  308. }
  309. }
  310. }).observe(document, { childList: true, subtree: true });
  311. processImportMaps();
  312. processScriptsAndPreloads();
  313. return init;
  314. }
  315. });
  316. let importMapPromise = initPromise;
  317. let firstPolyfillLoad = true;
  318. let acceptingImportMaps = true;
  319. async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
  320. if (!shimMode)
  321. acceptingImportMaps = false;
  322. await importMapPromise;
  323. // early analysis opt-out - no need to even fetch if we have feature support
  324. if (!shimMode && baselinePassthrough) {
  325. // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
  326. if (nativelyLoaded)
  327. return null;
  328. await lastStaticLoadPromise;
  329. return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
  330. }
  331. const load = getOrCreateLoad(url, fetchOpts, null, source);
  332. const seen = {};
  333. await loadAll(load, seen);
  334. lastLoad = undefined;
  335. resolveDeps(load, seen);
  336. await lastStaticLoadPromise;
  337. if (source && !shimMode && !load.n && !false) {
  338. const module = await dynamicImport(createBlob(source), { errUrl: source });
  339. if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
  340. return module;
  341. }
  342. if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
  343. onpolyfill();
  344. firstPolyfillLoad = false;
  345. }
  346. const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
  347. // if the top-level load is a shell, run its update function
  348. if (load.s)
  349. (await dynamicImport(load.s)).u$_(module);
  350. if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
  351. // when tla is supported, this should return the tla promise as an actual handle
  352. // so readystate can still correspond to the sync subgraph exec completions
  353. return module;
  354. }
  355. function revokeObjectURLs(registryKeys) {
  356. let batch = 0;
  357. const keysLength = registryKeys.length;
  358. const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
  359. schedule(cleanup);
  360. function cleanup() {
  361. const batchStartIndex = batch * 100;
  362. if (batchStartIndex > keysLength) return
  363. for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
  364. const load = registry[key];
  365. if (load) URL.revokeObjectURL(load.b);
  366. }
  367. batch++;
  368. schedule(cleanup);
  369. }
  370. }
  371. async function importShim (id, ...args) {
  372. // parentUrl if present will be the last argument
  373. let parentUrl = args[args.length - 1];
  374. if (typeof parentUrl !== 'string') {
  375. parentUrl = baseUrl;
  376. }
  377. // needed for shim check
  378. await initPromise;
  379. if (acceptingImportMaps || shimMode || !baselinePassthrough) {
  380. processImportMaps();
  381. if (!shimMode)
  382. acceptingImportMaps = false;
  383. }
  384. await importMapPromise;
  385. return topLevelLoad((await resolve(id, parentUrl)).r || throwUnresolved(id, parentUrl), { credentials: 'same-origin' });
  386. }
  387. self.importShim = importShim;
  388. if (shimMode) {
  389. importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
  390. }
  391. const meta = {};
  392. async function importMetaResolve (id, parentUrl = this.url) {
  393. return (await resolve(id, `${parentUrl}`)).r || throwUnresolved(id, parentUrl);
  394. }
  395. self._esmsm = meta;
  396. function urlJsString (url) {
  397. return `'${url.replace(/'/g, "\\'")}'`;
  398. }
  399. let lastLoad;
  400. function resolveDeps (load, seen) {
  401. if (load.b || !seen[load.u])
  402. return;
  403. seen[load.u] = 0;
  404. for (const dep of load.d)
  405. resolveDeps(dep, seen);
  406. const [imports] = load.a;
  407. // "execution"
  408. const source = load.S;
  409. // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
  410. let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
  411. if (!imports.length) {
  412. resolvedSource += source;
  413. }
  414. else {
  415. // once all deps have loaded we can inline the dependency resolution blobs
  416. // and define this blob
  417. let lastIndex = 0, depIndex = 0;
  418. for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
  419. // dependency source replacements
  420. if (dynamicImportIndex === -1) {
  421. const depLoad = load.d[depIndex++];
  422. let blobUrl = depLoad.b;
  423. if (!blobUrl) {
  424. // circular shell creation
  425. if (!(blobUrl = depLoad.s)) {
  426. blobUrl = depLoad.s = createBlob(`export function u$_(m){${
  427. depLoad.a[1].map(
  428. name => name === 'default' ? `$_default=m.default` : `${name}=m.${name}`
  429. ).join(',')
  430. }}${
  431. depLoad.a[1].map(name =>
  432. name === 'default' ? `let $_default;export{$_default as default}` : `export let ${name}`
  433. ).join(';')
  434. }\n//# sourceURL=${depLoad.r}?cycle`);
  435. }
  436. }
  437. // circular shell execution
  438. else if (depLoad.s) {
  439. resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)};import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
  440. lastIndex = statementEnd;
  441. depLoad.s = undefined;
  442. continue;
  443. }
  444. resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
  445. lastIndex = statementEnd;
  446. }
  447. // import.meta
  448. else if (dynamicImportIndex === -2) {
  449. meta[load.r] = { url: load.r, resolve: importMetaResolve };
  450. resolvedSource += `${source.slice(lastIndex, start)}self._esmsm[${urlJsString(load.r)}]`;
  451. lastIndex = statementEnd;
  452. }
  453. // dynamic import
  454. else {
  455. resolvedSource += `${source.slice(lastIndex, statementStart + 6)}Shim(${source.slice(start, statementEnd - 1)}, ${urlJsString(load.r)})`;
  456. lastIndex = statementEnd;
  457. }
  458. }
  459. resolvedSource += source.slice(lastIndex);
  460. }
  461. let hasSourceURL = false;
  462. resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
  463. if (!hasSourceURL)
  464. resolvedSource += '\n//# sourceURL=' + load.r;
  465. load.b = lastLoad = createBlob(resolvedSource);
  466. load.S = undefined;
  467. }
  468. // ; and // trailer support added for Ruby on Rails 7 source maps compatibility
  469. // https://github.com/guybedford/es-module-shims/issues/228
  470. const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
  471. const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
  472. const jsonContentType = /^(text|application)\/json(;|$)/;
  473. const cssContentType = /^(text|application)\/css(;|$)/;
  474. const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
  475. // restrict in-flight fetches to a pool of 100
  476. let p = [];
  477. let c = 0;
  478. function pushFetchPool () {
  479. if (++c > 100)
  480. return new Promise(r => p.push(r));
  481. }
  482. function popFetchPool () {
  483. c--;
  484. if (p.length)
  485. p.shift()();
  486. }
  487. function fromParent (parent) {
  488. return parent ? ` imported from ${parent}` : '';
  489. }
  490. async function doFetch (url, fetchOpts, parent) {
  491. if (enforceIntegrity && !fetchOpts.integrity)
  492. throw Error(`No integrity for ${url}${fromParent(parent)}.`);
  493. const poolQueue = pushFetchPool();
  494. if (poolQueue) await poolQueue;
  495. try {
  496. var res = await fetchHook(url, fetchOpts);
  497. }
  498. catch (e) {
  499. e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
  500. throw e;
  501. }
  502. finally {
  503. popFetchPool();
  504. }
  505. if (!res.ok)
  506. throw Error(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
  507. return res;
  508. }
  509. async function fetchModule (url, fetchOpts, parent) {
  510. const res = await doFetch(url, fetchOpts, parent);
  511. const contentType = res.headers.get('content-type');
  512. if (jsContentType.test(contentType))
  513. return { r: res.url, s: await res.text(), t: 'js' };
  514. else if (jsonContentType.test(contentType))
  515. return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
  516. else if (cssContentType.test(contentType)) {
  517. return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
  518. JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
  519. });export default s;`, t: 'css' };
  520. }
  521. else
  522. throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
  523. }
  524. function getOrCreateLoad (url, fetchOpts, parent, source) {
  525. let load = registry[url];
  526. if (load && !source)
  527. return load;
  528. load = {
  529. // url
  530. u: url,
  531. // response url
  532. r: source ? url : undefined,
  533. // fetchPromise
  534. f: undefined,
  535. // source
  536. S: undefined,
  537. // linkPromise
  538. L: undefined,
  539. // analysis
  540. a: undefined,
  541. // deps
  542. d: undefined,
  543. // blobUrl
  544. b: undefined,
  545. // shellUrl
  546. s: undefined,
  547. // needsShim
  548. n: false,
  549. // type
  550. t: null
  551. };
  552. if (registry[url]) {
  553. let i = 0;
  554. while (registry[load.u + ++i]);
  555. load.u += i;
  556. }
  557. registry[load.u] = load;
  558. load.f = (async () => {
  559. if (!source) {
  560. // preload fetch options override fetch options (race)
  561. let t;
  562. ({ r: load.r, s: source, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
  563. if (t && !shimMode) {
  564. if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
  565. throw Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
  566. if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
  567. load.n = true;
  568. }
  569. }
  570. try {
  571. load.a = parse(source, load.u);
  572. }
  573. catch (e) {
  574. console.warn(e);
  575. load.a = [[], []];
  576. }
  577. load.S = source;
  578. return load;
  579. })();
  580. load.L = load.f.then(async () => {
  581. let childFetchOpts = fetchOpts;
  582. load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
  583. if (d >= 0 && !supportsDynamicImport || d === 2 && !supportsImportMeta)
  584. load.n = true;
  585. if (!n) return;
  586. const { r, b } = await resolve(n, load.r || load.u);
  587. if (b && (!supportsImportMaps || importMapSrcOrLazy))
  588. load.n = true;
  589. if (d !== -1) return;
  590. if (!r)
  591. throwUnresolved(n, load.r || load.u);
  592. if (skip && skip.test(r)) return { b: r };
  593. if (childFetchOpts.integrity)
  594. childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
  595. return getOrCreateLoad(r, childFetchOpts, load.r).f;
  596. }))).filter(l => l);
  597. });
  598. return load;
  599. }
  600. function processScriptsAndPreloads () {
  601. for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
  602. processScript(script);
  603. for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
  604. processPreload(link);
  605. }
  606. function processImportMaps () {
  607. for (const script of document.querySelectorAll(shimMode ? 'script[type="importmap-shim"]' : 'script[type="importmap"]'))
  608. processImportMap(script);
  609. }
  610. function getFetchOpts (script) {
  611. const fetchOpts = {};
  612. if (script.integrity)
  613. fetchOpts.integrity = script.integrity;
  614. if (script.referrerpolicy)
  615. fetchOpts.referrerPolicy = script.referrerpolicy;
  616. if (script.crossorigin === 'use-credentials')
  617. fetchOpts.credentials = 'include';
  618. else if (script.crossorigin === 'anonymous')
  619. fetchOpts.credentials = 'omit';
  620. else
  621. fetchOpts.credentials = 'same-origin';
  622. return fetchOpts;
  623. }
  624. let lastStaticLoadPromise = Promise.resolve();
  625. let domContentLoadedCnt = 1;
  626. function domContentLoadedCheck () {
  627. if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers)
  628. document.dispatchEvent(new Event('DOMContentLoaded'));
  629. }
  630. // this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
  631. document.addEventListener('DOMContentLoaded', async () => {
  632. await initPromise;
  633. domContentLoadedCheck();
  634. if (shimMode || !baselinePassthrough) {
  635. processImportMaps();
  636. processScriptsAndPreloads();
  637. }
  638. });
  639. let readyStateCompleteCnt = 1;
  640. if (document.readyState === 'complete') {
  641. readyStateCompleteCheck();
  642. }
  643. else {
  644. document.addEventListener('readystatechange', async () => {
  645. processImportMaps();
  646. await initPromise;
  647. readyStateCompleteCheck();
  648. });
  649. }
  650. function readyStateCompleteCheck () {
  651. if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers)
  652. document.dispatchEvent(new Event('readystatechange'));
  653. }
  654. function processImportMap (script) {
  655. if (script.ep) // ep marker = script processed
  656. return;
  657. // empty inline scripts sometimes show before domready
  658. if (!script.src && !script.innerHTML)
  659. return;
  660. script.ep = true;
  661. // we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
  662. if (script.src) {
  663. if (!shimMode)
  664. return;
  665. importMapSrcOrLazy = true;
  666. }
  667. if (acceptingImportMaps) {
  668. importMapPromise = importMapPromise
  669. .then(async () => {
  670. importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
  671. })
  672. .catch(throwError);
  673. if (!shimMode)
  674. acceptingImportMaps = false;
  675. }
  676. }
  677. function processScript (script) {
  678. if (script.ep) // ep marker = script processed
  679. return;
  680. if (script.getAttribute('noshim') !== null)
  681. return;
  682. // empty inline scripts sometimes show before domready
  683. if (!script.src && !script.innerHTML)
  684. return;
  685. script.ep = true;
  686. // does this load block readystate complete
  687. const isReadyScript = readyStateCompleteCnt > 0;
  688. // does this load block DOMContentLoaded
  689. const isDomContentLoadedScript = domContentLoadedCnt > 0;
  690. if (isReadyScript) readyStateCompleteCnt++;
  691. if (isDomContentLoadedScript) domContentLoadedCnt++;
  692. const blocks = script.getAttribute('async') === null && isReadyScript;
  693. const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(throwError);
  694. if (blocks)
  695. lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
  696. if (isDomContentLoadedScript)
  697. loadPromise.then(domContentLoadedCheck);
  698. }
  699. const fetchCache = {};
  700. function processPreload (link) {
  701. if (link.ep) // ep marker = processed
  702. return;
  703. link.ep = true;
  704. if (fetchCache[link.href])
  705. return;
  706. fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
  707. }
  708. function throwUnresolved (id, parentUrl) {
  709. throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
  710. }
  711. })();