@plasmicpkgs/commerce-shopify 0.0.6 → 0.0.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.
- package/LICENSE.md +21 -0
- package/dist/commerce-shopify.cjs.development.js +588 -620
- package/dist/commerce-shopify.cjs.development.js.map +1 -1
- package/dist/commerce-shopify.cjs.production.min.js +1 -1
- package/dist/commerce-shopify.cjs.production.min.js.map +1 -1
- package/dist/commerce-shopify.esm.js +588 -620
- package/dist/commerce-shopify.esm.js.map +1 -1
- package/package.json +5 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useCallback } from 'react';
|
|
2
2
|
import { FetcherError, ValidationError, CommerceError, useCart, useCommerce as useCommerce$1, getCommerceProvider as getCommerceProvider$1 } from '@plasmicpkgs/commerce';
|
|
3
3
|
import Cookies from 'js-cookie';
|
|
4
|
-
import debounce from 'lodash
|
|
4
|
+
import debounce from 'lodash-es/debounce';
|
|
5
5
|
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -85,201 +85,198 @@ function createCommonjsModule(fn, module) {
|
|
|
85
85
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
117
|
-
define({}, "");
|
|
118
|
-
} catch (err) {
|
|
119
|
-
define = function(obj, key, value) {
|
|
120
|
-
return obj[key] = value;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
125
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
126
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
127
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
128
|
-
var context = new Context(tryLocsList || []);
|
|
129
|
-
|
|
130
|
-
// The ._invoke method unifies the implementations of the .next,
|
|
131
|
-
// .throw, and .return methods.
|
|
132
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
88
|
+
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
89
|
+
/**
|
|
90
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the MIT license found in the
|
|
93
|
+
* LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/
|
|
95
|
+
var runtime = function (exports) {
|
|
96
|
+
|
|
97
|
+
var Op = Object.prototype;
|
|
98
|
+
var hasOwn = Op.hasOwnProperty;
|
|
99
|
+
var undefined$1; // More compressible than void 0.
|
|
100
|
+
|
|
101
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
102
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
103
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
104
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
105
|
+
|
|
106
|
+
function define(obj, key, value) {
|
|
107
|
+
Object.defineProperty(obj, key, {
|
|
108
|
+
value: value,
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true
|
|
112
|
+
});
|
|
113
|
+
return obj[key];
|
|
114
|
+
}
|
|
133
115
|
|
|
134
|
-
return generator;
|
|
135
|
-
}
|
|
136
|
-
exports.wrap = wrap;
|
|
137
|
-
|
|
138
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
139
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
140
|
-
// have been (and was previously) designed to take a closure to be
|
|
141
|
-
// invoked without arguments, but in all the cases we care about we
|
|
142
|
-
// already have an existing method we want to call, so there's no need
|
|
143
|
-
// to create a new function object. We can even get away with assuming
|
|
144
|
-
// the method takes exactly one argument, since that happens to be true
|
|
145
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
146
|
-
// only additional allocation required is the completion record, which
|
|
147
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
148
|
-
function tryCatch(fn, obj, arg) {
|
|
149
116
|
try {
|
|
150
|
-
|
|
117
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
118
|
+
define({}, "");
|
|
151
119
|
} catch (err) {
|
|
152
|
-
|
|
120
|
+
define = function define(obj, key, value) {
|
|
121
|
+
return obj[key] = value;
|
|
122
|
+
};
|
|
153
123
|
}
|
|
154
|
-
}
|
|
155
124
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// breaking out of the dispatch switch statement.
|
|
163
|
-
var ContinueSentinel = {};
|
|
164
|
-
|
|
165
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
166
|
-
// .constructor.prototype properties for functions that return Generator
|
|
167
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
168
|
-
// minifier not to mangle the names of these two functions.
|
|
169
|
-
function Generator() {}
|
|
170
|
-
function GeneratorFunction() {}
|
|
171
|
-
function GeneratorFunctionPrototype() {}
|
|
172
|
-
|
|
173
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
174
|
-
// don't natively support it.
|
|
175
|
-
var IteratorPrototype = {};
|
|
176
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
177
|
-
return this;
|
|
178
|
-
});
|
|
125
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
126
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
127
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
128
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
129
|
+
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
130
|
+
// .throw, and .return methods.
|
|
179
131
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
NativeIteratorPrototype !== Op &&
|
|
184
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
185
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
186
|
-
// of the polyfill.
|
|
187
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
188
|
-
}
|
|
132
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
133
|
+
return generator;
|
|
134
|
+
}
|
|
189
135
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
|
|
136
|
+
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
137
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
138
|
+
// have been (and was previously) designed to take a closure to be
|
|
139
|
+
// invoked without arguments, but in all the cases we care about we
|
|
140
|
+
// already have an existing method we want to call, so there's no need
|
|
141
|
+
// to create a new function object. We can even get away with assuming
|
|
142
|
+
// the method takes exactly one argument, since that happens to be true
|
|
143
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
144
|
+
// only additional allocation required is the completion record, which
|
|
145
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
146
|
+
|
|
147
|
+
function tryCatch(fn, obj, arg) {
|
|
148
|
+
try {
|
|
149
|
+
return {
|
|
150
|
+
type: "normal",
|
|
151
|
+
arg: fn.call(obj, arg)
|
|
152
|
+
};
|
|
153
|
+
} catch (err) {
|
|
154
|
+
return {
|
|
155
|
+
type: "throw",
|
|
156
|
+
arg: err
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
162
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
163
|
+
var GenStateExecuting = "executing";
|
|
164
|
+
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
165
|
+
// breaking out of the dispatch switch statement.
|
|
166
|
+
|
|
167
|
+
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
168
|
+
// .constructor.prototype properties for functions that return Generator
|
|
169
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
170
|
+
// minifier not to mangle the names of these two functions.
|
|
171
|
+
|
|
172
|
+
function Generator() {}
|
|
173
|
+
|
|
174
|
+
function GeneratorFunction() {}
|
|
175
|
+
|
|
176
|
+
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
177
|
+
// don't natively support it.
|
|
210
178
|
|
|
211
|
-
exports.isGeneratorFunction = function(genFun) {
|
|
212
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
213
|
-
return ctor
|
|
214
|
-
? ctor === GeneratorFunction ||
|
|
215
|
-
// For the native GeneratorFunction constructor, the best we can
|
|
216
|
-
// do is to check its .name property.
|
|
217
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
218
|
-
: false;
|
|
219
|
-
};
|
|
220
179
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
180
|
+
var IteratorPrototype = {};
|
|
181
|
+
|
|
182
|
+
IteratorPrototype[iteratorSymbol] = function () {
|
|
183
|
+
return this;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var getProto = Object.getPrototypeOf;
|
|
187
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
188
|
+
|
|
189
|
+
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
190
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
191
|
+
// of the polyfill.
|
|
192
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
227
193
|
}
|
|
228
|
-
genFun.prototype = Object.create(Gp);
|
|
229
|
-
return genFun;
|
|
230
|
-
};
|
|
231
194
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return { __await: arg };
|
|
238
|
-
};
|
|
195
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
196
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
197
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
198
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
199
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
239
200
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
201
|
+
function defineIteratorMethods(prototype) {
|
|
202
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
203
|
+
define(prototype, method, function (arg) {
|
|
204
|
+
return this._invoke(method, arg);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
exports.isGeneratorFunction = function (genFun) {
|
|
210
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
211
|
+
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
212
|
+
// do is to check its .name property.
|
|
213
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
exports.mark = function (genFun) {
|
|
217
|
+
if (Object.setPrototypeOf) {
|
|
218
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
245
219
|
} else {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
220
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
221
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
genFun.prototype = Object.create(Gp);
|
|
225
|
+
return genFun;
|
|
226
|
+
}; // Within the body of any async function, `await x` is transformed to
|
|
227
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
228
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
229
|
+
// meant to be awaited.
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
exports.awrap = function (arg) {
|
|
233
|
+
return {
|
|
234
|
+
__await: arg
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
239
|
+
function invoke(method, arg, resolve, reject) {
|
|
240
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
241
|
+
|
|
242
|
+
if (record.type === "throw") {
|
|
243
|
+
reject(record.arg);
|
|
244
|
+
} else {
|
|
245
|
+
var result = record.arg;
|
|
246
|
+
var value = result.value;
|
|
247
|
+
|
|
248
|
+
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
249
|
+
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
250
|
+
invoke("next", value, resolve, reject);
|
|
251
|
+
}, function (err) {
|
|
252
|
+
invoke("throw", err, resolve, reject);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
257
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
258
|
+
// the .value of the Promise<{value,done}> result for the
|
|
259
|
+
// current iteration.
|
|
260
|
+
result.value = unwrapped;
|
|
261
|
+
resolve(result);
|
|
262
|
+
}, function (error) {
|
|
263
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
264
|
+
// into the async generator function so it can be handled there.
|
|
265
|
+
return invoke("throw", error, resolve, reject);
|
|
255
266
|
});
|
|
256
267
|
}
|
|
257
|
-
|
|
258
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
259
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
260
|
-
// the .value of the Promise<{value,done}> result for the
|
|
261
|
-
// current iteration.
|
|
262
|
-
result.value = unwrapped;
|
|
263
|
-
resolve(result);
|
|
264
|
-
}, function(error) {
|
|
265
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
266
|
-
// into the async generator function so it can be handled there.
|
|
267
|
-
return invoke("throw", error, resolve, reject);
|
|
268
|
-
});
|
|
269
268
|
}
|
|
270
|
-
}
|
|
271
269
|
|
|
272
|
-
|
|
270
|
+
var previousPromise;
|
|
273
271
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
272
|
+
function enqueue(method, arg) {
|
|
273
|
+
function callInvokeWithMethodAndArg() {
|
|
274
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
275
|
+
invoke(method, arg, resolve, reject);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
280
278
|
|
|
281
|
-
|
|
282
|
-
// If enqueue has been called before, then we want to wait until
|
|
279
|
+
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
283
280
|
// all previous Promises have been resolved before calling invoke,
|
|
284
281
|
// so that results are always delivered in the correct order. If
|
|
285
282
|
// enqueue has not been called before, then it is important to
|
|
@@ -291,554 +288,525 @@ var runtime = (function (exports) {
|
|
|
291
288
|
// execute code before the first await. Since we implement simple
|
|
292
289
|
// async functions in terms of async generators, it is especially
|
|
293
290
|
// important to get this right, even though it requires care.
|
|
294
|
-
previousPromise ? previousPromise.then(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
291
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
292
|
+
// invocations of the iterator.
|
|
293
|
+
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
294
|
+
} // Define the unified helper method that is used to implement .next,
|
|
295
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
this._invoke = enqueue;
|
|
300
299
|
}
|
|
301
300
|
|
|
302
|
-
|
|
303
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
304
|
-
this._invoke = enqueue;
|
|
305
|
-
}
|
|
301
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
306
302
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
});
|
|
311
|
-
exports.AsyncIterator = AsyncIterator;
|
|
312
|
-
|
|
313
|
-
// Note that simple async functions are implemented on top of
|
|
314
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
315
|
-
// the final result produced by the iterator.
|
|
316
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
317
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
318
|
-
|
|
319
|
-
var iter = new AsyncIterator(
|
|
320
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
321
|
-
PromiseImpl
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
return exports.isGeneratorFunction(outerFn)
|
|
325
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
326
|
-
: iter.next().then(function(result) {
|
|
327
|
-
return result.done ? result.value : iter.next();
|
|
328
|
-
});
|
|
329
|
-
};
|
|
303
|
+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
304
|
+
return this;
|
|
305
|
+
};
|
|
330
306
|
|
|
331
|
-
|
|
332
|
-
|
|
307
|
+
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
308
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
309
|
+
// the final result produced by the iterator.
|
|
333
310
|
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
|
|
311
|
+
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
312
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
313
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
314
|
+
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
315
|
+
: iter.next().then(function (result) {
|
|
316
|
+
return result.done ? result.value : iter.next();
|
|
317
|
+
});
|
|
318
|
+
};
|
|
338
319
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
320
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
321
|
+
var state = GenStateSuspendedStart;
|
|
322
|
+
return function invoke(method, arg) {
|
|
323
|
+
if (state === GenStateExecuting) {
|
|
324
|
+
throw new Error("Generator is already running");
|
|
342
325
|
}
|
|
343
326
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
327
|
+
if (state === GenStateCompleted) {
|
|
328
|
+
if (method === "throw") {
|
|
329
|
+
throw arg;
|
|
330
|
+
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
331
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
348
332
|
|
|
349
|
-
context.method = method;
|
|
350
|
-
context.arg = arg;
|
|
351
333
|
|
|
352
|
-
|
|
353
|
-
var delegate = context.delegate;
|
|
354
|
-
if (delegate) {
|
|
355
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
356
|
-
if (delegateResult) {
|
|
357
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
358
|
-
return delegateResult;
|
|
359
|
-
}
|
|
334
|
+
return doneResult();
|
|
360
335
|
}
|
|
361
336
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
337
|
+
context.method = method;
|
|
338
|
+
context.arg = arg;
|
|
339
|
+
|
|
340
|
+
while (true) {
|
|
341
|
+
var delegate = context.delegate;
|
|
342
|
+
|
|
343
|
+
if (delegate) {
|
|
344
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
366
345
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
346
|
+
if (delegateResult) {
|
|
347
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
348
|
+
return delegateResult;
|
|
349
|
+
}
|
|
371
350
|
}
|
|
372
351
|
|
|
373
|
-
|
|
352
|
+
if (context.method === "next") {
|
|
353
|
+
// Setting context._sent for legacy support of Babel's
|
|
354
|
+
// function.sent implementation.
|
|
355
|
+
context.sent = context._sent = context.arg;
|
|
356
|
+
} else if (context.method === "throw") {
|
|
357
|
+
if (state === GenStateSuspendedStart) {
|
|
358
|
+
state = GenStateCompleted;
|
|
359
|
+
throw context.arg;
|
|
360
|
+
}
|
|
374
361
|
|
|
375
|
-
|
|
376
|
-
context.
|
|
377
|
-
|
|
362
|
+
context.dispatchException(context.arg);
|
|
363
|
+
} else if (context.method === "return") {
|
|
364
|
+
context.abrupt("return", context.arg);
|
|
365
|
+
}
|
|
378
366
|
|
|
379
|
-
|
|
367
|
+
state = GenStateExecuting;
|
|
368
|
+
var record = tryCatch(innerFn, self, context);
|
|
380
369
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
state = context.done
|
|
386
|
-
? GenStateCompleted
|
|
387
|
-
: GenStateSuspendedYield;
|
|
370
|
+
if (record.type === "normal") {
|
|
371
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
372
|
+
// GenStateExecuting and loop back for another invocation.
|
|
373
|
+
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
388
374
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
375
|
+
if (record.arg === ContinueSentinel) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
392
378
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
379
|
+
return {
|
|
380
|
+
value: record.arg,
|
|
381
|
+
done: context.done
|
|
382
|
+
};
|
|
383
|
+
} else if (record.type === "throw") {
|
|
384
|
+
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
385
|
+
// context.dispatchException(context.arg) call above.
|
|
386
|
+
|
|
387
|
+
context.method = "throw";
|
|
388
|
+
context.arg = record.arg;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
393
|
+
// result, either by returning a { value, done } result from the
|
|
394
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
395
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
399
|
+
var method = delegate.iterator[context.method];
|
|
400
|
+
|
|
401
|
+
if (method === undefined$1) {
|
|
402
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
403
|
+
// method always terminates the yield* loop.
|
|
404
|
+
context.delegate = null;
|
|
405
|
+
|
|
406
|
+
if (context.method === "throw") {
|
|
407
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
408
|
+
if (delegate.iterator["return"]) {
|
|
409
|
+
// If the delegate iterator has a return method, give it a
|
|
410
|
+
// chance to clean up.
|
|
411
|
+
context.method = "return";
|
|
412
|
+
context.arg = undefined$1;
|
|
413
|
+
maybeInvokeDelegate(delegate, context);
|
|
414
|
+
|
|
415
|
+
if (context.method === "throw") {
|
|
416
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
417
|
+
// "return" to "throw", let that override the TypeError below.
|
|
418
|
+
return ContinueSentinel;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
397
421
|
|
|
398
|
-
} else if (record.type === "throw") {
|
|
399
|
-
state = GenStateCompleted;
|
|
400
|
-
// Dispatch the exception by looping back around to the
|
|
401
|
-
// context.dispatchException(context.arg) call above.
|
|
402
422
|
context.method = "throw";
|
|
403
|
-
context.arg =
|
|
423
|
+
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
404
424
|
}
|
|
425
|
+
|
|
426
|
+
return ContinueSentinel;
|
|
405
427
|
}
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
428
|
|
|
409
|
-
|
|
410
|
-
// result, either by returning a { value, done } result from the
|
|
411
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
412
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
413
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
414
|
-
var method = delegate.iterator[context.method];
|
|
415
|
-
if (method === undefined$1) {
|
|
416
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
417
|
-
// method always terminates the yield* loop.
|
|
418
|
-
context.delegate = null;
|
|
429
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
419
430
|
|
|
420
|
-
if (
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
context.arg = undefined$1;
|
|
427
|
-
maybeInvokeDelegate(delegate, context);
|
|
431
|
+
if (record.type === "throw") {
|
|
432
|
+
context.method = "throw";
|
|
433
|
+
context.arg = record.arg;
|
|
434
|
+
context.delegate = null;
|
|
435
|
+
return ContinueSentinel;
|
|
436
|
+
}
|
|
428
437
|
|
|
429
|
-
|
|
430
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
431
|
-
// "return" to "throw", let that override the TypeError below.
|
|
432
|
-
return ContinueSentinel;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
438
|
+
var info = record.arg;
|
|
435
439
|
|
|
440
|
+
if (!info) {
|
|
436
441
|
context.method = "throw";
|
|
437
|
-
context.arg = new TypeError(
|
|
438
|
-
|
|
442
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
443
|
+
context.delegate = null;
|
|
444
|
+
return ContinueSentinel;
|
|
439
445
|
}
|
|
440
446
|
|
|
441
|
-
|
|
442
|
-
|
|
447
|
+
if (info.done) {
|
|
448
|
+
// Assign the result of the finished delegate to the temporary
|
|
449
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
450
|
+
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
443
451
|
|
|
444
|
-
|
|
452
|
+
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
453
|
+
// exception, let the outer generator proceed normally. If
|
|
454
|
+
// context.method was "next", forget context.arg since it has been
|
|
455
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
456
|
+
// "return", allow the original .return call to continue in the
|
|
457
|
+
// outer generator.
|
|
445
458
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
459
|
+
if (context.method !== "return") {
|
|
460
|
+
context.method = "next";
|
|
461
|
+
context.arg = undefined$1;
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
// Re-yield the result returned by the delegate method.
|
|
465
|
+
return info;
|
|
466
|
+
} // The delegate iterator is finished, so forget it and continue with
|
|
467
|
+
// the outer generator.
|
|
452
468
|
|
|
453
|
-
var info = record.arg;
|
|
454
469
|
|
|
455
|
-
if (! info) {
|
|
456
|
-
context.method = "throw";
|
|
457
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
458
470
|
context.delegate = null;
|
|
459
471
|
return ContinueSentinel;
|
|
460
|
-
}
|
|
472
|
+
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
473
|
+
// unified ._invoke helper method.
|
|
461
474
|
|
|
462
|
-
if (info.done) {
|
|
463
|
-
// Assign the result of the finished delegate to the temporary
|
|
464
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
465
|
-
context[delegate.resultName] = info.value;
|
|
466
|
-
|
|
467
|
-
// Resume execution at the desired location (see delegateYield).
|
|
468
|
-
context.next = delegate.nextLoc;
|
|
469
|
-
|
|
470
|
-
// If context.method was "throw" but the delegate handled the
|
|
471
|
-
// exception, let the outer generator proceed normally. If
|
|
472
|
-
// context.method was "next", forget context.arg since it has been
|
|
473
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
474
|
-
// "return", allow the original .return call to continue in the
|
|
475
|
-
// outer generator.
|
|
476
|
-
if (context.method !== "return") {
|
|
477
|
-
context.method = "next";
|
|
478
|
-
context.arg = undefined$1;
|
|
479
|
-
}
|
|
480
475
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
476
|
+
defineIteratorMethods(Gp);
|
|
477
|
+
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
478
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
479
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
480
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
481
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
485
482
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
return ContinueSentinel;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
493
|
-
// unified ._invoke helper method.
|
|
494
|
-
defineIteratorMethods(Gp);
|
|
483
|
+
Gp[iteratorSymbol] = function () {
|
|
484
|
+
return this;
|
|
485
|
+
};
|
|
495
486
|
|
|
496
|
-
|
|
487
|
+
Gp.toString = function () {
|
|
488
|
+
return "[object Generator]";
|
|
489
|
+
};
|
|
497
490
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
503
|
-
define(Gp, iteratorSymbol, function() {
|
|
504
|
-
return this;
|
|
505
|
-
});
|
|
491
|
+
function pushTryEntry(locs) {
|
|
492
|
+
var entry = {
|
|
493
|
+
tryLoc: locs[0]
|
|
494
|
+
};
|
|
506
495
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
496
|
+
if (1 in locs) {
|
|
497
|
+
entry.catchLoc = locs[1];
|
|
498
|
+
}
|
|
510
499
|
|
|
511
|
-
|
|
512
|
-
|
|
500
|
+
if (2 in locs) {
|
|
501
|
+
entry.finallyLoc = locs[2];
|
|
502
|
+
entry.afterLoc = locs[3];
|
|
503
|
+
}
|
|
513
504
|
|
|
514
|
-
|
|
515
|
-
entry.catchLoc = locs[1];
|
|
505
|
+
this.tryEntries.push(entry);
|
|
516
506
|
}
|
|
517
507
|
|
|
518
|
-
|
|
519
|
-
entry.
|
|
520
|
-
|
|
508
|
+
function resetTryEntry(entry) {
|
|
509
|
+
var record = entry.completion || {};
|
|
510
|
+
record.type = "normal";
|
|
511
|
+
delete record.arg;
|
|
512
|
+
entry.completion = record;
|
|
521
513
|
}
|
|
522
514
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
function Context(tryLocsList) {
|
|
534
|
-
// The root entry object (effectively a try statement without a catch
|
|
535
|
-
// or a finally block) gives us a place to store values thrown from
|
|
536
|
-
// locations where there is no enclosing try statement.
|
|
537
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
538
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
539
|
-
this.reset(true);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
exports.keys = function(object) {
|
|
543
|
-
var keys = [];
|
|
544
|
-
for (var key in object) {
|
|
545
|
-
keys.push(key);
|
|
515
|
+
function Context(tryLocsList) {
|
|
516
|
+
// The root entry object (effectively a try statement without a catch
|
|
517
|
+
// or a finally block) gives us a place to store values thrown from
|
|
518
|
+
// locations where there is no enclosing try statement.
|
|
519
|
+
this.tryEntries = [{
|
|
520
|
+
tryLoc: "root"
|
|
521
|
+
}];
|
|
522
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
523
|
+
this.reset(true);
|
|
546
524
|
}
|
|
547
|
-
keys.reverse();
|
|
548
|
-
|
|
549
|
-
// Rather than returning an object with a next method, we keep
|
|
550
|
-
// things simple and return the next function itself.
|
|
551
|
-
return function next() {
|
|
552
|
-
while (keys.length) {
|
|
553
|
-
var key = keys.pop();
|
|
554
|
-
if (key in object) {
|
|
555
|
-
next.value = key;
|
|
556
|
-
next.done = false;
|
|
557
|
-
return next;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
525
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
// also ensures that the minifier will not anonymize the function.
|
|
564
|
-
next.done = true;
|
|
565
|
-
return next;
|
|
566
|
-
};
|
|
567
|
-
};
|
|
526
|
+
exports.keys = function (object) {
|
|
527
|
+
var keys = [];
|
|
568
528
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
572
|
-
if (iteratorMethod) {
|
|
573
|
-
return iteratorMethod.call(iterable);
|
|
529
|
+
for (var key in object) {
|
|
530
|
+
keys.push(key);
|
|
574
531
|
}
|
|
575
532
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
533
|
+
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
534
|
+
// things simple and return the next function itself.
|
|
579
535
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
if (hasOwn.call(iterable, i)) {
|
|
584
|
-
next.value = iterable[i];
|
|
585
|
-
next.done = false;
|
|
586
|
-
return next;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
536
|
+
return function next() {
|
|
537
|
+
while (keys.length) {
|
|
538
|
+
var key = keys.pop();
|
|
589
539
|
|
|
590
|
-
|
|
591
|
-
|
|
540
|
+
if (key in object) {
|
|
541
|
+
next.value = key;
|
|
542
|
+
next.done = false;
|
|
543
|
+
return next;
|
|
544
|
+
}
|
|
545
|
+
} // To avoid creating an additional object, we just hang the .value
|
|
546
|
+
// and .done properties off the next function object itself. This
|
|
547
|
+
// also ensures that the minifier will not anonymize the function.
|
|
592
548
|
|
|
593
|
-
return next;
|
|
594
|
-
};
|
|
595
549
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
550
|
+
next.done = true;
|
|
551
|
+
return next;
|
|
552
|
+
};
|
|
553
|
+
};
|
|
599
554
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
exports.values = values;
|
|
555
|
+
function values(iterable) {
|
|
556
|
+
if (iterable) {
|
|
557
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
604
558
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
559
|
+
if (iteratorMethod) {
|
|
560
|
+
return iteratorMethod.call(iterable);
|
|
561
|
+
}
|
|
608
562
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
reset: function(skipTempReset) {
|
|
613
|
-
this.prev = 0;
|
|
614
|
-
this.next = 0;
|
|
615
|
-
// Resetting context._sent for legacy support of Babel's
|
|
616
|
-
// function.sent implementation.
|
|
617
|
-
this.sent = this._sent = undefined$1;
|
|
618
|
-
this.done = false;
|
|
619
|
-
this.delegate = null;
|
|
620
|
-
|
|
621
|
-
this.method = "next";
|
|
622
|
-
this.arg = undefined$1;
|
|
623
|
-
|
|
624
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
625
|
-
|
|
626
|
-
if (!skipTempReset) {
|
|
627
|
-
for (var name in this) {
|
|
628
|
-
// Not sure about the optimal order of these conditions:
|
|
629
|
-
if (name.charAt(0) === "t" &&
|
|
630
|
-
hasOwn.call(this, name) &&
|
|
631
|
-
!isNaN(+name.slice(1))) {
|
|
632
|
-
this[name] = undefined$1;
|
|
633
|
-
}
|
|
563
|
+
if (typeof iterable.next === "function") {
|
|
564
|
+
return iterable;
|
|
634
565
|
}
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
566
|
|
|
638
|
-
|
|
639
|
-
|
|
567
|
+
if (!isNaN(iterable.length)) {
|
|
568
|
+
var i = -1,
|
|
569
|
+
next = function next() {
|
|
570
|
+
while (++i < iterable.length) {
|
|
571
|
+
if (hasOwn.call(iterable, i)) {
|
|
572
|
+
next.value = iterable[i];
|
|
573
|
+
next.done = false;
|
|
574
|
+
return next;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
640
577
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
578
|
+
next.value = undefined$1;
|
|
579
|
+
next.done = true;
|
|
580
|
+
return next;
|
|
581
|
+
};
|
|
646
582
|
|
|
647
|
-
|
|
648
|
-
|
|
583
|
+
return next.next = next;
|
|
584
|
+
}
|
|
585
|
+
} // Return an iterator with no values.
|
|
649
586
|
|
|
650
|
-
dispatchException: function(exception) {
|
|
651
|
-
if (this.done) {
|
|
652
|
-
throw exception;
|
|
653
|
-
}
|
|
654
587
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
context.next = loc;
|
|
588
|
+
return {
|
|
589
|
+
next: doneResult
|
|
590
|
+
};
|
|
591
|
+
}
|
|
660
592
|
|
|
661
|
-
|
|
662
|
-
// If the dispatched exception was caught by a catch block,
|
|
663
|
-
// then let that catch block handle the exception normally.
|
|
664
|
-
context.method = "next";
|
|
665
|
-
context.arg = undefined$1;
|
|
666
|
-
}
|
|
593
|
+
exports.values = values;
|
|
667
594
|
|
|
668
|
-
|
|
669
|
-
|
|
595
|
+
function doneResult() {
|
|
596
|
+
return {
|
|
597
|
+
value: undefined$1,
|
|
598
|
+
done: true
|
|
599
|
+
};
|
|
600
|
+
}
|
|
670
601
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
602
|
+
Context.prototype = {
|
|
603
|
+
constructor: Context,
|
|
604
|
+
reset: function reset(skipTempReset) {
|
|
605
|
+
this.prev = 0;
|
|
606
|
+
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
607
|
+
// function.sent implementation.
|
|
674
608
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
609
|
+
this.sent = this._sent = undefined$1;
|
|
610
|
+
this.done = false;
|
|
611
|
+
this.delegate = null;
|
|
612
|
+
this.method = "next";
|
|
613
|
+
this.arg = undefined$1;
|
|
614
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
615
|
+
|
|
616
|
+
if (!skipTempReset) {
|
|
617
|
+
for (var name in this) {
|
|
618
|
+
// Not sure about the optimal order of these conditions:
|
|
619
|
+
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
620
|
+
this[name] = undefined$1;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
680
623
|
}
|
|
624
|
+
},
|
|
625
|
+
stop: function stop() {
|
|
626
|
+
this.done = true;
|
|
627
|
+
var rootEntry = this.tryEntries[0];
|
|
628
|
+
var rootRecord = rootEntry.completion;
|
|
681
629
|
|
|
682
|
-
if (
|
|
683
|
-
|
|
684
|
-
|
|
630
|
+
if (rootRecord.type === "throw") {
|
|
631
|
+
throw rootRecord.arg;
|
|
632
|
+
}
|
|
685
633
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
634
|
+
return this.rval;
|
|
635
|
+
},
|
|
636
|
+
dispatchException: function dispatchException(exception) {
|
|
637
|
+
if (this.done) {
|
|
638
|
+
throw exception;
|
|
639
|
+
}
|
|
692
640
|
|
|
693
|
-
|
|
694
|
-
if (this.prev < entry.catchLoc) {
|
|
695
|
-
return handle(entry.catchLoc, true);
|
|
696
|
-
}
|
|
641
|
+
var context = this;
|
|
697
642
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
643
|
+
function handle(loc, caught) {
|
|
644
|
+
record.type = "throw";
|
|
645
|
+
record.arg = exception;
|
|
646
|
+
context.next = loc;
|
|
702
647
|
|
|
703
|
-
|
|
704
|
-
|
|
648
|
+
if (caught) {
|
|
649
|
+
// If the dispatched exception was caught by a catch block,
|
|
650
|
+
// then let that catch block handle the exception normally.
|
|
651
|
+
context.method = "next";
|
|
652
|
+
context.arg = undefined$1;
|
|
705
653
|
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
654
|
|
|
710
|
-
|
|
711
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
712
|
-
var entry = this.tryEntries[i];
|
|
713
|
-
if (entry.tryLoc <= this.prev &&
|
|
714
|
-
hasOwn.call(entry, "finallyLoc") &&
|
|
715
|
-
this.prev < entry.finallyLoc) {
|
|
716
|
-
var finallyEntry = entry;
|
|
717
|
-
break;
|
|
655
|
+
return !!caught;
|
|
718
656
|
}
|
|
719
|
-
}
|
|
720
657
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
finallyEntry.tryLoc <= arg &&
|
|
725
|
-
arg <= finallyEntry.finallyLoc) {
|
|
726
|
-
// Ignore the finally entry if control is not jumping to a
|
|
727
|
-
// location outside the try/catch block.
|
|
728
|
-
finallyEntry = null;
|
|
729
|
-
}
|
|
658
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
659
|
+
var entry = this.tryEntries[i];
|
|
660
|
+
var record = entry.completion;
|
|
730
661
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
662
|
+
if (entry.tryLoc === "root") {
|
|
663
|
+
// Exception thrown outside of any try block that could handle
|
|
664
|
+
// it, so set the completion value of the entire function to
|
|
665
|
+
// throw the exception.
|
|
666
|
+
return handle("end");
|
|
667
|
+
}
|
|
734
668
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
return ContinueSentinel;
|
|
739
|
-
}
|
|
669
|
+
if (entry.tryLoc <= this.prev) {
|
|
670
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
671
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
740
672
|
|
|
741
|
-
|
|
742
|
-
|
|
673
|
+
if (hasCatch && hasFinally) {
|
|
674
|
+
if (this.prev < entry.catchLoc) {
|
|
675
|
+
return handle(entry.catchLoc, true);
|
|
676
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
677
|
+
return handle(entry.finallyLoc);
|
|
678
|
+
}
|
|
679
|
+
} else if (hasCatch) {
|
|
680
|
+
if (this.prev < entry.catchLoc) {
|
|
681
|
+
return handle(entry.catchLoc, true);
|
|
682
|
+
}
|
|
683
|
+
} else if (hasFinally) {
|
|
684
|
+
if (this.prev < entry.finallyLoc) {
|
|
685
|
+
return handle(entry.finallyLoc);
|
|
686
|
+
}
|
|
687
|
+
} else {
|
|
688
|
+
throw new Error("try statement without catch or finally");
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
abrupt: function abrupt(type, arg) {
|
|
694
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
695
|
+
var entry = this.tryEntries[i];
|
|
743
696
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
697
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
698
|
+
var finallyEntry = entry;
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
748
702
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
this.method = "return";
|
|
755
|
-
this.next = "end";
|
|
756
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
757
|
-
this.next = afterLoc;
|
|
758
|
-
}
|
|
703
|
+
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
704
|
+
// Ignore the finally entry if control is not jumping to a
|
|
705
|
+
// location outside the try/catch block.
|
|
706
|
+
finallyEntry = null;
|
|
707
|
+
}
|
|
759
708
|
|
|
760
|
-
|
|
761
|
-
|
|
709
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
710
|
+
record.type = type;
|
|
711
|
+
record.arg = arg;
|
|
762
712
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
767
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
768
|
-
resetTryEntry(entry);
|
|
713
|
+
if (finallyEntry) {
|
|
714
|
+
this.method = "next";
|
|
715
|
+
this.next = finallyEntry.finallyLoc;
|
|
769
716
|
return ContinueSentinel;
|
|
770
717
|
}
|
|
771
|
-
}
|
|
772
|
-
},
|
|
773
718
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
719
|
+
return this.complete(record);
|
|
720
|
+
},
|
|
721
|
+
complete: function complete(record, afterLoc) {
|
|
722
|
+
if (record.type === "throw") {
|
|
723
|
+
throw record.arg;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
if (record.type === "break" || record.type === "continue") {
|
|
727
|
+
this.next = record.arg;
|
|
728
|
+
} else if (record.type === "return") {
|
|
729
|
+
this.rval = this.arg = record.arg;
|
|
730
|
+
this.method = "return";
|
|
731
|
+
this.next = "end";
|
|
732
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
733
|
+
this.next = afterLoc;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
return ContinueSentinel;
|
|
737
|
+
},
|
|
738
|
+
finish: function finish(finallyLoc) {
|
|
739
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
740
|
+
var entry = this.tryEntries[i];
|
|
741
|
+
|
|
742
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
743
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
781
744
|
resetTryEntry(entry);
|
|
745
|
+
return ContinueSentinel;
|
|
782
746
|
}
|
|
783
|
-
return thrown;
|
|
784
747
|
}
|
|
785
|
-
}
|
|
748
|
+
},
|
|
749
|
+
"catch": function _catch(tryLoc) {
|
|
750
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
751
|
+
var entry = this.tryEntries[i];
|
|
786
752
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
throw new Error("illegal catch attempt");
|
|
790
|
-
},
|
|
753
|
+
if (entry.tryLoc === tryLoc) {
|
|
754
|
+
var record = entry.completion;
|
|
791
755
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
nextLoc: nextLoc
|
|
797
|
-
};
|
|
756
|
+
if (record.type === "throw") {
|
|
757
|
+
var thrown = record.arg;
|
|
758
|
+
resetTryEntry(entry);
|
|
759
|
+
}
|
|
798
760
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
//
|
|
802
|
-
|
|
803
|
-
}
|
|
761
|
+
return thrown;
|
|
762
|
+
}
|
|
763
|
+
} // The context.catch method must only be called with a location
|
|
764
|
+
// argument that corresponds to a known catch block.
|
|
804
765
|
|
|
805
|
-
return ContinueSentinel;
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
766
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
767
|
+
throw new Error("illegal catch attempt");
|
|
768
|
+
},
|
|
769
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
770
|
+
this.delegate = {
|
|
771
|
+
iterator: values(iterable),
|
|
772
|
+
resultName: resultName,
|
|
773
|
+
nextLoc: nextLoc
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
if (this.method === "next") {
|
|
777
|
+
// Deliberately forget the last sent value so that we don't
|
|
778
|
+
// accidentally pass it on to the delegate.
|
|
779
|
+
this.arg = undefined$1;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return ContinueSentinel;
|
|
783
|
+
}
|
|
784
|
+
}; // Regardless of whether this script is executing as a CommonJS module
|
|
785
|
+
// or not, return the runtime object so that we can declare the variable
|
|
786
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
787
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
814
788
|
|
|
815
|
-
|
|
816
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
789
|
+
return exports;
|
|
790
|
+
}( // If this script is executing as a CommonJS module, use module.exports
|
|
817
791
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
818
792
|
// object. Either way, the resulting object will be used to initialize
|
|
819
793
|
// the regeneratorRuntime variable at the top of this file.
|
|
820
|
-
module.exports
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
835
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
836
|
-
if (typeof globalThis === "object") {
|
|
837
|
-
globalThis.regeneratorRuntime = runtime;
|
|
838
|
-
} else {
|
|
794
|
+
module.exports );
|
|
795
|
+
|
|
796
|
+
try {
|
|
797
|
+
regeneratorRuntime = runtime;
|
|
798
|
+
} catch (accidentalStrictMode) {
|
|
799
|
+
// This module should not be running in strict mode, so the above
|
|
800
|
+
// assignment should always work unless something is misconfigured. Just
|
|
801
|
+
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
802
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
803
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
804
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
805
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
806
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
807
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
839
808
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
840
809
|
}
|
|
841
|
-
}
|
|
842
810
|
});
|
|
843
811
|
|
|
844
812
|
function getError(errors, status) {
|