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