home/wwgoat/public_html/blog/wp-includes/js/dist/block-directory.js000064400000236664147207000130021507 0ustar00/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getDownloadableBlocks: () => (getDownloadableBlocks), getErrorNoticeForBlock: () => (getErrorNoticeForBlock), getErrorNotices: () => (getErrorNotices), getInstalledBlockTypes: () => (getInstalledBlockTypes), getNewBlockTypes: () => (getNewBlockTypes), getUnusedBlockTypes: () => (getUnusedBlockTypes), isInstalling: () => (isInstalling), isRequestingDownloadableBlocks: () => (isRequestingDownloadableBlocks) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { addInstalledBlockType: () => (addInstalledBlockType), clearErrorNotice: () => (clearErrorNotice), fetchDownloadableBlocks: () => (fetchDownloadableBlocks), installBlockType: () => (installBlockType), receiveDownloadableBlocks: () => (receiveDownloadableBlocks), removeInstalledBlockType: () => (removeInstalledBlockType), setErrorNotice: () => (setErrorNotice), setIsInstalling: () => (setIsInstalling), uninstallBlockType: () => (uninstallBlockType) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js var resolvers_namespaceObject = {}; __webpack_require__.r(resolvers_namespaceObject); __webpack_require__.d(resolvers_namespaceObject, { getDownloadableBlocks: () => (resolvers_getDownloadableBlocks) }); ;// CONCATENATED MODULE: external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// CONCATENATED MODULE: external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// CONCATENATED MODULE: external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// CONCATENATED MODULE: external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// CONCATENATED MODULE: external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// CONCATENATED MODULE: external ["wp","editor"] const external_wp_editor_namespaceObject = window["wp"]["editor"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js /** * WordPress dependencies */ /** * Reducer returning an array of downloadable blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const downloadableBlocks = (state = {}, action) => { switch (action.type) { case 'FETCH_DOWNLOADABLE_BLOCKS': return { ...state, [action.filterValue]: { isRequesting: true } }; case 'RECEIVE_DOWNLOADABLE_BLOCKS': return { ...state, [action.filterValue]: { results: action.downloadableBlocks, isRequesting: false } }; } return state; }; /** * Reducer managing the installation and deletion of blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const blockManagement = (state = { installedBlockTypes: [], isInstalling: {} }, action) => { switch (action.type) { case 'ADD_INSTALLED_BLOCK_TYPE': return { ...state, installedBlockTypes: [...state.installedBlockTypes, action.item] }; case 'REMOVE_INSTALLED_BLOCK_TYPE': return { ...state, installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name) }; case 'SET_INSTALLING_BLOCK': return { ...state, isInstalling: { ...state.isInstalling, [action.blockId]: action.isInstalling } }; } return state; }; /** * Reducer returning an object of error notices. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const errorNotices = (state = {}, action) => { switch (action.type) { case 'SET_ERROR_NOTICE': return { ...state, [action.blockId]: { message: action.message, isFatal: action.isFatal } }; case 'CLEAR_ERROR_NOTICE': const { [action.blockId]: blockId, ...restState } = state; return restState; } return state; }; /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ downloadableBlocks, blockManagement, errorNotices })); ;// CONCATENATED MODULE: external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js /** * Check if a block list contains a specific block type. Recursively searches * through `innerBlocks` if they exist. * * @param {Object} blockType A block object to search for. * @param {Object[]} blocks The list of blocks to look through. * * @return {boolean} Whether the blockType is found. */ function hasBlockType(blockType, blocks = []) { if (!blocks.length) { return false; } if (blocks.some(({ name }) => name === blockType.name)) { return true; } for (let i = 0; i < blocks.length; i++) { if (hasBlockType(blockType, blocks[i].innerBlocks)) { return true; } } return false; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns true if application is requesting for downloadable blocks. * * @param {Object} state Global application state. * @param {string} filterValue Search string. * * @return {boolean} Whether a request is in progress for the blocks list. */ function isRequestingDownloadableBlocks(state, filterValue) { var _state$downloadableBl; return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false; } /** * Returns the available uninstalled blocks. * * @param {Object} state Global application state. * @param {string} filterValue Search string. * * @return {Array} Downloadable blocks. */ function getDownloadableBlocks(state, filterValue) { var _state$downloadableBl2; return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : []; } /** * Returns the block types that have been installed on the server in this * session. * * @param {Object} state Global application state. * * @return {Array} Block type items */ function getInstalledBlockTypes(state) { return state.blockManagement.installedBlockTypes; } /** * Returns block types that have been installed on the server and used in the * current post. * * @param {Object} state Global application state. * * @return {Array} Block type items. */ const getNewBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); const installedBlockTypes = getInstalledBlockTypes(state); return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree)); }, state => [getInstalledBlockTypes(state), select(external_wp_blockEditor_namespaceObject.store).getBlocks()])); /** * Returns the block types that have been installed on the server but are not * used in the current post. * * @param {Object} state Global application state. * * @return {Array} Block type items. */ const getUnusedBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); const installedBlockTypes = getInstalledBlockTypes(state); return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree)); }, state => [getInstalledBlockTypes(state), select(external_wp_blockEditor_namespaceObject.store).getBlocks()])); /** * Returns true if a block plugin install is in progress. * * @param {Object} state Global application state. * @param {string} blockId Id of the block. * * @return {boolean} Whether this block is currently being installed. */ function isInstalling(state, blockId) { return state.blockManagement.isInstalling[blockId] || false; } /** * Returns all block error notices. * * @param {Object} state Global application state. * * @return {Object} Object with error notices. */ function getErrorNotices(state) { return state.errorNotices; } /** * Returns the error notice for a given block. * * @param {Object} state Global application state. * @param {string} blockId The ID of the block plugin. eg: my-block * * @return {string|boolean} The error text, or false if no error. */ function getErrorNoticeForBlock(state, blockId) { return state.errorNotices[blockId]; } ;// CONCATENATED MODULE: external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// CONCATENATED MODULE: external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// CONCATENATED MODULE: external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// CONCATENATED MODULE: external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js /** * WordPress dependencies */ /** * Load an asset for a block. * * This function returns a Promise that will resolve once the asset is loaded, * or in the case of Stylesheets and Inline JavaScript, will resolve immediately. * * @param {HTMLElement} el A HTML Element asset to inject. * * @return {Promise} Promise which will resolve when the asset is loaded. */ const loadAsset = el => { return new Promise((resolve, reject) => { /* * Reconstruct the passed element, this is required as inserting the Node directly * won't always fire the required onload events, even if the asset wasn't already loaded. */ const newNode = document.createElement(el.nodeName); ['id', 'rel', 'src', 'href', 'type'].forEach(attr => { if (el[attr]) { newNode[attr] = el[attr]; } }); // Append inline