es-module-shims 1.4.1 → 1.4.5

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