regeneratorRuntime.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. var _typeof = require("./typeof.js")["default"];
  2. function _regeneratorRuntime() {
  3. "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  4. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  5. return r;
  6. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  7. var t,
  8. r = {},
  9. e = Object.prototype,
  10. n = e.hasOwnProperty,
  11. o = "function" == typeof Symbol ? Symbol : {},
  12. i = o.iterator || "@@iterator",
  13. a = o.asyncIterator || "@@asyncIterator",
  14. u = o.toStringTag || "@@toStringTag";
  15. function c(t, r, e, n) {
  16. Object.defineProperty(t, r, {
  17. value: e,
  18. enumerable: !n,
  19. configurable: !n,
  20. writable: !n
  21. });
  22. }
  23. try {
  24. c({}, "");
  25. } catch (t) {
  26. c = function c(t, r, e) {
  27. return t[r] = e;
  28. };
  29. }
  30. function h(r, e, n, o) {
  31. var i = e && e.prototype instanceof Generator ? e : Generator,
  32. a = Object.create(i.prototype);
  33. return c(a, "_invoke", function (r, e, n) {
  34. var o = 1;
  35. return function (i, a) {
  36. if (3 === o) throw Error("Generator is already running");
  37. if (4 === o) {
  38. if ("throw" === i) throw a;
  39. return {
  40. value: t,
  41. done: !0
  42. };
  43. }
  44. for (n.method = i, n.arg = a;;) {
  45. var u = n.delegate;
  46. if (u) {
  47. var c = d(u, n);
  48. if (c) {
  49. if (c === f) continue;
  50. return c;
  51. }
  52. }
  53. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  54. if (1 === o) throw o = 4, n.arg;
  55. n.dispatchException(n.arg);
  56. } else "return" === n.method && n.abrupt("return", n.arg);
  57. o = 3;
  58. var h = s(r, e, n);
  59. if ("normal" === h.type) {
  60. if (o = n.done ? 4 : 2, h.arg === f) continue;
  61. return {
  62. value: h.arg,
  63. done: n.done
  64. };
  65. }
  66. "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
  67. }
  68. };
  69. }(r, n, new Context(o || [])), !0), a;
  70. }
  71. function s(t, r, e) {
  72. try {
  73. return {
  74. type: "normal",
  75. arg: t.call(r, e)
  76. };
  77. } catch (t) {
  78. return {
  79. type: "throw",
  80. arg: t
  81. };
  82. }
  83. }
  84. r.wrap = h;
  85. var f = {};
  86. function Generator() {}
  87. function GeneratorFunction() {}
  88. function GeneratorFunctionPrototype() {}
  89. var l = {};
  90. c(l, i, function () {
  91. return this;
  92. });
  93. var p = Object.getPrototypeOf,
  94. y = p && p(p(x([])));
  95. y && y !== e && n.call(y, i) && (l = y);
  96. var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
  97. function g(t) {
  98. ["next", "throw", "return"].forEach(function (r) {
  99. c(t, r, function (t) {
  100. return this._invoke(r, t);
  101. });
  102. });
  103. }
  104. function AsyncIterator(t, r) {
  105. function e(o, i, a, u) {
  106. var c = s(t[o], t, i);
  107. if ("throw" !== c.type) {
  108. var h = c.arg,
  109. f = h.value;
  110. return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
  111. e("next", t, a, u);
  112. }, function (t) {
  113. e("throw", t, a, u);
  114. }) : r.resolve(f).then(function (t) {
  115. h.value = t, a(h);
  116. }, function (t) {
  117. return e("throw", t, a, u);
  118. });
  119. }
  120. u(c.arg);
  121. }
  122. var o;
  123. c(this, "_invoke", function (t, n) {
  124. function i() {
  125. return new r(function (r, o) {
  126. e(t, n, r, o);
  127. });
  128. }
  129. return o = o ? o.then(i, i) : i();
  130. }, !0);
  131. }
  132. function d(r, e) {
  133. var n = e.method,
  134. o = r.i[n];
  135. if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
  136. var i = s(o, r.i, e.arg);
  137. if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
  138. var a = i.arg;
  139. return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
  140. }
  141. function w(t) {
  142. this.tryEntries.push(t);
  143. }
  144. function m(r) {
  145. var e = r[4] || {};
  146. e.type = "normal", e.arg = t, r[4] = e;
  147. }
  148. function Context(t) {
  149. this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
  150. }
  151. function x(r) {
  152. if (null != r) {
  153. var e = r[i];
  154. if (e) return e.call(r);
  155. if ("function" == typeof r.next) return r;
  156. if (!isNaN(r.length)) {
  157. var o = -1,
  158. a = function e() {
  159. for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
  160. return e.value = t, e.done = !0, e;
  161. };
  162. return a.next = a;
  163. }
  164. }
  165. throw new TypeError(_typeof(r) + " is not iterable");
  166. }
  167. return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) {
  168. var r = "function" == typeof t && t.constructor;
  169. return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
  170. }, r.mark = function (t) {
  171. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
  172. }, r.awrap = function (t) {
  173. return {
  174. __await: t
  175. };
  176. }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
  177. return this;
  178. }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
  179. void 0 === i && (i = Promise);
  180. var a = new AsyncIterator(h(t, e, n, o), i);
  181. return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
  182. return t.done ? t.value : a.next();
  183. });
  184. }, g(v), c(v, u, "Generator"), c(v, i, function () {
  185. return this;
  186. }), c(v, "toString", function () {
  187. return "[object Generator]";
  188. }), r.keys = function (t) {
  189. var r = Object(t),
  190. e = [];
  191. for (var n in r) e.unshift(n);
  192. return function t() {
  193. for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
  194. return t.done = !0, t;
  195. };
  196. }, r.values = x, Context.prototype = {
  197. constructor: Context,
  198. reset: function reset(r) {
  199. if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
  200. },
  201. stop: function stop() {
  202. this.done = !0;
  203. var t = this.tryEntries[0][4];
  204. if ("throw" === t.type) throw t.arg;
  205. return this.rval;
  206. },
  207. dispatchException: function dispatchException(r) {
  208. if (this.done) throw r;
  209. var e = this;
  210. function n(t) {
  211. a.type = "throw", a.arg = r, e.next = t;
  212. }
  213. for (var o = e.tryEntries.length - 1; o >= 0; --o) {
  214. var i = this.tryEntries[o],
  215. a = i[4],
  216. u = this.prev,
  217. c = i[1],
  218. h = i[2];
  219. if (-1 === i[0]) return n("end"), !1;
  220. if (!c && !h) throw Error("try statement without catch or finally");
  221. if (null != i[0] && i[0] <= u) {
  222. if (u < c) return this.method = "next", this.arg = t, n(c), !0;
  223. if (u < h) return n(h), !1;
  224. }
  225. }
  226. },
  227. abrupt: function abrupt(t, r) {
  228. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  229. var n = this.tryEntries[e];
  230. if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
  231. var o = n;
  232. break;
  233. }
  234. }
  235. o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
  236. var i = o ? o[4] : {};
  237. return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
  238. },
  239. complete: function complete(t, r) {
  240. if ("throw" === t.type) throw t.arg;
  241. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
  242. },
  243. finish: function finish(t) {
  244. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  245. var e = this.tryEntries[r];
  246. if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
  247. }
  248. },
  249. "catch": function _catch(t) {
  250. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  251. var e = this.tryEntries[r];
  252. if (e[0] === t) {
  253. var n = e[4];
  254. if ("throw" === n.type) {
  255. var o = n.arg;
  256. m(e);
  257. }
  258. return o;
  259. }
  260. }
  261. throw Error("illegal catch attempt");
  262. },
  263. delegateYield: function delegateYield(r, e, n) {
  264. return this.delegate = {
  265. i: x(r),
  266. r: e,
  267. n: n
  268. }, "next" === this.method && (this.arg = t), f;
  269. }
  270. }, r;
  271. }
  272. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;