[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/js/dist/ -> api-fetch.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["apiFetch"] =
   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 = 353);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 1:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["i18n"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 10:
  98  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99  
 100  "use strict";
 101  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 102  function _defineProperty(obj, key, value) {
 103    if (key in obj) {
 104      Object.defineProperty(obj, key, {
 105        value: value,
 106        enumerable: true,
 107        configurable: true,
 108        writable: true
 109      });
 110    } else {
 111      obj[key] = value;
 112    }
 113  
 114    return obj;
 115  }
 116  
 117  /***/ }),
 118  
 119  /***/ 20:
 120  /***/ (function(module, exports, __webpack_require__) {
 121  
 122  module.exports = __webpack_require__(47);
 123  
 124  
 125  /***/ }),
 126  
 127  /***/ 21:
 128  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 129  
 130  "use strict";
 131  
 132  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
 133  function _objectWithoutPropertiesLoose(source, excluded) {
 134    if (source == null) return {};
 135    var target = {};
 136    var sourceKeys = Object.keys(source);
 137    var key, i;
 138  
 139    for (i = 0; i < sourceKeys.length; i++) {
 140      key = sourceKeys[i];
 141      if (excluded.indexOf(key) >= 0) continue;
 142      target[key] = source[key];
 143    }
 144  
 145    return target;
 146  }
 147  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
 148  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
 149  
 150  function _objectWithoutProperties(source, excluded) {
 151    if (source == null) return {};
 152    var target = _objectWithoutPropertiesLoose(source, excluded);
 153    var key, i;
 154  
 155    if (Object.getOwnPropertySymbols) {
 156      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
 157  
 158      for (i = 0; i < sourceSymbolKeys.length; i++) {
 159        key = sourceSymbolKeys[i];
 160        if (excluded.indexOf(key) >= 0) continue;
 161        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
 162        target[key] = source[key];
 163      }
 164    }
 165  
 166    return target;
 167  }
 168  
 169  /***/ }),
 170  
 171  /***/ 26:
 172  /***/ (function(module, exports) {
 173  
 174  (function() { module.exports = this["wp"]["url"]; }());
 175  
 176  /***/ }),
 177  
 178  /***/ 353:
 179  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 180  
 181  "use strict";
 182  __webpack_require__.r(__webpack_exports__);
 183  
 184  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
 185  var objectSpread = __webpack_require__(7);
 186  
 187  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
 188  var objectWithoutProperties = __webpack_require__(21);
 189  
 190  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js
 191  
 192  
 193  function createNonceMiddleware(nonce) {
 194    function middleware(options, next) {
 195      var _options$headers = options.headers,
 196          headers = _options$headers === void 0 ? {} : _options$headers; // If an 'X-WP-Nonce' header (or any case-insensitive variation
 197      // thereof) was specified, no need to add a nonce header.
 198  
 199      for (var headerName in headers) {
 200        if (headerName.toLowerCase() === 'x-wp-nonce') {
 201          return next(options);
 202        }
 203      }
 204  
 205      return next(Object(objectSpread["a" /* default */])({}, options, {
 206        headers: Object(objectSpread["a" /* default */])({}, headers, {
 207          'X-WP-Nonce': middleware.nonce
 208        })
 209      }));
 210    }
 211  
 212    middleware.nonce = nonce;
 213    return middleware;
 214  }
 215  
 216  /* harmony default export */ var middlewares_nonce = (createNonceMiddleware);
 217  
 218  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js
 219  
 220  
 221  var namespace_endpoint_namespaceAndEndpointMiddleware = function namespaceAndEndpointMiddleware(options, next) {
 222    var path = options.path;
 223    var namespaceTrimmed, endpointTrimmed;
 224  
 225    if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') {
 226      namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, '');
 227      endpointTrimmed = options.endpoint.replace(/^\//, '');
 228  
 229      if (endpointTrimmed) {
 230        path = namespaceTrimmed + '/' + endpointTrimmed;
 231      } else {
 232        path = namespaceTrimmed;
 233      }
 234    }
 235  
 236    delete options.namespace;
 237    delete options.endpoint;
 238    return next(Object(objectSpread["a" /* default */])({}, options, {
 239      path: path
 240    }));
 241  };
 242  
 243  /* harmony default export */ var namespace_endpoint = (namespace_endpoint_namespaceAndEndpointMiddleware);
 244  
 245  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js
 246  
 247  
 248  /**
 249   * Internal dependencies
 250   */
 251  
 252  
 253  var root_url_createRootURLMiddleware = function createRootURLMiddleware(rootURL) {
 254    return function (options, next) {
 255      return namespace_endpoint(options, function (optionsWithPath) {
 256        var url = optionsWithPath.url;
 257        var path = optionsWithPath.path;
 258        var apiRoot;
 259  
 260        if (typeof path === 'string') {
 261          apiRoot = rootURL;
 262  
 263          if (-1 !== rootURL.indexOf('?')) {
 264            path = path.replace('?', '&');
 265          }
 266  
 267          path = path.replace(/^\//, ''); // API root may already include query parameter prefix if site is
 268          // configured to use plain permalinks.
 269  
 270          if ('string' === typeof apiRoot && -1 !== apiRoot.indexOf('?')) {
 271            path = path.replace('?', '&');
 272          }
 273  
 274          url = apiRoot + path;
 275        }
 276  
 277        return next(Object(objectSpread["a" /* default */])({}, optionsWithPath, {
 278          url: url
 279        }));
 280      });
 281    };
 282  };
 283  
 284  /* harmony default export */ var root_url = (root_url_createRootURLMiddleware);
 285  
 286  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js
 287  var createPreloadingMiddleware = function createPreloadingMiddleware(preloadedData) {
 288    return function (options, next) {
 289      function getStablePath(path) {
 290        var splitted = path.split('?');
 291        var query = splitted[1];
 292        var base = splitted[0];
 293  
 294        if (!query) {
 295          return base;
 296        } // 'b=1&c=2&a=5'
 297  
 298  
 299        return base + '?' + query // [ 'b=1', 'c=2', 'a=5' ]
 300        .split('&') // [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]
 301        .map(function (entry) {
 302          return entry.split('=');
 303        }) // [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]
 304        .sort(function (a, b) {
 305          return a[0].localeCompare(b[0]);
 306        }) // [ 'a=5', 'b=1', 'c=2' ]
 307        .map(function (pair) {
 308          return pair.join('=');
 309        }) // 'a=5&b=1&c=2'
 310        .join('&');
 311      }
 312  
 313      var _options$parse = options.parse,
 314          parse = _options$parse === void 0 ? true : _options$parse;
 315  
 316      if (typeof options.path === 'string') {
 317        var method = options.method || 'GET';
 318        var path = getStablePath(options.path);
 319  
 320        if (parse && 'GET' === method && preloadedData[path]) {
 321          return Promise.resolve(preloadedData[path].body);
 322        } else if ('OPTIONS' === method && preloadedData[method] && preloadedData[method][path]) {
 323          return Promise.resolve(preloadedData[method][path]);
 324        }
 325      }
 326  
 327      return next(options);
 328    };
 329  };
 330  
 331  /* harmony default export */ var preloading = (createPreloadingMiddleware);
 332  
 333  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
 334  var regenerator = __webpack_require__(20);
 335  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
 336  
 337  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
 338  var asyncToGenerator = __webpack_require__(43);
 339  
 340  // EXTERNAL MODULE: external {"this":["wp","url"]}
 341  var external_this_wp_url_ = __webpack_require__(26);
 342  
 343  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js
 344  
 345  
 346  
 347  
 348  
 349  /**
 350   * WordPress dependencies
 351   */
 352   // Apply query arguments to both URL and Path, whichever is present.
 353  
 354  var fetch_all_middleware_modifyQuery = function modifyQuery(_ref, queryArgs) {
 355    var path = _ref.path,
 356        url = _ref.url,
 357        options = Object(objectWithoutProperties["a" /* default */])(_ref, ["path", "url"]);
 358  
 359    return Object(objectSpread["a" /* default */])({}, options, {
 360      url: url && Object(external_this_wp_url_["addQueryArgs"])(url, queryArgs),
 361      path: path && Object(external_this_wp_url_["addQueryArgs"])(path, queryArgs)
 362    });
 363  }; // Duplicates parsing functionality from apiFetch.
 364  
 365  
 366  var parseResponse = function parseResponse(response) {
 367    return response.json ? response.json() : Promise.reject(response);
 368  };
 369  
 370  var parseLinkHeader = function parseLinkHeader(linkHeader) {
 371    if (!linkHeader) {
 372      return {};
 373    }
 374  
 375    var match = linkHeader.match(/<([^>]+)>; rel="next"/);
 376    return match ? {
 377      next: match[1]
 378    } : {};
 379  };
 380  
 381  var getNextPageUrl = function getNextPageUrl(response) {
 382    var _parseLinkHeader = parseLinkHeader(response.headers.get('link')),
 383        next = _parseLinkHeader.next;
 384  
 385    return next;
 386  };
 387  
 388  var requestContainsUnboundedQuery = function requestContainsUnboundedQuery(options) {
 389    var pathIsUnbounded = options.path && options.path.indexOf('per_page=-1') !== -1;
 390    var urlIsUnbounded = options.url && options.url.indexOf('per_page=-1') !== -1;
 391    return pathIsUnbounded || urlIsUnbounded;
 392  }; // The REST API enforces an upper limit on the per_page option. To handle large
 393  // collections, apiFetch consumers can pass `per_page=-1`; this middleware will
 394  // then recursively assemble a full response array from all available pages.
 395  
 396  
 397  var fetchAllMiddleware =
 398  /*#__PURE__*/
 399  function () {
 400    var _ref2 = Object(asyncToGenerator["a" /* default */])(
 401    /*#__PURE__*/
 402    regenerator_default.a.mark(function _callee(options, next) {
 403      var response, results, nextPage, mergedResults, nextResponse, nextResults;
 404      return regenerator_default.a.wrap(function _callee$(_context) {
 405        while (1) {
 406          switch (_context.prev = _context.next) {
 407            case 0:
 408              if (!(options.parse === false)) {
 409                _context.next = 2;
 410                break;
 411              }
 412  
 413              return _context.abrupt("return", next(options));
 414  
 415            case 2:
 416              if (requestContainsUnboundedQuery(options)) {
 417                _context.next = 4;
 418                break;
 419              }
 420  
 421              return _context.abrupt("return", next(options));
 422  
 423            case 4:
 424              _context.next = 6;
 425              return next(Object(objectSpread["a" /* default */])({}, fetch_all_middleware_modifyQuery(options, {
 426                per_page: 100
 427              }), {
 428                // Ensure headers are returned for page 1.
 429                parse: false
 430              }));
 431  
 432            case 6:
 433              response = _context.sent;
 434              _context.next = 9;
 435              return parseResponse(response);
 436  
 437            case 9:
 438              results = _context.sent;
 439  
 440              if (Array.isArray(results)) {
 441                _context.next = 12;
 442                break;
 443              }
 444  
 445              return _context.abrupt("return", results);
 446  
 447            case 12:
 448              nextPage = getNextPageUrl(response);
 449  
 450              if (nextPage) {
 451                _context.next = 15;
 452                break;
 453              }
 454  
 455              return _context.abrupt("return", results);
 456  
 457            case 15:
 458              // Iteratively fetch all remaining pages until no "next" header is found.
 459              mergedResults = [].concat(results);
 460  
 461            case 16:
 462              if (!nextPage) {
 463                _context.next = 27;
 464                break;
 465              }
 466  
 467              _context.next = 19;
 468              return next(Object(objectSpread["a" /* default */])({}, options, {
 469                // Ensure the URL for the next page is used instead of any provided path.
 470                path: undefined,
 471                url: nextPage,
 472                // Ensure we still get headers so we can identify the next page.
 473                parse: false
 474              }));
 475  
 476            case 19:
 477              nextResponse = _context.sent;
 478              _context.next = 22;
 479              return parseResponse(nextResponse);
 480  
 481            case 22:
 482              nextResults = _context.sent;
 483              mergedResults = mergedResults.concat(nextResults);
 484              nextPage = getNextPageUrl(nextResponse);
 485              _context.next = 16;
 486              break;
 487  
 488            case 27:
 489              return _context.abrupt("return", mergedResults);
 490  
 491            case 28:
 492            case "end":
 493              return _context.stop();
 494          }
 495        }
 496      }, _callee);
 497    }));
 498  
 499    return function fetchAllMiddleware(_x, _x2) {
 500      return _ref2.apply(this, arguments);
 501    };
 502  }();
 503  
 504  /* harmony default export */ var fetch_all_middleware = (fetchAllMiddleware);
 505  
 506  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js
 507  
 508  
 509  /**
 510   * Set of HTTP methods which are eligible to be overridden.
 511   *
 512   * @type {Set}
 513   */
 514  var OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
 515  /**
 516   * Default request method.
 517   *
 518   * "A request has an associated method (a method). Unless stated otherwise it
 519   * is `GET`."
 520   *
 521   * @see  https://fetch.spec.whatwg.org/#requests
 522   *
 523   * @type {string}
 524   */
 525  
 526  var DEFAULT_METHOD = 'GET';
 527  /**
 528   * API Fetch middleware which overrides the request method for HTTP v1
 529   * compatibility leveraging the REST API X-HTTP-Method-Override header.
 530   *
 531   * @param {Object}   options Fetch options.
 532   * @param {Function} next    [description]
 533   *
 534   * @return {*} The evaluated result of the remaining middleware chain.
 535   */
 536  
 537  function httpV1Middleware(options, next) {
 538    var _options = options,
 539        _options$method = _options.method,
 540        method = _options$method === void 0 ? DEFAULT_METHOD : _options$method;
 541  
 542    if (OVERRIDE_METHODS.has(method.toUpperCase())) {
 543      options = Object(objectSpread["a" /* default */])({}, options, {
 544        headers: Object(objectSpread["a" /* default */])({}, options.headers, {
 545          'X-HTTP-Method-Override': method,
 546          'Content-Type': 'application/json'
 547        }),
 548        method: 'POST'
 549      });
 550    }
 551  
 552    return next(options, next);
 553  }
 554  
 555  /* harmony default export */ var http_v1 = (httpV1Middleware);
 556  
 557  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js
 558  /**
 559   * WordPress dependencies
 560   */
 561  
 562  
 563  function userLocaleMiddleware(options, next) {
 564    if (typeof options.url === 'string' && !Object(external_this_wp_url_["hasQueryArg"])(options.url, '_locale')) {
 565      options.url = Object(external_this_wp_url_["addQueryArgs"])(options.url, {
 566        _locale: 'user'
 567      });
 568    }
 569  
 570    if (typeof options.path === 'string' && !Object(external_this_wp_url_["hasQueryArg"])(options.path, '_locale')) {
 571      options.path = Object(external_this_wp_url_["addQueryArgs"])(options.path, {
 572        _locale: 'user'
 573      });
 574    }
 575  
 576    return next(options, next);
 577  }
 578  
 579  /* harmony default export */ var user_locale = (userLocaleMiddleware);
 580  
 581  // EXTERNAL MODULE: external {"this":["wp","i18n"]}
 582  var external_this_wp_i18n_ = __webpack_require__(1);
 583  
 584  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/utils/response.js
 585  /**
 586   * WordPress dependencies
 587   */
 588  
 589  /**
 590   * Parses the apiFetch response.
 591   *
 592   * @param {Response} response
 593   * @param {boolean}  shouldParseResponse
 594   *
 595   * @return {Promise} Parsed response
 596   */
 597  
 598  var response_parseResponse = function parseResponse(response) {
 599    var shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
 600  
 601    if (shouldParseResponse) {
 602      if (response.status === 204) {
 603        return null;
 604      }
 605  
 606      return response.json ? response.json() : Promise.reject(response);
 607    }
 608  
 609    return response;
 610  };
 611  
 612  var response_parseJsonAndNormalizeError = function parseJsonAndNormalizeError(response) {
 613    var invalidJsonError = {
 614      code: 'invalid_json',
 615      message: Object(external_this_wp_i18n_["__"])('The response is not a valid JSON response.')
 616    };
 617  
 618    if (!response || !response.json) {
 619      throw invalidJsonError;
 620    }
 621  
 622    return response.json().catch(function () {
 623      throw invalidJsonError;
 624    });
 625  };
 626  /**
 627   * Parses the apiFetch response properly and normalize response errors.
 628   *
 629   * @param {Response} response
 630   * @param {boolean}  shouldParseResponse
 631   *
 632   * @return {Promise} Parsed response.
 633   */
 634  
 635  
 636  var parseResponseAndNormalizeError = function parseResponseAndNormalizeError(response) {
 637    var shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
 638    return Promise.resolve(response_parseResponse(response, shouldParseResponse)).catch(function (res) {
 639      return parseAndThrowError(res, shouldParseResponse);
 640    });
 641  };
 642  function parseAndThrowError(response) {
 643    var shouldParseResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
 644  
 645    if (!shouldParseResponse) {
 646      throw response;
 647    }
 648  
 649    return response_parseJsonAndNormalizeError(response).then(function (error) {
 650      var unknownError = {
 651        code: 'unknown_error',
 652        message: Object(external_this_wp_i18n_["__"])('An unknown error occurred.')
 653      };
 654      throw error || unknownError;
 655    });
 656  }
 657  
 658  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/media-upload.js
 659  
 660  
 661  /**
 662   * WordPress dependencies
 663   */
 664  
 665  /**
 666   * Internal dependencies
 667   */
 668  
 669  
 670  /**
 671   * Middleware handling media upload failures and retries.
 672   *
 673   * @param {Object}   options Fetch options.
 674   * @param {Function} next    [description]
 675   *
 676   * @return {*} The evaluated result of the remaining middleware chain.
 677   */
 678  
 679  function mediaUploadMiddleware(options, next) {
 680    var isMediaUploadRequest = options.path && options.path.indexOf('/wp/v2/media') !== -1 || options.url && options.url.indexOf('/wp/v2/media') !== -1;
 681  
 682    if (!isMediaUploadRequest) {
 683      return next(options, next);
 684    }
 685  
 686    var retries = 0;
 687    var maxRetries = 5;
 688  
 689    var postProcess = function postProcess(attachmentId) {
 690      retries++;
 691      return next({
 692        path: "/wp/v2/media/".concat(attachmentId, "/post-process"),
 693        method: 'POST',
 694        data: {
 695          action: 'create-image-subsizes'
 696        },
 697        parse: false
 698      }).catch(function () {
 699        if (retries < maxRetries) {
 700          return postProcess(attachmentId);
 701        }
 702  
 703        next({
 704          path: "/wp/v2/media/".concat(attachmentId, "?force=true"),
 705          method: 'DELETE'
 706        });
 707        return Promise.reject();
 708      });
 709    };
 710  
 711    return next(Object(objectSpread["a" /* default */])({}, options, {
 712      parse: false
 713    })).catch(function (response) {
 714      var attachmentId = response.headers.get('x-wp-upload-attachment-id');
 715  
 716      if (response.status >= 500 && response.status < 600 && attachmentId) {
 717        return postProcess(attachmentId).catch(function () {
 718          if (options.parse !== false) {
 719            return Promise.reject({
 720              code: 'post_process',
 721              message: Object(external_this_wp_i18n_["__"])('Media upload failed. If this is a photo or a large image, please scale it down and try again.')
 722            });
 723          }
 724  
 725          return Promise.reject(response);
 726        });
 727      }
 728  
 729      return parseAndThrowError(response, options.parse);
 730    }).then(function (response) {
 731      return parseResponseAndNormalizeError(response, options.parse);
 732    });
 733  }
 734  
 735  /* harmony default export */ var media_upload = (mediaUploadMiddleware);
 736  
 737  // CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/index.js
 738  
 739  
 740  
 741  /**
 742   * Internal dependencies
 743   */
 744  
 745  
 746  
 747  
 748  
 749  
 750  
 751  
 752  
 753  /**
 754   * Default set of header values which should be sent with every request unless
 755   * explicitly provided through apiFetch options.
 756   *
 757   * @type {Object}
 758   */
 759  
 760  var DEFAULT_HEADERS = {
 761    // The backend uses the Accept header as a condition for considering an
 762    // incoming request as a REST request.
 763    //
 764    // See: https://core.trac.wordpress.org/ticket/44534
 765    Accept: 'application/json, */*;q=0.1'
 766  };
 767  /**
 768   * Default set of fetch option values which should be sent with every request
 769   * unless explicitly provided through apiFetch options.
 770   *
 771   * @type {Object}
 772   */
 773  
 774  var DEFAULT_OPTIONS = {
 775    credentials: 'include'
 776  };
 777  var middlewares = [user_locale, namespace_endpoint, http_v1, fetch_all_middleware];
 778  
 779  function registerMiddleware(middleware) {
 780    middlewares.unshift(middleware);
 781  }
 782  
 783  var checkStatus = function checkStatus(response) {
 784    if (response.status >= 200 && response.status < 300) {
 785      return response;
 786    }
 787  
 788    throw response;
 789  };
 790  
 791  var build_module_defaultFetchHandler = function defaultFetchHandler(nextOptions) {
 792    var url = nextOptions.url,
 793        path = nextOptions.path,
 794        data = nextOptions.data,
 795        _nextOptions$parse = nextOptions.parse,
 796        parse = _nextOptions$parse === void 0 ? true : _nextOptions$parse,
 797        remainingOptions = Object(objectWithoutProperties["a" /* default */])(nextOptions, ["url", "path", "data", "parse"]);
 798  
 799    var body = nextOptions.body,
 800        headers = nextOptions.headers; // Merge explicitly-provided headers with default values.
 801  
 802    headers = Object(objectSpread["a" /* default */])({}, DEFAULT_HEADERS, headers); // The `data` property is a shorthand for sending a JSON body.
 803  
 804    if (data) {
 805      body = JSON.stringify(data);
 806      headers['Content-Type'] = 'application/json';
 807    }
 808  
 809    var responsePromise = window.fetch(url || path, Object(objectSpread["a" /* default */])({}, DEFAULT_OPTIONS, remainingOptions, {
 810      body: body,
 811      headers: headers
 812    }));
 813    return responsePromise.then(checkStatus).catch(function (response) {
 814      return parseAndThrowError(response, parse);
 815    }).then(function (response) {
 816      return parseResponseAndNormalizeError(response, parse);
 817    });
 818  };
 819  
 820  var fetchHandler = build_module_defaultFetchHandler;
 821  /**
 822   * Defines a custom fetch handler for making the requests that will override
 823   * the default one using window.fetch
 824   *
 825   * @param {Function} newFetchHandler The new fetch handler
 826   */
 827  
 828  function setFetchHandler(newFetchHandler) {
 829    fetchHandler = newFetchHandler;
 830  }
 831  
 832  function apiFetch(options) {
 833    var steps = [].concat(middlewares, [fetchHandler]);
 834  
 835    var createRunStep = function createRunStep(index) {
 836      return function (workingOptions) {
 837        var step = steps[index];
 838  
 839        if (index === steps.length - 1) {
 840          return step(workingOptions);
 841        }
 842  
 843        var next = createRunStep(index + 1);
 844        return step(workingOptions, next);
 845      };
 846    };
 847  
 848    return new Promise(function (resolve, reject) {
 849      createRunStep(0)(options).then(resolve).catch(function (error) {
 850        if (error.code !== 'rest_cookie_invalid_nonce') {
 851          return reject(error);
 852        } // If the nonce is invalid, refresh it and try again.
 853  
 854  
 855        window.fetch(apiFetch.nonceEndpoint).then(checkStatus).then(function (data) {
 856          return data.text();
 857        }).then(function (text) {
 858          apiFetch.nonceMiddleware.nonce = text;
 859          apiFetch(options).then(resolve).catch(reject);
 860        }).catch(reject);
 861      });
 862    });
 863  }
 864  
 865  apiFetch.use = registerMiddleware;
 866  apiFetch.setFetchHandler = setFetchHandler;
 867  apiFetch.createNonceMiddleware = middlewares_nonce;
 868  apiFetch.createPreloadingMiddleware = preloading;
 869  apiFetch.createRootURLMiddleware = root_url;
 870  apiFetch.fetchAllMiddleware = fetch_all_middleware;
 871  apiFetch.mediaUploadMiddleware = media_upload;
 872  /* harmony default export */ var build_module = __webpack_exports__["default"] = (apiFetch);
 873  
 874  
 875  /***/ }),
 876  
 877  /***/ 43:
 878  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 879  
 880  "use strict";
 881  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; });
 882  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
 883    try {
 884      var info = gen[key](arg);
 885      var value = info.value;
 886    } catch (error) {
 887      reject(error);
 888      return;
 889    }
 890  
 891    if (info.done) {
 892      resolve(value);
 893    } else {
 894      Promise.resolve(value).then(_next, _throw);
 895    }
 896  }
 897  
 898  function _asyncToGenerator(fn) {
 899    return function () {
 900      var self = this,
 901          args = arguments;
 902      return new Promise(function (resolve, reject) {
 903        var gen = fn.apply(self, args);
 904  
 905        function _next(value) {
 906          asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
 907        }
 908  
 909        function _throw(err) {
 910          asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
 911        }
 912  
 913        _next(undefined);
 914      });
 915    };
 916  }
 917  
 918  /***/ }),
 919  
 920  /***/ 47:
 921  /***/ (function(module, exports, __webpack_require__) {
 922  
 923  /**
 924   * Copyright (c) 2014-present, Facebook, Inc.
 925   *
 926   * This source code is licensed under the MIT license found in the
 927   * LICENSE file in the root directory of this source tree.
 928   */
 929  
 930  var runtime = (function (exports) {
 931    "use strict";
 932  
 933    var Op = Object.prototype;
 934    var hasOwn = Op.hasOwnProperty;
 935    var undefined; // More compressible than void 0.
 936    var $Symbol = typeof Symbol === "function" ? Symbol : {};
 937    var iteratorSymbol = $Symbol.iterator || "@@iterator";
 938    var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
 939    var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
 940  
 941    function wrap(innerFn, outerFn, self, tryLocsList) {
 942      // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
 943      var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
 944      var generator = Object.create(protoGenerator.prototype);
 945      var context = new Context(tryLocsList || []);
 946  
 947      // The ._invoke method unifies the implementations of the .next,
 948      // .throw, and .return methods.
 949      generator._invoke = makeInvokeMethod(innerFn, self, context);
 950  
 951      return generator;
 952    }
 953    exports.wrap = wrap;
 954  
 955    // Try/catch helper to minimize deoptimizations. Returns a completion
 956    // record like context.tryEntries[i].completion. This interface could
 957    // have been (and was previously) designed to take a closure to be
 958    // invoked without arguments, but in all the cases we care about we
 959    // already have an existing method we want to call, so there's no need
 960    // to create a new function object. We can even get away with assuming
 961    // the method takes exactly one argument, since that happens to be true
 962    // in every case, so we don't have to touch the arguments object. The
 963    // only additional allocation required is the completion record, which
 964    // has a stable shape and so hopefully should be cheap to allocate.
 965    function tryCatch(fn, obj, arg) {
 966      try {
 967        return { type: "normal", arg: fn.call(obj, arg) };
 968      } catch (err) {
 969        return { type: "throw", arg: err };
 970      }
 971    }
 972  
 973    var GenStateSuspendedStart = "suspendedStart";
 974    var GenStateSuspendedYield = "suspendedYield";
 975    var GenStateExecuting = "executing";
 976    var GenStateCompleted = "completed";
 977  
 978    // Returning this object from the innerFn has the same effect as
 979    // breaking out of the dispatch switch statement.
 980    var ContinueSentinel = {};
 981  
 982    // Dummy constructor functions that we use as the .constructor and
 983    // .constructor.prototype properties for functions that return Generator
 984    // objects. For full spec compliance, you may wish to configure your
 985    // minifier not to mangle the names of these two functions.
 986    function Generator() {}
 987    function GeneratorFunction() {}
 988    function GeneratorFunctionPrototype() {}
 989  
 990    // This is a polyfill for %IteratorPrototype% for environments that
 991    // don't natively support it.
 992    var IteratorPrototype = {};
 993    IteratorPrototype[iteratorSymbol] = function () {
 994      return this;
 995    };
 996  
 997    var getProto = Object.getPrototypeOf;
 998    var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
 999    if (NativeIteratorPrototype &&
1000        NativeIteratorPrototype !== Op &&
1001        hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
1002      // This environment has a native %IteratorPrototype%; use it instead
1003      // of the polyfill.
1004      IteratorPrototype = NativeIteratorPrototype;
1005    }
1006  
1007    var Gp = GeneratorFunctionPrototype.prototype =
1008      Generator.prototype = Object.create(IteratorPrototype);
1009    GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
1010    GeneratorFunctionPrototype.constructor = GeneratorFunction;
1011    GeneratorFunctionPrototype[toStringTagSymbol] =
1012      GeneratorFunction.displayName = "GeneratorFunction";
1013  
1014    // Helper for defining the .next, .throw, and .return methods of the
1015    // Iterator interface in terms of a single ._invoke method.
1016    function defineIteratorMethods(prototype) {
1017      ["next", "throw", "return"].forEach(function(method) {
1018        prototype[method] = function(arg) {
1019          return this._invoke(method, arg);
1020        };
1021      });
1022    }
1023  
1024    exports.isGeneratorFunction = function(genFun) {
1025      var ctor = typeof genFun === "function" && genFun.constructor;
1026      return ctor
1027        ? ctor === GeneratorFunction ||
1028          // For the native GeneratorFunction constructor, the best we can
1029          // do is to check its .name property.
1030          (ctor.displayName || ctor.name) === "GeneratorFunction"
1031        : false;
1032    };
1033  
1034    exports.mark = function(genFun) {
1035      if (Object.setPrototypeOf) {
1036        Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
1037      } else {
1038        genFun.__proto__ = GeneratorFunctionPrototype;
1039        if (!(toStringTagSymbol in genFun)) {
1040          genFun[toStringTagSymbol] = "GeneratorFunction";
1041        }
1042      }
1043      genFun.prototype = Object.create(Gp);
1044      return genFun;
1045    };
1046  
1047    // Within the body of any async function, `await x` is transformed to
1048    // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
1049    // `hasOwn.call(value, "__await")` to determine if the yielded value is
1050    // meant to be awaited.
1051    exports.awrap = function(arg) {
1052      return { __await: arg };
1053    };
1054  
1055    function AsyncIterator(generator) {
1056      function invoke(method, arg, resolve, reject) {
1057        var record = tryCatch(generator[method], generator, arg);
1058        if (record.type === "throw") {
1059          reject(record.arg);
1060        } else {
1061          var result = record.arg;
1062          var value = result.value;
1063          if (value &&
1064              typeof value === "object" &&
1065              hasOwn.call(value, "__await")) {
1066            return Promise.resolve(value.__await).then(function(value) {
1067              invoke("next", value, resolve, reject);
1068            }, function(err) {
1069              invoke("throw", err, resolve, reject);
1070            });
1071          }
1072  
1073          return Promise.resolve(value).then(function(unwrapped) {
1074            // When a yielded Promise is resolved, its final value becomes
1075            // the .value of the Promise<{value,done}> result for the
1076            // current iteration.
1077            result.value = unwrapped;
1078            resolve(result);
1079          }, function(error) {
1080            // If a rejected Promise was yielded, throw the rejection back
1081            // into the async generator function so it can be handled there.
1082            return invoke("throw", error, resolve, reject);
1083          });
1084        }
1085      }
1086  
1087      var previousPromise;
1088  
1089      function enqueue(method, arg) {
1090        function callInvokeWithMethodAndArg() {
1091          return new Promise(function(resolve, reject) {
1092            invoke(method, arg, resolve, reject);
1093          });
1094        }
1095  
1096        return previousPromise =
1097          // If enqueue has been called before, then we want to wait until
1098          // all previous Promises have been resolved before calling invoke,
1099          // so that results are always delivered in the correct order. If
1100          // enqueue has not been called before, then it is important to
1101          // call invoke immediately, without waiting on a callback to fire,
1102          // so that the async generator function has the opportunity to do
1103          // any necessary setup in a predictable way. This predictability
1104          // is why the Promise constructor synchronously invokes its
1105          // executor callback, and why async functions synchronously
1106          // execute code before the first await. Since we implement simple
1107          // async functions in terms of async generators, it is especially
1108          // important to get this right, even though it requires care.
1109          previousPromise ? previousPromise.then(
1110            callInvokeWithMethodAndArg,
1111            // Avoid propagating failures to Promises returned by later
1112            // invocations of the iterator.
1113            callInvokeWithMethodAndArg
1114          ) : callInvokeWithMethodAndArg();
1115      }
1116  
1117      // Define the unified helper method that is used to implement .next,
1118      // .throw, and .return (see defineIteratorMethods).
1119      this._invoke = enqueue;
1120    }
1121  
1122    defineIteratorMethods(AsyncIterator.prototype);
1123    AsyncIterator.prototype[asyncIteratorSymbol] = function () {
1124      return this;
1125    };
1126    exports.AsyncIterator = AsyncIterator;
1127  
1128    // Note that simple async functions are implemented on top of
1129    // AsyncIterator objects; they just return a Promise for the value of
1130    // the final result produced by the iterator.
1131    exports.async = function(innerFn, outerFn, self, tryLocsList) {
1132      var iter = new AsyncIterator(
1133        wrap(innerFn, outerFn, self, tryLocsList)
1134      );
1135  
1136      return exports.isGeneratorFunction(outerFn)
1137        ? iter // If outerFn is a generator, return the full iterator.
1138        : iter.next().then(function(result) {
1139            return result.done ? result.value : iter.next();
1140          });
1141    };
1142  
1143    function makeInvokeMethod(innerFn, self, context) {
1144      var state = GenStateSuspendedStart;
1145  
1146      return function invoke(method, arg) {
1147        if (state === GenStateExecuting) {
1148          throw new Error("Generator is already running");
1149        }
1150  
1151        if (state === GenStateCompleted) {
1152          if (method === "throw") {
1153            throw arg;
1154          }
1155  
1156          // Be forgiving, per 25.3.3.3.3 of the spec:
1157          // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
1158          return doneResult();
1159        }
1160  
1161        context.method = method;
1162        context.arg = arg;
1163  
1164        while (true) {
1165          var delegate = context.delegate;
1166          if (delegate) {
1167            var delegateResult = maybeInvokeDelegate(delegate, context);
1168            if (delegateResult) {
1169              if (delegateResult === ContinueSentinel) continue;
1170              return delegateResult;
1171            }
1172          }
1173  
1174          if (context.method === "next") {
1175            // Setting context._sent for legacy support of Babel's
1176            // function.sent implementation.
1177            context.sent = context._sent = context.arg;
1178  
1179          } else if (context.method === "throw") {
1180            if (state === GenStateSuspendedStart) {
1181              state = GenStateCompleted;
1182              throw context.arg;
1183            }
1184  
1185            context.dispatchException(context.arg);
1186  
1187          } else if (context.method === "return") {
1188            context.abrupt("return", context.arg);
1189          }
1190  
1191          state = GenStateExecuting;
1192  
1193          var record = tryCatch(innerFn, self, context);
1194          if (record.type === "normal") {
1195            // If an exception is thrown from innerFn, we leave state ===
1196            // GenStateExecuting and loop back for another invocation.
1197            state = context.done
1198              ? GenStateCompleted
1199              : GenStateSuspendedYield;
1200  
1201            if (record.arg === ContinueSentinel) {
1202              continue;
1203            }
1204  
1205            return {
1206              value: record.arg,
1207              done: context.done
1208            };
1209  
1210          } else if (record.type === "throw") {
1211            state = GenStateCompleted;
1212            // Dispatch the exception by looping back around to the
1213            // context.dispatchException(context.arg) call above.
1214            context.method = "throw";
1215            context.arg = record.arg;
1216          }
1217        }
1218      };
1219    }
1220  
1221    // Call delegate.iterator[context.method](context.arg) and handle the
1222    // result, either by returning a { value, done } result from the
1223    // delegate iterator, or by modifying context.method and context.arg,
1224    // setting context.delegate to null, and returning the ContinueSentinel.
1225    function maybeInvokeDelegate(delegate, context) {
1226      var method = delegate.iterator[context.method];
1227      if (method === undefined) {
1228        // A .throw or .return when the delegate iterator has no .throw
1229        // method always terminates the yield* loop.
1230        context.delegate = null;
1231  
1232        if (context.method === "throw") {
1233          // Note: ["return"] must be used for ES3 parsing compatibility.
1234          if (delegate.iterator["return"]) {
1235            // If the delegate iterator has a return method, give it a
1236            // chance to clean up.
1237            context.method = "return";
1238            context.arg = undefined;
1239            maybeInvokeDelegate(delegate, context);
1240  
1241            if (context.method === "throw") {
1242              // If maybeInvokeDelegate(context) changed context.method from
1243              // "return" to "throw", let that override the TypeError below.
1244              return ContinueSentinel;
1245            }
1246          }
1247  
1248          context.method = "throw";
1249          context.arg = new TypeError(
1250            "The iterator does not provide a 'throw' method");
1251        }
1252  
1253        return ContinueSentinel;
1254      }
1255  
1256      var record = tryCatch(method, delegate.iterator, context.arg);
1257  
1258      if (record.type === "throw") {
1259        context.method = "throw";
1260        context.arg = record.arg;
1261        context.delegate = null;
1262        return ContinueSentinel;
1263      }
1264  
1265      var info = record.arg;
1266  
1267      if (! info) {
1268        context.method = "throw";
1269        context.arg = new TypeError("iterator result is not an object");
1270        context.delegate = null;
1271        return ContinueSentinel;
1272      }
1273  
1274      if (info.done) {
1275        // Assign the result of the finished delegate to the temporary
1276        // variable specified by delegate.resultName (see delegateYield).
1277        context[delegate.resultName] = info.value;
1278  
1279        // Resume execution at the desired location (see delegateYield).
1280        context.next = delegate.nextLoc;
1281  
1282        // If context.method was "throw" but the delegate handled the
1283        // exception, let the outer generator proceed normally. If
1284        // context.method was "next", forget context.arg since it has been
1285        // "consumed" by the delegate iterator. If context.method was
1286        // "return", allow the original .return call to continue in the
1287        // outer generator.
1288        if (context.method !== "return") {
1289          context.method = "next";
1290          context.arg = undefined;
1291        }
1292  
1293      } else {
1294        // Re-yield the result returned by the delegate method.
1295        return info;
1296      }
1297  
1298      // The delegate iterator is finished, so forget it and continue with
1299      // the outer generator.
1300      context.delegate = null;
1301      return ContinueSentinel;
1302    }
1303  
1304    // Define Generator.prototype.{next,throw,return} in terms of the
1305    // unified ._invoke helper method.
1306    defineIteratorMethods(Gp);
1307  
1308    Gp[toStringTagSymbol] = "Generator";
1309  
1310    // A Generator should always return itself as the iterator object when the
1311    // @@iterator function is called on it. Some browsers' implementations of the
1312    // iterator prototype chain incorrectly implement this, causing the Generator
1313    // object to not be returned from this call. This ensures that doesn't happen.
1314    // See https://github.com/facebook/regenerator/issues/274 for more details.
1315    Gp[iteratorSymbol] = function() {
1316      return this;
1317    };
1318  
1319    Gp.toString = function() {
1320      return "[object Generator]";
1321    };
1322  
1323    function pushTryEntry(locs) {
1324      var entry = { tryLoc: locs[0] };
1325  
1326      if (1 in locs) {
1327        entry.catchLoc = locs[1];
1328      }
1329  
1330      if (2 in locs) {
1331        entry.finallyLoc = locs[2];
1332        entry.afterLoc = locs[3];
1333      }
1334  
1335      this.tryEntries.push(entry);
1336    }
1337  
1338    function resetTryEntry(entry) {
1339      var record = entry.completion || {};
1340      record.type = "normal";
1341      delete record.arg;
1342      entry.completion = record;
1343    }
1344  
1345    function Context(tryLocsList) {
1346      // The root entry object (effectively a try statement without a catch
1347      // or a finally block) gives us a place to store values thrown from
1348      // locations where there is no enclosing try statement.
1349      this.tryEntries = [{ tryLoc: "root" }];
1350      tryLocsList.forEach(pushTryEntry, this);
1351      this.reset(true);
1352    }
1353  
1354    exports.keys = function(object) {
1355      var keys = [];
1356      for (var key in object) {
1357        keys.push(key);
1358      }
1359      keys.reverse();
1360  
1361      // Rather than returning an object with a next method, we keep
1362      // things simple and return the next function itself.
1363      return function next() {
1364        while (keys.length) {
1365          var key = keys.pop();
1366          if (key in object) {
1367            next.value = key;
1368            next.done = false;
1369            return next;
1370          }
1371        }
1372  
1373        // To avoid creating an additional object, we just hang the .value
1374        // and .done properties off the next function object itself. This
1375        // also ensures that the minifier will not anonymize the function.
1376        next.done = true;
1377        return next;
1378      };
1379    };
1380  
1381    function values(iterable) {
1382      if (iterable) {
1383        var iteratorMethod = iterable[iteratorSymbol];
1384        if (iteratorMethod) {
1385          return iteratorMethod.call(iterable);
1386        }
1387  
1388        if (typeof iterable.next === "function") {
1389          return iterable;
1390        }
1391  
1392        if (!isNaN(iterable.length)) {
1393          var i = -1, next = function next() {
1394            while (++i < iterable.length) {
1395              if (hasOwn.call(iterable, i)) {
1396                next.value = iterable[i];
1397                next.done = false;
1398                return next;
1399              }
1400            }
1401  
1402            next.value = undefined;
1403            next.done = true;
1404  
1405            return next;
1406          };
1407  
1408          return next.next = next;
1409        }
1410      }
1411  
1412      // Return an iterator with no values.
1413      return { next: doneResult };
1414    }
1415    exports.values = values;
1416  
1417    function doneResult() {
1418      return { value: undefined, done: true };
1419    }
1420  
1421    Context.prototype = {
1422      constructor: Context,
1423  
1424      reset: function(skipTempReset) {
1425        this.prev = 0;
1426        this.next = 0;
1427        // Resetting context._sent for legacy support of Babel's
1428        // function.sent implementation.
1429        this.sent = this._sent = undefined;
1430        this.done = false;
1431        this.delegate = null;
1432  
1433        this.method = "next";
1434        this.arg = undefined;
1435  
1436        this.tryEntries.forEach(resetTryEntry);
1437  
1438        if (!skipTempReset) {
1439          for (var name in this) {
1440            // Not sure about the optimal order of these conditions:
1441            if (name.charAt(0) === "t" &&
1442                hasOwn.call(this, name) &&
1443                !isNaN(+name.slice(1))) {
1444              this[name] = undefined;
1445            }
1446          }
1447        }
1448      },
1449  
1450      stop: function() {
1451        this.done = true;
1452  
1453        var rootEntry = this.tryEntries[0];
1454        var rootRecord = rootEntry.completion;
1455        if (rootRecord.type === "throw") {
1456          throw rootRecord.arg;
1457        }
1458  
1459        return this.rval;
1460      },
1461  
1462      dispatchException: function(exception) {
1463        if (this.done) {
1464          throw exception;
1465        }
1466  
1467        var context = this;
1468        function handle(loc, caught) {
1469          record.type = "throw";
1470          record.arg = exception;
1471          context.next = loc;
1472  
1473          if (caught) {
1474            // If the dispatched exception was caught by a catch block,
1475            // then let that catch block handle the exception normally.
1476            context.method = "next";
1477            context.arg = undefined;
1478          }
1479  
1480          return !! caught;
1481        }
1482  
1483        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1484          var entry = this.tryEntries[i];
1485          var record = entry.completion;
1486  
1487          if (entry.tryLoc === "root") {
1488            // Exception thrown outside of any try block that could handle
1489            // it, so set the completion value of the entire function to
1490            // throw the exception.
1491            return handle("end");
1492          }
1493  
1494          if (entry.tryLoc <= this.prev) {
1495            var hasCatch = hasOwn.call(entry, "catchLoc");
1496            var hasFinally = hasOwn.call(entry, "finallyLoc");
1497  
1498            if (hasCatch && hasFinally) {
1499              if (this.prev < entry.catchLoc) {
1500                return handle(entry.catchLoc, true);
1501              } else if (this.prev < entry.finallyLoc) {
1502                return handle(entry.finallyLoc);
1503              }
1504  
1505            } else if (hasCatch) {
1506              if (this.prev < entry.catchLoc) {
1507                return handle(entry.catchLoc, true);
1508              }
1509  
1510            } else if (hasFinally) {
1511              if (this.prev < entry.finallyLoc) {
1512                return handle(entry.finallyLoc);
1513              }
1514  
1515            } else {
1516              throw new Error("try statement without catch or finally");
1517            }
1518          }
1519        }
1520      },
1521  
1522      abrupt: function(type, arg) {
1523        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1524          var entry = this.tryEntries[i];
1525          if (entry.tryLoc <= this.prev &&
1526              hasOwn.call(entry, "finallyLoc") &&
1527              this.prev < entry.finallyLoc) {
1528            var finallyEntry = entry;
1529            break;
1530          }
1531        }
1532  
1533        if (finallyEntry &&
1534            (type === "break" ||
1535             type === "continue") &&
1536            finallyEntry.tryLoc <= arg &&
1537            arg <= finallyEntry.finallyLoc) {
1538          // Ignore the finally entry if control is not jumping to a
1539          // location outside the try/catch block.
1540          finallyEntry = null;
1541        }
1542  
1543        var record = finallyEntry ? finallyEntry.completion : {};
1544        record.type = type;
1545        record.arg = arg;
1546  
1547        if (finallyEntry) {
1548          this.method = "next";
1549          this.next = finallyEntry.finallyLoc;
1550          return ContinueSentinel;
1551        }
1552  
1553        return this.complete(record);
1554      },
1555  
1556      complete: function(record, afterLoc) {
1557        if (record.type === "throw") {
1558          throw record.arg;
1559        }
1560  
1561        if (record.type === "break" ||
1562            record.type === "continue") {
1563          this.next = record.arg;
1564        } else if (record.type === "return") {
1565          this.rval = this.arg = record.arg;
1566          this.method = "return";
1567          this.next = "end";
1568        } else if (record.type === "normal" && afterLoc) {
1569          this.next = afterLoc;
1570        }
1571  
1572        return ContinueSentinel;
1573      },
1574  
1575      finish: function(finallyLoc) {
1576        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1577          var entry = this.tryEntries[i];
1578          if (entry.finallyLoc === finallyLoc) {
1579            this.complete(entry.completion, entry.afterLoc);
1580            resetTryEntry(entry);
1581            return ContinueSentinel;
1582          }
1583        }
1584      },
1585  
1586      "catch": function(tryLoc) {
1587        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1588          var entry = this.tryEntries[i];
1589          if (entry.tryLoc === tryLoc) {
1590            var record = entry.completion;
1591            if (record.type === "throw") {
1592              var thrown = record.arg;
1593              resetTryEntry(entry);
1594            }
1595            return thrown;
1596          }
1597        }
1598  
1599        // The context.catch method must only be called with a location
1600        // argument that corresponds to a known catch block.
1601        throw new Error("illegal catch attempt");
1602      },
1603  
1604      delegateYield: function(iterable, resultName, nextLoc) {
1605        this.delegate = {
1606          iterator: values(iterable),
1607          resultName: resultName,
1608          nextLoc: nextLoc
1609        };
1610  
1611        if (this.method === "next") {
1612          // Deliberately forget the last sent value so that we don't
1613          // accidentally pass it on to the delegate.
1614          this.arg = undefined;
1615        }
1616  
1617        return ContinueSentinel;
1618      }
1619    };
1620  
1621    // Regardless of whether this script is executing as a CommonJS module
1622    // or not, return the runtime object so that we can declare the variable
1623    // regeneratorRuntime in the outer scope, which allows this module to be
1624    // injected easily by `bin/regenerator --include-runtime script.js`.
1625    return exports;
1626  
1627  }(
1628    // If this script is executing as a CommonJS module, use module.exports
1629    // as the regeneratorRuntime namespace. Otherwise create a new empty
1630    // object. Either way, the resulting object will be used to initialize
1631    // the regeneratorRuntime variable at the top of this file.
1632     true ? module.exports : undefined
1633  ));
1634  
1635  try {
1636    regeneratorRuntime = runtime;
1637  } catch (accidentalStrictMode) {
1638    // This module should not be running in strict mode, so the above
1639    // assignment should always work unless something is misconfigured. Just
1640    // in case runtime.js accidentally runs in strict mode, we can escape
1641    // strict mode using a global Function call. This could conceivably fail
1642    // if a Content Security Policy forbids using Function, but in that case
1643    // the proper solution is to fix the accidental strict mode problem. If
1644    // you've misconfigured your bundler to force strict mode and applied a
1645    // CSP to forbid Function, and you're not willing to fix either of those
1646    // problems, please detail your unique predicament in a GitHub issue.
1647    Function("r", "regeneratorRuntime = r")(runtime);
1648  }
1649  
1650  
1651  /***/ }),
1652  
1653  /***/ 7:
1654  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1655  
1656  "use strict";
1657  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
1658  /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
1659  
1660  function _objectSpread(target) {
1661    for (var i = 1; i < arguments.length; i++) {
1662      var source = arguments[i] != null ? arguments[i] : {};
1663      var ownKeys = Object.keys(source);
1664  
1665      if (typeof Object.getOwnPropertySymbols === 'function') {
1666        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
1667          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1668        }));
1669      }
1670  
1671      ownKeys.forEach(function (key) {
1672        Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
1673      });
1674    }
1675  
1676    return target;
1677  }
1678  
1679  /***/ })
1680  
1681  /******/ })["default"];


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7