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