123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683 |
- this["wp"] = this["wp"] || {}; this["wp"]["hooks"] =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 351);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 17:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- }
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
- var iterableToArray = __webpack_require__(30);
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
- }
- /***/ }),
- /***/ 30:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
- function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
- }
- /***/ }),
- /***/ 351:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
- /**
- * Validate a namespace string.
- *
- * @param {string} namespace The namespace to validate - should take the form
- * `vendor/plugin/function`.
- *
- * @return {boolean} Whether the namespace is valid.
- */
- function validateNamespace(namespace) {
- if ('string' !== typeof namespace || '' === namespace) {
- // eslint-disable-next-line no-console
- console.error('The namespace must be a non-empty string.');
- return false;
- }
- if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
- // eslint-disable-next-line no-console
- console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
- return false;
- }
- return true;
- }
- /* harmony default export */ var build_module_validateNamespace = (validateNamespace);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js
- /**
- * Validate a hookName string.
- *
- * @param {string} hookName The hook name to validate. Should be a non empty string containing
- * only numbers, letters, dashes, periods and underscores. Also,
- * the hook name cannot begin with `__`.
- *
- * @return {boolean} Whether the hook name is valid.
- */
- function validateHookName(hookName) {
- if ('string' !== typeof hookName || '' === hookName) {
- // eslint-disable-next-line no-console
- console.error('The hook name must be a non-empty string.');
- return false;
- }
- if (/^__/.test(hookName)) {
- // eslint-disable-next-line no-console
- console.error('The hook name cannot begin with `__`.');
- return false;
- }
- if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
- // eslint-disable-next-line no-console
- console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
- return false;
- }
- return true;
- }
- /* harmony default export */ var build_module_validateHookName = (validateHookName);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js
- /**
- * Internal dependencies
- */
- /**
- * Returns a function which, when invoked, will add a hook.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- *
- * @return {Function} Function that adds a new hook.
- */
- function createAddHook(hooks) {
- /**
- * Adds the hook to the appropriate hooks container.
- *
- * @param {string} hookName Name of hook to add
- * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
- * @param {Function} callback Function to call when the hook is run
- * @param {?number} priority Priority of this hook (default=10)
- */
- return function addHook(hookName, namespace, callback) {
- var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
- if (!build_module_validateHookName(hookName)) {
- return;
- }
- if (!build_module_validateNamespace(namespace)) {
- return;
- }
- if ('function' !== typeof callback) {
- // eslint-disable-next-line no-console
- console.error('The hook callback must be a function.');
- return;
- } // Validate numeric priority
- if ('number' !== typeof priority) {
- // eslint-disable-next-line no-console
- console.error('If specified, the hook priority must be a number.');
- return;
- }
- var handler = {
- callback: callback,
- priority: priority,
- namespace: namespace
- };
- if (hooks[hookName]) {
- // Find the correct insert index of the new hook.
- var handlers = hooks[hookName].handlers;
- var i;
- for (i = handlers.length; i > 0; i--) {
- if (priority >= handlers[i - 1].priority) {
- break;
- }
- }
- if (i === handlers.length) {
- // If append, operate via direct assignment.
- handlers[i] = handler;
- } else {
- // Otherwise, insert before index via splice.
- handlers.splice(i, 0, handler);
- } // We may also be currently executing this hook. If the callback
- // we're adding would come after the current callback, there's no
- // problem; otherwise we need to increase the execution index of
- // any other runs by 1 to account for the added element.
- (hooks.__current || []).forEach(function (hookInfo) {
- if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
- hookInfo.currentIndex++;
- }
- });
- } else {
- // This is the first hook of its type.
- hooks[hookName] = {
- handlers: [handler],
- runs: 0
- };
- }
- if (hookName !== 'hookAdded') {
- doAction('hookAdded', hookName, namespace, callback, priority);
- }
- };
- }
- /* harmony default export */ var build_module_createAddHook = (createAddHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js
- /**
- * Internal dependencies
- */
- /**
- * Returns a function which, when invoked, will remove a specified hook or all
- * hooks by the given name.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- * @param {boolean} removeAll Whether to remove all callbacks for a hookName, without regard to namespace. Used to create `removeAll*` functions.
- *
- * @return {Function} Function that removes hooks.
- */
- function createRemoveHook(hooks, removeAll) {
- /**
- * Removes the specified callback (or all callbacks) from the hook with a
- * given hookName and namespace.
- *
- * @param {string} hookName The name of the hook to modify.
- * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
- *
- * @return {number} The number of callbacks removed.
- */
- return function removeHook(hookName, namespace) {
- if (!build_module_validateHookName(hookName)) {
- return;
- }
- if (!removeAll && !build_module_validateNamespace(namespace)) {
- return;
- } // Bail if no hooks exist by this name
- if (!hooks[hookName]) {
- return 0;
- }
- var handlersRemoved = 0;
- if (removeAll) {
- handlersRemoved = hooks[hookName].handlers.length;
- hooks[hookName] = {
- runs: hooks[hookName].runs,
- handlers: []
- };
- } else {
- // Try to find the specified callback to remove.
- var handlers = hooks[hookName].handlers;
- var _loop = function _loop(i) {
- if (handlers[i].namespace === namespace) {
- handlers.splice(i, 1);
- handlersRemoved++; // This callback may also be part of a hook that is
- // currently executing. If the callback we're removing
- // comes after the current callback, there's no problem;
- // otherwise we need to decrease the execution index of any
- // other runs by 1 to account for the removed element.
- (hooks.__current || []).forEach(function (hookInfo) {
- if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
- hookInfo.currentIndex--;
- }
- });
- }
- };
- for (var i = handlers.length - 1; i >= 0; i--) {
- _loop(i);
- }
- }
- if (hookName !== 'hookRemoved') {
- doAction('hookRemoved', hookName, namespace);
- }
- return handlersRemoved;
- };
- }
- /* harmony default export */ var build_module_createRemoveHook = (createRemoveHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js
- /**
- * Returns a function which, when invoked, will return whether any handlers are
- * attached to a particular hook.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- *
- * @return {Function} Function that returns whether any handlers are
- * attached to a particular hook and optional namespace.
- */
- function createHasHook(hooks) {
- /**
- * Returns whether any handlers are attached for the given hookName and optional namespace.
- *
- * @param {string} hookName The name of the hook to check for.
- * @param {?string} namespace Optional. The unique namespace identifying the callback
- * in the form `vendor/plugin/function`.
- *
- * @return {boolean} Whether there are handlers that are attached to the given hook.
- */
- return function hasHook(hookName, namespace) {
- // Use the namespace if provided.
- if ('undefined' !== typeof namespace) {
- return hookName in hooks && hooks[hookName].handlers.some(function (hook) {
- return hook.namespace === namespace;
- });
- }
- return hookName in hooks;
- };
- }
- /* harmony default export */ var build_module_createHasHook = (createHasHook);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
- var toConsumableArray = __webpack_require__(17);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
- /**
- * Returns a function which, when invoked, will execute all callbacks
- * registered to a hook of the specified type, optionally returning the final
- * value of the call chain.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- * @param {?boolean} returnFirstArg Whether each hook callback is expected to
- * return its first argument.
- *
- * @return {Function} Function that runs hook callbacks.
- */
- function createRunHook(hooks, returnFirstArg) {
- /**
- * Runs all callbacks for the specified hook.
- *
- * @param {string} hookName The name of the hook to run.
- * @param {...*} args Arguments to pass to the hook callbacks.
- *
- * @return {*} Return value of runner, if applicable.
- */
- return function runHooks(hookName) {
- if (!hooks[hookName]) {
- hooks[hookName] = {
- handlers: [],
- runs: 0
- };
- }
- hooks[hookName].runs++;
- var handlers = hooks[hookName].handlers; // The following code is stripped from production builds.
- if (false) {}
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- if (!handlers || !handlers.length) {
- return returnFirstArg ? args[0] : undefined;
- }
- var hookInfo = {
- name: hookName,
- currentIndex: 0
- };
- hooks.__current.push(hookInfo);
- while (hookInfo.currentIndex < handlers.length) {
- var handler = handlers[hookInfo.currentIndex];
- var result = handler.callback.apply(null, args);
- if (returnFirstArg) {
- args[0] = result;
- }
- hookInfo.currentIndex++;
- }
- hooks.__current.pop();
- if (returnFirstArg) {
- return args[0];
- }
- };
- }
- /* harmony default export */ var build_module_createRunHook = (createRunHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js
- /**
- * Returns a function which, when invoked, will return the name of the
- * currently running hook, or `null` if no hook of the given type is currently
- * running.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- *
- * @return {Function} Function that returns the current hook.
- */
- function createCurrentHook(hooks) {
- /**
- * Returns the name of the currently running hook, or `null` if no hook of
- * the given type is currently running.
- *
- * @return {?string} The name of the currently running hook, or
- * `null` if no hook is currently running.
- */
- return function currentHook() {
- if (!hooks.__current || !hooks.__current.length) {
- return null;
- }
- return hooks.__current[hooks.__current.length - 1].name;
- };
- }
- /* harmony default export */ var build_module_createCurrentHook = (createCurrentHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js
- /**
- * Returns a function which, when invoked, will return whether a hook is
- * currently being executed.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- *
- * @return {Function} Function that returns whether a hook is currently
- * being executed.
- */
- function createDoingHook(hooks) {
- /**
- * Returns whether a hook is currently being executed.
- *
- * @param {?string} hookName The name of the hook to check for. If
- * omitted, will check for any hook being executed.
- *
- * @return {boolean} Whether the hook is being executed.
- */
- return function doingHook(hookName) {
- // If the hookName was not passed, check for any current hook.
- if ('undefined' === typeof hookName) {
- return 'undefined' !== typeof hooks.__current[0];
- } // Return the __current hook.
- return hooks.__current[0] ? hookName === hooks.__current[0].name : false;
- };
- }
- /* harmony default export */ var build_module_createDoingHook = (createDoingHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js
- /**
- * Internal dependencies
- */
- /**
- * Returns a function which, when invoked, will return the number of times a
- * hook has been called.
- *
- * @param {Object} hooks Stored hooks, keyed by hook name.
- *
- * @return {Function} Function that returns a hook's call count.
- */
- function createDidHook(hooks) {
- /**
- * Returns the number of times an action has been fired.
- *
- * @param {string} hookName The hook name to check.
- *
- * @return {number} The number of times the hook has run.
- */
- return function didHook(hookName) {
- if (!build_module_validateHookName(hookName)) {
- return;
- }
- return hooks[hookName] && hooks[hookName].runs ? hooks[hookName].runs : 0;
- };
- }
- /* harmony default export */ var build_module_createDidHook = (createDidHook);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js
- /**
- * Internal dependencies
- */
- /**
- * Returns an instance of the hooks object.
- *
- * @return {Object} Object that contains all hooks.
- */
- function createHooks() {
- var actions = Object.create(null);
- var filters = Object.create(null);
- actions.__current = [];
- filters.__current = [];
- return {
- addAction: build_module_createAddHook(actions),
- addFilter: build_module_createAddHook(filters),
- removeAction: build_module_createRemoveHook(actions),
- removeFilter: build_module_createRemoveHook(filters),
- hasAction: build_module_createHasHook(actions),
- hasFilter: build_module_createHasHook(filters),
- removeAllActions: build_module_createRemoveHook(actions, true),
- removeAllFilters: build_module_createRemoveHook(filters, true),
- doAction: build_module_createRunHook(actions),
- applyFilters: build_module_createRunHook(filters, true),
- currentAction: build_module_createCurrentHook(actions),
- currentFilter: build_module_createCurrentHook(filters),
- doingAction: build_module_createDoingHook(actions),
- doingFilter: build_module_createDoingHook(filters),
- didAction: build_module_createDidHook(actions),
- didFilter: build_module_createDidHook(filters),
- actions: actions,
- filters: filters
- };
- }
- /* harmony default export */ var build_module_createHooks = (createHooks);
- // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAction", function() { return addAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFilter", function() { return addFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAction", function() { return removeAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return removeFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAction", function() { return hasAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return hasFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return removeAllActions; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return removeAllFilters; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAction", function() { return doAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return applyFilters; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentAction", function() { return currentAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return currentFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingAction", function() { return doingAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return doingFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didAction", function() { return didAction; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didFilter", function() { return didFilter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "actions", function() { return build_module_actions; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filters", function() { return build_module_filters; });
- /* concated harmony reexport createHooks */__webpack_require__.d(__webpack_exports__, "createHooks", function() { return build_module_createHooks; });
- /**
- * Internal dependencies
- */
- var _createHooks = build_module_createHooks(),
- addAction = _createHooks.addAction,
- addFilter = _createHooks.addFilter,
- removeAction = _createHooks.removeAction,
- removeFilter = _createHooks.removeFilter,
- hasAction = _createHooks.hasAction,
- hasFilter = _createHooks.hasFilter,
- removeAllActions = _createHooks.removeAllActions,
- removeAllFilters = _createHooks.removeAllFilters,
- doAction = _createHooks.doAction,
- applyFilters = _createHooks.applyFilters,
- currentAction = _createHooks.currentAction,
- currentFilter = _createHooks.currentFilter,
- doingAction = _createHooks.doingAction,
- doingFilter = _createHooks.doingFilter,
- didAction = _createHooks.didAction,
- didFilter = _createHooks.didFilter,
- build_module_actions = _createHooks.actions,
- build_module_filters = _createHooks.filters;
- /***/ })
- /******/ });
|