[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> keyboard-shortcuts.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["keyboardShortcuts"] =
   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 = 475);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 10:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["compose"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 12:
  98  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99  
 100  "use strict";
 101  
 102  // EXPORTS
 103  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
 104  
 105  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 106  var arrayWithHoles = __webpack_require__(38);
 107  
 108  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 109  function _iterableToArrayLimit(arr, i) {
 110    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 111    var _arr = [];
 112    var _n = true;
 113    var _d = false;
 114    var _e = undefined;
 115  
 116    try {
 117      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 118        _arr.push(_s.value);
 119  
 120        if (i && _arr.length === i) break;
 121      }
 122    } catch (err) {
 123      _d = true;
 124      _e = err;
 125    } finally {
 126      try {
 127        if (!_n && _i["return"] != null) _i["return"]();
 128      } finally {
 129        if (_d) throw _e;
 130      }
 131    }
 132  
 133    return _arr;
 134  }
 135  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 136  var unsupportedIterableToArray = __webpack_require__(30);
 137  
 138  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 139  var nonIterableRest = __webpack_require__(39);
 140  
 141  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 142  
 143  
 144  
 145  
 146  function _slicedToArray(arr, i) {
 147    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 148  }
 149  
 150  /***/ }),
 151  
 152  /***/ 17:
 153  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 154  
 155  "use strict";
 156  
 157  // EXPORTS
 158  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 159  
 160  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 161  var arrayLikeToArray = __webpack_require__(27);
 162  
 163  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 164  
 165  function _arrayWithoutHoles(arr) {
 166    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 167  }
 168  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 169  var iterableToArray = __webpack_require__(37);
 170  
 171  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 172  var unsupportedIterableToArray = __webpack_require__(30);
 173  
 174  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 175  function _nonIterableSpread() {
 176    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 177  }
 178  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 179  
 180  
 181  
 182  
 183  function _toConsumableArray(arr) {
 184    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 185  }
 186  
 187  /***/ }),
 188  
 189  /***/ 18:
 190  /***/ (function(module, exports) {
 191  
 192  (function() { module.exports = this["wp"]["keycodes"]; }());
 193  
 194  /***/ }),
 195  
 196  /***/ 2:
 197  /***/ (function(module, exports) {
 198  
 199  (function() { module.exports = this["lodash"]; }());
 200  
 201  /***/ }),
 202  
 203  /***/ 27:
 204  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 205  
 206  "use strict";
 207  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 208  function _arrayLikeToArray(arr, len) {
 209    if (len == null || len > arr.length) len = arr.length;
 210  
 211    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 212      arr2[i] = arr[i];
 213    }
 214  
 215    return arr2;
 216  }
 217  
 218  /***/ }),
 219  
 220  /***/ 30:
 221  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 222  
 223  "use strict";
 224  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 225  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
 226  
 227  function _unsupportedIterableToArray(o, minLen) {
 228    if (!o) return;
 229    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 230    var n = Object.prototype.toString.call(o).slice(8, -1);
 231    if (n === "Object" && o.constructor) n = o.constructor.name;
 232    if (n === "Map" || n === "Set") return Array.from(o);
 233    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 234  }
 235  
 236  /***/ }),
 237  
 238  /***/ 37:
 239  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 240  
 241  "use strict";
 242  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 243  function _iterableToArray(iter) {
 244    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 245  }
 246  
 247  /***/ }),
 248  
 249  /***/ 38:
 250  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 251  
 252  "use strict";
 253  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 254  function _arrayWithHoles(arr) {
 255    if (Array.isArray(arr)) return arr;
 256  }
 257  
 258  /***/ }),
 259  
 260  /***/ 39:
 261  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 262  
 263  "use strict";
 264  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 265  function _nonIterableRest() {
 266    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 267  }
 268  
 269  /***/ }),
 270  
 271  /***/ 4:
 272  /***/ (function(module, exports) {
 273  
 274  (function() { module.exports = this["wp"]["data"]; }());
 275  
 276  /***/ }),
 277  
 278  /***/ 42:
 279  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 280  
 281  "use strict";
 282  
 283  
 284  var LEAF_KEY, hasWeakMap;
 285  
 286  /**
 287   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 288   *
 289   * @type {Object}
 290   */
 291  LEAF_KEY = {};
 292  
 293  /**
 294   * Whether environment supports WeakMap.
 295   *
 296   * @type {boolean}
 297   */
 298  hasWeakMap = typeof WeakMap !== 'undefined';
 299  
 300  /**
 301   * Returns the first argument as the sole entry in an array.
 302   *
 303   * @param {*} value Value to return.
 304   *
 305   * @return {Array} Value returned as entry in array.
 306   */
 307  function arrayOf( value ) {
 308      return [ value ];
 309  }
 310  
 311  /**
 312   * Returns true if the value passed is object-like, or false otherwise. A value
 313   * is object-like if it can support property assignment, e.g. object or array.
 314   *
 315   * @param {*} value Value to test.
 316   *
 317   * @return {boolean} Whether value is object-like.
 318   */
 319  function isObjectLike( value ) {
 320      return !! value && 'object' === typeof value;
 321  }
 322  
 323  /**
 324   * Creates and returns a new cache object.
 325   *
 326   * @return {Object} Cache object.
 327   */
 328  function createCache() {
 329      var cache = {
 330          clear: function() {
 331              cache.head = null;
 332          },
 333      };
 334  
 335      return cache;
 336  }
 337  
 338  /**
 339   * Returns true if entries within the two arrays are strictly equal by
 340   * reference from a starting index.
 341   *
 342   * @param {Array}  a         First array.
 343   * @param {Array}  b         Second array.
 344   * @param {number} fromIndex Index from which to start comparison.
 345   *
 346   * @return {boolean} Whether arrays are shallowly equal.
 347   */
 348  function isShallowEqual( a, b, fromIndex ) {
 349      var i;
 350  
 351      if ( a.length !== b.length ) {
 352          return false;
 353      }
 354  
 355      for ( i = fromIndex; i < a.length; i++ ) {
 356          if ( a[ i ] !== b[ i ] ) {
 357              return false;
 358          }
 359      }
 360  
 361      return true;
 362  }
 363  
 364  /**
 365   * Returns a memoized selector function. The getDependants function argument is
 366   * called before the memoized selector and is expected to return an immutable
 367   * reference or array of references on which the selector depends for computing
 368   * its own return value. The memoize cache is preserved only as long as those
 369   * dependant references remain the same. If getDependants returns a different
 370   * reference(s), the cache is cleared and the selector value regenerated.
 371   *
 372   * @param {Function} selector      Selector function.
 373   * @param {Function} getDependants Dependant getter returning an immutable
 374   *                                 reference or array of reference used in
 375   *                                 cache bust consideration.
 376   *
 377   * @return {Function} Memoized selector.
 378   */
 379  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 380      var rootCache, getCache;
 381  
 382      // Use object source as dependant if getter not provided
 383      if ( ! getDependants ) {
 384          getDependants = arrayOf;
 385      }
 386  
 387      /**
 388       * Returns the root cache. If WeakMap is supported, this is assigned to the
 389       * root WeakMap cache set, otherwise it is a shared instance of the default
 390       * cache object.
 391       *
 392       * @return {(WeakMap|Object)} Root cache object.
 393       */
 394  	function getRootCache() {
 395          return rootCache;
 396      }
 397  
 398      /**
 399       * Returns the cache for a given dependants array. When possible, a WeakMap
 400       * will be used to create a unique cache for each set of dependants. This
 401       * is feasible due to the nature of WeakMap in allowing garbage collection
 402       * to occur on entries where the key object is no longer referenced. Since
 403       * WeakMap requires the key to be an object, this is only possible when the
 404       * dependant is object-like. The root cache is created as a hierarchy where
 405       * each top-level key is the first entry in a dependants set, the value a
 406       * WeakMap where each key is the next dependant, and so on. This continues
 407       * so long as the dependants are object-like. If no dependants are object-
 408       * like, then the cache is shared across all invocations.
 409       *
 410       * @see isObjectLike
 411       *
 412       * @param {Array} dependants Selector dependants.
 413       *
 414       * @return {Object} Cache object.
 415       */
 416  	function getWeakMapCache( dependants ) {
 417          var caches = rootCache,
 418              isUniqueByDependants = true,
 419              i, dependant, map, cache;
 420  
 421          for ( i = 0; i < dependants.length; i++ ) {
 422              dependant = dependants[ i ];
 423  
 424              // Can only compose WeakMap from object-like key.
 425              if ( ! isObjectLike( dependant ) ) {
 426                  isUniqueByDependants = false;
 427                  break;
 428              }
 429  
 430              // Does current segment of cache already have a WeakMap?
 431              if ( caches.has( dependant ) ) {
 432                  // Traverse into nested WeakMap.
 433                  caches = caches.get( dependant );
 434              } else {
 435                  // Create, set, and traverse into a new one.
 436                  map = new WeakMap();
 437                  caches.set( dependant, map );
 438                  caches = map;
 439              }
 440          }
 441  
 442          // We use an arbitrary (but consistent) object as key for the last item
 443          // in the WeakMap to serve as our running cache.
 444          if ( ! caches.has( LEAF_KEY ) ) {
 445              cache = createCache();
 446              cache.isUniqueByDependants = isUniqueByDependants;
 447              caches.set( LEAF_KEY, cache );
 448          }
 449  
 450          return caches.get( LEAF_KEY );
 451      }
 452  
 453      // Assign cache handler by availability of WeakMap
 454      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 455  
 456      /**
 457       * Resets root memoization cache.
 458       */
 459  	function clear() {
 460          rootCache = hasWeakMap ? new WeakMap() : createCache();
 461      }
 462  
 463      // eslint-disable-next-line jsdoc/check-param-names
 464      /**
 465       * The augmented selector call, considering first whether dependants have
 466       * changed before passing it to underlying memoize function.
 467       *
 468       * @param {Object} source    Source object for derivation.
 469       * @param {...*}   extraArgs Additional arguments to pass to selector.
 470       *
 471       * @return {*} Selector result.
 472       */
 473  	function callSelector( /* source, ...extraArgs */ ) {
 474          var len = arguments.length,
 475              cache, node, i, args, dependants;
 476  
 477          // Create copy of arguments (avoid leaking deoptimization).
 478          args = new Array( len );
 479          for ( i = 0; i < len; i++ ) {
 480              args[ i ] = arguments[ i ];
 481          }
 482  
 483          dependants = getDependants.apply( null, args );
 484          cache = getCache( dependants );
 485  
 486          // If not guaranteed uniqueness by dependants (primitive type or lack
 487          // of WeakMap support), shallow compare against last dependants and, if
 488          // references have changed, destroy cache to recalculate result.
 489          if ( ! cache.isUniqueByDependants ) {
 490              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 491                  cache.clear();
 492              }
 493  
 494              cache.lastDependants = dependants;
 495          }
 496  
 497          node = cache.head;
 498          while ( node ) {
 499              // Check whether node arguments match arguments
 500              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 501                  node = node.next;
 502                  continue;
 503              }
 504  
 505              // At this point we can assume we've found a match
 506  
 507              // Surface matched node to head if not already
 508              if ( node !== cache.head ) {
 509                  // Adjust siblings to point to each other.
 510                  node.prev.next = node.next;
 511                  if ( node.next ) {
 512                      node.next.prev = node.prev;
 513                  }
 514  
 515                  node.next = cache.head;
 516                  node.prev = null;
 517                  cache.head.prev = node;
 518                  cache.head = node;
 519              }
 520  
 521              // Return immediately
 522              return node.val;
 523          }
 524  
 525          // No cached value found. Continue to insertion phase:
 526  
 527          node = {
 528              // Generate the result from original function
 529              val: selector.apply( null, args ),
 530          };
 531  
 532          // Avoid including the source object in the cache.
 533          args[ 0 ] = null;
 534          node.args = args;
 535  
 536          // Don't need to check whether node is already head, since it would
 537          // have been returned above already if it was
 538  
 539          // Shift existing head down list
 540          if ( cache.head ) {
 541              cache.head.prev = node;
 542              node.next = cache.head;
 543          }
 544  
 545          cache.head = node;
 546  
 547          return node.val;
 548      }
 549  
 550      callSelector.getDependants = getDependants;
 551      callSelector.clear = clear;
 552      clear();
 553  
 554      return callSelector;
 555  });
 556  
 557  
 558  /***/ }),
 559  
 560  /***/ 475:
 561  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 562  
 563  "use strict";
 564  // ESM COMPAT FLAG
 565  __webpack_require__.r(__webpack_exports__);
 566  
 567  // EXPORTS
 568  __webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
 569  
 570  // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
 571  var actions_namespaceObject = {};
 572  __webpack_require__.r(actions_namespaceObject);
 573  __webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
 574  __webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
 575  
 576  // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
 577  var selectors_namespaceObject = {};
 578  __webpack_require__.r(selectors_namespaceObject);
 579  __webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
 580  __webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
 581  __webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
 582  __webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
 583  __webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
 584  __webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
 585  
 586  // EXTERNAL MODULE: external {"this":["wp","data"]}
 587  var external_this_wp_data_ = __webpack_require__(4);
 588  
 589  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 590  var defineProperty = __webpack_require__(5);
 591  
 592  // EXTERNAL MODULE: external {"this":"lodash"}
 593  var external_this_lodash_ = __webpack_require__(2);
 594  
 595  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
 596  
 597  
 598  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 599  
 600  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 601  
 602  /**
 603   * External dependencies
 604   */
 605  
 606  /**
 607   * Reducer returning the registered shortcuts
 608   *
 609   * @param {Object} state  Current state.
 610   * @param {Object} action Dispatched action.
 611   *
 612   * @return {Object} Updated state.
 613   */
 614  
 615  function reducer() {
 616    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 617    var action = arguments.length > 1 ? arguments[1] : undefined;
 618  
 619    switch (action.type) {
 620      case 'REGISTER_SHORTCUT':
 621        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.name, {
 622          category: action.category,
 623          keyCombination: action.keyCombination,
 624          aliases: action.aliases,
 625          description: action.description
 626        }));
 627  
 628      case 'UNREGISTER_SHORTCUT':
 629        return Object(external_this_lodash_["omit"])(state, action.name);
 630    }
 631  
 632    return state;
 633  }
 634  
 635  /* harmony default export */ var store_reducer = (reducer);
 636  
 637  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
 638  /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
 639  
 640  /**
 641   * Keyboard key combination.
 642   *
 643   * @typedef {Object} WPShortcutKeyCombination
 644   *
 645   * @property {string}                      character Character.
 646   * @property {WPKeycodeModifier|undefined} modifier  Modifier.
 647   */
 648  
 649  /**
 650   * Configuration of a registered keyboard shortcut.
 651   *
 652   * @typedef {Object} WPShortcutConfig
 653   *
 654   * @property {string}                     name           Shortcut name.
 655   * @property {string}                     category       Shortcut category.
 656   * @property {string}                     description    Shortcut description.
 657   * @property {WPShortcutKeyCombination}   keyCombination Shortcut key combination.
 658   * @property {WPShortcutKeyCombination[]} [aliases]      Shortcut aliases.
 659   */
 660  
 661  /**
 662   * Returns an action object used to register a new keyboard shortcut.
 663   *
 664   * @param {WPShortcutConfig} config Shortcut config.
 665   *
 666   * @return {Object} action.
 667   */
 668  function registerShortcut(_ref) {
 669    var name = _ref.name,
 670        category = _ref.category,
 671        description = _ref.description,
 672        keyCombination = _ref.keyCombination,
 673        aliases = _ref.aliases;
 674    return {
 675      type: 'REGISTER_SHORTCUT',
 676      name: name,
 677      category: category,
 678      keyCombination: keyCombination,
 679      aliases: aliases,
 680      description: description
 681    };
 682  }
 683  /**
 684   * Returns an action object used to unregister a keyboard shortcut.
 685   *
 686   * @param {string} name Shortcut name.
 687   *
 688   * @return {Object} action.
 689   */
 690  
 691  function unregisterShortcut(name) {
 692    return {
 693      type: 'UNREGISTER_SHORTCUT',
 694      name: name
 695    };
 696  }
 697  
 698  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
 699  var slicedToArray = __webpack_require__(12);
 700  
 701  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 702  var toConsumableArray = __webpack_require__(17);
 703  
 704  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 705  var rememo = __webpack_require__(42);
 706  
 707  // EXTERNAL MODULE: external {"this":["wp","keycodes"]}
 708  var external_this_wp_keycodes_ = __webpack_require__(18);
 709  
 710  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
 711  
 712  
 713  
 714  /**
 715   * External dependencies
 716   */
 717  
 718  
 719  /**
 720   * WordPress dependencies
 721   */
 722  
 723  
 724  /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
 725  
 726  /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
 727  
 728  /**
 729   * Shared reference to an empty array for cases where it is important to avoid
 730   * returning a new array reference on every invocation.
 731   *
 732   * @type {Array<any>}
 733   */
 734  
 735  var EMPTY_ARRAY = [];
 736  /**
 737   * Shortcut formatting methods.
 738   *
 739   * @property {WPKeycodeHandlerByModifier} display     Display formatting.
 740   * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
 741   * @property {WPKeycodeHandlerByModifier} ariaLabel   ARIA label formatting.
 742   */
 743  
 744  var FORMATTING_METHODS = {
 745    display: external_this_wp_keycodes_["displayShortcut"],
 746    raw: external_this_wp_keycodes_["rawShortcut"],
 747    ariaLabel: external_this_wp_keycodes_["shortcutAriaLabel"]
 748  };
 749  /**
 750   * Returns a string representing the key combination.
 751   *
 752   * @param {?WPShortcutKeyCombination} shortcut       Key combination.
 753   * @param {keyof FORMATTING_METHODS}  representation Type of representation
 754   *                                                   (display, raw, ariaLabel).
 755   *
 756   * @return {string?} Shortcut representation.
 757   */
 758  
 759  function getKeyCombinationRepresentation(shortcut, representation) {
 760    if (!shortcut) {
 761      return null;
 762    }
 763  
 764    return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
 765  }
 766  /**
 767   * Returns the main key combination for a given shortcut name.
 768   *
 769   * @param {Object} state Global state.
 770   * @param {string} name  Shortcut name.
 771   *
 772   * @return {WPShortcutKeyCombination?} Key combination.
 773   */
 774  
 775  
 776  function getShortcutKeyCombination(state, name) {
 777    return state[name] ? state[name].keyCombination : null;
 778  }
 779  /**
 780   * Returns a string representing the main key combination for a given shortcut name.
 781   *
 782   * @param {Object}                   state          Global state.
 783   * @param {string}                   name           Shortcut name.
 784   * @param {keyof FORMATTING_METHODS} representation Type of representation
 785   *                                                  (display, raw, ariaLabel).
 786   *
 787   * @return {string?} Shortcut representation.
 788   */
 789  
 790  function getShortcutRepresentation(state, name) {
 791    var representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
 792    var shortcut = getShortcutKeyCombination(state, name);
 793    return getKeyCombinationRepresentation(shortcut, representation);
 794  }
 795  /**
 796   * Returns the shortcut description given its name.
 797   *
 798   * @param {Object} state Global state.
 799   * @param {string} name  Shortcut name.
 800   *
 801   * @return {string?} Shortcut description.
 802   */
 803  
 804  function getShortcutDescription(state, name) {
 805    return state[name] ? state[name].description : null;
 806  }
 807  /**
 808   * Returns the aliases for a given shortcut name.
 809   *
 810   * @param {Object} state Global state.
 811   * @param {string} name  Shortcut name.
 812   *
 813   * @return {WPShortcutKeyCombination[]} Key combinations.
 814   */
 815  
 816  function getShortcutAliases(state, name) {
 817    return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
 818  }
 819  /**
 820   * Returns the raw representation of all the keyboard combinations of a given shortcut name.
 821   *
 822   * @param {Object} state Global state.
 823   * @param {string} name  Shortcut name.
 824   *
 825   * @return {string[]} Shortcuts.
 826   */
 827  
 828  var getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])(function (state, name) {
 829    return Object(external_this_lodash_["compact"])([getKeyCombinationRepresentation(getShortcutKeyCombination(state, name), 'raw')].concat(Object(toConsumableArray["a" /* default */])(getShortcutAliases(state, name).map(function (combination) {
 830      return getKeyCombinationRepresentation(combination, 'raw');
 831    }))));
 832  }, function (state, name) {
 833    return [state[name]];
 834  });
 835  /**
 836   * Returns the shortcut names list for a given category name.
 837   *
 838   * @param {Object} state Global state.
 839   * @param {string} name  Category name.
 840   *
 841   * @return {string[]} Shortcut names.
 842   */
 843  
 844  var getCategoryShortcuts = Object(rememo["a" /* default */])(function (state, categoryName) {
 845    return Object.entries(state).filter(function (_ref) {
 846      var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
 847          shortcut = _ref2[1];
 848  
 849      return shortcut.category === categoryName;
 850    }).map(function (_ref3) {
 851      var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 1),
 852          name = _ref4[0];
 853  
 854      return name;
 855    });
 856  }, function (state) {
 857    return [state];
 858  });
 859  
 860  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
 861  /**
 862   * WordPress dependencies
 863   */
 864  
 865  /**
 866   * Internal dependencies
 867   */
 868  
 869  
 870  
 871  
 872  /* harmony default export */ var store = (Object(external_this_wp_data_["registerStore"])('core/keyboard-shortcuts', {
 873    reducer: store_reducer,
 874    actions: actions_namespaceObject,
 875    selectors: selectors_namespaceObject
 876  }));
 877  
 878  // EXTERNAL MODULE: external {"this":["wp","compose"]}
 879  var external_this_wp_compose_ = __webpack_require__(10);
 880  
 881  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
 882  /**
 883   * WordPress dependencies
 884   */
 885  
 886  
 887  /**
 888   * Attach a keyboard shortcut handler.
 889   *
 890   * @param {string} name       Shortcut name.
 891   * @param {Function} callback Shortcut callback.
 892   * @param {Object} options    Shortcut options.
 893   */
 894  
 895  function useShortcut(name, callback, options) {
 896    var shortcuts = Object(external_this_wp_data_["useSelect"])(function (select) {
 897      return select('core/keyboard-shortcuts').getAllShortcutRawKeyCombinations(name);
 898    }, [name]);
 899    Object(external_this_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
 900  }
 901  
 902  /* harmony default export */ var use_shortcut = (useShortcut);
 903  
 904  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
 905  /**
 906   * Internal dependencies
 907   */
 908  
 909  
 910  
 911  
 912  /***/ }),
 913  
 914  /***/ 5:
 915  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 916  
 917  "use strict";
 918  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 919  function _defineProperty(obj, key, value) {
 920    if (key in obj) {
 921      Object.defineProperty(obj, key, {
 922        value: value,
 923        enumerable: true,
 924        configurable: true,
 925        writable: true
 926      });
 927    } else {
 928      obj[key] = value;
 929    }
 930  
 931    return obj;
 932  }
 933  
 934  /***/ })
 935  
 936  /******/ });


Generated: Fri Oct 30 01:00:03 2020 Cross-referenced by PHPXref 0.7.1