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