es-module-shims 1.10.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1071 +0,0 @@
1
- /* ES Module Shims Wasm DEV BUILD 1.10.0 */
2
- (function () {
3
-
4
- const hasDocument = typeof document !== 'undefined';
5
-
6
- const noop = () => {};
7
-
8
- const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined;
9
-
10
- const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
11
- Object.assign(esmsInitOptions, self.esmsInitOptions || {});
12
-
13
- let shimMode = hasDocument ? !!esmsInitOptions.shimMode : true;
14
-
15
- const importHook = globalHook(shimMode && esmsInitOptions.onimport);
16
- const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
17
- let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
18
- const metaHook = esmsInitOptions.meta ? globalHook(shimMode && esmsInitOptions.meta) : noop;
19
-
20
- const mapOverrides = esmsInitOptions.mapOverrides;
21
-
22
- let nonce = esmsInitOptions.nonce;
23
- if (!nonce && hasDocument) {
24
- const nonceElement = document.querySelector('script[nonce]');
25
- if (nonceElement)
26
- nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
27
- }
28
-
29
- const onerror = globalHook(esmsInitOptions.onerror || noop);
30
-
31
- const { revokeBlobURLs, noLoadEventRetriggers, globalLoadEventRetrigger, enforceIntegrity } = esmsInitOptions;
32
-
33
- function globalHook (name) {
34
- return typeof name === 'string' ? self[name] : name;
35
- }
36
-
37
- const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
38
- const cssModulesEnabled = enable.includes('css-modules');
39
- const jsonModulesEnabled = enable.includes('json-modules');
40
- const wasmModulesEnabled = enable.includes('wasm-modules');
41
- const sourcePhaseEnabled = enable.includes('source-phase');
42
-
43
- const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => {
44
- console.log(`%c^^ Module error above is polyfilled and can be ignored ^^`, 'font-weight:900;color:#391');
45
- };
46
-
47
- const edge = !navigator.userAgentData && !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
48
-
49
- const baseUrl = hasDocument
50
- ? document.baseURI
51
- : `${location.protocol}//${location.host}${location.pathname.includes('/')
52
- ? location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1)
53
- : location.pathname}`;
54
-
55
- const createBlob = (source, type = 'text/javascript') => URL.createObjectURL(new Blob([source], { type }));
56
- let { skip } = esmsInitOptions;
57
- if (Array.isArray(skip)) {
58
- const l = skip.map(s => new URL(s, baseUrl).href);
59
- skip = s => l.some(i => i[i.length - 1] === '/' && s.startsWith(i) || s === i);
60
- }
61
- else if (typeof skip === 'string') {
62
- const r = new RegExp(skip);
63
- skip = s => r.test(s);
64
- } else if (skip instanceof RegExp) {
65
- skip = s => skip.test(s);
66
- }
67
-
68
- const dispatchError = error => self.dispatchEvent(Object.assign(new Event('error'), { error }));
69
-
70
- const throwError = err => { (self.reportError || dispatchError)(err), void onerror(err); };
71
-
72
- function fromParent (parent) {
73
- return parent ? ` imported from ${parent}` : '';
74
- }
75
-
76
- let importMapSrcOrLazy = false;
77
-
78
- function setImportMapSrcOrLazy () {
79
- importMapSrcOrLazy = true;
80
- }
81
-
82
- // shim mode is determined on initialization, no late shim mode
83
- if (!shimMode) {
84
- if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
85
- shimMode = true;
86
- }
87
- else {
88
- let seenScript = false;
89
- for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
90
- if (!seenScript) {
91
- if (script.type === 'module' && !script.ep)
92
- seenScript = true;
93
- }
94
- else if (script.type === 'importmap' && seenScript) {
95
- importMapSrcOrLazy = true;
96
- break;
97
- }
98
- }
99
- }
100
- }
101
-
102
- const backslashRegEx = /\\/g;
103
-
104
- function asURL (url) {
105
- try {
106
- if (url.indexOf(':') !== -1)
107
- return new URL(url).href;
108
- }
109
- catch (_) {}
110
- }
111
-
112
- function resolveUrl (relUrl, parentUrl) {
113
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (asURL(relUrl) || resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
114
- }
115
-
116
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
117
- const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?');
118
- if (hIdx + qIdx > -2)
119
- parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx);
120
- if (relUrl.indexOf('\\') !== -1)
121
- relUrl = relUrl.replace(backslashRegEx, '/');
122
- // protocol-relative
123
- if (relUrl[0] === '/' && relUrl[1] === '/') {
124
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
125
- }
126
- // relative-url
127
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
128
- relUrl.length === 1 && (relUrl += '/')) ||
129
- relUrl[0] === '/') {
130
- const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
131
- if (parentProtocol === 'blob:') {
132
- throw new TypeError(`Failed to resolve module specifier "${relUrl}". Invalid relative url or base scheme isn't hierarchical.`);
133
- }
134
- // Disabled, but these cases will give inconsistent results for deep backtracking
135
- //if (parentUrl[parentProtocol.length] !== '/')
136
- // throw new Error('Cannot resolve');
137
- // read pathname from parent URL
138
- // pathname taken to be part after leading "/"
139
- let pathname;
140
- if (parentUrl[parentProtocol.length + 1] === '/') {
141
- // resolving to a :// so we need to read out the auth and host
142
- if (parentProtocol !== 'file:') {
143
- pathname = parentUrl.slice(parentProtocol.length + 2);
144
- pathname = pathname.slice(pathname.indexOf('/') + 1);
145
- }
146
- else {
147
- pathname = parentUrl.slice(8);
148
- }
149
- }
150
- else {
151
- // resolving to :/ so pathname is the /... part
152
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
153
- }
154
-
155
- if (relUrl[0] === '/')
156
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
157
-
158
- // join together and split for removal of .. and . segments
159
- // looping the string instead of anything fancy for perf reasons
160
- // '../../../../../z' resolved to 'x/y' is just 'z'
161
- const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
162
-
163
- const output = [];
164
- let segmentIndex = -1;
165
- for (let i = 0; i < segmented.length; i++) {
166
- // busy reading a segment - only terminate on '/'
167
- if (segmentIndex !== -1) {
168
- if (segmented[i] === '/') {
169
- output.push(segmented.slice(segmentIndex, i + 1));
170
- segmentIndex = -1;
171
- }
172
- continue;
173
- }
174
- // new segment - check if it is relative
175
- else if (segmented[i] === '.') {
176
- // ../ segment
177
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
178
- output.pop();
179
- i += 2;
180
- continue;
181
- }
182
- // ./ segment
183
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
184
- i += 1;
185
- continue;
186
- }
187
- }
188
- // it is the start of a new segment
189
- while (segmented[i] === '/') i++;
190
- segmentIndex = i;
191
- }
192
- // finish reading out the last segment
193
- if (segmentIndex !== -1)
194
- output.push(segmented.slice(segmentIndex));
195
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
196
- }
197
- }
198
-
199
- function resolveAndComposeImportMap (json, baseUrl, parentMap) {
200
- const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes), integrity: Object.assign({}, parentMap.integrity) };
201
-
202
- if (json.imports)
203
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
204
-
205
- if (json.scopes)
206
- for (let s in json.scopes) {
207
- const resolvedScope = resolveUrl(s, baseUrl);
208
- resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
209
- }
210
-
211
- if (json.integrity)
212
- resolveAndComposeIntegrity(json.integrity, outMap.integrity, baseUrl);
213
-
214
- return outMap;
215
- }
216
-
217
- function getMatch (path, matchObj) {
218
- if (matchObj[path])
219
- return path;
220
- let sepIndex = path.length;
221
- do {
222
- const segment = path.slice(0, sepIndex + 1);
223
- if (segment in matchObj)
224
- return segment;
225
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
226
- }
227
-
228
- function applyPackages (id, packages) {
229
- const pkgName = getMatch(id, packages);
230
- if (pkgName) {
231
- const pkg = packages[pkgName];
232
- if (pkg === null) return;
233
- return pkg + id.slice(pkgName.length);
234
- }
235
- }
236
-
237
-
238
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
239
- let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
240
- while (scopeUrl) {
241
- const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
242
- if (packageResolution)
243
- return packageResolution;
244
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
245
- }
246
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
247
- }
248
-
249
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
250
- for (let p in packages) {
251
- const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
252
- if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
253
- throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
254
- }
255
- let target = packages[p];
256
- if (typeof target !== 'string')
257
- continue;
258
- const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
259
- if (mapped) {
260
- outPackages[resolvedLhs] = mapped;
261
- continue;
262
- }
263
- console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
264
- }
265
- }
266
-
267
- function resolveAndComposeIntegrity (integrity, outIntegrity, baseUrl) {
268
- for (let p in integrity) {
269
- const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
270
- if ((!shimMode || !mapOverrides) && outIntegrity[resolvedLhs] && (outIntegrity[resolvedLhs] !== integrity[resolvedLhs])) {
271
- throw Error(`Rejected map integrity override "${resolvedLhs}" from ${outIntegrity[resolvedLhs]} to ${integrity[resolvedLhs]}.`);
272
- }
273
- outIntegrity[resolvedLhs] = integrity[p];
274
- }
275
- }
276
-
277
- let dynamicImport = !hasDocument && (0, eval)('u=>import(u)');
278
-
279
- let supportsDynamicImport;
280
-
281
- const dynamicImportCheck = hasDocument && new Promise(resolve => {
282
- const s = Object.assign(document.createElement('script'), {
283
- src: createBlob('self._d=u=>import(u)'),
284
- ep: true
285
- });
286
- s.setAttribute('nonce', nonce);
287
- s.addEventListener('load', () => {
288
- if (!(supportsDynamicImport = !!(dynamicImport = self._d))) {
289
- let err;
290
- window.addEventListener('error', _err => err = _err);
291
- dynamicImport = (url, opts) => new Promise((resolve, reject) => {
292
- const s = Object.assign(document.createElement('script'), {
293
- type: 'module',
294
- src: createBlob(`import*as m from'${url}';self._esmsi=m`)
295
- });
296
- err = undefined;
297
- s.ep = true;
298
- if (nonce)
299
- s.setAttribute('nonce', nonce);
300
- // Safari is unique in supporting module script error events
301
- s.addEventListener('error', cb);
302
- s.addEventListener('load', cb);
303
- function cb (_err) {
304
- document.head.removeChild(s);
305
- if (self._esmsi) {
306
- resolve(self._esmsi, baseUrl);
307
- self._esmsi = undefined;
308
- }
309
- else {
310
- reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading ${opts && opts.errUrl || url} (${s.src}).`));
311
- err = undefined;
312
- }
313
- }
314
- document.head.appendChild(s);
315
- });
316
- }
317
- document.head.removeChild(s);
318
- delete self._d;
319
- resolve();
320
- });
321
- document.head.appendChild(s);
322
- });
323
-
324
- // support browsers without dynamic import support (eg Firefox 6x)
325
- let supportsJsonAssertions = false;
326
- let supportsCssAssertions = false;
327
-
328
- const supports = hasDocument && HTMLScriptElement.supports;
329
-
330
- let supportsImportMaps = supports && supports.name === 'supports' && supports('importmap');
331
- let supportsImportMeta = supportsDynamicImport;
332
- let supportsWasmModules = false;
333
- let supportsSourcePhase = false;
334
-
335
- const wasmBytes = [0,97,115,109,1,0,0,0];
336
-
337
- let featureDetectionPromise = Promise.resolve(dynamicImportCheck).then(() => {
338
- if (!supportsDynamicImport)
339
- return;
340
- if (!hasDocument)
341
- return Promise.all([
342
- supportsImportMaps || dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),
343
- cssModulesEnabled && dynamicImport(createBlob(`import"${createBlob('', 'text/css')}"with{type:"css"}`)).then(() => supportsCssAssertions = true, noop),
344
- jsonModulesEnabled && dynamicImport(createBlob(`import"${createBlob('{}', 'text/json')}"with{type:"json"}`)).then(() => supportsJsonAssertions = true, noop),
345
- wasmModulesEnabled && dynamicImport(createBlob(`import"${createBlob(new Uint8Array(wasmBytes), 'application/wasm')}"`)).then(() => supportsWasmModules = true, noop),
346
- wasmModulesEnabled && sourcePhaseEnabled && dynamicImport(createBlob(`import source x from"${createBlob(new Uint8Array(wasmBytes), 'application/wasm')}"`)).then(() => supportsSourcePhase = true, noop),
347
- ]);
348
-
349
- return new Promise(resolve => {
350
- const iframe = document.createElement('iframe');
351
- iframe.style.display = 'none';
352
- iframe.setAttribute('nonce', nonce);
353
- function cb ({ data }) {
354
- const isFeatureDetectionMessage = Array.isArray(data) && data[0] === 'esms';
355
- if (!isFeatureDetectionMessage)
356
- return;
357
- [, supportsImportMaps, supportsImportMeta, supportsCssAssertions, supportsJsonAssertions, supportsWasmModules, supportsSourcePhase] = data;
358
- resolve();
359
- document.head.removeChild(iframe);
360
- window.removeEventListener('message', cb, false);
361
- }
362
- window.addEventListener('message', cb, false);
363
-
364
- const importMapTest = `<script nonce=${nonce || ''}>b=(s,type='text/javascript')=>URL.createObjectURL(new Blob([s],{type}));document.head.appendChild(Object.assign(document.createElement('script'),{type:'importmap',nonce:"${nonce}",innerText:\`{"imports":{"x":"\${b('')}"}}\`}));Promise.all([${
365
- supportsImportMaps ? 'true,true' : `'x',b('import.meta')`}, ${
366
- cssModulesEnabled ? `b(\`import"\${b('','text/css')}"with{type:"css"}\`)` : 'false'}, ${
367
- jsonModulesEnabled ? `b(\`import"\${b('{}','text/json')\}"with{type:"json"}\`)` : 'false'}, ${
368
- wasmModulesEnabled ? `b(\`import"\${b(new Uint8Array(${JSON.stringify(wasmBytes)}),'application/wasm')\}"\`)` : 'false'}, ${
369
- wasmModulesEnabled && sourcePhaseEnabled ? `b(\`import source x from "\${b(new Uint8Array(${JSON.stringify(wasmBytes)}),'application/wasm')\}"\`)` : 'false'}].map(x =>typeof x==='string'?import(x).then(()=>true,()=>false):x)).then(a=>parent.postMessage(['esms'].concat(a),'*'))<${''}/script>`;
370
-
371
- // Safari will call onload eagerly on head injection, but we don't want the Wechat
372
- // path to trigger before setting srcdoc, therefore we track the timing
373
- let readyForOnload = false, onloadCalledWhileNotReady = false;
374
- function doOnload () {
375
- if (!readyForOnload) {
376
- onloadCalledWhileNotReady = true;
377
- return;
378
- }
379
- // WeChat browser doesn't support setting srcdoc scripts
380
- // But iframe sandboxes don't support contentDocument so we do this as a fallback
381
- const doc = iframe.contentDocument;
382
- if (doc && doc.head.childNodes.length === 0) {
383
- const s = doc.createElement('script');
384
- if (nonce)
385
- s.setAttribute('nonce', nonce);
386
- s.innerHTML = importMapTest.slice(15 + (nonce ? nonce.length : 0), -9);
387
- doc.head.appendChild(s);
388
- }
389
- }
390
-
391
- iframe.onload = doOnload;
392
- // WeChat browser requires append before setting srcdoc
393
- document.head.appendChild(iframe);
394
-
395
- // setting srcdoc is not supported in React native webviews on iOS
396
- // setting src to a blob URL results in a navigation event in webviews
397
- // document.write gives usability warnings
398
- readyForOnload = true;
399
- if ('srcdoc' in iframe)
400
- iframe.srcdoc = importMapTest;
401
- else
402
- iframe.contentDocument.write(importMapTest);
403
- // retrigger onload for Safari only if necessary
404
- if (onloadCalledWhileNotReady) doOnload();
405
- });
406
- });
407
-
408
- /* es-module-lexer 1.5.3 */
409
- var ImportType;!function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase";}(ImportType||(ImportType={}));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,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const o=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,o,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 D=[],K=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),o=C.se();let K;C.ip()&&(K=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),D.push({n:K,t:B,s:A,e:Q,ss:w,se:o,d:I,a:g});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],o=B<0?void 0:E.slice(B,g),D=o?o[0]:"";K.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===D||"'"===D?k(o):o});}function k(A){try{return (0,eval)(A)}catch(A){}}return [D,K,!!C.f(),!!C.ms()]}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="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/Y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0DAkBBACgC+AkiAkUNACABIAIoAgBJDQAgASACKAIETQ0ECyABQX5qIQFBACgC3AkhAgJAA0AgAUECaiIEIAJNDQFBACABNgKcCiABLwEAIQMgAUF+aiIEIQEgAxAfRQ0ACyAEQQJqIQQLAkAgA0H//wNxECBFDQAgBEF+aiEBAkADQCABQQJqIgMgAk0NAUEAIAE2ApwKIAEvAQAhAyABQX5qIgQhASADECANAAsgBEECaiEDCyADECENBAtBAEEBOgCgCgwHC0EAKAKkCkEALwGYCiIBQQN0IgNqQQAoApwKNgIEQQAgAUEBajsBmApBACgCpAogA2pBAzYCAAsQIgwFC0EALQD8CUEALwGWCkEALwGYCnJyRSECDAcLECNBAEEAOgCgCgwDCxAkQQAhAgwFCyADQaABRw0BC0EAQQE6AKwKC0EAQQAoArAKNgKcCgtBACgCsAohAQwACwsgAEGA0ABqJAAgAgsaAAJAQQAoAtwJIABHDQBBAQ8LIABBfmoQJQv+CgEGf0EAQQAoArAKIgBBDGoiATYCsApBACgC+AkhAkEBECkhAwJAAkACQAJAAkACQAJAAkACQEEAKAKwCiIEIAFHDQAgAxAoRQ0BCwJAAkACQAJAAkACQAJAIANBKkYNACADQfsARw0BQQAgBEECajYCsApBARApIQNBACgCsAohBANAAkACQCADQf//A3EiA0EiRg0AIANBJ0YNACADECwaQQAoArAKIQMMAQsgAxAaQQBBACgCsApBAmoiAzYCsAoLQQEQKRoCQCAEIAMQLSIDQSxHDQBBAEEAKAKwCkECajYCsApBARApIQMLIANB/QBGDQNBACgCsAoiBSAERg0PIAUhBCAFQQAoArQKTQ0ADA8LC0EAIARBAmo2ArAKQQEQKRpBACgCsAoiAyADEC0aDAILQQBBADoAlAoCQAJAAkACQAJAAkAgA0Gff2oODAILBAELAwsLCwsLBQALIANB9gBGDQQMCgtBACAEQQ5qIgM2ArAKAkACQAJAQQEQKUGff2oOBgASAhISARILQQAoArAKIgUpAAJC84Dkg+CNwDFSDREgBS8BChAgRQ0RQQAgBUEKajYCsApBABApGgtBACgCs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CsAohBAwBCyACEBpBAEEAKAKwCkECaiIENgKwCgtBARApIQNBACgCsAohAgsCQCACIAVGDQAgBSAEQQAgACAAIAFGIgIbQQAgASACGxACCyADC3IBBH9BACgCsAohAEEAKAK0CiEBAkACQANAIABBAmohAiAAIAFPDQECQAJAIAIvAQAiA0Gkf2oOAgEEAAsgAiEAIANBdmoOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCsAoQJEEADwtBACACNgKwCkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwvsAQIAQYAIC84BAAB4AHAAbwByAHQAbQBwAG8AcgB0AGUAdABhAG8AdQByAGMAZQByAG8AbQB1AG4AYwB0AGkAbwBuAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBjAG8AbgB0AGkAbgBpAG4AcwB0AGEAbgB0AHkAYgByAGUAYQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQdAJCxABAAAAAgAAAAAEAABAOQAA","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;
410
-
411
- async function _resolve (id, parentUrl) {
412
- const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl) || asURL(id);
413
- return {
414
- r: resolveImportMap(importMap, urlResolved || id, parentUrl) || throwUnresolved(id, parentUrl),
415
- // b = bare specifier
416
- b: !urlResolved && !asURL(id)
417
- };
418
- }
419
-
420
- const resolve = resolveHook ? async (id, parentUrl) => {
421
- let result = resolveHook(id, parentUrl, defaultResolve);
422
- // will be deprecated in next major
423
- if (result && result.then)
424
- result = await result;
425
- return result ? { r: result, b: !resolveIfNotPlainOrUrl(id, parentUrl) && !asURL(id) } : _resolve(id, parentUrl);
426
- } : _resolve;
427
-
428
- // supports:
429
- // import('mod');
430
- // import('mod', { opts });
431
- // import('mod', { opts }, parentUrl);
432
- // import('mod', parentUrl);
433
- async function importHandler (id, ...args) {
434
- // parentUrl if present will be the last argument
435
- let parentUrl = args[args.length - 1];
436
- if (typeof parentUrl !== 'string')
437
- parentUrl = baseUrl;
438
- // needed for shim check
439
- await initPromise;
440
- if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
441
- if (acceptingImportMaps || shimMode || !baselinePassthrough) {
442
- if (hasDocument)
443
- processScriptsAndPreloads(true);
444
- if (!shimMode)
445
- acceptingImportMaps = false;
446
- }
447
- await importMapPromise;
448
- return (await resolve(id, parentUrl)).r;
449
- }
450
-
451
- // import()
452
- async function importShim (...args) {
453
- return topLevelLoad(await importHandler(...args), { credentials: 'same-origin' });
454
- }
455
-
456
- // import.source()
457
- if (sourcePhaseEnabled)
458
- importShim.source = async function importShimSource (...args) {
459
- const url = await importHandler(...args);
460
- const load = getOrCreateLoad(url, { credentials: 'same-origin' }, null, null);
461
- lastLoad = undefined;
462
- if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
463
- onpolyfill();
464
- firstPolyfillLoad = false;
465
- }
466
- await load.f;
467
- return importShim._s[load.r];
468
- };
469
-
470
- self.importShim = importShim;
471
-
472
- function defaultResolve (id, parentUrl) {
473
- return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
474
- }
475
-
476
- function throwUnresolved (id, parentUrl) {
477
- throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
478
- }
479
-
480
- const resolveSync = (id, parentUrl = baseUrl) => {
481
- parentUrl = `${parentUrl}`;
482
- const result = resolveHook && resolveHook(id, parentUrl, defaultResolve);
483
- return result && !result.then ? result : defaultResolve(id, parentUrl);
484
- };
485
-
486
- function metaResolve (id, parentUrl = this.url) {
487
- return resolveSync(id, parentUrl);
488
- }
489
-
490
- importShim.resolve = resolveSync;
491
- importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
492
- importShim.addImportMap = importMapIn => {
493
- if (!shimMode) throw new Error('Unsupported in polyfill mode.');
494
- importMap = resolveAndComposeImportMap(importMapIn, baseUrl, importMap);
495
- };
496
-
497
- const registry = importShim._r = {};
498
- const sourceCache = importShim._s = {};
499
-
500
- async function loadAll (load, seen) {
501
- seen[load.u] = 1;
502
- await load.L;
503
- await Promise.all(load.d.map(({ l: dep, s: sourcePhase }) => {
504
- if (dep.b || seen[dep.u])
505
- return;
506
- if (sourcePhase)
507
- return dep.f;
508
- return loadAll(dep, seen);
509
- }));
510
- if (!load.n)
511
- load.n = load.d.some(dep => dep.l.n);
512
- }
513
-
514
- let importMap = { imports: {}, scopes: {}, integrity: {} };
515
- let baselinePassthrough;
516
-
517
- const initPromise = featureDetectionPromise.then(() => {
518
- baselinePassthrough = esmsInitOptions.polyfillEnable !== true && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && (!wasmModulesEnabled || supportsWasmModules) && (!sourcePhaseEnabled || supportsSourcePhase) && !importMapSrcOrLazy && !self.TRANSFORM_HOOK;
519
- if (sourcePhaseEnabled && typeof WebAssembly !== 'undefined' && !Object.getPrototypeOf(WebAssembly.Module).name) {
520
- const s = Symbol();
521
- const brand = m => Object.defineProperty(m, s, { writable: false, configurable: false, value: 'WebAssembly.Module' });
522
- class AbstractModuleSource {
523
- get [Symbol.toStringTag]() {
524
- if (this[s]) return this[s];
525
- throw new TypeError('Not an AbstractModuleSource');
526
- }
527
- }
528
- const { Module: wasmModule, compile: wasmCompile, compileStreaming: wasmCompileStreaming } = WebAssembly;
529
- WebAssembly.Module = Object.setPrototypeOf(Object.assign(function Module (...args) {
530
- return brand(new wasmModule(...args));
531
- }, wasmModule), AbstractModuleSource);
532
- WebAssembly.Module.prototype = Object.setPrototypeOf(wasmModule.prototype, AbstractModuleSource.prototype);
533
- WebAssembly.compile = function compile (...args) {
534
- return wasmCompile(...args).then(brand);
535
- };
536
- WebAssembly.compileStreaming = function compileStreaming(...args) {
537
- return wasmCompileStreaming(...args).then(brand);
538
- };
539
- }
540
- if (hasDocument) {
541
- if (!supportsImportMaps) {
542
- const supports = HTMLScriptElement.supports || (type => type === 'classic' || type === 'module');
543
- HTMLScriptElement.supports = type => type === 'importmap' || supports(type);
544
- }
545
- if (shimMode || !baselinePassthrough) {
546
- new MutationObserver(mutations => {
547
- for (const mutation of mutations) {
548
- if (mutation.type !== 'childList') continue;
549
- for (const node of mutation.addedNodes) {
550
- if (node.tagName === 'SCRIPT') {
551
- if (node.type === (shimMode ? 'module-shim' : 'module'))
552
- processScript(node, true);
553
- if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
554
- processImportMap(node, true);
555
- }
556
- else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload')) {
557
- processPreload(node);
558
- }
559
- }
560
- }
561
- }).observe(document, {childList: true, subtree: true});
562
- processScriptsAndPreloads();
563
- if (document.readyState === 'complete') {
564
- readyStateCompleteCheck();
565
- }
566
- else {
567
- async function readyListener() {
568
- await initPromise;
569
- processScriptsAndPreloads();
570
- if (document.readyState === 'complete') {
571
- readyStateCompleteCheck();
572
- document.removeEventListener('readystatechange', readyListener);
573
- }
574
- }
575
- document.addEventListener('readystatechange', readyListener);
576
- }
577
- }
578
- }
579
- return init;
580
- });
581
- let importMapPromise = initPromise;
582
- let firstPolyfillLoad = true;
583
- let acceptingImportMaps = true;
584
-
585
- async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
586
- if (!shimMode)
587
- acceptingImportMaps = false;
588
- await initPromise;
589
- await importMapPromise;
590
- if (importHook) await importHook(url, typeof fetchOpts !== 'string' ? fetchOpts : {}, '');
591
- // early analysis opt-out - no need to even fetch if we have feature support
592
- if (!shimMode && baselinePassthrough) {
593
- // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
594
- if (nativelyLoaded)
595
- return null;
596
- await lastStaticLoadPromise;
597
- return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
598
- }
599
- const load = getOrCreateLoad(url, fetchOpts, null, source);
600
- linkLoad(load, fetchOpts);
601
- const seen = {};
602
- await loadAll(load, seen);
603
- lastLoad = undefined;
604
- resolveDeps(load, seen);
605
- await lastStaticLoadPromise;
606
- if (source && !shimMode && !load.n) {
607
- if (nativelyLoaded) return;
608
- if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
609
- return await dynamicImport(createBlob(source), { errUrl: source });
610
- }
611
- if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
612
- onpolyfill();
613
- firstPolyfillLoad = false;
614
- }
615
- const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
616
- // if the top-level load is a shell, run its update function
617
- if (load.s)
618
- (await dynamicImport(load.s)).u$_(module);
619
- if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
620
- // when tla is supported, this should return the tla promise as an actual handle
621
- // so readystate can still correspond to the sync subgraph exec completions
622
- return module;
623
- }
624
-
625
- function revokeObjectURLs(registryKeys) {
626
- let batch = 0;
627
- const keysLength = registryKeys.length;
628
- const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
629
- schedule(cleanup);
630
- function cleanup() {
631
- const batchStartIndex = batch * 100;
632
- if (batchStartIndex > keysLength) return
633
- for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
634
- const load = registry[key];
635
- if (load) URL.revokeObjectURL(load.b);
636
- }
637
- batch++;
638
- schedule(cleanup);
639
- }
640
- }
641
-
642
- function urlJsString (url) {
643
- return `'${url.replace(/'/g, "\\'")}'`;
644
- }
645
-
646
- let lastLoad;
647
- function resolveDeps (load, seen) {
648
- if (load.b || !seen[load.u])
649
- return;
650
- seen[load.u] = 0;
651
-
652
- for (const { l: dep, s: sourcePhase } of load.d) {
653
- if (!sourcePhase)
654
- resolveDeps(dep, seen);
655
- }
656
-
657
- const [imports, exports] = load.a;
658
-
659
- // "execution"
660
- const source = load.S;
661
-
662
- // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
663
- let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
664
-
665
- // once all deps have loaded we can inline the dependency resolution blobs
666
- // and define this blob
667
- let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
668
- function pushStringTo (originalIndex) {
669
- while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
670
- const dynamicImportEnd = dynamicImportEndStack.pop();
671
- resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
672
- lastIndex = dynamicImportEnd;
673
- }
674
- resolvedSource += source.slice(lastIndex, originalIndex);
675
- lastIndex = originalIndex;
676
- }
677
-
678
- for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex, t } of imports) {
679
- // source phase
680
- if (t === 4) {
681
- let { l: depLoad } = load.d[depIndex++];
682
- pushStringTo(statementStart);
683
- resolvedSource += 'import ';
684
- lastIndex = statementStart + 14;
685
- pushStringTo(start - 1);
686
- resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/'${createBlob(`export default importShim._s[${urlJsString(depLoad.r)}]`)}'`;
687
- lastIndex = statementEnd;
688
- }
689
- // dependency source replacements
690
- else if (dynamicImportIndex === -1) {
691
- let { l: depLoad } = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
692
- if (cycleShell) {
693
- // circular shell creation
694
- if (!(blobUrl = depLoad.s)) {
695
- blobUrl = depLoad.s = createBlob(`export function u$_(m){${
696
- depLoad.a[1].map(({ s, e }, i) => {
697
- const q = depLoad.S[s] === '"' || depLoad.S[s] === "'";
698
- return `e$_${i}=m${q ? `[` : '.'}${depLoad.S.slice(s, e)}${q ? `]` : ''}`;
699
- }).join(',')
700
- }}${
701
- depLoad.a[1].length ? `let ${depLoad.a[1].map((_, i) => `e$_${i}`).join(',')};` : ''
702
- }export {${
703
- depLoad.a[1].map(({ s, e }, i) => `e$_${i} as ${depLoad.S.slice(s, e)}`).join(',')
704
- }}\n//# sourceURL=${depLoad.r}?cycle`);
705
- }
706
- }
707
-
708
- pushStringTo(start - 1);
709
- resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/'${blobUrl}'`;
710
-
711
- // circular shell execution
712
- if (!cycleShell && depLoad.s) {
713
- resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
714
- depLoad.s = undefined;
715
- }
716
- lastIndex = statementEnd;
717
- }
718
- // import.meta
719
- else if (dynamicImportIndex === -2) {
720
- load.m = { url: load.r, resolve: metaResolve };
721
- metaHook(load.m, load.u);
722
- pushStringTo(start);
723
- resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
724
- lastIndex = statementEnd;
725
- }
726
- // dynamic import
727
- else {
728
- pushStringTo(statementStart + 6);
729
- resolvedSource += `Shim${t === 5 ? '.source' : ''}(`;
730
- dynamicImportEndStack.push(statementEnd - 1);
731
- lastIndex = start;
732
- }
733
- }
734
-
735
- // support progressive cycle binding updates (try statement avoids tdz errors)
736
- if (load.s && (imports.length === 0 || imports[imports.length - 1].d === -1))
737
- resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}:${ln}`).join(',')}})}catch(_){};\n`;
738
-
739
- function pushSourceURL (commentPrefix, commentStart) {
740
- const urlStart = commentStart + commentPrefix.length;
741
- const commentEnd = source.indexOf('\n', urlStart);
742
- const urlEnd = commentEnd !== -1 ? commentEnd : source.length;
743
- pushStringTo(urlStart);
744
- resolvedSource += new URL(source.slice(urlStart, urlEnd), load.r).href;
745
- lastIndex = urlEnd;
746
- }
747
-
748
- let sourceURLCommentStart = source.lastIndexOf(sourceURLCommentPrefix);
749
- let sourceMapURLCommentStart = source.lastIndexOf(sourceMapURLCommentPrefix);
750
-
751
- // ignore sourceMap comments before already spliced code
752
- if (sourceURLCommentStart < lastIndex) sourceURLCommentStart = -1;
753
- if (sourceMapURLCommentStart < lastIndex) sourceMapURLCommentStart = -1;
754
-
755
- // sourceURL first / only
756
- if (sourceURLCommentStart !== -1 && (sourceMapURLCommentStart === -1 || sourceMapURLCommentStart > sourceURLCommentStart)) {
757
- pushSourceURL(sourceURLCommentPrefix, sourceURLCommentStart);
758
- }
759
- // sourceMappingURL
760
- if (sourceMapURLCommentStart !== -1) {
761
- pushSourceURL(sourceMapURLCommentPrefix, sourceMapURLCommentStart);
762
- // sourceURL last
763
- if (sourceURLCommentStart !== -1 && (sourceURLCommentStart > sourceMapURLCommentStart))
764
- pushSourceURL(sourceURLCommentPrefix, sourceURLCommentStart);
765
- }
766
-
767
- pushStringTo(source.length);
768
-
769
- if (sourceURLCommentStart === -1)
770
- resolvedSource += sourceURLCommentPrefix + load.r;
771
-
772
- load.b = lastLoad = createBlob(resolvedSource);
773
- load.S = undefined;
774
- }
775
-
776
- const sourceURLCommentPrefix = '\n//# sourceURL=';
777
- const sourceMapURLCommentPrefix = '\n//# sourceMappingURL=';
778
-
779
- const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
780
- const wasmContentType = /^(application)\/wasm(;|$)/;
781
- const jsonContentType = /^(text|application)\/json(;|$)/;
782
- const cssContentType = /^(text|application)\/css(;|$)/;
783
-
784
- const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
785
-
786
- // restrict in-flight fetches to a pool of 100
787
- let p = [];
788
- let c = 0;
789
- function pushFetchPool () {
790
- if (++c > 100)
791
- return new Promise(r => p.push(r));
792
- }
793
- function popFetchPool () {
794
- c--;
795
- if (p.length)
796
- p.shift()();
797
- }
798
-
799
- async function doFetch (url, fetchOpts, parent) {
800
- if (enforceIntegrity && !fetchOpts.integrity)
801
- throw Error(`No integrity for ${url}${fromParent(parent)}.`);
802
- const poolQueue = pushFetchPool();
803
- if (poolQueue) await poolQueue;
804
- try {
805
- var res = await fetchHook(url, fetchOpts);
806
- }
807
- catch (e) {
808
- e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
809
- throw e;
810
- }
811
- finally {
812
- popFetchPool();
813
- }
814
-
815
- if (!res.ok) {
816
- const error = new TypeError(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
817
- error.response = res;
818
- throw error;
819
- }
820
- return res;
821
- }
822
-
823
- async function fetchModule (url, fetchOpts, parent) {
824
- const mapIntegrity = importMap.integrity[url];
825
- const res = await doFetch(url, mapIntegrity && !fetchOpts.integrity ? Object.assign({}, fetchOpts, { integrity: mapIntegrity }) : fetchOpts, parent);
826
- const r = res.url;
827
- const contentType = res.headers.get('content-type');
828
- if (jsContentType.test(contentType))
829
- return { r, s: await res.text(), t: 'js' };
830
- else if (wasmContentType.test(contentType)) {
831
- const module = await (sourceCache[r] || (sourceCache[r] = WebAssembly.compileStreaming(res)));
832
- sourceCache[r] = module;
833
- let s = '', i = 0, importObj = '';
834
- for (const impt of WebAssembly.Module.imports(module)) {
835
- const specifier = urlJsString(impt.module);
836
- s += `import * as impt${i} from ${specifier};\n`;
837
- importObj += `${specifier}:impt${i++},`;
838
- }
839
- i = 0;
840
- s += `const instance = await WebAssembly.instantiate(importShim._s[${urlJsString(r)}], {${importObj}});\n`;
841
- for (const expt of WebAssembly.Module.exports(module)) {
842
- s += `export const ${expt.name} = instance.exports['${expt.name}'];\n`;
843
- }
844
- return { r, s, t: 'wasm' };
845
- }
846
- else if (jsonContentType.test(contentType))
847
- return { r, s: `export default ${await res.text()}`, t: 'json' };
848
- else if (cssContentType.test(contentType)) {
849
- return { r, s: `var s=new CSSStyleSheet();s.replaceSync(${
850
- JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
851
- });export default s;`, t: 'css' };
852
- }
853
- else if (self.TRANSFORM_HOOK) {
854
- return { r, s: await res.text(), t: 'unknown' };
855
- }
856
- else
857
- throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
858
- }
859
-
860
- function getOrCreateLoad (url, fetchOpts, parent, source) {
861
- if (source && registry[url]) {
862
- let i = 0;
863
- while (registry[url + ++i]);
864
- url += i;
865
- }
866
- let load = registry[url];
867
- if (load) return load;
868
- registry[url] = load = {
869
- // url
870
- u: url,
871
- // response url
872
- r: source ? url : undefined,
873
- // fetchPromise
874
- f: undefined,
875
- // source
876
- S: source,
877
- // linkPromise
878
- L: undefined,
879
- // analysis
880
- a: undefined,
881
- // deps
882
- d: undefined,
883
- // blobUrl
884
- b: undefined,
885
- // shellUrl
886
- s: undefined,
887
- // needsShim
888
- n: false,
889
- // type
890
- t: null,
891
- // meta
892
- m: null
893
- };
894
- load.f = (async () => {
895
- if (!load.S) {
896
- // preload fetch options override fetch options (race)
897
- let t;
898
- ({ r: load.r, s: load.S, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
899
- const T = self.TRANSFORM_HOOK ? self.TRANSFORM_HOOK(load.r, load.S, t) : undefined;
900
- if (T !== undefined) {
901
- load.S = T;
902
- load.n = true;
903
- }
904
- if (t && !shimMode) {
905
- if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled || t === 'wasm' && !wasmModulesEnabled)
906
- throw featErr(`${t}-modules`);
907
- if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions || t === 'wasm' && !supportsWasmModules)
908
- load.n = true;
909
- }
910
- }
911
- try {
912
- load.a = parse(load.S, load.u);
913
- }
914
- catch (e) {
915
- throwError(e);
916
- load.a = [[], [], false];
917
- }
918
- return load;
919
- })();
920
- return load;
921
- }
922
-
923
- const featErr = feat => Error(`${feat} feature must be enabled via <script type="esms-options">{ "polyfillEnable": ["${feat}"] }<${''}/script>`);
924
-
925
- function linkLoad (load, fetchOpts) {
926
- if (load.L) return;
927
- load.L = load.f.then(async () => {
928
- let childFetchOpts = fetchOpts;
929
- load.d = (await Promise.all(load.a[0].map(async ({ n, d, t }) => {
930
- const sourcePhase = t >= 4;
931
- if (sourcePhase && !sourcePhaseEnabled)
932
- throw featErr('source-phase');
933
- if (d >= 0 && !supportsDynamicImport || d === -2 && !supportsImportMeta || sourcePhase && !supportsSourcePhase)
934
- load.n = true;
935
- if (d !== -1 || !n) return;
936
- const { r, b } = await resolve(n, load.r || load.u);
937
- if (b && (!supportsImportMaps || importMapSrcOrLazy))
938
- load.n = true;
939
- if (d !== -1) return;
940
- if (skip && skip(r) && !sourcePhase) return { l: { b: r }, s: false };
941
- if (childFetchOpts.integrity)
942
- childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
943
- const child = { l: getOrCreateLoad(r, childFetchOpts, load.r, null), s: sourcePhase };
944
- if (!child.s)
945
- linkLoad(child.l, fetchOpts);
946
- // load, sourcePhase
947
- return child;
948
- }))).filter(l => l);
949
- });
950
- }
951
-
952
- function processScriptsAndPreloads (mapsOnly = false) {
953
- if (!mapsOnly)
954
- for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
955
- processPreload(link);
956
- for (const script of document.querySelectorAll(shimMode ? 'script[type=importmap-shim]' : 'script[type=importmap]'))
957
- processImportMap(script);
958
- if (!mapsOnly)
959
- for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
960
- processScript(script);
961
- }
962
-
963
- function getFetchOpts (script) {
964
- const fetchOpts = {};
965
- if (script.integrity)
966
- fetchOpts.integrity = script.integrity;
967
- if (script.referrerPolicy)
968
- fetchOpts.referrerPolicy = script.referrerPolicy;
969
- if (script.fetchPriority)
970
- fetchOpts.priority = script.fetchPriority;
971
- if (script.crossOrigin === 'use-credentials')
972
- fetchOpts.credentials = 'include';
973
- else if (script.crossOrigin === 'anonymous')
974
- fetchOpts.credentials = 'omit';
975
- else
976
- fetchOpts.credentials = 'same-origin';
977
- return fetchOpts;
978
- }
979
-
980
- let lastStaticLoadPromise = Promise.resolve();
981
-
982
- let domContentLoadedCnt = 1;
983
- function domContentLoadedCheck () {
984
- if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough)) {
985
- document.dispatchEvent(new Event('DOMContentLoaded'));
986
- }
987
- }
988
- let loadCnt = 1;
989
- function loadCheck () {
990
- if (--loadCnt === 0 && globalLoadEventRetrigger && !noLoadEventRetriggers && (shimMode || !baselinePassthrough)) {
991
- window.dispatchEvent(new Event('load'));
992
- }
993
- }
994
- // this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
995
- if (hasDocument) {
996
- document.addEventListener('DOMContentLoaded', async () => {
997
- await initPromise;
998
- domContentLoadedCheck();
999
- });
1000
- window.addEventListener('load', async () => {
1001
- await initPromise;
1002
- loadCheck();
1003
- });
1004
- }
1005
-
1006
- let readyStateCompleteCnt = 1;
1007
- function readyStateCompleteCheck () {
1008
- if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough)) {
1009
- document.dispatchEvent(new Event('readystatechange'));
1010
- }
1011
- }
1012
-
1013
- const hasNext = script => script.nextSibling || script.parentNode && hasNext(script.parentNode);
1014
- const epCheck = (script, ready) => script.ep || !ready && (!script.src && !script.innerHTML || !hasNext(script)) || script.getAttribute('noshim') !== null || !(script.ep = true);
1015
-
1016
- function processImportMap (script, ready = readyStateCompleteCnt > 0) {
1017
- if (epCheck(script, ready)) return;
1018
- // we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
1019
- if (script.src) {
1020
- if (!shimMode)
1021
- return;
1022
- setImportMapSrcOrLazy();
1023
- }
1024
- if (acceptingImportMaps) {
1025
- importMapPromise = importMapPromise
1026
- .then(async () => {
1027
- importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
1028
- })
1029
- .catch(e => {
1030
- console.log(e);
1031
- if (e instanceof SyntaxError)
1032
- e = new Error(`Unable to parse import map ${e.message} in: ${script.src || script.innerHTML}`);
1033
- throwError(e);
1034
- });
1035
- if (!shimMode)
1036
- acceptingImportMaps = false;
1037
- }
1038
- }
1039
-
1040
- function processScript (script, ready = readyStateCompleteCnt > 0) {
1041
- if (epCheck(script, ready)) return;
1042
- // does this load block readystate complete
1043
- const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
1044
- // does this load block DOMContentLoaded
1045
- const isDomContentLoadedScript = domContentLoadedCnt > 0;
1046
- const isLoadScript = loadCnt > 0;
1047
- if (isLoadScript) loadCnt++;
1048
- if (isBlockingReadyScript) readyStateCompleteCnt++;
1049
- if (isDomContentLoadedScript) domContentLoadedCnt++;
1050
- const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isBlockingReadyScript && lastStaticLoadPromise)
1051
- .catch(throwError);
1052
- if (!noLoadEventRetriggers)
1053
- loadPromise.then(() => script.dispatchEvent(new Event('load')));
1054
- if (isBlockingReadyScript)
1055
- lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
1056
- if (isDomContentLoadedScript)
1057
- loadPromise.then(domContentLoadedCheck);
1058
- if (isLoadScript)
1059
- loadPromise.then(loadCheck);
1060
- }
1061
-
1062
- const fetchCache = {};
1063
- function processPreload (link) {
1064
- if (link.ep) return;
1065
- link.ep = true;
1066
- if (fetchCache[link.href])
1067
- return;
1068
- fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
1069
- }
1070
-
1071
- })();