runtime.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /**
  2. * Copyright (c) 2014-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. var runtime = (function (exports) {
  8. "use strict";
  9. var Op = Object.prototype;
  10. var hasOwn = Op.hasOwnProperty;
  11. var undefined; // More compressible than void 0.
  12. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  13. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  14. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  15. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  16. function wrap(innerFn, outerFn, self, tryLocsList) {
  17. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  18. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  19. var generator = Object.create(protoGenerator.prototype);
  20. var context = new Context(tryLocsList || []);
  21. // The ._invoke method unifies the implementations of the .next,
  22. // .throw, and .return methods.
  23. generator._invoke = makeInvokeMethod(innerFn, self, context);
  24. return generator;
  25. }
  26. exports.wrap = wrap;
  27. // Try/catch helper to minimize deoptimizations. Returns a completion
  28. // record like context.tryEntries[i].completion. This interface could
  29. // have been (and was previously) designed to take a closure to be
  30. // invoked without arguments, but in all the cases we care about we
  31. // already have an existing method we want to call, so there's no need
  32. // to create a new function object. We can even get away with assuming
  33. // the method takes exactly one argument, since that happens to be true
  34. // in every case, so we don't have to touch the arguments object. The
  35. // only additional allocation required is the completion record, which
  36. // has a stable shape and so hopefully should be cheap to allocate.
  37. function tryCatch(fn, obj, arg) {
  38. try {
  39. return { type: "normal", arg: fn.call(obj, arg) };
  40. } catch (err) {
  41. return { type: "throw", arg: err };
  42. }
  43. }
  44. var GenStateSuspendedStart = "suspendedStart";
  45. var GenStateSuspendedYield = "suspendedYield";
  46. var GenStateExecuting = "executing";
  47. var GenStateCompleted = "completed";
  48. // Returning this object from the innerFn has the same effect as
  49. // breaking out of the dispatch switch statement.
  50. var ContinueSentinel = {};
  51. // Dummy constructor functions that we use as the .constructor and
  52. // .constructor.prototype properties for functions that return Generator
  53. // objects. For full spec compliance, you may wish to configure your
  54. // minifier not to mangle the names of these two functions.
  55. function Generator() {}
  56. function GeneratorFunction() {}
  57. function GeneratorFunctionPrototype() {}
  58. // This is a polyfill for %IteratorPrototype% for environments that
  59. // don't natively support it.
  60. var IteratorPrototype = {};
  61. IteratorPrototype[iteratorSymbol] = function () {
  62. return this;
  63. };
  64. var getProto = Object.getPrototypeOf;
  65. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  66. if (NativeIteratorPrototype &&
  67. NativeIteratorPrototype !== Op &&
  68. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  69. // This environment has a native %IteratorPrototype%; use it instead
  70. // of the polyfill.
  71. IteratorPrototype = NativeIteratorPrototype;
  72. }
  73. var Gp = GeneratorFunctionPrototype.prototype =
  74. Generator.prototype = Object.create(IteratorPrototype);
  75. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  76. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  77. GeneratorFunctionPrototype[toStringTagSymbol] =
  78. GeneratorFunction.displayName = "GeneratorFunction";
  79. // Helper for defining the .next, .throw, and .return methods of the
  80. // Iterator interface in terms of a single ._invoke method.
  81. function defineIteratorMethods(prototype) {
  82. ["next", "throw", "return"].forEach(function(method) {
  83. prototype[method] = function(arg) {
  84. return this._invoke(method, arg);
  85. };
  86. });
  87. }
  88. exports.isGeneratorFunction = function(genFun) {
  89. var ctor = typeof genFun === "function" && genFun.constructor;
  90. return ctor
  91. ? ctor === GeneratorFunction ||
  92. // For the native GeneratorFunction constructor, the best we can
  93. // do is to check its .name property.
  94. (ctor.displayName || ctor.name) === "GeneratorFunction"
  95. : false;
  96. };
  97. exports.mark = function(genFun) {
  98. if (Object.setPrototypeOf) {
  99. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  100. } else {
  101. genFun.__proto__ = GeneratorFunctionPrototype;
  102. if (!(toStringTagSymbol in genFun)) {
  103. genFun[toStringTagSymbol] = "GeneratorFunction";
  104. }
  105. }
  106. genFun.prototype = Object.create(Gp);
  107. return genFun;
  108. };
  109. // Within the body of any async function, `await x` is transformed to
  110. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  111. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  112. // meant to be awaited.
  113. exports.awrap = function(arg) {
  114. return { __await: arg };
  115. };
  116. function AsyncIterator(generator, PromiseImpl) {
  117. function invoke(method, arg, resolve, reject) {
  118. var record = tryCatch(generator[method], generator, arg);
  119. if (record.type === "throw") {
  120. reject(record.arg);
  121. } else {
  122. var result = record.arg;
  123. var value = result.value;
  124. if (value &&
  125. typeof value === "object" &&
  126. hasOwn.call(value, "__await")) {
  127. return PromiseImpl.resolve(value.__await).then(function(value) {
  128. invoke("next", value, resolve, reject);
  129. }, function(err) {
  130. invoke("throw", err, resolve, reject);
  131. });
  132. }
  133. return PromiseImpl.resolve(value).then(function(unwrapped) {
  134. // When a yielded Promise is resolved, its final value becomes
  135. // the .value of the Promise<{value,done}> result for the
  136. // current iteration.
  137. result.value = unwrapped;
  138. resolve(result);
  139. }, function(error) {
  140. // If a rejected Promise was yielded, throw the rejection back
  141. // into the async generator function so it can be handled there.
  142. return invoke("throw", error, resolve, reject);
  143. });
  144. }
  145. }
  146. var previousPromise;
  147. function enqueue(method, arg) {
  148. function callInvokeWithMethodAndArg() {
  149. return new PromiseImpl(function(resolve, reject) {
  150. invoke(method, arg, resolve, reject);
  151. });
  152. }
  153. return previousPromise =
  154. // If enqueue has been called before, then we want to wait until
  155. // all previous Promises have been resolved before calling invoke,
  156. // so that results are always delivered in the correct order. If
  157. // enqueue has not been called before, then it is important to
  158. // call invoke immediately, without waiting on a callback to fire,
  159. // so that the async generator function has the opportunity to do
  160. // any necessary setup in a predictable way. This predictability
  161. // is why the Promise constructor synchronously invokes its
  162. // executor callback, and why async functions synchronously
  163. // execute code before the first await. Since we implement simple
  164. // async functions in terms of async generators, it is especially
  165. // important to get this right, even though it requires care.
  166. previousPromise ? previousPromise.then(
  167. callInvokeWithMethodAndArg,
  168. // Avoid propagating failures to Promises returned by later
  169. // invocations of the iterator.
  170. callInvokeWithMethodAndArg
  171. ) : callInvokeWithMethodAndArg();
  172. }
  173. // Define the unified helper method that is used to implement .next,
  174. // .throw, and .return (see defineIteratorMethods).
  175. this._invoke = enqueue;
  176. }
  177. defineIteratorMethods(AsyncIterator.prototype);
  178. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  179. return this;
  180. };
  181. exports.AsyncIterator = AsyncIterator;
  182. // Note that simple async functions are implemented on top of
  183. // AsyncIterator objects; they just return a Promise for the value of
  184. // the final result produced by the iterator.
  185. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  186. if (PromiseImpl === void 0) PromiseImpl = Promise;
  187. var iter = new AsyncIterator(
  188. wrap(innerFn, outerFn, self, tryLocsList),
  189. PromiseImpl
  190. );
  191. return exports.isGeneratorFunction(outerFn)
  192. ? iter // If outerFn is a generator, return the full iterator.
  193. : iter.next().then(function(result) {
  194. return result.done ? result.value : iter.next();
  195. });
  196. };
  197. function makeInvokeMethod(innerFn, self, context) {
  198. var state = GenStateSuspendedStart;
  199. return function invoke(method, arg) {
  200. if (state === GenStateExecuting) {
  201. throw new Error("Generator is already running");
  202. }
  203. if (state === GenStateCompleted) {
  204. if (method === "throw") {
  205. throw arg;
  206. }
  207. // Be forgiving, per 25.3.3.3.3 of the spec:
  208. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  209. return doneResult();
  210. }
  211. context.method = method;
  212. context.arg = arg;
  213. while (true) {
  214. var delegate = context.delegate;
  215. if (delegate) {
  216. var delegateResult = maybeInvokeDelegate(delegate, context);
  217. if (delegateResult) {
  218. if (delegateResult === ContinueSentinel) continue;
  219. return delegateResult;
  220. }
  221. }
  222. if (context.method === "next") {
  223. // Setting context._sent for legacy support of Babel's
  224. // function.sent implementation.
  225. context.sent = context._sent = context.arg;
  226. } else if (context.method === "throw") {
  227. if (state === GenStateSuspendedStart) {
  228. state = GenStateCompleted;
  229. throw context.arg;
  230. }
  231. context.dispatchException(context.arg);
  232. } else if (context.method === "return") {
  233. context.abrupt("return", context.arg);
  234. }
  235. state = GenStateExecuting;
  236. var record = tryCatch(innerFn, self, context);
  237. if (record.type === "normal") {
  238. // If an exception is thrown from innerFn, we leave state ===
  239. // GenStateExecuting and loop back for another invocation.
  240. state = context.done
  241. ? GenStateCompleted
  242. : GenStateSuspendedYield;
  243. if (record.arg === ContinueSentinel) {
  244. continue;
  245. }
  246. return {
  247. value: record.arg,
  248. done: context.done
  249. };
  250. } else if (record.type === "throw") {
  251. state = GenStateCompleted;
  252. // Dispatch the exception by looping back around to the
  253. // context.dispatchException(context.arg) call above.
  254. context.method = "throw";
  255. context.arg = record.arg;
  256. }
  257. }
  258. };
  259. }
  260. // Call delegate.iterator[context.method](context.arg) and handle the
  261. // result, either by returning a { value, done } result from the
  262. // delegate iterator, or by modifying context.method and context.arg,
  263. // setting context.delegate to null, and returning the ContinueSentinel.
  264. function maybeInvokeDelegate(delegate, context) {
  265. var method = delegate.iterator[context.method];
  266. if (method === undefined) {
  267. // A .throw or .return when the delegate iterator has no .throw
  268. // method always terminates the yield* loop.
  269. context.delegate = null;
  270. if (context.method === "throw") {
  271. // Note: ["return"] must be used for ES3 parsing compatibility.
  272. if (delegate.iterator["return"]) {
  273. // If the delegate iterator has a return method, give it a
  274. // chance to clean up.
  275. context.method = "return";
  276. context.arg = undefined;
  277. maybeInvokeDelegate(delegate, context);
  278. if (context.method === "throw") {
  279. // If maybeInvokeDelegate(context) changed context.method from
  280. // "return" to "throw", let that override the TypeError below.
  281. return ContinueSentinel;
  282. }
  283. }
  284. context.method = "throw";
  285. context.arg = new TypeError(
  286. "The iterator does not provide a 'throw' method");
  287. }
  288. return ContinueSentinel;
  289. }
  290. var record = tryCatch(method, delegate.iterator, context.arg);
  291. if (record.type === "throw") {
  292. context.method = "throw";
  293. context.arg = record.arg;
  294. context.delegate = null;
  295. return ContinueSentinel;
  296. }
  297. var info = record.arg;
  298. if (! info) {
  299. context.method = "throw";
  300. context.arg = new TypeError("iterator result is not an object");
  301. context.delegate = null;
  302. return ContinueSentinel;
  303. }
  304. if (info.done) {
  305. // Assign the result of the finished delegate to the temporary
  306. // variable specified by delegate.resultName (see delegateYield).
  307. context[delegate.resultName] = info.value;
  308. // Resume execution at the desired location (see delegateYield).
  309. context.next = delegate.nextLoc;
  310. // If context.method was "throw" but the delegate handled the
  311. // exception, let the outer generator proceed normally. If
  312. // context.method was "next", forget context.arg since it has been
  313. // "consumed" by the delegate iterator. If context.method was
  314. // "return", allow the original .return call to continue in the
  315. // outer generator.
  316. if (context.method !== "return") {
  317. context.method = "next";
  318. context.arg = undefined;
  319. }
  320. } else {
  321. // Re-yield the result returned by the delegate method.
  322. return info;
  323. }
  324. // The delegate iterator is finished, so forget it and continue with
  325. // the outer generator.
  326. context.delegate = null;
  327. return ContinueSentinel;
  328. }
  329. // Define Generator.prototype.{next,throw,return} in terms of the
  330. // unified ._invoke helper method.
  331. defineIteratorMethods(Gp);
  332. Gp[toStringTagSymbol] = "Generator";
  333. // A Generator should always return itself as the iterator object when the
  334. // @@iterator function is called on it. Some browsers' implementations of the
  335. // iterator prototype chain incorrectly implement this, causing the Generator
  336. // object to not be returned from this call. This ensures that doesn't happen.
  337. // See https://github.com/facebook/regenerator/issues/274 for more details.
  338. Gp[iteratorSymbol] = function() {
  339. return this;
  340. };
  341. Gp.toString = function() {
  342. return "[object Generator]";
  343. };
  344. function pushTryEntry(locs) {
  345. var entry = { tryLoc: locs[0] };
  346. if (1 in locs) {
  347. entry.catchLoc = locs[1];
  348. }
  349. if (2 in locs) {
  350. entry.finallyLoc = locs[2];
  351. entry.afterLoc = locs[3];
  352. }
  353. this.tryEntries.push(entry);
  354. }
  355. function resetTryEntry(entry) {
  356. var record = entry.completion || {};
  357. record.type = "normal";
  358. delete record.arg;
  359. entry.completion = record;
  360. }
  361. function Context(tryLocsList) {
  362. // The root entry object (effectively a try statement without a catch
  363. // or a finally block) gives us a place to store values thrown from
  364. // locations where there is no enclosing try statement.
  365. this.tryEntries = [{ tryLoc: "root" }];
  366. tryLocsList.forEach(pushTryEntry, this);
  367. this.reset(true);
  368. }
  369. exports.keys = function(object) {
  370. var keys = [];
  371. for (var key in object) {
  372. keys.push(key);
  373. }
  374. keys.reverse();
  375. // Rather than returning an object with a next method, we keep
  376. // things simple and return the next function itself.
  377. return function next() {
  378. while (keys.length) {
  379. var key = keys.pop();
  380. if (key in object) {
  381. next.value = key;
  382. next.done = false;
  383. return next;
  384. }
  385. }
  386. // To avoid creating an additional object, we just hang the .value
  387. // and .done properties off the next function object itself. This
  388. // also ensures that the minifier will not anonymize the function.
  389. next.done = true;
  390. return next;
  391. };
  392. };
  393. function values(iterable) {
  394. if (iterable) {
  395. var iteratorMethod = iterable[iteratorSymbol];
  396. if (iteratorMethod) {
  397. return iteratorMethod.call(iterable);
  398. }
  399. if (typeof iterable.next === "function") {
  400. return iterable;
  401. }
  402. if (!isNaN(iterable.length)) {
  403. var i = -1, next = function next() {
  404. while (++i < iterable.length) {
  405. if (hasOwn.call(iterable, i)) {
  406. next.value = iterable[i];
  407. next.done = false;
  408. return next;
  409. }
  410. }
  411. next.value = undefined;
  412. next.done = true;
  413. return next;
  414. };
  415. return next.next = next;
  416. }
  417. }
  418. // Return an iterator with no values.
  419. return { next: doneResult };
  420. }
  421. exports.values = values;
  422. function doneResult() {
  423. return { value: undefined, done: true };
  424. }
  425. Context.prototype = {
  426. constructor: Context,
  427. reset: function(skipTempReset) {
  428. this.prev = 0;
  429. this.next = 0;
  430. // Resetting context._sent for legacy support of Babel's
  431. // function.sent implementation.
  432. this.sent = this._sent = undefined;
  433. this.done = false;
  434. this.delegate = null;
  435. this.method = "next";
  436. this.arg = undefined;
  437. this.tryEntries.forEach(resetTryEntry);
  438. if (!skipTempReset) {
  439. for (var name in this) {
  440. // Not sure about the optimal order of these conditions:
  441. if (name.charAt(0) === "t" &&
  442. hasOwn.call(this, name) &&
  443. !isNaN(+name.slice(1))) {
  444. this[name] = undefined;
  445. }
  446. }
  447. }
  448. },
  449. stop: function() {
  450. this.done = true;
  451. var rootEntry = this.tryEntries[0];
  452. var rootRecord = rootEntry.completion;
  453. if (rootRecord.type === "throw") {
  454. throw rootRecord.arg;
  455. }
  456. return this.rval;
  457. },
  458. dispatchException: function(exception) {
  459. if (this.done) {
  460. throw exception;
  461. }
  462. var context = this;
  463. function handle(loc, caught) {
  464. record.type = "throw";
  465. record.arg = exception;
  466. context.next = loc;
  467. if (caught) {
  468. // If the dispatched exception was caught by a catch block,
  469. // then let that catch block handle the exception normally.
  470. context.method = "next";
  471. context.arg = undefined;
  472. }
  473. return !! caught;
  474. }
  475. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  476. var entry = this.tryEntries[i];
  477. var record = entry.completion;
  478. if (entry.tryLoc === "root") {
  479. // Exception thrown outside of any try block that could handle
  480. // it, so set the completion value of the entire function to
  481. // throw the exception.
  482. return handle("end");
  483. }
  484. if (entry.tryLoc <= this.prev) {
  485. var hasCatch = hasOwn.call(entry, "catchLoc");
  486. var hasFinally = hasOwn.call(entry, "finallyLoc");
  487. if (hasCatch && hasFinally) {
  488. if (this.prev < entry.catchLoc) {
  489. return handle(entry.catchLoc, true);
  490. } else if (this.prev < entry.finallyLoc) {
  491. return handle(entry.finallyLoc);
  492. }
  493. } else if (hasCatch) {
  494. if (this.prev < entry.catchLoc) {
  495. return handle(entry.catchLoc, true);
  496. }
  497. } else if (hasFinally) {
  498. if (this.prev < entry.finallyLoc) {
  499. return handle(entry.finallyLoc);
  500. }
  501. } else {
  502. throw new Error("try statement without catch or finally");
  503. }
  504. }
  505. }
  506. },
  507. abrupt: function(type, arg) {
  508. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  509. var entry = this.tryEntries[i];
  510. if (entry.tryLoc <= this.prev &&
  511. hasOwn.call(entry, "finallyLoc") &&
  512. this.prev < entry.finallyLoc) {
  513. var finallyEntry = entry;
  514. break;
  515. }
  516. }
  517. if (finallyEntry &&
  518. (type === "break" ||
  519. type === "continue") &&
  520. finallyEntry.tryLoc <= arg &&
  521. arg <= finallyEntry.finallyLoc) {
  522. // Ignore the finally entry if control is not jumping to a
  523. // location outside the try/catch block.
  524. finallyEntry = null;
  525. }
  526. var record = finallyEntry ? finallyEntry.completion : {};
  527. record.type = type;
  528. record.arg = arg;
  529. if (finallyEntry) {
  530. this.method = "next";
  531. this.next = finallyEntry.finallyLoc;
  532. return ContinueSentinel;
  533. }
  534. return this.complete(record);
  535. },
  536. complete: function(record, afterLoc) {
  537. if (record.type === "throw") {
  538. throw record.arg;
  539. }
  540. if (record.type === "break" ||
  541. record.type === "continue") {
  542. this.next = record.arg;
  543. } else if (record.type === "return") {
  544. this.rval = this.arg = record.arg;
  545. this.method = "return";
  546. this.next = "end";
  547. } else if (record.type === "normal" && afterLoc) {
  548. this.next = afterLoc;
  549. }
  550. return ContinueSentinel;
  551. },
  552. finish: function(finallyLoc) {
  553. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  554. var entry = this.tryEntries[i];
  555. if (entry.finallyLoc === finallyLoc) {
  556. this.complete(entry.completion, entry.afterLoc);
  557. resetTryEntry(entry);
  558. return ContinueSentinel;
  559. }
  560. }
  561. },
  562. "catch": function(tryLoc) {
  563. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  564. var entry = this.tryEntries[i];
  565. if (entry.tryLoc === tryLoc) {
  566. var record = entry.completion;
  567. if (record.type === "throw") {
  568. var thrown = record.arg;
  569. resetTryEntry(entry);
  570. }
  571. return thrown;
  572. }
  573. }
  574. // The context.catch method must only be called with a location
  575. // argument that corresponds to a known catch block.
  576. throw new Error("illegal catch attempt");
  577. },
  578. delegateYield: function(iterable, resultName, nextLoc) {
  579. this.delegate = {
  580. iterator: values(iterable),
  581. resultName: resultName,
  582. nextLoc: nextLoc
  583. };
  584. if (this.method === "next") {
  585. // Deliberately forget the last sent value so that we don't
  586. // accidentally pass it on to the delegate.
  587. this.arg = undefined;
  588. }
  589. return ContinueSentinel;
  590. }
  591. };
  592. // Regardless of whether this script is executing as a CommonJS module
  593. // or not, return the runtime object so that we can declare the variable
  594. // regeneratorRuntime in the outer scope, which allows this module to be
  595. // injected easily by `bin/regenerator --include-runtime script.js`.
  596. return exports;
  597. }(
  598. // If this script is executing as a CommonJS module, use module.exports
  599. // as the regeneratorRuntime namespace. Otherwise create a new empty
  600. // object. Either way, the resulting object will be used to initialize
  601. // the regeneratorRuntime variable at the top of this file.
  602. typeof module === "object" ? module.exports : {}
  603. ));
  604. try {
  605. regeneratorRuntime = runtime;
  606. } catch (accidentalStrictMode) {
  607. // This module should not be running in strict mode, so the above
  608. // assignment should always work unless something is misconfigured. Just
  609. // in case runtime.js accidentally runs in strict mode, we can escape
  610. // strict mode using a global Function call. This could conceivably fail
  611. // if a Content Security Policy forbids using Function, but in that case
  612. // the proper solution is to fix the accidental strict mode problem. If
  613. // you've misconfigured your bundler to force strict mode and applied a
  614. // CSP to forbid Function, and you're not willing to fix either of those
  615. // problems, please detail your unique predicament in a GitHub issue.
  616. Function("r", "regeneratorRuntime = r")(runtime);
  617. }