1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var runtime = (function (exports) {
|
9 | "use strict";
|
10 |
|
11 | var Op = Object.prototype;
|
12 | var hasOwn = Op.hasOwnProperty;
|
13 | var undefined;
|
14 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
15 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
16 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
17 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
18 |
|
19 | function define(obj, key, value) {
|
20 | Object.defineProperty(obj, key, {
|
21 | value: value,
|
22 | enumerable: true,
|
23 | configurable: true,
|
24 | writable: true
|
25 | });
|
26 | return obj[key];
|
27 | }
|
28 | try {
|
29 |
|
30 | define({}, "");
|
31 | } catch (err) {
|
32 | define = function(obj, key, value) {
|
33 | return obj[key] = value;
|
34 | };
|
35 | }
|
36 |
|
37 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
38 |
|
39 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
40 | var generator = Object.create(protoGenerator.prototype);
|
41 | var context = new Context(tryLocsList || []);
|
42 |
|
43 |
|
44 |
|
45 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
46 |
|
47 | return generator;
|
48 | }
|
49 | exports.wrap = wrap;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | function tryCatch(fn, obj, arg) {
|
62 | try {
|
63 | return { type: "normal", arg: fn.call(obj, arg) };
|
64 | } catch (err) {
|
65 | return { type: "throw", arg: err };
|
66 | }
|
67 | }
|
68 |
|
69 | var GenStateSuspendedStart = "suspendedStart";
|
70 | var GenStateSuspendedYield = "suspendedYield";
|
71 | var GenStateExecuting = "executing";
|
72 | var GenStateCompleted = "completed";
|
73 |
|
74 |
|
75 |
|
76 | var ContinueSentinel = {};
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | function Generator() {}
|
83 | function GeneratorFunction() {}
|
84 | function GeneratorFunctionPrototype() {}
|
85 |
|
86 |
|
87 |
|
88 | var IteratorPrototype = {};
|
89 | define(IteratorPrototype, iteratorSymbol, function () {
|
90 | return this;
|
91 | });
|
92 |
|
93 | var getProto = Object.getPrototypeOf;
|
94 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
95 | if (NativeIteratorPrototype &&
|
96 | NativeIteratorPrototype !== Op &&
|
97 | hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
98 |
|
99 |
|
100 | IteratorPrototype = NativeIteratorPrototype;
|
101 | }
|
102 |
|
103 | var Gp = GeneratorFunctionPrototype.prototype =
|
104 | Generator.prototype = Object.create(IteratorPrototype);
|
105 | GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
106 | define(Gp, "constructor", GeneratorFunctionPrototype);
|
107 | define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
108 | GeneratorFunction.displayName = define(
|
109 | GeneratorFunctionPrototype,
|
110 | toStringTagSymbol,
|
111 | "GeneratorFunction"
|
112 | );
|
113 |
|
114 |
|
115 |
|
116 | function defineIteratorMethods(prototype) {
|
117 | ["next", "throw", "return"].forEach(function(method) {
|
118 | define(prototype, method, function(arg) {
|
119 | return this._invoke(method, arg);
|
120 | });
|
121 | });
|
122 | }
|
123 |
|
124 | exports.isGeneratorFunction = function(genFun) {
|
125 | var ctor = typeof genFun === "function" && genFun.constructor;
|
126 | return ctor
|
127 | ? ctor === GeneratorFunction ||
|
128 |
|
129 |
|
130 | (ctor.displayName || ctor.name) === "GeneratorFunction"
|
131 | : false;
|
132 | };
|
133 |
|
134 | exports.mark = function(genFun) {
|
135 | if (Object.setPrototypeOf) {
|
136 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
137 | } else {
|
138 | genFun.__proto__ = GeneratorFunctionPrototype;
|
139 | define(genFun, toStringTagSymbol, "GeneratorFunction");
|
140 | }
|
141 | genFun.prototype = Object.create(Gp);
|
142 | return genFun;
|
143 | };
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | exports.awrap = function(arg) {
|
150 | return { __await: arg };
|
151 | };
|
152 |
|
153 | function AsyncIterator(generator, PromiseImpl) {
|
154 | function invoke(method, arg, resolve, reject) {
|
155 | var record = tryCatch(generator[method], generator, arg);
|
156 | if (record.type === "throw") {
|
157 | reject(record.arg);
|
158 | } else {
|
159 | var result = record.arg;
|
160 | var value = result.value;
|
161 | if (value &&
|
162 | typeof value === "object" &&
|
163 | hasOwn.call(value, "__await")) {
|
164 | return PromiseImpl.resolve(value.__await).then(function(value) {
|
165 | invoke("next", value, resolve, reject);
|
166 | }, function(err) {
|
167 | invoke("throw", err, resolve, reject);
|
168 | });
|
169 | }
|
170 |
|
171 | return PromiseImpl.resolve(value).then(function(unwrapped) {
|
172 |
|
173 |
|
174 |
|
175 | result.value = unwrapped;
|
176 | resolve(result);
|
177 | }, function(error) {
|
178 |
|
179 |
|
180 | return invoke("throw", error, resolve, reject);
|
181 | });
|
182 | }
|
183 | }
|
184 |
|
185 | var previousPromise;
|
186 |
|
187 | function enqueue(method, arg) {
|
188 | function callInvokeWithMethodAndArg() {
|
189 | return new PromiseImpl(function(resolve, reject) {
|
190 | invoke(method, arg, resolve, reject);
|
191 | });
|
192 | }
|
193 |
|
194 | return previousPromise =
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 | previousPromise ? previousPromise.then(
|
208 | callInvokeWithMethodAndArg,
|
209 |
|
210 |
|
211 | callInvokeWithMethodAndArg
|
212 | ) : callInvokeWithMethodAndArg();
|
213 | }
|
214 |
|
215 |
|
216 |
|
217 | this._invoke = enqueue;
|
218 | }
|
219 |
|
220 | defineIteratorMethods(AsyncIterator.prototype);
|
221 | define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
222 | return this;
|
223 | });
|
224 | exports.AsyncIterator = AsyncIterator;
|
225 |
|
226 |
|
227 |
|
228 |
|
229 | exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
230 | if (PromiseImpl === void 0) PromiseImpl = Promise;
|
231 |
|
232 | var iter = new AsyncIterator(
|
233 | wrap(innerFn, outerFn, self, tryLocsList),
|
234 | PromiseImpl
|
235 | );
|
236 |
|
237 | return exports.isGeneratorFunction(outerFn)
|
238 | ? iter
|
239 | : iter.next().then(function(result) {
|
240 | return result.done ? result.value : iter.next();
|
241 | });
|
242 | };
|
243 |
|
244 | function makeInvokeMethod(innerFn, self, context) {
|
245 | var state = GenStateSuspendedStart;
|
246 |
|
247 | return function invoke(method, arg) {
|
248 | if (state === GenStateExecuting) {
|
249 | throw new Error("Generator is already running");
|
250 | }
|
251 |
|
252 | if (state === GenStateCompleted) {
|
253 | if (method === "throw") {
|
254 | throw arg;
|
255 | }
|
256 |
|
257 |
|
258 |
|
259 | return doneResult();
|
260 | }
|
261 |
|
262 | context.method = method;
|
263 | context.arg = arg;
|
264 |
|
265 | while (true) {
|
266 | var delegate = context.delegate;
|
267 | if (delegate) {
|
268 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
269 | if (delegateResult) {
|
270 | if (delegateResult === ContinueSentinel) continue;
|
271 | return delegateResult;
|
272 | }
|
273 | }
|
274 |
|
275 | if (context.method === "next") {
|
276 |
|
277 |
|
278 | context.sent = context._sent = context.arg;
|
279 |
|
280 | } else if (context.method === "throw") {
|
281 | if (state === GenStateSuspendedStart) {
|
282 | state = GenStateCompleted;
|
283 | throw context.arg;
|
284 | }
|
285 |
|
286 | context.dispatchException(context.arg);
|
287 |
|
288 | } else if (context.method === "return") {
|
289 | context.abrupt("return", context.arg);
|
290 | }
|
291 |
|
292 | state = GenStateExecuting;
|
293 |
|
294 | var record = tryCatch(innerFn, self, context);
|
295 | if (record.type === "normal") {
|
296 |
|
297 |
|
298 | state = context.done
|
299 | ? GenStateCompleted
|
300 | : GenStateSuspendedYield;
|
301 |
|
302 | if (record.arg === ContinueSentinel) {
|
303 | continue;
|
304 | }
|
305 |
|
306 | return {
|
307 | value: record.arg,
|
308 | done: context.done
|
309 | };
|
310 |
|
311 | } else if (record.type === "throw") {
|
312 | state = GenStateCompleted;
|
313 |
|
314 |
|
315 | context.method = "throw";
|
316 | context.arg = record.arg;
|
317 | }
|
318 | }
|
319 | };
|
320 | }
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 | function maybeInvokeDelegate(delegate, context) {
|
327 | var method = delegate.iterator[context.method];
|
328 | if (method === undefined) {
|
329 |
|
330 |
|
331 | context.delegate = null;
|
332 |
|
333 | if (context.method === "throw") {
|
334 |
|
335 | if (delegate.iterator["return"]) {
|
336 |
|
337 |
|
338 | context.method = "return";
|
339 | context.arg = undefined;
|
340 | maybeInvokeDelegate(delegate, context);
|
341 |
|
342 | if (context.method === "throw") {
|
343 |
|
344 |
|
345 | return ContinueSentinel;
|
346 | }
|
347 | }
|
348 |
|
349 | context.method = "throw";
|
350 | context.arg = new TypeError(
|
351 | "The iterator does not provide a 'throw' method");
|
352 | }
|
353 |
|
354 | return ContinueSentinel;
|
355 | }
|
356 |
|
357 | var record = tryCatch(method, delegate.iterator, context.arg);
|
358 |
|
359 | if (record.type === "throw") {
|
360 | context.method = "throw";
|
361 | context.arg = record.arg;
|
362 | context.delegate = null;
|
363 | return ContinueSentinel;
|
364 | }
|
365 |
|
366 | var info = record.arg;
|
367 |
|
368 | if (! info) {
|
369 | context.method = "throw";
|
370 | context.arg = new TypeError("iterator result is not an object");
|
371 | context.delegate = null;
|
372 | return ContinueSentinel;
|
373 | }
|
374 |
|
375 | if (info.done) {
|
376 |
|
377 |
|
378 | context[delegate.resultName] = info.value;
|
379 |
|
380 |
|
381 | context.next = delegate.nextLoc;
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 | if (context.method !== "return") {
|
390 | context.method = "next";
|
391 | context.arg = undefined;
|
392 | }
|
393 |
|
394 | } else {
|
395 |
|
396 | return info;
|
397 | }
|
398 |
|
399 |
|
400 |
|
401 | context.delegate = null;
|
402 | return ContinueSentinel;
|
403 | }
|
404 |
|
405 |
|
406 |
|
407 | defineIteratorMethods(Gp);
|
408 |
|
409 | define(Gp, toStringTagSymbol, "Generator");
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | define(Gp, iteratorSymbol, function() {
|
417 | return this;
|
418 | });
|
419 |
|
420 | define(Gp, "toString", function() {
|
421 | return "[object Generator]";
|
422 | });
|
423 |
|
424 | function pushTryEntry(locs) {
|
425 | var entry = { tryLoc: locs[0] };
|
426 |
|
427 | if (1 in locs) {
|
428 | entry.catchLoc = locs[1];
|
429 | }
|
430 |
|
431 | if (2 in locs) {
|
432 | entry.finallyLoc = locs[2];
|
433 | entry.afterLoc = locs[3];
|
434 | }
|
435 |
|
436 | this.tryEntries.push(entry);
|
437 | }
|
438 |
|
439 | function resetTryEntry(entry) {
|
440 | var record = entry.completion || {};
|
441 | record.type = "normal";
|
442 | delete record.arg;
|
443 | entry.completion = record;
|
444 | }
|
445 |
|
446 | function Context(tryLocsList) {
|
447 |
|
448 |
|
449 |
|
450 | this.tryEntries = [{ tryLoc: "root" }];
|
451 | tryLocsList.forEach(pushTryEntry, this);
|
452 | this.reset(true);
|
453 | }
|
454 |
|
455 | exports.keys = function(object) {
|
456 | var keys = [];
|
457 | for (var key in object) {
|
458 | keys.push(key);
|
459 | }
|
460 | keys.reverse();
|
461 |
|
462 |
|
463 |
|
464 | return function next() {
|
465 | while (keys.length) {
|
466 | var key = keys.pop();
|
467 | if (key in object) {
|
468 | next.value = key;
|
469 | next.done = false;
|
470 | return next;
|
471 | }
|
472 | }
|
473 |
|
474 |
|
475 |
|
476 |
|
477 | next.done = true;
|
478 | return next;
|
479 | };
|
480 | };
|
481 |
|
482 | function values(iterable) {
|
483 | if (iterable) {
|
484 | var iteratorMethod = iterable[iteratorSymbol];
|
485 | if (iteratorMethod) {
|
486 | return iteratorMethod.call(iterable);
|
487 | }
|
488 |
|
489 | if (typeof iterable.next === "function") {
|
490 | return iterable;
|
491 | }
|
492 |
|
493 | if (!isNaN(iterable.length)) {
|
494 | var i = -1, next = function next() {
|
495 | while (++i < iterable.length) {
|
496 | if (hasOwn.call(iterable, i)) {
|
497 | next.value = iterable[i];
|
498 | next.done = false;
|
499 | return next;
|
500 | }
|
501 | }
|
502 |
|
503 | next.value = undefined;
|
504 | next.done = true;
|
505 |
|
506 | return next;
|
507 | };
|
508 |
|
509 | return next.next = next;
|
510 | }
|
511 | }
|
512 |
|
513 |
|
514 | return { next: doneResult };
|
515 | }
|
516 | exports.values = values;
|
517 |
|
518 | function doneResult() {
|
519 | return { value: undefined, done: true };
|
520 | }
|
521 |
|
522 | Context.prototype = {
|
523 | constructor: Context,
|
524 |
|
525 | reset: function(skipTempReset) {
|
526 | this.prev = 0;
|
527 | this.next = 0;
|
528 |
|
529 |
|
530 | this.sent = this._sent = undefined;
|
531 | this.done = false;
|
532 | this.delegate = null;
|
533 |
|
534 | this.method = "next";
|
535 | this.arg = undefined;
|
536 |
|
537 | this.tryEntries.forEach(resetTryEntry);
|
538 |
|
539 | if (!skipTempReset) {
|
540 | for (var name in this) {
|
541 |
|
542 | if (name.charAt(0) === "t" &&
|
543 | hasOwn.call(this, name) &&
|
544 | !isNaN(+name.slice(1))) {
|
545 | this[name] = undefined;
|
546 | }
|
547 | }
|
548 | }
|
549 | },
|
550 |
|
551 | stop: function() {
|
552 | this.done = true;
|
553 |
|
554 | var rootEntry = this.tryEntries[0];
|
555 | var rootRecord = rootEntry.completion;
|
556 | if (rootRecord.type === "throw") {
|
557 | throw rootRecord.arg;
|
558 | }
|
559 |
|
560 | return this.rval;
|
561 | },
|
562 |
|
563 | dispatchException: function(exception) {
|
564 | if (this.done) {
|
565 | throw exception;
|
566 | }
|
567 |
|
568 | var context = this;
|
569 | function handle(loc, caught) {
|
570 | record.type = "throw";
|
571 | record.arg = exception;
|
572 | context.next = loc;
|
573 |
|
574 | if (caught) {
|
575 |
|
576 |
|
577 | context.method = "next";
|
578 | context.arg = undefined;
|
579 | }
|
580 |
|
581 | return !! caught;
|
582 | }
|
583 |
|
584 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
585 | var entry = this.tryEntries[i];
|
586 | var record = entry.completion;
|
587 |
|
588 | if (entry.tryLoc === "root") {
|
589 |
|
590 |
|
591 |
|
592 | return handle("end");
|
593 | }
|
594 |
|
595 | if (entry.tryLoc <= this.prev) {
|
596 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
597 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
598 |
|
599 | if (hasCatch && hasFinally) {
|
600 | if (this.prev < entry.catchLoc) {
|
601 | return handle(entry.catchLoc, true);
|
602 | } else if (this.prev < entry.finallyLoc) {
|
603 | return handle(entry.finallyLoc);
|
604 | }
|
605 |
|
606 | } else if (hasCatch) {
|
607 | if (this.prev < entry.catchLoc) {
|
608 | return handle(entry.catchLoc, true);
|
609 | }
|
610 |
|
611 | } else if (hasFinally) {
|
612 | if (this.prev < entry.finallyLoc) {
|
613 | return handle(entry.finallyLoc);
|
614 | }
|
615 |
|
616 | } else {
|
617 | throw new Error("try statement without catch or finally");
|
618 | }
|
619 | }
|
620 | }
|
621 | },
|
622 |
|
623 | abrupt: function(type, arg) {
|
624 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
625 | var entry = this.tryEntries[i];
|
626 | if (entry.tryLoc <= this.prev &&
|
627 | hasOwn.call(entry, "finallyLoc") &&
|
628 | this.prev < entry.finallyLoc) {
|
629 | var finallyEntry = entry;
|
630 | break;
|
631 | }
|
632 | }
|
633 |
|
634 | if (finallyEntry &&
|
635 | (type === "break" ||
|
636 | type === "continue") &&
|
637 | finallyEntry.tryLoc <= arg &&
|
638 | arg <= finallyEntry.finallyLoc) {
|
639 |
|
640 |
|
641 | finallyEntry = null;
|
642 | }
|
643 |
|
644 | var record = finallyEntry ? finallyEntry.completion : {};
|
645 | record.type = type;
|
646 | record.arg = arg;
|
647 |
|
648 | if (finallyEntry) {
|
649 | this.method = "next";
|
650 | this.next = finallyEntry.finallyLoc;
|
651 | return ContinueSentinel;
|
652 | }
|
653 |
|
654 | return this.complete(record);
|
655 | },
|
656 |
|
657 | complete: function(record, afterLoc) {
|
658 | if (record.type === "throw") {
|
659 | throw record.arg;
|
660 | }
|
661 |
|
662 | if (record.type === "break" ||
|
663 | record.type === "continue") {
|
664 | this.next = record.arg;
|
665 | } else if (record.type === "return") {
|
666 | this.rval = this.arg = record.arg;
|
667 | this.method = "return";
|
668 | this.next = "end";
|
669 | } else if (record.type === "normal" && afterLoc) {
|
670 | this.next = afterLoc;
|
671 | }
|
672 |
|
673 | return ContinueSentinel;
|
674 | },
|
675 |
|
676 | finish: function(finallyLoc) {
|
677 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
678 | var entry = this.tryEntries[i];
|
679 | if (entry.finallyLoc === finallyLoc) {
|
680 | this.complete(entry.completion, entry.afterLoc);
|
681 | resetTryEntry(entry);
|
682 | return ContinueSentinel;
|
683 | }
|
684 | }
|
685 | },
|
686 |
|
687 | "catch": function(tryLoc) {
|
688 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
689 | var entry = this.tryEntries[i];
|
690 | if (entry.tryLoc === tryLoc) {
|
691 | var record = entry.completion;
|
692 | if (record.type === "throw") {
|
693 | var thrown = record.arg;
|
694 | resetTryEntry(entry);
|
695 | }
|
696 | return thrown;
|
697 | }
|
698 | }
|
699 |
|
700 |
|
701 |
|
702 | throw new Error("illegal catch attempt");
|
703 | },
|
704 |
|
705 | delegateYield: function(iterable, resultName, nextLoc) {
|
706 | this.delegate = {
|
707 | iterator: values(iterable),
|
708 | resultName: resultName,
|
709 | nextLoc: nextLoc
|
710 | };
|
711 |
|
712 | if (this.method === "next") {
|
713 |
|
714 |
|
715 | this.arg = undefined;
|
716 | }
|
717 |
|
718 | return ContinueSentinel;
|
719 | }
|
720 | };
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 | return exports;
|
727 |
|
728 | }(
|
729 |
|
730 |
|
731 |
|
732 |
|
733 | typeof module === "object" ? module.exports : {}
|
734 | ));
|
735 |
|
736 | try {
|
737 | regeneratorRuntime = runtime;
|
738 | } catch (accidentalStrictMode) {
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 | if (typeof globalThis === "object") {
|
750 | globalThis.regeneratorRuntime = runtime;
|
751 | } else {
|
752 | Function("r", "regeneratorRuntime = r")(runtime);
|
753 | }
|
754 | }
|