[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/js/dist/ -> token-list.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["tokenList"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 337);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 11:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
  95  function _defineProperties(target, props) {
  96    for (var i = 0; i < props.length; i++) {
  97      var descriptor = props[i];
  98      descriptor.enumerable = descriptor.enumerable || false;
  99      descriptor.configurable = true;
 100      if ("value" in descriptor) descriptor.writable = true;
 101      Object.defineProperty(target, descriptor.key, descriptor);
 102    }
 103  }
 104  
 105  function _createClass(Constructor, protoProps, staticProps) {
 106    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 107    if (staticProps) _defineProperties(Constructor, staticProps);
 108    return Constructor;
 109  }
 110  
 111  /***/ }),
 112  
 113  /***/ 12:
 114  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 115  
 116  "use strict";
 117  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 118  function _classCallCheck(instance, Constructor) {
 119    if (!(instance instanceof Constructor)) {
 120      throw new TypeError("Cannot call a class as a function");
 121    }
 122  }
 123  
 124  /***/ }),
 125  
 126  /***/ 2:
 127  /***/ (function(module, exports) {
 128  
 129  (function() { module.exports = this["lodash"]; }());
 130  
 131  /***/ }),
 132  
 133  /***/ 20:
 134  /***/ (function(module, exports, __webpack_require__) {
 135  
 136  module.exports = __webpack_require__(47);
 137  
 138  
 139  /***/ }),
 140  
 141  /***/ 337:
 142  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 143  
 144  "use strict";
 145  __webpack_require__.r(__webpack_exports__);
 146  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TokenList; });
 147  /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
 148  /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
 149  /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
 150  /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11);
 151  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
 152  /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
 153  
 154  
 155  
 156  
 157  /**
 158   * External dependencies
 159   */
 160  
 161  /**
 162   * A set of tokens.
 163   *
 164   * @see https://dom.spec.whatwg.org/#domtokenlist
 165   */
 166  
 167  var TokenList =
 168  /*#__PURE__*/
 169  function () {
 170    /**
 171     * Constructs a new instance of TokenList.
 172     *
 173     * @param {string} initialValue Initial value to assign.
 174     */
 175    function TokenList() {
 176      var _this = this;
 177  
 178      var initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
 179  
 180      Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(this, TokenList);
 181  
 182      this.value = initialValue;
 183      ['entries', 'forEach', 'keys', 'values'].forEach(function (fn) {
 184        _this[fn] = function () {
 185          var _this$_valueAsArray;
 186  
 187          return (_this$_valueAsArray = this._valueAsArray)[fn].apply(_this$_valueAsArray, arguments);
 188        }.bind(_this);
 189      });
 190    }
 191    /**
 192     * Returns the associated set as string.
 193     *
 194     * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
 195     *
 196     * @return {string} Token set as string.
 197     */
 198  
 199  
 200    Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(TokenList, [{
 201      key: "toString",
 202  
 203      /**
 204       * Returns the stringified form of the TokenList.
 205       *
 206       * @see https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior
 207       * @see https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring
 208       *
 209       * @return {string} Token set as string.
 210       */
 211      value: function toString() {
 212        return this.value;
 213      }
 214      /**
 215       * Returns an iterator for the TokenList, iterating items of the set.
 216       *
 217       * @see https://dom.spec.whatwg.org/#domtokenlist
 218       *
 219       * @return {IterableIterator<string>} TokenList iterator.
 220       */
 221  
 222    }, {
 223      key: Symbol.iterator,
 224      value:
 225      /*#__PURE__*/
 226      _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function value() {
 227        return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function value$(_context) {
 228          while (1) {
 229            switch (_context.prev = _context.next) {
 230              case 0:
 231                return _context.delegateYield(this._valueAsArray, "t0", 1);
 232  
 233              case 1:
 234                return _context.abrupt("return", _context.t0);
 235  
 236              case 2:
 237              case "end":
 238                return _context.stop();
 239            }
 240          }
 241        }, value, this);
 242      })
 243      /**
 244       * Returns the token with index `index`.
 245       *
 246       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-item
 247       *
 248       * @param {number} index Index at which to return token.
 249       *
 250       * @return {?string} Token at index.
 251       */
 252  
 253    }, {
 254      key: "item",
 255      value: function item(index) {
 256        return this._valueAsArray[index];
 257      }
 258      /**
 259       * Returns true if `token` is present, and false otherwise.
 260       *
 261       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-contains
 262       *
 263       * @param {string} item Token to test.
 264       *
 265       * @return {boolean} Whether token is present.
 266       */
 267  
 268    }, {
 269      key: "contains",
 270      value: function contains(item) {
 271        return this._valueAsArray.indexOf(item) !== -1;
 272      }
 273      /**
 274       * Adds all arguments passed, except those already present.
 275       *
 276       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-add
 277       *
 278       * @param {...string} items Items to add.
 279       */
 280  
 281    }, {
 282      key: "add",
 283      value: function add() {
 284        for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
 285          items[_key] = arguments[_key];
 286        }
 287  
 288        this.value += ' ' + items.join(' ');
 289      }
 290      /**
 291       * Removes arguments passed, if they are present.
 292       *
 293       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-remove
 294       *
 295       * @param {...string} items Items to remove.
 296       */
 297  
 298    }, {
 299      key: "remove",
 300      value: function remove() {
 301        for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
 302          items[_key2] = arguments[_key2];
 303        }
 304  
 305        this.value = lodash__WEBPACK_IMPORTED_MODULE_3__["without"].apply(void 0, [this._valueAsArray].concat(items)).join(' ');
 306      }
 307      /**
 308       * If `force` is not given, "toggles" `token`, removing it if it’s present
 309       * and adding it if it’s not present. If `force` is true, adds token (same
 310       * as add()). If force is false, removes token (same as remove()). Returns
 311       * true if `token` is now present, and false otherwise.
 312       *
 313       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
 314       *
 315       * @param {string}   token Token to toggle.
 316       * @param {?boolean} force Presence to force.
 317       *
 318       * @return {boolean} Whether token is present after toggle.
 319       */
 320  
 321    }, {
 322      key: "toggle",
 323      value: function toggle(token, force) {
 324        if (undefined === force) {
 325          force = !this.contains(token);
 326        }
 327  
 328        if (force) {
 329          this.add(token);
 330        } else {
 331          this.remove(token);
 332        }
 333  
 334        return force;
 335      }
 336      /**
 337       * Replaces `token` with `newToken`. Returns true if `token` was replaced
 338       * with `newToken`, and false otherwise.
 339       *
 340       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-replace
 341       *
 342       * @param {string} token    Token to replace with `newToken`.
 343       * @param {string} newToken Token to use in place of `token`.
 344       *
 345       * @return {boolean} Whether replacement occurred.
 346       */
 347  
 348    }, {
 349      key: "replace",
 350      value: function replace(token, newToken) {
 351        if (!this.contains(token)) {
 352          return false;
 353        }
 354  
 355        this.remove(token);
 356        this.add(newToken);
 357        return true;
 358      }
 359      /**
 360       * Returns true if `token` is in the associated attribute’s supported
 361       * tokens. Returns false otherwise.
 362       *
 363       * Always returns `true` in this implementation.
 364       *
 365       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports
 366       *
 367       * @return {boolean} Whether token is supported.
 368       */
 369  
 370    }, {
 371      key: "supports",
 372      value: function supports() {
 373        return true;
 374      }
 375    }, {
 376      key: "value",
 377      get: function get() {
 378        return this._currentValue;
 379      }
 380      /**
 381       * Replaces the associated set with a new string value.
 382       *
 383       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
 384       *
 385       * @param {string} value New token set as string.
 386       */
 387      ,
 388      set: function set(value) {
 389        value = String(value);
 390        this._valueAsArray = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["uniq"])(Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(value.split(/\s+/g)));
 391        this._currentValue = this._valueAsArray.join(' ');
 392      }
 393      /**
 394       * Returns the number of tokens.
 395       *
 396       * @see https://dom.spec.whatwg.org/#dom-domtokenlist-length
 397       *
 398       * @return {number} Number of tokens.
 399       */
 400  
 401    }, {
 402      key: "length",
 403      get: function get() {
 404        return this._valueAsArray.length;
 405      }
 406    }]);
 407  
 408    return TokenList;
 409  }();
 410  
 411  
 412  
 413  
 414  /***/ }),
 415  
 416  /***/ 47:
 417  /***/ (function(module, exports, __webpack_require__) {
 418  
 419  /**
 420   * Copyright (c) 2014-present, Facebook, Inc.
 421   *
 422   * This source code is licensed under the MIT license found in the
 423   * LICENSE file in the root directory of this source tree.
 424   */
 425  
 426  var runtime = (function (exports) {
 427    "use strict";
 428  
 429    var Op = Object.prototype;
 430    var hasOwn = Op.hasOwnProperty;
 431    var undefined; // More compressible than void 0.
 432    var $Symbol = typeof Symbol === "function" ? Symbol : {};
 433    var iteratorSymbol = $Symbol.iterator || "@@iterator";
 434    var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
 435    var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
 436  
 437    function wrap(innerFn, outerFn, self, tryLocsList) {
 438      // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
 439      var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
 440      var generator = Object.create(protoGenerator.prototype);
 441      var context = new Context(tryLocsList || []);
 442  
 443      // The ._invoke method unifies the implementations of the .next,
 444      // .throw, and .return methods.
 445      generator._invoke = makeInvokeMethod(innerFn, self, context);
 446  
 447      return generator;
 448    }
 449    exports.wrap = wrap;
 450  
 451    // Try/catch helper to minimize deoptimizations. Returns a completion
 452    // record like context.tryEntries[i].completion. This interface could
 453    // have been (and was previously) designed to take a closure to be
 454    // invoked without arguments, but in all the cases we care about we
 455    // already have an existing method we want to call, so there's no need
 456    // to create a new function object. We can even get away with assuming
 457    // the method takes exactly one argument, since that happens to be true
 458    // in every case, so we don't have to touch the arguments object. The
 459    // only additional allocation required is the completion record, which
 460    // has a stable shape and so hopefully should be cheap to allocate.
 461    function tryCatch(fn, obj, arg) {
 462      try {
 463        return { type: "normal", arg: fn.call(obj, arg) };
 464      } catch (err) {
 465        return { type: "throw", arg: err };
 466      }
 467    }
 468  
 469    var GenStateSuspendedStart = "suspendedStart";
 470    var GenStateSuspendedYield = "suspendedYield";
 471    var GenStateExecuting = "executing";
 472    var GenStateCompleted = "completed";
 473  
 474    // Returning this object from the innerFn has the same effect as
 475    // breaking out of the dispatch switch statement.
 476    var ContinueSentinel = {};
 477  
 478    // Dummy constructor functions that we use as the .constructor and
 479    // .constructor.prototype properties for functions that return Generator
 480    // objects. For full spec compliance, you may wish to configure your
 481    // minifier not to mangle the names of these two functions.
 482    function Generator() {}
 483    function GeneratorFunction() {}
 484    function GeneratorFunctionPrototype() {}
 485  
 486    // This is a polyfill for %IteratorPrototype% for environments that
 487    // don't natively support it.
 488    var IteratorPrototype = {};
 489    IteratorPrototype[iteratorSymbol] = function () {
 490      return this;
 491    };
 492  
 493    var getProto = Object.getPrototypeOf;
 494    var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
 495    if (NativeIteratorPrototype &&
 496        NativeIteratorPrototype !== Op &&
 497        hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
 498      // This environment has a native %IteratorPrototype%; use it instead
 499      // of the polyfill.
 500      IteratorPrototype = NativeIteratorPrototype;
 501    }
 502  
 503    var Gp = GeneratorFunctionPrototype.prototype =
 504      Generator.prototype = Object.create(IteratorPrototype);
 505    GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
 506    GeneratorFunctionPrototype.constructor = GeneratorFunction;
 507    GeneratorFunctionPrototype[toStringTagSymbol] =
 508      GeneratorFunction.displayName = "GeneratorFunction";
 509  
 510    // Helper for defining the .next, .throw, and .return methods of the
 511    // Iterator interface in terms of a single ._invoke method.
 512    function defineIteratorMethods(prototype) {
 513      ["next", "throw", "return"].forEach(function(method) {
 514        prototype[method] = function(arg) {
 515          return this._invoke(method, arg);
 516        };
 517      });
 518    }
 519  
 520    exports.isGeneratorFunction = function(genFun) {
 521      var ctor = typeof genFun === "function" && genFun.constructor;
 522      return ctor
 523        ? ctor === GeneratorFunction ||
 524          // For the native GeneratorFunction constructor, the best we can
 525          // do is to check its .name property.
 526          (ctor.displayName || ctor.name) === "GeneratorFunction"
 527        : false;
 528    };
 529  
 530    exports.mark = function(genFun) {
 531      if (Object.setPrototypeOf) {
 532        Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
 533      } else {
 534        genFun.__proto__ = GeneratorFunctionPrototype;
 535        if (!(toStringTagSymbol in genFun)) {
 536          genFun[toStringTagSymbol] = "GeneratorFunction";
 537        }
 538      }
 539      genFun.prototype = Object.create(Gp);
 540      return genFun;
 541    };
 542  
 543    // Within the body of any async function, `await x` is transformed to
 544    // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
 545    // `hasOwn.call(value, "__await")` to determine if the yielded value is
 546    // meant to be awaited.
 547    exports.awrap = function(arg) {
 548      return { __await: arg };
 549    };
 550  
 551    function AsyncIterator(generator) {
 552      function invoke(method, arg, resolve, reject) {
 553        var record = tryCatch(generator[method], generator, arg);
 554        if (record.type === "throw") {
 555          reject(record.arg);
 556        } else {
 557          var result = record.arg;
 558          var value = result.value;
 559          if (value &&
 560              typeof value === "object" &&
 561              hasOwn.call(value, "__await")) {
 562            return Promise.resolve(value.__await).then(function(value) {
 563              invoke("next", value, resolve, reject);
 564            }, function(err) {
 565              invoke("throw", err, resolve, reject);
 566            });
 567          }
 568  
 569          return Promise.resolve(value).then(function(unwrapped) {
 570            // When a yielded Promise is resolved, its final value becomes
 571            // the .value of the Promise<{value,done}> result for the
 572            // current iteration.
 573            result.value = unwrapped;
 574            resolve(result);
 575          }, function(error) {
 576            // If a rejected Promise was yielded, throw the rejection back
 577            // into the async generator function so it can be handled there.
 578            return invoke("throw", error, resolve, reject);
 579          });
 580        }
 581      }
 582  
 583      var previousPromise;
 584  
 585      function enqueue(method, arg) {
 586        function callInvokeWithMethodAndArg() {
 587          return new Promise(function(resolve, reject) {
 588            invoke(method, arg, resolve, reject);
 589          });
 590        }
 591  
 592        return previousPromise =
 593          // If enqueue has been called before, then we want to wait until
 594          // all previous Promises have been resolved before calling invoke,
 595          // so that results are always delivered in the correct order. If
 596          // enqueue has not been called before, then it is important to
 597          // call invoke immediately, without waiting on a callback to fire,
 598          // so that the async generator function has the opportunity to do
 599          // any necessary setup in a predictable way. This predictability
 600          // is why the Promise constructor synchronously invokes its
 601          // executor callback, and why async functions synchronously
 602          // execute code before the first await. Since we implement simple
 603          // async functions in terms of async generators, it is especially
 604          // important to get this right, even though it requires care.
 605          previousPromise ? previousPromise.then(
 606            callInvokeWithMethodAndArg,
 607            // Avoid propagating failures to Promises returned by later
 608            // invocations of the iterator.
 609            callInvokeWithMethodAndArg
 610          ) : callInvokeWithMethodAndArg();
 611      }
 612  
 613      // Define the unified helper method that is used to implement .next,
 614      // .throw, and .return (see defineIteratorMethods).
 615      this._invoke = enqueue;
 616    }
 617  
 618    defineIteratorMethods(AsyncIterator.prototype);
 619    AsyncIterator.prototype[asyncIteratorSymbol] = function () {
 620      return this;
 621    };
 622    exports.AsyncIterator = AsyncIterator;
 623  
 624    // Note that simple async functions are implemented on top of
 625    // AsyncIterator objects; they just return a Promise for the value of
 626    // the final result produced by the iterator.
 627    exports.async = function(innerFn, outerFn, self, tryLocsList) {
 628      var iter = new AsyncIterator(
 629        wrap(innerFn, outerFn, self, tryLocsList)
 630      );
 631  
 632      return exports.isGeneratorFunction(outerFn)
 633        ? iter // If outerFn is a generator, return the full iterator.
 634        : iter.next().then(function(result) {
 635            return result.done ? result.value : iter.next();
 636          });
 637    };
 638  
 639    function makeInvokeMethod(innerFn, self, context) {
 640      var state = GenStateSuspendedStart;
 641  
 642      return function invoke(method, arg) {
 643        if (state === GenStateExecuting) {
 644          throw new Error("Generator is already running");
 645        }
 646  
 647        if (state === GenStateCompleted) {
 648          if (method === "throw") {
 649            throw arg;
 650          }
 651  
 652          // Be forgiving, per 25.3.3.3.3 of the spec:
 653          // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
 654          return doneResult();
 655        }
 656  
 657        context.method = method;
 658        context.arg = arg;
 659  
 660        while (true) {
 661          var delegate = context.delegate;
 662          if (delegate) {
 663            var delegateResult = maybeInvokeDelegate(delegate, context);
 664            if (delegateResult) {
 665              if (delegateResult === ContinueSentinel) continue;
 666              return delegateResult;
 667            }
 668          }
 669  
 670          if (context.method === "next") {
 671            // Setting context._sent for legacy support of Babel's
 672            // function.sent implementation.
 673            context.sent = context._sent = context.arg;
 674  
 675          } else if (context.method === "throw") {
 676            if (state === GenStateSuspendedStart) {
 677              state = GenStateCompleted;
 678              throw context.arg;
 679            }
 680  
 681            context.dispatchException(context.arg);
 682  
 683          } else if (context.method === "return") {
 684            context.abrupt("return", context.arg);
 685          }
 686  
 687          state = GenStateExecuting;
 688  
 689          var record = tryCatch(innerFn, self, context);
 690          if (record.type === "normal") {
 691            // If an exception is thrown from innerFn, we leave state ===
 692            // GenStateExecuting and loop back for another invocation.
 693            state = context.done
 694              ? GenStateCompleted
 695              : GenStateSuspendedYield;
 696  
 697            if (record.arg === ContinueSentinel) {
 698              continue;
 699            }
 700  
 701            return {
 702              value: record.arg,
 703              done: context.done
 704            };
 705  
 706          } else if (record.type === "throw") {
 707            state = GenStateCompleted;
 708            // Dispatch the exception by looping back around to the
 709            // context.dispatchException(context.arg) call above.
 710            context.method = "throw";
 711            context.arg = record.arg;
 712          }
 713        }
 714      };
 715    }
 716  
 717    // Call delegate.iterator[context.method](context.arg) and handle the
 718    // result, either by returning a { value, done } result from the
 719    // delegate iterator, or by modifying context.method and context.arg,
 720    // setting context.delegate to null, and returning the ContinueSentinel.
 721    function maybeInvokeDelegate(delegate, context) {
 722      var method = delegate.iterator[context.method];
 723      if (method === undefined) {
 724        // A .throw or .return when the delegate iterator has no .throw
 725        // method always terminates the yield* loop.
 726        context.delegate = null;
 727  
 728        if (context.method === "throw") {
 729          // Note: ["return"] must be used for ES3 parsing compatibility.
 730          if (delegate.iterator["return"]) {
 731            // If the delegate iterator has a return method, give it a
 732            // chance to clean up.
 733            context.method = "return";
 734            context.arg = undefined;
 735            maybeInvokeDelegate(delegate, context);
 736  
 737            if (context.method === "throw") {
 738              // If maybeInvokeDelegate(context) changed context.method from
 739              // "return" to "throw", let that override the TypeError below.
 740              return ContinueSentinel;
 741            }
 742          }
 743  
 744          context.method = "throw";
 745          context.arg = new TypeError(
 746            "The iterator does not provide a 'throw' method");
 747        }
 748  
 749        return ContinueSentinel;
 750      }
 751  
 752      var record = tryCatch(method, delegate.iterator, context.arg);
 753  
 754      if (record.type === "throw") {
 755        context.method = "throw";
 756        context.arg = record.arg;
 757        context.delegate = null;
 758        return ContinueSentinel;
 759      }
 760  
 761      var info = record.arg;
 762  
 763      if (! info) {
 764        context.method = "throw";
 765        context.arg = new TypeError("iterator result is not an object");
 766        context.delegate = null;
 767        return ContinueSentinel;
 768      }
 769  
 770      if (info.done) {
 771        // Assign the result of the finished delegate to the temporary
 772        // variable specified by delegate.resultName (see delegateYield).
 773        context[delegate.resultName] = info.value;
 774  
 775        // Resume execution at the desired location (see delegateYield).
 776        context.next = delegate.nextLoc;
 777  
 778        // If context.method was "throw" but the delegate handled the
 779        // exception, let the outer generator proceed normally. If
 780        // context.method was "next", forget context.arg since it has been
 781        // "consumed" by the delegate iterator. If context.method was
 782        // "return", allow the original .return call to continue in the
 783        // outer generator.
 784        if (context.method !== "return") {
 785          context.method = "next";
 786          context.arg = undefined;
 787        }
 788  
 789      } else {
 790        // Re-yield the result returned by the delegate method.
 791        return info;
 792      }
 793  
 794      // The delegate iterator is finished, so forget it and continue with
 795      // the outer generator.
 796      context.delegate = null;
 797      return ContinueSentinel;
 798    }
 799  
 800    // Define Generator.prototype.{next,throw,return} in terms of the
 801    // unified ._invoke helper method.
 802    defineIteratorMethods(Gp);
 803  
 804    Gp[toStringTagSymbol] = "Generator";
 805  
 806    // A Generator should always return itself as the iterator object when the
 807    // @@iterator function is called on it. Some browsers' implementations of the
 808    // iterator prototype chain incorrectly implement this, causing the Generator
 809    // object to not be returned from this call. This ensures that doesn't happen.
 810    // See https://github.com/facebook/regenerator/issues/274 for more details.
 811    Gp[iteratorSymbol] = function() {
 812      return this;
 813    };
 814  
 815    Gp.toString = function() {
 816      return "[object Generator]";
 817    };
 818  
 819    function pushTryEntry(locs) {
 820      var entry = { tryLoc: locs[0] };
 821  
 822      if (1 in locs) {
 823        entry.catchLoc = locs[1];
 824      }
 825  
 826      if (2 in locs) {
 827        entry.finallyLoc = locs[2];
 828        entry.afterLoc = locs[3];
 829      }
 830  
 831      this.tryEntries.push(entry);
 832    }
 833  
 834    function resetTryEntry(entry) {
 835      var record = entry.completion || {};
 836      record.type = "normal";
 837      delete record.arg;
 838      entry.completion = record;
 839    }
 840  
 841    function Context(tryLocsList) {
 842      // The root entry object (effectively a try statement without a catch
 843      // or a finally block) gives us a place to store values thrown from
 844      // locations where there is no enclosing try statement.
 845      this.tryEntries = [{ tryLoc: "root" }];
 846      tryLocsList.forEach(pushTryEntry, this);
 847      this.reset(true);
 848    }
 849  
 850    exports.keys = function(object) {
 851      var keys = [];
 852      for (var key in object) {
 853        keys.push(key);
 854      }
 855      keys.reverse();
 856  
 857      // Rather than returning an object with a next method, we keep
 858      // things simple and return the next function itself.
 859      return function next() {
 860        while (keys.length) {
 861          var key = keys.pop();
 862          if (key in object) {
 863            next.value = key;
 864            next.done = false;
 865            return next;
 866          }
 867        }
 868  
 869        // To avoid creating an additional object, we just hang the .value
 870        // and .done properties off the next function object itself. This
 871        // also ensures that the minifier will not anonymize the function.
 872        next.done = true;
 873        return next;
 874      };
 875    };
 876  
 877    function values(iterable) {
 878      if (iterable) {
 879        var iteratorMethod = iterable[iteratorSymbol];
 880        if (iteratorMethod) {
 881          return iteratorMethod.call(iterable);
 882        }
 883  
 884        if (typeof iterable.next === "function") {
 885          return iterable;
 886        }
 887  
 888        if (!isNaN(iterable.length)) {
 889          var i = -1, next = function next() {
 890            while (++i < iterable.length) {
 891              if (hasOwn.call(iterable, i)) {
 892                next.value = iterable[i];
 893                next.done = false;
 894                return next;
 895              }
 896            }
 897  
 898            next.value = undefined;
 899            next.done = true;
 900  
 901            return next;
 902          };
 903  
 904          return next.next = next;
 905        }
 906      }
 907  
 908      // Return an iterator with no values.
 909      return { next: doneResult };
 910    }
 911    exports.values = values;
 912  
 913    function doneResult() {
 914      return { value: undefined, done: true };
 915    }
 916  
 917    Context.prototype = {
 918      constructor: Context,
 919  
 920      reset: function(skipTempReset) {
 921        this.prev = 0;
 922        this.next = 0;
 923        // Resetting context._sent for legacy support of Babel's
 924        // function.sent implementation.
 925        this.sent = this._sent = undefined;
 926        this.done = false;
 927        this.delegate = null;
 928  
 929        this.method = "next";
 930        this.arg = undefined;
 931  
 932        this.tryEntries.forEach(resetTryEntry);
 933  
 934        if (!skipTempReset) {
 935          for (var name in this) {
 936            // Not sure about the optimal order of these conditions:
 937            if (name.charAt(0) === "t" &&
 938                hasOwn.call(this, name) &&
 939                !isNaN(+name.slice(1))) {
 940              this[name] = undefined;
 941            }
 942          }
 943        }
 944      },
 945  
 946      stop: function() {
 947        this.done = true;
 948  
 949        var rootEntry = this.tryEntries[0];
 950        var rootRecord = rootEntry.completion;
 951        if (rootRecord.type === "throw") {
 952          throw rootRecord.arg;
 953        }
 954  
 955        return this.rval;
 956      },
 957  
 958      dispatchException: function(exception) {
 959        if (this.done) {
 960          throw exception;
 961        }
 962  
 963        var context = this;
 964        function handle(loc, caught) {
 965          record.type = "throw";
 966          record.arg = exception;
 967          context.next = loc;
 968  
 969          if (caught) {
 970            // If the dispatched exception was caught by a catch block,
 971            // then let that catch block handle the exception normally.
 972            context.method = "next";
 973            context.arg = undefined;
 974          }
 975  
 976          return !! caught;
 977        }
 978  
 979        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
 980          var entry = this.tryEntries[i];
 981          var record = entry.completion;
 982  
 983          if (entry.tryLoc === "root") {
 984            // Exception thrown outside of any try block that could handle
 985            // it, so set the completion value of the entire function to
 986            // throw the exception.
 987            return handle("end");
 988          }
 989  
 990          if (entry.tryLoc <= this.prev) {
 991            var hasCatch = hasOwn.call(entry, "catchLoc");
 992            var hasFinally = hasOwn.call(entry, "finallyLoc");
 993  
 994            if (hasCatch && hasFinally) {
 995              if (this.prev < entry.catchLoc) {
 996                return handle(entry.catchLoc, true);
 997              } else if (this.prev < entry.finallyLoc) {
 998                return handle(entry.finallyLoc);
 999              }
1000  
1001            } else if (hasCatch) {
1002              if (this.prev < entry.catchLoc) {
1003                return handle(entry.catchLoc, true);
1004              }
1005  
1006            } else if (hasFinally) {
1007              if (this.prev < entry.finallyLoc) {
1008                return handle(entry.finallyLoc);
1009              }
1010  
1011            } else {
1012              throw new Error("try statement without catch or finally");
1013            }
1014          }
1015        }
1016      },
1017  
1018      abrupt: function(type, arg) {
1019        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1020          var entry = this.tryEntries[i];
1021          if (entry.tryLoc <= this.prev &&
1022              hasOwn.call(entry, "finallyLoc") &&
1023              this.prev < entry.finallyLoc) {
1024            var finallyEntry = entry;
1025            break;
1026          }
1027        }
1028  
1029        if (finallyEntry &&
1030            (type === "break" ||
1031             type === "continue") &&
1032            finallyEntry.tryLoc <= arg &&
1033            arg <= finallyEntry.finallyLoc) {
1034          // Ignore the finally entry if control is not jumping to a
1035          // location outside the try/catch block.
1036          finallyEntry = null;
1037        }
1038  
1039        var record = finallyEntry ? finallyEntry.completion : {};
1040        record.type = type;
1041        record.arg = arg;
1042  
1043        if (finallyEntry) {
1044          this.method = "next";
1045          this.next = finallyEntry.finallyLoc;
1046          return ContinueSentinel;
1047        }
1048  
1049        return this.complete(record);
1050      },
1051  
1052      complete: function(record, afterLoc) {
1053        if (record.type === "throw") {
1054          throw record.arg;
1055        }
1056  
1057        if (record.type === "break" ||
1058            record.type === "continue") {
1059          this.next = record.arg;
1060        } else if (record.type === "return") {
1061          this.rval = this.arg = record.arg;
1062          this.method = "return";
1063          this.next = "end";
1064        } else if (record.type === "normal" && afterLoc) {
1065          this.next = afterLoc;
1066        }
1067  
1068        return ContinueSentinel;
1069      },
1070  
1071      finish: function(finallyLoc) {
1072        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1073          var entry = this.tryEntries[i];
1074          if (entry.finallyLoc === finallyLoc) {
1075            this.complete(entry.completion, entry.afterLoc);
1076            resetTryEntry(entry);
1077            return ContinueSentinel;
1078          }
1079        }
1080      },
1081  
1082      "catch": function(tryLoc) {
1083        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1084          var entry = this.tryEntries[i];
1085          if (entry.tryLoc === tryLoc) {
1086            var record = entry.completion;
1087            if (record.type === "throw") {
1088              var thrown = record.arg;
1089              resetTryEntry(entry);
1090            }
1091            return thrown;
1092          }
1093        }
1094  
1095        // The context.catch method must only be called with a location
1096        // argument that corresponds to a known catch block.
1097        throw new Error("illegal catch attempt");
1098      },
1099  
1100      delegateYield: function(iterable, resultName, nextLoc) {
1101        this.delegate = {
1102          iterator: values(iterable),
1103          resultName: resultName,
1104          nextLoc: nextLoc
1105        };
1106  
1107        if (this.method === "next") {
1108          // Deliberately forget the last sent value so that we don't
1109          // accidentally pass it on to the delegate.
1110          this.arg = undefined;
1111        }
1112  
1113        return ContinueSentinel;
1114      }
1115    };
1116  
1117    // Regardless of whether this script is executing as a CommonJS module
1118    // or not, return the runtime object so that we can declare the variable
1119    // regeneratorRuntime in the outer scope, which allows this module to be
1120    // injected easily by `bin/regenerator --include-runtime script.js`.
1121    return exports;
1122  
1123  }(
1124    // If this script is executing as a CommonJS module, use module.exports
1125    // as the regeneratorRuntime namespace. Otherwise create a new empty
1126    // object. Either way, the resulting object will be used to initialize
1127    // the regeneratorRuntime variable at the top of this file.
1128     true ? module.exports : undefined
1129  ));
1130  
1131  try {
1132    regeneratorRuntime = runtime;
1133  } catch (accidentalStrictMode) {
1134    // This module should not be running in strict mode, so the above
1135    // assignment should always work unless something is misconfigured. Just
1136    // in case runtime.js accidentally runs in strict mode, we can escape
1137    // strict mode using a global Function call. This could conceivably fail
1138    // if a Content Security Policy forbids using Function, but in that case
1139    // the proper solution is to fix the accidental strict mode problem. If
1140    // you've misconfigured your bundler to force strict mode and applied a
1141    // CSP to forbid Function, and you're not willing to fix either of those
1142    // problems, please detail your unique predicament in a GitHub issue.
1143    Function("r", "regeneratorRuntime = r")(runtime);
1144  }
1145  
1146  
1147  /***/ })
1148  
1149  /******/ })["default"];


Generated: Fri Oct 25 08:20:01 2019 Cross-referenced by PHPXref 0.7