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