@plasmicapp/loader-core 1.0.89 → 1.0.90
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.
- package/dist/loader-core.cjs.development.js +94 -271
- package/dist/loader-core.cjs.development.js.map +1 -1
- package/dist/loader-core.cjs.production.min.js +1 -1
- package/dist/loader-core.cjs.production.min.js.map +1 -1
- package/dist/loader-core.esm.js +94 -271
- package/dist/loader-core.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/loader-core.esm.js
CHANGED
|
@@ -8,52 +8,42 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
8
8
|
reject(error);
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
if (info.done) {
|
|
13
12
|
resolve(value);
|
|
14
13
|
} else {
|
|
15
14
|
Promise.resolve(value).then(_next, _throw);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
function _asyncToGenerator(fn) {
|
|
20
18
|
return function () {
|
|
21
19
|
var self = this,
|
|
22
|
-
|
|
20
|
+
args = arguments;
|
|
23
21
|
return new Promise(function (resolve, reject) {
|
|
24
22
|
var gen = fn.apply(self, args);
|
|
25
|
-
|
|
26
23
|
function _next(value) {
|
|
27
24
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
function _throw(err) {
|
|
31
27
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
_next(undefined);
|
|
35
30
|
});
|
|
36
31
|
};
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
function _extends() {
|
|
40
|
-
_extends = Object.assign
|
|
34
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
41
35
|
for (var i = 1; i < arguments.length; i++) {
|
|
42
36
|
var source = arguments[i];
|
|
43
|
-
|
|
44
37
|
for (var key in source) {
|
|
45
38
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
46
39
|
target[key] = source[key];
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
return target;
|
|
52
44
|
};
|
|
53
|
-
|
|
54
45
|
return _extends.apply(this, arguments);
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
function _unsupportedIterableToArray(o, minLen) {
|
|
58
48
|
if (!o) return;
|
|
59
49
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -62,19 +52,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
62
52
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
63
53
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
function _arrayLikeToArray(arr, len) {
|
|
67
56
|
if (len == null || len > arr.length) len = arr.length;
|
|
68
|
-
|
|
69
57
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
70
|
-
|
|
71
58
|
return arr2;
|
|
72
59
|
}
|
|
73
|
-
|
|
74
60
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
75
61
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
76
62
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
77
|
-
|
|
78
63
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
79
64
|
if (it) o = it;
|
|
80
65
|
var i = 0;
|
|
@@ -88,7 +73,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
88
73
|
};
|
|
89
74
|
};
|
|
90
75
|
}
|
|
91
|
-
|
|
92
76
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
93
77
|
}
|
|
94
78
|
|
|
@@ -100,64 +84,48 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
100
84
|
this.dependedBy = {};
|
|
101
85
|
this.rebuildGraph();
|
|
102
86
|
}
|
|
103
|
-
|
|
104
87
|
var _proto = DepsGraph.prototype;
|
|
105
|
-
|
|
106
88
|
_proto.getTransitiveDependers = function getTransitiveDependers(name) {
|
|
107
89
|
return this.transitiveCrawl(name, this.dependedBy);
|
|
108
90
|
};
|
|
109
|
-
|
|
110
91
|
_proto.getTransitiveDeps = function getTransitiveDeps(name) {
|
|
111
92
|
if (!(name in this.dependsOn)) {
|
|
112
93
|
return [];
|
|
113
94
|
}
|
|
114
|
-
|
|
115
95
|
return this.transitiveCrawl(name, this.dependsOn);
|
|
116
96
|
};
|
|
117
|
-
|
|
118
97
|
_proto.transitiveCrawl = function transitiveCrawl(name, edges) {
|
|
119
98
|
var deps = new Set();
|
|
120
|
-
|
|
121
99
|
var crawl = function crawl(dep) {
|
|
122
100
|
if (deps.has(dep)) {
|
|
123
101
|
return;
|
|
124
102
|
}
|
|
125
|
-
|
|
126
103
|
deps.add(dep);
|
|
127
|
-
|
|
128
104
|
for (var _iterator = _createForOfIteratorHelperLoose((_edges$dep = edges[dep]) != null ? _edges$dep : []), _step; !(_step = _iterator()).done;) {
|
|
129
105
|
var _edges$dep;
|
|
130
|
-
|
|
131
106
|
var subdep = _step.value;
|
|
132
107
|
crawl(subdep);
|
|
133
108
|
}
|
|
134
109
|
};
|
|
135
|
-
|
|
136
110
|
for (var _iterator2 = _createForOfIteratorHelperLoose(edges[name]), _step2; !(_step2 = _iterator2()).done;) {
|
|
137
111
|
var dep = _step2.value;
|
|
138
112
|
crawl(dep);
|
|
139
113
|
}
|
|
140
|
-
|
|
141
114
|
return Array.from(deps);
|
|
142
115
|
};
|
|
143
|
-
|
|
144
116
|
_proto.rebuildGraph = function rebuildGraph() {
|
|
145
117
|
this.dependedBy = {};
|
|
146
118
|
this.dependsOn = {};
|
|
147
|
-
|
|
148
119
|
for (var _iterator3 = _createForOfIteratorHelperLoose(this.browserBuild ? this.bundle.modules.browser : this.bundle.modules.server), _step3; !(_step3 = _iterator3()).done;) {
|
|
149
120
|
var mod = _step3.value;
|
|
150
|
-
|
|
151
121
|
if (mod.type === 'code') {
|
|
152
122
|
for (var _iterator4 = _createForOfIteratorHelperLoose(mod.imports), _step4; !(_step4 = _iterator4()).done;) {
|
|
153
123
|
var imported = _step4.value;
|
|
154
|
-
|
|
155
124
|
if (!(mod.fileName in this.dependsOn)) {
|
|
156
125
|
this.dependsOn[mod.fileName] = [imported];
|
|
157
126
|
} else {
|
|
158
127
|
this.dependsOn[mod.fileName].push(imported);
|
|
159
128
|
}
|
|
160
|
-
|
|
161
129
|
if (!(imported in this.dependedBy)) {
|
|
162
130
|
this.dependedBy[imported] = [mod.fileName];
|
|
163
131
|
} else {
|
|
@@ -167,7 +135,6 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
167
135
|
}
|
|
168
136
|
}
|
|
169
137
|
};
|
|
170
|
-
|
|
171
138
|
return DepsGraph;
|
|
172
139
|
}();
|
|
173
140
|
|
|
@@ -176,10 +143,8 @@ var DepsGraph = /*#__PURE__*/function () {
|
|
|
176
143
|
* @param opts.target by default, will target the browser modules. Can request
|
|
177
144
|
* the server modules instead.
|
|
178
145
|
*/
|
|
179
|
-
|
|
180
146
|
function getBundleSubset(bundle, names, opts) {
|
|
181
147
|
var _opts$target;
|
|
182
|
-
|
|
183
148
|
var namesSet = new Set(names);
|
|
184
149
|
var target = (_opts$target = opts == null ? void 0 : opts.target) != null ? _opts$target : 'browser';
|
|
185
150
|
var forBrowser = target === 'browser';
|
|
@@ -187,11 +152,9 @@ function getBundleSubset(bundle, names, opts) {
|
|
|
187
152
|
var deps = new Set(names.flatMap(function (name) {
|
|
188
153
|
return graph.getTransitiveDeps(name);
|
|
189
154
|
}));
|
|
190
|
-
|
|
191
155
|
var isSubModule = function isSubModule(fileName) {
|
|
192
156
|
return deps.has(fileName) || namesSet.has(fileName);
|
|
193
157
|
};
|
|
194
|
-
|
|
195
158
|
var modules = bundle.modules[target];
|
|
196
159
|
var filteredModules = modules.filter(function (mod) {
|
|
197
160
|
return isSubModule(mod.fileName);
|
|
@@ -220,64 +183,48 @@ var Registry = /*#__PURE__*/function () {
|
|
|
220
183
|
this.registeredModules = {};
|
|
221
184
|
this.modules = {};
|
|
222
185
|
}
|
|
223
|
-
|
|
224
186
|
Registry.getInstance = function getInstance() {
|
|
225
187
|
if (!Registry.instance) {
|
|
226
188
|
Registry.instance = new Registry();
|
|
227
189
|
}
|
|
228
|
-
|
|
229
190
|
return Registry.instance;
|
|
230
191
|
};
|
|
231
|
-
|
|
232
192
|
var _proto = Registry.prototype;
|
|
233
|
-
|
|
234
193
|
_proto.register = function register(name, module) {
|
|
235
194
|
this.registeredModules[name] = module;
|
|
236
195
|
};
|
|
237
|
-
|
|
238
196
|
_proto.isEmpty = function isEmpty() {
|
|
239
197
|
return Object.keys(this.loadedModules).length === 0;
|
|
240
198
|
};
|
|
241
|
-
|
|
242
199
|
_proto.clear = function clear() {
|
|
243
200
|
this.loadedModules = {};
|
|
244
201
|
};
|
|
245
|
-
|
|
246
202
|
_proto.getRegisteredModule = function getRegisteredModule(name) {
|
|
247
203
|
return this.registeredModules[name];
|
|
248
204
|
};
|
|
249
|
-
|
|
250
205
|
_proto.hasModule = function hasModule(name, opts) {
|
|
251
206
|
if (opts === void 0) {
|
|
252
207
|
opts = {};
|
|
253
208
|
}
|
|
254
|
-
|
|
255
209
|
if (name in this.registeredModules && !opts.forceOriginal) {
|
|
256
210
|
return true;
|
|
257
211
|
}
|
|
258
|
-
|
|
259
212
|
return name in this.modules;
|
|
260
213
|
};
|
|
261
|
-
|
|
262
214
|
_proto.load = function load(name, opts) {
|
|
263
215
|
var _this = this;
|
|
264
|
-
|
|
265
216
|
if (opts === void 0) {
|
|
266
217
|
opts = {};
|
|
267
218
|
}
|
|
268
|
-
|
|
269
219
|
if (name in this.registeredModules && !opts.forceOriginal) {
|
|
270
220
|
return this.registeredModules[name];
|
|
271
221
|
}
|
|
272
|
-
|
|
273
222
|
if (name in this.loadedModules) {
|
|
274
223
|
return this.loadedModules[name];
|
|
275
224
|
}
|
|
276
|
-
|
|
277
225
|
if (!(name in this.modules)) {
|
|
278
226
|
throw new Error("Unknown module " + name);
|
|
279
227
|
}
|
|
280
|
-
|
|
281
228
|
var code = this.modules[name];
|
|
282
229
|
var requireFn = isBrowser ? function (dep) {
|
|
283
230
|
var normalizedDep = resolvePath(dep, name);
|
|
@@ -296,16 +243,13 @@ var Registry = /*#__PURE__*/function () {
|
|
|
296
243
|
}
|
|
297
244
|
};
|
|
298
245
|
var func;
|
|
299
|
-
|
|
300
246
|
try {
|
|
301
247
|
func = new Function('require', 'exports', code);
|
|
302
248
|
} catch (err) {
|
|
303
249
|
throw new Error("PLASMIC: Failed to create function for " + name + ": " + err);
|
|
304
250
|
}
|
|
305
|
-
|
|
306
251
|
var exports = {};
|
|
307
252
|
this.loadedModules[name] = exports;
|
|
308
|
-
|
|
309
253
|
try {
|
|
310
254
|
func(requireFn, exports);
|
|
311
255
|
} catch (err) {
|
|
@@ -314,56 +258,44 @@ var Registry = /*#__PURE__*/function () {
|
|
|
314
258
|
delete this.loadedModules[name];
|
|
315
259
|
throw new Error("PLASMIC: Failed to load " + name + ": " + err);
|
|
316
260
|
}
|
|
317
|
-
|
|
318
261
|
return exports;
|
|
319
262
|
};
|
|
320
|
-
|
|
321
263
|
_proto.updateModules = function updateModules(bundle) {
|
|
322
264
|
var updated = false;
|
|
323
|
-
|
|
324
265
|
for (var _iterator = _createForOfIteratorHelperLoose(isBrowser ? bundle.modules.browser : bundle.modules.server), _step; !(_step = _iterator()).done;) {
|
|
325
266
|
var mod = _step.value;
|
|
326
|
-
|
|
327
267
|
if (mod.type === 'code' && mod.code !== this.modules[mod.fileName]) {
|
|
328
268
|
this.modules[mod.fileName] = mod.code;
|
|
329
269
|
updated = true;
|
|
330
270
|
}
|
|
331
271
|
}
|
|
332
|
-
|
|
333
272
|
if (updated) {
|
|
334
273
|
// TODO: do something more efficient than tearing everything down?
|
|
335
274
|
this.clear();
|
|
336
275
|
}
|
|
337
276
|
};
|
|
338
|
-
|
|
339
277
|
return Registry;
|
|
340
|
-
}();
|
|
341
|
-
|
|
278
|
+
}();
|
|
279
|
+
// Singleton
|
|
342
280
|
Registry.instance = undefined;
|
|
343
|
-
|
|
344
281
|
function resolvePath(path, from) {
|
|
345
282
|
var fromParts = from.split('/');
|
|
346
283
|
var pathParts = path.split('/');
|
|
347
|
-
|
|
348
284
|
if (pathParts.length === 0) {
|
|
349
285
|
return path;
|
|
350
286
|
}
|
|
351
|
-
|
|
352
287
|
if (pathParts[0] === '.') {
|
|
353
288
|
return [].concat(fromParts.slice(0, fromParts.length - 1), pathParts.slice(1)).join('/');
|
|
354
289
|
} else if (pathParts[0] === '..') {
|
|
355
290
|
var count = 0;
|
|
356
|
-
|
|
357
291
|
for (var _iterator2 = _createForOfIteratorHelperLoose(pathParts), _step2; !(_step2 = _iterator2()).done;) {
|
|
358
292
|
var part = _step2.value;
|
|
359
|
-
|
|
360
293
|
if (part === '..') {
|
|
361
294
|
count += 1;
|
|
362
295
|
} else {
|
|
363
296
|
break;
|
|
364
297
|
}
|
|
365
298
|
}
|
|
366
|
-
|
|
367
299
|
return [].concat(fromParts.slice(0, fromParts.length - count - 1), pathParts.slice(count)).join('/');
|
|
368
300
|
} else {
|
|
369
301
|
return path;
|
|
@@ -381,17 +313,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
381
313
|
* This source code is licensed under the MIT license found in the
|
|
382
314
|
* LICENSE file in the root directory of this source tree.
|
|
383
315
|
*/
|
|
316
|
+
|
|
384
317
|
var runtime = function (exports) {
|
|
385
318
|
|
|
386
319
|
var Op = Object.prototype;
|
|
387
320
|
var hasOwn = Op.hasOwnProperty;
|
|
388
321
|
var undefined$1; // More compressible than void 0.
|
|
389
|
-
|
|
390
322
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
391
323
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
392
324
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
393
325
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
394
|
-
|
|
395
326
|
function define(obj, key, value) {
|
|
396
327
|
Object.defineProperty(obj, key, {
|
|
397
328
|
value: value,
|
|
@@ -401,7 +332,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
401
332
|
});
|
|
402
333
|
return obj[key];
|
|
403
334
|
}
|
|
404
|
-
|
|
405
335
|
try {
|
|
406
336
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
407
337
|
define({}, "");
|
|
@@ -410,19 +340,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
410
340
|
return obj[key] = value;
|
|
411
341
|
};
|
|
412
342
|
}
|
|
413
|
-
|
|
414
343
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
415
344
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
416
345
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
417
346
|
var generator = Object.create(protoGenerator.prototype);
|
|
418
|
-
var context = new Context(tryLocsList || []);
|
|
419
|
-
// .throw, and .return methods.
|
|
347
|
+
var context = new Context(tryLocsList || []);
|
|
420
348
|
|
|
349
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
350
|
+
// .throw, and .return methods.
|
|
421
351
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
422
352
|
return generator;
|
|
423
353
|
}
|
|
354
|
+
exports.wrap = wrap;
|
|
424
355
|
|
|
425
|
-
|
|
356
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
426
357
|
// record like context.tryEntries[i].completion. This interface could
|
|
427
358
|
// have been (and was previously) designed to take a closure to be
|
|
428
359
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -432,7 +363,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
432
363
|
// in every case, so we don't have to touch the arguments object. The
|
|
433
364
|
// only additional allocation required is the completion record, which
|
|
434
365
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
435
|
-
|
|
436
366
|
function tryCatch(fn, obj, arg) {
|
|
437
367
|
try {
|
|
438
368
|
return {
|
|
@@ -446,46 +376,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
446
376
|
};
|
|
447
377
|
}
|
|
448
378
|
}
|
|
449
|
-
|
|
450
379
|
var GenStateSuspendedStart = "suspendedStart";
|
|
451
380
|
var GenStateSuspendedYield = "suspendedYield";
|
|
452
381
|
var GenStateExecuting = "executing";
|
|
453
|
-
var GenStateCompleted = "completed";
|
|
382
|
+
var GenStateCompleted = "completed";
|
|
383
|
+
|
|
384
|
+
// Returning this object from the innerFn has the same effect as
|
|
454
385
|
// breaking out of the dispatch switch statement.
|
|
386
|
+
var ContinueSentinel = {};
|
|
455
387
|
|
|
456
|
-
|
|
388
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
457
389
|
// .constructor.prototype properties for functions that return Generator
|
|
458
390
|
// objects. For full spec compliance, you may wish to configure your
|
|
459
391
|
// minifier not to mangle the names of these two functions.
|
|
460
|
-
|
|
461
392
|
function Generator() {}
|
|
462
|
-
|
|
463
393
|
function GeneratorFunction() {}
|
|
394
|
+
function GeneratorFunctionPrototype() {}
|
|
464
395
|
|
|
465
|
-
|
|
396
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
466
397
|
// don't natively support it.
|
|
467
|
-
|
|
468
|
-
|
|
469
398
|
var IteratorPrototype = {};
|
|
470
399
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
471
400
|
return this;
|
|
472
401
|
});
|
|
473
402
|
var getProto = Object.getPrototypeOf;
|
|
474
403
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
475
|
-
|
|
476
404
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
477
405
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
478
406
|
// of the polyfill.
|
|
479
407
|
IteratorPrototype = NativeIteratorPrototype;
|
|
480
408
|
}
|
|
481
|
-
|
|
482
409
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
483
410
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
484
411
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
485
412
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
486
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
487
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
413
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
488
414
|
|
|
415
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
416
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
489
417
|
function defineIteratorMethods(prototype) {
|
|
490
418
|
["next", "throw", "return"].forEach(function (method) {
|
|
491
419
|
define(prototype, method, function (arg) {
|
|
@@ -493,14 +421,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
493
421
|
});
|
|
494
422
|
});
|
|
495
423
|
}
|
|
496
|
-
|
|
497
424
|
exports.isGeneratorFunction = function (genFun) {
|
|
498
425
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
499
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
426
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
427
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
500
428
|
// do is to check its .name property.
|
|
501
429
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
502
430
|
};
|
|
503
|
-
|
|
504
431
|
exports.mark = function (genFun) {
|
|
505
432
|
if (Object.setPrototypeOf) {
|
|
506
433
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -508,31 +435,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
508
435
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
509
436
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
510
437
|
}
|
|
511
|
-
|
|
512
438
|
genFun.prototype = Object.create(Gp);
|
|
513
439
|
return genFun;
|
|
514
|
-
};
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// Within the body of any async function, `await x` is transformed to
|
|
515
443
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
516
444
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
517
445
|
// meant to be awaited.
|
|
518
|
-
|
|
519
|
-
|
|
520
446
|
exports.awrap = function (arg) {
|
|
521
447
|
return {
|
|
522
448
|
__await: arg
|
|
523
449
|
};
|
|
524
450
|
};
|
|
525
|
-
|
|
526
451
|
function AsyncIterator(generator, PromiseImpl) {
|
|
527
452
|
function invoke(method, arg, resolve, reject) {
|
|
528
453
|
var record = tryCatch(generator[method], generator, arg);
|
|
529
|
-
|
|
530
454
|
if (record.type === "throw") {
|
|
531
455
|
reject(record.arg);
|
|
532
456
|
} else {
|
|
533
457
|
var result = record.arg;
|
|
534
458
|
var value = result.value;
|
|
535
|
-
|
|
536
459
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
537
460
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
538
461
|
invoke("next", value, resolve, reject);
|
|
@@ -540,7 +463,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
540
463
|
invoke("throw", err, resolve, reject);
|
|
541
464
|
});
|
|
542
465
|
}
|
|
543
|
-
|
|
544
466
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
545
467
|
// When a yielded Promise is resolved, its final value becomes
|
|
546
468
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -554,17 +476,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
554
476
|
});
|
|
555
477
|
}
|
|
556
478
|
}
|
|
557
|
-
|
|
558
479
|
var previousPromise;
|
|
559
|
-
|
|
560
480
|
function enqueue(method, arg) {
|
|
561
481
|
function callInvokeWithMethodAndArg() {
|
|
562
482
|
return new PromiseImpl(function (resolve, reject) {
|
|
563
483
|
invoke(method, arg, resolve, reject);
|
|
564
484
|
});
|
|
565
485
|
}
|
|
566
|
-
|
|
567
|
-
|
|
486
|
+
return previousPromise =
|
|
487
|
+
// If enqueue has been called before, then we want to wait until
|
|
568
488
|
// all previous Promises have been resolved before calling invoke,
|
|
569
489
|
// so that results are always delivered in the correct order. If
|
|
570
490
|
// enqueue has not been called before, then it is important to
|
|
@@ -576,24 +496,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
576
496
|
// execute code before the first await. Since we implement simple
|
|
577
497
|
// async functions in terms of async generators, it is especially
|
|
578
498
|
// important to get this right, even though it requires care.
|
|
579
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
499
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
500
|
+
// Avoid propagating failures to Promises returned by later
|
|
580
501
|
// invocations of the iterator.
|
|
581
502
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
582
|
-
}
|
|
583
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
584
|
-
|
|
503
|
+
}
|
|
585
504
|
|
|
505
|
+
// Define the unified helper method that is used to implement .next,
|
|
506
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
586
507
|
this._invoke = enqueue;
|
|
587
508
|
}
|
|
588
|
-
|
|
589
509
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
590
510
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
591
511
|
return this;
|
|
592
512
|
});
|
|
593
|
-
exports.AsyncIterator = AsyncIterator;
|
|
513
|
+
exports.AsyncIterator = AsyncIterator;
|
|
514
|
+
|
|
515
|
+
// Note that simple async functions are implemented on top of
|
|
594
516
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
595
517
|
// the final result produced by the iterator.
|
|
596
|
-
|
|
597
518
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
598
519
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
599
520
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -602,39 +523,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
602
523
|
return result.done ? result.value : iter.next();
|
|
603
524
|
});
|
|
604
525
|
};
|
|
605
|
-
|
|
606
526
|
function makeInvokeMethod(innerFn, self, context) {
|
|
607
527
|
var state = GenStateSuspendedStart;
|
|
608
528
|
return function invoke(method, arg) {
|
|
609
529
|
if (state === GenStateExecuting) {
|
|
610
530
|
throw new Error("Generator is already running");
|
|
611
531
|
}
|
|
612
|
-
|
|
613
532
|
if (state === GenStateCompleted) {
|
|
614
533
|
if (method === "throw") {
|
|
615
534
|
throw arg;
|
|
616
|
-
}
|
|
617
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
618
|
-
|
|
535
|
+
}
|
|
619
536
|
|
|
537
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
538
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
620
539
|
return doneResult();
|
|
621
540
|
}
|
|
622
|
-
|
|
623
541
|
context.method = method;
|
|
624
542
|
context.arg = arg;
|
|
625
|
-
|
|
626
543
|
while (true) {
|
|
627
544
|
var delegate = context.delegate;
|
|
628
|
-
|
|
629
545
|
if (delegate) {
|
|
630
546
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
631
|
-
|
|
632
547
|
if (delegateResult) {
|
|
633
548
|
if (delegateResult === ContinueSentinel) continue;
|
|
634
549
|
return delegateResult;
|
|
635
550
|
}
|
|
636
551
|
}
|
|
637
|
-
|
|
638
552
|
if (context.method === "next") {
|
|
639
553
|
// Setting context._sent for legacy support of Babel's
|
|
640
554
|
// function.sent implementation.
|
|
@@ -644,51 +558,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
644
558
|
state = GenStateCompleted;
|
|
645
559
|
throw context.arg;
|
|
646
560
|
}
|
|
647
|
-
|
|
648
561
|
context.dispatchException(context.arg);
|
|
649
562
|
} else if (context.method === "return") {
|
|
650
563
|
context.abrupt("return", context.arg);
|
|
651
564
|
}
|
|
652
|
-
|
|
653
565
|
state = GenStateExecuting;
|
|
654
566
|
var record = tryCatch(innerFn, self, context);
|
|
655
|
-
|
|
656
567
|
if (record.type === "normal") {
|
|
657
568
|
// If an exception is thrown from innerFn, we leave state ===
|
|
658
569
|
// GenStateExecuting and loop back for another invocation.
|
|
659
570
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
660
|
-
|
|
661
571
|
if (record.arg === ContinueSentinel) {
|
|
662
572
|
continue;
|
|
663
573
|
}
|
|
664
|
-
|
|
665
574
|
return {
|
|
666
575
|
value: record.arg,
|
|
667
576
|
done: context.done
|
|
668
577
|
};
|
|
669
578
|
} else if (record.type === "throw") {
|
|
670
|
-
state = GenStateCompleted;
|
|
579
|
+
state = GenStateCompleted;
|
|
580
|
+
// Dispatch the exception by looping back around to the
|
|
671
581
|
// context.dispatchException(context.arg) call above.
|
|
672
|
-
|
|
673
582
|
context.method = "throw";
|
|
674
583
|
context.arg = record.arg;
|
|
675
584
|
}
|
|
676
585
|
}
|
|
677
586
|
};
|
|
678
|
-
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
679
590
|
// result, either by returning a { value, done } result from the
|
|
680
591
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
681
592
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
682
|
-
|
|
683
|
-
|
|
684
593
|
function maybeInvokeDelegate(delegate, context) {
|
|
685
594
|
var method = delegate.iterator[context.method];
|
|
686
|
-
|
|
687
595
|
if (method === undefined$1) {
|
|
688
596
|
// A .throw or .return when the delegate iterator has no .throw
|
|
689
597
|
// method always terminates the yield* loop.
|
|
690
598
|
context.delegate = null;
|
|
691
|
-
|
|
692
599
|
if (context.method === "throw") {
|
|
693
600
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
694
601
|
if (delegate.iterator["return"]) {
|
|
@@ -697,51 +604,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
697
604
|
context.method = "return";
|
|
698
605
|
context.arg = undefined$1;
|
|
699
606
|
maybeInvokeDelegate(delegate, context);
|
|
700
|
-
|
|
701
607
|
if (context.method === "throw") {
|
|
702
608
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
703
609
|
// "return" to "throw", let that override the TypeError below.
|
|
704
610
|
return ContinueSentinel;
|
|
705
611
|
}
|
|
706
612
|
}
|
|
707
|
-
|
|
708
613
|
context.method = "throw";
|
|
709
614
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
710
615
|
}
|
|
711
|
-
|
|
712
616
|
return ContinueSentinel;
|
|
713
617
|
}
|
|
714
|
-
|
|
715
618
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
716
|
-
|
|
717
619
|
if (record.type === "throw") {
|
|
718
620
|
context.method = "throw";
|
|
719
621
|
context.arg = record.arg;
|
|
720
622
|
context.delegate = null;
|
|
721
623
|
return ContinueSentinel;
|
|
722
624
|
}
|
|
723
|
-
|
|
724
625
|
var info = record.arg;
|
|
725
|
-
|
|
726
626
|
if (!info) {
|
|
727
627
|
context.method = "throw";
|
|
728
628
|
context.arg = new TypeError("iterator result is not an object");
|
|
729
629
|
context.delegate = null;
|
|
730
630
|
return ContinueSentinel;
|
|
731
631
|
}
|
|
732
|
-
|
|
733
632
|
if (info.done) {
|
|
734
633
|
// Assign the result of the finished delegate to the temporary
|
|
735
634
|
// variable specified by delegate.resultName (see delegateYield).
|
|
736
|
-
context[delegate.resultName] = info.value;
|
|
635
|
+
context[delegate.resultName] = info.value;
|
|
636
|
+
|
|
637
|
+
// Resume execution at the desired location (see delegateYield).
|
|
638
|
+
context.next = delegate.nextLoc;
|
|
737
639
|
|
|
738
|
-
|
|
640
|
+
// If context.method was "throw" but the delegate handled the
|
|
739
641
|
// exception, let the outer generator proceed normally. If
|
|
740
642
|
// context.method was "next", forget context.arg since it has been
|
|
741
643
|
// "consumed" by the delegate iterator. If context.method was
|
|
742
644
|
// "return", allow the original .return call to continue in the
|
|
743
645
|
// outer generator.
|
|
744
|
-
|
|
745
646
|
if (context.method !== "return") {
|
|
746
647
|
context.method = "next";
|
|
747
648
|
context.arg = undefined$1;
|
|
@@ -749,54 +650,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
749
650
|
} else {
|
|
750
651
|
// Re-yield the result returned by the delegate method.
|
|
751
652
|
return info;
|
|
752
|
-
}
|
|
753
|
-
// the outer generator.
|
|
754
|
-
|
|
653
|
+
}
|
|
755
654
|
|
|
655
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
656
|
+
// the outer generator.
|
|
756
657
|
context.delegate = null;
|
|
757
658
|
return ContinueSentinel;
|
|
758
|
-
}
|
|
759
|
-
// unified ._invoke helper method.
|
|
760
|
-
|
|
659
|
+
}
|
|
761
660
|
|
|
661
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
662
|
+
// unified ._invoke helper method.
|
|
762
663
|
defineIteratorMethods(Gp);
|
|
763
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
664
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
665
|
+
|
|
666
|
+
// A Generator should always return itself as the iterator object when the
|
|
764
667
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
765
668
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
766
669
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
767
670
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
768
|
-
|
|
769
671
|
define(Gp, iteratorSymbol, function () {
|
|
770
672
|
return this;
|
|
771
673
|
});
|
|
772
674
|
define(Gp, "toString", function () {
|
|
773
675
|
return "[object Generator]";
|
|
774
676
|
});
|
|
775
|
-
|
|
776
677
|
function pushTryEntry(locs) {
|
|
777
678
|
var entry = {
|
|
778
679
|
tryLoc: locs[0]
|
|
779
680
|
};
|
|
780
|
-
|
|
781
681
|
if (1 in locs) {
|
|
782
682
|
entry.catchLoc = locs[1];
|
|
783
683
|
}
|
|
784
|
-
|
|
785
684
|
if (2 in locs) {
|
|
786
685
|
entry.finallyLoc = locs[2];
|
|
787
686
|
entry.afterLoc = locs[3];
|
|
788
687
|
}
|
|
789
|
-
|
|
790
688
|
this.tryEntries.push(entry);
|
|
791
689
|
}
|
|
792
|
-
|
|
793
690
|
function resetTryEntry(entry) {
|
|
794
691
|
var record = entry.completion || {};
|
|
795
692
|
record.type = "normal";
|
|
796
693
|
delete record.arg;
|
|
797
694
|
entry.completion = record;
|
|
798
695
|
}
|
|
799
|
-
|
|
800
696
|
function Context(tryLocsList) {
|
|
801
697
|
// The root entry object (effectively a try statement without a catch
|
|
802
698
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -807,97 +703,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
807
703
|
tryLocsList.forEach(pushTryEntry, this);
|
|
808
704
|
this.reset(true);
|
|
809
705
|
}
|
|
810
|
-
|
|
811
706
|
exports.keys = function (object) {
|
|
812
707
|
var keys = [];
|
|
813
|
-
|
|
814
708
|
for (var key in object) {
|
|
815
709
|
keys.push(key);
|
|
816
710
|
}
|
|
711
|
+
keys.reverse();
|
|
817
712
|
|
|
818
|
-
|
|
713
|
+
// Rather than returning an object with a next method, we keep
|
|
819
714
|
// things simple and return the next function itself.
|
|
820
|
-
|
|
821
715
|
return function next() {
|
|
822
716
|
while (keys.length) {
|
|
823
717
|
var key = keys.pop();
|
|
824
|
-
|
|
825
718
|
if (key in object) {
|
|
826
719
|
next.value = key;
|
|
827
720
|
next.done = false;
|
|
828
721
|
return next;
|
|
829
722
|
}
|
|
830
|
-
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// To avoid creating an additional object, we just hang the .value
|
|
831
726
|
// and .done properties off the next function object itself. This
|
|
832
727
|
// also ensures that the minifier will not anonymize the function.
|
|
833
|
-
|
|
834
|
-
|
|
835
728
|
next.done = true;
|
|
836
729
|
return next;
|
|
837
730
|
};
|
|
838
731
|
};
|
|
839
|
-
|
|
840
732
|
function values(iterable) {
|
|
841
733
|
if (iterable) {
|
|
842
734
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
843
|
-
|
|
844
735
|
if (iteratorMethod) {
|
|
845
736
|
return iteratorMethod.call(iterable);
|
|
846
737
|
}
|
|
847
|
-
|
|
848
738
|
if (typeof iterable.next === "function") {
|
|
849
739
|
return iterable;
|
|
850
740
|
}
|
|
851
|
-
|
|
852
741
|
if (!isNaN(iterable.length)) {
|
|
853
742
|
var i = -1,
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
743
|
+
next = function next() {
|
|
744
|
+
while (++i < iterable.length) {
|
|
745
|
+
if (hasOwn.call(iterable, i)) {
|
|
746
|
+
next.value = iterable[i];
|
|
747
|
+
next.done = false;
|
|
748
|
+
return next;
|
|
749
|
+
}
|
|
860
750
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
return next;
|
|
866
|
-
};
|
|
867
|
-
|
|
751
|
+
next.value = undefined$1;
|
|
752
|
+
next.done = true;
|
|
753
|
+
return next;
|
|
754
|
+
};
|
|
868
755
|
return next.next = next;
|
|
869
756
|
}
|
|
870
|
-
}
|
|
871
|
-
|
|
757
|
+
}
|
|
872
758
|
|
|
759
|
+
// Return an iterator with no values.
|
|
873
760
|
return {
|
|
874
761
|
next: doneResult
|
|
875
762
|
};
|
|
876
763
|
}
|
|
877
|
-
|
|
878
764
|
exports.values = values;
|
|
879
|
-
|
|
880
765
|
function doneResult() {
|
|
881
766
|
return {
|
|
882
767
|
value: undefined$1,
|
|
883
768
|
done: true
|
|
884
769
|
};
|
|
885
770
|
}
|
|
886
|
-
|
|
887
771
|
Context.prototype = {
|
|
888
772
|
constructor: Context,
|
|
889
773
|
reset: function reset(skipTempReset) {
|
|
890
774
|
this.prev = 0;
|
|
891
|
-
this.next = 0;
|
|
775
|
+
this.next = 0;
|
|
776
|
+
// Resetting context._sent for legacy support of Babel's
|
|
892
777
|
// function.sent implementation.
|
|
893
|
-
|
|
894
778
|
this.sent = this._sent = undefined$1;
|
|
895
779
|
this.done = false;
|
|
896
780
|
this.delegate = null;
|
|
897
781
|
this.method = "next";
|
|
898
782
|
this.arg = undefined$1;
|
|
899
783
|
this.tryEntries.forEach(resetTryEntry);
|
|
900
|
-
|
|
901
784
|
if (!skipTempReset) {
|
|
902
785
|
for (var name in this) {
|
|
903
786
|
// Not sure about the optimal order of these conditions:
|
|
@@ -911,50 +794,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
911
794
|
this.done = true;
|
|
912
795
|
var rootEntry = this.tryEntries[0];
|
|
913
796
|
var rootRecord = rootEntry.completion;
|
|
914
|
-
|
|
915
797
|
if (rootRecord.type === "throw") {
|
|
916
798
|
throw rootRecord.arg;
|
|
917
799
|
}
|
|
918
|
-
|
|
919
800
|
return this.rval;
|
|
920
801
|
},
|
|
921
802
|
dispatchException: function dispatchException(exception) {
|
|
922
803
|
if (this.done) {
|
|
923
804
|
throw exception;
|
|
924
805
|
}
|
|
925
|
-
|
|
926
806
|
var context = this;
|
|
927
|
-
|
|
928
807
|
function handle(loc, caught) {
|
|
929
808
|
record.type = "throw";
|
|
930
809
|
record.arg = exception;
|
|
931
810
|
context.next = loc;
|
|
932
|
-
|
|
933
811
|
if (caught) {
|
|
934
812
|
// If the dispatched exception was caught by a catch block,
|
|
935
813
|
// then let that catch block handle the exception normally.
|
|
936
814
|
context.method = "next";
|
|
937
815
|
context.arg = undefined$1;
|
|
938
816
|
}
|
|
939
|
-
|
|
940
817
|
return !!caught;
|
|
941
818
|
}
|
|
942
|
-
|
|
943
819
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
944
820
|
var entry = this.tryEntries[i];
|
|
945
821
|
var record = entry.completion;
|
|
946
|
-
|
|
947
822
|
if (entry.tryLoc === "root") {
|
|
948
823
|
// Exception thrown outside of any try block that could handle
|
|
949
824
|
// it, so set the completion value of the entire function to
|
|
950
825
|
// throw the exception.
|
|
951
826
|
return handle("end");
|
|
952
827
|
}
|
|
953
|
-
|
|
954
828
|
if (entry.tryLoc <= this.prev) {
|
|
955
829
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
956
830
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
957
|
-
|
|
958
831
|
if (hasCatch && hasFinally) {
|
|
959
832
|
if (this.prev < entry.catchLoc) {
|
|
960
833
|
return handle(entry.catchLoc, true);
|
|
@@ -978,36 +851,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
978
851
|
abrupt: function abrupt(type, arg) {
|
|
979
852
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
980
853
|
var entry = this.tryEntries[i];
|
|
981
|
-
|
|
982
854
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
983
855
|
var finallyEntry = entry;
|
|
984
856
|
break;
|
|
985
857
|
}
|
|
986
858
|
}
|
|
987
|
-
|
|
988
859
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
989
860
|
// Ignore the finally entry if control is not jumping to a
|
|
990
861
|
// location outside the try/catch block.
|
|
991
862
|
finallyEntry = null;
|
|
992
863
|
}
|
|
993
|
-
|
|
994
864
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
995
865
|
record.type = type;
|
|
996
866
|
record.arg = arg;
|
|
997
|
-
|
|
998
867
|
if (finallyEntry) {
|
|
999
868
|
this.method = "next";
|
|
1000
869
|
this.next = finallyEntry.finallyLoc;
|
|
1001
870
|
return ContinueSentinel;
|
|
1002
871
|
}
|
|
1003
|
-
|
|
1004
872
|
return this.complete(record);
|
|
1005
873
|
},
|
|
1006
874
|
complete: function complete(record, afterLoc) {
|
|
1007
875
|
if (record.type === "throw") {
|
|
1008
876
|
throw record.arg;
|
|
1009
877
|
}
|
|
1010
|
-
|
|
1011
878
|
if (record.type === "break" || record.type === "continue") {
|
|
1012
879
|
this.next = record.arg;
|
|
1013
880
|
} else if (record.type === "return") {
|
|
@@ -1017,13 +884,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1017
884
|
} else if (record.type === "normal" && afterLoc) {
|
|
1018
885
|
this.next = afterLoc;
|
|
1019
886
|
}
|
|
1020
|
-
|
|
1021
887
|
return ContinueSentinel;
|
|
1022
888
|
},
|
|
1023
889
|
finish: function finish(finallyLoc) {
|
|
1024
890
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1025
891
|
var entry = this.tryEntries[i];
|
|
1026
|
-
|
|
1027
892
|
if (entry.finallyLoc === finallyLoc) {
|
|
1028
893
|
this.complete(entry.completion, entry.afterLoc);
|
|
1029
894
|
resetTryEntry(entry);
|
|
@@ -1034,21 +899,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1034
899
|
"catch": function _catch(tryLoc) {
|
|
1035
900
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1036
901
|
var entry = this.tryEntries[i];
|
|
1037
|
-
|
|
1038
902
|
if (entry.tryLoc === tryLoc) {
|
|
1039
903
|
var record = entry.completion;
|
|
1040
|
-
|
|
1041
904
|
if (record.type === "throw") {
|
|
1042
905
|
var thrown = record.arg;
|
|
1043
906
|
resetTryEntry(entry);
|
|
1044
907
|
}
|
|
1045
|
-
|
|
1046
908
|
return thrown;
|
|
1047
909
|
}
|
|
1048
|
-
}
|
|
1049
|
-
// argument that corresponds to a known catch block.
|
|
1050
|
-
|
|
910
|
+
}
|
|
1051
911
|
|
|
912
|
+
// The context.catch method must only be called with a location
|
|
913
|
+
// argument that corresponds to a known catch block.
|
|
1052
914
|
throw new Error("illegal catch attempt");
|
|
1053
915
|
},
|
|
1054
916
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -1057,27 +919,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1057
919
|
resultName: resultName,
|
|
1058
920
|
nextLoc: nextLoc
|
|
1059
921
|
};
|
|
1060
|
-
|
|
1061
922
|
if (this.method === "next") {
|
|
1062
923
|
// Deliberately forget the last sent value so that we don't
|
|
1063
924
|
// accidentally pass it on to the delegate.
|
|
1064
925
|
this.arg = undefined$1;
|
|
1065
926
|
}
|
|
1066
|
-
|
|
1067
927
|
return ContinueSentinel;
|
|
1068
928
|
}
|
|
1069
|
-
};
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
1070
932
|
// or not, return the runtime object so that we can declare the variable
|
|
1071
933
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1072
934
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1073
|
-
|
|
1074
935
|
return exports;
|
|
1075
|
-
}(
|
|
936
|
+
}(
|
|
937
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
1076
938
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1077
939
|
// object. Either way, the resulting object will be used to initialize
|
|
1078
940
|
// the regeneratorRuntime variable at the top of this file.
|
|
1079
941
|
module.exports );
|
|
1080
|
-
|
|
1081
942
|
try {
|
|
1082
943
|
regeneratorRuntime = runtime;
|
|
1083
944
|
} catch (accidentalStrictMode) {
|
|
@@ -1104,14 +965,13 @@ function getPlasmicCookieValues() {
|
|
|
1104
965
|
if (!isBrowser$1) {
|
|
1105
966
|
return {};
|
|
1106
967
|
}
|
|
1107
|
-
|
|
1108
968
|
return Object.fromEntries(document.cookie.split('; ').filter(function (cookie) {
|
|
1109
969
|
return cookie.includes('plasmic:');
|
|
1110
970
|
}).map(function (cookie) {
|
|
1111
971
|
return cookie.split('=');
|
|
1112
972
|
}).map(function (_ref) {
|
|
1113
973
|
var key = _ref[0],
|
|
1114
|
-
|
|
974
|
+
value = _ref[1];
|
|
1115
975
|
return [key.split(':')[1], value];
|
|
1116
976
|
}));
|
|
1117
977
|
}
|
|
@@ -1122,17 +982,14 @@ function getVariationCookieValues() {
|
|
|
1122
982
|
}).filter(function (val) {
|
|
1123
983
|
return !!val[0];
|
|
1124
984
|
}));
|
|
1125
|
-
}
|
|
1126
|
-
|
|
985
|
+
}
|
|
986
|
+
// https://stackoverflow.com/a/8809472
|
|
1127
987
|
function generateUUID() {
|
|
1128
988
|
// Public Domain/MIT
|
|
1129
989
|
var d = new Date().getTime(); //Timestamp
|
|
1130
|
-
|
|
1131
990
|
var d2 = typeof performance !== 'undefined' && performance.now && performance.now() * 1000 || 0; //Time in microseconds since page-load or 0 if unsupported
|
|
1132
|
-
|
|
1133
991
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
1134
992
|
var r = Math.random() * 16; //random number between 0 and 16
|
|
1135
|
-
|
|
1136
993
|
if (d > 0) {
|
|
1137
994
|
//Use timestamp until depleted
|
|
1138
995
|
r = (d + r) % 16 | 0;
|
|
@@ -1142,7 +999,6 @@ function generateUUID() {
|
|
|
1142
999
|
r = (d2 + r) % 16 | 0;
|
|
1143
1000
|
d2 = Math.floor(d2 / 16);
|
|
1144
1001
|
}
|
|
1145
|
-
|
|
1146
1002
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
1147
1003
|
});
|
|
1148
1004
|
}
|
|
@@ -1150,35 +1006,29 @@ function getDistinctId() {
|
|
|
1150
1006
|
if (!isBrowser$1) {
|
|
1151
1007
|
return 'LOADER-SERVER';
|
|
1152
1008
|
}
|
|
1153
|
-
|
|
1154
1009
|
return generateUUID();
|
|
1155
1010
|
}
|
|
1156
|
-
|
|
1157
1011
|
function getCampaignParams() {
|
|
1158
1012
|
var _window = window,
|
|
1159
|
-
|
|
1013
|
+
location = _window.location;
|
|
1160
1014
|
var params = {};
|
|
1161
|
-
|
|
1162
1015
|
try {
|
|
1163
1016
|
var url = new URL(location.href);
|
|
1164
1017
|
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid'];
|
|
1165
1018
|
CAMPAIGN_KEYWORDS.forEach(function (keyword) {
|
|
1166
1019
|
var value = url.searchParams.get(keyword);
|
|
1167
|
-
|
|
1168
1020
|
if (value) {
|
|
1169
1021
|
params[keyword] = value;
|
|
1170
1022
|
}
|
|
1171
1023
|
});
|
|
1172
1024
|
} catch (err) {}
|
|
1173
|
-
|
|
1174
1025
|
return params;
|
|
1175
1026
|
}
|
|
1176
|
-
|
|
1177
1027
|
function getLocationMeta() {
|
|
1178
1028
|
var _window2 = window,
|
|
1179
|
-
|
|
1029
|
+
location = _window2.location;
|
|
1180
1030
|
var _document = document,
|
|
1181
|
-
|
|
1031
|
+
referrer = _document.referrer;
|
|
1182
1032
|
return _extends({
|
|
1183
1033
|
url: location.href,
|
|
1184
1034
|
host: location.host,
|
|
@@ -1186,10 +1036,9 @@ function getLocationMeta() {
|
|
|
1186
1036
|
referrer: referrer
|
|
1187
1037
|
}, getCampaignParams());
|
|
1188
1038
|
}
|
|
1189
|
-
|
|
1190
1039
|
function getScreenMeta() {
|
|
1191
1040
|
var _window3 = window,
|
|
1192
|
-
|
|
1041
|
+
screen = _window3.screen;
|
|
1193
1042
|
return {
|
|
1194
1043
|
screen_height: screen.height,
|
|
1195
1044
|
screen_width: screen.width,
|
|
@@ -1197,13 +1046,11 @@ function getScreenMeta() {
|
|
|
1197
1046
|
viewport_width: window.innerWidth
|
|
1198
1047
|
};
|
|
1199
1048
|
}
|
|
1200
|
-
|
|
1201
1049
|
function getOS(userAgent) {
|
|
1202
1050
|
if (/Windows/i.test(userAgent)) {
|
|
1203
1051
|
if (/Phone/.test(userAgent) || /WPDesktop/.test(userAgent)) {
|
|
1204
1052
|
return 'Windows Phone';
|
|
1205
1053
|
}
|
|
1206
|
-
|
|
1207
1054
|
return 'Windows';
|
|
1208
1055
|
} else if (/(iPhone|iPad|iPod)/.test(userAgent)) {
|
|
1209
1056
|
return 'iOS';
|
|
@@ -1221,7 +1068,6 @@ function getOS(userAgent) {
|
|
|
1221
1068
|
return '';
|
|
1222
1069
|
}
|
|
1223
1070
|
}
|
|
1224
|
-
|
|
1225
1071
|
function getDeviceInfo(userAgent) {
|
|
1226
1072
|
var PATTERNS = [{
|
|
1227
1073
|
device: 'iPhone',
|
|
@@ -1251,19 +1097,16 @@ function getDeviceInfo(userAgent) {
|
|
|
1251
1097
|
os: getOS(userAgent)
|
|
1252
1098
|
};
|
|
1253
1099
|
}
|
|
1254
|
-
|
|
1255
1100
|
function getUserAgentMeta() {
|
|
1256
1101
|
var _window4 = window,
|
|
1257
|
-
|
|
1102
|
+
navigator = _window4.navigator;
|
|
1258
1103
|
var userAgent = navigator.userAgent;
|
|
1259
1104
|
return _extends({}, getDeviceInfo(userAgent));
|
|
1260
1105
|
}
|
|
1261
|
-
|
|
1262
1106
|
function getWindowMeta() {
|
|
1263
1107
|
if (!isBrowser$1) {
|
|
1264
1108
|
return {};
|
|
1265
1109
|
}
|
|
1266
|
-
|
|
1267
1110
|
return _extends({}, getLocationMeta(), getScreenMeta(), getUserAgentMeta());
|
|
1268
1111
|
}
|
|
1269
1112
|
var isProduction = process.env.NODE_ENV === 'production';
|
|
@@ -1277,8 +1120,7 @@ function rawSplitVariation(variation) {
|
|
|
1277
1120
|
var rawVariations = {};
|
|
1278
1121
|
Object.keys(variation).forEach(function (variationKey) {
|
|
1279
1122
|
var _variationKey$split = variationKey.split('.'),
|
|
1280
|
-
|
|
1281
|
-
|
|
1123
|
+
splitId = _variationKey$split[1];
|
|
1282
1124
|
if (splitId) {
|
|
1283
1125
|
rawVariations[splitId] = variation[variationKey];
|
|
1284
1126
|
}
|
|
@@ -1293,7 +1135,6 @@ function throttled(func) {
|
|
|
1293
1135
|
// will already be taken care of next time we run
|
|
1294
1136
|
return;
|
|
1295
1137
|
}
|
|
1296
|
-
|
|
1297
1138
|
if (isBrowser$1) {
|
|
1298
1139
|
timerId = window.requestAnimationFrame(function () {
|
|
1299
1140
|
timerId = undefined;
|
|
@@ -1314,7 +1155,6 @@ var TRACKER_VERSION = 3;
|
|
|
1314
1155
|
var PlasmicTracker = /*#__PURE__*/function () {
|
|
1315
1156
|
function PlasmicTracker(opts) {
|
|
1316
1157
|
var _this = this;
|
|
1317
|
-
|
|
1318
1158
|
this.opts = opts;
|
|
1319
1159
|
this.eventQueue = [];
|
|
1320
1160
|
this.sendEvents = throttled( /*#__PURE__*/function () {
|
|
@@ -1328,9 +1168,7 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1328
1168
|
_context.next = 2;
|
|
1329
1169
|
break;
|
|
1330
1170
|
}
|
|
1331
|
-
|
|
1332
1171
|
return _context.abrupt("return");
|
|
1333
|
-
|
|
1334
1172
|
case 2:
|
|
1335
1173
|
events = [].concat(_this.eventQueue);
|
|
1336
1174
|
_this.eventQueue.length = 0;
|
|
@@ -1338,10 +1176,8 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1338
1176
|
api_key: API_PUBLIC_KEY,
|
|
1339
1177
|
batch: events
|
|
1340
1178
|
};
|
|
1341
|
-
|
|
1342
1179
|
try {
|
|
1343
1180
|
stringBody = JSON.stringify(body);
|
|
1344
|
-
|
|
1345
1181
|
if (transport === 'beacon') {
|
|
1346
1182
|
// Triggers warning: https://chromestatus.com/feature/5629709824032768
|
|
1347
1183
|
window.navigator.sendBeacon(API_ENDPOINT, stringBody);
|
|
@@ -1355,7 +1191,6 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1355
1191
|
}).then(function () {})["catch"](function () {});
|
|
1356
1192
|
}
|
|
1357
1193
|
} catch (err) {}
|
|
1358
|
-
|
|
1359
1194
|
case 6:
|
|
1360
1195
|
case "end":
|
|
1361
1196
|
return _context.stop();
|
|
@@ -1363,36 +1198,29 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1363
1198
|
}
|
|
1364
1199
|
}, _callee);
|
|
1365
1200
|
}));
|
|
1366
|
-
|
|
1367
1201
|
return function (_x) {
|
|
1368
1202
|
return _ref.apply(this, arguments);
|
|
1369
1203
|
};
|
|
1370
1204
|
}());
|
|
1371
1205
|
}
|
|
1372
|
-
|
|
1373
1206
|
var _proto = PlasmicTracker.prototype;
|
|
1374
|
-
|
|
1375
1207
|
_proto.trackRender = function trackRender(opts) {
|
|
1376
1208
|
var _opts$renderCtx, _opts$variation;
|
|
1377
|
-
|
|
1378
1209
|
this.enqueue({
|
|
1379
1210
|
event: '$render',
|
|
1380
1211
|
properties: _extends({}, this.getProperties(), (_opts$renderCtx = opts == null ? void 0 : opts.renderCtx) != null ? _opts$renderCtx : {}, rawSplitVariation((_opts$variation = opts == null ? void 0 : opts.variation) != null ? _opts$variation : {}))
|
|
1381
1212
|
});
|
|
1382
1213
|
};
|
|
1383
|
-
|
|
1384
1214
|
_proto.trackFetch = function trackFetch() {
|
|
1385
1215
|
this.enqueue({
|
|
1386
1216
|
event: '$fetch',
|
|
1387
1217
|
properties: this.getProperties()
|
|
1388
1218
|
});
|
|
1389
1219
|
};
|
|
1390
|
-
|
|
1391
1220
|
_proto.trackConversion = function trackConversion(value) {
|
|
1392
1221
|
if (value === void 0) {
|
|
1393
1222
|
value = 0;
|
|
1394
1223
|
}
|
|
1395
|
-
|
|
1396
1224
|
this.enqueue({
|
|
1397
1225
|
event: '$conversion',
|
|
1398
1226
|
properties: _extends({}, this.getProperties(), {
|
|
@@ -1400,10 +1228,8 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1400
1228
|
})
|
|
1401
1229
|
});
|
|
1402
1230
|
};
|
|
1403
|
-
|
|
1404
1231
|
_proto.getProperties = function getProperties() {
|
|
1405
1232
|
var _Date$now;
|
|
1406
|
-
|
|
1407
1233
|
return _extends({
|
|
1408
1234
|
distinct_id: getDistinctId()
|
|
1409
1235
|
}, getWindowMeta(), getEnvMeta(), this.getContextMeta(), getVariationCookieValues(), {
|
|
@@ -1411,12 +1237,10 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1411
1237
|
trackerVersion: TRACKER_VERSION
|
|
1412
1238
|
});
|
|
1413
1239
|
};
|
|
1414
|
-
|
|
1415
1240
|
_proto.enqueue = function enqueue(event) {
|
|
1416
1241
|
this.eventQueue.push(event);
|
|
1417
1242
|
this.sendEvents('fetch');
|
|
1418
1243
|
};
|
|
1419
|
-
|
|
1420
1244
|
_proto.getContextMeta = function getContextMeta() {
|
|
1421
1245
|
return {
|
|
1422
1246
|
platform: this.opts.platform,
|
|
@@ -1424,7 +1248,6 @@ var PlasmicTracker = /*#__PURE__*/function () {
|
|
|
1424
1248
|
projectIds: this.opts.projectIds
|
|
1425
1249
|
};
|
|
1426
1250
|
};
|
|
1427
|
-
|
|
1428
1251
|
return PlasmicTracker;
|
|
1429
1252
|
}();
|
|
1430
1253
|
|