{"version":3,"file":"is-within-overlay.mjs","names":["coreStore"],"sources":["../../src/utils/is-within-overlay.js"],"sourcesContent":["import { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA } from '../navigation/constants';\n\n/**\n * Checks if the current editing context is within a navigation overlay template part.\n *\n * This utility exists because `@wordpress/block-library` cannot depend on `@wordpress/editor`\n * as a package dependency. Blocks can be loaded into non-post block editors, so we must\n * access the 'core/editor' store by string literal rather than importing it.\n *\n * React components should wrap this in useSelect for reactivity. Non-React contexts\n * (like filter callbacks) can call this directly.\n *\n * @return {boolean} True if editing a navigation overlay template part, false otherwise.\n */\nexport function isWithinNavigationOverlay() {\n\t// @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst editorStore = select( 'core/editor' );\n\n\t// Return false if the editor store is not available.\n\tif ( ! editorStore ) {\n\t\treturn false;\n\t}\n\n\tconst { getCurrentPostType, getCurrentPostId } = editorStore;\n\tconst { getEditedEntityRecord } = select( coreStore );\n\n\tconst postType = getCurrentPostType?.();\n\tconst postId = getCurrentPostId?.();\n\n\tif ( postType === 'wp_template_part' && postId ) {\n\t\tconst templatePart = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\tpostId\n\t\t);\n\n\t\treturn templatePart?.area === NAVIGATION_OVERLAY_TEMPLATE_PART_AREA;\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,4BAA4B;CAM3C,MAAM,cAAc,OAAQ,aAAc;CAG1C,IAAK,CAAE,aACN,OAAO;CAGR,MAAM,EAAE,oBAAoB,qBAAqB;CACjD,MAAM,EAAE,0BAA0B,OAAQA,KAAU;CAEpD,MAAM,WAAW,qBAAqB;CACtC,MAAM,SAAS,mBAAmB;CAElC,IAAK,aAAa,sBAAsB,QAOvC,OANqB,sBACpB,YACA,oBACA,MAGiB,CAAC,EAAE,SAAS;CAG/B,OAAO;AACR"}