@plasmicpkgs/commerce-swell 0.0.15 → 0.0.18

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.
@@ -89,205 +89,240 @@ function _objectWithoutPropertiesLoose(source, excluded) {
89
89
  return target;
90
90
  }
91
91
 
92
- function createCommonjsModule(fn, module) {
93
- return module = { exports: {} }, fn(module, module.exports), module.exports;
92
+ function _unsupportedIterableToArray(o, minLen) {
93
+ if (!o) return;
94
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
95
+ var n = Object.prototype.toString.call(o).slice(8, -1);
96
+ if (n === "Object" && o.constructor) n = o.constructor.name;
97
+ if (n === "Map" || n === "Set") return Array.from(o);
98
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
94
99
  }
95
100
 
96
- var runtime_1 = createCommonjsModule(function (module) {
97
- /**
98
- * Copyright (c) 2014-present, Facebook, Inc.
99
- *
100
- * This source code is licensed under the MIT license found in the
101
- * LICENSE file in the root directory of this source tree.
102
- */
103
-
104
- var runtime = (function (exports) {
105
-
106
- var Op = Object.prototype;
107
- var hasOwn = Op.hasOwnProperty;
108
- var undefined$1; // More compressible than void 0.
109
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
110
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
111
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
112
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
113
-
114
- function define(obj, key, value) {
115
- Object.defineProperty(obj, key, {
116
- value: value,
117
- enumerable: true,
118
- configurable: true,
119
- writable: true
120
- });
121
- return obj[key];
122
- }
123
- try {
124
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
125
- define({}, "");
126
- } catch (err) {
127
- define = function(obj, key, value) {
128
- return obj[key] = value;
101
+ function _arrayLikeToArray(arr, len) {
102
+ if (len == null || len > arr.length) len = arr.length;
103
+
104
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
105
+
106
+ return arr2;
107
+ }
108
+
109
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
110
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
111
+ if (it) return (it = it.call(o)).next.bind(it);
112
+
113
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
114
+ if (it) o = it;
115
+ var i = 0;
116
+ return function () {
117
+ if (i >= o.length) return {
118
+ done: true
119
+ };
120
+ return {
121
+ done: false,
122
+ value: o[i++]
123
+ };
129
124
  };
130
125
  }
131
126
 
132
- function wrap(innerFn, outerFn, self, tryLocsList) {
133
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
134
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
135
- var generator = Object.create(protoGenerator.prototype);
136
- var context = new Context(tryLocsList || []);
127
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
128
+ }
129
+
130
+ function createCommonjsModule(fn, module) {
131
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
132
+ }
137
133
 
138
- // The ._invoke method unifies the implementations of the .next,
139
- // .throw, and .return methods.
140
- generator._invoke = makeInvokeMethod(innerFn, self, context);
134
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
135
+ /**
136
+ * Copyright (c) 2014-present, Facebook, Inc.
137
+ *
138
+ * This source code is licensed under the MIT license found in the
139
+ * LICENSE file in the root directory of this source tree.
140
+ */
141
+ var runtime = function (exports) {
142
+
143
+ var Op = Object.prototype;
144
+ var hasOwn = Op.hasOwnProperty;
145
+ var undefined$1; // More compressible than void 0.
146
+
147
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
148
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
149
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
150
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
151
+
152
+ function define(obj, key, value) {
153
+ Object.defineProperty(obj, key, {
154
+ value: value,
155
+ enumerable: true,
156
+ configurable: true,
157
+ writable: true
158
+ });
159
+ return obj[key];
160
+ }
141
161
 
142
- return generator;
143
- }
144
- exports.wrap = wrap;
145
-
146
- // Try/catch helper to minimize deoptimizations. Returns a completion
147
- // record like context.tryEntries[i].completion. This interface could
148
- // have been (and was previously) designed to take a closure to be
149
- // invoked without arguments, but in all the cases we care about we
150
- // already have an existing method we want to call, so there's no need
151
- // to create a new function object. We can even get away with assuming
152
- // the method takes exactly one argument, since that happens to be true
153
- // in every case, so we don't have to touch the arguments object. The
154
- // only additional allocation required is the completion record, which
155
- // has a stable shape and so hopefully should be cheap to allocate.
156
- function tryCatch(fn, obj, arg) {
157
162
  try {
158
- return { type: "normal", arg: fn.call(obj, arg) };
163
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
164
+ define({}, "");
159
165
  } catch (err) {
160
- return { type: "throw", arg: err };
166
+ define = function define(obj, key, value) {
167
+ return obj[key] = value;
168
+ };
161
169
  }
162
- }
163
170
 
164
- var GenStateSuspendedStart = "suspendedStart";
165
- var GenStateSuspendedYield = "suspendedYield";
166
- var GenStateExecuting = "executing";
167
- var GenStateCompleted = "completed";
168
-
169
- // Returning this object from the innerFn has the same effect as
170
- // breaking out of the dispatch switch statement.
171
- var ContinueSentinel = {};
172
-
173
- // Dummy constructor functions that we use as the .constructor and
174
- // .constructor.prototype properties for functions that return Generator
175
- // objects. For full spec compliance, you may wish to configure your
176
- // minifier not to mangle the names of these two functions.
177
- function Generator() {}
178
- function GeneratorFunction() {}
179
- function GeneratorFunctionPrototype() {}
180
-
181
- // This is a polyfill for %IteratorPrototype% for environments that
182
- // don't natively support it.
183
- var IteratorPrototype = {};
184
- define(IteratorPrototype, iteratorSymbol, function () {
185
- return this;
186
- });
171
+ function wrap(innerFn, outerFn, self, tryLocsList) {
172
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
173
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
174
+ var generator = Object.create(protoGenerator.prototype);
175
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
176
+ // .throw, and .return methods.
187
177
 
188
- var getProto = Object.getPrototypeOf;
189
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
190
- if (NativeIteratorPrototype &&
191
- NativeIteratorPrototype !== Op &&
192
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
193
- // This environment has a native %IteratorPrototype%; use it instead
194
- // of the polyfill.
195
- IteratorPrototype = NativeIteratorPrototype;
196
- }
178
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
179
+ return generator;
180
+ }
197
181
 
198
- var Gp = GeneratorFunctionPrototype.prototype =
199
- Generator.prototype = Object.create(IteratorPrototype);
200
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
201
- define(Gp, "constructor", GeneratorFunctionPrototype);
202
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
203
- GeneratorFunction.displayName = define(
204
- GeneratorFunctionPrototype,
205
- toStringTagSymbol,
206
- "GeneratorFunction"
207
- );
208
-
209
- // Helper for defining the .next, .throw, and .return methods of the
210
- // Iterator interface in terms of a single ._invoke method.
211
- function defineIteratorMethods(prototype) {
212
- ["next", "throw", "return"].forEach(function(method) {
213
- define(prototype, method, function(arg) {
214
- return this._invoke(method, arg);
215
- });
216
- });
217
- }
182
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
183
+ // record like context.tryEntries[i].completion. This interface could
184
+ // have been (and was previously) designed to take a closure to be
185
+ // invoked without arguments, but in all the cases we care about we
186
+ // already have an existing method we want to call, so there's no need
187
+ // to create a new function object. We can even get away with assuming
188
+ // the method takes exactly one argument, since that happens to be true
189
+ // in every case, so we don't have to touch the arguments object. The
190
+ // only additional allocation required is the completion record, which
191
+ // has a stable shape and so hopefully should be cheap to allocate.
192
+
193
+ function tryCatch(fn, obj, arg) {
194
+ try {
195
+ return {
196
+ type: "normal",
197
+ arg: fn.call(obj, arg)
198
+ };
199
+ } catch (err) {
200
+ return {
201
+ type: "throw",
202
+ arg: err
203
+ };
204
+ }
205
+ }
218
206
 
219
- exports.isGeneratorFunction = function(genFun) {
220
- var ctor = typeof genFun === "function" && genFun.constructor;
221
- return ctor
222
- ? ctor === GeneratorFunction ||
223
- // For the native GeneratorFunction constructor, the best we can
224
- // do is to check its .name property.
225
- (ctor.displayName || ctor.name) === "GeneratorFunction"
226
- : false;
227
- };
207
+ var GenStateSuspendedStart = "suspendedStart";
208
+ var GenStateSuspendedYield = "suspendedYield";
209
+ var GenStateExecuting = "executing";
210
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
211
+ // breaking out of the dispatch switch statement.
212
+
213
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
214
+ // .constructor.prototype properties for functions that return Generator
215
+ // objects. For full spec compliance, you may wish to configure your
216
+ // minifier not to mangle the names of these two functions.
217
+
218
+ function Generator() {}
219
+
220
+ function GeneratorFunction() {}
228
221
 
229
- exports.mark = function(genFun) {
230
- if (Object.setPrototypeOf) {
231
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
232
- } else {
233
- genFun.__proto__ = GeneratorFunctionPrototype;
234
- define(genFun, toStringTagSymbol, "GeneratorFunction");
222
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
223
+ // don't natively support it.
224
+
225
+
226
+ var IteratorPrototype = {};
227
+
228
+ IteratorPrototype[iteratorSymbol] = function () {
229
+ return this;
230
+ };
231
+
232
+ var getProto = Object.getPrototypeOf;
233
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
234
+
235
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
236
+ // This environment has a native %IteratorPrototype%; use it instead
237
+ // of the polyfill.
238
+ IteratorPrototype = NativeIteratorPrototype;
235
239
  }
236
- genFun.prototype = Object.create(Gp);
237
- return genFun;
238
- };
239
240
 
240
- // Within the body of any async function, `await x` is transformed to
241
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
242
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
243
- // meant to be awaited.
244
- exports.awrap = function(arg) {
245
- return { __await: arg };
246
- };
241
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
242
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
243
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
244
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
245
+ // Iterator interface in terms of a single ._invoke method.
247
246
 
248
- function AsyncIterator(generator, PromiseImpl) {
249
- function invoke(method, arg, resolve, reject) {
250
- var record = tryCatch(generator[method], generator, arg);
251
- if (record.type === "throw") {
252
- reject(record.arg);
247
+ function defineIteratorMethods(prototype) {
248
+ ["next", "throw", "return"].forEach(function (method) {
249
+ define(prototype, method, function (arg) {
250
+ return this._invoke(method, arg);
251
+ });
252
+ });
253
+ }
254
+
255
+ exports.isGeneratorFunction = function (genFun) {
256
+ var ctor = typeof genFun === "function" && genFun.constructor;
257
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
258
+ // do is to check its .name property.
259
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
260
+ };
261
+
262
+ exports.mark = function (genFun) {
263
+ if (Object.setPrototypeOf) {
264
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
253
265
  } else {
254
- var result = record.arg;
255
- var value = result.value;
256
- if (value &&
257
- typeof value === "object" &&
258
- hasOwn.call(value, "__await")) {
259
- return PromiseImpl.resolve(value.__await).then(function(value) {
260
- invoke("next", value, resolve, reject);
261
- }, function(err) {
262
- invoke("throw", err, resolve, reject);
266
+ genFun.__proto__ = GeneratorFunctionPrototype;
267
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
268
+ }
269
+
270
+ genFun.prototype = Object.create(Gp);
271
+ return genFun;
272
+ }; // Within the body of any async function, `await x` is transformed to
273
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
274
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
275
+ // meant to be awaited.
276
+
277
+
278
+ exports.awrap = function (arg) {
279
+ return {
280
+ __await: arg
281
+ };
282
+ };
283
+
284
+ function AsyncIterator(generator, PromiseImpl) {
285
+ function invoke(method, arg, resolve, reject) {
286
+ var record = tryCatch(generator[method], generator, arg);
287
+
288
+ if (record.type === "throw") {
289
+ reject(record.arg);
290
+ } else {
291
+ var result = record.arg;
292
+ var value = result.value;
293
+
294
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
295
+ return PromiseImpl.resolve(value.__await).then(function (value) {
296
+ invoke("next", value, resolve, reject);
297
+ }, function (err) {
298
+ invoke("throw", err, resolve, reject);
299
+ });
300
+ }
301
+
302
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
303
+ // When a yielded Promise is resolved, its final value becomes
304
+ // the .value of the Promise<{value,done}> result for the
305
+ // current iteration.
306
+ result.value = unwrapped;
307
+ resolve(result);
308
+ }, function (error) {
309
+ // If a rejected Promise was yielded, throw the rejection back
310
+ // into the async generator function so it can be handled there.
311
+ return invoke("throw", error, resolve, reject);
263
312
  });
264
313
  }
265
-
266
- return PromiseImpl.resolve(value).then(function(unwrapped) {
267
- // When a yielded Promise is resolved, its final value becomes
268
- // the .value of the Promise<{value,done}> result for the
269
- // current iteration.
270
- result.value = unwrapped;
271
- resolve(result);
272
- }, function(error) {
273
- // If a rejected Promise was yielded, throw the rejection back
274
- // into the async generator function so it can be handled there.
275
- return invoke("throw", error, resolve, reject);
276
- });
277
314
  }
278
- }
279
315
 
280
- var previousPromise;
316
+ var previousPromise;
281
317
 
282
- function enqueue(method, arg) {
283
- function callInvokeWithMethodAndArg() {
284
- return new PromiseImpl(function(resolve, reject) {
285
- invoke(method, arg, resolve, reject);
286
- });
287
- }
318
+ function enqueue(method, arg) {
319
+ function callInvokeWithMethodAndArg() {
320
+ return new PromiseImpl(function (resolve, reject) {
321
+ invoke(method, arg, resolve, reject);
322
+ });
323
+ }
288
324
 
289
- return previousPromise =
290
- // If enqueue has been called before, then we want to wait until
325
+ return previousPromise = // If enqueue has been called before, then we want to wait until
291
326
  // all previous Promises have been resolved before calling invoke,
292
327
  // so that results are always delivered in the correct order. If
293
328
  // enqueue has not been called before, then it is important to
@@ -299,554 +334,525 @@ var runtime = (function (exports) {
299
334
  // execute code before the first await. Since we implement simple
300
335
  // async functions in terms of async generators, it is especially
301
336
  // important to get this right, even though it requires care.
302
- previousPromise ? previousPromise.then(
303
- callInvokeWithMethodAndArg,
304
- // Avoid propagating failures to Promises returned by later
305
- // invocations of the iterator.
306
- callInvokeWithMethodAndArg
307
- ) : callInvokeWithMethodAndArg();
337
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
338
+ // invocations of the iterator.
339
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
340
+ } // Define the unified helper method that is used to implement .next,
341
+ // .throw, and .return (see defineIteratorMethods).
342
+
343
+
344
+ this._invoke = enqueue;
308
345
  }
309
346
 
310
- // Define the unified helper method that is used to implement .next,
311
- // .throw, and .return (see defineIteratorMethods).
312
- this._invoke = enqueue;
313
- }
347
+ defineIteratorMethods(AsyncIterator.prototype);
314
348
 
315
- defineIteratorMethods(AsyncIterator.prototype);
316
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
317
- return this;
318
- });
319
- exports.AsyncIterator = AsyncIterator;
320
-
321
- // Note that simple async functions are implemented on top of
322
- // AsyncIterator objects; they just return a Promise for the value of
323
- // the final result produced by the iterator.
324
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
325
- if (PromiseImpl === void 0) PromiseImpl = Promise;
326
-
327
- var iter = new AsyncIterator(
328
- wrap(innerFn, outerFn, self, tryLocsList),
329
- PromiseImpl
330
- );
331
-
332
- return exports.isGeneratorFunction(outerFn)
333
- ? iter // If outerFn is a generator, return the full iterator.
334
- : iter.next().then(function(result) {
335
- return result.done ? result.value : iter.next();
336
- });
337
- };
349
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
350
+ return this;
351
+ };
338
352
 
339
- function makeInvokeMethod(innerFn, self, context) {
340
- var state = GenStateSuspendedStart;
353
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
354
+ // AsyncIterator objects; they just return a Promise for the value of
355
+ // the final result produced by the iterator.
341
356
 
342
- return function invoke(method, arg) {
343
- if (state === GenStateExecuting) {
344
- throw new Error("Generator is already running");
345
- }
357
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
358
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
359
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
360
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
361
+ : iter.next().then(function (result) {
362
+ return result.done ? result.value : iter.next();
363
+ });
364
+ };
346
365
 
347
- if (state === GenStateCompleted) {
348
- if (method === "throw") {
349
- throw arg;
366
+ function makeInvokeMethod(innerFn, self, context) {
367
+ var state = GenStateSuspendedStart;
368
+ return function invoke(method, arg) {
369
+ if (state === GenStateExecuting) {
370
+ throw new Error("Generator is already running");
350
371
  }
351
372
 
352
- // Be forgiving, per 25.3.3.3.3 of the spec:
353
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
354
- return doneResult();
355
- }
373
+ if (state === GenStateCompleted) {
374
+ if (method === "throw") {
375
+ throw arg;
376
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
377
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
356
378
 
357
- context.method = method;
358
- context.arg = arg;
359
379
 
360
- while (true) {
361
- var delegate = context.delegate;
362
- if (delegate) {
363
- var delegateResult = maybeInvokeDelegate(delegate, context);
364
- if (delegateResult) {
365
- if (delegateResult === ContinueSentinel) continue;
366
- return delegateResult;
367
- }
380
+ return doneResult();
368
381
  }
369
382
 
370
- if (context.method === "next") {
371
- // Setting context._sent for legacy support of Babel's
372
- // function.sent implementation.
373
- context.sent = context._sent = context.arg;
383
+ context.method = method;
384
+ context.arg = arg;
374
385
 
375
- } else if (context.method === "throw") {
376
- if (state === GenStateSuspendedStart) {
377
- state = GenStateCompleted;
378
- throw context.arg;
386
+ while (true) {
387
+ var delegate = context.delegate;
388
+
389
+ if (delegate) {
390
+ var delegateResult = maybeInvokeDelegate(delegate, context);
391
+
392
+ if (delegateResult) {
393
+ if (delegateResult === ContinueSentinel) continue;
394
+ return delegateResult;
395
+ }
379
396
  }
380
397
 
381
- context.dispatchException(context.arg);
398
+ if (context.method === "next") {
399
+ // Setting context._sent for legacy support of Babel's
400
+ // function.sent implementation.
401
+ context.sent = context._sent = context.arg;
402
+ } else if (context.method === "throw") {
403
+ if (state === GenStateSuspendedStart) {
404
+ state = GenStateCompleted;
405
+ throw context.arg;
406
+ }
382
407
 
383
- } else if (context.method === "return") {
384
- context.abrupt("return", context.arg);
385
- }
408
+ context.dispatchException(context.arg);
409
+ } else if (context.method === "return") {
410
+ context.abrupt("return", context.arg);
411
+ }
386
412
 
387
- state = GenStateExecuting;
413
+ state = GenStateExecuting;
414
+ var record = tryCatch(innerFn, self, context);
388
415
 
389
- var record = tryCatch(innerFn, self, context);
390
- if (record.type === "normal") {
391
- // If an exception is thrown from innerFn, we leave state ===
392
- // GenStateExecuting and loop back for another invocation.
393
- state = context.done
394
- ? GenStateCompleted
395
- : GenStateSuspendedYield;
416
+ if (record.type === "normal") {
417
+ // If an exception is thrown from innerFn, we leave state ===
418
+ // GenStateExecuting and loop back for another invocation.
419
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
396
420
 
397
- if (record.arg === ContinueSentinel) {
398
- continue;
399
- }
421
+ if (record.arg === ContinueSentinel) {
422
+ continue;
423
+ }
400
424
 
401
- return {
402
- value: record.arg,
403
- done: context.done
404
- };
425
+ return {
426
+ value: record.arg,
427
+ done: context.done
428
+ };
429
+ } else if (record.type === "throw") {
430
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
431
+ // context.dispatchException(context.arg) call above.
432
+
433
+ context.method = "throw";
434
+ context.arg = record.arg;
435
+ }
436
+ }
437
+ };
438
+ } // Call delegate.iterator[context.method](context.arg) and handle the
439
+ // result, either by returning a { value, done } result from the
440
+ // delegate iterator, or by modifying context.method and context.arg,
441
+ // setting context.delegate to null, and returning the ContinueSentinel.
442
+
443
+
444
+ function maybeInvokeDelegate(delegate, context) {
445
+ var method = delegate.iterator[context.method];
446
+
447
+ if (method === undefined$1) {
448
+ // A .throw or .return when the delegate iterator has no .throw
449
+ // method always terminates the yield* loop.
450
+ context.delegate = null;
451
+
452
+ if (context.method === "throw") {
453
+ // Note: ["return"] must be used for ES3 parsing compatibility.
454
+ if (delegate.iterator["return"]) {
455
+ // If the delegate iterator has a return method, give it a
456
+ // chance to clean up.
457
+ context.method = "return";
458
+ context.arg = undefined$1;
459
+ maybeInvokeDelegate(delegate, context);
460
+
461
+ if (context.method === "throw") {
462
+ // If maybeInvokeDelegate(context) changed context.method from
463
+ // "return" to "throw", let that override the TypeError below.
464
+ return ContinueSentinel;
465
+ }
466
+ }
405
467
 
406
- } else if (record.type === "throw") {
407
- state = GenStateCompleted;
408
- // Dispatch the exception by looping back around to the
409
- // context.dispatchException(context.arg) call above.
410
468
  context.method = "throw";
411
- context.arg = record.arg;
469
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
412
470
  }
471
+
472
+ return ContinueSentinel;
413
473
  }
414
- };
415
- }
416
474
 
417
- // Call delegate.iterator[context.method](context.arg) and handle the
418
- // result, either by returning a { value, done } result from the
419
- // delegate iterator, or by modifying context.method and context.arg,
420
- // setting context.delegate to null, and returning the ContinueSentinel.
421
- function maybeInvokeDelegate(delegate, context) {
422
- var method = delegate.iterator[context.method];
423
- if (method === undefined$1) {
424
- // A .throw or .return when the delegate iterator has no .throw
425
- // method always terminates the yield* loop.
426
- context.delegate = null;
475
+ var record = tryCatch(method, delegate.iterator, context.arg);
427
476
 
428
- if (context.method === "throw") {
429
- // Note: ["return"] must be used for ES3 parsing compatibility.
430
- if (delegate.iterator["return"]) {
431
- // If the delegate iterator has a return method, give it a
432
- // chance to clean up.
433
- context.method = "return";
434
- context.arg = undefined$1;
435
- maybeInvokeDelegate(delegate, context);
477
+ if (record.type === "throw") {
478
+ context.method = "throw";
479
+ context.arg = record.arg;
480
+ context.delegate = null;
481
+ return ContinueSentinel;
482
+ }
436
483
 
437
- if (context.method === "throw") {
438
- // If maybeInvokeDelegate(context) changed context.method from
439
- // "return" to "throw", let that override the TypeError below.
440
- return ContinueSentinel;
441
- }
442
- }
484
+ var info = record.arg;
443
485
 
486
+ if (!info) {
444
487
  context.method = "throw";
445
- context.arg = new TypeError(
446
- "The iterator does not provide a 'throw' method");
488
+ context.arg = new TypeError("iterator result is not an object");
489
+ context.delegate = null;
490
+ return ContinueSentinel;
447
491
  }
448
492
 
449
- return ContinueSentinel;
450
- }
493
+ if (info.done) {
494
+ // Assign the result of the finished delegate to the temporary
495
+ // variable specified by delegate.resultName (see delegateYield).
496
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
451
497
 
452
- var record = tryCatch(method, delegate.iterator, context.arg);
498
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
499
+ // exception, let the outer generator proceed normally. If
500
+ // context.method was "next", forget context.arg since it has been
501
+ // "consumed" by the delegate iterator. If context.method was
502
+ // "return", allow the original .return call to continue in the
503
+ // outer generator.
453
504
 
454
- if (record.type === "throw") {
455
- context.method = "throw";
456
- context.arg = record.arg;
457
- context.delegate = null;
458
- return ContinueSentinel;
459
- }
505
+ if (context.method !== "return") {
506
+ context.method = "next";
507
+ context.arg = undefined$1;
508
+ }
509
+ } else {
510
+ // Re-yield the result returned by the delegate method.
511
+ return info;
512
+ } // The delegate iterator is finished, so forget it and continue with
513
+ // the outer generator.
460
514
 
461
- var info = record.arg;
462
515
 
463
- if (! info) {
464
- context.method = "throw";
465
- context.arg = new TypeError("iterator result is not an object");
466
516
  context.delegate = null;
467
517
  return ContinueSentinel;
468
- }
469
-
470
- if (info.done) {
471
- // Assign the result of the finished delegate to the temporary
472
- // variable specified by delegate.resultName (see delegateYield).
473
- context[delegate.resultName] = info.value;
474
-
475
- // Resume execution at the desired location (see delegateYield).
476
- context.next = delegate.nextLoc;
477
-
478
- // If context.method was "throw" but the delegate handled the
479
- // exception, let the outer generator proceed normally. If
480
- // context.method was "next", forget context.arg since it has been
481
- // "consumed" by the delegate iterator. If context.method was
482
- // "return", allow the original .return call to continue in the
483
- // outer generator.
484
- if (context.method !== "return") {
485
- context.method = "next";
486
- context.arg = undefined$1;
487
- }
518
+ } // Define Generator.prototype.{next,throw,return} in terms of the
519
+ // unified ._invoke helper method.
488
520
 
489
- } else {
490
- // Re-yield the result returned by the delegate method.
491
- return info;
492
- }
493
521
 
494
- // The delegate iterator is finished, so forget it and continue with
495
- // the outer generator.
496
- context.delegate = null;
497
- return ContinueSentinel;
498
- }
522
+ defineIteratorMethods(Gp);
523
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
524
+ // @@iterator function is called on it. Some browsers' implementations of the
525
+ // iterator prototype chain incorrectly implement this, causing the Generator
526
+ // object to not be returned from this call. This ensures that doesn't happen.
527
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
499
528
 
500
- // Define Generator.prototype.{next,throw,return} in terms of the
501
- // unified ._invoke helper method.
502
- defineIteratorMethods(Gp);
529
+ Gp[iteratorSymbol] = function () {
530
+ return this;
531
+ };
503
532
 
504
- define(Gp, toStringTagSymbol, "Generator");
533
+ Gp.toString = function () {
534
+ return "[object Generator]";
535
+ };
505
536
 
506
- // A Generator should always return itself as the iterator object when the
507
- // @@iterator function is called on it. Some browsers' implementations of the
508
- // iterator prototype chain incorrectly implement this, causing the Generator
509
- // object to not be returned from this call. This ensures that doesn't happen.
510
- // See https://github.com/facebook/regenerator/issues/274 for more details.
511
- define(Gp, iteratorSymbol, function() {
512
- return this;
513
- });
537
+ function pushTryEntry(locs) {
538
+ var entry = {
539
+ tryLoc: locs[0]
540
+ };
514
541
 
515
- define(Gp, "toString", function() {
516
- return "[object Generator]";
517
- });
542
+ if (1 in locs) {
543
+ entry.catchLoc = locs[1];
544
+ }
518
545
 
519
- function pushTryEntry(locs) {
520
- var entry = { tryLoc: locs[0] };
546
+ if (2 in locs) {
547
+ entry.finallyLoc = locs[2];
548
+ entry.afterLoc = locs[3];
549
+ }
521
550
 
522
- if (1 in locs) {
523
- entry.catchLoc = locs[1];
551
+ this.tryEntries.push(entry);
524
552
  }
525
553
 
526
- if (2 in locs) {
527
- entry.finallyLoc = locs[2];
528
- entry.afterLoc = locs[3];
554
+ function resetTryEntry(entry) {
555
+ var record = entry.completion || {};
556
+ record.type = "normal";
557
+ delete record.arg;
558
+ entry.completion = record;
529
559
  }
530
560
 
531
- this.tryEntries.push(entry);
532
- }
533
-
534
- function resetTryEntry(entry) {
535
- var record = entry.completion || {};
536
- record.type = "normal";
537
- delete record.arg;
538
- entry.completion = record;
539
- }
540
-
541
- function Context(tryLocsList) {
542
- // The root entry object (effectively a try statement without a catch
543
- // or a finally block) gives us a place to store values thrown from
544
- // locations where there is no enclosing try statement.
545
- this.tryEntries = [{ tryLoc: "root" }];
546
- tryLocsList.forEach(pushTryEntry, this);
547
- this.reset(true);
548
- }
549
-
550
- exports.keys = function(object) {
551
- var keys = [];
552
- for (var key in object) {
553
- keys.push(key);
561
+ function Context(tryLocsList) {
562
+ // The root entry object (effectively a try statement without a catch
563
+ // or a finally block) gives us a place to store values thrown from
564
+ // locations where there is no enclosing try statement.
565
+ this.tryEntries = [{
566
+ tryLoc: "root"
567
+ }];
568
+ tryLocsList.forEach(pushTryEntry, this);
569
+ this.reset(true);
554
570
  }
555
- keys.reverse();
556
-
557
- // Rather than returning an object with a next method, we keep
558
- // things simple and return the next function itself.
559
- return function next() {
560
- while (keys.length) {
561
- var key = keys.pop();
562
- if (key in object) {
563
- next.value = key;
564
- next.done = false;
565
- return next;
566
- }
567
- }
568
571
 
569
- // To avoid creating an additional object, we just hang the .value
570
- // and .done properties off the next function object itself. This
571
- // also ensures that the minifier will not anonymize the function.
572
- next.done = true;
573
- return next;
574
- };
575
- };
572
+ exports.keys = function (object) {
573
+ var keys = [];
576
574
 
577
- function values(iterable) {
578
- if (iterable) {
579
- var iteratorMethod = iterable[iteratorSymbol];
580
- if (iteratorMethod) {
581
- return iteratorMethod.call(iterable);
575
+ for (var key in object) {
576
+ keys.push(key);
582
577
  }
583
578
 
584
- if (typeof iterable.next === "function") {
585
- return iterable;
586
- }
579
+ keys.reverse(); // Rather than returning an object with a next method, we keep
580
+ // things simple and return the next function itself.
587
581
 
588
- if (!isNaN(iterable.length)) {
589
- var i = -1, next = function next() {
590
- while (++i < iterable.length) {
591
- if (hasOwn.call(iterable, i)) {
592
- next.value = iterable[i];
593
- next.done = false;
594
- return next;
595
- }
596
- }
582
+ return function next() {
583
+ while (keys.length) {
584
+ var key = keys.pop();
597
585
 
598
- next.value = undefined$1;
599
- next.done = true;
586
+ if (key in object) {
587
+ next.value = key;
588
+ next.done = false;
589
+ return next;
590
+ }
591
+ } // To avoid creating an additional object, we just hang the .value
592
+ // and .done properties off the next function object itself. This
593
+ // also ensures that the minifier will not anonymize the function.
600
594
 
601
- return next;
602
- };
603
595
 
604
- return next.next = next;
605
- }
606
- }
596
+ next.done = true;
597
+ return next;
598
+ };
599
+ };
607
600
 
608
- // Return an iterator with no values.
609
- return { next: doneResult };
610
- }
611
- exports.values = values;
601
+ function values(iterable) {
602
+ if (iterable) {
603
+ var iteratorMethod = iterable[iteratorSymbol];
612
604
 
613
- function doneResult() {
614
- return { value: undefined$1, done: true };
615
- }
605
+ if (iteratorMethod) {
606
+ return iteratorMethod.call(iterable);
607
+ }
616
608
 
617
- Context.prototype = {
618
- constructor: Context,
619
-
620
- reset: function(skipTempReset) {
621
- this.prev = 0;
622
- this.next = 0;
623
- // Resetting context._sent for legacy support of Babel's
624
- // function.sent implementation.
625
- this.sent = this._sent = undefined$1;
626
- this.done = false;
627
- this.delegate = null;
628
-
629
- this.method = "next";
630
- this.arg = undefined$1;
631
-
632
- this.tryEntries.forEach(resetTryEntry);
633
-
634
- if (!skipTempReset) {
635
- for (var name in this) {
636
- // Not sure about the optimal order of these conditions:
637
- if (name.charAt(0) === "t" &&
638
- hasOwn.call(this, name) &&
639
- !isNaN(+name.slice(1))) {
640
- this[name] = undefined$1;
641
- }
609
+ if (typeof iterable.next === "function") {
610
+ return iterable;
642
611
  }
643
- }
644
- },
645
612
 
646
- stop: function() {
647
- this.done = true;
613
+ if (!isNaN(iterable.length)) {
614
+ var i = -1,
615
+ next = function next() {
616
+ while (++i < iterable.length) {
617
+ if (hasOwn.call(iterable, i)) {
618
+ next.value = iterable[i];
619
+ next.done = false;
620
+ return next;
621
+ }
622
+ }
648
623
 
649
- var rootEntry = this.tryEntries[0];
650
- var rootRecord = rootEntry.completion;
651
- if (rootRecord.type === "throw") {
652
- throw rootRecord.arg;
653
- }
624
+ next.value = undefined$1;
625
+ next.done = true;
626
+ return next;
627
+ };
654
628
 
655
- return this.rval;
656
- },
629
+ return next.next = next;
630
+ }
631
+ } // Return an iterator with no values.
657
632
 
658
- dispatchException: function(exception) {
659
- if (this.done) {
660
- throw exception;
661
- }
662
633
 
663
- var context = this;
664
- function handle(loc, caught) {
665
- record.type = "throw";
666
- record.arg = exception;
667
- context.next = loc;
634
+ return {
635
+ next: doneResult
636
+ };
637
+ }
668
638
 
669
- if (caught) {
670
- // If the dispatched exception was caught by a catch block,
671
- // then let that catch block handle the exception normally.
672
- context.method = "next";
673
- context.arg = undefined$1;
674
- }
639
+ exports.values = values;
675
640
 
676
- return !! caught;
677
- }
641
+ function doneResult() {
642
+ return {
643
+ value: undefined$1,
644
+ done: true
645
+ };
646
+ }
647
+
648
+ Context.prototype = {
649
+ constructor: Context,
650
+ reset: function reset(skipTempReset) {
651
+ this.prev = 0;
652
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
653
+ // function.sent implementation.
678
654
 
679
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
680
- var entry = this.tryEntries[i];
681
- var record = entry.completion;
655
+ this.sent = this._sent = undefined$1;
656
+ this.done = false;
657
+ this.delegate = null;
658
+ this.method = "next";
659
+ this.arg = undefined$1;
660
+ this.tryEntries.forEach(resetTryEntry);
682
661
 
683
- if (entry.tryLoc === "root") {
684
- // Exception thrown outside of any try block that could handle
685
- // it, so set the completion value of the entire function to
686
- // throw the exception.
687
- return handle("end");
662
+ if (!skipTempReset) {
663
+ for (var name in this) {
664
+ // Not sure about the optimal order of these conditions:
665
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
666
+ this[name] = undefined$1;
667
+ }
668
+ }
688
669
  }
670
+ },
671
+ stop: function stop() {
672
+ this.done = true;
673
+ var rootEntry = this.tryEntries[0];
674
+ var rootRecord = rootEntry.completion;
689
675
 
690
- if (entry.tryLoc <= this.prev) {
691
- var hasCatch = hasOwn.call(entry, "catchLoc");
692
- var hasFinally = hasOwn.call(entry, "finallyLoc");
676
+ if (rootRecord.type === "throw") {
677
+ throw rootRecord.arg;
678
+ }
693
679
 
694
- if (hasCatch && hasFinally) {
695
- if (this.prev < entry.catchLoc) {
696
- return handle(entry.catchLoc, true);
697
- } else if (this.prev < entry.finallyLoc) {
698
- return handle(entry.finallyLoc);
699
- }
680
+ return this.rval;
681
+ },
682
+ dispatchException: function dispatchException(exception) {
683
+ if (this.done) {
684
+ throw exception;
685
+ }
700
686
 
701
- } else if (hasCatch) {
702
- if (this.prev < entry.catchLoc) {
703
- return handle(entry.catchLoc, true);
704
- }
687
+ var context = this;
705
688
 
706
- } else if (hasFinally) {
707
- if (this.prev < entry.finallyLoc) {
708
- return handle(entry.finallyLoc);
709
- }
689
+ function handle(loc, caught) {
690
+ record.type = "throw";
691
+ record.arg = exception;
692
+ context.next = loc;
710
693
 
711
- } else {
712
- throw new Error("try statement without catch or finally");
694
+ if (caught) {
695
+ // If the dispatched exception was caught by a catch block,
696
+ // then let that catch block handle the exception normally.
697
+ context.method = "next";
698
+ context.arg = undefined$1;
713
699
  }
714
- }
715
- }
716
- },
717
700
 
718
- abrupt: function(type, arg) {
719
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
720
- var entry = this.tryEntries[i];
721
- if (entry.tryLoc <= this.prev &&
722
- hasOwn.call(entry, "finallyLoc") &&
723
- this.prev < entry.finallyLoc) {
724
- var finallyEntry = entry;
725
- break;
701
+ return !!caught;
726
702
  }
727
- }
728
703
 
729
- if (finallyEntry &&
730
- (type === "break" ||
731
- type === "continue") &&
732
- finallyEntry.tryLoc <= arg &&
733
- arg <= finallyEntry.finallyLoc) {
734
- // Ignore the finally entry if control is not jumping to a
735
- // location outside the try/catch block.
736
- finallyEntry = null;
737
- }
704
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
705
+ var entry = this.tryEntries[i];
706
+ var record = entry.completion;
738
707
 
739
- var record = finallyEntry ? finallyEntry.completion : {};
740
- record.type = type;
741
- record.arg = arg;
708
+ if (entry.tryLoc === "root") {
709
+ // Exception thrown outside of any try block that could handle
710
+ // it, so set the completion value of the entire function to
711
+ // throw the exception.
712
+ return handle("end");
713
+ }
742
714
 
743
- if (finallyEntry) {
744
- this.method = "next";
745
- this.next = finallyEntry.finallyLoc;
746
- return ContinueSentinel;
747
- }
715
+ if (entry.tryLoc <= this.prev) {
716
+ var hasCatch = hasOwn.call(entry, "catchLoc");
717
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
748
718
 
749
- return this.complete(record);
750
- },
719
+ if (hasCatch && hasFinally) {
720
+ if (this.prev < entry.catchLoc) {
721
+ return handle(entry.catchLoc, true);
722
+ } else if (this.prev < entry.finallyLoc) {
723
+ return handle(entry.finallyLoc);
724
+ }
725
+ } else if (hasCatch) {
726
+ if (this.prev < entry.catchLoc) {
727
+ return handle(entry.catchLoc, true);
728
+ }
729
+ } else if (hasFinally) {
730
+ if (this.prev < entry.finallyLoc) {
731
+ return handle(entry.finallyLoc);
732
+ }
733
+ } else {
734
+ throw new Error("try statement without catch or finally");
735
+ }
736
+ }
737
+ }
738
+ },
739
+ abrupt: function abrupt(type, arg) {
740
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
741
+ var entry = this.tryEntries[i];
751
742
 
752
- complete: function(record, afterLoc) {
753
- if (record.type === "throw") {
754
- throw record.arg;
755
- }
743
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
744
+ var finallyEntry = entry;
745
+ break;
746
+ }
747
+ }
756
748
 
757
- if (record.type === "break" ||
758
- record.type === "continue") {
759
- this.next = record.arg;
760
- } else if (record.type === "return") {
761
- this.rval = this.arg = record.arg;
762
- this.method = "return";
763
- this.next = "end";
764
- } else if (record.type === "normal" && afterLoc) {
765
- this.next = afterLoc;
766
- }
749
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
750
+ // Ignore the finally entry if control is not jumping to a
751
+ // location outside the try/catch block.
752
+ finallyEntry = null;
753
+ }
767
754
 
768
- return ContinueSentinel;
769
- },
755
+ var record = finallyEntry ? finallyEntry.completion : {};
756
+ record.type = type;
757
+ record.arg = arg;
770
758
 
771
- finish: function(finallyLoc) {
772
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
773
- var entry = this.tryEntries[i];
774
- if (entry.finallyLoc === finallyLoc) {
775
- this.complete(entry.completion, entry.afterLoc);
776
- resetTryEntry(entry);
759
+ if (finallyEntry) {
760
+ this.method = "next";
761
+ this.next = finallyEntry.finallyLoc;
777
762
  return ContinueSentinel;
778
763
  }
779
- }
780
- },
781
764
 
782
- "catch": function(tryLoc) {
783
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
784
- var entry = this.tryEntries[i];
785
- if (entry.tryLoc === tryLoc) {
786
- var record = entry.completion;
787
- if (record.type === "throw") {
788
- var thrown = record.arg;
765
+ return this.complete(record);
766
+ },
767
+ complete: function complete(record, afterLoc) {
768
+ if (record.type === "throw") {
769
+ throw record.arg;
770
+ }
771
+
772
+ if (record.type === "break" || record.type === "continue") {
773
+ this.next = record.arg;
774
+ } else if (record.type === "return") {
775
+ this.rval = this.arg = record.arg;
776
+ this.method = "return";
777
+ this.next = "end";
778
+ } else if (record.type === "normal" && afterLoc) {
779
+ this.next = afterLoc;
780
+ }
781
+
782
+ return ContinueSentinel;
783
+ },
784
+ finish: function finish(finallyLoc) {
785
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
786
+ var entry = this.tryEntries[i];
787
+
788
+ if (entry.finallyLoc === finallyLoc) {
789
+ this.complete(entry.completion, entry.afterLoc);
789
790
  resetTryEntry(entry);
791
+ return ContinueSentinel;
790
792
  }
791
- return thrown;
792
793
  }
793
- }
794
+ },
795
+ "catch": function _catch(tryLoc) {
796
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
797
+ var entry = this.tryEntries[i];
794
798
 
795
- // The context.catch method must only be called with a location
796
- // argument that corresponds to a known catch block.
797
- throw new Error("illegal catch attempt");
798
- },
799
+ if (entry.tryLoc === tryLoc) {
800
+ var record = entry.completion;
799
801
 
800
- delegateYield: function(iterable, resultName, nextLoc) {
801
- this.delegate = {
802
- iterator: values(iterable),
803
- resultName: resultName,
804
- nextLoc: nextLoc
805
- };
802
+ if (record.type === "throw") {
803
+ var thrown = record.arg;
804
+ resetTryEntry(entry);
805
+ }
806
806
 
807
- if (this.method === "next") {
808
- // Deliberately forget the last sent value so that we don't
809
- // accidentally pass it on to the delegate.
810
- this.arg = undefined$1;
811
- }
807
+ return thrown;
808
+ }
809
+ } // The context.catch method must only be called with a location
810
+ // argument that corresponds to a known catch block.
812
811
 
813
- return ContinueSentinel;
814
- }
815
- };
816
812
 
817
- // Regardless of whether this script is executing as a CommonJS module
818
- // or not, return the runtime object so that we can declare the variable
819
- // regeneratorRuntime in the outer scope, which allows this module to be
820
- // injected easily by `bin/regenerator --include-runtime script.js`.
821
- return exports;
813
+ throw new Error("illegal catch attempt");
814
+ },
815
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
816
+ this.delegate = {
817
+ iterator: values(iterable),
818
+ resultName: resultName,
819
+ nextLoc: nextLoc
820
+ };
821
+
822
+ if (this.method === "next") {
823
+ // Deliberately forget the last sent value so that we don't
824
+ // accidentally pass it on to the delegate.
825
+ this.arg = undefined$1;
826
+ }
822
827
 
823
- }(
824
- // If this script is executing as a CommonJS module, use module.exports
828
+ return ContinueSentinel;
829
+ }
830
+ }; // Regardless of whether this script is executing as a CommonJS module
831
+ // or not, return the runtime object so that we can declare the variable
832
+ // regeneratorRuntime in the outer scope, which allows this module to be
833
+ // injected easily by `bin/regenerator --include-runtime script.js`.
834
+
835
+ return exports;
836
+ }( // If this script is executing as a CommonJS module, use module.exports
825
837
  // as the regeneratorRuntime namespace. Otherwise create a new empty
826
838
  // object. Either way, the resulting object will be used to initialize
827
839
  // the regeneratorRuntime variable at the top of this file.
828
- module.exports
829
- ));
830
-
831
- try {
832
- regeneratorRuntime = runtime;
833
- } catch (accidentalStrictMode) {
834
- // This module should not be running in strict mode, so the above
835
- // assignment should always work unless something is misconfigured. Just
836
- // in case runtime.js accidentally runs in strict mode, in modern engines
837
- // we can explicitly access globalThis. In older engines we can escape
838
- // strict mode using a global Function call. This could conceivably fail
839
- // if a Content Security Policy forbids using Function, but in that case
840
- // the proper solution is to fix the accidental strict mode problem. If
841
- // you've misconfigured your bundler to force strict mode and applied a
842
- // CSP to forbid Function, and you're not willing to fix either of those
843
- // problems, please detail your unique predicament in a GitHub issue.
844
- if (typeof globalThis === "object") {
845
- globalThis.regeneratorRuntime = runtime;
846
- } else {
840
+ module.exports );
841
+
842
+ try {
843
+ regeneratorRuntime = runtime;
844
+ } catch (accidentalStrictMode) {
845
+ // This module should not be running in strict mode, so the above
846
+ // assignment should always work unless something is misconfigured. Just
847
+ // in case runtime.js accidentally runs in strict mode, we can escape
848
+ // strict mode using a global Function call. This could conceivably fail
849
+ // if a Content Security Policy forbids using Function, but in that case
850
+ // the proper solution is to fix the accidental strict mode problem. If
851
+ // you've misconfigured your bundler to force strict mode and applied a
852
+ // CSP to forbid Function, and you're not willing to fix either of those
853
+ // problems, please detail your unique predicament in a GitHub issue.
847
854
  Function("r", "regeneratorRuntime = r")(runtime);
848
855
  }
849
- }
850
856
  });
851
857
 
852
858
  var _excluded = ["file"];
@@ -1051,12 +1057,20 @@ function normalizeLineItem(_ref6) {
1051
1057
  return item;
1052
1058
  }
1053
1059
 
1060
+ function normalizeChildren(children) {
1061
+ return children == null ? void 0 : children.results.map(function (ch) {
1062
+ return ch.id;
1063
+ });
1064
+ }
1054
1065
  function normalizeCategory(_ref7) {
1055
1066
  var id = _ref7.id,
1056
1067
  name = _ref7.name,
1057
1068
  slug = _ref7.slug,
1058
1069
  products = _ref7.products,
1059
- images = _ref7.images;
1070
+ images = _ref7.images,
1071
+ depth = _ref7.depth,
1072
+ children = _ref7.children,
1073
+ parent_id = _ref7.parent_id;
1060
1074
  return {
1061
1075
  id: id,
1062
1076
  name: name,
@@ -1067,7 +1081,10 @@ function normalizeCategory(_ref7) {
1067
1081
  return {
1068
1082
  url: image.file.url
1069
1083
  };
1070
- })
1084
+ }),
1085
+ depth: depth,
1086
+ children: normalizeChildren(children),
1087
+ parentId: parent_id
1071
1088
  };
1072
1089
  }
1073
1090
 
@@ -1573,22 +1590,22 @@ var walkCategoryTree = function walkCategoryTree(category, categories) {
1573
1590
  var result = [];
1574
1591
 
1575
1592
  while (queue.length > 0) {
1576
- var _curr$children$result, _curr$children;
1593
+ var _curr$children$map, _curr$children;
1577
1594
 
1578
1595
  var curr = ensure(queue.shift());
1579
1596
  result.push(curr);
1580
- queue.push.apply(queue, (_curr$children$result = (_curr$children = curr.children) == null ? void 0 : _curr$children.results.map(function (child) {
1597
+ queue.push.apply(queue, (_curr$children$map = (_curr$children = curr.children) == null ? void 0 : _curr$children.map(function (child) {
1581
1598
  return ensure(categories.find(function (category) {
1582
- return category.id === child.id;
1599
+ return category.id === child;
1583
1600
  }));
1584
- })) != null ? _curr$children$result : []);
1601
+ })) != null ? _curr$children$map : []);
1585
1602
  }
1586
1603
 
1587
1604
  return result;
1588
1605
  };
1589
1606
  var topologicalSortForCategoryTree = function topologicalSortForCategoryTree(categories) {
1590
1607
  return categories.filter(function (category) {
1591
- return !category.parent_id;
1608
+ return !category.parentId;
1592
1609
  }).flatMap(function (category) {
1593
1610
  return walkCategoryTree(category, categories);
1594
1611
  });
@@ -1791,26 +1808,27 @@ var handler$5 = {
1791
1808
 
1792
1809
  var handler$6 = {
1793
1810
  fetchOptions: {
1794
- query: 'categories',
1795
- method: 'get'
1811
+ query: "categories",
1812
+ method: "get"
1796
1813
  },
1797
1814
  fetcher: function fetcher(_ref) {
1798
1815
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1799
1816
  var _data$results;
1800
1817
 
1801
- var input, options, fetch, topologicalSort, addIsEmptyField, categoryId, data, categories;
1818
+ var input, options, fetch, addIsEmptyField, categoryId, data, categories, normalizedCategories, _loop, _iterator, _step;
1819
+
1802
1820
  return runtime_1.wrap(function _callee2$(_context2) {
1803
1821
  while (1) {
1804
1822
  switch (_context2.prev = _context2.next) {
1805
1823
  case 0:
1806
1824
  input = _ref.input, options = _ref.options, fetch = _ref.fetch;
1807
- topologicalSort = input.topologicalSort, addIsEmptyField = input.addIsEmptyField, categoryId = input.categoryId;
1825
+ addIsEmptyField = input.addIsEmptyField, categoryId = input.categoryId;
1808
1826
  _context2.next = 4;
1809
1827
  return fetch({
1810
1828
  query: options.query,
1811
1829
  method: options.method,
1812
1830
  variables: {
1813
- expand: [].concat(topologicalSort ? ["children", "parent_id"] : []),
1831
+ expand: ["children", "parent_id"],
1814
1832
  id: categoryId
1815
1833
  }
1816
1834
  });
@@ -1836,8 +1854,8 @@ var handler$6 = {
1836
1854
  _context.t2 = category;
1837
1855
  _context.next = 5;
1838
1856
  return fetch({
1839
- query: 'products',
1840
- method: 'list',
1857
+ query: "products",
1858
+ method: "list",
1841
1859
  variables: {
1842
1860
  limit: 1,
1843
1861
  category: category.id
@@ -1868,11 +1886,24 @@ var handler$6 = {
1868
1886
  categories = _context2.sent;
1869
1887
 
1870
1888
  case 10:
1871
- return _context2.abrupt("return", (topologicalSort ? topologicalSortForCategoryTree(categories) : categories).map(function (category) {
1872
- return normalizeCategory(category);
1873
- }));
1889
+ normalizedCategories = topologicalSortForCategoryTree(categories.map(normalizeCategory));
1890
+
1891
+ _loop = function _loop() {
1892
+ var _normalizedCategories, _normalizedCategories2;
1893
+
1894
+ var category = _step.value;
1895
+ category.depth = ((_normalizedCategories = (_normalizedCategories2 = normalizedCategories.find(function (c) {
1896
+ return c.id === category.parentId;
1897
+ })) == null ? void 0 : _normalizedCategories2.depth) != null ? _normalizedCategories : -1) + 1;
1898
+ };
1874
1899
 
1875
- case 11:
1900
+ for (_iterator = _createForOfIteratorHelperLoose(normalizedCategories); !(_step = _iterator()).done;) {
1901
+ _loop();
1902
+ }
1903
+
1904
+ return _context2.abrupt("return", normalizedCategories);
1905
+
1906
+ case 14:
1876
1907
  case "end":
1877
1908
  return _context2.stop();
1878
1909
  }
@@ -1884,7 +1915,7 @@ var handler$6 = {
1884
1915
  var useData = _ref3.useData;
1885
1916
  return function (input) {
1886
1917
  var response = useData({
1887
- input: [["topologicalSort", input == null ? void 0 : input.topologicalSort], ["addIsEmptyField", input == null ? void 0 : input.addIsEmptyField], ["categoryId", input == null ? void 0 : input.categoryId]],
1918
+ input: [["addIsEmptyField", input == null ? void 0 : input.addIsEmptyField], ["categoryId", input == null ? void 0 : input.categoryId]],
1888
1919
  swrOptions: _extends({
1889
1920
  revalidateOnFocus: false
1890
1921
  }, input == null ? void 0 : input.swrOptions)
@@ -1907,8 +1938,8 @@ var handler$6 = {
1907
1938
 
1908
1939
  var handler$7 = {
1909
1940
  fetchOptions: {
1910
- query: 'attributes',
1911
- method: 'get'
1941
+ query: "attributes",
1942
+ method: "get"
1912
1943
  },
1913
1944
  fetcher: function fetcher(_ref) {
1914
1945
  return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
@@ -1922,9 +1953,9 @@ var handler$7 = {
1922
1953
  fetch = _ref.fetch;
1923
1954
  _context.next = 3;
1924
1955
  return fetch({
1925
- query: 'attributes',
1926
- method: 'get',
1927
- variables: 'brand'
1956
+ query: "attributes",
1957
+ method: "get",
1958
+ variables: "brand"
1928
1959
  });
1929
1960
 
1930
1961
  case 3:
@@ -1959,7 +1990,6 @@ var handler$7 = {
1959
1990
 
1960
1991
  case 15:
1961
1992
  vendors = _context.t3;
1962
- console.log("dale", "useBrands", vendors);
1963
1993
  return _context.abrupt("return", Array.from(new Set(vendors).values()).map(function (v) {
1964
1994
  return {
1965
1995
  entityId: v,
@@ -1968,7 +1998,7 @@ var handler$7 = {
1968
1998
  };
1969
1999
  }));
1970
2000
 
1971
- case 18:
2001
+ case 17:
1972
2002
  case "end":
1973
2003
  return _context.stop();
1974
2004
  }
@@ -2129,10 +2159,16 @@ var commerceProviderMeta = {
2129
2159
  name: "plasmic-commerce-swell-provider",
2130
2160
  displayName: "Swell Provider",
2131
2161
  props: {
2132
- storeId: "string",
2133
- publicKey: "string"
2162
+ storeId: {
2163
+ type: "string",
2164
+ defaultValue: "plasmic-sandbox"
2165
+ },
2166
+ publicKey: {
2167
+ type: "string",
2168
+ defaultValue: "pk_QaZeGhtpQaVbNQnWJdRlE1abE6Ezf9U9"
2169
+ }
2134
2170
  },
2135
- importPath: "commerce-providers/swell",
2171
+ importPath: "@plasmicpkgs/commerce-swell",
2136
2172
  importName: "CommerceProviderComponent"
2137
2173
  };
2138
2174
  function CommerceProviderComponent(props) {