@plasmicpkgs/plasmic-cms 0.0.16 → 0.0.22

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.
@@ -211,201 +211,198 @@ function createCommonjsModule(fn, module) {
211
211
  return module = { exports: {} }, fn(module, module.exports), module.exports;
212
212
  }
213
213
 
214
- var runtime_1 = createCommonjsModule(function (module) {
215
- /**
216
- * Copyright (c) 2014-present, Facebook, Inc.
217
- *
218
- * This source code is licensed under the MIT license found in the
219
- * LICENSE file in the root directory of this source tree.
220
- */
221
-
222
- var runtime = (function (exports) {
223
-
224
- var Op = Object.prototype;
225
- var hasOwn = Op.hasOwnProperty;
226
- var undefined$1; // More compressible than void 0.
227
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
228
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
229
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
230
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
231
-
232
- function define(obj, key, value) {
233
- Object.defineProperty(obj, key, {
234
- value: value,
235
- enumerable: true,
236
- configurable: true,
237
- writable: true
238
- });
239
- return obj[key];
240
- }
241
- try {
242
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
243
- define({}, "");
244
- } catch (err) {
245
- define = function(obj, key, value) {
246
- return obj[key] = value;
247
- };
248
- }
249
-
250
- function wrap(innerFn, outerFn, self, tryLocsList) {
251
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
252
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
253
- var generator = Object.create(protoGenerator.prototype);
254
- var context = new Context(tryLocsList || []);
255
-
256
- // The ._invoke method unifies the implementations of the .next,
257
- // .throw, and .return methods.
258
- generator._invoke = makeInvokeMethod(innerFn, self, context);
214
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
215
+ /**
216
+ * Copyright (c) 2014-present, Facebook, Inc.
217
+ *
218
+ * This source code is licensed under the MIT license found in the
219
+ * LICENSE file in the root directory of this source tree.
220
+ */
221
+ var runtime = function (exports) {
222
+
223
+ var Op = Object.prototype;
224
+ var hasOwn = Op.hasOwnProperty;
225
+ var undefined$1; // More compressible than void 0.
226
+
227
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
228
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
229
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
230
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
231
+
232
+ function define(obj, key, value) {
233
+ Object.defineProperty(obj, key, {
234
+ value: value,
235
+ enumerable: true,
236
+ configurable: true,
237
+ writable: true
238
+ });
239
+ return obj[key];
240
+ }
259
241
 
260
- return generator;
261
- }
262
- exports.wrap = wrap;
263
-
264
- // Try/catch helper to minimize deoptimizations. Returns a completion
265
- // record like context.tryEntries[i].completion. This interface could
266
- // have been (and was previously) designed to take a closure to be
267
- // invoked without arguments, but in all the cases we care about we
268
- // already have an existing method we want to call, so there's no need
269
- // to create a new function object. We can even get away with assuming
270
- // the method takes exactly one argument, since that happens to be true
271
- // in every case, so we don't have to touch the arguments object. The
272
- // only additional allocation required is the completion record, which
273
- // has a stable shape and so hopefully should be cheap to allocate.
274
- function tryCatch(fn, obj, arg) {
275
242
  try {
276
- return { type: "normal", arg: fn.call(obj, arg) };
243
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
244
+ define({}, "");
277
245
  } catch (err) {
278
- return { type: "throw", arg: err };
246
+ define = function define(obj, key, value) {
247
+ return obj[key] = value;
248
+ };
279
249
  }
280
- }
281
250
 
282
- var GenStateSuspendedStart = "suspendedStart";
283
- var GenStateSuspendedYield = "suspendedYield";
284
- var GenStateExecuting = "executing";
285
- var GenStateCompleted = "completed";
286
-
287
- // Returning this object from the innerFn has the same effect as
288
- // breaking out of the dispatch switch statement.
289
- var ContinueSentinel = {};
290
-
291
- // Dummy constructor functions that we use as the .constructor and
292
- // .constructor.prototype properties for functions that return Generator
293
- // objects. For full spec compliance, you may wish to configure your
294
- // minifier not to mangle the names of these two functions.
295
- function Generator() {}
296
- function GeneratorFunction() {}
297
- function GeneratorFunctionPrototype() {}
298
-
299
- // This is a polyfill for %IteratorPrototype% for environments that
300
- // don't natively support it.
301
- var IteratorPrototype = {};
302
- define(IteratorPrototype, iteratorSymbol, function () {
303
- return this;
304
- });
251
+ function wrap(innerFn, outerFn, self, tryLocsList) {
252
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
253
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
254
+ var generator = Object.create(protoGenerator.prototype);
255
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
256
+ // .throw, and .return methods.
305
257
 
306
- var getProto = Object.getPrototypeOf;
307
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
308
- if (NativeIteratorPrototype &&
309
- NativeIteratorPrototype !== Op &&
310
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
311
- // This environment has a native %IteratorPrototype%; use it instead
312
- // of the polyfill.
313
- IteratorPrototype = NativeIteratorPrototype;
314
- }
258
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
259
+ return generator;
260
+ }
315
261
 
316
- var Gp = GeneratorFunctionPrototype.prototype =
317
- Generator.prototype = Object.create(IteratorPrototype);
318
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
319
- define(Gp, "constructor", GeneratorFunctionPrototype);
320
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
321
- GeneratorFunction.displayName = define(
322
- GeneratorFunctionPrototype,
323
- toStringTagSymbol,
324
- "GeneratorFunction"
325
- );
326
-
327
- // Helper for defining the .next, .throw, and .return methods of the
328
- // Iterator interface in terms of a single ._invoke method.
329
- function defineIteratorMethods(prototype) {
330
- ["next", "throw", "return"].forEach(function(method) {
331
- define(prototype, method, function(arg) {
332
- return this._invoke(method, arg);
333
- });
334
- });
335
- }
262
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
263
+ // record like context.tryEntries[i].completion. This interface could
264
+ // have been (and was previously) designed to take a closure to be
265
+ // invoked without arguments, but in all the cases we care about we
266
+ // already have an existing method we want to call, so there's no need
267
+ // to create a new function object. We can even get away with assuming
268
+ // the method takes exactly one argument, since that happens to be true
269
+ // in every case, so we don't have to touch the arguments object. The
270
+ // only additional allocation required is the completion record, which
271
+ // has a stable shape and so hopefully should be cheap to allocate.
272
+
273
+ function tryCatch(fn, obj, arg) {
274
+ try {
275
+ return {
276
+ type: "normal",
277
+ arg: fn.call(obj, arg)
278
+ };
279
+ } catch (err) {
280
+ return {
281
+ type: "throw",
282
+ arg: err
283
+ };
284
+ }
285
+ }
336
286
 
337
- exports.isGeneratorFunction = function(genFun) {
338
- var ctor = typeof genFun === "function" && genFun.constructor;
339
- return ctor
340
- ? ctor === GeneratorFunction ||
341
- // For the native GeneratorFunction constructor, the best we can
342
- // do is to check its .name property.
343
- (ctor.displayName || ctor.name) === "GeneratorFunction"
344
- : false;
345
- };
287
+ var GenStateSuspendedStart = "suspendedStart";
288
+ var GenStateSuspendedYield = "suspendedYield";
289
+ var GenStateExecuting = "executing";
290
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
291
+ // breaking out of the dispatch switch statement.
346
292
 
347
- exports.mark = function(genFun) {
348
- if (Object.setPrototypeOf) {
349
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
350
- } else {
351
- genFun.__proto__ = GeneratorFunctionPrototype;
352
- define(genFun, toStringTagSymbol, "GeneratorFunction");
293
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
294
+ // .constructor.prototype properties for functions that return Generator
295
+ // objects. For full spec compliance, you may wish to configure your
296
+ // minifier not to mangle the names of these two functions.
297
+
298
+ function Generator() {}
299
+
300
+ function GeneratorFunction() {}
301
+
302
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
303
+ // don't natively support it.
304
+
305
+
306
+ var IteratorPrototype = {};
307
+
308
+ IteratorPrototype[iteratorSymbol] = function () {
309
+ return this;
310
+ };
311
+
312
+ var getProto = Object.getPrototypeOf;
313
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
314
+
315
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
316
+ // This environment has a native %IteratorPrototype%; use it instead
317
+ // of the polyfill.
318
+ IteratorPrototype = NativeIteratorPrototype;
353
319
  }
354
- genFun.prototype = Object.create(Gp);
355
- return genFun;
356
- };
357
320
 
358
- // Within the body of any async function, `await x` is transformed to
359
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
360
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
361
- // meant to be awaited.
362
- exports.awrap = function(arg) {
363
- return { __await: arg };
364
- };
321
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
322
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
323
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
324
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
325
+ // Iterator interface in terms of a single ._invoke method.
365
326
 
366
- function AsyncIterator(generator, PromiseImpl) {
367
- function invoke(method, arg, resolve, reject) {
368
- var record = tryCatch(generator[method], generator, arg);
369
- if (record.type === "throw") {
370
- reject(record.arg);
327
+ function defineIteratorMethods(prototype) {
328
+ ["next", "throw", "return"].forEach(function (method) {
329
+ define(prototype, method, function (arg) {
330
+ return this._invoke(method, arg);
331
+ });
332
+ });
333
+ }
334
+
335
+ exports.isGeneratorFunction = function (genFun) {
336
+ var ctor = typeof genFun === "function" && genFun.constructor;
337
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
338
+ // do is to check its .name property.
339
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
340
+ };
341
+
342
+ exports.mark = function (genFun) {
343
+ if (Object.setPrototypeOf) {
344
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
371
345
  } else {
372
- var result = record.arg;
373
- var value = result.value;
374
- if (value &&
375
- typeof value === "object" &&
376
- hasOwn.call(value, "__await")) {
377
- return PromiseImpl.resolve(value.__await).then(function(value) {
378
- invoke("next", value, resolve, reject);
379
- }, function(err) {
380
- invoke("throw", err, resolve, reject);
346
+ genFun.__proto__ = GeneratorFunctionPrototype;
347
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
348
+ }
349
+
350
+ genFun.prototype = Object.create(Gp);
351
+ return genFun;
352
+ }; // Within the body of any async function, `await x` is transformed to
353
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
354
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
355
+ // meant to be awaited.
356
+
357
+
358
+ exports.awrap = function (arg) {
359
+ return {
360
+ __await: arg
361
+ };
362
+ };
363
+
364
+ function AsyncIterator(generator, PromiseImpl) {
365
+ function invoke(method, arg, resolve, reject) {
366
+ var record = tryCatch(generator[method], generator, arg);
367
+
368
+ if (record.type === "throw") {
369
+ reject(record.arg);
370
+ } else {
371
+ var result = record.arg;
372
+ var value = result.value;
373
+
374
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
375
+ return PromiseImpl.resolve(value.__await).then(function (value) {
376
+ invoke("next", value, resolve, reject);
377
+ }, function (err) {
378
+ invoke("throw", err, resolve, reject);
379
+ });
380
+ }
381
+
382
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
383
+ // When a yielded Promise is resolved, its final value becomes
384
+ // the .value of the Promise<{value,done}> result for the
385
+ // current iteration.
386
+ result.value = unwrapped;
387
+ resolve(result);
388
+ }, function (error) {
389
+ // If a rejected Promise was yielded, throw the rejection back
390
+ // into the async generator function so it can be handled there.
391
+ return invoke("throw", error, resolve, reject);
381
392
  });
382
393
  }
383
-
384
- return PromiseImpl.resolve(value).then(function(unwrapped) {
385
- // When a yielded Promise is resolved, its final value becomes
386
- // the .value of the Promise<{value,done}> result for the
387
- // current iteration.
388
- result.value = unwrapped;
389
- resolve(result);
390
- }, function(error) {
391
- // If a rejected Promise was yielded, throw the rejection back
392
- // into the async generator function so it can be handled there.
393
- return invoke("throw", error, resolve, reject);
394
- });
395
394
  }
396
- }
397
395
 
398
- var previousPromise;
396
+ var previousPromise;
399
397
 
400
- function enqueue(method, arg) {
401
- function callInvokeWithMethodAndArg() {
402
- return new PromiseImpl(function(resolve, reject) {
403
- invoke(method, arg, resolve, reject);
404
- });
405
- }
398
+ function enqueue(method, arg) {
399
+ function callInvokeWithMethodAndArg() {
400
+ return new PromiseImpl(function (resolve, reject) {
401
+ invoke(method, arg, resolve, reject);
402
+ });
403
+ }
406
404
 
407
- return previousPromise =
408
- // If enqueue has been called before, then we want to wait until
405
+ return previousPromise = // If enqueue has been called before, then we want to wait until
409
406
  // all previous Promises have been resolved before calling invoke,
410
407
  // so that results are always delivered in the correct order. If
411
408
  // enqueue has not been called before, then it is important to
@@ -417,554 +414,525 @@ var runtime = (function (exports) {
417
414
  // execute code before the first await. Since we implement simple
418
415
  // async functions in terms of async generators, it is especially
419
416
  // important to get this right, even though it requires care.
420
- previousPromise ? previousPromise.then(
421
- callInvokeWithMethodAndArg,
422
- // Avoid propagating failures to Promises returned by later
423
- // invocations of the iterator.
424
- callInvokeWithMethodAndArg
425
- ) : callInvokeWithMethodAndArg();
417
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
418
+ // invocations of the iterator.
419
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
420
+ } // Define the unified helper method that is used to implement .next,
421
+ // .throw, and .return (see defineIteratorMethods).
422
+
423
+
424
+ this._invoke = enqueue;
426
425
  }
427
426
 
428
- // Define the unified helper method that is used to implement .next,
429
- // .throw, and .return (see defineIteratorMethods).
430
- this._invoke = enqueue;
431
- }
427
+ defineIteratorMethods(AsyncIterator.prototype);
432
428
 
433
- defineIteratorMethods(AsyncIterator.prototype);
434
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
435
- return this;
436
- });
437
- exports.AsyncIterator = AsyncIterator;
438
-
439
- // Note that simple async functions are implemented on top of
440
- // AsyncIterator objects; they just return a Promise for the value of
441
- // the final result produced by the iterator.
442
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
443
- if (PromiseImpl === void 0) PromiseImpl = Promise;
444
-
445
- var iter = new AsyncIterator(
446
- wrap(innerFn, outerFn, self, tryLocsList),
447
- PromiseImpl
448
- );
449
-
450
- return exports.isGeneratorFunction(outerFn)
451
- ? iter // If outerFn is a generator, return the full iterator.
452
- : iter.next().then(function(result) {
453
- return result.done ? result.value : iter.next();
454
- });
455
- };
429
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
430
+ return this;
431
+ };
456
432
 
457
- function makeInvokeMethod(innerFn, self, context) {
458
- var state = GenStateSuspendedStart;
433
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
434
+ // AsyncIterator objects; they just return a Promise for the value of
435
+ // the final result produced by the iterator.
459
436
 
460
- return function invoke(method, arg) {
461
- if (state === GenStateExecuting) {
462
- throw new Error("Generator is already running");
463
- }
437
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
438
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
439
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
440
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
441
+ : iter.next().then(function (result) {
442
+ return result.done ? result.value : iter.next();
443
+ });
444
+ };
464
445
 
465
- if (state === GenStateCompleted) {
466
- if (method === "throw") {
467
- throw arg;
446
+ function makeInvokeMethod(innerFn, self, context) {
447
+ var state = GenStateSuspendedStart;
448
+ return function invoke(method, arg) {
449
+ if (state === GenStateExecuting) {
450
+ throw new Error("Generator is already running");
468
451
  }
469
452
 
470
- // Be forgiving, per 25.3.3.3.3 of the spec:
471
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
472
- return doneResult();
473
- }
453
+ if (state === GenStateCompleted) {
454
+ if (method === "throw") {
455
+ throw arg;
456
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
457
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
474
458
 
475
- context.method = method;
476
- context.arg = arg;
477
459
 
478
- while (true) {
479
- var delegate = context.delegate;
480
- if (delegate) {
481
- var delegateResult = maybeInvokeDelegate(delegate, context);
482
- if (delegateResult) {
483
- if (delegateResult === ContinueSentinel) continue;
484
- return delegateResult;
485
- }
460
+ return doneResult();
486
461
  }
487
462
 
488
- if (context.method === "next") {
489
- // Setting context._sent for legacy support of Babel's
490
- // function.sent implementation.
491
- context.sent = context._sent = context.arg;
463
+ context.method = method;
464
+ context.arg = arg;
465
+
466
+ while (true) {
467
+ var delegate = context.delegate;
492
468
 
493
- } else if (context.method === "throw") {
494
- if (state === GenStateSuspendedStart) {
495
- state = GenStateCompleted;
496
- throw context.arg;
469
+ if (delegate) {
470
+ var delegateResult = maybeInvokeDelegate(delegate, context);
471
+
472
+ if (delegateResult) {
473
+ if (delegateResult === ContinueSentinel) continue;
474
+ return delegateResult;
475
+ }
497
476
  }
498
477
 
499
- context.dispatchException(context.arg);
478
+ if (context.method === "next") {
479
+ // Setting context._sent for legacy support of Babel's
480
+ // function.sent implementation.
481
+ context.sent = context._sent = context.arg;
482
+ } else if (context.method === "throw") {
483
+ if (state === GenStateSuspendedStart) {
484
+ state = GenStateCompleted;
485
+ throw context.arg;
486
+ }
500
487
 
501
- } else if (context.method === "return") {
502
- context.abrupt("return", context.arg);
503
- }
488
+ context.dispatchException(context.arg);
489
+ } else if (context.method === "return") {
490
+ context.abrupt("return", context.arg);
491
+ }
504
492
 
505
- state = GenStateExecuting;
493
+ state = GenStateExecuting;
494
+ var record = tryCatch(innerFn, self, context);
506
495
 
507
- var record = tryCatch(innerFn, self, context);
508
- if (record.type === "normal") {
509
- // If an exception is thrown from innerFn, we leave state ===
510
- // GenStateExecuting and loop back for another invocation.
511
- state = context.done
512
- ? GenStateCompleted
513
- : GenStateSuspendedYield;
496
+ if (record.type === "normal") {
497
+ // If an exception is thrown from innerFn, we leave state ===
498
+ // GenStateExecuting and loop back for another invocation.
499
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
514
500
 
515
- if (record.arg === ContinueSentinel) {
516
- continue;
517
- }
501
+ if (record.arg === ContinueSentinel) {
502
+ continue;
503
+ }
518
504
 
519
- return {
520
- value: record.arg,
521
- done: context.done
522
- };
505
+ return {
506
+ value: record.arg,
507
+ done: context.done
508
+ };
509
+ } else if (record.type === "throw") {
510
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
511
+ // context.dispatchException(context.arg) call above.
512
+
513
+ context.method = "throw";
514
+ context.arg = record.arg;
515
+ }
516
+ }
517
+ };
518
+ } // Call delegate.iterator[context.method](context.arg) and handle the
519
+ // result, either by returning a { value, done } result from the
520
+ // delegate iterator, or by modifying context.method and context.arg,
521
+ // setting context.delegate to null, and returning the ContinueSentinel.
522
+
523
+
524
+ function maybeInvokeDelegate(delegate, context) {
525
+ var method = delegate.iterator[context.method];
526
+
527
+ if (method === undefined$1) {
528
+ // A .throw or .return when the delegate iterator has no .throw
529
+ // method always terminates the yield* loop.
530
+ context.delegate = null;
531
+
532
+ if (context.method === "throw") {
533
+ // Note: ["return"] must be used for ES3 parsing compatibility.
534
+ if (delegate.iterator["return"]) {
535
+ // If the delegate iterator has a return method, give it a
536
+ // chance to clean up.
537
+ context.method = "return";
538
+ context.arg = undefined$1;
539
+ maybeInvokeDelegate(delegate, context);
540
+
541
+ if (context.method === "throw") {
542
+ // If maybeInvokeDelegate(context) changed context.method from
543
+ // "return" to "throw", let that override the TypeError below.
544
+ return ContinueSentinel;
545
+ }
546
+ }
523
547
 
524
- } else if (record.type === "throw") {
525
- state = GenStateCompleted;
526
- // Dispatch the exception by looping back around to the
527
- // context.dispatchException(context.arg) call above.
528
548
  context.method = "throw";
529
- context.arg = record.arg;
549
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
530
550
  }
551
+
552
+ return ContinueSentinel;
531
553
  }
532
- };
533
- }
534
554
 
535
- // Call delegate.iterator[context.method](context.arg) and handle the
536
- // result, either by returning a { value, done } result from the
537
- // delegate iterator, or by modifying context.method and context.arg,
538
- // setting context.delegate to null, and returning the ContinueSentinel.
539
- function maybeInvokeDelegate(delegate, context) {
540
- var method = delegate.iterator[context.method];
541
- if (method === undefined$1) {
542
- // A .throw or .return when the delegate iterator has no .throw
543
- // method always terminates the yield* loop.
544
- context.delegate = null;
555
+ var record = tryCatch(method, delegate.iterator, context.arg);
545
556
 
546
- if (context.method === "throw") {
547
- // Note: ["return"] must be used for ES3 parsing compatibility.
548
- if (delegate.iterator["return"]) {
549
- // If the delegate iterator has a return method, give it a
550
- // chance to clean up.
551
- context.method = "return";
552
- context.arg = undefined$1;
553
- maybeInvokeDelegate(delegate, context);
557
+ if (record.type === "throw") {
558
+ context.method = "throw";
559
+ context.arg = record.arg;
560
+ context.delegate = null;
561
+ return ContinueSentinel;
562
+ }
554
563
 
555
- if (context.method === "throw") {
556
- // If maybeInvokeDelegate(context) changed context.method from
557
- // "return" to "throw", let that override the TypeError below.
558
- return ContinueSentinel;
559
- }
560
- }
564
+ var info = record.arg;
561
565
 
566
+ if (!info) {
562
567
  context.method = "throw";
563
- context.arg = new TypeError(
564
- "The iterator does not provide a 'throw' method");
568
+ context.arg = new TypeError("iterator result is not an object");
569
+ context.delegate = null;
570
+ return ContinueSentinel;
565
571
  }
566
572
 
567
- return ContinueSentinel;
568
- }
573
+ if (info.done) {
574
+ // Assign the result of the finished delegate to the temporary
575
+ // variable specified by delegate.resultName (see delegateYield).
576
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
569
577
 
570
- var record = tryCatch(method, delegate.iterator, context.arg);
578
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
579
+ // exception, let the outer generator proceed normally. If
580
+ // context.method was "next", forget context.arg since it has been
581
+ // "consumed" by the delegate iterator. If context.method was
582
+ // "return", allow the original .return call to continue in the
583
+ // outer generator.
571
584
 
572
- if (record.type === "throw") {
573
- context.method = "throw";
574
- context.arg = record.arg;
575
- context.delegate = null;
576
- return ContinueSentinel;
577
- }
585
+ if (context.method !== "return") {
586
+ context.method = "next";
587
+ context.arg = undefined$1;
588
+ }
589
+ } else {
590
+ // Re-yield the result returned by the delegate method.
591
+ return info;
592
+ } // The delegate iterator is finished, so forget it and continue with
593
+ // the outer generator.
578
594
 
579
- var info = record.arg;
580
595
 
581
- if (! info) {
582
- context.method = "throw";
583
- context.arg = new TypeError("iterator result is not an object");
584
596
  context.delegate = null;
585
597
  return ContinueSentinel;
586
- }
598
+ } // Define Generator.prototype.{next,throw,return} in terms of the
599
+ // unified ._invoke helper method.
587
600
 
588
- if (info.done) {
589
- // Assign the result of the finished delegate to the temporary
590
- // variable specified by delegate.resultName (see delegateYield).
591
- context[delegate.resultName] = info.value;
592
-
593
- // Resume execution at the desired location (see delegateYield).
594
- context.next = delegate.nextLoc;
595
-
596
- // If context.method was "throw" but the delegate handled the
597
- // exception, let the outer generator proceed normally. If
598
- // context.method was "next", forget context.arg since it has been
599
- // "consumed" by the delegate iterator. If context.method was
600
- // "return", allow the original .return call to continue in the
601
- // outer generator.
602
- if (context.method !== "return") {
603
- context.method = "next";
604
- context.arg = undefined$1;
605
- }
606
-
607
- } else {
608
- // Re-yield the result returned by the delegate method.
609
- return info;
610
- }
611
601
 
612
- // The delegate iterator is finished, so forget it and continue with
613
- // the outer generator.
614
- context.delegate = null;
615
- return ContinueSentinel;
616
- }
602
+ defineIteratorMethods(Gp);
603
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
604
+ // @@iterator function is called on it. Some browsers' implementations of the
605
+ // iterator prototype chain incorrectly implement this, causing the Generator
606
+ // object to not be returned from this call. This ensures that doesn't happen.
607
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
617
608
 
618
- // Define Generator.prototype.{next,throw,return} in terms of the
619
- // unified ._invoke helper method.
620
- defineIteratorMethods(Gp);
609
+ Gp[iteratorSymbol] = function () {
610
+ return this;
611
+ };
621
612
 
622
- define(Gp, toStringTagSymbol, "Generator");
613
+ Gp.toString = function () {
614
+ return "[object Generator]";
615
+ };
623
616
 
624
- // A Generator should always return itself as the iterator object when the
625
- // @@iterator function is called on it. Some browsers' implementations of the
626
- // iterator prototype chain incorrectly implement this, causing the Generator
627
- // object to not be returned from this call. This ensures that doesn't happen.
628
- // See https://github.com/facebook/regenerator/issues/274 for more details.
629
- define(Gp, iteratorSymbol, function() {
630
- return this;
631
- });
617
+ function pushTryEntry(locs) {
618
+ var entry = {
619
+ tryLoc: locs[0]
620
+ };
632
621
 
633
- define(Gp, "toString", function() {
634
- return "[object Generator]";
635
- });
622
+ if (1 in locs) {
623
+ entry.catchLoc = locs[1];
624
+ }
636
625
 
637
- function pushTryEntry(locs) {
638
- var entry = { tryLoc: locs[0] };
626
+ if (2 in locs) {
627
+ entry.finallyLoc = locs[2];
628
+ entry.afterLoc = locs[3];
629
+ }
639
630
 
640
- if (1 in locs) {
641
- entry.catchLoc = locs[1];
631
+ this.tryEntries.push(entry);
642
632
  }
643
633
 
644
- if (2 in locs) {
645
- entry.finallyLoc = locs[2];
646
- entry.afterLoc = locs[3];
634
+ function resetTryEntry(entry) {
635
+ var record = entry.completion || {};
636
+ record.type = "normal";
637
+ delete record.arg;
638
+ entry.completion = record;
647
639
  }
648
640
 
649
- this.tryEntries.push(entry);
650
- }
651
-
652
- function resetTryEntry(entry) {
653
- var record = entry.completion || {};
654
- record.type = "normal";
655
- delete record.arg;
656
- entry.completion = record;
657
- }
658
-
659
- function Context(tryLocsList) {
660
- // The root entry object (effectively a try statement without a catch
661
- // or a finally block) gives us a place to store values thrown from
662
- // locations where there is no enclosing try statement.
663
- this.tryEntries = [{ tryLoc: "root" }];
664
- tryLocsList.forEach(pushTryEntry, this);
665
- this.reset(true);
666
- }
667
-
668
- exports.keys = function(object) {
669
- var keys = [];
670
- for (var key in object) {
671
- keys.push(key);
641
+ function Context(tryLocsList) {
642
+ // The root entry object (effectively a try statement without a catch
643
+ // or a finally block) gives us a place to store values thrown from
644
+ // locations where there is no enclosing try statement.
645
+ this.tryEntries = [{
646
+ tryLoc: "root"
647
+ }];
648
+ tryLocsList.forEach(pushTryEntry, this);
649
+ this.reset(true);
672
650
  }
673
- keys.reverse();
674
-
675
- // Rather than returning an object with a next method, we keep
676
- // things simple and return the next function itself.
677
- return function next() {
678
- while (keys.length) {
679
- var key = keys.pop();
680
- if (key in object) {
681
- next.value = key;
682
- next.done = false;
683
- return next;
684
- }
685
- }
686
651
 
687
- // To avoid creating an additional object, we just hang the .value
688
- // and .done properties off the next function object itself. This
689
- // also ensures that the minifier will not anonymize the function.
690
- next.done = true;
691
- return next;
692
- };
693
- };
652
+ exports.keys = function (object) {
653
+ var keys = [];
694
654
 
695
- function values(iterable) {
696
- if (iterable) {
697
- var iteratorMethod = iterable[iteratorSymbol];
698
- if (iteratorMethod) {
699
- return iteratorMethod.call(iterable);
655
+ for (var key in object) {
656
+ keys.push(key);
700
657
  }
701
658
 
702
- if (typeof iterable.next === "function") {
703
- return iterable;
704
- }
659
+ keys.reverse(); // Rather than returning an object with a next method, we keep
660
+ // things simple and return the next function itself.
705
661
 
706
- if (!isNaN(iterable.length)) {
707
- var i = -1, next = function next() {
708
- while (++i < iterable.length) {
709
- if (hasOwn.call(iterable, i)) {
710
- next.value = iterable[i];
711
- next.done = false;
712
- return next;
713
- }
714
- }
662
+ return function next() {
663
+ while (keys.length) {
664
+ var key = keys.pop();
715
665
 
716
- next.value = undefined$1;
717
- next.done = true;
666
+ if (key in object) {
667
+ next.value = key;
668
+ next.done = false;
669
+ return next;
670
+ }
671
+ } // To avoid creating an additional object, we just hang the .value
672
+ // and .done properties off the next function object itself. This
673
+ // also ensures that the minifier will not anonymize the function.
718
674
 
719
- return next;
720
- };
721
675
 
722
- return next.next = next;
723
- }
724
- }
676
+ next.done = true;
677
+ return next;
678
+ };
679
+ };
725
680
 
726
- // Return an iterator with no values.
727
- return { next: doneResult };
728
- }
729
- exports.values = values;
681
+ function values(iterable) {
682
+ if (iterable) {
683
+ var iteratorMethod = iterable[iteratorSymbol];
730
684
 
731
- function doneResult() {
732
- return { value: undefined$1, done: true };
733
- }
734
-
735
- Context.prototype = {
736
- constructor: Context,
737
-
738
- reset: function(skipTempReset) {
739
- this.prev = 0;
740
- this.next = 0;
741
- // Resetting context._sent for legacy support of Babel's
742
- // function.sent implementation.
743
- this.sent = this._sent = undefined$1;
744
- this.done = false;
745
- this.delegate = null;
746
-
747
- this.method = "next";
748
- this.arg = undefined$1;
749
-
750
- this.tryEntries.forEach(resetTryEntry);
751
-
752
- if (!skipTempReset) {
753
- for (var name in this) {
754
- // Not sure about the optimal order of these conditions:
755
- if (name.charAt(0) === "t" &&
756
- hasOwn.call(this, name) &&
757
- !isNaN(+name.slice(1))) {
758
- this[name] = undefined$1;
759
- }
685
+ if (iteratorMethod) {
686
+ return iteratorMethod.call(iterable);
760
687
  }
761
- }
762
- },
763
-
764
- stop: function() {
765
- this.done = true;
766
-
767
- var rootEntry = this.tryEntries[0];
768
- var rootRecord = rootEntry.completion;
769
- if (rootRecord.type === "throw") {
770
- throw rootRecord.arg;
771
- }
772
688
 
773
- return this.rval;
774
- },
689
+ if (typeof iterable.next === "function") {
690
+ return iterable;
691
+ }
775
692
 
776
- dispatchException: function(exception) {
777
- if (this.done) {
778
- throw exception;
779
- }
693
+ if (!isNaN(iterable.length)) {
694
+ var i = -1,
695
+ next = function next() {
696
+ while (++i < iterable.length) {
697
+ if (hasOwn.call(iterable, i)) {
698
+ next.value = iterable[i];
699
+ next.done = false;
700
+ return next;
701
+ }
702
+ }
780
703
 
781
- var context = this;
782
- function handle(loc, caught) {
783
- record.type = "throw";
784
- record.arg = exception;
785
- context.next = loc;
704
+ next.value = undefined$1;
705
+ next.done = true;
706
+ return next;
707
+ };
786
708
 
787
- if (caught) {
788
- // If the dispatched exception was caught by a catch block,
789
- // then let that catch block handle the exception normally.
790
- context.method = "next";
791
- context.arg = undefined$1;
709
+ return next.next = next;
792
710
  }
711
+ } // Return an iterator with no values.
793
712
 
794
- return !! caught;
795
- }
796
713
 
797
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
798
- var entry = this.tryEntries[i];
799
- var record = entry.completion;
714
+ return {
715
+ next: doneResult
716
+ };
717
+ }
800
718
 
801
- if (entry.tryLoc === "root") {
802
- // Exception thrown outside of any try block that could handle
803
- // it, so set the completion value of the entire function to
804
- // throw the exception.
805
- return handle("end");
806
- }
719
+ exports.values = values;
807
720
 
808
- if (entry.tryLoc <= this.prev) {
809
- var hasCatch = hasOwn.call(entry, "catchLoc");
810
- var hasFinally = hasOwn.call(entry, "finallyLoc");
721
+ function doneResult() {
722
+ return {
723
+ value: undefined$1,
724
+ done: true
725
+ };
726
+ }
811
727
 
812
- if (hasCatch && hasFinally) {
813
- if (this.prev < entry.catchLoc) {
814
- return handle(entry.catchLoc, true);
815
- } else if (this.prev < entry.finallyLoc) {
816
- return handle(entry.finallyLoc);
817
- }
728
+ Context.prototype = {
729
+ constructor: Context,
730
+ reset: function reset(skipTempReset) {
731
+ this.prev = 0;
732
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
733
+ // function.sent implementation.
818
734
 
819
- } else if (hasCatch) {
820
- if (this.prev < entry.catchLoc) {
821
- return handle(entry.catchLoc, true);
822
- }
735
+ this.sent = this._sent = undefined$1;
736
+ this.done = false;
737
+ this.delegate = null;
738
+ this.method = "next";
739
+ this.arg = undefined$1;
740
+ this.tryEntries.forEach(resetTryEntry);
823
741
 
824
- } else if (hasFinally) {
825
- if (this.prev < entry.finallyLoc) {
826
- return handle(entry.finallyLoc);
742
+ if (!skipTempReset) {
743
+ for (var name in this) {
744
+ // Not sure about the optimal order of these conditions:
745
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
746
+ this[name] = undefined$1;
827
747
  }
828
-
829
- } else {
830
- throw new Error("try statement without catch or finally");
831
748
  }
832
749
  }
833
- }
834
- },
750
+ },
751
+ stop: function stop() {
752
+ this.done = true;
753
+ var rootEntry = this.tryEntries[0];
754
+ var rootRecord = rootEntry.completion;
755
+
756
+ if (rootRecord.type === "throw") {
757
+ throw rootRecord.arg;
758
+ }
835
759
 
836
- abrupt: function(type, arg) {
837
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
838
- var entry = this.tryEntries[i];
839
- if (entry.tryLoc <= this.prev &&
840
- hasOwn.call(entry, "finallyLoc") &&
841
- this.prev < entry.finallyLoc) {
842
- var finallyEntry = entry;
843
- break;
760
+ return this.rval;
761
+ },
762
+ dispatchException: function dispatchException(exception) {
763
+ if (this.done) {
764
+ throw exception;
844
765
  }
845
- }
846
766
 
847
- if (finallyEntry &&
848
- (type === "break" ||
849
- type === "continue") &&
850
- finallyEntry.tryLoc <= arg &&
851
- arg <= finallyEntry.finallyLoc) {
852
- // Ignore the finally entry if control is not jumping to a
853
- // location outside the try/catch block.
854
- finallyEntry = null;
855
- }
767
+ var context = this;
856
768
 
857
- var record = finallyEntry ? finallyEntry.completion : {};
858
- record.type = type;
859
- record.arg = arg;
769
+ function handle(loc, caught) {
770
+ record.type = "throw";
771
+ record.arg = exception;
772
+ context.next = loc;
860
773
 
861
- if (finallyEntry) {
862
- this.method = "next";
863
- this.next = finallyEntry.finallyLoc;
864
- return ContinueSentinel;
865
- }
774
+ if (caught) {
775
+ // If the dispatched exception was caught by a catch block,
776
+ // then let that catch block handle the exception normally.
777
+ context.method = "next";
778
+ context.arg = undefined$1;
779
+ }
866
780
 
867
- return this.complete(record);
868
- },
781
+ return !!caught;
782
+ }
869
783
 
870
- complete: function(record, afterLoc) {
871
- if (record.type === "throw") {
872
- throw record.arg;
873
- }
784
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
785
+ var entry = this.tryEntries[i];
786
+ var record = entry.completion;
874
787
 
875
- if (record.type === "break" ||
876
- record.type === "continue") {
877
- this.next = record.arg;
878
- } else if (record.type === "return") {
879
- this.rval = this.arg = record.arg;
880
- this.method = "return";
881
- this.next = "end";
882
- } else if (record.type === "normal" && afterLoc) {
883
- this.next = afterLoc;
884
- }
788
+ if (entry.tryLoc === "root") {
789
+ // Exception thrown outside of any try block that could handle
790
+ // it, so set the completion value of the entire function to
791
+ // throw the exception.
792
+ return handle("end");
793
+ }
885
794
 
886
- return ContinueSentinel;
887
- },
795
+ if (entry.tryLoc <= this.prev) {
796
+ var hasCatch = hasOwn.call(entry, "catchLoc");
797
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
888
798
 
889
- finish: function(finallyLoc) {
890
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
891
- var entry = this.tryEntries[i];
892
- if (entry.finallyLoc === finallyLoc) {
893
- this.complete(entry.completion, entry.afterLoc);
894
- resetTryEntry(entry);
799
+ if (hasCatch && hasFinally) {
800
+ if (this.prev < entry.catchLoc) {
801
+ return handle(entry.catchLoc, true);
802
+ } else if (this.prev < entry.finallyLoc) {
803
+ return handle(entry.finallyLoc);
804
+ }
805
+ } else if (hasCatch) {
806
+ if (this.prev < entry.catchLoc) {
807
+ return handle(entry.catchLoc, true);
808
+ }
809
+ } else if (hasFinally) {
810
+ if (this.prev < entry.finallyLoc) {
811
+ return handle(entry.finallyLoc);
812
+ }
813
+ } else {
814
+ throw new Error("try statement without catch or finally");
815
+ }
816
+ }
817
+ }
818
+ },
819
+ abrupt: function abrupt(type, arg) {
820
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
821
+ var entry = this.tryEntries[i];
822
+
823
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
824
+ var finallyEntry = entry;
825
+ break;
826
+ }
827
+ }
828
+
829
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
830
+ // Ignore the finally entry if control is not jumping to a
831
+ // location outside the try/catch block.
832
+ finallyEntry = null;
833
+ }
834
+
835
+ var record = finallyEntry ? finallyEntry.completion : {};
836
+ record.type = type;
837
+ record.arg = arg;
838
+
839
+ if (finallyEntry) {
840
+ this.method = "next";
841
+ this.next = finallyEntry.finallyLoc;
895
842
  return ContinueSentinel;
896
843
  }
897
- }
898
- },
899
844
 
900
- "catch": function(tryLoc) {
901
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
902
- var entry = this.tryEntries[i];
903
- if (entry.tryLoc === tryLoc) {
904
- var record = entry.completion;
905
- if (record.type === "throw") {
906
- var thrown = record.arg;
845
+ return this.complete(record);
846
+ },
847
+ complete: function complete(record, afterLoc) {
848
+ if (record.type === "throw") {
849
+ throw record.arg;
850
+ }
851
+
852
+ if (record.type === "break" || record.type === "continue") {
853
+ this.next = record.arg;
854
+ } else if (record.type === "return") {
855
+ this.rval = this.arg = record.arg;
856
+ this.method = "return";
857
+ this.next = "end";
858
+ } else if (record.type === "normal" && afterLoc) {
859
+ this.next = afterLoc;
860
+ }
861
+
862
+ return ContinueSentinel;
863
+ },
864
+ finish: function finish(finallyLoc) {
865
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
866
+ var entry = this.tryEntries[i];
867
+
868
+ if (entry.finallyLoc === finallyLoc) {
869
+ this.complete(entry.completion, entry.afterLoc);
907
870
  resetTryEntry(entry);
871
+ return ContinueSentinel;
908
872
  }
909
- return thrown;
910
873
  }
911
- }
874
+ },
875
+ "catch": function _catch(tryLoc) {
876
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
877
+ var entry = this.tryEntries[i];
912
878
 
913
- // The context.catch method must only be called with a location
914
- // argument that corresponds to a known catch block.
915
- throw new Error("illegal catch attempt");
916
- },
879
+ if (entry.tryLoc === tryLoc) {
880
+ var record = entry.completion;
917
881
 
918
- delegateYield: function(iterable, resultName, nextLoc) {
919
- this.delegate = {
920
- iterator: values(iterable),
921
- resultName: resultName,
922
- nextLoc: nextLoc
923
- };
882
+ if (record.type === "throw") {
883
+ var thrown = record.arg;
884
+ resetTryEntry(entry);
885
+ }
924
886
 
925
- if (this.method === "next") {
926
- // Deliberately forget the last sent value so that we don't
927
- // accidentally pass it on to the delegate.
928
- this.arg = undefined$1;
929
- }
887
+ return thrown;
888
+ }
889
+ } // The context.catch method must only be called with a location
890
+ // argument that corresponds to a known catch block.
930
891
 
931
- return ContinueSentinel;
932
- }
933
- };
934
892
 
935
- // Regardless of whether this script is executing as a CommonJS module
936
- // or not, return the runtime object so that we can declare the variable
937
- // regeneratorRuntime in the outer scope, which allows this module to be
938
- // injected easily by `bin/regenerator --include-runtime script.js`.
939
- return exports;
893
+ throw new Error("illegal catch attempt");
894
+ },
895
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
896
+ this.delegate = {
897
+ iterator: values(iterable),
898
+ resultName: resultName,
899
+ nextLoc: nextLoc
900
+ };
901
+
902
+ if (this.method === "next") {
903
+ // Deliberately forget the last sent value so that we don't
904
+ // accidentally pass it on to the delegate.
905
+ this.arg = undefined$1;
906
+ }
907
+
908
+ return ContinueSentinel;
909
+ }
910
+ }; // Regardless of whether this script is executing as a CommonJS module
911
+ // or not, return the runtime object so that we can declare the variable
912
+ // regeneratorRuntime in the outer scope, which allows this module to be
913
+ // injected easily by `bin/regenerator --include-runtime script.js`.
940
914
 
941
- }(
942
- // If this script is executing as a CommonJS module, use module.exports
915
+ return exports;
916
+ }( // If this script is executing as a CommonJS module, use module.exports
943
917
  // as the regeneratorRuntime namespace. Otherwise create a new empty
944
918
  // object. Either way, the resulting object will be used to initialize
945
919
  // the regeneratorRuntime variable at the top of this file.
946
- module.exports
947
- ));
948
-
949
- try {
950
- regeneratorRuntime = runtime;
951
- } catch (accidentalStrictMode) {
952
- // This module should not be running in strict mode, so the above
953
- // assignment should always work unless something is misconfigured. Just
954
- // in case runtime.js accidentally runs in strict mode, in modern engines
955
- // we can explicitly access globalThis. In older engines we can escape
956
- // strict mode using a global Function call. This could conceivably fail
957
- // if a Content Security Policy forbids using Function, but in that case
958
- // the proper solution is to fix the accidental strict mode problem. If
959
- // you've misconfigured your bundler to force strict mode and applied a
960
- // CSP to forbid Function, and you're not willing to fix either of those
961
- // problems, please detail your unique predicament in a GitHub issue.
962
- if (typeof globalThis === "object") {
963
- globalThis.regeneratorRuntime = runtime;
964
- } else {
920
+ module.exports );
921
+
922
+ try {
923
+ regeneratorRuntime = runtime;
924
+ } catch (accidentalStrictMode) {
925
+ // This module should not be running in strict mode, so the above
926
+ // assignment should always work unless something is misconfigured. Just
927
+ // in case runtime.js accidentally runs in strict mode, we can escape
928
+ // strict mode using a global Function call. This could conceivably fail
929
+ // if a Content Security Policy forbids using Function, but in that case
930
+ // the proper solution is to fix the accidental strict mode problem. If
931
+ // you've misconfigured your bundler to force strict mode and applied a
932
+ // CSP to forbid Function, and you're not willing to fix either of those
933
+ // problems, please detail your unique predicament in a GitHub issue.
965
934
  Function("r", "regeneratorRuntime = r")(runtime);
966
935
  }
967
- }
968
936
  });
969
937
 
970
938
  function queryParamsToApi(params) {
@@ -1381,7 +1349,7 @@ function mkTableOptions(tables) {
1381
1349
  };
1382
1350
  });
1383
1351
  }
1384
- function mkFieldOptions(tables, tableId) {
1352
+ function mkFieldOptions(tables, tableId, types) {
1385
1353
  if (!tables) {
1386
1354
  return [];
1387
1355
  }
@@ -1394,7 +1362,15 @@ function mkFieldOptions(tables, tableId) {
1394
1362
  return [];
1395
1363
  }
1396
1364
 
1397
- return table.schema.fields.map(function (f) {
1365
+ var fields = table.schema.fields;
1366
+
1367
+ if (types) {
1368
+ fields = fields.filter(function (f) {
1369
+ return types.includes(f.type);
1370
+ });
1371
+ }
1372
+
1373
+ return fields.map(function (f) {
1398
1374
  return {
1399
1375
  value: f.identifier,
1400
1376
  label: f.name || f.identifier
@@ -1403,7 +1379,7 @@ function mkFieldOptions(tables, tableId) {
1403
1379
  }
1404
1380
 
1405
1381
  var _excluded = ["children"],
1406
- _excluded2 = ["table", "children", "setControlContextData"];
1382
+ _excluded2 = ["className", "table", "field", "setControlContextData"];
1407
1383
  var modulePath = "@plasmicpkgs/plasmic-cms";
1408
1384
  var componentPrefix = "hostless-plasmic-cms";
1409
1385
  var fetcherComponentPropMetas = {
@@ -1481,6 +1457,19 @@ function CmsCredentialsProvider(_ref) {
1481
1457
  config = _objectWithoutPropertiesLoose(_ref, _excluded);
1482
1458
 
1483
1459
  config.host = config.host || defaultHost;
1460
+
1461
+ if (!config.databaseId) {
1462
+ throw new Error("You must specify the CMS database ID to use.");
1463
+ }
1464
+
1465
+ if (!config.projectId) {
1466
+ throw new Error("You must specify the project you are using this CMS from.");
1467
+ }
1468
+
1469
+ if (!config.projectApiToken) {
1470
+ throw new Error("You must specify the token of the project you are using this CMS from.");
1471
+ }
1472
+
1484
1473
  return React.createElement(DatabaseProvider, {
1485
1474
  config: config
1486
1475
  }, React.createElement(TablesFetcher, null, children));
@@ -1575,8 +1564,11 @@ function CmsQueryLoader(_ref5) {
1575
1564
  var table = _ref5.table,
1576
1565
  children = _ref5.children,
1577
1566
  setControlContextData = _ref5.setControlContextData,
1578
- params = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1579
-
1567
+ where = _ref5.where,
1568
+ useDraft = _ref5.useDraft,
1569
+ orderBy = _ref5.orderBy,
1570
+ desc = _ref5.desc,
1571
+ limit = _ref5.limit;
1580
1572
  var databaseConfig = useDatabase();
1581
1573
  var tables = useTables();
1582
1574
 
@@ -1587,6 +1579,13 @@ function CmsQueryLoader(_ref5) {
1587
1579
  });
1588
1580
  }
1589
1581
 
1582
+ var params = {
1583
+ where: where,
1584
+ useDraft: useDraft,
1585
+ orderBy: orderBy,
1586
+ desc: desc,
1587
+ limit: limit
1588
+ };
1590
1589
  var cacheKey = JSON.stringify({
1591
1590
  component: "CmsQueryLoader",
1592
1591
  table: table,
@@ -1704,18 +1703,20 @@ var cmsRowFieldMeta = {
1704
1703
  var _ctx$table;
1705
1704
 
1706
1705
  var table = _ref8.table;
1707
- return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table);
1706
+ return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table, ["number", "boolean", "text", "long-text", "date-time"]);
1708
1707
  }
1709
1708
  }
1710
1709
  }
1711
1710
  };
1712
1711
  function CmsRowField(_ref9) {
1713
- var _tables$find, _res$row$data;
1712
+ var _res$row$data;
1714
1713
 
1715
1714
  var className = _ref9.className,
1716
1715
  table = _ref9.table,
1717
1716
  field = _ref9.field,
1718
- setControlContextData = _ref9.setControlContextData;
1717
+ setControlContextData = _ref9.setControlContextData,
1718
+ rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
1719
+
1719
1720
  var tables = useTables();
1720
1721
  var res = useRow(table);
1721
1722
 
@@ -1731,21 +1732,40 @@ function CmsRowField(_ref9) {
1731
1732
  });
1732
1733
  }
1733
1734
 
1734
- var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
1735
- return t.identifier === res.table;
1736
- })) == null ? void 0 : _tables$find.schema;
1737
- var fieldMeta = field ? schema == null ? void 0 : schema.fields.find(function (f) {
1738
- return f.identifier === field;
1739
- }) : schema == null ? void 0 : schema.fields[0];
1735
+ var fieldMeta = deriveInferredTableField({
1736
+ table: res.table,
1737
+ tables: tables,
1738
+ field: field,
1739
+ typeFilters: ["text"]
1740
+ });
1740
1741
 
1741
1742
  if (!fieldMeta) {
1742
1743
  return React.createElement("div", null, "Error: No field to display");
1743
1744
  }
1744
1745
 
1745
1746
  var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
1746
- return data ? renderValue(data, fieldMeta.type, {
1747
+ return data ? renderValue(data, fieldMeta.type, _extends({
1747
1748
  className: className
1748
- }) : React.createElement("div", null, "(no data returned)");
1749
+ }, rest)) : null;
1750
+ }
1751
+ var DEFAULT_TYPE_FILTERS = ["text"];
1752
+
1753
+ function deriveInferredTableField(opts) {
1754
+ var _tables$find;
1755
+
1756
+ var table = opts.table,
1757
+ tables = opts.tables,
1758
+ field = opts.field,
1759
+ typeFilters = opts.typeFilters;
1760
+ var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
1761
+ return t.identifier === table;
1762
+ })) == null ? void 0 : _tables$find.schema;
1763
+ var fieldMeta = field ? schema == null ? void 0 : schema.fields.find(function (f) {
1764
+ return f.identifier === field;
1765
+ }) : schema == null ? void 0 : schema.fields.find(function (f) {
1766
+ return (typeFilters != null ? typeFilters : DEFAULT_TYPE_FILTERS).includes(f.type);
1767
+ });
1768
+ return fieldMeta;
1749
1769
  }
1750
1770
 
1751
1771
  function assertNever(_) {
@@ -1759,18 +1779,22 @@ function renderValue(value, type, props) {
1759
1779
  case "text":
1760
1780
  case "long-text":
1761
1781
  case "date-time":
1762
- return React.createElement("div", {
1763
- className: props.className
1764
- }, value);
1782
+ return React.createElement("div", Object.assign({}, props), value);
1783
+
1784
+ case "rich-text":
1785
+ return React.createElement("div", Object.assign({
1786
+ dangerouslySetInnerHTML: {
1787
+ __html: value
1788
+ }
1789
+ }, props));
1765
1790
 
1766
1791
  case "image":
1767
1792
  if (value && typeof value === "object" && value.url && value.imageMeta) {
1768
- return React.createElement("img", {
1793
+ return React.createElement("img", Object.assign({
1769
1794
  src: value.url,
1770
1795
  width: value.imageMeta.height,
1771
- height: value.imageMeta.height,
1772
- className: props.className
1773
- });
1796
+ height: value.imageMeta.height
1797
+ }, props));
1774
1798
  }
1775
1799
 
1776
1800
  return null;
@@ -1789,7 +1813,7 @@ var cmsRowLinkMeta = {
1789
1813
  children: {
1790
1814
  type: "slot",
1791
1815
  defaultValue: {
1792
- type: "vbox",
1816
+ type: "text",
1793
1817
  tag: "a",
1794
1818
  value: "Link"
1795
1819
  }
@@ -1822,7 +1846,7 @@ var cmsRowLinkMeta = {
1822
1846
  }
1823
1847
  };
1824
1848
  function CmsRowLink(_ref11) {
1825
- var _tables$find2, _res$row$data2;
1849
+ var _res$row$data2;
1826
1850
 
1827
1851
  var table = _ref11.table,
1828
1852
  field = _ref11.field,
@@ -1833,7 +1857,7 @@ function CmsRowLink(_ref11) {
1833
1857
  var res = useRow(table);
1834
1858
 
1835
1859
  if (!res || !res.row) {
1836
- return React.createElement("div", null, "Error: No CMS row found");
1860
+ return React.createElement(React.Fragment, null, children);
1837
1861
  }
1838
1862
 
1839
1863
  if (tables) {
@@ -1844,17 +1868,19 @@ function CmsRowLink(_ref11) {
1844
1868
  });
1845
1869
  }
1846
1870
 
1847
- var schema = tables == null ? void 0 : (_tables$find2 = tables.find(function (t) {
1848
- return t.identifier === res.table;
1849
- })) == null ? void 0 : _tables$find2.schema;
1850
- var fieldMeta = field ? schema == null ? void 0 : schema.fields.find(function (f) {
1851
- return f.identifier === field;
1852
- }) : schema == null ? void 0 : schema.fields.find(function (f) {
1853
- return f.type === "text";
1871
+ var fieldMeta = deriveInferredTableField({
1872
+ table: res.table,
1873
+ tables: tables,
1874
+ field: field,
1875
+ typeFilters: ["text"]
1854
1876
  });
1855
1877
 
1856
1878
  if (!fieldMeta) {
1857
- return React.createElement("div", null, "Error: No field to display");
1879
+ return React.createElement(React.Fragment, null, children);
1880
+ }
1881
+
1882
+ if (!children) {
1883
+ return null;
1858
1884
  }
1859
1885
 
1860
1886
  var value = ((_res$row$data2 = res.row.data) == null ? void 0 : _res$row$data2[fieldMeta.identifier]) || "";
@@ -1867,6 +1893,184 @@ function CmsRowLink(_ref11) {
1867
1893
 
1868
1894
  return child;
1869
1895
  });
1896
+ return React.createElement(React.Fragment, null, childrenWithProps != null ? childrenWithProps : null);
1897
+ }
1898
+ var cmsRowImageMeta = {
1899
+ name: componentPrefix + "-row-image",
1900
+ displayName: "CMS Row Image",
1901
+ importName: "CmsRowImage",
1902
+ importPath: modulePath,
1903
+ props: {
1904
+ children: {
1905
+ type: "slot",
1906
+ defaultValue: {
1907
+ type: "img",
1908
+ src: "https://studio.plasmic.app/static/img/placeholder-full.png"
1909
+ }
1910
+ },
1911
+ table: {
1912
+ type: "choice",
1913
+ displayName: "Model",
1914
+ description: "CMS model (table) to use.",
1915
+ options: function options(_, ctx) {
1916
+ return mkTableOptions(ctx == null ? void 0 : ctx.tables);
1917
+ }
1918
+ },
1919
+ field: {
1920
+ type: "choice",
1921
+ displayName: "Field",
1922
+ description: "Field (from model schema) to use.",
1923
+ options: function options(_ref12, ctx) {
1924
+ var _ctx$table3;
1925
+
1926
+ var table = _ref12.table;
1927
+ return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
1928
+ }
1929
+ },
1930
+ srcProp: {
1931
+ type: "string",
1932
+ displayName: 'Image "src" prop',
1933
+ description: "Prop to inject into children",
1934
+ defaultValue: "src"
1935
+ }
1936
+ }
1937
+ };
1938
+ function CmsRowImage(_ref13) {
1939
+ var _res$row$data3;
1940
+
1941
+ var table = _ref13.table,
1942
+ field = _ref13.field,
1943
+ srcProp = _ref13.srcProp,
1944
+ children = _ref13.children,
1945
+ setControlContextData = _ref13.setControlContextData;
1946
+ var tables = useTables();
1947
+ var res = useRow(table);
1948
+
1949
+ if (!res || !res.row) {
1950
+ return React.createElement(React.Fragment, null, children);
1951
+ }
1952
+
1953
+ if (tables) {
1954
+ // TODO: Only include table if __plasmic_cms_row_{table} exists.
1955
+ setControlContextData == null ? void 0 : setControlContextData({
1956
+ tables: tables,
1957
+ table: res.table
1958
+ });
1959
+ }
1960
+
1961
+ var fieldMeta = deriveInferredTableField({
1962
+ table: res.table,
1963
+ tables: tables,
1964
+ field: field,
1965
+ typeFilters: ["image"]
1966
+ });
1967
+
1968
+ if (!fieldMeta) {
1969
+ return React.createElement(React.Fragment, null, children);
1970
+ }
1971
+
1972
+ var value = ((_res$row$data3 = res.row.data) == null ? void 0 : _res$row$data3[fieldMeta.identifier]) || "";
1973
+ var childrenWithProps = React.Children.map(children, function (child) {
1974
+ if (React.isValidElement(child) && value) {
1975
+ var _React$cloneElement3;
1976
+
1977
+ if (typeof value === "object" && value.url && value.imageMeta) {
1978
+ var _React$cloneElement2;
1979
+
1980
+ return React.cloneElement(child, (_React$cloneElement2 = {}, _React$cloneElement2[srcProp] = {
1981
+ src: value.url,
1982
+ fullHeight: value.imageMeta.height,
1983
+ fullWidth: value.imageMeta.width
1984
+ }, _React$cloneElement2));
1985
+ }
1986
+
1987
+ return React.cloneElement(child, (_React$cloneElement3 = {}, _React$cloneElement3[srcProp] = value, _React$cloneElement3));
1988
+ }
1989
+
1990
+ return child;
1991
+ });
1992
+ return React.createElement(React.Fragment, null, childrenWithProps);
1993
+ }
1994
+ var cmsRowFieldValueMeta = {
1995
+ name: componentPrefix + "-row-value",
1996
+ displayName: "CMS Row Value",
1997
+ importName: "CmsRowValue",
1998
+ importPath: modulePath,
1999
+ props: {
2000
+ children: {
2001
+ type: "slot"
2002
+ },
2003
+ table: {
2004
+ type: "choice",
2005
+ displayName: "Model",
2006
+ description: "CMS model (table) to use.",
2007
+ options: function options(_, ctx) {
2008
+ return mkTableOptions(ctx == null ? void 0 : ctx.tables);
2009
+ }
2010
+ },
2011
+ field: {
2012
+ type: "choice",
2013
+ displayName: "Field",
2014
+ description: "Field (from model schema) to use.",
2015
+ options: function options(_ref14, ctx) {
2016
+ var _ctx$table4;
2017
+
2018
+ var table = _ref14.table;
2019
+ return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table);
2020
+ }
2021
+ },
2022
+ valueProp: {
2023
+ type: "string",
2024
+ displayName: "Value prop",
2025
+ description: "Prop to inject into children as",
2026
+ defaultValue: "children"
2027
+ }
2028
+ }
2029
+ };
2030
+ function CmsRowFieldValue(_ref15) {
2031
+ var _res$row$data4;
2032
+
2033
+ var table = _ref15.table,
2034
+ field = _ref15.field,
2035
+ valueProp = _ref15.valueProp,
2036
+ children = _ref15.children,
2037
+ setControlContextData = _ref15.setControlContextData;
2038
+ var tables = useTables();
2039
+ var res = useRow(table);
2040
+
2041
+ if (!res || !res.row) {
2042
+ return React.createElement(React.Fragment, null, children);
2043
+ }
2044
+
2045
+ if (tables) {
2046
+ // TODO: Only include table if __plasmic_cms_row_{table} exists.
2047
+ setControlContextData == null ? void 0 : setControlContextData({
2048
+ tables: tables,
2049
+ table: res.table
2050
+ });
2051
+ }
2052
+
2053
+ var fieldMeta = deriveInferredTableField({
2054
+ table: res.table,
2055
+ tables: tables,
2056
+ field: field,
2057
+ typeFilters: ["text"]
2058
+ });
2059
+
2060
+ if (!fieldMeta) {
2061
+ return React.createElement(React.Fragment, null, children);
2062
+ }
2063
+
2064
+ var value = ((_res$row$data4 = res.row.data) == null ? void 0 : _res$row$data4[fieldMeta.identifier]) || "";
2065
+ var childrenWithProps = React.Children.map(children, function (child) {
2066
+ if (React.isValidElement(child)) {
2067
+ var _React$cloneElement4;
2068
+
2069
+ return React.cloneElement(child, (_React$cloneElement4 = {}, _React$cloneElement4[valueProp] = value, _React$cloneElement4));
2070
+ }
2071
+
2072
+ return child;
2073
+ });
1870
2074
  return React.createElement(React.Fragment, null, childrenWithProps);
1871
2075
  }
1872
2076
  var cmsRowLoaderMeta = {
@@ -1903,13 +2107,13 @@ var cmsRowLoaderMeta = {
1903
2107
  }
1904
2108
  }, fetcherComponentPropMetas)
1905
2109
  };
1906
- function CmsRowLoader(_ref12) {
1907
- var table = _ref12.table,
1908
- row = _ref12.row,
1909
- children = _ref12.children,
1910
- useDraft = _ref12.useDraft,
1911
- hideIfNotFound = _ref12.hideIfNotFound,
1912
- setControlContextData = _ref12.setControlContextData;
2110
+ function CmsRowLoader(_ref16) {
2111
+ var table = _ref16.table,
2112
+ row = _ref16.row,
2113
+ children = _ref16.children,
2114
+ useDraft = _ref16.useDraft,
2115
+ hideIfNotFound = _ref16.hideIfNotFound,
2116
+ setControlContextData = _ref16.setControlContextData;
1913
2117
  var databaseConfig = useDatabase();
1914
2118
  var tables = useTables();
1915
2119
 
@@ -1991,18 +2195,26 @@ function registerAll(loader) {
1991
2195
 
1992
2196
  _registerComponent(CmsRowLink, cmsRowLinkMeta);
1993
2197
 
2198
+ _registerComponent(CmsRowImage, cmsRowImageMeta);
2199
+
2200
+ _registerComponent(CmsRowFieldValue, cmsRowFieldValueMeta);
2201
+
1994
2202
  _registerComponent(CmsRowLoader, cmsRowLoaderMeta);
1995
2203
  }
1996
2204
 
1997
2205
  exports.CmsCredentialsProvider = CmsCredentialsProvider;
1998
2206
  exports.CmsQueryLoader = CmsQueryLoader;
1999
2207
  exports.CmsRowField = CmsRowField;
2208
+ exports.CmsRowFieldValue = CmsRowFieldValue;
2209
+ exports.CmsRowImage = CmsRowImage;
2000
2210
  exports.CmsRowLink = CmsRowLink;
2001
2211
  exports.CmsRowLoader = CmsRowLoader;
2002
2212
  exports.CmsRowRepeater = CmsRowRepeater;
2003
2213
  exports.cmsCredentialsProviderMeta = cmsCredentialsProviderMeta;
2004
2214
  exports.cmsQueryLoaderMeta = cmsQueryLoaderMeta;
2005
2215
  exports.cmsRowFieldMeta = cmsRowFieldMeta;
2216
+ exports.cmsRowFieldValueMeta = cmsRowFieldValueMeta;
2217
+ exports.cmsRowImageMeta = cmsRowImageMeta;
2006
2218
  exports.cmsRowLinkMeta = cmsRowLinkMeta;
2007
2219
  exports.cmsRowLoaderMeta = cmsRowLoaderMeta;
2008
2220
  exports.cmsRowRepeaterMeta = cmsRowRepeaterMeta;