2018-12-14 05:41:57 +01:00
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
2020-07-21 14:14:37 +02:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 450 ) ;
2018-12-14 05:41:57 +01:00
/******/ } )
/************************************************************************/
/******/ ( {
2020-07-21 14:14:37 +02:00
/***/ 18 :
2019-09-19 17:19:18 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 13:50:29 +02:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return /* binding */ _toConsumableArray ; } ) ;
2020-03-24 00:40:19 +01:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
2020-06-26 15:33:47 +02:00
var arrayLikeToArray = _ _webpack _require _ _ ( 26 ) ;
2020-03-24 00:40:19 +01:00
2019-09-19 17:19:18 +02:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
2020-03-24 00:40:19 +01:00
function _arrayWithoutHoles ( arr ) {
if ( Array . isArray ( arr ) ) return Object ( arrayLikeToArray [ "a" /* default */ ] ) ( arr ) ;
2019-09-19 17:19:18 +02:00
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
2020-03-24 00:40:19 +01:00
var iterableToArray = _ _webpack _require _ _ ( 35 ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
2020-07-07 16:43:35 +02:00
var unsupportedIterableToArray = _ _webpack _require _ _ ( 29 ) ;
2019-09-19 17:19:18 +02:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread ( ) {
2020-03-24 00:40:19 +01:00
throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
2019-09-19 17:19:18 +02:00
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
2020-03-24 00:40:19 +01:00
2019-09-19 17:19:18 +02:00
function _toConsumableArray ( arr ) {
2020-03-24 00:40:19 +01:00
return _arrayWithoutHoles ( arr ) || Object ( iterableToArray [ "a" /* default */ ] ) ( arr ) || Object ( unsupportedIterableToArray [ "a" /* default */ ] ) ( arr ) || _nonIterableSpread ( ) ;
}
/***/ } ) ,
2020-06-26 15:33:47 +02:00
/***/ 26 :
2020-03-24 00:40:19 +01:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _arrayLikeToArray ; } ) ;
function _arrayLikeToArray ( arr , len ) {
if ( len == null || len > arr . length ) len = arr . length ;
for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) {
arr2 [ i ] = arr [ i ] ;
}
return arr2 ;
}
/***/ } ) ,
2020-07-07 16:43:35 +02:00
/***/ 29 :
2020-03-24 00:40:19 +01:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _unsupportedIterableToArray ; } ) ;
2020-06-26 15:33:47 +02:00
/* harmony import */ var _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 26 ) ;
2020-03-24 00:40:19 +01:00
function _unsupportedIterableToArray ( o , minLen ) {
if ( ! o ) return ;
if ( typeof o === "string" ) return Object ( _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( o , minLen ) ;
var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ;
if ( n === "Object" && o . constructor ) n = o . constructor . name ;
2020-06-26 15:33:47 +02:00
if ( n === "Map" || n === "Set" ) return Array . from ( o ) ;
2020-03-24 00:40:19 +01:00
if ( n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ) return Object ( _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( o , minLen ) ;
2019-09-19 17:19:18 +02:00
}
/***/ } ) ,
2020-03-24 00:40:19 +01:00
/***/ 35 :
2019-09-19 17:19:18 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _iterableToArray ; } ) ;
function _iterableToArray ( iter ) {
2020-03-24 00:40:19 +01:00
if ( typeof Symbol !== "undefined" && Symbol . iterator in Object ( iter ) ) return Array . from ( iter ) ;
2019-09-19 17:19:18 +02:00
}
/***/ } ) ,
2020-07-21 14:14:37 +02:00
/***/ 450 :
2018-12-14 05:41:57 +01:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 13:50:29 +02:00
// ESM COMPAT FLAG
2018-12-14 05:41:57 +01:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2018-12-18 04:14:52 +01:00
2020-06-29 13:50:29 +02:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "createHooks" , function ( ) { return /* reexport */ build _module _createHooks ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "addAction" , function ( ) { return /* binding */ addAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "addFilter" , function ( ) { return /* binding */ addFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "removeAction" , function ( ) { return /* binding */ removeAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "removeFilter" , function ( ) { return /* binding */ removeFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "hasAction" , function ( ) { return /* binding */ hasAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "hasFilter" , function ( ) { return /* binding */ hasFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "removeAllActions" , function ( ) { return /* binding */ removeAllActions ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "removeAllFilters" , function ( ) { return /* binding */ removeAllFilters ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "doAction" , function ( ) { return /* binding */ doAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "applyFilters" , function ( ) { return /* binding */ applyFilters ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "currentAction" , function ( ) { return /* binding */ currentAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "currentFilter" , function ( ) { return /* binding */ currentFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "doingAction" , function ( ) { return /* binding */ doingAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "doingFilter" , function ( ) { return /* binding */ doingFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "didAction" , function ( ) { return /* binding */ didAction ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "didFilter" , function ( ) { return /* binding */ didFilter ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "actions" , function ( ) { return /* binding */ build _module _actions ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "filters" , function ( ) { return /* binding */ build _module _filters ; } ) ;
2018-12-18 04:14:52 +01:00
// 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
2019-03-07 10:09:59 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
/ * *
* 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 ;
2018-12-18 04:14:52 +01:00
if ( ! build _module _validateHookName ( hookName ) ) {
2018-12-14 05:41:57 +01:00
return ;
}
2018-12-18 04:14:52 +01:00
if ( ! build _module _validateNamespace ( namespace ) ) {
2018-12-14 05:41:57 +01:00
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 ;
2019-01-04 20:38:57 +01:00
var i ;
2018-12-14 05:41:57 +01:00
2019-01-04 20:38:57 +01:00
for ( i = handlers . length ; i > 0 ; i -- ) {
if ( priority >= handlers [ i - 1 ] . priority ) {
2018-12-14 05:41:57 +01:00
break ;
}
2019-01-04 20:38:57 +01:00
}
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
2018-12-14 05:41:57 +01:00
// 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.
2019-01-04 20:38:57 +01:00
2018-12-14 05:41:57 +01:00
( 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' ) {
2018-12-18 04:14:52 +01:00
doAction ( 'hookAdded' , hookName , namespace , callback , priority ) ;
2018-12-14 05:41:57 +01:00
}
} ;
}
2018-12-18 04:14:52 +01:00
/* harmony default export */ var build _module _createAddHook = ( createAddHook ) ;
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js
2019-03-07 10:09:59 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
/ * *
* 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 ) {
2018-12-18 04:14:52 +01:00
if ( ! build _module _validateHookName ( hookName ) ) {
2018-12-14 05:41:57 +01:00
return ;
}
2018-12-18 04:14:52 +01:00
if ( ! removeAll && ! build _module _validateNamespace ( namespace ) ) {
2018-12-14 05:41:57 +01:00
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' ) {
2018-12-18 04:14:52 +01:00
doAction ( 'hookRemoved' , hookName , namespace ) ;
2018-12-14 05:41:57 +01:00
}
return handlersRemoved ;
} ;
}
2018-12-18 04:14:52 +01:00
/* harmony default export */ var build _module _createRemoveHook = ( createRemoveHook ) ;
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
// 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
2019-09-19 17:19:18 +02:00
* attached to a particular hook and optional namespace .
2018-12-18 04:14:52 +01:00
* /
function createHasHook ( hooks ) {
/ * *
2019-09-19 17:19:18 +02:00
* Returns whether any handlers are attached for the given hookName and optional namespace .
2018-12-18 04:14:52 +01:00
*
2019-09-19 17:19:18 +02:00
* @ 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 ` .
2018-12-18 04:14:52 +01:00
*
* @ return { boolean } Whether there are handlers that are attached to the given hook .
* /
2019-09-19 17:19:18 +02:00
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 ;
} ) ;
}
2018-12-18 04:14:52 +01:00
return hookName in hooks ;
} ;
}
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/* harmony default export */ var build _module _createHasHook = ( createHasHook ) ;
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
2020-07-21 14:14:37 +02:00
var toConsumableArray = _ _webpack _require _ _ ( 18 ) ;
2019-09-19 17:19:18 +02:00
2018-12-18 04:14:52 +01:00
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
2019-09-19 17:19:18 +02:00
2018-12-14 05:41:57 +01:00
/ * *
* 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 ++ ;
2019-09-19 17:19:18 +02:00
var handlers = hooks [ hookName ] . handlers ; // The following code is stripped from production builds.
if ( false ) { }
2018-12-14 05:41:57 +01:00
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 ] ;
}
} ;
}
2018-12-18 04:14:52 +01:00
/* 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.
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
return hooks . _ _current [ 0 ] ? hookName === hooks . _ _current [ 0 ] . name : false ;
} ;
}
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/* harmony default export */ var build _module _createDoingHook = ( createDoingHook ) ;
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js
2019-03-07 10:09:59 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/ * *
* 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
2019-03-07 10:09:59 +01:00
/ * *
* Internal dependencies
* /
2018-12-18 04:14:52 +01:00
/ * *
* 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
2019-03-07 10:09:59 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
var _createHooks = build _module _createHooks ( ) ,
2018-12-14 05:41:57 +01:00
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 ,
2018-12-18 04:14:52 +01:00
build _module _actions = _createHooks . actions ,
build _module _filters = _createHooks . filters ;
2018-12-14 05:41:57 +01:00
/***/ } )
2018-12-18 04:14:52 +01:00
/******/ } ) ;