iobroker.webui 1.25.2 → 1.26.0

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