[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  this["wp"] = this["wp"] || {}; this["wp"]["compose"] =
   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 = 431);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 105:
  98  /***/ (function(module, exports) {
  99  
 100  // shim for using process in browser
 101  var process = module.exports = {};
 102  
 103  // cached from whatever global is present so that test runners that stub it
 104  // don't break things.  But we need to wrap it in a try catch in case it is
 105  // wrapped in strict mode code which doesn't define any globals.  It's inside a
 106  // function because try/catches deoptimize in certain engines.
 107  
 108  var cachedSetTimeout;
 109  var cachedClearTimeout;
 110  
 111  function defaultSetTimout() {
 112      throw new Error('setTimeout has not been defined');
 113  }
 114  function defaultClearTimeout () {
 115      throw new Error('clearTimeout has not been defined');
 116  }
 117  (function () {
 118      try {
 119          if (typeof setTimeout === 'function') {
 120              cachedSetTimeout = setTimeout;
 121          } else {
 122              cachedSetTimeout = defaultSetTimout;
 123          }
 124      } catch (e) {
 125          cachedSetTimeout = defaultSetTimout;
 126      }
 127      try {
 128          if (typeof clearTimeout === 'function') {
 129              cachedClearTimeout = clearTimeout;
 130          } else {
 131              cachedClearTimeout = defaultClearTimeout;
 132          }
 133      } catch (e) {
 134          cachedClearTimeout = defaultClearTimeout;
 135      }
 136  } ())
 137  function runTimeout(fun) {
 138      if (cachedSetTimeout === setTimeout) {
 139          //normal enviroments in sane situations
 140          return setTimeout(fun, 0);
 141      }
 142      // if setTimeout wasn't available but was latter defined
 143      if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
 144          cachedSetTimeout = setTimeout;
 145          return setTimeout(fun, 0);
 146      }
 147      try {
 148          // when when somebody has screwed with setTimeout but no I.E. maddness
 149          return cachedSetTimeout(fun, 0);
 150      } catch(e){
 151          try {
 152              // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
 153              return cachedSetTimeout.call(null, fun, 0);
 154          } catch(e){
 155              // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
 156              return cachedSetTimeout.call(this, fun, 0);
 157          }
 158      }
 159  
 160  
 161  }
 162  function runClearTimeout(marker) {
 163      if (cachedClearTimeout === clearTimeout) {
 164          //normal enviroments in sane situations
 165          return clearTimeout(marker);
 166      }
 167      // if clearTimeout wasn't available but was latter defined
 168      if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
 169          cachedClearTimeout = clearTimeout;
 170          return clearTimeout(marker);
 171      }
 172      try {
 173          // when when somebody has screwed with setTimeout but no I.E. maddness
 174          return cachedClearTimeout(marker);
 175      } catch (e){
 176          try {
 177              // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
 178              return cachedClearTimeout.call(null, marker);
 179          } catch (e){
 180              // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
 181              // Some versions of I.E. have different rules for clearTimeout vs setTimeout
 182              return cachedClearTimeout.call(this, marker);
 183          }
 184      }
 185  
 186  
 187  
 188  }
 189  var queue = [];
 190  var draining = false;
 191  var currentQueue;
 192  var queueIndex = -1;
 193  
 194  function cleanUpNextTick() {
 195      if (!draining || !currentQueue) {
 196          return;
 197      }
 198      draining = false;
 199      if (currentQueue.length) {
 200          queue = currentQueue.concat(queue);
 201      } else {
 202          queueIndex = -1;
 203      }
 204      if (queue.length) {
 205          drainQueue();
 206      }
 207  }
 208  
 209  function drainQueue() {
 210      if (draining) {
 211          return;
 212      }
 213      var timeout = runTimeout(cleanUpNextTick);
 214      draining = true;
 215  
 216      var len = queue.length;
 217      while(len) {
 218          currentQueue = queue;
 219          queue = [];
 220          while (++queueIndex < len) {
 221              if (currentQueue) {
 222                  currentQueue[queueIndex].run();
 223              }
 224          }
 225          queueIndex = -1;
 226          len = queue.length;
 227      }
 228      currentQueue = null;
 229      draining = false;
 230      runClearTimeout(timeout);
 231  }
 232  
 233  process.nextTick = function (fun) {
 234      var args = new Array(arguments.length - 1);
 235      if (arguments.length > 1) {
 236          for (var i = 1; i < arguments.length; i++) {
 237              args[i - 1] = arguments[i];
 238          }
 239      }
 240      queue.push(new Item(fun, args));
 241      if (queue.length === 1 && !draining) {
 242          runTimeout(drainQueue);
 243      }
 244  };
 245  
 246  // v8 likes predictible objects
 247  function Item(fun, array) {
 248      this.fun = fun;
 249      this.array = array;
 250  }
 251  Item.prototype.run = function () {
 252      this.fun.apply(null, this.array);
 253  };
 254  process.title = 'browser';
 255  process.browser = true;
 256  process.env = {};
 257  process.argv = [];
 258  process.version = ''; // empty string to avoid regexp issues
 259  process.versions = {};
 260  
 261  function noop() {}
 262  
 263  process.on = noop;
 264  process.addListener = noop;
 265  process.once = noop;
 266  process.off = noop;
 267  process.removeListener = noop;
 268  process.removeAllListeners = noop;
 269  process.emit = noop;
 270  process.prependListener = noop;
 271  process.prependOnceListener = noop;
 272  
 273  process.listeners = function (name) { return [] }
 274  
 275  process.binding = function (name) {
 276      throw new Error('process.binding is not supported');
 277  };
 278  
 279  process.cwd = function () { return '/' };
 280  process.chdir = function (dir) {
 281      throw new Error('process.chdir is not supported');
 282  };
 283  process.umask = function() { return 0; };
 284  
 285  
 286  /***/ }),
 287  
 288  /***/ 112:
 289  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 290  
 291  "use strict";
 292  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useMediaQuery; });
 293  /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
 294  /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
 295  /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
 296  
 297  
 298  /**
 299   * WordPress dependencies
 300   */
 301  
 302  /**
 303   * Runs a media query and returns its value when it changes.
 304   *
 305   * @param {string} [query] Media Query.
 306   * @return {boolean} return value of the media query.
 307   */
 308  
 309  function useMediaQuery(query) {
 310    var _useState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useState"])(false),
 311        _useState2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_useState, 2),
 312        match = _useState2[0],
 313        setMatch = _useState2[1];
 314  
 315    Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () {
 316      if (!query) {
 317        return;
 318      }
 319  
 320      var updateMatch = function updateMatch() {
 321        return setMatch(window.matchMedia(query).matches);
 322      };
 323  
 324      updateMatch();
 325      var list = window.matchMedia(query);
 326      list.addListener(updateMatch);
 327      return function () {
 328        list.removeListener(updateMatch);
 329      };
 330    }, [query]);
 331    return query && match;
 332  }
 333  
 334  
 335  /***/ }),
 336  
 337  /***/ 12:
 338  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 339  
 340  "use strict";
 341  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
 342  function _extends() {
 343    _extends = Object.assign || function (target) {
 344      for (var i = 1; i < arguments.length; i++) {
 345        var source = arguments[i];
 346  
 347        for (var key in source) {
 348          if (Object.prototype.hasOwnProperty.call(source, key)) {
 349            target[key] = source[key];
 350          }
 351        }
 352      }
 353  
 354      return target;
 355    };
 356  
 357    return _extends.apply(this, arguments);
 358  }
 359  
 360  /***/ }),
 361  
 362  /***/ 13:
 363  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 364  
 365  "use strict";
 366  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
 367  function _defineProperties(target, props) {
 368    for (var i = 0; i < props.length; i++) {
 369      var descriptor = props[i];
 370      descriptor.enumerable = descriptor.enumerable || false;
 371      descriptor.configurable = true;
 372      if ("value" in descriptor) descriptor.writable = true;
 373      Object.defineProperty(target, descriptor.key, descriptor);
 374    }
 375  }
 376  
 377  function _createClass(Constructor, protoProps, staticProps) {
 378    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 379    if (staticProps) _defineProperties(Constructor, staticProps);
 380    return Constructor;
 381  }
 382  
 383  /***/ }),
 384  
 385  /***/ 14:
 386  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 387  
 388  "use strict";
 389  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 390  function _classCallCheck(instance, Constructor) {
 391    if (!(instance instanceof Constructor)) {
 392      throw new TypeError("Cannot call a class as a function");
 393    }
 394  }
 395  
 396  /***/ }),
 397  
 398  /***/ 15:
 399  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 400  
 401  "use strict";
 402  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
 403  /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
 404  /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
 405  
 406  
 407  function _possibleConstructorReturn(self, call) {
 408    if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
 409      return call;
 410    }
 411  
 412    return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
 413  }
 414  
 415  /***/ }),
 416  
 417  /***/ 16:
 418  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 419  
 420  "use strict";
 421  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
 422  function _getPrototypeOf(o) {
 423    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
 424      return o.__proto__ || Object.getPrototypeOf(o);
 425    };
 426    return _getPrototypeOf(o);
 427  }
 428  
 429  /***/ }),
 430  
 431  /***/ 17:
 432  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 433  
 434  "use strict";
 435  
 436  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
 437  function _setPrototypeOf(o, p) {
 438    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
 439      o.__proto__ = p;
 440      return o;
 441    };
 442  
 443    return _setPrototypeOf(o, p);
 444  }
 445  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
 446  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
 447  
 448  function _inherits(subClass, superClass) {
 449    if (typeof superClass !== "function" && superClass !== null) {
 450      throw new TypeError("Super expression must either be null or a function");
 451    }
 452  
 453    subClass.prototype = Object.create(superClass && superClass.prototype, {
 454      constructor: {
 455        value: subClass,
 456        writable: true,
 457        configurable: true
 458      }
 459    });
 460    if (superClass) _setPrototypeOf(subClass, superClass);
 461  }
 462  
 463  /***/ }),
 464  
 465  /***/ 2:
 466  /***/ (function(module, exports) {
 467  
 468  (function() { module.exports = this["lodash"]; }());
 469  
 470  /***/ }),
 471  
 472  /***/ 20:
 473  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 474  
 475  "use strict";
 476  
 477  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 478  var arrayWithHoles = __webpack_require__(38);
 479  
 480  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 481  function _iterableToArrayLimit(arr, i) {
 482    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 483    var _arr = [];
 484    var _n = true;
 485    var _d = false;
 486    var _e = undefined;
 487  
 488    try {
 489      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 490        _arr.push(_s.value);
 491  
 492        if (i && _arr.length === i) break;
 493      }
 494    } catch (err) {
 495      _d = true;
 496      _e = err;
 497    } finally {
 498      try {
 499        if (!_n && _i["return"] != null) _i["return"]();
 500      } finally {
 501        if (_d) throw _e;
 502      }
 503    }
 504  
 505    return _arr;
 506  }
 507  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 508  var unsupportedIterableToArray = __webpack_require__(27);
 509  
 510  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 511  var nonIterableRest = __webpack_require__(39);
 512  
 513  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 514  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
 515  
 516  
 517  
 518  
 519  function _slicedToArray(arr, i) {
 520    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 521  }
 522  
 523  /***/ }),
 524  
 525  /***/ 25:
 526  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 527  
 528  "use strict";
 529  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 530  function _arrayLikeToArray(arr, len) {
 531    if (len == null || len > arr.length) len = arr.length;
 532  
 533    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 534      arr2[i] = arr[i];
 535    }
 536  
 537    return arr2;
 538  }
 539  
 540  /***/ }),
 541  
 542  /***/ 252:
 543  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 544  
 545  "use strict";
 546  /* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _use_media_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(112);
 547  /**
 548   * Internal dependencies
 549   */
 550  
 551  /**
 552   * Whether or not the user agent is Internet Explorer.
 553   *
 554   * @type {boolean}
 555   */
 556  
 557  var IS_IE = typeof window !== 'undefined' && window.navigator.userAgent.indexOf('Trident') >= 0;
 558  /**
 559   * Hook returning whether the user has a preference for reduced motion.
 560   *
 561   * @return {boolean} Reduced motion preference value.
 562   */
 563  
 564  var useReducedMotion = process.env.FORCE_REDUCED_MOTION || IS_IE ? function () {
 565    return true;
 566  } : function () {
 567    return Object(_use_media_query__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])('(prefers-reduced-motion: reduce)');
 568  };
 569  /* harmony default export */ __webpack_exports__["a"] = (useReducedMotion);
 570  
 571  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(105)))
 572  
 573  /***/ }),
 574  
 575  /***/ 27:
 576  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 577  
 578  "use strict";
 579  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 580  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
 581  
 582  function _unsupportedIterableToArray(o, minLen) {
 583    if (!o) return;
 584    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 585    var n = Object.prototype.toString.call(o).slice(8, -1);
 586    if (n === "Object" && o.constructor) n = o.constructor.name;
 587    if (n === "Map" || n === "Set") return Array.from(n);
 588    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 589  }
 590  
 591  /***/ }),
 592  
 593  /***/ 271:
 594  /***/ (function(module, exports, __webpack_require__) {
 595  
 596  var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */
 597  /**
 598   * Copyright 2012-2017 Craig Campbell
 599   *
 600   * Licensed under the Apache License, Version 2.0 (the "License");
 601   * you may not use this file except in compliance with the License.
 602   * You may obtain a copy of the License at
 603   *
 604   * http://www.apache.org/licenses/LICENSE-2.0
 605   *
 606   * Unless required by applicable law or agreed to in writing, software
 607   * distributed under the License is distributed on an "AS IS" BASIS,
 608   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 609   * See the License for the specific language governing permissions and
 610   * limitations under the License.
 611   *
 612   * Mousetrap is a simple keyboard shortcut library for Javascript with
 613   * no external dependencies
 614   *
 615   * @version 1.6.5
 616   * @url craig.is/killing/mice
 617   */
 618  (function(window, document, undefined) {
 619  
 620      // Check if mousetrap is used inside browser, if not, return
 621      if (!window) {
 622          return;
 623      }
 624  
 625      /**
 626       * mapping of special keycodes to their corresponding keys
 627       *
 628       * everything in this dictionary cannot use keypress events
 629       * so it has to be here to map to the correct keycodes for
 630       * keyup/keydown events
 631       *
 632       * @type {Object}
 633       */
 634      var _MAP = {
 635          8: 'backspace',
 636          9: 'tab',
 637          13: 'enter',
 638          16: 'shift',
 639          17: 'ctrl',
 640          18: 'alt',
 641          20: 'capslock',
 642          27: 'esc',
 643          32: 'space',
 644          33: 'pageup',
 645          34: 'pagedown',
 646          35: 'end',
 647          36: 'home',
 648          37: 'left',
 649          38: 'up',
 650          39: 'right',
 651          40: 'down',
 652          45: 'ins',
 653          46: 'del',
 654          91: 'meta',
 655          93: 'meta',
 656          224: 'meta'
 657      };
 658  
 659      /**
 660       * mapping for special characters so they can support
 661       *
 662       * this dictionary is only used incase you want to bind a
 663       * keyup or keydown event to one of these keys
 664       *
 665       * @type {Object}
 666       */
 667      var _KEYCODE_MAP = {
 668          106: '*',
 669          107: '+',
 670          109: '-',
 671          110: '.',
 672          111 : '/',
 673          186: ';',
 674          187: '=',
 675          188: ',',
 676          189: '-',
 677          190: '.',
 678          191: '/',
 679          192: '`',
 680          219: '[',
 681          220: '\\',
 682          221: ']',
 683          222: '\''
 684      };
 685  
 686      /**
 687       * this is a mapping of keys that require shift on a US keypad
 688       * back to the non shift equivelents
 689       *
 690       * this is so you can use keyup events with these keys
 691       *
 692       * note that this will only work reliably on US keyboards
 693       *
 694       * @type {Object}
 695       */
 696      var _SHIFT_MAP = {
 697          '~': '`',
 698          '!': '1',
 699          '@': '2',
 700          '#': '3',
 701          '$': '4',
 702          '%': '5',
 703          '^': '6',
 704          '&': '7',
 705          '*': '8',
 706          '(': '9',
 707          ')': '0',
 708          '_': '-',
 709          '+': '=',
 710          ':': ';',
 711          '\"': '\'',
 712          '<': ',',
 713          '>': '.',
 714          '?': '/',
 715          '|': '\\'
 716      };
 717  
 718      /**
 719       * this is a list of special strings you can use to map
 720       * to modifier keys when you specify your keyboard shortcuts
 721       *
 722       * @type {Object}
 723       */
 724      var _SPECIAL_ALIASES = {
 725          'option': 'alt',
 726          'command': 'meta',
 727          'return': 'enter',
 728          'escape': 'esc',
 729          'plus': '+',
 730          'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
 731      };
 732  
 733      /**
 734       * variable to store the flipped version of _MAP from above
 735       * needed to check if we should use keypress or not when no action
 736       * is specified
 737       *
 738       * @type {Object|undefined}
 739       */
 740      var _REVERSE_MAP;
 741  
 742      /**
 743       * loop through the f keys, f1 to f19 and add them to the map
 744       * programatically
 745       */
 746      for (var i = 1; i < 20; ++i) {
 747          _MAP[111 + i] = 'f' + i;
 748      }
 749  
 750      /**
 751       * loop through to map numbers on the numeric keypad
 752       */
 753      for (i = 0; i <= 9; ++i) {
 754  
 755          // This needs to use a string cause otherwise since 0 is falsey
 756          // mousetrap will never fire for numpad 0 pressed as part of a keydown
 757          // event.
 758          //
 759          // @see https://github.com/ccampbell/mousetrap/pull/258
 760          _MAP[i + 96] = i.toString();
 761      }
 762  
 763      /**
 764       * cross browser add event method
 765       *
 766       * @param {Element|HTMLDocument} object
 767       * @param {string} type
 768       * @param {Function} callback
 769       * @returns void
 770       */
 771      function _addEvent(object, type, callback) {
 772          if (object.addEventListener) {
 773              object.addEventListener(type, callback, false);
 774              return;
 775          }
 776  
 777          object.attachEvent('on' + type, callback);
 778      }
 779  
 780      /**
 781       * takes the event and returns the key character
 782       *
 783       * @param {Event} e
 784       * @return {string}
 785       */
 786      function _characterFromEvent(e) {
 787  
 788          // for keypress events we should return the character as is
 789          if (e.type == 'keypress') {
 790              var character = String.fromCharCode(e.which);
 791  
 792              // if the shift key is not pressed then it is safe to assume
 793              // that we want the character to be lowercase.  this means if
 794              // you accidentally have caps lock on then your key bindings
 795              // will continue to work
 796              //
 797              // the only side effect that might not be desired is if you
 798              // bind something like 'A' cause you want to trigger an
 799              // event when capital A is pressed caps lock will no longer
 800              // trigger the event.  shift+a will though.
 801              if (!e.shiftKey) {
 802                  character = character.toLowerCase();
 803              }
 804  
 805              return character;
 806          }
 807  
 808          // for non keypress events the special maps are needed
 809          if (_MAP[e.which]) {
 810              return _MAP[e.which];
 811          }
 812  
 813          if (_KEYCODE_MAP[e.which]) {
 814              return _KEYCODE_MAP[e.which];
 815          }
 816  
 817          // if it is not in the special map
 818  
 819          // with keydown and keyup events the character seems to always
 820          // come in as an uppercase character whether you are pressing shift
 821          // or not.  we should make sure it is always lowercase for comparisons
 822          return String.fromCharCode(e.which).toLowerCase();
 823      }
 824  
 825      /**
 826       * checks if two arrays are equal
 827       *
 828       * @param {Array} modifiers1
 829       * @param {Array} modifiers2
 830       * @returns {boolean}
 831       */
 832      function _modifiersMatch(modifiers1, modifiers2) {
 833          return modifiers1.sort().join(',') === modifiers2.sort().join(',');
 834      }
 835  
 836      /**
 837       * takes a key event and figures out what the modifiers are
 838       *
 839       * @param {Event} e
 840       * @returns {Array}
 841       */
 842      function _eventModifiers(e) {
 843          var modifiers = [];
 844  
 845          if (e.shiftKey) {
 846              modifiers.push('shift');
 847          }
 848  
 849          if (e.altKey) {
 850              modifiers.push('alt');
 851          }
 852  
 853          if (e.ctrlKey) {
 854              modifiers.push('ctrl');
 855          }
 856  
 857          if (e.metaKey) {
 858              modifiers.push('meta');
 859          }
 860  
 861          return modifiers;
 862      }
 863  
 864      /**
 865       * prevents default for this event
 866       *
 867       * @param {Event} e
 868       * @returns void
 869       */
 870      function _preventDefault(e) {
 871          if (e.preventDefault) {
 872              e.preventDefault();
 873              return;
 874          }
 875  
 876          e.returnValue = false;
 877      }
 878  
 879      /**
 880       * stops propogation for this event
 881       *
 882       * @param {Event} e
 883       * @returns void
 884       */
 885      function _stopPropagation(e) {
 886          if (e.stopPropagation) {
 887              e.stopPropagation();
 888              return;
 889          }
 890  
 891          e.cancelBubble = true;
 892      }
 893  
 894      /**
 895       * determines if the keycode specified is a modifier key or not
 896       *
 897       * @param {string} key
 898       * @returns {boolean}
 899       */
 900      function _isModifier(key) {
 901          return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
 902      }
 903  
 904      /**
 905       * reverses the map lookup so that we can look for specific keys
 906       * to see what can and can't use keypress
 907       *
 908       * @return {Object}
 909       */
 910      function _getReverseMap() {
 911          if (!_REVERSE_MAP) {
 912              _REVERSE_MAP = {};
 913              for (var key in _MAP) {
 914  
 915                  // pull out the numeric keypad from here cause keypress should
 916                  // be able to detect the keys from the character
 917                  if (key > 95 && key < 112) {
 918                      continue;
 919                  }
 920  
 921                  if (_MAP.hasOwnProperty(key)) {
 922                      _REVERSE_MAP[_MAP[key]] = key;
 923                  }
 924              }
 925          }
 926          return _REVERSE_MAP;
 927      }
 928  
 929      /**
 930       * picks the best action based on the key combination
 931       *
 932       * @param {string} key - character for key
 933       * @param {Array} modifiers
 934       * @param {string=} action passed in
 935       */
 936      function _pickBestAction(key, modifiers, action) {
 937  
 938          // if no action was picked in we should try to pick the one
 939          // that we think would work best for this key
 940          if (!action) {
 941              action = _getReverseMap()[key] ? 'keydown' : 'keypress';
 942          }
 943  
 944          // modifier keys don't work as expected with keypress,
 945          // switch to keydown
 946          if (action == 'keypress' && modifiers.length) {
 947              action = 'keydown';
 948          }
 949  
 950          return action;
 951      }
 952  
 953      /**
 954       * Converts from a string key combination to an array
 955       *
 956       * @param  {string} combination like "command+shift+l"
 957       * @return {Array}
 958       */
 959      function _keysFromString(combination) {
 960          if (combination === '+') {
 961              return ['+'];
 962          }
 963  
 964          combination = combination.replace(/\+{2}/g, '+plus');
 965          return combination.split('+');
 966      }
 967  
 968      /**
 969       * Gets info for a specific key combination
 970       *
 971       * @param  {string} combination key combination ("command+s" or "a" or "*")
 972       * @param  {string=} action
 973       * @returns {Object}
 974       */
 975      function _getKeyInfo(combination, action) {
 976          var keys;
 977          var key;
 978          var i;
 979          var modifiers = [];
 980  
 981          // take the keys from this pattern and figure out what the actual
 982          // pattern is all about
 983          keys = _keysFromString(combination);
 984  
 985          for (i = 0; i < keys.length; ++i) {
 986              key = keys[i];
 987  
 988              // normalize key names
 989              if (_SPECIAL_ALIASES[key]) {
 990                  key = _SPECIAL_ALIASES[key];
 991              }
 992  
 993              // if this is not a keypress event then we should
 994              // be smart about using shift keys
 995              // this will only work for US keyboards however
 996              if (action && action != 'keypress' && _SHIFT_MAP[key]) {
 997                  key = _SHIFT_MAP[key];
 998                  modifiers.push('shift');
 999              }
1000  
1001              // if this key is a modifier then add it to the list of modifiers
1002              if (_isModifier(key)) {
1003                  modifiers.push(key);
1004              }
1005          }
1006  
1007          // depending on what the key combination is
1008          // we will try to pick the best event for it
1009          action = _pickBestAction(key, modifiers, action);
1010  
1011          return {
1012              key: key,
1013              modifiers: modifiers,
1014              action: action
1015          };
1016      }
1017  
1018      function _belongsTo(element, ancestor) {
1019          if (element === null || element === document) {
1020              return false;
1021          }
1022  
1023          if (element === ancestor) {
1024              return true;
1025          }
1026  
1027          return _belongsTo(element.parentNode, ancestor);
1028      }
1029  
1030      function Mousetrap(targetElement) {
1031          var self = this;
1032  
1033          targetElement = targetElement || document;
1034  
1035          if (!(self instanceof Mousetrap)) {
1036              return new Mousetrap(targetElement);
1037          }
1038  
1039          /**
1040           * element to attach key events to
1041           *
1042           * @type {Element}
1043           */
1044          self.target = targetElement;
1045  
1046          /**
1047           * a list of all the callbacks setup via Mousetrap.bind()
1048           *
1049           * @type {Object}
1050           */
1051          self._callbacks = {};
1052  
1053          /**
1054           * direct map of string combinations to callbacks used for trigger()
1055           *
1056           * @type {Object}
1057           */
1058          self._directMap = {};
1059  
1060          /**
1061           * keeps track of what level each sequence is at since multiple
1062           * sequences can start out with the same sequence
1063           *
1064           * @type {Object}
1065           */
1066          var _sequenceLevels = {};
1067  
1068          /**
1069           * variable to store the setTimeout call
1070           *
1071           * @type {null|number}
1072           */
1073          var _resetTimer;
1074  
1075          /**
1076           * temporary state where we will ignore the next keyup
1077           *
1078           * @type {boolean|string}
1079           */
1080          var _ignoreNextKeyup = false;
1081  
1082          /**
1083           * temporary state where we will ignore the next keypress
1084           *
1085           * @type {boolean}
1086           */
1087          var _ignoreNextKeypress = false;
1088  
1089          /**
1090           * are we currently inside of a sequence?
1091           * type of action ("keyup" or "keydown" or "keypress") or false
1092           *
1093           * @type {boolean|string}
1094           */
1095          var _nextExpectedAction = false;
1096  
1097          /**
1098           * resets all sequence counters except for the ones passed in
1099           *
1100           * @param {Object} doNotReset
1101           * @returns void
1102           */
1103          function _resetSequences(doNotReset) {
1104              doNotReset = doNotReset || {};
1105  
1106              var activeSequences = false,
1107                  key;
1108  
1109              for (key in _sequenceLevels) {
1110                  if (doNotReset[key]) {
1111                      activeSequences = true;
1112                      continue;
1113                  }
1114                  _sequenceLevels[key] = 0;
1115              }
1116  
1117              if (!activeSequences) {
1118                  _nextExpectedAction = false;
1119              }
1120          }
1121  
1122          /**
1123           * finds all callbacks that match based on the keycode, modifiers,
1124           * and action
1125           *
1126           * @param {string} character
1127           * @param {Array} modifiers
1128           * @param {Event|Object} e
1129           * @param {string=} sequenceName - name of the sequence we are looking for
1130           * @param {string=} combination
1131           * @param {number=} level
1132           * @returns {Array}
1133           */
1134          function _getMatches(character, modifiers, e, sequenceName, combination, level) {
1135              var i;
1136              var callback;
1137              var matches = [];
1138              var action = e.type;
1139  
1140              // if there are no events related to this keycode
1141              if (!self._callbacks[character]) {
1142                  return [];
1143              }
1144  
1145              // if a modifier key is coming up on its own we should allow it
1146              if (action == 'keyup' && _isModifier(character)) {
1147                  modifiers = [character];
1148              }
1149  
1150              // loop through all callbacks for the key that was pressed
1151              // and see if any of them match
1152              for (i = 0; i < self._callbacks[character].length; ++i) {
1153                  callback = self._callbacks[character][i];
1154  
1155                  // if a sequence name is not specified, but this is a sequence at
1156                  // the wrong level then move onto the next match
1157                  if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
1158                      continue;
1159                  }
1160  
1161                  // if the action we are looking for doesn't match the action we got
1162                  // then we should keep going
1163                  if (action != callback.action) {
1164                      continue;
1165                  }
1166  
1167                  // if this is a keypress event and the meta key and control key
1168                  // are not pressed that means that we need to only look at the
1169                  // character, otherwise check the modifiers as well
1170                  //
1171                  // chrome will not fire a keypress if meta or control is down
1172                  // safari will fire a keypress if meta or meta+shift is down
1173                  // firefox will fire a keypress if meta or control is down
1174                  if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
1175  
1176                      // when you bind a combination or sequence a second time it
1177                      // should overwrite the first one.  if a sequenceName or
1178                      // combination is specified in this call it does just that
1179                      //
1180                      // @todo make deleting its own method?
1181                      var deleteCombo = !sequenceName && callback.combo == combination;
1182                      var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
1183                      if (deleteCombo || deleteSequence) {
1184                          self._callbacks[character].splice(i, 1);
1185                      }
1186  
1187                      matches.push(callback);
1188                  }
1189              }
1190  
1191              return matches;
1192          }
1193  
1194          /**
1195           * actually calls the callback function
1196           *
1197           * if your callback function returns false this will use the jquery
1198           * convention - prevent default and stop propogation on the event
1199           *
1200           * @param {Function} callback
1201           * @param {Event} e
1202           * @returns void
1203           */
1204          function _fireCallback(callback, e, combo, sequence) {
1205  
1206              // if this event should not happen stop here
1207              if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
1208                  return;
1209              }
1210  
1211              if (callback(e, combo) === false) {
1212                  _preventDefault(e);
1213                  _stopPropagation(e);
1214              }
1215          }
1216  
1217          /**
1218           * handles a character key event
1219           *
1220           * @param {string} character
1221           * @param {Array} modifiers
1222           * @param {Event} e
1223           * @returns void
1224           */
1225          self._handleKey = function(character, modifiers, e) {
1226              var callbacks = _getMatches(character, modifiers, e);
1227              var i;
1228              var doNotReset = {};
1229              var maxLevel = 0;
1230              var processedSequenceCallback = false;
1231  
1232              // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
1233              for (i = 0; i < callbacks.length; ++i) {
1234                  if (callbacks[i].seq) {
1235                      maxLevel = Math.max(maxLevel, callbacks[i].level);
1236                  }
1237              }
1238  
1239              // loop through matching callbacks for this key event
1240              for (i = 0; i < callbacks.length; ++i) {
1241  
1242                  // fire for all sequence callbacks
1243                  // this is because if for example you have multiple sequences
1244                  // bound such as "g i" and "g t" they both need to fire the
1245                  // callback for matching g cause otherwise you can only ever
1246                  // match the first one
1247                  if (callbacks[i].seq) {
1248  
1249                      // only fire callbacks for the maxLevel to prevent
1250                      // subsequences from also firing
1251                      //
1252                      // for example 'a option b' should not cause 'option b' to fire
1253                      // even though 'option b' is part of the other sequence
1254                      //
1255                      // any sequences that do not match here will be discarded
1256                      // below by the _resetSequences call
1257                      if (callbacks[i].level != maxLevel) {
1258                          continue;
1259                      }
1260  
1261                      processedSequenceCallback = true;
1262  
1263                      // keep a list of which sequences were matches for later
1264                      doNotReset[callbacks[i].seq] = 1;
1265                      _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
1266                      continue;
1267                  }
1268  
1269                  // if there were no sequence matches but we are still here
1270                  // that means this is a regular match so we should fire that
1271                  if (!processedSequenceCallback) {
1272                      _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
1273                  }
1274              }
1275  
1276              // if the key you pressed matches the type of sequence without
1277              // being a modifier (ie "keyup" or "keypress") then we should
1278              // reset all sequences that were not matched by this event
1279              //
1280              // this is so, for example, if you have the sequence "h a t" and you
1281              // type "h e a r t" it does not match.  in this case the "e" will
1282              // cause the sequence to reset
1283              //
1284              // modifier keys are ignored because you can have a sequence
1285              // that contains modifiers such as "enter ctrl+space" and in most
1286              // cases the modifier key will be pressed before the next key
1287              //
1288              // also if you have a sequence such as "ctrl+b a" then pressing the
1289              // "b" key will trigger a "keypress" and a "keydown"
1290              //
1291              // the "keydown" is expected when there is a modifier, but the
1292              // "keypress" ends up matching the _nextExpectedAction since it occurs
1293              // after and that causes the sequence to reset
1294              //
1295              // we ignore keypresses in a sequence that directly follow a keydown
1296              // for the same character
1297              var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
1298              if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
1299                  _resetSequences(doNotReset);
1300              }
1301  
1302              _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
1303          };
1304  
1305          /**
1306           * handles a keydown event
1307           *
1308           * @param {Event} e
1309           * @returns void
1310           */
1311          function _handleKeyEvent(e) {
1312  
1313              // normalize e.which for key events
1314              // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
1315              if (typeof e.which !== 'number') {
1316                  e.which = e.keyCode;
1317              }
1318  
1319              var character = _characterFromEvent(e);
1320  
1321              // no character found then stop
1322              if (!character) {
1323                  return;
1324              }
1325  
1326              // need to use === for the character check because the character can be 0
1327              if (e.type == 'keyup' && _ignoreNextKeyup === character) {
1328                  _ignoreNextKeyup = false;
1329                  return;
1330              }
1331  
1332              self.handleKey(character, _eventModifiers(e), e);
1333          }
1334  
1335          /**
1336           * called to set a 1 second timeout on the specified sequence
1337           *
1338           * this is so after each key press in the sequence you have 1 second
1339           * to press the next key before you have to start over
1340           *
1341           * @returns void
1342           */
1343          function _resetSequenceTimer() {
1344              clearTimeout(_resetTimer);
1345              _resetTimer = setTimeout(_resetSequences, 1000);
1346          }
1347  
1348          /**
1349           * binds a key sequence to an event
1350           *
1351           * @param {string} combo - combo specified in bind call
1352           * @param {Array} keys
1353           * @param {Function} callback
1354           * @param {string=} action
1355           * @returns void
1356           */
1357          function _bindSequence(combo, keys, callback, action) {
1358  
1359              // start off by adding a sequence level record for this combination
1360              // and setting the level to 0
1361              _sequenceLevels[combo] = 0;
1362  
1363              /**
1364               * callback to increase the sequence level for this sequence and reset
1365               * all other sequences that were active
1366               *
1367               * @param {string} nextAction
1368               * @returns {Function}
1369               */
1370              function _increaseSequence(nextAction) {
1371                  return function() {
1372                      _nextExpectedAction = nextAction;
1373                      ++_sequenceLevels[combo];
1374                      _resetSequenceTimer();
1375                  };
1376              }
1377  
1378              /**
1379               * wraps the specified callback inside of another function in order
1380               * to reset all sequence counters as soon as this sequence is done
1381               *
1382               * @param {Event} e
1383               * @returns void
1384               */
1385              function _callbackAndReset(e) {
1386                  _fireCallback(callback, e, combo);
1387  
1388                  // we should ignore the next key up if the action is key down
1389                  // or keypress.  this is so if you finish a sequence and
1390                  // release the key the final key will not trigger a keyup
1391                  if (action !== 'keyup') {
1392                      _ignoreNextKeyup = _characterFromEvent(e);
1393                  }
1394  
1395                  // weird race condition if a sequence ends with the key
1396                  // another sequence begins with
1397                  setTimeout(_resetSequences, 10);
1398              }
1399  
1400              // loop through keys one at a time and bind the appropriate callback
1401              // function.  for any key leading up to the final one it should
1402              // increase the sequence. after the final, it should reset all sequences
1403              //
1404              // if an action is specified in the original bind call then that will
1405              // be used throughout.  otherwise we will pass the action that the
1406              // next key in the sequence should match.  this allows a sequence
1407              // to mix and match keypress and keydown events depending on which
1408              // ones are better suited to the key provided
1409              for (var i = 0; i < keys.length; ++i) {
1410                  var isFinal = i + 1 === keys.length;
1411                  var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
1412                  _bindSingle(keys[i], wrappedCallback, action, combo, i);
1413              }
1414          }
1415  
1416          /**
1417           * binds a single keyboard combination
1418           *
1419           * @param {string} combination
1420           * @param {Function} callback
1421           * @param {string=} action
1422           * @param {string=} sequenceName - name of sequence if part of sequence
1423           * @param {number=} level - what part of the sequence the command is
1424           * @returns void
1425           */
1426          function _bindSingle(combination, callback, action, sequenceName, level) {
1427  
1428              // store a direct mapped reference for use with Mousetrap.trigger
1429              self._directMap[combination + ':' + action] = callback;
1430  
1431              // make sure multiple spaces in a row become a single space
1432              combination = combination.replace(/\s+/g, ' ');
1433  
1434              var sequence = combination.split(' ');
1435              var info;
1436  
1437              // if this pattern is a sequence of keys then run through this method
1438              // to reprocess each pattern one key at a time
1439              if (sequence.length > 1) {
1440                  _bindSequence(combination, sequence, callback, action);
1441                  return;
1442              }
1443  
1444              info = _getKeyInfo(combination, action);
1445  
1446              // make sure to initialize array if this is the first time
1447              // a callback is added for this key
1448              self._callbacks[info.key] = self._callbacks[info.key] || [];
1449  
1450              // remove an existing match if there is one
1451              _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
1452  
1453              // add this call back to the array
1454              // if it is a sequence put it at the beginning
1455              // if not put it at the end
1456              //
1457              // this is important because the way these are processed expects
1458              // the sequence ones to come first
1459              self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
1460                  callback: callback,
1461                  modifiers: info.modifiers,
1462                  action: info.action,
1463                  seq: sequenceName,
1464                  level: level,
1465                  combo: combination
1466              });
1467          }
1468  
1469          /**
1470           * binds multiple combinations to the same callback
1471           *
1472           * @param {Array} combinations
1473           * @param {Function} callback
1474           * @param {string|undefined} action
1475           * @returns void
1476           */
1477          self._bindMultiple = function(combinations, callback, action) {
1478              for (var i = 0; i < combinations.length; ++i) {
1479                  _bindSingle(combinations[i], callback, action);
1480              }
1481          };
1482  
1483          // start!
1484          _addEvent(targetElement, 'keypress', _handleKeyEvent);
1485          _addEvent(targetElement, 'keydown', _handleKeyEvent);
1486          _addEvent(targetElement, 'keyup', _handleKeyEvent);
1487      }
1488  
1489      /**
1490       * binds an event to mousetrap
1491       *
1492       * can be a single key, a combination of keys separated with +,
1493       * an array of keys, or a sequence of keys separated by spaces
1494       *
1495       * be sure to list the modifier keys first to make sure that the
1496       * correct key ends up getting bound (the last key in the pattern)
1497       *
1498       * @param {string|Array} keys
1499       * @param {Function} callback
1500       * @param {string=} action - 'keypress', 'keydown', or 'keyup'
1501       * @returns void
1502       */
1503      Mousetrap.prototype.bind = function(keys, callback, action) {
1504          var self = this;
1505          keys = keys instanceof Array ? keys : [keys];
1506          self._bindMultiple.call(self, keys, callback, action);
1507          return self;
1508      };
1509  
1510      /**
1511       * unbinds an event to mousetrap
1512       *
1513       * the unbinding sets the callback function of the specified key combo
1514       * to an empty function and deletes the corresponding key in the
1515       * _directMap dict.
1516       *
1517       * TODO: actually remove this from the _callbacks dictionary instead
1518       * of binding an empty function
1519       *
1520       * the keycombo+action has to be exactly the same as
1521       * it was defined in the bind method
1522       *
1523       * @param {string|Array} keys
1524       * @param {string} action
1525       * @returns void
1526       */
1527      Mousetrap.prototype.unbind = function(keys, action) {
1528          var self = this;
1529          return self.bind.call(self, keys, function() {}, action);
1530      };
1531  
1532      /**
1533       * triggers an event that has already been bound
1534       *
1535       * @param {string} keys
1536       * @param {string=} action
1537       * @returns void
1538       */
1539      Mousetrap.prototype.trigger = function(keys, action) {
1540          var self = this;
1541          if (self._directMap[keys + ':' + action]) {
1542              self._directMap[keys + ':' + action]({}, keys);
1543          }
1544          return self;
1545      };
1546  
1547      /**
1548       * resets the library back to its initial state.  this is useful
1549       * if you want to clear out the current keyboard shortcuts and bind
1550       * new ones - for example if you switch to another page
1551       *
1552       * @returns void
1553       */
1554      Mousetrap.prototype.reset = function() {
1555          var self = this;
1556          self._callbacks = {};
1557          self._directMap = {};
1558          return self;
1559      };
1560  
1561      /**
1562       * should we stop this event before firing off callbacks
1563       *
1564       * @param {Event} e
1565       * @param {Element} element
1566       * @return {boolean}
1567       */
1568      Mousetrap.prototype.stopCallback = function(e, element) {
1569          var self = this;
1570  
1571          // if the element has the class "mousetrap" then no need to stop
1572          if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
1573              return false;
1574          }
1575  
1576          if (_belongsTo(element, self.target)) {
1577              return false;
1578          }
1579  
1580          // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,
1581          // not the initial event target in the shadow tree. Note that not all events cross the
1582          // shadow boundary.
1583          // For shadow trees with `mode: 'open'`, the initial event target is the first element in
1584          // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event
1585          // target cannot be obtained.
1586          if ('composedPath' in e && typeof e.composedPath === 'function') {
1587              // For open shadow trees, update `element` so that the following check works.
1588              var initialEventTarget = e.composedPath()[0];
1589              if (initialEventTarget !== e.target) {
1590                  element = initialEventTarget;
1591              }
1592          }
1593  
1594          // stop for input, select, and textarea
1595          return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
1596      };
1597  
1598      /**
1599       * exposes _handleKey publicly so it can be overwritten by extensions
1600       */
1601      Mousetrap.prototype.handleKey = function() {
1602          var self = this;
1603          return self._handleKey.apply(self, arguments);
1604      };
1605  
1606      /**
1607       * allow custom key mappings
1608       */
1609      Mousetrap.addKeycodes = function(object) {
1610          for (var key in object) {
1611              if (object.hasOwnProperty(key)) {
1612                  _MAP[key] = object[key];
1613              }
1614          }
1615          _REVERSE_MAP = null;
1616      };
1617  
1618      /**
1619       * Init the global mousetrap functions
1620       *
1621       * This method is needed to allow the global mousetrap functions to work
1622       * now that mousetrap is a constructor function.
1623       */
1624      Mousetrap.init = function() {
1625          var documentMousetrap = Mousetrap(document);
1626          for (var method in documentMousetrap) {
1627              if (method.charAt(0) !== '_') {
1628                  Mousetrap[method] = (function(method) {
1629                      return function() {
1630                          return documentMousetrap[method].apply(documentMousetrap, arguments);
1631                      };
1632                  } (method));
1633              }
1634          }
1635      };
1636  
1637      Mousetrap.init();
1638  
1639      // expose mousetrap to the global object
1640      window.Mousetrap = Mousetrap;
1641  
1642      // expose as a common js module
1643      if ( true && module.exports) {
1644          module.exports = Mousetrap;
1645      }
1646  
1647      // expose mousetrap as an AMD module
1648      if (true) {
1649          !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
1650              return Mousetrap;
1651          }).call(exports, __webpack_require__, exports, module),
1652                  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1653      }
1654  }) (typeof window !== 'undefined' ? window : null, typeof  window !== 'undefined' ? document : null);
1655  
1656  
1657  /***/ }),
1658  
1659  /***/ 34:
1660  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1661  
1662  "use strict";
1663  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
1664  function _typeof(obj) {
1665    "@babel/helpers - typeof";
1666  
1667    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1668      _typeof = function _typeof(obj) {
1669        return typeof obj;
1670      };
1671    } else {
1672      _typeof = function _typeof(obj) {
1673        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1674      };
1675    }
1676  
1677    return _typeof(obj);
1678  }
1679  
1680  /***/ }),
1681  
1682  /***/ 38:
1683  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1684  
1685  "use strict";
1686  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
1687  function _arrayWithHoles(arr) {
1688    if (Array.isArray(arr)) return arr;
1689  }
1690  
1691  /***/ }),
1692  
1693  /***/ 39:
1694  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1695  
1696  "use strict";
1697  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
1698  function _nonIterableRest() {
1699    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1700  }
1701  
1702  /***/ }),
1703  
1704  /***/ 396:
1705  /***/ (function(module, exports) {
1706  
1707  /**
1708   * adds a bindGlobal method to Mousetrap that allows you to
1709   * bind specific keyboard shortcuts that will still work
1710   * inside a text input field
1711   *
1712   * usage:
1713   * Mousetrap.bindGlobal('ctrl+s', _saveChanges);
1714   */
1715  /* global Mousetrap:true */
1716  (function(Mousetrap) {
1717      if (! Mousetrap) {
1718          return;
1719      }
1720      var _globalCallbacks = {};
1721      var _originalStopCallback = Mousetrap.prototype.stopCallback;
1722  
1723      Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) {
1724          var self = this;
1725  
1726          if (self.paused) {
1727              return true;
1728          }
1729  
1730          if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
1731              return false;
1732          }
1733  
1734          return _originalStopCallback.call(self, e, element, combo);
1735      };
1736  
1737      Mousetrap.prototype.bindGlobal = function(keys, callback, action) {
1738          var self = this;
1739          self.bind(keys, callback, action);
1740  
1741          if (keys instanceof Array) {
1742              for (var i = 0; i < keys.length; i++) {
1743                  _globalCallbacks[keys[i]] = true;
1744              }
1745              return;
1746          }
1747  
1748          _globalCallbacks[keys] = true;
1749      };
1750  
1751      Mousetrap.init();
1752  }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined);
1753  
1754  
1755  /***/ }),
1756  
1757  /***/ 431:
1758  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1759  
1760  "use strict";
1761  __webpack_require__.r(__webpack_exports__);
1762  
1763  // EXTERNAL MODULE: external {"this":"lodash"}
1764  var external_this_lodash_ = __webpack_require__(2);
1765  
1766  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js
1767  /**
1768   * External dependencies
1769   */
1770  
1771  /**
1772   * Given a function mapping a component to an enhanced component and modifier
1773   * name, returns the enhanced component augmented with a generated displayName.
1774   *
1775   * @param {Function} mapComponentToEnhancedComponent Function mapping component
1776   *                                                   to enhanced component.
1777   * @param {string}   modifierName                    Seed name from which to
1778   *                                                   generated display name.
1779   *
1780   * @return {WPComponent} Component class with generated display name assigned.
1781   */
1782  
1783  function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) {
1784    return function (OriginalComponent) {
1785      var EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent);
1786      var _OriginalComponent$di = OriginalComponent.displayName,
1787          displayName = _OriginalComponent$di === void 0 ? OriginalComponent.name || 'Component' : _OriginalComponent$di;
1788      EnhancedComponent.displayName = "".concat(Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(modifierName)), "(").concat(displayName, ")");
1789      return EnhancedComponent;
1790    };
1791  }
1792  
1793  /* harmony default export */ var create_higher_order_component = (createHigherOrderComponent);
1794  
1795  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/compose.js
1796  /**
1797   * External dependencies
1798   */
1799  
1800  /**
1801   * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function
1802   * composition, where each successive invocation is supplied the return value of the previous.
1803   *
1804   * @param {...Function} hocs The HOC functions to invoke.
1805   *
1806   * @return {Function} Returns the new composite function.
1807   */
1808  
1809  /* harmony default export */ var compose = (external_this_lodash_["flowRight"]);
1810  
1811  // EXTERNAL MODULE: external {"this":["wp","element"]}
1812  var external_this_wp_element_ = __webpack_require__(0);
1813  
1814  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js
1815  
1816  
1817  /**
1818   * Internal dependencies
1819   */
1820  
1821  /**
1822   * Higher-order component creator, creating a new component which renders if
1823   * the given condition is satisfied or with the given optional prop name.
1824   *
1825   * @param {Function} predicate Function to test condition.
1826   *
1827   * @return {Function} Higher-order component.
1828   */
1829  
1830  var if_condition_ifCondition = function ifCondition(predicate) {
1831    return create_higher_order_component(function (WrappedComponent) {
1832      return function (props) {
1833        if (!predicate(props)) {
1834          return null;
1835        }
1836  
1837        return Object(external_this_wp_element_["createElement"])(WrappedComponent, props);
1838      };
1839    }, 'ifCondition');
1840  };
1841  
1842  /* harmony default export */ var if_condition = (if_condition_ifCondition);
1843  
1844  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
1845  var classCallCheck = __webpack_require__(14);
1846  
1847  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
1848  var createClass = __webpack_require__(13);
1849  
1850  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
1851  var possibleConstructorReturn = __webpack_require__(15);
1852  
1853  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
1854  var getPrototypeOf = __webpack_require__(16);
1855  
1856  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
1857  var inherits = __webpack_require__(17);
1858  
1859  // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
1860  var external_this_wp_isShallowEqual_ = __webpack_require__(51);
1861  var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
1862  
1863  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  /**
1872   * WordPress dependencies
1873   */
1874  
1875  
1876  /**
1877   * Internal dependencies
1878   */
1879  
1880  
1881  /**
1882   * Given a component returns the enhanced component augmented with a component
1883   * only rerendering when its props/state change
1884   *
1885   * @param {Function} mapComponentToEnhancedComponent Function mapping component
1886   *                                                   to enhanced component.
1887   * @param {string}   modifierName                    Seed name from which to
1888   *                                                   generated display name.
1889   *
1890   * @return {WPComponent} Component class with generated display name assigned.
1891   */
1892  
1893  var pure = create_higher_order_component(function (Wrapped) {
1894    if (Wrapped.prototype instanceof external_this_wp_element_["Component"]) {
1895      return (
1896        /*#__PURE__*/
1897        function (_Wrapped) {
1898          Object(inherits["a" /* default */])(_class, _Wrapped);
1899  
1900          function _class() {
1901            Object(classCallCheck["a" /* default */])(this, _class);
1902  
1903            return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(_class).apply(this, arguments));
1904          }
1905  
1906          Object(createClass["a" /* default */])(_class, [{
1907            key: "shouldComponentUpdate",
1908            value: function shouldComponentUpdate(nextProps, nextState) {
1909              return !external_this_wp_isShallowEqual_default()(nextProps, this.props) || !external_this_wp_isShallowEqual_default()(nextState, this.state);
1910            }
1911          }]);
1912  
1913          return _class;
1914        }(Wrapped)
1915      );
1916    }
1917  
1918    return (
1919      /*#__PURE__*/
1920      function (_Component) {
1921        Object(inherits["a" /* default */])(_class2, _Component);
1922  
1923        function _class2() {
1924          Object(classCallCheck["a" /* default */])(this, _class2);
1925  
1926          return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(_class2).apply(this, arguments));
1927        }
1928  
1929        Object(createClass["a" /* default */])(_class2, [{
1930          key: "shouldComponentUpdate",
1931          value: function shouldComponentUpdate(nextProps) {
1932            return !external_this_wp_isShallowEqual_default()(nextProps, this.props);
1933          }
1934        }, {
1935          key: "render",
1936          value: function render() {
1937            return Object(external_this_wp_element_["createElement"])(Wrapped, this.props);
1938          }
1939        }]);
1940  
1941        return _class2;
1942      }(external_this_wp_element_["Component"])
1943    );
1944  }, 'pure');
1945  /* harmony default export */ var higher_order_pure = (pure);
1946  
1947  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
1948  var esm_extends = __webpack_require__(12);
1949  
1950  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
1951  var assertThisInitialized = __webpack_require__(7);
1952  
1953  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js
1954  
1955  
1956  
1957  /**
1958   * External dependencies
1959   */
1960  
1961  /**
1962   * Class responsible for orchestrating event handling on the global window,
1963   * binding a single event to be shared across all handling instances, and
1964   * removing the handler when no instances are listening for the event.
1965   */
1966  
1967  var listener_Listener =
1968  /*#__PURE__*/
1969  function () {
1970    function Listener() {
1971      Object(classCallCheck["a" /* default */])(this, Listener);
1972  
1973      this.listeners = {};
1974      this.handleEvent = this.handleEvent.bind(this);
1975    }
1976  
1977    Object(createClass["a" /* default */])(Listener, [{
1978      key: "add",
1979      value: function add(eventType, instance) {
1980        if (!this.listeners[eventType]) {
1981          // Adding first listener for this type, so bind event.
1982          window.addEventListener(eventType, this.handleEvent);
1983          this.listeners[eventType] = [];
1984        }
1985  
1986        this.listeners[eventType].push(instance);
1987      }
1988    }, {
1989      key: "remove",
1990      value: function remove(eventType, instance) {
1991        this.listeners[eventType] = Object(external_this_lodash_["without"])(this.listeners[eventType], instance);
1992  
1993        if (!this.listeners[eventType].length) {
1994          // Removing last listener for this type, so unbind event.
1995          window.removeEventListener(eventType, this.handleEvent);
1996          delete this.listeners[eventType];
1997        }
1998      }
1999    }, {
2000      key: "handleEvent",
2001      value: function handleEvent(event) {
2002        Object(external_this_lodash_["forEach"])(this.listeners[event.type], function (instance) {
2003          instance.handleEvent(event);
2004        });
2005      }
2006    }]);
2007  
2008    return Listener;
2009  }();
2010  
2011  /* harmony default export */ var listener = (listener_Listener);
2012  
2013  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js
2014  
2015  
2016  
2017  
2018  
2019  
2020  
2021  
2022  
2023  /**
2024   * External dependencies
2025   */
2026  
2027  /**
2028   * WordPress dependencies
2029   */
2030  
2031  
2032  /**
2033   * Internal dependencies
2034   */
2035  
2036  
2037  
2038  /**
2039   * Listener instance responsible for managing document event handling.
2040   *
2041   * @type {Listener}
2042   */
2043  
2044  var with_global_events_listener = new listener();
2045  /**
2046   * Higher-order component creator which, given an object of DOM event types and
2047   * values corresponding to a callback function name on the component, will
2048   * create or update a window event handler to invoke the callback when an event
2049   * occurs. On behalf of the consuming developer, the higher-order component
2050   * manages unbinding when the component unmounts, and binding at most a single
2051   * event handler for the entire application.
2052   *
2053   * @param {Object<string,string>} eventTypesToHandlers Object with keys of DOM
2054   *                                                     event type, the value a
2055   *                                                     name of the function on
2056   *                                                     the original component's
2057   *                                                     instance which handles
2058   *                                                     the event.
2059   *
2060   * @return {Function} Higher-order component.
2061   */
2062  
2063  function withGlobalEvents(eventTypesToHandlers) {
2064    return create_higher_order_component(function (WrappedComponent) {
2065      var Wrapper =
2066      /*#__PURE__*/
2067      function (_Component) {
2068        Object(inherits["a" /* default */])(Wrapper, _Component);
2069  
2070        function Wrapper() {
2071          var _this;
2072  
2073          Object(classCallCheck["a" /* default */])(this, Wrapper);
2074  
2075          _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(Wrapper).apply(this, arguments));
2076          _this.handleEvent = _this.handleEvent.bind(Object(assertThisInitialized["a" /* default */])(_this));
2077          _this.handleRef = _this.handleRef.bind(Object(assertThisInitialized["a" /* default */])(_this));
2078          return _this;
2079        }
2080  
2081        Object(createClass["a" /* default */])(Wrapper, [{
2082          key: "componentDidMount",
2083          value: function componentDidMount() {
2084            var _this2 = this;
2085  
2086            Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) {
2087              with_global_events_listener.add(eventType, _this2);
2088            });
2089          }
2090        }, {
2091          key: "componentWillUnmount",
2092          value: function componentWillUnmount() {
2093            var _this3 = this;
2094  
2095            Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) {
2096              with_global_events_listener.remove(eventType, _this3);
2097            });
2098          }
2099        }, {
2100          key: "handleEvent",
2101          value: function handleEvent(event) {
2102            var handler = eventTypesToHandlers[event.type];
2103  
2104            if (typeof this.wrappedRef[handler] === 'function') {
2105              this.wrappedRef[handler](event);
2106            }
2107          }
2108        }, {
2109          key: "handleRef",
2110          value: function handleRef(el) {
2111            this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref`
2112            // will cause `this.props.forwardedRef` to be `null`, so we need this
2113            // check.
2114  
2115            if (this.props.forwardedRef) {
2116              this.props.forwardedRef(el);
2117            }
2118          }
2119        }, {
2120          key: "render",
2121          value: function render() {
2122            return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props.ownProps, {
2123              ref: this.handleRef
2124            }));
2125          }
2126        }]);
2127  
2128        return Wrapper;
2129      }(external_this_wp_element_["Component"]);
2130  
2131      return Object(external_this_wp_element_["forwardRef"])(function (props, ref) {
2132        return Object(external_this_wp_element_["createElement"])(Wrapper, {
2133          ownProps: props,
2134          forwardedRef: ref
2135        });
2136      });
2137    }, 'withGlobalEvents');
2138  }
2139  
2140  /* harmony default export */ var with_global_events = (withGlobalEvents);
2141  
2142  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
2143  /**
2144   * WordPress dependencies
2145   */
2146  
2147  var instanceMap = new WeakMap();
2148  /**
2149   * Creates a new id for a given object.
2150   *
2151   * @param {Object} object Object reference to create an id for.
2152   */
2153  
2154  function createId(object) {
2155    var instances = instanceMap.get(object) || 0;
2156    instanceMap.set(object, instances + 1);
2157    return instances;
2158  }
2159  /**
2160   * Provides a unique instance ID.
2161   *
2162   * @param {Object} object Object reference to create an id for.
2163   */
2164  
2165  
2166  function useInstanceId(object) {
2167    return Object(external_this_wp_element_["useMemo"])(function () {
2168      return createId(object);
2169    }, [object]);
2170  }
2171  
2172  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js
2173  
2174  
2175  
2176  /**
2177   * Internal dependencies
2178   */
2179  
2180  
2181  /**
2182   * A Higher Order Component used to be provide a unique instance ID by
2183   * component.
2184   *
2185   * @param {WPComponent} WrappedComponent The wrapped component.
2186   *
2187   * @return {WPComponent} Component with an instanceId prop.
2188   */
2189  
2190  /* harmony default export */ var with_instance_id = (create_higher_order_component(function (WrappedComponent) {
2191    return function (props) {
2192      var instanceId = useInstanceId(WrappedComponent);
2193      return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, {
2194        instanceId: instanceId
2195      }));
2196    };
2197  }, 'withInstanceId'));
2198  
2199  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js
2200  
2201  
2202  
2203  
2204  
2205  
2206  
2207  
2208  
2209  /**
2210   * External dependencies
2211   */
2212  
2213  /**
2214   * WordPress dependencies
2215   */
2216  
2217  
2218  /**
2219   * Internal dependencies
2220   */
2221  
2222  
2223  /**
2224   * A higher-order component used to provide and manage delayed function calls
2225   * that ought to be bound to a component's lifecycle.
2226   *
2227   * @param {WPComponent} OriginalComponent Component requiring setTimeout
2228   *
2229   * @return {WPComponent} Wrapped component.
2230   */
2231  
2232  var withSafeTimeout = create_higher_order_component(function (OriginalComponent) {
2233    return (
2234      /*#__PURE__*/
2235      function (_Component) {
2236        Object(inherits["a" /* default */])(WrappedComponent, _Component);
2237  
2238        function WrappedComponent() {
2239          var _this;
2240  
2241          Object(classCallCheck["a" /* default */])(this, WrappedComponent);
2242  
2243          _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(WrappedComponent).apply(this, arguments));
2244          _this.timeouts = [];
2245          _this.setTimeout = _this.setTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this));
2246          _this.clearTimeout = _this.clearTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this));
2247          return _this;
2248        }
2249  
2250        Object(createClass["a" /* default */])(WrappedComponent, [{
2251          key: "componentWillUnmount",
2252          value: function componentWillUnmount() {
2253            this.timeouts.forEach(clearTimeout);
2254          }
2255        }, {
2256          key: "setTimeout",
2257          value: function (_setTimeout) {
2258            function setTimeout(_x, _x2) {
2259              return _setTimeout.apply(this, arguments);
2260            }
2261  
2262            setTimeout.toString = function () {
2263              return _setTimeout.toString();
2264            };
2265  
2266            return setTimeout;
2267          }(function (fn, delay) {
2268            var _this2 = this;
2269  
2270            var id = setTimeout(function () {
2271              fn();
2272  
2273              _this2.clearTimeout(id);
2274            }, delay);
2275            this.timeouts.push(id);
2276            return id;
2277          })
2278        }, {
2279          key: "clearTimeout",
2280          value: function (_clearTimeout) {
2281            function clearTimeout(_x3) {
2282              return _clearTimeout.apply(this, arguments);
2283            }
2284  
2285            clearTimeout.toString = function () {
2286              return _clearTimeout.toString();
2287            };
2288  
2289            return clearTimeout;
2290          }(function (id) {
2291            clearTimeout(id);
2292            this.timeouts = Object(external_this_lodash_["without"])(this.timeouts, id);
2293          })
2294        }, {
2295          key: "render",
2296          value: function render() {
2297            return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, {
2298              setTimeout: this.setTimeout,
2299              clearTimeout: this.clearTimeout
2300            }));
2301          }
2302        }]);
2303  
2304        return WrappedComponent;
2305      }(external_this_wp_element_["Component"])
2306    );
2307  }, 'withSafeTimeout');
2308  /* harmony default export */ var with_safe_timeout = (withSafeTimeout);
2309  
2310  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js
2311  
2312  
2313  
2314  
2315  
2316  
2317  
2318  
2319  
2320  /**
2321   * WordPress dependencies
2322   */
2323  
2324  /**
2325   * Internal dependencies
2326   */
2327  
2328  
2329  /**
2330   * A Higher Order Component used to provide and manage internal component state
2331   * via props.
2332   *
2333   * @param {?Object} initialState Optional initial state of the component.
2334   *
2335   * @return {WPComponent} Wrapped component.
2336   */
2337  
2338  function withState() {
2339    var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2340    return create_higher_order_component(function (OriginalComponent) {
2341      return (
2342        /*#__PURE__*/
2343        function (_Component) {
2344          Object(inherits["a" /* default */])(WrappedComponent, _Component);
2345  
2346          function WrappedComponent() {
2347            var _this;
2348  
2349            Object(classCallCheck["a" /* default */])(this, WrappedComponent);
2350  
2351            _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(WrappedComponent).apply(this, arguments));
2352            _this.setState = _this.setState.bind(Object(assertThisInitialized["a" /* default */])(_this));
2353            _this.state = initialState;
2354            return _this;
2355          }
2356  
2357          Object(createClass["a" /* default */])(WrappedComponent, [{
2358            key: "render",
2359            value: function render() {
2360              return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, this.state, {
2361                setState: this.setState
2362              }));
2363            }
2364          }]);
2365  
2366          return WrappedComponent;
2367        }(external_this_wp_element_["Component"])
2368      );
2369    }, 'withState');
2370  }
2371  
2372  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
2373  var slicedToArray = __webpack_require__(20);
2374  
2375  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dragging/index.js
2376  
2377  
2378  /**
2379   * WordPress dependencies
2380   */
2381  
2382  var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_this_wp_element_["useLayoutEffect"] : external_this_wp_element_["useEffect"];
2383  function useDragging(_ref) {
2384    var onDragStart = _ref.onDragStart,
2385        onDragMove = _ref.onDragMove,
2386        onDragEnd = _ref.onDragEnd;
2387  
2388    var _useState = Object(external_this_wp_element_["useState"])(false),
2389        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
2390        isDragging = _useState2[0],
2391        setIsDragging = _useState2[1];
2392  
2393    var eventsRef = Object(external_this_wp_element_["useRef"])({
2394      onDragStart: onDragStart,
2395      onDragMove: onDragMove,
2396      onDragEnd: onDragEnd
2397    });
2398    useIsomorphicLayoutEffect(function () {
2399      eventsRef.current.onDragStart = onDragStart;
2400      eventsRef.current.onDragMove = onDragMove;
2401      eventsRef.current.onDragEnd = onDragEnd;
2402    }, [onDragStart, onDragMove, onDragEnd]);
2403    var onMouseMove = Object(external_this_wp_element_["useCallback"])(function () {
2404      var _eventsRef$current;
2405  
2406      return eventsRef.current.onDragMove && (_eventsRef$current = eventsRef.current).onDragMove.apply(_eventsRef$current, arguments);
2407    }, []);
2408    var endDrag = Object(external_this_wp_element_["useCallback"])(function () {
2409      if (eventsRef.current.onDragEnd) {
2410        var _eventsRef$current2;
2411  
2412        (_eventsRef$current2 = eventsRef.current).onDragEnd.apply(_eventsRef$current2, arguments);
2413      }
2414  
2415      document.removeEventListener('mousemove', onMouseMove);
2416      document.removeEventListener('mouseup', endDrag);
2417      setIsDragging(false);
2418    }, []);
2419    var startDrag = Object(external_this_wp_element_["useCallback"])(function () {
2420      if (eventsRef.current.onDragStart) {
2421        var _eventsRef$current3;
2422  
2423        (_eventsRef$current3 = eventsRef.current).onDragStart.apply(_eventsRef$current3, arguments);
2424      }
2425  
2426      document.addEventListener('mousemove', onMouseMove);
2427      document.addEventListener('mouseup', endDrag);
2428      setIsDragging(true);
2429    }, []); // Remove the global events when unmounting if needed.
2430  
2431    Object(external_this_wp_element_["useEffect"])(function () {
2432      return function () {
2433        if (isDragging) {
2434          document.removeEventListener('mousemove', onMouseMove);
2435          document.removeEventListener('mouseup', endDrag);
2436        }
2437      };
2438    }, [isDragging]);
2439    return {
2440      startDrag: startDrag,
2441      endDrag: endDrag,
2442      isDragging: isDragging
2443    };
2444  }
2445  
2446  // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js
2447  var mousetrap_mousetrap = __webpack_require__(271);
2448  var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap);
2449  
2450  // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js
2451  var mousetrap_global_bind = __webpack_require__(396);
2452  
2453  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-keyboard-shortcut/index.js
2454  /**
2455   * External dependencies
2456   */
2457  
2458  
2459  
2460  /**
2461   * WordPress dependencies
2462   */
2463  
2464  
2465  /**
2466   * A block selection object.
2467   *
2468   * @typedef {Object} WPKeyboardShortcutConfig
2469   *
2470   * @property {boolean} [bindGlobal]  Handle keyboard events anywhere including inside textarea/input fields.
2471   * @property {string}  [eventName]   Event name used to trigger the handler, defaults to keydown.
2472   * @property {boolean} [isDisabled]  Disables the keyboard handler if the value is true.
2473   * @property {Object}  [target]      React reference to the DOM element used to catch the keyboard event.
2474   */
2475  
2476  /**
2477   * Return true if platform is MacOS.
2478   *
2479   * @param {Object} _window   window object by default; used for DI testing.
2480   *
2481   * @return {boolean} True if MacOS; false otherwise.
2482   */
2483  
2484  function isAppleOS() {
2485    var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
2486  
2487    var platform = _window.navigator.platform;
2488    return platform.indexOf('Mac') !== -1 || Object(external_this_lodash_["includes"])(['iPad', 'iPhone'], platform);
2489  }
2490  /**
2491   * Attach a keyboard shortcut handler.
2492   *
2493   * @param {string[]|string}         shortcuts  Keyboard Shortcuts.
2494   * @param {Function}                callback   Shortcut callback.
2495   * @param {WPKeyboardShortcutConfig} options    Shortcut options.
2496   */
2497  
2498  
2499  function useKeyboardShortcut(shortcuts, callback) {
2500    var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
2501        _ref$bindGlobal = _ref.bindGlobal,
2502        bindGlobal = _ref$bindGlobal === void 0 ? false : _ref$bindGlobal,
2503        _ref$eventName = _ref.eventName,
2504        eventName = _ref$eventName === void 0 ? 'keydown' : _ref$eventName,
2505        _ref$isDisabled = _ref.isDisabled,
2506        isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
2507        target = _ref.target;
2508  
2509    Object(external_this_wp_element_["useEffect"])(function () {
2510      if (isDisabled) {
2511        return;
2512      }
2513  
2514      var mousetrap = new mousetrap_default.a(target ? target.current : document);
2515      Object(external_this_lodash_["castArray"])(shortcuts).forEach(function (shortcut) {
2516        var keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string.
2517        // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that
2518        // the modifiers are Shift and Cmd because they're not a single character.
2519  
2520        var modifiers = new Set(keys.filter(function (value) {
2521          return value.length > 1;
2522        }));
2523        var hasAlt = modifiers.has('alt');
2524        var hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead.
2525  
2526        if (isAppleOS() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) {
2527          throw new Error("Cannot bind ".concat(shortcut, ". Alt and Shift+Alt modifiers are reserved for character input."));
2528        }
2529  
2530        var bindFn = bindGlobal ? 'bindGlobal' : 'bind';
2531        mousetrap[bindFn](shortcut, callback, eventName);
2532      });
2533      return function () {
2534        mousetrap.reset();
2535      };
2536    }, [shortcuts, bindGlobal, eventName, callback, target, isDisabled]);
2537  }
2538  
2539  /* harmony default export */ var use_keyboard_shortcut = (useKeyboardShortcut);
2540  
2541  // EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js
2542  var use_media_query = __webpack_require__(112);
2543  
2544  // EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js
2545  var use_reduced_motion = __webpack_require__(252);
2546  
2547  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js
2548  /**
2549   * WordPress dependencies
2550   */
2551  
2552  /**
2553   * Internal dependencies
2554   */
2555  
2556  
2557  /**
2558   * @typedef {"huge"|"wide"|"large"|"medium"|"small"|"mobile"} WPBreakpoint
2559   */
2560  
2561  /**
2562   * Hash of breakpoint names with pixel width at which it becomes effective.
2563   *
2564   * @see _breakpoints.scss
2565   *
2566   * @type {Object<WPBreakpoint,number>}
2567   */
2568  
2569  var BREAKPOINTS = {
2570    huge: 1440,
2571    wide: 1280,
2572    large: 960,
2573    medium: 782,
2574    small: 600,
2575    mobile: 480
2576  };
2577  /**
2578   * @typedef {">="|"<"} WPViewportOperator
2579   */
2580  
2581  /**
2582   * Object mapping media query operators to the condition to be used.
2583   *
2584   * @type {Object<WPViewportOperator,string>}
2585   */
2586  
2587  var CONDITIONS = {
2588    '>=': 'min-width',
2589    '<': 'max-width'
2590  };
2591  /**
2592   * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.
2593   *
2594   * @type {Object<WPViewportOperator,Function>}
2595   */
2596  
2597  var OPERATOR_EVALUATORS = {
2598    '>=': function _(breakpointValue, width) {
2599      return width >= breakpointValue;
2600    },
2601    '<': function _(breakpointValue, width) {
2602      return width < breakpointValue;
2603    }
2604  };
2605  var ViewportMatchWidthContext = Object(external_this_wp_element_["createContext"])(null);
2606  /**
2607   * Returns true if the viewport matches the given query, or false otherwise.
2608   *
2609   * @param {WPBreakpoint}       breakpoint      Breakpoint size name.
2610   * @param {WPViewportOperator} [operator=">="] Viewport operator.
2611   *
2612   * @example
2613   *
2614   * ```js
2615   * useViewportMatch( 'huge', <' );
2616   * useViewportMatch( 'medium' );
2617   * ```
2618   *
2619   * @return {boolean} Whether viewport matches query.
2620   */
2621  
2622  var use_viewport_match_useViewportMatch = function useViewportMatch(breakpoint) {
2623    var operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '>=';
2624    var simulatedWidth = Object(external_this_wp_element_["useContext"])(ViewportMatchWidthContext);
2625    var mediaQuery = !simulatedWidth && "(".concat(CONDITIONS[operator], ": ").concat(BREAKPOINTS[breakpoint], "px)");
2626    var mediaQueryResult = Object(use_media_query["a" /* default */])(mediaQuery);
2627  
2628    if (simulatedWidth) {
2629      return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
2630    }
2631  
2632    return mediaQueryResult;
2633  };
2634  
2635  use_viewport_match_useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
2636  /* harmony default export */ var use_viewport_match = (use_viewport_match_useViewportMatch);
2637  
2638  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/index.js
2639  /* concated harmony reexport createHigherOrderComponent */__webpack_require__.d(__webpack_exports__, "createHigherOrderComponent", function() { return create_higher_order_component; });
2640  /* concated harmony reexport compose */__webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
2641  /* concated harmony reexport ifCondition */__webpack_require__.d(__webpack_exports__, "ifCondition", function() { return if_condition; });
2642  /* concated harmony reexport pure */__webpack_require__.d(__webpack_exports__, "pure", function() { return higher_order_pure; });
2643  /* concated harmony reexport withGlobalEvents */__webpack_require__.d(__webpack_exports__, "withGlobalEvents", function() { return with_global_events; });
2644  /* concated harmony reexport withInstanceId */__webpack_require__.d(__webpack_exports__, "withInstanceId", function() { return with_instance_id; });
2645  /* concated harmony reexport withSafeTimeout */__webpack_require__.d(__webpack_exports__, "withSafeTimeout", function() { return with_safe_timeout; });
2646  /* concated harmony reexport withState */__webpack_require__.d(__webpack_exports__, "withState", function() { return withState; });
2647  /* concated harmony reexport __experimentalUseDragging */__webpack_require__.d(__webpack_exports__, "__experimentalUseDragging", function() { return useDragging; });
2648  /* concated harmony reexport useInstanceId */__webpack_require__.d(__webpack_exports__, "useInstanceId", function() { return useInstanceId; });
2649  /* concated harmony reexport useKeyboardShortcut */__webpack_require__.d(__webpack_exports__, "useKeyboardShortcut", function() { return use_keyboard_shortcut; });
2650  /* concated harmony reexport useMediaQuery */__webpack_require__.d(__webpack_exports__, "useMediaQuery", function() { return use_media_query["a" /* default */]; });
2651  /* concated harmony reexport useReducedMotion */__webpack_require__.d(__webpack_exports__, "useReducedMotion", function() { return use_reduced_motion["a" /* default */]; });
2652  /* concated harmony reexport useViewportMatch */__webpack_require__.d(__webpack_exports__, "useViewportMatch", function() { return use_viewport_match; });
2653  // Utils
2654   // Compose helper (aliased flowRight from Lodash)
2655  
2656   // Higher-order components
2657  
2658  
2659  
2660  
2661  
2662  
2663   // Hooks
2664  
2665  
2666  
2667  
2668  
2669  
2670  
2671  
2672  
2673  /***/ }),
2674  
2675  /***/ 51:
2676  /***/ (function(module, exports) {
2677  
2678  (function() { module.exports = this["wp"]["isShallowEqual"]; }());
2679  
2680  /***/ }),
2681  
2682  /***/ 7:
2683  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2684  
2685  "use strict";
2686  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
2687  function _assertThisInitialized(self) {
2688    if (self === void 0) {
2689      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2690    }
2691  
2692    return self;
2693  }
2694  
2695  /***/ })
2696  
2697  /******/ });


Generated: Mon Mar 30 01:00:03 2020 Cross-referenced by PHPXref 0.7.1