[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/js/dist/ -> notices.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["notices"] =
   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 = 356);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 10:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
  95  function _defineProperty(obj, key, value) {
  96    if (key in obj) {
  97      Object.defineProperty(obj, key, {
  98        value: value,
  99        enumerable: true,
 100        configurable: true,
 101        writable: true
 102      });
 103    } else {
 104      obj[key] = value;
 105    }
 106  
 107    return obj;
 108  }
 109  
 110  /***/ }),
 111  
 112  /***/ 17:
 113  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 114  
 115  "use strict";
 116  
 117  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 118  function _arrayWithoutHoles(arr) {
 119    if (Array.isArray(arr)) {
 120      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
 121        arr2[i] = arr[i];
 122      }
 123  
 124      return arr2;
 125    }
 126  }
 127  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 128  var iterableToArray = __webpack_require__(30);
 129  
 130  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 131  function _nonIterableSpread() {
 132    throw new TypeError("Invalid attempt to spread non-iterable instance");
 133  }
 134  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 135  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
 136  
 137  
 138  
 139  function _toConsumableArray(arr) {
 140    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 141  }
 142  
 143  /***/ }),
 144  
 145  /***/ 2:
 146  /***/ (function(module, exports) {
 147  
 148  (function() { module.exports = this["lodash"]; }());
 149  
 150  /***/ }),
 151  
 152  /***/ 20:
 153  /***/ (function(module, exports, __webpack_require__) {
 154  
 155  module.exports = __webpack_require__(47);
 156  
 157  
 158  /***/ }),
 159  
 160  /***/ 30:
 161  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 162  
 163  "use strict";
 164  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 165  function _iterableToArray(iter) {
 166    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
 167  }
 168  
 169  /***/ }),
 170  
 171  /***/ 356:
 172  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 173  
 174  "use strict";
 175  __webpack_require__.r(__webpack_exports__);
 176  var actions_namespaceObject = {};
 177  __webpack_require__.r(actions_namespaceObject);
 178  __webpack_require__.d(actions_namespaceObject, "createNotice", function() { return createNotice; });
 179  __webpack_require__.d(actions_namespaceObject, "createSuccessNotice", function() { return createSuccessNotice; });
 180  __webpack_require__.d(actions_namespaceObject, "createInfoNotice", function() { return createInfoNotice; });
 181  __webpack_require__.d(actions_namespaceObject, "createErrorNotice", function() { return createErrorNotice; });
 182  __webpack_require__.d(actions_namespaceObject, "createWarningNotice", function() { return createWarningNotice; });
 183  __webpack_require__.d(actions_namespaceObject, "removeNotice", function() { return removeNotice; });
 184  var selectors_namespaceObject = {};
 185  __webpack_require__.r(selectors_namespaceObject);
 186  __webpack_require__.d(selectors_namespaceObject, "getNotices", function() { return getNotices; });
 187  
 188  // EXTERNAL MODULE: external {"this":["wp","data"]}
 189  var external_this_wp_data_ = __webpack_require__(4);
 190  
 191  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 192  var toConsumableArray = __webpack_require__(17);
 193  
 194  // EXTERNAL MODULE: external "lodash"
 195  var external_lodash_ = __webpack_require__(2);
 196  
 197  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 198  var defineProperty = __webpack_require__(10);
 199  
 200  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
 201  var objectSpread = __webpack_require__(7);
 202  
 203  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js
 204  
 205  
 206  
 207  /**
 208   * Higher-order reducer creator which creates a combined reducer object, keyed
 209   * by a property on the action object.
 210   *
 211   * @param {string} actionProperty Action property by which to key object.
 212   *
 213   * @return {Function} Higher-order reducer.
 214   */
 215  var on_sub_key_onSubKey = function onSubKey(actionProperty) {
 216    return function (reducer) {
 217      return function () {
 218        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 219        var action = arguments.length > 1 ? arguments[1] : undefined;
 220        // Retrieve subkey from action. Do not track if undefined; useful for cases
 221        // where reducer is scoped by action shape.
 222        var key = action[actionProperty];
 223  
 224        if (key === undefined) {
 225          return state;
 226        } // Avoid updating state if unchanged. Note that this also accounts for a
 227        // reducer which returns undefined on a key which is not yet tracked.
 228  
 229  
 230        var nextKeyState = reducer(state[key], action);
 231  
 232        if (nextKeyState === state[key]) {
 233          return state;
 234        }
 235  
 236        return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, key, nextKeyState));
 237      };
 238    };
 239  };
 240  /* harmony default export */ var on_sub_key = (on_sub_key_onSubKey);
 241  
 242  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/reducer.js
 243  
 244  
 245  /**
 246   * External dependencies
 247   */
 248  
 249  /**
 250   * Internal dependencies
 251   */
 252  
 253  
 254  /**
 255   * Reducer returning the next notices state. The notices state is an object
 256   * where each key is a context, its value an array of notice objects.
 257   *
 258   * @param {Object} state  Current state.
 259   * @param {Object} action Dispatched action.
 260   *
 261   * @return {Object} Updated state.
 262   */
 263  
 264  var notices = on_sub_key('context')(function () {
 265    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
 266    var action = arguments.length > 1 ? arguments[1] : undefined;
 267  
 268    switch (action.type) {
 269      case 'CREATE_NOTICE':
 270        // Avoid duplicates on ID.
 271        return [].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["reject"])(state, {
 272          id: action.notice.id
 273        })), [action.notice]);
 274  
 275      case 'REMOVE_NOTICE':
 276        return Object(external_lodash_["reject"])(state, {
 277          id: action.id
 278        });
 279    }
 280  
 281    return state;
 282  });
 283  /* harmony default export */ var store_reducer = (notices);
 284  
 285  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
 286  var regenerator = __webpack_require__(20);
 287  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
 288  
 289  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/constants.js
 290  /**
 291   * Default context to use for notice grouping when not otherwise specified. Its
 292   * specific value doesn't hold much meaning, but it must be reasonably unique
 293   * and, more importantly, referenced consistently in the store implementation.
 294   *
 295   * @type {string}
 296   */
 297  var DEFAULT_CONTEXT = 'global';
 298  /**
 299   * Default notice status.
 300   *
 301   * @type {string}
 302   */
 303  
 304  var DEFAULT_STATUS = 'info';
 305  
 306  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/actions.js
 307  
 308  
 309  var _marked =
 310  /*#__PURE__*/
 311  regenerator_default.a.mark(createNotice);
 312  
 313  /**
 314   * External dependencies
 315   */
 316  
 317  /**
 318   * Internal dependencies
 319   */
 320  
 321  
 322  /**
 323   * Yields action objects used in signalling that a notice is to be created.
 324   *
 325   * @param {string}                [status='info']              Notice status.
 326   * @param {string}                content                      Notice message.
 327   * @param {Object}                [options]                    Notice options.
 328   * @param {string}                [options.context='global']   Context under which to
 329   *                                                             group notice.
 330   * @param {string}                [options.id]                 Identifier for notice.
 331   *                                                             Automatically assigned
 332   *                                                             if not specified.
 333   * @param {boolean}               [options.isDismissible=true] Whether the notice can
 334   *                                                             be dismissed by user.
 335   * @param {string}                [options.type='default']     Type of notice, one of
 336   *                                                             `default`, or `snackbar`.
 337   * @param {boolean}               [options.speak=true]         Whether the notice
 338   *                                                             content should be
 339   *                                                             announced to screen
 340   *                                                             readers.
 341   * @param {Array<WPNoticeAction>} [options.actions]            User actions to be
 342   *                                                             presented with notice.
 343   */
 344  
 345  function createNotice() {
 346    var status,
 347        content,
 348        options,
 349        _options$speak,
 350        speak,
 351        _options$isDismissibl,
 352        isDismissible,
 353        _options$context,
 354        context,
 355        _options$id,
 356        id,
 357        _options$actions,
 358        actions,
 359        _options$type,
 360        type,
 361        __unstableHTML,
 362        _args = arguments;
 363  
 364    return regenerator_default.a.wrap(function createNotice$(_context) {
 365      while (1) {
 366        switch (_context.prev = _context.next) {
 367          case 0:
 368            status = _args.length > 0 && _args[0] !== undefined ? _args[0] : DEFAULT_STATUS;
 369            content = _args.length > 1 ? _args[1] : undefined;
 370            options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
 371            _options$speak = options.speak, speak = _options$speak === void 0 ? true : _options$speak, _options$isDismissibl = options.isDismissible, isDismissible = _options$isDismissibl === void 0 ? true : _options$isDismissibl, _options$context = options.context, context = _options$context === void 0 ? DEFAULT_CONTEXT : _options$context, _options$id = options.id, id = _options$id === void 0 ? Object(external_lodash_["uniqueId"])(context) : _options$id, _options$actions = options.actions, actions = _options$actions === void 0 ? [] : _options$actions, _options$type = options.type, type = _options$type === void 0 ? 'default' : _options$type, __unstableHTML = options.__unstableHTML; // The supported value shape of content is currently limited to plain text
 372            // strings. To avoid setting expectation that e.g. a WPElement could be
 373            // supported, cast to a string.
 374  
 375            content = String(content);
 376  
 377            if (!speak) {
 378              _context.next = 8;
 379              break;
 380            }
 381  
 382            _context.next = 8;
 383            return {
 384              type: 'SPEAK',
 385              message: content,
 386              ariaLive: type === 'snackbar' ? 'polite' : 'assertive'
 387            };
 388  
 389          case 8:
 390            _context.next = 10;
 391            return {
 392              type: 'CREATE_NOTICE',
 393              context: context,
 394              notice: {
 395                id: id,
 396                status: status,
 397                content: content,
 398                __unstableHTML: __unstableHTML,
 399                isDismissible: isDismissible,
 400                actions: actions,
 401                type: type
 402              }
 403            };
 404  
 405          case 10:
 406          case "end":
 407            return _context.stop();
 408        }
 409      }
 410    }, _marked);
 411  }
 412  /**
 413   * Returns an action object used in signalling that a success notice is to be
 414   * created. Refer to `createNotice` for options documentation.
 415   *
 416   * @see createNotice
 417   *
 418   * @param {string} content   Notice message.
 419   * @param {Object} [options] Optional notice options.
 420   *
 421   * @return {Object} Action object.
 422   */
 423  
 424  function createSuccessNotice(content, options) {
 425    return createNotice('success', content, options);
 426  }
 427  /**
 428   * Returns an action object used in signalling that an info notice is to be
 429   * created. Refer to `createNotice` for options documentation.
 430   *
 431   * @see createNotice
 432   *
 433   * @param {string} content   Notice message.
 434   * @param {Object} [options] Optional notice options.
 435   *
 436   * @return {Object} Action object.
 437   */
 438  
 439  function createInfoNotice(content, options) {
 440    return createNotice('info', content, options);
 441  }
 442  /**
 443   * Returns an action object used in signalling that an error notice is to be
 444   * created. Refer to `createNotice` for options documentation.
 445   *
 446   * @see createNotice
 447   *
 448   * @param {string} content   Notice message.
 449   * @param {Object} [options] Optional notice options.
 450   *
 451   * @return {Object} Action object.
 452   */
 453  
 454  function createErrorNotice(content, options) {
 455    return createNotice('error', content, options);
 456  }
 457  /**
 458   * Returns an action object used in signalling that a warning notice is to be
 459   * created. Refer to `createNotice` for options documentation.
 460   *
 461   * @see createNotice
 462   *
 463   * @param {string} content   Notice message.
 464   * @param {Object} [options] Optional notice options.
 465   *
 466   * @return {Object} Action object.
 467   */
 468  
 469  function createWarningNotice(content, options) {
 470    return createNotice('warning', content, options);
 471  }
 472  /**
 473   * Returns an action object used in signalling that a notice is to be removed.
 474   *
 475   * @param {string} id                 Notice unique identifier.
 476   * @param {string} [context='global'] Optional context (grouping) in which the notice is
 477   *                                    intended to appear. Defaults to default context.
 478   *
 479   * @return {Object} Action object.
 480   */
 481  
 482  function removeNotice(id) {
 483    var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT;
 484    return {
 485      type: 'REMOVE_NOTICE',
 486      id: id,
 487      context: context
 488    };
 489  }
 490  
 491  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/selectors.js
 492  /**
 493   * Internal dependencies
 494   */
 495  
 496  /**
 497   * The default empty set of notices to return when there are no notices
 498   * assigned for a given notices context. This can occur if the getNotices
 499   * selector is called without a notice ever having been created for the
 500   * context. A shared value is used to ensure referential equality between
 501   * sequential selector calls, since otherwise `[] !== []`.
 502   *
 503   * @type {Array}
 504   */
 505  
 506  var DEFAULT_NOTICES = [];
 507  /**
 508   * @typedef {Object} WPNotice Notice object.
 509   *
 510   * @property {string}  id               Unique identifier of notice.
 511   * @property {string}  status           Status of notice, one of `success`,
 512   *                                      `info`, `error`, or `warning`. Defaults
 513   *                                      to `info`.
 514   * @property {string}  content          Notice message.
 515   * @property {string}  __unstableHTML   Notice message as raw HTML. Intended to
 516   *                                      serve primarily for compatibility of
 517   *                                      server-rendered notices, and SHOULD NOT
 518   *                                      be used for notices. It is subject to
 519   *                                      removal without notice.
 520   * @property {boolean} isDismissible    Whether the notice can be dismissed by
 521   *                                      user. Defaults to `true`.
 522   * @property {string}  type             Type of notice, one of `default`,
 523   *                                      or `snackbar`. Defaults to `default`.
 524   * @property {boolean} speak            Whether the notice content should be
 525   *                                      announced to screen readers. Defaults to
 526   *                                      `true`.
 527   * @property {WPNoticeAction[]} actions User actions to present with notice.
 528   *
 529   */
 530  
 531  /**
 532   * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.
 533   *
 534   * @property {string}    label    Message to use as action label.
 535   * @property {?string}   url      Optional URL of resource if action incurs
 536   *                                browser navigation.
 537   * @property {?Function} onClick  Optional function to invoke when action is
 538   *                                triggered by user.
 539   *
 540   */
 541  
 542  /**
 543   * Returns all notices as an array, optionally for a given context. Defaults to
 544   * the global context.
 545   *
 546   * @param {Object}  state   Notices state.
 547   * @param {?string} context Optional grouping context.
 548   *
 549   * @return {WPNotice[]} Array of notices.
 550   */
 551  
 552  function getNotices(state) {
 553    var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT;
 554    return state[context] || DEFAULT_NOTICES;
 555  }
 556  
 557  // EXTERNAL MODULE: external {"this":["wp","a11y"]}
 558  var external_this_wp_a11y_ = __webpack_require__(45);
 559  
 560  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/controls.js
 561  /**
 562   * WordPress dependencies
 563   */
 564  
 565  /* harmony default export */ var controls = ({
 566    SPEAK: function SPEAK(action) {
 567      Object(external_this_wp_a11y_["speak"])(action.message, action.ariaLive || 'assertive');
 568    }
 569  });
 570  
 571  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/index.js
 572  /**
 573   * WordPress dependencies
 574   */
 575  
 576  /**
 577   * Internal dependencies
 578   */
 579  
 580  
 581  
 582  
 583  
 584  /* harmony default export */ var store = (Object(external_this_wp_data_["registerStore"])('core/notices', {
 585    reducer: store_reducer,
 586    actions: actions_namespaceObject,
 587    selectors: selectors_namespaceObject,
 588    controls: controls
 589  }));
 590  
 591  // CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/index.js
 592  /**
 593   * Internal dependencies
 594   */
 595  
 596  
 597  
 598  /***/ }),
 599  
 600  /***/ 4:
 601  /***/ (function(module, exports) {
 602  
 603  (function() { module.exports = this["wp"]["data"]; }());
 604  
 605  /***/ }),
 606  
 607  /***/ 45:
 608  /***/ (function(module, exports) {
 609  
 610  (function() { module.exports = this["wp"]["a11y"]; }());
 611  
 612  /***/ }),
 613  
 614  /***/ 47:
 615  /***/ (function(module, exports, __webpack_require__) {
 616  
 617  /**
 618   * Copyright (c) 2014-present, Facebook, Inc.
 619   *
 620   * This source code is licensed under the MIT license found in the
 621   * LICENSE file in the root directory of this source tree.
 622   */
 623  
 624  var runtime = (function (exports) {
 625    "use strict";
 626  
 627    var Op = Object.prototype;
 628    var hasOwn = Op.hasOwnProperty;
 629    var undefined; // More compressible than void 0.
 630    var $Symbol = typeof Symbol === "function" ? Symbol : {};
 631    var iteratorSymbol = $Symbol.iterator || "@@iterator";
 632    var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
 633    var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
 634  
 635    function wrap(innerFn, outerFn, self, tryLocsList) {
 636      // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
 637      var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
 638      var generator = Object.create(protoGenerator.prototype);
 639      var context = new Context(tryLocsList || []);
 640  
 641      // The ._invoke method unifies the implementations of the .next,
 642      // .throw, and .return methods.
 643      generator._invoke = makeInvokeMethod(innerFn, self, context);
 644  
 645      return generator;
 646    }
 647    exports.wrap = wrap;
 648  
 649    // Try/catch helper to minimize deoptimizations. Returns a completion
 650    // record like context.tryEntries[i].completion. This interface could
 651    // have been (and was previously) designed to take a closure to be
 652    // invoked without arguments, but in all the cases we care about we
 653    // already have an existing method we want to call, so there's no need
 654    // to create a new function object. We can even get away with assuming
 655    // the method takes exactly one argument, since that happens to be true
 656    // in every case, so we don't have to touch the arguments object. The
 657    // only additional allocation required is the completion record, which
 658    // has a stable shape and so hopefully should be cheap to allocate.
 659    function tryCatch(fn, obj, arg) {
 660      try {
 661        return { type: "normal", arg: fn.call(obj, arg) };
 662      } catch (err) {
 663        return { type: "throw", arg: err };
 664      }
 665    }
 666  
 667    var GenStateSuspendedStart = "suspendedStart";
 668    var GenStateSuspendedYield = "suspendedYield";
 669    var GenStateExecuting = "executing";
 670    var GenStateCompleted = "completed";
 671  
 672    // Returning this object from the innerFn has the same effect as
 673    // breaking out of the dispatch switch statement.
 674    var ContinueSentinel = {};
 675  
 676    // Dummy constructor functions that we use as the .constructor and
 677    // .constructor.prototype properties for functions that return Generator
 678    // objects. For full spec compliance, you may wish to configure your
 679    // minifier not to mangle the names of these two functions.
 680    function Generator() {}
 681    function GeneratorFunction() {}
 682    function GeneratorFunctionPrototype() {}
 683  
 684    // This is a polyfill for %IteratorPrototype% for environments that
 685    // don't natively support it.
 686    var IteratorPrototype = {};
 687    IteratorPrototype[iteratorSymbol] = function () {
 688      return this;
 689    };
 690  
 691    var getProto = Object.getPrototypeOf;
 692    var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
 693    if (NativeIteratorPrototype &&
 694        NativeIteratorPrototype !== Op &&
 695        hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
 696      // This environment has a native %IteratorPrototype%; use it instead
 697      // of the polyfill.
 698      IteratorPrototype = NativeIteratorPrototype;
 699    }
 700  
 701    var Gp = GeneratorFunctionPrototype.prototype =
 702      Generator.prototype = Object.create(IteratorPrototype);
 703    GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
 704    GeneratorFunctionPrototype.constructor = GeneratorFunction;
 705    GeneratorFunctionPrototype[toStringTagSymbol] =
 706      GeneratorFunction.displayName = "GeneratorFunction";
 707  
 708    // Helper for defining the .next, .throw, and .return methods of the
 709    // Iterator interface in terms of a single ._invoke method.
 710    function defineIteratorMethods(prototype) {
 711      ["next", "throw", "return"].forEach(function(method) {
 712        prototype[method] = function(arg) {
 713          return this._invoke(method, arg);
 714        };
 715      });
 716    }
 717  
 718    exports.isGeneratorFunction = function(genFun) {
 719      var ctor = typeof genFun === "function" && genFun.constructor;
 720      return ctor
 721        ? ctor === GeneratorFunction ||
 722          // For the native GeneratorFunction constructor, the best we can
 723          // do is to check its .name property.
 724          (ctor.displayName || ctor.name) === "GeneratorFunction"
 725        : false;
 726    };
 727  
 728    exports.mark = function(genFun) {
 729      if (Object.setPrototypeOf) {
 730        Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
 731      } else {
 732        genFun.__proto__ = GeneratorFunctionPrototype;
 733        if (!(toStringTagSymbol in genFun)) {
 734          genFun[toStringTagSymbol] = "GeneratorFunction";
 735        }
 736      }
 737      genFun.prototype = Object.create(Gp);
 738      return genFun;
 739    };
 740  
 741    // Within the body of any async function, `await x` is transformed to
 742    // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
 743    // `hasOwn.call(value, "__await")` to determine if the yielded value is
 744    // meant to be awaited.
 745    exports.awrap = function(arg) {
 746      return { __await: arg };
 747    };
 748  
 749    function AsyncIterator(generator) {
 750      function invoke(method, arg, resolve, reject) {
 751        var record = tryCatch(generator[method], generator, arg);
 752        if (record.type === "throw") {
 753          reject(record.arg);
 754        } else {
 755          var result = record.arg;
 756          var value = result.value;
 757          if (value &&
 758              typeof value === "object" &&
 759              hasOwn.call(value, "__await")) {
 760            return Promise.resolve(value.__await).then(function(value) {
 761              invoke("next", value, resolve, reject);
 762            }, function(err) {
 763              invoke("throw", err, resolve, reject);
 764            });
 765          }
 766  
 767          return Promise.resolve(value).then(function(unwrapped) {
 768            // When a yielded Promise is resolved, its final value becomes
 769            // the .value of the Promise<{value,done}> result for the
 770            // current iteration.
 771            result.value = unwrapped;
 772            resolve(result);
 773          }, function(error) {
 774            // If a rejected Promise was yielded, throw the rejection back
 775            // into the async generator function so it can be handled there.
 776            return invoke("throw", error, resolve, reject);
 777          });
 778        }
 779      }
 780  
 781      var previousPromise;
 782  
 783      function enqueue(method, arg) {
 784        function callInvokeWithMethodAndArg() {
 785          return new Promise(function(resolve, reject) {
 786            invoke(method, arg, resolve, reject);
 787          });
 788        }
 789  
 790        return previousPromise =
 791          // If enqueue has been called before, then we want to wait until
 792          // all previous Promises have been resolved before calling invoke,
 793          // so that results are always delivered in the correct order. If
 794          // enqueue has not been called before, then it is important to
 795          // call invoke immediately, without waiting on a callback to fire,
 796          // so that the async generator function has the opportunity to do
 797          // any necessary setup in a predictable way. This predictability
 798          // is why the Promise constructor synchronously invokes its
 799          // executor callback, and why async functions synchronously
 800          // execute code before the first await. Since we implement simple
 801          // async functions in terms of async generators, it is especially
 802          // important to get this right, even though it requires care.
 803          previousPromise ? previousPromise.then(
 804            callInvokeWithMethodAndArg,
 805            // Avoid propagating failures to Promises returned by later
 806            // invocations of the iterator.
 807            callInvokeWithMethodAndArg
 808          ) : callInvokeWithMethodAndArg();
 809      }
 810  
 811      // Define the unified helper method that is used to implement .next,
 812      // .throw, and .return (see defineIteratorMethods).
 813      this._invoke = enqueue;
 814    }
 815  
 816    defineIteratorMethods(AsyncIterator.prototype);
 817    AsyncIterator.prototype[asyncIteratorSymbol] = function () {
 818      return this;
 819    };
 820    exports.AsyncIterator = AsyncIterator;
 821  
 822    // Note that simple async functions are implemented on top of
 823    // AsyncIterator objects; they just return a Promise for the value of
 824    // the final result produced by the iterator.
 825    exports.async = function(innerFn, outerFn, self, tryLocsList) {
 826      var iter = new AsyncIterator(
 827        wrap(innerFn, outerFn, self, tryLocsList)
 828      );
 829  
 830      return exports.isGeneratorFunction(outerFn)
 831        ? iter // If outerFn is a generator, return the full iterator.
 832        : iter.next().then(function(result) {
 833            return result.done ? result.value : iter.next();
 834          });
 835    };
 836  
 837    function makeInvokeMethod(innerFn, self, context) {
 838      var state = GenStateSuspendedStart;
 839  
 840      return function invoke(method, arg) {
 841        if (state === GenStateExecuting) {
 842          throw new Error("Generator is already running");
 843        }
 844  
 845        if (state === GenStateCompleted) {
 846          if (method === "throw") {
 847            throw arg;
 848          }
 849  
 850          // Be forgiving, per 25.3.3.3.3 of the spec:
 851          // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
 852          return doneResult();
 853        }
 854  
 855        context.method = method;
 856        context.arg = arg;
 857  
 858        while (true) {
 859          var delegate = context.delegate;
 860          if (delegate) {
 861            var delegateResult = maybeInvokeDelegate(delegate, context);
 862            if (delegateResult) {
 863              if (delegateResult === ContinueSentinel) continue;
 864              return delegateResult;
 865            }
 866          }
 867  
 868          if (context.method === "next") {
 869            // Setting context._sent for legacy support of Babel's
 870            // function.sent implementation.
 871            context.sent = context._sent = context.arg;
 872  
 873          } else if (context.method === "throw") {
 874            if (state === GenStateSuspendedStart) {
 875              state = GenStateCompleted;
 876              throw context.arg;
 877            }
 878  
 879            context.dispatchException(context.arg);
 880  
 881          } else if (context.method === "return") {
 882            context.abrupt("return", context.arg);
 883          }
 884  
 885          state = GenStateExecuting;
 886  
 887          var record = tryCatch(innerFn, self, context);
 888          if (record.type === "normal") {
 889            // If an exception is thrown from innerFn, we leave state ===
 890            // GenStateExecuting and loop back for another invocation.
 891            state = context.done
 892              ? GenStateCompleted
 893              : GenStateSuspendedYield;
 894  
 895            if (record.arg === ContinueSentinel) {
 896              continue;
 897            }
 898  
 899            return {
 900              value: record.arg,
 901              done: context.done
 902            };
 903  
 904          } else if (record.type === "throw") {
 905            state = GenStateCompleted;
 906            // Dispatch the exception by looping back around to the
 907            // context.dispatchException(context.arg) call above.
 908            context.method = "throw";
 909            context.arg = record.arg;
 910          }
 911        }
 912      };
 913    }
 914  
 915    // Call delegate.iterator[context.method](context.arg) and handle the
 916    // result, either by returning a { value, done } result from the
 917    // delegate iterator, or by modifying context.method and context.arg,
 918    // setting context.delegate to null, and returning the ContinueSentinel.
 919    function maybeInvokeDelegate(delegate, context) {
 920      var method = delegate.iterator[context.method];
 921      if (method === undefined) {
 922        // A .throw or .return when the delegate iterator has no .throw
 923        // method always terminates the yield* loop.
 924        context.delegate = null;
 925  
 926        if (context.method === "throw") {
 927          // Note: ["return"] must be used for ES3 parsing compatibility.
 928          if (delegate.iterator["return"]) {
 929            // If the delegate iterator has a return method, give it a
 930            // chance to clean up.
 931            context.method = "return";
 932            context.arg = undefined;
 933            maybeInvokeDelegate(delegate, context);
 934  
 935            if (context.method === "throw") {
 936              // If maybeInvokeDelegate(context) changed context.method from
 937              // "return" to "throw", let that override the TypeError below.
 938              return ContinueSentinel;
 939            }
 940          }
 941  
 942          context.method = "throw";
 943          context.arg = new TypeError(
 944            "The iterator does not provide a 'throw' method");
 945        }
 946  
 947        return ContinueSentinel;
 948      }
 949  
 950      var record = tryCatch(method, delegate.iterator, context.arg);
 951  
 952      if (record.type === "throw") {
 953        context.method = "throw";
 954        context.arg = record.arg;
 955        context.delegate = null;
 956        return ContinueSentinel;
 957      }
 958  
 959      var info = record.arg;
 960  
 961      if (! info) {
 962        context.method = "throw";
 963        context.arg = new TypeError("iterator result is not an object");
 964        context.delegate = null;
 965        return ContinueSentinel;
 966      }
 967  
 968      if (info.done) {
 969        // Assign the result of the finished delegate to the temporary
 970        // variable specified by delegate.resultName (see delegateYield).
 971        context[delegate.resultName] = info.value;
 972  
 973        // Resume execution at the desired location (see delegateYield).
 974        context.next = delegate.nextLoc;
 975  
 976        // If context.method was "throw" but the delegate handled the
 977        // exception, let the outer generator proceed normally. If
 978        // context.method was "next", forget context.arg since it has been
 979        // "consumed" by the delegate iterator. If context.method was
 980        // "return", allow the original .return call to continue in the
 981        // outer generator.
 982        if (context.method !== "return") {
 983          context.method = "next";
 984          context.arg = undefined;
 985        }
 986  
 987      } else {
 988        // Re-yield the result returned by the delegate method.
 989        return info;
 990      }
 991  
 992      // The delegate iterator is finished, so forget it and continue with
 993      // the outer generator.
 994      context.delegate = null;
 995      return ContinueSentinel;
 996    }
 997  
 998    // Define Generator.prototype.{next,throw,return} in terms of the
 999    // unified ._invoke helper method.
1000    defineIteratorMethods(Gp);
1001  
1002    Gp[toStringTagSymbol] = "Generator";
1003  
1004    // A Generator should always return itself as the iterator object when the
1005    // @@iterator function is called on it. Some browsers' implementations of the
1006    // iterator prototype chain incorrectly implement this, causing the Generator
1007    // object to not be returned from this call. This ensures that doesn't happen.
1008    // See https://github.com/facebook/regenerator/issues/274 for more details.
1009    Gp[iteratorSymbol] = function() {
1010      return this;
1011    };
1012  
1013    Gp.toString = function() {
1014      return "[object Generator]";
1015    };
1016  
1017    function pushTryEntry(locs) {
1018      var entry = { tryLoc: locs[0] };
1019  
1020      if (1 in locs) {
1021        entry.catchLoc = locs[1];
1022      }
1023  
1024      if (2 in locs) {
1025        entry.finallyLoc = locs[2];
1026        entry.afterLoc = locs[3];
1027      }
1028  
1029      this.tryEntries.push(entry);
1030    }
1031  
1032    function resetTryEntry(entry) {
1033      var record = entry.completion || {};
1034      record.type = "normal";
1035      delete record.arg;
1036      entry.completion = record;
1037    }
1038  
1039    function Context(tryLocsList) {
1040      // The root entry object (effectively a try statement without a catch
1041      // or a finally block) gives us a place to store values thrown from
1042      // locations where there is no enclosing try statement.
1043      this.tryEntries = [{ tryLoc: "root" }];
1044      tryLocsList.forEach(pushTryEntry, this);
1045      this.reset(true);
1046    }
1047  
1048    exports.keys = function(object) {
1049      var keys = [];
1050      for (var key in object) {
1051        keys.push(key);
1052      }
1053      keys.reverse();
1054  
1055      // Rather than returning an object with a next method, we keep
1056      // things simple and return the next function itself.
1057      return function next() {
1058        while (keys.length) {
1059          var key = keys.pop();
1060          if (key in object) {
1061            next.value = key;
1062            next.done = false;
1063            return next;
1064          }
1065        }
1066  
1067        // To avoid creating an additional object, we just hang the .value
1068        // and .done properties off the next function object itself. This
1069        // also ensures that the minifier will not anonymize the function.
1070        next.done = true;
1071        return next;
1072      };
1073    };
1074  
1075    function values(iterable) {
1076      if (iterable) {
1077        var iteratorMethod = iterable[iteratorSymbol];
1078        if (iteratorMethod) {
1079          return iteratorMethod.call(iterable);
1080        }
1081  
1082        if (typeof iterable.next === "function") {
1083          return iterable;
1084        }
1085  
1086        if (!isNaN(iterable.length)) {
1087          var i = -1, next = function next() {
1088            while (++i < iterable.length) {
1089              if (hasOwn.call(iterable, i)) {
1090                next.value = iterable[i];
1091                next.done = false;
1092                return next;
1093              }
1094            }
1095  
1096            next.value = undefined;
1097            next.done = true;
1098  
1099            return next;
1100          };
1101  
1102          return next.next = next;
1103        }
1104      }
1105  
1106      // Return an iterator with no values.
1107      return { next: doneResult };
1108    }
1109    exports.values = values;
1110  
1111    function doneResult() {
1112      return { value: undefined, done: true };
1113    }
1114  
1115    Context.prototype = {
1116      constructor: Context,
1117  
1118      reset: function(skipTempReset) {
1119        this.prev = 0;
1120        this.next = 0;
1121        // Resetting context._sent for legacy support of Babel's
1122        // function.sent implementation.
1123        this.sent = this._sent = undefined;
1124        this.done = false;
1125        this.delegate = null;
1126  
1127        this.method = "next";
1128        this.arg = undefined;
1129  
1130        this.tryEntries.forEach(resetTryEntry);
1131  
1132        if (!skipTempReset) {
1133          for (var name in this) {
1134            // Not sure about the optimal order of these conditions:
1135            if (name.charAt(0) === "t" &&
1136                hasOwn.call(this, name) &&
1137                !isNaN(+name.slice(1))) {
1138              this[name] = undefined;
1139            }
1140          }
1141        }
1142      },
1143  
1144      stop: function() {
1145        this.done = true;
1146  
1147        var rootEntry = this.tryEntries[0];
1148        var rootRecord = rootEntry.completion;
1149        if (rootRecord.type === "throw") {
1150          throw rootRecord.arg;
1151        }
1152  
1153        return this.rval;
1154      },
1155  
1156      dispatchException: function(exception) {
1157        if (this.done) {
1158          throw exception;
1159        }
1160  
1161        var context = this;
1162        function handle(loc, caught) {
1163          record.type = "throw";
1164          record.arg = exception;
1165          context.next = loc;
1166  
1167          if (caught) {
1168            // If the dispatched exception was caught by a catch block,
1169            // then let that catch block handle the exception normally.
1170            context.method = "next";
1171            context.arg = undefined;
1172          }
1173  
1174          return !! caught;
1175        }
1176  
1177        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1178          var entry = this.tryEntries[i];
1179          var record = entry.completion;
1180  
1181          if (entry.tryLoc === "root") {
1182            // Exception thrown outside of any try block that could handle
1183            // it, so set the completion value of the entire function to
1184            // throw the exception.
1185            return handle("end");
1186          }
1187  
1188          if (entry.tryLoc <= this.prev) {
1189            var hasCatch = hasOwn.call(entry, "catchLoc");
1190            var hasFinally = hasOwn.call(entry, "finallyLoc");
1191  
1192            if (hasCatch && hasFinally) {
1193              if (this.prev < entry.catchLoc) {
1194                return handle(entry.catchLoc, true);
1195              } else if (this.prev < entry.finallyLoc) {
1196                return handle(entry.finallyLoc);
1197              }
1198  
1199            } else if (hasCatch) {
1200              if (this.prev < entry.catchLoc) {
1201                return handle(entry.catchLoc, true);
1202              }
1203  
1204            } else if (hasFinally) {
1205              if (this.prev < entry.finallyLoc) {
1206                return handle(entry.finallyLoc);
1207              }
1208  
1209            } else {
1210              throw new Error("try statement without catch or finally");
1211            }
1212          }
1213        }
1214      },
1215  
1216      abrupt: function(type, arg) {
1217        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1218          var entry = this.tryEntries[i];
1219          if (entry.tryLoc <= this.prev &&
1220              hasOwn.call(entry, "finallyLoc") &&
1221              this.prev < entry.finallyLoc) {
1222            var finallyEntry = entry;
1223            break;
1224          }
1225        }
1226  
1227        if (finallyEntry &&
1228            (type === "break" ||
1229             type === "continue") &&
1230            finallyEntry.tryLoc <= arg &&
1231            arg <= finallyEntry.finallyLoc) {
1232          // Ignore the finally entry if control is not jumping to a
1233          // location outside the try/catch block.
1234          finallyEntry = null;
1235        }
1236  
1237        var record = finallyEntry ? finallyEntry.completion : {};
1238        record.type = type;
1239        record.arg = arg;
1240  
1241        if (finallyEntry) {
1242          this.method = "next";
1243          this.next = finallyEntry.finallyLoc;
1244          return ContinueSentinel;
1245        }
1246  
1247        return this.complete(record);
1248      },
1249  
1250      complete: function(record, afterLoc) {
1251        if (record.type === "throw") {
1252          throw record.arg;
1253        }
1254  
1255        if (record.type === "break" ||
1256            record.type === "continue") {
1257          this.next = record.arg;
1258        } else if (record.type === "return") {
1259          this.rval = this.arg = record.arg;
1260          this.method = "return";
1261          this.next = "end";
1262        } else if (record.type === "normal" && afterLoc) {
1263          this.next = afterLoc;
1264        }
1265  
1266        return ContinueSentinel;
1267      },
1268  
1269      finish: function(finallyLoc) {
1270        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1271          var entry = this.tryEntries[i];
1272          if (entry.finallyLoc === finallyLoc) {
1273            this.complete(entry.completion, entry.afterLoc);
1274            resetTryEntry(entry);
1275            return ContinueSentinel;
1276          }
1277        }
1278      },
1279  
1280      "catch": function(tryLoc) {
1281        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1282          var entry = this.tryEntries[i];
1283          if (entry.tryLoc === tryLoc) {
1284            var record = entry.completion;
1285            if (record.type === "throw") {
1286              var thrown = record.arg;
1287              resetTryEntry(entry);
1288            }
1289            return thrown;
1290          }
1291        }
1292  
1293        // The context.catch method must only be called with a location
1294        // argument that corresponds to a known catch block.
1295        throw new Error("illegal catch attempt");
1296      },
1297  
1298      delegateYield: function(iterable, resultName, nextLoc) {
1299        this.delegate = {
1300          iterator: values(iterable),
1301          resultName: resultName,
1302          nextLoc: nextLoc
1303        };
1304  
1305        if (this.method === "next") {
1306          // Deliberately forget the last sent value so that we don't
1307          // accidentally pass it on to the delegate.
1308          this.arg = undefined;
1309        }
1310  
1311        return ContinueSentinel;
1312      }
1313    };
1314  
1315    // Regardless of whether this script is executing as a CommonJS module
1316    // or not, return the runtime object so that we can declare the variable
1317    // regeneratorRuntime in the outer scope, which allows this module to be
1318    // injected easily by `bin/regenerator --include-runtime script.js`.
1319    return exports;
1320  
1321  }(
1322    // If this script is executing as a CommonJS module, use module.exports
1323    // as the regeneratorRuntime namespace. Otherwise create a new empty
1324    // object. Either way, the resulting object will be used to initialize
1325    // the regeneratorRuntime variable at the top of this file.
1326     true ? module.exports : undefined
1327  ));
1328  
1329  try {
1330    regeneratorRuntime = runtime;
1331  } catch (accidentalStrictMode) {
1332    // This module should not be running in strict mode, so the above
1333    // assignment should always work unless something is misconfigured. Just
1334    // in case runtime.js accidentally runs in strict mode, we can escape
1335    // strict mode using a global Function call. This could conceivably fail
1336    // if a Content Security Policy forbids using Function, but in that case
1337    // the proper solution is to fix the accidental strict mode problem. If
1338    // you've misconfigured your bundler to force strict mode and applied a
1339    // CSP to forbid Function, and you're not willing to fix either of those
1340    // problems, please detail your unique predicament in a GitHub issue.
1341    Function("r", "regeneratorRuntime = r")(runtime);
1342  }
1343  
1344  
1345  /***/ }),
1346  
1347  /***/ 7:
1348  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1349  
1350  "use strict";
1351  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
1352  /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
1353  
1354  function _objectSpread(target) {
1355    for (var i = 1; i < arguments.length; i++) {
1356      var source = arguments[i] != null ? arguments[i] : {};
1357      var ownKeys = Object.keys(source);
1358  
1359      if (typeof Object.getOwnPropertySymbols === 'function') {
1360        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
1361          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1362        }));
1363      }
1364  
1365      ownKeys.forEach(function (key) {
1366        Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
1367      });
1368    }
1369  
1370    return target;
1371  }
1372  
1373  /***/ })
1374  
1375  /******/ });


Generated: Wed Oct 16 08:20:01 2019 Cross-referenced by PHPXref 0.7