@wordpress/block-editor 15.15.0 → 15.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-inspector/index.cjs +2 -1
  3. package/build/components/block-inspector/index.cjs.map +2 -2
  4. package/build/components/block-visibility/modal.cjs +2 -2
  5. package/build/components/block-visibility/modal.cjs.map +1 -1
  6. package/build/components/block-visibility/viewport-visibility-info.cjs +6 -1
  7. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  8. package/build/components/global-styles/background-panel.cjs +142 -33
  9. package/build/components/global-styles/background-panel.cjs.map +2 -2
  10. package/build/components/global-styles/color-panel.cjs +18 -7
  11. package/build/components/global-styles/color-panel.cjs.map +2 -2
  12. package/build/components/global-styles/hooks.cjs +8 -4
  13. package/build/components/global-styles/hooks.cjs.map +2 -2
  14. package/build/components/inspector-controls-tabs/styles-tab.cjs +2 -1
  15. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  16. package/build/hooks/background.cjs +74 -21
  17. package/build/hooks/background.cjs.map +3 -3
  18. package/build/hooks/cross-origin-isolation.cjs +6 -6
  19. package/build/hooks/cross-origin-isolation.cjs.map +2 -2
  20. package/build/hooks/custom-css.cjs +5 -0
  21. package/build/hooks/custom-css.cjs.map +2 -2
  22. package/build/hooks/fit-text.cjs +46 -58
  23. package/build/hooks/fit-text.cjs.map +3 -3
  24. package/build/hooks/utils.cjs +5 -1
  25. package/build/hooks/utils.cjs.map +2 -2
  26. package/build/store/actions.cjs +8 -4
  27. package/build/store/actions.cjs.map +2 -2
  28. package/build/store/private-selectors.cjs +2 -2
  29. package/build/store/private-selectors.cjs.map +2 -2
  30. package/build/store/reducer.cjs +62 -95
  31. package/build/store/reducer.cjs.map +2 -2
  32. package/build/store/selectors.cjs +2 -2
  33. package/build/store/selectors.cjs.map +2 -2
  34. package/build-module/components/block-inspector/index.mjs +2 -1
  35. package/build-module/components/block-inspector/index.mjs.map +2 -2
  36. package/build-module/components/block-visibility/modal.mjs +2 -2
  37. package/build-module/components/block-visibility/modal.mjs.map +1 -1
  38. package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -1
  39. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  40. package/build-module/components/global-styles/background-panel.mjs +141 -34
  41. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  42. package/build-module/components/global-styles/color-panel.mjs +17 -7
  43. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  44. package/build-module/components/global-styles/hooks.mjs +8 -4
  45. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  46. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +2 -1
  47. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  48. package/build-module/hooks/background.mjs +76 -22
  49. package/build-module/hooks/background.mjs.map +2 -2
  50. package/build-module/hooks/cross-origin-isolation.mjs +6 -6
  51. package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
  52. package/build-module/hooks/custom-css.mjs +5 -0
  53. package/build-module/hooks/custom-css.mjs.map +2 -2
  54. package/build-module/hooks/fit-text.mjs +46 -58
  55. package/build-module/hooks/fit-text.mjs.map +2 -2
  56. package/build-module/hooks/utils.mjs +5 -1
  57. package/build-module/hooks/utils.mjs.map +2 -2
  58. package/build-module/store/actions.mjs +8 -4
  59. package/build-module/store/actions.mjs.map +2 -2
  60. package/build-module/store/private-selectors.mjs +2 -2
  61. package/build-module/store/private-selectors.mjs.map +2 -2
  62. package/build-module/store/reducer.mjs +62 -94
  63. package/build-module/store/reducer.mjs.map +2 -2
  64. package/build-module/store/selectors.mjs +2 -2
  65. package/build-module/store/selectors.mjs.map +2 -2
  66. package/build-style/content-rtl.css +2 -2
  67. package/build-style/content.css +2 -2
  68. package/build-style/style-rtl.css +35 -7
  69. package/build-style/style.css +35 -7
  70. package/package.json +39 -39
  71. package/src/components/background-image-control/style.scss +0 -4
  72. package/src/components/block-inspector/index.js +1 -0
  73. package/src/components/block-visibility/viewport-visibility-info.js +8 -1
  74. package/src/components/fit-text-size-warning/style.scss +1 -5
  75. package/src/components/global-styles/background-panel.js +157 -11
  76. package/src/components/global-styles/color-panel.js +23 -7
  77. package/src/components/global-styles/hooks.js +12 -4
  78. package/src/components/global-styles/test/background-panel.js +44 -1
  79. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  80. package/src/hooks/background.js +122 -21
  81. package/src/hooks/background.scss +45 -0
  82. package/src/hooks/cross-origin-isolation.js +6 -6
  83. package/src/hooks/custom-css.js +6 -0
  84. package/src/hooks/fit-text.js +73 -83
  85. package/src/hooks/test/cross-origin-isolation.js +7 -3
  86. package/src/hooks/utils.js +4 -0
  87. package/src/store/actions.js +9 -8
  88. package/src/store/private-selectors.js +2 -2
  89. package/src/store/reducer.js +84 -128
  90. package/src/store/selectors.js +2 -2
  91. package/src/store/test/private-selectors.js +67 -34
  92. package/src/store/test/reducer.js +436 -66
  93. package/src/store/test/selectors.js +81 -63
  94. package/src/style.scss +1 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/private-selectors.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\thasBlockSupport,\n\tprivateApis as blocksPrivateApis,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n\tgetSettings,\n\tcanInsertBlockType,\n\tgetBlockName,\n\tgetTemplateLock,\n\tgetClientIdsWithDescendants,\n\tgetBlockRootClientId,\n\tgetBlockAttributes,\n} from './selectors';\nimport {\n\tcheckAllowListRecursive,\n\tgetAllPatternsDependants,\n\tgetInsertBlockTypeDependants,\n\tgetGrammar,\n\tmapUserPattern,\n} from './utils';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n\tisIsolatedEditorKey,\n} from './private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\nconst { isContentBlock } = unlock( blocksPrivateApis );\n\nexport { getBlockSettings } from './get-block-settings';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\nexport function getBlockWithoutAttributes( state, clientId ) {\n\treturn state.blocks.byClientId.get( clientId );\n}\n\n/**\n * Returns true if all of the descendants of a block with the given client ID\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = ( state, clientId ) => {\n\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, childClientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\tisChildSubtreeDisabled\n\t\t\t)\n\t\t);\n\t};\n\treturn getBlockOrder( state, clientId ).every( isChildSubtreeDisabled );\n};\n\n/**\n * Determines if a container (clientId) allows insertion of blocks, considering contentOnly mode restrictions.\n *\n * @param {Object} state Editor state.\n * @param {string} blockName The block name to insert.\n * @param {string} rootClientId The client ID of the root container block.\n * @return {boolean} Whether the container allows insertion.\n */\nexport function isContainerInsertableToInContentOnlyMode(\n\tstate,\n\tblockName,\n\trootClientId\n) {\n\tconst isBlockContentBlock = isContentBlock( blockName );\n\tconst rootBlockName = getBlockName( state, rootClientId );\n\tconst isContainerContentBlock = isContentBlock( rootBlockName );\n\tconst isRootBlockMain = getSectionRootClientId( state ) === rootClientId;\n\n\t// In contentOnly mode, containers shouldn't be inserted into unless:\n\t// 1. they are a section root;\n\t// 2. they are a content block and the block to be inserted is also content.\n\treturn (\n\t\tisRootBlockMain || ( isContainerContentBlock && isBlockContentBlock )\n\t);\n}\n\nfunction getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {\n\tconst blockOrder = getBlockOrder( state, rootClientId );\n\tconst result = [];\n\n\tfor ( const clientId of blockOrder ) {\n\t\tconst innerBlocks = getEnabledClientIdsTreeUnmemoized(\n\t\t\tstate,\n\t\t\tclientId\n\t\t);\n\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\tresult.push( { clientId, innerBlocks } );\n\t\t} else {\n\t\t\tresult.push( ...innerBlocks );\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createRegistrySelector( () =>\n\tcreateSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.derivedBlockEditingModes,\n\t\tstate.blockEditingModes,\n\t] )\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * Overrides are sorted to match the order of the blocks they relate to. This\n * is useful to maintain correct CSS cascade order.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} An array of style ID to style override pairs.\n */\nexport const getStyleOverrides = createSelector(\n\t( state ) => {\n\t\tconst clientIds = getClientIdsWithDescendants( state );\n\t\tconst clientIdMap = clientIds.reduce( ( acc, clientId, index ) => {\n\t\t\tacc[ clientId ] = index;\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\treturn [ ...state.styleOverrides ].sort( ( overrideA, overrideB ) => {\n\t\t\t// Once the overrides Map is spread to an array, the first element\n\t\t\t// is the key, while the second is the override itself including\n\t\t\t// the clientId to sort by.\n\t\t\tconst [ , { clientId: clientIdA } ] = overrideA;\n\t\t\tconst [ , { clientId: clientIdB } ] = overrideB;\n\n\t\t\tconst aIndex = clientIdMap[ clientIdA ] ?? -1;\n\t\t\tconst bIndex = clientIdMap[ clientIdB ] ?? -1;\n\n\t\t\treturn aIndex - bIndex;\n\t\t} );\n\t},\n\t( state ) => [ state.blocks.order, state.styleOverrides ]\n);\n\n/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */\n/**\n * Returns the registered inserter media categories through the public API.\n *\n * @param {Object} state Editor state.\n *\n * @return {InserterMediaCategory[]} Inserter media categories.\n */\nexport function getRegisteredInserterMediaCategories( state ) {\n\treturn state.registeredInserterMediaCategories;\n}\n\n/**\n * Returns an array containing the allowed inserter media categories.\n * It merges the registered media categories from extenders with the\n * core ones. It also takes into account the allowed `mime_types`, which\n * can be altered by `upload_mimes` filter and restrict some of them.\n *\n * @param {Object} state Global application state.\n *\n * @return {InserterMediaCategory[]} Client IDs of descendants.\n */\nexport const getInserterMediaCategories = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tsettings: {\n\t\t\t\tinserterMediaCategories,\n\t\t\t\tallowedMimeTypes,\n\t\t\t\tenableOpenverseMediaCategory,\n\t\t\t},\n\t\t\tregisteredInserterMediaCategories,\n\t\t} = state;\n\t\t// The allowed `mime_types` can be altered by `upload_mimes` filter and restrict\n\t\t// some of them. In this case we shouldn't add the category to the available media\n\t\t// categories list in the inserter.\n\t\tif (\n\t\t\t( ! inserterMediaCategories &&\n\t\t\t\t! registeredInserterMediaCategories.length ) ||\n\t\t\t! allowedMimeTypes\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst coreInserterMediaCategoriesNames =\n\t\t\tinserterMediaCategories?.map( ( { name } ) => name ) || [];\n\t\tconst mergedCategories = [\n\t\t\t...( inserterMediaCategories || [] ),\n\t\t\t...( registeredInserterMediaCategories || [] ).filter(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\t! coreInserterMediaCategoriesNames.includes( name )\n\t\t\t),\n\t\t];\n\t\treturn mergedCategories.filter( ( category ) => {\n\t\t\t// Check if Openverse category is enabled.\n\t\t\tif (\n\t\t\t\t! enableOpenverseMediaCategory &&\n\t\t\t\tcategory.name === 'openverse'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn Object.values( allowedMimeTypes ).some( ( mimeType ) =>\n\t\t\t\tmimeType.startsWith( `${ category.mediaType }/` )\n\t\t\t);\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.settings.inserterMediaCategories,\n\t\tstate.settings.allowedMimeTypes,\n\t\tstate.settings.enableOpenverseMediaCategory,\n\t\tstate.registeredInserterMediaCategories,\n\t]\n);\n\n/**\n * Returns whether there is at least one allowed pattern for inner blocks children.\n * This is useful for deferring the parsing of all patterns until needed.\n *\n * @param {Object} state Editor state.\n * @param {string} [rootClientId=null] Target root client ID.\n *\n * @return {boolean} If there is at least one allowed pattern.\n */\nexport const hasAllowedPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, rootClientId = null ) => {\n\t\t\tconst { getAllPatterns } = unlock( select( STORE_NAME ) );\n\t\t\tconst patterns = getAllPatterns();\n\t\t\tconst { allowedBlockTypes } = getSettings( state );\n\t\t\treturn patterns.some( ( pattern ) => {\n\t\t\t\tconst { inserter = true } = pattern;\n\t\t\t\tif ( ! inserter ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst grammar = getGrammar( pattern );\n\t\t\t\treturn (\n\t\t\t\t\tcheckAllowListRecursive( grammar, allowedBlockTypes ) &&\n\t\t\t\t\tgrammar.every( ( { name: blockName } ) =>\n\t\t\t\t\t\tcanInsertBlockType( state, blockName, rootClientId )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t( state, rootClientId ) => [\n\t\t\t...getAllPatternsDependants( select )( state ),\n\t\t\t...getInsertBlockTypeDependants( select )( state, rootClientId ),\n\t\t]\n\t)\n);\n\nexport const getPatternBySlug = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, patternName ) => {\n\t\t\t// Only fetch reusable blocks if we know we need them. To do: maybe\n\t\t\t// use the entity record API to retrieve the block by slug.\n\t\t\tif ( patternName?.startsWith( 'core/block/' ) ) {\n\t\t\t\tconst _id = parseInt(\n\t\t\t\t\tpatternName.slice( 'core/block/'.length ),\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst block = unlock( select( STORE_NAME ) )\n\t\t\t\t\t.getReusableBlocks()\n\t\t\t\t\t.find( ( { id } ) => id === _id );\n\n\t\t\t\tif ( ! block ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn mapUserPattern(\n\t\t\t\t\tblock,\n\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t// This setting is left for back compat.\n\t\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ??\n\t\t\t\t\t[] ),\n\t\t\t].find( ( { name } ) => name === patternName );\n\t\t},\n\t\t( state, patternName ) =>\n\t\t\tpatternName?.startsWith( 'core/block/' )\n\t\t\t\t? [\n\t\t\t\t\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t\t\t\t\t\tstate.settings.__experimentalReusableBlocks,\n\t\t\t\t ]\n\t\t\t\t: [\n\t\t\t\t\t\tstate.settings.__experimentalBlockPatterns,\n\t\t\t\t\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\t\t\t ]\n\t)\n);\n\nexport const getAllPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector( ( state ) => {\n\t\treturn [\n\t\t\t...unlock( select( STORE_NAME ) )\n\t\t\t\t.getReusableBlocks()\n\t\t\t\t.map( ( userPattern ) =>\n\t\t\t\t\tmapUserPattern(\n\t\t\t\t\t\tuserPattern,\n\t\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t// This setting is left for back compat.\n\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ?? [] ),\n\t\t].filter(\n\t\t\t( x, index, arr ) =>\n\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t);\n\t}, getAllPatternsDependants( select ) )\n);\n\nconst EMPTY_ARRAY = [];\n\nexport const getReusableBlocks = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];\n\t\treturn (\n\t\t\t( reusableBlocksSelect\n\t\t\t\t? reusableBlocksSelect( select )\n\t\t\t\t: state.settings.__experimentalReusableBlocks ) ?? EMPTY_ARRAY\n\t\t);\n\t}\n);\n\n/**\n * Returns the element of the last element that had focus when focus left the editor canvas.\n *\n * @param {Object} state Block editor state.\n *\n * @return {Object} Element.\n */\nexport function getLastFocus( state ) {\n\treturn state.lastFocus;\n}\n\n/**\n * Returns true if the user is dragging anything, or false otherwise. It is possible for a\n * user to be dragging data from outside of the editor, so this selector is separate from\n * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether user is dragging.\n */\nexport function isDragging( state ) {\n\treturn state.isDragging;\n}\n\n/**\n * Retrieves the expanded block from the state.\n *\n * @param {Object} state Block editor state.\n *\n * @return {string|null} The client ID of the expanded block, if set.\n */\nexport function getExpandedBlock( state ) {\n\treturn state.expandedBlock;\n}\n\n/**\n * Retrieves the client ID of the ancestor block that is content locking the block\n * with the provided client ID.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getContentLockingParent = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( getTemplateLock( state, current ) === 'contentOnly' ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Checks whether a block meets the raw criteria to be a section block,\n * without considering contextual factors like nesting or the edited\n * content-only section. Used internally by `isSectionBlock` and\n * `getParentSectionBlock` to avoid circular calls between them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a candidate section block.\n */\nfunction isSectionBlockCandidate( state, clientId ) {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( blockName === 'core/block' ) {\n\t\treturn true;\n\t}\n\n\tconst attributes = getBlockAttributes( state, clientId );\n\tconst isTemplatePart = blockName === 'core/template-part';\n\n\t// When in an isolated editing context (e.g., editing a template part or pattern directly),\n\t// don't treat nested unsynced patterns as section blocks.\n\tconst isIsolatedEditor = state.settings?.[ isIsolatedEditorKey ];\n\n\tconst disableContentOnlyForUnsyncedPatterns =\n\t\tstate.settings?.disableContentOnlyForUnsyncedPatterns;\n\n\tconst disableContentOnlyForTemplateParts =\n\t\tstate.settings?.disableContentOnlyForTemplateParts;\n\n\tif (\n\t\t( ( ! disableContentOnlyForUnsyncedPatterns &&\n\t\t\tattributes?.metadata?.patternName ) ||\n\t\t\t( isTemplatePart && ! disableContentOnlyForTemplateParts ) ) &&\n\t\t! isIsolatedEditor\n\t) {\n\t\treturn true;\n\t}\n\n\t// TemplateLock cascades to all inner parent blocks. Only the top-level\n\t// block that's contentOnly templateLocked is the true contentLocker,\n\t// all the others are mere imitators.\n\tconst hasContentOnlyTemplateLock =\n\t\tgetTemplateLock( state, clientId ) === 'contentOnly';\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst hasRootContentOnlyTemplateLock =\n\t\tgetTemplateLock( state, rootClientId ) === 'contentOnly';\n\tif ( hasContentOnlyTemplateLock && ! hasRootContentOnlyTemplateLock ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Retrieves the client ID of the parent section block.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is a contentOnly section.\n */\nexport const getParentSectionBlock = ( state, clientId ) => {\n\t// If this block is within the edited content-only section,\n\t// it has no parent section \u2014 it's temporarily fully editable.\n\tif ( isWithinEditedContentOnlySection( state, clientId ) ) {\n\t\treturn undefined;\n\t}\n\n\tlet current = clientId;\n\tlet result;\n\n\t// If sections are nested, return the top level section block.\n\t// Don't return early.\n\twhile ( ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( isSectionBlockCandidate( state, current ) ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Returns whether the block is a contentOnly section.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a contentOnly section.\n */\nexport function isSectionBlock( state, clientId ) {\n\t// isWithinEditedContentOnlySection -\n\t// If the section is being edited or a parent section is being edited,\n\t// this block is temporarily not considered a section.\n\t//\n\t// getParentSectionBlock -\n\t// Only the top level section is considered the section,\n\t// a nested section is managed by its parent section.\n\tif (\n\t\tisWithinEditedContentOnlySection( state, clientId ) ||\n\t\tgetParentSectionBlock( state, clientId )\n\t) {\n\t\treturn false;\n\t}\n\n\treturn isSectionBlockCandidate( state, clientId );\n}\n\n/**\n * Retrieves the client ID of the block that is a contentOnly section but is\n * currently being temporarily edited (contentOnly is deactivated).\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The client ID of the block being temporarily edited.\n */\nexport function getEditedContentOnlySection( state ) {\n\treturn state.editedContentOnlySection;\n}\n\nexport function isWithinEditedContentOnlySection( state, clientId ) {\n\tif ( ! state.editedContentOnlySection ) {\n\t\treturn false;\n\t}\n\n\tif ( state.editedContentOnlySection === clientId ) {\n\t\treturn true;\n\t}\n\n\tlet current = clientId;\n\twhile ( ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( state.editedContentOnlySection === current ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Returns the style attributes of multiple blocks.\n *\n * @param {Object} state Global application state.\n * @param {string[]} clientIds An array of block client IDs.\n *\n * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined.\n */\nexport const getBlockStyles = createSelector(\n\t( state, clientIds ) =>\n\t\tclientIds.reduce( ( styles, clientId ) => {\n\t\t\tstyles[ clientId ] = state.blocks.attributes.get( clientId )?.style;\n\t\t\treturn styles;\n\t\t}, {} ),\n\t( state, clientIds ) => [\n\t\t...clientIds.map(\n\t\t\t( clientId ) => state.blocks.attributes.get( clientId )?.style\n\t\t),\n\t]\n);\n\n/**\n * Retrieves the client ID of the block which contains the blocks\n * acting as \"sections\" in the editor. This is typically the \"main content\"\n * of the template/post.\n *\n * @param {Object} state Editor state.\n *\n * @return {string|undefined} The section root client ID or undefined if not set.\n */\nexport function getSectionRootClientId( state ) {\n\treturn state.settings?.[ sectionRootClientIdKey ];\n}\n\n/**\n * Returns whether the editor is considered zoomed out.\n *\n * @param {Object} state Global application state.\n * @return {boolean} Whether the editor is zoomed.\n */\nexport function isZoomOut( state ) {\n\treturn state.zoomLevel === 'auto-scaled' || state.zoomLevel < 100;\n}\n\n/**\n * Returns whether the zoom level.\n *\n * @param {Object} state Global application state.\n * @return {number|\"auto-scaled\"} Zoom level.\n */\nexport function getZoomLevel( state ) {\n\treturn state.zoomLevel;\n}\n\n/**\n * Finds the closest block where the block is allowed to be inserted.\n *\n * @param {Object} state Editor state.\n * @param {string[] | string} name Block name or names.\n * @param {string} clientId Default insertion point.\n *\n * @return {string} clientID of the closest container when the block name can be inserted.\n */\nexport function getClosestAllowedInsertionPoint( state, name, clientId = '' ) {\n\tconst blockNames = Array.isArray( name ) ? name : [ name ];\n\tconst areBlockNamesAllowedInClientId = ( id ) =>\n\t\tblockNames.every( ( currentName ) =>\n\t\t\tcanInsertBlockType( state, currentName, id )\n\t\t);\n\n\t// If we're trying to insert at the root level and it's not allowed\n\t// Try the section root instead.\n\tif ( ! clientId ) {\n\t\tif ( areBlockNamesAllowedInClientId( clientId ) ) {\n\t\t\treturn clientId;\n\t\t}\n\n\t\tconst sectionRootClientId = getSectionRootClientId( state );\n\t\tif (\n\t\t\tsectionRootClientId &&\n\t\t\tareBlockNamesAllowedInClientId( sectionRootClientId )\n\t\t) {\n\t\t\treturn sectionRootClientId;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Traverse the block tree up until we find a place where we can insert.\n\tlet current = clientId;\n\twhile ( current !== null && ! areBlockNamesAllowedInClientId( current ) ) {\n\t\tconst parentClientId = getBlockRootClientId( state, current );\n\t\tcurrent = parentClientId;\n\t}\n\n\treturn current;\n}\n\nexport function getClosestAllowedInsertionPointForPattern(\n\tstate,\n\tpattern,\n\tclientId\n) {\n\tconst { allowedBlockTypes } = getSettings( state );\n\tconst isAllowed = checkAllowListRecursive(\n\t\tgetGrammar( pattern ),\n\t\tallowedBlockTypes\n\t);\n\tif ( ! isAllowed ) {\n\t\treturn null;\n\t}\n\tconst names = getGrammar( pattern ).map( ( { blockName: name } ) => name );\n\treturn getClosestAllowedInsertionPoint( state, names, clientId );\n}\n\n/**\n * Where the point where the next block will be inserted into.\n *\n * @param {Object} state\n * @return {Object} where the insertion point in the block editor is or null if none is set.\n */\nexport function getInsertionPoint( state ) {\n\treturn state.insertionPoint;\n}\n\n/**\n * Returns true if the block is hidden anywhere, or false otherwise.\n *\n * This selector checks whether a block has visibility metadata set that would\n * hide it at any viewport or everywhere. It's useful for flagging blocks that\n * have visibility restrictions.\n *\n * A block is considered hidden anywhere if:\n * - blockVisibility is false (hidden everywhere)\n * - blockVisibility.viewport has any viewport set to false (hidden at specific screen sizes)\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the block is hidden anywhere.\n */\nexport const isBlockHiddenAnywhere = ( state, clientId ) => {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( ! hasBlockSupport( blockName, 'visibility', true ) ) {\n\t\treturn false;\n\t}\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibility = attributes?.metadata?.blockVisibility;\n\n\tif ( blockVisibility === false ) {\n\t\treturn true;\n\t}\n\n\tif (\n\t\ttypeof blockVisibility?.viewport === 'object' &&\n\t\tblockVisibility?.viewport !== null\n\t) {\n\t\t// Check if the block is hidden at any viewport.\n\t\treturn Object.values( BLOCK_VISIBILITY_VIEWPORTS ).some(\n\t\t\t( viewport ) =>\n\t\t\t\tblockVisibility?.viewport?.[ viewport.key ] === false\n\t\t);\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if the block is hidden everywhere (blockVisibility is false).\n *\n * A block is considered hidden everywhere when blockVisibility is explicitly\n * set to false, which means it's hidden on all viewports.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the block is hidden everywhere.\n */\nexport const isBlockHiddenEverywhere = ( state, clientId ) => {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( ! hasBlockSupport( blockName, 'visibility', true ) ) {\n\t\treturn false;\n\t}\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibility = attributes?.metadata?.blockVisibility;\n\n\tif ( blockVisibility === false ) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if any parent block (immediate or further up the chain) is hidden everywhere.\n *\n * Checks all parent blocks in the hierarchy and returns true if any of them\n * is hidden everywhere.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether any parent block is hidden everywhere.\n */\nexport const isBlockParentHiddenEverywhere = ( state, clientId ) => {\n\tconst parents = getBlockParents( state, clientId );\n\treturn parents.some( ( parentId ) =>\n\t\tisBlockHiddenEverywhere( state, parentId )\n\t);\n};\n\n/**\n * Returns true if the block is hidden at the given viewport.\n *\n * A block is considered hidden at a viewport if:\n * - blockVisibility is false (hidden everywhere)\n * - blockVisibility is an object with the specified viewport set to false\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').\n *\n * @return {boolean} Whether the block is hidden at the viewport.\n */\nexport const isBlockHiddenAtViewport = ( state, clientId, viewport ) => {\n\tif ( isBlockHiddenEverywhere( state, clientId ) ) {\n\t\treturn true;\n\t}\n\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibilityViewport =\n\t\tattributes?.metadata?.blockVisibility?.viewport;\n\tif (\n\t\ttypeof blockVisibilityViewport === 'object' &&\n\t\tblockVisibilityViewport !== null &&\n\t\ttypeof viewport === 'string'\n\t) {\n\t\treturn blockVisibilityViewport?.[ viewport.toLowerCase() ] === false;\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if any parent block (immediate or further up the chain) is hidden at the given viewport.\n *\n * Checks all parent blocks in the hierarchy and returns true if any of them\n * is hidden at the specified viewport.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').\n *\n * @return {boolean} Whether any parent block is hidden at the viewport.\n */\nexport const isBlockParentHiddenAtViewport = ( state, clientId, viewport ) => {\n\tconst parents = getBlockParents( state, clientId );\n\treturn parents.some( ( parentId ) =>\n\t\tisBlockHiddenAtViewport( state, parentId, viewport )\n\t);\n};\n\n/**\n * Returns true if there is a spotlighted block.\n *\n * The spotlight is also active when a contentOnly section is being edited, the selector\n * also returns true if this is the case.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block is currently spotlighted.\n */\nexport function hasBlockSpotlight( state ) {\n\treturn !! state.hasBlockSpotlight || !! state.editedContentOnlySection;\n}\n\n/**\n * Returns whether a block is locked to prevent editing.\n *\n * This selector only reasons about block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n * Currently there's also no way to prevent editing via `templateLock`.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` aren't included as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isEditLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\treturn !! attributes?.lock?.edit;\n}\n\n/**\n * Returns whether a block is locked to prevent moving.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isMoveLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\t// If a block explicitly has `move` set to `false`, it turns off\n\t// any locking that might be inherited from a parent.\n\tif ( attributes?.lock?.move !== undefined ) {\n\t\treturn !! attributes?.lock?.move;\n\t}\n\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\n\t// While `contentOnly` templateLock does sometimes prevent moving, a user can't modify\n\t// this, so don't include it in this function. See the `canMoveBlock` selector\n\t// as an alternative.\n\treturn templateLock === 'all';\n}\n\n/**\n * Returns whether a block is locked to prevent removal.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isRemoveLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\tif ( attributes?.lock?.remove !== undefined ) {\n\t\treturn !! attributes?.lock?.remove;\n\t}\n\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\n\t// While `contentOnly` templateLock does sometimes prevent removal, a user can't modify\n\t// this, so don't include it in this function. See the `canRemoveBlock` selector\n\t// as an alternative.\n\treturn templateLock === 'all' || templateLock === 'insert';\n}\n\n/**\n * Returns whether a block is locked.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isLockedBlock( state, clientId ) {\n\treturn (\n\t\tisEditLockedBlock( state, clientId ) ||\n\t\tisMoveLockedBlock( state, clientId ) ||\n\t\tisRemoveLockedBlock( state, clientId )\n\t);\n}\n\n/**\n * Returns whether the list view content panel popover is open.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the popover is open.\n */\nexport function isListViewContentPanelOpen( state ) {\n\treturn state.listViewContentPanelOpen;\n}\n\n/**\n * Returns whether a List View panel is opened.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the panel is opened.\n */\nexport function isListViewPanelOpened( state, clientId ) {\n\t// If allOpen flag is set, all panels are open\n\tif ( state.openedListViewPanels?.allOpen ) {\n\t\treturn true;\n\t}\n\treturn state.openedListViewPanels?.panels?.[ clientId ] === true;\n}\n\n/**\n * Returns the List View expand revision number.\n *\n * This counter is used in the ListView component's key prop to force remounting.\n *\n * @param {Object} state Global application state.\n *\n * @return {number} The expand revision number.\n */\nexport function getListViewExpandRevision( state ) {\n\treturn state.listViewExpandRevision || 0;\n}\n\n/**\n * Returns the client IDs for the viewport modal, or null if\n * the modal is not open.\n *\n * @param {Object} state Global application state.\n *\n * @return {string[]|null} Client IDs for the visibility modal, or null.\n */\nexport function getViewportModalClientIds( state ) {\n\treturn state.viewportModalClientIds;\n}\n\n/**\n * Returns the requested inspector tab state, if any.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|null} The requested tab state with tabName and options, or null if no request is pending.\n */\nexport function getRequestedInspectorTab( state ) {\n\treturn state.requestedInspectorTab;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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R;AACA,SAAO,MAAM,sBAAsB,SAAU,QAAS,MAAM;AAC7D;AAWO,SAAS,0BAA2B,OAAQ;AAClD,SAAO,MAAM,0BAA0B;AACxC;AAUO,SAAS,0BAA2B,OAAQ;AAClD,SAAO,MAAM;AACd;AASO,SAAS,yBAA0B,OAAQ;AACjD,SAAO,MAAM;AACd;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\thasBlockSupport,\n\tprivateApis as blocksPrivateApis,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n\tgetSettings,\n\tcanInsertBlockType,\n\tgetBlockName,\n\tgetTemplateLock,\n\tgetClientIdsWithDescendants,\n\tgetBlockRootClientId,\n\tgetBlockAttributes,\n} from './selectors';\nimport {\n\tcheckAllowListRecursive,\n\tgetAllPatternsDependants,\n\tgetInsertBlockTypeDependants,\n\tgetGrammar,\n\tmapUserPattern,\n} from './utils';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n\tisIsolatedEditorKey,\n} from './private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\nconst { isContentBlock } = unlock( blocksPrivateApis );\n\nexport { getBlockSettings } from './get-block-settings';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\nexport function getBlockWithoutAttributes( state, clientId ) {\n\treturn state.blocks.byClientId.get( clientId );\n}\n\n/**\n * Returns true if all of the descendants of a block with the given client ID\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = ( state, clientId ) => {\n\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, childClientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\tisChildSubtreeDisabled\n\t\t\t)\n\t\t);\n\t};\n\treturn getBlockOrder( state, clientId ).every( isChildSubtreeDisabled );\n};\n\n/**\n * Determines if a container (clientId) allows insertion of blocks, considering contentOnly mode restrictions.\n *\n * @param {Object} state Editor state.\n * @param {string} blockName The block name to insert.\n * @param {string} rootClientId The client ID of the root container block.\n * @return {boolean} Whether the container allows insertion.\n */\nexport function isContainerInsertableToInContentOnlyMode(\n\tstate,\n\tblockName,\n\trootClientId\n) {\n\tconst isBlockContentBlock = isContentBlock( blockName );\n\tconst rootBlockName = getBlockName( state, rootClientId );\n\tconst isContainerContentBlock = isContentBlock( rootBlockName );\n\tconst isRootBlockMain = getSectionRootClientId( state ) === rootClientId;\n\n\t// In contentOnly mode, containers shouldn't be inserted into unless:\n\t// 1. they are a section root;\n\t// 2. they are a content block and the block to be inserted is also content.\n\treturn (\n\t\tisRootBlockMain || ( isContainerContentBlock && isBlockContentBlock )\n\t);\n}\n\nfunction getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {\n\tconst blockOrder = getBlockOrder( state, rootClientId );\n\tconst result = [];\n\n\tfor ( const clientId of blockOrder ) {\n\t\tconst innerBlocks = getEnabledClientIdsTreeUnmemoized(\n\t\t\tstate,\n\t\t\tclientId\n\t\t);\n\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\tresult.push( { clientId, innerBlocks } );\n\t\t} else {\n\t\t\tresult.push( ...innerBlocks );\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createRegistrySelector( () =>\n\tcreateSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.derivedBlockEditingModes,\n\t\tstate.blocks.blockEditingModes,\n\t] )\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blocks.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * Overrides are sorted to match the order of the blocks they relate to. This\n * is useful to maintain correct CSS cascade order.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} An array of style ID to style override pairs.\n */\nexport const getStyleOverrides = createSelector(\n\t( state ) => {\n\t\tconst clientIds = getClientIdsWithDescendants( state );\n\t\tconst clientIdMap = clientIds.reduce( ( acc, clientId, index ) => {\n\t\t\tacc[ clientId ] = index;\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\treturn [ ...state.styleOverrides ].sort( ( overrideA, overrideB ) => {\n\t\t\t// Once the overrides Map is spread to an array, the first element\n\t\t\t// is the key, while the second is the override itself including\n\t\t\t// the clientId to sort by.\n\t\t\tconst [ , { clientId: clientIdA } ] = overrideA;\n\t\t\tconst [ , { clientId: clientIdB } ] = overrideB;\n\n\t\t\tconst aIndex = clientIdMap[ clientIdA ] ?? -1;\n\t\t\tconst bIndex = clientIdMap[ clientIdB ] ?? -1;\n\n\t\t\treturn aIndex - bIndex;\n\t\t} );\n\t},\n\t( state ) => [ state.blocks.order, state.styleOverrides ]\n);\n\n/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */\n/**\n * Returns the registered inserter media categories through the public API.\n *\n * @param {Object} state Editor state.\n *\n * @return {InserterMediaCategory[]} Inserter media categories.\n */\nexport function getRegisteredInserterMediaCategories( state ) {\n\treturn state.registeredInserterMediaCategories;\n}\n\n/**\n * Returns an array containing the allowed inserter media categories.\n * It merges the registered media categories from extenders with the\n * core ones. It also takes into account the allowed `mime_types`, which\n * can be altered by `upload_mimes` filter and restrict some of them.\n *\n * @param {Object} state Global application state.\n *\n * @return {InserterMediaCategory[]} Client IDs of descendants.\n */\nexport const getInserterMediaCategories = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tsettings: {\n\t\t\t\tinserterMediaCategories,\n\t\t\t\tallowedMimeTypes,\n\t\t\t\tenableOpenverseMediaCategory,\n\t\t\t},\n\t\t\tregisteredInserterMediaCategories,\n\t\t} = state;\n\t\t// The allowed `mime_types` can be altered by `upload_mimes` filter and restrict\n\t\t// some of them. In this case we shouldn't add the category to the available media\n\t\t// categories list in the inserter.\n\t\tif (\n\t\t\t( ! inserterMediaCategories &&\n\t\t\t\t! registeredInserterMediaCategories.length ) ||\n\t\t\t! allowedMimeTypes\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst coreInserterMediaCategoriesNames =\n\t\t\tinserterMediaCategories?.map( ( { name } ) => name ) || [];\n\t\tconst mergedCategories = [\n\t\t\t...( inserterMediaCategories || [] ),\n\t\t\t...( registeredInserterMediaCategories || [] ).filter(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\t! coreInserterMediaCategoriesNames.includes( name )\n\t\t\t),\n\t\t];\n\t\treturn mergedCategories.filter( ( category ) => {\n\t\t\t// Check if Openverse category is enabled.\n\t\t\tif (\n\t\t\t\t! enableOpenverseMediaCategory &&\n\t\t\t\tcategory.name === 'openverse'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn Object.values( allowedMimeTypes ).some( ( mimeType ) =>\n\t\t\t\tmimeType.startsWith( `${ category.mediaType }/` )\n\t\t\t);\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.settings.inserterMediaCategories,\n\t\tstate.settings.allowedMimeTypes,\n\t\tstate.settings.enableOpenverseMediaCategory,\n\t\tstate.registeredInserterMediaCategories,\n\t]\n);\n\n/**\n * Returns whether there is at least one allowed pattern for inner blocks children.\n * This is useful for deferring the parsing of all patterns until needed.\n *\n * @param {Object} state Editor state.\n * @param {string} [rootClientId=null] Target root client ID.\n *\n * @return {boolean} If there is at least one allowed pattern.\n */\nexport const hasAllowedPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, rootClientId = null ) => {\n\t\t\tconst { getAllPatterns } = unlock( select( STORE_NAME ) );\n\t\t\tconst patterns = getAllPatterns();\n\t\t\tconst { allowedBlockTypes } = getSettings( state );\n\t\t\treturn patterns.some( ( pattern ) => {\n\t\t\t\tconst { inserter = true } = pattern;\n\t\t\t\tif ( ! inserter ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst grammar = getGrammar( pattern );\n\t\t\t\treturn (\n\t\t\t\t\tcheckAllowListRecursive( grammar, allowedBlockTypes ) &&\n\t\t\t\t\tgrammar.every( ( { name: blockName } ) =>\n\t\t\t\t\t\tcanInsertBlockType( state, blockName, rootClientId )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t( state, rootClientId ) => [\n\t\t\t...getAllPatternsDependants( select )( state ),\n\t\t\t...getInsertBlockTypeDependants( select )( state, rootClientId ),\n\t\t]\n\t)\n);\n\nexport const getPatternBySlug = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, patternName ) => {\n\t\t\t// Only fetch reusable blocks if we know we need them. To do: maybe\n\t\t\t// use the entity record API to retrieve the block by slug.\n\t\t\tif ( patternName?.startsWith( 'core/block/' ) ) {\n\t\t\t\tconst _id = parseInt(\n\t\t\t\t\tpatternName.slice( 'core/block/'.length ),\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst block = unlock( select( STORE_NAME ) )\n\t\t\t\t\t.getReusableBlocks()\n\t\t\t\t\t.find( ( { id } ) => id === _id );\n\n\t\t\t\tif ( ! block ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn mapUserPattern(\n\t\t\t\t\tblock,\n\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t// This setting is left for back compat.\n\t\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ??\n\t\t\t\t\t[] ),\n\t\t\t].find( ( { name } ) => name === patternName );\n\t\t},\n\t\t( state, patternName ) =>\n\t\t\tpatternName?.startsWith( 'core/block/' )\n\t\t\t\t? [\n\t\t\t\t\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t\t\t\t\t\tstate.settings.__experimentalReusableBlocks,\n\t\t\t\t ]\n\t\t\t\t: [\n\t\t\t\t\t\tstate.settings.__experimentalBlockPatterns,\n\t\t\t\t\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\t\t\t ]\n\t)\n);\n\nexport const getAllPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector( ( state ) => {\n\t\treturn [\n\t\t\t...unlock( select( STORE_NAME ) )\n\t\t\t\t.getReusableBlocks()\n\t\t\t\t.map( ( userPattern ) =>\n\t\t\t\t\tmapUserPattern(\n\t\t\t\t\t\tuserPattern,\n\t\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t// This setting is left for back compat.\n\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ?? [] ),\n\t\t].filter(\n\t\t\t( x, index, arr ) =>\n\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t);\n\t}, getAllPatternsDependants( select ) )\n);\n\nconst EMPTY_ARRAY = [];\n\nexport const getReusableBlocks = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];\n\t\treturn (\n\t\t\t( reusableBlocksSelect\n\t\t\t\t? reusableBlocksSelect( select )\n\t\t\t\t: state.settings.__experimentalReusableBlocks ) ?? EMPTY_ARRAY\n\t\t);\n\t}\n);\n\n/**\n * Returns the element of the last element that had focus when focus left the editor canvas.\n *\n * @param {Object} state Block editor state.\n *\n * @return {Object} Element.\n */\nexport function getLastFocus( state ) {\n\treturn state.lastFocus;\n}\n\n/**\n * Returns true if the user is dragging anything, or false otherwise. It is possible for a\n * user to be dragging data from outside of the editor, so this selector is separate from\n * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether user is dragging.\n */\nexport function isDragging( state ) {\n\treturn state.isDragging;\n}\n\n/**\n * Retrieves the expanded block from the state.\n *\n * @param {Object} state Block editor state.\n *\n * @return {string|null} The client ID of the expanded block, if set.\n */\nexport function getExpandedBlock( state ) {\n\treturn state.expandedBlock;\n}\n\n/**\n * Retrieves the client ID of the ancestor block that is content locking the block\n * with the provided client ID.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getContentLockingParent = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( getTemplateLock( state, current ) === 'contentOnly' ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Checks whether a block meets the raw criteria to be a section block,\n * without considering contextual factors like nesting or the edited\n * content-only section. Used internally by `isSectionBlock` and\n * `getParentSectionBlock` to avoid circular calls between them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a candidate section block.\n */\nfunction isSectionBlockCandidate( state, clientId ) {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( blockName === 'core/block' ) {\n\t\treturn true;\n\t}\n\n\tconst attributes = getBlockAttributes( state, clientId );\n\tconst isTemplatePart = blockName === 'core/template-part';\n\n\t// When in an isolated editing context (e.g., editing a template part or pattern directly),\n\t// don't treat nested unsynced patterns as section blocks.\n\tconst isIsolatedEditor = state.settings?.[ isIsolatedEditorKey ];\n\n\tconst disableContentOnlyForUnsyncedPatterns =\n\t\tstate.settings?.disableContentOnlyForUnsyncedPatterns;\n\n\tconst disableContentOnlyForTemplateParts =\n\t\tstate.settings?.disableContentOnlyForTemplateParts;\n\n\tif (\n\t\t( ( ! disableContentOnlyForUnsyncedPatterns &&\n\t\t\tattributes?.metadata?.patternName ) ||\n\t\t\t( isTemplatePart && ! disableContentOnlyForTemplateParts ) ) &&\n\t\t! isIsolatedEditor\n\t) {\n\t\treturn true;\n\t}\n\n\t// TemplateLock cascades to all inner parent blocks. Only the top-level\n\t// block that's contentOnly templateLocked is the true contentLocker,\n\t// all the others are mere imitators.\n\tconst hasContentOnlyTemplateLock =\n\t\tgetTemplateLock( state, clientId ) === 'contentOnly';\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst hasRootContentOnlyTemplateLock =\n\t\tgetTemplateLock( state, rootClientId ) === 'contentOnly';\n\tif ( hasContentOnlyTemplateLock && ! hasRootContentOnlyTemplateLock ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Retrieves the client ID of the parent section block.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is a contentOnly section.\n */\nexport const getParentSectionBlock = ( state, clientId ) => {\n\t// If this block is within the edited content-only section,\n\t// it has no parent section \u2014 it's temporarily fully editable.\n\tif ( isWithinEditedContentOnlySection( state, clientId ) ) {\n\t\treturn undefined;\n\t}\n\n\tlet current = clientId;\n\tlet result;\n\n\t// If sections are nested, return the top level section block.\n\t// Don't return early.\n\twhile ( ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( isSectionBlockCandidate( state, current ) ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Returns whether the block is a contentOnly section.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a contentOnly section.\n */\nexport function isSectionBlock( state, clientId ) {\n\t// isWithinEditedContentOnlySection -\n\t// If the section is being edited or a parent section is being edited,\n\t// this block is temporarily not considered a section.\n\t//\n\t// getParentSectionBlock -\n\t// Only the top level section is considered the section,\n\t// a nested section is managed by its parent section.\n\tif (\n\t\tisWithinEditedContentOnlySection( state, clientId ) ||\n\t\tgetParentSectionBlock( state, clientId )\n\t) {\n\t\treturn false;\n\t}\n\n\treturn isSectionBlockCandidate( state, clientId );\n}\n\n/**\n * Retrieves the client ID of the block that is a contentOnly section but is\n * currently being temporarily edited (contentOnly is deactivated).\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The client ID of the block being temporarily edited.\n */\nexport function getEditedContentOnlySection( state ) {\n\treturn state.editedContentOnlySection;\n}\n\nexport function isWithinEditedContentOnlySection( state, clientId ) {\n\tif ( ! state.editedContentOnlySection ) {\n\t\treturn false;\n\t}\n\n\tif ( state.editedContentOnlySection === clientId ) {\n\t\treturn true;\n\t}\n\n\tlet current = clientId;\n\twhile ( ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( state.editedContentOnlySection === current ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Returns the style attributes of multiple blocks.\n *\n * @param {Object} state Global application state.\n * @param {string[]} clientIds An array of block client IDs.\n *\n * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined.\n */\nexport const getBlockStyles = createSelector(\n\t( state, clientIds ) =>\n\t\tclientIds.reduce( ( styles, clientId ) => {\n\t\t\tstyles[ clientId ] = state.blocks.attributes.get( clientId )?.style;\n\t\t\treturn styles;\n\t\t}, {} ),\n\t( state, clientIds ) => [\n\t\t...clientIds.map(\n\t\t\t( clientId ) => state.blocks.attributes.get( clientId )?.style\n\t\t),\n\t]\n);\n\n/**\n * Retrieves the client ID of the block which contains the blocks\n * acting as \"sections\" in the editor. This is typically the \"main content\"\n * of the template/post.\n *\n * @param {Object} state Editor state.\n *\n * @return {string|undefined} The section root client ID or undefined if not set.\n */\nexport function getSectionRootClientId( state ) {\n\treturn state.settings?.[ sectionRootClientIdKey ];\n}\n\n/**\n * Returns whether the editor is considered zoomed out.\n *\n * @param {Object} state Global application state.\n * @return {boolean} Whether the editor is zoomed.\n */\nexport function isZoomOut( state ) {\n\treturn state.zoomLevel === 'auto-scaled' || state.zoomLevel < 100;\n}\n\n/**\n * Returns whether the zoom level.\n *\n * @param {Object} state Global application state.\n * @return {number|\"auto-scaled\"} Zoom level.\n */\nexport function getZoomLevel( state ) {\n\treturn state.zoomLevel;\n}\n\n/**\n * Finds the closest block where the block is allowed to be inserted.\n *\n * @param {Object} state Editor state.\n * @param {string[] | string} name Block name or names.\n * @param {string} clientId Default insertion point.\n *\n * @return {string} clientID of the closest container when the block name can be inserted.\n */\nexport function getClosestAllowedInsertionPoint( state, name, clientId = '' ) {\n\tconst blockNames = Array.isArray( name ) ? name : [ name ];\n\tconst areBlockNamesAllowedInClientId = ( id ) =>\n\t\tblockNames.every( ( currentName ) =>\n\t\t\tcanInsertBlockType( state, currentName, id )\n\t\t);\n\n\t// If we're trying to insert at the root level and it's not allowed\n\t// Try the section root instead.\n\tif ( ! clientId ) {\n\t\tif ( areBlockNamesAllowedInClientId( clientId ) ) {\n\t\t\treturn clientId;\n\t\t}\n\n\t\tconst sectionRootClientId = getSectionRootClientId( state );\n\t\tif (\n\t\t\tsectionRootClientId &&\n\t\t\tareBlockNamesAllowedInClientId( sectionRootClientId )\n\t\t) {\n\t\t\treturn sectionRootClientId;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Traverse the block tree up until we find a place where we can insert.\n\tlet current = clientId;\n\twhile ( current !== null && ! areBlockNamesAllowedInClientId( current ) ) {\n\t\tconst parentClientId = getBlockRootClientId( state, current );\n\t\tcurrent = parentClientId;\n\t}\n\n\treturn current;\n}\n\nexport function getClosestAllowedInsertionPointForPattern(\n\tstate,\n\tpattern,\n\tclientId\n) {\n\tconst { allowedBlockTypes } = getSettings( state );\n\tconst isAllowed = checkAllowListRecursive(\n\t\tgetGrammar( pattern ),\n\t\tallowedBlockTypes\n\t);\n\tif ( ! isAllowed ) {\n\t\treturn null;\n\t}\n\tconst names = getGrammar( pattern ).map( ( { blockName: name } ) => name );\n\treturn getClosestAllowedInsertionPoint( state, names, clientId );\n}\n\n/**\n * Where the point where the next block will be inserted into.\n *\n * @param {Object} state\n * @return {Object} where the insertion point in the block editor is or null if none is set.\n */\nexport function getInsertionPoint( state ) {\n\treturn state.insertionPoint;\n}\n\n/**\n * Returns true if the block is hidden anywhere, or false otherwise.\n *\n * This selector checks whether a block has visibility metadata set that would\n * hide it at any viewport or everywhere. It's useful for flagging blocks that\n * have visibility restrictions.\n *\n * A block is considered hidden anywhere if:\n * - blockVisibility is false (hidden everywhere)\n * - blockVisibility.viewport has any viewport set to false (hidden at specific screen sizes)\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the block is hidden anywhere.\n */\nexport const isBlockHiddenAnywhere = ( state, clientId ) => {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( ! hasBlockSupport( blockName, 'visibility', true ) ) {\n\t\treturn false;\n\t}\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibility = attributes?.metadata?.blockVisibility;\n\n\tif ( blockVisibility === false ) {\n\t\treturn true;\n\t}\n\n\tif (\n\t\ttypeof blockVisibility?.viewport === 'object' &&\n\t\tblockVisibility?.viewport !== null\n\t) {\n\t\t// Check if the block is hidden at any viewport.\n\t\treturn Object.values( BLOCK_VISIBILITY_VIEWPORTS ).some(\n\t\t\t( viewport ) =>\n\t\t\t\tblockVisibility?.viewport?.[ viewport.key ] === false\n\t\t);\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if the block is hidden everywhere (blockVisibility is false).\n *\n * A block is considered hidden everywhere when blockVisibility is explicitly\n * set to false, which means it's hidden on all viewports.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the block is hidden everywhere.\n */\nexport const isBlockHiddenEverywhere = ( state, clientId ) => {\n\tconst blockName = getBlockName( state, clientId );\n\tif ( ! hasBlockSupport( blockName, 'visibility', true ) ) {\n\t\treturn false;\n\t}\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibility = attributes?.metadata?.blockVisibility;\n\n\tif ( blockVisibility === false ) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if any parent block (immediate or further up the chain) is hidden everywhere.\n *\n * Checks all parent blocks in the hierarchy and returns true if any of them\n * is hidden everywhere.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether any parent block is hidden everywhere.\n */\nexport const isBlockParentHiddenEverywhere = ( state, clientId ) => {\n\tconst parents = getBlockParents( state, clientId );\n\treturn parents.some( ( parentId ) =>\n\t\tisBlockHiddenEverywhere( state, parentId )\n\t);\n};\n\n/**\n * Returns true if the block is hidden at the given viewport.\n *\n * A block is considered hidden at a viewport if:\n * - blockVisibility is false (hidden everywhere)\n * - blockVisibility is an object with the specified viewport set to false\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').\n *\n * @return {boolean} Whether the block is hidden at the viewport.\n */\nexport const isBlockHiddenAtViewport = ( state, clientId, viewport ) => {\n\tif ( isBlockHiddenEverywhere( state, clientId ) ) {\n\t\treturn true;\n\t}\n\n\tconst attributes = state.blocks.attributes.get( clientId );\n\tconst blockVisibilityViewport =\n\t\tattributes?.metadata?.blockVisibility?.viewport;\n\tif (\n\t\ttypeof blockVisibilityViewport === 'object' &&\n\t\tblockVisibilityViewport !== null &&\n\t\ttypeof viewport === 'string'\n\t) {\n\t\treturn blockVisibilityViewport?.[ viewport.toLowerCase() ] === false;\n\t}\n\treturn false;\n};\n\n/**\n * Returns true if any parent block (immediate or further up the chain) is hidden at the given viewport.\n *\n * Checks all parent blocks in the hierarchy and returns true if any of them\n * is hidden at the specified viewport.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').\n *\n * @return {boolean} Whether any parent block is hidden at the viewport.\n */\nexport const isBlockParentHiddenAtViewport = ( state, clientId, viewport ) => {\n\tconst parents = getBlockParents( state, clientId );\n\treturn parents.some( ( parentId ) =>\n\t\tisBlockHiddenAtViewport( state, parentId, viewport )\n\t);\n};\n\n/**\n * Returns true if there is a spotlighted block.\n *\n * The spotlight is also active when a contentOnly section is being edited, the selector\n * also returns true if this is the case.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block is currently spotlighted.\n */\nexport function hasBlockSpotlight( state ) {\n\treturn !! state.hasBlockSpotlight || !! state.editedContentOnlySection;\n}\n\n/**\n * Returns whether a block is locked to prevent editing.\n *\n * This selector only reasons about block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n * Currently there's also no way to prevent editing via `templateLock`.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` aren't included as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isEditLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\treturn !! attributes?.lock?.edit;\n}\n\n/**\n * Returns whether a block is locked to prevent moving.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isMoveLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\t// If a block explicitly has `move` set to `false`, it turns off\n\t// any locking that might be inherited from a parent.\n\tif ( attributes?.lock?.move !== undefined ) {\n\t\treturn !! attributes?.lock?.move;\n\t}\n\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\n\t// While `contentOnly` templateLock does sometimes prevent moving, a user can't modify\n\t// this, so don't include it in this function. See the `canMoveBlock` selector\n\t// as an alternative.\n\treturn templateLock === 'all';\n}\n\n/**\n * Returns whether a block is locked to prevent removal.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isRemoveLockedBlock( state, clientId ) {\n\tconst attributes = getBlockAttributes( state, clientId );\n\tif ( attributes?.lock?.remove !== undefined ) {\n\t\treturn !! attributes?.lock?.remove;\n\t}\n\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\n\t// While `contentOnly` templateLock does sometimes prevent removal, a user can't modify\n\t// this, so don't include it in this function. See the `canRemoveBlock` selector\n\t// as an alternative.\n\treturn templateLock === 'all' || templateLock === 'insert';\n}\n\n/**\n * Returns whether a block is locked.\n *\n * This selector only reasons about templateLock and block lock, not associated features\n * like `blockEditingMode` that might prevent user modifications to a block.\n *\n * This distinction is important as this selector specifically drives the block lock UI\n * that a user interacts with. `blockEditingModes` are excluded as a user can't change\n * them.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId ClientId of the block.\n *\n * @return {boolean} Whether the block is currently locked.\n */\nexport function isLockedBlock( state, clientId ) {\n\treturn (\n\t\tisEditLockedBlock( state, clientId ) ||\n\t\tisMoveLockedBlock( state, clientId ) ||\n\t\tisRemoveLockedBlock( state, clientId )\n\t);\n}\n\n/**\n * Returns whether the list view content panel popover is open.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the popover is open.\n */\nexport function isListViewContentPanelOpen( state ) {\n\treturn state.listViewContentPanelOpen;\n}\n\n/**\n * Returns whether a List View panel is opened.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client ID of the block.\n *\n * @return {boolean} Whether the panel is opened.\n */\nexport function isListViewPanelOpened( state, clientId ) {\n\t// If allOpen flag is set, all panels are open\n\tif ( state.openedListViewPanels?.allOpen ) {\n\t\treturn true;\n\t}\n\treturn state.openedListViewPanels?.panels?.[ clientId ] === true;\n}\n\n/**\n * Returns the List View expand revision number.\n *\n * This counter is used in the ListView component's key prop to force remounting.\n *\n * @param {Object} state Global application state.\n *\n * @return {number} The expand revision number.\n */\nexport function getListViewExpandRevision( state ) {\n\treturn state.listViewExpandRevision || 0;\n}\n\n/**\n * Returns the client IDs for the viewport modal, or null if\n * the modal is not open.\n *\n * @param {Object} state Global application state.\n *\n * @return {string[]|null} Client IDs for the visibility modal, or null.\n */\nexport function getViewportModalClientIds( state ) {\n\treturn state.viewportModalClientIds;\n}\n\n/**\n * Returns the requested inspector tab state, if any.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|null} The requested tab state with tabName and options, or null if no request is pending.\n */\nexport function getRequestedInspectorTab( state ) {\n\treturn state.requestedInspectorTab;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuD;AACvD,oBAGO;AAKP,uBAWO;AACP,mBAMO;AACP,uBAA2B;AAC3B,yBAAuB;AACvB,0BAKO;AACP,IAAAA,oBAA2C;AAI3C,gCAAiC;AAFjC,IAAM,EAAE,eAAe,QAAI,2BAAQ,cAAAC,WAAkB;AAW9C,SAAS,uBAAwB,OAAQ;AAC/C,SAAO,MAAM;AACd;AAQO,SAAS,+BAAgC,OAAQ;AACvD,SAAO,OAAO,mBAAmB;AAClC;AAEO,SAAS,0BAA2B,OAAO,UAAW;AAC5D,SAAO,MAAM,OAAO,WAAW,IAAK,QAAS;AAC9C;AAWO,IAAM,yBAAyB,CAAE,OAAO,aAAc;AAC5D,QAAM,yBAAyB,CAAE,kBAAmB;AACnD,eACC,sCAAqB,OAAO,aAAc,MAAM,kBAChD,gCAAe,OAAO,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AAK,YAAY,MAAM,SAAS,QAAY;AAC3C,WAAO,CAAC,CAAE,YAAY,MAAM;AAAA,EAC7B;AAEA,QAAM,mBAAe,uCAAsB,OAAO,QAAS;AAC3D,QAAM,mBAAe,kCAAiB,OAAO,YAAa;AAK1D,SAAO,iBAAiB;AACzB;AAiBO,SAAS,oBAAqB,OAAO,UAAW;AACtD,QAAM,iBAAa,qCAAoB,OAAO,QAAS;AACvD,MAAK,YAAY,MAAM,WAAW,QAAY;AAC7C,WAAO,CAAC,CAAE,YAAY,MAAM;AAAA,EAC7B;AAEA,QAAM,mBAAe,uCAAsB,OAAO,QAAS;AAC3D,QAAM,mBAAe,kCAAiB,OAAO,YAAa;AAK1D,SAAO,iBAAiB,SAAS,iBAAiB;AACnD;AAiBO,SAAS,cAAe,OAAO,UAAW;AAChD,SACC,kBAAmB,OAAO,QAAS,KACnC,kBAAmB,OAAO,QAAS,KACnC,oBAAqB,OAAO,QAAS;AAEvC;AASO,SAAS,2BAA4B,OAAQ;AACnD,SAAO,MAAM;AACd;AAUO,SAAS,sBAAuB,OAAO,UAAW;AAExD,MAAK,MAAM,sBAAsB,SAAU;AAC1C,WAAO;AAAA,EACR;AACA,SAAO,MAAM,sBAAsB,SAAU,QAAS,MAAM;AAC7D;AAWO,SAAS,0BAA2B,OAAQ;AAClD,SAAO,MAAM,0BAA0B;AACxC;AAUO,SAAS,0BAA2B,OAAQ;AAClD,SAAO,MAAM;AACd;AASO,SAAS,yBAA0B,OAAQ;AACjD,SAAO,MAAM;AACd;",
6
6
  "names": ["import_constants", "blocksPrivateApis", "getAllPatterns"]
7
7
  }
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // packages/block-editor/src/store/reducer.js
31
31
  var reducer_exports = {};
32
32
  __export(reducer_exports, {
33
- blockEditingModes: () => blockEditingModes,
34
33
  blockListSettings: () => blockListSettings,
35
34
  blockVisibility: () => blockVisibility,
36
35
  blocks: () => blocks,
@@ -325,27 +324,6 @@ var withBlockTree = (reducer) => (state = {}, action) => {
325
324
  );
326
325
  break;
327
326
  }
328
- case "SAVE_REUSABLE_BLOCK_SUCCESS": {
329
- const updatedBlockUids = [];
330
- newState.attributes.forEach((attributes, clientId) => {
331
- if (newState.byClientId.get(clientId).name === "core/block" && attributes.ref === action.updatedId) {
332
- updatedBlockUids.push(clientId);
333
- }
334
- });
335
- newState.tree = new Map(newState.tree);
336
- updatedBlockUids.forEach((clientId) => {
337
- newState.tree.set(clientId, {
338
- ...newState.byClientId.get(clientId),
339
- attributes: newState.attributes.get(clientId),
340
- innerBlocks: newState.tree.get(clientId).innerBlocks
341
- });
342
- });
343
- updateParentInnerBlocksInTree(
344
- newState,
345
- updatedBlockUids,
346
- false
347
- );
348
- }
349
327
  }
350
328
  return newState;
351
329
  };
@@ -434,17 +412,12 @@ var withInnerBlocksRemoveCascade = (reducer) => (state, action) => {
434
412
  };
435
413
  var withBlockReset = (reducer) => (state, action) => {
436
414
  if (action.type === "RESET_BLOCKS") {
415
+ const newState = reducer(void 0, {
416
+ type: "INSERT_BLOCKS",
417
+ rootClientId: "",
418
+ blocks: action.blocks
419
+ });
437
420
  const preservedControlledInnerBlocks = state?.controlledInnerBlocks ?? {};
438
- const newState = {
439
- ...state,
440
- byClientId: new Map(
441
- getFlattenedBlocksWithoutAttributes(action.blocks)
442
- ),
443
- attributes: new Map(getFlattenedBlockAttributes(action.blocks)),
444
- order: mapBlockOrder(action.blocks),
445
- parents: new Map(mapBlockParents(action.blocks)),
446
- controlledInnerBlocks: preservedControlledInnerBlocks
447
- };
448
421
  if (state?.order) {
449
422
  for (const clientId of Object.keys(
450
423
  preservedControlledInnerBlocks
@@ -455,23 +428,24 @@ var withBlockReset = (reducer) => (state, action) => {
455
428
  if (!newState.byClientId.has(clientId)) {
456
429
  continue;
457
430
  }
431
+ newState.controlledInnerBlocks[clientId] = true;
458
432
  const oldOrder = state.order.get(clientId);
459
433
  if (!oldOrder?.length) {
460
434
  continue;
461
435
  }
462
436
  newState.order.set(clientId, oldOrder);
463
437
  const preserveBlock = (blockId, parentId) => {
464
- const blockData = state.byClientId?.get(blockId);
438
+ const blockData = state.byClientId.get(blockId);
465
439
  if (!blockData) {
466
440
  return;
467
441
  }
468
442
  newState.byClientId.set(blockId, blockData);
469
443
  newState.attributes.set(
470
444
  blockId,
471
- state.attributes?.get(blockId)
445
+ state.attributes.get(blockId)
472
446
  );
473
447
  newState.parents.set(blockId, parentId);
474
- const childOrder = state.order?.get(blockId) || [];
448
+ const childOrder = state.order.get(blockId) || [];
475
449
  newState.order.set(blockId, childOrder);
476
450
  childOrder.forEach(
477
451
  (childId) => preserveBlock(childId, blockId)
@@ -480,35 +454,39 @@ var withBlockReset = (reducer) => (state, action) => {
480
454
  oldOrder.forEach((id) => preserveBlock(id, clientId));
481
455
  }
482
456
  }
483
- newState.tree = new Map(state?.tree);
484
- updateBlockTreeForBlocks(newState, action.blocks);
485
457
  for (const clientId of Object.keys(
486
- preservedControlledInnerBlocks
458
+ newState.controlledInnerBlocks
487
459
  )) {
488
- if (!preservedControlledInnerBlocks[clientId]) {
489
- continue;
490
- }
491
- if (!newState.byClientId.has(clientId)) {
492
- continue;
493
- }
494
460
  const controlledOrder = newState.order.get(clientId);
495
461
  if (!controlledOrder?.length) {
496
462
  continue;
497
463
  }
498
464
  const innerBlocks = controlledOrder.map(
499
- (id) => newState.tree.get(id)
465
+ (id) => state.tree.get(id)
500
466
  );
501
467
  const existingEntry = newState.tree.get(clientId);
502
468
  if (existingEntry) {
503
469
  existingEntry.innerBlocks = innerBlocks;
504
470
  }
505
471
  newState.tree.set("controlled||" + clientId, { innerBlocks });
472
+ const preserveTreeEntry = (blockId) => {
473
+ const treeEntry = state.tree.get(blockId);
474
+ if (!treeEntry) {
475
+ return;
476
+ }
477
+ newState.tree.set(blockId, treeEntry);
478
+ const childOrder = newState.order.get(blockId) || [];
479
+ childOrder.forEach(preserveTreeEntry);
480
+ };
481
+ controlledOrder.forEach(preserveTreeEntry);
482
+ }
483
+ const preservedBlockEditingModes = state?.blockEditingModes ?? /* @__PURE__ */ new Map();
484
+ for (const [clientId, mode] of preservedBlockEditingModes) {
485
+ if (!newState.tree.has(clientId)) {
486
+ continue;
487
+ }
488
+ newState.blockEditingModes.set(clientId, mode);
506
489
  }
507
- newState.tree.set("", {
508
- innerBlocks: action.blocks.map(
509
- (subBlock) => newState.tree.get(subBlock.clientId)
510
- )
511
- });
512
490
  return newState;
513
491
  }
514
492
  return reducer(state, action);
@@ -560,26 +538,6 @@ var withReplaceInnerBlocks = (reducer) => (state, action) => {
560
538
  }
561
539
  return stateAfterInsert;
562
540
  };
563
- var withSaveReusableBlock = (reducer) => (state, action) => {
564
- if (state && action.type === "SAVE_REUSABLE_BLOCK_SUCCESS") {
565
- const { id, updatedId } = action;
566
- if (id === updatedId) {
567
- return state;
568
- }
569
- state = { ...state };
570
- state.attributes = new Map(state.attributes);
571
- state.attributes.forEach((attributes, clientId) => {
572
- const { name } = state.byClientId.get(clientId);
573
- if (name === "core/block" && attributes.ref === id) {
574
- state.attributes.set(clientId, {
575
- ...attributes,
576
- ref: updatedId
577
- });
578
- }
579
- });
580
- }
581
- return reducer(state, action);
582
- };
583
541
  var withResetControlledBlocks = (reducer) => (state, action) => {
584
542
  if (action.type === "SET_HAS_CONTROLLED_INNER_BLOCKS") {
585
543
  const innerBlockOrder = state.order.get(action.clientId);
@@ -597,8 +555,6 @@ var withResetControlledBlocks = (reducer) => (state, action) => {
597
555
  };
598
556
  var blocks = (0, import_compose.pipe)(
599
557
  import_data.combineReducers,
600
- withSaveReusableBlock,
601
- // Needs to be before withBlockCache.
602
558
  withBlockTree,
603
559
  // Needs to be before withInnerBlocksRemoveCascade.
604
560
  withInnerBlocksRemoveCascade,
@@ -977,6 +933,24 @@ var blocks = (0, import_compose.pipe)(
977
933
  };
978
934
  }
979
935
  return state;
936
+ },
937
+ blockEditingModes(state = /* @__PURE__ */ new Map(), action) {
938
+ switch (action.type) {
939
+ case "SET_BLOCK_EDITING_MODE":
940
+ if (state.get(action.clientId) === action.mode) {
941
+ return state;
942
+ }
943
+ return new Map(state).set(action.clientId, action.mode);
944
+ case "UNSET_BLOCK_EDITING_MODE": {
945
+ if (!state.has(action.clientId)) {
946
+ return state;
947
+ }
948
+ const newState = new Map(state);
949
+ newState.delete(action.clientId);
950
+ return newState;
951
+ }
952
+ }
953
+ return state;
980
954
  }
981
955
  });
982
956
  function isBlockInterfaceHidden(state = false, action) {
@@ -1438,26 +1412,21 @@ function editedContentOnlySection(state, action) {
1438
1412
  if (action.type === "EDIT_CONTENT_ONLY_SECTION") {
1439
1413
  return action.clientId;
1440
1414
  }
1441
- return state;
1442
- }
1443
- function blockEditingModes(state = /* @__PURE__ */ new Map(), action) {
1415
+ if (!state) {
1416
+ return state;
1417
+ }
1444
1418
  switch (action.type) {
1445
- case "SET_BLOCK_EDITING_MODE":
1446
- if (state.get(action.clientId) === action.mode) {
1447
- return state;
1419
+ case "REMOVE_BLOCKS":
1420
+ case "REPLACE_BLOCKS":
1421
+ if (action.clientIds.includes(state)) {
1422
+ return void 0;
1448
1423
  }
1449
- return new Map(state).set(action.clientId, action.mode);
1450
- case "UNSET_BLOCK_EDITING_MODE": {
1451
- if (!state.has(action.clientId)) {
1452
- return state;
1424
+ break;
1425
+ case "RESET_BLOCKS":
1426
+ if (!getFlattenedClientIds(action.blocks)[state]) {
1427
+ return void 0;
1453
1428
  }
1454
- const newState = new Map(state);
1455
- newState.delete(action.clientId);
1456
- return newState;
1457
- }
1458
- case "RESET_BLOCKS": {
1459
- return state.has("") ? (/* @__PURE__ */ new Map()).set("", state.get("")) : state;
1460
- }
1429
+ break;
1461
1430
  }
1462
1431
  return state;
1463
1432
  }
@@ -1596,7 +1565,6 @@ var combinedReducers = (0, import_data.combineReducers)({
1596
1565
  editedContentOnlySection,
1597
1566
  blockVisibility,
1598
1567
  viewportModalClientIds,
1599
- blockEditingModes,
1600
1568
  styleOverrides,
1601
1569
  removalPromptData,
1602
1570
  blockRemovalRules,
@@ -1662,7 +1630,7 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
1662
1630
  const derivedBlockEditingModes = /* @__PURE__ */ new Map();
1663
1631
  const sectionRootClientId = state.settings?.[import_private_keys.sectionRootClientIdKey];
1664
1632
  const sectionClientIds = state.blocks.order.get(sectionRootClientId);
1665
- const hasDisabledBlocks = Array.from(state.blockEditingModes).some(
1633
+ const hasDisabledBlocks = Array.from(state.blocks.blockEditingModes).some(
1666
1634
  ([, mode]) => mode === "disabled"
1667
1635
  );
1668
1636
  const templatePartClientIds = [];
@@ -1705,15 +1673,15 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
1705
1673
  return;
1706
1674
  }
1707
1675
  }
1708
- if (state.blockEditingModes.has(clientId)) {
1676
+ if (state.blocks.blockEditingModes.has(clientId)) {
1709
1677
  return;
1710
1678
  }
1711
1679
  if (hasDisabledBlocks) {
1712
1680
  let ancestorBlockEditingMode;
1713
1681
  let parent = state.blocks.parents.get(clientId);
1714
1682
  while (parent !== void 0) {
1715
- if (state.blockEditingModes.has(parent)) {
1716
- ancestorBlockEditingMode = state.blockEditingModes.get(parent);
1683
+ if (state.blocks.blockEditingModes.has(parent)) {
1684
+ ancestorBlockEditingMode = state.blocks.blockEditingModes.get(parent);
1717
1685
  }
1718
1686
  if (ancestorBlockEditingMode) {
1719
1687
  break;
@@ -2089,7 +2057,6 @@ var reducer_default = (0, import_compose.pipe)(
2089
2057
  )(combinedReducers);
2090
2058
  // Annotate the CommonJS export names for ESM import in node:
2091
2059
  0 && (module.exports = {
2092
- blockEditingModes,
2093
2060
  blockListSettings,
2094
2061
  blockVisibility,
2095
2062
  blocks,