WordPress/wp-includes/js/dist/edit-post.min.js
gziolo d444b56849 Update the WP packages with fixes prior to WP 6.2 beta 4
This updated the packages to the latest versions with the latest fixes.

Gutenberg changes: 35f10c1836

Includes the following bug fixes:

- Only add layout classes to inner wrapper if block is a container.
- Revert dynamic block anchor support
- [Inserter - Media tab]: Upload Openverse images when inserted
- SpacingSizesControl: Fix white dot on thumb
- Site Editor: update the edit button
- Change "Browse all templates" to "Manage all templates" in template details popover
- Remove TemplateAreas from template details
- Add support for orientation-based block movers to core/social-links
- Site Editor: polish add template modal style
- Match color of the focus template view with site dark material
- Site Editor: Fix routing for Classic themes using block-based template parts
- Remove broken site editor redirect
- Make the template customized info accessible
- Sort templates and template parts by slug
- Prevent distracting focused back button on site editor load
- Fix: Content only CPT template locking.
- Pin floating-ui/react-dom version
- Widget Importer: Don't render controls when there's nothing to import
- Post Editor: Update postContentBlock check to see if the block is valid
- Site Tagline: Add example so that it will display in style book
- Remove copy for managing a block's style variations
- Fix the site editor home page loading when installed in a subdirectory
- Global Styles: Display preset names via the tooltip
- [Query Loop] Fix top border in pattern selection modal
- Site Editor: Fix the 'Browse all' link in the template details modal
- Site Editor: Fix the tooltip and shortcut for the global save button
- Make the Site Logo block placeholder state smaller
- Site Editor Sidebar: Add line-height for template/parts name and update width for edit button
- Style Book: Focus the Style Book when opened, and enable ESCAPE key to close
- [Site Editor]: Set html block as freeform fallback block
- Make the performance tests more stable
- Adds all allowed innerblocks to the inspector animation experiment
- Revert Link control UX changes for WP 6.2
- Fix Site Editor perf tests
- Playwright: fix request utils for non Docker envs

See #57471.
Props Mamaduka, ntsekouras.


Built from https://develop.svn.wordpress.org/trunk@55440


git-svn-id: http://core.svn.wordpress.org/trunk@54973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 12:05:03 +00:00

7 lines
123 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
!function(){var e={4403:function(e,t){var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var l=typeof n;if("string"===l||"number"===l)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===l){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var i in n)o.call(n,i)&&n[i]&&e.push(i)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};!function(){"use strict";n.r(o),n.d(o,{PluginBlockSettingsMenuItem:function(){return Br},PluginDocumentSettingPanel:function(){return Zo},PluginMoreMenuItem:function(){return Mr},PluginPostPublishPanel:function(){return ir},PluginPostStatusInfo:function(){return Eo},PluginPrePublishPanel:function(){return ur},PluginSidebar:function(){return Ko},PluginSidebarMoreMenuItem:function(){return Nr},__experimentalFullscreenModeClose:function(){return Cn},__experimentalMainDashboardButton:function(){return Un},initializeEditor:function(){return Ir},reinitializeEditor:function(){return Dr},store:function(){return Rt}});var e={};n.r(e),n.d(e,{disableComplementaryArea:function(){return $},enableComplementaryArea:function(){return W},pinItem:function(){return q},setDefaultComplementaryArea:function(){return z},setFeatureDefaults:function(){return Y},setFeatureValue:function(){return K},toggleFeature:function(){return Z},unpinItem:function(){return j}});var t={};n.r(t),n.d(t,{getActiveComplementaryArea:function(){return X},isFeatureActive:function(){return J},isItemPinned:function(){return Q}});var r={};n.r(r),n.d(r,{__experimentalSetPreviewDeviceType:function(){return Ye},__unstableCreateTemplate:function(){return tt},__unstableSwitchToTemplateMode:function(){return et},closeGeneralSidebar:function(){return Ne},closeModal:function(){return De},closePublishSidebar:function(){return Le},hideBlockTypes:function(){return $e},initializeMetaBoxes:function(){return ot},metaBoxUpdatesFailure:function(){return Ke},metaBoxUpdatesSuccess:function(){return Ze},openGeneralSidebar:function(){return Me},openModal:function(){return Ie},openPublishSidebar:function(){return Ae},removeEditorPanel:function(){return Re},requestMetaBoxUpdates:function(){return je},setAvailableMetaBoxesPerLocation:function(){return qe},setIsEditingTemplate:function(){return Je},setIsInserterOpened:function(){return Xe},setIsListViewOpened:function(){return Qe},showBlockTypes:function(){return We},switchEditorMode:function(){return Ge},toggleEditorPanelEnabled:function(){return Ve},toggleEditorPanelOpened:function(){return Fe},toggleFeature:function(){return He},togglePinnedPluginItem:function(){return Ue},togglePublishSidebar:function(){return Oe},updatePreferredStyleVariations:function(){return ze}});var l={};n.r(l),n.d(l,{__experimentalGetInsertionPoint:function(){return Dt},__experimentalGetPreviewDeviceType:function(){return Nt},areMetaBoxesInitialized:function(){return Ot},getActiveGeneralSidebarName:function(){return pt},getActiveMetaBoxLocations:function(){return kt},getAllMetaBoxes:function(){return xt},getEditedPostTemplate:function(){return Vt},getEditorMode:function(){return dt},getHiddenBlockTypes:function(){return _t},getMetaBoxesPerLocation:function(){return Tt},getPreference:function(){return ht},getPreferences:function(){return gt},hasMetaBoxes:function(){return Bt},isEditingTemplate:function(){return Lt},isEditorPanelEnabled:function(){return ft},isEditorPanelOpened:function(){return vt},isEditorPanelRemoved:function(){return bt},isEditorSidebarOpened:function(){return ut},isFeatureActive:function(){return wt},isInserterOpened:function(){return It},isListViewOpened:function(){return At},isMetaBoxLocationActive:function(){return Ct},isMetaBoxLocationVisible:function(){return Pt},isModalActive:function(){return yt},isPluginItemPinned:function(){return St},isPluginSidebarOpened:function(){return mt},isPublishSidebarOpened:function(){return Et},isSavingMetaBoxes:function(){return Mt}});var a=window.wp.element,i=window.wp.blocks,s=window.wp.blockLibrary,c=window.wp.deprecated,d=n.n(c),u=window.wp.data,m=window.wp.hooks,p=window.wp.preferences,g=window.wp.widgets,h=window.wp.mediaUtils;function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_.apply(this,arguments)}(0,m.addFilter)("editor.MediaUpload","core/edit-post/replace-media-upload",(()=>h.MediaUpload));var E=window.wp.components,b=window.wp.blockEditor,f=window.wp.i18n,v=window.wp.compose;const y=(0,v.compose)((0,u.withSelect)(((e,t)=>{if((0,i.hasBlockSupport)(t.name,"multiple",!0))return{};const n=e(b.store).getBlocks().find((e=>{let{name:n}=e;return t.name===n}));return{originalBlockClientId:n&&n.clientId!==t.clientId&&n.clientId}})),(0,u.withDispatch)(((e,t)=>{let{originalBlockClientId:n}=t;return{selectFirst:()=>e(b.store).selectBlock(n)}}))),w=(0,v.createHigherOrderComponent)((e=>y((t=>{let{originalBlockClientId:n,selectFirst:o,...r}=t;if(!n)return(0,a.createElement)(e,r);const l=(0,i.getBlockType)(r.name),s=function(e){const t=(0,i.findTransform)((0,i.getBlockTransforms)("to",e),(e=>{let{type:t,blocks:n}=e;return"block"===t&&1===n.length}));if(!t)return null;return(0,i.getBlockType)(t.blocks[0])}(r.name);return[(0,a.createElement)("div",{key:"invalid-preview",style:{minHeight:"60px"}},(0,a.createElement)(e,_({key:"block-edit"},r))),(0,a.createElement)(b.Warning,{key:"multiple-use-warning",actions:[(0,a.createElement)(E.Button,{key:"find-original",variant:"secondary",onClick:o},(0,f.__)("Find original")),(0,a.createElement)(E.Button,{key:"remove",variant:"secondary",onClick:()=>r.onReplace([])},(0,f.__)("Remove")),s&&(0,a.createElement)(E.Button,{key:"transform",variant:"secondary",onClick:()=>r.onReplace((0,i.createBlock)(s.name,r.attributes))},(0,f.__)("Transform into:")," ",s.title)]},(0,a.createElement)("strong",null,null==l?void 0:l.title,": "),(0,f.__)("This block can only be used once."))]}))),"withMultipleValidation");(0,m.addFilter)("editor.BlockEdit","core/edit-post/validate-multiple-use/with-multiple-validation",w);var S=window.wp.primitives;var k=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"})),P=window.wp.plugins,C=window.wp.url,T=window.wp.notices,x=window.wp.editor;function B(){const{createNotice:e}=(0,u.useDispatch)(T.store),t=(0,u.useSelect)((e=>()=>e(x.store).getEditedPostAttribute("content")),[]);const n=(0,v.useCopyToClipboard)(t,(function(){e("info",(0,f.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,a.createElement)(E.MenuItem,{ref:n},(0,f.__)("Copy all blocks"))}var M=window.wp.keycodes;function N(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;const n=[...e];for(const e of t){const t=n.findIndex((t=>t.id===e.id));-1!==t?n[t]=e:n.push(e)}return n}const I=(0,u.combineReducers)({isSaving:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REQUEST_META_BOX_UPDATES":return!0;case"META_BOX_UPDATES_SUCCESS":case"META_BOX_UPDATES_FAILURE":return!1;default:return e}},locations:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("SET_META_BOXES_PER_LOCATIONS"===t.type){const n={...e};for(const[e,o]of Object.entries(t.metaBoxesPerLocation))n[e]=N(n[e],o);return n}return e},initialized:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"META_BOXES_INITIALIZED"===t.type||e}});var D=(0,u.combineReducers)({activeModal:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e},metaBoxes:I,publishSidebarActive:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"OPEN_PUBLISH_SIDEBAR":return!0;case"CLOSE_PUBLISH_SIDEBAR":return!1;case"TOGGLE_PUBLISH_SIDEBAR":return!e}return e},removedPanels:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if("REMOVE_PANEL"===t.type)if(!e.includes(t.panelName))return[...e,t.panelName];return e},deviceType:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Desktop",t=arguments.length>1?arguments[1]:void 0;return"SET_PREVIEW_DEVICE_TYPE"===t.type?t.deviceType:e},blockInserterPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},listViewPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},isEditingTemplate:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"SET_IS_EDITING_TEMPLATE"===t.type?t.value:e}}),A=window.wp.apiFetch,L=n.n(A),O=n(4403),V=n.n(O);var F=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var R=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var H=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),G=window.wp.viewport;var U=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));const z=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),W=(e,t)=>n=>{let{registry:o,dispatch:r}=n;if(!t)return;o.select(p.store).get(e,"isComplementaryAreaVisible")||o.dispatch(p.store).set(e,"isComplementaryAreaVisible",!0),r({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},$=e=>t=>{let{registry:n}=t;n.select(p.store).get(e,"isComplementaryAreaVisible")&&n.dispatch(p.store).set(e,"isComplementaryAreaVisible",!1)},q=(e,t)=>n=>{let{registry:o}=n;if(!t)return;const r=o.select(p.store).get(e,"pinnedItems");!0!==(null==r?void 0:r[t])&&o.dispatch(p.store).set(e,"pinnedItems",{...r,[t]:!0})},j=(e,t)=>n=>{let{registry:o}=n;if(!t)return;const r=o.select(p.store).get(e,"pinnedItems");o.dispatch(p.store).set(e,"pinnedItems",{...r,[t]:!1})};function Z(e,t){return function(n){let{registry:o}=n;d()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),o.dispatch(p.store).toggle(e,t)}}function K(e,t,n){return function(o){let{registry:r}=o;d()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),r.dispatch(p.store).set(e,t,!!n)}}function Y(e,t){return function(n){let{registry:o}=n;d()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),o.dispatch(p.store).setDefaults(e,t)}}const X=(0,u.createRegistrySelector)((e=>(t,n)=>{var o;const r=e(p.store).get(n,"isComplementaryAreaVisible");if(void 0!==r)return r?null==t||null===(o=t.complementaryAreas)||void 0===o?void 0:o[n]:null})),Q=(0,u.createRegistrySelector)((e=>(t,n,o)=>{var r;const l=e(p.store).get(n,"pinnedItems");return null===(r=null==l?void 0:l[o])||void 0===r||r})),J=(0,u.createRegistrySelector)((e=>(t,n,o)=>(d()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(p.store).get(n,o))));var ee=(0,u.combineReducers)({complementaryAreas:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:o}=t;return e[n]?e:{...e,[n]:o}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:o}=t;return{...e,[n]:o}}}return e}});const te=(0,u.createReduxStore)("core/interface",{reducer:ee,actions:e,selectors:t});(0,u.register)(te);var ne=(0,P.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var oe=ne((function(e){let{as:t=E.Button,scope:n,identifier:o,icon:r,selectedIcon:l,name:i,...s}=e;const c=t,d=(0,u.useSelect)((e=>e(te).getActiveComplementaryArea(n)===o),[o]),{enableComplementaryArea:m,disableComplementaryArea:p}=(0,u.useDispatch)(te);return(0,a.createElement)(c,_({icon:l&&d?l:r,onClick:()=>{d?p(n):m(n,o)}},s))}));var re=e=>{let{smallScreenTitle:t,children:n,className:o,toggleButtonProps:r}=e;const l=(0,a.createElement)(oe,_({icon:U},r));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},t&&(0,a.createElement)("span",{className:"interface-complementary-area-header__small-title"},t),l),(0,a.createElement)("div",{className:V()("components-panel__header","interface-complementary-area-header",o),tabIndex:-1},n,l))};const le=()=>{};function ae(e){let{name:t,as:n=E.Button,onClick:o,...r}=e;return(0,a.createElement)(E.Fill,{name:t},(e=>{let{onClick:t}=e;return(0,a.createElement)(n,_({onClick:o||t?function(){(o||le)(...arguments),(t||le)(...arguments)}:void 0},r))}))}ae.Slot=function(e){let{name:t,as:n=E.ButtonGroup,fillProps:o={},bubblesVirtually:r,...l}=e;return(0,a.createElement)(E.Slot,{name:t,bubblesVirtually:r,fillProps:o},(e=>{if(!a.Children.toArray(e).length)return null;const t=[];a.Children.forEach(e,(e=>{let{props:{__unstableExplicitMenuItem:n,__unstableTarget:o}}=e;o&&n&&t.push(o)}));const o=a.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&t.includes(e.props.__unstableTarget)?null:e));return(0,a.createElement)(n,l,o)}))};var ie=ae;const se=e=>{let{__unstableExplicitMenuItem:t,__unstableTarget:n,...o}=e;return(0,a.createElement)(E.MenuItem,o)};function ce(e){let{scope:t,target:n,__unstableExplicitMenuItem:o,...r}=e;return(0,a.createElement)(oe,_({as:e=>(0,a.createElement)(ie,_({__unstableExplicitMenuItem:o,__unstableTarget:`${t}/${n}`,as:se,name:`${t}/plugin-more-menu`},e)),role:"menuitemcheckbox",selectedIcon:F,name:n,scope:t},r))}function de(e){let{scope:t,...n}=e;return(0,a.createElement)(E.Fill,_({name:`PinnedItems/${t}`},n))}de.Slot=function(e){let{scope:t,className:n,...o}=e;return(0,a.createElement)(E.Slot,_({name:`PinnedItems/${t}`},o),(e=>(null==e?void 0:e.length)>0&&(0,a.createElement)("div",{className:V()(n,"interface-pinned-items")},e)))};var ue=de;function me(e){let{scope:t,children:n,className:o}=e;return(0,a.createElement)(E.Fill,{name:`ComplementaryArea/${t}`},(0,a.createElement)("div",{className:o},n))}const pe=ne((function(e){let{children:t,className:n,closeLabel:o=(0,f.__)("Close plugin"),identifier:r,header:l,headerClassName:i,icon:s,isPinnable:c=!0,panelClassName:d,scope:m,name:p,smallScreenTitle:g,title:h,toggleShortcut:_,isActiveByDefault:b,showIconLabels:v=!1}=e;const{isActive:y,isPinned:w,activeArea:S,isSmall:k,isLarge:P}=(0,u.useSelect)((e=>{const{getActiveComplementaryArea:t,isItemPinned:n}=e(te),o=t(m);return{isActive:o===r,isPinned:n(m,r),activeArea:o,isSmall:e(G.store).isViewportMatch("< medium"),isLarge:e(G.store).isViewportMatch("large")}}),[r,m]);!function(e,t,n,o,r){const l=(0,a.useRef)(!1),i=(0,a.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:c}=(0,u.useDispatch)(te);(0,a.useEffect)((()=>{o&&r&&!l.current?(c(e),i.current=!0):i.current&&!r&&l.current?(i.current=!1,s(e,t)):i.current&&n&&n!==t&&(i.current=!1),r!==l.current&&(l.current=r)}),[o,r,e,t,n])}(m,r,S,y,k);const{enableComplementaryArea:C,disableComplementaryArea:T,pinItem:x,unpinItem:B}=(0,u.useDispatch)(te);return(0,a.useEffect)((()=>{b&&void 0===S&&!k&&C(m,r)}),[S,b,m,r,k]),(0,a.createElement)(a.Fragment,null,c&&(0,a.createElement)(ue,{scope:m},w&&(0,a.createElement)(oe,{scope:m,identifier:r,isPressed:y&&(!v||P),"aria-expanded":y,label:h,icon:v?F:s,showTooltip:!v,variant:v?"tertiary":void 0})),p&&c&&(0,a.createElement)(ce,{target:p,scope:m,icon:s},h),y&&(0,a.createElement)(me,{className:V()("interface-complementary-area",n),scope:m},(0,a.createElement)(re,{className:i,closeLabel:o,onClose:()=>T(m),smallScreenTitle:g,toggleButtonProps:{label:o,shortcut:_,scope:m,identifier:r}},l||(0,a.createElement)(a.Fragment,null,(0,a.createElement)("strong",null,h),c&&(0,a.createElement)(E.Button,{className:"interface-complementary-area__pin-unpin-item",icon:w?R:H,label:w?(0,f.__)("Unpin from toolbar"):(0,f.__)("Pin to toolbar"),onClick:()=>(w?B:x)(m,r),isPressed:w,"aria-expanded":w}))),(0,a.createElement)(E.Panel,{className:d},t)))}));pe.Slot=function(e){let{scope:t,...n}=e;return(0,a.createElement)(E.Slot,_({name:`ComplementaryArea/${t}`},n))};var ge=pe;var he=e=>{let{isActive:t}=e;return(0,a.useEffect)((()=>{let e=!1;return document.body.classList.contains("sticky-menu")&&(e=!0,document.body.classList.remove("sticky-menu")),()=>{e&&document.body.classList.add("sticky-menu")}}),[]),(0,a.useEffect)((()=>(t?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{t&&document.body.classList.remove("is-fullscreen-mode")})),[t]),null};function _e(e){let{children:t,className:n,ariaLabel:o,as:r="div",...l}=e;return(0,a.createElement)(r,_({className:V()("interface-navigable-region",n),"aria-label":o,role:"region",tabIndex:"-1"},l),t)}var Ee=(0,a.forwardRef)((function(e,t){let{isDistractionFree:n,footer:o,header:r,editorNotices:l,sidebar:i,secondarySidebar:s,notices:c,content:d,actions:u,labels:m,className:p,enableRegionNavigation:g=!0,shortcuts:h}=e;const b=(0,E.__unstableUseNavigateRegions)(h);!function(e){(0,a.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const y={...{header:(0,f.__)("Header"),body:(0,f.__)("Content"),secondarySidebar:(0,f.__)("Block Library"),sidebar:(0,f.__)("Settings"),actions:(0,f.__)("Publish"),footer:(0,f.__)("Footer")},...m},w={hidden:n?{opacity:0}:{opacity:1},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}}};return(0,a.createElement)("div",_({},g?b:{},{ref:(0,v.useMergeRefs)([t,g?b.ref:void 0]),className:V()(p,"interface-interface-skeleton",b.className,!!o&&"has-footer")}),(0,a.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&n&&(0,a.createElement)(_e,{as:E.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":y.header,initial:n?"hidden":"hover",whileHover:"hover",variants:w,transition:{type:"tween",delay:.8}},r),!!r&&!n&&(0,a.createElement)(_e,{className:"interface-interface-skeleton__header",ariaLabel:y.header},r),n&&(0,a.createElement)("div",{className:"interface-interface-skeleton__header"},l),(0,a.createElement)("div",{className:"interface-interface-skeleton__body"},!!s&&(0,a.createElement)(_e,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:y.secondarySidebar},s),!!c&&(0,a.createElement)("div",{className:"interface-interface-skeleton__notices"},c),(0,a.createElement)(_e,{className:"interface-interface-skeleton__content",ariaLabel:y.body},d),!!i&&(0,a.createElement)(_e,{className:"interface-interface-skeleton__sidebar",ariaLabel:y.sidebar},i),!!u&&(0,a.createElement)(_e,{className:"interface-interface-skeleton__actions",ariaLabel:y.actions},u))),!!o&&(0,a.createElement)(_e,{className:"interface-interface-skeleton__footer",ariaLabel:y.footer},o))}));var be=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function fe(e){let{as:t=E.DropdownMenu,className:n,label:o=(0,f.__)("Options"),popoverProps:r,toggleProps:l,children:i}=e;return(0,a.createElement)(t,{className:V()("interface-more-menu-dropdown",n),icon:be,label:o,popoverProps:{placement:"bottom-end",...r,className:V()("interface-more-menu-dropdown__content",null==r?void 0:r.className)},toggleProps:{tooltipPosition:"bottom",...l}},(e=>i(e)))}function ve(e){let{closeModal:t,children:n}=e;return(0,a.createElement)(E.Modal,{className:"interface-preferences-modal",title:(0,f.__)("Preferences"),onRequestClose:t},n)}var ye=function(e){let{icon:t,size:n=24,...o}=e;return(0,a.cloneElement)(t,{width:n,height:n,...o})};var we=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));var Se=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));const ke="preferences-menu";function Pe(e){let{sections:t}=e;const n=(0,v.useViewportMatch)("medium"),[o,r]=(0,a.useState)(ke),{tabs:l,sectionsContentMap:i}=(0,a.useMemo)((()=>{let e={tabs:[],sectionsContentMap:{}};return t.length&&(e=t.reduce(((e,t)=>{let{name:n,tabLabel:o,content:r}=t;return e.tabs.push({name:n,title:o}),e.sectionsContentMap[n]=r,e}),{tabs:[],sectionsContentMap:{}})),e}),[t]),s=(0,a.useCallback)((e=>i[e.name]||null),[i]);let c;return c=n?(0,a.createElement)(E.TabPanel,{className:"interface-preferences__tabs",tabs:l,initialTabName:o!==ke?o:void 0,onSelect:r,orientation:"vertical"},s):(0,a.createElement)(E.__experimentalNavigatorProvider,{initialPath:"/",className:"interface-preferences__provider"},(0,a.createElement)(E.__experimentalNavigatorScreen,{path:"/"},(0,a.createElement)(E.Card,{isBorderless:!0,size:"small"},(0,a.createElement)(E.CardBody,null,(0,a.createElement)(E.__experimentalItemGroup,null,l.map((e=>(0,a.createElement)(E.__experimentalNavigatorButton,{key:e.name,path:e.name,as:E.__experimentalItem,isAction:!0},(0,a.createElement)(E.__experimentalHStack,{justify:"space-between"},(0,a.createElement)(E.FlexItem,null,(0,a.createElement)(E.__experimentalTruncate,null,e.title)),(0,a.createElement)(E.FlexItem,null,(0,a.createElement)(ye,{icon:(0,f.isRTL)()?we:Se})))))))))),t.length&&t.map((e=>(0,a.createElement)(E.__experimentalNavigatorScreen,{key:`${e.name}-menu`,path:e.name},(0,a.createElement)(E.Card,{isBorderless:!0,size:"large"},(0,a.createElement)(E.CardHeader,{isBorderless:!1,justify:"left",size:"small",gap:"6"},(0,a.createElement)(E.__experimentalNavigatorBackButton,{icon:(0,f.isRTL)()?Se:we,"aria-label":(0,f.__)("Navigate to the previous view")}),(0,a.createElement)(E.__experimentalText,{size:"16"},e.tabLabel)),(0,a.createElement)(E.CardBody,null,e.content)))))),c}var Ce=e=>{let{description:t,title:n,children:o}=e;return(0,a.createElement)("fieldset",{className:"interface-preferences-modal__section"},(0,a.createElement)("legend",{className:"interface-preferences-modal__section-legend"},(0,a.createElement)("h2",{className:"interface-preferences-modal__section-title"},n),t&&(0,a.createElement)("p",{className:"interface-preferences-modal__section-description"},t)),o)};var Te=function(e){let{help:t,label:n,isChecked:o,onChange:r,children:l}=e;return(0,a.createElement)("div",{className:"interface-preferences-modal__option"},(0,a.createElement)(E.ToggleControl,{__nextHasNoMarginBottom:!0,help:t,label:n,checked:o,onChange:r}),l)},xe=window.wp.a11y,Be=window.wp.coreData;const Me=e=>t=>{let{registry:n}=t;return n.dispatch(te).enableComplementaryArea(Rt.name,e)},Ne=()=>e=>{let{registry:t}=e;return t.dispatch(te).disableComplementaryArea(Rt.name)};function Ie(e){return{type:"OPEN_MODAL",name:e}}function De(){return{type:"CLOSE_MODAL"}}function Ae(){return{type:"OPEN_PUBLISH_SIDEBAR"}}function Le(){return{type:"CLOSE_PUBLISH_SIDEBAR"}}function Oe(){return{type:"TOGGLE_PUBLISH_SIDEBAR"}}const Ve=e=>t=>{var n;let{registry:o}=t;const r=null!==(n=o.select(p.store).get("core/edit-post","inactivePanels"))&&void 0!==n?n:[];let l;l=!(null==r||!r.includes(e))?r.filter((t=>t!==e)):[...r,e],o.dispatch(p.store).set("core/edit-post","inactivePanels",l)},Fe=e=>t=>{var n;let{registry:o}=t;const r=null!==(n=o.select(p.store).get("core/edit-post","openPanels"))&&void 0!==n?n:[];let l;l=!(null==r||!r.includes(e))?r.filter((t=>t!==e)):[...r,e],o.dispatch(p.store).set("core/edit-post","openPanels",l)};function Re(e){return{type:"REMOVE_PANEL",panelName:e}}const He=e=>t=>{let{registry:n}=t;return n.dispatch(p.store).toggle("core/edit-post",e)},Ge=e=>t=>{let{registry:n}=t;n.dispatch(p.store).set("core/edit-post","editorMode",e),"visual"!==e&&n.dispatch(b.store).clearSelectedBlock();const o="visual"===e?(0,f.__)("Visual editor selected"):(0,f.__)("Code editor selected");(0,xe.speak)(o,"assertive")},Ue=e=>t=>{let{registry:n}=t;const o=n.select(te).isItemPinned("core/edit-post",e);n.dispatch(te)[o?"unpinItem":"pinItem"]("core/edit-post",e)},ze=(e,t)=>n=>{var o;let{registry:r}=n;if(!e)return;const l=null!==(o=r.select(p.store).get("core/edit-post","preferredStyleVariations"))&&void 0!==o?o:{};if(t)r.dispatch(p.store).set("core/edit-post","preferredStyleVariations",{...l,[e]:t});else{const t={...l};delete t[e],r.dispatch(p.store).set("core/edit-post","preferredStyleVariations",t)}},We=e=>t=>{var n;let{registry:o}=t;const r=(null!==(n=o.select(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==n?n:[]).filter((t=>!(Array.isArray(e)?e:[e]).includes(t)));o.dispatch(p.store).set("core/edit-post","hiddenBlockTypes",r)},$e=e=>t=>{var n;let{registry:o}=t;const r=null!==(n=o.select(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==n?n:[],l=new Set([...r,...Array.isArray(e)?e:[e]]);o.dispatch(p.store).set("core/edit-post","hiddenBlockTypes",[...l])};function qe(e){return{type:"SET_META_BOXES_PER_LOCATIONS",metaBoxesPerLocation:e}}const je=()=>async e=>{let{registry:t,select:n,dispatch:o}=e;o({type:"REQUEST_META_BOX_UPDATES"}),window.tinyMCE&&window.tinyMCE.triggerSave();const r=t.select(x.store).getCurrentPost(),l=[!!r.comment_status&&["comment_status",r.comment_status],!!r.ping_status&&["ping_status",r.ping_status],!!r.sticky&&["sticky",r.sticky],!!r.author&&["post_author",r.author]].filter(Boolean),a=[new window.FormData(document.querySelector(".metabox-base-form")),...n.getActiveMetaBoxLocations().map((e=>new window.FormData((e=>document.querySelector(`.edit-post-meta-boxes-area.is-${e} .metabox-location-${e}`)||document.querySelector("#metaboxes .metabox-location-"+e))(e))))].reduce(((e,t)=>{for(const[n,o]of t)e.append(n,o);return e}),new window.FormData);l.forEach((e=>{let[t,n]=e;return a.append(t,n)}));try{await L()({url:window._wpMetaBoxUrl,method:"POST",body:a,parse:!1}),o.metaBoxUpdatesSuccess()}catch{o.metaBoxUpdatesFailure()}};function Ze(){return{type:"META_BOX_UPDATES_SUCCESS"}}function Ke(){return{type:"META_BOX_UPDATES_FAILURE"}}function Ye(e){return{type:"SET_PREVIEW_DEVICE_TYPE",deviceType:e}}function Xe(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Qe(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}function Je(e){return{type:"SET_IS_EDITING_TEMPLATE",value:e}}const et=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t=>{let{registry:n,select:o,dispatch:r}=t;r(Je(!0));if(!o.isFeatureActive("welcomeGuideTemplate")){const t=e?(0,f.__)("Custom template created. You're in template mode now."):(0,f.__)("Editing template. Changes made here affect all posts and pages that use the template.");n.dispatch(T.store).createSuccessNotice(t,{type:"snackbar"})}}},tt=e=>async t=>{let{registry:n}=t;const o=await n.dispatch(Be.store).saveEntityRecord("postType","wp_template",e),r=n.select(x.store).getCurrentPost();n.dispatch(Be.store).editEntityRecord("postType",r.type,r.id,{template:o.slug})};let nt=!1;const ot=()=>e=>{let{registry:t,select:n,dispatch:o}=e;if(!t.select(x.store).__unstableIsEditorReady())return;if(nt)return;const r=t.select(x.store).getCurrentPostType();window.postboxes.page!==r&&window.postboxes.add_postbox_toggles(r),nt=!0;let l=t.select(x.store).isSavingPost(),a=t.select(x.store).isAutosavingPost();t.subscribe((async()=>{const e=t.select(x.store).isSavingPost(),r=t.select(x.store).isAutosavingPost(),i=l&&!a&&!e&&n.hasMetaBoxes();l=e,a=r,i&&await o.requestMetaBoxUpdates()})),o({type:"META_BOXES_INITIALIZED"})};var rt={};function lt(e){return[e]}function at(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function it(e,t){var n,o=t||lt;function r(e){var t,o,r,l,a,i=n,s=!0;for(t=0;t<e.length;t++){if(o=e[t],!(a=o)||"object"!=typeof a){s=!1;break}i.has(o)?i=i.get(o):(r=new WeakMap,i.set(o,r),i=r)}return i.has(rt)||((l=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=s,i.set(rt,l)),i.get(rt)}function l(){n=new WeakMap}function a(){var t,n,l,a,i,s=arguments.length;for(a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];for((t=r(i=o.apply(null,a))).isUniqueByDependants||(t.lastDependants&&!at(i,t.lastDependants,0)&&t.clear(),t.lastDependants=i),n=t.head;n;){if(at(n.args,a,1))return n!==t.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=t.head,n.prev=null,t.head.prev=n,t.head=n),n.val;n=n.next}return n={val:e.apply(null,a)},a[0]=null,n.args=a,t.head&&(t.head.prev=n,n.next=t.head),t.head=n,n.val}return a.getDependants=o,a.clear=l,l(),a}const st=[],ct={},dt=(0,u.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core/edit-post","editorMode"))&&void 0!==t?t:"visual"})),ut=(0,u.createRegistrySelector)((e=>()=>{const t=e(te).getActiveComplementaryArea("core/edit-post");return["edit-post/document","edit-post/block"].includes(t)})),mt=(0,u.createRegistrySelector)((e=>()=>{const t=e(te).getActiveComplementaryArea("core/edit-post");return!!t&&!["edit-post/document","edit-post/block"].includes(t)})),pt=(0,u.createRegistrySelector)((e=>()=>e(te).getActiveComplementaryArea("core/edit-post")));const gt=(0,u.createRegistrySelector)((e=>()=>{d()("select( 'core/edit-post' ).getPreferences",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const t=["hiddenBlockTypes","editorMode","preferredStyleVariations"].reduce(((t,n)=>({...t,[n]:e(p.store).get("core/edit-post",n)})),{}),n=function(e,t){var n;const o=null==e?void 0:e.reduce(((e,t)=>({...e,[t]:{enabled:!1}})),{}),r=null==t?void 0:t.reduce(((e,t)=>{const n=null==e?void 0:e[t];return{...e,[t]:{...n,opened:!0}}}),null!=o?o:{});return null!==(n=null!=r?r:o)&&void 0!==n?n:ct}(e(p.store).get("core/edit-post","inactivePanels"),e(p.store).get("core/edit-post","openPanels"));return{...t,panels:n}}));function ht(e,t,n){d()("select( 'core/edit-post' ).getPreference",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const o=gt(e)[t];return void 0===o?n:o}const _t=(0,u.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core/edit-post","hiddenBlockTypes"))&&void 0!==t?t:st}));function Et(e){return e.publishSidebarActive}function bt(e,t){return e.removedPanels.includes(t)}const ft=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get("core/edit-post","inactivePanels");return!(bt(t,n)||null!=o&&o.includes(n))})),vt=(0,u.createRegistrySelector)((e=>(t,n)=>{const o=e(p.store).get("core/edit-post","openPanels");return!(null==o||!o.includes(n))}));function yt(e,t){return e.activeModal===t}const wt=(0,u.createRegistrySelector)((e=>(t,n)=>!!e(p.store).get("core/edit-post",n))),St=(0,u.createRegistrySelector)((e=>(t,n)=>e(te).isItemPinned("core/edit-post",n))),kt=it((e=>Object.keys(e.metaBoxes.locations).filter((t=>Ct(e,t)))),(e=>[e.metaBoxes.locations]));function Pt(e,t){var n;return Ct(e,t)&&(null===(n=Tt(e,t))||void 0===n?void 0:n.some((t=>{let{id:n}=t;return ft(e,`meta-box-${n}`)})))}function Ct(e,t){const n=Tt(e,t);return!!n&&0!==n.length}function Tt(e,t){return e.metaBoxes.locations[t]}const xt=it((e=>Object.values(e.metaBoxes.locations).flat()),(e=>[e.metaBoxes.locations]));function Bt(e){return kt(e).length>0}function Mt(e){return e.metaBoxes.isSaving}function Nt(e){return e.deviceType}function It(e){return!!e.blockInserterPanel}function Dt(e){const{rootClientId:t,insertionIndex:n,filterValue:o}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:n,filterValue:o}}function At(e){return e.listViewPanel}function Lt(e){return e.isEditingTemplate}function Ot(e){return e.metaBoxes.initialized}const Vt=(0,u.createRegistrySelector)((e=>()=>{const t=e(x.store).getEditedPostAttribute("template");if(t){var n;const o=null===(n=e(Be.store).getEntityRecords("postType","wp_template",{per_page:-1}))||void 0===n?void 0:n.find((e=>e.slug===t));return o?e(Be.store).getEditedEntityRecord("postType","wp_template",o.id):o}const o=e(x.store).getCurrentPost();return o.link?e(Be.store).__experimentalGetTemplateForLink(o.link):null})),Ft="core/edit-post",Rt=(0,u.createReduxStore)(Ft,{reducer:D,actions:r,selectors:l});(0,u.register)(Rt);var Ht=(0,u.withDispatch)((e=>{const{openModal:t}=e(Rt);return{openModal:t}}))((function(e){let{openModal:t}=e;return(0,a.createElement)(E.MenuItem,{onClick:()=>{t("edit-post/keyboard-shortcut-help")},shortcut:M.displayShortcut.access("h")},(0,f.__)("Keyboard shortcuts"))})),Gt=window.lodash;const{Fill:Ut,Slot:zt}=(0,E.createSlotFill)("ToolsMoreMenuGroup");Ut.Slot=e=>{let{fillProps:t}=e;return(0,a.createElement)(zt,{fillProps:t},(e=>!(0,Gt.isEmpty)(e)&&(0,a.createElement)(E.MenuGroup,{label:(0,f.__)("Tools")},e)))};var Wt=Ut;function $t(){const e=(0,u.useSelect)((e=>e(Rt).isEditingTemplate()),[]);return(0,a.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:e?"welcomeGuideTemplate":"welcomeGuide",label:(0,f.__)("Welcome Guide")})}(0,P.registerPlugin)("edit-post",{render(){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Wt,null,(e=>{let{onClose:t}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(E.MenuItem,{role:"menuitem",href:(0,C.addQueryArgs)("edit.php",{post_type:"wp_block"})},(0,f.__)("Manage Reusable blocks")),(0,a.createElement)(Ht,{onSelect:t}),(0,a.createElement)($t,null),(0,a.createElement)(B,null),(0,a.createElement)(E.MenuItem,{role:"menuitem",icon:k,href:(0,f.__)("https://wordpress.org/support/article/wordpress-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,f.__)("Help"),(0,a.createElement)(E.VisuallyHidden,{as:"span"},(0,f.__)("(opens in a new tab)"))))})))}});var qt=window.wp.keyboardShortcuts;function jt(){const e=(0,u.useSelect)((e=>e(x.store).getEditorSettings().richEditingEnabled),[]),{switchEditorMode:t}=(0,u.useDispatch)(Rt);return(0,a.createElement)("div",{className:"edit-post-text-editor"},(0,a.createElement)(x.TextEditorGlobalKeyboardShortcuts,null),e&&(0,a.createElement)("div",{className:"edit-post-text-editor__toolbar"},(0,a.createElement)("h2",null,(0,f.__)("Editing code")),(0,a.createElement)(E.Button,{variant:"tertiary",onClick:()=>t("visual"),shortcut:M.displayShortcut.secondary("m")},(0,f.__)("Exit code editor"))),(0,a.createElement)("div",{className:"edit-post-text-editor__body"},(0,a.createElement)(x.PostTitle,null),(0,a.createElement)(x.PostTextEditor,null)))}var Zt=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"}));function Kt(e){let{children:t,contentRef:n,shouldIframe:o,styles:r,style:l}=e;const i=(0,b.__unstableUseMouseMoveTypingReset)();return o?(0,a.createElement)(b.__unstableIframe,{head:(0,a.createElement)(b.__unstableEditorStyles,{styles:r}),ref:i,contentRef:n,style:{width:"100%",height:"100%",display:"block"},name:"editor-canvas"},t):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(b.__unstableEditorStyles,{styles:r}),(0,a.createElement)(b.WritingFlow,{ref:n,className:"editor-styles-wrapper",style:{flex:"1",...l},tabIndex:-1},t))}function Yt(e){for(let t=0;t<e.length;t++){if("core/post-content"===e[t].name)return e[t];if(e[t].innerBlocks.length){const n=Yt(e[t].innerBlocks);if(n)return n}}}function Xt(e){var t;let{styles:n}=e;const{deviceType:o,isWelcomeGuideVisible:r,isTemplateMode:l,editedPostTemplate:s={},wrapperBlockName:c,wrapperUniqueId:d,isBlockBasedTheme:m}=(0,u.useSelect)((e=>{const{isFeatureActive:t,isEditingTemplate:n,__experimentalGetPreviewDeviceType:o,getEditedPostTemplate:r}=e(Rt),{getCurrentPostId:l,getCurrentPostType:a,getEditorSettings:i}=e(x.store),s=n();let c;"wp_block"===a()?c="core/block":s||(c="core/post-content");const d=i(),u=d.supportsTemplateMode,m=e(Be.store).canUser("create","templates");return{deviceType:o(),isWelcomeGuideVisible:t("welcomeGuide"),isTemplateMode:s,editedPostTemplate:u&&m?r():void 0,wrapperBlockName:c,wrapperUniqueId:l(),isBlockBasedTheme:d.__unstableIsBlockBasedTheme}}),[]),{isCleanNewPost:p}=(0,u.useSelect)(x.store),g=(0,u.useSelect)((e=>e(Rt).hasMetaBoxes()),[]),{themeHasDisabledLayoutStyles:h,themeSupportsLayout:_,isFocusMode:y}=(0,u.useSelect)((e=>{const t=e(b.store).getSettings();return{themeHasDisabledLayoutStyles:t.disableLayoutStyles,themeSupportsLayout:t.supportsLayout,isFocusMode:t.focusMode}}),[]),{clearSelectedBlock:w}=(0,u.useDispatch)(b.store),{setIsEditingTemplate:S}=(0,u.useDispatch)(Rt),k={height:"100%",width:"100%",margin:0,display:"flex",flexFlow:"column",background:"white"},P={...k,borderRadius:"2px 2px 0 0",border:"1px solid #ddd",borderBottom:0},C=(0,b.__experimentalUseResizeCanvas)(o,l),T=(0,b.useSetting)("layout"),B="is-"+o.toLowerCase()+"-preview";let M,N=l?P:k;C&&(N=C),g||C||l||(M="40vh");const I=(0,a.useRef)(),D=(0,v.useMergeRefs)([I,(0,b.__unstableUseClipboardHandler)(),(0,b.__unstableUseTypewriter)(),(0,b.__unstableUseTypingObserver)(),(0,b.__unstableUseBlockSelectionClearer)()]),A=(0,b.__unstableUseBlockSelectionClearer)(),L=(0,a.useMemo)((()=>l?{type:"default"}:_?{...T,type:"constrained"}:{type:"default"}),[l,_,T]),O=(0,a.useMemo)((()=>{if(null!=s&&s.blocks)return Yt(null==s?void 0:s.blocks);const e="string"==typeof(null==s?void 0:s.content)?null==s?void 0:s.content:"";return Yt((0,i.parse)(e))||{}}),[null==s?void 0:s.content,null==s?void 0:s.blocks]),F=(0,b.__experimentaluseLayoutClasses)(O),R=V()({"is-layout-flow":!_},_&&F),H=(0,b.__experimentaluseLayoutStyles)(O,".block-editor-block-list__layout.is-root-container"),G=(null==O||null===(t=O.attributes)||void 0===t?void 0:t.layout)||{},U=(0,a.useMemo)((()=>G&&("constrained"===(null==G?void 0:G.type)||null!=G&&G.inherit||null!=G&&G.contentSize||null!=G&&G.wideSize)?{...T,...G,type:"constrained"}:{...T,...G,type:"default"}),[null==G?void 0:G.type,null==G?void 0:G.inherit,null==G?void 0:G.contentSize,null==G?void 0:G.wideSize,T]),z=null!=O&&O.isValid?U:L,W=(0,a.useRef)();return(0,a.useEffect)((()=>{var e;!r&&p()&&(null==W||null===(e=W.current)||void 0===e||e.focus())}),[r,p]),n=(0,a.useMemo)((()=>[...n,{css:".edit-post-visual-editor__post-title-wrapper{margin-top:4rem}"+(M?`body{padding-bottom:${M}}`:"")}]),[n]),(0,a.createElement)(b.BlockTools,{__unstableContentRef:I,className:V()("edit-post-visual-editor",{"is-template-mode":l})},(0,a.createElement)(x.VisualEditorGlobalKeyboardShortcuts,null),(0,a.createElement)(E.__unstableMotion.div,{className:"edit-post-visual-editor__content-area",animate:{padding:l?"48px 48px 0":"0"},ref:A},l&&(0,a.createElement)(E.Button,{className:"edit-post-visual-editor__exit-template-mode",icon:Zt,onClick:()=>{w(),S(!1)}},(0,f.__)("Back")),(0,a.createElement)(E.__unstableMotion.div,{animate:N,initial:k,className:B},(0,a.createElement)(Kt,{shouldIframe:l||"Tablet"===o||"Mobile"===o,contentRef:D,styles:n},_&&!h&&!l&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(b.__experimentalLayoutStyle,{selector:".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",layout:L,layoutDefinitions:null==T?void 0:T.definitions}),H&&(0,a.createElement)(b.__experimentalLayoutStyle,{layout:U,css:H,layoutDefinitions:null==T?void 0:T.definitions})),!l&&(0,a.createElement)("div",{className:V()("is-root-container","block-editor-block-list__layout","edit-post-visual-editor__post-title-wrapper",{"is-focus-mode":y},R),contentEditable:!1},(0,a.createElement)(x.PostTitle,{ref:W})),(0,a.createElement)(b.__experimentalRecursionProvider,{blockName:c,uniqueId:d},(0,a.createElement)(b.BlockList,{className:l?"wp-site-blocks":`${R} wp-block-post-content`,__experimentalLayout:z}))))))}var Qt=function(){const{getBlockSelectionStart:e}=(0,u.useSelect)(b.store),{getEditorMode:t,isEditorSidebarOpened:n,isListViewOpened:o,isFeatureActive:r}=(0,u.useSelect)(Rt),l=(0,u.useSelect)((e=>{const{richEditingEnabled:t,codeEditingEnabled:n}=e(x.store).getEditorSettings();return!t||!n}),[]),{createInfoNotice:s}=(0,u.useDispatch)(T.store),{switchEditorMode:c,openGeneralSidebar:d,closeGeneralSidebar:m,toggleFeature:g,setIsListViewOpened:h,setIsInserterOpened:_}=(0,u.useDispatch)(Rt),{registerShortcut:E}=(0,u.useDispatch)(qt.store),{set:v}=(0,u.useDispatch)(p.store),{replaceBlocks:y}=(0,u.useDispatch)(b.store),{getBlockName:w,getSelectedBlockClientId:S,getBlockAttributes:k}=(0,u.useSelect)(b.store),P=(e,t)=>{e.preventDefault();const n=0===t?"core/paragraph":"core/heading",o=S();if(null===o)return;const r=w(o);if("core/paragraph"!==r&&"core/heading"!==r)return;const l=k(o),{content:a,align:s}=l;y(o,(0,i.createBlock)(n,{level:t,content:a,align:s}))};return(0,a.useEffect)((()=>{E({name:"core/edit-post/toggle-mode",category:"global",description:(0,f.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),E({name:"core/edit-post/toggle-distraction-free",category:"global",description:(0,f.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}}),E({name:"core/edit-post/toggle-fullscreen",category:"global",description:(0,f.__)("Toggle fullscreen mode."),keyCombination:{modifier:"secondary",character:"f"}}),E({name:"core/edit-post/toggle-list-view",category:"global",description:(0,f.__)("Open the block list view."),keyCombination:{modifier:"access",character:"o"}}),E({name:"core/edit-post/toggle-sidebar",category:"global",description:(0,f.__)("Show or hide the settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),E({name:"core/edit-post/next-region",category:"global",description:(0,f.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),E({name:"core/edit-post/previous-region",category:"global",description:(0,f.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),E({name:"core/edit-post/keyboard-shortcuts",category:"main",description:(0,f.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),E({name:"core/block-editor/transform-heading-to-paragraph",category:"block-library",description:(0,f.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((e=>{E({name:`core/block-editor/transform-paragraph-to-heading-${e}`,category:"block-library",description:(0,f.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${e}`}})}))}),[]),(0,qt.useShortcut)("core/edit-post/toggle-mode",(()=>{c("visual"===t()?"text":"visual")}),{isDisabled:l}),(0,qt.useShortcut)("core/edit-post/toggle-fullscreen",(()=>{g("fullscreenMode")})),(0,qt.useShortcut)("core/edit-post/toggle-distraction-free",(()=>{m(),h(!1),v("core/edit-post","fixedToolbar",!1),_(!1),h(!1),m(),g("distractionFree"),s(r("distractionFree")?(0,f.__)("Distraction free mode turned on."):(0,f.__)("Distraction free mode turned off."),{id:"core/edit-post/distraction-free-mode/notice",type:"snackbar"})})),(0,qt.useShortcut)("core/edit-post/toggle-sidebar",(t=>{if(t.preventDefault(),n())m();else{const t=e()?"edit-post/block":"edit-post/document";d(t)}})),(0,qt.useShortcut)("core/edit-post/toggle-list-view",(()=>h(!o()))),(0,qt.useShortcut)("core/block-editor/transform-heading-to-paragraph",(e=>P(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,qt.useShortcut)(`core/block-editor/transform-paragraph-to-heading-${e}`,(t=>P(t,e)))})),null};const Jt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,f.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,f.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,f.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,f.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,f.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,f.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,f.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,f.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,f.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,f.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function en(e){let{keyCombination:t,forceAriaLabel:n}=e;const o=t.modifier?M.displayShortcutList[t.modifier](t.character):t.character,r=t.modifier?M.shortcutAriaLabel[t.modifier](t.character):t.character;return(0,a.createElement)("kbd",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":n||r},(Array.isArray(o)?o:[o]).map(((e,t)=>"+"===e?(0,a.createElement)(a.Fragment,{key:t},e):(0,a.createElement)("kbd",{key:t,className:"edit-post-keyboard-shortcut-help-modal__shortcut-key"},e))))}var tn=function(e){let{description:t,keyCombination:n,aliases:o=[],ariaLabel:r}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-description"},t),(0,a.createElement)("div",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-term"},(0,a.createElement)(en,{keyCombination:n,forceAriaLabel:r}),o.map(((e,t)=>(0,a.createElement)(en,{keyCombination:e,forceAriaLabel:r,key:t})))))};var nn=function(e){let{name:t}=e;const{keyCombination:n,description:o,aliases:r}=(0,u.useSelect)((e=>{const{getShortcutKeyCombination:n,getShortcutDescription:o,getShortcutAliases:r}=e(qt.store);return{keyCombination:n(t),aliases:r(t),description:o(t)}}),[t]);return n?(0,a.createElement)(tn,{keyCombination:n,description:o,aliases:r}):null};const on="edit-post/keyboard-shortcut-help",rn=e=>{let{shortcuts:t}=e;return(0,a.createElement)("ul",{className:"edit-post-keyboard-shortcut-help-modal__shortcut-list",role:"list"},t.map(((e,t)=>(0,a.createElement)("li",{className:"edit-post-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,a.createElement)(nn,{name:e}):(0,a.createElement)(tn,e)))))},ln=e=>{let{title:t,shortcuts:n,className:o}=e;return(0,a.createElement)("section",{className:V()("edit-post-keyboard-shortcut-help-modal__section",o)},!!t&&(0,a.createElement)("h2",{className:"edit-post-keyboard-shortcut-help-modal__section-title"},t),(0,a.createElement)(rn,{shortcuts:n}))},an=e=>{let{title:t,categoryName:n,additionalShortcuts:o=[]}=e;const r=(0,u.useSelect)((e=>e(qt.store).getCategoryShortcuts(n)),[n]);return(0,a.createElement)(ln,{title:t,shortcuts:r.concat(o)})};var sn=(0,v.compose)([(0,u.withSelect)((e=>({isModalActive:e(Rt).isModalActive(on)}))),(0,u.withDispatch)(((e,t)=>{let{isModalActive:n}=t;const{openModal:o,closeModal:r}=e(Rt);return{toggleModal:()=>n?r():o(on)}}))])((function(e){let{isModalActive:t,toggleModal:n}=e;return(0,qt.useShortcut)("core/edit-post/keyboard-shortcuts",n),t?(0,a.createElement)(E.Modal,{className:"edit-post-keyboard-shortcut-help-modal",title:(0,f.__)("Keyboard shortcuts"),closeButtonLabel:(0,f.__)("Close"),onRequestClose:n},(0,a.createElement)(ln,{className:"edit-post-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-post/keyboard-shortcuts"]}),(0,a.createElement)(an,{title:(0,f.__)("Global shortcuts"),categoryName:"global"}),(0,a.createElement)(an,{title:(0,f.__)("Selection shortcuts"),categoryName:"selection"}),(0,a.createElement)(an,{title:(0,f.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,f.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,f.__)("Forward-slash")}]}),(0,a.createElement)(ln,{title:(0,f.__)("Text formatting"),shortcuts:Jt})):null}));function cn(e){let{willEnable:t}=e;const[n,o]=(0,a.useState)(!1);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",{className:"edit-post-preferences-modal__custom-fields-confirmation-message"},(0,f.__)("A page reload is required for this change. Make sure your content is saved before reloading.")),(0,a.createElement)(E.Button,{className:"edit-post-preferences-modal__custom-fields-confirmation-button",variant:"secondary",isBusy:n,disabled:n,onClick:()=>{o(!0),document.getElementById("toggle-custom-fields-form").submit()}},t?(0,f.__)("Enable & Reload"):(0,f.__)("Disable & Reload")))}var dn=(0,u.withSelect)((e=>({areCustomFieldsEnabled:!!e(x.store).getEditorSettings().enableCustomFields})))((function(e){let{label:t,areCustomFieldsEnabled:n}=e;const[o,r]=(0,a.useState)(n);return(0,a.createElement)(Te,{label:t,isChecked:o,onChange:r},o!==n&&(0,a.createElement)(cn,{willEnable:o}))})),un=(0,v.compose)((0,u.withSelect)(((e,t)=>{let{panelName:n}=t;const{isEditorPanelEnabled:o,isEditorPanelRemoved:r}=e(Rt);return{isRemoved:r(n),isChecked:o(n)}})),(0,v.ifCondition)((e=>{let{isRemoved:t}=e;return!t})),(0,u.withDispatch)(((e,t)=>{let{panelName:n}=t;return{onChange:()=>e(Rt).toggleEditorPanelEnabled(n)}})))(Te);const{Fill:mn,Slot:pn}=(0,E.createSlotFill)("EnablePluginDocumentSettingPanelOption"),gn=e=>{let{label:t,panelName:n}=e;return(0,a.createElement)(mn,null,(0,a.createElement)(un,{label:t,panelName:n}))};gn.Slot=pn;var hn=gn,_n=(0,v.compose)((0,u.withSelect)((e=>({isChecked:e(x.store).isPublishSidebarEnabled()}))),(0,u.withDispatch)((e=>{const{enablePublishSidebar:t,disablePublishSidebar:n}=e(x.store);return{onChange:e=>e?t():n()}})),(0,G.ifViewportMatches)("medium"))(Te),En=(0,v.compose)((0,u.withSelect)(((e,t)=>{let{featureName:n}=t;const{isFeatureActive:o}=e(Rt);return{isChecked:o(n)}})),(0,u.withDispatch)(((e,t)=>{let{featureName:n,onToggle:o=(()=>{})}=t;return{onChange:()=>{o(),e(Rt).toggleFeature(n)}}})))(Te);var bn=(0,u.withSelect)((e=>{const{getEditorSettings:t}=e(x.store),{getAllMetaBoxes:n}=e(Rt);return{areCustomFieldsRegistered:void 0!==t().enableCustomFields,metaBoxes:n()}}))((function(e){let{areCustomFieldsRegistered:t,metaBoxes:n,...o}=e;const r=n.filter((e=>{let{id:t}=e;return"postcustom"!==t}));return t||0!==r.length?(0,a.createElement)(Ce,o,t&&(0,a.createElement)(dn,{label:(0,f.__)("Custom fields")}),r.map((e=>{let{id:t,title:n}=e;return(0,a.createElement)(un,{key:t,label:n,panelName:`meta-box-${t}`})}))):null}));var fn=function(e){let{blockTypes:t,value:n,onItemChange:o}=e;return(0,a.createElement)("ul",{className:"edit-post-block-manager__checklist"},t.map((e=>(0,a.createElement)("li",{key:e.name,className:"edit-post-block-manager__checklist-item"},(0,a.createElement)(E.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.title,checked:n.includes(e.name),onChange:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return o(e.name,...n)}}),(0,a.createElement)(b.BlockIcon,{icon:e.icon})))))};var vn=function e(t){let{title:n,blockTypes:o}=t;const r=(0,v.useInstanceId)(e),{defaultAllowedBlockTypes:l,hiddenBlockTypes:i}=(0,u.useSelect)((e=>{const{getEditorSettings:t}=e(x.store),{getHiddenBlockTypes:n}=e(Rt);return{defaultAllowedBlockTypes:t().defaultAllowedBlockTypes,hiddenBlockTypes:n()}}),[]),s=(0,a.useMemo)((()=>!0===l?o:o.filter((e=>{let{name:t}=e;return null==l?void 0:l.includes(t)}))),[l,o]),{showBlockTypes:c,hideBlockTypes:d}=(0,u.useDispatch)(Rt),m=(0,a.useCallback)(((e,t)=>{t?c(e):d(e)}),[]),p=(0,a.useCallback)((e=>{const t=o.map((e=>{let{name:t}=e;return t}));e?c(t):d(t)}),[o]);if(!s.length)return null;const g=s.map((e=>{let{name:t}=e;return t})).filter((e=>!i.includes(e))),h="edit-post-block-manager__category-title-"+r,_=g.length===s.length,b=!_&&g.length>0;return(0,a.createElement)("div",{role:"group","aria-labelledby":h,className:"edit-post-block-manager__category"},(0,a.createElement)(E.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:_,onChange:p,className:"edit-post-block-manager__category-title",indeterminate:b,label:(0,a.createElement)("span",{id:h},n)}),(0,a.createElement)(fn,{blockTypes:s,value:g,onItemChange:m}))};var yn=(0,u.withSelect)((e=>{const{getBlockTypes:t,getCategories:n,hasBlockSupport:o,isMatchingSearchTerm:r}=e(i.store),{getHiddenBlockTypes:l}=e(Rt),a=t(),s=l().filter((e=>a.some((t=>t.name===e)))),c=Array.isArray(s)&&s.length;return{blockTypes:a,categories:n(),hasBlockSupport:o,isMatchingSearchTerm:r,numberOfHiddenBlocks:c}}))((function(e){let{blockTypes:t,categories:n,hasBlockSupport:o,isMatchingSearchTerm:r,numberOfHiddenBlocks:l}=e;const i=(0,v.useDebounce)(xe.speak,500),[s,c]=(0,a.useState)("");return t=t.filter((e=>o(e,"inserter",!0)&&(!s||r(e,s))&&(!e.parent||e.parent.includes("core/post-content")))),(0,a.useEffect)((()=>{if(!s)return;const e=t.length,n=(0,f.sprintf)((0,f._n)("%d result found.","%d results found.",e),e);i(n)}),[t.length,s,i]),(0,a.createElement)("div",{className:"edit-post-block-manager__content"},!!l&&(0,a.createElement)("div",{className:"edit-post-block-manager__disabled-blocks-count"},(0,f.sprintf)((0,f._n)("%d block is hidden.","%d blocks are hidden.",l),l)),(0,a.createElement)(E.SearchControl,{__nextHasNoMarginBottom:!0,label:(0,f.__)("Search for a block"),placeholder:(0,f.__)("Search for a block"),value:s,onChange:e=>c(e),className:"edit-post-block-manager__search"}),(0,a.createElement)("div",{tabIndex:"0",role:"region","aria-label":(0,f.__)("Available block types"),className:"edit-post-block-manager__results"},0===t.length&&(0,a.createElement)("p",{className:"edit-post-block-manager__no-results"},(0,f.__)("No blocks found.")),n.map((e=>(0,a.createElement)(vn,{key:e.slug,title:e.title,blockTypes:t.filter((t=>t.category===e.slug))}))),(0,a.createElement)(vn,{title:(0,f.__)("Uncategorized"),blockTypes:t.filter((e=>{let{category:t}=e;return!t}))})))}));function wn(){const e=(0,v.useViewportMatch)("medium"),{closeModal:t}=(0,u.useDispatch)(Rt),[n,o]=(0,u.useSelect)((t=>{const{getEditorSettings:n}=t(x.store),{getEditorMode:o,isFeatureActive:r}=t(Rt),l=t(Rt).isModalActive("edit-post/preferences"),a=o(),i=n().richEditingEnabled,s=r("distractionFree");return[l,!s&&e&&i&&"visual"===a,s]}),[e]),{closeGeneralSidebar:r,setIsListViewOpened:l,setIsInserterOpened:i}=(0,u.useDispatch)(Rt),{set:s}=(0,u.useDispatch)(p.store),c=()=>{s("core/edit-post","fixedToolbar",!1),i(!1),l(!1),r()},d=(0,a.useMemo)((()=>[{name:"general",tabLabel:(0,f.__)("General"),content:(0,a.createElement)(a.Fragment,null,e&&(0,a.createElement)(Ce,{title:(0,f.__)("Publishing"),description:(0,f.__)("Change options related to publishing.")},(0,a.createElement)(_n,{help:(0,f.__)("Review settings, such as visibility and tags."),label:(0,f.__)("Include pre-publish checklist")})),(0,a.createElement)(Ce,{title:(0,f.__)("Appearance"),description:(0,f.__)("Customize options related to the block editor interface and editing flow.")},(0,a.createElement)(En,{featureName:"distractionFree",onToggle:c,help:(0,f.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,f.__)("Distraction free")}),(0,a.createElement)(En,{featureName:"focusMode",help:(0,f.__)("Highlights the current block and fades other content."),label:(0,f.__)("Spotlight mode")}),(0,a.createElement)(En,{featureName:"showIconLabels",label:(0,f.__)("Show button text labels"),help:(0,f.__)("Show text instead of icons on buttons.")}),(0,a.createElement)(En,{featureName:"showListViewByDefault",help:(0,f.__)("Opens the block list view sidebar by default."),label:(0,f.__)("Always open list view")}),(0,a.createElement)(En,{featureName:"themeStyles",help:(0,f.__)("Make the editor look like your theme."),label:(0,f.__)("Use theme styles")}),o&&(0,a.createElement)(En,{featureName:"showBlockBreadcrumbs",help:(0,f.__)("Shows block breadcrumbs at the bottom of the editor."),label:(0,f.__)("Display block breadcrumbs")})))},{name:"blocks",tabLabel:(0,f.__)("Blocks"),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ce,{title:(0,f.__)("Block interactions"),description:(0,f.__)("Customize how you interact with blocks in the block library and editing canvas.")},(0,a.createElement)(En,{featureName:"mostUsedBlocks",help:(0,f.__)("Places the most frequent blocks in the block library."),label:(0,f.__)("Show most used blocks")}),(0,a.createElement)(En,{featureName:"keepCaretInsideBlock",help:(0,f.__)("Aids screen readers by stopping text caret from leaving blocks."),label:(0,f.__)("Contain text cursor inside block")})),(0,a.createElement)(Ce,{title:(0,f.__)("Visible blocks"),description:(0,f.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")},(0,a.createElement)(yn,null)))},{name:"panels",tabLabel:(0,f.__)("Panels"),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ce,{title:(0,f.__)("Document settings"),description:(0,f.__)("Choose what displays in the panel.")},(0,a.createElement)(hn.Slot,null),(0,a.createElement)(x.PostTaxonomies,{taxonomyWrapper:(e,t)=>(0,a.createElement)(un,{label:(0,Gt.get)(t,["labels","menu_name"]),panelName:`taxonomy-panel-${t.slug}`})}),(0,a.createElement)(x.PostFeaturedImageCheck,null,(0,a.createElement)(un,{label:(0,f.__)("Featured image"),panelName:"featured-image"})),(0,a.createElement)(x.PostExcerptCheck,null,(0,a.createElement)(un,{label:(0,f.__)("Excerpt"),panelName:"post-excerpt"})),(0,a.createElement)(x.PostTypeSupportCheck,{supportKeys:["comments","trackbacks"]},(0,a.createElement)(un,{label:(0,f.__)("Discussion"),panelName:"discussion-panel"})),(0,a.createElement)(x.PageAttributesCheck,null,(0,a.createElement)(un,{label:(0,f.__)("Page attributes"),panelName:"page-attributes"}))),(0,a.createElement)(bn,{title:(0,f.__)("Additional"),description:(0,f.__)("Add extra areas to the editor.")}))}]),[e,o]);return n?(0,a.createElement)(ve,{closeModal:t},(0,a.createElement)(Pe,{sections:d})):null}class Sn extends a.Component{constructor(){super(...arguments),this.state={historyId:null}}componentDidUpdate(e){const{postId:t,postStatus:n,postType:o,isSavingPost:r}=this.props,{historyId:l}=this.state;"trash"!==n||r?t===e.postId&&t===l||"auto-draft"===n||!t||this.setBrowserURL(t):this.setTrashURL(t,o)}setTrashURL(e,t){window.location.href=function(e,t){return(0,C.addQueryArgs)("edit.php",{trashed:1,post_type:t,ids:e})}(e,t)}setBrowserURL(e){window.history.replaceState({id:e},"Post "+e,function(e){return(0,C.addQueryArgs)("post.php",{post:e,action:"edit"})}(e)),this.setState((()=>({historyId:e})))}render(){return null}}var kn=(0,u.withSelect)((e=>{const{getCurrentPost:t,isSavingPost:n}=e(x.store),o=t();let{id:r,status:l,type:a}=o;return["wp_template","wp_template_part"].includes(a)&&(r=o.wp_id),{postId:r,postStatus:l,postType:a,isSavingPost:n()}}))(Sn);var Pn=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,a.createElement)(S.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));var Cn=function(e){let{showTooltip:t,icon:n,href:o}=e;const{isActive:r,isRequestingSiteIcon:l,postType:i,siteIconUrl:s}=(0,u.useSelect)((e=>{const{getCurrentPostType:t}=e(x.store),{isFeatureActive:n}=e(Rt),{getEntityRecord:o,getPostType:r,isResolving:l}=e(Be.store),a=o("root","__unstableBase",void 0)||{};return{isActive:n("fullscreenMode"),isRequestingSiteIcon:l("getEntityRecord",["root","__unstableBase",void 0]),postType:r(t()),siteIconUrl:a.site_icon_url}}),[]),c=(0,v.useReducedMotion)();if(!r||!i)return null;let d=(0,a.createElement)(E.Icon,{size:"36px",icon:Pn});const m={expand:{scale:1.25,transition:{type:"tween",duration:"0.3"}}};s&&(d=(0,a.createElement)(E.__unstableMotion.img,{variants:!c&&m,alt:(0,f.__)("Site Icon"),className:"edit-post-fullscreen-mode-close_site-icon",src:s})),l&&(d=null),n&&(d=(0,a.createElement)(E.Icon,{size:"36px",icon:n}));const p=V()({"edit-post-fullscreen-mode-close":!0,"has-icon":s});return(0,a.createElement)(E.__unstableMotion.div,{whileHover:"expand"},(0,a.createElement)(E.Button,{className:p,href:null!=o?o:(0,C.addQueryArgs)("edit.php",{post_type:i.slug}),label:(0,Gt.get)(i,["labels","view_items"],(0,f.__)("Back")),showTooltip:t},d))};var Tn=(0,a.createElement)(S.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(S.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));var xn=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const Bn=e=>{e.preventDefault()};var Mn=function(){const e=(0,a.useRef)(),{setIsInserterOpened:t,setIsListViewOpened:n}=(0,u.useDispatch)(Rt),{isInserterEnabled:o,isInserterOpened:r,isTextModeEnabled:l,showIconLabels:i,isListViewOpen:s,listViewShortcut:c}=(0,u.useSelect)((e=>{const{hasInserterItems:t,getBlockRootClientId:n,getBlockSelectionEnd:o}=e(b.store),{getEditorSettings:r}=e(x.store),{getEditorMode:l,isFeatureActive:a,isListViewOpened:i}=e(Rt),{getShortcutRepresentation:s}=e(qt.store);return{isInserterEnabled:"visual"===l()&&r().richEditingEnabled&&t(n(o())),isInserterOpened:e(Rt).isInserterOpened(),isTextModeEnabled:"text"===l(),showIconLabels:a("showIconLabels"),isListViewOpen:i(),listViewShortcut:s("core/edit-post/toggle-list-view")}}),[]),d=(0,v.useViewportMatch)("medium"),m=(0,v.useViewportMatch)("wide"),p=(0,f.__)("Document tools"),g=(0,a.useCallback)((()=>n(!s)),[n,s]),h=(0,a.createElement)(a.Fragment,null,(0,a.createElement)(E.ToolbarItem,{as:E.Button,className:"edit-post-header-toolbar__document-overview-toggle",icon:Tn,disabled:l,isPressed:s,label:(0,f.__)("Document Overview"),onClick:g,shortcut:c,showTooltip:!i,variant:i?"tertiary":void 0})),_=(0,a.useCallback)((()=>{r?(e.current.focus(),t(!1)):t(!0)}),[r,t]),y=(0,f._x)("Toggle block inserter","Generic label for block inserter button"),w=r?(0,f.__)("Close"):(0,f.__)("Add");return(0,a.createElement)(b.NavigableToolbar,{className:"edit-post-header-toolbar","aria-label":p},(0,a.createElement)("div",{className:"edit-post-header-toolbar__left"},(0,a.createElement)(E.ToolbarItem,{ref:e,as:E.Button,className:"edit-post-header-toolbar__inserter-toggle",variant:"primary",isPressed:r,onMouseDown:Bn,onClick:_,disabled:!o,icon:xn,label:i?w:y,showTooltip:!i}),(m||!i)&&(0,a.createElement)(a.Fragment,null,d&&(0,a.createElement)(E.ToolbarItem,{as:b.ToolSelector,showTooltip:!i,variant:i?"tertiary":void 0,disabled:l}),(0,a.createElement)(E.ToolbarItem,{as:x.EditorHistoryUndo,showTooltip:!i,variant:i?"tertiary":void 0}),(0,a.createElement)(E.ToolbarItem,{as:x.EditorHistoryRedo,showTooltip:!i,variant:i?"tertiary":void 0}),h)))};const Nn=[{value:"visual",label:(0,f.__)("Visual editor")},{value:"text",label:(0,f.__)("Code editor")}];var In=function(){const{shortcut:e,isRichEditingEnabled:t,isCodeEditingEnabled:n,isEditingTemplate:o,mode:r}=(0,u.useSelect)((e=>({shortcut:e(qt.store).getShortcutRepresentation("core/edit-post/toggle-mode"),isRichEditingEnabled:e(x.store).getEditorSettings().richEditingEnabled,isCodeEditingEnabled:e(x.store).getEditorSettings().codeEditingEnabled,isEditingTemplate:e(Rt).isEditingTemplate(),mode:e(Rt).getEditorMode()})),[]),{switchEditorMode:l}=(0,u.useDispatch)(Rt);if(o)return null;if(!t||!n)return null;const i=Nn.map((t=>t.value!==r?{...t,shortcut:e}:t));return(0,a.createElement)(E.MenuGroup,{label:(0,f.__)("Editor")},(0,a.createElement)(E.MenuItemsChoice,{choices:i,value:r,onSelect:l}))};function Dn(){const{openModal:e}=(0,u.useDispatch)(Rt);return(0,a.createElement)(E.MenuItem,{onClick:()=>{e("edit-post/preferences")}},(0,f.__)("Preferences"))}var An=function(){const e=(0,u.useRegistry)(),t=(0,u.useSelect)((e=>e(b.store).getSettings().isDistractionFree),[]),n=(0,u.useSelect)((e=>e(b.store).getBlocks()),[]),{setIsInserterOpened:o,setIsListViewOpened:r,closeGeneralSidebar:l}=(0,u.useDispatch)(Rt),{set:i}=(0,u.useDispatch)(p.store),{selectBlock:s}=(0,u.useDispatch)(b.store);return(0,v.useViewportMatch)("medium")?(0,a.createElement)(E.MenuGroup,{label:(0,f._x)("View","noun")},(0,a.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",disabled:t,name:"fixedToolbar",label:(0,f.__)("Top toolbar"),info:(0,f.__)("Access all block and document tools in a single place"),messageActivated:(0,f.__)("Top toolbar activated"),messageDeactivated:(0,f.__)("Top toolbar deactivated")}),(0,a.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"focusMode",label:(0,f.__)("Spotlight mode"),info:(0,f.__)("Focus on one block at a time"),messageActivated:(0,f.__)("Spotlight mode activated"),messageDeactivated:(0,f.__)("Spotlight mode deactivated")}),(0,a.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"fullscreenMode",label:(0,f.__)("Fullscreen mode"),info:(0,f.__)("Show and hide admin UI"),messageActivated:(0,f.__)("Fullscreen mode activated"),messageDeactivated:(0,f.__)("Fullscreen mode deactivated"),shortcut:M.displayShortcut.secondary("f")}),(0,a.createElement)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"distractionFree",onToggle:()=>{e.batch((()=>{i("core/edit-post","fixedToolbar",!1),o(!1),r(!1),l(),!t&&n.length&&s(n[0].clientId)}))},label:(0,f.__)("Distraction free"),info:(0,f.__)("Write with calmness"),messageActivated:(0,f.__)("Distraction free mode activated"),messageDeactivated:(0,f.__)("Distraction free mode deactivated"),shortcut:M.displayShortcut.primaryShift("\\")})):null};var Ln=e=>{let{showIconLabels:t}=e;const n=(0,v.useViewportMatch)("large");return(0,a.createElement)(fe,{toggleProps:{showTooltip:!t,...t&&{variant:"tertiary"}}},(e=>{let{onClose:o}=e;return(0,a.createElement)(a.Fragment,null,t&&!n&&(0,a.createElement)(ue.Slot,{className:t&&"show-icon-labels",scope:"core/edit-post"}),(0,a.createElement)(An,null),(0,a.createElement)(In,null),(0,a.createElement)(ie.Slot,{name:"core/edit-post/plugin-more-menu",label:(0,f.__)("Plugins"),as:E.MenuGroup,fillProps:{onClick:o}}),(0,a.createElement)(Wt.Slot,{fillProps:{onClose:o}}),(0,a.createElement)(E.MenuGroup,null,(0,a.createElement)(Dn,null)))}))};var On=(0,v.compose)((0,u.withSelect)((e=>({hasPublishAction:(0,Gt.get)(e(x.store).getCurrentPost(),["_links","wp:action-publish"],!1),isBeingScheduled:e(x.store).isEditedPostBeingScheduled(),isPending:e(x.store).isCurrentPostPending(),isPublished:e(x.store).isCurrentPostPublished(),isPublishSidebarEnabled:e(x.store).isPublishSidebarEnabled(),isPublishSidebarOpened:e(Rt).isPublishSidebarOpened(),isScheduled:e(x.store).isCurrentPostScheduled()}))),(0,u.withDispatch)((e=>{const{togglePublishSidebar:t}=e(Rt);return{togglePublishSidebar:t}})))((function(e){let{forceIsDirty:t,forceIsSaving:n,hasPublishAction:o,isBeingScheduled:r,isPending:l,isPublished:i,isPublishSidebarEnabled:s,isPublishSidebarOpened:c,isScheduled:d,togglePublishSidebar:u,setEntitiesSavedStatesCallback:m}=e;const p="toggle",g="button",h=(0,v.useViewportMatch)("medium","<");let _;return _=i||d&&r||l&&!o&&!h?g:h||s?p:g,(0,a.createElement)(x.PostPublishButton,{forceIsDirty:t,forceIsSaving:n,isOpen:c,isToggle:_===p,onToggle:u,setEntitiesSavedStatesCallback:m})}));function Vn(){const{hasActiveMetaboxes:e,isPostSaveable:t,isSaving:n,isViewable:o,deviceType:r}=(0,u.useSelect)((e=>{const{getEditedPostAttribute:t}=e(x.store),{getPostType:n}=e(Be.store),o=n(t("type"));return{hasActiveMetaboxes:e(Rt).hasMetaBoxes(),isSaving:e(Rt).isSavingMetaBoxes(),isPostSaveable:e(x.store).isEditedPostSaveable(),isViewable:(0,Gt.get)(o,["viewable"],!1),deviceType:e(Rt).__experimentalGetPreviewDeviceType()}}),[]),{__experimentalSetPreviewDeviceType:l}=(0,u.useDispatch)(Rt);return(0,a.createElement)(b.__experimentalPreviewOptions,{isEnabled:t,className:"edit-post-post-preview-dropdown",deviceType:r,setDeviceType:l,viewLabel:(0,f.__)("Preview")},o&&(0,a.createElement)(E.MenuGroup,null,(0,a.createElement)("div",{className:"edit-post-header-preview__grouping-external"},(0,a.createElement)(x.PostPreviewButton,{className:"edit-post-header-preview__button-external",role:"menuitem",forceIsAutosaveable:e,forcePreviewLink:n?null:void 0,textContent:(0,a.createElement)(a.Fragment,null,(0,f.__)("Preview in new tab"),(0,a.createElement)(E.Icon,{icon:k}))}))))}const Fn="__experimentalMainDashboardButton",{Fill:Rn,Slot:Hn}=(0,E.createSlotFill)(Fn),Gn=Rn;Gn.Slot=e=>{let{children:t}=e;const n=(0,E.__experimentalUseSlotFills)(Fn);return Boolean(n&&n.length)?(0,a.createElement)(Hn,{bubblesVirtually:!0}):t};var Un=Gn;var zn=(0,a.createElement)(S.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(S.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function Wn(){const{clearSelectedBlock:e}=(0,u.useDispatch)(b.store),{setIsEditingTemplate:t}=(0,u.useDispatch)(Rt),{getEditorSettings:n}=(0,u.useSelect)(x.store),{updateEditorSettings:o,editPost:r}=(0,u.useDispatch)(x.store),{deleteEntityRecord:l}=(0,u.useDispatch)(Be.store),{template:i}=(0,u.useSelect)((e=>{const{isEditingTemplate:t,getEditedPostTemplate:n}=e(Rt);return{template:t()?n():null}}),[]),[s,c]=(0,a.useState)(!1);if(!i||!i.wp_id)return null;let d=i.slug;null!=i&&i.title&&(d=i.title);const m=null==i?void 0:i.has_theme_file;return(0,a.createElement)(E.MenuGroup,{className:"edit-post-template-top-area__second-menu-group"},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(E.MenuItem,{className:"edit-post-template-top-area__delete-template-button",isDestructive:!m,onClick:()=>{c(!0)},info:m?(0,f.__)("Use the template as supplied by the theme."):void 0},m?(0,f.__)("Clear customizations"):(0,f.__)("Delete template")),(0,a.createElement)(E.__experimentalConfirmDialog,{isOpen:s,onConfirm:()=>{var a;e(),t(!1),c(!1),r({template:""});const s=n(),d=Object.fromEntries(Object.entries(null!==(a=s.availableTemplates)&&void 0!==a?a:{}).filter((e=>{let[t]=e;return t!==i.slug})));o({...s,availableTemplates:d}),l("postType","wp_template",i.id,{throwOnError:!0})},onCancel:()=>{c(!1)}},(0,f.sprintf)((0,f.__)("Are you sure you want to delete the %s template? It may be used by other pages or posts."),d))))}function $n(){const[e,t]=(0,a.useState)(!1),{template:n}=(0,u.useSelect)((e=>{const{getEditedPostTemplate:t}=e(Rt);return{template:t()}}),[]),{editEntityRecord:o}=(0,u.useDispatch)(Be.store),{getEditorSettings:r}=(0,u.useSelect)(x.store),{updateEditorSettings:l}=(0,u.useDispatch)(x.store);if(!n.is_custom||n.has_theme_file)return null;let i=(0,f.__)("Default");return null!=n&&n.title?i=n.title:n&&(i=n.slug),(0,a.createElement)("div",{className:"edit-site-template-details__group"},(0,a.createElement)(E.TextControl,{__nextHasNoMarginBottom:!0,label:(0,f.__)("Title"),value:e?"":i,help:(0,f.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),onChange:a=>{if(!a&&!e)return void t(!0);t(!1);const i=r(),s=(0,Gt.mapValues)(i.availableTemplates,((e,t)=>t!==n.slug?e:a));l({...i,availableTemplates:s}),o("postType","wp_template",n.id,{title:a})},onBlur:()=>t(!1)}))}function qn(){const{description:e,title:t}=(0,u.useSelect)((e=>{const{getEditedPostTemplate:t}=e(Rt);return{title:t().title,description:t().description}}),[]);return e?(0,a.createElement)("div",{className:"edit-site-template-details__group"},(0,a.createElement)(E.__experimentalHeading,{level:4,weight:600},t),(0,a.createElement)(E.__experimentalText,{className:"edit-post-template-details__description",size:"body",as:"p",style:{marginTop:"12px"}},e)):null}var jn=function(){const{template:e,isEditing:t,title:n}=(0,u.useSelect)((e=>{const{isEditingTemplate:t,getEditedPostTemplate:n}=e(Rt),{getEditedPostAttribute:o}=e(x.store),r=t();return{template:r?n():null,isEditing:r,title:o("title")?o("title"):(0,f.__)("Untitled")}}),[]),{clearSelectedBlock:o}=(0,u.useDispatch)(b.store),{setIsEditingTemplate:r}=(0,u.useDispatch)(Rt);if(!t||!e)return null;let l=(0,f.__)("Default");null!=e&&e.title?l=e.title:e&&(l=e.slug);const i=!!(e.custom||e.wp_id||e.description);return(0,a.createElement)("div",{className:"edit-post-template-top-area"},(0,a.createElement)(E.Button,{className:"edit-post-template-post-title",isLink:!0,showTooltip:!0,label:(0,f.sprintf)((0,f.__)("Edit %s"),n),onClick:()=>{o(),r(!1)}},n),i?(0,a.createElement)(E.Dropdown,{popoverProps:{placement:"bottom"},contentClassName:"edit-post-template-top-area__popover",renderToggle:e=>{let{onToggle:t}=e;return(0,a.createElement)(E.Button,{className:"edit-post-template-title",isLink:!0,icon:zn,showTooltip:!0,onClick:t,label:(0,f.__)("Template Options")},l)},renderContent:()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)($n,null),(0,a.createElement)(qn,null),(0,a.createElement)(Wn,null))}):(0,a.createElement)(E.__experimentalText,{className:"edit-post-template-title",size:"body",style:{lineHeight:"24px"}},l))};var Zn=function(e){let{setEntitiesSavedStatesCallback:t}=e;const n=(0,v.useViewportMatch)("large"),{hasActiveMetaboxes:o,isPublishSidebarOpened:r,isSaving:l,showIconLabels:i,isDistractionFreeMode:s}=(0,u.useSelect)((e=>({hasActiveMetaboxes:e(Rt).hasMetaBoxes(),isPublishSidebarOpened:e(Rt).isPublishSidebarOpened(),isSaving:e(Rt).isSavingMetaBoxes(),showIconLabels:e(Rt).isFeatureActive("showIconLabels"),isDistractionFreeMode:e(Rt).isFeatureActive("distractionFree")})),[]),c=s&&n,d=V()("edit-post-header"),m={hidden:c?{y:"-50"}:{y:0},hover:{y:0,transition:{type:"tween",delay:.2}}},p={hidden:c?{x:"-100%"}:{x:0},hover:{x:0,transition:{type:"tween",delay:.2}}};return(0,a.createElement)("div",{className:d},(0,a.createElement)(Un.Slot,null,(0,a.createElement)(E.__unstableMotion.div,{variants:p,transition:{type:"tween",delay:.8}},(0,a.createElement)(Cn,{showTooltip:!0}))),(0,a.createElement)(E.__unstableMotion.div,{variants:m,transition:{type:"tween",delay:.8},className:"edit-post-header__toolbar"},(0,a.createElement)(Mn,null),(0,a.createElement)(jn,null)),(0,a.createElement)(E.__unstableMotion.div,{variants:m,transition:{type:"tween",delay:.8},className:"edit-post-header__settings"},!r&&(0,a.createElement)(x.PostSavedState,{forceIsDirty:o,forceIsSaving:l,showIconLabels:i}),(0,a.createElement)(Vn,null),(0,a.createElement)(x.PostPreviewButton,{forceIsAutosaveable:o,forcePreviewLink:l?null:void 0}),(0,a.createElement)(On,{forceIsDirty:o,forceIsSaving:l,setEntitiesSavedStatesCallback:t}),(n||!i)&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ue.Slot,{scope:"core/edit-post"}),(0,a.createElement)(Ln,{showIconLabels:i})),i&&!n&&(0,a.createElement)(Ln,{showIconLabels:i})))};var Kn=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function Yn(){const{insertionPoint:e,showMostUsedBlocks:t}=(0,u.useSelect)((e=>{const{isFeatureActive:t,__experimentalGetInsertionPoint:n}=e(Rt);return{insertionPoint:n(),showMostUsedBlocks:t("mostUsedBlocks")}}),[]),{setIsInserterOpened:n}=(0,u.useDispatch)(Rt),o=(0,v.useViewportMatch)("medium","<"),r=o?"div":E.VisuallyHidden,[l,i]=(0,v.__experimentalUseDialog)({onClose:()=>n(!1),focusOnMount:null}),s=(0,a.useRef)();return(0,a.useEffect)((()=>{s.current.focusSearch()}),[]),(0,a.createElement)("div",_({ref:l},i,{className:"edit-post-editor__inserter-panel"}),(0,a.createElement)(r,{className:"edit-post-editor__inserter-panel-header"},(0,a.createElement)(E.Button,{icon:Kn,label:(0,f.__)("Close block inserter"),onClick:()=>n(!1)})),(0,a.createElement)("div",{className:"edit-post-editor__inserter-panel-content"},(0,a.createElement)(b.__experimentalLibrary,{showMostUsedBlocks:t,showInserterHelpPanel:!0,shouldFocusBlock:o,rootClientId:e.rootClientId,__experimentalInsertionIndex:e.insertionIndex,__experimentalFilterValue:e.filterValue,ref:s})))}function Xn(){return(0,a.createElement)(E.SVG,{width:"138",height:"148",viewBox:"0 0 138 148",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(E.Rect,{width:"138",height:"148",rx:"4",fill:"#F0F6FC"}),(0,a.createElement)(E.Line,{x1:"44",y1:"28",x2:"24",y2:"28",stroke:"#DDDDDD"}),(0,a.createElement)(E.Rect,{x:"48",y:"16",width:"27",height:"23",rx:"4",fill:"#DDDDDD"}),(0,a.createElement)(E.Path,{d:"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",fill:"black"}),(0,a.createElement)(E.Line,{x1:"55",y1:"59",x2:"24",y2:"59",stroke:"#DDDDDD"}),(0,a.createElement)(E.Rect,{x:"59",y:"47",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,a.createElement)(E.Path,{d:"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",fill:"black"}),(0,a.createElement)(E.Line,{x1:"80",y1:"90",x2:"24",y2:"90",stroke:"#DDDDDD"}),(0,a.createElement)(E.Rect,{x:"84",y:"78",width:"30",height:"23",rx:"4",fill:"#F0B849"}),(0,a.createElement)(E.Path,{d:"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",fill:"black"}),(0,a.createElement)(E.Line,{x1:"66",y1:"121",x2:"24",y2:"121",stroke:"#DDDDDD"}),(0,a.createElement)(E.Rect,{x:"70",y:"109",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,a.createElement)(E.Path,{d:"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",fill:"black"}))}function Qn(){const{headingCount:e}=(0,u.useSelect)((e=>{const{getGlobalBlockCount:t}=e(b.store);return{headingCount:t("core/heading")}}),[]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"edit-post-editor__list-view-overview"},(0,a.createElement)("div",null,(0,a.createElement)(E.__experimentalText,null,(0,f.__)("Characters:")),(0,a.createElement)(E.__experimentalText,null,(0,a.createElement)(x.CharacterCount,null))),(0,a.createElement)("div",null,(0,a.createElement)(E.__experimentalText,null,(0,f.__)("Words:")),(0,a.createElement)(x.WordCount,null)),(0,a.createElement)("div",null,(0,a.createElement)(E.__experimentalText,null,(0,f.__)("Time to read:")),(0,a.createElement)(x.TimeToRead,null))),e>0?(0,a.createElement)(x.DocumentOutline,null):(0,a.createElement)("div",{className:"edit-post-editor__list-view-empty-headings"},(0,a.createElement)(Xn,null),(0,a.createElement)("p",null,(0,f.__)("Navigate the structure of your document and address issues like empty or incorrect heading levels."))))}function Jn(){const{setIsListViewOpened:e}=(0,u.useDispatch)(Rt),t=(0,v.useFocusOnMount)("firstElement"),n=(0,v.useFocusReturn)(),o=(0,v.useFocusReturn)();const[r,l]=(0,a.useState)("list-view");return(0,a.createElement)("div",{"aria-label":(0,f.__)("Document Overview"),className:"edit-post-editor__document-overview-panel",onKeyDown:function(t){t.keyCode!==M.ESCAPE||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,a.createElement)("div",{className:"edit-post-editor__document-overview-panel-header components-panel__header edit-post-sidebar__panel-tabs",ref:n},(0,a.createElement)(E.Button,{icon:U,label:(0,f.__)("Close Document Overview Sidebar"),onClick:()=>e(!1)}),(0,a.createElement)("ul",null,(0,a.createElement)("li",null,(0,a.createElement)(E.Button,{onClick:()=>{l("list-view")},className:V()("edit-post-sidebar__panel-tab",{"is-active":"list-view"===r}),"aria-current":"list-view"===r},(0,f.__)("List View"))),(0,a.createElement)("li",null,(0,a.createElement)(E.Button,{onClick:()=>{l("outline")},className:V()("edit-post-sidebar__panel-tab",{"is-active":"outline"===r}),"aria-current":"outline"===r},(0,f.__)("Outline"))))),(0,a.createElement)("div",{ref:(0,v.useMergeRefs)([o,t]),className:"edit-post-editor__list-view-container"},"list-view"===r&&(0,a.createElement)("div",{className:"edit-post-editor__list-view-panel-content"},(0,a.createElement)(b.__experimentalListView,null)),"outline"===r&&(0,a.createElement)(Qn,null)))}var eo=(0,a.createElement)(S.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"}));var to=(0,a.createElement)(S.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"}));var no=e=>{let{sidebarName:t}=e;const{openGeneralSidebar:n}=(0,u.useDispatch)(Rt),o=()=>n("edit-post/document"),{documentLabel:r,isTemplateMode:l}=(0,u.useSelect)((e=>({documentLabel:e(x.store).getPostTypeLabel()||(0,f._x)("Document","noun"),isTemplateMode:e(Rt).isEditingTemplate()})),[]),[i,s]="edit-post/document"===t?[(0,f.sprintf)((0,f.__)("%s (selected)"),r),"is-active"]:[r,""],[c,d]="edit-post/block"===t?[(0,f.__)("Block (selected)"),"is-active"]:[(0,f.__)("Block"),""],[m,p]="edit-post/document"===t?[(0,f.__)("Template (selected)"),"is-active"]:[(0,f.__)("Template"),""];return(0,a.createElement)("ul",null,!l&&(0,a.createElement)("li",null,(0,a.createElement)(E.Button,{onClick:o,className:`edit-post-sidebar__panel-tab ${s}`,"aria-label":i,"data-label":r},r)),l&&(0,a.createElement)("li",null,(0,a.createElement)(E.Button,{onClick:o,className:`edit-post-sidebar__panel-tab ${p}`,"aria-label":m,"data-label":(0,f.__)("Template")},(0,f.__)("Template"))),(0,a.createElement)("li",null,(0,a.createElement)(E.Button,{onClick:()=>n("edit-post/block"),className:`edit-post-sidebar__panel-tab ${d}`,"aria-label":c,"data-label":(0,f.__)("Block")},(0,f.__)("Block"))))};function oo(e){let{isOpen:t,onClick:n}=e;const o=(0,x.usePostVisibilityLabel)();return(0,a.createElement)(E.Button,{className:"edit-post-post-visibility__toggle",variant:"tertiary","aria-expanded":t,"aria-label":(0,f.sprintf)((0,f.__)("Select visibility: %s"),o),onClick:n},o)}var ro=function(){const[e,t]=(0,a.useState)(null),n=(0,a.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,a.createElement)(x.PostVisibilityCheck,{render:e=>{let{canEdit:o}=e;return(0,a.createElement)(E.PanelRow,{ref:t,className:"edit-post-post-visibility"},(0,a.createElement)("span",null,(0,f.__)("Visibility")),!o&&(0,a.createElement)("span",null,(0,a.createElement)(x.PostVisibilityLabel,null)),o&&(0,a.createElement)(E.Dropdown,{contentClassName:"edit-post-post-visibility__dialog",popoverProps:n,focusOnMount:!0,renderToggle:e=>{let{isOpen:t,onToggle:n}=e;return(0,a.createElement)(oo,{isOpen:t,onClick:n})},renderContent:e=>{let{onClose:t}=e;return(0,a.createElement)(x.PostVisibility,{onClose:t})}}))}})};function lo(){return(0,a.createElement)(x.PostTrashCheck,null,(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PostTrash,null)))}function ao(){const[e,t]=(0,a.useState)(null),n=(0,a.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,a.createElement)(x.PostScheduleCheck,null,(0,a.createElement)(E.PanelRow,{className:"edit-post-post-schedule",ref:t},(0,a.createElement)("span",null,(0,f.__)("Publish")),(0,a.createElement)(E.Dropdown,{popoverProps:n,contentClassName:"edit-post-post-schedule__dialog",focusOnMount:!0,renderToggle:e=>{let{isOpen:t,onToggle:n}=e;return(0,a.createElement)(io,{isOpen:t,onClick:n})},renderContent:e=>{let{onClose:t}=e;return(0,a.createElement)(x.PostSchedule,{onClose:t})}})))}function io(e){let{isOpen:t,onClick:n}=e;const o=(0,x.usePostScheduleLabel)(),r=(0,x.usePostScheduleLabel)({full:!0});return(0,a.createElement)(E.Button,{className:"edit-post-post-schedule__toggle",variant:"tertiary",label:r,showTooltip:!0,"aria-expanded":t,"aria-label":(0,f.sprintf)((0,f.__)("Change date: %s"),o),onClick:n},o)}var so=function(){return(0,a.createElement)(x.PostStickyCheck,null,(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PostSticky,null)))};var co=function(){return(0,a.createElement)(x.PostAuthorCheck,null,(0,a.createElement)(E.PanelRow,{className:"edit-post-post-author"},(0,a.createElement)(x.PostAuthor,null)))};var uo=function(){return(0,a.createElement)(x.PostSlugCheck,null,(0,a.createElement)(E.PanelRow,{className:"edit-post-post-slug"},(0,a.createElement)(x.PostSlug,null)))};var mo=function(){return(0,a.createElement)(x.PostFormatCheck,null,(0,a.createElement)(E.PanelRow,{className:"edit-post-post-format"},(0,a.createElement)(x.PostFormat,null)))};var po=function(){return(0,a.createElement)(x.PostPendingStatusCheck,null,(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PostPendingStatus,null)))};const{Fill:go,Slot:ho}=(0,E.createSlotFill)("PluginPostStatusInfo"),_o=e=>{let{children:t,className:n}=e;return(0,a.createElement)(go,null,(0,a.createElement)(E.PanelRow,{className:n},t))};_o.Slot=ho;var Eo=_o;var bo=(0,a.createElement)(S.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(S.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"}));const fo=(0,f.__)("Custom Template");function vo(e){let{onClose:t}=e;const n=(0,u.useSelect)((e=>e(x.store).getEditorSettings().defaultBlockTemplate),[]),{__unstableCreateTemplate:o,__unstableSwitchToTemplateMode:r}=(0,u.useDispatch)(Rt),[l,s]=(0,a.useState)(""),[c,d]=(0,a.useState)(!1),m=()=>{s(""),t()};return(0,a.createElement)(E.Modal,{title:(0,f.__)("Create custom template"),onRequestClose:m,className:"edit-post-post-template__create-modal"},(0,a.createElement)("form",{className:"edit-post-post-template__create-form",onSubmit:async e=>{if(e.preventDefault(),c)return;d(!0);const t=null!=n?n:(0,i.serialize)([(0,i.createBlock)("core/group",{tagName:"header",layout:{inherit:!0}},[(0,i.createBlock)("core/site-title"),(0,i.createBlock)("core/site-tagline")]),(0,i.createBlock)("core/separator"),(0,i.createBlock)("core/group",{tagName:"main"},[(0,i.createBlock)("core/group",{layout:{inherit:!0}},[(0,i.createBlock)("core/post-title")]),(0,i.createBlock)("core/post-content",{layout:{inherit:!0}})])]);await o({slug:(0,C.cleanForSlug)(l||fo),content:t,title:l||fo}),d(!1),m(),r(!0)}},(0,a.createElement)(E.__experimentalVStack,{spacing:"3"},(0,a.createElement)(E.TextControl,{__nextHasNoMarginBottom:!0,label:(0,f.__)("Name"),value:l,onChange:s,placeholder:fo,disabled:c,help:(0,f.__)('Describe the template, e.g. "Post with sidebar". Custom templates can be applied to any post or page.')}),(0,a.createElement)(E.__experimentalHStack,{justify:"right"},(0,a.createElement)(E.Button,{variant:"tertiary",onClick:m},(0,f.__)("Cancel")),(0,a.createElement)(E.Button,{variant:"primary",type:"submit",isBusy:c,"aria-disabled":c},(0,f.__)("Create"))))))}function yo(e){var t,n;let{onClose:o}=e;const{isPostsPage:r,availableTemplates:l,fetchedTemplates:i,selectedTemplateSlug:s,canCreate:c,canEdit:d}=(0,u.useSelect)((e=>{const{canUser:t,getEntityRecord:n,getEntityRecords:o}=e(Be.store),r=e(x.store).getEditorSettings(),l=t("read","settings")?n("root","site"):void 0,a=e(x.store).getCurrentPostId()===(null==l?void 0:l.page_for_posts),i=t("create","templates");return{isPostsPage:a,availableTemplates:r.availableTemplates,fetchedTemplates:i?o("postType","wp_template",{post_type:e(x.store).getCurrentPostType(),per_page:-1}):void 0,selectedTemplateSlug:e(x.store).getEditedPostAttribute("template"),canCreate:i&&!a&&r.supportsTemplateMode,canEdit:i&&r.supportsTemplateMode&&!!e(Rt).getEditedPostTemplate()}}),[]),m=(0,a.useMemo)((()=>Object.entries({...l,...Object.fromEntries((null!=i?i:[]).map((e=>{let{slug:t,title:n}=e;return[t,n.rendered]})))}).map((e=>{let[t,n]=e;return{value:t,label:n}}))),[l,i]),p=null!==(t=m.find((e=>e.value===s)))&&void 0!==t?t:m.find((e=>!e.value)),{editPost:g}=(0,u.useDispatch)(x.store),{__unstableSwitchToTemplateMode:h}=(0,u.useDispatch)(Rt),[_,v]=(0,a.useState)(!1);return(0,a.createElement)("div",{className:"edit-post-post-template__form"},(0,a.createElement)(b.__experimentalInspectorPopoverHeader,{title:(0,f.__)("Template"),help:(0,f.__)("Templates define the way content is displayed when viewing your site."),actions:c?[{icon:bo,label:(0,f.__)("Add template"),onClick:()=>v(!0)}]:[],onClose:o}),r?(0,a.createElement)(E.Notice,{className:"edit-post-post-template__notice",status:"warning",isDismissible:!1},(0,f.__)("The posts page template cannot be changed.")):(0,a.createElement)(E.SelectControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,f.__)("Template"),value:null!==(n=null==p?void 0:p.value)&&void 0!==n?n:"",options:m,onChange:e=>g({template:e||""})}),d&&(0,a.createElement)("p",null,(0,a.createElement)(E.Button,{variant:"link",onClick:()=>h()},(0,f.__)("Edit template"))),_&&(0,a.createElement)(vo,{onClose:()=>v(!1)}))}function wo(){const[e,t]=(0,a.useState)(null),n=(0,a.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,u.useSelect)((e=>{var t;const n=e(x.store).getCurrentPostType(),o=e(Be.store).getPostType(n);if(null==o||!o.viewable)return!1;const r=e(x.store).getEditorSettings();if(!!r.availableTemplates&&Object.keys(r.availableTemplates).length>0)return!0;if(!r.supportsTemplateMode)return!1;return null!==(t=e(Be.store).canUser("create","templates"))&&void 0!==t&&t}),[])?(0,a.createElement)(E.PanelRow,{className:"edit-post-post-template",ref:t},(0,a.createElement)("span",null,(0,f.__)("Template")),(0,a.createElement)(E.Dropdown,{popoverProps:n,className:"edit-post-post-template__dropdown",contentClassName:"edit-post-post-template__dialog",focusOnMount:!0,renderToggle:e=>{let{isOpen:t,onToggle:n}=e;return(0,a.createElement)(So,{isOpen:t,onClick:n})},renderContent:e=>{let{onClose:t}=e;return(0,a.createElement)(yo,{onClose:t})}})):null}function So(e){let{isOpen:t,onClick:n}=e;const o=(0,u.useSelect)((e=>{const t=e(x.store).getEditedPostAttribute("template"),{supportsTemplateMode:n,availableTemplates:o}=e(x.store).getEditorSettings();if(!n&&o[t])return o[t];const r=e(Be.store).canUser("create","templates")&&e(Rt).getEditedPostTemplate();return(null==r?void 0:r.title)||(null==r?void 0:r.slug)||(null==o?void 0:o[t])}),[]);return(0,a.createElement)(E.Button,{className:"edit-post-post-template__toggle",variant:"tertiary","aria-expanded":t,"aria-label":o?(0,f.sprintf)((0,f.__)("Select template: %s"),o):(0,f.__)("Select template"),onClick:n},null!=o?o:(0,f.__)("Default template"))}function ko(){const[e,t]=(0,a.useState)(null),n=(0,a.useMemo)((()=>({anchor:e,placement:"bottom-end"})),[e]);return(0,a.createElement)(x.PostURLCheck,null,(0,a.createElement)(E.PanelRow,{className:"edit-post-post-url",ref:t},(0,a.createElement)("span",null,(0,f.__)("URL")),(0,a.createElement)(E.Dropdown,{popoverProps:n,className:"edit-post-post-url__dropdown",contentClassName:"edit-post-post-url__dialog",focusOnMount:!0,renderToggle:e=>{let{isOpen:t,onToggle:n}=e;return(0,a.createElement)(Po,{isOpen:t,onClick:n})},renderContent:e=>{let{onClose:t}=e;return(0,a.createElement)(x.PostURL,{onClose:t})}})))}function Po(e){let{isOpen:t,onClick:n}=e;const o=(0,x.usePostURLLabel)();return(0,a.createElement)(E.Button,{className:"edit-post-post-url__toggle",variant:"tertiary","aria-expanded":t,"aria-label":(0,f.sprintf)((0,f.__)("Change URL: %s"),o),onClick:n},o)}const Co="post-status";var To=(0,v.compose)([(0,u.withSelect)((e=>{const{isEditorPanelRemoved:t,isEditorPanelOpened:n}=e(Rt);return{isRemoved:t(Co),isOpened:n(Co)}})),(0,v.ifCondition)((e=>{let{isRemoved:t}=e;return!t})),(0,u.withDispatch)((e=>({onTogglePanel(){return e(Rt).toggleEditorPanelOpened(Co)}})))])((function(e){let{isOpened:t,onTogglePanel:n}=e;return(0,a.createElement)(E.PanelBody,{className:"edit-post-post-status",title:(0,f.__)("Summary"),opened:t,onToggle:n},(0,a.createElement)(Eo.Slot,null,(e=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ro,null),(0,a.createElement)(ao,null),(0,a.createElement)(wo,null),(0,a.createElement)(ko,null),(0,a.createElement)(so,null),(0,a.createElement)(po,null),(0,a.createElement)(mo,null),(0,a.createElement)(uo,null),(0,a.createElement)(co,null),e,(0,a.createElement)(lo,null)))))}));var xo=function(){return(0,a.createElement)(x.PostLastRevisionCheck,null,(0,a.createElement)(E.PanelBody,{className:"edit-post-last-revision__panel"},(0,a.createElement)(x.PostLastRevision,null)))};var Bo=(0,v.compose)((0,u.withSelect)(((e,t)=>{const n=(0,Gt.get)(t.taxonomy,["slug"]),o=n?`taxonomy-panel-${n}`:"";return{panelName:o,isEnabled:!!n&&e(Rt).isEditorPanelEnabled(o),isOpened:!!n&&e(Rt).isEditorPanelOpened(o)}})),(0,u.withDispatch)(((e,t)=>({onTogglePanel:()=>{e(Rt).toggleEditorPanelOpened(t.panelName)}}))))((function(e){let{isEnabled:t,taxonomy:n,isOpened:o,onTogglePanel:r,children:l}=e;if(!t)return null;const i=(0,Gt.get)(n,["labels","menu_name"]);return i?(0,a.createElement)(E.PanelBody,{title:i,opened:o,onToggle:r},l):null}));var Mo=function(){return(0,a.createElement)(x.PostTaxonomiesCheck,null,(0,a.createElement)(x.PostTaxonomies,{taxonomyWrapper:(e,t)=>(0,a.createElement)(Bo,{taxonomy:t},e)}))};const No="featured-image";const Io=(0,u.withSelect)((e=>{const{getEditedPostAttribute:t}=e(x.store),{getPostType:n}=e(Be.store),{isEditorPanelEnabled:o,isEditorPanelOpened:r}=e(Rt);return{postType:n(t("type")),isEnabled:o(No),isOpened:r(No)}})),Do=(0,u.withDispatch)((e=>{const{toggleEditorPanelOpened:t}=e(Rt);return{onTogglePanel:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return t(No,...n)}}}));var Ao=(0,v.compose)(Io,Do)((function(e){let{isEnabled:t,isOpened:n,postType:o,onTogglePanel:r}=e;return t?(0,a.createElement)(x.PostFeaturedImageCheck,null,(0,a.createElement)(E.PanelBody,{title:(0,Gt.get)(o,["labels","featured_image"],(0,f.__)("Featured image")),opened:n,onToggle:r},(0,a.createElement)(x.PostFeaturedImage,null))):null}));const Lo="post-excerpt";var Oo=(0,v.compose)([(0,u.withSelect)((e=>({isEnabled:e(Rt).isEditorPanelEnabled(Lo),isOpened:e(Rt).isEditorPanelOpened(Lo)}))),(0,u.withDispatch)((e=>({onTogglePanel(){return e(Rt).toggleEditorPanelOpened(Lo)}})))])((function(e){let{isEnabled:t,isOpened:n,onTogglePanel:o}=e;return t?(0,a.createElement)(x.PostExcerptCheck,null,(0,a.createElement)(E.PanelBody,{title:(0,f.__)("Excerpt"),opened:n,onToggle:o},(0,a.createElement)(x.PostExcerpt,null))):null}));const Vo="discussion-panel";var Fo=(0,v.compose)([(0,u.withSelect)((e=>({isEnabled:e(Rt).isEditorPanelEnabled(Vo),isOpened:e(Rt).isEditorPanelOpened(Vo)}))),(0,u.withDispatch)((e=>({onTogglePanel(){return e(Rt).toggleEditorPanelOpened(Vo)}})))])((function(e){let{isEnabled:t,isOpened:n,onTogglePanel:o}=e;return t?(0,a.createElement)(x.PostTypeSupportCheck,{supportKeys:["comments","trackbacks"]},(0,a.createElement)(E.PanelBody,{title:(0,f.__)("Discussion"),opened:n,onToggle:o},(0,a.createElement)(x.PostTypeSupportCheck,{supportKeys:"comments"},(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PostComments,null))),(0,a.createElement)(x.PostTypeSupportCheck,{supportKeys:"trackbacks"},(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PostPingbacks,null))))):null}));const Ro="page-attributes";var Ho=function(){const{isEnabled:e,isOpened:t,postType:n}=(0,u.useSelect)((e=>{const{getEditedPostAttribute:t}=e(x.store),{isEditorPanelEnabled:n,isEditorPanelOpened:o}=e(Rt),{getPostType:r}=e(Be.store);return{isEnabled:n(Ro),isOpened:o(Ro),postType:r(t("type"))}}),[]),{toggleEditorPanelOpened:o}=(0,u.useDispatch)(Rt);return e&&n?(0,a.createElement)(x.PageAttributesCheck,null,(0,a.createElement)(E.PanelBody,{title:(0,Gt.get)(n,["labels","attributes"],(0,f.__)("Page attributes")),opened:t,onToggle:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o(Ro,...t)}},(0,a.createElement)(x.PageAttributesParent,null),(0,a.createElement)(E.PanelRow,null,(0,a.createElement)(x.PageAttributesOrder,null)))):null};var Go=function(e){let{location:t}=e;const n=(0,a.useRef)(null),o=(0,a.useRef)(null);(0,a.useEffect)((()=>(o.current=document.querySelector(".metabox-location-"+t),o.current&&n.current.appendChild(o.current),()=>{o.current&&document.querySelector("#metaboxes").appendChild(o.current)})),[t]);const r=(0,u.useSelect)((e=>e(Rt).isSavingMetaBoxes()),[]),l=V()("edit-post-meta-boxes-area",`is-${t}`,{"is-loading":r});return(0,a.createElement)("div",{className:l},r&&(0,a.createElement)(E.Spinner,null),(0,a.createElement)("div",{className:"edit-post-meta-boxes-area__container",ref:n}),(0,a.createElement)("div",{className:"edit-post-meta-boxes-area__clear"}))};class Uo extends a.Component{componentDidMount(){this.updateDOM()}componentDidUpdate(e){this.props.isVisible!==e.isVisible&&this.updateDOM()}updateDOM(){const{id:e,isVisible:t}=this.props,n=document.getElementById(e);n&&(t?n.classList.remove("is-hidden"):n.classList.add("is-hidden"))}render(){return null}}var zo=(0,u.withSelect)(((e,t)=>{let{id:n}=t;return{isVisible:e(Rt).isEditorPanelEnabled(`meta-box-${n}`)}}))(Uo);function Wo(e){let{location:t}=e;const n=(0,u.useRegistry)(),{metaBoxes:o,areMetaBoxesInitialized:r,isEditorReady:l}=(0,u.useSelect)((e=>{const{__unstableIsEditorReady:n}=e(x.store),{getMetaBoxesPerLocation:o,areMetaBoxesInitialized:r}=e(Rt);return{metaBoxes:o(t),areMetaBoxesInitialized:r(),isEditorReady:n()}}),[t]);return(0,a.useEffect)((()=>{l&&!r&&n.dispatch(Rt).initializeMetaBoxes()}),[l,r]),r?(0,a.createElement)(a.Fragment,null,(null!=o?o:[]).map((e=>{let{id:t}=e;return(0,a.createElement)(zo,{key:t,id:t})})),(0,a.createElement)(Go,{location:t})):null}window.wp.warning;const{Fill:$o,Slot:qo}=(0,E.createSlotFill)("PluginDocumentSettingPanel"),jo=(0,v.compose)((0,P.withPluginContext)(((e,t)=>(void 0===t.name&&"undefined"!=typeof process&&process.env,{panelName:`${e.name}/${t.name}`}))),(0,u.withSelect)(((e,t)=>{let{panelName:n}=t;return{opened:e(Rt).isEditorPanelOpened(n),isEnabled:e(Rt).isEditorPanelEnabled(n)}})),(0,u.withDispatch)(((e,t)=>{let{panelName:n}=t;return{onToggle(){return e(Rt).toggleEditorPanelOpened(n)}}})))((e=>{let{isEnabled:t,panelName:n,opened:o,onToggle:r,className:l,title:i,icon:s,children:c}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(hn,{label:i,panelName:n}),(0,a.createElement)($o,null,t&&(0,a.createElement)(E.PanelBody,{className:l,title:i,icon:s,opened:o,onToggle:r},c)))}));jo.Slot=qo;var Zo=jo;function Ko(e){let{className:t,...n}=e;const{postTitle:o,shortcut:r,showIconLabels:l}=(0,u.useSelect)((e=>({postTitle:e(x.store).getEditedPostAttribute("title"),shortcut:e(qt.store).getShortcutRepresentation("core/edit-post/toggle-sidebar"),showIconLabels:e(Rt).isFeatureActive("showIconLabels")})),[]);return(0,a.createElement)(ge,_({panelClassName:t,className:"edit-post-sidebar",smallScreenTitle:o||(0,f.__)("(no title)"),scope:"core/edit-post",toggleShortcut:r,showIconLabels:l},n))}var Yo=(0,a.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(S.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));var Xo=function(){const e=(0,u.useSelect)((e=>{const{getEditedPostTemplate:t}=e(Rt);return t()}),[]);return e?(0,a.createElement)(E.PanelBody,null,(0,a.createElement)(E.Flex,{align:"flex-start",gap:"3"},(0,a.createElement)(E.FlexItem,null,(0,a.createElement)(ye,{icon:Yo})),(0,a.createElement)(E.FlexBlock,null,(0,a.createElement)("h2",{className:"edit-post-template-summary__title"},(null==e?void 0:e.title)||(null==e?void 0:e.slug)),(0,a.createElement)("p",null,null==e?void 0:e.description)))):null};const Qo=a.Platform.select({web:!0,native:!1});var Jo=()=>{const{sidebarName:e,keyboardShortcut:t,isTemplateMode:n}=(0,u.useSelect)((e=>{let t=e(te).getActiveComplementaryArea(Rt.name);["edit-post/document","edit-post/block"].includes(t)||(e(b.store).getBlockSelectionStart()&&(t="edit-post/block"),t="edit-post/document");return{sidebarName:t,keyboardShortcut:e(qt.store).getShortcutRepresentation("core/edit-post/toggle-sidebar"),isTemplateMode:e(Rt).isEditingTemplate()}}),[]);return(0,a.createElement)(Ko,{identifier:e,header:(0,a.createElement)(no,{sidebarName:e}),closeLabel:(0,f.__)("Close settings"),headerClassName:"edit-post-sidebar__panel-tabs",title:(0,f.__)("Settings"),toggleShortcut:t,icon:(0,f.isRTL)()?eo:to,isActiveByDefault:Qo},!n&&"edit-post/document"===e&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(To,null),(0,a.createElement)(Zo.Slot,null),(0,a.createElement)(xo,null),(0,a.createElement)(Mo,null),(0,a.createElement)(Ao,null),(0,a.createElement)(Oo,null),(0,a.createElement)(Fo,null),(0,a.createElement)(Ho,null),(0,a.createElement)(Wo,{location:"side"})),n&&"edit-post/document"===e&&(0,a.createElement)(Xo,null),"edit-post/block"===e&&(0,a.createElement)(b.BlockInspector,null))};function er(e){let{nonAnimatedSrc:t,animatedSrc:n}=e;return(0,a.createElement)("picture",{className:"edit-post-welcome-guide__image"},(0,a.createElement)("source",{srcSet:t,media:"(prefers-reduced-motion: reduce)"}),(0,a.createElement)("img",{src:n,width:"312",height:"240",alt:""}))}function tr(){const{toggleFeature:e}=(0,u.useDispatch)(Rt);return(0,a.createElement)(E.Guide,{className:"edit-post-welcome-guide",contentLabel:(0,f.__)("Welcome to the block editor"),finishButtonText:(0,f.__)("Get started"),onFinish:()=>e("welcomeGuide"),pages:[{image:(0,a.createElement)(er,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,f.__)("Welcome to the block editor")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,f.__)("In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.")))},{image:(0,a.createElement)(er,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,f.__)("Make each block your own")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,f.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,a.createElement)(er,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,f.__)("Get to know the block library")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,a.createInterpolateElement)((0,f.__)("All of the blocks available to you live in the block library. Youll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,a.createElement)("img",{alt:(0,f.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,a.createElement)(er,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,f.__)("Learn how to use the block editor")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,f.__)("New to the block editor? Want to learn more about using it? "),(0,a.createElement)(E.ExternalLink,{href:(0,f.__)("https://wordpress.org/support/article/wordpress-editor/")},(0,f.__)("Here's a detailed guide."))))}]})}function nr(){const{toggleFeature:e}=(0,u.useDispatch)(Rt);return(0,a.createElement)(E.Guide,{className:"edit-template-welcome-guide",contentLabel:(0,f.__)("Welcome to the template editor"),finishButtonText:(0,f.__)("Get started"),onFinish:()=>e("welcomeGuideTemplate"),pages:[{image:(0,a.createElement)(er,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-template-editor.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,f.__)("Welcome to the template editor")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,f.__)("Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.")))}]})}function or(){const{isActive:e,isTemplateMode:t}=(0,u.useSelect)((e=>{const{isFeatureActive:t,isEditingTemplate:n}=e(Rt),o=n();return{isActive:t(o?"welcomeGuideTemplate":"welcomeGuide"),isTemplateMode:o}}),[]);return e?t?(0,a.createElement)(nr,null):(0,a.createElement)(tr,null):null}const{Fill:rr,Slot:lr}=(0,E.createSlotFill)("PluginPostPublishPanel"),ar=(0,v.compose)((0,P.withPluginContext)(((e,t)=>({icon:t.icon||e.icon}))))((e=>{let{children:t,className:n,title:o,initialOpen:r=!1,icon:l}=e;return(0,a.createElement)(rr,null,(0,a.createElement)(E.PanelBody,{className:n,initialOpen:r||!o,title:o,icon:l},t))}));ar.Slot=lr;var ir=ar;const{Fill:sr,Slot:cr}=(0,E.createSlotFill)("PluginPrePublishPanel"),dr=(0,v.compose)((0,P.withPluginContext)(((e,t)=>({icon:t.icon||e.icon}))))((e=>{let{children:t,className:n,title:o,initialOpen:r=!1,icon:l}=e;return(0,a.createElement)(sr,null,(0,a.createElement)(E.PanelBody,{className:n,initialOpen:r||!o,title:o,icon:l},t))}));dr.Slot=cr;var ur=dr;const{Fill:mr,Slot:pr}=(0,E.createSlotFill)("ActionsPanel");function gr(e){let{setEntitiesSavedStatesCallback:t,closeEntitiesSavedStates:n,isEntitiesSavedStatesOpen:o}=e;const{closePublishSidebar:r,togglePublishSidebar:l}=(0,u.useDispatch)(Rt),{publishSidebarOpened:i,hasActiveMetaboxes:s,isSavingMetaBoxes:c,hasNonPostEntityChanges:d}=(0,u.useSelect)((e=>({publishSidebarOpened:e(Rt).isPublishSidebarOpened(),hasActiveMetaboxes:e(Rt).hasMetaBoxes(),isSavingMetaBoxes:e(Rt).isSavingMetaBoxes(),hasNonPostEntityChanges:e(x.store).hasNonPostEntityChanges()})),[]),m=(0,a.useCallback)((()=>t(!0)),[]);let p;return p=i?(0,a.createElement)(x.PostPublishPanel,{onClose:r,forceIsDirty:s,forceIsSaving:c,PrePublishExtension:ur.Slot,PostPublishExtension:ir.Slot}):d?(0,a.createElement)("div",{className:"edit-post-layout__toggle-entities-saved-states-panel"},(0,a.createElement)(E.Button,{variant:"secondary",className:"edit-post-layout__toggle-entities-saved-states-panel-button",onClick:m,"aria-expanded":!1},(0,f.__)("Open save panel"))):(0,a.createElement)("div",{className:"edit-post-layout__toggle-publish-panel"},(0,a.createElement)(E.Button,{variant:"secondary",className:"edit-post-layout__toggle-publish-panel-button",onClick:l,"aria-expanded":!1},(0,f.__)("Open publish panel"))),(0,a.createElement)(a.Fragment,null,o&&(0,a.createElement)(x.EntitiesSavedStates,{close:n}),(0,a.createElement)(pr,{bubblesVirtually:!0}),!o&&p)}function hr(){const{blockPatternsWithPostContentBlockType:e,postType:t}=(0,u.useSelect)((e=>{const{getPatternsByBlockTypes:t}=e(b.store),{getCurrentPostType:n}=e(x.store);return{blockPatternsWithPostContentBlockType:t("core/post-content"),postType:n()}}),[]);return(0,a.useMemo)((()=>e.filter((e=>"page"===t&&!e.postTypes||Array.isArray(e.postTypes)&&e.postTypes.includes(t)))),[t,e])}function _r(e){let{onChoosePattern:t}=e;const n=hr(),o=(0,v.useAsyncList)(n),{resetEditorBlocks:r}=(0,u.useDispatch)(x.store);return(0,a.createElement)(b.__experimentalBlockPatternsList,{blockPatterns:n,shownPatterns:o,onClickPattern:(e,n)=>{r(n),t()}})}const Er="INITIAL",br="PATTERN",fr="CLOSED";function vr(){const[e,t]=(0,a.useState)(Er),n=hr().length>0,o=(0,u.useSelect)((t=>{if(!n||e!==Er)return!1;const{getEditedPostContent:o,isEditedPostSaveable:r}=t(x.store),{isEditingTemplate:l,isFeatureActive:a}=t(Rt);return!r()&&""===o()&&!l()&&!a("welcomeGuide")}),[e,n]);return(0,a.useEffect)((()=>{o&&t(br)}),[o]),e===Er||e===fr?null:(0,a.createElement)(E.Modal,{className:"edit-post-start-page-options__modal",title:(0,f.__)("Choose a pattern"),onRequestClose:()=>{t(fr)}},(0,a.createElement)("div",{className:"edit-post-start-page-options__modal-content"},e===br&&(0,a.createElement)(_r,{onChoosePattern:()=>{t(fr)}})))}const yr={header:(0,f.__)("Editor top bar"),body:(0,f.__)("Editor content"),sidebar:(0,f.__)("Editor settings"),actions:(0,f.__)("Editor publish"),footer:(0,f.__)("Editor footer")};var wr=function(e){let{styles:t}=e;const n=(0,v.useViewportMatch)("medium","<"),o=(0,v.useViewportMatch)("huge",">="),r=(0,v.useViewportMatch)("large"),{openGeneralSidebar:l,closeGeneralSidebar:i,setIsInserterOpened:s}=(0,u.useDispatch)(Rt),{createErrorNotice:c}=(0,u.useDispatch)(T.store),{mode:d,isFullscreenActive:m,isRichEditingEnabled:p,sidebarIsOpened:g,hasActiveMetaboxes:h,hasFixedToolbar:_,previousShortcut:y,nextShortcut:w,hasBlockSelected:S,isInserterOpened:k,isListViewOpened:C,showIconLabels:B,isDistractionFreeMode:M,showBlockBreadcrumbs:N,isTemplateMode:I,documentLabel:D}=(0,u.useSelect)((e=>{const{getEditorSettings:t,getPostTypeLabel:n}=e(x.store),o=t(),r=n();return{isTemplateMode:e(Rt).isEditingTemplate(),hasFixedToolbar:e(Rt).isFeatureActive("fixedToolbar"),sidebarIsOpened:!(!e(te).getActiveComplementaryArea(Rt.name)&&!e(Rt).isPublishSidebarOpened()),isFullscreenActive:e(Rt).isFeatureActive("fullscreenMode"),isInserterOpened:e(Rt).isInserterOpened(),isListViewOpened:e(Rt).isListViewOpened(),mode:e(Rt).getEditorMode(),isRichEditingEnabled:o.richEditingEnabled,hasActiveMetaboxes:e(Rt).hasMetaBoxes(),previousShortcut:e(qt.store).getAllShortcutKeyCombinations("core/edit-post/previous-region"),nextShortcut:e(qt.store).getAllShortcutKeyCombinations("core/edit-post/next-region"),showIconLabels:e(Rt).isFeatureActive("showIconLabels"),isDistractionFreeMode:e(Rt).isFeatureActive("distractionFree"),showBlockBreadcrumbs:e(Rt).isFeatureActive("showBlockBreadcrumbs"),documentLabel:r||(0,f._x)("Document","noun")}}),[]),A=M&&r;(0,a.useEffect)((()=>{g&&!o&&s(!1)}),[g,o]),(0,a.useEffect)((()=>{k&&!o&&i()}),[k,o]);const[L,O]=(0,a.useState)(!1),F=(0,a.useCallback)((e=>{"function"==typeof L&&L(e),O(!1)}),[L]),R=V()("edit-post-layout","is-mode-"+d,{"is-sidebar-opened":g,"has-fixed-toolbar":_,"has-metaboxes":h,"show-icon-labels":B,"is-distraction-free":A,"is-entity-save-view-open":!!L}),H=C?(0,f.__)("Document Overview"):(0,f.__)("Block Library");return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(he,{isActive:m}),(0,a.createElement)(kn,null),(0,a.createElement)(x.UnsavedChangesWarning,null),(0,a.createElement)(x.AutosaveMonitor,null),(0,a.createElement)(x.LocalAutosaveMonitor,null),(0,a.createElement)(Qt,null),(0,a.createElement)(x.EditorKeyboardShortcutsRegister,null),(0,a.createElement)(Jo,null),(0,a.createElement)(Ee,{isDistractionFree:A,className:R,labels:{...yr,secondarySidebar:H},header:(0,a.createElement)(Zn,{setEntitiesSavedStatesCallback:O}),editorNotices:(0,a.createElement)(x.EditorNotices,null),secondarySidebar:"visual"===d&&k?(0,a.createElement)(Yn,null):"visual"===d&&C?(0,a.createElement)(Jn,null):null,sidebar:(!n||g)&&(0,a.createElement)(a.Fragment,null,!n&&!g&&(0,a.createElement)("div",{className:"edit-post-layout__toggle-sidebar-panel"},(0,a.createElement)(E.Button,{variant:"secondary",className:"edit-post-layout__toggle-sidebar-panel-button",onClick:()=>l(S?"edit-post/block":"edit-post/document"),"aria-expanded":!1},S?(0,f.__)("Open block settings"):(0,f.__)("Open document settings"))),(0,a.createElement)(ge.Slot,{scope:"core/edit-post"})),notices:(0,a.createElement)(x.EditorSnackbars,null),content:(0,a.createElement)(a.Fragment,null,!A&&(0,a.createElement)(x.EditorNotices,null),("text"===d||!p)&&(0,a.createElement)(jt,null),p&&"visual"===d&&(0,a.createElement)(Xt,{styles:t}),!I&&(0,a.createElement)("div",{className:"edit-post-layout__metaboxes"},(0,a.createElement)(Wo,{location:"normal"}),(0,a.createElement)(Wo,{location:"advanced"})),n&&g&&(0,a.createElement)(E.ScrollLock,null)),footer:!A&&N&&!n&&p&&"visual"===d&&(0,a.createElement)("div",{className:"edit-post-layout__footer"},(0,a.createElement)(b.BlockBreadcrumb,{rootLabelText:D})),actions:(0,a.createElement)(gr,{closeEntitiesSavedStates:F,isEntitiesSavedStatesOpen:L,setEntitiesSavedStatesCallback:O}),shortcuts:{previous:y,next:w}}),(0,a.createElement)(wn,null),(0,a.createElement)(sn,null),(0,a.createElement)(or,null),(0,a.createElement)(vr,null),(0,a.createElement)(E.Popover.Slot,null),(0,a.createElement)(P.PluginArea,{onError:function(e){c((0,f.sprintf)((0,f.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}))};function Sr(e){let{postId:t}=e;return(e=>{const{hasBlockSelection:t,isEditorSidebarOpened:n}=(0,u.useSelect)((e=>({hasBlockSelection:!!e(b.store).getBlockSelectionStart(),isEditorSidebarOpened:e(Ft).isEditorSidebarOpened()})),[e]),{openGeneralSidebar:o}=(0,u.useDispatch)(Ft);(0,a.useEffect)((()=>{n&&o(t?"edit-post/block":"edit-post/document")}),[t,n])})(t),(e=>{const{newPermalink:t}=(0,u.useSelect)((e=>({newPermalink:e(x.store).getCurrentPost().link})),[e]),n=(0,a.useRef)();(0,a.useEffect)((()=>{n.current=document.querySelector("#wp-admin-bar-preview a")||document.querySelector("#wp-admin-bar-view a")}),[e]),(0,a.useEffect)((()=>{t&&n.current&&n.current.setAttribute("href",t)}),[t])})(t),null}var kr=window.wp.privateApis;const{lock:Pr,unlock:Cr}=(0,kr.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/edit-post"),{ExperimentalEditorProvider:Tr}=Cr(x.privateApis);var xr=function(e){let{postId:t,postType:n,settings:o,initialEdits:r,...l}=e;const{hasFixedToolbar:s,focusMode:c,isDistractionFree:d,hasInlineToolbar:m,hasThemeStyles:g,post:h,preferredStyleVariations:b,hiddenBlockTypes:f,blockTypes:v,keepCaretInsideBlock:y,isTemplateMode:w,template:S}=(0,u.useSelect)((e=>{var o,r;const{isFeatureActive:l,__experimentalGetPreviewDeviceType:a,isEditingTemplate:s,getEditedPostTemplate:c,getHiddenBlockTypes:d}=e(Rt),{getEntityRecord:u,getPostType:m,getEntityRecords:g,canUser:h}=e(Be.store),{getEditorSettings:_}=e(x.store),{getBlockTypes:E}=e(i.store);let b;if(["wp_template","wp_template_part"].includes(n)){const e=g("postType",n,{wp_id:t});b=null==e?void 0:e[0]}else b=u("postType",n,t);const f=_().supportsTemplateMode,v=null!==(o=null===(r=m(n))||void 0===r?void 0:r.viewable)&&void 0!==o&&o,y=h("create","templates");return{hasFixedToolbar:l("fixedToolbar")||"Desktop"!==a(),focusMode:l("focusMode"),isDistractionFree:l("distractionFree"),hasInlineToolbar:l("inlineToolbar"),hasThemeStyles:l("themeStyles"),preferredStyleVariations:e(p.store).get("core/edit-post","preferredStyleVariations"),hiddenBlockTypes:d(),blockTypes:E(),keepCaretInsideBlock:l("keepCaretInsideBlock"),isTemplateMode:s(),template:f&&v&&y?c():null,post:b}}),[n,t]),{updatePreferredStyleVariations:k,setIsInserterOpened:P}=(0,u.useDispatch)(Rt),C=(0,a.useMemo)((()=>{const e={...o,__experimentalPreferredStyleVariations:{value:b,onChange:k},hasFixedToolbar:s,focusMode:c,isDistractionFree:d,hasInlineToolbar:m,__experimentalSetIsInserterOpened:P,keepCaretInsideBlock:y,defaultAllowedBlockTypes:o.allowedBlockTypes};if(f.length>0){const t=!0===o.allowedBlockTypes?v.map((e=>{let{name:t}=e;return t})):o.allowedBlockTypes||[];e.allowedBlockTypes=t.filter((e=>!f.includes(e)))}return e}),[o,s,c,d,f,v,b,P,k,y]),T=(0,a.useMemo)((()=>{var e;const t=[],n=[];null===(e=o.styles)||void 0===e||e.forEach((e=>{e.__unstableType&&"theme"!==e.__unstableType?n.push(e):t.push(e)}));const r=[...o.defaultEditorStyles,...n];return g&&t.length?o.styles:r}),[o,g]);return h?(0,a.createElement)(qt.ShortcutProvider,null,(0,a.createElement)(E.SlotFillProvider,null,(0,a.createElement)(Tr,_({settings:C,post:h,initialEdits:r,useSubRegistry:!1,__unstableTemplate:w?S:void 0},l),(0,a.createElement)(x.ErrorBoundary,null,(0,a.createElement)(Sr,{postId:t}),(0,a.createElement)(wr,{styles:T})),(0,a.createElement)(x.PostLockedModal,null)))):null};var Br=e=>{let{allowedBlocks:t,icon:n,label:o,onClick:r,small:l,role:i}=e;return(0,a.createElement)(b.BlockSettingsMenuControls,null,(e=>{let{selectedBlocks:s,onClose:c}=e;return((e,t)=>{return!Array.isArray(t)||(n=t,0===e.filter((e=>!n.includes(e))).length);var n})(s,t)?(0,a.createElement)(E.MenuItem,{onClick:(0,v.compose)(r,c),icon:n,label:l?o:void 0,role:i},!l&&o):null}))},Mr=(0,v.compose)((0,P.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:E.MenuItem,icon:t.icon||e.icon,name:"core/edit-post/plugin-more-menu"}})))(ie);function Nr(e){return(0,a.createElement)(ce,_({__unstableExplicitMenuItem:!0,scope:"core/edit-post"},e))}function Ir(e,t,n,o,r){const l=document.getElementById(e),c=(0,a.createRoot)(l);(0,u.dispatch)(p.store).setDefaults("core/edit-post",{editorMode:"visual",fixedToolbar:!1,fullscreenMode:!0,hiddenBlockTypes:[],inactivePanels:[],isPublishSidebarEnabled:!0,openPanels:["post-status"],preferredStyleVariations:{},showBlockBreadcrumbs:!0,showIconLabels:!1,showListViewByDefault:!1,themeStyles:!0,welcomeGuide:!0,welcomeGuideTemplate:!0}),(0,u.dispatch)(i.store).__experimentalReapplyBlockTypeFilters(),(0,u.select)(Rt).isFeatureActive("showListViewByDefault")&&(0,u.dispatch)(Rt).setIsListViewOpened(!0),(0,s.registerCoreBlocks)(),(0,g.registerLegacyWidgetBlock)({inserter:!1}),(0,m.addFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter",((e,t)=>!(!(0,u.select)(Rt).isEditingTemplate()&&"core/template-part"===t.name)&&e));"Standards"!==("CSS1Compat"===document.compatMode?"Standards":"Quirks")&&console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");return-1!==window.navigator.userAgent.indexOf("iPhone")&&window.addEventListener("scroll",(e=>{const t=document.getElementsByClassName("interface-interface-skeleton__body")[0];e.target===document&&(window.scrollY>100&&(t.scrollTop=t.scrollTop+window.scrollY),document.getElementsByClassName("is-mode-visual")[0]&&window.scrollTo(0,0))})),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),c.render((0,a.createElement)(xr,{settings:o,postId:n,postType:t,initialEdits:r})),c}function Dr(){d()("wp.editPost.reinitializeEditor",{since:"6.2",version:"6.3"})}}(),(window.wp=window.wp||{}).editPost=o}();