@plasmicapp/loader-core
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,3 +7,3 @@ 'use strict'; | ||
var fetch = _interopDefault(require('isomorphic-fetch')); | ||
var fetch = _interopDefault(require('isomorphic-unfetch')); | ||
@@ -106,196 +106,194 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
var runtime_1 = createCommonjsModule(function (module) { | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) { | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var runtime = function (exports) { | ||
var runtime = (function (exports) { | ||
var Op = Object.prototype; | ||
var hasOwn = Op.hasOwnProperty; | ||
var undefined$1; // More compressible than void 0. | ||
var Op = Object.prototype; | ||
var hasOwn = Op.hasOwnProperty; | ||
var undefined$1; // More compressible than void 0. | ||
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | ||
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | ||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | ||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | ||
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | ||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | ||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
return obj[key]; | ||
} | ||
try { | ||
// IE 8 has a broken Object.defineProperty that only works on DOM objects. | ||
define({}, ""); | ||
} catch (err) { | ||
define = function(obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function define(obj, key, value) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
return obj[key]; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | ||
var generator = Object.create(protoGenerator.prototype); | ||
var context = new Context(tryLocsList || []); | ||
try { | ||
// IE 8 has a broken Object.defineProperty that only works on DOM objects. | ||
define({}, ""); | ||
} catch (err) { | ||
define = function define(obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
// The ._invoke method unifies the implementations of the .next, | ||
// .throw, and .return methods. | ||
generator._invoke = makeInvokeMethod(innerFn, self, context); | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | ||
var generator = Object.create(protoGenerator.prototype); | ||
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, | ||
// .throw, and .return methods. | ||
return generator; | ||
} | ||
exports.wrap = wrap; | ||
generator._invoke = makeInvokeMethod(innerFn, self, context); | ||
return generator; | ||
} | ||
// Try/catch helper to minimize deoptimizations. Returns a completion | ||
// record like context.tryEntries[i].completion. This interface could | ||
// have been (and was previously) designed to take a closure to be | ||
// invoked without arguments, but in all the cases we care about we | ||
// already have an existing method we want to call, so there's no need | ||
// to create a new function object. We can even get away with assuming | ||
// the method takes exactly one argument, since that happens to be true | ||
// in every case, so we don't have to touch the arguments object. The | ||
// only additional allocation required is the completion record, which | ||
// has a stable shape and so hopefully should be cheap to allocate. | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { type: "normal", arg: fn.call(obj, arg) }; | ||
} catch (err) { | ||
return { type: "throw", arg: err }; | ||
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion | ||
// record like context.tryEntries[i].completion. This interface could | ||
// have been (and was previously) designed to take a closure to be | ||
// invoked without arguments, but in all the cases we care about we | ||
// already have an existing method we want to call, so there's no need | ||
// to create a new function object. We can even get away with assuming | ||
// the method takes exactly one argument, since that happens to be true | ||
// in every case, so we don't have to touch the arguments object. The | ||
// only additional allocation required is the completion record, which | ||
// has a stable shape and so hopefully should be cheap to allocate. | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
} | ||
var GenStateSuspendedStart = "suspendedStart"; | ||
var GenStateSuspendedYield = "suspendedYield"; | ||
var GenStateExecuting = "executing"; | ||
var GenStateCompleted = "completed"; | ||
var GenStateSuspendedStart = "suspendedStart"; | ||
var GenStateSuspendedYield = "suspendedYield"; | ||
var GenStateExecuting = "executing"; | ||
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as | ||
// breaking out of the dispatch switch statement. | ||
// Returning this object from the innerFn has the same effect as | ||
// breaking out of the dispatch switch statement. | ||
var ContinueSentinel = {}; | ||
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and | ||
// .constructor.prototype properties for functions that return Generator | ||
// objects. For full spec compliance, you may wish to configure your | ||
// minifier not to mangle the names of these two functions. | ||
// Dummy constructor functions that we use as the .constructor and | ||
// .constructor.prototype properties for functions that return Generator | ||
// objects. For full spec compliance, you may wish to configure your | ||
// minifier not to mangle the names of these two functions. | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
function Generator() {} | ||
// This is a polyfill for %IteratorPrototype% for environments that | ||
// don't natively support it. | ||
var IteratorPrototype = {}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
function GeneratorFunction() {} | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
if (NativeIteratorPrototype && | ||
NativeIteratorPrototype !== Op && | ||
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | ||
// This environment has a native %IteratorPrototype%; use it instead | ||
// of the polyfill. | ||
IteratorPrototype = NativeIteratorPrototype; | ||
} | ||
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that | ||
// don't natively support it. | ||
var Gp = GeneratorFunctionPrototype.prototype = | ||
Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.displayName = define( | ||
GeneratorFunctionPrototype, | ||
toStringTagSymbol, | ||
"GeneratorFunction" | ||
); | ||
// Helper for defining the .next, .throw, and .return methods of the | ||
// Iterator interface in terms of a single ._invoke method. | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function(method) { | ||
define(prototype, method, function(arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
var IteratorPrototype = {}; | ||
exports.isGeneratorFunction = function(genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
return ctor | ||
? ctor === GeneratorFunction || | ||
// For the native GeneratorFunction constructor, the best we can | ||
// do is to check its .name property. | ||
(ctor.displayName || ctor.name) === "GeneratorFunction" | ||
: false; | ||
}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
exports.mark = function(genFun) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
} else { | ||
genFun.__proto__ = GeneratorFunctionPrototype; | ||
define(genFun, toStringTagSymbol, "GeneratorFunction"); | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | ||
// This environment has a native %IteratorPrototype%; use it instead | ||
// of the polyfill. | ||
IteratorPrototype = NativeIteratorPrototype; | ||
} | ||
genFun.prototype = Object.create(Gp); | ||
return genFun; | ||
}; | ||
// Within the body of any async function, `await x` is transformed to | ||
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | ||
// `hasOwn.call(value, "__await")` to determine if the yielded value is | ||
// meant to be awaited. | ||
exports.awrap = function(arg) { | ||
return { __await: arg }; | ||
}; | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the | ||
// Iterator interface in terms of a single ._invoke method. | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if (record.type === "throw") { | ||
reject(record.arg); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function (method) { | ||
define(prototype, method, function (arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
exports.isGeneratorFunction = function (genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can | ||
// do is to check its .name property. | ||
(ctor.displayName || ctor.name) === "GeneratorFunction" : false; | ||
}; | ||
exports.mark = function (genFun) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
} else { | ||
var result = record.arg; | ||
var value = result.value; | ||
if (value && | ||
typeof value === "object" && | ||
hasOwn.call(value, "__await")) { | ||
return PromiseImpl.resolve(value.__await).then(function(value) { | ||
invoke("next", value, resolve, reject); | ||
}, function(err) { | ||
invoke("throw", err, resolve, reject); | ||
genFun.__proto__ = GeneratorFunctionPrototype; | ||
define(genFun, toStringTagSymbol, "GeneratorFunction"); | ||
} | ||
genFun.prototype = Object.create(Gp); | ||
return genFun; | ||
}; // Within the body of any async function, `await x` is transformed to | ||
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | ||
// `hasOwn.call(value, "__await")` to determine if the yielded value is | ||
// meant to be awaited. | ||
exports.awrap = function (arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}; | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if (record.type === "throw") { | ||
reject(record.arg); | ||
} else { | ||
var result = record.arg; | ||
var value = result.value; | ||
if (value && typeof value === "object" && hasOwn.call(value, "__await")) { | ||
return PromiseImpl.resolve(value.__await).then(function (value) { | ||
invoke("next", value, resolve, reject); | ||
}, function (err) { | ||
invoke("throw", err, resolve, reject); | ||
}); | ||
} | ||
return PromiseImpl.resolve(value).then(function (unwrapped) { | ||
// When a yielded Promise is resolved, its final value becomes | ||
// the .value of the Promise<{value,done}> result for the | ||
// current iteration. | ||
result.value = unwrapped; | ||
resolve(result); | ||
}, function (error) { | ||
// If a rejected Promise was yielded, throw the rejection back | ||
// into the async generator function so it can be handled there. | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
return PromiseImpl.resolve(value).then(function(unwrapped) { | ||
// When a yielded Promise is resolved, its final value becomes | ||
// the .value of the Promise<{value,done}> result for the | ||
// current iteration. | ||
result.value = unwrapped; | ||
resolve(result); | ||
}, function(error) { | ||
// If a rejected Promise was yielded, throw the rejection back | ||
// into the async generator function so it can be handled there. | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
} | ||
var previousPromise; | ||
var previousPromise; | ||
function enqueue(method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function(resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
function enqueue(method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function (resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = | ||
// If enqueue has been called before, then we want to wait until | ||
return previousPromise = // If enqueue has been called before, then we want to wait until | ||
// all previous Promises have been resolved before calling invoke, | ||
@@ -312,545 +310,521 @@ // so that results are always delivered in the correct order. If | ||
// important to get this right, even though it requires care. | ||
previousPromise ? previousPromise.then( | ||
callInvokeWithMethodAndArg, | ||
// Avoid propagating failures to Promises returned by later | ||
// invocations of the iterator. | ||
callInvokeWithMethodAndArg | ||
) : callInvokeWithMethodAndArg(); | ||
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later | ||
// invocations of the iterator. | ||
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} // Define the unified helper method that is used to implement .next, | ||
// .throw, and .return (see defineIteratorMethods). | ||
this._invoke = enqueue; | ||
} | ||
// Define the unified helper method that is used to implement .next, | ||
// .throw, and .return (see defineIteratorMethods). | ||
this._invoke = enqueue; | ||
} | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
return this; | ||
}; | ||
exports.AsyncIterator = AsyncIterator; | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
return this; | ||
}; | ||
// Note that simple async functions are implemented on top of | ||
// AsyncIterator objects; they just return a Promise for the value of | ||
// the final result produced by the iterator. | ||
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) PromiseImpl = Promise; | ||
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of | ||
// AsyncIterator objects; they just return a Promise for the value of | ||
// the final result produced by the iterator. | ||
var iter = new AsyncIterator( | ||
wrap(innerFn, outerFn, self, tryLocsList), | ||
PromiseImpl | ||
); | ||
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) PromiseImpl = Promise; | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. | ||
: iter.next().then(function (result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}; | ||
return exports.isGeneratorFunction(outerFn) | ||
? iter // If outerFn is a generator, return the full iterator. | ||
: iter.next().then(function(result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}; | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = GenStateSuspendedStart; | ||
return function invoke(method, arg) { | ||
if (state === GenStateExecuting) { | ||
throw new Error("Generator is already running"); | ||
} | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = GenStateSuspendedStart; | ||
if (state === GenStateCompleted) { | ||
if (method === "throw") { | ||
throw arg; | ||
} // Be forgiving, per 25.3.3.3.3 of the spec: | ||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | ||
return function invoke(method, arg) { | ||
if (state === GenStateExecuting) { | ||
throw new Error("Generator is already running"); | ||
} | ||
if (state === GenStateCompleted) { | ||
if (method === "throw") { | ||
throw arg; | ||
return doneResult(); | ||
} | ||
// Be forgiving, per 25.3.3.3.3 of the spec: | ||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | ||
return doneResult(); | ||
} | ||
context.method = method; | ||
context.arg = arg; | ||
context.method = method; | ||
context.arg = arg; | ||
while (true) { | ||
var delegate = context.delegate; | ||
while (true) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
} | ||
} | ||
} | ||
if (context.method === "next") { | ||
// Setting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
context.sent = context._sent = context.arg; | ||
if (context.method === "next") { | ||
// Setting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
context.sent = context._sent = context.arg; | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw context.arg; | ||
} | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw context.arg; | ||
context.dispatchException(context.arg); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
} | ||
context.dispatchException(context.arg); | ||
state = GenStateExecuting; | ||
var record = tryCatch(innerFn, self, context); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
if (record.type === "normal") { | ||
// If an exception is thrown from innerFn, we leave state === | ||
// GenStateExecuting and loop back for another invocation. | ||
state = context.done ? GenStateCompleted : GenStateSuspendedYield; | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
} | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; // Dispatch the exception by looping back around to the | ||
// context.dispatchException(context.arg) call above. | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
} | ||
} | ||
}; | ||
} // Call delegate.iterator[context.method](context.arg) and handle the | ||
// result, either by returning a { value, done } result from the | ||
// delegate iterator, or by modifying context.method and context.arg, | ||
// setting context.delegate to null, and returning the ContinueSentinel. | ||
state = GenStateExecuting; | ||
var record = tryCatch(innerFn, self, context); | ||
if (record.type === "normal") { | ||
// If an exception is thrown from innerFn, we leave state === | ||
// GenStateExecuting and loop back for another invocation. | ||
state = context.done | ||
? GenStateCompleted | ||
: GenStateSuspendedYield; | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
if (method === undefined$1) { | ||
// A .throw or .return when the delegate iterator has no .throw | ||
// method always terminates the yield* loop. | ||
context.delegate = null; | ||
if (context.method === "throw") { | ||
// Note: ["return"] must be used for ES3 parsing compatibility. | ||
if (delegate.iterator["return"]) { | ||
// If the delegate iterator has a return method, give it a | ||
// chance to clean up. | ||
context.method = "return"; | ||
context.arg = undefined$1; | ||
maybeInvokeDelegate(delegate, context); | ||
if (context.method === "throw") { | ||
// If maybeInvokeDelegate(context) changed context.method from | ||
// "return" to "throw", let that override the TypeError below. | ||
return ContinueSentinel; | ||
} | ||
} | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; | ||
// Dispatch the exception by looping back around to the | ||
// context.dispatchException(context.arg) call above. | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.arg = new TypeError("The iterator does not provide a 'throw' method"); | ||
} | ||
return ContinueSentinel; | ||
} | ||
}; | ||
} | ||
// Call delegate.iterator[context.method](context.arg) and handle the | ||
// result, either by returning a { value, done } result from the | ||
// delegate iterator, or by modifying context.method and context.arg, | ||
// setting context.delegate to null, and returning the ContinueSentinel. | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (method === undefined$1) { | ||
// A .throw or .return when the delegate iterator has no .throw | ||
// method always terminates the yield* loop. | ||
context.delegate = null; | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if (context.method === "throw") { | ||
// Note: ["return"] must be used for ES3 parsing compatibility. | ||
if (delegate.iterator["return"]) { | ||
// If the delegate iterator has a return method, give it a | ||
// chance to clean up. | ||
context.method = "return"; | ||
context.arg = undefined$1; | ||
maybeInvokeDelegate(delegate, context); | ||
if (record.type === "throw") { | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
if (context.method === "throw") { | ||
// If maybeInvokeDelegate(context) changed context.method from | ||
// "return" to "throw", let that override the TypeError below. | ||
return ContinueSentinel; | ||
} | ||
} | ||
var info = record.arg; | ||
if (!info) { | ||
context.method = "throw"; | ||
context.arg = new TypeError( | ||
"The iterator does not provide a 'throw' method"); | ||
context.arg = new TypeError("iterator result is not an object"); | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
return ContinueSentinel; | ||
} | ||
if (info.done) { | ||
// Assign the result of the finished delegate to the temporary | ||
// variable specified by delegate.resultName (see delegateYield). | ||
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the | ||
// exception, let the outer generator proceed normally. If | ||
// context.method was "next", forget context.arg since it has been | ||
// "consumed" by the delegate iterator. If context.method was | ||
// "return", allow the original .return call to continue in the | ||
// outer generator. | ||
if (record.type === "throw") { | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
if (context.method !== "return") { | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
} else { | ||
// Re-yield the result returned by the delegate method. | ||
return info; | ||
} // The delegate iterator is finished, so forget it and continue with | ||
// the outer generator. | ||
var info = record.arg; | ||
if (! info) { | ||
context.method = "throw"; | ||
context.arg = new TypeError("iterator result is not an object"); | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
} // Define Generator.prototype.{next,throw,return} in terms of the | ||
// unified ._invoke helper method. | ||
if (info.done) { | ||
// Assign the result of the finished delegate to the temporary | ||
// variable specified by delegate.resultName (see delegateYield). | ||
context[delegate.resultName] = info.value; | ||
// Resume execution at the desired location (see delegateYield). | ||
context.next = delegate.nextLoc; | ||
defineIteratorMethods(Gp); | ||
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the | ||
// @@iterator function is called on it. Some browsers' implementations of the | ||
// iterator prototype chain incorrectly implement this, causing the Generator | ||
// object to not be returned from this call. This ensures that doesn't happen. | ||
// See https://github.com/facebook/regenerator/issues/274 for more details. | ||
// If context.method was "throw" but the delegate handled the | ||
// exception, let the outer generator proceed normally. If | ||
// context.method was "next", forget context.arg since it has been | ||
// "consumed" by the delegate iterator. If context.method was | ||
// "return", allow the original .return call to continue in the | ||
// outer generator. | ||
if (context.method !== "return") { | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
Gp[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
} else { | ||
// Re-yield the result returned by the delegate method. | ||
return info; | ||
} | ||
Gp.toString = function () { | ||
return "[object Generator]"; | ||
}; | ||
// The delegate iterator is finished, so forget it and continue with | ||
// the outer generator. | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
// Define Generator.prototype.{next,throw,return} in terms of the | ||
// unified ._invoke helper method. | ||
defineIteratorMethods(Gp); | ||
if (1 in locs) { | ||
entry.catchLoc = locs[1]; | ||
} | ||
define(Gp, toStringTagSymbol, "Generator"); | ||
if (2 in locs) { | ||
entry.finallyLoc = locs[2]; | ||
entry.afterLoc = locs[3]; | ||
} | ||
// A Generator should always return itself as the iterator object when the | ||
// @@iterator function is called on it. Some browsers' implementations of the | ||
// iterator prototype chain incorrectly implement this, causing the Generator | ||
// object to not be returned from this call. This ensures that doesn't happen. | ||
// See https://github.com/facebook/regenerator/issues/274 for more details. | ||
Gp[iteratorSymbol] = function() { | ||
return this; | ||
}; | ||
this.tryEntries.push(entry); | ||
} | ||
Gp.toString = function() { | ||
return "[object Generator]"; | ||
}; | ||
function pushTryEntry(locs) { | ||
var entry = { tryLoc: locs[0] }; | ||
if (1 in locs) { | ||
entry.catchLoc = locs[1]; | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal"; | ||
delete record.arg; | ||
entry.completion = record; | ||
} | ||
if (2 in locs) { | ||
entry.finallyLoc = locs[2]; | ||
entry.afterLoc = locs[3]; | ||
function Context(tryLocsList) { | ||
// The root entry object (effectively a try statement without a catch | ||
// or a finally block) gives us a place to store values thrown from | ||
// locations where there is no enclosing try statement. | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}]; | ||
tryLocsList.forEach(pushTryEntry, this); | ||
this.reset(true); | ||
} | ||
this.tryEntries.push(entry); | ||
} | ||
exports.keys = function (object) { | ||
var keys = []; | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal"; | ||
delete record.arg; | ||
entry.completion = record; | ||
} | ||
for (var key in object) { | ||
keys.push(key); | ||
} | ||
function Context(tryLocsList) { | ||
// The root entry object (effectively a try statement without a catch | ||
// or a finally block) gives us a place to store values thrown from | ||
// locations where there is no enclosing try statement. | ||
this.tryEntries = [{ tryLoc: "root" }]; | ||
tryLocsList.forEach(pushTryEntry, this); | ||
this.reset(true); | ||
} | ||
keys.reverse(); // Rather than returning an object with a next method, we keep | ||
// things simple and return the next function itself. | ||
exports.keys = function(object) { | ||
var keys = []; | ||
for (var key in object) { | ||
keys.push(key); | ||
} | ||
keys.reverse(); | ||
return function next() { | ||
while (keys.length) { | ||
var key = keys.pop(); | ||
// Rather than returning an object with a next method, we keep | ||
// things simple and return the next function itself. | ||
return function next() { | ||
while (keys.length) { | ||
var key = keys.pop(); | ||
if (key in object) { | ||
next.value = key; | ||
next.done = false; | ||
return next; | ||
} | ||
} | ||
if (key in object) { | ||
next.value = key; | ||
next.done = false; | ||
return next; | ||
} | ||
} // To avoid creating an additional object, we just hang the .value | ||
// and .done properties off the next function object itself. This | ||
// also ensures that the minifier will not anonymize the function. | ||
// To avoid creating an additional object, we just hang the .value | ||
// and .done properties off the next function object itself. This | ||
// also ensures that the minifier will not anonymize the function. | ||
next.done = true; | ||
return next; | ||
next.done = true; | ||
return next; | ||
}; | ||
}; | ||
}; | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) { | ||
return iteratorMethod.call(iterable); | ||
} | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (typeof iterable.next === "function") { | ||
return iterable; | ||
} | ||
if (iteratorMethod) { | ||
return iteratorMethod.call(iterable); | ||
} | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, next = function next() { | ||
while (++i < iterable.length) { | ||
if (hasOwn.call(iterable, i)) { | ||
next.value = iterable[i]; | ||
next.done = false; | ||
return next; | ||
if (typeof iterable.next === "function") { | ||
return iterable; | ||
} | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, | ||
next = function next() { | ||
while (++i < iterable.length) { | ||
if (hasOwn.call(iterable, i)) { | ||
next.value = iterable[i]; | ||
next.done = false; | ||
return next; | ||
} | ||
} | ||
} | ||
next.value = undefined$1; | ||
next.done = true; | ||
next.value = undefined$1; | ||
next.done = true; | ||
return next; | ||
}; | ||
return next; | ||
}; | ||
return next.next = next; | ||
} | ||
} // Return an iterator with no values. | ||
return next.next = next; | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
// Return an iterator with no values. | ||
return { next: doneResult }; | ||
} | ||
exports.values = values; | ||
exports.values = values; | ||
function doneResult() { | ||
return { value: undefined$1, done: true }; | ||
} | ||
function doneResult() { | ||
return { | ||
value: undefined$1, | ||
done: true | ||
}; | ||
} | ||
Context.prototype = { | ||
constructor: Context, | ||
Context.prototype = { | ||
constructor: Context, | ||
reset: function reset(skipTempReset) { | ||
this.prev = 0; | ||
this.next = 0; // Resetting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
reset: function(skipTempReset) { | ||
this.prev = 0; | ||
this.next = 0; | ||
// Resetting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
this.sent = this._sent = undefined$1; | ||
this.done = false; | ||
this.delegate = null; | ||
this.sent = this._sent = undefined$1; | ||
this.done = false; | ||
this.delegate = null; | ||
this.method = "next"; | ||
this.arg = undefined$1; | ||
this.tryEntries.forEach(resetTryEntry); | ||
this.method = "next"; | ||
this.arg = undefined$1; | ||
this.tryEntries.forEach(resetTryEntry); | ||
if (!skipTempReset) { | ||
for (var name in this) { | ||
// Not sure about the optimal order of these conditions: | ||
if (name.charAt(0) === "t" && | ||
hasOwn.call(this, name) && | ||
!isNaN(+name.slice(1))) { | ||
this[name] = undefined$1; | ||
if (!skipTempReset) { | ||
for (var name in this) { | ||
// Not sure about the optimal order of these conditions: | ||
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { | ||
this[name] = undefined$1; | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
stop: function stop() { | ||
this.done = true; | ||
var rootEntry = this.tryEntries[0]; | ||
var rootRecord = rootEntry.completion; | ||
stop: function() { | ||
this.done = true; | ||
if (rootRecord.type === "throw") { | ||
throw rootRecord.arg; | ||
} | ||
var rootEntry = this.tryEntries[0]; | ||
var rootRecord = rootEntry.completion; | ||
if (rootRecord.type === "throw") { | ||
throw rootRecord.arg; | ||
} | ||
return this.rval; | ||
}, | ||
dispatchException: function dispatchException(exception) { | ||
if (this.done) { | ||
throw exception; | ||
} | ||
return this.rval; | ||
}, | ||
var context = this; | ||
dispatchException: function(exception) { | ||
if (this.done) { | ||
throw exception; | ||
} | ||
function handle(loc, caught) { | ||
record.type = "throw"; | ||
record.arg = exception; | ||
context.next = loc; | ||
var context = this; | ||
function handle(loc, caught) { | ||
record.type = "throw"; | ||
record.arg = exception; | ||
context.next = loc; | ||
if (caught) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
if (caught) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
return !!caught; | ||
} | ||
return !! caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
var record = entry.completion; | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
var record = entry.completion; | ||
if (entry.tryLoc === "root") { | ||
// Exception thrown outside of any try block that could handle | ||
// it, so set the completion value of the entire function to | ||
// throw the exception. | ||
return handle("end"); | ||
} | ||
if (entry.tryLoc === "root") { | ||
// Exception thrown outside of any try block that could handle | ||
// it, so set the completion value of the entire function to | ||
// throw the exception. | ||
return handle("end"); | ||
} | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"); | ||
var hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"); | ||
var hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} else if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} else if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} | ||
} else if (hasFinally) { | ||
if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else { | ||
throw new Error("try statement without catch or finally"); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function abrupt(type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} | ||
} else if (hasFinally) { | ||
if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else { | ||
throw new Error("try statement without catch or finally"); | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function(type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && | ||
hasOwn.call(entry, "finallyLoc") && | ||
this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { | ||
// Ignore the finally entry if control is not jumping to a | ||
// location outside the try/catch block. | ||
finallyEntry = null; | ||
} | ||
} | ||
if (finallyEntry && | ||
(type === "break" || | ||
type === "continue") && | ||
finallyEntry.tryLoc <= arg && | ||
arg <= finallyEntry.finallyLoc) { | ||
// Ignore the finally entry if control is not jumping to a | ||
// location outside the try/catch block. | ||
finallyEntry = null; | ||
} | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
record.type = type; | ||
record.arg = arg; | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
record.type = type; | ||
record.arg = arg; | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
return ContinueSentinel; | ||
} | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
return ContinueSentinel; | ||
} | ||
return this.complete(record); | ||
}, | ||
complete: function complete(record, afterLoc) { | ||
if (record.type === "throw") { | ||
throw record.arg; | ||
} | ||
return this.complete(record); | ||
}, | ||
if (record.type === "break" || record.type === "continue") { | ||
this.next = record.arg; | ||
} else if (record.type === "return") { | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
} else if (record.type === "normal" && afterLoc) { | ||
this.next = afterLoc; | ||
} | ||
complete: function(record, afterLoc) { | ||
if (record.type === "throw") { | ||
throw record.arg; | ||
} | ||
return ContinueSentinel; | ||
}, | ||
finish: function finish(finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (record.type === "break" || | ||
record.type === "continue") { | ||
this.next = record.arg; | ||
} else if (record.type === "return") { | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
} else if (record.type === "normal" && afterLoc) { | ||
this.next = afterLoc; | ||
} | ||
if (entry.finallyLoc === finallyLoc) { | ||
this.complete(entry.completion, entry.afterLoc); | ||
resetTryEntry(entry); | ||
return ContinueSentinel; | ||
} | ||
} | ||
}, | ||
"catch": function _catch(tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
return ContinueSentinel; | ||
}, | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
finish: function(finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) { | ||
this.complete(entry.completion, entry.afterLoc); | ||
resetTryEntry(entry); | ||
return ContinueSentinel; | ||
} | ||
} | ||
}, | ||
if (record.type === "throw") { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
"catch": function(tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if (record.type === "throw") { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
return thrown; | ||
} | ||
return thrown; | ||
} | ||
} | ||
} // The context.catch method must only be called with a location | ||
// argument that corresponds to a known catch block. | ||
// The context.catch method must only be called with a location | ||
// argument that corresponds to a known catch block. | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function(iterable, resultName, nextLoc) { | ||
this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}; | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function delegateYield(iterable, resultName, nextLoc) { | ||
this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}; | ||
if (this.method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
this.arg = undefined$1; | ||
if (this.method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
this.arg = undefined$1; | ||
} | ||
return ContinueSentinel; | ||
} | ||
}; // Regardless of whether this script is executing as a CommonJS module | ||
// or not, return the runtime object so that we can declare the variable | ||
// regeneratorRuntime in the outer scope, which allows this module to be | ||
// injected easily by `bin/regenerator --include-runtime script.js`. | ||
return ContinueSentinel; | ||
} | ||
}; | ||
// Regardless of whether this script is executing as a CommonJS module | ||
// or not, return the runtime object so that we can declare the variable | ||
// regeneratorRuntime in the outer scope, which allows this module to be | ||
// injected easily by `bin/regenerator --include-runtime script.js`. | ||
return exports; | ||
}( | ||
// If this script is executing as a CommonJS module, use module.exports | ||
return exports; | ||
}( // If this script is executing as a CommonJS module, use module.exports | ||
// as the regeneratorRuntime namespace. Otherwise create a new empty | ||
// object. Either way, the resulting object will be used to initialize | ||
// the regeneratorRuntime variable at the top of this file. | ||
module.exports | ||
)); | ||
module.exports ); | ||
try { | ||
regeneratorRuntime = runtime; | ||
} catch (accidentalStrictMode) { | ||
// This module should not be running in strict mode, so the above | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
// if a Content Security Policy forbids using Function, but in that case | ||
// the proper solution is to fix the accidental strict mode problem. If | ||
// you've misconfigured your bundler to force strict mode and applied a | ||
// CSP to forbid Function, and you're not willing to fix either of those | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
try { | ||
regeneratorRuntime = runtime; | ||
} catch (accidentalStrictMode) { | ||
// This module should not be running in strict mode, so the above | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
// if a Content Security Policy forbids using Function, but in that case | ||
// the proper solution is to fix the accidental strict mode problem. If | ||
// you've misconfigured your bundler to force strict mode and applied a | ||
// CSP to forbid Function, and you're not willing to fix either of those | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
}); | ||
@@ -1107,3 +1081,3 @@ | ||
if (!this.opts.cache) { | ||
_context.next = 7; | ||
_context.next = 6; | ||
break; | ||
@@ -1119,32 +1093,30 @@ } | ||
if (!cachedData) { | ||
_context.next = 7; | ||
_context.next = 6; | ||
break; | ||
} | ||
console.log('Using cached data'); | ||
return _context.abrupt("return", cachedData); | ||
case 7: | ||
case 6: | ||
if (!this.curFetch) { | ||
_context.next = 12; | ||
_context.next = 10; | ||
break; | ||
} | ||
console.log('Awaiting in-process fetch'); | ||
_context.next = 11; | ||
_context.next = 9; | ||
return this.curFetch; | ||
case 11: | ||
case 9: | ||
return _context.abrupt("return", _context.sent); | ||
case 12: | ||
console.log('Doing a fresh fetch...'); | ||
case 10: | ||
console.debug('PlasmicLoader: doing a fresh fetch...'); | ||
this.curFetch = this.doFetch(); | ||
_context.next = 16; | ||
_context.next = 14; | ||
return this.curFetch; | ||
case 16: | ||
case 14: | ||
return _context.abrupt("return", _context.sent); | ||
case 17: | ||
case 15: | ||
case "end": | ||
@@ -1193,6 +1165,5 @@ return _context.stop(); | ||
case 6: | ||
console.log('Finished fresh fetch'); | ||
return _context2.abrupt("return", data); | ||
case 8: | ||
case 7: | ||
case "end": | ||
@@ -1199,0 +1170,0 @@ return _context2.stop(); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("isomorphic-fetch"))&&"object"==typeof t&&"default"in t?t.default:t;function r(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function s(t){r(a,o,i,s,u,"next",t)}function u(t){r(a,o,i,s,u,"throw",t)}s(void 0)}))}}function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return i(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=x(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function l(){}function f(){}function d(){}var p={};p[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,o)&&(p=y);var m=d.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,s){var u=c(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=m.constructor=d,d.constructor=f,f.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),w.prototype[i]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),s(m,a,"Generator"),m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(s={exports:{}}),s.exports),c=function(){function t(t){var e;this.opts=t,this.host=null!=(e=t.host)?e:"https://studio.plasmic.app"}var r=t.prototype;return r.fetchLoaderData=function(){var t=n(u.mark((function t(r,n){var o,i,a,s,c,h,l,f;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.platform,i=n.preview,a=new URLSearchParams([["platform",null!=o?o:"react"]].concat(r.map((function(t){return["projectId",t]})))).toString(),s=this.host+"/api/v1/loader/code/"+(i?"preview":"published")+"?"+a,t.next=5,e(s,{method:"GET",headers:this.makeGetHeaders()});case 5:if(!((c=t.sent).status>=400)){t.next=11;break}return t.next=9,c.json();case 9:throw f=t.sent,new Error(null!=(h=null==f||null==(l=f.error)?void 0:l.message)?h:c.statusText);case 11:return t.next=13,c.json();case 13:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.fetchHtmlData=function(){var t=n(u.mark((function t(r){var n,o;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URLSearchParams([["projectId",r.projectId],["component",r.component],["embedHydrate",r.embedHydrate?"1":"0"],["hydrate",r.hydrate?"1":"0"]]).toString(),t.next=4,e(this.host+"/api/v1/loader/html?"+n,{method:"GET",headers:this.makeGetHeaders()});case 4:return o=t.sent,t.next=7,o.json();case 7:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.makeGetHeaders=function(){return o({},this.makeAuthHeaders())},r.makePostHeaders=function(){return o({"Content-Type":"application/json"},this.makeAuthHeaders())},r.makeAuthHeaders=function(){return{"x-plasmic-api-project-tokens":this.opts.projects.map((function(t){return t.id+":"+t.token})).join(",")}},t}(),h=function(){function t(t){this.bundle=t,this.dependsOn={},this.dependedBy={},this.rebuildGraph()}var e=t.prototype;return e.getTransitiveDependers=function(t){return this.transitiveCrawl(t,this.dependedBy)},e.getTransitiveDeps=function(t){return t in this.dependsOn?this.transitiveCrawl(t,this.dependsOn):[]},e.transitiveCrawl=function(t,e){for(var r,n=new Set,o=function t(r){if(!n.has(r)){n.add(r);for(var o,i=a(null!=(s=e[r])?s:[]);!(o=i()).done;){var s;t(o.value)}}},i=a(e[t]);!(r=i()).done;)o(r.value);return Array.from(n)},e.rebuildGraph=function(){this.dependedBy={},this.dependsOn={};for(var t,e=a(this.bundle.modules);!(t=e()).done;){var r=t.value;if("code"===r.type)for(var n,o=a(r.imports);!(n=o()).done;){var i=n.value;r.fileName in this.dependsOn?this.dependsOn[r.fileName].push(i):this.dependsOn[r.fileName]=[i],i in this.dependedBy?this.dependedBy[i].push(r.fileName):this.dependedBy[i]=[r.fileName]}}},t}(),l=function(){function t(t){this.opts=t,this.curFetch=void 0,this.api=new c({projects:t.projects,host:t.host})}var e=t.prototype;return e.fetchAllData=function(){var t=n(u.mark((function t(){var e;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.opts.cache){t.next=7;break}return t.next=3,this.opts.cache.get();case 3:if(!(e=t.sent)){t.next=7;break}return console.log("Using cached data"),t.abrupt("return",e);case 7:if(!this.curFetch){t.next=12;break}return console.log("Awaiting in-process fetch"),t.next=11,this.curFetch;case 11:return t.abrupt("return",t.sent);case 12:return console.log("Doing a fresh fetch..."),this.curFetch=this.doFetch(),t.next=16,this.curFetch;case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.doFetch=function(){var t=n(u.mark((function t(){var e,r=this;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.api.fetchLoaderData(this.opts.projects.map((function(t){return t.version&&!r.opts.preview?t.id+"@"+t.version:t.id})),{platform:this.opts.platform,preview:this.opts.preview});case 2:if(e=t.sent,!this.opts.cache){t.next=6;break}return t.next=6,this.opts.cache.set(e);case 6:return console.log("Finished fresh fetch"),t.abrupt("return",e);case 8:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),f=function(){function t(){this.loadedModules={},this.registeredModules={},this.modules={}}var e=t.prototype;return e.register=function(t,e){this.registeredModules[t]=e},e.isEmpty=function(){return 0===Object.keys(this.loadedModules).length},e.clear=function(){this.loadedModules={}},e.hasModule=function(t,e){return void 0===e&&(e={}),t in this.registeredModules&&!e.forceOriginal||t in this.modules},e.load=function(t,e){var r=this;if(void 0===e&&(e={}),t in this.registeredModules&&!e.forceOriginal)return this.registeredModules[t];if(t in this.loadedModules)return this.loadedModules[t];if(!(t in this.modules))throw new Error("Unknown module "+t);var n=new Function("require","exports",this.modules[t]),o={};return this.loadedModules[t]=o,n((function(e){var n=function(t,e){var r=e.split("/"),n=t.split("/");if(0===n.length)return t;if("."===n[0])return[].concat(r.slice(0,r.length-1),n.slice(1)).join("/");if(".."===n[0]){for(var o,i=0,s=a(n);!(o=s()).done&&".."===o.value;)i+=1;return[].concat(r.slice(0,r.length-i-1),n.slice(i)).join("/")}return t}(e,t);return r.load(n)}),o),o},e.updateModules=function(t){for(var e,r=!1,n=a(t.modules);!(e=n()).done;){var o=e.value;"code"===o.type&&o.code!==this.modules[o.fileName]&&(this.modules[o.fileName]=o.code,r=!0)}r&&this.clear()},t}();exports.Api=c,exports.PlasmicModulesFetcher=l,exports.Registry=f,exports.getBundleSubset=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var o=new h(t),i=new Set(r.flatMap((function(t){return o.getTransitiveDeps(t)})));return{modules:t.modules.filter((function(t){return i.has(t.fileName)||r.includes(t.fileName)})),external:t.external.filter((function(t){return i.has(t)})),components:t.components,globalGroups:t.globalGroups,projects:t.projects}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("isomorphic-unfetch"))&&"object"==typeof t&&"default"in t?t.default:t;function r(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function s(t){r(a,o,i,s,u,"next",t)}function u(t){r(a,o,i,s,u,"throw",t)}s(void 0)}))}}function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return i(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){return t(e={exports:{}},e.exports),e.exports}var u=s((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=x(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function l(){}function f(){}function d(){}var p={};p[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,o)&&(p=y);var m=d.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,s){var u=c(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=m.constructor=d,d.constructor=f,f.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),w.prototype[i]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),s(m,a,"Generator"),m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}})),c=function(){function t(t){var e;this.opts=t,this.host=null!=(e=t.host)?e:"https://studio.plasmic.app"}var r=t.prototype;return r.fetchLoaderData=function(){var t=n(u.mark((function t(r,n){var o,i,a,s,c,h,l,f;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.platform,i=n.preview,a=new URLSearchParams([["platform",null!=o?o:"react"]].concat(r.map((function(t){return["projectId",t]})))).toString(),s=this.host+"/api/v1/loader/code/"+(i?"preview":"published")+"?"+a,t.next=5,e(s,{method:"GET",headers:this.makeGetHeaders()});case 5:if(!((c=t.sent).status>=400)){t.next=11;break}return t.next=9,c.json();case 9:throw f=t.sent,new Error(null!=(h=null==f||null==(l=f.error)?void 0:l.message)?h:c.statusText);case 11:return t.next=13,c.json();case 13:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.fetchHtmlData=function(){var t=n(u.mark((function t(r){var n,o;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URLSearchParams([["projectId",r.projectId],["component",r.component],["embedHydrate",r.embedHydrate?"1":"0"],["hydrate",r.hydrate?"1":"0"]]).toString(),t.next=4,e(this.host+"/api/v1/loader/html?"+n,{method:"GET",headers:this.makeGetHeaders()});case 4:return o=t.sent,t.next=7,o.json();case 7:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),r.makeGetHeaders=function(){return o({},this.makeAuthHeaders())},r.makePostHeaders=function(){return o({"Content-Type":"application/json"},this.makeAuthHeaders())},r.makeAuthHeaders=function(){return{"x-plasmic-api-project-tokens":this.opts.projects.map((function(t){return t.id+":"+t.token})).join(",")}},t}(),h=function(){function t(t){this.bundle=t,this.dependsOn={},this.dependedBy={},this.rebuildGraph()}var e=t.prototype;return e.getTransitiveDependers=function(t){return this.transitiveCrawl(t,this.dependedBy)},e.getTransitiveDeps=function(t){return t in this.dependsOn?this.transitiveCrawl(t,this.dependsOn):[]},e.transitiveCrawl=function(t,e){for(var r,n=new Set,o=function t(r){if(!n.has(r)){n.add(r);for(var o,i=a(null!=(s=e[r])?s:[]);!(o=i()).done;){var s;t(o.value)}}},i=a(e[t]);!(r=i()).done;)o(r.value);return Array.from(n)},e.rebuildGraph=function(){this.dependedBy={},this.dependsOn={};for(var t,e=a(this.bundle.modules);!(t=e()).done;){var r=t.value;if("code"===r.type)for(var n,o=a(r.imports);!(n=o()).done;){var i=n.value;r.fileName in this.dependsOn?this.dependsOn[r.fileName].push(i):this.dependsOn[r.fileName]=[i],i in this.dependedBy?this.dependedBy[i].push(r.fileName):this.dependedBy[i]=[r.fileName]}}},t}(),l=function(){function t(t){this.opts=t,this.curFetch=void 0,this.api=new c({projects:t.projects,host:t.host})}var e=t.prototype;return e.fetchAllData=function(){var t=n(u.mark((function t(){var e;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.opts.cache){t.next=6;break}return t.next=3,this.opts.cache.get();case 3:if(!(e=t.sent)){t.next=6;break}return t.abrupt("return",e);case 6:if(!this.curFetch){t.next=10;break}return t.next=9,this.curFetch;case 9:return t.abrupt("return",t.sent);case 10:return console.debug("PlasmicLoader: doing a fresh fetch..."),this.curFetch=this.doFetch(),t.next=14,this.curFetch;case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.doFetch=function(){var t=n(u.mark((function t(){var e,r=this;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.api.fetchLoaderData(this.opts.projects.map((function(t){return t.version&&!r.opts.preview?t.id+"@"+t.version:t.id})),{platform:this.opts.platform,preview:this.opts.preview});case 2:if(e=t.sent,!this.opts.cache){t.next=6;break}return t.next=6,this.opts.cache.set(e);case 6:return t.abrupt("return",e);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),t}(),f=function(){function t(){this.loadedModules={},this.registeredModules={},this.modules={}}var e=t.prototype;return e.register=function(t,e){this.registeredModules[t]=e},e.isEmpty=function(){return 0===Object.keys(this.loadedModules).length},e.clear=function(){this.loadedModules={}},e.hasModule=function(t,e){return void 0===e&&(e={}),t in this.registeredModules&&!e.forceOriginal||t in this.modules},e.load=function(t,e){var r=this;if(void 0===e&&(e={}),t in this.registeredModules&&!e.forceOriginal)return this.registeredModules[t];if(t in this.loadedModules)return this.loadedModules[t];if(!(t in this.modules))throw new Error("Unknown module "+t);var n=new Function("require","exports",this.modules[t]),o={};return this.loadedModules[t]=o,n((function(e){var n=function(t,e){var r=e.split("/"),n=t.split("/");if(0===n.length)return t;if("."===n[0])return[].concat(r.slice(0,r.length-1),n.slice(1)).join("/");if(".."===n[0]){for(var o,i=0,s=a(n);!(o=s()).done&&".."===o.value;)i+=1;return[].concat(r.slice(0,r.length-i-1),n.slice(i)).join("/")}return t}(e,t);return r.load(n)}),o),o},e.updateModules=function(t){for(var e,r=!1,n=a(t.modules);!(e=n()).done;){var o=e.value;"code"===o.type&&o.code!==this.modules[o.fileName]&&(this.modules[o.fileName]=o.code,r=!0)}r&&this.clear()},t}();exports.Api=c,exports.PlasmicModulesFetcher=l,exports.Registry=f,exports.getBundleSubset=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var o=new h(t),i=new Set(r.flatMap((function(t){return o.getTransitiveDeps(t)})));return{modules:t.modules.filter((function(t){return i.has(t.fileName)||r.includes(t.fileName)})),external:t.external.filter((function(t){return i.has(t)})),components:t.components,globalGroups:t.globalGroups,projects:t.projects}}; | ||
//# sourceMappingURL=loader-core.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import fetch from 'isomorphic-fetch'; | ||
import fetch from 'isomorphic-unfetch'; | ||
@@ -99,196 +99,194 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
var runtime_1 = createCommonjsModule(function (module) { | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) { | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var runtime = function (exports) { | ||
var runtime = (function (exports) { | ||
var Op = Object.prototype; | ||
var hasOwn = Op.hasOwnProperty; | ||
var undefined$1; // More compressible than void 0. | ||
var Op = Object.prototype; | ||
var hasOwn = Op.hasOwnProperty; | ||
var undefined$1; // More compressible than void 0. | ||
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | ||
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | ||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | ||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | ||
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | ||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | ||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
return obj[key]; | ||
} | ||
try { | ||
// IE 8 has a broken Object.defineProperty that only works on DOM objects. | ||
define({}, ""); | ||
} catch (err) { | ||
define = function(obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function define(obj, key, value) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
return obj[key]; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | ||
var generator = Object.create(protoGenerator.prototype); | ||
var context = new Context(tryLocsList || []); | ||
try { | ||
// IE 8 has a broken Object.defineProperty that only works on DOM objects. | ||
define({}, ""); | ||
} catch (err) { | ||
define = function define(obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
// The ._invoke method unifies the implementations of the .next, | ||
// .throw, and .return methods. | ||
generator._invoke = makeInvokeMethod(innerFn, self, context); | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | ||
var generator = Object.create(protoGenerator.prototype); | ||
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, | ||
// .throw, and .return methods. | ||
return generator; | ||
} | ||
exports.wrap = wrap; | ||
generator._invoke = makeInvokeMethod(innerFn, self, context); | ||
return generator; | ||
} | ||
// Try/catch helper to minimize deoptimizations. Returns a completion | ||
// record like context.tryEntries[i].completion. This interface could | ||
// have been (and was previously) designed to take a closure to be | ||
// invoked without arguments, but in all the cases we care about we | ||
// already have an existing method we want to call, so there's no need | ||
// to create a new function object. We can even get away with assuming | ||
// the method takes exactly one argument, since that happens to be true | ||
// in every case, so we don't have to touch the arguments object. The | ||
// only additional allocation required is the completion record, which | ||
// has a stable shape and so hopefully should be cheap to allocate. | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { type: "normal", arg: fn.call(obj, arg) }; | ||
} catch (err) { | ||
return { type: "throw", arg: err }; | ||
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion | ||
// record like context.tryEntries[i].completion. This interface could | ||
// have been (and was previously) designed to take a closure to be | ||
// invoked without arguments, but in all the cases we care about we | ||
// already have an existing method we want to call, so there's no need | ||
// to create a new function object. We can even get away with assuming | ||
// the method takes exactly one argument, since that happens to be true | ||
// in every case, so we don't have to touch the arguments object. The | ||
// only additional allocation required is the completion record, which | ||
// has a stable shape and so hopefully should be cheap to allocate. | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
} | ||
var GenStateSuspendedStart = "suspendedStart"; | ||
var GenStateSuspendedYield = "suspendedYield"; | ||
var GenStateExecuting = "executing"; | ||
var GenStateCompleted = "completed"; | ||
var GenStateSuspendedStart = "suspendedStart"; | ||
var GenStateSuspendedYield = "suspendedYield"; | ||
var GenStateExecuting = "executing"; | ||
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as | ||
// breaking out of the dispatch switch statement. | ||
// Returning this object from the innerFn has the same effect as | ||
// breaking out of the dispatch switch statement. | ||
var ContinueSentinel = {}; | ||
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and | ||
// .constructor.prototype properties for functions that return Generator | ||
// objects. For full spec compliance, you may wish to configure your | ||
// minifier not to mangle the names of these two functions. | ||
// Dummy constructor functions that we use as the .constructor and | ||
// .constructor.prototype properties for functions that return Generator | ||
// objects. For full spec compliance, you may wish to configure your | ||
// minifier not to mangle the names of these two functions. | ||
function Generator() {} | ||
function GeneratorFunction() {} | ||
function GeneratorFunctionPrototype() {} | ||
function Generator() {} | ||
// This is a polyfill for %IteratorPrototype% for environments that | ||
// don't natively support it. | ||
var IteratorPrototype = {}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
function GeneratorFunction() {} | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
if (NativeIteratorPrototype && | ||
NativeIteratorPrototype !== Op && | ||
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | ||
// This environment has a native %IteratorPrototype%; use it instead | ||
// of the polyfill. | ||
IteratorPrototype = NativeIteratorPrototype; | ||
} | ||
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that | ||
// don't natively support it. | ||
var Gp = GeneratorFunctionPrototype.prototype = | ||
Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.displayName = define( | ||
GeneratorFunctionPrototype, | ||
toStringTagSymbol, | ||
"GeneratorFunction" | ||
); | ||
// Helper for defining the .next, .throw, and .return methods of the | ||
// Iterator interface in terms of a single ._invoke method. | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function(method) { | ||
define(prototype, method, function(arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
var IteratorPrototype = {}; | ||
exports.isGeneratorFunction = function(genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
return ctor | ||
? ctor === GeneratorFunction || | ||
// For the native GeneratorFunction constructor, the best we can | ||
// do is to check its .name property. | ||
(ctor.displayName || ctor.name) === "GeneratorFunction" | ||
: false; | ||
}; | ||
IteratorPrototype[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
exports.mark = function(genFun) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
} else { | ||
genFun.__proto__ = GeneratorFunctionPrototype; | ||
define(genFun, toStringTagSymbol, "GeneratorFunction"); | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | ||
// This environment has a native %IteratorPrototype%; use it instead | ||
// of the polyfill. | ||
IteratorPrototype = NativeIteratorPrototype; | ||
} | ||
genFun.prototype = Object.create(Gp); | ||
return genFun; | ||
}; | ||
// Within the body of any async function, `await x` is transformed to | ||
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | ||
// `hasOwn.call(value, "__await")` to determine if the yielded value is | ||
// meant to be awaited. | ||
exports.awrap = function(arg) { | ||
return { __await: arg }; | ||
}; | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; | ||
GeneratorFunctionPrototype.constructor = GeneratorFunction; | ||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the | ||
// Iterator interface in terms of a single ._invoke method. | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if (record.type === "throw") { | ||
reject(record.arg); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function (method) { | ||
define(prototype, method, function (arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
exports.isGeneratorFunction = function (genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can | ||
// do is to check its .name property. | ||
(ctor.displayName || ctor.name) === "GeneratorFunction" : false; | ||
}; | ||
exports.mark = function (genFun) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
} else { | ||
var result = record.arg; | ||
var value = result.value; | ||
if (value && | ||
typeof value === "object" && | ||
hasOwn.call(value, "__await")) { | ||
return PromiseImpl.resolve(value.__await).then(function(value) { | ||
invoke("next", value, resolve, reject); | ||
}, function(err) { | ||
invoke("throw", err, resolve, reject); | ||
genFun.__proto__ = GeneratorFunctionPrototype; | ||
define(genFun, toStringTagSymbol, "GeneratorFunction"); | ||
} | ||
genFun.prototype = Object.create(Gp); | ||
return genFun; | ||
}; // Within the body of any async function, `await x` is transformed to | ||
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test | ||
// `hasOwn.call(value, "__await")` to determine if the yielded value is | ||
// meant to be awaited. | ||
exports.awrap = function (arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}; | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if (record.type === "throw") { | ||
reject(record.arg); | ||
} else { | ||
var result = record.arg; | ||
var value = result.value; | ||
if (value && typeof value === "object" && hasOwn.call(value, "__await")) { | ||
return PromiseImpl.resolve(value.__await).then(function (value) { | ||
invoke("next", value, resolve, reject); | ||
}, function (err) { | ||
invoke("throw", err, resolve, reject); | ||
}); | ||
} | ||
return PromiseImpl.resolve(value).then(function (unwrapped) { | ||
// When a yielded Promise is resolved, its final value becomes | ||
// the .value of the Promise<{value,done}> result for the | ||
// current iteration. | ||
result.value = unwrapped; | ||
resolve(result); | ||
}, function (error) { | ||
// If a rejected Promise was yielded, throw the rejection back | ||
// into the async generator function so it can be handled there. | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
return PromiseImpl.resolve(value).then(function(unwrapped) { | ||
// When a yielded Promise is resolved, its final value becomes | ||
// the .value of the Promise<{value,done}> result for the | ||
// current iteration. | ||
result.value = unwrapped; | ||
resolve(result); | ||
}, function(error) { | ||
// If a rejected Promise was yielded, throw the rejection back | ||
// into the async generator function so it can be handled there. | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
} | ||
var previousPromise; | ||
var previousPromise; | ||
function enqueue(method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function(resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
function enqueue(method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function (resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = | ||
// If enqueue has been called before, then we want to wait until | ||
return previousPromise = // If enqueue has been called before, then we want to wait until | ||
// all previous Promises have been resolved before calling invoke, | ||
@@ -305,545 +303,521 @@ // so that results are always delivered in the correct order. If | ||
// important to get this right, even though it requires care. | ||
previousPromise ? previousPromise.then( | ||
callInvokeWithMethodAndArg, | ||
// Avoid propagating failures to Promises returned by later | ||
// invocations of the iterator. | ||
callInvokeWithMethodAndArg | ||
) : callInvokeWithMethodAndArg(); | ||
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later | ||
// invocations of the iterator. | ||
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} // Define the unified helper method that is used to implement .next, | ||
// .throw, and .return (see defineIteratorMethods). | ||
this._invoke = enqueue; | ||
} | ||
// Define the unified helper method that is used to implement .next, | ||
// .throw, and .return (see defineIteratorMethods). | ||
this._invoke = enqueue; | ||
} | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
return this; | ||
}; | ||
exports.AsyncIterator = AsyncIterator; | ||
AsyncIterator.prototype[asyncIteratorSymbol] = function () { | ||
return this; | ||
}; | ||
// Note that simple async functions are implemented on top of | ||
// AsyncIterator objects; they just return a Promise for the value of | ||
// the final result produced by the iterator. | ||
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) PromiseImpl = Promise; | ||
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of | ||
// AsyncIterator objects; they just return a Promise for the value of | ||
// the final result produced by the iterator. | ||
var iter = new AsyncIterator( | ||
wrap(innerFn, outerFn, self, tryLocsList), | ||
PromiseImpl | ||
); | ||
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) PromiseImpl = Promise; | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. | ||
: iter.next().then(function (result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}; | ||
return exports.isGeneratorFunction(outerFn) | ||
? iter // If outerFn is a generator, return the full iterator. | ||
: iter.next().then(function(result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}; | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = GenStateSuspendedStart; | ||
return function invoke(method, arg) { | ||
if (state === GenStateExecuting) { | ||
throw new Error("Generator is already running"); | ||
} | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = GenStateSuspendedStart; | ||
if (state === GenStateCompleted) { | ||
if (method === "throw") { | ||
throw arg; | ||
} // Be forgiving, per 25.3.3.3.3 of the spec: | ||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | ||
return function invoke(method, arg) { | ||
if (state === GenStateExecuting) { | ||
throw new Error("Generator is already running"); | ||
} | ||
if (state === GenStateCompleted) { | ||
if (method === "throw") { | ||
throw arg; | ||
return doneResult(); | ||
} | ||
// Be forgiving, per 25.3.3.3.3 of the spec: | ||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume | ||
return doneResult(); | ||
} | ||
context.method = method; | ||
context.arg = arg; | ||
context.method = method; | ||
context.arg = arg; | ||
while (true) { | ||
var delegate = context.delegate; | ||
while (true) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) continue; | ||
return delegateResult; | ||
} | ||
} | ||
} | ||
if (context.method === "next") { | ||
// Setting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
context.sent = context._sent = context.arg; | ||
if (context.method === "next") { | ||
// Setting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
context.sent = context._sent = context.arg; | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw context.arg; | ||
} | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw context.arg; | ||
context.dispatchException(context.arg); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
} | ||
context.dispatchException(context.arg); | ||
state = GenStateExecuting; | ||
var record = tryCatch(innerFn, self, context); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
if (record.type === "normal") { | ||
// If an exception is thrown from innerFn, we leave state === | ||
// GenStateExecuting and loop back for another invocation. | ||
state = context.done ? GenStateCompleted : GenStateSuspendedYield; | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
} | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; // Dispatch the exception by looping back around to the | ||
// context.dispatchException(context.arg) call above. | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
} | ||
} | ||
}; | ||
} // Call delegate.iterator[context.method](context.arg) and handle the | ||
// result, either by returning a { value, done } result from the | ||
// delegate iterator, or by modifying context.method and context.arg, | ||
// setting context.delegate to null, and returning the ContinueSentinel. | ||
state = GenStateExecuting; | ||
var record = tryCatch(innerFn, self, context); | ||
if (record.type === "normal") { | ||
// If an exception is thrown from innerFn, we leave state === | ||
// GenStateExecuting and loop back for another invocation. | ||
state = context.done | ||
? GenStateCompleted | ||
: GenStateSuspendedYield; | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
if (method === undefined$1) { | ||
// A .throw or .return when the delegate iterator has no .throw | ||
// method always terminates the yield* loop. | ||
context.delegate = null; | ||
if (context.method === "throw") { | ||
// Note: ["return"] must be used for ES3 parsing compatibility. | ||
if (delegate.iterator["return"]) { | ||
// If the delegate iterator has a return method, give it a | ||
// chance to clean up. | ||
context.method = "return"; | ||
context.arg = undefined$1; | ||
maybeInvokeDelegate(delegate, context); | ||
if (context.method === "throw") { | ||
// If maybeInvokeDelegate(context) changed context.method from | ||
// "return" to "throw", let that override the TypeError below. | ||
return ContinueSentinel; | ||
} | ||
} | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; | ||
// Dispatch the exception by looping back around to the | ||
// context.dispatchException(context.arg) call above. | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.arg = new TypeError("The iterator does not provide a 'throw' method"); | ||
} | ||
return ContinueSentinel; | ||
} | ||
}; | ||
} | ||
// Call delegate.iterator[context.method](context.arg) and handle the | ||
// result, either by returning a { value, done } result from the | ||
// delegate iterator, or by modifying context.method and context.arg, | ||
// setting context.delegate to null, and returning the ContinueSentinel. | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (method === undefined$1) { | ||
// A .throw or .return when the delegate iterator has no .throw | ||
// method always terminates the yield* loop. | ||
context.delegate = null; | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if (context.method === "throw") { | ||
// Note: ["return"] must be used for ES3 parsing compatibility. | ||
if (delegate.iterator["return"]) { | ||
// If the delegate iterator has a return method, give it a | ||
// chance to clean up. | ||
context.method = "return"; | ||
context.arg = undefined$1; | ||
maybeInvokeDelegate(delegate, context); | ||
if (record.type === "throw") { | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
if (context.method === "throw") { | ||
// If maybeInvokeDelegate(context) changed context.method from | ||
// "return" to "throw", let that override the TypeError below. | ||
return ContinueSentinel; | ||
} | ||
} | ||
var info = record.arg; | ||
if (!info) { | ||
context.method = "throw"; | ||
context.arg = new TypeError( | ||
"The iterator does not provide a 'throw' method"); | ||
context.arg = new TypeError("iterator result is not an object"); | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
return ContinueSentinel; | ||
} | ||
if (info.done) { | ||
// Assign the result of the finished delegate to the temporary | ||
// variable specified by delegate.resultName (see delegateYield). | ||
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the | ||
// exception, let the outer generator proceed normally. If | ||
// context.method was "next", forget context.arg since it has been | ||
// "consumed" by the delegate iterator. If context.method was | ||
// "return", allow the original .return call to continue in the | ||
// outer generator. | ||
if (record.type === "throw") { | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
if (context.method !== "return") { | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
} else { | ||
// Re-yield the result returned by the delegate method. | ||
return info; | ||
} // The delegate iterator is finished, so forget it and continue with | ||
// the outer generator. | ||
var info = record.arg; | ||
if (! info) { | ||
context.method = "throw"; | ||
context.arg = new TypeError("iterator result is not an object"); | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
} // Define Generator.prototype.{next,throw,return} in terms of the | ||
// unified ._invoke helper method. | ||
if (info.done) { | ||
// Assign the result of the finished delegate to the temporary | ||
// variable specified by delegate.resultName (see delegateYield). | ||
context[delegate.resultName] = info.value; | ||
// Resume execution at the desired location (see delegateYield). | ||
context.next = delegate.nextLoc; | ||
defineIteratorMethods(Gp); | ||
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the | ||
// @@iterator function is called on it. Some browsers' implementations of the | ||
// iterator prototype chain incorrectly implement this, causing the Generator | ||
// object to not be returned from this call. This ensures that doesn't happen. | ||
// See https://github.com/facebook/regenerator/issues/274 for more details. | ||
// If context.method was "throw" but the delegate handled the | ||
// exception, let the outer generator proceed normally. If | ||
// context.method was "next", forget context.arg since it has been | ||
// "consumed" by the delegate iterator. If context.method was | ||
// "return", allow the original .return call to continue in the | ||
// outer generator. | ||
if (context.method !== "return") { | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
Gp[iteratorSymbol] = function () { | ||
return this; | ||
}; | ||
} else { | ||
// Re-yield the result returned by the delegate method. | ||
return info; | ||
} | ||
Gp.toString = function () { | ||
return "[object Generator]"; | ||
}; | ||
// The delegate iterator is finished, so forget it and continue with | ||
// the outer generator. | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
// Define Generator.prototype.{next,throw,return} in terms of the | ||
// unified ._invoke helper method. | ||
defineIteratorMethods(Gp); | ||
if (1 in locs) { | ||
entry.catchLoc = locs[1]; | ||
} | ||
define(Gp, toStringTagSymbol, "Generator"); | ||
if (2 in locs) { | ||
entry.finallyLoc = locs[2]; | ||
entry.afterLoc = locs[3]; | ||
} | ||
// A Generator should always return itself as the iterator object when the | ||
// @@iterator function is called on it. Some browsers' implementations of the | ||
// iterator prototype chain incorrectly implement this, causing the Generator | ||
// object to not be returned from this call. This ensures that doesn't happen. | ||
// See https://github.com/facebook/regenerator/issues/274 for more details. | ||
Gp[iteratorSymbol] = function() { | ||
return this; | ||
}; | ||
this.tryEntries.push(entry); | ||
} | ||
Gp.toString = function() { | ||
return "[object Generator]"; | ||
}; | ||
function pushTryEntry(locs) { | ||
var entry = { tryLoc: locs[0] }; | ||
if (1 in locs) { | ||
entry.catchLoc = locs[1]; | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal"; | ||
delete record.arg; | ||
entry.completion = record; | ||
} | ||
if (2 in locs) { | ||
entry.finallyLoc = locs[2]; | ||
entry.afterLoc = locs[3]; | ||
function Context(tryLocsList) { | ||
// The root entry object (effectively a try statement without a catch | ||
// or a finally block) gives us a place to store values thrown from | ||
// locations where there is no enclosing try statement. | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}]; | ||
tryLocsList.forEach(pushTryEntry, this); | ||
this.reset(true); | ||
} | ||
this.tryEntries.push(entry); | ||
} | ||
exports.keys = function (object) { | ||
var keys = []; | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal"; | ||
delete record.arg; | ||
entry.completion = record; | ||
} | ||
for (var key in object) { | ||
keys.push(key); | ||
} | ||
function Context(tryLocsList) { | ||
// The root entry object (effectively a try statement without a catch | ||
// or a finally block) gives us a place to store values thrown from | ||
// locations where there is no enclosing try statement. | ||
this.tryEntries = [{ tryLoc: "root" }]; | ||
tryLocsList.forEach(pushTryEntry, this); | ||
this.reset(true); | ||
} | ||
keys.reverse(); // Rather than returning an object with a next method, we keep | ||
// things simple and return the next function itself. | ||
exports.keys = function(object) { | ||
var keys = []; | ||
for (var key in object) { | ||
keys.push(key); | ||
} | ||
keys.reverse(); | ||
return function next() { | ||
while (keys.length) { | ||
var key = keys.pop(); | ||
// Rather than returning an object with a next method, we keep | ||
// things simple and return the next function itself. | ||
return function next() { | ||
while (keys.length) { | ||
var key = keys.pop(); | ||
if (key in object) { | ||
next.value = key; | ||
next.done = false; | ||
return next; | ||
} | ||
} | ||
if (key in object) { | ||
next.value = key; | ||
next.done = false; | ||
return next; | ||
} | ||
} // To avoid creating an additional object, we just hang the .value | ||
// and .done properties off the next function object itself. This | ||
// also ensures that the minifier will not anonymize the function. | ||
// To avoid creating an additional object, we just hang the .value | ||
// and .done properties off the next function object itself. This | ||
// also ensures that the minifier will not anonymize the function. | ||
next.done = true; | ||
return next; | ||
next.done = true; | ||
return next; | ||
}; | ||
}; | ||
}; | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) { | ||
return iteratorMethod.call(iterable); | ||
} | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (typeof iterable.next === "function") { | ||
return iterable; | ||
} | ||
if (iteratorMethod) { | ||
return iteratorMethod.call(iterable); | ||
} | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, next = function next() { | ||
while (++i < iterable.length) { | ||
if (hasOwn.call(iterable, i)) { | ||
next.value = iterable[i]; | ||
next.done = false; | ||
return next; | ||
if (typeof iterable.next === "function") { | ||
return iterable; | ||
} | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, | ||
next = function next() { | ||
while (++i < iterable.length) { | ||
if (hasOwn.call(iterable, i)) { | ||
next.value = iterable[i]; | ||
next.done = false; | ||
return next; | ||
} | ||
} | ||
} | ||
next.value = undefined$1; | ||
next.done = true; | ||
next.value = undefined$1; | ||
next.done = true; | ||
return next; | ||
}; | ||
return next; | ||
}; | ||
return next.next = next; | ||
} | ||
} // Return an iterator with no values. | ||
return next.next = next; | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
// Return an iterator with no values. | ||
return { next: doneResult }; | ||
} | ||
exports.values = values; | ||
exports.values = values; | ||
function doneResult() { | ||
return { value: undefined$1, done: true }; | ||
} | ||
function doneResult() { | ||
return { | ||
value: undefined$1, | ||
done: true | ||
}; | ||
} | ||
Context.prototype = { | ||
constructor: Context, | ||
Context.prototype = { | ||
constructor: Context, | ||
reset: function reset(skipTempReset) { | ||
this.prev = 0; | ||
this.next = 0; // Resetting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
reset: function(skipTempReset) { | ||
this.prev = 0; | ||
this.next = 0; | ||
// Resetting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
this.sent = this._sent = undefined$1; | ||
this.done = false; | ||
this.delegate = null; | ||
this.sent = this._sent = undefined$1; | ||
this.done = false; | ||
this.delegate = null; | ||
this.method = "next"; | ||
this.arg = undefined$1; | ||
this.tryEntries.forEach(resetTryEntry); | ||
this.method = "next"; | ||
this.arg = undefined$1; | ||
this.tryEntries.forEach(resetTryEntry); | ||
if (!skipTempReset) { | ||
for (var name in this) { | ||
// Not sure about the optimal order of these conditions: | ||
if (name.charAt(0) === "t" && | ||
hasOwn.call(this, name) && | ||
!isNaN(+name.slice(1))) { | ||
this[name] = undefined$1; | ||
if (!skipTempReset) { | ||
for (var name in this) { | ||
// Not sure about the optimal order of these conditions: | ||
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { | ||
this[name] = undefined$1; | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
stop: function stop() { | ||
this.done = true; | ||
var rootEntry = this.tryEntries[0]; | ||
var rootRecord = rootEntry.completion; | ||
stop: function() { | ||
this.done = true; | ||
if (rootRecord.type === "throw") { | ||
throw rootRecord.arg; | ||
} | ||
var rootEntry = this.tryEntries[0]; | ||
var rootRecord = rootEntry.completion; | ||
if (rootRecord.type === "throw") { | ||
throw rootRecord.arg; | ||
} | ||
return this.rval; | ||
}, | ||
dispatchException: function dispatchException(exception) { | ||
if (this.done) { | ||
throw exception; | ||
} | ||
return this.rval; | ||
}, | ||
var context = this; | ||
dispatchException: function(exception) { | ||
if (this.done) { | ||
throw exception; | ||
} | ||
function handle(loc, caught) { | ||
record.type = "throw"; | ||
record.arg = exception; | ||
context.next = loc; | ||
var context = this; | ||
function handle(loc, caught) { | ||
record.type = "throw"; | ||
record.arg = exception; | ||
context.next = loc; | ||
if (caught) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
} | ||
if (caught) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
context.method = "next"; | ||
context.arg = undefined$1; | ||
return !!caught; | ||
} | ||
return !! caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
var record = entry.completion; | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
var record = entry.completion; | ||
if (entry.tryLoc === "root") { | ||
// Exception thrown outside of any try block that could handle | ||
// it, so set the completion value of the entire function to | ||
// throw the exception. | ||
return handle("end"); | ||
} | ||
if (entry.tryLoc === "root") { | ||
// Exception thrown outside of any try block that could handle | ||
// it, so set the completion value of the entire function to | ||
// throw the exception. | ||
return handle("end"); | ||
} | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"); | ||
var hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"); | ||
var hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} else if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} else if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} | ||
} else if (hasFinally) { | ||
if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else { | ||
throw new Error("try statement without catch or finally"); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function abrupt(type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} | ||
} else if (hasFinally) { | ||
if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else { | ||
throw new Error("try statement without catch or finally"); | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function(type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && | ||
hasOwn.call(entry, "finallyLoc") && | ||
this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { | ||
// Ignore the finally entry if control is not jumping to a | ||
// location outside the try/catch block. | ||
finallyEntry = null; | ||
} | ||
} | ||
if (finallyEntry && | ||
(type === "break" || | ||
type === "continue") && | ||
finallyEntry.tryLoc <= arg && | ||
arg <= finallyEntry.finallyLoc) { | ||
// Ignore the finally entry if control is not jumping to a | ||
// location outside the try/catch block. | ||
finallyEntry = null; | ||
} | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
record.type = type; | ||
record.arg = arg; | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
record.type = type; | ||
record.arg = arg; | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
return ContinueSentinel; | ||
} | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
return ContinueSentinel; | ||
} | ||
return this.complete(record); | ||
}, | ||
complete: function complete(record, afterLoc) { | ||
if (record.type === "throw") { | ||
throw record.arg; | ||
} | ||
return this.complete(record); | ||
}, | ||
if (record.type === "break" || record.type === "continue") { | ||
this.next = record.arg; | ||
} else if (record.type === "return") { | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
} else if (record.type === "normal" && afterLoc) { | ||
this.next = afterLoc; | ||
} | ||
complete: function(record, afterLoc) { | ||
if (record.type === "throw") { | ||
throw record.arg; | ||
} | ||
return ContinueSentinel; | ||
}, | ||
finish: function finish(finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (record.type === "break" || | ||
record.type === "continue") { | ||
this.next = record.arg; | ||
} else if (record.type === "return") { | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
} else if (record.type === "normal" && afterLoc) { | ||
this.next = afterLoc; | ||
} | ||
if (entry.finallyLoc === finallyLoc) { | ||
this.complete(entry.completion, entry.afterLoc); | ||
resetTryEntry(entry); | ||
return ContinueSentinel; | ||
} | ||
} | ||
}, | ||
"catch": function _catch(tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
return ContinueSentinel; | ||
}, | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
finish: function(finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) { | ||
this.complete(entry.completion, entry.afterLoc); | ||
resetTryEntry(entry); | ||
return ContinueSentinel; | ||
} | ||
} | ||
}, | ||
if (record.type === "throw") { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
"catch": function(tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if (record.type === "throw") { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
return thrown; | ||
} | ||
return thrown; | ||
} | ||
} | ||
} // The context.catch method must only be called with a location | ||
// argument that corresponds to a known catch block. | ||
// The context.catch method must only be called with a location | ||
// argument that corresponds to a known catch block. | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function(iterable, resultName, nextLoc) { | ||
this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}; | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function delegateYield(iterable, resultName, nextLoc) { | ||
this.delegate = { | ||
iterator: values(iterable), | ||
resultName: resultName, | ||
nextLoc: nextLoc | ||
}; | ||
if (this.method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
this.arg = undefined$1; | ||
if (this.method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
this.arg = undefined$1; | ||
} | ||
return ContinueSentinel; | ||
} | ||
}; // Regardless of whether this script is executing as a CommonJS module | ||
// or not, return the runtime object so that we can declare the variable | ||
// regeneratorRuntime in the outer scope, which allows this module to be | ||
// injected easily by `bin/regenerator --include-runtime script.js`. | ||
return ContinueSentinel; | ||
} | ||
}; | ||
// Regardless of whether this script is executing as a CommonJS module | ||
// or not, return the runtime object so that we can declare the variable | ||
// regeneratorRuntime in the outer scope, which allows this module to be | ||
// injected easily by `bin/regenerator --include-runtime script.js`. | ||
return exports; | ||
}( | ||
// If this script is executing as a CommonJS module, use module.exports | ||
return exports; | ||
}( // If this script is executing as a CommonJS module, use module.exports | ||
// as the regeneratorRuntime namespace. Otherwise create a new empty | ||
// object. Either way, the resulting object will be used to initialize | ||
// the regeneratorRuntime variable at the top of this file. | ||
module.exports | ||
)); | ||
module.exports ); | ||
try { | ||
regeneratorRuntime = runtime; | ||
} catch (accidentalStrictMode) { | ||
// This module should not be running in strict mode, so the above | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
// if a Content Security Policy forbids using Function, but in that case | ||
// the proper solution is to fix the accidental strict mode problem. If | ||
// you've misconfigured your bundler to force strict mode and applied a | ||
// CSP to forbid Function, and you're not willing to fix either of those | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
try { | ||
regeneratorRuntime = runtime; | ||
} catch (accidentalStrictMode) { | ||
// This module should not be running in strict mode, so the above | ||
// assignment should always work unless something is misconfigured. Just | ||
// in case runtime.js accidentally runs in strict mode, we can escape | ||
// strict mode using a global Function call. This could conceivably fail | ||
// if a Content Security Policy forbids using Function, but in that case | ||
// the proper solution is to fix the accidental strict mode problem. If | ||
// you've misconfigured your bundler to force strict mode and applied a | ||
// CSP to forbid Function, and you're not willing to fix either of those | ||
// problems, please detail your unique predicament in a GitHub issue. | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
}); | ||
@@ -1100,3 +1074,3 @@ | ||
if (!this.opts.cache) { | ||
_context.next = 7; | ||
_context.next = 6; | ||
break; | ||
@@ -1112,32 +1086,30 @@ } | ||
if (!cachedData) { | ||
_context.next = 7; | ||
_context.next = 6; | ||
break; | ||
} | ||
console.log('Using cached data'); | ||
return _context.abrupt("return", cachedData); | ||
case 7: | ||
case 6: | ||
if (!this.curFetch) { | ||
_context.next = 12; | ||
_context.next = 10; | ||
break; | ||
} | ||
console.log('Awaiting in-process fetch'); | ||
_context.next = 11; | ||
_context.next = 9; | ||
return this.curFetch; | ||
case 11: | ||
case 9: | ||
return _context.abrupt("return", _context.sent); | ||
case 12: | ||
console.log('Doing a fresh fetch...'); | ||
case 10: | ||
console.debug('PlasmicLoader: doing a fresh fetch...'); | ||
this.curFetch = this.doFetch(); | ||
_context.next = 16; | ||
_context.next = 14; | ||
return this.curFetch; | ||
case 16: | ||
case 14: | ||
return _context.abrupt("return", _context.sent); | ||
case 17: | ||
case 15: | ||
case "end": | ||
@@ -1186,6 +1158,5 @@ return _context.stop(); | ||
case 6: | ||
console.log('Finished fresh fetch'); | ||
return _context2.abrupt("return", data); | ||
case 8: | ||
case 7: | ||
case "end": | ||
@@ -1192,0 +1163,0 @@ return _context2.stop(); |
{ | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"license": "MIT", | ||
@@ -56,4 +56,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"isomorphic-fetch": "^3.0.0" | ||
} | ||
"isomorphic-unfetch": "^3.1.0" | ||
}, | ||
"gitHead": "fa53f7d79f0e26d8b061102fda0c06788da6f8a7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280362
2301
+ Addedisomorphic-unfetch@^3.1.0
+ Addedisomorphic-unfetch@3.1.0(transitive)
+ Addedunfetch@4.2.0(transitive)
- Removedisomorphic-fetch@^3.0.0
- Removedisomorphic-fetch@3.0.0(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)