WordPress/wp-includes/js/dist/edit-post.min.js
noisysocks cf877c686b Editor: Update packages for 6.7 Beta 1.
Syncs `@wordpress/*` packages to the `wp-6.7` npm tag.

See #61906.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-09-30 05:11:31 +00:00

2 lines
42 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 */
(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var s in o)e.o(o,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:o[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{PluginBlockSettingsMenuItem:()=>Gt,PluginDocumentSettingPanel:()=>Ut,PluginMoreMenuItem:()=>Ht,PluginPostPublishPanel:()=>Wt,PluginPostStatusInfo:()=>Qt,PluginPrePublishPanel:()=>qt,PluginSidebar:()=>$t,PluginSidebarMoreMenuItem:()=>Xt,__experimentalFullscreenModeClose:()=>j,__experimentalMainDashboardButton:()=>Yt,__experimentalPluginPostExcerpt:()=>Zt,initializeEditor:()=>eo,reinitializeEditor:()=>to,store:()=>Je});var o={};e.r(o),e.d(o,{__experimentalSetPreviewDeviceType:()=>ge,__unstableCreateTemplate:()=>ye,closeGeneralSidebar:()=>$,closeModal:()=>Z,closePublishSidebar:()=>K,hideBlockTypes:()=>ce,initializeMetaBoxes:()=>fe,metaBoxUpdatesFailure:()=>ue,metaBoxUpdatesSuccess:()=>pe,openGeneralSidebar:()=>Q,openModal:()=>X,openPublishSidebar:()=>Y,removeEditorPanel:()=>oe,requestMetaBoxUpdates:()=>de,setAvailableMetaBoxesPerLocation:()=>le,setIsEditingTemplate:()=>we,setIsInserterOpened:()=>me,setIsListViewOpened:()=>he,showBlockTypes:()=>ae,switchEditorMode:()=>ie,toggleDistractionFree:()=>be,toggleEditorPanelEnabled:()=>ee,toggleEditorPanelOpened:()=>te,toggleFeature:()=>se,togglePinnedPluginItem:()=>re,togglePublishSidebar:()=>J,updatePreferredStyleVariations:()=>ne});var s={};e.r(s),e.d(s,{getEditedPostTemplateId:()=>xe});var i={};e.r(i),e.d(i,{__experimentalGetInsertionPoint:()=>$e,__experimentalGetPreviewDeviceType:()=>We,areMetaBoxesInitialized:()=>Ye,getActiveGeneralSidebarName:()=>Be,getActiveMetaBoxLocations:()=>Ne,getAllMetaBoxes:()=>Ue,getEditedPostTemplate:()=>Ke,getEditorMode:()=>Ee,getHiddenBlockTypes:()=>Ie,getMetaBoxesPerLocation:()=>Ge,getPreference:()=>je,getPreferences:()=>ke,hasMetaBoxes:()=>He,isEditingTemplate:()=>Ze,isEditorPanelEnabled:()=>Ce,isEditorPanelOpened:()=>Oe,isEditorPanelRemoved:()=>Re,isEditorSidebarOpened:()=>Me,isFeatureActive:()=>Fe,isInserterOpened:()=>Qe,isListViewOpened:()=>Xe,isMetaBoxLocationActive:()=>ze,isMetaBoxLocationVisible:()=>Ve,isModalActive:()=>De,isPluginItemPinned:()=>Le,isPluginSidebarOpened:()=>Te,isPublishSidebarOpened:()=>Ae,isSavingMetaBoxes:()=>qe});const r=window.wp.blocks,n=window.wp.blockLibrary,a=window.wp.deprecated;var c=e.n(a);const l=window.wp.element,d=window.wp.data,p=window.wp.preferences,u=window.wp.widgets,g=window.wp.editor;function m(e){var t,o,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(o=m(e[t]))&&(s&&(s+=" "),s+=o)}else for(o in e)e[o]&&(s&&(s+=" "),s+=o);return s}const h=function(){for(var e,t,o=0,s="",i=arguments.length;o<i;o++)(e=arguments[o])&&(t=m(e))&&(s&&(s+=" "),s+=t);return s},w=window.wp.blockEditor,y=window.wp.plugins,_=window.wp.i18n,f=window.wp.notices,b=window.wp.commands,x=window.wp.coreCommands,v=window.wp.url,S=window.wp.htmlEntities,P=window.wp.coreData,E=window.wp.components,M=window.wp.compose,T=window.wp.primitives,B=window.ReactJSXRuntime,k=(0,B.jsx)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,B.jsx)(T.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"})});const j=function({showTooltip:e,icon:t,href:o,initialPost:s}){var i;const{isRequestingSiteIcon:r,postType:n,siteIconUrl:a}=(0,d.useSelect)((e=>{const{getCurrentPostType:t}=e(g.store),{getEntityRecord:o,getPostType:i,isResolving:r}=e(P.store),n=o("root","__unstableBase",void 0)||{},a=s?.type||t();return{isRequestingSiteIcon:r("getEntityRecord",["root","__unstableBase",void 0]),postType:i(a),siteIconUrl:n.site_icon_url}}),[]),c=(0,M.useReducedMotion)();if(!n)return null;let l=(0,B.jsx)(E.Icon,{size:"36px",icon:k});const p={expand:{scale:1.25,transition:{type:"tween",duration:"0.3"}}};a&&(l=(0,B.jsx)(E.__unstableMotion.img,{variants:!c&&p,alt:(0,_.__)("Site Icon"),className:"edit-post-fullscreen-mode-close_site-icon",src:a})),r&&(l=null),t&&(l=(0,B.jsx)(E.Icon,{size:"36px",icon:t}));const u=h("edit-post-fullscreen-mode-close",{"has-icon":a}),m=null!=o?o:(0,v.addQueryArgs)("edit.php",{post_type:n.slug}),w=null!==(i=n?.labels?.view_items)&&void 0!==i?i:(0,_.__)("Back");return(0,B.jsx)(E.__unstableMotion.div,{whileHover:"expand",children:(0,B.jsx)(E.Button,{__next40pxDefaultSize:!1,className:u,href:m,label:w,showTooltip:e,children:l})})},I=window.wp.privateApis,{lock:A,unlock:R}=(0,I.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-post"),{BackButton:C}=R(g.privateApis),O={hidden:{x:"-100%"},distractionFreeInactive:{x:0},hover:{x:0,transition:{type:"tween",delay:.2}}};const D=function({initialPost:e}){return(0,B.jsx)(C,{children:({length:t})=>t<=1&&(0,B.jsx)(E.__unstableMotion.div,{variants:O,transition:{type:"tween",delay:.8},children:(0,B.jsx)(j,{showTooltip:!0,initialPost:e})})})},F=()=>{const{newPermalink:e}=(0,d.useSelect)((e=>({newPermalink:e(g.store).getCurrentPost().link})),[]),t=(0,l.useRef)();(0,l.useEffect)((()=>{t.current=document.querySelector("#wp-admin-bar-preview a")||document.querySelector("#wp-admin-bar-view a")}),[]),(0,l.useEffect)((()=>{e&&t.current&&t.current.setAttribute("href",e)}),[e])};function L(){return F(),null}const N=window.wp.keyboardShortcuts;function V(e=[],t){const o=[...e];for(const e of t){const t=o.findIndex((t=>t.id===e.id));-1!==t?o[t]=e:o.push(e)}return o}const z=(0,d.combineReducers)({isSaving:function(e=!1,t){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(e={},t){if("SET_META_BOXES_PER_LOCATIONS"===t.type){const o={...e};for(const[e,s]of Object.entries(t.metaBoxesPerLocation))o[e]=V(o[e],s);return o}return e},initialized:function(e=!1,t){return"META_BOXES_INITIALIZED"===t.type||e}}),G=(0,d.combineReducers)({metaBoxes:z}),U=window.wp.apiFetch;var H=e.n(U);const q=window.wp.hooks,{interfaceStore:W}=R(g.privateApis),Q=e=>({registry:t})=>{t.dispatch(W).enableComplementaryArea("core",e)},$=()=>({registry:e})=>e.dispatch(W).disableComplementaryArea("core"),X=e=>({registry:t})=>(c()("select( 'core/edit-post' ).openModal( name )",{since:"6.3",alternative:"select( 'core/interface').openModal( name )"}),t.dispatch(W).openModal(e)),Z=()=>({registry:e})=>(c()("select( 'core/edit-post' ).closeModal()",{since:"6.3",alternative:"select( 'core/interface').closeModal()"}),e.dispatch(W).closeModal()),Y=()=>({registry:e})=>{c()("dispatch( 'core/edit-post' ).openPublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').openPublishSidebar"}),e.dispatch(g.store).openPublishSidebar()},K=()=>({registry:e})=>{c()("dispatch( 'core/edit-post' ).closePublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').closePublishSidebar"}),e.dispatch(g.store).closePublishSidebar()},J=()=>({registry:e})=>{c()("dispatch( 'core/edit-post' ).togglePublishSidebar",{since:"6.6",alternative:"dispatch( 'core/editor').togglePublishSidebar"}),e.dispatch(g.store).togglePublishSidebar()},ee=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled",{since:"6.5",alternative:"dispatch( 'core/editor').toggleEditorPanelEnabled"}),t.dispatch(g.store).toggleEditorPanelEnabled(e)},te=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened",{since:"6.5",alternative:"dispatch( 'core/editor').toggleEditorPanelOpened"}),t.dispatch(g.store).toggleEditorPanelOpened(e)},oe=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).removeEditorPanel",{since:"6.5",alternative:"dispatch( 'core/editor').removeEditorPanel"}),t.dispatch(g.store).removeEditorPanel(e)},se=e=>({registry:t})=>t.dispatch(p.store).toggle("core/edit-post",e),ie=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(g.store).switchEditorMode(e)},re=e=>({registry:t})=>{const o=t.select(W).isItemPinned("core",e);t.dispatch(W)[o?"unpinItem":"pinItem"]("core",e)};function ne(){return c()("dispatch( 'core/edit-post' ).updatePreferredStyleVariations",{since:"6.6",hint:"Preferred Style Variations are not supported anymore."}),{type:"NOTHING"}}const ae=e=>({registry:t})=>{R(t.dispatch(g.store)).showBlockTypes(e)},ce=e=>({registry:t})=>{R(t.dispatch(g.store)).hideBlockTypes(e)};function le(e){return{type:"SET_META_BOXES_PER_LOCATIONS",metaBoxesPerLocation:e}}const de=()=>async({registry:e,select:t,dispatch:o})=>{o({type:"REQUEST_META_BOX_UPDATES"}),window.tinyMCE&&window.tinyMCE.triggerSave();const s=new window.FormData(document.querySelector(".metabox-base-form")),i=s.get("post_ID"),r=s.get("post_type"),n=e.select(P.store).getEditedEntityRecord("postType",r,i),a=[!!n.comment_status&&["comment_status",n.comment_status],!!n.ping_status&&["ping_status",n.ping_status],!!n.sticky&&["sticky",n.sticky],!!n.author&&["post_author",n.author]].filter(Boolean),c=[s,...t.getActiveMetaBoxLocations().map((e=>new window.FormData((e=>{const t=document.querySelector(`.edit-post-meta-boxes-area.is-${e} .metabox-location-${e}`);return t||document.querySelector("#metaboxes .metabox-location-"+e)})(e))))].reduce(((e,t)=>{for(const[o,s]of t)e.append(o,s);return e}),new window.FormData);a.forEach((([e,t])=>c.append(e,t)));try{await H()({url:window._wpMetaBoxUrl,method:"POST",body:c,parse:!1}),o.metaBoxUpdatesSuccess()}catch{o.metaBoxUpdatesFailure()}};function pe(){return{type:"META_BOX_UPDATES_SUCCESS"}}function ue(){return{type:"META_BOX_UPDATES_FAILURE"}}const ge=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(g.store).setDeviceType(e)},me=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(g.store).setIsInserterOpened(e)},he=e=>({registry:t})=>{c()("dispatch( 'core/edit-post' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(g.store).setIsListViewOpened(e)};function we(){return c()("dispatch( 'core/edit-post' ).setIsEditingTemplate",{since:"6.5",alternative:"dispatch( 'core/editor').setRenderingMode"}),{type:"NOTHING"}}function ye(){return c()("dispatch( 'core/edit-post' ).__unstableCreateTemplate",{since:"6.5"}),{type:"NOTHING"}}let _e=!1;const fe=()=>({registry:e,select:t,dispatch:o})=>{if(!e.select(g.store).__unstableIsEditorReady())return;if(_e)return;const s=e.select(g.store).getCurrentPostType();window.postboxes.page!==s&&window.postboxes.add_postbox_toggles(s),_e=!0,(0,q.addAction)("editor.savePost","core/edit-post/save-metaboxes",(async e=>{!e.isAutosave&&t.hasMetaBoxes()&&await o.requestMetaBoxUpdates()})),o({type:"META_BOXES_INITIALIZED"})},be=()=>({registry:e})=>{c()("dispatch( 'core/edit-post' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(g.store).toggleDistractionFree()},xe=(0,d.createRegistrySelector)((e=>()=>{const{id:t,type:o,slug:s}=e(g.store).getCurrentPost(),{getEntityRecord:i,getEntityRecords:r,canUser:n}=e(P.store),a=n("read",{kind:"root",name:"site"})?i("root","site"):void 0;if(+t===a?.page_for_posts)return e(P.store).getDefaultTemplateId({slug:"home"});const c=e(g.store).getEditedPostAttribute("template");if(c){const e=r("postType","wp_template",{per_page:-1})?.find((e=>e.slug===c));return e?e.id:e}let l;return l=s?"page"===o?`${o}-${s}`:`single-${o}-${s}`:"page"===o?"page":`single-${o}`,o?e(P.store).getDefaultTemplateId({slug:l}):void 0})),{interfaceStore:ve}=R(g.privateApis),Se=[],Pe={},Ee=(0,d.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core","editorMode"))&&void 0!==t?t:"visual"})),Me=(0,d.createRegistrySelector)((e=>()=>{const t=e(ve).getActiveComplementaryArea("core");return["edit-post/document","edit-post/block"].includes(t)})),Te=(0,d.createRegistrySelector)((e=>()=>{const t=e(ve).getActiveComplementaryArea("core");return!!t&&!["edit-post/document","edit-post/block"].includes(t)})),Be=(0,d.createRegistrySelector)((e=>()=>e(ve).getActiveComplementaryArea("core")));const ke=(0,d.createRegistrySelector)((e=>()=>{c()("select( 'core/edit-post' ).getPreferences",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const t=["editorMode","hiddenBlockTypes"].reduce(((t,o)=>({...t,[o]:e(p.store).get("core",o)})),{}),o=function(e,t){var o;const s=e?.reduce(((e,t)=>({...e,[t]:{enabled:!1}})),{}),i=t?.reduce(((e,t)=>{const o=e?.[t];return{...e,[t]:{...o,opened:!0}}}),null!=s?s:{});return null!==(o=null!=i?i:s)&&void 0!==o?o:Pe}(e(p.store).get("core","inactivePanels"),e(p.store).get("core","openPanels"));return{...t,panels:o}}));function je(e,t,o){c()("select( 'core/edit-post' ).getPreference",{since:"6.0",alternative:"select( 'core/preferences' ).get"});const s=ke(e)[t];return void 0===s?o:s}const Ie=(0,d.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(p.store).get("core","hiddenBlockTypes"))&&void 0!==t?t:Se})),Ae=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-post' ).isPublishSidebarOpened",{since:"6.6",alternative:"select( 'core/editor' ).isPublishSidebarOpened"}),e(g.store).isPublishSidebarOpened()))),Re=(0,d.createRegistrySelector)((e=>(t,o)=>(c()("select( 'core/edit-post' ).isEditorPanelRemoved",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelRemoved"}),e(g.store).isEditorPanelRemoved(o)))),Ce=(0,d.createRegistrySelector)((e=>(t,o)=>(c()("select( 'core/edit-post' ).isEditorPanelEnabled",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelEnabled"}),e(g.store).isEditorPanelEnabled(o)))),Oe=(0,d.createRegistrySelector)((e=>(t,o)=>(c()("select( 'core/edit-post' ).isEditorPanelOpened",{since:"6.5",alternative:"select( 'core/editor' ).isEditorPanelOpened"}),e(g.store).isEditorPanelOpened(o)))),De=(0,d.createRegistrySelector)((e=>(t,o)=>(c()("select( 'core/edit-post' ).isModalActive",{since:"6.3",alternative:"select( 'core/interface' ).isModalActive"}),!!e(ve).isModalActive(o)))),Fe=(0,d.createRegistrySelector)((e=>(t,o)=>!!e(p.store).get("core/edit-post",o))),Le=(0,d.createRegistrySelector)((e=>(t,o)=>e(ve).isItemPinned("core",o))),Ne=(0,d.createSelector)((e=>Object.keys(e.metaBoxes.locations).filter((t=>ze(e,t)))),(e=>[e.metaBoxes.locations])),Ve=(0,d.createRegistrySelector)((e=>(t,o)=>ze(t,o)&&Ge(t,o)?.some((({id:t})=>e(g.store).isEditorPanelEnabled(`meta-box-${t}`)))));function ze(e,t){const o=Ge(e,t);return!!o&&0!==o.length}function Ge(e,t){return e.metaBoxes.locations[t]}const Ue=(0,d.createSelector)((e=>Object.values(e.metaBoxes.locations).flat()),(e=>[e.metaBoxes.locations]));function He(e){return Ne(e).length>0}function qe(e){return e.metaBoxes.isSaving}const We=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(g.store).getDeviceType()))),Qe=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-post' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(g.store).isInserterOpened()))),$e=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-post' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),R(e(g.store)).getInsertionPoint()))),Xe=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-post' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(g.store).isListViewOpened()))),Ze=(0,d.createRegistrySelector)((e=>()=>(c()("select( 'core/edit-post' ).isEditingTemplate",{since:"6.5",alternative:"select( 'core/editor' ).getRenderingMode"}),"wp_template"===e(g.store).getCurrentPostType())));function Ye(e){return e.metaBoxes.initialized}const Ke=(0,d.createRegistrySelector)((e=>t=>{const o=xe(t);if(o)return e(P.store).getEditedEntityRecord("postType","wp_template",o)})),Je=(0,d.createReduxStore)("core/edit-post",{reducer:G,actions:o,selectors:i});(0,d.register)(Je),R(Je).registerPrivateSelectors(s);const et=function(){const{toggleFeature:e}=(0,d.useDispatch)(Je),{registerShortcut:t}=(0,d.useDispatch)(N.store);return(0,l.useEffect)((()=>{t({name:"core/edit-post/toggle-fullscreen",category:"global",description:(0,_.__)("Toggle fullscreen mode."),keyCombination:{modifier:"secondary",character:"f"}})}),[]),(0,N.useShortcut)("core/edit-post/toggle-fullscreen",(()=>{e("fullscreenMode")})),null};function tt(){const{editPost:e}=(0,d.useDispatch)(g.store),[t,o]=(0,l.useState)(!1),[s,i]=(0,l.useState)(void 0),[r,n]=(0,l.useState)(""),{postType:a,isNewPost:c}=(0,d.useSelect)((e=>{const{getEditedPostAttribute:t,isCleanNewPost:o}=e(g.store);return{postType:t("type"),isNewPost:o()}}),[]);return(0,l.useEffect)((()=>{c&&"wp_block"===a&&o(!0)}),[]),"wp_block"===a&&c?(0,B.jsx)(B.Fragment,{children:t&&(0,B.jsx)(E.Modal,{title:(0,_.__)("Create pattern"),onRequestClose:()=>{o(!1)},overlayClassName:"reusable-blocks-menu-items__convert-modal",children:(0,B.jsx)("form",{onSubmit:t=>{t.preventDefault(),o(!1),e({title:r,meta:{wp_pattern_sync_status:s}})},children:(0,B.jsxs)(E.__experimentalVStack,{spacing:"5",children:[(0,B.jsx)(E.TextControl,{label:(0,_.__)("Name"),value:r,onChange:n,placeholder:(0,_.__)("My pattern"),className:"patterns-create-modal__name-input",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,B.jsx)(E.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_._x)("Synced","pattern (singular)"),help:(0,_.__)("Sync this pattern across multiple locations."),checked:!s,onChange:()=>{i(s?void 0:"unsynced")}}),(0,B.jsx)(E.__experimentalHStack,{justify:"right",children:(0,B.jsx)(E.Button,{__next40pxDefaultSize:!1,variant:"primary",type:"submit",disabled:!r,accessibleWhenDisabled:!0,children:(0,_.__)("Create")})})]})})})}):null}class ot extends l.Component{constructor(){super(...arguments),this.state={historyId:null}}componentDidUpdate(e){const{postId:t,postStatus:o,hasHistory:s}=this.props,{historyId:i}=this.state;t===e.postId&&t===i||"auto-draft"===o||!t||s||this.setBrowserURL(t)}setBrowserURL(e){window.history.replaceState({id:e},"Post "+e,function(e){return(0,v.addQueryArgs)("post.php",{post:e,action:"edit"})}(e)),this.setState((()=>({historyId:e})))}render(){return null}}const st=(0,d.withSelect)((e=>{const{getCurrentPost:t}=e(g.store),o=t();let{id:s,status:i,type:r}=o;return["wp_template","wp_template_part"].includes(r)&&(s=o.wp_id),{postId:s,postStatus:i}}))(ot);const it=function({location:e}){const t=(0,l.useRef)(null),o=(0,l.useRef)(null);(0,l.useEffect)((()=>(o.current=document.querySelector(".metabox-location-"+e),o.current&&t.current.appendChild(o.current),()=>{o.current&&document.querySelector("#metaboxes").appendChild(o.current)})),[e]);const s=(0,d.useSelect)((e=>e(Je).isSavingMetaBoxes()),[]),i=h("edit-post-meta-boxes-area",`is-${e}`,{"is-loading":s});return(0,B.jsxs)("div",{className:i,children:[s&&(0,B.jsx)(E.Spinner,{}),(0,B.jsx)("div",{className:"edit-post-meta-boxes-area__container",ref:t}),(0,B.jsx)("div",{className:"edit-post-meta-boxes-area__clear"})]})};class rt extends l.Component{componentDidMount(){this.updateDOM()}componentDidUpdate(e){this.props.isVisible!==e.isVisible&&this.updateDOM()}updateDOM(){const{id:e,isVisible:t}=this.props,o=document.getElementById(e);o&&(t?o.classList.remove("is-hidden"):o.classList.add("is-hidden"))}render(){return null}}const nt=(0,d.withSelect)(((e,{id:t})=>({isVisible:e(g.store).isEditorPanelEnabled(`meta-box-${t}`)})))(rt);function at({location:e}){const t=(0,d.useRegistry)(),{metaBoxes:o,areMetaBoxesInitialized:s,isEditorReady:i}=(0,d.useSelect)((t=>{const{__unstableIsEditorReady:o}=t(g.store),{getMetaBoxesPerLocation:s,areMetaBoxesInitialized:i}=t(Je);return{metaBoxes:s(e),areMetaBoxesInitialized:i(),isEditorReady:o()}}),[e]),r=!!o?.length;return(0,l.useEffect)((()=>{i&&r&&!s&&t.dispatch(Je).initializeMetaBoxes()}),[i,r,s]),s?(0,B.jsxs)(B.Fragment,{children:[(null!=o?o:[]).map((({id:e})=>(0,B.jsx)(nt,{id:e},e))),(0,B.jsx)(it,{location:e})]}):null}const ct=window.wp.keycodes;const lt=function(){const e=(0,d.useSelect)((e=>{const{canUser:t}=e(P.store),o=(0,v.addQueryArgs)("edit.php",{post_type:"wp_block"}),s=(0,v.addQueryArgs)("site-editor.php",{path:"/patterns"});return t("create",{kind:"postType",name:"wp_template"})?s:o}),[]);return(0,B.jsx)(E.MenuItem,{role:"menuitem",href:e,children:(0,_.__)("Manage patterns")})};function dt(){const e=(0,d.useSelect)((e=>"wp_template"===e(g.store).getCurrentPostType()),[]);return(0,B.jsx)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:e?"welcomeGuideTemplate":"welcomeGuide",label:(0,_.__)("Welcome Guide")})}const{PreferenceBaseOption:pt}=R(p.privateApis);function ut({willEnable:e}){const[t,o]=(0,l.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("p",{className:"edit-post-preferences-modal__custom-fields-confirmation-message",children:(0,_.__)("A page reload is required for this change. Make sure your content is saved before reloading.")}),(0,B.jsx)(E.Button,{__next40pxDefaultSize:!1,className:"edit-post-preferences-modal__custom-fields-confirmation-button",variant:"secondary",isBusy:t,accessibleWhenDisabled:!0,disabled:t,onClick:()=>{o(!0),function(){const e=document.getElementById("toggle-custom-fields-form");e.querySelector('[name="_wp_http_referer"]').setAttribute("value",(0,v.getPathAndQueryString)(window.location.href)),e.submit()}()},children:e?(0,_.__)("Show & Reload Page"):(0,_.__)("Hide & Reload Page")})]})}const gt=(0,d.withSelect)((e=>({areCustomFieldsEnabled:!!e(g.store).getEditorSettings().enableCustomFields})))((function({label:e,areCustomFieldsEnabled:t}){const[o,s]=(0,l.useState)(t);return(0,B.jsx)(pt,{label:e,isChecked:o,onChange:s,children:o!==t&&(0,B.jsx)(ut,{willEnable:o})})})),{PreferenceBaseOption:mt}=R(p.privateApis),ht=(0,M.compose)((0,d.withSelect)(((e,{panelName:t})=>{const{isEditorPanelEnabled:o,isEditorPanelRemoved:s}=e(g.store);return{isRemoved:s(t),isChecked:o(t)}})),(0,M.ifCondition)((({isRemoved:e})=>!e)),(0,d.withDispatch)(((e,{panelName:t})=>({onChange:()=>e(g.store).toggleEditorPanelEnabled(t)}))))(mt),{PreferencesModalSection:wt}=R(p.privateApis);const yt=(0,d.withSelect)((e=>{const{getEditorSettings:t}=e(g.store),{getAllMetaBoxes:o}=e(Je);return{areCustomFieldsRegistered:void 0!==t().enableCustomFields,metaBoxes:o()}}))((function({areCustomFieldsRegistered:e,metaBoxes:t,...o}){const s=t.filter((({id:e})=>"postcustom"!==e));return e||0!==s.length?(0,B.jsxs)(wt,{...o,children:[e&&(0,B.jsx)(gt,{label:(0,_.__)("Custom fields")}),s.map((({id:e,title:t})=>(0,B.jsx)(ht,{label:t,panelName:`meta-box-${e}`},e)))]}):null})),{PreferenceToggleControl:_t}=R(p.privateApis),{PreferencesModal:ft}=R(g.privateApis);function bt(){const e={general:(0,B.jsx)(yt,{title:(0,_.__)("Advanced")}),appearance:(0,B.jsx)(_t,{scope:"core/edit-post",featureName:"themeStyles",help:(0,_.__)("Make the editor look like your theme."),label:(0,_.__)("Use theme styles")})};return(0,B.jsx)(ft,{extraSections:e})}const{ToolsMoreMenuGroup:xt,ViewMoreMenuGroup:vt}=R(g.privateApis),St=()=>{const e=(0,M.useViewportMatch)("large");return(0,B.jsxs)(B.Fragment,{children:[e&&(0,B.jsx)(vt,{children:(0,B.jsx)(p.PreferenceToggleMenuItem,{scope:"core/edit-post",name:"fullscreenMode",label:(0,_.__)("Fullscreen mode"),info:(0,_.__)("Show and hide the admin user interface"),messageActivated:(0,_.__)("Fullscreen mode activated"),messageDeactivated:(0,_.__)("Fullscreen mode deactivated"),shortcut:ct.displayShortcut.secondary("f")})}),(0,B.jsxs)(xt,{children:[(0,B.jsx)(lt,{}),(0,B.jsx)(dt,{})]}),(0,B.jsx)(bt,{})]})};function Pt({nonAnimatedSrc:e,animatedSrc:t}){return(0,B.jsxs)("picture",{className:"edit-post-welcome-guide__image",children:[(0,B.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,B.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function Et(){const{toggleFeature:e}=(0,d.useDispatch)(Je);return(0,B.jsx)(E.Guide,{className:"edit-post-welcome-guide",contentLabel:(0,_.__)("Welcome to the block editor"),finishButtonText:(0,_.__)("Get started"),onFinish:()=>e("welcomeGuide"),pages:[{image:(0,B.jsx)(Pt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("h1",{className:"edit-post-welcome-guide__heading",children:(0,_.__)("Welcome to the block editor")}),(0,B.jsx)("p",{className:"edit-post-welcome-guide__text",children:(0,_.__)("In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.")})]})},{image:(0,B.jsx)(Pt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("h1",{className:"edit-post-welcome-guide__heading",children:(0,_.__)("Make each block your own")}),(0,B.jsx)("p",{className:"edit-post-welcome-guide__text",children:(0,_.__)("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,B.jsx)(Pt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("h1",{className:"edit-post-welcome-guide__heading",children:(0,_.__)("Get to know the block library")}),(0,B.jsx)("p",{className:"edit-post-welcome-guide__text",children:(0,l.createInterpolateElement)((0,_.__)("All of the blocks available to you live in the block library. Youll find it wherever you see the <InserterIconImage /> icon."),{InserterIconImage:(0,B.jsx)("img",{alt:(0,_.__)("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,B.jsx)(Pt,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("h1",{className:"edit-post-welcome-guide__heading",children:(0,_.__)("Learn how to use the block editor")}),(0,B.jsx)("p",{className:"edit-post-welcome-guide__text",children:(0,l.createInterpolateElement)((0,_.__)("New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"),{a:(0,B.jsx)(E.ExternalLink,{href:(0,_.__)("https://wordpress.org/documentation/article/wordpress-block-editor/")})})})]})}]})}function Mt(){const{toggleFeature:e}=(0,d.useDispatch)(Je);return(0,B.jsx)(E.Guide,{className:"edit-template-welcome-guide",contentLabel:(0,_.__)("Welcome to the template editor"),finishButtonText:(0,_.__)("Get started"),onFinish:()=>e("welcomeGuideTemplate"),pages:[{image:(0,B.jsx)(Pt,{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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("h1",{className:"edit-post-welcome-guide__heading",children:(0,_.__)("Welcome to the template editor")}),(0,B.jsx)("p",{className:"edit-post-welcome-guide__text",children:(0,_.__)("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 Tt({postType:e}){const{isActive:t,isEditingTemplate:o}=(0,d.useSelect)((t=>{const{isFeatureActive:o}=t(Je),s="wp_template"===e;return{isActive:o(s?"welcomeGuideTemplate":"welcomeGuide"),isEditingTemplate:s}}),[e]);return t?o?(0,B.jsx)(Mt,{}):(0,B.jsx)(Et,{}):null}const Bt=(0,B.jsx)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,B.jsx)(T.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"})});const kt=!1;const{getLayoutStyles:jt}=R(w.privateApis),{useCommands:It}=R(x.privateApis),{useCommandContext:At}=R(b.privateApis),{Editor:Rt,FullscreenMode:Ct}=R(g.privateApis),{BlockKeyboardShortcuts:Ot}=R(n.privateApis),Dt=["wp_template","wp_template_part","wp_block","wp_navigation"];function Ft({isLegacy:e}){const[t,o,s]=(0,d.useSelect)((e=>{const{get:t}=e(p.store),{isMetaBoxLocationVisible:o}=e(Je);return[t("core/edit-post","metaBoxesMainIsOpen"),t("core/edit-post","metaBoxesMainOpenHeight"),o("normal")||o("advanced")||o("side")]}),[]),{set:i}=(0,d.useDispatch)(p.store),r=(0,l.useRef)(),n=(0,M.useMediaQuery)("(max-height: 549px)"),[{min:a,max:c},u]=(0,l.useState)((()=>({}))),g=(0,M.useRefEffect)((e=>{const t=e.closest(".interface-interface-skeleton__content"),o=t.querySelectorAll(":scope > .components-notice-list"),s=t.querySelector(".edit-post-meta-boxes-main__resize-handle"),i=new window.ResizeObserver((()=>{let e=t.offsetHeight;for(const t of o)e-=t.offsetHeight;const i=s.offsetHeight;u({min:i,max:e})}));i.observe(t);for(const e of o)i.observe(e);return()=>i.disconnect()}),[]),m=(0,l.useRef)(),w=(0,l.useId)(),[y,f]=(0,l.useState)(!0);if(!s)return;const b="edit-post-meta-boxes-main",x=(0,B.jsxs)("div",{className:h("edit-post-layout__metaboxes",!e&&"edit-post-meta-boxes-main__liner"),children:[(0,B.jsx)(at,{location:"normal"}),(0,B.jsx)(at,{location:"advanced"})]});if(e)return x;const v=void 0===o;let S="50%";void 0!==c&&(S=v&&y?c/2:c);const P=e=>Math.round((e-a)/(c-a)*100),T=void 0===c||v?50:P(o);if(n)return(0,B.jsxs)("details",{className:b,open:t,onToggle:({target:e})=>{i("core/edit-post","metaBoxesMainIsOpen",e.open)},children:[(0,B.jsx)("summary",{children:(0,_.__)("Meta Boxes")}),x]});return(0,B.jsxs)(E.ResizableBox,{className:b,defaultSize:{height:o},ref:r,enable:{top:!0,right:!1,bottom:!1,left:!1,topLeft:!1,topRight:!1,bottomRight:!1,bottomLeft:!1},minHeight:a,maxHeight:S,bounds:"parent",boundsByDirection:!0,onPointerDown:({pointerId:e,target:t})=>{t.setPointerCapture(e)},onResizeStart:(e,t,o)=>{if(v){const e=o.offsetHeight;r.current.updateSize({height:e}),f(!1)}},onResize:()=>{const{height:e}=r.current.state;m.current.ariaValueNow=P(e)},onResizeStop:()=>{const e=r.current.state.height;i("core/edit-post","metaBoxesMainOpenHeight",e)},handleClasses:{top:"edit-post-meta-boxes-main__resize-handle"},handleComponent:{top:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(E.Tooltip,{text:(0,_.__)("Drag to resize"),children:(0,B.jsx)("button",{ref:m,"aria-label":(0,_.__)("Drag to resize"),"aria-describedby":w,onKeyDown:e=>{const t={ArrowUp:20,ArrowDown:-20}[e.key];if(t){const{resizable:e}=r.current,s=v?e.offsetHeight:o,n=Math.min(c,Math.max(a,t+s));r.current.updateSize({height:n,width:"auto"}),i("core/edit-post","metaBoxesMainOpenHeight",n)}},role:"separator","aria-valuenow":T})}),(0,B.jsx)(E.VisuallyHidden,{id:w,children:(0,_.__)("Use up and down arrow keys to resize the metabox panel.")})]})},children:[(0,B.jsx)("meta",{ref:g}),x]})}const Lt=function({postId:e,postType:t,settings:o,initialEdits:s}){It(),function(){const{isFullscreen:e}=(0,d.useSelect)((e=>{const{get:t}=e(p.store);return{isFullscreen:t("core/edit-post","fullscreenMode")}}),[]),{toggle:t}=(0,d.useDispatch)(p.store),{createInfoNotice:o}=(0,d.useDispatch)(f.store);(0,b.useCommand)({name:"core/toggle-fullscreen-mode",label:e?(0,_.__)("Exit fullscreen"):(0,_.__)("Enter fullscreen"),icon:Bt,callback:({close:s})=>{t("core/edit-post","fullscreenMode"),s(),o(e?(0,_.__)("Fullscreen off."):(0,_.__)("Fullscreen on."),{id:"core/edit-post/toggle-fullscreen-mode/notice",type:"snackbar",actions:[{label:(0,_.__)("Undo"),onClick:()=>{t("core/edit-post","fullscreenMode")}}]})}})}();const i=function(){const e=(0,d.useRegistry)();return(0,M.useRefEffect)((t=>{function o(o){if(o.target!==t)return;const{ownerDocument:s}=t,{defaultView:i}=s;if(!i.parseInt(i.getComputedStyle(t,":after").height,10))return;const n=t.lastElementChild;if(!n)return;const a=n.getBoundingClientRect();if(o.clientY<a.bottom)return;o.stopPropagation();const c=e.select(w.store).getBlockOrder(""),l=c[c.length-1],d=e.select(w.store).getBlock(l),{selectBlock:p,insertDefaultBlock:u}=e.dispatch(w.store);d&&(0,r.isUnmodifiedDefaultBlock)(d)?p(l):u()}return t.addEventListener("mousedown",o),()=>{t.removeEventListener("mousedown",o)}}),[e])}(),n=function(){const{isBlockBasedTheme:e,hasV3BlocksOnly:t,isEditingTemplate:o,isZoomOutMode:s}=(0,d.useSelect)((e=>{const{getEditorSettings:t,getCurrentPostType:o}=e(g.store),{__unstableGetEditorMode:s}=e(w.store),{getBlockTypes:i}=e(r.store);return{isBlockBasedTheme:t().__unstableIsBlockBasedTheme,hasV3BlocksOnly:i().every((e=>e.apiVersion>=3)),isEditingTemplate:"wp_template"===o(),isZoomOutMode:"zoom-out"===s()}}),[]);return t||kt&&e||o||s}(),{createErrorNotice:a}=(0,d.useDispatch)(f.store),{currentPost:{postId:c,postType:u},onNavigateToEntityRecord:m,onNavigateToPreviousEntityRecord:x}=function(e,t,o){const[s,i]=(0,l.useReducer)(((e,{type:t,post:o,previousRenderingMode:s})=>"push"===t?[...e,{post:o,previousRenderingMode:s}]:"pop"===t&&e.length>1?e.slice(0,-1):e),[{post:{postId:e,postType:t}}]),{post:r,previousRenderingMode:n}=s[s.length-1],{getRenderingMode:a}=(0,d.useSelect)(g.store),{setRenderingMode:c}=(0,d.useDispatch)(g.store),p=(0,l.useCallback)((e=>{i({type:"push",post:{postId:e.postId,postType:e.postType},previousRenderingMode:a()}),c(o)}),[a,c,o]),u=(0,l.useCallback)((()=>{i({type:"pop"}),n&&c(n)}),[c,n]);return{currentPost:r,onNavigateToEntityRecord:p,onNavigateToPreviousEntityRecord:s.length>1?u:void 0}}(e,t,"post-only"),T="wp_template"===u,{mode:k,isFullscreenActive:j,hasActiveMetaboxes:I,hasBlockSelected:A,showIconLabels:C,isDistractionFree:O,showMetaBoxes:F,hasHistory:N,isWelcomeGuideVisible:V,templateId:z}=(0,d.useSelect)((e=>{var t;const{get:s}=e(p.store),{isFeatureActive:i,getEditedPostTemplateId:r}=R(e(Je)),{canUser:n,getPostType:a}=e(P.store),c=o.supportsTemplateMode,l=null!==(t=a(u)?.viewable)&&void 0!==t&&t,d=n("read",{kind:"postType",name:"wp_template"});return{mode:e(g.store).getEditorMode(),isFullscreenActive:e(Je).isFeatureActive("fullscreenMode"),hasActiveMetaboxes:e(Je).hasMetaBoxes(),hasBlockSelected:!!e(w.store).getBlockSelectionStart(),showIconLabels:s("core","showIconLabels"),isDistractionFree:s("core","distractionFree"),showMetaBoxes:!Dt.includes(u)&&"post-only"===e(g.store).getRenderingMode(),isWelcomeGuideVisible:i("welcomeGuide"),templateId:c&&l&&d&&!T?r():null}}),[u,T,o.supportsTemplateMode]);At(A?"block-selection-edit":"entity-edit");const G=(0,l.useMemo)((()=>({...o,onNavigateToEntityRecord:m,onNavigateToPreviousEntityRecord:x,defaultRenderingMode:"post-only"})),[o,m,x]),U=function(){const{hasThemeStyleSupport:e,editorSettings:t,isZoomedOutView:o,renderingMode:s,postType:i}=(0,d.useSelect)((e=>{const{__unstableGetEditorMode:t}=e(w.store),{getCurrentPostType:o,getRenderingMode:s}=e(g.store),i=o();return{hasThemeStyleSupport:e(Je).isFeatureActive("themeStyles"),editorSettings:e(g.store).getEditorSettings(),isZoomedOutView:"zoom-out"===t(),renderingMode:s(),postType:i}}),[]);return(0,l.useMemo)((()=>{var r,n,a,c;const l=null!==(r=t.styles?.filter((e=>e.__unstableType&&"theme"!==e.__unstableType)))&&void 0!==r?r:[],d=[...null!==(n=t?.defaultEditorStyles)&&void 0!==n?n:[],...l],p=e&&l.length!==(null!==(a=t.styles?.length)&&void 0!==a?a:0);t.disableLayoutStyles||p||d.push({css:jt({style:{},selector:"body",hasBlockGapSupport:!1,hasFallbackGapSupport:!0,fallbackGapValue:"0.5em"})});const u=p?null!==(c=t.styles)&&void 0!==c?c:[]:d;return o||"post-only"!==s||Dt.includes(i)?u:[...u,{css:':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}'}]}),[t.defaultEditorStyles,t.disableLayoutStyles,t.styles,e,i])}();C?document.body.classList.add("show-icon-labels"):document.body.classList.remove("show-icon-labels");const H=h("edit-post-layout","is-mode-"+k,{"has-metaboxes":I}),{createSuccessNotice:q}=(0,d.useDispatch)(f.store),W=(0,l.useCallback)(((e,t)=>{switch(e){case"move-to-trash":document.location.href=(0,v.addQueryArgs)("edit.php",{trashed:1,post_type:t[0].type,ids:t[0].id});break;case"duplicate-post":{const e=t[0],o="string"==typeof e.title?e.title:e.title?.rendered;q((0,_.sprintf)((0,_.__)('"%s" successfully created.'),(0,S.decodeEntities)(o)),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,_.__)("Edit"),onClick:()=>{const t=e.id;document.location.href=(0,v.addQueryArgs)("post.php",{post:t,action:"edit"})}}]})}}}),[q]),Q=(0,l.useMemo)((()=>({type:t,id:e})),[t,e]),$=(0,M.useViewportMatch)("medium")&&j?(0,B.jsx)(D,{initialPost:Q}):null;return(0,B.jsx)(E.SlotFillProvider,{children:(0,B.jsxs)(g.ErrorBoundary,{children:[(0,B.jsx)(b.CommandMenu,{}),(0,B.jsx)(Tt,{postType:u}),(0,B.jsxs)(Rt,{settings:G,initialEdits:s,postType:u,postId:c,templateId:z,className:H,styles:U,forceIsDirty:I,contentRef:i,disableIframe:!n,autoFocus:!V,onActionPerformed:W,extraSidebarPanels:F&&(0,B.jsx)(at,{location:"side"}),extraContent:!O&&F&&(0,B.jsx)(Ft,{isLegacy:!n}),children:[(0,B.jsx)(g.PostLockedModal,{}),(0,B.jsx)(L,{}),(0,B.jsx)(Ct,{isActive:j}),(0,B.jsx)(st,{hasHistory:N}),(0,B.jsx)(g.UnsavedChangesWarning,{}),(0,B.jsx)(g.AutosaveMonitor,{}),(0,B.jsx)(g.LocalAutosaveMonitor,{}),(0,B.jsx)(et,{}),(0,B.jsx)(g.EditorKeyboardShortcutsRegister,{}),(0,B.jsx)(Ot,{}),(0,B.jsx)(tt,{}),(0,B.jsx)(y.PluginArea,{onError:function(e){a((0,_.sprintf)((0,_.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,B.jsx)(St,{}),$,(0,B.jsx)(g.EditorSnackbars,{})]})]})})},{PluginPostExcerpt:Nt}=R(g.privateApis),Vt=(0,v.getPath)(window.location.href)?.includes("site-editor.php"),zt=e=>{c()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function Gt(e){return Vt?null:(zt("PluginBlockSettingsMenuItem"),(0,B.jsx)(g.PluginBlockSettingsMenuItem,{...e}))}function Ut(e){return Vt?null:(zt("PluginDocumentSettingPanel"),(0,B.jsx)(g.PluginDocumentSettingPanel,{...e}))}function Ht(e){return Vt?null:(zt("PluginMoreMenuItem"),(0,B.jsx)(g.PluginMoreMenuItem,{...e}))}function qt(e){return Vt?null:(zt("PluginPrePublishPanel"),(0,B.jsx)(g.PluginPrePublishPanel,{...e}))}function Wt(e){return Vt?null:(zt("PluginPostPublishPanel"),(0,B.jsx)(g.PluginPostPublishPanel,{...e}))}function Qt(e){return Vt?null:(zt("PluginPostStatusInfo"),(0,B.jsx)(g.PluginPostStatusInfo,{...e}))}function $t(e){return Vt?null:(zt("PluginSidebar"),(0,B.jsx)(g.PluginSidebar,{...e}))}function Xt(e){return Vt?null:(zt("PluginSidebarMoreMenuItem"),(0,B.jsx)(g.PluginSidebarMoreMenuItem,{...e}))}function Zt(){return Vt?null:(c()("wp.editPost.__experimentalPluginPostExcerpt",{since:"6.6",hint:"Core and custom panels can be access programmatically using their panel name.",link:"https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically"}),Nt)}const{BackButton:Yt,registerCoreBlockBindingsSources:Kt,bootstrapBlockBindingsSourcesFromServer:Jt}=R(g.privateApis);function eo(e,t,o,s,i){const a=window.matchMedia("(min-width: 782px)").matches,c=document.getElementById(e),m=(0,l.createRoot)(c);(0,d.dispatch)(p.store).setDefaults("core/edit-post",{fullscreenMode:!0,themeStyles:!0,welcomeGuide:!0,welcomeGuideTemplate:!0}),(0,d.dispatch)(p.store).setDefaults("core",{allowRightClickOverrides:!0,editorMode:"visual",fixedToolbar:!1,hiddenBlockTypes:[],inactivePanels:[],openPanels:["post-status"],showBlockBreadcrumbs:!0,showIconLabels:!1,showListViewByDefault:!1,enableChoosePatternModal:!0,isPublishSidebarEnabled:!0}),window.__experimentalMediaProcessing&&(0,d.dispatch)(p.store).setDefaults("core/media",{requireApproval:!0,optimizeOnUpload:!0}),(0,d.dispatch)(r.store).reapplyBlockTypeFilters(),a&&(0,d.select)(p.store).get("core","showListViewByDefault")&&!(0,d.select)(p.store).get("core","distractionFree")&&(0,d.dispatch)(g.store).setIsListViewOpened(!0),(0,n.registerCoreBlocks)(),Jt(s?.blockBindingsSources),Kt(),(0,u.registerLegacyWidgetBlock)({inserter:!1}),(0,u.registerWidgetGroupBlock)({inserter:!1});"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),m.render((0,B.jsx)(l.StrictMode,{children:(0,B.jsx)(Lt,{settings:s,postId:o,postType:t,initialEdits:i})})),m}function to(){c()("wp.editPost.reinitializeEditor",{since:"6.2",version:"6.3"})}(window.wp=window.wp||{}).editPost=t})();