@jsenv/core 23.8.2 → 23.8.7

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 (133) hide show
  1. package/dist/jsenv_browser_system.js +46 -39
  2. package/dist/jsenv_browser_system.js.map +14 -14
  3. package/dist/jsenv_compile_proxy.js.map +6 -6
  4. package/dist/jsenv_exploring_index.js.map +5 -5
  5. package/dist/jsenv_exploring_redirector.js.map +12 -12
  6. package/dist/jsenv_toolbar.js.map +7 -7
  7. package/dist/jsenv_toolbar_injector.js.map +5 -5
  8. package/helpers/babel/.eslintrc.cjs +24 -24
  9. package/helpers/babel/AsyncGenerator/AsyncGenerator.js +81 -81
  10. package/helpers/babel/AwaitValue/AwaitValue.js +3 -3
  11. package/helpers/babel/applyDecoratorDescriptor/applyDecoratorDescriptor.js +33 -33
  12. package/helpers/babel/arrayLikeToArray/arrayLikeToArray.js +7 -7
  13. package/helpers/babel/arrayWithHoles/arrayWithHoles.js +4 -4
  14. package/helpers/babel/arrayWithoutHoles/arrayWithoutHoles.js +6 -6
  15. package/helpers/babel/assertThisInitialized/assertThisInitialized.js +7 -7
  16. package/helpers/babel/asyncGeneratorDelegate/asyncGeneratorDelegate.js +40 -40
  17. package/helpers/babel/asyncIterator/asyncIterator.js +12 -12
  18. package/helpers/babel/asyncToGenerator/asyncToGenerator.js +34 -34
  19. package/helpers/babel/awaitAsyncGenerator/awaitAsyncGenerator.js +5 -5
  20. package/helpers/babel/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +20 -20
  21. package/helpers/babel/classApplyDescriptorGet/classApplyDescriptorGet.js +6 -6
  22. package/helpers/babel/classApplyDescriptorSet/classApplyDescriptorSet.js +13 -13
  23. package/helpers/babel/classCallCheck/classCallCheck.js +5 -5
  24. package/helpers/babel/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +5 -5
  25. package/helpers/babel/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +6 -6
  26. package/helpers/babel/classExtractFieldDescriptor/classExtractFieldDescriptor.js +7 -7
  27. package/helpers/babel/classNameTDZError/classNameTDZError.js +4 -4
  28. package/helpers/babel/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +7 -7
  29. package/helpers/babel/classPrivateFieldGet/classPrivateFieldGet.js +7 -7
  30. package/helpers/babel/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +6 -6
  31. package/helpers/babel/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +5 -5
  32. package/helpers/babel/classPrivateFieldSet/classPrivateFieldSet.js +8 -8
  33. package/helpers/babel/classPrivateMethodGet/classPrivateMethodGet.js +6 -6
  34. package/helpers/babel/classPrivateMethodSet/classPrivateMethodSet.js +3 -3
  35. package/helpers/babel/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +9 -9
  36. package/helpers/babel/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +15 -15
  37. package/helpers/babel/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +6 -6
  38. package/helpers/babel/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +3 -3
  39. package/helpers/babel/construct/construct.js +16 -16
  40. package/helpers/babel/createClass/createClass.js +15 -15
  41. package/helpers/babel/createForOfIteratorHelper/createForOfIteratorHelper.js +60 -60
  42. package/helpers/babel/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +23 -23
  43. package/helpers/babel/createRawReactElement/createRawReactElement.js +50 -50
  44. package/helpers/babel/createSuper/createSuper.js +22 -22
  45. package/helpers/babel/decorate/decorate.js +403 -403
  46. package/helpers/babel/defaults/defaults.js +11 -11
  47. package/helpers/babel/defineEnumerableProperties/defineEnumerableProperties.js +23 -23
  48. package/helpers/babel/defineProperty/defineProperty.js +18 -18
  49. package/helpers/babel/extends/extends.js +14 -14
  50. package/helpers/babel/get/get.js +13 -13
  51. package/helpers/babel/getPrototypeOf/getPrototypeOf.js +4 -4
  52. package/helpers/babel/inherits/inherits.js +15 -15
  53. package/helpers/babel/inheritsLoose/inheritsLoose.js +7 -7
  54. package/helpers/babel/initializerDefineProperty/initializerDefineProperty.js +10 -10
  55. package/helpers/babel/initializerWarningHelper/initializerWarningHelper.js +6 -6
  56. package/helpers/babel/instanceof/instanceof.js +6 -6
  57. package/helpers/babel/interopRequireDefault/interopRequireDefault.js +3 -3
  58. package/helpers/babel/interopRequireWildcard/interopRequireWildcard.js +37 -37
  59. package/helpers/babel/isNativeFunction/isNativeFunction.js +4 -4
  60. package/helpers/babel/isNativeReflectConstruct/isNativeReflectConstruct.js +21 -21
  61. package/helpers/babel/iterableToArray/iterableToArray.js +7 -7
  62. package/helpers/babel/iterableToArrayLimit/iterableToArrayLimit.js +36 -36
  63. package/helpers/babel/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +10 -10
  64. package/helpers/babel/jsx/jsx.js +45 -45
  65. package/helpers/babel/maybeArrayLike/maybeArrayLike.js +10 -10
  66. package/helpers/babel/newArrowCheck/newArrowCheck.js +5 -5
  67. package/helpers/babel/nonIterableRest/nonIterableRest.js +5 -5
  68. package/helpers/babel/nonIterableSpread/nonIterableSpread.js +5 -5
  69. package/helpers/babel/objectDestructuringEmpty/objectDestructuringEmpty.js +3 -3
  70. package/helpers/babel/objectSpread/objectSpread.js +23 -23
  71. package/helpers/babel/objectSpread2/objectSpread2.js +33 -33
  72. package/helpers/babel/objectWithoutProperties/objectWithoutProperties.js +19 -19
  73. package/helpers/babel/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +13 -13
  74. package/helpers/babel/possibleConstructorReturn/possibleConstructorReturn.js +10 -10
  75. package/helpers/babel/readOnlyError/readOnlyError.js +4 -4
  76. package/helpers/babel/readme.md +9 -9
  77. package/helpers/babel/set/set.js +44 -44
  78. package/helpers/babel/setPrototypeOf/setPrototypeOf.js +6 -6
  79. package/helpers/babel/skipFirstGeneratorNext/skipFirstGeneratorNext.js +8 -8
  80. package/helpers/babel/slicedToArray/slicedToArray.js +10 -10
  81. package/helpers/babel/slicedToArrayLoose/slicedToArrayLoose.js +13 -13
  82. package/helpers/babel/superPropBase/superPropBase.js +10 -10
  83. package/helpers/babel/taggedTemplateLiteral/taggedTemplateLiteral.js +10 -10
  84. package/helpers/babel/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +7 -7
  85. package/helpers/babel/tdz/tdz.js +4 -4
  86. package/helpers/babel/temporalRef/temporalRef.js +6 -6
  87. package/helpers/babel/temporalUndefined/temporalUndefined.js +3 -3
  88. package/helpers/babel/toArray/toArray.js +10 -10
  89. package/helpers/babel/toConsumableArray/toConsumableArray.js +10 -10
  90. package/helpers/babel/toPrimitive/toPrimitive.js +10 -10
  91. package/helpers/babel/toPropertyKey/toPropertyKey.js +6 -6
  92. package/helpers/babel/typeof/typeof.js +14 -14
  93. package/helpers/babel/unsupportedIterableToArray/unsupportedIterableToArray.js +12 -12
  94. package/helpers/babel/wrapAsyncGenerator/wrapAsyncGenerator.js +8 -8
  95. package/helpers/babel/wrapNativeSuper/wrapNativeSuper.js +30 -30
  96. package/helpers/babel/wrapRegExp/wrapRegExp.js +63 -63
  97. package/helpers/babel/writeOnlyError/writeOnlyError.js +4 -4
  98. package/helpers/regenerator-runtime/regenerator-runtime.js +748 -748
  99. package/{LICENSE → license} +21 -21
  100. package/package.json +2 -2
  101. package/src/buildProject.js +300 -300
  102. package/src/execute.js +184 -184
  103. package/src/internal/browser-launcher/jsenv-browser-system.js +203 -199
  104. package/src/internal/building/buildUsingRollup.js +2 -10
  105. package/src/internal/compiling/babel_plugin_import_assertions.js +121 -121
  106. package/src/internal/compiling/babel_plugin_import_metadata.js +22 -22
  107. package/src/internal/compiling/babel_plugin_import_visitor.js +84 -84
  108. package/src/internal/compiling/compile-directory/getOrGenerateCompiledFile.js +268 -268
  109. package/src/internal/compiling/compile-directory/updateMeta.js +154 -154
  110. package/src/internal/compiling/compile-directory/validateCache.js +265 -265
  111. package/src/internal/compiling/compileFile.js +233 -224
  112. package/src/internal/compiling/compileHtml.js +550 -550
  113. package/src/internal/compiling/createCompiledFileService.js +291 -291
  114. package/src/internal/compiling/html_source_file_service.js +403 -404
  115. package/src/internal/compiling/js-compilation-service/jsenvTransform.js +272 -270
  116. package/src/internal/compiling/jsenvCompilerForHtml.js +374 -308
  117. package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -0
  118. package/src/internal/compiling/startCompileServer.js +1086 -1048
  119. package/src/internal/compiling/transformResultToCompilationResult.js +220 -220
  120. package/src/internal/executing/coverage/babel_plugin_instrument.js +90 -90
  121. package/src/internal/executing/coverage/reportToCoverage.js +193 -187
  122. package/src/internal/executing/executePlan.js +183 -183
  123. package/src/internal/executing/launchAndExecute.js +458 -458
  124. package/src/internal/generateGroupMap/featuresCompatMap.js +29 -0
  125. package/src/internal/generateGroupMap/jsenvBabelPluginCompatMap.js +1 -8
  126. package/src/internal/runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js +246 -246
  127. package/src/internal/runtime/createNodeRuntime/scanNodeRuntimeFeatures.js +112 -112
  128. package/src/internal/runtime/s.js +727 -727
  129. package/src/internal/toolbar/jsenv-logo.svg +144 -144
  130. package/src/internal/toolbar/toolbar.main.css +196 -196
  131. package/src/internal/toolbar/toolbar.main.js +227 -227
  132. package/src/internal/url_conversion.js +317 -317
  133. package/src/startExploring.js +309 -309
@@ -1,728 +1,728 @@
1
- /*
2
- * SJS 6.11.0
3
- * Minimal SystemJS Build
4
- */
5
- (function () {
6
-
7
- function errMsg(errCode, msg) {
8
- return (msg || "") + " (SystemJS https://git.io/JvFET#" + errCode + ")";
9
- }
10
-
11
- var hasSymbol = typeof Symbol !== 'undefined';
12
- var hasSelf = typeof self !== 'undefined';
13
- var hasDocument = typeof document !== 'undefined';
14
-
15
- var envGlobal = hasSelf ? self : global;
16
-
17
- var baseUrl;
18
-
19
- if (hasDocument) {
20
- var baseEl = document.querySelector('base[href]');
21
- if (baseEl)
22
- baseUrl = baseEl.href;
23
- }
24
-
25
- if (!baseUrl && typeof location !== 'undefined') {
26
- baseUrl = location.href.split('#')[0].split('?')[0];
27
- var lastSepIndex = baseUrl.lastIndexOf('/');
28
- if (lastSepIndex !== -1)
29
- baseUrl = baseUrl.slice(0, lastSepIndex + 1);
30
- }
31
-
32
- var backslashRegEx = /\\/g;
33
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
34
- if (relUrl.indexOf('\\') !== -1)
35
- relUrl = relUrl.replace(backslashRegEx, '/');
36
- // protocol-relative
37
- if (relUrl[0] === '/' && relUrl[1] === '/') {
38
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
39
- }
40
- // relative-url
41
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
42
- relUrl.length === 1 && (relUrl += '/')) ||
43
- relUrl[0] === '/') {
44
- var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
45
- // Disabled, but these cases will give inconsistent results for deep backtracking
46
- //if (parentUrl[parentProtocol.length] !== '/')
47
- // throw Error('Cannot resolve');
48
- // read pathname from parent URL
49
- // pathname taken to be part after leading "/"
50
- var pathname;
51
- if (parentUrl[parentProtocol.length + 1] === '/') {
52
- // resolving to a :// so we need to read out the auth and host
53
- if (parentProtocol !== 'file:') {
54
- pathname = parentUrl.slice(parentProtocol.length + 2);
55
- pathname = pathname.slice(pathname.indexOf('/') + 1);
56
- }
57
- else {
58
- pathname = parentUrl.slice(8);
59
- }
60
- }
61
- else {
62
- // resolving to :/ so pathname is the /... part
63
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
64
- }
65
-
66
- if (relUrl[0] === '/')
67
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
68
-
69
- // join together and split for removal of .. and . segments
70
- // looping the string instead of anything fancy for perf reasons
71
- // '../../../../../z' resolved to 'x/y' is just 'z'
72
- var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
73
-
74
- var output = [];
75
- var segmentIndex = -1;
76
- for (var i = 0; i < segmented.length; i++) {
77
- // busy reading a segment - only terminate on '/'
78
- if (segmentIndex !== -1) {
79
- if (segmented[i] === '/') {
80
- output.push(segmented.slice(segmentIndex, i + 1));
81
- segmentIndex = -1;
82
- }
83
- }
84
-
85
- // new segment - check if it is relative
86
- else if (segmented[i] === '.') {
87
- // ../ segment
88
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
89
- output.pop();
90
- i += 2;
91
- }
92
- // ./ segment
93
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
94
- i += 1;
95
- }
96
- else {
97
- // the start of a new segment as below
98
- segmentIndex = i;
99
- }
100
- }
101
- // it is the start of a new segment
102
- else {
103
- segmentIndex = i;
104
- }
105
- }
106
- // finish reading out the last segment
107
- if (segmentIndex !== -1)
108
- output.push(segmented.slice(segmentIndex));
109
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
110
- }
111
- }
112
-
113
- /*
114
- * Import maps implementation
115
- *
116
- * To make lookups fast we pre-resolve the entire import map
117
- * and then match based on backtracked hash lookups
118
- *
119
- */
120
-
121
- function resolveUrl (relUrl, parentUrl) {
122
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
123
- }
124
-
125
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap, parentUrl) {
126
- for (var p in packages) {
127
- var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
128
- var rhs = packages[p];
129
- // package fallbacks not currently supported
130
- if (typeof rhs !== 'string')
131
- continue;
132
- var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
133
- if (!mapped) {
134
- targetWarning('W1', p, rhs);
135
- }
136
- else
137
- outPackages[resolvedLhs] = mapped;
138
- }
139
- }
140
-
141
- function resolveAndComposeImportMap (json, baseUrl, outMap) {
142
- if (json.imports)
143
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null);
144
-
145
- var u;
146
- for (u in json.scopes || {}) {
147
- var resolvedScope = resolveUrl(u, baseUrl);
148
- resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope);
149
- }
150
-
151
- for (u in json.depcache || {})
152
- outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u];
153
-
154
- for (u in json.integrity || {})
155
- outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u];
156
- }
157
-
158
- function getMatch (path, matchObj) {
159
- if (matchObj[path])
160
- return path;
161
- var sepIndex = path.length;
162
- do {
163
- var segment = path.slice(0, sepIndex + 1);
164
- if (segment in matchObj)
165
- return segment;
166
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
167
- }
168
-
169
- function applyPackages (id, packages) {
170
- var pkgName = getMatch(id, packages);
171
- if (pkgName) {
172
- var pkg = packages[pkgName];
173
- if (pkg === null) return;
174
- if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') {
175
- targetWarning('W2', pkgName, pkg);
176
- }
177
- else
178
- return pkg + id.slice(pkgName.length);
179
- }
180
- }
181
-
182
- function targetWarning (code, match, target, msg) {
183
- console.warn(errMsg(code, [target, match].join(', ') ));
184
- }
185
-
186
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
187
- var scopes = importMap.scopes;
188
- var scopeUrl = parentUrl && getMatch(parentUrl, scopes);
189
- while (scopeUrl) {
190
- var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]);
191
- if (packageResolution)
192
- return packageResolution;
193
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes);
194
- }
195
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
196
- }
197
-
198
- /*
199
- * SystemJS Core
200
- *
201
- * Provides
202
- * - System.import
203
- * - System.register support for
204
- * live bindings, function hoisting through circular references,
205
- * reexports, dynamic import, import.meta.url, top-level await
206
- * - System.getRegister to get the registration
207
- * - Symbol.toStringTag support in Module objects
208
- * - Hookable System.createContext to customize import.meta
209
- * - System.onload(err, id, deps) handler for tracing / hot-reloading
210
- *
211
- * Core comes with no System.prototype.resolve or
212
- * System.prototype.instantiate implementations
213
- */
214
-
215
- var toStringTag = hasSymbol && Symbol.toStringTag;
216
- var REGISTRY = hasSymbol ? Symbol() : '@';
217
-
218
- function SystemJS () {
219
- this[REGISTRY] = {};
220
- }
221
-
222
- var systemJSPrototype = SystemJS.prototype;
223
-
224
- systemJSPrototype.import = function (id, parentUrl) {
225
- var loader = this;
226
- return Promise.resolve(loader.prepareImport())
227
- .then(function() {
228
- return loader.resolve(id, parentUrl);
229
- })
230
- .then(function (id) {
231
- var load = getOrCreateLoad(loader, id);
232
- return load.C || topLevelLoad(loader, load);
233
- });
234
- };
235
-
236
- // Hookable createContext function -> allowing eg custom import meta
237
- systemJSPrototype.createContext = function (parentId) {
238
- var loader = this;
239
- return {
240
- url: parentId,
241
- resolve: function (id, parentUrl) {
242
- return Promise.resolve(loader.resolve(id, parentUrl || parentId));
243
- }
244
- };
245
- };
246
- function loadToId (load) {
247
- return load.id;
248
- }
249
- function triggerOnload (loader, load, err, isErrSource) {
250
- loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource);
251
- if (err)
252
- throw err;
253
- }
254
-
255
- var lastRegister;
256
- systemJSPrototype.register = function (deps, declare) {
257
- lastRegister = [deps, declare];
258
- };
259
-
260
- /*
261
- * getRegister provides the last anonymous System.register call
262
- */
263
- systemJSPrototype.getRegister = function () {
264
- var _lastRegister = lastRegister;
265
- lastRegister = undefined;
266
- return _lastRegister;
267
- };
268
-
269
- function getOrCreateLoad (loader, id, firstParentUrl) {
270
- var load = loader[REGISTRY][id];
271
- if (load)
272
- return load;
273
-
274
- var importerSetters = [];
275
- var ns = Object.create(null);
276
- if (toStringTag)
277
- Object.defineProperty(ns, toStringTag, { value: 'Module' });
278
-
279
- var instantiatePromise = Promise.resolve()
280
- .then(function () {
281
- return loader.instantiate(id, firstParentUrl);
282
- })
283
- .then(function (registration) {
284
- if (!registration)
285
- throw Error(errMsg(2, id ));
286
- function _export (name, value) {
287
- // note if we have hoisted exports (including reexports)
288
- load.h = true;
289
- var changed = false;
290
- if (typeof name === 'string') {
291
- if (!(name in ns) || ns[name] !== value) {
292
- ns[name] = value;
293
- changed = true;
294
- }
295
- }
296
- else {
297
- for (var p in name) {
298
- var value = name[p];
299
- if (!(p in ns) || ns[p] !== value) {
300
- ns[p] = value;
301
- changed = true;
302
- }
303
- }
304
-
305
- if (name && name.__esModule) {
306
- ns.__esModule = name.__esModule;
307
- }
308
- }
309
- if (changed)
310
- for (var i = 0; i < importerSetters.length; i++) {
311
- var setter = importerSetters[i];
312
- if (setter) setter(ns);
313
- }
314
- return value;
315
- }
316
- var declared = registration[1](_export, registration[1].length === 2 ? {
317
- import: function (importId) {
318
- return loader.import(importId, id);
319
- },
320
- meta: loader.createContext(id)
321
- } : undefined);
322
- load.e = declared.execute || function () {};
323
- return [registration[0], declared.setters || []];
324
- }, function (err) {
325
- load.e = null;
326
- load.er = err;
327
- throw err;
328
- });
329
-
330
- var linkPromise = instantiatePromise
331
- .then(function (instantiation) {
332
- return Promise.all(instantiation[0].map(function (dep, i) {
333
- var setter = instantiation[1][i];
334
- return Promise.resolve(loader.resolve(dep, id))
335
- .then(function (depId) {
336
- var depLoad = getOrCreateLoad(loader, depId, id);
337
- // depLoad.I may be undefined for already-evaluated
338
- return Promise.resolve(depLoad.I)
339
- .then(function () {
340
- if (setter) {
341
- depLoad.i.push(setter);
342
- // only run early setters when there are hoisted exports of that module
343
- // the timing works here as pending hoisted export calls will trigger through importerSetters
344
- if (depLoad.h || !depLoad.I)
345
- setter(depLoad.n);
346
- }
347
- return depLoad;
348
- });
349
- });
350
- }))
351
- .then(function (depLoads) {
352
- load.d = depLoads;
353
- });
354
- });
355
-
356
- // Capital letter = a promise function
357
- return load = loader[REGISTRY][id] = {
358
- id: id,
359
- // importerSetters, the setters functions registered to this dependency
360
- // we retain this to add more later
361
- i: importerSetters,
362
- // module namespace object
363
- n: ns,
364
-
365
- // instantiate
366
- I: instantiatePromise,
367
- // link
368
- L: linkPromise,
369
- // whether it has hoisted exports
370
- h: false,
371
-
372
- // On instantiate completion we have populated:
373
- // dependency load records
374
- d: undefined,
375
- // execution function
376
- e: undefined,
377
-
378
- // On execution we have populated:
379
- // the execution error if any
380
- er: undefined,
381
- // in the case of TLA, the execution promise
382
- E: undefined,
383
-
384
- // On execution, L, I, E cleared
385
-
386
- // Promise for top-level completion
387
- C: undefined,
388
-
389
- // parent instantiator / executor
390
- p: undefined
391
- };
392
- }
393
-
394
- function instantiateAll (loader, load, parent, loaded) {
395
- if (!loaded[load.id]) {
396
- loaded[load.id] = true;
397
- // load.L may be undefined for already-instantiated
398
- return Promise.resolve(load.L)
399
- .then(function () {
400
- if (!load.p || load.p.e === null)
401
- load.p = parent;
402
- return Promise.all(load.d.map(function (dep) {
403
- return instantiateAll(loader, dep, parent, loaded);
404
- }));
405
- })
406
- .catch(function (err) {
407
- if (load.er)
408
- throw err;
409
- load.e = null;
410
- throw err;
411
- });
412
- }
413
- }
414
-
415
- function topLevelLoad (loader, load) {
416
- return load.C = instantiateAll(loader, load, load, {})
417
- .then(function () {
418
- return postOrderExec(loader, load, {});
419
- })
420
- .then(function () {
421
- return load.n;
422
- });
423
- }
424
-
425
- // the closest we can get to call(undefined)
426
- var nullContext = Object.freeze(Object.create(null));
427
-
428
- // returns a promise if and only if a top-level await subgraph
429
- // throws on sync errors
430
- function postOrderExec (loader, load, seen) {
431
- if (seen[load.id])
432
- return;
433
- seen[load.id] = true;
434
-
435
- if (!load.e) {
436
- if (load.er)
437
- throw load.er;
438
- if (load.E)
439
- return load.E;
440
- return;
441
- }
442
-
443
- // deps execute first, unless circular
444
- var depLoadPromises;
445
- load.d.forEach(function (depLoad) {
446
- try {
447
- var depLoadPromise = postOrderExec(loader, depLoad, seen);
448
- if (depLoadPromise)
449
- (depLoadPromises = depLoadPromises || []).push(depLoadPromise);
450
- }
451
- catch (err) {
452
- load.e = null;
453
- load.er = err;
454
- throw err;
455
- }
456
- });
457
- if (depLoadPromises)
458
- return Promise.all(depLoadPromises).then(doExec);
459
-
460
- return doExec();
461
-
462
- function doExec () {
463
- try {
464
- var execPromise = load.e.call(nullContext);
465
- if (execPromise) {
466
- execPromise = execPromise.then(function () {
467
- load.C = load.n;
468
- load.E = null; // indicates completion
469
- if (!true) ;
470
- }, function (err) {
471
- load.er = err;
472
- load.E = null;
473
- if (!true) ;
474
- throw err;
475
- });
476
- return load.E = execPromise;
477
- }
478
- // (should be a promise, but a minify optimization to leave out Promise.resolve)
479
- load.C = load.n;
480
- load.L = load.I = undefined;
481
- }
482
- catch (err) {
483
- load.er = err;
484
- throw err;
485
- }
486
- finally {
487
- load.e = null;
488
- }
489
- }
490
- }
491
-
492
- envGlobal.System = new SystemJS();
493
-
494
- /*
495
- * SystemJS browser attachments for script and import map processing
496
- */
497
-
498
- var importMapPromise = Promise.resolve();
499
- var importMap = { imports: {}, scopes: {}, depcache: {}, integrity: {} };
500
-
501
- // Scripts are processed immediately, on the first System.import, and on DOMReady.
502
- // Import map scripts are processed only once (by being marked) and in order for each phase.
503
- // This is to avoid using DOM mutation observers in core, although that would be an alternative.
504
- var processFirst = hasDocument;
505
- systemJSPrototype.prepareImport = function (doProcessScripts) {
506
- if (processFirst || doProcessScripts) {
507
- processScripts();
508
- processFirst = false;
509
- }
510
- return importMapPromise;
511
- };
512
- if (hasDocument) {
513
- processScripts();
514
- window.addEventListener('DOMContentLoaded', processScripts);
515
- }
516
-
517
- function processScripts () {
518
- [].forEach.call(document.querySelectorAll('script'), function (script) {
519
- if (script.sp) // sp marker = systemjs processed
520
- return;
521
- // TODO: deprecate systemjs-module in next major now that we have auto import
522
- if (script.type === 'systemjs-module') {
523
- script.sp = true;
524
- if (!script.src)
525
- return;
526
- System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
527
- // if there is a script load error, dispatch an "error" event
528
- // on the script tag.
529
- if (e.message.indexOf('https://git.io/JvFET#3') > -1) {
530
- var event = document.createEvent('Event');
531
- event.initEvent('error', false, false);
532
- script.dispatchEvent(event);
533
- }
534
- return Promise.reject(e);
535
- });
536
- }
537
- else if (script.type === 'systemjs-importmap') {
538
- script.sp = true;
539
- var fetchPromise = script.src ? fetch(script.src, { integrity: script.integrity }).then(function (res) {
540
- if (!res.ok)
541
- throw Error( res.status );
542
- return res.text();
543
- }).catch(function (err) {
544
- err.message = errMsg('W4', script.src ) + '\n' + err.message;
545
- console.warn(err);
546
- if (typeof script.onerror === 'function') {
547
- script.onerror();
548
- }
549
- return '{}';
550
- }) : script.innerHTML;
551
- importMapPromise = importMapPromise.then(function () {
552
- return fetchPromise;
553
- }).then(function (text) {
554
- extendImportMap(importMap, text, script.src || baseUrl);
555
- });
556
- }
557
- });
558
- }
559
-
560
- function extendImportMap (importMap, newMapText, newMapUrl) {
561
- var newMap = {};
562
- try {
563
- newMap = JSON.parse(newMapText);
564
- } catch (err) {
565
- console.warn(Error(( errMsg('W5') )));
566
- }
567
- resolveAndComposeImportMap(newMap, newMapUrl, importMap);
568
- }
569
-
570
- /*
571
- * Script instantiation loading
572
- */
573
-
574
- if (hasDocument) {
575
- window.addEventListener('error', function (evt) {
576
- lastWindowErrorUrl = evt.filename;
577
- lastWindowError = evt.error;
578
- });
579
- var baseOrigin = location.origin;
580
- }
581
-
582
- systemJSPrototype.createScript = function (url) {
583
- var script = document.createElement('script');
584
- script.async = true;
585
- // Only add cross origin for actual cross origin
586
- // this is because Safari triggers for all
587
- // - https://bugs.webkit.org/show_bug.cgi?id=171566
588
- if (url.indexOf(baseOrigin + '/'))
589
- script.crossOrigin = 'anonymous';
590
- var integrity = importMap.integrity[url];
591
- if (integrity)
592
- script.integrity = integrity;
593
- script.src = url;
594
- return script;
595
- };
596
-
597
- // Auto imports -> script tags can be inlined directly for load phase
598
- var lastAutoImportDeps, lastAutoImportTimeout;
599
- var autoImportCandidates = {};
600
- var systemRegister = systemJSPrototype.register;
601
- var inlineScriptCount = 0;
602
- systemJSPrototype.register = function (deps, declare) {
603
- if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') {
604
- var scripts = document.querySelectorAll('script[src]');
605
- var lastScript = scripts[scripts.length - 1];
606
- var lastAutoImportUrl
607
- lastAutoImportDeps = deps;
608
- if (lastScript) {
609
- lastAutoImportUrl = lastScript.src;
610
- }
611
- else {
612
- inlineScriptCount++
613
- lastAutoImportUrl = document.location.href + "__inline_script__" + inlineScriptCount;
614
- }
615
- // if this is already a System load, then the instantiate has already begun
616
- // so this re-import has no consequence
617
- var loader = this;
618
- lastAutoImportTimeout = setTimeout(function () {
619
- autoImportCandidates[lastAutoImportUrl] = [deps, declare];
620
- loader.import(lastAutoImportUrl);
621
- });
622
- }
623
- else {
624
- lastAutoImportDeps = undefined;
625
- }
626
- return systemRegister.call(this, deps, declare);
627
- };
628
-
629
- var lastWindowErrorUrl, lastWindowError;
630
- systemJSPrototype.instantiate = function (url, firstParentUrl) {
631
- var autoImportRegistration = autoImportCandidates[url];
632
- if (autoImportRegistration) {
633
- delete autoImportCandidates[url];
634
- return autoImportRegistration;
635
- }
636
- var loader = this;
637
- return Promise.resolve(systemJSPrototype.createScript(url)).then(function (script) {
638
- return new Promise(function (resolve, reject) {
639
- script.addEventListener('error', function () {
640
- reject(Error(errMsg(3, [url, firstParentUrl].join(', ') )));
641
- });
642
- script.addEventListener('load', function () {
643
- document.head.removeChild(script);
644
- // Note that if an error occurs that isn't caught by this if statement,
645
- // that getRegister will return null and a "did not instantiate" error will be thrown.
646
- if (lastWindowErrorUrl === url) {
647
- reject(lastWindowError);
648
- }
649
- else {
650
- var register = loader.getRegister(url);
651
- // Clear any auto import registration for dynamic import scripts during load
652
- if (register && register[0] === lastAutoImportDeps)
653
- clearTimeout(lastAutoImportTimeout);
654
- resolve(register);
655
- }
656
- });
657
- document.head.appendChild(script);
658
- });
659
- });
660
- };
661
-
662
- /*
663
- * Fetch loader, sets up shouldFetch and fetch hooks
664
- */
665
- systemJSPrototype.shouldFetch = function () {
666
- return false;
667
- };
668
- if (typeof fetch !== 'undefined')
669
- systemJSPrototype.fetch = fetch;
670
-
671
- var instantiate = systemJSPrototype.instantiate;
672
- var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
673
- systemJSPrototype.instantiate = function (url, parent) {
674
- var loader = this;
675
- if (!this.shouldFetch(url))
676
- return instantiate.apply(this, arguments);
677
- return this.fetch(url, {
678
- credentials: 'same-origin',
679
- integrity: importMap.integrity[url]
680
- })
681
- .then(function (res) {
682
- if (!res.ok)
683
- throw Error(errMsg(7, [res.status, res.statusText, url, parent].join(', ') ));
684
- var contentType = res.headers.get('content-type');
685
- if (!contentType || !jsContentTypeRegEx.test(contentType))
686
- throw Error(errMsg(4, contentType ));
687
- return res.text().then(function (source) {
688
- if (source.indexOf('//# sourceURL=') < 0)
689
- source += '\n//# sourceURL=' + url;
690
- (0, eval)(source);
691
- return loader.getRegister(url);
692
- });
693
- });
694
- };
695
-
696
- systemJSPrototype.resolve = function (id, parentUrl) {
697
- parentUrl = parentUrl || !true || baseUrl;
698
- return resolveImportMap(( importMap), resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
699
- };
700
-
701
- function throwUnresolved (id, parentUrl) {
702
- throw Error(errMsg(8, [id, parentUrl].join(', ') ));
703
- }
704
-
705
- var systemInstantiate = systemJSPrototype.instantiate;
706
- systemJSPrototype.instantiate = function (url, firstParentUrl) {
707
- var preloads = ( importMap).depcache[url];
708
- if (preloads) {
709
- for (var i = 0; i < preloads.length; i++)
710
- getOrCreateLoad(this, this.resolve(preloads[i], url), url);
711
- }
712
- return systemInstantiate.call(this, url, firstParentUrl);
713
- };
714
-
715
- /*
716
- * Supports loading System.register in workers
717
- */
718
-
719
- if (hasSelf && typeof importScripts === 'function')
720
- systemJSPrototype.instantiate = function (url) {
721
- var loader = this;
722
- return Promise.resolve().then(function () {
723
- importScripts(url);
724
- return loader.getRegister(url);
725
- });
726
- };
727
-
1
+ /*
2
+ * SJS 6.11.0
3
+ * Minimal SystemJS Build
4
+ */
5
+ (function () {
6
+
7
+ function errMsg(errCode, msg) {
8
+ return (msg || "") + " (SystemJS https://git.io/JvFET#" + errCode + ")";
9
+ }
10
+
11
+ var hasSymbol = typeof Symbol !== 'undefined';
12
+ var hasSelf = typeof self !== 'undefined';
13
+ var hasDocument = typeof document !== 'undefined';
14
+
15
+ var envGlobal = hasSelf ? self : global;
16
+
17
+ var baseUrl;
18
+
19
+ if (hasDocument) {
20
+ var baseEl = document.querySelector('base[href]');
21
+ if (baseEl)
22
+ baseUrl = baseEl.href;
23
+ }
24
+
25
+ if (!baseUrl && typeof location !== 'undefined') {
26
+ baseUrl = location.href.split('#')[0].split('?')[0];
27
+ var lastSepIndex = baseUrl.lastIndexOf('/');
28
+ if (lastSepIndex !== -1)
29
+ baseUrl = baseUrl.slice(0, lastSepIndex + 1);
30
+ }
31
+
32
+ var backslashRegEx = /\\/g;
33
+ function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
34
+ if (relUrl.indexOf('\\') !== -1)
35
+ relUrl = relUrl.replace(backslashRegEx, '/');
36
+ // protocol-relative
37
+ if (relUrl[0] === '/' && relUrl[1] === '/') {
38
+ return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
39
+ }
40
+ // relative-url
41
+ else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
42
+ relUrl.length === 1 && (relUrl += '/')) ||
43
+ relUrl[0] === '/') {
44
+ var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
45
+ // Disabled, but these cases will give inconsistent results for deep backtracking
46
+ //if (parentUrl[parentProtocol.length] !== '/')
47
+ // throw Error('Cannot resolve');
48
+ // read pathname from parent URL
49
+ // pathname taken to be part after leading "/"
50
+ var pathname;
51
+ if (parentUrl[parentProtocol.length + 1] === '/') {
52
+ // resolving to a :// so we need to read out the auth and host
53
+ if (parentProtocol !== 'file:') {
54
+ pathname = parentUrl.slice(parentProtocol.length + 2);
55
+ pathname = pathname.slice(pathname.indexOf('/') + 1);
56
+ }
57
+ else {
58
+ pathname = parentUrl.slice(8);
59
+ }
60
+ }
61
+ else {
62
+ // resolving to :/ so pathname is the /... part
63
+ pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
64
+ }
65
+
66
+ if (relUrl[0] === '/')
67
+ return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
68
+
69
+ // join together and split for removal of .. and . segments
70
+ // looping the string instead of anything fancy for perf reasons
71
+ // '../../../../../z' resolved to 'x/y' is just 'z'
72
+ var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
73
+
74
+ var output = [];
75
+ var segmentIndex = -1;
76
+ for (var i = 0; i < segmented.length; i++) {
77
+ // busy reading a segment - only terminate on '/'
78
+ if (segmentIndex !== -1) {
79
+ if (segmented[i] === '/') {
80
+ output.push(segmented.slice(segmentIndex, i + 1));
81
+ segmentIndex = -1;
82
+ }
83
+ }
84
+
85
+ // new segment - check if it is relative
86
+ else if (segmented[i] === '.') {
87
+ // ../ segment
88
+ if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
89
+ output.pop();
90
+ i += 2;
91
+ }
92
+ // ./ segment
93
+ else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
94
+ i += 1;
95
+ }
96
+ else {
97
+ // the start of a new segment as below
98
+ segmentIndex = i;
99
+ }
100
+ }
101
+ // it is the start of a new segment
102
+ else {
103
+ segmentIndex = i;
104
+ }
105
+ }
106
+ // finish reading out the last segment
107
+ if (segmentIndex !== -1)
108
+ output.push(segmented.slice(segmentIndex));
109
+ return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
110
+ }
111
+ }
112
+
113
+ /*
114
+ * Import maps implementation
115
+ *
116
+ * To make lookups fast we pre-resolve the entire import map
117
+ * and then match based on backtracked hash lookups
118
+ *
119
+ */
120
+
121
+ function resolveUrl (relUrl, parentUrl) {
122
+ return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
123
+ }
124
+
125
+ function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap, parentUrl) {
126
+ for (var p in packages) {
127
+ var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
128
+ var rhs = packages[p];
129
+ // package fallbacks not currently supported
130
+ if (typeof rhs !== 'string')
131
+ continue;
132
+ var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
133
+ if (!mapped) {
134
+ targetWarning('W1', p, rhs);
135
+ }
136
+ else
137
+ outPackages[resolvedLhs] = mapped;
138
+ }
139
+ }
140
+
141
+ function resolveAndComposeImportMap (json, baseUrl, outMap) {
142
+ if (json.imports)
143
+ resolveAndComposePackages(json.imports, outMap.imports, baseUrl, outMap, null);
144
+
145
+ var u;
146
+ for (u in json.scopes || {}) {
147
+ var resolvedScope = resolveUrl(u, baseUrl);
148
+ resolveAndComposePackages(json.scopes[u], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, outMap, resolvedScope);
149
+ }
150
+
151
+ for (u in json.depcache || {})
152
+ outMap.depcache[resolveUrl(u, baseUrl)] = json.depcache[u];
153
+
154
+ for (u in json.integrity || {})
155
+ outMap.integrity[resolveUrl(u, baseUrl)] = json.integrity[u];
156
+ }
157
+
158
+ function getMatch (path, matchObj) {
159
+ if (matchObj[path])
160
+ return path;
161
+ var sepIndex = path.length;
162
+ do {
163
+ var segment = path.slice(0, sepIndex + 1);
164
+ if (segment in matchObj)
165
+ return segment;
166
+ } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
167
+ }
168
+
169
+ function applyPackages (id, packages) {
170
+ var pkgName = getMatch(id, packages);
171
+ if (pkgName) {
172
+ var pkg = packages[pkgName];
173
+ if (pkg === null) return;
174
+ if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/') {
175
+ targetWarning('W2', pkgName, pkg);
176
+ }
177
+ else
178
+ return pkg + id.slice(pkgName.length);
179
+ }
180
+ }
181
+
182
+ function targetWarning (code, match, target, msg) {
183
+ console.warn(errMsg(code, [target, match].join(', ') ));
184
+ }
185
+
186
+ function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
187
+ var scopes = importMap.scopes;
188
+ var scopeUrl = parentUrl && getMatch(parentUrl, scopes);
189
+ while (scopeUrl) {
190
+ var packageResolution = applyPackages(resolvedOrPlain, scopes[scopeUrl]);
191
+ if (packageResolution)
192
+ return packageResolution;
193
+ scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), scopes);
194
+ }
195
+ return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
196
+ }
197
+
198
+ /*
199
+ * SystemJS Core
200
+ *
201
+ * Provides
202
+ * - System.import
203
+ * - System.register support for
204
+ * live bindings, function hoisting through circular references,
205
+ * reexports, dynamic import, import.meta.url, top-level await
206
+ * - System.getRegister to get the registration
207
+ * - Symbol.toStringTag support in Module objects
208
+ * - Hookable System.createContext to customize import.meta
209
+ * - System.onload(err, id, deps) handler for tracing / hot-reloading
210
+ *
211
+ * Core comes with no System.prototype.resolve or
212
+ * System.prototype.instantiate implementations
213
+ */
214
+
215
+ var toStringTag = hasSymbol && Symbol.toStringTag;
216
+ var REGISTRY = hasSymbol ? Symbol() : '@';
217
+
218
+ function SystemJS () {
219
+ this[REGISTRY] = {};
220
+ }
221
+
222
+ var systemJSPrototype = SystemJS.prototype;
223
+
224
+ systemJSPrototype.import = function (id, parentUrl) {
225
+ var loader = this;
226
+ return Promise.resolve(loader.prepareImport())
227
+ .then(function() {
228
+ return loader.resolve(id, parentUrl);
229
+ })
230
+ .then(function (id) {
231
+ var load = getOrCreateLoad(loader, id);
232
+ return load.C || topLevelLoad(loader, load);
233
+ });
234
+ };
235
+
236
+ // Hookable createContext function -> allowing eg custom import meta
237
+ systemJSPrototype.createContext = function (parentId) {
238
+ var loader = this;
239
+ return {
240
+ url: parentId,
241
+ resolve: function (id, parentUrl) {
242
+ return Promise.resolve(loader.resolve(id, parentUrl || parentId));
243
+ }
244
+ };
245
+ };
246
+ function loadToId (load) {
247
+ return load.id;
248
+ }
249
+ function triggerOnload (loader, load, err, isErrSource) {
250
+ loader.onload(err, load.id, load.d && load.d.map(loadToId), !!isErrSource);
251
+ if (err)
252
+ throw err;
253
+ }
254
+
255
+ var lastRegister;
256
+ systemJSPrototype.register = function (deps, declare) {
257
+ lastRegister = [deps, declare];
258
+ };
259
+
260
+ /*
261
+ * getRegister provides the last anonymous System.register call
262
+ */
263
+ systemJSPrototype.getRegister = function () {
264
+ var _lastRegister = lastRegister;
265
+ lastRegister = undefined;
266
+ return _lastRegister;
267
+ };
268
+
269
+ function getOrCreateLoad (loader, id, firstParentUrl) {
270
+ var load = loader[REGISTRY][id];
271
+ if (load)
272
+ return load;
273
+
274
+ var importerSetters = [];
275
+ var ns = Object.create(null);
276
+ if (toStringTag)
277
+ Object.defineProperty(ns, toStringTag, { value: 'Module' });
278
+
279
+ var instantiatePromise = Promise.resolve()
280
+ .then(function () {
281
+ return loader.instantiate(id, firstParentUrl);
282
+ })
283
+ .then(function (registration) {
284
+ if (!registration)
285
+ throw Error(errMsg(2, id ));
286
+ function _export (name, value) {
287
+ // note if we have hoisted exports (including reexports)
288
+ load.h = true;
289
+ var changed = false;
290
+ if (typeof name === 'string') {
291
+ if (!(name in ns) || ns[name] !== value) {
292
+ ns[name] = value;
293
+ changed = true;
294
+ }
295
+ }
296
+ else {
297
+ for (var p in name) {
298
+ var value = name[p];
299
+ if (!(p in ns) || ns[p] !== value) {
300
+ ns[p] = value;
301
+ changed = true;
302
+ }
303
+ }
304
+
305
+ if (name && name.__esModule) {
306
+ ns.__esModule = name.__esModule;
307
+ }
308
+ }
309
+ if (changed)
310
+ for (var i = 0; i < importerSetters.length; i++) {
311
+ var setter = importerSetters[i];
312
+ if (setter) setter(ns);
313
+ }
314
+ return value;
315
+ }
316
+ var declared = registration[1](_export, registration[1].length === 2 ? {
317
+ import: function (importId) {
318
+ return loader.import(importId, id);
319
+ },
320
+ meta: loader.createContext(id)
321
+ } : undefined);
322
+ load.e = declared.execute || function () {};
323
+ return [registration[0], declared.setters || []];
324
+ }, function (err) {
325
+ load.e = null;
326
+ load.er = err;
327
+ throw err;
328
+ });
329
+
330
+ var linkPromise = instantiatePromise
331
+ .then(function (instantiation) {
332
+ return Promise.all(instantiation[0].map(function (dep, i) {
333
+ var setter = instantiation[1][i];
334
+ return Promise.resolve(loader.resolve(dep, id))
335
+ .then(function (depId) {
336
+ var depLoad = getOrCreateLoad(loader, depId, id);
337
+ // depLoad.I may be undefined for already-evaluated
338
+ return Promise.resolve(depLoad.I)
339
+ .then(function () {
340
+ if (setter) {
341
+ depLoad.i.push(setter);
342
+ // only run early setters when there are hoisted exports of that module
343
+ // the timing works here as pending hoisted export calls will trigger through importerSetters
344
+ if (depLoad.h || !depLoad.I)
345
+ setter(depLoad.n);
346
+ }
347
+ return depLoad;
348
+ });
349
+ });
350
+ }))
351
+ .then(function (depLoads) {
352
+ load.d = depLoads;
353
+ });
354
+ });
355
+
356
+ // Capital letter = a promise function
357
+ return load = loader[REGISTRY][id] = {
358
+ id: id,
359
+ // importerSetters, the setters functions registered to this dependency
360
+ // we retain this to add more later
361
+ i: importerSetters,
362
+ // module namespace object
363
+ n: ns,
364
+
365
+ // instantiate
366
+ I: instantiatePromise,
367
+ // link
368
+ L: linkPromise,
369
+ // whether it has hoisted exports
370
+ h: false,
371
+
372
+ // On instantiate completion we have populated:
373
+ // dependency load records
374
+ d: undefined,
375
+ // execution function
376
+ e: undefined,
377
+
378
+ // On execution we have populated:
379
+ // the execution error if any
380
+ er: undefined,
381
+ // in the case of TLA, the execution promise
382
+ E: undefined,
383
+
384
+ // On execution, L, I, E cleared
385
+
386
+ // Promise for top-level completion
387
+ C: undefined,
388
+
389
+ // parent instantiator / executor
390
+ p: undefined
391
+ };
392
+ }
393
+
394
+ function instantiateAll (loader, load, parent, loaded) {
395
+ if (!loaded[load.id]) {
396
+ loaded[load.id] = true;
397
+ // load.L may be undefined for already-instantiated
398
+ return Promise.resolve(load.L)
399
+ .then(function () {
400
+ if (!load.p || load.p.e === null)
401
+ load.p = parent;
402
+ return Promise.all(load.d.map(function (dep) {
403
+ return instantiateAll(loader, dep, parent, loaded);
404
+ }));
405
+ })
406
+ .catch(function (err) {
407
+ if (load.er)
408
+ throw err;
409
+ load.e = null;
410
+ throw err;
411
+ });
412
+ }
413
+ }
414
+
415
+ function topLevelLoad (loader, load) {
416
+ return load.C = instantiateAll(loader, load, load, {})
417
+ .then(function () {
418
+ return postOrderExec(loader, load, {});
419
+ })
420
+ .then(function () {
421
+ return load.n;
422
+ });
423
+ }
424
+
425
+ // the closest we can get to call(undefined)
426
+ var nullContext = Object.freeze(Object.create(null));
427
+
428
+ // returns a promise if and only if a top-level await subgraph
429
+ // throws on sync errors
430
+ function postOrderExec (loader, load, seen) {
431
+ if (seen[load.id])
432
+ return;
433
+ seen[load.id] = true;
434
+
435
+ if (!load.e) {
436
+ if (load.er)
437
+ throw load.er;
438
+ if (load.E)
439
+ return load.E;
440
+ return;
441
+ }
442
+
443
+ // deps execute first, unless circular
444
+ var depLoadPromises;
445
+ load.d.forEach(function (depLoad) {
446
+ try {
447
+ var depLoadPromise = postOrderExec(loader, depLoad, seen);
448
+ if (depLoadPromise)
449
+ (depLoadPromises = depLoadPromises || []).push(depLoadPromise);
450
+ }
451
+ catch (err) {
452
+ load.e = null;
453
+ load.er = err;
454
+ throw err;
455
+ }
456
+ });
457
+ if (depLoadPromises)
458
+ return Promise.all(depLoadPromises).then(doExec);
459
+
460
+ return doExec();
461
+
462
+ function doExec () {
463
+ try {
464
+ var execPromise = load.e.call(nullContext);
465
+ if (execPromise) {
466
+ execPromise = execPromise.then(function () {
467
+ load.C = load.n;
468
+ load.E = null; // indicates completion
469
+ if (!true) ;
470
+ }, function (err) {
471
+ load.er = err;
472
+ load.E = null;
473
+ if (!true) ;
474
+ throw err;
475
+ });
476
+ return load.E = execPromise;
477
+ }
478
+ // (should be a promise, but a minify optimization to leave out Promise.resolve)
479
+ load.C = load.n;
480
+ load.L = load.I = undefined;
481
+ }
482
+ catch (err) {
483
+ load.er = err;
484
+ throw err;
485
+ }
486
+ finally {
487
+ load.e = null;
488
+ }
489
+ }
490
+ }
491
+
492
+ envGlobal.System = new SystemJS();
493
+
494
+ /*
495
+ * SystemJS browser attachments for script and import map processing
496
+ */
497
+
498
+ var importMapPromise = Promise.resolve();
499
+ var importMap = { imports: {}, scopes: {}, depcache: {}, integrity: {} };
500
+
501
+ // Scripts are processed immediately, on the first System.import, and on DOMReady.
502
+ // Import map scripts are processed only once (by being marked) and in order for each phase.
503
+ // This is to avoid using DOM mutation observers in core, although that would be an alternative.
504
+ var processFirst = hasDocument;
505
+ systemJSPrototype.prepareImport = function (doProcessScripts) {
506
+ if (processFirst || doProcessScripts) {
507
+ processScripts();
508
+ processFirst = false;
509
+ }
510
+ return importMapPromise;
511
+ };
512
+ if (hasDocument) {
513
+ processScripts();
514
+ window.addEventListener('DOMContentLoaded', processScripts);
515
+ }
516
+
517
+ function processScripts () {
518
+ [].forEach.call(document.querySelectorAll('script'), function (script) {
519
+ if (script.sp) // sp marker = systemjs processed
520
+ return;
521
+ // TODO: deprecate systemjs-module in next major now that we have auto import
522
+ if (script.type === 'systemjs-module') {
523
+ script.sp = true;
524
+ if (!script.src)
525
+ return;
526
+ System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
527
+ // if there is a script load error, dispatch an "error" event
528
+ // on the script tag.
529
+ if (e.message.indexOf('https://git.io/JvFET#3') > -1) {
530
+ var event = document.createEvent('Event');
531
+ event.initEvent('error', false, false);
532
+ script.dispatchEvent(event);
533
+ }
534
+ return Promise.reject(e);
535
+ });
536
+ }
537
+ else if (script.type === 'systemjs-importmap') {
538
+ script.sp = true;
539
+ var fetchPromise = script.src ? fetch(script.src, { integrity: script.integrity }).then(function (res) {
540
+ if (!res.ok)
541
+ throw Error( res.status );
542
+ return res.text();
543
+ }).catch(function (err) {
544
+ err.message = errMsg('W4', script.src ) + '\n' + err.message;
545
+ console.warn(err);
546
+ if (typeof script.onerror === 'function') {
547
+ script.onerror();
548
+ }
549
+ return '{}';
550
+ }) : script.innerHTML;
551
+ importMapPromise = importMapPromise.then(function () {
552
+ return fetchPromise;
553
+ }).then(function (text) {
554
+ extendImportMap(importMap, text, script.src || baseUrl);
555
+ });
556
+ }
557
+ });
558
+ }
559
+
560
+ function extendImportMap (importMap, newMapText, newMapUrl) {
561
+ var newMap = {};
562
+ try {
563
+ newMap = JSON.parse(newMapText);
564
+ } catch (err) {
565
+ console.warn(Error(( errMsg('W5') )));
566
+ }
567
+ resolveAndComposeImportMap(newMap, newMapUrl, importMap);
568
+ }
569
+
570
+ /*
571
+ * Script instantiation loading
572
+ */
573
+
574
+ if (hasDocument) {
575
+ window.addEventListener('error', function (evt) {
576
+ lastWindowErrorUrl = evt.filename;
577
+ lastWindowError = evt.error;
578
+ });
579
+ var baseOrigin = location.origin;
580
+ }
581
+
582
+ systemJSPrototype.createScript = function (url) {
583
+ var script = document.createElement('script');
584
+ script.async = true;
585
+ // Only add cross origin for actual cross origin
586
+ // this is because Safari triggers for all
587
+ // - https://bugs.webkit.org/show_bug.cgi?id=171566
588
+ if (url.indexOf(baseOrigin + '/'))
589
+ script.crossOrigin = 'anonymous';
590
+ var integrity = importMap.integrity[url];
591
+ if (integrity)
592
+ script.integrity = integrity;
593
+ script.src = url;
594
+ return script;
595
+ };
596
+
597
+ // Auto imports -> script tags can be inlined directly for load phase
598
+ var lastAutoImportDeps, lastAutoImportTimeout;
599
+ var autoImportCandidates = {};
600
+ var systemRegister = systemJSPrototype.register;
601
+ var inlineScriptCount = 0;
602
+ systemJSPrototype.register = function (deps, declare) {
603
+ if (hasDocument && document.readyState === 'loading' && typeof deps !== 'string') {
604
+ var scripts = document.querySelectorAll('script[src]');
605
+ var lastScript = scripts[scripts.length - 1];
606
+ var lastAutoImportUrl
607
+ lastAutoImportDeps = deps;
608
+ if (lastScript) {
609
+ lastAutoImportUrl = lastScript.src;
610
+ }
611
+ else {
612
+ inlineScriptCount++
613
+ lastAutoImportUrl = document.location.href + "__inline_script__" + inlineScriptCount;
614
+ }
615
+ // if this is already a System load, then the instantiate has already begun
616
+ // so this re-import has no consequence
617
+ var loader = this;
618
+ lastAutoImportTimeout = setTimeout(function () {
619
+ autoImportCandidates[lastAutoImportUrl] = [deps, declare];
620
+ loader.import(lastAutoImportUrl);
621
+ });
622
+ }
623
+ else {
624
+ lastAutoImportDeps = undefined;
625
+ }
626
+ return systemRegister.call(this, deps, declare);
627
+ };
628
+
629
+ var lastWindowErrorUrl, lastWindowError;
630
+ systemJSPrototype.instantiate = function (url, firstParentUrl) {
631
+ var autoImportRegistration = autoImportCandidates[url];
632
+ if (autoImportRegistration) {
633
+ delete autoImportCandidates[url];
634
+ return autoImportRegistration;
635
+ }
636
+ var loader = this;
637
+ return Promise.resolve(systemJSPrototype.createScript(url)).then(function (script) {
638
+ return new Promise(function (resolve, reject) {
639
+ script.addEventListener('error', function () {
640
+ reject(Error(errMsg(3, [url, firstParentUrl].join(', ') )));
641
+ });
642
+ script.addEventListener('load', function () {
643
+ document.head.removeChild(script);
644
+ // Note that if an error occurs that isn't caught by this if statement,
645
+ // that getRegister will return null and a "did not instantiate" error will be thrown.
646
+ if (lastWindowErrorUrl === url) {
647
+ reject(lastWindowError);
648
+ }
649
+ else {
650
+ var register = loader.getRegister(url);
651
+ // Clear any auto import registration for dynamic import scripts during load
652
+ if (register && register[0] === lastAutoImportDeps)
653
+ clearTimeout(lastAutoImportTimeout);
654
+ resolve(register);
655
+ }
656
+ });
657
+ document.head.appendChild(script);
658
+ });
659
+ });
660
+ };
661
+
662
+ /*
663
+ * Fetch loader, sets up shouldFetch and fetch hooks
664
+ */
665
+ systemJSPrototype.shouldFetch = function () {
666
+ return false;
667
+ };
668
+ if (typeof fetch !== 'undefined')
669
+ systemJSPrototype.fetch = fetch;
670
+
671
+ var instantiate = systemJSPrototype.instantiate;
672
+ var jsContentTypeRegEx = /^(text|application)\/(x-)?javascript(;|$)/;
673
+ systemJSPrototype.instantiate = function (url, parent) {
674
+ var loader = this;
675
+ if (!this.shouldFetch(url))
676
+ return instantiate.apply(this, arguments);
677
+ return this.fetch(url, {
678
+ credentials: 'same-origin',
679
+ integrity: importMap.integrity[url]
680
+ })
681
+ .then(function (res) {
682
+ if (!res.ok)
683
+ throw Error(errMsg(7, [res.status, res.statusText, url, parent].join(', ') ));
684
+ var contentType = res.headers.get('content-type');
685
+ if (!contentType || !jsContentTypeRegEx.test(contentType))
686
+ throw Error(errMsg(4, contentType ));
687
+ return res.text().then(function (source) {
688
+ if (source.indexOf('//# sourceURL=') < 0)
689
+ source += '\n//# sourceURL=' + url;
690
+ (0, eval)(source);
691
+ return loader.getRegister(url);
692
+ });
693
+ });
694
+ };
695
+
696
+ systemJSPrototype.resolve = function (id, parentUrl) {
697
+ parentUrl = parentUrl || !true || baseUrl;
698
+ return resolveImportMap(( importMap), resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
699
+ };
700
+
701
+ function throwUnresolved (id, parentUrl) {
702
+ throw Error(errMsg(8, [id, parentUrl].join(', ') ));
703
+ }
704
+
705
+ var systemInstantiate = systemJSPrototype.instantiate;
706
+ systemJSPrototype.instantiate = function (url, firstParentUrl) {
707
+ var preloads = ( importMap).depcache[url];
708
+ if (preloads) {
709
+ for (var i = 0; i < preloads.length; i++)
710
+ getOrCreateLoad(this, this.resolve(preloads[i], url), url);
711
+ }
712
+ return systemInstantiate.call(this, url, firstParentUrl);
713
+ };
714
+
715
+ /*
716
+ * Supports loading System.register in workers
717
+ */
718
+
719
+ if (hasSelf && typeof importScripts === 'function')
720
+ systemJSPrototype.instantiate = function (url) {
721
+ var loader = this;
722
+ return Promise.resolve().then(function () {
723
+ importScripts(url);
724
+ return loader.getRegister(url);
725
+ });
726
+ };
727
+
728
728
  }());