/*! This file is auto-generated */ (()=>{var e={4306:function(e,t){var s,o,n; /*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */o=[e,t],s=function(e,t){"use strict";var s,o,n="function"==typeof Map?new Map:(s=[],o=[],{has:function(e){return s.indexOf(e)>-1},get:function(e){return o[s.indexOf(e)]},set:function(e,t){-1===s.indexOf(e)&&(s.push(e),o.push(t))},delete:function(e){var t=s.indexOf(e);t>-1&&(s.splice(t,1),o.splice(t,1))}}),i=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){i=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!n.has(e)){var t=null,s=null,o=null,r=function(){e.clientWidth!==s&&p()},a=function(t){window.removeEventListener("resize",r,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(s){e.style[s]=t[s]})),n.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",r,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",n.set(e,{destroy:a,update:p}),l()}function l(){var s=window.getComputedStyle(e,null);"vertical"===s.resize?e.style.resize="none":"both"===s.resize&&(e.style.resize="horizontal"),t="content-box"===s.boxSizing?-(parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)):parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var s=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=s,e.style.overflowY=t}function d(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function u(){if(0!==e.scrollHeight){var o=d(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",s=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),n&&(document.documentElement.scrollTop=n)}}function p(){u();var t=Math.round(parseFloat(e.style.height)),s=window.getComputedStyle(e,null),n="content-box"===s.boxSizing?Math.round(parseFloat(s.height)):e.offsetHeight;if(n{e.exports=function(e,t,s){return((s=window.getComputedStyle)?s(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((s=e,Array.isArray(s)?[]:{}),e,t):e;var s}function n(e,t,s){return e.concat(t).map((function(e){return o(e,s)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function a(e,t,s){var n={};return s.isMergeableObject(e)&&i(e).forEach((function(t){n[t]=o(e[t],s)})),i(t).forEach((function(i){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(r(e,i)&&s.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return l;var s=t.customMerge(e);return"function"==typeof s?s:l}(i,s)(e[i],t[i],s):n[i]=o(t[i],s))})),n}function l(e,s,i){(i=i||{}).arrayMerge=i.arrayMerge||n,i.isMergeableObject=i.isMergeableObject||t,i.cloneUnlessOtherwiseSpecified=o;var r=Array.isArray(s);return r===Array.isArray(e)?r?i.arrayMerge(e,s,i):a(e,s,i):o(s,i)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,s){return l(e,s,t)}),{})};var c=l;e.exports=c},5215:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var o,n,i;if(Array.isArray(t)){if((o=t.length)!=s.length)return!1;for(n=o;0!=n--;)if(!e(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((o=(i=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(s,i[n]))return!1;for(n=o;0!=n--;){var r=i[n];if(!e(t[r],s[r]))return!1}return!0}return t!=t&&s!=s}},461:(e,t,s)=>{var o=s(6109);e.exports=function(e){var t=o(e,"line-height"),s=parseFloat(t,10);if(t===s+""){var n=e.style.lineHeight;e.style.lineHeight=t+"em",t=o(e,"line-height"),s=parseFloat(t,10),n?e.style.lineHeight=n:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(s*=4,s/=3):-1!==t.indexOf("mm")?(s*=96,s/=25.4):-1!==t.indexOf("cm")?(s*=96,s/=2.54):-1!==t.indexOf("in")?s*=96:-1!==t.indexOf("pc")&&(s*=16),s=Math.round(s),"normal"===t){var i=e.nodeName,r=document.createElement(i);r.innerHTML=" ","TEXTAREA"===i.toUpperCase()&&r.setAttribute("rows","1");var a=o(e,"font-size");r.style.fontSize=a,r.style.padding="0px",r.style.border="0px";var l=document.body;l.appendChild(r),s=r.offsetHeight,l.removeChild(r)}return s}},628:(e,t,s)=>{"use strict";var o=s(4067);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,s,n,i,r){if(r!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return s.PropTypes=s,s}},5826:(e,t,s)=>{e.exports=s(628)()},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4462:function(e,t,s){"use strict";var o,n=this&&this.__extends||(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])},function(e,t){function s(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}),i=this&&this.__assign||Object.assign||function(e){for(var t,s=1,o=arguments.length;s{"use strict";var o=s(4462);t.A=o.TextareaAutosize},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},s=Object.keys(t).join("|"),o=new RegExp(s,"g"),n=new RegExp(s,"");function i(e){return t[e]}var r=function(e){return e.replace(o,i)};e.exports=r,e.exports.has=function(e){return!!e.match(n)},e.exports.remove=r},1609:e=>{"use strict";e.exports=window.React}},t={};function s(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,s),i.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";s.r(o),s.d(o,{AlignmentToolbar:()=>Kh,Autocomplete:()=>Yh,AutosaveMonitor:()=>Xr,BlockAlignmentToolbar:()=>qh,BlockControls:()=>Qh,BlockEdit:()=>Xh,BlockEditorKeyboardShortcuts:()=>Jh,BlockFormatControls:()=>em,BlockIcon:()=>tm,BlockInspector:()=>sm,BlockList:()=>om,BlockMover:()=>nm,BlockNavigationDropdown:()=>im,BlockSelectionClearer:()=>rm,BlockSettingsMenu:()=>am,BlockTitle:()=>lm,BlockToolbar:()=>cm,CharacterCount:()=>mp,ColorPalette:()=>dm,ContrastChecker:()=>um,CopyHandler:()=>pm,DefaultBlockAppender:()=>hm,DocumentBar:()=>na,DocumentOutline:()=>ma,DocumentOutlineCheck:()=>ga,EditorHistoryRedo:()=>ya,EditorHistoryUndo:()=>xa,EditorKeyboardShortcuts:()=>qr,EditorKeyboardShortcutsRegister:()=>_a,EditorNotices:()=>wa,EditorProvider:()=>Uh,EditorSnackbars:()=>ka,EntitiesSavedStates:()=>Aa,ErrorBoundary:()=>La,FontSizePicker:()=>mm,InnerBlocks:()=>_m,Inserter:()=>gm,InspectorAdvancedControls:()=>fm,InspectorControls:()=>bm,LocalAutosaveMonitor:()=>Ua,MediaPlaceholder:()=>km,MediaUpload:()=>Pm,MediaUploadCheck:()=>Cm,MultiSelectScrollIntoView:()=>jm,NavigableToolbar:()=>Em,ObserveTyping:()=>Tm,PageAttributesCheck:()=>Ha,PageAttributesOrder:()=>Wa,PageAttributesPanel:()=>ll,PageAttributesParent:()=>il,PageTemplate:()=>xl,PanelColorSettings:()=>ym,PlainText:()=>xm,PluginBlockSettingsMenuItem:()=>Il,PluginDocumentSettingPanel:()=>Bl,PluginMoreMenuItem:()=>Nl,PluginPostPublishPanel:()=>Ml,PluginPostStatusInfo:()=>Vl,PluginPrePublishPanel:()=>Gl,PluginPreviewMenuItem:()=>$l,PluginSidebar:()=>Wl,PluginSidebarMoreMenuItem:()=>Zl,PostAuthor:()=>rc,PostAuthorCheck:()=>ac,PostAuthorPanel:()=>cc,PostComments:()=>uc,PostDiscussionPanel:()=>_c,PostExcerpt:()=>fc,PostExcerptCheck:()=>bc,PostExcerptPanel:()=>Pc,PostFeaturedImage:()=>Mc,PostFeaturedImageCheck:()=>Tc,PostFeaturedImagePanel:()=>Lc,PostFormat:()=>zc,PostFormatCheck:()=>Fc,PostLastRevision:()=>$c,PostLastRevisionCheck:()=>Uc,PostLastRevisionPanel:()=>Wc,PostLockedModal:()=>Zc,PostPendingStatus:()=>Kc,PostPendingStatusCheck:()=>Yc,PostPingbacks:()=>pc,PostPreviewButton:()=>qc,PostPublishButton:()=>ed,PostPublishButtonLabel:()=>Qc,PostPublishPanel:()=>gu,PostSavedState:()=>Bu,PostSchedule:()=>wd,PostScheduleCheck:()=>Iu,PostScheduleLabel:()=>kd,PostSchedulePanel:()=>Au,PostSlug:()=>Mu,PostSlugCheck:()=>Du,PostSticky:()=>Pu,PostStickyCheck:()=>ku,PostSwitchToDraftButton:()=>Ou,PostSyncStatus:()=>Lu,PostTaxonomies:()=>Vu,PostTaxonomiesCheck:()=>zu,PostTaxonomiesFlatTermSelector:()=>Od,PostTaxonomiesHierarchicalTermSelector:()=>Zd,PostTaxonomiesPanel:()=>Hu,PostTemplatePanel:()=>ec,PostTextEditor:()=>$u,PostTitle:()=>Qu,PostTitleRaw:()=>Xu,PostTrash:()=>ep,PostTrashCheck:()=>Ju,PostTypeSupportCheck:()=>Ga,PostURL:()=>sp,PostURLCheck:()=>op,PostURLLabel:()=>np,PostURLPanel:()=>rp,PostVisibility:()=>od,PostVisibilityCheck:()=>lp,PostVisibilityLabel:()=>id,RichText:()=>Zh,RichTextShortcut:()=>vm,RichTextToolbarButton:()=>wm,ServerSideRender:()=>Gh(),SkipToSelectedBlock:()=>Bm,TableOfContents:()=>_p,TextEditorGlobalKeyboardShortcuts:()=>Wm,ThemeSupportCheck:()=>Ec,TimeToRead:()=>hp,URLInput:()=>Im,URLInputButton:()=>Nm,URLPopover:()=>Am,UnsavedChangesWarning:()=>fp,VisualEditorGlobalKeyboardShortcuts:()=>$m,Warning:()=>Dm,WordCount:()=>up,WritingFlow:()=>Rm,__unstableRichTextInputEvent:()=>Sm,cleanForSlug:()=>Zm,createCustomColorsHOC:()=>Mm,getColorClassName:()=>Om,getColorObjectByAttributeValues:()=>Lm,getColorObjectByColorValue:()=>Fm,getFontSize:()=>Vm,getFontSizeClass:()=>zm,getTemplatePartIcon:()=>$,mediaUpload:()=>Pp,privateApis:()=>cf,registerEntityAction:()=>df,store:()=>Wi,storeConfig:()=>$i,transformStyles:()=>m.transformStyles,unregisterEntityAction:()=>uf,useEntitiesSavedStatesIsDirty:()=>Ia,usePostScheduleLabel:()=>Pd,usePostURLLabel:()=>ip,usePostVisibilityLabel:()=>rd,userAutocompleter:()=>Yi,withColorContext:()=>Um,withColors:()=>Hm,withFontSizes:()=>Gm});var e={};s.r(e),s.d(e,{__experimentalGetDefaultTemplatePartAreas:()=>is,__experimentalGetDefaultTemplateType:()=>rs,__experimentalGetDefaultTemplateTypes:()=>ns,__experimentalGetTemplateInfo:()=>as,__unstableIsEditorReady:()=>Qe,canInsertBlockType:()=>es,canUserUseUnfilteredHTML:()=>Ue,didPostSaveRequestFail:()=>Pe,didPostSaveRequestSucceed:()=>ke,getActivePostLock:()=>ze,getAdjacentBlockClientId:()=>Pt,getAutosaveAttribute:()=>de,getBlock:()=>dt,getBlockAttributes:()=>ct,getBlockCount:()=>_t,getBlockHierarchyRootClientId:()=>kt,getBlockIndex:()=>Ft,getBlockInsertionPoint:()=>Kt,getBlockListSettings:()=>os,getBlockMode:()=>Wt,getBlockName:()=>at,getBlockOrder:()=>Lt,getBlockRootClientId:()=>St,getBlockSelectionEnd:()=>bt,getBlockSelectionStart:()=>ft,getBlocks:()=>ut,getBlocksByClientId:()=>gt,getClientIdsOfDescendants:()=>pt,getClientIdsWithDescendants:()=>ht,getCurrentPost:()=>ee,getCurrentPostAttribute:()=>ae,getCurrentPostId:()=>se,getCurrentPostLastRevisionId:()=>ie,getCurrentPostRevisionsCount:()=>ne,getCurrentPostType:()=>te,getCurrentTemplateId:()=>oe,getDeviceType:()=>et,getEditedPostAttribute:()=>ce,getEditedPostContent:()=>Be,getEditedPostPreviewLink:()=>Ee,getEditedPostSlug:()=>De,getEditedPostVisibility:()=>ue,getEditorBlocks:()=>Ge,getEditorMode:()=>ot,getEditorSelection:()=>qe,getEditorSelectionEnd:()=>Ke,getEditorSelectionStart:()=>Ye,getEditorSettings:()=>Xe,getFirstMultiSelectedBlockClientId:()=>It,getGlobalBlockCount:()=>mt,getInserterItems:()=>ts,getLastMultiSelectedBlockClientId:()=>Nt,getMultiSelectedBlockClientIds:()=>Tt,getMultiSelectedBlocks:()=>Bt,getMultiSelectedBlocksEndClientId:()=>Ot,getMultiSelectedBlocksStartClientId:()=>Mt,getNextBlockClientId:()=>jt,getPermalink:()=>Ae,getPermalinkParts:()=>Re,getPostEdits:()=>re,getPostLockUser:()=>Ve,getPostTypeLabel:()=>ls,getPreviousBlockClientId:()=>Ct,getRenderingMode:()=>Je,getSelectedBlock:()=>wt,getSelectedBlockClientId:()=>vt,getSelectedBlockCount:()=>yt,getSelectedBlocksInitialCaretPosition:()=>Et,getStateBeforeOptimisticTransaction:()=>nt,getSuggestedPostFormat:()=>Te,getTemplate:()=>Xt,getTemplateLock:()=>Jt,hasChangedContent:()=>q,hasEditorRedo:()=>Y,hasEditorUndo:()=>Z,hasInserterItems:()=>ss,hasMultiSelection:()=>Ht,hasNonPostEntityChanges:()=>X,hasSelectedBlock:()=>xt,hasSelectedInnerBlock:()=>zt,inSomeHistory:()=>it,isAncestorMultiSelected:()=>Rt,isAutosavingPost:()=>Ce,isBlockInsertionPointVisible:()=>qt,isBlockMultiSelected:()=>Dt,isBlockSelected:()=>Vt,isBlockValid:()=>lt,isBlockWithinSelection:()=>Ut,isCaretWithinFormattedText:()=>Yt,isCleanNewPost:()=>J,isCurrentPostPending:()=>pe,isCurrentPostPublished:()=>he,isCurrentPostScheduled:()=>me,isDeletingPost:()=>ve,isEditedPostAutosaveable:()=>be,isEditedPostBeingScheduled:()=>ye,isEditedPostDateFloating:()=>xe,isEditedPostDirty:()=>Q,isEditedPostEmpty:()=>fe,isEditedPostNew:()=>K,isEditedPostPublishable:()=>ge,isEditedPostSaveable:()=>_e,isEditorPanelEnabled:()=>We,isEditorPanelOpened:()=>Ze,isEditorPanelRemoved:()=>$e,isFirstMultiSelectedBlock:()=>At,isInserterOpened:()=>st,isListViewOpened:()=>tt,isMultiSelecting:()=>Gt,isPermalinkEditable:()=>Ne,isPostAutosavingLocked:()=>Le,isPostLockTakeover:()=>Fe,isPostLocked:()=>Me,isPostSavingLocked:()=>Oe,isPreviewingPost:()=>je,isPublishSidebarEnabled:()=>He,isPublishSidebarOpened:()=>cs,isPublishingPost:()=>Ie,isSavingNonPostEntityChanges:()=>Se,isSavingPost:()=>we,isSelectionEnabled:()=>$t,isTyping:()=>Zt,isValidTemplate:()=>Qt});var t={};s.r(t),s.d(t,{__experimentalTearDownEditor:()=>bs,__unstableSaveForPreview:()=>Es,autosave:()=>js,clearSelectedBlock:()=>lo,closePublishSidebar:()=>Qs,createUndoLevel:()=>Is,disablePublishSidebar:()=>Ds,editPost:()=>Ss,enablePublishSidebar:()=>As,enterFormattedText:()=>Eo,exitFormattedText:()=>To,hideInsertionPoint:()=>yo,insertBlock:()=>_o,insertBlocks:()=>fo,insertDefaultBlock:()=>Bo,lockPostAutosaving:()=>Os,lockPostSaving:()=>Rs,mergeBlocks:()=>wo,moveBlockToPosition:()=>go,moveBlocksDown:()=>ho,moveBlocksUp:()=>mo,multiSelect:()=>ao,openPublishSidebar:()=>qs,receiveBlocks:()=>to,redo:()=>Ts,refreshPost:()=>Ps,removeBlock:()=>ko,removeBlocks:()=>So,removeEditorPanel:()=>$s,replaceBlock:()=>po,replaceBlocks:()=>uo,resetBlocks:()=>eo,resetEditorBlocks:()=>Fs,resetPost:()=>ys,savePost:()=>ks,selectBlock:()=>no,setDeviceType:()=>Us,setEditedPost:()=>ws,setIsInserterOpened:()=>Ws,setIsListViewOpened:()=>Zs,setRenderingMode:()=>zs,setTemplateValidity:()=>xo,setupEditor:()=>fs,setupEditorState:()=>vs,showInsertionPoint:()=>bo,startMultiSelect:()=>io,startTyping:()=>Co,stopMultiSelect:()=>ro,stopTyping:()=>jo,switchEditorMode:()=>Ks,synchronizeTemplate:()=>vo,toggleBlockMode:()=>Po,toggleDistractionFree:()=>Ys,toggleEditorPanelEnabled:()=>Hs,toggleEditorPanelOpened:()=>Gs,togglePublishSidebar:()=>Xs,toggleSelection:()=>co,trashPost:()=>Cs,undo:()=>Bs,unlockPostAutosaving:()=>Ls,unlockPostSaving:()=>Ms,updateBlock:()=>so,updateBlockAttributes:()=>oo,updateBlockListSettings:()=>Io,updateEditorSettings:()=>Vs,updatePost:()=>xs,updatePostLock:()=>Ns});var n={};s.r(n),s.d(n,{createTemplate:()=>wi,hideBlockTypes:()=>ki,registerEntityAction:()=>fi,registerPostTypeActions:()=>xi,removeTemplates:()=>ji,revertTemplate:()=>Ci,saveDirtyEntities:()=>Pi,setCurrentTemplateId:()=>vi,setIsReady:()=>yi,showBlockTypes:()=>Si,unregisterEntityAction:()=>bi});var i={};s.r(i),s.d(i,{getEntityActions:()=>Ui,getInserterSidebarToggleRef:()=>Li,getInsertionPoint:()=>Mi,getListViewToggleRef:()=>Oi,getPostBlocksByName:()=>Gi,getPostIcon:()=>Vi,hasPostMetaChanges:()=>zi,isEntityReady:()=>Hi});var r={};s.r(r),s.d(r,{closeModal:()=>vr,disableComplementaryArea:()=>mr,enableComplementaryArea:()=>hr,openModal:()=>xr,pinItem:()=>gr,setDefaultComplementaryArea:()=>pr,setFeatureDefaults:()=>yr,setFeatureValue:()=>br,toggleFeature:()=>fr,unpinItem:()=>_r});var a={};s.r(a),s.d(a,{getActiveComplementaryArea:()=>wr,isComplementaryAreaLoading:()=>Sr,isFeatureActive:()=>Pr,isItemPinned:()=>kr,isModalActive:()=>Cr});var l={};s.r(l),s.d(l,{ActionItem:()=>Rr,ComplementaryArea:()=>Hr,ComplementaryAreaMoreMenuItem:()=>Or,FullscreenMode:()=>Gr,InterfaceSkeleton:()=>Kr,NavigableRegion:()=>Wr,PinnedItems:()=>Fr,store:()=>Er});const c=window.wp.data,d=window.wp.coreData,u=window.wp.element,p=window.wp.compose,h=window.wp.hooks,m=window.wp.blockEditor,g={...m.SETTINGS_DEFAULTS,richEditingEnabled:!0,codeEditingEnabled:!0,fontLibraryEnabled:!0,enableCustomFields:void 0,defaultRenderingMode:"post-only"};const _=(0,c.combineReducers)({actions:function(e={},t){var s;switch(t.type){case"REGISTER_ENTITY_ACTION":return{...e,[t.kind]:{...e[t.kind],[t.name]:[...(null!==(s=e[t.kind]?.[t.name])&&void 0!==s?s:[]).filter((e=>e.id!==t.config.id)),t.config]}};case"UNREGISTER_ENTITY_ACTION":var o;return{...e,[t.kind]:{...e[t.kind],[t.name]:(null!==(o=e[t.kind]?.[t.name])&&void 0!==o?o:[]).filter((e=>e.id!==t.actionId))}}}return e},isReady:function(e={},t){return"SET_IS_READY"===t.type?{...e,[t.kind]:{...e[t.kind],[t.name]:!0}}:e}});function f(e){return e&&"object"==typeof e&&"raw"in e?e.raw:e}const b=(0,c.combineReducers)({postId:function(e=null,t){return"SET_EDITED_POST"===t.type?t.postId:e},postType:function(e=null,t){return"SET_EDITED_POST"===t.type?t.postType:e},templateId:function(e=null,t){return"SET_CURRENT_TEMPLATE_ID"===t.type?t.id:e},saving:function(e={},t){switch(t.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===t.type,options:t.options||{}}}return e},deleting:function(e={},t){switch(t.type){case"REQUEST_POST_DELETE_START":case"REQUEST_POST_DELETE_FINISH":return{pending:"REQUEST_POST_DELETE_START"===t.type}}return e},postLock:function(e={isLocked:!1},t){return"UPDATE_POST_LOCK"===t.type?t.lock:e},template:function(e={isValid:!0},t){return"SET_TEMPLATE_VALIDITY"===t.type?{...e,isValid:t.isValid}:e},postSavingLock:function(e={},t){switch(t.type){case"LOCK_POST_SAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_SAVING":{const{[t.lockName]:s,...o}=e;return o}}return e},editorSettings:function(e=g,t){return"UPDATE_EDITOR_SETTINGS"===t.type?{...e,...t.settings}:e},postAutosavingLock:function(e={},t){switch(t.type){case"LOCK_POST_AUTOSAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_AUTOSAVING":{const{[t.lockName]:s,...o}=e;return o}}return e},renderingMode:function(e="post-only",t){return"SET_RENDERING_MODE"===t.type?t.mode:e},deviceType:function(e="Desktop",t){return"SET_DEVICE_TYPE"===t.type?t.deviceType:e},removedPanels:function(e=[],t){if("REMOVE_PANEL"===t.type)if(!e.includes(t.panelName))return[...e,t.panelName];return e},blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},inserterSidebarToggleRef:function(e={current:null}){return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e},listViewToggleRef:function(e={current:null}){return e},publishSidebarActive:function(e=!1,t){switch(t.type){case"OPEN_PUBLISH_SIDEBAR":return!0;case"CLOSE_PUBLISH_SIDEBAR":return!1;case"TOGGLE_PUBLISH_SIDEBAR":return!e}return e},dataviews:_}),y=window.wp.blocks,x=window.wp.date,v=window.wp.url,w=window.wp.deprecated;var S=s.n(w);const k=window.wp.primitives,P=window.ReactJSXRuntime,C=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.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"})}),j=window.wp.preferences,E=new Set(["meta"]),T="SAVE_POST_NOTICE_ID",B="TRASH_POST_NOTICE_ID",I=/%(?:postname|pagename)%/,N=6e4,A=["title","excerpt","content"],D="wp_template",R="wp_template_part",M="wp_block",O="wp_navigation",L="custom",F=["wp_template","wp_template_part"],V=[...F,"wp_block","wp_navigation"],z=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M18.5 10.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"})}),U=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),H=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),G=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})});function $(e){return"header"===e?z:"footer"===e?U:"sidebar"===e?H:G}const W={},Z=(0,c.createRegistrySelector)((e=>()=>e(d.store).hasUndo())),Y=(0,c.createRegistrySelector)((e=>()=>e(d.store).hasRedo()));function K(e){return"auto-draft"===ee(e).status}function q(e){return"content"in re(e)}const Q=(0,c.createRegistrySelector)((e=>t=>{const s=te(t),o=se(t);return e(d.store).hasEditsForEntityRecord("postType",s,o)})),X=(0,c.createRegistrySelector)((e=>t=>{const s=e(d.store).__experimentalGetDirtyEntityRecords(),{type:o,id:n}=ee(t);return s.some((e=>"postType"!==e.kind||e.name!==o||e.key!==n))}));function J(e){return!Q(e)&&K(e)}const ee=(0,c.createRegistrySelector)((e=>t=>{const s=se(t),o=te(t),n=e(d.store).getRawEntityRecord("postType",o,s);return n||W}));function te(e){return e.postType}function se(e){return e.postId}function oe(e){return e.templateId}function ne(e){var t;return null!==(t=ee(e)._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}function ie(e){var t;return null!==(t=ee(e)._links?.["predecessor-version"]?.[0]?.id)&&void 0!==t?t:null}const re=(0,c.createRegistrySelector)((e=>t=>{const s=te(t),o=se(t);return e(d.store).getEntityRecordEdits("postType",s,o)||W}));function ae(e,t){switch(t){case"type":return te(e);case"id":return se(e);default:const s=ee(e);if(!s.hasOwnProperty(t))break;return f(s[t])}}const le=(0,c.createSelector)(((e,t)=>{const s=re(e);return s.hasOwnProperty(t)?{...ae(e,t),...s[t]}:ae(e,t)}),((e,t)=>[ae(e,t),re(e)[t]]));function ce(e,t){if("content"===t)return Be(e);const s=re(e);return s.hasOwnProperty(t)?E.has(t)?le(e,t):s[t]:ae(e,t)}const de=(0,c.createRegistrySelector)((e=>(t,s)=>{if(!A.includes(s)&&"preview_link"!==s)return;const o=te(t);if("wp_template"===o)return!1;const n=se(t),i=e(d.store).getCurrentUser()?.id,r=e(d.store).getAutosave(o,n,i);return r?f(r[s]):void 0}));function ue(e){if("private"===ce(e,"status"))return"private";return ce(e,"password")?"password":"public"}function pe(e){return"pending"===ee(e).status}function he(e,t){const s=t||ee(e);return-1!==["publish","private"].indexOf(s.status)||"future"===s.status&&!(0,x.isInTheFuture)(new Date(Number((0,x.getDate)(s.date))-N))}function me(e){return"future"===ee(e).status&&!he(e)}function ge(e){const t=ee(e);return Q(e)||-1===["publish","private","future"].indexOf(t.status)}function _e(e){return!we(e)&&(!!ce(e,"title")||!!ce(e,"excerpt")||!fe(e)||"native"===u.Platform.OS)}const fe=(0,c.createRegistrySelector)((e=>t=>{const s=se(t),o=te(t),n=e(d.store).getEditedEntityRecord("postType",o,s);if("function"!=typeof n.content)return!n.content;const i=ce(t,"blocks");if(0===i.length)return!0;if(i.length>1)return!1;const r=i[0].name;return(r===(0,y.getDefaultBlockName)()||r===(0,y.getFreeformContentHandlerName)())&&!Be(t)})),be=(0,c.createRegistrySelector)((e=>t=>{if(!_e(t))return!1;if(Le(t))return!1;const s=te(t);if("wp_template"===s)return!1;const o=se(t),n=e(d.store).hasFetchedAutosaves(s,o),i=e(d.store).getCurrentUser()?.id,r=e(d.store).getAutosave(s,o,i);return!!n&&(!r||(!!q(t)||["title","excerpt","meta"].some((e=>f(r[e])!==ce(t,e)))))}));function ye(e){const t=ce(e,"date"),s=new Date(Number((0,x.getDate)(t))-N);return(0,x.isInTheFuture)(s)}function xe(e){const t=ce(e,"date"),s=ce(e,"modified"),o=ee(e).status;return("draft"===o||"auto-draft"===o||"pending"===o)&&(t===s||null===t)}function ve(e){return!!e.deleting.pending}function we(e){return!!e.saving.pending}const Se=(0,c.createRegistrySelector)((e=>t=>{const s=e(d.store).__experimentalGetEntitiesBeingSaved(),{type:o,id:n}=ee(t);return s.some((e=>"postType"!==e.kind||e.name!==o||e.key!==n))})),ke=(0,c.createRegistrySelector)((e=>t=>{const s=te(t),o=se(t);return!e(d.store).getLastEntitySaveError("postType",s,o)})),Pe=(0,c.createRegistrySelector)((e=>t=>{const s=te(t),o=se(t);return!!e(d.store).getLastEntitySaveError("postType",s,o)}));function Ce(e){return we(e)&&Boolean(e.saving.options?.isAutosave)}function je(e){return we(e)&&Boolean(e.saving.options?.isPreview)}function Ee(e){if(e.saving.pending||we(e))return;let t=de(e,"preview_link");t&&"draft"!==ee(e).status||(t=ce(e,"link"),t&&(t=(0,v.addQueryArgs)(t,{preview:!0})));const s=ce(e,"featured_media");return t&&s?(0,v.addQueryArgs)(t,{_thumbnail_id:s}):t}const Te=(0,c.createRegistrySelector)((e=>()=>{const t=e(m.store).getBlocks();if(t.length>2)return null;let s;if(1===t.length&&(s=t[0].name,"core/embed"===s)){const e=t[0].attributes?.providerNameSlug;["youtube","vimeo"].includes(e)?s="core/video":["spotify","soundcloud"].includes(e)&&(s="core/audio")}switch(2===t.length&&"core/paragraph"===t[1].name&&(s=t[0].name),s){case"core/image":return"image";case"core/quote":case"core/pullquote":return"quote";case"core/gallery":return"gallery";case"core/video":return"video";case"core/audio":return"audio";default:return null}})),Be=(0,c.createRegistrySelector)((e=>t=>{const s=se(t),o=te(t),n=e(d.store).getEditedEntityRecord("postType",o,s);if(n){if("function"==typeof n.content)return n.content(n);if(n.blocks)return(0,y.__unstableSerializeAndClean)(n.blocks);if(n.content)return n.content}return""}));function Ie(e){return we(e)&&!he(e)&&"publish"===ce(e,"status")}function Ne(e){const t=ce(e,"permalink_template");return I.test(t)}function Ae(e){const t=Re(e);if(!t)return null;const{prefix:s,postName:o,suffix:n}=t;return Ne(e)?s+o+n:s}function De(e){return ce(e,"slug")||(0,v.cleanForSlug)(ce(e,"title"))||se(e)}function Re(e){const t=ce(e,"permalink_template");if(!t)return null;const s=ce(e,"slug")||ce(e,"generated_slug"),[o,n]=t.split(I);return{prefix:o,postName:s,suffix:n}}function Me(e){return e.postLock.isLocked}function Oe(e){return Object.keys(e.postSavingLock).length>0}function Le(e){return Object.keys(e.postAutosavingLock).length>0}function Fe(e){return e.postLock.isTakeover}function Ve(e){return e.postLock.user}function ze(e){return e.postLock.activePostLock}function Ue(e){return Boolean(ee(e)._links?.hasOwnProperty("wp:action-unfiltered-html"))}const He=(0,c.createRegistrySelector)((e=>()=>!!e(j.store).get("core","isPublishSidebarEnabled"))),Ge=(0,c.createSelector)((e=>ce(e,"blocks")||(0,y.parse)(Be(e))),(e=>[ce(e,"blocks"),Be(e)]));function $e(e,t){return e.removedPanels.includes(t)}const We=(0,c.createRegistrySelector)((e=>(t,s)=>{const o=e(j.store).get("core","inactivePanels");return!$e(t,s)&&!o?.includes(s)})),Ze=(0,c.createRegistrySelector)((e=>(t,s)=>{const o=e(j.store).get("core","openPanels");return!!o?.includes(s)}));function Ye(e){return S()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),ce(e,"selection")?.selectionStart}function Ke(e){return S()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),ce(e,"selection")?.selectionEnd}function qe(e){return ce(e,"selection")}function Qe(e){return!!e.postId}function Xe(e){return e.editorSettings}function Je(e){return e.renderingMode}const et=(0,c.createRegistrySelector)((e=>t=>"zoom-out"===e(m.store).__unstableGetEditorMode()?"Desktop":t.deviceType));function tt(e){return e.listViewPanel}function st(e){return!!e.blockInserterPanel}const ot=(0,c.createRegistrySelector)((e=>()=>{var t;return null!==(t=e(j.store).get("core","editorMode"))&&void 0!==t?t:"visual"}));function nt(){return S()("select('core/editor').getStateBeforeOptimisticTransaction",{since:"5.7",hint:"No state history is kept on this store anymore"}),null}function it(){return S()("select('core/editor').inSomeHistory",{since:"5.7",hint:"No state history is kept on this store anymore"}),!1}function rt(e){return(0,c.createRegistrySelector)((t=>(s,...o)=>(S()("`wp.data.select( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.select( 'core/block-editor' )."+e+"`",version:"6.2"}),t(m.store)[e](...o))))}const at=rt("getBlockName"),lt=rt("isBlockValid"),ct=rt("getBlockAttributes"),dt=rt("getBlock"),ut=rt("getBlocks"),pt=rt("getClientIdsOfDescendants"),ht=rt("getClientIdsWithDescendants"),mt=rt("getGlobalBlockCount"),gt=rt("getBlocksByClientId"),_t=rt("getBlockCount"),ft=rt("getBlockSelectionStart"),bt=rt("getBlockSelectionEnd"),yt=rt("getSelectedBlockCount"),xt=rt("hasSelectedBlock"),vt=rt("getSelectedBlockClientId"),wt=rt("getSelectedBlock"),St=rt("getBlockRootClientId"),kt=rt("getBlockHierarchyRootClientId"),Pt=rt("getAdjacentBlockClientId"),Ct=rt("getPreviousBlockClientId"),jt=rt("getNextBlockClientId"),Et=rt("getSelectedBlocksInitialCaretPosition"),Tt=rt("getMultiSelectedBlockClientIds"),Bt=rt("getMultiSelectedBlocks"),It=rt("getFirstMultiSelectedBlockClientId"),Nt=rt("getLastMultiSelectedBlockClientId"),At=rt("isFirstMultiSelectedBlock"),Dt=rt("isBlockMultiSelected"),Rt=rt("isAncestorMultiSelected"),Mt=rt("getMultiSelectedBlocksStartClientId"),Ot=rt("getMultiSelectedBlocksEndClientId"),Lt=rt("getBlockOrder"),Ft=rt("getBlockIndex"),Vt=rt("isBlockSelected"),zt=rt("hasSelectedInnerBlock"),Ut=rt("isBlockWithinSelection"),Ht=rt("hasMultiSelection"),Gt=rt("isMultiSelecting"),$t=rt("isSelectionEnabled"),Wt=rt("getBlockMode"),Zt=rt("isTyping"),Yt=rt("isCaretWithinFormattedText"),Kt=rt("getBlockInsertionPoint"),qt=rt("isBlockInsertionPointVisible"),Qt=rt("isValidTemplate"),Xt=rt("getTemplate"),Jt=rt("getTemplateLock"),es=rt("canInsertBlockType"),ts=rt("getInserterItems"),ss=rt("hasInserterItems"),os=rt("getBlockListSettings");function ns(e){return Xe(e)?.defaultTemplateTypes}const is=(0,c.createSelector)((e=>{var t;return(null!==(t=Xe(e)?.defaultTemplatePartAreas)&&void 0!==t?t:[]).map((e=>({...e,icon:$(e.icon)})))}),(e=>[Xe(e)?.defaultTemplatePartAreas])),rs=(0,c.createSelector)(((e,t)=>{var s;const o=ns(e);return o&&null!==(s=Object.values(o).find((e=>e.slug===t)))&&void 0!==s?s:W}),(e=>[ns(e)])),as=(0,c.createSelector)(((e,t)=>{if(!t)return W;const{description:s,slug:o,title:n,area:i}=t,{title:r,description:a}=rs(e,o),l="string"==typeof n?n:n?.rendered;return{title:l&&l!==o?l:r||o,description:("string"==typeof s?s:s?.raw)||a,icon:is(e).find((e=>i===e.area))?.icon||C}}),(e=>[ns(e),is(e)])),ls=(0,c.createRegistrySelector)((e=>t=>{const s=te(t),o=e(d.store).getPostType(s);return o?.labels?.singular_name}));function cs(e){return e.publishSidebarActive}const ds=window.wp.a11y,us=window.wp.apiFetch;var ps=s.n(us);const hs=window.wp.notices,ms=window.wp.i18n;function gs(e,t){return`wp-autosave-block-editor-post-${t?"auto-draft":e}`}function _s(e,t){window.sessionStorage.removeItem(gs(e,t))}const fs=(e,t,s)=>({dispatch:o})=>{o.setEditedPost(e.type,e.id);if("auto-draft"===e.status&&s){let n;n="content"in t?t.content:e.content.raw;let i=(0,y.parse)(n);i=(0,y.synchronizeBlocksWithTemplate)(i,s),o.resetEditorBlocks(i,{__unstableShouldCreateUndoLevel:!1})}t&&Object.values(t).some((([t,s])=>{var o;return s!==(null!==(o=e[t]?.raw)&&void 0!==o?o:e[t])}))&&o.editPost(t)};function bs(){return S()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor",{since:"6.5"}),{type:"DO_NOTHING"}}function ys(){return S()("wp.data.dispatch( 'core/editor' ).resetPost",{since:"6.0",version:"6.3",alternative:"Initialize the editor with the setupEditorState action"}),{type:"DO_NOTHING"}}function xs(){return S()("wp.data.dispatch( 'core/editor' ).updatePost",{since:"5.7",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function vs(e){return S()("wp.data.dispatch( 'core/editor' ).setupEditorState",{since:"6.5",alternative:"wp.data.dispatch( 'core/editor' ).setEditedPost"}),ws(e.type,e.id)}function ws(e,t){return{type:"SET_EDITED_POST",postType:e,postId:t}}const Ss=(e,t)=>({select:s,registry:o})=>{const{id:n,type:i}=s.getCurrentPost();o.dispatch(d.store).editEntityRecord("postType",i,n,e,t)},ks=(e={})=>async({select:t,dispatch:s,registry:o})=>{if(!t.isEditedPostSaveable())return;const n=t.getEditedPostContent();e.isAutosave||s.editPost({content:n},{undoIgnore:!0});const i=t.getCurrentPost();let r={id:i.id,...o.select(d.store).getEntityRecordNonTransientEdits("postType",i.type,i.id),content:n};s({type:"REQUEST_POST_UPDATE_START",options:e});let a=!1;try{r=await(0,h.applyFiltersAsync)("editor.preSavePost",r,e)}catch(e){a=e}if(!a)try{await o.dispatch(d.store).saveEntityRecord("postType",i.type,r,e)}catch(e){a=e.message&&"unknown_error"!==e.code?e.message:(0,ms.__)("An error occurred while updating.")}if(a||(a=o.select(d.store).getLastEntitySaveError("postType",i.type,i.id)),!a)try{await(0,h.applyFilters)("editor.__unstableSavePost",Promise.resolve(),e)}catch(e){a=e}if(!a)try{await(0,h.doActionAsync)("editor.savePost",{id:i.id},e)}catch(e){a=e}if(s({type:"REQUEST_POST_UPDATE_FINISH",options:e}),a){const e=function(e){const{post:t,edits:s,error:o}=e;if(o&&"rest_autosave_no_changes"===o.code)return[];const n=["publish","private","future"],i=-1!==n.indexOf(t.status),r={publish:(0,ms.__)("Publishing failed."),private:(0,ms.__)("Publishing failed."),future:(0,ms.__)("Scheduling failed.")};let a=i||-1===n.indexOf(s.status)?(0,ms.__)("Updating failed."):r[s.status];return o.message&&!/<\/?[^>]*>/.test(o.message)&&(a=[a,o.message].join(" ")),[a,{id:T}]}({post:i,edits:r,error:a});e.length&&o.dispatch(hs.store).createErrorNotice(...e)}else{const s=t.getCurrentPost(),n=function(e){var t;const{previousPost:s,post:o,postType:n}=e;if(e.options?.isAutosave)return[];const i=["publish","private","future"],r=i.includes(s.status),a=i.includes(o.status),l="trash"===o.status&&"trash"!==s.status;let c,d,u=null!==(t=n?.viewable)&&void 0!==t&&t;l?(c=n.labels.item_trashed,u=!1):r||a?r&&!a?(c=n.labels.item_reverted_to_draft,u=!1):c=!r&&a?{publish:n.labels.item_published,private:n.labels.item_published_privately,future:n.labels.item_scheduled}[o.status]:n.labels.item_updated:(c=(0,ms.__)("Draft saved."),d=!0);const p=[];return u&&p.push({label:d?(0,ms.__)("View Preview"):n.labels.view_item,url:o.link}),[c,{id:T,type:"snackbar",actions:p}]}({previousPost:i,post:s,postType:await o.resolveSelect(d.store).getPostType(s.type),options:e});n.length&&o.dispatch(hs.store).createSuccessNotice(...n),e.isAutosave||o.dispatch(m.store).__unstableMarkLastChangeAsPersistent()}};function Ps(){return S()("wp.data.dispatch( 'core/editor' ).refreshPost",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}const Cs=()=>async({select:e,dispatch:t,registry:s})=>{const o=e.getCurrentPostType(),n=await s.resolveSelect(d.store).getPostType(o);s.dispatch(hs.store).removeNotice(B);const{rest_base:i,rest_namespace:r="wp/v2"}=n;t({type:"REQUEST_POST_DELETE_START"});try{const s=e.getCurrentPost();await ps()({path:`/${r}/${i}/${s.id}`,method:"DELETE"}),await t.savePost()}catch(e){s.dispatch(hs.store).createErrorNotice(...(a={error:e},[a.error.message&&"unknown_error"!==a.error.code?a.error.message:(0,ms.__)("Trashing failed"),{id:B}]))}var a;t({type:"REQUEST_POST_DELETE_FINISH"})},js=({local:e=!1,...t}={})=>async({select:s,dispatch:o})=>{const n=s.getCurrentPost();if("wp_template"!==n.type)if(e){const e=s.isEditedPostNew(),t=s.getEditedPostAttribute("title"),o=s.getEditedPostAttribute("content"),i=s.getEditedPostAttribute("excerpt");!function(e,t,s,o,n){window.sessionStorage.setItem(gs(e,t),JSON.stringify({post_title:s,content:o,excerpt:n}))}(n.id,e,t,o,i)}else await o.savePost({isAutosave:!0,...t})},Es=({forceIsAutosaveable:e}={})=>async({select:t,dispatch:s})=>{if((e||t.isEditedPostAutosaveable())&&!t.isPostLocked()){["draft","auto-draft"].includes(t.getEditedPostAttribute("status"))?await s.savePost({isPreview:!0}):await s.autosave({isPreview:!0})}return t.getEditedPostPreviewLink()},Ts=()=>({registry:e})=>{e.dispatch(d.store).redo()},Bs=()=>({registry:e})=>{e.dispatch(d.store).undo()};function Is(){return S()("wp.data.dispatch( 'core/editor' ).createUndoLevel",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function Ns(e){return{type:"UPDATE_POST_LOCK",lock:e}}const As=()=>({registry:e})=>{e.dispatch(j.store).set("core","isPublishSidebarEnabled",!0)},Ds=()=>({registry:e})=>{e.dispatch(j.store).set("core","isPublishSidebarEnabled",!1)};function Rs(e){return{type:"LOCK_POST_SAVING",lockName:e}}function Ms(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function Os(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function Ls(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}const Fs=(e,t={})=>({select:s,dispatch:o,registry:n})=>{const{__unstableShouldCreateUndoLevel:i,selection:r}=t,a={blocks:e,selection:r};if(!1!==i){const{id:e,type:t}=s.getCurrentPost();if(n.select(d.store).getEditedEntityRecord("postType",t,e).blocks===a.blocks)return void n.dispatch(d.store).__unstableCreateUndoLevel("postType",t,e);a.content=({blocks:e=[]})=>(0,y.__unstableSerializeAndClean)(e)}o.editPost(a)};function Vs(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}const zs=e=>({dispatch:t,registry:s,select:o})=>{o.__unstableIsEditorReady()&&(s.dispatch(m.store).clearSelectedBlock(),t.editPost({selection:void 0},{undoIgnore:!0})),t({type:"SET_RENDERING_MODE",mode:e})};function Us(e){return{type:"SET_DEVICE_TYPE",deviceType:e}}const Hs=e=>({registry:t})=>{var s;const o=null!==(s=t.select(j.store).get("core","inactivePanels"))&&void 0!==s?s:[];let n;n=!!o?.includes(e)?o.filter((t=>t!==e)):[...o,e],t.dispatch(j.store).set("core","inactivePanels",n)},Gs=e=>({registry:t})=>{var s;const o=null!==(s=t.select(j.store).get("core","openPanels"))&&void 0!==s?s:[];let n;n=!!o?.includes(e)?o.filter((t=>t!==e)):[...o,e],t.dispatch(j.store).set("core","openPanels",n)};function $s(e){return{type:"REMOVE_PANEL",panelName:e}}function Ws(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Zs(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Ys=()=>({dispatch:e,registry:t})=>{const s=t.select(j.store).get("core","distractionFree");s&&t.dispatch(j.store).set("core","fixedToolbar",!1),s||t.batch((()=>{t.dispatch(j.store).set("core","fixedToolbar",!0),e.setIsInserterOpened(!1),e.setIsListViewOpened(!1)})),t.batch((()=>{t.dispatch(j.store).set("core","distractionFree",!s),t.dispatch(hs.store).createInfoNotice(s?(0,ms.__)("Distraction free off."):(0,ms.__)("Distraction free on."),{id:"core/editor/distraction-free-mode/notice",type:"snackbar",actions:[{label:(0,ms.__)("Undo"),onClick:()=>{t.batch((()=>{t.dispatch(j.store).set("core","fixedToolbar",!!s),t.dispatch(j.store).toggle("core","distractionFree")}))}}]})}))},Ks=e=>({dispatch:t,registry:s})=>{if(s.dispatch(j.store).set("core","editorMode",e),"visual"!==e&&s.dispatch(m.store).clearSelectedBlock(),"visual"===e)(0,ds.speak)((0,ms.__)("Visual editor selected"),"assertive");else if("text"===e){s.select(j.store).get("core","distractionFree")&&t.toggleDistractionFree(),(0,ds.speak)((0,ms.__)("Code editor selected"),"assertive")}};function qs(){return{type:"OPEN_PUBLISH_SIDEBAR"}}function Qs(){return{type:"CLOSE_PUBLISH_SIDEBAR"}}function Xs(){return{type:"TOGGLE_PUBLISH_SIDEBAR"}}const Js=e=>(...t)=>({registry:s})=>{S()("`wp.data.dispatch( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`",version:"6.2"}),s.dispatch(m.store)[e](...t)},eo=Js("resetBlocks"),to=Js("receiveBlocks"),so=Js("updateBlock"),oo=Js("updateBlockAttributes"),no=Js("selectBlock"),io=Js("startMultiSelect"),ro=Js("stopMultiSelect"),ao=Js("multiSelect"),lo=Js("clearSelectedBlock"),co=Js("toggleSelection"),uo=Js("replaceBlocks"),po=Js("replaceBlock"),ho=Js("moveBlocksDown"),mo=Js("moveBlocksUp"),go=Js("moveBlockToPosition"),_o=Js("insertBlock"),fo=Js("insertBlocks"),bo=Js("showInsertionPoint"),yo=Js("hideInsertionPoint"),xo=Js("setTemplateValidity"),vo=Js("synchronizeTemplate"),wo=Js("mergeBlocks"),So=Js("removeBlocks"),ko=Js("removeBlock"),Po=Js("toggleBlockMode"),Co=Js("startTyping"),jo=Js("stopTyping"),Eo=Js("enterFormattedText"),To=Js("exitFormattedText"),Bo=Js("insertDefaultBlock"),Io=Js("updateBlockListSettings"),No=window.wp.htmlEntities;const Ao=window.wp.components,Do=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})});var Ro=function(){return Ro=Object.assign||function(e){for(var t,s=1,o=arguments.length;se(d.store).getPostType(R)?.labels?.add_new_item),[]);return(0,P.jsx)(Ao.Modal,{title:e||s,onRequestClose:t.closeModal,overlayClassName:"editor-create-template-part-modal",focusOnMount:"firstContentElement",size:"medium",children:(0,P.jsx)(Ho,{...t})})}function Ho({defaultArea:e="uncategorized",blocks:t=[],confirmLabel:s=(0,ms.__)("Add"),closeModal:o,onCreate:n,onError:i,defaultTitle:r=""}){const{createErrorNotice:a}=(0,c.useDispatch)(hs.store),{saveEntityRecord:l}=(0,c.useDispatch)(d.store),h=(0,c.useSelect)((e=>e(d.store).getEntityRecords("postType",R,{per_page:-1})),[]),[m,g]=(0,u.useState)(r),[_,f]=(0,u.useState)(e),[b,x]=(0,u.useState)(!1),v=(0,p.useInstanceId)(Uo),w=(0,c.useSelect)((e=>e(Wi).__experimentalGetDefaultTemplatePartAreas()),[]);async function S(){if(m&&!b)try{x(!0);const e=((e,t)=>{const s=e.toLowerCase(),o=t.map((e=>e.title.rendered.toLowerCase()));if(!o.includes(s))return e;let n=2;for(;o.includes(`${s} ${n}`);)n++;return`${e} ${n}`})(m,h),s=(e=>zo(e).replace(/[^\w-]+/g,"")||"wp-custom-part")(e),o=await l("postType",R,{slug:s,title:e,content:(0,y.serialize)(t),area:_},{throwOnError:!0});await n(o)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,ms.__)("An error occurred while creating the template part.");a(t,{type:"snackbar"}),i?.()}finally{x(!1)}}return(0,P.jsx)("form",{onSubmit:async e=>{e.preventDefault(),await S()},children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"4",children:[(0,P.jsx)(Ao.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,ms.__)("Name"),value:m,onChange:g,required:!0}),(0,P.jsx)(Ao.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Area"),id:`editor-create-template-part-modal__area-selection-${v}`,className:"editor-create-template-part-modal__area-base-control",children:(0,P.jsx)(Ao.__experimentalRadioGroup,{label:(0,ms.__)("Area"),className:"editor-create-template-part-modal__area-radio-group",id:`editor-create-template-part-modal__area-selection-${v}`,onChange:f,checked:_,children:w.map((({icon:e,label:t,area:s,description:o})=>(0,P.jsx)(Ao.__experimentalRadio,{value:s,className:"editor-create-template-part-modal__area-radio",children:(0,P.jsxs)(Ao.Flex,{align:"start",justify:"start",children:[(0,P.jsx)(Ao.FlexItem,{children:(0,P.jsx)(Ao.Icon,{icon:e})}),(0,P.jsxs)(Ao.FlexBlock,{className:"editor-create-template-part-modal__option-label",children:[t,(0,P.jsx)("div",{children:o})]}),(0,P.jsx)(Ao.FlexItem,{className:"editor-create-template-part-modal__checkbox",children:_===s&&(0,P.jsx)(Ao.Icon,{icon:Do})})]})},t)))})}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{o()},children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!m||b,isBusy:b,children:s})]})]})})}function Go(e){return e.type===D||e.type===R}function $o(e){return"string"==typeof e.title?(0,No.decodeEntities)(e.title):"rendered"in e.title?(0,No.decodeEntities)(e.title.rendered):"raw"in e.title?(0,No.decodeEntities)(e.title.raw):""}function Wo(e){return!!e&&([e.source,e.source].includes(L)&&!Boolean("wp_template"===e.type&&e?.plugin)&&!e.has_theme_file)}const Zo={id:"duplicate-template-part",label:(0,ms._x)("Duplicate","action label"),isEligible:e=>e.type===R,modalHeader:(0,ms._x)("Duplicate template part","action label"),RenderModal:({items:e,closeModal:t})=>{const[s]=e,o=(0,u.useMemo)((()=>{var e;return null!==(e=s.blocks)&&void 0!==e?e:(0,y.parse)("string"==typeof s.content?s.content:s.content.raw,{__unstableSkipMigrationLogs:!0})}),[s.content,s.blocks]),{createSuccessNotice:n}=(0,c.useDispatch)(hs.store);return(0,P.jsx)(Ho,{blocks:o,defaultArea:s.area,defaultTitle:(0,ms.sprintf)((0,ms._x)("%s (Copy)","template part"),$o(s)),onCreate:function(){n((0,ms.sprintf)((0,ms._x)('"%s" duplicated.',"template part"),$o(s)),{type:"snackbar",id:"edit-site-patterns-success"}),t?.()},onError:t,confirmLabel:(0,ms._x)("Duplicate","action label"),closeModal:t})}},Yo=Zo,Ko=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"})}),qo=window.wp.privateApis,{lock:Qo,unlock:Xo}=(0,qo.__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/editor"),Jo={id:"reset-post",label:(0,ms.__)("Reset"),isEligible:e=>Go(e)&&e?.source===L&&(Boolean("wp_template"===e.type&&e?.plugin)||e?.has_theme_file),icon:Ko,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[o,n]=(0,u.useState)(!1),{revertTemplate:i}=Xo((0,c.useDispatch)(Wi)),{saveEditedEntityRecord:r}=(0,c.useDispatch)(d.store),{createSuccessNotice:a,createErrorNotice:l}=(0,c.useDispatch)(hs.store);return(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"5",children:[(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Reset to default and clear all customizations?")}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,disabled:o,accessibleWhenDisabled:!0,children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{n(!0),await(async()=>{try{for(const t of e)await i(t,{allowUndo:!1}),await r("postType",t.type,t.id);a(e.length>1?(0,ms.sprintf)((0,ms.__)("%s items reset."),e.length):(0,ms.sprintf)((0,ms.__)('"%s" reset.'),$o(e[0])),{type:"snackbar",id:"revert-template-action"})}catch(t){let s;s=e[0].type===D?1===e.length?(0,ms.__)("An error occurred while reverting the template."):(0,ms.__)("An error occurred while reverting the templates."):1===e.length?(0,ms.__)("An error occurred while reverting the template part."):(0,ms.__)("An error occurred while reverting the template parts.");const o=t,n=o.message&&"unknown_error"!==o.code?o.message:s;l(n,{type:"snackbar"})}})(),s?.(e),n(!1),t?.()},isBusy:o,disabled:o,accessibleWhenDisabled:!0,children:(0,ms.__)("Reset")})]})]})}},en=Jo,tn=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),sn={id:"move-to-trash",label:(0,ms.__)("Move to trash"),isPrimary:!0,icon:tn,isEligible:e=>!Go(e)&&"wp_block"!==e.type&&(!!e.status&&!["auto-draft","trash"].includes(e.status)&&e.permissions?.delete),supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[o,n]=(0,u.useState)(!1),{createSuccessNotice:i,createErrorNotice:r}=(0,c.useDispatch)(hs.store),{deleteEntityRecord:a}=(0,c.useDispatch)(d.store);return(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"5",children:[(0,P.jsx)(Ao.__experimentalText,{children:1===e.length?(0,ms.sprintf)((0,ms.__)('Are you sure you want to move "%s" to the trash?'),$o(e[0])):(0,ms.sprintf)((0,ms._n)("Are you sure you want to move %d item to the trash ?","Are you sure you want to move %d items to the trash ?",e.length),e.length)}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,disabled:o,accessibleWhenDisabled:!0,children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{n(!0);const o=await Promise.allSettled(e.map((e=>a("postType",e.type,e.id.toString(),{},{throwOnError:!0}))));if(o.every((({status:e})=>"fulfilled"===e))){let t;t=1===o.length?(0,ms.sprintf)((0,ms.__)('"%s" moved to the trash.'),$o(e[0])):(0,ms.sprintf)((0,ms._n)("%s item moved to the trash.","%s items moved to the trash.",e.length),e.length),i(t,{type:"snackbar",id:"move-to-trash-action"})}else{let e;if(1===o.length){const t=o[0];e=t.reason?.message?t.reason.message:(0,ms.__)("An error occurred while moving the item to the trash.")}else{const t=new Set,s=o.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,ms.__)("An error occurred while moving the items to the trash."):1===t.size?(0,ms.sprintf)((0,ms.__)("An error occurred while moving the item to the trash: %s"),[...t][0]):(0,ms.sprintf)((0,ms.__)("Some errors occurred while moving the items to the trash: %s"),[...t].join(","))}r(e,{type:"snackbar"})}s&&s(e),n(!1),t?.()},isBusy:o,disabled:o,accessibleWhenDisabled:!0,children:(0,ms._x)("Trash","verb")})]})]})}},on=sn,nn=window.wp.patterns,{PATTERN_TYPES:rn}=Xo(nn.privateApis),an={id:"rename-post",label:(0,ms.__)("Rename"),isEligible:e=>"trash"!==e.status&&([D,R,...Object.values(rn)].includes(e.type)?function(e){return e.type===D}(e)?Wo(e)&&e.is_custom&&e.permissions?.update:function(e){return e.type===R}(e)?e.source===L&&!e?.has_theme_file&&e.permissions?.update:e.type===rn.user&&e.permissions?.update:e.permissions?.update),RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[o]=e,[n,i]=(0,u.useState)((()=>$o(o))),{editEntityRecord:r,saveEditedEntityRecord:a}=(0,c.useDispatch)(d.store),{createSuccessNotice:l,createErrorNotice:p}=(0,c.useDispatch)(hs.store);return(0,P.jsx)("form",{onSubmit:async function(c){c.preventDefault();try{await r("postType",o.type,o.id,{title:n}),i(""),t?.(),await a("postType",o.type,o.id,{throwOnError:!0}),l((0,ms.__)("Name updated"),{type:"snackbar"}),s?.(e)}catch(e){const t=e,s=t.message&&"unknown_error"!==t.code?t.message:(0,ms.__)("An error occurred while updating the name");p(s,{type:"snackbar"})}},children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"5",children:[(0,P.jsx)(Ao.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,ms.__)("Name"),value:n,onChange:i,required:!0}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,ms.__)("Save")})]})]})})}},ln=an,cn={id:"restore",label:(0,ms.__)("Restore"),isPrimary:!0,icon:Ko,supportsBulk:!0,isEligible:e=>!Go(e)&&"wp_block"!==e.type&&"trash"===e.status&&e.permissions?.update,async callback(e,{registry:t,onActionPerformed:s}){const{createSuccessNotice:o,createErrorNotice:n}=t.dispatch(hs.store),{editEntityRecord:i,saveEditedEntityRecord:r}=t.dispatch(d.store);await Promise.allSettled(e.map((e=>i("postType",e.type,e.id,{status:"draft"}))));const a=await Promise.allSettled(e.map((e=>r("postType",e.type,e.id,{throwOnError:!0}))));if(a.every((({status:e})=>"fulfilled"===e))){let t;t=1===e.length?(0,ms.sprintf)((0,ms.__)('"%s" has been restored.'),$o(e[0])):"page"===e[0].type?(0,ms.sprintf)((0,ms.__)("%d pages have been restored."),e.length):(0,ms.sprintf)((0,ms.__)("%d posts have been restored."),e.length),o(t,{type:"snackbar",id:"restore-post-action"}),s&&s(e)}else{let e;if(1===a.length){const t=a[0];e=t.reason?.message?t.reason.message:(0,ms.__)("An error occurred while restoring the post.")}else{const t=new Set,s=a.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,ms.__)("An error occurred while restoring the posts."):1===t.size?(0,ms.sprintf)((0,ms.__)("An error occurred while restoring the posts: %s"),[...t][0]):(0,ms.sprintf)((0,ms.__)("Some errors occurred while restoring the posts: %s"),[...t].join(","))}n(e,{type:"snackbar"})}}},dn=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),un={id:"view-post",label:(0,ms._x)("View","verb"),isPrimary:!0,icon:dn,isEligible:e=>"trash"!==e.status,callback(e,{onActionPerformed:t}){const s=e[0];window.open(s?.link,"_blank"),t&&t(e)}},pn={id:"view-post-revisions",context:"list",label(e){var t;const s=null!==(t=e[0]._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0;return(0,ms.sprintf)((0,ms.__)("View revisions (%s)"),s)},isEligible(e){var t,s;if("trash"===e.status)return!1;const o=null!==(t=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==t?t:null,n=null!==(s=e?._links?.["version-history"]?.[0]?.count)&&void 0!==s?s:0;return!!o&&n>1},callback(e,{onActionPerformed:t}){const s=e[0],o=(0,v.addQueryArgs)("revision.php",{revision:s?._links?.["predecessor-version"]?.[0]?.id});document.location.href=o,t&&t(e)}},{lock:hn,unlock:mn}=(0,qo.__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/fields"),{CreatePatternModalContents:gn,useDuplicatePatternProps:_n}=mn(nn.privateApis),fn={id:"duplicate-pattern",label:(0,ms._x)("Duplicate","action label"),isEligible:e=>"wp_template_part"!==e.type,modalHeader:(0,ms._x)("Duplicate pattern","action label"),RenderModal:({items:e,closeModal:t})=>{const[s]=e,o=_n({pattern:s,onSuccess:()=>t?.()});return(0,P.jsx)(gn,{onClose:t,confirmLabel:(0,ms._x)("Duplicate","action label"),...o})}},bn=fn;const yn={sort:function(e,t,s){return"asc"===s?e-t:t-e},isValid:function(e,t){if(""===e)return!1;if(!Number.isInteger(Number(e)))return!1;if(t?.elements){const s=t?.elements.map((e=>e.value));if(!s.includes(Number(e)))return!1}return!0},Edit:"integer"};const xn={sort:function(e,t,s){return"asc"===s?e.localeCompare(t):t.localeCompare(e)},isValid:function(e,t){if(t?.elements){const s=t?.elements?.map((e=>e.value));if(!s.includes(e))return!1}return!0},Edit:"text"};const vn={sort:function(e,t,s){const o=new Date(e).getTime(),n=new Date(t).getTime();return"asc"===s?o-n:n-o},isValid:function(e,t){if(t?.elements){const s=t?.elements.map((e=>e.value));if(!s.includes(e))return!1}return!0},Edit:"datetime"};const wn={datetime:function({data:e,field:t,onChange:s,hideLabelFromVision:o}){const{id:n,label:i}=t,r=t.getValue({item:e}),a=(0,u.useCallback)((e=>s({[n]:e})),[n,s]);return(0,P.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!o&&(0,P.jsx)(Ao.BaseControl.VisualLabel,{as:"legend",children:i}),o&&(0,P.jsx)(Ao.VisuallyHidden,{as:"legend",children:i}),(0,P.jsx)(Ao.TimePicker,{currentTime:r,onChange:a,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:s,hideLabelFromVision:o}){var n;const{id:i,label:r,description:a}=t,l=null!==(n=t.getValue({item:e}))&&void 0!==n?n:"",c=(0,u.useCallback)((e=>s({[i]:Number(e)})),[i,s]);return(0,P.jsx)(Ao.__experimentalNumberControl,{label:r,help:a,value:l,onChange:c,__next40pxDefaultSize:!0,hideLabelFromVision:o})},radio:function({data:e,field:t,onChange:s,hideLabelFromVision:o}){const{id:n,label:i}=t,r=t.getValue({item:e}),a=(0,u.useCallback)((e=>s({[n]:e})),[n,s]);return t.elements?(0,P.jsx)(Ao.RadioControl,{label:i,onChange:a,options:t.elements,selected:r,hideLabelFromVision:o}):null},select:function({data:e,field:t,onChange:s,hideLabelFromVision:o}){var n,i;const{id:r,label:a}=t,l=null!==(n=t.getValue({item:e}))&&void 0!==n?n:"",c=(0,u.useCallback)((e=>s({[r]:e})),[r,s]),d=[{label:(0,ms.__)("Select item"),value:""},...null!==(i=t?.elements)&&void 0!==i?i:[]];return(0,P.jsx)(Ao.SelectControl,{label:a,value:l,options:d,onChange:c,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:o})},text:function({data:e,field:t,onChange:s,hideLabelFromVision:o}){const{id:n,label:i,placeholder:r}=t,a=t.getValue({item:e}),l=(0,u.useCallback)((e=>s({[n]:e})),[n,s]);return(0,P.jsx)(Ao.TextControl,{label:i,placeholder:r,value:null!=a?a:"",onChange:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:o})}};function Sn(e){if(Object.keys(wn).includes(e))return wn[e];throw"Control "+e+" not found"}function kn(e){return e.map((e=>{var t,s,o,n;const i="integer"===(r=e.type)?yn:"text"===r?xn:"datetime"===r?vn:{sort:(e,t,s)=>"number"==typeof e&&"number"==typeof t?"asc"===s?e-t:t-e:"asc"===s?e.localeCompare(t):t.localeCompare(e),isValid:(e,t)=>{if(t?.elements){const s=t?.elements?.map((e=>e.value));if(!s.includes(e))return!1}return!0},Edit:()=>null};var r;const a=e.getValue||(({item:t})=>t[e.id]),l=null!==(t=e.sort)&&void 0!==t?t:function(e,t,s){return i.sort(a({item:e}),a({item:t}),s)},c=null!==(s=e.isValid)&&void 0!==s?s:function(e,t){return i.isValid(a({item:e}),t)},d=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Sn(e.Edit):e.elements?Sn("select"):"string"==typeof t.Edit?Sn(t.Edit):t.Edit}(e,i),u=e.render||(e.elements?({item:t})=>{const s=a({item:t});return e?.elements?.find((e=>e.value===s))?.label||a({item:t})}:a);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:a,render:u,sort:l,isValid:c,Edit:d,enableHiding:null===(o=e.enableHiding)||void 0===o||o,enableSorting:null===(n=e.enableSorting)||void 0===n||n}}))}function Pn(e,t,s){return kn(t.filter((({id:e})=>!!s.fields?.includes(e)))).every((t=>t.isValid(e,{elements:t.elements})))}const Cn=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.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"})});function jn({title:e,onClose:t}){return(0,P.jsx)(Ao.__experimentalVStack,{className:"dataforms-layouts-panel__dropdown-header",spacing:4,children:(0,P.jsxs)(Ao.__experimentalHStack,{alignment:"center",children:[(0,P.jsx)(Ao.__experimentalHeading,{level:2,size:13,children:e}),(0,P.jsx)(Ao.__experimentalSpacer,{}),t&&(0,P.jsx)(Ao.Button,{label:(0,ms.__)("Close"),icon:Cn,onClick:t,size:"small"})]})})}function En({data:e,field:t,onChange:s}){const[o,n]=(0,u.useState)(null),i=(0,u.useMemo)((()=>({anchor:o,placement:"left-start",offset:36,shift:!0})),[o]);return(0,P.jsxs)(Ao.__experimentalHStack,{ref:n,className:"dataforms-layouts-panel__field",children:[(0,P.jsx)("div",{className:"dataforms-layouts-panel__field-label",children:t.label}),(0,P.jsx)("div",{children:(0,P.jsx)(Ao.Dropdown,{contentClassName:"dataforms-layouts-panel__field-dropdown",popoverProps:i,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},renderToggle:({isOpen:s,onToggle:o})=>(0,P.jsx)(Ao.Button,{className:"dataforms-layouts-panel__field-control",size:"compact",variant:"tertiary","aria-expanded":s,"aria-label":(0,ms.sprintf)((0,ms._x)("Edit %s","field"),t.label),onClick:o,children:(0,P.jsx)(t.render,{item:e})}),renderContent:({onClose:o})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(jn,{title:t.label,onClose:o}),(0,P.jsx)(t.Edit,{data:e,field:t,onChange:s,hideLabelFromVision:!0},t.id)]})})})]})}const Tn=[{type:"regular",component:function({data:e,fields:t,form:s,onChange:o}){const n=(0,u.useMemo)((()=>{var e;return kn((null!==(e=s.fields)&&void 0!==e?e:[]).map((e=>t.find((({id:t})=>t===e)))).filter((e=>!!e)))}),[t,s.fields]);return(0,P.jsx)(Ao.__experimentalVStack,{spacing:4,children:n.map((t=>(0,P.jsx)(t.Edit,{data:e,field:t,onChange:o},t.id)))})}},{type:"panel",component:function({data:e,fields:t,form:s,onChange:o}){const n=(0,u.useMemo)((()=>{var e;return kn((null!==(e=s.fields)&&void 0!==e?e:[]).map((e=>t.find((({id:t})=>t===e)))).filter((e=>!!e)))}),[t,s.fields]);return(0,P.jsx)(Ao.__experimentalVStack,{spacing:2,children:n.map((t=>(0,P.jsx)(En,{data:e,field:t,onChange:o},t.id)))})}}];function Bn({form:e,...t}){var s;const o=(n=null!==(s=e.type)&&void 0!==s?s:"regular",Tn.find((e=>e.type===n)));var n;return o?(0,P.jsx)(o.component,{form:e,...t}):null}const In=[{type:"integer",id:"menu_order",label:(0,ms.__)("Order"),description:(0,ms.__)("Determines the order of pages.")}],Nn={fields:["menu_order"]};const An={id:"order-pages",label:(0,ms.__)("Order"),isEligible:({status:e})=>"trash"!==e,RenderModal:function({items:e,closeModal:t,onActionPerformed:s}){const[o,n]=(0,u.useState)(e[0]),i=o.menu_order,{editEntityRecord:r,saveEditedEntityRecord:a}=(0,c.useDispatch)(d.store),{createSuccessNotice:l,createErrorNotice:p}=(0,c.useDispatch)(hs.store),h=!Pn(o,In,Nn);return(0,P.jsx)("form",{onSubmit:async function(n){if(n.preventDefault(),Pn(o,In,Nn))try{await r("postType",o.type,o.id,{menu_order:i}),t?.(),await a("postType",o.type,o.id,{throwOnError:!0}),l((0,ms.__)("Order updated."),{type:"snackbar"}),s?.(e)}catch(e){const t=e,s=t.message&&"unknown_error"!==t.code?t.message:(0,ms.__)("An error occurred while updating the order");p(s,{type:"snackbar"})}},children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"5",children:[(0,P.jsx)("div",{children:(0,ms.__)("Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.")}),(0,P.jsx)(Bn,{data:o,fields:In,form:Nn,onChange:e=>n({...o,...e})}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",accessibleWhenDisabled:!0,disabled:h,children:(0,ms.__)("Save")})]})]})})}},Dn=An;"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,t,s){const o=Number(0xffffffffn&t),n=Number(t>>32n);this.setUint32(e+(s?0:4),o,s),this.setUint32(e+(s?4:0),n,s)}});var Rn=e=>new DataView(new ArrayBuffer(e)),Mn=e=>new Uint8Array(e.buffer||e),On=e=>(new TextEncoder).encode(String(e)),Ln=e=>Math.min(4294967295,Number(e)),Fn=e=>Math.min(65535,Number(e));function Vn(e,t){if(void 0===t||t instanceof Date||(t=new Date(t)),e instanceof File)return{isFile:1,t:t||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:t||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===t)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t};if("string"==typeof e)return{isFile:1,t,i:On(e)};if(e instanceof Blob)return{isFile:1,t,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t,i:Mn(e)};if(Symbol.asyncIterator in e)return{isFile:1,t,i:zn(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function zn(e,t=e){return new ReadableStream({async pull(t){let s=0;for(;t.desiredSize>s;){const o=await e.next();if(!o.value){t.close();break}{const e=Un(o.value);t.enqueue(e),s+=e.byteLength}}},cancel(e){t.throw?.(e)}})}function Un(e){return"string"==typeof e?On(e):e instanceof Uint8Array?e:Mn(e)}function Hn(e,t,s){let[o,n]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[Mn(e),1]:[On(e),0]:[void 0,0]}(t);if(e instanceof File)return{o:$n(o||On(e.name)),u:BigInt(e.size),l:n};if(e instanceof Response){const t=e.headers.get("content-disposition"),i=t&&t.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),r=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),a=r&&decodeURIComponent(r),l=s||+e.headers.get("content-length");return{o:$n(o||On(a)),u:BigInt(l),l:n}}return o=$n(o,void 0!==e||void 0!==s),"string"==typeof e?{o,u:BigInt(On(e).length),l:n}:e instanceof Blob?{o,u:BigInt(e.size),l:n}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o,u:BigInt(e.byteLength),l:n}:{o,u:Gn(e,s),l:n}}function Gn(e,t){return t>-1?BigInt(t):e?void 0:0n}function $n(e,t=1){if(!e||e.every((e=>47===e)))throw new Error("The file must have a name.");if(t)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var Wn=new Uint32Array(256);for(let e=0;e<256;++e){let t=e;for(let e=0;e<8;++e)t=t>>>1^(1&t&&3988292384);Wn[e]=t}function Zn(e,t=0){t^=-1;for(var s=0,o=e.length;s>>8^Wn[255&t^e[s]];return~t>>>0}function Yn(e,t,s=0){const o=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,n=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(s,o,1),t.setUint16(s+2,n,1)}function Kn({o:e,l:t},s){return 8*(!t||(s??function(e){try{qn.decode(e)}catch{return 0}return 1}(e)))}var qn=new TextDecoder("utf8",{fatal:1});function Qn(e,t=0){const s=Rn(30);return s.setUint32(0,1347093252),s.setUint32(4,754976768|t),Yn(e.t,s,10),s.setUint16(26,e.o.length,1),Mn(s)}async function*Xn(e){let{i:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.m=Zn(t,0),e.u=BigInt(t.length);else{e.u=0n;const s=t.getReader();for(;;){const{value:t,done:o}=await s.read();if(o)break;e.m=Zn(t,e.m),e.u+=BigInt(t.length),yield t}}}function Jn(e,t){const s=Rn(16+(t?8:0));return s.setUint32(0,1347094280),s.setUint32(4,e.isFile?e.m:0,1),t?(s.setBigUint64(8,e.u,1),s.setBigUint64(16,e.u,1)):(s.setUint32(8,Ln(e.u),1),s.setUint32(12,Ln(e.u),1)),Mn(s)}function ei(e,t,s=0,o=0){const n=Rn(46);return n.setUint32(0,1347092738),n.setUint32(4,755182848),n.setUint16(8,2048|s),Yn(e.t,n,12),n.setUint32(16,e.isFile?e.m:0,1),n.setUint32(20,Ln(e.u),1),n.setUint32(24,Ln(e.u),1),n.setUint16(28,e.o.length,1),n.setUint16(30,o,1),n.setUint16(40,e.isFile?33204:16893,1),n.setUint32(42,Ln(t),1),Mn(n)}function ti(e,t,s){const o=Rn(s);return o.setUint16(0,1,1),o.setUint16(2,s-4,1),16&s&&(o.setBigUint64(4,e.u,1),o.setBigUint64(12,e.u,1)),o.setBigUint64(s-8,t,1),Mn(o)}function si(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function oi(e,t={}){const s={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof t.length||Number.isInteger(t.length))&&t.length>0&&(s["Content-Length"]=String(t.length)),t.metadata&&(s["Content-Length"]=String((e=>function(e){let t=BigInt(22),s=0n,o=0;for(const n of e){if(!n.o)throw new Error("Every file must have a non-empty name.");if(void 0===n.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(n.o)}".`);const e=n.u>=0xffffffffn,i=s>=0xffffffffn;s+=BigInt(46+n.o.length+(e&&8))+n.u,t+=BigInt(n.o.length+46+(12*i|28*e)),o||(o=e)}return(o||s>=0xffffffffn)&&(t+=BigInt(76)),t+s}(function*(e){for(const t of e)yield Hn(...si(t)[0])}(e)))(t.metadata))),new Response(ni(e,t),{headers:s})}function ni(e,t={}){const s=function(e){const t=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await t.next();if(e.done)return e;const[s,o]=si(e.value);return{done:0,value:Object.assign(Vn(...o),Hn(...s))}},throw:t.throw?.bind(t),[Symbol.asyncIterator](){return this}}}(e);return zn(async function*(e,t){const s=[];let o=0n,n=0n,i=0;for await(const r of e){const e=Kn(r,t.buffersAreUTF8);yield Qn(r,e),yield new Uint8Array(r.o),r.isFile&&(yield*Xn(r));const a=r.u>=0xffffffffn,l=12*(o>=0xffffffffn)|28*a;yield Jn(r,a),s.push(ei(r,o,e,l)),s.push(r.o),l&&s.push(ti(r,o,l)),a&&(o+=8n),n++,o+=BigInt(46+r.o.length)+r.u,i||(i=a)}let r=0n;for(const e of s)yield e,r+=BigInt(e.length);if(i||o>=0xffffffffn){const e=Rn(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,n,1),e.setBigUint64(32,n,1),e.setBigUint64(40,r,1),e.setBigUint64(48,o,1),e.setUint32(56,1347094023),e.setBigUint64(64,o+r,1),e.setUint32(72,1,1),yield Mn(e)}const a=Rn(22);a.setUint32(0,1347093766),a.setUint16(8,Fn(n),1),a.setUint16(10,Fn(n),1),a.setUint32(12,Ln(r),1),a.setUint32(16,Ln(o),1),yield Mn(a)}(s,t),s)}const ii=window.wp.blob,ri=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),ai="wp_template",li="wp_template_part";function ci(e){return"string"==typeof e.title?(0,No.decodeEntities)(e.title):"rendered"in e.title?(0,No.decodeEntities)(e.title.rendered):"raw"in e.title?(0,No.decodeEntities)(e.title.raw):""}function di(e){return JSON.stringify({__file:e.type,title:ci(e),content:"string"==typeof e.content?e.content:e.content?.raw,syncStatus:e.wp_pattern_sync_status},null,2)}const ui={id:"export-pattern",label:(0,ms.__)("Export as JSON"),icon:ri,supportsBulk:!0,isEligible:e=>"wp_block"===e.type,callback:async e=>{if(1===e.length)return(0,ii.downloadBlob)(`${zo(ci(e[0])||e[0].slug)}.json`,di(e[0]),"application/json");const t={},s=e.map((e=>{const s=zo(ci(e)||e.slug);return t[s]=(t[s]||0)+1,{name:s+(t[s]>1?"-"+(t[s]-1):"")+".json",lastModified:new Date,input:di(e)}}));return(0,ii.downloadBlob)((0,ms.__)("patterns-export")+".zip",await oi(s).blob(),"application/zip")}},pi={id:"permanently-delete",label:(0,ms.__)("Permanently delete"),supportsBulk:!0,icon:tn,isEligible(e){if(function(e){return e.type===ai||e.type===li}(e)||"wp_block"===e.type)return!1;const{status:t,permissions:s}=e;return"trash"===t&&s?.delete},async callback(e,{registry:t,onActionPerformed:s}){const{createSuccessNotice:o,createErrorNotice:n}=t.dispatch(hs.store),{deleteEntityRecord:i}=t.dispatch(d.store),r=await Promise.allSettled(e.map((e=>i("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(r.every((({status:e})=>"fulfilled"===e))){let t;t=1===r.length?(0,ms.sprintf)((0,ms.__)('"%s" permanently deleted.'),ci(e[0])):(0,ms.__)("The items were permanently deleted."),o(t,{type:"snackbar",id:"permanently-delete-post-action"}),s?.(e)}else{let e;if(1===r.length){const t=r[0];e=t.reason?.message?t.reason.message:(0,ms.__)("An error occurred while permanently deleting the item.")}else{const t=new Set,s=r.filter((({status:e})=>"rejected"===e));for(const e of s){const s=e;s.reason?.message&&t.add(s.reason.message)}e=0===t.size?(0,ms.__)("An error occurred while permanently deleting the items."):1===t.size?(0,ms.sprintf)((0,ms.__)("An error occurred while permanently deleting the items: %s"),[...t][0]):(0,ms.sprintf)((0,ms.__)("Some errors occurred while permanently deleting the items: %s"),[...t].join(","))}n(e,{type:"snackbar"})}}},hi=pi,{PATTERN_TYPES:mi}=Xo(nn.privateApis),gi={id:"delete-post",label:(0,ms.__)("Delete"),isPrimary:!0,icon:tn,isEligible:e=>Go(e)?Wo(e):e.type===mi.user,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onActionPerformed:s})=>{const[o,n]=(0,u.useState)(!1),{removeTemplates:i}=Xo((0,c.useDispatch)(Wi));return(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"5",children:[(0,P.jsx)(Ao.__experimentalText,{children:e.length>1?(0,ms.sprintf)((0,ms._n)("Delete %d item?","Delete %d items?",e.length),e.length):(0,ms.sprintf)((0,ms._x)('Delete "%s"?',"template part"),$o(e[0]))}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{variant:"tertiary",onClick:t,disabled:o,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{variant:"primary",onClick:async()=>{n(!0),await i(e,{allowUndo:!1}),s?.(e),n(!1),t?.()},isBusy:o,disabled:o,accessibleWhenDisabled:!0,__next40pxDefaultSize:!0,children:(0,ms.__)("Delete")})]})]})}},_i=gi;function fi(e,t,s){return{type:"REGISTER_ENTITY_ACTION",kind:e,name:t,config:s}}function bi(e,t,s){return{type:"UNREGISTER_ENTITY_ACTION",kind:e,name:t,actionId:s}}function yi(e,t){return{type:"SET_IS_READY",kind:e,name:t}}const xi=e=>async({registry:t})=>{if(Xo(t.select(Wi)).isEntityReady("postType",e))return;Xo(t.dispatch(Wi)).setIsReady("postType",e);const s=await t.resolveSelect(d.store).getPostType(e),o=await t.resolveSelect(d.store).canUser("create",{kind:"postType",name:e}),n=await t.resolveSelect(d.store).getCurrentTheme(),i=[s.viewable?un:void 0,s?.supports?.revisions?pn:void 0,void 0,"wp_template_part"===s.slug&&o&&n?.is_block_theme?Yo:void 0,o&&"wp_block"===s.slug?bn:void 0,s.supports?.title?ln:void 0,s?.supports?.["page-attributes"]?Dn:void 0,"wp_block"===s.slug?ui:void 0,en,cn,_i,on,hi];t.batch((()=>{i.forEach((s=>{s&&Xo(t.dispatch(Wi)).registerEntityAction("postType",e,s)}))})),(0,h.doAction)("core.registerPostTypeActions",e)};function vi(e){return{type:"SET_CURRENT_TEMPLATE_ID",id:e}}const wi=e=>async({select:t,dispatch:s,registry:o})=>{const n=await o.dispatch(d.store).saveEntityRecord("postType","wp_template",e);return o.dispatch(d.store).editEntityRecord("postType",t.getCurrentPostType(),t.getCurrentPostId(),{template:n.slug}),o.dispatch(hs.store).createSuccessNotice((0,ms.__)("Custom template created. You're in template mode now."),{type:"snackbar",actions:[{label:(0,ms.__)("Go back"),onClick:()=>s.setRenderingMode(t.getEditorSettings().defaultRenderingMode)}]}),n},Si=e=>({registry:t})=>{var s;const o=(null!==(s=t.select(j.store).get("core","hiddenBlockTypes"))&&void 0!==s?s:[]).filter((t=>!(Array.isArray(e)?e:[e]).includes(t)));t.dispatch(j.store).set("core","hiddenBlockTypes",o)},ki=e=>({registry:t})=>{var s;const o=null!==(s=t.select(j.store).get("core","hiddenBlockTypes"))&&void 0!==s?s:[],n=new Set([...o,...Array.isArray(e)?e:[e]]);t.dispatch(j.store).set("core","hiddenBlockTypes",[...n])},Pi=({onSave:e,dirtyEntityRecords:t=[],entitiesToSkip:s=[],close:o}={})=>({registry:n})=>{const i=[{kind:"postType",name:"wp_navigation"}],r="site-editor-save-success",a=n.select(d.store).getEntityRecord("root","__unstableBase")?.home;n.dispatch(hs.store).removeNotice(r);const l=t.filter((({kind:e,name:t,key:o,property:n})=>!s.some((s=>s.kind===e&&s.name===t&&s.key===o&&s.property===n))));o?.(l);const c=[],u=[];l.forEach((({kind:e,name:t,key:s,property:o})=>{"root"===e&&"site"===t?c.push(o):(i.some((s=>s.kind===e&&s.name===t))&&n.dispatch(d.store).editEntityRecord(e,t,s,{status:"publish"}),u.push(n.dispatch(d.store).saveEditedEntityRecord(e,t,s)))})),c.length&&u.push(n.dispatch(d.store).__experimentalSaveSpecifiedEntityEdits("root","site",void 0,c)),n.dispatch(m.store).__unstableMarkLastChangeAsPersistent(),Promise.all(u).then((t=>e?e(t):t)).then((e=>{e.some((e=>void 0===e))?n.dispatch(hs.store).createErrorNotice((0,ms.__)("Saving failed.")):n.dispatch(hs.store).createSuccessNotice((0,ms.__)("Site updated."),{type:"snackbar",id:r,actions:[{label:(0,ms.__)("View site"),url:a}]})})).catch((e=>n.dispatch(hs.store).createErrorNotice(`${(0,ms.__)("Saving failed.")} ${e}`)))},Ci=(e,{allowUndo:t=!0}={})=>async({registry:s})=>{const o="edit-site-template-reverted";var n;if(s.dispatch(hs.store).removeNotice(o),(n=e)&&n.source===L&&(Boolean(n?.plugin)||n?.has_theme_file))try{const n=s.select(d.store).getEntityConfig("postType",e.type);if(!n)return void s.dispatch(hs.store).createErrorNotice((0,ms.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const i=(0,v.addQueryArgs)(`${n.baseURL}/${e.id}`,{context:"edit",source:e.origin}),r=await ps()({path:i});if(!r)return void s.dispatch(hs.store).createErrorNotice((0,ms.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const a=({blocks:e=[]})=>(0,y.__unstableSerializeAndClean)(e),l=s.select(d.store).getEditedEntityRecord("postType",e.type,e.id);s.dispatch(d.store).editEntityRecord("postType",e.type,e.id,{content:a,blocks:l.blocks,source:"custom"},{undoIgnore:!0});const c=(0,y.parse)(r?.content?.raw);if(s.dispatch(d.store).editEntityRecord("postType",e.type,r.id,{content:a,blocks:c,source:"theme"}),t){const t=()=>{s.dispatch(d.store).editEntityRecord("postType",e.type,l.id,{content:a,blocks:l.blocks,source:"custom"})};s.dispatch(hs.store).createSuccessNotice((0,ms.__)("Template reset."),{type:"snackbar",id:o,actions:[{label:(0,ms.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,ms.__)("Template revert failed. Please reload.");s.dispatch(hs.store).createErrorNotice(t,{type:"snackbar"})}else s.dispatch(hs.store).createErrorNotice((0,ms.__)("This template is not revertable."),{type:"snackbar"})},ji=e=>async({registry:t})=>{const s=e.every((e=>e?.has_theme_file)),o=await Promise.allSettled(e.map((e=>t.dispatch(d.store).deleteEntityRecord("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(o.every((({status:e})=>"fulfilled"===e))){let o;if(1===e.length){let t;"string"==typeof e[0].title?t=e[0].title:"string"==typeof e[0].title?.rendered?t=e[0].title?.rendered:"string"==typeof e[0].title?.raw&&(t=e[0].title?.raw),o=s?(0,ms.sprintf)((0,ms.__)('"%s" reset.'),(0,No.decodeEntities)(t)):(0,ms.sprintf)((0,ms._x)('"%s" deleted.',"template part"),(0,No.decodeEntities)(t))}else o=s?(0,ms.__)("Items reset."):(0,ms.__)("Items deleted.");t.dispatch(hs.store).createSuccessNotice(o,{type:"snackbar",id:"editor-template-deleted-success"})}else{let e;if(1===o.length)e=o[0].reason?.message?o[0].reason.message:s?(0,ms.__)("An error occurred while reverting the item."):(0,ms.__)("An error occurred while deleting the item.");else{const t=new Set,n=o.filter((({status:e})=>"rejected"===e));for(const e of n)e.reason?.message&&t.add(e.reason.message);e=0===t.size?(0,ms.__)("An error occurred while deleting the items."):1===t.size?s?(0,ms.sprintf)((0,ms.__)("An error occurred while reverting the items: %s"),[...t][0]):(0,ms.sprintf)((0,ms.__)("An error occurred while deleting the items: %s"),[...t][0]):s?(0,ms.sprintf)((0,ms.__)("Some errors occurred while reverting the items: %s"),[...t].join(",")):(0,ms.sprintf)((0,ms.__)("Some errors occurred while deleting the items: %s"),[...t].join(","))}t.dispatch(hs.store).createErrorNotice(e,{type:"snackbar"})}};var Ei=s(5215),Ti=s.n(Ei);const Bi=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),Ii=(0,P.jsx)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)(k.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})}),Ni=(0,P.jsxs)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,P.jsx)(k.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,P.jsx)(k.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})]}),Ai=(0,P.jsx)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)(k.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})}),Di=[];const Ri={rootClientId:void 0,insertionIndex:void 0,filterValue:void 0},Mi=(0,c.createRegistrySelector)((e=>(0,c.createSelector)((t=>{if("object"==typeof t.blockInserterPanel)return t.blockInserterPanel;if("template-locked"===Je(t)){const[t]=e(m.store).getBlocksByName("core/post-content");if(t)return{rootClientId:t,insertionIndex:void 0,filterValue:void 0}}return Ri}),(t=>{const[s]=e(m.store).getBlocksByName("core/post-content");return[t.blockInserterPanel,Je(t),s]}))));function Oi(e){return e.listViewToggleRef}function Li(e){return e.inserterSidebarToggleRef}const Fi={wp_block:Bi,wp_navigation:Ii,page:Ni,post:Ai},Vi=(0,c.createRegistrySelector)((e=>(t,s,o)=>{{if("wp_template_part"===s||"wp_template"===s)return is(t).find((e=>o.area===e.area))?.icon||C;if(Fi[s])return Fi[s];const n=e(d.store).getPostType(s);return"string"==typeof n?.icon&&n.icon.startsWith("dashicons-")?n.icon.slice(10):Ni}})),zi=(0,c.createRegistrySelector)((e=>(t,s,o)=>{const{type:n,id:i}=ee(t),r=e(d.store).getEntityRecordNonTransientEdits("postType",s||n,o||i);if(!r?.meta)return!1;const a=e(d.store).getEntityRecord("postType",s||n,o||i)?.meta;return!Ti()({...a,footnotes:void 0},{...r.meta,footnotes:void 0})}));function Ui(e,...t){return function(e,t,s){var o;return null!==(o=e.actions[t]?.[s])&&void 0!==o?o:Di}(e.dataviews,...t)}function Hi(e,...t){return function(e,t,s){return e.isReady[t]?.[s]}(e.dataviews,...t)}const Gi=(0,c.createRegistrySelector)((e=>(0,c.createSelector)(((t,s)=>{s=Array.isArray(s)?s:[s];const{getBlocksByName:o,getBlockParents:n,getBlockName:i}=e(m.store);return o(s).filter((e=>n(e).every((e=>{const t=i(e);return"core/query"!==t&&!s.includes(t)}))))}),(()=>[e(m.store).getBlocks()])))),$i={reducer:b,selectors:e,actions:t},Wi=(0,c.createReduxStore)("core/editor",{...$i});(0,c.register)(Wi),Xo(Wi).registerPrivateActions(n),Xo(Wi).registerPrivateSelectors(i);function Zi(e){const t=e.avatar_urls&&e.avatar_urls[24]?(0,P.jsx)("img",{className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):(0,P.jsx)("span",{className:"editor-autocompleters__no-avatar"});return(0,P.jsxs)(P.Fragment,{children:[t,(0,P.jsx)("span",{className:"editor-autocompleters__user-name",children:e.name}),(0,P.jsx)("span",{className:"editor-autocompleters__user-slug",children:e.slug})]})}(0,h.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",(function(e){var t;const s=Object.fromEntries(Object.entries(null!==(t=e.attributes)&&void 0!==t?t:{}).filter((([,{source:e}])=>"meta"===e)).map((([e,{meta:t}])=>[e,t])));return Object.entries(s).length&&(e.edit=(e=>(0,p.createHigherOrderComponent)((t=>({attributes:s,setAttributes:o,...n})=>{const i=(0,c.useSelect)((e=>e(Wi).getCurrentPostType()),[]),[r,a]=(0,d.useEntityProp)("postType",i,"meta"),l=(0,u.useMemo)((()=>({...s,...Object.fromEntries(Object.entries(e).map((([e,t])=>[e,r[t]])))})),[s,r]);return(0,P.jsx)(t,{attributes:l,setAttributes:t=>{const s=Object.fromEntries(Object.entries(null!=t?t:{}).filter((([t])=>t in e)).map((([t,s])=>[e[t],s])));Object.entries(s).length&&a(s),o(t)},...n})}),"withMetaAttributeSource"))(s)(e.edit)),e}));const Yi={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",useItems(e){const t=(0,c.useSelect)((t=>{const{getUsers:s}=t(d.store);return s({context:"view",search:encodeURIComponent(e)})}),[e]),s=(0,u.useMemo)((()=>t?t.map((e=>({key:`user-${e.slug}`,value:e,label:Zi(e)}))):[]),[t]);return[s]},getOptionCompletion:e=>`@${e.slug}`};(0,h.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",(function(e=[]){return e.push({...Yi}),e}));const Ki=window.wp.mediaUtils;(0,h.addFilter)("editor.MediaUpload","core/editor/components/media-upload",(()=>Ki.MediaUpload));const{PatternOverridesControls:qi,ResetOverridesControl:Qi,PatternOverridesBlockControls:Xi,PATTERN_TYPES:Ji,PARTIAL_SYNCING_SUPPORTED_BLOCKS:er,PATTERN_SYNC_TYPES:tr}=Xo(nn.privateApis),sr=(0,p.createHigherOrderComponent)((e=>t=>{const s=!!er[t.name];return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(e,{...t},"edit"),t.isSelected&&s&&(0,P.jsx)(or,{...t}),s&&(0,P.jsx)(Xi,{})]})}),"withPatternOverrideControls");function or(e){const t=(0,m.useBlockEditingMode)(),{hasPatternOverridesSource:s,isEditingSyncedPattern:o}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getEditedPostAttribute:s}=e(Wi);return{hasPatternOverridesSource:!!(0,y.getBlockBindingsSource)("core/pattern-overrides"),isEditingSyncedPattern:t()===Ji.user&&s("meta")?.wp_pattern_sync_status!==tr.unsynced&&s("wp_pattern_sync_status")!==tr.unsynced}}),[]),n=e.attributes.metadata?.bindings,i=!!n&&Object.values(n).some((e=>"core/pattern-overrides"===e.source)),r=o&&"default"===t,a=!o&&!!e.attributes.metadata?.name&&"disabled"!==t&&i;return s?(0,P.jsxs)(P.Fragment,{children:[r&&(0,P.jsx)(qi,{...e}),a&&(0,P.jsx)(Qi,{...e})]}):null}(0,h.addFilter)("editor.BlockEdit","core/editor/with-pattern-override-controls",sr);const nr=window.wp.keyboardShortcuts;function ir(e){var t,s,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e=dr(e),area:t=ur(e,t)}),hr=(e,t)=>({registry:s,dispatch:o})=>{if(!t)return;e=dr(e),t=ur(e,t);s.select(j.store).get(e,"isComplementaryAreaVisible")||s.dispatch(j.store).set(e,"isComplementaryAreaVisible",!0),o({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},mr=e=>({registry:t})=>{e=dr(e);t.select(j.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(j.store).set(e,"isComplementaryAreaVisible",!1)},gr=(e,t)=>({registry:s})=>{if(!t)return;e=dr(e),t=ur(e,t);const o=s.select(j.store).get(e,"pinnedItems");!0!==o?.[t]&&s.dispatch(j.store).set(e,"pinnedItems",{...o,[t]:!0})},_r=(e,t)=>({registry:s})=>{if(!t)return;e=dr(e),t=ur(e,t);const o=s.select(j.store).get(e,"pinnedItems");s.dispatch(j.store).set(e,"pinnedItems",{...o,[t]:!1})};function fr(e,t){return function({registry:s}){S()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),s.dispatch(j.store).toggle(e,t)}}function br(e,t,s){return function({registry:o}){S()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),o.dispatch(j.store).set(e,t,!!s)}}function yr(e,t){return function({registry:s}){S()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),s.dispatch(j.store).setDefaults(e,t)}}function xr(e){return{type:"OPEN_MODAL",name:e}}function vr(){return{type:"CLOSE_MODAL"}}const wr=(0,c.createRegistrySelector)((e=>(t,s)=>{s=dr(s);const o=e(j.store).get(s,"isComplementaryAreaVisible");if(void 0!==o)return!1===o?null:t?.complementaryAreas?.[s]})),Sr=(0,c.createRegistrySelector)((e=>(t,s)=>{s=dr(s);const o=e(j.store).get(s,"isComplementaryAreaVisible"),n=t?.complementaryAreas?.[s];return o&&void 0===n})),kr=(0,c.createRegistrySelector)((e=>(t,s,o)=>{var n;o=ur(s=dr(s),o);const i=e(j.store).get(s,"pinnedItems");return null===(n=i?.[o])||void 0===n||n})),Pr=(0,c.createRegistrySelector)((e=>(t,s,o)=>(S()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(j.store).get(s,o))));function Cr(e,t){return e.activeModal===t}const jr=(0,c.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:s,area:o}=t;return e[s]?e:{...e,[s]:o}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:s,area:o}=t;return{...e,[s]:o}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),Er=(0,c.createReduxStore)("core/interface",{reducer:jr,actions:r,selectors:a});(0,c.register)(Er);const Tr=window.wp.plugins,Br=(0,Tr.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));const Ir=Br((function({as:e=Ao.Button,scope:t,identifier:s,icon:o,selectedIcon:n,name:i,shortcut:r,...a}){const l=e,d=(0,c.useSelect)((e=>e(Er).getActiveComplementaryArea(t)===s),[s,t]),{enableComplementaryArea:u,disableComplementaryArea:p}=(0,c.useDispatch)(Er);return(0,P.jsx)(l,{icon:n&&d?n:o,"aria-controls":s.replace("/",":"),"aria-checked":(h=a.role,["checkbox","option","radio","switch","menuitemcheckbox","menuitemradio","treeitem"].includes(h)?d:void 0),onClick:()=>{d?p(t):u(t,s)},shortcut:r,...a});var h})),Nr=({smallScreenTitle:e,children:t,className:s,toggleButtonProps:o})=>{const n=(0,P.jsx)(Ir,{icon:Cn,...o});return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"components-panel__header interface-complementary-area-header__small",children:[e&&(0,P.jsx)("h2",{className:"interface-complementary-area-header__small-title",children:e}),n]}),(0,P.jsxs)("div",{className:rr("components-panel__header","interface-complementary-area-header",s),tabIndex:-1,children:[t,n]})]})},Ar=()=>{};function Dr({name:e,as:t=Ao.Button,onClick:s,...o}){return(0,P.jsx)(Ao.Fill,{name:e,children:({onClick:e})=>(0,P.jsx)(t,{onClick:s||e?(...t)=>{(s||Ar)(...t),(e||Ar)(...t)}:void 0,...o})})}Dr.Slot=function({name:e,as:t=Ao.ButtonGroup,fillProps:s={},bubblesVirtually:o,...n}){return(0,P.jsx)(Ao.Slot,{name:e,bubblesVirtually:o,fillProps:s,children:e=>{if(!u.Children.toArray(e).length)return null;const s=[];u.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&s.push(t)}));const o=u.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&s.includes(e.props.__unstableTarget)?null:e));return(0,P.jsx)(t,{...n,children:o})}})};const Rr=Dr,Mr=({__unstableExplicitMenuItem:e,__unstableTarget:t,...s})=>(0,P.jsx)(Ao.MenuItem,{...s});function Or({scope:e,target:t,__unstableExplicitMenuItem:s,...o}){return(0,P.jsx)(Ir,{as:o=>(0,P.jsx)(Rr,{__unstableExplicitMenuItem:s,__unstableTarget:`${e}/${t}`,as:Mr,name:`${e}/plugin-more-menu`,...o}),role:"menuitemcheckbox",selectedIcon:Do,name:t,scope:e,...o})}function Lr({scope:e,...t}){return(0,P.jsx)(Ao.Fill,{name:`PinnedItems/${e}`,...t})}Lr.Slot=function({scope:e,className:t,...s}){return(0,P.jsx)(Ao.Slot,{name:`PinnedItems/${e}`,...s,children:e=>e?.length>0&&(0,P.jsx)("div",{className:rr(t,"interface-pinned-items"),children:e})})};const Fr=Lr;const Vr={open:{width:280},closed:{width:0},mobileOpen:{width:"100vw"}};function zr({activeArea:e,isActive:t,scope:s,children:o,className:n,id:i}){const r=(0,p.useReducedMotion)(),a=(0,p.useViewportMatch)("medium","<"),l=(0,p.usePrevious)(e),c=(0,p.usePrevious)(t),[,d]=(0,u.useState)({});(0,u.useEffect)((()=>{d({})}),[t]);const h={type:"tween",duration:r||a||l&&e&&e!==l?0:.3,ease:[.6,0,.4,1]};return(0,P.jsx)(Ao.Fill,{name:`ComplementaryArea/${s}`,children:(0,P.jsx)(Ao.__unstableAnimatePresence,{initial:!1,children:(c||t)&&(0,P.jsx)(Ao.__unstableMotion.div,{variants:Vr,initial:"closed",animate:a?"mobileOpen":"open",exit:"closed",transition:h,className:"interface-complementary-area__fill",children:(0,P.jsx)("div",{id:i,className:n,style:{width:a?"100vw":280},children:o})})})})}const Ur=Br((function({children:e,className:t,closeLabel:s=(0,ms.__)("Close plugin"),identifier:o,header:n,headerClassName:i,icon:r,isPinnable:a=!0,panelClassName:l,scope:d,name:p,smallScreenTitle:h,title:m,toggleShortcut:g,isActiveByDefault:_}){const[f,b]=(0,u.useState)(!1),{isLoading:y,isActive:x,isPinned:v,activeArea:w,isSmall:S,isLarge:k,showIconLabels:C}=(0,c.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:s,isItemPinned:n}=e(Er),{get:i}=e(j.store),r=t(d);return{isLoading:s(d),isActive:r===o,isPinned:n(d,o),activeArea:r,isSmall:e(cr.store).isViewportMatch("< medium"),isLarge:e(cr.store).isViewportMatch("large"),showIconLabels:i("core","showIconLabels")}}),[o,d]);!function(e,t,s,o,n){const i=(0,u.useRef)(!1),r=(0,u.useRef)(!1),{enableComplementaryArea:a,disableComplementaryArea:l}=(0,c.useDispatch)(Er);(0,u.useEffect)((()=>{o&&n&&!i.current?(l(e),r.current=!0):r.current&&!n&&i.current?(r.current=!1,a(e,t)):r.current&&s&&s!==t&&(r.current=!1),n!==i.current&&(i.current=n)}),[o,n,e,t,s,l,a])}(d,o,w,x,S);const{enableComplementaryArea:E,disableComplementaryArea:T,pinItem:B,unpinItem:I}=(0,c.useDispatch)(Er);if((0,u.useEffect)((()=>{_&&void 0===w&&!S?E(d,o):void 0===w&&S&&T(d,o),b(!0)}),[w,_,d,o,S,E,T]),f)return(0,P.jsxs)(P.Fragment,{children:[a&&(0,P.jsx)(Fr,{scope:d,children:v&&(0,P.jsx)(Ir,{scope:d,identifier:o,isPressed:x&&(!C||k),"aria-expanded":x,"aria-disabled":y,label:m,icon:C?Do:r,showTooltip:!C,variant:C?"tertiary":void 0,size:"compact",shortcut:g})}),p&&a&&(0,P.jsx)(Or,{target:p,scope:d,icon:r,children:m}),(0,P.jsxs)(zr,{activeArea:w,isActive:x,className:rr("interface-complementary-area",t),scope:d,id:o.replace("/",":"),children:[(0,P.jsx)(Nr,{className:i,closeLabel:s,onClose:()=>T(d),smallScreenTitle:h,toggleButtonProps:{label:s,size:"small",shortcut:g,scope:d,identifier:o},children:n||(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h2",{className:"interface-complementary-area-header__title",children:m}),a&&(0,P.jsx)(Ao.Button,{className:"interface-complementary-area__pin-unpin-item",icon:v?ar:lr,label:v?(0,ms.__)("Unpin from toolbar"):(0,ms.__)("Pin to toolbar"),onClick:()=>(v?I:B)(d,o),isPressed:v,"aria-expanded":v,size:"compact"})]})}),(0,P.jsx)(Ao.Panel,{className:l,children:e})]})]})}));Ur.Slot=function({scope:e,...t}){return(0,P.jsx)(Ao.Slot,{name:`ComplementaryArea/${e}`,...t})};const Hr=Ur,Gr=({isActive:e})=>((0,u.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,u.useEffect)((()=>(e?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{e&&document.body.classList.remove("is-fullscreen-mode")})),[e]),null),$r=(0,u.forwardRef)((({children:e,className:t,ariaLabel:s,as:o="div",...n},i)=>(0,P.jsx)(o,{ref:i,className:rr("interface-navigable-region",t),"aria-label":s,role:"region",tabIndex:"-1",...n,children:e})));$r.displayName="NavigableRegion";const Wr=$r,Zr={type:"tween",duration:.25,ease:[.6,0,.4,1]};const Yr={hidden:{opacity:1,marginTop:-60},visible:{opacity:1,marginTop:0},distractionFreeHover:{opacity:1,marginTop:0,transition:{...Zr,delay:.2,delayChildren:.2}},distractionFreeHidden:{opacity:0,marginTop:-60},distractionFreeDisabled:{opacity:0,marginTop:0,transition:{...Zr,delay:.8,delayChildren:.8}}};const Kr=(0,u.forwardRef)((function({isDistractionFree:e,footer:t,header:s,editorNotices:o,sidebar:n,secondarySidebar:i,content:r,actions:a,labels:l,className:c},d){const[h,m]=(0,p.useResizeObserver)(),g=(0,p.useViewportMatch)("medium","<"),_={type:"tween",duration:(0,p.useReducedMotion)()?0:.25,ease:[.6,0,.4,1]};!function(e){(0,u.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 f={...{header:(0,ms._x)("Header","header landmark area"),body:(0,ms.__)("Content"),secondarySidebar:(0,ms.__)("Block Library"),sidebar:(0,ms._x)("Settings","settings landmark area"),actions:(0,ms.__)("Publish"),footer:(0,ms.__)("Footer")},...l};return(0,P.jsxs)("div",{ref:d,className:rr(c,"interface-interface-skeleton",!!t&&"has-footer"),children:[(0,P.jsxs)("div",{className:"interface-interface-skeleton__editor",children:[(0,P.jsx)(Ao.__unstableAnimatePresence,{initial:!1,children:!!s&&(0,P.jsx)(Wr,{as:Ao.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":f.header,initial:e&&!g?"distractionFreeHidden":"hidden",whileHover:e&&!g?"distractionFreeHover":"visible",animate:e&&!g?"distractionFreeDisabled":"visible",exit:e&&!g?"distractionFreeHidden":"hidden",variants:Yr,transition:_,children:s})}),e&&(0,P.jsx)("div",{className:"interface-interface-skeleton__header",children:o}),(0,P.jsxs)("div",{className:"interface-interface-skeleton__body",children:[(0,P.jsx)(Ao.__unstableAnimatePresence,{initial:!1,children:!!i&&(0,P.jsx)(Wr,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:f.secondarySidebar,as:Ao.__unstableMotion.div,initial:"closed",animate:"open",exit:"closed",variants:{open:{width:m.width},closed:{width:0}},transition:_,children:(0,P.jsxs)(Ao.__unstableMotion.div,{style:{position:"absolute",width:g?"100vw":"fit-content",height:"100%",left:0},variants:{open:{x:0},closed:{x:"-100%"}},transition:_,children:[h,i]})})}),(0,P.jsx)(Wr,{className:"interface-interface-skeleton__content",ariaLabel:f.body,children:r}),!!n&&(0,P.jsx)(Wr,{className:"interface-interface-skeleton__sidebar",ariaLabel:f.sidebar,children:n}),!!a&&(0,P.jsx)(Wr,{className:"interface-interface-skeleton__actions",ariaLabel:f.actions,children:a})]})]}),!!t&&(0,P.jsx)(Wr,{className:"interface-interface-skeleton__footer",ariaLabel:f.footer,children:t})]})}));function qr(){const e=(0,c.useSelect)((e=>{const{richEditingEnabled:t,codeEditingEnabled:s}=e(Wi).getEditorSettings();return!t||!s}),[]),{getBlockSelectionStart:t}=(0,c.useSelect)(m.store),{getActiveComplementaryArea:s}=(0,c.useSelect)(Er),{enableComplementaryArea:o,disableComplementaryArea:n}=(0,c.useDispatch)(Er),{redo:i,undo:r,savePost:a,setIsListViewOpened:l,switchEditorMode:d,toggleDistractionFree:u}=(0,c.useDispatch)(Wi),{isEditedPostDirty:p,isPostSavingLocked:h,isListViewOpened:g,getEditorMode:_}=(0,c.useSelect)(Wi);return(0,nr.useShortcut)("core/editor/toggle-mode",(()=>{d("visual"===_()?"text":"visual")}),{isDisabled:e}),(0,nr.useShortcut)("core/editor/toggle-distraction-free",(()=>{u()})),(0,nr.useShortcut)("core/editor/undo",(e=>{r(),e.preventDefault()})),(0,nr.useShortcut)("core/editor/redo",(e=>{i(),e.preventDefault()})),(0,nr.useShortcut)("core/editor/save",(e=>{e.preventDefault(),h()||p()&&a()})),(0,nr.useShortcut)("core/editor/toggle-list-view",(e=>{g()||(e.preventDefault(),l(!0))})),(0,nr.useShortcut)("core/editor/toggle-sidebar",(e=>{e.preventDefault();if(["edit-post/document","edit-post/block"].includes(s("core")))n("core");else{const e=t()?"edit-post/block":"edit-post/document";o("core",e)}})),null}class Qr extends u.Component{constructor(e){super(e),this.needsAutosave=!(!e.isDirty||!e.isAutosaveable)}componentDidMount(){this.props.disableIntervalChecks||this.setAutosaveTimer()}componentDidUpdate(e){this.props.disableIntervalChecks?this.props.editsReference!==e.editsReference&&this.props.autosave():(this.props.interval!==e.interval&&(clearTimeout(this.timerId),this.setAutosaveTimer()),this.props.isDirty&&(!this.props.isAutosaving||e.isAutosaving)?this.props.editsReference!==e.editsReference&&(this.needsAutosave=!0):this.needsAutosave=!1)}componentWillUnmount(){clearTimeout(this.timerId)}setAutosaveTimer(e=1e3*this.props.interval){this.timerId=setTimeout((()=>{this.autosaveTimerHandler()}),e)}autosaveTimerHandler(){this.props.isAutosaveable?(this.needsAutosave&&(this.needsAutosave=!1,this.props.autosave()),this.setAutosaveTimer()):this.setAutosaveTimer(1e3)}render(){return null}}const Xr=(0,p.compose)([(0,c.withSelect)(((e,t)=>{const{getReferenceByDistinctEdits:s}=e(d.store),{isEditedPostDirty:o,isEditedPostAutosaveable:n,isAutosavingPost:i,getEditorSettings:r}=e(Wi),{interval:a=r().autosaveInterval}=t;return{editsReference:s(),isDirty:o(),isAutosaveable:n(),isAutosaving:i(),interval:a}})),(0,c.withDispatch)(((e,t)=>({autosave(){const{autosave:s=e(Wi).autosave}=t;s()}})))])(Qr),Jr=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),ea=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),ta=window.wp.keycodes,sa=window.wp.commands,oa=(0,Ao.__unstableMotion)(Ao.Button);function na(e){const{postType:t,postTypeLabel:s,documentTitle:o,isNotFound:n,isUnsyncedPattern:i,templateTitle:r,onNavigateToPreviousEntityRecord:a}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s,getEditorSettings:o,__experimentalGetTemplateInfo:n}=e(Wi),{getEditedEntityRecord:i,getPostType:r,isResolving:a}=e(d.store),l=t(),c=s(),u=i("postType",l,c),p=n(u),h=r(l)?.labels?.singular_name;return{postType:l,postTypeLabel:h,documentTitle:u.title,isNotFound:!u&&!a("getEditedEntityRecord","postType",l,c),isUnsyncedPattern:"unsynced"===u?.wp_pattern_sync_status,templateTitle:p.title,onNavigateToPreviousEntityRecord:o().onNavigateToPreviousEntityRecord}}),[]),{open:l}=(0,c.useDispatch)(sa.store),h=(0,p.useReducedMotion)(),g=F.includes(t),_=V.includes(t),f=!!a,b=g?r:o,y=e.title||b,x=e.icon,v=(0,u.useRef)(!1);return(0,u.useEffect)((()=>{v.current=!0}),[]),(0,P.jsxs)("div",{className:rr("editor-document-bar",{"has-back-button":f,"is-global":_&&!i}),children:[(0,P.jsx)(Ao.__unstableAnimatePresence,{children:f&&(0,P.jsx)(oa,{className:"editor-document-bar__back",icon:(0,ms.isRTL)()?Jr:ea,onClick:e=>{e.stopPropagation(),a()},size:"compact",initial:!!v.current&&{opacity:0,transform:"translateX(15%)"},animate:{opacity:1,transform:"translateX(0%)"},exit:{opacity:0,transform:"translateX(15%)"},transition:h?{duration:0}:void 0,children:(0,ms.__)("Back")})}),n?(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Document not found")}):(0,P.jsxs)(Ao.Button,{className:"editor-document-bar__command",onClick:()=>l(),size:"compact",children:[(0,P.jsxs)(Ao.__unstableMotion.div,{className:"editor-document-bar__title",initial:!!v.current&&{opacity:0,transform:f?"translateX(15%)":"translateX(-15%)"},animate:{opacity:1,transform:"translateX(0%)"},transition:h?{duration:0}:void 0,children:[x&&(0,P.jsx)(m.BlockIcon,{icon:x}),(0,P.jsxs)(Ao.__experimentalText,{size:"body",as:"h1",children:[(0,P.jsx)("span",{className:"editor-document-bar__post-title",children:y?(0,No.decodeEntities)(y):(0,ms.__)("No title")}),s&&!e.title&&(0,P.jsx)("span",{className:"editor-document-bar__post-type-label",children:"· "+(0,No.decodeEntities)(s)})]})]},f),(0,P.jsx)("span",{className:"editor-document-bar__shortcut",children:ta.displayShortcut.primary("k")})]})]})}const ia=window.wp.richText,ra=({children:e,isValid:t,level:s,href:o,onSelect:n})=>(0,P.jsx)("li",{className:rr("document-outline__item",`is-${s.toLowerCase()}`,{"is-invalid":!t}),children:(0,P.jsxs)("a",{href:o,className:"document-outline__button",onClick:n,children:[(0,P.jsx)("span",{className:"document-outline__emdash","aria-hidden":"true"}),(0,P.jsx)("strong",{className:"document-outline__level",children:s}),(0,P.jsx)("span",{className:"document-outline__item-content",children:e})]})}),aa=(0,P.jsx)("em",{children:(0,ms.__)("(Empty heading)")}),la=[(0,P.jsx)("br",{},"incorrect-break"),(0,P.jsx)("em",{children:(0,ms.__)("(Incorrect heading level)")},"incorrect-message")],ca=[(0,P.jsx)("br",{},"incorrect-break-h1"),(0,P.jsx)("em",{children:(0,ms.__)("(Your theme may already use a H1 for the post title)")},"incorrect-message-h1")],da=[(0,P.jsx)("br",{},"incorrect-break-multiple-h1"),(0,P.jsx)("em",{children:(0,ms.__)("(Multiple H1 headings are not recommended)")},"incorrect-message-multiple-h1")];function ua(){return(0,P.jsxs)(Ao.SVG,{width:"138",height:"148",viewBox:"0 0 138 148",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,P.jsx)(Ao.Rect,{width:"138",height:"148",rx:"4",fill:"#F0F6FC"}),(0,P.jsx)(Ao.Line,{x1:"44",y1:"28",x2:"24",y2:"28",stroke:"#DDDDDD"}),(0,P.jsx)(Ao.Rect,{x:"48",y:"16",width:"27",height:"23",rx:"4",fill:"#DDDDDD"}),(0,P.jsx)(Ao.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,P.jsx)(Ao.Line,{x1:"55",y1:"59",x2:"24",y2:"59",stroke:"#DDDDDD"}),(0,P.jsx)(Ao.Rect,{x:"59",y:"47",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,P.jsx)(Ao.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,P.jsx)(Ao.Line,{x1:"80",y1:"90",x2:"24",y2:"90",stroke:"#DDDDDD"}),(0,P.jsx)(Ao.Rect,{x:"84",y:"78",width:"30",height:"23",rx:"4",fill:"#F0B849"}),(0,P.jsx)(Ao.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,P.jsx)(Ao.Line,{x1:"66",y1:"121",x2:"24",y2:"121",stroke:"#DDDDDD"}),(0,P.jsx)(Ao.Rect,{x:"70",y:"109",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,P.jsx)(Ao.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"})]})}const pa=(e=[])=>e.flatMap(((e={})=>"core/heading"===e.name?{...e,level:e.attributes.level,isEmpty:ha(e)}:pa(e.innerBlocks))),ha=e=>!e.attributes.content||0===e.attributes.content.trim().length;function ma({onSelect:e,isTitleSupported:t,hasOutlineItemsDisabled:s}){const{selectBlock:o}=(0,c.useDispatch)(m.store),{blocks:n,title:i}=(0,c.useSelect)((e=>{var t;const{getBlocks:s}=e(m.store),{getEditedPostAttribute:o}=e(Wi),{getPostType:n}=e(d.store),i=n(o("type"));return{title:o("title"),blocks:s(),isTitleSupported:null!==(t=i?.supports?.title)&&void 0!==t&&t}})),r=pa(n);if(r.length<1)return(0,P.jsxs)("div",{className:"editor-document-outline has-no-headings",children:[(0,P.jsx)(ua,{}),(0,P.jsx)("p",{children:(0,ms.__)("Navigate the structure of your document and address issues like empty or incorrect heading levels.")})]});let a=1;const l=document.querySelector(".editor-post-title__input"),u=t&&i&&l,p=r.reduce(((e,t)=>({...e,[t.level]:(e[t.level]||0)+1})),{})[1]>1;return(0,P.jsx)("div",{className:"document-outline",children:(0,P.jsxs)("ul",{children:[u&&(0,P.jsx)(ra,{level:(0,ms.__)("Title"),isValid:!0,onSelect:e,href:`#${l.id}`,isDisabled:s,children:i}),r.map(((t,n)=>{const i=t.level>a+1,r=!(t.isEmpty||i||!t.level||1===t.level&&(p||u));return a=t.level,(0,P.jsxs)(ra,{level:`H${t.level}`,isValid:r,isDisabled:s,href:`#block-${t.clientId}`,onSelect:()=>{o(t.clientId),e?.()},children:[t.isEmpty?aa:(0,ia.getTextContent)((0,ia.create)({html:t.attributes.content})),i&&la,1===t.level&&p&&da,u&&1===t.level&&!p&&ca]},n)}))]})})}function ga({children:e}){const t=(0,c.useSelect)((e=>{const{getGlobalBlockCount:t}=e(m.store);return t("core/heading")>0}));return t?null:e}const _a=function(){const{registerShortcut:e}=(0,c.useDispatch)(nr.store);return(0,u.useEffect)((()=>{e({name:"core/editor/toggle-mode",category:"global",description:(0,ms.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/editor/save",category:"global",description:(0,ms.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:(0,ms.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:(0,ms.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,ta.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/editor/toggle-list-view",category:"global",description:(0,ms.__)("Open the List View."),keyCombination:{modifier:"access",character:"o"}}),e({name:"core/editor/toggle-distraction-free",category:"global",description:(0,ms.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}}),e({name:"core/editor/toggle-sidebar",category:"global",description:(0,ms.__)("Show or hide the Settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/editor/keyboard-shortcuts",category:"main",description:(0,ms.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/editor/next-region",category:"global",description:(0,ms.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/editor/previous-region",category:"global",description:(0,ms.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]})}),[e]),(0,P.jsx)(m.BlockEditorKeyboardShortcuts.Register,{})},fa=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})}),ba=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})});const ya=(0,u.forwardRef)((function(e,t){const s=(0,ta.isAppleOS)()?ta.displayShortcut.primaryShift("z"):ta.displayShortcut.primary("y"),o=(0,c.useSelect)((e=>e(Wi).hasEditorRedo()),[]),{redo:n}=(0,c.useDispatch)(Wi);return(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,ms.isRTL)()?ba:fa,label:(0,ms.__)("Redo"),shortcut:s,"aria-disabled":!o,onClick:o?n:void 0,className:"editor-history__redo"})}));const xa=(0,u.forwardRef)((function(e,t){const s=(0,c.useSelect)((e=>e(Wi).hasEditorUndo()),[]),{undo:o}=(0,c.useDispatch)(Wi);return(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,ms.isRTL)()?fa:ba,label:(0,ms.__)("Undo"),shortcut:ta.displayShortcut.primary("z"),"aria-disabled":!s,onClick:s?o:void 0,className:"editor-history__undo"})}));function va(){const[e,t]=(0,u.useState)(!1),s=(0,c.useSelect)((e=>e(m.store).isValidTemplate()),[]),{setTemplateValidity:o,synchronizeTemplate:n}=(0,c.useDispatch)(m.store);return s?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:(0,ms.__)("Keep it as is"),onClick:()=>o(!0)},{label:(0,ms.__)("Reset the template"),onClick:()=>t(!0)}],children:(0,ms.__)("The content of your post doesn’t match the template assigned to your post type.")}),(0,P.jsx)(Ao.__experimentalConfirmDialog,{isOpen:e,confirmButtonText:(0,ms.__)("Reset"),onConfirm:()=>{t(!1),n()},onCancel:()=>t(!1),size:"medium",children:(0,ms.__)("Resetting the template may result in loss of content, do you want to continue?")})]})}const wa=function(){const{notices:e}=(0,c.useSelect)((e=>({notices:e(hs.store).getNotices()})),[]),{removeNotice:t}=(0,c.useDispatch)(hs.store),s=e.filter((({isDismissible:e,type:t})=>e&&"default"===t)),o=e.filter((({isDismissible:e,type:t})=>!e&&"default"===t));return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.NoticeList,{notices:o,className:"components-editor-notices__pinned"}),(0,P.jsx)(Ao.NoticeList,{notices:s,className:"components-editor-notices__dismissible",onRemove:t,children:(0,P.jsx)(va,{})})]})},Sa=-3;function ka(){const e=(0,c.useSelect)((e=>e(hs.store).getNotices()),[]),{removeNotice:t}=(0,c.useDispatch)(hs.store),s=e.filter((({type:e})=>"snackbar"===e)).slice(Sa);return(0,P.jsx)(Ao.SnackbarList,{notices:s,className:"components-editor-notices__snackbar",onRemove:t})}function Pa({record:e,checked:t,onChange:s}){const{name:o,kind:n,title:i,key:r}=e,{entityRecordTitle:a,hasPostMetaChanges:l}=(0,c.useSelect)((e=>{if("postType"!==n||"wp_template"!==o)return{entityRecordTitle:i,hasPostMetaChanges:Xo(e(Wi)).hasPostMetaChanges(o,r)};const t=e(d.store).getEditedEntityRecord(n,o,r);return{entityRecordTitle:e(Wi).__experimentalGetTemplateInfo(t).title,hasPostMetaChanges:Xo(e(Wi)).hasPostMetaChanges(o,r)}}),[o,n,i,r]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.PanelRow,{children:(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,No.decodeEntities)(a)||(0,ms.__)("Untitled"),checked:t,onChange:s})}),l&&(0,P.jsx)("ul",{className:"entities-saved-states__changes",children:(0,P.jsx)("li",{children:(0,ms.__)("Post Meta.")})})]})}const{getGlobalStylesChanges:Ca,GlobalStylesContext:ja}=Xo(m.privateApis);function Ea({record:e}){const{user:t}=(0,u.useContext)(ja),s=(0,c.useSelect)((t=>t(d.store).getEntityRecord(e.kind,e.name,e.key)),[e.kind,e.name,e.key]),o=Ca(t,s,{maxResults:10});return o.length?(0,P.jsx)("ul",{className:"entities-saved-states__changes",children:o.map((e=>(0,P.jsx)("li",{children:e},e)))}):null}function Ta({record:e,count:t}){if("globalStyles"===e?.name)return null;const s=function(e,t){switch(e){case"site":return 1===t?(0,ms.__)("This change will affect your whole site."):(0,ms.__)("These changes will affect your whole site.");case"wp_template":return(0,ms.__)("This change will affect pages and posts that use this template.");case"page":case"post":return(0,ms.__)("The following has been modified.")}}(e?.name,t);return s?(0,P.jsx)(Ao.PanelRow,{children:s}):null}function Ba({list:e,unselectedEntities:t,setUnselectedEntities:s}){const o=e.length,n=e[0];let i=(0,c.useSelect)((e=>e(d.store).getEntityConfig(n.kind,n.name)),[n.kind,n.name]).label;return"wp_template_part"===n?.name&&(i=1===o?(0,ms.__)("Template Part"):(0,ms.__)("Template Parts")),(0,P.jsxs)(Ao.PanelBody,{title:i,initialOpen:!0,children:[(0,P.jsx)(Ta,{record:n,count:o}),e.map((e=>(0,P.jsx)(Pa,{record:e,checked:!t.some((t=>t.kind===e.kind&&t.name===e.name&&t.key===e.key&&t.property===e.property)),onChange:t=>s(e,t)},e.key||e.property))),"globalStyles"===n?.name&&(0,P.jsx)(Ea,{record:n})]})}const Ia=()=>{const{editedEntities:e,siteEdits:t,siteEntityConfig:s}=(0,c.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,getEntityRecordEdits:s,getEntityConfig:o}=e(d.store);return{editedEntities:t(),siteEdits:s("root","site"),siteEntityConfig:o("root","site")}}),[]),o=(0,u.useMemo)((()=>{var o;const n=e.filter((e=>!("root"===e.kind&&"site"===e.name))),i=null!==(o=s?.meta?.labels)&&void 0!==o?o:{},r=[];for(const e in t)r.push({kind:"root",name:"site",title:i[e]||e,property:e});return[...n,...r]}),[e,t,s]),[n,i]=(0,u.useState)([]);return{dirtyEntityRecords:o,isDirty:o.length-n.length>0,setUnselectedEntities:({kind:e,name:t,key:s,property:o},r)=>{i(r?n.filter((n=>n.kind!==e||n.name!==t||n.key!==s||n.property!==o)):[...n,{kind:e,name:t,key:s,property:o}])},unselectedEntities:n}};function Na(e){return e}function Aa({close:e,renderDialog:t}){const s=Ia();return(0,P.jsx)(Da,{close:e,renderDialog:t,...s})}function Da({additionalPrompt:e,close:t,onSave:s=Na,saveEnabled:o,saveLabel:n=(0,ms.__)("Save"),renderDialog:i,dirtyEntityRecords:r,isDirty:a,setUnselectedEntities:l,unselectedEntities:d}){const h=(0,u.useRef)(),{saveDirtyEntities:m}=Xo((0,c.useDispatch)(Wi)),g=r.reduce(((e,t)=>{const{name:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e}),{}),{site:_,wp_template:f,wp_template_part:b,...y}=g,x=[_,f,b,...Object.values(y)].filter(Array.isArray),v=null!=o?o:a,w=(0,u.useCallback)((()=>t()),[t]),[S,k]=(0,p.__experimentalUseDialog)({onClose:()=>w()}),C=(0,p.useInstanceId)(Da,"label"),j=(0,p.useInstanceId)(Da,"description");return(0,P.jsxs)("div",{ref:S,...k,className:"entities-saved-states__panel",role:i?"dialog":void 0,"aria-labelledby":i?C:void 0,"aria-describedby":i?j:void 0,children:[(0,P.jsxs)(Ao.Flex,{className:"entities-saved-states__panel-header",gap:2,children:[(0,P.jsx)(Ao.FlexItem,{isBlock:!0,as:Ao.Button,variant:"secondary",size:"compact",onClick:w,children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.FlexItem,{isBlock:!0,as:Ao.Button,ref:h,variant:"primary",size:"compact",disabled:!v,accessibleWhenDisabled:!0,onClick:()=>m({onSave:s,dirtyEntityRecords:r,entitiesToSkip:d,close:t}),className:"editor-entities-saved-states__save-button",children:n})]}),(0,P.jsxs)("div",{className:"entities-saved-states__text-prompt",children:[(0,P.jsxs)("div",{className:"entities-saved-states__text-prompt--header-wrapper",id:i?C:void 0,children:[(0,P.jsx)("strong",{className:"entities-saved-states__text-prompt--header",children:(0,ms.__)("Are you ready to save?")}),e]}),(0,P.jsx)("p",{id:i?j:void 0,children:a?(0,u.createInterpolateElement)((0,ms.sprintf)((0,ms._n)("There is %d site change waiting to be saved.","There are %d site changes waiting to be saved.",x.length),x.length),{strong:(0,P.jsx)("strong",{})}):(0,ms.__)("Select the items you want to save.")})]}),x.map((e=>(0,P.jsx)(Ba,{list:e,unselectedEntities:d,setUnselectedEntities:l},e[0].name)))]})}function Ra(){try{return(0,c.select)(Wi).getEditedPostContent()}catch(e){}}function Ma({text:e,children:t}){const s=(0,p.useCopyToClipboard)(e);return(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"secondary",ref:s,children:t})}class Oa extends u.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,h.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){const{error:e}=this.state;if(!e)return this.props.children;const t=[(0,P.jsx)(Ma,{text:Ra,children:(0,ms.__)("Copy Post Text")},"copy-post"),(0,P.jsx)(Ma,{text:e.stack,children:(0,ms.__)("Copy Error")},"copy-error")];return(0,P.jsx)(m.Warning,{className:"editor-error-boundary",actions:t,children:(0,ms.__)("The editor has encountered an unexpected error.")})}}const La=Oa,Fa=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame;let Va;function za(){const{postId:e,isEditedPostNew:t,hasRemoteAutosave:s}=(0,c.useSelect)((e=>({postId:e(Wi).getCurrentPostId(),isEditedPostNew:e(Wi).isEditedPostNew(),hasRemoteAutosave:!!e(Wi).getEditorSettings().autosave})),[]),{getEditedPostAttribute:o}=(0,c.useSelect)(Wi),{createWarningNotice:n,removeNotice:i}=(0,c.useDispatch)(hs.store),{editPost:r,resetEditorBlocks:a}=(0,c.useDispatch)(Wi);(0,u.useEffect)((()=>{let l=function(e,t){return window.sessionStorage.getItem(gs(e,t))}(e,t);if(!l)return;try{l=JSON.parse(l)}catch{return}const{post_title:c,content:d,excerpt:u}=l,p={title:c,content:d,excerpt:u};if(!Object.keys(p).some((e=>p[e]!==o(e))))return void _s(e,t);if(s)return;const h="wpEditorAutosaveRestore";n((0,ms.__)("The backup of this post in your browser is different from the version below."),{id:h,actions:[{label:(0,ms.__)("Restore the backup"),onClick(){const{content:e,...t}=p;r(t),a((0,y.parse)(p.content)),i(h)}}]})}),[t,e])}const Ua=(0,p.ifCondition)((()=>{if(void 0!==Va)return Va;try{window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),Va=!0}catch{Va=!1}return Va}))((function(){const{autosave:e}=(0,c.useDispatch)(Wi),t=(0,u.useCallback)((()=>{Fa((()=>e({local:!0})))}),[]);za(),function(){const{postId:e,isEditedPostNew:t,isDirty:s,isAutosaving:o,didError:n}=(0,c.useSelect)((e=>({postId:e(Wi).getCurrentPostId(),isEditedPostNew:e(Wi).isEditedPostNew(),isDirty:e(Wi).isEditedPostDirty(),isAutosaving:e(Wi).isAutosavingPost(),didError:e(Wi).didPostSaveRequestFail()})),[]),i=(0,u.useRef)(s),r=(0,u.useRef)(o);(0,u.useEffect)((()=>{!n&&(r.current&&!o||i.current&&!s)&&_s(e,t),i.current=s,r.current=o}),[s,o,n]);const a=(0,p.usePrevious)(t),l=(0,p.usePrevious)(e);(0,u.useEffect)((()=>{l===e&&a&&!t&&_s(e,!0)}),[t,e])}();const s=(0,c.useSelect)((e=>e(Wi).getEditorSettings().localAutosaveInterval),[]);return(0,P.jsx)(Xr,{interval:s,autosave:t})}));const Ha=function({children:e}){const t=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi),{getPostType:s}=e(d.store),o=s(t("type"));return!!o?.supports?.["page-attributes"]}),[]);return t?e:null};const Ga=function({children:e,supportKeys:t}){const s=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi),{getPostType:s}=e(d.store);return s(t("type"))}),[]);let o=!!s;return s&&(o=(Array.isArray(t)?t:[t]).some((e=>!!s.supports[e]))),o?e:null};function $a(){const e=(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getEditedPostAttribute("menu_order"))&&void 0!==t?t:0}),[]),{editPost:t}=(0,c.useDispatch)(Wi),[s,o]=(0,u.useState)(null),n=null!=s?s:e;return(0,P.jsx)(Ao.Flex,{children:(0,P.jsx)(Ao.FlexBlock,{children:(0,P.jsx)(Ao.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,ms.__)("Order"),help:(0,ms.__)("Set the page order."),value:n,onChange:e=>{o(e);const s=Number(e);Number.isInteger(s)&&""!==e.trim?.()&&t({menu_order:s})},hideLabelFromVision:!0,onBlur:()=>{o(null)}})})})}function Wa(){return(0,P.jsx)(Ga,{supportKeys:"page-attributes",children:(0,P.jsx)($a,{})})}var Za=s(9681),Ya=s.n(Za);const Ka=(0,u.forwardRef)((({className:e,label:t,children:s},o)=>(0,P.jsxs)(Ao.__experimentalHStack,{className:rr("editor-post-panel__row",e),ref:o,children:[t&&(0,P.jsx)("div",{className:"editor-post-panel__row-label",children:t}),(0,P.jsx)("div",{className:"editor-post-panel__row-control",children:s})]})));function qa(e){const t=e.map((e=>({children:[],parent:null,...e})));if(t.some((({parent:e})=>null===e)))return t;const s=t.reduce(((e,t)=>{const{parent:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e}),{}),o=e=>e.map((e=>{const t=s[e.id];return{...e,children:t&&t.length?o(t):[]}}));return o(s[0]||[])}const Qa=e=>(0,No.decodeEntities)(e),Xa=e=>({...e,name:Qa(e.name)}),Ja=e=>(null!=e?e:[]).map(Xa);function el(e){return e?.title?.rendered?(0,No.decodeEntities)(e.title.rendered):`#${e.id} (${(0,ms.__)("no title")})`}const tl=(e,t)=>{const s=Ya()(e||"").toLowerCase(),o=Ya()(t||"").toLowerCase();return s===o?0:s.startsWith(o)?s.length:1/0};function sl(){const{editPost:e}=(0,c.useDispatch)(Wi),[t,s]=(0,u.useState)(!1),{isHierarchical:o,parentPostId:n,parentPostTitle:i,pageItems:r}=(0,c.useSelect)((e=>{var s;const{getPostType:o,getEntityRecords:n,getEntityRecord:i}=e(d.store),{getCurrentPostId:r,getEditedPostAttribute:a}=e(Wi),l=a("type"),c=a("parent"),u=o(l),p=r(),h=null!==(s=u?.hierarchical)&&void 0!==s&&s,m={per_page:100,exclude:p,parent_exclude:p,orderby:"menu_order",order:"asc",_fields:"id,title,parent"};t&&(m.search=t);const g=c?i("postType",l,c):null;return{isHierarchical:h,parentPostId:c,parentPostTitle:g?el(g):"",pageItems:h?n("postType",l,m):null}}),[t]),a=(0,u.useMemo)((()=>{const e=(s,o=0)=>{const n=s.map((t=>[{value:t.id,label:"— ".repeat(o)+(0,No.decodeEntities)(t.name),rawName:t.name},...e(t.children||[],o+1)])).sort((([e],[s])=>tl(e.rawName,t)>=tl(s.rawName,t)?1:-1));return n.flat()};if(!r)return[];let s=r.map((e=>({id:e.id,parent:e.parent,name:el(e)})));t||(s=qa(s));const o=e(s),a=o.find((e=>e.value===n));return i&&!a&&o.unshift({value:n,label:i}),o}),[r,t,i,n]);if(!o)return null;return(0,P.jsx)(Ao.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,className:"editor-page-attributes__parent",label:(0,ms.__)("Parent"),help:(0,ms.__)("Choose a parent page."),value:n,options:a,onFilterValueChange:(0,p.debounce)((e=>{s(e)}),300),onChange:t=>{e({parent:t})},hideLabelFromVision:!0})}function ol({isOpen:e,onClick:t}){const s=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi),s=t("parent");if(!s)return null;const{getEntityRecord:o}=e(d.store);return o("postType",t("type"),s)}),[]),o=(0,u.useMemo)((()=>s?el(s):(0,ms.__)("None")),[s]);return(0,P.jsx)(Ao.Button,{size:"compact",className:"editor-post-parent__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change parent: %s"),o),onClick:t,children:o})}function nl(){const e=(0,c.useSelect)((e=>e(d.store).getEntityRecord("root","__unstableBase")?.home),[]),[t,s]=(0,u.useState)(null),o=(0,u.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return(0,P.jsx)(Ka,{label:(0,ms.__)("Parent"),ref:s,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:o,className:"editor-post-parent__panel-dropdown",contentClassName:"editor-post-parent__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(ol,{isOpen:e,onClick:t}),renderContent:({onClose:t})=>(0,P.jsxs)("div",{className:"editor-post-parent",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Parent"),onClose:t}),(0,P.jsxs)("div",{children:[(0,u.createInterpolateElement)((0,ms.sprintf)((0,ms.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s/services/pricing.'),(0,v.filterURLForDisplay)(e).replace(/([/.])/g,"$1")),{wbr:(0,P.jsx)("wbr",{})}),(0,P.jsx)("p",{children:(0,u.createInterpolateElement)((0,ms.__)("They also show up as sub-items in the default navigation menu. Learn more."),{a:(0,P.jsx)(Ao.ExternalLink,{href:(0,ms.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes")})})})]}),(0,P.jsx)(sl,{})]})})})}const il=sl,rl="page-attributes";function al(){const{isEnabled:e,postType:t}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,isEditorPanelEnabled:s}=e(Wi),{getPostType:o}=e(d.store);return{isEnabled:s(rl),postType:o(t("type"))}}),[]);return e&&t?(0,P.jsx)(nl,{}):null}function ll(){return(0,P.jsx)(Ha,{children:(0,P.jsx)(al,{})})}const cl=(0,P.jsx)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)(k.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"})}),dl=(0,ms.__)("Custom Template");function ul({onClose:e}){const{defaultBlockTemplate:t,onNavigateToEntityRecord:s}=(0,c.useSelect)((e=>{const{getEditorSettings:t,getCurrentTemplateId:s}=e(Wi);return{defaultBlockTemplate:t().defaultBlockTemplate,onNavigateToEntityRecord:t().onNavigateToEntityRecord,getTemplateId:s}})),{createTemplate:o}=Xo((0,c.useDispatch)(Wi)),[n,i]=(0,u.useState)(""),[r,a]=(0,u.useState)(!1),l=()=>{i(""),e()};return(0,P.jsx)(Ao.Modal,{title:(0,ms.__)("Create custom template"),onRequestClose:l,focusOnMount:"firstContentElement",size:"small",children:(0,P.jsx)("form",{className:"editor-post-template__create-form",onSubmit:async e=>{if(e.preventDefault(),r)return;a(!0);const i=null!=t?t:(0,y.serialize)([(0,y.createBlock)("core/group",{tagName:"header",layout:{inherit:!0}},[(0,y.createBlock)("core/site-title"),(0,y.createBlock)("core/site-tagline")]),(0,y.createBlock)("core/separator"),(0,y.createBlock)("core/group",{tagName:"main"},[(0,y.createBlock)("core/group",{layout:{inherit:!0}},[(0,y.createBlock)("core/post-title")]),(0,y.createBlock)("core/post-content",{layout:{inherit:!0}})])]),c=await o({slug:(0,v.cleanForSlug)(n||dl),content:i,title:n||dl});a(!1),s({postId:c.id,postType:"wp_template"}),l()},children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:"3",children:[(0,P.jsx)(Ao.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,ms.__)("Name"),value:n,onChange:i,placeholder:dl,disabled:r,help:(0,ms.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,P.jsxs)(Ao.__experimentalHStack,{justify:"right",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:l,children:(0,ms.__)("Cancel")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,ms.__)("Create")})]})]})})})}function pl(){return(0,c.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPostType:s}=e(Wi);return{postId:t(),postType:s()}}),[])}function hl(){const{postType:e,postId:t}=pl();return(0,c.useSelect)((s=>{const{canUser:o,getEntityRecord:n,getEntityRecords:i}=s(d.store),r=o("read",{kind:"root",name:"site"})?n("root","site"):void 0,a=i("postType","wp_template",{per_page:-1}),l=+t===r?.page_for_posts,c="page"===e&&+t===r?.page_on_front&&a?.some((({slug:e})=>"front-page"===e));return!l&&!c}),[t,e])}function ml(e){return(0,c.useSelect)((t=>t(d.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:e})),[e])}function gl(e){const t=_l(),s=hl(),o=ml(e);return(0,u.useMemo)((()=>s&&o?.filter((e=>e.is_custom&&e.slug!==t&&!!e.content.raw))),[o,t,s])}function _l(){const{postType:e,postId:t}=pl(),s=ml(e),o=(0,c.useSelect)((s=>{const o=s(d.store).getEditedEntityRecord("postType",e,t);return o?.template}),[e,t]);if(o)return s?.find((e=>e.slug===o))?.slug}const fl={className:"editor-post-template__dropdown",placement:"bottom-start"};function bl({isOpen:e,onClick:t}){const s=(0,c.useSelect)((e=>{const t=e(Wi).getEditedPostAttribute("template"),{supportsTemplateMode:s,availableTemplates:o}=e(Wi).getEditorSettings();if(!s&&o[t])return o[t];const n=e(d.store).canUser("create",{kind:"postType",name:"wp_template"})&&e(Wi).getCurrentTemplateId();return n?.title||n?.slug||o?.[t]}),[]);return(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.__)("Template options"),onClick:t,children:null!=s?s:(0,ms.__)("Default template")})}function yl({onClose:e}){var t,s;const o=hl(),{availableTemplates:n,fetchedTemplates:i,selectedTemplateSlug:r,canCreate:a,canEdit:l,currentTemplateId:p,onNavigateToEntityRecord:h,getEditorSettings:g}=(0,c.useSelect)((e=>{const{canUser:t,getEntityRecords:s}=e(d.store),n=e(Wi).getEditorSettings(),i=t("create",{kind:"postType",name:"wp_template"}),r=e(Wi).getCurrentTemplateId();return{availableTemplates:n.availableTemplates,fetchedTemplates:i?s("postType","wp_template",{post_type:e(Wi).getCurrentPostType(),per_page:-1}):void 0,selectedTemplateSlug:e(Wi).getEditedPostAttribute("template"),canCreate:o&&i&&n.supportsTemplateMode,canEdit:o&&i&&n.supportsTemplateMode&&!!r,currentTemplateId:r,onNavigateToEntityRecord:n.onNavigateToEntityRecord,getEditorSettings:e(Wi).getEditorSettings}}),[o]),_=(0,u.useMemo)((()=>Object.entries({...n,...Object.fromEntries((null!=i?i:[]).map((({slug:e,title:t})=>[e,t.rendered])))}).map((([e,t])=>({value:e,label:t})))),[n,i]),f=null!==(t=_.find((e=>e.value===r)))&&void 0!==t?t:_.find((e=>!e.value)),{editPost:b}=(0,c.useDispatch)(Wi),{createSuccessNotice:y}=(0,c.useDispatch)(hs.store),[x,v]=(0,u.useState)(!1);return(0,P.jsxs)("div",{className:"editor-post-template__classic-theme-dropdown",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Template"),help:(0,ms.__)("Templates define the way content is displayed when viewing your site."),actions:a?[{icon:cl,label:(0,ms.__)("Add template"),onClick:()=>v(!0)}]:[],onClose:e}),o?(0,P.jsx)(Ao.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,ms.__)("Template"),value:null!==(s=f?.value)&&void 0!==s?s:"",options:_,onChange:e=>b({template:e||""})}):(0,P.jsx)(Ao.Notice,{status:"warning",isDismissible:!1,children:(0,ms.__)("The posts page template cannot be changed.")}),l&&h&&(0,P.jsx)("p",{children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!1,variant:"link",onClick:()=>{h({postId:p,postType:"wp_template"}),e(),y((0,ms.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:[{label:(0,ms.__)("Go back"),onClick:()=>g().onNavigateToPreviousEntityRecord()}]})},children:(0,ms.__)("Edit template")})}),x&&(0,P.jsx)(ul,{onClose:()=>v(!1)})]})}const xl=function(){return(0,P.jsx)(Ao.Dropdown,{popoverProps:fl,focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(bl,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,P.jsx)(yl,{onClose:e})})},{PreferenceBaseOption:vl}=(window.wp.warning,Xo(j.privateApis)),wl=(0,p.compose)((0,c.withSelect)(((e,{panelName:t})=>{const{isEditorPanelEnabled:s,isEditorPanelRemoved:o}=e(Wi);return{isRemoved:o(t),isChecked:s(t)}})),(0,p.ifCondition)((({isRemoved:e})=>!e)),(0,c.withDispatch)(((e,{panelName:t})=>({onChange:()=>e(Wi).toggleEditorPanelEnabled(t)}))))(vl),{Fill:Sl,Slot:kl}=(0,Ao.createSlotFill)("EnablePluginDocumentSettingPanelOption"),Pl=({label:e,panelName:t})=>(0,P.jsx)(Sl,{children:(0,P.jsx)(wl,{label:e,panelName:t})});Pl.Slot=kl;const Cl=Pl,{Fill:jl,Slot:El}=(0,Ao.createSlotFill)("PluginDocumentSettingPanel"),Tl=({name:e,className:t,title:s,icon:o,children:n})=>{const{name:i}=(0,Tr.usePluginContext)(),r=`${i}/${e}`,{opened:a,isEnabled:l}=(0,c.useSelect)((e=>{const{isEditorPanelOpened:t,isEditorPanelEnabled:s}=e(Wi);return{opened:t(r),isEnabled:s(r)}}),[r]),{toggleEditorPanelOpened:d}=(0,c.useDispatch)(Wi);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Cl,{label:s,panelName:r}),(0,P.jsx)(jl,{children:l&&(0,P.jsx)(Ao.PanelBody,{className:t,title:s,icon:o,opened:a,onToggle:()=>d(r),children:n})})]})};Tl.Slot=El;const Bl=Tl,Il=({allowedBlocks:e,icon:t,label:s,onClick:o,small:n,role:i})=>(0,P.jsx)(m.BlockSettingsMenuControls,{children:({selectedBlocks:r,onClose:a})=>((e,t)=>{return!Array.isArray(t)||(s=t,0===e.filter((e=>!s.includes(e))).length);var s})(r,e)?(0,P.jsx)(Ao.MenuItem,{onClick:(0,p.compose)(o,a),icon:t,label:n?s:void 0,role:i,children:!n&&s}):null}),Nl=(0,p.compose)((0,Tr.withPluginContext)(((e,t)=>{var s;return{as:null!==(s=t.as)&&void 0!==s?s:Ao.MenuItem,icon:t.icon||e.icon,name:"core/plugin-more-menu"}})))(Rr),{Fill:Al,Slot:Dl}=(0,Ao.createSlotFill)("PluginPostPublishPanel"),Rl=({children:e,className:t,title:s,initialOpen:o=!1,icon:n})=>{const{icon:i}=(0,Tr.usePluginContext)();return(0,P.jsx)(Al,{children:(0,P.jsx)(Ao.PanelBody,{className:t,initialOpen:o||!s,title:s,icon:null!=n?n:i,children:e})})};Rl.Slot=Dl;const Ml=Rl,{Fill:Ol,Slot:Ll}=(0,Ao.createSlotFill)("PluginPostStatusInfo"),Fl=({children:e,className:t})=>(0,P.jsx)(Ol,{children:(0,P.jsx)(Ao.PanelRow,{className:t,children:e})});Fl.Slot=Ll;const Vl=Fl,{Fill:zl,Slot:Ul}=(0,Ao.createSlotFill)("PluginPrePublishPanel"),Hl=({children:e,className:t,title:s,initialOpen:o=!1,icon:n})=>{const{icon:i}=(0,Tr.usePluginContext)();return(0,P.jsx)(zl,{children:(0,P.jsx)(Ao.PanelBody,{className:t,initialOpen:o||!s,title:s,icon:null!=n?n:i,children:e})})};Hl.Slot=Ul;const Gl=Hl,$l=(0,p.compose)((0,Tr.withPluginContext)(((e,t)=>{var s;return{as:null!==(s=t.as)&&void 0!==s?s:Ao.MenuItem,icon:t.icon||e.icon,name:"core/plugin-preview-menu"}})))(Rr);function Wl({className:e,...t}){const{postTitle:s}=(0,c.useSelect)((e=>({postTitle:e(Wi).getEditedPostAttribute("title")})),[]);return(0,P.jsx)(Hr,{panelClassName:e,className:"editor-sidebar",smallScreenTitle:s||(0,ms.__)("(no title)"),scope:"core",...t})}function Zl(e){return(0,P.jsx)(Or,{__unstableExplicitMenuItem:!0,scope:"core",...e})}function Yl({onClick:e}){const[t,s]=(0,u.useState)(!1),{postType:o,postId:n}=pl(),i=gl(o),{editEntityRecord:r}=(0,c.useDispatch)(d.store);if(!i?.length)return null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.MenuItem,{onClick:()=>s(!0),children:(0,ms.__)("Swap template")}),t&&(0,P.jsx)(Ao.Modal,{title:(0,ms.__)("Choose a template"),onRequestClose:()=>s(!1),overlayClassName:"editor-post-template__swap-template-modal",isFullScreen:!0,children:(0,P.jsx)("div",{className:"editor-post-template__swap-template-modal-content",children:(0,P.jsx)(Kl,{postType:o,onSelect:async t=>{r("postType",o,n,{template:t.name},{undoIgnore:!0}),s(!1),e()}})})})]})}function Kl({postType:e,onSelect:t}){const s=gl(e),o=(0,u.useMemo)((()=>s.map((e=>({name:e.slug,blocks:(0,y.parse)(e.content.raw),title:(0,No.decodeEntities)(e.title.rendered),id:e.id})))),[s]),n=(0,p.useAsyncList)(o);return(0,P.jsx)(m.__experimentalBlockPatternsList,{label:(0,ms.__)("Templates"),blockPatterns:o,shownPatterns:n,onClickPattern:t})}function ql({onClick:e}){const t=_l(),s=hl(),{postType:o,postId:n}=pl(),{editEntityRecord:i}=(0,c.useDispatch)(d.store);return t&&s?(0,P.jsx)(Ao.MenuItem,{onClick:()=>{i("postType",o,n,{template:""},{undoIgnore:!0}),e()},children:(0,ms.__)("Use default template")}):null}function Ql({onClick:e}){const{canCreateTemplates:t}=(0,c.useSelect)((e=>{const{canUser:t}=e(d.store);return{canCreateTemplates:t("create",{kind:"postType",name:"wp_template"})}}),[]),[s,o]=(0,u.useState)(!1),n=hl();return t&&n?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.MenuItem,{onClick:()=>{o(!0)},children:(0,ms.__)("Create new template")}),s&&(0,P.jsx)(ul,{onClose:()=>{o(!1),e()}})]}):null}const Xl={className:"editor-post-template__dropdown",placement:"bottom-start"};function Jl({id:e}){const{isTemplateHidden:t,onNavigateToEntityRecord:s,getEditorSettings:o,hasGoBack:n}=(0,c.useSelect)((e=>{const{getRenderingMode:t,getEditorSettings:s}=Xo(e(Wi)),o=s();return{isTemplateHidden:"post-only"===t(),onNavigateToEntityRecord:o.onNavigateToEntityRecord,getEditorSettings:s,hasGoBack:o.hasOwnProperty("onNavigateToPreviousEntityRecord")}}),[]),{get:i}=(0,c.useSelect)(j.store),{editedRecord:r,hasResolved:a}=(0,d.useEntityRecord)("postType","wp_template",e),{createSuccessNotice:l}=(0,c.useDispatch)(hs.store),{setRenderingMode:u}=(0,c.useDispatch)(Wi),p=(0,c.useSelect)((e=>!!e(d.store).canUser("create",{kind:"postType",name:"wp_template"})),[]);if(!a)return null;const h=n?[{label:(0,ms.__)("Go back"),onClick:()=>o().onNavigateToPreviousEntityRecord()}]:void 0;return(0,P.jsx)(Ao.DropdownMenu,{popoverProps:Xl,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},label:(0,ms.__)("Template options"),text:(0,No.decodeEntities)(r.title),icon:null,children:({onClose:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Ao.MenuGroup,{children:[p&&(0,P.jsx)(Ao.MenuItem,{onClick:()=>{s({postId:r.id,postType:"wp_template"}),e(),i("core/edit-site","welcomeGuideTemplate")||l((0,ms.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:h})},children:(0,ms.__)("Edit template")}),(0,P.jsx)(Yl,{onClick:e}),(0,P.jsx)(ql,{onClick:e}),p&&(0,P.jsx)(Ql,{onClick:e})]}),(0,P.jsx)(Ao.MenuGroup,{children:(0,P.jsx)(Ao.MenuItem,{icon:t?void 0:Do,isSelected:!t,role:"menuitemcheckbox",onClick:()=>{u(t?"template-locked":"post-only")},children:(0,ms.__)("Show template")})})]})})}function ec(){const{templateId:e,isBlockTheme:t}=(0,c.useSelect)((e=>{const{getCurrentTemplateId:t,getEditorSettings:s}=e(Wi);return{templateId:t(),isBlockTheme:s().__unstableIsBlockBasedTheme}}),[]),s=(0,c.useSelect)((e=>{var t;const s=e(Wi).getCurrentPostType(),o=e(d.store).getPostType(s);if(!o?.viewable)return!1;const n=e(Wi).getEditorSettings();if(!!n.availableTemplates&&Object.keys(n.availableTemplates).length>0)return!0;if(!n.supportsTemplateMode)return!1;return null!==(t=e(d.store).canUser("create",{kind:"postType",name:"wp_template"}))&&void 0!==t&&t}),[]),o=(0,c.useSelect)((e=>{var t;return null!==(t=e(d.store).canUser("read",{kind:"postType",name:"wp_template"}))&&void 0!==t&&t}),[]);return t&&o||!s?t&&e?(0,P.jsx)(Ka,{label:(0,ms.__)("Template"),children:(0,P.jsx)(Jl,{id:e})}):null:(0,P.jsx)(Ka,{label:(0,ms.__)("Template"),children:(0,P.jsx)(xl,{})})}const tc={_fields:"id,name",context:"view"},sc={who:"authors",per_page:50,...tc};function oc(e){const{authorId:t,authors:s,postAuthor:o}=(0,c.useSelect)((t=>{const{getUser:s,getUsers:o}=t(d.store),{getEditedPostAttribute:n}=t(Wi),i=n("author"),r={...sc};return e&&(r.search=e),{authorId:i,authors:o(r),postAuthor:s(i,tc)}}),[e]);return{authorId:t,authorOptions:(0,u.useMemo)((()=>{const e=(null!=s?s:[]).map((e=>({value:e.id,label:(0,No.decodeEntities)(e.name)}))),t=e.findIndex((({value:e})=>o?.id===e));let n=[];return t<0&&o?n=[{value:o.id,label:(0,No.decodeEntities)(o.name)}]:t<0&&!o&&(n=[{value:0,label:(0,ms.__)("(No author)")}]),[...n,...e]}),[s,o]),postAuthor:o}}function nc(){const[e,t]=(0,u.useState)(),{editPost:s}=(0,c.useDispatch)(Wi),{authorId:o,authorOptions:n}=oc(e);return(0,P.jsx)(Ao.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,ms.__)("Author"),options:n,value:o,onFilterValueChange:(0,p.debounce)((e=>{t(e)}),300),onChange:e=>{e&&s({author:e})},allowReset:!1,hideLabelFromVision:!0})}function ic(){const{editPost:e}=(0,c.useDispatch)(Wi),{authorId:t,authorOptions:s}=oc();return(0,P.jsx)(Ao.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"post-author-selector",label:(0,ms.__)("Author"),options:s,onChange:t=>{const s=Number(t);e({author:s})},value:t,hideLabelFromVision:!0})}const rc=function(){return(0,c.useSelect)((e=>{const t=e(d.store).getUsers(sc);return t?.length>=25}),[])?(0,P.jsx)(nc,{}):(0,P.jsx)(ic,{})};function ac({children:e}){const{hasAssignAuthorAction:t,hasAuthors:s}=(0,c.useSelect)((e=>{var t;const s=e(Wi).getCurrentPost(),o=e(d.store).getUsers(sc);return{hasAssignAuthorAction:null!==(t=s._links?.["wp:action-assign-author"])&&void 0!==t&&t,hasAuthors:o?.length>=1}}),[]);return t&&s?(0,P.jsx)(Ga,{supportKeys:"author",children:e}):null}function lc({isOpen:e,onClick:t}){const{postAuthor:s}=oc(),o=(0,No.decodeEntities)(s?.name)||(0,ms.__)("(No author)");return(0,P.jsx)(Ao.Button,{size:"compact",className:"editor-post-author__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change author: %s"),o),onClick:t,children:o})}const cc=function(){const[e,t]=(0,u.useState)(null),s=(0,u.useMemo)((()=>({anchor:e,placement:"left-start",offset:36,shift:!0})),[e]);return(0,P.jsx)(ac,{children:(0,P.jsx)(Ka,{label:(0,ms.__)("Author"),ref:t,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:s,contentClassName:"editor-post-author__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(lc,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,P.jsxs)("div",{className:"editor-post-author",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Author"),onClose:e}),(0,P.jsx)(rc,{onClose:e})]})})})})},dc=[{label:(0,ms._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,ms.__)("Visitors can add new comments and replies.")},{label:(0,ms.__)("Closed"),value:"closed",description:[(0,ms.__)("Visitors cannot add new comments or replies."),(0,ms.__)("Existing comments remain visible.")].join(" ")}];const uc=function(){const e=(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getEditedPostAttribute("comment_status"))&&void 0!==t?t:"open"}),[]),{editPost:t}=(0,c.useDispatch)(Wi);return(0,P.jsx)("form",{children:(0,P.jsx)(Ao.__experimentalVStack,{spacing:4,children:(0,P.jsx)(Ao.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,ms.__)("Comment status"),options:dc,onChange:e=>t({comment_status:e}),selected:e})})})};const pc=function(){const e=(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getEditedPostAttribute("ping_status"))&&void 0!==t?t:"open"}),[]),{editPost:t}=(0,c.useDispatch)(Wi);return(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Enable pingbacks & trackbacks"),checked:"open"===e,onChange:()=>t({ping_status:"open"===e?"closed":"open"}),help:(0,P.jsx)(Ao.ExternalLink,{href:(0,ms.__)("https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"),children:(0,ms.__)("Learn more about pingbacks & trackbacks")})})},hc="discussion-panel";function mc({onClose:e}){return(0,P.jsxs)("div",{className:"editor-post-discussion",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Discussion"),onClose:e}),(0,P.jsxs)(Ao.__experimentalVStack,{spacing:4,children:[(0,P.jsx)(Ga,{supportKeys:"comments",children:(0,P.jsx)(uc,{})}),(0,P.jsx)(Ga,{supportKeys:"trackbacks",children:(0,P.jsx)(pc,{})})]})]})}function gc({isOpen:e,onClick:t}){const{commentStatus:s,pingStatus:o,commentsSupported:n,trackbacksSupported:i}=(0,c.useSelect)((e=>{var t,s;const{getEditedPostAttribute:o}=e(Wi),{getPostType:n}=e(d.store),i=n(o("type"));return{commentStatus:null!==(t=o("comment_status"))&&void 0!==t?t:"open",pingStatus:null!==(s=o("ping_status"))&&void 0!==s?s:"open",commentsSupported:!!i.supports.comments,trackbacksSupported:!!i.supports.trackbacks}}),[]);let r;return r="open"===s?"open"===o?(0,ms._x)("Open",'Adjective: e.g. "Comments are open"'):i?(0,ms.__)("Comments only"):(0,ms._x)("Open",'Adjective: e.g. "Comments are open"'):"open"===o?n?(0,ms.__)("Pings only"):(0,ms.__)("Pings enabled"):(0,ms.__)("Closed"),(0,P.jsx)(Ao.Button,{size:"compact",className:"editor-post-discussion__panel-toggle",variant:"tertiary","aria-label":(0,ms.__)("Change discussion options"),"aria-expanded":e,onClick:t,children:r})}function _c(){const{isEnabled:e}=(0,c.useSelect)((e=>{const{isEditorPanelEnabled:t}=e(Wi);return{isEnabled:t(hc)}}),[]),[t,s]=(0,u.useState)(null),o=(0,u.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return e?(0,P.jsx)(Ga,{supportKeys:["comments","trackbacks"],children:(0,P.jsx)(Ka,{label:(0,ms.__)("Discussion"),ref:s,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:o,className:"editor-post-discussion__panel-dropdown",contentClassName:"editor-post-discussion__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(gc,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,P.jsx)(mc,{onClose:e})})})}):null}function fc({hideLabelFromVision:e=!1,updateOnBlur:t=!1}){const{excerpt:s,shouldUseDescriptionLabel:o,usedAttribute:n}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getEditedPostAttribute:s}=e(Wi),o=t(),n=["wp_template","wp_template_part"].includes(o)?"description":"excerpt";return{excerpt:s(n),shouldUseDescriptionLabel:["wp_template","wp_template_part","wp_block"].includes(o),usedAttribute:n}}),[]),{editPost:i}=(0,c.useDispatch)(Wi),[r,a]=(0,u.useState)((0,No.decodeEntities)(s)),l=e=>{i({[n]:e})},d=o?(0,ms.__)("Write a description (optional)"):(0,ms.__)("Write an excerpt (optional)");return(0,P.jsx)("div",{className:"editor-post-excerpt",children:(0,P.jsx)(Ao.TextareaControl,{__nextHasNoMarginBottom:!0,label:d,hideLabelFromVision:e,className:"editor-post-excerpt__textarea",onChange:t?a:l,onBlur:t?()=>l(r):void 0,value:t?r:s,help:o?(0,ms.__)("Write a description"):(0,P.jsx)(Ao.ExternalLink,{href:(0,ms.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt"),children:(0,ms.__)("Learn more about manual excerpts")})})})}const bc=function({children:e}){return(0,P.jsx)(Ga,{supportKeys:"excerpt",children:e})},{Fill:yc,Slot:xc}=(0,Ao.createSlotFill)("PluginPostExcerpt"),vc=({children:e,className:t})=>(0,P.jsx)(yc,{children:(0,P.jsx)(Ao.PanelRow,{className:t,children:e})});vc.Slot=xc;const wc=vc,Sc="post-excerpt";function kc(){const{isOpened:e,isEnabled:t,postType:s}=(0,c.useSelect)((e=>{const{isEditorPanelOpened:t,isEditorPanelEnabled:s,getCurrentPostType:o}=e(Wi);return{isOpened:t(Sc),isEnabled:s(Sc),postType:o()}}),[]),{toggleEditorPanelOpened:o}=(0,c.useDispatch)(Wi);if(!t)return null;const n=["wp_template","wp_template_part","wp_block"].includes(s);return(0,P.jsx)(Ao.PanelBody,{title:n?(0,ms.__)("Description"):(0,ms.__)("Excerpt"),opened:e,onToggle:()=>o(Sc),children:(0,P.jsx)(wc.Slot,{children:e=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(fc,{}),e]})})})}function Pc(){return(0,P.jsx)(bc,{children:(0,P.jsx)(kc,{})})}function Cc(){return(0,P.jsx)(bc,{children:(0,P.jsx)(jc,{})})}function jc(){const{shouldRender:e,excerpt:t,shouldBeUsedAsDescription:s,allowEditing:o}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s,getEditedPostAttribute:o,isEditorPanelEnabled:n}=e(Wi),i=t(),r=["wp_template","wp_template_part"].includes(i),a="wp_block"===i,l=r||a,c=r?"description":"excerpt",u=r&&e(d.store).getEntityRecord("postType",i,s()),p=n(Sc)||l;return{excerpt:o(c),shouldRender:p,shouldBeUsedAsDescription:l,allowEditing:p&&(!l||a||u&&u.source===L&&!u.has_theme_file&&u.is_custom)}}),[]),[n,i]=(0,u.useState)(null),r=s?(0,ms.__)("Description"):(0,ms.__)("Excerpt"),a=(0,u.useMemo)((()=>({anchor:n,"aria-label":r,headerTitle:r,placement:"left-start",offset:36,shift:!0})),[n,r]);if(!e)return!1;const l=!!t&&(0,P.jsx)(Ao.__experimentalText,{align:"left",numberOfLines:4,truncate:o,children:(0,No.decodeEntities)(t)});if(!o)return l;const p=s?(0,ms.__)("Add a description…"):(0,ms.__)("Add an excerpt…"),h=s?(0,ms.__)("Edit description"):(0,ms.__)("Edit excerpt");return(0,P.jsxs)(Ao.__experimentalVStack,{children:[l,(0,P.jsx)(Ao.Dropdown,{className:"editor-post-excerpt__dropdown",contentClassName:"editor-post-excerpt__dropdown__content",popoverProps:a,focusOnMount:!0,ref:i,renderToggle:({onToggle:e})=>(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,onClick:e,variant:"link",children:l?h:p}),renderContent:({onClose:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:r,onClose:e}),(0,P.jsx)(Ao.__experimentalVStack,{spacing:4,children:(0,P.jsx)(wc.Slot,{children:e=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(fc,{hideLabelFromVision:!0,updateOnBlur:!0}),e]})})})]})})]})}function Ec({children:e,supportKeys:t}){const{postType:s,themeSupports:o}=(0,c.useSelect)((e=>({postType:e(Wi).getEditedPostAttribute("type"),themeSupports:e(d.store).getThemeSupports()})),[]);return(Array.isArray(t)?t:[t]).some((e=>{var t;const n=null!==(t=o?.[e])&&void 0!==t&&t;return"post-thumbnails"===e&&Array.isArray(n)?n.includes(s):n}))?e:null}const Tc=function({children:e}){return(0,P.jsx)(Ec,{supportKeys:"post-thumbnails",children:(0,P.jsx)(Ga,{supportKeys:"thumbnail",children:e})})},Bc=["image"],Ic=(0,ms.__)("Featured image"),Nc=(0,ms.__)("Add a featured image"),Ac=(0,P.jsx)("p",{children:(0,ms.__)("To edit the featured image, you need permission to upload media.")});const Dc=(0,c.withSelect)((e=>{const{getMedia:t,getPostType:s}=e(d.store),{getCurrentPostId:o,getEditedPostAttribute:n}=e(Wi),i=n("featured_media");return{media:i?t(i,{context:"view"}):null,currentPostId:o(),postType:s(n("type")),featuredImageId:i}})),Rc=(0,c.withDispatch)(((e,{noticeOperations:t},{select:s})=>{const{editPost:o}=e(Wi);return{onUpdateImage(e){o({featured_media:e.id})},onDropImage(e){s(m.store).getSettings().mediaUpload({allowedTypes:["image"],filesList:e,onFileChange([e]){o({featured_media:e.id})},onError(e){t.removeAllNotices(),t.createErrorNotice(e)}})},onRemoveImage(){o({featured_media:0})}}})),Mc=(0,p.compose)(Ao.withNotices,Dc,Rc,(0,Ao.withFilters)("editor.PostFeaturedImage"))((function({currentPostId:e,featuredImageId:t,onUpdateImage:s,onRemoveImage:o,media:n,postType:i,noticeUI:r,noticeOperations:a}){const l=(0,u.useRef)(),[d,p]=(0,u.useState)(!1),{getSettings:g}=(0,c.useSelect)(m.store),{mediaSourceUrl:_}=function(e,t){var s,o;if(!e)return{};const n=(0,h.applyFilters)("editor.PostFeaturedImage.imageSize","large",e.id,t);if(n in(null!==(s=e?.media_details?.sizes)&&void 0!==s?s:{}))return{mediaWidth:e.media_details.sizes[n].width,mediaHeight:e.media_details.sizes[n].height,mediaSourceUrl:e.media_details.sizes[n].source_url};const i=(0,h.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",e.id,t);return i in(null!==(o=e?.media_details?.sizes)&&void 0!==o?o:{})?{mediaWidth:e.media_details.sizes[i].width,mediaHeight:e.media_details.sizes[i].height,mediaSourceUrl:e.media_details.sizes[i].source_url}:{mediaWidth:e.media_details.width,mediaHeight:e.media_details.height,mediaSourceUrl:e.source_url}}(n,e);function f(e){g().mediaUpload({allowedTypes:Bc,filesList:e,onFileChange([e]){(0,ii.isBlobURL)(e?.url)?p(!0):(e&&s(e),p(!1))},onError(e){a.removeAllNotices(),a.createErrorNotice(e)}})}return(0,P.jsxs)(Tc,{children:[r,(0,P.jsxs)("div",{className:"editor-post-featured-image",children:[n&&(0,P.jsxs)("div",{id:`editor-post-featured-image-${t}-describedby`,className:"hidden",children:[n.alt_text&&(0,ms.sprintf)((0,ms.__)("Current image: %s"),n.alt_text),!n.alt_text&&(0,ms.sprintf)((0,ms.__)("The current image has no alternative text. The file name is: %s"),n.media_details.sizes?.full?.file||n.slug)]}),(0,P.jsx)(m.MediaUploadCheck,{fallback:Ac,children:(0,P.jsx)(m.MediaUpload,{title:i?.labels?.featured_image||Ic,onSelect:s,unstableFeaturedImageFlow:!0,allowedTypes:Bc,modalClass:"editor-post-featured-image__media-modal",render:({open:e})=>(0,P.jsxs)("div",{className:"editor-post-featured-image__container",children:[(0,P.jsxs)(Ao.Button,{__next40pxDefaultSize:!0,ref:l,className:t?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:e,"aria-label":t?(0,ms.__)("Edit or replace the featured image"):null,"aria-describedby":t?`editor-post-featured-image-${t}-describedby`:null,"aria-haspopup":"dialog",disabled:d,accessibleWhenDisabled:!0,children:[!!t&&n&&(0,P.jsx)("img",{className:"editor-post-featured-image__preview-image",src:_,alt:""}),d&&(0,P.jsx)(Ao.Spinner,{}),!t&&!d&&(i?.labels?.set_featured_image||Nc)]}),!!t&&(0,P.jsxs)(Ao.__experimentalHStack,{className:"editor-post-featured-image__actions",children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:e,"aria-haspopup":"dialog",children:(0,ms.__)("Replace")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:()=>{o(),l.current.focus()},children:(0,ms.__)("Remove")})]}),(0,P.jsx)(Ao.DropZone,{onFilesDrop:f})]}),value:t})})]})]})})),Oc="featured-image";function Lc({withPanelBody:e=!0}){var t;const{postType:s,isEnabled:o,isOpened:n}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,isEditorPanelEnabled:s,isEditorPanelOpened:o}=e(Wi),{getPostType:n}=e(d.store);return{postType:n(t("type")),isEnabled:s(Oc),isOpened:o(Oc)}}),[]),{toggleEditorPanelOpened:i}=(0,c.useDispatch)(Wi);return o?e?(0,P.jsx)(Tc,{children:(0,P.jsx)(Ao.PanelBody,{title:null!==(t=s?.labels?.featured_image)&&void 0!==t?t:(0,ms.__)("Featured image"),opened:n,onToggle:()=>i(Oc),children:(0,P.jsx)(Mc,{})})}):(0,P.jsx)(Tc,{children:(0,P.jsx)(Mc,{})}):null}const Fc=function({children:e}){return(0,c.useSelect)((e=>e(Wi).getEditorSettings().disablePostFormats),[])?null:(0,P.jsx)(Ga,{supportKeys:"post-formats",children:e})},Vc=[{id:"aside",caption:(0,ms.__)("Aside")},{id:"audio",caption:(0,ms.__)("Audio")},{id:"chat",caption:(0,ms.__)("Chat")},{id:"gallery",caption:(0,ms.__)("Gallery")},{id:"image",caption:(0,ms.__)("Image")},{id:"link",caption:(0,ms.__)("Link")},{id:"quote",caption:(0,ms.__)("Quote")},{id:"standard",caption:(0,ms.__)("Standard")},{id:"status",caption:(0,ms.__)("Status")},{id:"video",caption:(0,ms.__)("Video")}].sort(((e,t)=>{const s=e.caption.toUpperCase(),o=t.caption.toUpperCase();return so?1:0}));function zc(){const e=`post-format-selector-${(0,p.useInstanceId)(zc)}`,{postFormat:t,suggestedFormat:s,supportedFormats:o}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:s}=e(Wi),o=t("format"),n=e(d.store).getThemeSupports();return{postFormat:null!=o?o:"standard",suggestedFormat:s(),supportedFormats:n.formats}}),[]),n=Vc.filter((e=>o?.includes(e.id)||t===e.id)),i=n.find((e=>e.id===s)),{editPost:r}=(0,c.useDispatch)(Wi),a=e=>r({format:e});return(0,P.jsx)(Fc,{children:(0,P.jsxs)("div",{className:"editor-post-format",children:[(0,P.jsx)(Ao.RadioControl,{className:"editor-post-format__options",label:(0,ms.__)("Post Format"),selected:t,onChange:e=>a(e),id:e,options:n.map((e=>({label:e.caption,value:e.id}))),hideLabelFromVision:!0}),i&&i.id!==t&&(0,P.jsx)("p",{className:"editor-post-format__suggestion",children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>a(i.id),children:(0,ms.sprintf)((0,ms.__)("Apply suggested format: %s"),i.caption)})})]})})}const Uc=function({children:e}){const{lastRevisionId:t,revisionsCount:s}=(0,c.useSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:s}=e(Wi);return{lastRevisionId:t(),revisionsCount:s()}}),[]);return!t||s<2?null:(0,P.jsx)(Ga,{supportKeys:"revisions",children:e})};function Hc(){return(0,c.useSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:s}=e(Wi);return{lastRevisionId:t(),revisionsCount:s()}}),[])}function Gc(){const{lastRevisionId:e,revisionsCount:t}=Hc();return(0,P.jsx)(Uc,{children:(0,P.jsx)(Ka,{label:(0,ms.__)("Revisions"),children:(0,P.jsx)(Ao.Button,{href:(0,v.addQueryArgs)("revision.php",{revision:e}),className:"editor-private-post-last-revision__button",text:t,variant:"tertiary",size:"compact"})})})}const $c=function(){const{lastRevisionId:e,revisionsCount:t}=Hc();return(0,P.jsx)(Uc,{children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,href:(0,v.addQueryArgs)("revision.php",{revision:e}),className:"editor-post-last-revision__title",icon:Ko,iconPosition:"right",text:(0,ms.sprintf)((0,ms.__)("Revisions (%s)"),t)})})};const Wc=function(){return(0,P.jsx)(Uc,{children:(0,P.jsx)(Ao.PanelBody,{className:"editor-post-last-revision__panel",children:(0,P.jsx)($c,{})})})};function Zc(){const e="core/editor/post-locked-modal-"+(0,p.useInstanceId)(Zc),{autosave:t,updatePostLock:s}=(0,c.useDispatch)(Wi),{isLocked:o,isTakeover:n,user:i,postId:r,postLockUtils:a,activePostLock:l,postType:m,previewLink:g}=(0,c.useSelect)((e=>{const{isPostLocked:t,isPostLockTakeover:s,getPostLockUser:o,getCurrentPostId:n,getActivePostLock:i,getEditedPostAttribute:r,getEditedPostPreviewLink:a,getEditorSettings:l}=e(Wi),{getPostType:c}=e(d.store);return{isLocked:t(),isTakeover:s(),user:o(),postId:n(),postLockUtils:l().postLockUtils,activePostLock:i(),postType:c(r("type")),previewLink:a()}}),[]);if((0,u.useEffect)((()=>{function n(){if(o||!l)return;const e=new window.FormData;if(e.append("action","wp-remove-post-lock"),e.append("_wpnonce",a.unlockNonce),e.append("post_ID",r),e.append("active_post_lock",l),window.navigator.sendBeacon)window.navigator.sendBeacon(a.ajaxUrl,e);else{const t=new window.XMLHttpRequest;t.open("POST",a.ajaxUrl,!1),t.send(e)}}return(0,h.addAction)("heartbeat.send",e,(function(e){o||(e["wp-refresh-post-lock"]={lock:l,post_id:r})})),(0,h.addAction)("heartbeat.tick",e,(function(e){if(!e["wp-refresh-post-lock"])return;const o=e["wp-refresh-post-lock"];o.lock_error?(t(),s({isLocked:!0,isTakeover:!0,user:{name:o.lock_error.name,avatar:o.lock_error.avatar_src_2x}})):o.new_lock&&s({isLocked:!1,activePostLock:o.new_lock})})),window.addEventListener("beforeunload",n),()=>{(0,h.removeAction)("heartbeat.send",e),(0,h.removeAction)("heartbeat.tick",e),window.removeEventListener("beforeunload",n)}}),[]),!o)return null;const _=i.name,f=i.avatar,b=(0,v.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:r,action:"edit",_wpnonce:a.nonce}),y=(0,v.addQueryArgs)("edit.php",{post_type:m?.slug}),x=(0,ms.__)("Exit editor");return(0,P.jsx)(Ao.Modal,{title:n?(0,ms.__)("Someone else has taken over this post"):(0,ms.__)("This post is already being edited"),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal",size:"medium",children:(0,P.jsxs)(Ao.__experimentalHStack,{alignment:"top",spacing:6,children:[!!f&&(0,P.jsx)("img",{src:f,alt:(0,ms.__)("Avatar"),className:"editor-post-locked-modal__avatar",width:64,height:64}),(0,P.jsxs)("div",{children:[!!n&&(0,P.jsx)("p",{children:(0,u.createInterpolateElement)(_?(0,ms.sprintf)((0,ms.__)("%s now has editing control of this post (). Don’t worry, your changes up to this moment have been saved."),_):(0,ms.__)("Another user now has editing control of this post (). Don’t worry, your changes up to this moment have been saved."),{strong:(0,P.jsx)("strong",{}),PreviewLink:(0,P.jsx)(Ao.ExternalLink,{href:g,children:(0,ms.__)("preview")})})}),!n&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("p",{children:(0,u.createInterpolateElement)(_?(0,ms.sprintf)((0,ms.__)("%s is currently working on this post (), which means you cannot make changes, unless you take over."),_):(0,ms.__)("Another user is currently working on this post (), which means you cannot make changes, unless you take over."),{strong:(0,P.jsx)("strong",{}),PreviewLink:(0,P.jsx)(Ao.ExternalLink,{href:g,children:(0,ms.__)("preview")})})}),(0,P.jsx)("p",{children:(0,ms.__)("If you take over, the other user will lose editing control to the post, but their changes will be saved.")})]}),(0,P.jsxs)(Ao.__experimentalHStack,{className:"editor-post-locked-modal__buttons",justify:"flex-end",children:[!n&&(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",href:b,children:(0,ms.__)("Take over")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"primary",href:y,children:x})]})]})]})})}const Yc=function({children:e}){const{hasPublishAction:t,isPublished:s}=(0,c.useSelect)((e=>{var t;const{isCurrentPostPublished:s,getCurrentPost:o}=e(Wi);return{hasPublishAction:null!==(t=o()._links?.["wp:action-publish"])&&void 0!==t&&t,isPublished:s()}}),[]);return s||!t?null:e};const Kc=function(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostAttribute("status")),[]),{editPost:t}=(0,c.useDispatch)(Wi);return(0,P.jsx)(Yc,{children:(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Pending review"),checked:"pending"===e,onChange:()=>{t({status:"pending"===e?"draft":"pending"})}})})};function qc({className:e,textContent:t,forceIsAutosaveable:s,role:o,onPreview:n}){const{postId:i,currentPostLink:r,previewLink:a,isSaveable:l,isViewable:p}=(0,c.useSelect)((e=>{var t;const s=e(Wi),o=e(d.store).getPostType(s.getCurrentPostType("type"));return{postId:s.getCurrentPostId(),currentPostLink:s.getCurrentPostAttribute("link"),previewLink:s.getEditedPostPreviewLink(),isSaveable:s.isEditedPostSaveable(),isViewable:null!==(t=o?.viewable)&&void 0!==t&&t}}),[]),{__unstableSaveForPreview:m}=(0,c.useDispatch)(Wi);if(!p)return null;const g=`wp-preview-${i}`,_=a||r;return(0,P.jsx)(Ao.Button,{variant:e?void 0:"tertiary",className:e||"editor-post-preview",href:_,target:g,accessibleWhenDisabled:!0,disabled:!l,onClick:async e=>{e.preventDefault();const t=window.open("",g);t.focus(),function(e){let t=(0,u.renderToString)((0,P.jsxs)("div",{className:"editor-post-preview-button__interstitial-message",children:[(0,P.jsxs)(Ao.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96",children:[(0,P.jsx)(Ao.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),(0,P.jsx)(Ao.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})]}),(0,P.jsx)("p",{children:(0,ms.__)("Generating preview…")})]}));t+='\n\t\t\n\t',t=(0,h.applyFilters)("editor.PostPreview.interstitialMarkup",t),e.write(t),e.title=(0,ms.__)("Generating preview…"),e.close()}(t.document);const o=await m({forceIsAutosaveable:s});t.location=o,n?.()},role:o,size:"compact",children:t||(0,P.jsxs)(P.Fragment,{children:[(0,ms._x)("Preview","imperative verb"),(0,P.jsx)(Ao.VisuallyHidden,{as:"span",children:(0,ms.__)("(opens in a new tab)")})]})})}function Qc(){const e=(0,p.useViewportMatch)("medium","<"),{isPublished:t,isBeingScheduled:s,isSaving:o,isPublishing:n,hasPublishAction:i,isAutosaving:r,hasNonPostEntityChanges:a,postStatusHasChanged:l,postStatus:d}=(0,c.useSelect)((e=>{var t;const{isCurrentPostPublished:s,isEditedPostBeingScheduled:o,isSavingPost:n,isPublishingPost:i,getCurrentPost:r,getCurrentPostType:a,isAutosavingPost:l,getPostEdits:c,getEditedPostAttribute:d}=e(Wi);return{isPublished:s(),isBeingScheduled:o(),isSaving:n(),isPublishing:i(),hasPublishAction:null!==(t=r()._links?.["wp:action-publish"])&&void 0!==t&&t,postType:a(),isAutosaving:l(),hasNonPostEntityChanges:e(Wi).hasNonPostEntityChanges(),postStatusHasChanged:!!c()?.status,postStatus:d("status")}}),[]);return n?(0,ms.__)("Publishing…"):(t||s)&&o&&!r?(0,ms.__)("Saving…"):i?a||t||l&&!["future","publish"].includes(d)||!l&&"future"===d?(0,ms.__)("Save"):s?(0,ms.__)("Schedule"):(0,ms.__)("Publish"):e?(0,ms.__)("Publish"):(0,ms.__)("Submit for Review")}const Xc=()=>{};class Jc extends u.Component{constructor(e){super(e),this.createOnClick=this.createOnClick.bind(this),this.closeEntitiesSavedStates=this.closeEntitiesSavedStates.bind(this),this.state={entitiesSavedStatesCallback:!1}}createOnClick(e){return(...t)=>{const{hasNonPostEntityChanges:s,setEntitiesSavedStatesCallback:o}=this.props;return s&&o?(this.setState({entitiesSavedStatesCallback:()=>e(...t)}),o((()=>this.closeEntitiesSavedStates)),Xc):e(...t)}}closeEntitiesSavedStates(e){const{postType:t,postId:s}=this.props,{entitiesSavedStatesCallback:o}=this.state;this.setState({entitiesSavedStatesCallback:!1},(()=>{e&&e.some((e=>"postType"===e.kind&&e.name===t&&e.key===s))&&o()}))}render(){const{forceIsDirty:e,hasPublishAction:t,isBeingScheduled:s,isOpen:o,isPostSavingLocked:n,isPublishable:i,isPublished:r,isSaveable:a,isSaving:l,isAutoSaving:c,isToggle:d,savePostStatus:u,onSubmit:p=Xc,onToggle:h,visibility:m,hasNonPostEntityChanges:g,isSavingNonPostEntityChanges:_,postStatus:f,postStatusHasChanged:b}=this.props,y=(l||!a||n||!i&&!e)&&(!g||_),x=(r||l||!a||!i&&!e)&&(!g||_);let v="publish";b?v=f:t?"private"===m?v="private":s&&(v="future"):v="pending";const w={"aria-disabled":y,className:"editor-post-publish-button",isBusy:!c&&l,variant:"primary",onClick:this.createOnClick((()=>{y||(p(),u(v))}))},S={"aria-disabled":x,"aria-expanded":o,className:"editor-post-publish-panel__toggle",isBusy:l&&r,variant:"primary",size:"compact",onClick:this.createOnClick((()=>{x||h()}))},k=d?S:w;return(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Ao.Button,{...k,className:`${k.className} editor-post-publish-button__button`,size:"compact",children:(0,P.jsx)(Qc,{})})})}}const ed=(0,p.compose)([(0,c.withSelect)((e=>{var t;const{isSavingPost:s,isAutosavingPost:o,isEditedPostBeingScheduled:n,getEditedPostVisibility:i,isCurrentPostPublished:r,isEditedPostSaveable:a,isEditedPostPublishable:l,isPostSavingLocked:c,getCurrentPost:d,getCurrentPostType:u,getCurrentPostId:p,hasNonPostEntityChanges:h,isSavingNonPostEntityChanges:m,getEditedPostAttribute:g,getPostEdits:_}=e(Wi);return{isSaving:s(),isAutoSaving:o(),isBeingScheduled:n(),visibility:i(),isSaveable:a(),isPostSavingLocked:c(),isPublishable:l(),isPublished:r(),hasPublishAction:null!==(t=d()._links?.["wp:action-publish"])&&void 0!==t&&t,postType:u(),postId:p(),postStatus:g("status"),postStatusHasChanged:_()?.status,hasNonPostEntityChanges:h(),isSavingNonPostEntityChanges:m()}})),(0,c.withDispatch)((e=>{const{editPost:t,savePost:s}=e(Wi);return{savePostStatus:e=>{t({status:e},{undoIgnore:!0}),s()}}}))])(Jc),td=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,P.jsx)(k.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"})}),sd={public:{label:(0,ms.__)("Public"),info:(0,ms.__)("Visible to everyone.")},private:{label:(0,ms.__)("Private"),info:(0,ms.__)("Only visible to site admins and editors.")},password:{label:(0,ms.__)("Password protected"),info:(0,ms.__)("Only those with the password can view this post.")}};function od({onClose:e}){const t=(0,p.useInstanceId)(od),{status:s,visibility:o,password:n}=(0,c.useSelect)((e=>({status:e(Wi).getEditedPostAttribute("status"),visibility:e(Wi).getEditedPostVisibility(),password:e(Wi).getEditedPostAttribute("password")}))),{editPost:i,savePost:r}=(0,c.useDispatch)(Wi),[a,l]=(0,u.useState)(!!n),[d,h]=(0,u.useState)(!1);return(0,P.jsxs)("div",{className:"editor-post-visibility",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Visibility"),help:(0,ms.__)("Control how this post is viewed."),onClose:e}),(0,P.jsxs)("fieldset",{className:"editor-post-visibility__fieldset",children:[(0,P.jsx)(Ao.VisuallyHidden,{as:"legend",children:(0,ms.__)("Visibility")}),(0,P.jsx)(nd,{instanceId:t,value:"public",label:sd.public.label,info:sd.public.info,checked:"public"===o&&!a,onChange:()=>{i({status:"private"===o?"draft":s,password:""}),l(!1)}}),(0,P.jsx)(nd,{instanceId:t,value:"private",label:sd.private.label,info:sd.private.info,checked:"private"===o,onChange:()=>{h(!0)}}),(0,P.jsx)(nd,{instanceId:t,value:"password",label:sd.password.label,info:sd.password.info,checked:a,onChange:()=>{i({status:"private"===o?"draft":s,password:n||""}),l(!0)}}),a&&(0,P.jsxs)("div",{className:"editor-post-visibility__password",children:[(0,P.jsx)(Ao.VisuallyHidden,{as:"label",htmlFor:`editor-post-visibility__password-input-${t}`,children:(0,ms.__)("Create password")}),(0,P.jsx)("input",{className:"editor-post-visibility__password-input",id:`editor-post-visibility__password-input-${t}`,type:"text",onChange:e=>{i({password:e.target.value})},value:n,placeholder:(0,ms.__)("Use a secure password")})]})]}),(0,P.jsx)(Ao.__experimentalConfirmDialog,{isOpen:d,onConfirm:()=>{i({status:"private",password:""}),l(!1),h(!1),r()},onCancel:()=>{h(!1)},confirmButtonText:(0,ms.__)("Publish"),size:"medium",children:(0,ms.__)("Would you like to privately publish this post now?")})]})}function nd({instanceId:e,value:t,label:s,info:o,...n}){return(0,P.jsxs)("div",{className:"editor-post-visibility__choice",children:[(0,P.jsx)("input",{type:"radio",name:`editor-post-visibility__setting-${e}`,value:t,id:`editor-post-${t}-${e}`,"aria-describedby":`editor-post-${t}-${e}-description`,className:"editor-post-visibility__radio",...n}),(0,P.jsx)("label",{htmlFor:`editor-post-${t}-${e}`,className:"editor-post-visibility__label",children:s}),(0,P.jsx)("p",{id:`editor-post-${t}-${e}-description`,className:"editor-post-visibility__info",children:o})]})}function id(){return rd()}function rd(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostVisibility()));return sd[e]?.label}function ad(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function ld(e){const t=ad(e);return t.setDate(1),t.setHours(0,0,0,0),t}function cd(e){const t=ad(e),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(23,59,59,999),t}Math.pow(10,8);const dd=6e4,ud=36e5;function pd(e,t){const s=t?.additionalDigits??2,o=function(e){const t={},s=e.split(hd.dateTimeDelimiter);let o;if(s.length>2)return t;/:/.test(s[0])?o=s[0]:(t.date=s[0],o=s[1],hd.timeZoneDelimiter.test(t.date)&&(t.date=e.split(hd.timeZoneDelimiter)[0],o=e.substr(t.date.length,e.length)));if(o){const e=hd.timezone.exec(o);e?(t.time=o.replace(e[1],""),t.timezone=e[1]):t.time=o}return t}(e);let n;if(o.date){const e=function(e,t){const s=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),o=e.match(s);if(!o)return{year:NaN,restDateString:""};const n=o[1]?parseInt(o[1]):null,i=o[2]?parseInt(o[2]):null;return{year:null===i?n:100*i,restDateString:e.slice((o[1]||o[2]).length)}}(o.date,s);n=function(e,t){if(null===t)return new Date(NaN);const s=e.match(md);if(!s)return new Date(NaN);const o=!!s[4],n=fd(s[1]),i=fd(s[2])-1,r=fd(s[3]),a=fd(s[4]),l=fd(s[5])-1;if(o)return function(e,t,s){return t>=1&&t<=53&&s>=0&&s<=6}(0,a,l)?function(e,t,s){const o=new Date(0);o.setUTCFullYear(e,0,4);const n=o.getUTCDay()||7,i=7*(t-1)+s+1-n;return o.setUTCDate(o.getUTCDate()+i),o}(t,a,l):new Date(NaN);{const e=new Date(0);return function(e,t,s){return t>=0&&t<=11&&s>=1&&s<=(yd[t]||(xd(e)?29:28))}(t,i,r)&&function(e,t){return t>=1&&t<=(xd(e)?366:365)}(t,n)?(e.setUTCFullYear(t,i,Math.max(n,r)),e):new Date(NaN)}}(e.restDateString,e.year)}if(!n||isNaN(n.getTime()))return new Date(NaN);const i=n.getTime();let r,a=0;if(o.time&&(a=function(e){const t=e.match(gd);if(!t)return NaN;const s=bd(t[1]),o=bd(t[2]),n=bd(t[3]);if(!function(e,t,s){if(24===e)return 0===t&&0===s;return s>=0&&s<60&&t>=0&&t<60&&e>=0&&e<25}(s,o,n))return NaN;return s*ud+o*dd+1e3*n}(o.time),isNaN(a)))return new Date(NaN);if(!o.timezone){const e=new Date(i+a),t=new Date(0);return t.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),t}return r=function(e){if("Z"===e)return 0;const t=e.match(_d);if(!t)return 0;const s="+"===t[1]?-1:1,o=parseInt(t[2]),n=t[3]&&parseInt(t[3])||0;if(!function(e,t){return t>=0&&t<=59}(0,n))return NaN;return s*(o*ud+n*dd)}(o.timezone),isNaN(r)?new Date(NaN):new Date(i+a+r)}const hd={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},md=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,gd=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_d=/^([+-])(\d{2})(?::?(\d{2}))?$/;function fd(e){return e?parseInt(e):1}function bd(e){return e&&parseFloat(e.replace(",","."))||0}const yd=[31,null,31,30,31,30,31,31,30,31,30,31];function xd(e){return e%400==0||e%4==0&&e%100!=0}const{PrivatePublishDateTimePicker:vd}=Xo(m.privateApis);function wd(e){return(0,P.jsx)(Sd,{...e,showPopoverHeaderActions:!0,isCompact:!1})}function Sd({onClose:e,showPopoverHeaderActions:t,isCompact:s}){const{postDate:o,postType:n}=(0,c.useSelect)((e=>({postDate:e(Wi).getEditedPostAttribute("date"),postType:e(Wi).getCurrentPostType()})),[]),{editPost:i}=(0,c.useDispatch)(Wi),[r,a]=(0,u.useState)(ld(new Date(o))),l=(0,c.useSelect)((e=>e(d.store).getEntityRecords("postType",n,{status:"publish,future",after:ld(r).toISOString(),before:cd(r).toISOString(),exclude:[e(Wi).getCurrentPostId()],per_page:100,_fields:"id,date"})),[r,n]),p=(0,u.useMemo)((()=>(l||[]).map((({date:e})=>({date:new Date(e)})))),[l]),h=(0,x.getSettings)(),m=/a(?!\\)/i.test(h.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,P.jsx)(vd,{currentDate:o,onChange:e=>i({date:e}),is12Hour:m,dateOrder:(0,ms._x)("dmy","date order"),events:p,onMonthPreviewed:e=>a(pd(e)),onClose:e,isCompact:s,showPopoverHeaderActions:t})}function kd(e){return Pd(e)}function Pd({full:e=!1}={}){const{date:t,isFloating:s}=(0,c.useSelect)((e=>({date:e(Wi).getEditedPostAttribute("date"),isFloating:e(Wi).isEditedPostDateFloating()})),[]);return e?Cd(t):function(e,{isFloating:t=!1,now:s=new Date}={}){if(!e||t)return(0,ms.__)("Immediately");if(!function(e){const{timezone:t}=(0,x.getSettings)(),s=Number(t.offset),o=e.getTimezoneOffset()/60*-1;return s===o}(s))return Cd(e);const o=(0,x.getDate)(e);if(jd(o,s))return(0,ms.sprintf)((0,ms.__)("Today at %s"),(0,x.dateI18n)((0,ms._x)("g:i a","post schedule time format"),o));const n=new Date(s);if(n.setDate(n.getDate()+1),jd(o,n))return(0,ms.sprintf)((0,ms.__)("Tomorrow at %s"),(0,x.dateI18n)((0,ms._x)("g:i a","post schedule time format"),o));if(o.getFullYear()===s.getFullYear())return(0,x.dateI18n)((0,ms._x)("F j g:i a","post schedule date format without year"),o);return(0,x.dateI18n)((0,ms._x)("F j, Y g:i a","post schedule full date format"),o)}(t,{isFloating:s})}function Cd(e){const t=(0,x.getDate)(e),s=function(){const{timezone:e}=(0,x.getSettings)();if(e.abbr&&isNaN(Number(e.abbr)))return e.abbr;const t=e.offset<0?"":"+";return`UTC${t}${e.offsetFormatted}`}(),o=(0,x.dateI18n)((0,ms._x)("F j, Y g:i a","post schedule full date format"),t);return(0,ms.isRTL)()?`${s} ${o}`:`${o} ${s}`}function jd(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}const Ed=3,Td={per_page:10,orderby:"count",order:"desc",hide_empty:!0,_fields:"id,name,count",context:"view"};function Bd({onSelect:e,taxonomy:t}){const{_terms:s,showTerms:o}=(0,c.useSelect)((e=>{const s=e(d.store).getEntityRecords("taxonomy",t.slug,Td);return{_terms:s,showTerms:s?.length>=Ed}}),[t.slug]);if(!o)return null;const n=Ja(s);return(0,P.jsxs)("div",{className:"editor-post-taxonomies__flat-term-most-used",children:[(0,P.jsx)(Ao.BaseControl.VisualLabel,{as:"h3",className:"editor-post-taxonomies__flat-term-most-used-label",children:t.labels.most_used}),(0,P.jsx)("ul",{role:"list",className:"editor-post-taxonomies__flat-term-most-used-list",children:n.map((t=>(0,P.jsx)("li",{children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>e(t),children:t.name})},t.id)))})]})}const Id=[],Nd=100,Ad={per_page:Nd,_fields:"id,name",context:"view"},Dd=(e,t)=>Qa(e).toLowerCase()===Qa(t).toLowerCase(),Rd=(e,t)=>e.map((e=>t.find((t=>Dd(t.name,e)))?.id)).filter((e=>void 0!==e)),Md=({children:e,__nextHasNoMarginBottom:t})=>t?(0,P.jsx)(Ao.__experimentalVStack,{spacing:4,children:e}):(0,P.jsx)(u.Fragment,{children:e});function Od({slug:e,__nextHasNoMarginBottom:t}){var s,o;const[n,i]=(0,u.useState)([]),[r,a]=(0,u.useState)(""),l=(0,p.useDebounce)(a,500);t||S()("Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector",{since:"6.7",version:"7.0",hint:"Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version."});const{terms:h,termIds:m,taxonomy:g,hasAssignAction:_,hasCreateAction:f,hasResolvedTerms:b}=(0,c.useSelect)((t=>{var s,o;const{getCurrentPost:n,getEditedPostAttribute:i}=t(Wi),{getEntityRecords:r,getTaxonomy:a,hasFinishedResolution:l}=t(d.store),c=n(),u=a(e),p=u?i(u.rest_base):Id,h={...Ad,include:p?.join(","),per_page:-1};return{hasCreateAction:!!u&&(null!==(s=c._links?.["wp:action-create-"+u.rest_base])&&void 0!==s&&s),hasAssignAction:!!u&&(null!==(o=c._links?.["wp:action-assign-"+u.rest_base])&&void 0!==o&&o),taxonomy:u,termIds:p,terms:p?.length?r("taxonomy",e,h):Id,hasResolvedTerms:l("getEntityRecords",["taxonomy",e,h])}}),[e]),{searchResults:y}=(0,c.useSelect)((t=>{const{getEntityRecords:s}=t(d.store);return{searchResults:r?s("taxonomy",e,{...Ad,search:r}):Id}}),[r,e]);(0,u.useEffect)((()=>{if(b){const e=(null!=h?h:[]).map((e=>Qa(e.name)));i(e)}}),[h,b]);const x=(0,u.useMemo)((()=>(null!=y?y:[]).map((e=>Qa(e.name)))),[y]),{editPost:v}=(0,c.useDispatch)(Wi),{saveEntityRecord:w}=(0,c.useDispatch)(d.store),{createErrorNotice:k}=(0,c.useDispatch)(hs.store);if(!_)return null;function C(e){v({[g.rest_base]:e})}const j=null!==(s=g?.labels?.add_new_item)&&void 0!==s?s:"post_tag"===e?(0,ms.__)("Add new tag"):(0,ms.__)("Add new Term"),E=null!==(o=g?.labels?.singular_name)&&void 0!==o?o:"post_tag"===e?(0,ms.__)("Tag"):(0,ms.__)("Term"),T=(0,ms.sprintf)((0,ms._x)("%s added","term"),E),B=(0,ms.sprintf)((0,ms._x)("%s removed","term"),E),I=(0,ms.sprintf)((0,ms._x)("Remove %s","term"),E);return(0,P.jsxs)(Md,{__nextHasNoMarginBottom:t,children:[(0,P.jsx)(Ao.FormTokenField,{__next40pxDefaultSize:!0,value:n,suggestions:x,onChange:function(t){const s=[...null!=h?h:[],...null!=y?y:[]],o=t.reduce(((e,t)=>(e.some((e=>e.toLowerCase()===t.toLowerCase()))||e.push(t),e)),[]),n=o.filter((e=>!s.find((t=>Dd(t.name,e)))));i(o),0!==n.length?f&&Promise.all(n.map((t=>async function(t){try{const s=await w("taxonomy",e,t,{throwOnError:!0});return Xa(s)}catch(e){if("term_exists"!==e.code)throw e;return{id:e.data.term_id,name:t.name}}}({name:t})))).then((e=>{const t=s.concat(e);C(Rd(o,t))})).catch((e=>{k(e.message,{type:"snackbar"}),C(Rd(o,s))})):C(Rd(o,s))},onInputChange:l,maxSuggestions:Nd,label:j,messages:{added:T,removed:B,remove:I},__nextHasNoMarginBottom:t}),(0,P.jsx)(Bd,{taxonomy:g,onSelect:function(t){var s;if(m.includes(t.id))return;const o=[...m,t.id],n="post_tag"===e?(0,ms.__)("Tag"):(0,ms.__)("Term"),i=(0,ms.sprintf)((0,ms._x)("%s added","term"),null!==(s=g?.labels?.singular_name)&&void 0!==s?s:n);(0,ds.speak)(i,"assertive"),C(o)}})]})}const Ld=(0,Ao.withFilters)("editor.PostTaxonomyType")(Od),Fd=()=>{const e=[(0,ms.__)("Suggestion:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,ms.__)("Add tags")},"label")];return(0,P.jsxs)(Ao.PanelBody,{initialOpen:!1,title:e,children:[(0,P.jsx)("p",{children:(0,ms.__)("Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.")}),(0,P.jsx)(Ld,{slug:"post_tag",__nextHasNoMarginBottom:!0})]})},Vd=()=>{const{hasTags:e,isPostTypeSupported:t}=(0,c.useSelect)((e=>{const t=e(Wi).getCurrentPostType(),s=e(d.store).getTaxonomy("post_tag"),o=s?.types?.includes(t),n=void 0!==s,i=s&&e(Wi).getEditedPostAttribute(s.rest_base);return{hasTags:!!i?.length,isPostTypeSupported:n&&o}}),[]),[s]=(0,u.useState)(e);return t?s?null:(0,P.jsx)(Fd,{}):null},zd=(e,t)=>Vc.filter((t=>e?.includes(t.id))).find((e=>e.id===t)),Ud=({suggestedPostFormat:e,suggestionText:t,onUpdatePostFormat:s})=>(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>s(e),children:t});function Hd(){const{currentPostFormat:e,suggestion:t}=(0,c.useSelect)((e=>{var t;const{getEditedPostAttribute:s,getSuggestedPostFormat:o}=e(Wi),n=null!==(t=e(d.store).getThemeSupports().formats)&&void 0!==t?t:[];return{currentPostFormat:s("format"),suggestion:zd(n,o())}}),[]),{editPost:s}=(0,c.useDispatch)(Wi),o=[(0,ms.__)("Suggestion:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,ms.__)("Use a post format")},"label")];return t&&t.id!==e?(0,P.jsxs)(Ao.PanelBody,{initialOpen:!1,title:o,children:[(0,P.jsx)("p",{children:(0,ms.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")}),(0,P.jsx)("p",{children:(0,P.jsx)(Ud,{onUpdatePostFormat:e=>s({format:e}),suggestedPostFormat:t.id,suggestionText:(0,ms.sprintf)((0,ms.__)('Apply the "%1$s" format.'),t.caption)})})]}):null}const Gd={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},$d=8,Wd=[];function Zd({slug:e}){var t,s;const[o,n]=(0,u.useState)(!1),[i,r]=(0,u.useState)(""),[a,l]=(0,u.useState)(""),[h,m]=(0,u.useState)(!1),[g,_]=(0,u.useState)(""),[f,b]=(0,u.useState)([]),y=(0,p.useDebounce)(ds.speak,500),{hasCreateAction:x,hasAssignAction:v,terms:w,loading:S,availableTerms:k,taxonomy:C}=(0,c.useSelect)((t=>{var s,o;const{getCurrentPost:n,getEditedPostAttribute:i}=t(Wi),{getTaxonomy:r,getEntityRecords:a,isResolving:l}=t(d.store),c=r(e),u=n();return{hasCreateAction:!!c&&(null!==(s=u._links?.["wp:action-create-"+c.rest_base])&&void 0!==s&&s),hasAssignAction:!!c&&(null!==(o=u._links?.["wp:action-assign-"+c.rest_base])&&void 0!==o&&o),terms:c?i(c.rest_base):Wd,loading:l("getEntityRecords",["taxonomy",e,Gd]),availableTerms:a("taxonomy",e,Gd)||Wd,taxonomy:c}}),[e]),{editPost:j}=(0,c.useDispatch)(Wi),{saveEntityRecord:E}=(0,c.useDispatch)(d.store),T=(0,u.useMemo)((()=>function(e,t){const s=e=>-1!==t.indexOf(e.id)||void 0!==e.children&&e.children.map(s).filter((e=>e)).length>0,o=[...e];return o.sort(((e,t)=>{const o=s(e),n=s(t);return o===n?0:o&&!n?-1:!o&&n?1:0})),o}(qa(k),w)),[k]),{createErrorNotice:B}=(0,c.useDispatch)(hs.store);if(!v)return null;const I=e=>{j({[C.rest_base]:e})},N=e=>e.map((e=>(0,P.jsxs)("div",{className:"editor-post-taxonomies__hierarchical-terms-choice",children:[(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:-1!==w.indexOf(e.id),onChange:()=>{(e=>{const t=w.includes(e)?w.filter((t=>t!==e)):[...w,e];I(t)})(parseInt(e.id,10))},label:(0,No.decodeEntities)(e.name)}),!!e.children.length&&(0,P.jsx)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices",children:N(e.children)})]},e.id))),A=(t,s,o)=>{var n;return null!==(n=C?.labels?.[t])&&void 0!==n?n:"category"===e?s:o},D=A("add_new_item",(0,ms.__)("Add new category"),(0,ms.__)("Add new term")),R=A("new_item_name",(0,ms.__)("Add new category"),(0,ms.__)("Add new term")),M=A("parent_item",(0,ms.__)("Parent Category"),(0,ms.__)("Parent Term")),O=`— ${M} —`,L=D,F=null!==(t=C?.labels?.search_items)&&void 0!==t?t:(0,ms.__)("Search Terms"),V=null!==(s=C?.name)&&void 0!==s?s:(0,ms.__)("Terms"),z=k.length>=$d;return(0,P.jsxs)(Ao.Flex,{direction:"column",gap:"4",children:[z&&(0,P.jsx)(Ao.SearchControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:F,value:g,onChange:e=>{const t=T.map(function(e){const t=s=>{if(""===e)return s;const o={...s};return o.children.length>0&&(o.children=o.children.map(t).filter((e=>e))),(-1!==o.name.toLowerCase().indexOf(e.toLowerCase())||o.children.length>0)&&o};return t}(e)).filter((e=>e)),s=e=>{let t=0;for(let o=0;o{m(!h)},className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":h,variant:"link",children:D})}),h&&(0,P.jsx)("form",{onSubmit:async t=>{var s;if(t.preventDefault(),""===i||o)return;const c=function(e,t,s){return e.find((e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===s.toLowerCase()))}(k,a,i);if(c)return w.some((e=>e===c.id))||I([...w,c.id]),r(""),void l("");let d;n(!0);try{d=await(u={name:i,parent:a||void 0},E("taxonomy",e,u,{throwOnError:!0}))}catch(e){return void B(e.message,{type:"snackbar"})}var u;const p="category"===e?(0,ms.__)("Category"):(0,ms.__)("Term"),h=(0,ms.sprintf)((0,ms._x)("%s added","term"),null!==(s=C?.labels?.singular_name)&&void 0!==s?s:p);(0,ds.speak)(h,"assertive"),n(!1),r(""),l(""),I([...w,d.id])},children:(0,P.jsxs)(Ao.Flex,{direction:"column",gap:"4",children:[(0,P.jsx)(Ao.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:R,value:i,onChange:e=>{r(e)},required:!0}),!!k.length&&(0,P.jsx)(Ao.TreeSelect,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:M,noOptionLabel:O,onChange:e=>{l(e)},selectedId:a,tree:T}),(0,P.jsx)(Ao.FlexItem,{children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",children:L})})]})})]})}const Yd=(0,Ao.withFilters)("editor.PostTaxonomyType")(Zd);const Kd=function(){const e=(0,c.useSelect)((e=>{const t=e(Wi).getCurrentPostType(),{canUser:s,getEntityRecord:o,getTaxonomy:n}=e(d.store),i=n("category"),r=s("read",{kind:"root",name:"site"})?o("root","site")?.default_category:void 0,a=r?o("taxonomy","category",r):void 0,l=i&&i.types.some((e=>e===t)),c=i&&e(Wi).getEditedPostAttribute(i.rest_base);return!!i&&!!a&&l&&(0===c?.length||1===c?.length&&a?.id===c[0])}),[]),[t,s]=(0,u.useState)(!1);if((0,u.useEffect)((()=>{e&&s(!0)}),[e]),!t)return null;const o=[(0,ms.__)("Suggestion:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,ms.__)("Assign a category")},"label")];return(0,P.jsxs)(Ao.PanelBody,{initialOpen:!1,title:o,children:[(0,P.jsx)("p",{children:(0,ms.__)("Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.")}),(0,P.jsx)(Yd,{slug:"category"})]})},qd={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Qd;const Xd=new Uint8Array(16);function Jd(){if(!Qd&&(Qd="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qd(Xd)}const eu=[];for(let e=0;e<256;++e)eu.push((e+256).toString(16).slice(1));function tu(e,t=0){return eu[e[t+0]]+eu[e[t+1]]+eu[e[t+2]]+eu[e[t+3]]+"-"+eu[e[t+4]]+eu[e[t+5]]+"-"+eu[e[t+6]]+eu[e[t+7]]+"-"+eu[e[t+8]]+eu[e[t+9]]+"-"+eu[e[t+10]]+eu[e[t+11]]+eu[e[t+12]]+eu[e[t+13]]+eu[e[t+14]]+eu[e[t+15]]}const su=function(e,t,s){if(qd.randomUUID&&!t&&!e)return qd.randomUUID();const o=(e=e||{}).random||(e.rng||Jd)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){s=s||0;for(let e=0;e<16;++e)t[s+e]=o[e];return t}return tu(o)};function ou(e){return Object.fromEntries(Object.entries(function(e){const t=new Set;return Object.fromEntries(e.map((e=>{const s=(0,v.getFilename)(e);let o="";if(s){const e=s.split(".");e.length>1&&e.pop(),o=e.join(".")}return o||(o=su()),t.has(o)&&(o=`${o}-${su()}`),t.add(o),[e,o]})))}(e)).map((([e,t])=>{const s=window.fetch(e.includes("?")?e:e+"?").then((e=>e.blob())).then((e=>new File([e],`${t}.png`,{type:e.type})));return[e,s]})))}function nu(e){const t=[];return e.forEach((e=>{t.push(e),t.push(...nu(e.innerBlocks))})),t}function iu(e){if("core/image"===e.name||"core/cover"===e.name){const{url:t,alt:s,id:o}=e.attributes;return{url:t,alt:s,id:o}}if("core/media-text"===e.name){const{mediaUrl:t,mediaAlt:s,mediaId:o}=e.attributes;return{url:t,alt:s,id:o}}return{}}function ru({clientId:e,alt:t,url:s}){const{selectBlock:o}=(0,c.useDispatch)(m.store);return(0,P.jsx)(Ao.__unstableMotion.img,{tabIndex:0,role:"button","aria-label":(0,ms.__)("Select image block."),onClick:()=>{o(e)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(o(e),t.preventDefault())},alt:t,src:s,animate:{opacity:1},exit:{opacity:0,scale:0},style:{width:"32px",height:"32px",objectFit:"cover",borderRadius:"2px",cursor:"pointer"},whileHover:{scale:1.08}},e)}function au(){const[e,t]=(0,u.useState)(!1),[s,o]=(0,u.useState)(!1),[n,i]=(0,u.useState)(!1),{editorBlocks:r,mediaUpload:a}=(0,c.useSelect)((e=>({editorBlocks:e(m.store).getBlocks(),mediaUpload:e(m.store).getSettings().mediaUpload})),[]),l=nu(r).filter((e=>function(e){return"core/image"===e.name||"core/cover"===e.name?e.attributes.url&&!e.attributes.id:"core/media-text"===e.name?e.attributes.mediaUrl&&!e.attributes.mediaId:void 0}(e))),{updateBlockAttributes:d}=(0,c.useDispatch)(m.store);if(!a||!l.length)return null;const p=[(0,ms.__)("Suggestion:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,ms.__)("External media")},"label")];return(0,P.jsxs)(Ao.PanelBody,{initialOpen:!0,title:p,children:[(0,P.jsx)("p",{children:(0,ms.__)("Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.")}),(0,P.jsxs)("div",{style:{display:"inline-flex",flexWrap:"wrap",gap:"8px"},children:[(0,P.jsx)(Ao.__unstableAnimatePresence,{onExitComplete:()=>o(!1),children:l.map((e=>{const{url:t,alt:s}=iu(e);return(0,P.jsx)(ru,{clientId:e.clientId,url:t,alt:s},e.clientId)}))}),e||s?(0,P.jsx)(Ao.Spinner,{}):(0,P.jsx)(Ao.Button,{size:"compact",variant:"primary",onClick:function(){t(!0),i(!1);const e=new Set(l.map((e=>{const{url:t}=iu(e);return t}))),s=Object.fromEntries(Object.entries(ou([...e])).map((([e,t])=>[e,t.then((e=>new Promise(((t,s)=>{a({filesList:[e],onFileChange:([e])=>{(0,ii.isBlobURL)(e.url)||t(e)},onError(){s()}})}))))])));Promise.allSettled(l.map((e=>{const{url:t}=iu(e);return s[t].then((t=>function(e,t){"core/image"!==e.name&&"core/cover"!==e.name||d(e.clientId,{id:t.id,url:t.url}),"core/media-text"===e.name&&d(e.clientId,{mediaId:t.id,mediaUrl:t.url})}(e,t))).then((()=>o(!0))).catch((()=>i(!0)))}))).finally((()=>{t(!1)}))},children:(0,ms.__)("Upload")})]}),n&&(0,P.jsx)("p",{children:(0,ms.__)("Upload failed, try again.")})]})}const lu=function({children:e}){const{isBeingScheduled:t,isRequestingSiteIcon:s,hasPublishAction:o,siteIconUrl:n,siteTitle:i,siteHome:r}=(0,c.useSelect)((e=>{var t;const{getCurrentPost:s,isEditedPostBeingScheduled:o}=e(Wi),{getEntityRecord:n,isResolving:i}=e(d.store),r=n("root","__unstableBase",void 0)||{};return{hasPublishAction:null!==(t=s()._links?.["wp:action-publish"])&&void 0!==t&&t,isBeingScheduled:o(),isRequestingSiteIcon:i("getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:r.site_icon_url,siteTitle:r.name,siteHome:r.home&&(0,v.filterURLForDisplay)(r.home)}}),[]);let a,l,u=(0,P.jsx)(Ao.Icon,{className:"components-site-icon",size:"36px",icon:td});return n&&(u=(0,P.jsx)("img",{alt:(0,ms.__)("Site Icon"),className:"components-site-icon",src:n})),s&&(u=null),o?t?(a=(0,ms.__)("Are you ready to schedule?"),l=(0,ms.__)("Your work will be published at the specified date and time.")):(a=(0,ms.__)("Are you ready to publish?"),l=(0,ms.__)("Double-check your settings before publishing.")):(a=(0,ms.__)("Are you ready to submit for review?"),l=(0,ms.__)("When you’re ready, submit your work for review, and an Editor will be able to approve it for you.")),(0,P.jsxs)("div",{className:"editor-post-publish-panel__prepublish",children:[(0,P.jsx)("div",{children:(0,P.jsx)("strong",{children:a})}),(0,P.jsx)("p",{children:l}),(0,P.jsxs)("div",{className:"components-site-card",children:[u,(0,P.jsxs)("div",{className:"components-site-info",children:[(0,P.jsx)("span",{className:"components-site-name",children:(0,No.decodeEntities)(i)||(0,ms.__)("(Untitled)")}),(0,P.jsx)("span",{className:"components-site-home",children:r})]})]}),(0,P.jsx)(au,{}),o&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.PanelBody,{initialOpen:!1,title:[(0,ms.__)("Visibility:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,P.jsx)(id,{})},"label")],children:(0,P.jsx)(od,{})}),(0,P.jsx)(Ao.PanelBody,{initialOpen:!1,title:[(0,ms.__)("Publish:"),(0,P.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,P.jsx)(kd,{})},"label")],children:(0,P.jsx)(wd,{})})]}),(0,P.jsx)(Hd,{}),(0,P.jsx)(Vd,{}),(0,P.jsx)(Kd,{}),e]})},cu="%postname%",du="%pagename%";function uu({text:e,onCopy:t,children:s}){const o=(0,p.useCopyToClipboard)(e,t);return(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"secondary",ref:o,children:s})}class pu extends u.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this),this.postLink=(0,u.createRef)()}componentDidMount(){this.props.focusOnMount&&this.postLink.current.focus()}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const{children:e,isScheduled:t,post:s,postType:o}=this.props,n=o?.labels?.singular_name,i=o?.labels?.view_item,r=o?.labels?.add_new_item,a="future"===s.status?(e=>{const{slug:t}=e;return e.permalink_template.includes(cu)?e.permalink_template.replace(cu,t):e.permalink_template.includes(du)?e.permalink_template.replace(du,t):e.permalink_template})(s):s.link,l=(0,v.addQueryArgs)("post-new.php",{post_type:s.type}),c=t?(0,P.jsxs)(P.Fragment,{children:[(0,ms.__)("is now scheduled. It will go live on")," ",(0,P.jsx)(kd,{}),"."]}):(0,ms.__)("is now live.");return(0,P.jsxs)("div",{className:"post-publish-panel__postpublish",children:[(0,P.jsxs)(Ao.PanelBody,{className:"post-publish-panel__postpublish-header",children:[(0,P.jsx)("a",{ref:this.postLink,href:a,children:(0,No.decodeEntities)(s.title)||(0,ms.__)("(no title)")})," ",c]}),(0,P.jsxs)(Ao.PanelBody,{children:[(0,P.jsx)("p",{className:"post-publish-panel__postpublish-subheader",children:(0,P.jsx)("strong",{children:(0,ms.__)("What’s next?")})}),(0,P.jsxs)("div",{className:"post-publish-panel__postpublish-post-address-container",children:[(0,P.jsx)(Ao.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:(0,ms.sprintf)((0,ms.__)("%s address"),n),value:(0,v.safeDecodeURIComponent)(a),onFocus:this.onSelectInput}),(0,P.jsx)("div",{className:"post-publish-panel__postpublish-post-address__copy-button-wrap",children:(0,P.jsx)(uu,{text:a,onCopy:this.onCopy,children:this.state.showCopyConfirmation?(0,ms.__)("Copied!"):(0,ms.__)("Copy")})})]}),(0,P.jsxs)("div",{className:"post-publish-panel__postpublish-buttons",children:[!t&&(0,P.jsx)(Ao.Button,{variant:"primary",href:a,__next40pxDefaultSize:!0,children:i}),(0,P.jsx)(Ao.Button,{variant:t?"primary":"secondary",__next40pxDefaultSize:!0,href:l,children:r})]})]}),e]})}}const hu=(0,c.withSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPost:s,isCurrentPostScheduled:o}=e(Wi),{getPostType:n}=e(d.store);return{post:s(),postType:n(t("type")),isScheduled:o()}}))(pu);class mu extends u.Component{constructor(){super(...arguments),this.onSubmit=this.onSubmit.bind(this),this.cancelButtonNode=(0,u.createRef)()}componentDidMount(){this.timeoutID=setTimeout((()=>{this.cancelButtonNode.current.focus()}),0)}componentWillUnmount(){clearTimeout(this.timeoutID)}componentDidUpdate(e){e.isPublished&&!this.props.isSaving&&this.props.isDirty&&this.props.onClose()}onSubmit(){const{onClose:e,hasPublishAction:t,isPostTypeViewable:s}=this.props;t&&s||e()}render(){const{forceIsDirty:e,isBeingScheduled:t,isPublished:s,isPublishSidebarEnabled:o,isScheduled:n,isSaving:i,isSavingNonPostEntityChanges:r,onClose:a,onTogglePublishSidebar:l,PostPublishExtension:c,PrePublishExtension:d,...u}=this.props,{hasPublishAction:p,isDirty:h,isPostTypeViewable:m,...g}=u,_=s||n&&t,f=!_&&!i,b=_&&!i;return(0,P.jsxs)("div",{className:"editor-post-publish-panel",...g,children:[(0,P.jsx)("div",{className:"editor-post-publish-panel__header",children:b?(0,P.jsx)(Ao.Button,{size:"compact",onClick:a,icon:Cn,label:(0,ms.__)("Close panel")}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"editor-post-publish-panel__header-cancel-button",children:(0,P.jsx)(Ao.Button,{ref:this.cancelButtonNode,accessibleWhenDisabled:!0,disabled:r,onClick:a,variant:"secondary",size:"compact",children:(0,ms.__)("Cancel")})}),(0,P.jsx)("div",{className:"editor-post-publish-panel__header-publish-button",children:(0,P.jsx)(ed,{onSubmit:this.onSubmit,forceIsDirty:e})})]})}),(0,P.jsxs)("div",{className:"editor-post-publish-panel__content",children:[f&&(0,P.jsx)(lu,{children:d&&(0,P.jsx)(d,{})}),b&&(0,P.jsx)(hu,{focusOnMount:!0,children:c&&(0,P.jsx)(c,{})}),i&&(0,P.jsx)(Ao.Spinner,{})]}),(0,P.jsx)("div",{className:"editor-post-publish-panel__footer",children:(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Always show pre-publish checks."),checked:o,onChange:l})})]})}}const gu=(0,p.compose)([(0,c.withSelect)((e=>{var t;const{getPostType:s}=e(d.store),{getCurrentPost:o,getEditedPostAttribute:n,isCurrentPostPublished:i,isCurrentPostScheduled:r,isEditedPostBeingScheduled:a,isEditedPostDirty:l,isAutosavingPost:c,isSavingPost:u,isSavingNonPostEntityChanges:p}=e(Wi),{isPublishSidebarEnabled:h}=e(Wi),m=s(n("type"));return{hasPublishAction:null!==(t=o()._links?.["wp:action-publish"])&&void 0!==t&&t,isPostTypeViewable:m?.viewable,isBeingScheduled:a(),isDirty:l(),isPublished:i(),isPublishSidebarEnabled:h(),isSaving:u()&&!c(),isSavingNonPostEntityChanges:p(),isScheduled:r()}})),(0,c.withDispatch)(((e,{isPublishSidebarEnabled:t})=>{const{disablePublishSidebar:s,enablePublishSidebar:o}=e(Wi);return{onTogglePublishSidebar:()=>{t?s():o()}}})),Ao.withFocusReturn,Ao.withConstrainedTabbing])(mu),_u=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"})});const fu=(0,u.forwardRef)((function({icon:e,size:t=24,...s},o){return(0,u.cloneElement)(e,{width:t,height:t,...s,ref:o})})),bu=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"})}),yu=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"})}),xu=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"})}),vu=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"})}),wu=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),Su=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})});function ku({children:e}){const{hasStickyAction:t,postType:s}=(0,c.useSelect)((e=>{var t;const s=e(Wi).getCurrentPost();return{hasStickyAction:null!==(t=s._links?.["wp:action-sticky"])&&void 0!==t&&t,postType:e(Wi).getCurrentPostType()}}),[]);return"post"===s&&t?e:null}function Pu(){const e=(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getEditedPostAttribute("sticky"))&&void 0!==t&&t}),[]),{editPost:t}=(0,c.useDispatch)(Wi);return(0,P.jsx)(ku,{children:(0,P.jsx)(Ao.CheckboxControl,{className:"editor-post-sticky__checkbox-control",label:(0,ms.__)("Sticky"),help:(0,ms.__)("Pin this post to the top of the blog"),checked:e,onChange:()=>t({sticky:!e}),__nextHasNoMarginBottom:!0})})}const Cu={"auto-draft":{label:(0,ms.__)("Draft"),icon:yu},draft:{label:(0,ms.__)("Draft"),icon:yu},pending:{label:(0,ms.__)("Pending"),icon:xu},private:{label:(0,ms.__)("Private"),icon:vu},future:{label:(0,ms.__)("Scheduled"),icon:wu},publish:{label:(0,ms.__)("Published"),icon:Su}},ju=[{label:(0,ms.__)("Draft"),value:"draft",description:(0,ms.__)("Not ready to publish.")},{label:(0,ms.__)("Pending"),value:"pending",description:(0,ms.__)("Waiting for review before publishing.")},{label:(0,ms.__)("Private"),value:"private",description:(0,ms.__)("Only visible to site admins and editors.")},{label:(0,ms.__)("Scheduled"),value:"future",description:(0,ms.__)("Publish automatically on a chosen date.")},{label:(0,ms.__)("Published"),value:"publish",description:(0,ms.__)("Visible to everyone.")}],Eu=[D,R,M,O];function Tu(){const{status:e,date:t,password:s,postId:o,postType:n,canEdit:i}=(0,c.useSelect)((e=>{var t;const{getEditedPostAttribute:s,getCurrentPostId:o,getCurrentPostType:n,getCurrentPost:i}=e(Wi);return{status:s("status"),date:s("date"),password:s("password"),postId:o(),postType:n(),canEdit:null!==(t=i()._links?.["wp:action-publish"])&&void 0!==t&&t}}),[]),[r,a]=(0,u.useState)(!!s),l=(0,p.useInstanceId)(Tu,"editor-change-status__password-input"),{editEntityRecord:h}=(0,c.useDispatch)(d.store),[g,_]=(0,u.useState)(null),f=(0,u.useMemo)((()=>({anchor:g,"aria-label":(0,ms.__)("Status & visibility"),headerTitle:(0,ms.__)("Status & visibility"),placement:"left-start",offset:36,shift:!0})),[g]);if(Eu.includes(n))return null;const b=({status:i=e,password:r=s,date:a=t})=>{h("postType",n,o,{status:i,date:a,password:r})},y=e=>{a(e),e||b({password:""})},x=o=>{let n=t,i=s;"future"===e&&new Date(t)>new Date&&(n=null),"private"===o&&s&&(i=""),b({status:o,date:n,password:i})};return(0,P.jsx)(Ka,{label:(0,ms.__)("Status"),ref:_,children:i?(0,P.jsx)(Ao.Dropdown,{className:"editor-post-status",contentClassName:"editor-change-status__content",popoverProps:f,focusOnMount:!0,renderToggle:({onToggle:t,isOpen:s})=>(0,P.jsx)(Ao.Button,{className:"editor-post-status__toggle",variant:"tertiary",size:"compact",onClick:t,icon:Cu[e]?.icon,"aria-label":(0,ms.sprintf)((0,ms.__)("Change status: %s"),Cu[e]?.label),"aria-expanded":s,children:Cu[e]?.label}),renderContent:({onClose:t})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Status & visibility"),onClose:t}),(0,P.jsx)("form",{children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:4,children:[(0,P.jsx)(Ao.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,ms.__)("Status"),options:ju,onChange:x,selected:"auto-draft"===e?"draft":e}),"future"===e&&(0,P.jsx)("div",{className:"editor-change-status__publish-date-wrapper",children:(0,P.jsx)(Sd,{showPopoverHeaderActions:!1,isCompact:!0})}),"private"!==e&&(0,P.jsxs)(Ao.__experimentalVStack,{as:"fieldset",spacing:4,className:"editor-change-status__password-fieldset",children:[(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Password protected"),help:(0,ms.__)("Only visible to those who know the password"),checked:r,onChange:y}),r&&(0,P.jsx)("div",{className:"editor-change-status__password-input",children:(0,P.jsx)(Ao.TextControl,{label:(0,ms.__)("Password"),onChange:e=>b({password:e}),value:s,placeholder:(0,ms.__)("Use a secure password"),type:"text",id:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,maxLength:255})})]}),(0,P.jsx)(Pu,{})]})})]})}):(0,P.jsx)("div",{className:"editor-post-status is-read-only",children:Cu[e]?.label})})}function Bu({forceIsDirty:e}){const[t,s]=(0,u.useState)(!1),o=(0,p.useViewportMatch)("small"),{isAutosaving:n,isDirty:i,isNew:r,isPublished:a,isSaveable:l,isSaving:d,isScheduled:h,hasPublishAction:m,showIconLabels:g,postStatus:_,postStatusHasChanged:f}=(0,c.useSelect)((t=>{var s;const{isEditedPostNew:o,isCurrentPostPublished:n,isCurrentPostScheduled:i,isEditedPostDirty:r,isSavingPost:a,isEditedPostSaveable:l,getCurrentPost:c,isAutosavingPost:d,getEditedPostAttribute:u,getPostEdits:p}=t(Wi),{get:h}=t(j.store);return{isAutosaving:d(),isDirty:e||r(),isNew:o(),isPublished:n(),isSaving:a(),isSaveable:l(),isScheduled:i(),hasPublishAction:null!==(s=c()?._links?.["wp:action-publish"])&&void 0!==s&&s,showIconLabels:h("core","showIconLabels"),postStatus:u("status"),postStatusHasChanged:!!p()?.status}}),[e]),b="pending"===_,{savePost:y}=(0,c.useDispatch)(Wi),x=(0,p.usePrevious)(d);if((0,u.useEffect)((()=>{let e;return x&&!d&&(s(!0),e=setTimeout((()=>{s(!1)}),1e3)),()=>clearTimeout(e)}),[d]),!m&&b)return null;const v=!["pending","draft","auto-draft"].includes(_)&&ju.map((({value:e})=>e)).includes(_);if(a||h||v||f&&["pending","draft"].includes(_))return null;const w=b?(0,ms.__)("Save as pending"):(0,ms.__)("Save draft"),S=(0,ms.__)("Save"),k=t||!r&&!i,C=d||k,E=d||k||!l;let T;return d?T=n?(0,ms.__)("Autosaving"):(0,ms.__)("Saving"):k?T=(0,ms.__)("Saved"):o?T=w:g&&(T=S),(0,P.jsxs)(Ao.Button,{className:l||d?rr({"editor-post-save-draft":!C,"editor-post-saved-state":C,"is-saving":d,"is-autosaving":n,"is-saved":k,[(0,Ao.__unstableGetAnimateClassName)({type:"loading"})]:d}):void 0,onClick:E?void 0:()=>y(),shortcut:E?void 0:ta.displayShortcut.primary("s"),variant:"tertiary",size:"compact",icon:o?void 0:_u,label:T||w,"aria-disabled":E,children:[C&&(0,P.jsx)(fu,{icon:k?Do:bu}),T]})}function Iu({children:e}){return(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getCurrentPost()._links?.["wp:action-publish"])&&void 0!==t&&t}),[])?e:null}const Nu=[D,R,M,O];function Au(){const[e,t]=(0,u.useState)(null),s=(0,c.useSelect)((e=>e(Wi).getCurrentPostType()),[]),o=(0,u.useMemo)((()=>({anchor:e,"aria-label":(0,ms.__)("Change publish date"),placement:"left-start",offset:36,shift:!0})),[e]),n=Pd(),i=Pd({full:!0});return Nu.includes(s)?null:(0,P.jsx)(Iu,{children:(0,P.jsx)(Ka,{label:(0,ms.__)("Publish"),ref:t,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:o,focusOnMount:!0,className:"editor-post-schedule__panel-dropdown",contentClassName:"editor-post-schedule__dialog",renderToggle:({onToggle:e,isOpen:t})=>(0,P.jsx)(Ao.Button,{size:"compact",className:"editor-post-schedule__dialog-toggle",variant:"tertiary",tooltipPosition:"middle left",onClick:e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change date: %s"),n),label:i,showTooltip:n!==i,"aria-expanded":t,children:n}),renderContent:({onClose:e})=>(0,P.jsx)(wd,{onClose:e})})})})}function Du({children:e}){return(0,P.jsx)(Ga,{supportKeys:"slug",children:e})}function Ru(){const e=(0,c.useSelect)((e=>(0,v.safeDecodeURIComponent)(e(Wi).getEditedPostSlug())),[]),{editPost:t}=(0,c.useDispatch)(Wi),[s,o]=(0,u.useState)(!1);return(0,P.jsx)(Ao.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,ms.__)("Slug"),autoComplete:"off",spellCheck:"false",value:s?"":e,onChange:e=>{t({slug:e}),e?s&&o(!1):s||o(!0)},onBlur:e=>{t({slug:(0,v.cleanForSlug)(e.target.value)}),s&&o(!1)},className:"editor-post-slug"})}function Mu(){return(0,P.jsx)(Du,{children:(0,P.jsx)(Ru,{})})}function Ou(){S()("wp.editor.PostSwitchToDraftButton",{since:"6.7",version:"6.9"});const[e,t]=(0,u.useState)(!1),{editPost:s,savePost:o}=(0,c.useDispatch)(Wi),{isSaving:n,isPublished:i,isScheduled:r}=(0,c.useSelect)((e=>{const{isSavingPost:t,isCurrentPostPublished:s,isCurrentPostScheduled:o}=e(Wi);return{isSaving:t(),isPublished:s(),isScheduled:o()}}),[]),a=n||!i&&!r;let l,d;i?(l=(0,ms.__)("Are you sure you want to unpublish this post?"),d=(0,ms.__)("Unpublish")):r&&(l=(0,ms.__)("Are you sure you want to unschedule this post?"),d=(0,ms.__)("Unschedule"));return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,className:"editor-post-switch-to-draft",onClick:()=>{a||t(!0)},"aria-disabled":a,variant:"secondary",style:{flexGrow:"1",justifyContent:"center"},children:(0,ms.__)("Switch to draft")}),(0,P.jsx)(Ao.__experimentalConfirmDialog,{isOpen:e,onConfirm:()=>{t(!1),s({status:"draft"}),o()},onCancel:()=>t(!1),confirmButtonText:d,children:l})]})}function Lu(){const{syncStatus:e,postType:t}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi),s=t("meta");return{syncStatus:"unsynced"===s?.wp_pattern_sync_status?"unsynced":t("wp_pattern_sync_status"),postType:t("type")}}));return"wp_block"!==t?null:(0,P.jsx)(Ka,{label:(0,ms.__)("Sync status"),children:(0,P.jsx)("div",{className:"editor-post-sync-status__value",children:"unsynced"===e?(0,ms._x)("Not synced","pattern (singular)"):(0,ms._x)("Synced","pattern (singular)")})})}const Fu=e=>e;const Vu=function({taxonomyWrapper:e=Fu}){const{postType:t,taxonomies:s}=(0,c.useSelect)((e=>({postType:e(Wi).getCurrentPostType(),taxonomies:e(d.store).getTaxonomies({per_page:-1})})),[]);return(null!=s?s:[]).filter((e=>e.types.includes(t)&&e.visibility?.show_ui)).map((t=>{const s=t.hierarchical?Yd:Ld,o={slug:t.slug,...t.hierarchical?{}:{__nextHasNoMarginBottom:!0}};return(0,P.jsx)(u.Fragment,{children:e((0,P.jsx)(s,{...o}),t)},`taxonomy-${t.slug}`)}))};function zu({children:e}){const t=(0,c.useSelect)((e=>{const t=e(Wi).getCurrentPostType(),s=e(d.store).getTaxonomies({per_page:-1});return s?.some((e=>e.types.includes(t)))}),[]);return t?e:null}function Uu({taxonomy:e,children:t}){const s=e?.slug,o=s?`taxonomy-panel-${s}`:"",{isEnabled:n,isOpened:i}=(0,c.useSelect)((e=>{const{isEditorPanelEnabled:t,isEditorPanelOpened:n}=e(Wi);return{isEnabled:!!s&&t(o),isOpened:!!s&&n(o)}}),[o,s]),{toggleEditorPanelOpened:r}=(0,c.useDispatch)(Wi);if(!n)return null;const a=e?.labels?.menu_name;return a?(0,P.jsx)(Ao.PanelBody,{title:a,opened:i,onToggle:()=>r(o),children:t}):null}const Hu=function(){return(0,P.jsx)(zu,{children:(0,P.jsx)(Vu,{taxonomyWrapper:(e,t)=>(0,P.jsx)(Uu,{taxonomy:t,children:e})})})};var Gu=s(4132);function $u(){const e=(0,p.useInstanceId)($u),{content:t,blocks:s,type:o,id:n}=(0,c.useSelect)((e=>{const{getEditedEntityRecord:t}=e(d.store),{getCurrentPostType:s,getCurrentPostId:o}=e(Wi),n=s(),i=o(),r=t("postType",n,i);return{content:r?.content,blocks:r?.blocks,type:n,id:i}}),[]),{editEntityRecord:i}=(0,c.useDispatch)(d.store),r=(0,u.useMemo)((()=>t instanceof Function?t({blocks:s}):s?(0,y.__unstableSerializeAndClean)(s):t),[t,s]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.VisuallyHidden,{as:"label",htmlFor:`post-content-${e}`,children:(0,ms.__)("Type text or HTML")}),(0,P.jsx)(Gu.A,{autoComplete:"off",dir:"auto",value:r,onChange:e=>{i("postType",o,n,{content:e.target.value,blocks:void 0,selection:void 0})},className:"editor-post-text-editor",id:`post-content-${e}`,placeholder:(0,ms.__)("Start writing with text or HTML")})]})}const Wu=window.wp.dom,Zu="wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text",Yu=/[\r\n]+/g;function Ku(e){const t=(0,u.useRef)(),{isCleanNewPost:s}=(0,c.useSelect)((e=>{const{isCleanNewPost:t}=e(Wi);return{isCleanNewPost:t()}}),[]);return(0,u.useImperativeHandle)(e,(()=>({focus:()=>{t?.current?.focus()}}))),(0,u.useEffect)((()=>{if(!t.current)return;const{defaultView:e}=t.current.ownerDocument,{name:o,parent:n}=e,i="editor-canvas"===o?n.document:e.document,{activeElement:r,body:a}=i;!s||r&&a!==r||t.current.focus()}),[s]),{ref:t}}function qu(){const{editPost:e}=(0,c.useDispatch)(Wi),{title:t}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi);return{title:t("title")}}),[]);return{title:t,setTitle:function(t){e({title:t})}}}const Qu=(0,u.forwardRef)((function(e,t){const{placeholder:s}=(0,c.useSelect)((e=>{const{getSettings:t}=e(m.store),{titlePlaceholder:s}=t();return{placeholder:s}}),[]),[o,n]=(0,u.useState)(!1),{ref:i}=Ku(t),{title:r,setTitle:a}=qu(),[l,d]=(0,u.useState)({}),{clearSelectedBlock:h,insertBlocks:g,insertDefaultBlock:_}=(0,c.useDispatch)(m.store),f=(0,No.decodeEntities)(s)||(0,ms.__)("Add title"),{value:b,onChange:x,ref:v}=(0,ia.__unstableUseRichText)({value:r,onChange(e){a(e.replace(Yu," "))},placeholder:f,selectionStart:l.start,selectionEnd:l.end,onSelectionChange(e,t){d((s=>{const{start:o,end:n}=s;return o===e&&n===t?s:{start:e,end:t}}))},__unstableDisableFormats:!1});function w(e){g(e,0)}const S=rr(Zu,{"is-selected":o});return(0,P.jsx)(Ga,{supportKeys:"title",children:(0,P.jsx)("h1",{ref:(0,p.useMergeRefs)([v,i]),contentEditable:!0,className:S,"aria-label":f,role:"textbox","aria-multiline":"true",onFocus:function(){n(!0),h()},onBlur:function(){n(!1),d({})},onKeyDown:function(e){e.keyCode===ta.ENTER&&(e.preventDefault(),_(void 0,void 0,0))},onPaste:function(e){const t=e.clipboardData;let s="",o="";try{s=t.getData("text/plain"),o=t.getData("text/html")}catch(e){return}window.console.log("Received HTML:\n\n",o),window.console.log("Received plain text:\n\n",s);const n=(0,y.pasteHandler)({HTML:o,plainText:s});if(e.preventDefault(),n.length)if("string"!=typeof n){const[e]=n;if(r||"core/heading"!==e.name&&"core/paragraph"!==e.name)w(n);else{const t=(0,Wu.__unstableStripHTML)(e.attributes.content);a(t),w(n.slice(1))}}else{const e=(0,Wu.__unstableStripHTML)(n);x((0,ia.insert)(b,(0,ia.create)({html:e})))}}})})}));const Xu=(0,u.forwardRef)((function(e,t){const{placeholder:s}=(0,c.useSelect)((e=>{const{getSettings:t}=e(m.store),{titlePlaceholder:s}=t();return{placeholder:s}}),[]),[o,n]=(0,u.useState)(!1),{title:i,setTitle:r}=qu(),{ref:a}=Ku(t),l=rr(Zu,{"is-selected":o,"is-raw-text":!0}),d=(0,No.decodeEntities)(s)||(0,ms.__)("Add title");return(0,P.jsx)(Ao.TextareaControl,{ref:a,value:i,onChange:function(e){r(e.replace(Yu," "))},onFocus:function(){n(!0)},onBlur:function(){n(!1)},label:s,className:l,placeholder:d,hideLabelFromVision:!0,autoComplete:"off",dir:"auto",rows:1,__nextHasNoMarginBottom:!0})}));function Ju({children:e}){const{canTrashPost:t}=(0,c.useSelect)((e=>{const{isEditedPostNew:t,getCurrentPostId:s,getCurrentPostType:o}=e(Wi),{canUser:n}=e(d.store),i=o(),r=s(),a=t(),l=!!r&&n("delete",{kind:"postType",name:i,id:r});return{canTrashPost:(!a||r)&&l&&!V.includes(i)}}),[]);return t?e:null}function ep({onActionPerformed:e}){const t=(0,c.useRegistry)(),{isNew:s,isDeleting:o,postId:n,title:i}=(0,c.useSelect)((e=>{const t=e(Wi);return{isNew:t.isEditedPostNew(),isDeleting:t.isDeletingPost(),postId:t.getCurrentPostId(),title:t.getCurrentPostAttribute("title")}}),[]),{trashPost:r}=(0,c.useDispatch)(Wi),[a,l]=(0,u.useState)(!1);if(s||!n)return null;return(0,P.jsxs)(Ju,{children:[(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,className:"editor-post-trash",isDestructive:!0,variant:"secondary",isBusy:o,"aria-disabled":o,onClick:o?void 0:()=>l(!0),children:(0,ms.__)("Move to trash")}),(0,P.jsx)(Ao.__experimentalConfirmDialog,{isOpen:a,onConfirm:async()=>{l(!1),await r();const s=await t.resolveSelect(Wi).getCurrentPost();e?.("move-to-trash",[s])},onCancel:()=>l(!1),confirmButtonText:(0,ms.__)("Move to trash"),size:"small",children:(0,ms.sprintf)((0,ms.__)('Are you sure you want to move "%s" to the trash?'),i)})]})}const tp=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"})});function sp({onClose:e}){const{isEditable:t,postSlug:s,postLink:o,permalinkPrefix:n,permalinkSuffix:i,permalink:r}=(0,c.useSelect)((e=>{var t;const s=e(Wi).getCurrentPost(),o=e(Wi).getCurrentPostType(),n=e(d.store).getPostType(o),i=e(Wi).getPermalinkParts(),r=null!==(t=s?._links?.["wp:action-publish"])&&void 0!==t&&t;return{isEditable:e(Wi).isPermalinkEditable()&&r,postSlug:(0,v.safeDecodeURIComponent)(e(Wi).getEditedPostSlug()),viewPostLabel:n?.labels.view_item,postLink:s.link,permalinkPrefix:i?.prefix,permalinkSuffix:i?.suffix,permalink:(0,v.safeDecodeURIComponent)(e(Wi).getPermalink())}}),[]),{editPost:a}=(0,c.useDispatch)(Wi),{createNotice:l}=(0,c.useDispatch)(hs.store),[h,g]=(0,u.useState)(!1),_=(0,p.useCopyToClipboard)(r,(()=>{l("info",(0,ms.__)("Copied URL to clipboard."),{isDismissible:!0,type:"snackbar"})}));return(0,P.jsxs)("div",{className:"editor-post-url",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Link"),onClose:e}),(0,P.jsxs)(Ao.__experimentalVStack,{spacing:3,children:[t&&(0,P.jsx)("div",{children:(0,u.createInterpolateElement)((0,ms.__)("Customize the last part of the URL. Learn more."),{a:(0,P.jsx)(Ao.ExternalLink,{href:(0,ms.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink")})})}),(0,P.jsxs)("div",{children:[t&&(0,P.jsx)(Ao.__experimentalInputControl,{__next40pxDefaultSize:!0,prefix:(0,P.jsx)(Ao.__experimentalInputControlPrefixWrapper,{children:"/"}),suffix:(0,P.jsx)(Ao.__experimentalInputControlSuffixWrapper,{variant:"control",children:(0,P.jsx)(Ao.Button,{icon:tp,ref:_,size:"small",label:"Copy"})}),label:(0,ms.__)("Link"),hideLabelFromVision:!0,value:h?"":s,autoComplete:"off",spellCheck:"false",type:"text",className:"editor-post-url__input",onChange:e=>{a({slug:e}),e?h&&g(!1):h||g(!0)},onBlur:e=>{a({slug:(0,v.cleanForSlug)(e.target.value)}),h&&g(!1)},help:(0,P.jsxs)(Ao.ExternalLink,{className:"editor-post-url__link",href:o,target:"_blank",children:[(0,P.jsx)("span",{className:"editor-post-url__link-prefix",children:n}),(0,P.jsx)("span",{className:"editor-post-url__link-slug",children:s}),(0,P.jsx)("span",{className:"editor-post-url__link-suffix",children:i})]})}),!t&&(0,P.jsx)(Ao.ExternalLink,{className:"editor-post-url__link",href:o,target:"_blank",children:o})]})]})]})}function op({children:e}){const t=(0,c.useSelect)((e=>{const t=e(Wi).getCurrentPostType(),s=e(d.store).getPostType(t);if(!s?.viewable)return!1;if(!e(Wi).getCurrentPost().link)return!1;return!!e(Wi).getPermalinkParts()}),[]);return t?e:null}function np(){return ip()}function ip(){const e=(0,c.useSelect)((e=>e(Wi).getPermalink()),[]);return(0,v.filterURLForDisplay)((0,v.safeDecodeURIComponent)(e))}function rp(){const[e,t]=(0,u.useState)(null),s=(0,u.useMemo)((()=>({anchor:e,placement:"left-start",offset:36,shift:!0})),[e]);return(0,P.jsx)(op,{children:(0,P.jsx)(Ka,{label:(0,ms.__)("Link"),ref:t,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:s,className:"editor-post-url__panel-dropdown",contentClassName:"editor-post-url__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(ap,{isOpen:e,onClick:t}),renderContent:({onClose:e})=>(0,P.jsx)(sp,{onClose:e})})})})}function ap({isOpen:e,onClick:t}){const{slug:s,isFrontPage:o,postLink:n}=(0,c.useSelect)((e=>{const{getCurrentPostId:t,getCurrentPost:s}=e(Wi),{getEditedEntityRecord:o,canUser:n}=e(d.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0,r=t();return{slug:e(Wi).getEditedPostSlug(),isFrontPage:i?.page_on_front===r,postLink:s()?.link}}),[]),i=(0,v.safeDecodeURIComponent)(s);return(0,P.jsx)(Ao.Button,{size:"compact",className:"editor-post-url__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change link: %s"),i),onClick:t,children:(0,P.jsx)(Ao.__experimentalTruncate,{numberOfLines:1,children:o?n:`/${i}`})})}function lp({render:e}){return e({canEdit:(0,c.useSelect)((e=>{var t;return null!==(t=e(Wi).getCurrentPost()._links?.["wp:action-publish"])&&void 0!==t&&t}))})}const cp=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})}),dp=window.wp.wordcount;function up(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostAttribute("content")),[]),t=(0,ms._x)("words","Word count type. Do not translate!");return(0,P.jsx)("span",{className:"word-count",children:(0,dp.count)(e,t)})}const pp=189;function hp(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostAttribute("content")),[]),t=(0,ms._x)("words","Word count type. Do not translate!"),s=Math.round((0,dp.count)(e,t)/pp),o=0===s?(0,u.createInterpolateElement)((0,ms.__)("< 1 minute"),{span:(0,P.jsx)("span",{})}):(0,u.createInterpolateElement)((0,ms.sprintf)((0,ms._n)("%s minute","%s minutes",s),s),{span:(0,P.jsx)("span",{})});return(0,P.jsx)("span",{className:"time-to-read",children:o})}function mp(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostAttribute("content")),[]);return(0,dp.count)(e,"characters_including_spaces")}const gp=function({hasOutlineItemsDisabled:e,onRequestClose:t}){const{headingCount:s,paragraphCount:o,numberOfBlocks:n}=(0,c.useSelect)((e=>{const{getGlobalBlockCount:t}=e(m.store);return{headingCount:t("core/heading"),paragraphCount:t("core/paragraph"),numberOfBlocks:t()}}),[]);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":(0,ms.__)("Document Statistics"),tabIndex:"0",children:(0,P.jsxs)("ul",{role:"list",className:"table-of-contents__counts",children:[(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Words"),(0,P.jsx)(up,{})]}),(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Characters"),(0,P.jsx)("span",{className:"table-of-contents__number",children:(0,P.jsx)(mp,{})})]}),(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Time to read"),(0,P.jsx)(hp,{})]}),(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Headings"),(0,P.jsx)("span",{className:"table-of-contents__number",children:s})]}),(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Paragraphs"),(0,P.jsx)("span",{className:"table-of-contents__number",children:o})]}),(0,P.jsxs)("li",{className:"table-of-contents__count",children:[(0,ms.__)("Blocks"),(0,P.jsx)("span",{className:"table-of-contents__number",children:n})]})]})}),s>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("hr",{}),(0,P.jsx)("h2",{className:"table-of-contents__title",children:(0,ms.__)("Document Outline")}),(0,P.jsx)(ma,{onSelect:t,hasOutlineItemsDisabled:e})]})]})};const _p=(0,u.forwardRef)((function({hasOutlineItemsDisabled:e,repositionDropdown:t,...s},o){const n=(0,c.useSelect)((e=>!!e(m.store).getBlockCount()),[]);return(0,P.jsx)(Ao.Dropdown,{popoverProps:{placement:t?"right":"bottom"},className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,...s,ref:o,onClick:n?t:void 0,icon:cp,"aria-expanded":e,"aria-haspopup":"true",label:(0,ms.__)("Details"),tooltipPosition:"bottom","aria-disabled":!n}),renderContent:({onClose:t})=>(0,P.jsx)(gp,{onRequestClose:t,hasOutlineItemsDisabled:e})})}));function fp(){const{__experimentalGetDirtyEntityRecords:e}=(0,c.useSelect)(d.store);return(0,u.useEffect)((()=>{const t=t=>{if(e().length>0)return t.returnValue=(0,ms.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}const bp=(0,p.createHigherOrderComponent)((e=>({useSubRegistry:t=!0,...s})=>{const o=(0,c.useRegistry)(),[n]=(0,u.useState)((()=>new WeakMap)),i=function(e,t,s){if(!s)return t;let o=e.get(t);return o||(o=(0,c.createRegistry)({"core/block-editor":m.storeConfig},t),o.registerStore("core/editor",$i),e.set(t,o)),o}(n,o,t);return i===o?(0,P.jsx)(e,{registry:o,...s}):(0,P.jsx)(c.RegistryProvider,{value:i,children:(0,P.jsx)(e,{registry:i,...s})})}),"withRegistryProvider"),yp=(e,t)=>`${t}`,xp=e=>`href="${e}" target="_blank" rel="noreferrer noopener"`,vp=e=>{const{title:t,foreign_landing_url:s,creator:o,creator_url:n,license:i,license_version:r,license_url:a}=e,l=((e,t)=>{let s=e.trim();return"pdm"!==e&&(s=e.toUpperCase().replace("SAMPLING","Sampling")),t&&(s+=` ${t}`),["pdm","cc0"].includes(e)||(s=`CC ${s}`),s})(i,r),c=(0,No.decodeEntities)(o);let d;return d=c?t?(0,ms.sprintf)((0,ms._x)('"%1$s" by %2$s/ %3$s',"caption"),yp(s,(0,No.decodeEntities)(t)),n?yp(n,c):c,a?yp(`${a}?ref=openverse`,l):l):(0,ms.sprintf)((0,ms._x)("Work by %2$s/ %3$s","caption"),xp(s),n?yp(n,c):c,a?yp(`${a}?ref=openverse`,l):l):t?(0,ms.sprintf)((0,ms._x)('"%1$s"/ %2$s',"caption"),yp(s,(0,No.decodeEntities)(t)),a?yp(`${a}?ref=openverse`,l):l):(0,ms.sprintf)((0,ms._x)("Work/ %2$s","caption"),xp(s),a?yp(`${a}?ref=openverse`,l):l),d.replace(/\s{2}/g," ")},wp=async(e={})=>(await(0,c.resolveSelect)(d.store).getMediaItems({...e,orderBy:e?.search?"relevance":"date"})).map((e=>({...e,alt:e.alt_text,url:e.source_url,previewUrl:e.media_details?.sizes?.medium?.source_url,caption:e.caption?.raw}))),Sp=[{name:"images",labels:{name:(0,ms.__)("Images"),search_items:(0,ms.__)("Search images")},mediaType:"image",fetch:async(e={})=>wp({...e,media_type:"image"})},{name:"videos",labels:{name:(0,ms.__)("Videos"),search_items:(0,ms.__)("Search videos")},mediaType:"video",fetch:async(e={})=>wp({...e,media_type:"video"})},{name:"audio",labels:{name:(0,ms.__)("Audio"),search_items:(0,ms.__)("Search audio")},mediaType:"audio",fetch:async(e={})=>wp({...e,media_type:"audio"})},{name:"openverse",labels:{name:(0,ms.__)("Openverse"),search_items:(0,ms.__)("Search Openverse")},mediaType:"image",async fetch(e={}){const t={...e,mature:!1,excluded_source:"flickr,inaturalist,wikimedia",license:"pdm,cc0"},s={per_page:"page_size",search:"q"},o=new URL("https://api.openverse.org/v1/images/");Object.entries(t).forEach((([e,t])=>{const n=s[e]||e;o.searchParams.set(n,t)}));const n=await window.fetch(o,{headers:{"User-Agent":"WordPress/inserter-media-fetch"}});return(await n.json()).results.map((e=>({...e,title:e.title?.toLowerCase().startsWith("file:")?e.title.slice(5):e.title,sourceId:e.id,id:void 0,caption:vp(e),previewUrl:e.thumbnail})))},getReportUrl:({sourceId:e})=>`https://wordpress.org/openverse/image/${e}/report/`,isExternalResource:!0}],kp=()=>{};function Pp({additionalData:e={},allowedTypes:t,filesList:s,maxUploadFileSize:o,onError:n=kp,onFileChange:i}){const{getCurrentPost:r,getEditorSettings:a}=(0,c.select)(Wi),{lockPostAutosaving:l,unlockPostAutosaving:d,lockPostSaving:u,unlockPostSaving:p}=(0,c.dispatch)(Wi),h=a().allowedMimeTypes,m=`image-upload-${su()}`;let g=!1;o=o||a().maxUploadFileSize;const _=r(),f="number"==typeof _?.id?_.id:_?.wp_id,b=f?{post:f}:{},y=()=>{p(m),d(m),g=!1};(0,Ki.uploadMedia)({allowedTypes:t,filesList:s,onFileChange:e=>{g?y():(u(m),l(m),g=!0),i(e)},additionalData:{...b,...e},maxUploadFileSize:o,onError:({message:e})=>{y(),n(e)},wpAllowedMimeTypes:h})}var Cp=s(66),jp=s.n(Cp); /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function Ep(e){return"[object Object]"===Object.prototype.toString.call(e)}function Tp(e){var t,s;return!1!==Ep(e)&&(void 0===(t=e.constructor)||!1!==Ep(s=t.prototype)&&!1!==s.hasOwnProperty("isPrototypeOf"))}const{GlobalStylesContext:Bp,cleanEmptyObject:Ip}=Xo(m.privateApis);function Np(e,t){return jp()(e,t,{isMergeableObject:Tp,customMerge:e=>{if("backgroundImage"===e)return(e,t)=>t}})}function Ap(){const[e,t,s]=function(){const{globalStylesId:e,isReady:t,settings:s,styles:o,_links:n}=(0,c.useSelect)((e=>{const{getEntityRecord:t,getEditedEntityRecord:s,hasFinishedResolution:o,canUser:n}=e(d.store),i=e(d.store).__experimentalGetCurrentGlobalStylesId();let r;const a=i?n("update",{kind:"root",name:"globalStyles",id:i}):null;i&&"boolean"==typeof a&&(r=a?s("root","globalStyles",i):t("root","globalStyles",i,{context:"view"}));let l=!1;return o("__experimentalGetCurrentGlobalStylesId")&&(l=!i||(a?o("getEditedEntityRecord",["root","globalStyles",i]):o("getEntityRecord",["root","globalStyles",i,{context:"view"}]))),{globalStylesId:i,isReady:l,settings:r?.settings,styles:r?.styles,_links:r?._links}}),[]),{getEditedEntityRecord:i}=(0,c.useSelect)(d.store),{editEntityRecord:r}=(0,c.useDispatch)(d.store);return[t,(0,u.useMemo)((()=>({settings:null!=s?s:{},styles:null!=o?o:{},_links:null!=n?n:{}})),[s,o,n]),(0,u.useCallback)(((t,s={})=>{var o,n,a;const l=i("root","globalStyles",e),c={styles:null!==(o=l?.styles)&&void 0!==o?o:{},settings:null!==(n=l?.settings)&&void 0!==n?n:{},_links:null!==(a=l?._links)&&void 0!==a?a:{}},d="function"==typeof t?t(c):t;r("root","globalStyles",e,{styles:Ip(d.styles)||{},settings:Ip(d.settings)||{},_links:Ip(d._links)||{}},s)}),[e,r,i])]}(),[o,n]=function(){const e=(0,c.useSelect)((e=>e(d.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),i=(0,u.useMemo)((()=>n&&t?Np(n,t):{}),[t,n]);return(0,u.useMemo)((()=>({isReady:e&&o,user:t,base:n,merged:i,setUserConfig:s})),[i,t,n,s,e,o])}const Dp={};function Rp(e){const{getEntityRecords:t,hasFinishedResolution:s}=e(d.store),o=t("postType","wp_block",{per_page:-1});return s("getEntityRecords",["postType","wp_block",{per_page:-1}])?o:void 0}const Mp=["__experimentalBlockDirectory","__experimentalDiscussionSettings","__experimentalFeatures","__experimentalGlobalStylesBaseStyles","alignWide","blockInspectorTabs","allowedMimeTypes","bodyPlaceholder","canLockBlocks","canUpdateBlockBindings","capabilities","clearBlockSelection","codeEditingEnabled","colors","disableCustomColors","disableCustomFontSizes","disableCustomSpacingSizes","disableCustomGradients","disableLayoutStyles","enableCustomLineHeight","enableCustomSpacing","enableCustomUnits","enableOpenverseMediaCategory","fontSizes","gradients","generateAnchors","onNavigateToEntityRecord","imageDefaultSize","imageDimensions","imageEditing","imageSizes","isRTL","locale","maxWidth","postContentAttributes","postsPerPage","readOnly","styles","titlePlaceholder","supportsLayout","widgetTypesToHideFromLegacyWidgetBlock","__unstableHasCustomAppender","__unstableIsPreviewMode","__unstableResolvedAssets","__unstableIsBlockBasedTheme"],{globalStylesDataKey:Op,globalStylesLinksDataKey:Lp,selectBlockPatternsKey:Fp,reusableBlocksSelectKey:Vp,sectionRootClientIdKey:zp}=Xo(m.privateApis);const Up=function(e,t,s,o){var n,i,r,a;const l=(0,p.useViewportMatch)("medium"),{allowRightClickOverrides:h,blockTypes:g,focusMode:_,hasFixedToolbar:f,isDistractionFree:b,keepCaretInsideBlock:x,hasUploadPermissions:v,hiddenBlockTypes:w,canUseUnfilteredHTML:S,userCanCreatePages:k,pageOnFront:P,pageForPosts:C,userPatternCategories:E,restBlockPatternCategories:T,sectionRootClientId:B}=(0,c.useSelect)((e=>{var n;const{canUser:i,getRawEntityRecord:r,getEntityRecord:a,getUserPatternCategories:c,getBlockPatternCategories:u}=e(d.store),{get:p}=e(j.store),{getBlockTypes:h}=e(y.store),{getBlocksByName:g,getBlockAttributes:_}=e(m.store),f=i("read",{kind:"root",name:"site"})?a("root","site"):void 0;return{allowRightClickOverrides:p("core","allowRightClickOverrides"),blockTypes:h(),canUseUnfilteredHTML:r("postType",t,s)?._links?.hasOwnProperty("wp:action-unfiltered-html"),focusMode:p("core","focusMode"),hasFixedToolbar:p("core","fixedToolbar")||!l,hiddenBlockTypes:p("core","hiddenBlockTypes"),isDistractionFree:p("core","distractionFree"),keepCaretInsideBlock:p("core","keepCaretInsideBlock"),hasUploadPermissions:null===(n=i("create",{kind:"root",name:"media"}))||void 0===n||n,userCanCreatePages:i("create",{kind:"postType",name:"page"}),pageOnFront:f?.page_on_front,pageForPosts:f?.page_for_posts,userPatternCategories:c(),restBlockPatternCategories:u(),sectionRootClientId:"template-locked"===o?null!==(x=g("core/post-content")?.[0])&&void 0!==x?x:"":null!==(b=g("core/group").find((e=>"main"===_(e)?.tagName)))&&void 0!==b?b:""};var b,x}),[t,s,l,o]),{merged:I}=Ap(),N=null!==(n=I.styles)&&void 0!==n?n:Dp,A=null!==(i=I._links)&&void 0!==i?i:Dp,D=null!==(r=e.__experimentalAdditionalBlockPatterns)&&void 0!==r?r:e.__experimentalBlockPatterns,R=null!==(a=e.__experimentalAdditionalBlockPatternCategories)&&void 0!==a?a:e.__experimentalBlockPatternCategories,M=(0,u.useMemo)((()=>[...D||[]].filter((({postTypes:e})=>!e||Array.isArray(e)&&e.includes(t)))),[D,t]),O=(0,u.useMemo)((()=>[...R||[],...T||[]].filter(((e,t,s)=>t===s.findIndex((t=>e.name===t.name))))),[R,T]),{undo:L,setIsInserterOpened:F}=(0,c.useDispatch)(Wi),{saveEntityRecord:V}=(0,c.useDispatch)(d.store),z=(0,u.useCallback)((e=>k?V("postType","page",e):Promise.reject({message:(0,ms.__)("You do not have permission to create Pages.")})),[V,k]),U=(0,u.useMemo)((()=>{if(w&&w.length>0){return(!0===e.allowedBlockTypes?g.map((({name:e})=>e)):e.allowedBlockTypes||[]).filter((e=>!w.includes(e)))}return e.allowedBlockTypes}),[e.allowedBlockTypes,w,g]),H=!1===e.focusMode;return(0,u.useMemo)((()=>{const s={...Object.fromEntries(Object.entries(e).filter((([e])=>Mp.includes(e)))),[Op]:N,[Lp]:A,allowedBlockTypes:U,allowRightClickOverrides:h,focusMode:_&&!H,hasFixedToolbar:f,isDistractionFree:b,keepCaretInsideBlock:x,mediaUpload:v?Pp:void 0,__experimentalBlockPatterns:M,[Fp]:e=>{const{hasFinishedResolution:s,getBlockPatternsForPostType:o}=Xo(e(d.store)),n=o(t);return s("getBlockPatterns")?n:void 0},[Vp]:Rp,__experimentalBlockPatternCategories:O,__experimentalUserPatternCategories:E,__experimentalFetchLinkSuggestions:(t,s)=>(0,d.__experimentalFetchLinkSuggestions)(t,s,e),inserterMediaCategories:Sp,__experimentalFetchRichUrlData:d.__experimentalFetchUrlData,__experimentalCanUserUseUnfilteredHTML:S,__experimentalUndo:L,outlineMode:!b&&"wp_template"===t,__experimentalCreatePageEntity:z,__experimentalUserCanCreatePages:k,pageOnFront:P,pageForPosts:C,__experimentalPreferPatternsOnRoot:"wp_template"===t,templateLock:"wp_navigation"===t?"insert":e.templateLock,template:"wp_navigation"===t?[["core/navigation",{},[]]]:e.template,__experimentalSetIsInserterOpened:F,[zp]:B};return s}),[U,h,_,H,f,b,x,e,v,E,M,O,S,L,z,k,P,C,t,F,B,N,A])},Hp=["core/post-title","core/post-featured-image","core/post-content"];function Gp(){const e=(0,u.useMemo)((()=>[...(0,h.applyFilters)("editor.postContentBlockTypes",Hp),"core/template-part"]),[]),t=(0,c.useSelect)((t=>{const{getPostBlocksByName:s}=Xo(t(Wi));return s(e)}),[e]),s=(0,c.useSelect)((e=>{const{getBlocksByName:t,getBlockOrder:s}=e(m.store);return t("core/template-part").flatMap((e=>s(e)))}),[]),o=(0,c.useRegistry)();return(0,u.useEffect)((()=>{const{setBlockEditingMode:e,unsetBlockEditingMode:n}=o.dispatch(m.store);return o.batch((()=>{e("","disabled");for(const s of t)e(s,"contentOnly");for(const t of s)e(t,"disabled")})),()=>{o.batch((()=>{n("");for(const e of t)n(e);for(const e of s)n(e)}))}}),[t,s,o]),null}function $p(){const e=(0,c.useSelect)((e=>e(m.store).getBlockOrder()?.[0]),[]),{setBlockEditingMode:t,unsetBlockEditingMode:s}=(0,c.useDispatch)(m.store);(0,u.useEffect)((()=>{if(e)return t(e,"contentOnly"),()=>{s(e)}}),[e,s,t])}const Wp=["wp_block","wp_template","wp_template_part"];const Zp=(0,P.jsxs)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,P.jsx)(k.Path,{d:"m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"}),(0,P.jsx)(k.Path,{d:"m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"})]}),Yp=(0,P.jsx)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)(k.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})}),Kp=(0,P.jsx)(k.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,P.jsx)(k.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})}),qp=(0,P.jsx)(k.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.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"})}),Qp=(0,P.jsx)(k.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.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"})}),Xp=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})}),Jp=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),eh=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),{RenamePatternModal:th}=Xo(nn.privateApis),sh="editor/pattern-rename";function oh(){const{record:e,postType:t}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi),{getEditedEntityRecord:o}=e(d.store),n=t();return{record:o("postType",n,s()),postType:n}}),[]),{closeModal:s}=(0,c.useDispatch)(Er);return(0,c.useSelect)((e=>e(Er).isModalActive(sh)))&&t===M?(0,P.jsx)(th,{onClose:s,pattern:e}):null}const{DuplicatePatternModal:nh}=Xo(nn.privateApis),ih="editor/pattern-duplicate";function rh(){const{record:e,postType:t}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi),{getEditedEntityRecord:o}=e(d.store),n=t();return{record:o("postType",n,s()),postType:n}}),[]),{closeModal:s}=(0,c.useDispatch)(Er);return(0,c.useSelect)((e=>e(Er).isModalActive(ih)))&&t===M?(0,P.jsx)(nh,{onClose:s,onSuccess:()=>s(),pattern:e}):null}function ah(){const{editorMode:e,isListViewOpen:t,showBlockBreadcrumbs:s,isDistractionFree:o,isTopToolbar:n,isFocusMode:i,isPreviewMode:r,isViewable:a,isCodeEditingEnabled:l,isRichEditingEnabled:u,isPublishSidebarEnabled:p}=(0,c.useSelect)((e=>{var t,s;const{get:o}=e(j.store),{isListViewOpened:n,getCurrentPostType:i,getEditorSettings:r}=e(Wi),{getSettings:a}=e(m.store),{getPostType:l}=e(d.store);return{editorMode:null!==(t=o("core","editorMode"))&&void 0!==t?t:"visual",isListViewOpen:n(),showBlockBreadcrumbs:o("core","showBlockBreadcrumbs"),isDistractionFree:o("core","distractionFree"),isFocusMode:o("core","focusMode"),isTopToolbar:o("core","fixedToolbar"),isPreviewMode:a().__unstableIsPreviewMode,isViewable:null!==(s=l(i())?.viewable)&&void 0!==s&&s,isCodeEditingEnabled:r().codeEditingEnabled,isRichEditingEnabled:r().richEditingEnabled,isPublishSidebarEnabled:e(Wi).isPublishSidebarEnabled()}}),[]),{getActiveComplementaryArea:h}=(0,c.useSelect)(Er),{toggle:g}=(0,c.useDispatch)(j.store),{createInfoNotice:_}=(0,c.useDispatch)(hs.store),{__unstableSaveForPreview:f,setIsListViewOpened:b,switchEditorMode:y,toggleDistractionFree:x}=(0,c.useDispatch)(Wi),{openModal:v,enableComplementaryArea:w,disableComplementaryArea:S}=(0,c.useDispatch)(Er),{getCurrentPostId:k}=(0,c.useSelect)(Wi),P=l&&u;if(r)return{commands:[],isLoading:!1};const C=[];return C.push({name:"core/open-shortcut-help",label:(0,ms.__)("Keyboard shortcuts"),icon:Zp,callback:({close:e})=>{e(),v("editor/keyboard-shortcut-help")}}),C.push({name:"core/toggle-distraction-free",label:o?(0,ms.__)("Exit Distraction Free"):(0,ms.__)("Enter Distraction Free"),callback:({close:e})=>{x(),e()}}),C.push({name:"core/open-preferences",label:(0,ms.__)("Editor preferences"),callback:({close:e})=>{e(),v("editor/preferences")}}),C.push({name:"core/toggle-spotlight-mode",label:(0,ms.__)("Toggle spotlight"),callback:({close:e})=>{g("core","focusMode"),e(),_(i?(0,ms.__)("Spotlight off."):(0,ms.__)("Spotlight on."),{id:"core/editor/toggle-spotlight-mode/notice",type:"snackbar",actions:[{label:(0,ms.__)("Undo"),onClick:()=>{g("core","focusMode")}}]})}}),C.push({name:"core/toggle-list-view",label:t?(0,ms.__)("Close List View"):(0,ms.__)("Open List View"),icon:Yp,callback:({close:e})=>{b(!t),e(),_(t?(0,ms.__)("List View off."):(0,ms.__)("List View on."),{id:"core/editor/toggle-list-view/notice",type:"snackbar"})}}),C.push({name:"core/toggle-top-toolbar",label:(0,ms.__)("Toggle top toolbar"),callback:({close:e})=>{g("core","fixedToolbar"),o&&x(),e(),_(n?(0,ms.__)("Top toolbar off."):(0,ms.__)("Top toolbar on."),{id:"core/editor/toggle-top-toolbar/notice",type:"snackbar",actions:[{label:(0,ms.__)("Undo"),onClick:()=>{g("core","fixedToolbar")}}]})}}),P&&C.push({name:"core/toggle-code-editor",label:"visual"===e?(0,ms.__)("Open code editor"):(0,ms.__)("Exit code editor"),icon:Kp,callback:({close:t})=>{y("visual"===e?"text":"visual"),t()}}),C.push({name:"core/toggle-breadcrumbs",label:s?(0,ms.__)("Hide block breadcrumbs"):(0,ms.__)("Show block breadcrumbs"),callback:({close:e})=>{g("core","showBlockBreadcrumbs"),e(),_(s?(0,ms.__)("Breadcrumbs hidden."):(0,ms.__)("Breadcrumbs visible."),{id:"core/editor/toggle-breadcrumbs/notice",type:"snackbar"})}}),C.push({name:"core/open-settings-sidebar",label:(0,ms.__)("Toggle settings sidebar"),icon:(0,ms.isRTL)()?qp:Qp,callback:({close:e})=>{const t=h("core");e(),"edit-post/document"===t?S("core"):w("core","edit-post/document")}}),C.push({name:"core/open-block-inspector",label:(0,ms.__)("Toggle block inspector"),icon:Xp,callback:({close:e})=>{const t=h("core");e(),"edit-post/block"===t?S("core"):w("core","edit-post/block")}}),C.push({name:"core/toggle-publish-sidebar",label:p?(0,ms.__)("Disable pre-publish checks"):(0,ms.__)("Enable pre-publish checks"),icon:Jp,callback:({close:e})=>{e(),g("core","isPublishSidebarEnabled"),_(p?(0,ms.__)("Pre-publish checks disabled."):(0,ms.__)("Pre-publish checks enabled."),{id:"core/editor/publish-sidebar/notice",type:"snackbar"})}}),a&&C.push({name:"core/preview-link",label:(0,ms.__)("Preview in a new tab"),icon:dn,callback:async({close:e})=>{e();const t=k(),s=await f();window.open(s,`wp-preview-${t}`)}}),{commands:C,isLoading:!1}}function lh(){const{postType:e}=(0,c.useSelect)((e=>{const{getCurrentPostType:t}=e(Wi);return{postType:t()}}),[]),{openModal:t}=(0,c.useDispatch)(Er),s=[];return e===M&&(s.push({name:"core/rename-pattern",label:(0,ms.__)("Rename pattern"),icon:eh,callback:({close:e})=>{t(sh),e()}}),s.push({name:"core/duplicate-pattern",label:(0,ms.__)("Duplicate pattern"),icon:Bi,callback:({close:e})=>{t(ih),e()}})),{isLoading:!1,commands:s}}const{BlockRemovalWarningModal:ch}=Xo(m.privateApis),dh=["core/post-content","core/post-template","core/query"],uh=[{postTypes:["wp_template","wp_template_part"],callback(e){if(e.filter((({name:e})=>dh.includes(e))).length)return(0,ms._n)("Deleting this block will stop your post or page content from displaying on this template. It is not recommended.","Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.",e.length)}},{postTypes:["wp_block"],callback(e){if(e.filter((({attributes:e})=>e?.metadata?.bindings&&Object.values(e.metadata.bindings).some((e=>"core/pattern-overrides"===e.source)))).length)return(0,ms._n)("The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?","Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?",e.length)}}];function ph(){const e=(0,c.useSelect)((e=>e(Wi).getCurrentPostType()),[]),t=(0,u.useMemo)((()=>uh.filter((t=>t.postTypes.includes(e)))),[e]);return ch&&t?(0,P.jsx)(ch,{rules:t}):null}function hh(){const{blockPatternsWithPostContentBlockType:e,postType:t}=(0,c.useSelect)((e=>{const{getPatternsByBlockTypes:t,getBlocksByName:s}=e(m.store),{getCurrentPostType:o,getRenderingMode:n}=e(Wi);return{blockPatternsWithPostContentBlockType:t("core/post-content","post-only"===n()?"":s("core/post-content")?.[0]),postType:o()}}),[]);return(0,u.useMemo)((()=>e?.length?e.filter((e=>"page"===t&&!e.postTypes||Array.isArray(e.postTypes)&&e.postTypes.includes(t))):[]),[t,e])}function mh({blockPatterns:e,onChoosePattern:t}){const s=(0,p.useAsyncList)(e),{editEntityRecord:o}=(0,c.useDispatch)(d.store),{postType:n,postId:i}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi);return{postType:t(),postId:s()}}),[]);return(0,P.jsx)(m.__experimentalBlockPatternsList,{blockPatterns:e,shownPatterns:s,onClickPattern:(e,s)=>{o("postType",n,i,{blocks:s,content:({blocks:e=[]})=>(0,y.__unstableSerializeAndClean)(e)}),t()}})}function gh({onClose:e}){const t=hh();return t.length>0?(0,P.jsx)(Ao.Modal,{title:(0,ms.__)("Choose a pattern"),isFullScreen:!0,onRequestClose:e,children:(0,P.jsx)("div",{className:"editor-start-page-options__modal-content",children:(0,P.jsx)(mh,{blockPatterns:t,onChoosePattern:e})})}):null}function _h(){const[e,t]=(0,u.useState)(!1),s=(0,c.useSelect)((e=>{const{isEditedPostDirty:t,isEditedPostEmpty:s,getCurrentPostType:o}=e(Wi),n=e(Er).isModalActive("editor/preferences");return e(j.store).get("core","enableChoosePatternModal")&&!n&&!t()&&s()&&D!==o()}),[]);return!s||e?null:(0,P.jsx)(gh,{onClose:()=>t(!0)})}const fh=[{keyCombination:{modifier:"primary",character:"b"},description:(0,ms.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,ms.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,ms.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,ms.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,ms.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,ms.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,ms.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,ms.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,ms.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,ms.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,ms.__)("Add non breaking space.")}];function bh({keyCombination:e,forceAriaLabel:t}){const s=e.modifier?ta.displayShortcutList[e.modifier](e.character):e.character,o=e.modifier?ta.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,P.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||o,children:(Array.isArray(s)?s:[s]).map(((e,t)=>"+"===e?(0,P.jsx)(u.Fragment,{children:e},t):(0,P.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key",children:e},t)))})}const yh=function({description:e,keyCombination:t,aliases:s=[],ariaLabel:o}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,P.jsxs)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-term",children:[(0,P.jsx)(bh,{keyCombination:t,forceAriaLabel:o}),s.map(((e,t)=>(0,P.jsx)(bh,{keyCombination:e,forceAriaLabel:o},t)))]})]})};const xh=function({name:e}){const{keyCombination:t,description:s,aliases:o}=(0,c.useSelect)((t=>{const{getShortcutKeyCombination:s,getShortcutDescription:o,getShortcutAliases:n}=t(nr.store);return{keyCombination:s(e),aliases:n(e),description:o(e)}}),[e]);return t?(0,P.jsx)(yh,{keyCombination:t,description:s,aliases:o}):null},vh="editor/keyboard-shortcut-help",wh=({shortcuts:e})=>(0,P.jsx)("ul",{className:"editor-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map(((e,t)=>(0,P.jsx)("li",{className:"editor-keyboard-shortcut-help-modal__shortcut",children:"string"==typeof e?(0,P.jsx)(xh,{name:e}):(0,P.jsx)(yh,{...e})},t)))}),Sh=({title:e,shortcuts:t,className:s})=>(0,P.jsxs)("section",{className:rr("editor-keyboard-shortcut-help-modal__section",s),children:[!!e&&(0,P.jsx)("h2",{className:"editor-keyboard-shortcut-help-modal__section-title",children:e}),(0,P.jsx)(wh,{shortcuts:t})]}),kh=({title:e,categoryName:t,additionalShortcuts:s=[]})=>{const o=(0,c.useSelect)((e=>e(nr.store).getCategoryShortcuts(t)),[t]);return(0,P.jsx)(Sh,{title:e,shortcuts:o.concat(s)})};const Ph=function(){const e=(0,c.useSelect)((e=>e(Er).isModalActive(vh)),[]),{openModal:t,closeModal:s}=(0,c.useDispatch)(Er),o=()=>{e?s():t(vh)};return(0,nr.useShortcut)("core/editor/keyboard-shortcuts",o),e?(0,P.jsxs)(Ao.Modal,{className:"editor-keyboard-shortcut-help-modal",title:(0,ms.__)("Keyboard shortcuts"),closeButtonLabel:(0,ms.__)("Close"),onRequestClose:o,children:[(0,P.jsx)(Sh,{className:"editor-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/editor/keyboard-shortcuts"]}),(0,P.jsx)(kh,{title:(0,ms.__)("Global shortcuts"),categoryName:"global"}),(0,P.jsx)(kh,{title:(0,ms.__)("Selection shortcuts"),categoryName:"selection"}),(0,P.jsx)(kh,{title:(0,ms.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,ms.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,ms.__)("Forward-slash")}]}),(0,P.jsx)(Sh,{title:(0,ms.__)("Text formatting"),shortcuts:fh}),(0,P.jsx)(kh,{title:(0,ms.__)("List View shortcuts"),categoryName:"list-view"})]}):null};function Ch({clientId:e,onClose:t}){const{entity:s,onNavigateToEntityRecord:o,canEditTemplates:n}=(0,c.useSelect)((t=>{const{getBlockEditingMode:s,getBlockParentsByBlockName:o,getSettings:n,getBlockAttributes:i}=t(m.store);if(!("contentOnly"===s(e)))return{};const r=o(e,"core/block",!0)[0];let a;if(r)a=t(d.store).getEntityRecord("postType","wp_block",i(r).ref);else{const{getCurrentTemplateId:s,getRenderingMode:o}=t(Wi),n=s(),{getContentLockingParent:i}=Xo(t(m.store));"template-locked"===o()&&!i(e)&&n&&(a=t(d.store).getEntityRecord("postType","wp_template",n))}return{canEditTemplates:t(d.store).canUser("create",{kind:"postType",name:"wp_template"}),entity:a,onNavigateToEntityRecord:n().onNavigateToEntityRecord}}),[e]);if(!s)return(0,P.jsx)(jh,{clientId:e,onClose:t});const i="wp_block"===s.type;let r=i?(0,ms.__)("Edit the pattern to move, delete, or make further changes to this block."):(0,ms.__)("Edit the template to move, delete, or make further changes to this block.");return n||(r=(0,ms.__)("Only users with permissions to edit the template can move or delete this block")),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__unstableBlockSettingsMenuFirstItem,{children:(0,P.jsx)(Ao.MenuItem,{onClick:()=>{o({postId:s.id,postType:s.type})},disabled:!n,children:i?(0,ms.__)("Edit pattern"):(0,ms.__)("Edit template")})}),(0,P.jsx)(Ao.__experimentalText,{variant:"muted",as:"p",className:"editor-content-only-settings-menu__description",children:r})]})}function jh({clientId:e,onClose:t}){const{contentLockingParent:s}=(0,c.useSelect)((t=>{const{getContentLockingParent:s}=Xo(t(m.store));return{contentLockingParent:s(e)}}),[e]),o=(0,m.useBlockDisplayInformation)(s),n=(0,c.useDispatch)(m.store);if(!o?.title)return null;const{modifyContentLockBlock:i}=Xo(n);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__unstableBlockSettingsMenuFirstItem,{children:(0,P.jsx)(Ao.MenuItem,{onClick:()=>{i(s),t()},children:(0,ms._x)("Unlock","Unlock content locked blocks")})}),(0,P.jsx)(Ao.__experimentalText,{variant:"muted",as:"p",className:"editor-content-only-settings-menu__description",children:(0,ms.__)("Temporarily unlock the parent block to edit, delete or make further changes to this block.")})]})}function Eh(){return(0,P.jsx)(m.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>1===e.length&&(0,P.jsx)(Ch,{clientId:e[0],onClose:t})})}function Th(e){const{slug:t,patterns:s}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi),{getEntityRecord:o,getBlockPatterns:n}=e(d.store),i=s();return{slug:o("postType",t(),i).slug,patterns:n()}}),[]),o=(0,c.useSelect)((e=>e(d.store).getCurrentTheme().stylesheet));return(0,u.useMemo)((()=>[{name:"fallback",blocks:(0,y.parse)(e),title:(0,ms.__)("Fallback content")},...s.filter((e=>Array.isArray(e.templateTypes)&&e.templateTypes.some((e=>t.startsWith(e))))).map((e=>({...e,blocks:(0,y.parse)(e.content).map((e=>function(e){return e.innerBlocks.find((e=>"core/template-part"===e.name))&&(e.innerBlocks=e.innerBlocks.map((e=>("core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=o),e)))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=o),e}(e)))})))]),[e,t,s])}function Bh({fallbackContent:e,onChoosePattern:t,postType:s}){const[,,o]=(0,d.useEntityBlockEditor)("postType",s),n=Th(e),i=(0,p.useAsyncList)(n);return(0,P.jsx)(m.__experimentalBlockPatternsList,{blockPatterns:n,shownPatterns:i,onClickPattern:(e,s)=>{o(s,{selection:void 0}),t()}})}function Ih({slug:e,isCustom:t,onClose:s,postType:o}){const n=function(e,t=!1){return(0,c.useSelect)((s=>{const{getEntityRecord:o,getDefaultTemplateId:n}=s(d.store),i=n({slug:e,is_custom:t,ignore_empty:!0});return i?o("postType",D,i)?.content?.raw:void 0}),[e,t])}(e,t);return n?(0,P.jsxs)(Ao.Modal,{className:"editor-start-template-options__modal",title:(0,ms.__)("Choose a pattern"),closeLabel:(0,ms.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:s,isFullScreen:!0,children:[(0,P.jsx)("div",{className:"editor-start-template-options__modal-content",children:(0,P.jsx)(Bh,{fallbackContent:n,slug:e,isCustom:t,postType:o,onChoosePattern:()=>{s()}})}),(0,P.jsx)(Ao.Flex,{className:"editor-start-template-options__modal__actions",justify:"flex-end",expanded:!1,children:(0,P.jsx)(Ao.FlexItem,{children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:s,children:(0,ms.__)("Skip")})})})]}):null}function Nh(){const[e,t]=(0,u.useState)(!1),{shouldOpenModal:s,slug:o,isCustom:n,postType:i,postId:r}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi),o=t(),n=s(),{getEditedEntityRecord:i,hasEditsForEntityRecord:r}=e(d.store),a=i("postType",o,n);return{shouldOpenModal:!r("postType",o,n)&&""===a.content&&D===o,slug:a.slug,isCustom:a.is_custom,postType:o,postId:n}}),[]);return(0,u.useEffect)((()=>{t(!1)}),[i,r]),!s||e?null:(0,P.jsx)(Ih,{slug:o,isCustom:n,postType:i,onClose:()=>t(!0)})}function Ah({clientId:e,onClose:t}){const{getBlocks:s}=(0,c.useSelect)(m.store),{replaceBlocks:o}=(0,c.useDispatch)(m.store);return(0,c.useSelect)((t=>t(m.store).canRemoveBlock(e)),[e])?(0,P.jsx)(Ao.MenuItem,{onClick:()=>{o(e,s(e)),t()},children:(0,ms.__)("Detach")}):null}function Dh({clientIds:e,blocks:t}){const[s,o]=(0,u.useState)(!1),{replaceBlocks:n}=(0,c.useDispatch)(m.store),{createSuccessNotice:i}=(0,c.useDispatch)(hs.store),{canCreate:r}=(0,c.useSelect)((e=>({canCreate:e(m.store).canInsertBlockType("core/template-part")})),[]);if(!r)return null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.MenuItem,{icon:G,onClick:()=>{o(!0)},"aria-expanded":s,"aria-haspopup":"dialog",children:(0,ms.__)("Create template part")}),s&&(0,P.jsx)(Uo,{closeModal:()=>{o(!1)},blocks:t,onCreate:async t=>{n(e,(0,y.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),i((0,ms.__)("Template part created."),{type:"snackbar"})}})]})}function Rh(){return(0,P.jsx)(m.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>(0,P.jsx)(Mh,{clientIds:e,onClose:t})})}function Mh({clientIds:e,onClose:t}){const{isContentOnly:s,blocks:o}=(0,c.useSelect)((t=>{const{getBlocksByClientId:s,getBlockEditingMode:o}=t(m.store);return{blocks:s(e),isContentOnly:1===e.length&&"contentOnly"===o(e[0])}}),[e]);return s?null:1===o.length&&"core/template-part"===o[0]?.name?(0,P.jsx)(Ah,{clientId:e[0],onClose:t}):(0,P.jsx)(Dh,{clientIds:e,blocks:o})}const{ExperimentalBlockEditorProvider:Oh}=Xo(m.privateApis),{PatternsMenuItems:Lh}=Xo(nn.privateApis),Fh=()=>{},Vh=["wp_block","wp_navigation","wp_template_part"];const zh=bp((({post:e,settings:t,recovery:s,initialEdits:o,children:n,BlockEditorProviderComponent:i=Oh,__unstableTemplate:r})=>{const{editorSettings:a,selection:l,isReady:p,mode:g,postTypeEntities:_}=(0,c.useSelect)((t=>{const{getEditorSettings:s,getEditorSelection:o,getRenderingMode:n,__unstableIsEditorReady:i}=t(Wi),{getEntitiesConfig:r}=t(d.store);return{editorSettings:s(),isReady:i(),mode:n(),selection:o(),postTypeEntities:"wp_template"===e.type?r("postType"):null}}),[e.type]),f=(0,c.useSelect)((e=>{const{__unstableGetEditorMode:t}=Xo(e(m.store));return"zoom-out"===t()})),b=!!r&&"post-only"!==g,x=b?r:e,v=(0,u.useMemo)((()=>{const t={};if("wp_template"===e.type){if("page"===e.slug)t.postType="page";else if("single"===e.slug)t.postType="post";else if("single"===e.slug.split("-")[0]){const s=_?.map((e=>e.name))||[],o=e.slug.match(`^single-(${s.join("|")})(?:-.+)?$`);o&&(t.postType=o[1])}}else Vh.includes(x.type)&&!b||(t.postId=e.id,t.postType=e.type);return{...t,templateSlug:"wp_template"===x.type?x.slug:void 0}}),[b,e.id,e.type,e.slug,x.type,x.slug,_]),{id:w,type:S}=x,k=Up(a,S,w,g),[C,j,E]=function(e,t,s){const o="post-only"!==s&&t?"template":"post",[n,i,r]=(0,d.useEntityBlockEditor)("postType",e.type,{id:e.id}),[a,l,c]=(0,d.useEntityBlockEditor)("postType",t?.type,{id:t?.id}),p=(0,u.useMemo)((()=>{if("wp_navigation"===e.type)return[(0,y.createBlock)("core/navigation",{ref:e.id,templateLock:!1})]}),[e.type,e.id]),h=(0,u.useMemo)((()=>p||("template"===o?a:n)),[p,o,a,n]);return t&&"template-locked"===s||"wp_navigation"===e.type?[h,Fh,Fh]:[h,"post"===o?i:l,"post"===o?r:c]}(e,r,g),{updatePostLock:T,setupEditor:B,updateEditorSettings:I,setCurrentTemplateId:N,setEditedPost:A,setRenderingMode:D}=Xo((0,c.useDispatch)(Wi)),{createWarningNotice:R}=(0,c.useDispatch)(hs.store);return(0,u.useLayoutEffect)((()=>{s||(T(t.postLock),B(e,o,t.template),t.autosave&&R((0,ms.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:(0,ms.__)("View the autosave"),url:t.autosave.editLink}]}))}),[]),(0,u.useEffect)((()=>{A(e.type,e.id)}),[e.type,e.id,A]),(0,u.useEffect)((()=>{I(t)}),[t,I]),(0,u.useEffect)((()=>{N(r?.id)}),[r?.id,N]),(0,u.useEffect)((()=>{var e;D(null!==(e=t.defaultRenderingMode)&&void 0!==e?e:"post-only")}),[t.defaultRenderingMode,D]),function(e,t){(0,u.useEffect)((()=>((0,h.addFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter",((s,o)=>!(!Wp.includes(e)&&"core/template-part"===o.name&&"post-only"===t)&&s)),(0,h.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",((t,s,o,{getBlockParentsByBlockName:n})=>Wp.includes(e)||"core/post-content"!==s.name?t:n(o,"core/query").length>0)),()=>{(0,h.removeFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter"),(0,h.removeFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter")})),[e,t])}(e.type,g),(0,sa.useCommandLoader)({name:"core/editor/edit-ui",hook:ah}),(0,sa.useCommandLoader)({name:"core/editor/contextual-commands",hook:lh,context:"entity-edit"}),p?(0,P.jsx)(d.EntityProvider,{kind:"root",type:"site",children:(0,P.jsx)(d.EntityProvider,{kind:"postType",type:e.type,id:e.id,children:(0,P.jsx)(m.BlockContextProvider,{value:v,children:(0,P.jsxs)(i,{value:C,onChange:E,onInput:j,selection:l,settings:k,useSubRegistry:!1,children:[n,!t.__unstableIsPreviewMode&&(0,P.jsxs)(P.Fragment,{children:[!f&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Lh,{}),(0,P.jsx)(Rh,{}),(0,P.jsx)(Eh,{})]}),"template-locked"===g&&(0,P.jsx)(Gp,{}),"wp_navigation"===S&&(0,P.jsx)($p,{}),(0,P.jsx)(qr,{}),(0,P.jsx)(Ph,{}),(0,P.jsx)(ph,{}),(0,P.jsx)(_h,{}),(0,P.jsx)(Nh,{}),(0,P.jsx)(oh,{}),(0,P.jsx)(rh,{})]})]})})})}):null}));const Uh=function(e){return(0,P.jsx)(zh,{...e,BlockEditorProviderComponent:m.BlockEditorProvider,children:e.children})},Hh=window.wp.serverSideRender;var Gh=s.n(Hh);function $h(e,t,s=[]){const o=(0,u.forwardRef)(((s,o)=>(S()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),(0,P.jsx)(t,{ref:o,...s}))));return s.forEach((s=>{o[s]=$h(e+"."+s,t[s])})),o}function Wh(e,t){return(...s)=>(S()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),t(...s))}const Zh=$h("RichText",m.RichText,["Content"]);Zh.isEmpty=Wh("RichText.isEmpty",m.RichText.isEmpty);const Yh=$h("Autocomplete",m.Autocomplete),Kh=$h("AlignmentToolbar",m.AlignmentToolbar),qh=$h("BlockAlignmentToolbar",m.BlockAlignmentToolbar),Qh=$h("BlockControls",m.BlockControls,["Slot"]),Xh=$h("BlockEdit",m.BlockEdit),Jh=$h("BlockEditorKeyboardShortcuts",m.BlockEditorKeyboardShortcuts),em=$h("BlockFormatControls",m.BlockFormatControls,["Slot"]),tm=$h("BlockIcon",m.BlockIcon),sm=$h("BlockInspector",m.BlockInspector),om=$h("BlockList",m.BlockList),nm=$h("BlockMover",m.BlockMover),im=$h("BlockNavigationDropdown",m.BlockNavigationDropdown),rm=$h("BlockSelectionClearer",m.BlockSelectionClearer),am=$h("BlockSettingsMenu",m.BlockSettingsMenu),lm=$h("BlockTitle",m.BlockTitle),cm=$h("BlockToolbar",m.BlockToolbar),dm=$h("ColorPalette",m.ColorPalette),um=$h("ContrastChecker",m.ContrastChecker),pm=$h("CopyHandler",m.CopyHandler),hm=$h("DefaultBlockAppender",m.DefaultBlockAppender),mm=$h("FontSizePicker",m.FontSizePicker),gm=$h("Inserter",m.Inserter),_m=$h("InnerBlocks",m.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),fm=$h("InspectorAdvancedControls",m.InspectorAdvancedControls,["Slot"]),bm=$h("InspectorControls",m.InspectorControls,["Slot"]),ym=$h("PanelColorSettings",m.PanelColorSettings),xm=$h("PlainText",m.PlainText),vm=$h("RichTextShortcut",m.RichTextShortcut),wm=$h("RichTextToolbarButton",m.RichTextToolbarButton),Sm=$h("__unstableRichTextInputEvent",m.__unstableRichTextInputEvent),km=$h("MediaPlaceholder",m.MediaPlaceholder),Pm=$h("MediaUpload",m.MediaUpload),Cm=$h("MediaUploadCheck",m.MediaUploadCheck),jm=$h("MultiSelectScrollIntoView",m.MultiSelectScrollIntoView),Em=$h("NavigableToolbar",m.NavigableToolbar),Tm=$h("ObserveTyping",m.ObserveTyping),Bm=$h("SkipToSelectedBlock",m.SkipToSelectedBlock),Im=$h("URLInput",m.URLInput),Nm=$h("URLInputButton",m.URLInputButton),Am=$h("URLPopover",m.URLPopover),Dm=$h("Warning",m.Warning),Rm=$h("WritingFlow",m.WritingFlow),Mm=Wh("createCustomColorsHOC",m.createCustomColorsHOC),Om=Wh("getColorClassName",m.getColorClassName),Lm=Wh("getColorObjectByAttributeValues",m.getColorObjectByAttributeValues),Fm=Wh("getColorObjectByColorValue",m.getColorObjectByColorValue),Vm=Wh("getFontSize",m.getFontSize),zm=Wh("getFontSizeClass",m.getFontSizeClass),Um=Wh("withColorContext",m.withColorContext),Hm=Wh("withColors",m.withColors),Gm=Wh("withFontSizes",m.withFontSizes),$m=qr,Wm=qr;function Zm(e){return S()("wp.editor.cleanForSlug",{since:"12.7",plugin:"Gutenberg",alternative:"wp.url.cleanForSlug"}),(0,v.cleanForSlug)(e)}const{createPrivateSlotFill:Ym}=Xo(Ao.privateApis),Km=Ym("EditCanvasContainerSlot"),qm="__experimentalMainDashboardButton",{Fill:Qm,Slot:Xm}=(0,Ao.createSlotFill)(qm),Jm=Qm;Jm.Slot=()=>{const e=(0,Ao.__experimentalUseSlotFills)(qm);return(0,P.jsx)(Xm,{bubblesVirtually:!0,fillProps:{length:e?e.length:0}})};const eg=Jm,tg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),sg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})}),{useHasBlockToolbar:og}=Xo(m.privateApis);function ng({isCollapsed:e,onToggle:t}){const{blockSelectionStart:s}=(0,c.useSelect)((e=>({blockSelectionStart:e(m.store).getBlockSelectionStart()})),[]),o=og(),n=!!s;return(0,u.useEffect)((()=>{s&&t(!1)}),[s,t]),o?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:rr("editor-collapsible-block-toolbar",{"is-collapsed":e||!n}),children:(0,P.jsx)(m.BlockToolbar,{hideDragHandle:!0})}),(0,P.jsx)(Ao.Popover.Slot,{name:"block-toolbar"}),(0,P.jsx)(Ao.Button,{className:"editor-collapsible-block-toolbar__toggle",icon:e?tg:sg,onClick:()=>{t(!e)},label:e?(0,ms.__)("Show block tools"):(0,ms.__)("Hide block tools"),size:"compact"})]}):null}const ig=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const rg=function({className:e,disableBlockTools:t=!1}){const{setIsInserterOpened:s,setIsListViewOpened:o}=(0,c.useDispatch)(Wi),{isDistractionFree:n,isInserterOpened:i,isListViewOpen:r,listViewShortcut:a,inserterSidebarToggleRef:l,listViewToggleRef:d,hasFixedToolbar:h,showIconLabels:g}=(0,c.useSelect)((e=>{const{getSettings:t}=e(m.store),{get:s}=e(j.store),{isListViewOpened:o,getEditorMode:n,getInserterSidebarToggleRef:i,getListViewToggleRef:r}=Xo(e(Wi)),{getShortcutRepresentation:a}=e(nr.store),{__unstableGetEditorMode:l}=e(m.store);return{isInserterOpened:e(Wi).isInserterOpened(),isListViewOpen:o(),listViewShortcut:a("core/editor/toggle-list-view"),inserterSidebarToggleRef:i(),listViewToggleRef:r(),hasFixedToolbar:t().hasFixedToolbar,showIconLabels:s("core","showIconLabels"),isDistractionFree:s("core","distractionFree"),isVisualMode:"visual"===n(),isZoomedOutView:"zoom-out"===l()}}),[]),_=(0,p.useViewportMatch)("medium"),f=(0,p.useViewportMatch)("wide"),b=(0,ms.__)("Document tools"),y=(0,u.useCallback)((()=>o(!r)),[o,r]),x=(0,u.useCallback)((()=>s(!i)),[i,s]),v=(0,ms._x)("Toggle block inserter","Generic label for block inserter button"),w=i?(0,ms.__)("Close"):(0,ms.__)("Add");return(0,P.jsx)(m.NavigableToolbar,{className:rr("editor-document-tools","edit-post-header-toolbar",e),"aria-label":b,variant:"unstyled",children:(0,P.jsxs)("div",{className:"editor-document-tools__left",children:[!n&&(0,P.jsx)(Ao.ToolbarItem,{ref:l,as:Ao.Button,className:"editor-document-tools__inserter-toggle",variant:"primary",isPressed:i,onMouseDown:e=>{i&&e.preventDefault()},onClick:x,disabled:t,icon:ig,label:g?w:v,showTooltip:!g,"aria-expanded":i}),(f||!g)&&(0,P.jsxs)(P.Fragment,{children:[_&&!h&&(0,P.jsx)(Ao.ToolbarItem,{as:m.ToolSelector,showTooltip:!g,variant:g?"tertiary":void 0,disabled:t,size:"compact"}),(0,P.jsx)(Ao.ToolbarItem,{as:xa,showTooltip:!g,variant:g?"tertiary":void 0,size:"compact"}),(0,P.jsx)(Ao.ToolbarItem,{as:ya,showTooltip:!g,variant:g?"tertiary":void 0,size:"compact"}),!n&&(0,P.jsx)(Ao.ToolbarItem,{as:Ao.Button,className:"editor-document-tools__document-overview-toggle",icon:Yp,disabled:t,isPressed:r,label:(0,ms.__)("Document Overview"),onClick:y,shortcut:a,showTooltip:!g,variant:g?"tertiary":void 0,"aria-expanded":r,ref:d,size:"compact"})]})]})})},ag=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function lg(){const{createNotice:e}=(0,c.useDispatch)(hs.store),{getCurrentPostId:t,getCurrentPostType:s}=(0,c.useSelect)(Wi),{getEditedEntityRecord:o}=(0,c.useSelect)(d.store);const n=(0,p.useCopyToClipboard)((function(){const e=o("postType",s(),t());return e?"function"==typeof e.content?e.content(e):e.blocks?(0,y.__unstableSerializeAndClean)(e.blocks):e.content?e.content:void 0:""}),(function(){e("info",(0,ms.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,P.jsx)(Ao.MenuItem,{ref:n,children:(0,ms.__)("Copy all blocks")})}const cg=[{value:"visual",label:(0,ms.__)("Visual editor")},{value:"text",label:(0,ms.__)("Code editor")}];const dg=function(){const{shortcut:e,isRichEditingEnabled:t,isCodeEditingEnabled:s,mode:o}=(0,c.useSelect)((e=>({shortcut:e(nr.store).getShortcutRepresentation("core/editor/toggle-mode"),isRichEditingEnabled:e(Wi).getEditorSettings().richEditingEnabled,isCodeEditingEnabled:e(Wi).getEditorSettings().codeEditingEnabled,mode:e(Wi).getEditorMode()})),[]),{switchEditorMode:n}=(0,c.useDispatch)(Wi);let i=o;t||"visual"!==o||(i="text"),s||"text"!==o||(i="visual");const r=cg.map((o=>(s||"text"!==o.value||(o={...o,disabled:!0}),t||"visual"!==o.value||(o={...o,disabled:!0,info:(0,ms.__)("You can enable the visual editor in your profile settings.")}),o.value===i||o.disabled?o:{...o,shortcut:e})));return(0,P.jsx)(Ao.MenuGroup,{label:(0,ms.__)("Editor"),children:(0,P.jsx)(Ao.MenuItemsChoice,{choices:r,value:i,onSelect:n})})},{Fill:ug,Slot:pg}=(0,Ao.createSlotFill)("ToolsMoreMenuGroup");ug.Slot=({fillProps:e})=>(0,P.jsx)(pg,{fillProps:e});const hg=ug,{Fill:mg,Slot:gg}=(0,Ao.createSlotFill)("web"===u.Platform.OS?Symbol("ViewMoreMenuGroup"):"ViewMoreMenuGroup");mg.Slot=({fillProps:e})=>(0,P.jsx)(gg,{fillProps:e});const _g=mg;function fg(){const{openModal:e}=(0,c.useDispatch)(Er),{set:t}=(0,c.useDispatch)(j.store),{toggleDistractionFree:s}=(0,c.useDispatch)(Wi),o=(0,c.useSelect)((e=>e(j.store).get("core","showIconLabels")),[]),n=()=>{t("core","distractionFree",!1)};return(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Ao.DropdownMenu,{icon:ag,label:(0,ms.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{showTooltip:!o,...o&&{variant:"tertiary"},tooltipPosition:"bottom",size:"compact"},children:({onClose:t})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Ao.MenuGroup,{label:(0,ms._x)("View","noun"),children:[(0,P.jsx)(j.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:n,label:(0,ms.__)("Top toolbar"),info:(0,ms.__)("Access all block and document tools in a single place"),messageActivated:(0,ms.__)("Top toolbar activated"),messageDeactivated:(0,ms.__)("Top toolbar deactivated")}),(0,P.jsx)(j.PreferenceToggleMenuItem,{scope:"core",name:"distractionFree",label:(0,ms.__)("Distraction free"),info:(0,ms.__)("Write with calmness"),handleToggling:!1,onToggle:s,messageActivated:(0,ms.__)("Distraction free mode activated"),messageDeactivated:(0,ms.__)("Distraction free mode deactivated"),shortcut:ta.displayShortcut.primaryShift("\\")}),(0,P.jsx)(j.PreferenceToggleMenuItem,{scope:"core",name:"focusMode",label:(0,ms.__)("Spotlight mode"),info:(0,ms.__)("Focus on one block at a time"),messageActivated:(0,ms.__)("Spotlight mode activated"),messageDeactivated:(0,ms.__)("Spotlight mode deactivated")}),(0,P.jsx)(_g.Slot,{fillProps:{onClose:t}})]}),(0,P.jsx)(dg,{}),(0,P.jsx)(Rr.Slot,{name:"core/plugin-more-menu",label:(0,ms.__)("Plugins"),as:Ao.MenuGroup,fillProps:{onClick:t}}),(0,P.jsxs)(Ao.MenuGroup,{label:(0,ms.__)("Tools"),children:[(0,P.jsx)(Ao.MenuItem,{onClick:()=>e("editor/keyboard-shortcut-help"),shortcut:ta.displayShortcut.access("h"),children:(0,ms.__)("Keyboard shortcuts")}),(0,P.jsx)(lg,{}),(0,P.jsxs)(Ao.MenuItem,{icon:dn,href:(0,ms.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),target:"_blank",rel:"noopener noreferrer",children:[(0,ms.__)("Help"),(0,P.jsx)(Ao.VisuallyHidden,{as:"span",children:(0,ms.__)("(opens in a new tab)")})]}),(0,P.jsx)(hg.Slot,{fillProps:{onClose:t}})]}),(0,P.jsx)(Ao.MenuGroup,{children:(0,P.jsx)(Ao.MenuItem,{onClick:()=>e("editor/preferences"),children:(0,ms.__)("Preferences")})})]})})})}const bg=(0,p.compose)((0,c.withSelect)((e=>{var t;return{hasPublishAction:null!==(t=e(Wi).getCurrentPost()?._links?.["wp:action-publish"])&&void 0!==t&&t,isBeingScheduled:e(Wi).isEditedPostBeingScheduled(),isPending:e(Wi).isCurrentPostPending(),isPublished:e(Wi).isCurrentPostPublished(),isPublishSidebarEnabled:e(Wi).isPublishSidebarEnabled(),isPublishSidebarOpened:e(Wi).isPublishSidebarOpened(),isScheduled:e(Wi).isCurrentPostScheduled(),postStatus:e(Wi).getEditedPostAttribute("status"),postStatusHasChanged:e(Wi).getPostEdits()?.status}})),(0,c.withDispatch)((e=>{const{togglePublishSidebar:t}=e(Wi);return{togglePublishSidebar:t}})))((function({forceIsDirty:e,hasPublishAction:t,isBeingScheduled:s,isPending:o,isPublished:n,isPublishSidebarEnabled:i,isPublishSidebarOpened:r,isScheduled:a,togglePublishSidebar:l,setEntitiesSavedStatesCallback:c,postStatusHasChanged:d,postStatus:u}){const h="toggle",m="button",g=(0,p.useViewportMatch)("medium","<");let _;return _=n||d&&!["future","publish"].includes(u)||a&&s||o&&!t&&!g?m:g||i?h:m,(0,P.jsx)(ed,{forceIsDirty:e,isOpen:r,isToggle:_===h,onToggle:l,setEntitiesSavedStatesCallback:c})}));function yg(){const{hasLoaded:e,permalink:t,isPublished:s,label:o,showIconLabels:n}=(0,c.useSelect)((e=>{const t=e(Wi).getCurrentPostType(),s=e(d.store).getPostType(t),{get:o}=e(j.store);return{permalink:e(Wi).getPermalink(),isPublished:e(Wi).isCurrentPostPublished(),label:s?.labels.view_item,hasLoaded:!!s,showIconLabels:o("core","showIconLabels")}}),[]);return s&&t&&e?(0,P.jsx)(Ao.Button,{icon:dn,label:o||(0,ms.__)("View post"),href:t,target:"_blank",showTooltip:!n,size:"compact"}):null}const xg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})}),vg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"})}),wg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,P.jsx)(k.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})});function Sg({forceIsAutosaveable:e,disabled:t}){const{deviceType:s,homeUrl:o,isTemplate:n,isViewable:i,showIconLabels:r}=(0,c.useSelect)((e=>{var t;const{getDeviceType:s,getCurrentPostType:o}=e(Wi),{getEntityRecord:n,getPostType:i}=e(d.store),{get:r}=e(j.store),a=o();return{deviceType:s(),homeUrl:n("root","__unstableBase")?.home,isTemplate:"wp_template"===a,isViewable:null!==(t=i(a)?.viewable)&&void 0!==t&&t,showIconLabels:r("core","showIconLabels")}}),[]),{setDeviceType:a}=(0,c.useDispatch)(Wi),{__unstableSetEditorMode:l}=(0,c.useDispatch)(m.store),{resetZoomLevel:u}=Xo((0,c.useDispatch)(m.store)),h=e=>{a(e),l("edit"),u()};if((0,p.useViewportMatch)("medium","<"))return null;const g={className:"editor-preview-dropdown__toggle",iconPosition:"right",size:"compact",showTooltip:!r,disabled:t,accessibleWhenDisabled:t},_={"aria-label":(0,ms.__)("View options")},f={desktop:xg,mobile:vg,tablet:wg},b=[{value:"Desktop",label:(0,ms.__)("Desktop"),icon:xg},{value:"Tablet",label:(0,ms.__)("Tablet"),icon:wg},{value:"Mobile",label:(0,ms.__)("Mobile"),icon:vg}];return(0,P.jsx)(Ao.DropdownMenu,{className:rr("editor-preview-dropdown",`editor-preview-dropdown--${s.toLowerCase()}`),popoverProps:{placement:"bottom-end"},toggleProps:g,menuProps:_,icon:f[s.toLowerCase()],label:(0,ms.__)("View"),disableOpenOnArrowDown:t,children:({onClose:t})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.MenuGroup,{children:(0,P.jsx)(Ao.MenuItemsChoice,{choices:b,value:s,onSelect:h})}),n&&(0,P.jsx)(Ao.MenuGroup,{children:(0,P.jsxs)(Ao.MenuItem,{href:o,target:"_blank",icon:dn,onClick:t,children:[(0,ms.__)("View site"),(0,P.jsx)(Ao.VisuallyHidden,{as:"span",children:(0,ms.__)("(opens in a new tab)")})]})}),i&&(0,P.jsx)(Ao.MenuGroup,{children:(0,P.jsx)(qc,{className:"editor-preview-dropdown__button-external",role:"menuitem",forceIsAutosaveable:e,"aria-label":(0,ms.__)("Preview in new tab"),textContent:(0,P.jsxs)(P.Fragment,{children:[(0,ms.__)("Preview in new tab"),(0,P.jsx)(Ao.Icon,{icon:dn})]}),onPreview:t})}),(0,P.jsx)(Rr.Slot,{name:"core/plugin-preview-menu",as:Ao.MenuGroup,fillProps:{onClick:t}})]})})}const kg=(0,P.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",children:(0,P.jsx)(k.Path,{fill:"none",d:"M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"square"})}),Pg=({disabled:e})=>{const{isZoomOut:t,showIconLabels:s}=(0,c.useSelect)((e=>({isZoomOut:Xo(e(m.store)).isZoomOut(),showIconLabels:e(j.store).get("core","showIconLabels")}))),{resetZoomLevel:o,setZoomLevel:n,__unstableSetEditorMode:i}=Xo((0,c.useDispatch)(m.store));return(0,P.jsx)(Ao.Button,{accessibleWhenDisabled:!0,disabled:e,onClick:()=>{t?o():n(50),i(t?"edit":"zoom-out")},icon:kg,label:(0,ms.__)("Zoom Out"),isPressed:t,size:"compact",showTooltip:!s})},Cg={distractionFreeDisabled:{y:"-50px"},distractionFreeHover:{y:0},distractionFreeHidden:{y:"-50px"},visible:{y:0},hidden:{y:0}},jg={distractionFreeDisabled:{x:"-100%"},distractionFreeHover:{x:0},distractionFreeHidden:{x:"-100%"},visible:{x:0},hidden:{x:0}};const Eg=function({customSaveButton:e,forceIsDirty:t,forceDisableBlockTools:s,setEntitiesSavedStatesCallback:o,title:n,isEditorIframed:i}){const r=(0,p.useViewportMatch)("large"),a=(0,p.useViewportMatch)("medium"),l=(0,p.useMediaQuery)("(max-width: 403px)"),{isTextEditor:d,isPublishSidebarOpened:h,showIconLabels:g,hasFixedToolbar:_,hasBlockSelection:f,isNestedEntity:b}=(0,c.useSelect)((e=>{const{get:t}=e(j.store),{getEditorMode:s,getEditorSettings:o,isPublishSidebarOpened:n}=e(Wi),{__unstableGetEditorMode:i}=e(m.store);return{isTextEditor:"text"===s(),isPublishSidebarOpened:n(),showIconLabels:t("core","showIconLabels"),hasFixedToolbar:t("core","fixedToolbar"),hasBlockSelection:!!e(m.store).getBlockSelectionStart(),isNestedEntity:!!o().onNavigateToPreviousEntityRecord,isZoomedOutView:"zoom-out"===i()}}),[]),[y,x]=(0,u.useState)(!0),v=(!f||y)&&!l,w=(()=>{const e=(0,Ao.__experimentalUseSlotFills)(qm);return Boolean(e&&e.length)})();return(0,P.jsxs)("div",{className:"editor-header edit-post-header",children:[w&&(0,P.jsx)(Ao.__unstableMotion.div,{className:"editor-header__back-button",variants:jg,transition:{type:"tween"},children:(0,P.jsx)(eg.Slot,{})}),(0,P.jsxs)(Ao.__unstableMotion.div,{variants:Cg,className:"editor-header__toolbar",transition:{type:"tween"},children:[(0,P.jsx)(rg,{disableBlockTools:s||d}),_&&a&&(0,P.jsx)(ng,{isCollapsed:y,onToggle:x})]}),v&&(0,P.jsx)(Ao.__unstableMotion.div,{className:"editor-header__center",variants:Cg,transition:{type:"tween"},children:(0,P.jsx)(na,{title:n})}),(0,P.jsxs)(Ao.__unstableMotion.div,{variants:Cg,transition:{type:"tween"},className:"editor-header__settings",children:[!e&&!h&&(0,P.jsx)(Bu,{forceIsDirty:t}),(0,P.jsx)(Sg,{forceIsAutosaveable:t,disabled:b}),(0,P.jsx)(qc,{className:"editor-header__post-preview-button",forceIsAutosaveable:t}),(0,P.jsx)(yg,{}),i&&r&&(0,P.jsx)(Pg,{disabled:s}),(r||!g)&&(0,P.jsx)(Fr.Slot,{scope:"core"}),!e&&(0,P.jsx)(bg,{forceIsDirty:t,setEntitiesSavedStatesCallback:o}),e,(0,P.jsx)(fg,{})]})]})},{PrivateInserterLibrary:Tg}=Xo(m.privateApis);function Bg(){const{blockSectionRootClientId:e,inserterSidebarToggleRef:t,insertionPoint:s,showMostUsedBlocks:o,sidebarIsOpened:n}=(0,c.useSelect)((e=>{const{getInserterSidebarToggleRef:t,getInsertionPoint:s,isPublishSidebarOpened:o}=Xo(e(Wi)),{getBlockRootClientId:n,__unstableGetEditorMode:i,getSectionRootClientId:r}=Xo(e(m.store)),{get:a}=e(j.store),{getActiveComplementaryArea:l}=e(Er);return{inserterSidebarToggleRef:t(),insertionPoint:s(),showMostUsedBlocks:a("core","mostUsedBlocks"),blockSectionRootClientId:(()=>{if("zoom-out"===i()){const e=r();if(e)return e}return n()})(),sidebarIsOpened:!(!l("core")&&!o())}}),[]),{setIsInserterOpened:i}=(0,c.useDispatch)(Wi),{disableComplementaryArea:r}=(0,c.useDispatch)(Er),a=(0,p.useViewportMatch)("medium","<"),l=(0,u.useRef)(),d=(0,u.useCallback)((()=>{i(!1),t.current?.focus()}),[t,i]),h=(0,u.useCallback)((e=>{e.keyCode!==ta.ESCAPE||e.defaultPrevented||(e.preventDefault(),d())}),[d]),g=(0,P.jsx)("div",{className:"editor-inserter-sidebar__content",children:(0,P.jsx)(Tg,{showMostUsedBlocks:o,showInserterHelpPanel:!0,shouldFocusBlock:a,rootClientId:null!=e?e:s.rootClientId,__experimentalInsertionIndex:s.insertionIndex,onSelect:s.onSelect,__experimentalInitialTab:s.tab,__experimentalInitialCategory:s.category,__experimentalFilterValue:s.filterValue,onPatternCategorySelection:n?()=>r("core"):void 0,ref:l,onClose:d})});return(0,P.jsx)("div",{onKeyDown:h,className:"editor-inserter-sidebar",children:g})}function Ig(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"editor-list-view-sidebar__outline",children:[(0,P.jsxs)("div",{children:[(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Characters:")}),(0,P.jsx)(Ao.__experimentalText,{children:(0,P.jsx)(mp,{})})]}),(0,P.jsxs)("div",{children:[(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Words:")}),(0,P.jsx)(up,{})]}),(0,P.jsxs)("div",{children:[(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Time to read:")}),(0,P.jsx)(hp,{})]})]}),(0,P.jsx)(ma,{})]})}const{TabbedSidebar:Ng}=Xo(m.privateApis);function Ag(){const{setIsListViewOpened:e}=(0,c.useDispatch)(Wi),{getListViewToggleRef:t}=Xo((0,c.useSelect)(Wi)),s=(0,p.useFocusOnMount)("firstElement"),o=(0,u.useCallback)((()=>{e(!1),t().current?.focus()}),[t,e]),n=(0,u.useCallback)((e=>{e.keyCode!==ta.ESCAPE||e.defaultPrevented||(e.preventDefault(),o())}),[o]),[i,r]=(0,u.useState)(null),[a,l]=(0,u.useState)("list-view"),d=(0,u.useRef)(),h=(0,u.useRef)(),g=(0,u.useRef)(),_=(0,p.useMergeRefs)([s,g,r]);const f=(0,u.useCallback)((()=>{d.current.contains(d.current.ownerDocument.activeElement)?o():function(e){const t=Wu.focus.tabbable.find(h.current)[0];if("list-view"===e){const e=Wu.focus.tabbable.find(g.current)[0];(d.current.contains(e)?e:t).focus()}else t.focus()}(a)}),[o,a]);return(0,nr.useShortcut)("core/editor/toggle-list-view",f),(0,P.jsx)("div",{className:"editor-list-view-sidebar",onKeyDown:n,ref:d,children:(0,P.jsx)(Ng,{tabs:[{name:"list-view",title:(0,ms._x)("List View","Post overview"),panel:(0,P.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,P.jsx)("div",{className:"editor-list-view-sidebar__list-view-panel-content",children:(0,P.jsx)(m.__experimentalListView,{dropZoneElement:i})})}),panelRef:_},{name:"outline",title:(0,ms._x)("Outline","Post overview"),panel:(0,P.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,P.jsx)(Ig,{})})}],onClose:o,onSelect:e=>l(e),defaultTabId:"list-view",ref:h,closeButtonLabel:(0,ms.__)("Close")})})}const{Fill:Dg,Slot:Rg}=(0,Ao.createSlotFill)("ActionsPanel");function Mg({setEntitiesSavedStatesCallback:e,closeEntitiesSavedStates:t,isEntitiesSavedStatesOpen:s,forceIsDirtyPublishPanel:o}){const{closePublishSidebar:n,togglePublishSidebar:i}=(0,c.useDispatch)(Wi),{publishSidebarOpened:r,isPublishable:a,isDirty:l,hasOtherEntitiesChanges:d}=(0,c.useSelect)((e=>{const{isPublishSidebarOpened:t,isEditedPostPublishable:s,isCurrentPostPublished:o,isEditedPostDirty:n,hasNonPostEntityChanges:i}=e(Wi),r=i();return{publishSidebarOpened:t(),isPublishable:!o()&&s(),isDirty:r||n(),hasOtherEntitiesChanges:r}}),[]),p=(0,u.useCallback)((()=>e(!0)),[]);let h;return h=r?(0,P.jsx)(gu,{onClose:n,forceIsDirty:o,PrePublishExtension:Gl.Slot,PostPublishExtension:Ml.Slot}):a&&!d?(0,P.jsx)("div",{className:"editor-layout__toggle-publish-panel",children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:i,"aria-expanded":!1,children:(0,ms.__)("Open publish panel")})}):(0,P.jsx)("div",{className:"editor-layout__toggle-entities-saved-states-panel",children:(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:p,"aria-expanded":!1,disabled:!l,accessibleWhenDisabled:!0,children:(0,ms.__)("Open save panel")})}),(0,P.jsxs)(P.Fragment,{children:[s&&(0,P.jsx)(Aa,{close:t}),(0,P.jsx)(Rg,{bubblesVirtually:!0}),!s&&h]})}function Og({autoFocus:e=!1}){const{switchEditorMode:t}=(0,c.useDispatch)(Wi),{shortcut:s,isRichEditingEnabled:o}=(0,c.useSelect)((e=>{const{getEditorSettings:t}=e(Wi),{getShortcutRepresentation:s}=e(nr.store);return{shortcut:s("core/editor/toggle-mode"),isRichEditingEnabled:t().richEditingEnabled}}),[]),{resetZoomLevel:n,__unstableSetEditorMode:i}=Xo((0,c.useDispatch)(m.store)),r=(0,u.useRef)();return(0,u.useEffect)((()=>{n(),i("edit"),e||r?.current?.focus()}),[e,n,i]),(0,P.jsxs)("div",{className:"editor-text-editor",children:[o&&(0,P.jsxs)("div",{className:"editor-text-editor__toolbar",children:[(0,P.jsx)("h2",{children:(0,ms.__)("Editing code")}),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>t("visual"),shortcut:s,children:(0,ms.__)("Exit code editor")})]}),(0,P.jsxs)("div",{className:"editor-text-editor__body",children:[(0,P.jsx)(Xu,{ref:r}),(0,P.jsx)($u,{})]})]})}function Lg({contentRef:e}){const{onNavigateToEntityRecord:t,templateId:s}=(0,c.useSelect)((e=>{const{getEditorSettings:t,getCurrentTemplateId:s}=e(Wi);return{onNavigateToEntityRecord:t().onNavigateToEntityRecord,templateId:s()}}),[]),o=(0,c.useSelect)((e=>!!e(d.store).canUser("create",{kind:"postType",name:"wp_template"})),[]),[n,i]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{const t=e=>{o&&e.target.classList.contains("is-root-container")&&"core/template-part"!==e.target.dataset?.type&&(e.defaultPrevented||(e.preventDefault(),i(!0)))},s=e.current;return s?.addEventListener("dblclick",t),()=>{s?.removeEventListener("dblclick",t)}}),[e,o]),o?(0,P.jsx)(Ao.__experimentalConfirmDialog,{isOpen:n,confirmButtonText:(0,ms.__)("Edit template"),onConfirm:()=>{i(!1),t({postId:s,postType:"wp_template"})},onCancel:()=>i(!1),size:"medium",children:(0,ms.__)("You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?")}):null}function Fg({direction:e,resizeWidthBy:t}){const s=`resizable-editor__resize-help-${e}`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Ao.Tooltip,{text:(0,ms.__)("Drag to resize"),children:(0,P.jsx)(Ao.__unstableMotion.button,{className:`editor-resizable-editor__resize-handle is-${e}`,"aria-label":(0,ms.__)("Drag to resize"),"aria-describedby":s,onKeyDown:function(s){const{keyCode:o}=s;"left"===e&&o===ta.LEFT||"right"===e&&o===ta.RIGHT?t(20):("left"===e&&o===ta.RIGHT||"right"===e&&o===ta.LEFT)&&t(-20)},variants:{active:{opacity:1,scaleY:1.3}},whileFocus:"active",whileHover:"active",whileTap:"active",role:"separator","aria-orientation":"vertical"},"handle")}),(0,P.jsx)(Ao.VisuallyHidden,{id:s,children:(0,ms.__)("Use left and right arrow keys to resize the canvas.")})]})}const Vg={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};const zg=function({className:e,enableResizing:t,height:s,children:o}){const[n,i]=(0,u.useState)("100%"),r=(0,u.useRef)(),a=(0,u.useCallback)((e=>{r.current&&i(r.current.offsetWidth+e)}),[]);return(0,P.jsx)(Ao.ResizableBox,{className:rr("editor-resizable-editor",e,{"is-resizable":t}),ref:e=>{r.current=e?.resizable},size:{width:t?n:"100%",height:t&&s?s:"100%"},onResizeStop:(e,t,s)=>{i(s.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{left:t,right:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,P.jsx)(Fg,{direction:"left",resizeWidthBy:a}),right:(0,P.jsx)(Fg,{direction:"right",resizeWidthBy:a})},handleClasses:void 0,handleStyles:{left:Vg,right:Vg},children:o})};function Ug(e,t,s){return Math.min(Math.max(e,t),s)}function Hg(e,t,s){const o=e-Ug(e,s.left,s.right),n=t-Ug(t,s.top,s.bottom);return Math.sqrt(o*o+n*n)}function Gg({isEnabled:e=!0}={}){const{getEnabledClientIdsTree:t,getBlockName:s,getBlockOrder:o}=Xo((0,c.useSelect)(m.store)),{selectBlock:n}=(0,c.useDispatch)(m.store);return(0,p.useRefEffect)((i=>{if(!e)return;const r=e=>{(e.target===i||e.target.classList.contains("is-root-container"))&&((e,r)=>{const a=t().flatMap((({clientId:e})=>{const t=s(e);if("core/template-part"===t)return[];if("core/post-content"===t){const t=o(e);if(t.length)return t}return[e]}));let l=1/0,c=null;for(const t of a){const s=i.querySelector(`[data-block="${t}"]`);if(!s)continue;const o=Hg(e,r,s.getBoundingClientRect());oi.removeEventListener("click",r)}),[e])}const{LayoutStyle:$g,useLayoutClasses:Wg,useLayoutStyles:Zg,ExperimentalBlockCanvas:Yg,useFlashEditableBlocks:Kg,useZoomOutModeExit:qg}=Xo(m.privateApis),Qg=[M,D,O,R];function Xg(e){for(let t=0;t{const{getCurrentPostId:t,getCurrentPostType:s,getCurrentTemplateId:o,getEditorSettings:n,getRenderingMode:i,getDeviceType:r}=e(Wi),{getPostType:a,getEditedEntityRecord:l}=e(d.store),c=s(),u=i();let p;c===M?p="core/block":"post-only"===u&&(p="core/post-content");const h=n(),m=h.supportsTemplateMode,g=a(c),_=o(),f=_?l("postType",D,_):void 0;return{renderingMode:u,postContentAttributes:h.postContentAttributes,isDesignPostType:Qg.includes(c),editedPostTemplate:g?.viewable&&m?f:void 0,wrapperBlockName:p,wrapperUniqueId:t(),deviceType:r(),isFocusedEntity:!!h.onNavigateToPreviousEntityRecord,postType:c,isPreview:h.__unstableIsPreviewMode}}),[]),{isCleanNewPost:j}=(0,c.useSelect)(Wi),{hasRootPaddingAwareAlignments:E,themeHasDisabledLayoutStyles:T,themeSupportsLayout:B,isZoomedOut:I}=(0,c.useSelect)((e=>{const{getSettings:t,isZoomOut:s}=Xo(e(m.store)),o=t();return{themeHasDisabledLayoutStyles:o.disableLayoutStyles,themeSupportsLayout:o.supportsLayout,hasRootPaddingAwareAlignments:o.__experimentalFeatures?.useRootPaddingAwareAlignments,isZoomedOut:s()}}),[]),N=(0,m.__experimentalUseResizeCanvas)(v),[A]=(0,m.useSettings)("layout"),L=(0,u.useMemo)((()=>"post-only"!==g||S?{type:"default"}:B?{...A,type:"constrained"}:{type:"default"}),[g,B,A,S]),F=(0,u.useMemo)((()=>{if(!f?.content&&!f?.blocks&&_)return _;if(f?.blocks)return Xg(f?.blocks);const e="string"==typeof f?.content?f?.content:"";return Xg((0,y.parse)(e))||{}}),[f?.content,f?.blocks,_]),V=(0,u.useMemo)((()=>{if(!f?.content&&!f?.blocks)return!1;if(f?.blocks)return Jg(f?.blocks);const e="string"==typeof f?.content?f?.content:"";return Jg((0,y.parse)(e))||!1}),[f?.content,f?.blocks]),{layout:z={},align:U=""}=F||{},H=Wg(F,"core/post-content"),G=rr({"is-layout-flow":!B},B&&H,U&&`align${U}`),$=Zg(F,"core/post-content",".block-editor-block-list__layout.is-root-container"),W=(0,u.useMemo)((()=>z&&("constrained"===z?.type||z?.inherit||z?.contentSize||z?.wideSize)?{...A,...z,type:"constrained"}:{...A,...z,type:"default"}),[z?.type,z?.inherit,z?.contentSize,z?.wideSize,A]),Z=_?W:L,Y="default"!==Z?.type||V?Z:L,K=(0,m.__unstableUseTypingObserver)(),q=(0,u.useRef)();(0,u.useEffect)((()=>{e&&j()&&q?.current?.focus()}),[e,j]);const Q=(0,u.useRef)(),X=(0,m.__unstableUseTypewriter)();n=(0,p.useMergeRefs)([Q,n,"post-only"===g?X:null,Kg({isEnabled:"template-locked"===g}),Gg({isEnabled:"template-locked"===g}),qg()]);const J=I&&!h?{scale:"default",frameSize:"40px"}:{},ee=k===O,te=[O,R,M].includes(k)&&!C&&!l&&!I,se=!s||["Tablet","Mobile"].includes(v),oe=(0,u.useMemo)((()=>[...null!=t?t:[],{css:`:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${te?"min-height:0!important;":""}}`}]),[t,te]);return(0,P.jsx)("div",{className:rr("editor-visual-editor","edit-post-visual-editor",i,{"has-padding":w||te,"is-resizable":te,"is-iframed":se}),children:(0,P.jsx)(zg,{enableResizing:te,height:a.height&&!ee?a.height:"100%",children:(0,P.jsxs)(Yg,{shouldIframe:se,contentRef:n,styles:oe,height:"100%",iframeProps:{...o,...J,style:{...o?.style,...N}},children:[B&&!T&&"post-only"===g&&!S&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)($g,{selector:".editor-visual-editor__post-title-wrapper",layout:L}),(0,P.jsx)($g,{selector:".block-editor-block-list__layout.is-root-container",layout:Y}),U&&(0,P.jsx)($g,{css:".is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}"}),$&&(0,P.jsx)($g,{layout:W,css:$})]}),"post-only"===g&&!S&&(0,P.jsx)("div",{className:rr("editor-visual-editor__post-title-wrapper","edit-post-visual-editor__post-title-wrapper",{"has-global-padding":E}),contentEditable:!1,ref:K,style:{marginTop:"4rem"},children:(0,P.jsx)(Qu,{ref:q})}),(0,P.jsxs)(m.RecursionProvider,{blockName:b,uniqueId:x,children:[(0,P.jsx)(m.BlockList,{className:rr("is-"+v.toLowerCase()+"-preview","post-only"!==g||S?"wp-site-blocks":`${G} wp-block-post-content`),layout:Z,dropZoneElement:s?Q.current:Q.current?.parentNode,__unstableDisableDropZone:"template-locked"===g}),"template-locked"===g&&(0,P.jsx)(Lg,{contentRef:Q})]}),te&&r]})})})},t_={header:(0,ms.__)("Editor top bar"),body:(0,ms.__)("Editor content"),sidebar:(0,ms.__)("Editor settings"),actions:(0,ms.__)("Editor publish"),footer:(0,ms.__)("Editor footer")};function s_({className:e,styles:t,children:s,forceIsDirty:o,contentRef:n,disableIframe:i,autoFocus:r,customSaveButton:a,customSavePanel:l,forceDisableBlockTools:d,title:h,iframeProps:g}){const{mode:_,isRichEditingEnabled:f,isInserterOpened:b,isListViewOpened:y,isDistractionFree:x,isPreviewMode:v,showBlockBreadcrumbs:w,documentLabel:S,isZoomOut:k}=(0,c.useSelect)((e=>{const{get:t}=e(j.store),{getEditorSettings:s,getPostTypeLabel:o}=e(Wi),n=s(),i=o(),{isZoomOut:r}=Xo(e(m.store));return{mode:e(Wi).getEditorMode(),isRichEditingEnabled:n.richEditingEnabled,isInserterOpened:e(Wi).isInserterOpened(),isListViewOpened:e(Wi).isListViewOpened(),isDistractionFree:t("core","distractionFree"),isPreviewMode:n.__unstableIsPreviewMode,showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),documentLabel:i||(0,ms._x)("Document","noun, breadcrumb"),isZoomOut:r()}}),[]),C=(0,p.useViewportMatch)("medium"),E=y?(0,ms.__)("Document Overview"):(0,ms.__)("Block Library"),[T,B]=(0,u.useState)(!1),I=(0,u.useCallback)((e=>{"function"==typeof T&&T(e),B(!1)}),[T]);return(0,P.jsx)(Kr,{isDistractionFree:x,className:rr("editor-editor-interface",e,{"is-entity-save-view-open":!!T,"is-distraction-free":x&&!v}),labels:{...t_,secondarySidebar:E},header:!v&&(0,P.jsx)(Eg,{forceIsDirty:o,setEntitiesSavedStatesCallback:B,customSaveButton:a,forceDisableBlockTools:d,title:h,isEditorIframed:!i}),editorNotices:(0,P.jsx)(wa,{}),secondarySidebar:!v&&"visual"===_&&(b&&(0,P.jsx)(Bg,{})||y&&(0,P.jsx)(Ag,{})),sidebar:!v&&!x&&(0,P.jsx)(Hr.Slot,{scope:"core"}),content:(0,P.jsxs)(P.Fragment,{children:[!x&&!v&&(0,P.jsx)(wa,{}),(0,P.jsx)(Km.Slot,{children:([e])=>e||(0,P.jsxs)(P.Fragment,{children:[!v&&("text"===_||!f)&&(0,P.jsx)(Og,{autoFocus:r}),!v&&!C&&"visual"===_&&(0,P.jsx)(m.BlockToolbar,{hideDragHandle:!0}),(v||f&&"visual"===_)&&(0,P.jsx)(e_,{styles:t,contentRef:n,disableIframe:i,autoFocus:r,iframeProps:g}),s]})})]}),footer:!v&&!x&&C&&w&&f&&!k&&"visual"===_&&(0,P.jsx)(m.BlockBreadcrumb,{rootLabelText:S}),actions:v?void 0:l||(0,P.jsx)(Mg,{closeEntitiesSavedStates:I,isEntitiesSavedStatesOpen:T,setEntitiesSavedStatesCallback:B,forceIsDirtyPublishPanel:o})})}const{OverridesPanel:o_}=Xo(nn.privateApis);function n_(){return(0,c.useSelect)((e=>"wp_block"===e(Wi).getCurrentPostType()),[])?(0,P.jsx)(o_,{}):null}function i_({postType:e,onActionPerformed:t,context:s}){const{defaultActions:o}=(0,c.useSelect)((t=>{const{getEntityActions:s}=Xo(t(Wi));return{defaultActions:s("postType",e)}}),[e]),{registerPostTypeActions:n}=Xo((0,c.useDispatch)(Wi));return(0,u.useEffect)((()=>{n(e)}),[n,e]),(0,u.useMemo)((()=>{const e=o.filter((e=>!e.context||e.context===s));if(t)for(let s=0;s{o(n,{...i,onActionPerformed:o=>{i?.onActionPerformed&&i.onActionPerformed(o),t(e[s].id,o)}})}}}if(e[s].RenderModal){const o=e[s].RenderModal;e[s]={...e[s],RenderModal:n=>(0,P.jsx)(o,{...n,onActionPerformed:o=>{n.onActionPerformed&&n.onActionPerformed(o),t(e[s].id,o)}})}}}return e}),[o,t,s])}const{DropdownMenuV2:r_,kebabCase:a_}=Xo(Ao.privateApis);function l_({postType:e,postId:t,onActionPerformed:s}){const[o,n]=(0,u.useState)(!1),{item:i,permissions:r}=(0,c.useSelect)((s=>{const{getEditedEntityRecord:o,getEntityRecordPermissions:n}=Xo(s(d.store));return{item:o("postType",e,t),permissions:n("postType",e,t)}}),[t,e]),a=(0,u.useMemo)((()=>({...i,permissions:r})),[i,r]),l=i_({postType:e,onActionPerformed:s}),p=(0,u.useMemo)((()=>l.filter((e=>!e.isEligible||e.isEligible(a)))),[l,a]);return(0,P.jsx)(r_,{open:o,trigger:(0,P.jsx)(Ao.Button,{size:"small",icon:ag,label:(0,ms.__)("Actions"),disabled:!p.length,accessibleWhenDisabled:!0,className:"editor-all-actions-button",onClick:()=>n(!o)}),onOpenChange:n,placement:"bottom-end",children:(0,P.jsx)(u_,{actions:p,item:a,onClose:()=>{n(!1)}})})}function c_({action:e,onClick:t,items:s}){const o="string"==typeof e.label?e.label:e.label(s);return(0,P.jsx)(r_.Item,{onClick:t,hideOnClick:!e.RenderModal,children:(0,P.jsx)(r_.ItemLabel,{children:o})})}function d_({action:e,item:t,ActionTrigger:s,onClose:o}){const[n,i]=(0,u.useState)(!1),r={action:e,onClick:()=>i(!0),items:[t]},{RenderModal:a,hideModalHeader:l}=e;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(s,{...r}),n&&(0,P.jsx)(Ao.Modal,{title:e.modalHeader||e.label,__experimentalHideHeader:!!l,onRequestClose:()=>{i(!1)},overlayClassName:`editor-action-modal editor-action-modal__${a_(e.id)}`,focusOnMount:"firstContentElement",size:"small",children:(0,P.jsx)(a,{items:[t],closeModal:()=>{i(!1),o()}})})]})}function u_({actions:e,item:t,onClose:s}){return(0,P.jsx)(r_.Group,{children:e.map((e=>e.RenderModal?(0,P.jsx)(d_,{action:e,item:t,ActionTrigger:c_,onClose:s},e.id):(0,P.jsx)(c_,{action:e,onClick:()=>e.callback([t]),items:[t]},e.id)))})}function p_({postType:e,postId:t,onActionPerformed:s}){const{isFrontPage:o,isPostsPage:n,title:i,icon:r,isSync:a}=(0,c.useSelect)((s=>{const{__experimentalGetTemplateInfo:o}=s(Wi),{canUser:n,getEditedEntityRecord:i}=s(d.store),r=n("read",{kind:"root",name:"site"})?i("root","site"):void 0,a=i("postType",e,t),l=[D,R].includes(e)&&o(a);let c=!1;if(V.includes(e))if(M===e){c="unsynced"!==("unsynced"===a?.meta?.wp_pattern_sync_status?"unsynced":a?.wp_pattern_sync_status)}else c=!0;return{title:l?.title||a?.title,icon:Xo(s(Wi)).getPostIcon(e,{area:a?.area}),isSync:c,isFrontPage:r?.page_on_front===t,isPostsPage:r?.page_for_posts===t}}),[t,e]);return(0,P.jsx)("div",{className:"editor-post-card-panel",children:(0,P.jsxs)(Ao.__experimentalHStack,{spacing:2,className:"editor-post-card-panel__header",align:"flex-start",children:[(0,P.jsx)(Ao.Icon,{className:rr("editor-post-card-panel__icon",{"is-sync":a}),icon:r}),(0,P.jsxs)(Ao.__experimentalText,{numberOfLines:2,truncate:!0,className:"editor-post-card-panel__title",weight:500,as:"h2",lineHeight:"20px",children:[i?(0,No.decodeEntities)(i):(0,ms.__)("No title"),o&&(0,P.jsx)("span",{className:"editor-post-card-panel__title-badge",children:(0,ms.__)("Homepage")}),n&&(0,P.jsx)("span",{className:"editor-post-card-panel__title-badge",children:(0,ms.__)("Posts Page")})]}),(0,P.jsx)(l_,{postType:e,postId:t,onActionPerformed:s})]})})}function h_(){const{postContent:e}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s,getCurrentPostId:o}=e(Wi),{canUser:n}=e(d.store),{getEntityRecord:i}=e(d.store),r=n("read",{kind:"root",name:"site"})?i("root","site"):void 0,a=s();return{postContent:!(+o()===r?.page_for_posts)&&![D,R].includes(a)&&t("content")}}),[]),t=(0,ms._x)("words","Word count type. Do not translate!"),s=(0,u.useMemo)((()=>e?(0,dp.count)(e,t):0),[e,t]);if(!s)return null;const o=Math.round(s/189),n=(0,ms.sprintf)((0,ms._n)("%s word","%s words",s),s.toLocaleString()),i=o<=1?(0,ms.__)("1 minute"):(0,ms.sprintf)((0,ms._n)("%s minute","%s minutes",o),o.toLocaleString());return(0,P.jsx)("div",{className:"editor-post-content-information",children:(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.sprintf)((0,ms.__)("%1$s, %2$s read time."),n,i)})})}const m_=function(){const{postFormat:e}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t}=e(Wi),s=t("format");return{postFormat:null!=s?s:"standard"}}),[]),t=Vc.find((t=>t.id===e)),[s,o]=(0,u.useState)(null),n=(0,u.useMemo)((()=>({anchor:s,placement:"left-start",offset:36,shift:!0})),[s]);return(0,P.jsx)(Fc,{children:(0,P.jsx)(Ka,{label:(0,ms.__)("Format"),ref:o,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:n,contentClassName:"editor-post-format__dialog",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,P.jsx)(Ao.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change format: %s"),t?.caption),onClick:s,children:t?.caption}),renderContent:({onClose:e})=>(0,P.jsxs)("div",{className:"editor-post-format__dialog-content",children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Format"),onClose:e}),(0,P.jsx)(zc,{})]})})})})};function g_(){const e=(0,c.useSelect)((e=>e(Wi).getEditedPostAttribute("modified")),[]),t=e&&(0,ms.sprintf)((0,ms.__)("Last edited %s."),(0,x.humanTimeDiff)(e));return t?(0,P.jsx)("div",{className:"editor-post-last-edited-panel",children:(0,P.jsx)(Ao.__experimentalText,{children:t})}):null}const __=function({className:e,children:t}){return(0,P.jsx)(Ao.__experimentalVStack,{className:rr("editor-post-panel__section",e),children:t})},f_={};function b_(){const{editEntityRecord:e}=(0,c.useDispatch)(d.store),{postsPageTitle:t,postsPageId:s,isTemplate:o,postSlug:n}=(0,c.useSelect)((e=>{const{getEntityRecord:t,getEditedEntityRecord:s,canUser:o}=e(d.store),n=o("read",{kind:"root",name:"site"})?t("root","site"):void 0,i=n?.page_for_posts?s("postType","page",n?.page_for_posts):f_,{getEditedPostAttribute:r,getCurrentPostType:a}=e(Wi);return{postsPageId:i?.id,postsPageTitle:i?.title,isTemplate:a()===D,postSlug:r("slug")}}),[]),[i,r]=(0,u.useState)(null),a=(0,u.useMemo)((()=>({anchor:i,placement:"left-start",offset:36,shift:!0})),[i]);if(!o||!["home","index"].includes(n)||!s)return null;const l=t=>{e("postType","page",s,{title:t})},h=(0,No.decodeEntities)(t);return(0,P.jsx)(Ka,{label:(0,ms.__)("Blog title"),ref:r,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:a,contentClassName:"editor-blog-title-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:t})=>(0,P.jsx)(Ao.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.sprintf)((0,ms.__)("Change blog title: %s"),h),onClick:t,children:h}),renderContent:({onClose:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Blog title"),onClose:e}),(0,P.jsx)(Ao.__experimentalInputControl,{placeholder:(0,ms.__)("No title"),size:"__unstable-large",value:t,onChange:(0,p.debounce)(l,300),label:(0,ms.__)("Blog title"),help:(0,ms.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media."),hideLabelFromVision:!0})]})})})}function y_(){const{editEntityRecord:e}=(0,c.useDispatch)(d.store),{postsPerPage:t,isTemplate:s,postSlug:o}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s}=e(Wi),{getEditedEntityRecord:o,canUser:n}=e(d.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0;return{isTemplate:s()===D,postSlug:t("slug"),postsPerPage:i?.posts_per_page||1}}),[]),[n,i]=(0,u.useState)(null),r=(0,u.useMemo)((()=>({anchor:n,placement:"left-start",offset:36,shift:!0})),[n]);if(!s||!["home","index"].includes(o))return null;const a=t=>{e("root","site",void 0,{posts_per_page:t})};return(0,P.jsx)(Ka,{label:(0,ms.__)("Posts per page"),ref:i,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:r,contentClassName:"editor-posts-per-page-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,P.jsx)(Ao.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.__)("Change posts per page"),onClick:s,children:t}),renderContent:({onClose:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Posts per page"),onClose:e}),(0,P.jsx)(Ao.__experimentalNumberControl,{placeholder:0,value:t,size:"__unstable-large",spinControls:"custom",step:"1",min:"1",onChange:a,label:(0,ms.__)("Posts per page"),help:(0,ms.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting."),hideLabelFromVision:!0})]})})})}const x_=[{label:(0,ms._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,ms.__)("Visitors can add new comments and replies.")},{label:(0,ms.__)("Closed"),value:"",description:[(0,ms.__)("Visitors cannot add new comments or replies."),(0,ms.__)("Existing comments remain visible.")].join(" ")}];function v_(){const{editEntityRecord:e}=(0,c.useDispatch)(d.store),{allowCommentsOnNewPosts:t,isTemplate:s,postSlug:o}=(0,c.useSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPostType:s}=e(Wi),{getEditedEntityRecord:o,canUser:n}=e(d.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0;return{isTemplate:s()===D,postSlug:t("slug"),allowCommentsOnNewPosts:i?.default_comment_status||""}}),[]),[n,i]=(0,u.useState)(null),r=(0,u.useMemo)((()=>({anchor:n,placement:"left-start",offset:36,shift:!0})),[n]);if(!s||!["home","index"].includes(o))return null;const a=t=>{e("root","site",void 0,{default_comment_status:t?"open":null})};return(0,P.jsx)(Ka,{label:(0,ms.__)("Discussion"),ref:i,children:(0,P.jsx)(Ao.Dropdown,{popoverProps:r,contentClassName:"editor-site-discussion-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:e,onToggle:s})=>(0,P.jsx)(Ao.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,ms.__)("Change discussion settings"),onClick:s,children:t?(0,ms.__)("Comments open"):(0,ms.__)("Comments closed")}),renderContent:({onClose:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(m.__experimentalInspectorPopoverHeader,{title:(0,ms.__)("Discussion"),onClose:e}),(0,P.jsxs)(Ao.__experimentalVStack,{spacing:3,children:[(0,P.jsx)(Ao.__experimentalText,{children:(0,ms.__)("Changes will apply to new posts only. Individual posts may override these settings.")}),(0,P.jsx)(Ao.RadioControl,{className:"editor-site-discussion__options",hideLabelFromVision:!0,label:(0,ms.__)("Comment status"),options:x_,onChange:a,selected:t})]})]})})})}function w_({onActionPerformed:e}){const{isRemovedPostStatusPanel:t,postType:s,postId:o}=(0,c.useSelect)((e=>{const{isEditorPanelRemoved:t,getCurrentPostType:s,getCurrentPostId:o}=e(Wi);return{isRemovedPostStatusPanel:t("post-status"),postType:s(),postId:o()}}),[]);return(0,P.jsx)(__,{className:"editor-post-summary",children:(0,P.jsx)(Vl.Slot,{children:n=>(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(Ao.__experimentalVStack,{spacing:4,children:[(0,P.jsx)(p_,{postType:s,postId:o,onActionPerformed:e}),(0,P.jsx)(Lc,{withPanelBody:!1}),(0,P.jsx)(Cc,{}),(0,P.jsxs)(Ao.__experimentalVStack,{spacing:1,children:[(0,P.jsx)(h_,{}),(0,P.jsx)(g_,{})]}),!t&&(0,P.jsxs)(Ao.__experimentalVStack,{spacing:4,children:[(0,P.jsxs)(Ao.__experimentalVStack,{spacing:1,children:[(0,P.jsx)(Tu,{}),(0,P.jsx)(Au,{}),(0,P.jsx)(rp,{}),(0,P.jsx)(cc,{}),(0,P.jsx)(ec,{}),(0,P.jsx)(_c,{}),(0,P.jsx)(Gc,{}),(0,P.jsx)(ll,{}),(0,P.jsx)(Lu,{}),(0,P.jsx)(b_,{}),(0,P.jsx)(y_,{}),(0,P.jsx)(v_,{}),(0,P.jsx)(m_,{}),n]}),(0,P.jsx)(ep,{onActionPerformed:e})]})]})})})})}const{EXCLUDED_PATTERN_SOURCES:S_,PATTERN_TYPES:k_}=Xo(nn.privateApis);function P_(e,t){return e.innerBlocks=e.innerBlocks.map((e=>P_(e,t))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=t),e}function C_(e,t){return e.filter(((e,s,o)=>((e,t,s)=>t===s.findIndex((t=>e.name===t.name)))(e,s,o)&&(e=>!S_.includes(e.source))(e)&&(e=>e.templateTypes?.includes(t.slug)||e.blockTypes?.includes("core/template-part/"+t.area))(e)))}function j_(e,t){return e.map((e=>({...e,keywords:e.keywords||[],type:k_.theme,blocks:(0,y.parse)(e.content,{__unstableSkipMigrationLogs:!0}).map((e=>P_(e,t)))})))}function E_({availableTemplates:e,onSelect:t}){const s=(0,p.useAsyncList)(e);return e&&0!==e?.length?(0,P.jsx)(m.__experimentalBlockPatternsList,{label:(0,ms.__)("Templates"),blockPatterns:e,shownPatterns:s,onClickPattern:t,showTitlesAsTooltip:!0}):null}function T_(){const{record:e,postType:t,postId:s}=(0,c.useSelect)((e=>{const{getCurrentPostType:t,getCurrentPostId:s}=e(Wi),{getEditedEntityRecord:o}=e(d.store),n=t(),i=s();return{postType:n,postId:i,record:o("postType",n,i)}}),[]),{editEntityRecord:o}=(0,c.useDispatch)(d.store),n=function(e){const{blockPatterns:t,restBlockPatterns:s,currentThemeStylesheet:o}=(0,c.useSelect)((e=>{var t;const{getEditorSettings:s}=e(Wi),o=s();return{blockPatterns:null!==(t=o.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:o.__experimentalBlockPatterns,restBlockPatterns:e(d.store).getBlockPatterns(),currentThemeStylesheet:e(d.store).getCurrentTheme().stylesheet}}),[]);return(0,u.useMemo)((()=>j_(C_([...t||[],...s||[]],e),e)),[t,s,e,o])}(e);return n?.length?(0,P.jsx)(Ao.PanelBody,{title:(0,ms.__)("Design"),initialOpen:e.type===R,children:(0,P.jsx)(E_,{availableTemplates:n,onSelect:async e=>{await o("postType",t,s,{blocks:e.blocks,content:(0,y.serialize)(e.blocks)})}})}):null}function B_(){const{postType:e}=(0,c.useSelect)((e=>{const{getCurrentPostType:t}=e(Wi);return{postType:t()}}),[]);return[R,D].includes(e)?(0,P.jsx)(T_,{}):null}const I_={document:"edit-post/document",block:"edit-post/block"},{Tabs:N_}=Xo(Ao.privateApis),A_=(0,u.forwardRef)(((e,t)=>{const{documentLabel:s}=(0,c.useSelect)((e=>{const{getPostTypeLabel:t}=e(Wi);return{documentLabel:t()||(0,ms._x)("Document","noun, sidebar")}}),[]);return(0,P.jsxs)(N_.TabList,{ref:t,children:[(0,P.jsx)(N_.Tab,{tabId:I_.document,"data-tab-id":I_.document,children:s}),(0,P.jsx)(N_.Tab,{tabId:I_.block,"data-tab-id":I_.block,children:(0,ms.__)("Block")})]})})),{BlockQuickNavigation:D_}=Xo(m.privateApis),R_=["core/post-title","core/post-featured-image","core/post-content"];function M_(){const e=(0,u.useMemo)((()=>(0,h.applyFilters)("editor.postContentBlockTypes",R_)),[]),{clientIds:t,postType:s,renderingMode:o}=(0,c.useSelect)((t=>{const{getCurrentPostType:s,getPostBlocksByName:o,getRenderingMode:n}=Xo(t(Wi)),i=s();return{postType:i,clientIds:o(D===i?"core/template-part":e),renderingMode:n()}}),[e]),{enableComplementaryArea:n}=(0,c.useDispatch)(Er);return"post-only"===o&&s!==D||0===t.length?null:(0,P.jsx)(Ao.PanelBody,{title:(0,ms.__)("Content"),children:(0,P.jsx)(D_,{clientIds:t,onSelect:()=>{n("core","edit-post/document")}})})}const{BlockQuickNavigation:O_}=Xo(m.privateApis);function L_(){const e=(0,c.useSelect)((e=>{const{getBlockTypes:t}=e(y.store);return t()}),[]),t=(0,u.useMemo)((()=>e.filter((e=>"theme"===e.category)).map((({name:e})=>e))),[e]),s=(0,c.useSelect)((e=>{const{getBlocksByName:s}=e(m.store);return s(t)}),[t]);return 0===s.length?null:(0,P.jsx)(Ao.PanelBody,{title:(0,ms.__)("Content"),children:(0,P.jsx)(O_,{clientIds:s})})}function F_(){const e=(0,c.useSelect)((e=>{const{getCurrentPostType:t}=e(Wi);return t()}),[]);return e!==R?null:(0,P.jsx)(L_,{})}const V_=function(){const{hasBlockSelection:e}=(0,c.useSelect)((e=>({hasBlockSelection:!!e(m.store).getBlockSelectionStart()})),[]),{getActiveComplementaryArea:t}=(0,c.useSelect)(Er),{enableComplementaryArea:s}=(0,c.useDispatch)(Er),{get:o}=(0,c.useSelect)(j.store);(0,u.useEffect)((()=>{const n=t("core"),i=["edit-post/document","edit-post/block"].includes(n),r=o("core","distractionFree");i&&!r&&s("core",e?"edit-post/block":"edit-post/document")}),[e,t,s,o])},{Tabs:z_}=Xo(Ao.privateApis),U_=u.Platform.select({web:!0,native:!1}),H_=({tabName:e,keyboardShortcut:t,onActionPerformed:s,extraPanels:o})=>{const n=(0,u.useRef)(null),i=(0,u.useContext)(z_.Context);return(0,u.useEffect)((()=>{const t=Array.from(n.current?.querySelectorAll('[role="tab"]')||[]),s=t.find((t=>t.getAttribute("data-tab-id")===e)),o=s?.ownerDocument.activeElement;t.some((e=>o&&o.id===e.id))&&s&&s.id!==o?.id&&s?.focus()}),[e]),(0,P.jsx)(Wl,{identifier:e,header:(0,P.jsx)(z_.Context.Provider,{value:i,children:(0,P.jsx)(A_,{ref:n})}),closeLabel:(0,ms.__)("Close Settings"),className:"editor-sidebar__panel",headerClassName:"editor-sidebar__panel-tabs",title:(0,ms._x)("Settings","sidebar button label"),toggleShortcut:t,icon:(0,ms.isRTL)()?qp:Qp,isActiveByDefault:U_,children:(0,P.jsxs)(z_.Context.Provider,{value:i,children:[(0,P.jsxs)(z_.TabPanel,{tabId:I_.document,focusable:!1,children:[(0,P.jsx)(w_,{onActionPerformed:s}),(0,P.jsx)(Bl.Slot,{}),(0,P.jsx)(M_,{}),(0,P.jsx)(F_,{}),(0,P.jsx)(B_,{}),(0,P.jsx)(Hu,{}),(0,P.jsx)(n_,{}),o]}),(0,P.jsx)(z_.TabPanel,{tabId:I_.block,focusable:!1,children:(0,P.jsx)(m.BlockInspector,{})})]})})},G_=({extraPanels:e,onActionPerformed:t})=>{V_();const{tabName:s,keyboardShortcut:o,showSummary:n}=(0,c.useSelect)((e=>{const t=e(nr.store).getShortcutRepresentation("core/editor/toggle-sidebar"),s=e(Er).getActiveComplementaryArea("core");let o=s;return[I_.block,I_.document].includes(s)||(o=e(m.store).getBlockSelectionStart()?I_.block:I_.document),{tabName:o,keyboardShortcut:t,showSummary:![D,R,O].includes(e(Wi).getCurrentPostType())}}),[]),{enableComplementaryArea:i}=(0,c.useDispatch)(Er),r=(0,u.useCallback)((e=>{e&&i("core",e)}),[i]);return(0,P.jsx)(z_,{selectedTabId:s,onSelect:r,selectOnMove:!1,children:(0,P.jsx)(H_,{tabName:s,keyboardShortcut:o,showSummary:n,onActionPerformed:t,extraPanels:e})})};const $_=function({postType:e,postId:t,templateId:s,settings:o,children:n,initialEdits:i,onActionPerformed:r,extraContent:a,extraSidebarPanels:l,...u}){const{post:p,template:h,hasLoadedPost:m}=(0,c.useSelect)((o=>{const{getEntityRecord:n,hasFinishedResolution:i}=o(d.store);return{post:n("postType",e,t),template:s?n("postType",D,s):void 0,hasLoadedPost:i("getEntityRecord",["postType",e,t])}}),[e,t,s]);return(0,P.jsxs)(P.Fragment,{children:[m&&!p&&(0,P.jsx)(Ao.Notice,{status:"warning",isDismissible:!1,children:(0,ms.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")}),!!p&&(0,P.jsxs)(zh,{post:p,__unstableTemplate:h,settings:o,initialEdits:i,useSubRegistry:!1,children:[(0,P.jsx)(s_,{...u,children:a}),n,(0,P.jsx)(G_,{onActionPerformed:r,extraPanels:l})]})]})},{PreferenceBaseOption:W_}=Xo(j.privateApis),Z_=(0,p.compose)((0,c.withSelect)((e=>({isChecked:e(Wi).isPublishSidebarEnabled()}))),(0,c.withDispatch)((e=>{const{enablePublishSidebar:t,disablePublishSidebar:s}=e(Wi);return{onChange:e=>e?t():s()}})))(W_);const Y_=function({blockTypes:e,value:t,onItemChange:s}){return(0,P.jsx)("ul",{className:"editor-block-manager__checklist",children:e.map((e=>(0,P.jsxs)("li",{className:"editor-block-manager__checklist-item",children:[(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.title,checked:t.includes(e.name),onChange:(...t)=>s(e.name,...t)}),(0,P.jsx)(m.BlockIcon,{icon:e.icon})]},e.name)))})};const K_=function e({title:t,blockTypes:s}){const o=(0,p.useInstanceId)(e),{allowedBlockTypes:n,hiddenBlockTypes:i}=(0,c.useSelect)((e=>{const{getEditorSettings:t}=e(Wi),{get:s}=e(j.store);return{allowedBlockTypes:t().allowedBlockTypes,hiddenBlockTypes:s("core","hiddenBlockTypes")}}),[]),r=(0,u.useMemo)((()=>!0===n?s:s.filter((({name:e})=>n?.includes(e)))),[n,s]),{showBlockTypes:a,hideBlockTypes:l}=Xo((0,c.useDispatch)(Wi)),d=(0,u.useCallback)(((e,t)=>{t?a(e):l(e)}),[a,l]),h=(0,u.useCallback)((e=>{const t=s.map((({name:e})=>e));e?a(t):l(t)}),[s,a,l]);if(!r.length)return null;const m=r.map((({name:e})=>e)).filter((e=>!(null!=i?i:[]).includes(e))),g="editor-block-manager__category-title-"+o,_=m.length===r.length,f=!_&&m.length>0;return(0,P.jsxs)("div",{role:"group","aria-labelledby":g,className:"editor-block-manager__category",children:[(0,P.jsx)(Ao.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:_,onChange:h,className:"editor-block-manager__category-title",indeterminate:f,label:(0,P.jsx)("span",{id:g,children:t})}),(0,P.jsx)(Y_,{blockTypes:r,value:m,onItemChange:d})]})};function q_(){const e=(0,p.useDebounce)(ds.speak,500),[t,s]=(0,u.useState)(""),{showBlockTypes:o}=Xo((0,c.useDispatch)(Wi)),{blockTypes:n,categories:i,hasBlockSupport:r,isMatchingSearchTerm:a,numberOfHiddenBlocks:l}=(0,c.useSelect)((e=>{var t;const s=e(y.store).getBlockTypes(),o=(null!==(t=e(j.store).get("core","hiddenBlockTypes"))&&void 0!==t?t:[]).filter((e=>s.some((t=>t.name===e))));return{blockTypes:s,categories:e(y.store).getCategories(),hasBlockSupport:e(y.store).hasBlockSupport,isMatchingSearchTerm:e(y.store).isMatchingSearchTerm,numberOfHiddenBlocks:Array.isArray(o)&&o.length}}),[]);const d=n.filter((e=>r(e,"inserter",!0)&&(!t||a(e,t))&&(!e.parent||e.parent.includes("core/post-content"))));return(0,u.useEffect)((()=>{if(!t)return;const s=d.length,o=(0,ms.sprintf)((0,ms._n)("%d result found.","%d results found.",s),s);e(o)}),[d?.length,t,e]),(0,P.jsxs)("div",{className:"editor-block-manager__content",children:[!!l&&(0,P.jsxs)("div",{className:"editor-block-manager__disabled-blocks-count",children:[(0,ms.sprintf)((0,ms._n)("%d block is hidden.","%d blocks are hidden.",l),l),(0,P.jsx)(Ao.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>function(e){const t=e.map((({name:e})=>e));o(t)}(d),children:(0,ms.__)("Reset")})]}),(0,P.jsx)(Ao.SearchControl,{__nextHasNoMarginBottom:!0,label:(0,ms.__)("Search for a block"),placeholder:(0,ms.__)("Search for a block"),value:t,onChange:e=>s(e),className:"editor-block-manager__search"}),(0,P.jsxs)("div",{tabIndex:"0",role:"region","aria-label":(0,ms.__)("Available block types"),className:"editor-block-manager__results",children:[0===d.length&&(0,P.jsx)("p",{className:"editor-block-manager__no-results",children:(0,ms.__)("No blocks found.")}),i.map((e=>(0,P.jsx)(K_,{title:e.title,blockTypes:d.filter((t=>t.category===e.slug))},e.slug))),(0,P.jsx)(K_,{title:(0,ms.__)("Uncategorized"),blockTypes:d.filter((({category:e})=>!e))})]})]})}const{PreferencesModal:Q_,PreferencesModalTabs:X_,PreferencesModalSection:J_,PreferenceToggleControl:ef}=Xo(j.privateApis);function tf({extraSections:e={}}){const t=(0,p.useViewportMatch)("medium"),s=(0,c.useSelect)((e=>{const{getEditorSettings:s}=e(Wi),{get:o}=e(j.store),n=s().richEditingEnabled;return!o("core","distractionFree")&&t&&n}),[t]),{setIsListViewOpened:o,setIsInserterOpened:n}=(0,c.useDispatch)(Wi),{set:i}=(0,c.useDispatch)(j.store),r=!!hh().length,a=(0,u.useMemo)((()=>[{name:"general",tabLabel:(0,ms.__)("General"),content:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(J_,{title:(0,ms.__)("Interface"),children:[(0,P.jsx)(ef,{scope:"core",featureName:"showListViewByDefault",help:(0,ms.__)("Opens the List View sidebar by default."),label:(0,ms.__)("Always open List View")}),s&&(0,P.jsx)(ef,{scope:"core",featureName:"showBlockBreadcrumbs",help:(0,ms.__)("Display the block hierarchy trail at the bottom of the editor."),label:(0,ms.__)("Show block breadcrumbs")}),(0,P.jsx)(ef,{scope:"core",featureName:"allowRightClickOverrides",help:(0,ms.__)("Allows contextual List View menus via right-click, overriding browser defaults."),label:(0,ms.__)("Allow right-click contextual menus")}),r&&(0,P.jsx)(ef,{scope:"core",featureName:"enableChoosePatternModal",help:(0,ms.__)("Shows starter patterns when creating a new page."),label:(0,ms.__)("Show starter patterns")})]}),(0,P.jsxs)(J_,{title:(0,ms.__)("Document settings"),description:(0,ms.__)("Select what settings are shown in the document panel."),children:[(0,P.jsx)(Cl.Slot,{}),(0,P.jsx)(Vu,{taxonomyWrapper:(e,t)=>(0,P.jsx)(wl,{label:t.labels.menu_name,panelName:`taxonomy-panel-${t.slug}`})}),(0,P.jsx)(Tc,{children:(0,P.jsx)(wl,{label:(0,ms.__)("Featured image"),panelName:"featured-image"})}),(0,P.jsx)(bc,{children:(0,P.jsx)(wl,{label:(0,ms.__)("Excerpt"),panelName:"post-excerpt"})}),(0,P.jsx)(Ga,{supportKeys:["comments","trackbacks"],children:(0,P.jsx)(wl,{label:(0,ms.__)("Discussion"),panelName:"discussion-panel"})}),(0,P.jsx)(Ha,{children:(0,P.jsx)(wl,{label:(0,ms.__)("Page attributes"),panelName:"page-attributes"})})]}),t&&(0,P.jsx)(J_,{title:(0,ms.__)("Publishing"),children:(0,P.jsx)(Z_,{help:(0,ms.__)("Review settings, such as visibility and tags."),label:(0,ms.__)("Enable pre-publish checks")})}),e?.general]})},{name:"appearance",tabLabel:(0,ms.__)("Appearance"),content:(0,P.jsxs)(J_,{title:(0,ms.__)("Appearance"),description:(0,ms.__)("Customize the editor interface to suit your needs."),children:[(0,P.jsx)(ef,{scope:"core",featureName:"fixedToolbar",onToggle:()=>i("core","distractionFree",!1),help:(0,ms.__)("Access all block and document tools in a single place."),label:(0,ms.__)("Top toolbar")}),(0,P.jsx)(ef,{scope:"core",featureName:"distractionFree",onToggle:()=>{i("core","fixedToolbar",!0),n(!1),o(!1)},help:(0,ms.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,ms.__)("Distraction free")}),(0,P.jsx)(ef,{scope:"core",featureName:"focusMode",help:(0,ms.__)("Highlights the current block and fades other content."),label:(0,ms.__)("Spotlight mode")}),e?.appearance]})},{name:"accessibility",tabLabel:(0,ms.__)("Accessibility"),content:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(J_,{title:(0,ms.__)("Navigation"),description:(0,ms.__)("Optimize the editing experience for enhanced control."),children:(0,P.jsx)(ef,{scope:"core",featureName:"keepCaretInsideBlock",help:(0,ms.__)("Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block."),label:(0,ms.__)("Contain text cursor inside block")})}),(0,P.jsx)(J_,{title:(0,ms.__)("Interface"),children:(0,P.jsx)(ef,{scope:"core",featureName:"showIconLabels",label:(0,ms.__)("Show button text labels"),help:(0,ms.__)("Show text instead of icons on buttons across the interface.")})})]})},{name:"blocks",tabLabel:(0,ms.__)("Blocks"),content:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(J_,{title:(0,ms.__)("Inserter"),children:(0,P.jsx)(ef,{scope:"core",featureName:"mostUsedBlocks",help:(0,ms.__)("Adds a category with the most frequently used blocks in the inserter."),label:(0,ms.__)("Show most used blocks")})}),(0,P.jsx)(J_,{title:(0,ms.__)("Manage block visibility"),description:(0,ms.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."),children:(0,P.jsx)(q_,{})})]})},window.__experimentalMediaProcessing&&{name:"media",tabLabel:(0,ms.__)("Media"),content:(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(J_,{title:(0,ms.__)("General"),description:(0,ms.__)("Customize options related to the media upload flow."),children:[(0,P.jsx)(ef,{scope:"core/media",featureName:"optimizeOnUpload",help:(0,ms.__)("Compress media items before uploading to the server."),label:(0,ms.__)("Pre-upload compression")}),(0,P.jsx)(ef,{scope:"core/media",featureName:"requireApproval",help:(0,ms.__)("Require approval step when optimizing existing media."),label:(0,ms.__)("Approval step")})]})})}].filter(Boolean)),[s,e,n,o,i,t,r]);return(0,P.jsx)(X_,{sections:a})}const sf="content",of={name:"core/pattern-overrides",getValues({select:e,clientId:t,context:s,bindings:o}){const n=s["pattern/overrides"],{getBlockAttributes:i}=e(m.store),r=i(t),a={};for(const e of Object.keys(o)){const t=n?.[r?.metadata?.name]?.[e];void 0!==t?a[e]=""===t?void 0:t:a[e]=r[e]}return a},setValues({select:e,dispatch:t,clientId:s,bindings:o}){const{getBlockAttributes:n,getBlockParentsByBlockName:i,getBlocks:r}=e(m.store),a=n(s),l=a?.metadata?.name;if(!l)return;const[c]=i(s,"core/block",!0),d=Object.entries(o).reduce(((e,[t,{newValue:s}])=>(e[t]=s,e)),{});if(!c){const e=s=>{for(const o of s)o.attributes?.metadata?.name===l&&t(m.store).updateBlockAttributes(o.clientId,d),e(o.innerBlocks)};return void e(r())}const u=n(c)?.[sf];t(m.store).updateBlockAttributes(c,{[sf]:{...u,[l]:{...u?.[l],...Object.entries(d).reduce(((e,[t,s])=>(e[t]=void 0===s?"":s,e)),{})}}})},canUserEditValue:()=>!0};function nf(e,t){const{getEditedEntityRecord:s}=e(d.store),{getRegisteredPostMeta:o}=Xo(e(d.store));let n;t?.postType&&t?.postId&&(n=s("postType",t?.postType,t?.postId).meta);const i=o(t?.postType),r={};return Object.entries(i||{}).forEach((([e,t])=>{var s;"footnotes"!==e&&"_"!==e.charAt(0)&&(r[e]={label:t.title||e,value:null!==(s=n?.[e])&&void 0!==s?s:t.default||void 0,type:t.type})})),Object.keys(r||{}).length?r:null}const rf={name:"core/post-meta",getValues({select:e,context:t,bindings:s}){const o=nf(e,t),n={};for(const[e,t]of Object.entries(s)){var i;const s=t.args.key,{value:r,label:a}=o?.[s]||{};n[e]=null!==(i=null!=r?r:a)&&void 0!==i?i:s}return n},setValues({dispatch:e,context:t,bindings:s}){const o={};Object.values(s).forEach((({args:e,newValue:t})=>{o[e.key]=t})),e(d.store).editEntityRecord("postType",t?.postType,t?.postId,{meta:o})},canUserEditValue({select:e,context:t,args:s}){if(t?.query||t?.queryId)return!1;if("wp_template"===(t?.postType||e(Wi).getCurrentPostType()))return!1;const o=nf(e,t)?.[s.key]?.value;if(void 0===o)return!1;if(e(Wi).getEditorSettings().enableCustomFields)return!1;return!!e(d.store).canUser("update",{kind:"postType",name:t?.postType,id:t?.postId})},getFieldsList:({select:e,context:t})=>nf(e,t)};const{store:af,...lf}=l,cf={};function df(e,t,s){const{registerEntityAction:o}=Xo((0,c.dispatch)(Wi))}function uf(e,t,s){const{unregisterEntityAction:o}=Xo((0,c.dispatch)(Wi))}Qo(cf,{CreateTemplatePartModal:Uo,BackButton:eg,EntitiesSavedStatesExtensible:Da,Editor:$_,EditorContentSlotFill:Km,GlobalStylesProvider:function({children:e}){const t=Ap();return t.isReady?(0,P.jsx)(Bp.Provider,{value:t,children:e}):null},mergeBaseAndUserConfigs:Np,PluginPostExcerpt:wc,PostCardPanel:p_,PreferencesModal:function({extraSections:e={}}){const t=(0,c.useSelect)((e=>e(Er).isModalActive("editor/preferences")),[]),{closeModal:s}=(0,c.useDispatch)(Er);return t?(0,P.jsx)(Q_,{closeModal:s,children:(0,P.jsx)(tf,{extraSections:e})}):null},usePostActions:i_,ToolsMoreMenuGroup:hg,ViewMoreMenuGroup:_g,ResizableEditor:zg,registerCoreBlockBindingsSources:function(){(0,y.registerBlockBindingsSource)(of),(0,y.registerBlockBindingsSource)(rf)},interfaceStore:af,...lf})})(),(window.wp=window.wp||{}).editor=o})();