12 lines
199 KiB
JavaScript
12 lines
199 KiB
JavaScript
/*! This file is auto-generated */
|
||
!function(){var e={6411:function(e,t){var n,l,a;
|
||
/*!
|
||
autosize 4.0.4
|
||
license: MIT
|
||
http://www.jacklmoore.com/autosize
|
||
*/l=[e,t],n=function(e,t){"use strict";var n,l,a="function"==typeof Map?new Map:(n=[],l=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return l[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),l.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),l.splice(t,1))}}),r=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){r=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function o(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!a.has(e)){var t=null,n=null,l=null,o=function(){e.clientWidth!==n&&m()},i=function(t){window.removeEventListener("resize",o,!1),e.removeEventListener("input",m,!1),e.removeEventListener("keyup",m,!1),e.removeEventListener("autosize:destroy",i,!1),e.removeEventListener("autosize:update",m,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),a.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",i,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",m,!1),window.addEventListener("resize",o,!1),e.addEventListener("input",m,!1),e.addEventListener("autosize:update",m,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",a.set(e,{destroy:i,update:m}),s()}function s(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),m()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(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 d(){if(0!==e.scrollHeight){var l=u(e),a=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,l.forEach((function(e){e.node.scrollTop=e.scrollTop})),a&&(document.documentElement.scrollTop=a)}}function m(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),a="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(a<t?"hidden"===n.overflowY&&(c("scroll"),d(),a="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(c("hidden"),d(),a="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),l!==a){l=a;var o=r("autosize:resized");try{e.dispatchEvent(o)}catch(e){}}}}function i(e){var t=a.get(e);t&&t.destroy()}function s(e){var t=a.get(e);t&&t.update()}var c=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((c=function(e){return e}).destroy=function(e){return e},c.update=function(e){return e}):((c=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return o(e,t)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},c.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],s),e}),t.default=c,e.exports=t.default},void 0===(a="function"==typeof n?n.apply(t,l):n)||(e.exports=a)},4403:function(e,t){var n;
|
||
/*!
|
||
Copyright (c) 2018 Jed Watson.
|
||
Licensed under the MIT License (MIT), see
|
||
http://jedwatson.github.io/classnames
|
||
*/!function(){"use strict";var l={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n)){if(n.length){var o=a.apply(null,n);o&&e.push(o)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var i in n)l.call(n,i)&&n[i]&&e.push(i)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},4827:function(e){e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},8981:function(e,t){var n,l,a;l=[],void 0===(a="function"==typeof(n=function(){return function e(t,n,l){var a,r,o=window,i="application/octet-stream",s=l||i,c=t,u=!n&&!l&&c,d=document.createElement("a"),m=function(e){return String(e)},p=o.Blob||o.MozBlob||o.WebKitBlob||m,g=n||"download";if(p=p.call?p.bind(o):Blob,"true"===String(this)&&(s=(c=[c,s])[0],c=c[1]),u&&u.length<2048&&(g=u.split("/").pop().split("?")[0],d.href=u,-1!==d.href.indexOf(u))){var _=new XMLHttpRequest;return _.open("GET",u,!0),_.responseType="blob",_.onload=function(t){e(t.target.response,g,i)},setTimeout((function(){_.send()}),0),_}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424&&p!==m))return navigator.msSaveBlob?navigator.msSaveBlob(v(c),g):y(c);s=(c=v(c)).type||i}else if(/([\x80-\xff])/.test(c)){for(var h=0,f=new Uint8Array(c.length),E=f.length;h<E;++h)f[h]=c.charCodeAt(h);c=new p([f],{type:s})}function v(e){for(var t=e.split(/[:;,]/),n=t[1],l=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),a=l.length,r=0,o=new Uint8Array(a);r<a;++r)o[r]=l.charCodeAt(r);return new p([o],{type:n})}function y(e,t){if("download"in d)return d.href=e,d.setAttribute("download",g),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout((function(){d.click(),document.body.removeChild(d),!0===t&&setTimeout((function(){o.URL.revokeObjectURL(d.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,i)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var n=document.createElement("iframe");document.body.appendChild(n),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,i)),n.src=e,setTimeout((function(){document.body.removeChild(n)}),333)}if(a=c instanceof p?c:new p([c],{type:s}),navigator.msSaveBlob)return navigator.msSaveBlob(a,g);if(o.URL)y(o.URL.createObjectURL(a),!0);else{if("string"==typeof a||a.constructor===m)try{return y("data:"+s+";base64,"+o.btoa(a))}catch(e){return y("data:"+s+","+encodeURIComponent(a))}(r=new FileReader).onload=function(e){y(this.result)},r.readAsDataURL(a)}return!0}})?n.apply(t,l):n)||(e.exports=a)},9894:function(e,t,n){var l=n(4827);e.exports=function(e){var t=l(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var a=e.style.lineHeight;e.style.lineHeight=t+"em",t=l(e,"line-height"),n=parseFloat(t,10),a?e.style.lineHeight=a:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var r=e.nodeName,o=document.createElement(r);o.innerHTML=" ","TEXTAREA"===r.toUpperCase()&&o.setAttribute("rows","1");var i=l(e,"font-size");o.style.fontSize=i,o.style.padding="0px",o.style.border="0px";var s=document.body;s.appendChild(o),n=o.offsetHeight,s.removeChild(o)}return n}},5372:function(e,t,n){"use strict";var l=n(9567);function a(){}function r(){}r.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,r,o){if(o!==l){var i=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 i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={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:r,resetWarningCache:a};return n.PropTypes=n,n}},2652:function(e,t,n){e.exports=n(5372)()},9567:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},5438:function(e,t,n){"use strict";var l,a=this&&this.__extends||(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,l=arguments.length;n<l;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o=this&&this.__rest||function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&t.indexOf(l)<0&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(l=Object.getOwnPropertySymbols(e);a<l.length;a++)t.indexOf(l[a])<0&&(n[l[a]]=e[l[a]])}return n};t.__esModule=!0;var i=n(9196),s=n(2652),c=n(6411),u=n(9894),d="autosize:resized",m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.textarea=null,t.onResize=function(e){t.props.onResize&&t.props.onResize(e)},t.updateLineHeight=function(){t.textarea&&t.setState({lineHeight:u(t.textarea)})},t.onChange=function(e){var n=t.props.onChange;t.currentValue=e.currentTarget.value,n&&n(e)},t}return a(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.maxRows,l=t.async;"number"==typeof n&&this.updateLineHeight(),"number"==typeof n||l?setTimeout((function(){return e.textarea&&c(e.textarea)})):this.textarea&&c(this.textarea),this.textarea&&this.textarea.addEventListener(d,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(d,this.onResize),c.destroy(this.textarea))},t.prototype.render=function(){var e=this,t=this.props,n=(t.onResize,t.maxRows),l=(t.onChange,t.style),a=(t.innerRef,t.children),s=o(t,["onResize","maxRows","onChange","style","innerRef","children"]),c=this.state.lineHeight,u=n&&c?c*n:null;return i.createElement("textarea",r({},s,{onChange:this.onChange,style:u?r({},l,{maxHeight:u}):l,ref:function(t){e.textarea=t,"function"==typeof e.props.innerRef?e.props.innerRef(t):e.props.innerRef&&(e.props.innerRef.current=t)}}),a)},t.prototype.componentDidUpdate=function(){this.textarea&&c.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:s.number,maxRows:s.number,onResize:s.func,innerRef:s.any,async:s.bool},t}(i.Component);t.TextareaAutosize=i.forwardRef((function(e,t){return i.createElement(m,r({},e,{innerRef:t}))}))},773:function(e,t,n){"use strict";var l=n(5438);t.Z=l.TextareaAutosize},9196:function(e){"use strict";e.exports=window.React}},t={};function n(l){var a=t[l];if(void 0!==a)return a.exports;var r=t[l]={exports:{}};return e[l].call(r.exports,r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};!function(){"use strict";n.r(l),n.d(l,{PluginMoreMenuItem:function(){return qo},PluginSidebar:function(){return Wo},PluginSidebarMoreMenuItem:function(){return Yo},__experimentalMainDashboardButton:function(){return Qa},__experimentalNavigationToggle:function(){return lr},initializeEditor:function(){return Ko},reinitializeEditor:function(){return Xo}});var e={};n.r(e),n.d(e,{disableComplementaryArea:function(){return N},enableComplementaryArea:function(){return T},pinItem:function(){return I},setDefaultComplementaryArea:function(){return C},setFeatureDefaults:function(){return V},setFeatureValue:function(){return z},toggleFeature:function(){return P},unpinItem:function(){return M}});var t={};n.r(t),n.d(t,{getActiveComplementaryArea:function(){return B},isFeatureActive:function(){return R},isItemPinned:function(){return A}});var a={};n.r(a),n.d(a,{__experimentalSetPreviewDeviceType:function(){return tt},addTemplate:function(){return lt},closeGeneralSidebar:function(){return ht},openGeneralSidebar:function(){return _t},openNavigationPanelToMenu:function(){return ct},removeTemplate:function(){return at},revertTemplate:function(){return gt},setHomeTemplateId:function(){return ot},setIsInserterOpened:function(){return dt},setIsListViewOpened:function(){return pt},setIsNavigationPanelOpened:function(){return ut},setNavigationPanelActiveMenu:function(){return st},setPage:function(){return it},setTemplate:function(){return nt},setTemplatePart:function(){return rt},switchEditorMode:function(){return ft},toggleFeature:function(){return et},updateSettings:function(){return mt}});var r={};n.r(r),n.d(r,{__experimentalGetInsertionPoint:function(){return Dt},__experimentalGetPreviewDeviceType:function(){return Ct},__unstableGetPreference:function(){return St},getCanUserCreateMedia:function(){return Tt},getCurrentTemplateNavigationPanelSubMenu:function(){return Rt},getCurrentTemplateTemplateParts:function(){return Ft},getEditedPostId:function(){return Vt},getEditedPostType:function(){return zt},getEditorMode:function(){return Ht},getHomeTemplateId:function(){return Mt},getNavigationPanelActiveMenu:function(){return At},getPage:function(){return Bt},getReusableBlocks:function(){return Nt},getSettings:function(){return It},isFeatureActive:function(){return kt},isInserterOpened:function(){return Ot},isListViewOpened:function(){return Gt},isNavigationOpened:function(){return Lt}});var o=window.wp.element,i=window.wp.blocks,s=window.wp.blockLibrary,c=window.wp.data,u=window.wp.coreData,d=window.wp.editor;function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},m.apply(this,arguments)}var p=n(4403),g=n.n(p),_=window.wp.components,h=window.wp.i18n,f=window.wp.primitives;var E=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var v=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var y=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),b=window.wp.viewport;var w=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"})),x=window.wp.deprecated,S=n.n(x),k=window.wp.preferences;const C=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),T=(e,t)=>n=>{let{registry:l,dispatch:a}=n;if(!t)return;l.select(k.store).get(e,"isComplementaryAreaVisible")||l.dispatch(k.store).set(e,"isComplementaryAreaVisible",!0),a({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},N=e=>t=>{let{registry:n}=t;n.select(k.store).get(e,"isComplementaryAreaVisible")&&n.dispatch(k.store).set(e,"isComplementaryAreaVisible",!1)},I=(e,t)=>n=>{let{registry:l}=n;if(!t)return;const a=l.select(k.store).get(e,"pinnedItems");!0!==(null==a?void 0:a[t])&&l.dispatch(k.store).set(e,"pinnedItems",{...a,[t]:!0})},M=(e,t)=>n=>{let{registry:l}=n;if(!t)return;const a=l.select(k.store).get(e,"pinnedItems");l.dispatch(k.store).set(e,"pinnedItems",{...a,[t]:!1})};function P(e,t){return function(n){let{registry:l}=n;S()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),l.dispatch(k.store).toggle(e,t)}}function z(e,t,n){return function(l){let{registry:a}=l;S()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),a.dispatch(k.store).set(e,t,!!n)}}function V(e,t){return function(n){let{registry:l}=n;S()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),l.dispatch(k.store).setDefaults(e,t)}}const B=(0,c.createRegistrySelector)((e=>(t,n)=>{var l;const a=e(k.store).get(n,"isComplementaryAreaVisible");if(void 0!==a)return a?null==t||null===(l=t.complementaryAreas)||void 0===l?void 0:l[n]:null})),A=(0,c.createRegistrySelector)((e=>(t,n,l)=>{var a;const r=e(k.store).get(n,"pinnedItems");return null===(a=null==r?void 0:r[l])||void 0===a||a})),R=(0,c.createRegistrySelector)((e=>(t,n,l)=>(S()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(k.store).get(n,l))));var L=(0,c.combineReducers)({complementaryAreas:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:l}=t;return e[n]?e:{...e,[n]:l}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:l}=t;return{...e,[n]:l}}}return e}});const O=(0,c.createReduxStore)("core/interface",{reducer:L,actions:e,selectors:t});(0,c.register)(O);var D=window.wp.plugins,G=(0,D.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var F=G((function(e){let{as:t=_.Button,scope:n,identifier:l,icon:a,selectedIcon:r,name:i,...s}=e;const u=t,d=(0,c.useSelect)((e=>e(O).getActiveComplementaryArea(n)===l),[l]),{enableComplementaryArea:p,disableComplementaryArea:g}=(0,c.useDispatch)(O);return(0,o.createElement)(u,m({icon:r&&d?r:a,onClick:()=>{d?g(n):p(n,l)}},s))}));var H=e=>{let{smallScreenTitle:t,children:n,className:l,toggleButtonProps:a}=e;const r=(0,o.createElement)(F,m({icon:w},a));return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},t&&(0,o.createElement)("span",{className:"interface-complementary-area-header__small-title"},t),r),(0,o.createElement)("div",{className:g()("components-panel__header","interface-complementary-area-header",l),tabIndex:-1},n,r))};const $=()=>{};function U(e){let{name:t,as:n=_.Button,onClick:l,...a}=e;return(0,o.createElement)(_.Fill,{name:t},(e=>{let{onClick:t}=e;return(0,o.createElement)(n,m({onClick:l||t?function(){(l||$)(...arguments),(t||$)(...arguments)}:void 0},a))}))}U.Slot=function(e){let{name:t,as:n=_.ButtonGroup,fillProps:l={},bubblesVirtually:a,...r}=e;return(0,o.createElement)(_.Slot,{name:t,bubblesVirtually:a,fillProps:l},(e=>{if(!o.Children.toArray(e).length)return null;const t=[];o.Children.forEach(e,(e=>{let{props:{__unstableExplicitMenuItem:n,__unstableTarget:l}}=e;l&&n&&t.push(l)}));const l=o.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&t.includes(e.props.__unstableTarget)?null:e));return(0,o.createElement)(n,r,l)}))};var j=U;const W=e=>{let{__unstableExplicitMenuItem:t,__unstableTarget:n,...l}=e;return(0,o.createElement)(_.MenuItem,l)};function Y(e){let{scope:t,target:n,__unstableExplicitMenuItem:l,...a}=e;return(0,o.createElement)(F,m({as:e=>(0,o.createElement)(j,m({__unstableExplicitMenuItem:l,__unstableTarget:`${t}/${n}`,as:W,name:`${t}/plugin-more-menu`},e)),role:"menuitemcheckbox",selectedIcon:E,name:n,scope:t},a))}function q(e){let{scope:t,...n}=e;return(0,o.createElement)(_.Fill,m({name:`PinnedItems/${t}`},n))}q.Slot=function(e){let{scope:t,className:n,...l}=e;return(0,o.createElement)(_.Slot,m({name:`PinnedItems/${t}`},l),(e=>(null==e?void 0:e.length)>0&&(0,o.createElement)("div",{className:g()(n,"interface-pinned-items")},e)))};var X=q;function K(e){let{scope:t,children:n,className:l}=e;return(0,o.createElement)(_.Fill,{name:`ComplementaryArea/${t}`},(0,o.createElement)("div",{className:l},n))}const Z=G((function(e){let{children:t,className:n,closeLabel:l=(0,h.__)("Close plugin"),identifier:a,header:r,headerClassName:i,icon:s,isPinnable:u=!0,panelClassName:d,scope:m,name:p,smallScreenTitle:f,title:w,toggleShortcut:x,isActiveByDefault:S,showIconLabels:k=!1}=e;const{isActive:C,isPinned:T,activeArea:N,isSmall:I,isLarge:M}=(0,c.useSelect)((e=>{const{getActiveComplementaryArea:t,isItemPinned:n}=e(O),l=t(m);return{isActive:l===a,isPinned:n(m,a),activeArea:l,isSmall:e(b.store).isViewportMatch("< medium"),isLarge:e(b.store).isViewportMatch("large")}}),[a,m]);!function(e,t,n,l,a){const r=(0,o.useRef)(!1),i=(0,o.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:u}=(0,c.useDispatch)(O);(0,o.useEffect)((()=>{l&&a&&!r.current?(u(e),i.current=!0):i.current&&!a&&r.current?(i.current=!1,s(e,t)):i.current&&n&&n!==t&&(i.current=!1),a!==r.current&&(r.current=a)}),[l,a,e,t,n])}(m,a,N,C,I);const{enableComplementaryArea:P,disableComplementaryArea:z,pinItem:V,unpinItem:B}=(0,c.useDispatch)(O);return(0,o.useEffect)((()=>{S&&void 0===N&&!I&&P(m,a)}),[N,S,m,a,I]),(0,o.createElement)(o.Fragment,null,u&&(0,o.createElement)(X,{scope:m},T&&(0,o.createElement)(F,{scope:m,identifier:a,isPressed:C&&(!k||M),"aria-expanded":C,label:w,icon:k?E:s,showTooltip:!k,variant:k?"tertiary":void 0})),p&&u&&(0,o.createElement)(Y,{target:p,scope:m,icon:s},w),C&&(0,o.createElement)(K,{className:g()("interface-complementary-area",n),scope:m},(0,o.createElement)(H,{className:i,closeLabel:l,onClose:()=>z(m),smallScreenTitle:f,toggleButtonProps:{label:l,shortcut:x,scope:m,identifier:a}},r||(0,o.createElement)(o.Fragment,null,(0,o.createElement)("strong",null,w),u&&(0,o.createElement)(_.Button,{className:"interface-complementary-area__pin-unpin-item",icon:T?v:y,label:T?(0,h.__)("Unpin from toolbar"):(0,h.__)("Pin to toolbar"),onClick:()=>(T?B:V)(m,a),isPressed:T,"aria-expanded":T}))),(0,o.createElement)(_.Panel,{className:d},t)))}));Z.Slot=function(e){let{scope:t,...n}=e;return(0,o.createElement)(_.Slot,m({name:`ComplementaryArea/${t}`},n))};var Q=Z,J=window.wp.compose;var ee=(0,o.forwardRef)((function(e,t){let{footer:n,header:l,sidebar:a,secondarySidebar:r,notices:i,content:s,drawer:c,actions:u,labels:d,className:p,shortcuts:f}=e;const E=(0,_.__unstableUseNavigateRegions)(f);!function(e){(0,o.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 v={...{drawer:(0,h.__)("Drawer"),header:(0,h.__)("Header"),body:(0,h.__)("Content"),secondarySidebar:(0,h.__)("Block Library"),sidebar:(0,h.__)("Settings"),actions:(0,h.__)("Publish"),footer:(0,h.__)("Footer")},...d};return(0,o.createElement)("div",m({},E,{ref:(0,J.useMergeRefs)([t,E.ref]),className:g()(p,"interface-interface-skeleton",E.className,!!n&&"has-footer")}),!!c&&(0,o.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":v.drawer,tabIndex:"-1"},c),(0,o.createElement)("div",{className:"interface-interface-skeleton__editor"},!!l&&(0,o.createElement)("div",{className:"interface-interface-skeleton__header",role:"region","aria-label":v.header,tabIndex:"-1"},l),(0,o.createElement)("div",{className:"interface-interface-skeleton__body"},!!r&&(0,o.createElement)("div",{className:"interface-interface-skeleton__secondary-sidebar",role:"region","aria-label":v.secondarySidebar,tabIndex:"-1"},r),!!i&&(0,o.createElement)("div",{className:"interface-interface-skeleton__notices"},i),(0,o.createElement)("div",{className:"interface-interface-skeleton__content",role:"region","aria-label":v.body,tabIndex:"-1"},s),!!a&&(0,o.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":v.sidebar,tabIndex:"-1"},a),!!u&&(0,o.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":v.actions,tabIndex:"-1"},u))),!!n&&(0,o.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":v.footer,tabIndex:"-1"},n))}));var te=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ne(e){let{as:t=_.DropdownMenu,className:n,label:l=(0,h.__)("Options"),popoverProps:a,toggleProps:r,children:i}=e;return(0,o.createElement)(t,{className:g()("interface-more-menu-dropdown",n),icon:te,label:l,popoverProps:{position:"bottom left",...a,className:g()("interface-more-menu-dropdown__content",null==a?void 0:a.className)},toggleProps:{tooltipPosition:"bottom",...r}},(e=>i(e)))}function le(e){let{closeModal:t,children:n}=e;return(0,o.createElement)(_.Modal,{className:"interface-preferences-modal",title:(0,h.__)("Preferences"),closeLabel:(0,h.__)("Close"),onRequestClose:t},n)}var ae=function(e){let{icon:t,size:n=24,...l}=e;return(0,o.cloneElement)(t,{width:n,height:n,...l})};var re=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));var oe=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));const ie="preferences-menu";function se(e){let{sections:t}=e;const n=(0,J.useViewportMatch)("medium"),[l,a]=(0,o.useState)(ie),{tabs:r,sectionsContentMap:i}=(0,o.useMemo)((()=>{let e={tabs:[],sectionsContentMap:{}};return t.length&&(e=t.reduce(((e,t)=>{let{name:n,tabLabel:l,content:a}=t;return e.tabs.push({name:n,title:l}),e.sectionsContentMap[n]=a,e}),{tabs:[],sectionsContentMap:{}})),e}),[t]),s=(0,o.useCallback)((e=>i[e.name]||null),[i]);let c;return c=n?(0,o.createElement)(_.TabPanel,{className:"interface-preferences__tabs",tabs:r,initialTabName:l!==ie?l:void 0,onSelect:a,orientation:"vertical"},s):(0,o.createElement)(_.__experimentalNavigatorProvider,{initialPath:"/",className:"interface-preferences__provider"},(0,o.createElement)(_.__experimentalNavigatorScreen,{path:"/"},(0,o.createElement)(_.Card,{isBorderless:!0,size:"small"},(0,o.createElement)(_.CardBody,null,(0,o.createElement)(_.__experimentalItemGroup,null,r.map((e=>(0,o.createElement)(_.__experimentalNavigatorButton,{key:e.name,path:e.name,as:_.__experimentalItem,isAction:!0},(0,o.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.__experimentalTruncate,null,e.title)),(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(ae,{icon:(0,h.isRTL)()?re:oe})))))))))),t.length&&t.map((e=>(0,o.createElement)(_.__experimentalNavigatorScreen,{key:`${e.name}-menu`,path:e.name},(0,o.createElement)(_.Card,{isBorderless:!0,size:"large"},(0,o.createElement)(_.CardHeader,{isBorderless:!1,justify:"left",size:"small",gap:"6"},(0,o.createElement)(_.__experimentalNavigatorBackButton,{icon:(0,h.isRTL)()?oe:re,"aria-label":(0,h.__)("Navigate to the previous view")}),(0,o.createElement)(_.__experimentalText,{size:"16"},e.tabLabel)),(0,o.createElement)(_.CardBody,null,e.content)))))),c}var ce=e=>{let{description:t,title:n,children:l}=e;return(0,o.createElement)("fieldset",{className:"interface-preferences-modal__section"},(0,o.createElement)("legend",{className:"interface-preferences-modal__section-legend"},(0,o.createElement)("h2",{className:"interface-preferences-modal__section-title"},n),t&&(0,o.createElement)("p",{className:"interface-preferences-modal__section-description"},t)),l)};var ue=function(e){let{help:t,label:n,isChecked:l,onChange:a,children:r}=e;return(0,o.createElement)("div",{className:"interface-preferences-modal__option"},(0,o.createElement)(_.ToggleControl,{__nextHasNoMarginBottom:!0,help:t,label:n,checked:l,onChange:a}),r)},de=window.wp.url,me=window.wp.hooks,pe=window.wp.mediaUtils;(0,me.addFilter)("editor.MediaUpload","core/edit-site/components/media-upload",(()=>pe.MediaUpload));var ge,_e=window.wp.blockEditor;!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(ge||(ge={}));var he=function(e){return e};var fe="beforeunload",Ee="popstate";function ve(e){e.preventDefault(),e.returnValue=""}function ye(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function be(){return Math.random().toString(36).substr(2,8)}function we(e){var t=e.pathname,n=void 0===t?"/":t,l=e.search,a=void 0===l?"":l,r=e.hash,o=void 0===r?"":r;return a&&"?"!==a&&(n+="?"===a.charAt(0)?a:"?"+a),o&&"#"!==o&&(n+="#"===o.charAt(0)?o:"#"+o),n}function xe(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var l=e.indexOf("?");l>=0&&(t.search=e.substr(l),e=e.substr(0,l)),e&&(t.pathname=e)}return t}const Se=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,l=n.history;function a(){var e=n.location,t=e.pathname,a=e.search,r=e.hash,o=l.state||{};return[o.idx,he({pathname:t,search:a,hash:r,state:o.usr||null,key:o.key||"default"})]}var r=null;n.addEventListener(Ee,(function(){if(r)d.call(r),r=null;else{var e=ge.Pop,t=a(),n=t[0],l=t[1];if(d.length){if(null!=n){var o=s-n;o&&(r={action:e,location:l,retry:function(){E(-1*o)}},E(o))}}else f(e)}}));var o=ge.Pop,i=a(),s=i[0],c=i[1],u=ye(),d=ye();function p(e){return"string"==typeof e?e:we(e)}function g(e,t){return void 0===t&&(t=null),he(m({pathname:c.pathname,hash:"",search:""},"string"==typeof e?xe(e):e,{state:t,key:be()}))}function _(e,t){return[{usr:e.state,key:e.key,idx:t},p(e)]}function h(e,t,n){return!d.length||(d.call({action:e,location:t,retry:n}),!1)}function f(e){o=e;var t=a();s=t[0],c=t[1],u.call({action:o,location:c})}function E(e){l.go(e)}null==s&&(s=0,l.replaceState(m({},l.state,{idx:s}),""));var v={get action(){return o},get location(){return c},createHref:p,push:function e(t,a){var r=ge.Push,o=g(t,a);if(h(r,o,(function(){e(t,a)}))){var i=_(o,s+1),c=i[0],u=i[1];try{l.pushState(c,"",u)}catch(e){n.location.assign(u)}f(r)}},replace:function e(t,n){var a=ge.Replace,r=g(t,n);if(h(a,r,(function(){e(t,n)}))){var o=_(r,s),i=o[0],c=o[1];l.replaceState(i,"",c),f(a)}},go:E,back:function(){E(-1)},forward:function(){E(1)},listen:function(e){return u.push(e)},block:function(e){var t=d.push(e);return 1===d.length&&n.addEventListener(fe,ve),function(){t(),d.length||n.removeEventListener(fe,ve)}}};return v}(),ke=Se.push,Ce=Se.replace;Se.push=function(e,t){return ke.call(Se,(0,de.addQueryArgs)(window.location.href,e),t)},Se.replace=function(e,t){return Ce.call(Se,(0,de.addQueryArgs)(window.location.href,e),t)};var Te=Se;const Ne=(0,o.createContext)(),Ie=(0,o.createContext)();function Me(){return(0,o.useContext)(Ne)}function Pe(){return(0,o.useContext)(Ie)}function ze(e){const t=new URLSearchParams(e.search);return{...e,params:Object.fromEntries(t.entries())}}function Ve(e){let{children:t}=e;const[n,l]=(0,o.useState)((()=>ze(Te.location)));return(0,o.useEffect)((()=>Te.listen((e=>{let{location:t}=e;l(ze(t))}))),[]),(0,o.createElement)(Ie.Provider,{value:Te},(0,o.createElement)(Ne.Provider,{value:n},t(n)))}function Be(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const l=Pe();function a(a){a.preventDefault(),n?l.replace(e,t):l.push(e,t)}return{href:(0,de.addQueryArgs)(window.location.href,e),onClick:a}}function Ae(e){let{params:t={},state:n,replace:l=!1,children:a,...r}=e;const{href:i,onClick:s}=Be(t,n,l);return(0,o.createElement)("a",m({href:i,onClick:s},r),a)}function Re(e){let{attributes:t}=e;const{theme:n,slug:l}=t,{params:a}=Me(),r=(0,c.useSelect)((e=>e(u.store).getEntityRecord("postType","wp_template_part",`${n}//${l}`)),[n,l]),i=Be({postId:null==r?void 0:r.id,postType:null==r?void 0:r.type},{fromTemplateId:a.postId});return r?(0,o.createElement)(_e.BlockControls,{group:"other"},(0,o.createElement)(_.ToolbarButton,m({},i,{onClick:e=>{i.onClick(e)}}),(0,h.__)("Edit"))):null}const Le=(0,J.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:l}=t,a="core/template-part"===l&&n.slug;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(e,t),a&&(0,o.createElement)(Re,{attributes:n}))}),"withEditBlockControls");(0,me.addFilter)("editor.BlockEdit","core/edit-site/template-part-edit-button",Le);const Oe="core/edit-site",De="uncategorized",Ge=["index","singular","archive","single","page","home","404","search","author","category","taxonomy","date","tag","attachment","single","front-page"],Fe=["page-home"],He=["post-","author-","single-","tag-"],$e=["page-"],Ue={singular:["single","page"],index:["archive","404","search","singular","home"],home:["front-page"]},je="root",We="templates-general",Ye=[{area:"header",menu:"template-parts-headers",title:(0,h.__)("headers")},{area:"footer",menu:"template-parts-footers",title:(0,h.__)("footers")},{area:"sidebar",menu:"template-parts-sidebars",title:(0,h.__)("sidebars")},{area:De,menu:"template-parts-general",title:(0,h.__)("general")}];var qe=(0,c.combineReducers)({deviceType:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Desktop",t=arguments.length>1?arguments[1]:void 0;return"SET_PREVIEW_DEVICE_TYPE"===t.type?t.deviceType:e},settings:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_TEMPLATE":case"SET_PAGE":return{type:"wp_template",id:t.templateId,page:t.page};case"SET_TEMPLATE_PART":return{type:"wp_template_part",id:t.templatePartId}}return e},homeTemplateId:function(e,t){return"SET_HOME_TEMPLATE"===t.type?t.homeTemplateId:e},navigationPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{menu:je,isOpen:!1},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_NAVIGATION_PANEL_ACTIVE_MENU":return{...e,menu:t.menu};case"OPEN_NAVIGATION_PANEL_TO_MENU":return{...e,isOpen:!0,menu:t.menu};case"SET_IS_NAVIGATION_PANEL_OPENED":return{...e,menu:t.isOpen?e.menu:je,isOpen:t.isOpen};case"SET_IS_LIST_VIEW_OPENED":return{...e,menu:e.isOpen&&t.isOpen?je:e.menu,isOpen:!t.isOpen&&e.isOpen};case"SET_IS_INSERTER_OPENED":return{...e,menu:e.isOpen&&t.value?je:e.menu,isOpen:!t.value&&e.isOpen}}return e},blockInserterPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"OPEN_NAVIGATION_PANEL_TO_MENU":return!1;case"SET_IS_NAVIGATION_PANEL_OPENED":case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value}return e},listViewPanel:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"OPEN_NAVIGATION_PANEL_TO_MENU":return!1;case"SET_IS_NAVIGATION_PANEL_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen}return e}}),Xe=window.wp.apiFetch,Ke=n.n(Xe),Ze=window.wp.notices,Qe=window.wp.a11y;function Je(e){return!!e&&("custom"===(null==e?void 0:e.source)&&(null==e?void 0:e.has_theme_file))}function et(e){return function(t){let{registry:n}=t;S()("select( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"select( 'core/preferences').toggle( 'core/edit-site', featureName )"}),n.dispatch(k.store).toggle("core/edit-site",e)}}function tt(e){return{type:"SET_PREVIEW_DEVICE_TYPE",deviceType:e}}const nt=(e,t)=>async n=>{let{dispatch:l,registry:a}=n;if(!t){const n=await a.resolveSelect(u.store).getEntityRecord("postType","wp_template",e);t=null==n?void 0:n.slug}l({type:"SET_TEMPLATE",templateId:e,page:{context:{templateSlug:t}}})},lt=e=>async t=>{let{dispatch:n,registry:l}=t;const a=await l.dispatch(u.store).saveEntityRecord("postType","wp_template",e);e.content&&l.dispatch(u.store).editEntityRecord("postType","wp_template",a.id,{blocks:(0,i.parse)(e.content)},{undoIgnore:!0}),n({type:"SET_TEMPLATE",templateId:a.id,page:{context:{templateSlug:a.slug}}})},at=e=>async t=>{let{registry:n}=t;try{await n.dispatch(u.store).deleteEntityRecord("postType",e.type,e.id,{force:!0});const t=n.select(u.store).getLastEntityDeleteError("postType",e.type,e.id);if(t)throw t;n.dispatch(Ze.store).createSuccessNotice((0,h.sprintf)((0,h.__)('"%s" deleted.'),e.title.rendered),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("An error occurred while deleting the template.");n.dispatch(Ze.store).createErrorNotice(t,{type:"snackbar"})}};function rt(e){return{type:"SET_TEMPLATE_PART",templatePartId:e}}function ot(e){return{type:"SET_HOME_TEMPLATE",homeTemplateId:e}}const it=e=>async t=>{var n;let{dispatch:l,registry:a}=t;if(!e.path&&null!==(n=e.context)&&void 0!==n&&n.postId){const t=await a.resolveSelect(u.store).getEntityRecord("postType",e.context.postType||"post",e.context.postId);e.path=(0,de.getPathAndQueryString)(null==t?void 0:t.link)}const r=await a.resolveSelect(u.store).__experimentalGetTemplateForLink(e.path);if(r)return l({type:"SET_PAGE",page:r.slug?{...e,context:{...e.context,templateSlug:r.slug}}:e,templateId:r.id}),r.id};function st(e){return{type:"SET_NAVIGATION_PANEL_ACTIVE_MENU",menu:e}}function ct(e){return{type:"OPEN_NAVIGATION_PANEL_TO_MENU",menu:e}}function ut(e){return{type:"SET_IS_NAVIGATION_PANEL_OPENED",isOpen:e}}function dt(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function mt(e){return{type:"UPDATE_SETTINGS",settings:e}}function pt(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const gt=function(e){let{allowUndo:t=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async n=>{let{registry:l}=n;if(Je(e))try{var a;const n=l.select(u.store).getEntityConfig("postType",e.type);if(!n)return void l.dispatch(Ze.store).createErrorNotice((0,h.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const r=(0,de.addQueryArgs)(`${n.baseURL}/${e.id}`,{context:"edit",source:"theme"}),o=await Ke()({path:r});if(!o)return void l.dispatch(Ze.store).createErrorNotice((0,h.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const s=e=>{let{blocks:t=[]}=e;return(0,i.__unstableSerializeAndClean)(t)},c=l.select(u.store).getEditedEntityRecord("postType",e.type,e.id);l.dispatch(u.store).editEntityRecord("postType",e.type,e.id,{content:s,blocks:c.blocks,source:"custom"},{undoIgnore:!0});const d=(0,i.parse)(null==o||null===(a=o.content)||void 0===a?void 0:a.raw);if(l.dispatch(u.store).editEntityRecord("postType",e.type,o.id,{content:s,blocks:d,source:"theme"}),t){const t=()=>{l.dispatch(u.store).editEntityRecord("postType",e.type,c.id,{content:s,blocks:c.blocks,source:"custom"})};l.dispatch(Ze.store).createSuccessNotice((0,h.__)("Template reverted."),{type:"snackbar",actions:[{label:(0,h.__)("Undo"),onClick:t}]})}else l.dispatch(Ze.store).createSuccessNotice((0,h.__)("Template reverted."))}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("Template revert failed. Please reload.");l.dispatch(Ze.store).createErrorNotice(t,{type:"snackbar"})}else l.dispatch(Ze.store).createErrorNotice((0,h.__)("This template is not revertable."),{type:"snackbar"})}},_t=e=>t=>{let{registry:n}=t;n.dispatch(O).enableComplementaryArea(Oe,e)},ht=()=>e=>{let{registry:t}=e;t.dispatch(O).disableComplementaryArea(Oe)},ft=e=>t=>{let{registry:n}=t;n.dispatch("core/preferences").set("core/edit-site","editorMode",e),"visual"!==e&&n.dispatch(_e.store).clearSelectedBlock(),"visual"===e?(0,Qe.speak)((0,h.__)("Visual editor selected"),"assertive"):"mosaic"===e&&(0,Qe.speak)((0,h.__)("Mosaic view selected"),"assertive")};var Et=window.lodash,vt={};function yt(e){return[e]}function bt(e,t,n){var l;if(e.length!==t.length)return!1;for(l=n;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function wt(e,t,n){return!!Ue[e]&&("home"===e&&"posts"!==n||Ue[e].every((e=>t.includes(e)||wt(e,t,n))))}function xt(e){if(Ge.includes(e))return"templates";if(Fe.includes(e))return We;if(He.some((t=>e.startsWith(t))))return"templates-posts";return $e.some((t=>e.startsWith(t)))?"templates-pages":We}const St=(0,c.createRegistrySelector)((e=>(t,n)=>e(k.store).get("core/edit-site",n)));function kt(e,t){return S()("select( 'core/interface' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!St(e,t)}function Ct(e){return e.deviceType}const Tt=(0,c.createRegistrySelector)((e=>()=>e(u.store).canUser("create","media"))),Nt=(0,c.createRegistrySelector)((e=>()=>"web"===o.Platform.OS?e(u.store).getEntityRecords("postType","wp_block",{per_page:-1}):[])),It=function(e,t){var n,l=t||yt;function a(e){var t,l,a,r,o,i=n,s=!0;for(t=0;t<e.length;t++){if(l=e[t],!(o=l)||"object"!=typeof o){s=!1;break}i.has(l)?i=i.get(l):(a=new WeakMap,i.set(l,a),i=a)}return i.has(vt)||((r=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=s,i.set(vt,r)),i.get(vt)}function r(){n=new WeakMap}function o(){var t,n,r,o,i,s=arguments.length;for(o=new Array(s),r=0;r<s;r++)o[r]=arguments[r];for((t=a(i=l.apply(null,o))).isUniqueByDependants||(t.lastDependants&&!bt(i,t.lastDependants,0)&&t.clear(),t.lastDependants=i),n=t.head;n;){if(bt(n.args,o,1))return n!==t.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=t.head,n.prev=null,t.head.prev=n,t.head=n),n.val;n=n.next}return n={val:e.apply(null,o)},o[0]=null,n.args=o,t.head&&(t.head.prev=n,n.next=t.head),t.head=n,n.val}return o.getDependants=l,o.clear=r,r(),o}(((e,t)=>{const n={...e.settings,outlineMode:!0,focusMode:!!St(e,"focusMode"),hasFixedToolbar:!!St(e,"fixedToolbar"),keepCaretInsideBlock:!!St(e,"keepCaretInsideBlock"),showIconLabels:!!St(e,"showIconLabels"),__experimentalSetIsInserterOpened:t,__experimentalReusableBlocks:Nt(e),__experimentalPreferPatternsOnRoot:"wp_template"===zt(e)};return Tt(e)?(n.mediaUpload=t=>{let{onError:n,...l}=t;(0,pe.uploadMedia)({wpAllowedMimeTypes:e.settings.allowedMimeTypes,onError:e=>{let{message:t}=e;return n(t)},...l})},n):n}),(e=>[Tt(e),e.settings,St(e,"focusMode"),St(e,"fixedToolbar"),St(e,"keepCaretInsideBlock"),St(e,"showIconLabels"),Nt(e),zt(e)]));function Mt(e){return e.homeTemplateId}function Pt(e){return e.editedPost}function zt(e){return Pt(e).type}function Vt(e){return Pt(e).id}function Bt(e){return Pt(e).page}function At(e){return e.navigationPanel.menu}const Rt=(0,c.createRegistrySelector)((e=>t=>{const n=zt(t),l=Vt(t),a=l?e(u.store).getEntityRecord("postType",n,l):null;if(!a)return je;var r;if("wp_template_part"===n)return(null===(r=Ye.find((e=>e.area===(null==a?void 0:a.area))))||void 0===r?void 0:r.menu)||"template-parts";const o=e(u.store).getEntityRecords("postType","wp_template"),i=e(u.store).getEditedEntityRecord("root","site").show_on_front;return wt(a.slug,(0,Et.map)(o,"slug"),i)?"templates-unused":xt(a.slug)}));function Lt(e){return e.navigationPanel.isOpen}function Ot(e){return!!e.blockInserterPanel}function Dt(e){const{rootClientId:t,insertionIndex:n,filterValue:l}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:n,filterValue:l}}function Gt(e){return e.listViewPanel}const Ft=(0,c.createRegistrySelector)((e=>t=>{var n;const l=zt(t),a=Vt(t),r=e(u.store).getEditedEntityRecord("postType",l,a),o=e(u.store).getEntityRecords("postType","wp_template_part",{per_page:-1}),s=o?o.reduce(((e,t)=>({...e,[t.id]:t})),{}):{};return(null!==(n=r.blocks)&&void 0!==n?n:[]).filter((e=>(0,i.isTemplatePart)(e))).map((e=>{const{attributes:{theme:t,slug:n}}=e;return{templatePart:s[`${t}//${n}`],block:e}})).filter((e=>{let{templatePart:t}=e;return!!t}))}));function Ht(e){return St(e,"editorMode")}const $t={reducer:qe,actions:a,selectors:r},Ut=(0,c.createReduxStore)(Oe,$t);(0,c.register)(Ut);var jt=window.wp.keyboardShortcuts;var Wt=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var Yt=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));var qt=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"}));var Xt=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"})),Kt=window.wp.keycodes;const Zt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,h.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,h.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,h.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,h.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,h.__)("Insert a link to a post or page")},{keyCombination:{modifier:"primary",character:"u"},description:(0,h.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,h.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,h.__)("Make the selected text inline code.")}];function Qt(e){let{keyCombination:t,forceAriaLabel:n}=e;const l=t.modifier?Kt.displayShortcutList[t.modifier](t.character):t.character,a=t.modifier?Kt.shortcutAriaLabel[t.modifier](t.character):t.character;return(0,o.createElement)("kbd",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":n||a},(0,Et.castArray)(l).map(((e,t)=>"+"===e?(0,o.createElement)(o.Fragment,{key:t},e):(0,o.createElement)("kbd",{key:t,className:"edit-site-keyboard-shortcut-help-modal__shortcut-key"},e))))}function Jt(e){let{description:t,keyCombination:n,aliases:l=[],ariaLabel:a}=e;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-description"},t),(0,o.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-term"},(0,o.createElement)(Qt,{keyCombination:n,forceAriaLabel:a}),l.map(((e,t)=>(0,o.createElement)(Qt,{keyCombination:e,forceAriaLabel:a,key:t})))))}function en(e){let{name:t}=e;const{keyCombination:n,description:l,aliases:a}=(0,c.useSelect)((e=>{const{getShortcutKeyCombination:n,getShortcutDescription:l,getShortcutAliases:a}=e(jt.store);return{keyCombination:n(t),aliases:a(t),description:l(t)}}),[t]);return n?(0,o.createElement)(Jt,{keyCombination:n,description:l,aliases:a}):null}const tn=e=>{let{shortcuts:t}=e;return(0,o.createElement)("ul",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-list",role:"list"},t.map(((e,t)=>(0,o.createElement)("li",{className:"edit-site-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,o.createElement)(en,{name:e}):(0,o.createElement)(Jt,e)))))},nn=e=>{let{title:t,shortcuts:n,className:l}=e;return(0,o.createElement)("section",{className:g()("edit-site-keyboard-shortcut-help-modal__section",l)},!!t&&(0,o.createElement)("h2",{className:"edit-site-keyboard-shortcut-help-modal__section-title"},t),(0,o.createElement)(tn,{shortcuts:n}))},ln=e=>{let{title:t,categoryName:n,additionalShortcuts:l=[]}=e;const a=(0,c.useSelect)((e=>e(jt.store).getCategoryShortcuts(n)),[n]);return(0,o.createElement)(nn,{title:t,shortcuts:a.concat(l)})};function an(e){let{isModalActive:t,toggleModal:n}=e;return t?(0,o.createElement)(_.Modal,{className:"edit-site-keyboard-shortcut-help-modal",title:(0,h.__)("Keyboard shortcuts"),closeLabel:(0,h.__)("Close"),onRequestClose:n},(0,o.createElement)(nn,{className:"edit-site-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-site/keyboard-shortcuts"]}),(0,o.createElement)(ln,{title:(0,h.__)("Global shortcuts"),categoryName:"global"}),(0,o.createElement)(ln,{title:(0,h.__)("Selection shortcuts"),categoryName:"selection"}),(0,o.createElement)(ln,{title:(0,h.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,h.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,h.__)("Forward-slash")}]}),(0,o.createElement)(nn,{title:(0,h.__)("Text formatting"),shortcuts:Zt})):null}function rn(e){const{featureName:t,...n}=e,l=(0,c.useSelect)((e=>!!e(k.store).get("core/edit-site",t)),[t]),{toggle:a}=(0,c.useDispatch)(k.store);return(0,o.createElement)(ue,m({onChange:()=>a("core/edit-site",t),isChecked:l},n))}function on(e){let{isModalActive:t,toggleModal:n}=e;const l=(0,o.useMemo)((()=>[{name:"general",tabLabel:(0,h.__)("General"),content:(0,o.createElement)(ce,{title:(0,h.__)("Appearance"),description:(0,h.__)("Customize options related to the block editor interface and editing flow.")},(0,o.createElement)(rn,{featureName:"focusMode",help:(0,h.__)("Highlights the current block and fades other content."),label:(0,h.__)("Spotlight mode")}),(0,o.createElement)(rn,{featureName:"showIconLabels",label:(0,h.__)("Show button text labels"),help:(0,h.__)("Show text instead of icons on buttons.")}),(0,o.createElement)(rn,{featureName:"showListViewByDefault",help:(0,h.__)("Opens the block list view sidebar by default."),label:(0,h.__)("Always open list view")}))},{name:"blocks",tabLabel:(0,h.__)("Blocks"),content:(0,o.createElement)(ce,{title:(0,h.__)("Block interactions"),description:(0,h.__)("Customize how you interact with blocks in the block library and editing canvas.")},(0,o.createElement)(rn,{featureName:"keepCaretInsideBlock",help:(0,h.__)("Aids screen readers by stopping text caret from leaving blocks."),label:(0,h.__)("Contain text cursor inside block")}))}]));return t?(0,o.createElement)(le,{closeModal:n},(0,o.createElement)(se,{sections:l})):null}const{Fill:sn,Slot:cn}=(0,_.createSlotFill)("EditSiteToolsMoreMenuGroup");sn.Slot=e=>{let{fillProps:t}=e;return(0,o.createElement)(cn,{fillProps:t},(e=>!(0,Et.isEmpty)(e)&&e))};var un=sn,dn=n(8981),mn=n.n(dn);var pn=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"}));function gn(){const{createErrorNotice:e}=(0,c.useDispatch)(Ze.store);return(0,o.createElement)(_.MenuItem,{role:"menuitem",icon:pn,onClick:async function(){try{const e=await Ke()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),l=n[1]?n[1]:"edit-site-export";mn()(t,l+".zip","application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const l=n.message&&"unknown_error"!==n.code?n.message:(0,h.__)("An error occurred while creating the site export.");e(l,{type:"snackbar"})}},info:(0,h.__)("Download your theme with updated templates and styles.")},(0,h._x)("Export","site exporter menu item"))}function _n(){const{toggle:e}=(0,c.useDispatch)(k.store);return(0,o.createElement)(_.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide")},(0,h.__)("Welcome Guide"))}function hn(){const{createNotice:e}=(0,c.useDispatch)(Ze.store),t=(0,c.useSelect)((e=>()=>{const{getEditedPostId:t,getEditedPostType:n}=e(Ut),{getEditedEntityRecord:l}=e(u.store),a=l("postType",n(),t());if(a){if("function"==typeof a.content)return a.content(a);if(a.blocks)return(0,i.__unstableSerializeAndClean)(a.blocks);if(a.content)return a.content}return""}),[]);const n=(0,J.useCopyToClipboard)(t,(function(){e("info",(0,h.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,o.createElement)(_.MenuItem,{ref:n},(0,h.__)("Copy all blocks"))}const fn=[{value:"visual",label:(0,h.__)("Visual editor")},{value:"text",label:(0,h.__)("Code editor")}];var En=function(){const{shortcut:e,mode:t}=(0,c.useSelect)((e=>({shortcut:e(jt.store).getShortcutRepresentation("core/edit-site/toggle-mode"),isRichEditingEnabled:e(Ut).getSettings().richEditingEnabled,isCodeEditingEnabled:e(Ut).getSettings().codeEditingEnabled,mode:e(Ut).getEditorMode()})),[]),{switchEditorMode:n}=(0,c.useDispatch)(Ut),l=fn.map((n=>n.value!==t?{...n,shortcut:e}:n));return(0,o.createElement)(_.MenuGroup,{label:(0,h.__)("Editor")},(0,o.createElement)(_.MenuItemsChoice,{choices:l,value:t,onSelect:n}))};function vn(e){let{showIconLabels:t}=e;const[n,l]=(0,o.useReducer)((e=>!e),!1),[a,r]=(0,o.useReducer)((e=>!e),!1);return(0,jt.useShortcut)("core/edit-site/keyboard-shortcuts",l),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ne,{toggleProps:{showTooltip:!t,...t&&{variant:"tertiary"}}},(e=>{let{onClose:t}=e;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.MenuGroup,{label:(0,h._x)("View","noun")},(0,o.createElement)(k.PreferenceToggleMenuItem,{scope:"core/edit-site",name:"fixedToolbar",label:(0,h.__)("Top toolbar"),info:(0,h.__)("Access all block and document tools in a single place"),messageActivated:(0,h.__)("Top toolbar activated"),messageDeactivated:(0,h.__)("Top toolbar deactivated")}),(0,o.createElement)(k.PreferenceToggleMenuItem,{scope:"core/edit-site",name:"focusMode",label:(0,h.__)("Spotlight mode"),info:(0,h.__)("Focus on one block at a time"),messageActivated:(0,h.__)("Spotlight mode activated"),messageDeactivated:(0,h.__)("Spotlight mode deactivated")}),(0,o.createElement)(En,null),(0,o.createElement)(j.Slot,{name:"core/edit-site/plugin-more-menu",label:(0,h.__)("Plugins"),as:_.MenuGroup,fillProps:{onClick:t}})),(0,o.createElement)(_.MenuGroup,{label:(0,h.__)("Tools")},(0,o.createElement)(gn,null),(0,o.createElement)(_.MenuItem,{onClick:l,shortcut:Kt.displayShortcut.access("h")},(0,h.__)("Keyboard shortcuts")),(0,o.createElement)(_n,null),(0,o.createElement)(hn,null),(0,o.createElement)(_.MenuItem,{icon:Xt,role:"menuitem",href:(0,h.__)("https://wordpress.org/support/article/site-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,h.__)("Help"),(0,o.createElement)(_.VisuallyHidden,{as:"span"},(0,h.__)("(opens in a new tab)"))),(0,o.createElement)(un.Slot,{fillProps:{onClose:t}})),(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,{onClick:r},(0,h.__)("Preferences"))))})),(0,o.createElement)(an,{isModalActive:n,toggleModal:l}),(0,o.createElement)(on,{isModalActive:a,toggleModal:r}))}function yn(e){let{openEntitiesSavedStates:t,isEntitiesSavedStatesOpen:n}=e;const{isDirty:l,isSaving:a}=(0,c.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n}=e(u.store),l=t();return{isDirty:l.length>0,isSaving:(0,Et.some)(l,(e=>n(e.kind,e.name,e.key)))}}),[]),r=!l||a;return(0,o.createElement)(_.Button,{variant:"primary",className:"edit-site-save-button__button","aria-disabled":r,"aria-expanded":n,isBusy:a,onClick:r?void 0:t},(0,h.__)("Save"))}var bn=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"}));var wn=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"}));var xn=(0,o.forwardRef)((function(e,t){const n=(0,c.useSelect)((e=>e(u.store).hasUndo()),[]),{undo:l}=(0,c.useDispatch)(u.store);return(0,o.createElement)(_.Button,m({},e,{ref:t,icon:(0,h.isRTL)()?wn:bn,label:(0,h.__)("Undo"),shortcut:Kt.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?l:void 0}))}));var Sn=(0,o.forwardRef)((function(e,t){const n=(0,Kt.isAppleOS)()?Kt.displayShortcut.primaryShift("z"):Kt.displayShortcut.primary("y"),l=(0,c.useSelect)((e=>e(u.store).hasRedo()),[]),{redo:a}=(0,c.useDispatch)(u.store);return(0,o.createElement)(_.Button,m({},e,{ref:t,icon:(0,h.isRTL)()?bn:wn,label:(0,h.__)("Redo"),shortcut:n,"aria-disabled":!l,onClick:l?a:void 0}))}));var kn=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function Cn(e){if(e){const t=(0,i.getBlockType)(e.name);return t?(0,i.__experimentalGetBlockLabel)(t,e.attributes):null}return null}function Tn(e){let{entityTitle:t,entityLabel:n,isLoaded:l,children:a,showIconLabels:r}=e;const{label:i}=function(){const{getBlock:e}=(0,c.useSelect)(_e.store),t=(0,c.useSelect)((e=>e(_e.store).__experimentalGetActiveBlockIdByBlockNames(["core/template-part"])),[]);return t?{label:Cn(e(t)),isActive:!0}:{}}(),[s,u]=(0,o.useState)(null),d=(0,o.useMemo)((()=>({anchor:s})),[s]);return l?t?(0,o.createElement)("div",{className:g()("edit-site-document-actions",{"has-secondary-label":!!i})},(0,o.createElement)("div",{ref:u,className:"edit-site-document-actions__title-wrapper"},(0,o.createElement)(_.__experimentalText,{size:"body",className:"edit-site-document-actions__title",as:"h1"},(0,o.createElement)(_.VisuallyHidden,{as:"span"},(0,h.sprintf)((0,h.__)("Editing %s: "),n)),t),(0,o.createElement)(_.__experimentalText,{size:"body",className:"edit-site-document-actions__secondary-item"},null!=i?i:""),a&&(0,o.createElement)(_.Dropdown,{popoverProps:d,position:"bottom center",renderToggle:e=>{let{isOpen:t,onToggle:l}=e;return(0,o.createElement)(_.Button,{className:"edit-site-document-actions__get-info",icon:kn,"aria-expanded":t,"aria-haspopup":"true",onClick:l,variant:r?"tertiary":void 0,label:(0,h.sprintf)((0,h.__)("Show %s details"),n)},r&&(0,h.__)("Details"))},contentClassName:"edit-site-document-actions__info-dropdown",renderContent:a}))):(0,o.createElement)("div",{className:"edit-site-document-actions"},(0,h.__)("Template not found")):(0,o.createElement)("div",{className:"edit-site-document-actions"},(0,h.__)("Loading…"))}function Nn(e){var t;let{onClose:n,templatePart:l,closeTemplateDetailsDropdown:a}=e;const{revertTemplate:r}=(0,c.useDispatch)(Ut),{params:i}=Me(),s=Be({postId:l.id,postType:l.type},{fromTemplateId:i.postId});return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,m({},s,{onClick:function(e){s.onClick(e),n(),a()}}),(0,h.sprintf)((0,h.__)("Edit %s"),null===(t=l.title)||void 0===t?void 0:t.rendered))),Je(l)&&(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,{info:(0,h.__)("Use the template part as supplied by the theme."),onClick:function(){r(l),n(),a()}},(0,h.__)("Clear customizations"))))}function In(e){let{templatePart:t,clientId:n,closeTemplateDetailsDropdown:l}=e;const{selectBlock:a,toggleBlockHighlight:r}=(0,c.useDispatch)(_e.store),i=(0,c.useSelect)((e=>e(d.store).__experimentalGetDefaultTemplatePartAreas().find((e=>e.area===t.area))),[t.area]),s=()=>r(n,!0),u=()=>r(n,!1);return(0,o.createElement)("div",{role:"menuitem",className:"edit-site-template-details__template-areas-item"},(0,o.createElement)(_.MenuItem,{role:"button",icon:null==i?void 0:i.icon,iconPosition:"left",onClick:()=>{a(n)},onMouseOver:s,onMouseLeave:u,onFocus:s,onBlur:u},null==i?void 0:i.label),(0,o.createElement)(_.DropdownMenu,{icon:te,label:(0,h.__)("More options"),className:"edit-site-template-details__template-areas-item-more"},(e=>{let{onClose:n}=e;return(0,o.createElement)(Nn,{onClose:n,templatePart:t,closeTemplateDetailsDropdown:l})})))}function Mn(e){let{closeTemplateDetailsDropdown:t}=e;const n=(0,c.useSelect)((e=>e(Ut).getCurrentTemplateTemplateParts()),[]);return n.length?(0,o.createElement)(_.MenuGroup,{label:(0,h.__)("Areas"),className:"edit-site-template-details__group edit-site-template-details__template-areas"},n.map((e=>{let{templatePart:n,block:l}=e;return(0,o.createElement)(In,{key:n.slug,clientId:l.clientId,templatePart:n,closeTemplateDetailsDropdown:t})}))):null}function Pn(e){let{template:t}=e;const[n,l]=(0,o.useState)(!1),[a,r]=(0,u.useEntityProp)("postType",t.type,"title",t.id);return(0,o.createElement)(_.TextControl,{label:(0,h.__)("Title"),value:n?"":a,help:"wp_template_part"!==t.type?(0,h.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'):null,onChange:e=>{e||n?(l(!1),r(e)):l(!0)},onBlur:()=>l(!1)})}function zn(e){let{id:t}=e;const[n,l]=(0,u.useEntityProp)("postType","wp_template_part","area",t),a=(0,c.useSelect)((e=>e(d.store).__experimentalGetDefaultTemplatePartAreas()),[]).map((e=>{let{label:t,area:n}=e;return{label:t,value:n}}));return(0,o.createElement)(_.SelectControl,{label:(0,h.__)("Area"),labelPosition:"top",options:a,value:n,onChange:l})}function Vn(e){let{template:t,onClose:n}=e;const{title:l,description:a}=(0,c.useSelect)((e=>e(d.store).__experimentalGetTemplateInfo(t)),[]),{revertTemplate:r}=(0,c.useDispatch)(Ut),i=Be({postType:t.type,postId:void 0}),s="wp_template_part"===t.type,u=(s||t.is_custom)&&!t.has_theme_file;if(!t)return null;return(0,o.createElement)("div",{className:"edit-site-template-details"},(0,o.createElement)(_.__experimentalVStack,{className:"edit-site-template-details__group",spacing:3},u?(0,o.createElement)(Pn,{template:t}):(0,o.createElement)(_.__experimentalText,{size:16,weight:600,className:"edit-site-template-details__title",as:"p"},l),a&&(0,o.createElement)(_.__experimentalText,{size:"body",className:"edit-site-template-details__description",as:"p"},a)),s&&(0,o.createElement)("div",{className:"edit-site-template-details__group"},(0,o.createElement)(zn,{id:t.id})),(0,o.createElement)(Mn,{closeTemplateDetailsDropdown:n}),Je(t)&&(0,o.createElement)(_.MenuGroup,{className:"edit-site-template-details__group edit-site-template-details__revert"},(0,o.createElement)(_.MenuItem,{className:"edit-site-template-details__revert-button",info:(0,h.__)("Use the template as supplied by the theme."),onClick:()=>{r(t),n()}},(0,h.__)("Clear customizations"))),(0,o.createElement)(_.Button,m({className:"edit-site-template-details__show-all-button"},i),"wp_template"===(null==t?void 0:t.type)?(0,h.__)("Browse all templates"):(0,h.__)("Browse all template parts")))}const Bn=e=>{e.preventDefault()};function An(e){var t;let{openEntitiesSavedStates:n,isEntitiesSavedStatesOpen:l,showIconLabels:a}=e;const r=(0,o.useRef)(),{deviceType:i,entityTitle:s,template:m,templateType:p,isInserterOpen:f,isListViewOpen:E,listViewShortcut:v,isLoaded:y,isVisualMode:b,settings:w,blockEditorMode:x}=(0,c.useSelect)((e=>{const{__experimentalGetPreviewDeviceType:t,getEditedPostType:n,getEditedPostId:l,isInserterOpened:a,isListViewOpened:r,getEditorMode:o,getSettings:i}=e(Ut),{getEditedEntityRecord:s}=e(u.store),{__experimentalGetTemplateInfo:c}=e(d.store),{getShortcutRepresentation:m}=e(jt.store),{__unstableGetEditorMode:p}=e(_e.store),g=n(),_=l(),h=s("postType",g,_),f=!!_;return{deviceType:t(),entityTitle:c(h).title,isLoaded:f,template:h,templateType:g,isInserterOpen:a(),isListViewOpen:r(),listViewShortcut:m("core/edit-site/toggle-list-view"),isVisualMode:"visual"===o(),settings:i(),blockEditorMode:p()}}),[]),{__experimentalSetPreviewDeviceType:S,setIsInserterOpened:k,setIsListViewOpened:C}=(0,c.useDispatch)(Ut),{__unstableSetEditorMode:T}=(0,c.useDispatch)(_e.store),N=(0,J.useViewportMatch)("medium"),I=(0,o.useCallback)((()=>{f?r.current.focus():k(!0)}),[f,k]),M=(0,o.useCallback)((()=>C(!E)),[C,E]),P="wp_template_part"===p,z=(0,h._x)("Toggle block inserter","Generic label for block inserter button"),V=f?(0,h.__)("Close"):(0,h.__)("Add"),B=(null===(t=window)||void 0===t?void 0:t.__experimentalEnableZoomedOutView)&&b,A="zoom-out"===x;return(0,o.createElement)("div",{className:"edit-site-header"},(0,o.createElement)(_e.NavigableToolbar,{className:"edit-site-header_start","aria-label":(0,h.__)("Document tools")},(0,o.createElement)("div",{className:"edit-site-header__toolbar"},(0,o.createElement)(_.ToolbarItem,{ref:r,as:_.Button,className:"edit-site-header-toolbar__inserter-toggle",variant:"primary",isPressed:f,onMouseDown:Bn,onClick:I,disabled:!b,icon:Wt,label:a?V:z,showTooltip:!a}),N&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.ToolbarItem,{as:_e.ToolSelector,showTooltip:!a,variant:a?"tertiary":void 0,disabled:!b}),(0,o.createElement)(_.ToolbarItem,{as:xn,showTooltip:!a,variant:a?"tertiary":void 0}),(0,o.createElement)(_.ToolbarItem,{as:Sn,showTooltip:!a,variant:a?"tertiary":void 0}),(0,o.createElement)(_.ToolbarItem,{as:_.Button,className:"edit-site-header-toolbar__list-view-toggle",disabled:!b&&A,icon:Yt,isPressed:E,label:(0,h.__)("List View"),onClick:M,shortcut:v,showTooltip:!a,variant:a?"tertiary":void 0}),B&&(0,o.createElement)(_.ToolbarItem,{as:_.Button,className:"edit-site-header-toolbar__zoom-out-view-toggle",icon:qt,isPressed:A,label:(0,h.__)("Zoom-out View"),onClick:()=>{S("desktop"),C(!1),T(A?"edit":"zoom-out")}})))),(0,o.createElement)("div",{className:"edit-site-header_center"},(0,o.createElement)(Tn,{entityTitle:s,entityLabel:"wp_template_part"===p?"template part":"template",isLoaded:y,showIconLabels:a},(e=>{let{onClose:t}=e;return(0,o.createElement)(Vn,{template:m,onClose:t})}))),(0,o.createElement)("div",{className:"edit-site-header_end"},(0,o.createElement)("div",{className:"edit-site-header__actions"},!P&&(0,o.createElement)("div",{className:g()("edit-site-header__actions__preview-options",{"is-zoomed-out":A})},(0,o.createElement)(_e.__experimentalPreviewOptions,{deviceType:i,setDeviceType:S,viewLabel:(0,h.__)("View")},(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,{href:null==w?void 0:w.siteUrl,target:"_blank",icon:Xt},(0,h.__)("View site"),(0,o.createElement)(_.VisuallyHidden,{as:"span"},(0,h.__)("(opens in a new tab)")))))),(0,o.createElement)(yn,{openEntitiesSavedStates:n,isEntitiesSavedStatesOpen:l}),(0,o.createElement)(X.Slot,{scope:"core/edit-site"}),(0,o.createElement)(vn,{showIconLabels:a}))))}var Rn=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"}));function Ln(e){let{className:t,identifier:n,title:l,icon:a,children:r,closeLabel:i,header:s,headerClassName:u,panelClassName:d}=e;const m=(0,c.useSelect)((e=>e(Ut).getSettings().showIconLabels),[]);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Q,{className:t,scope:"core/edit-site",identifier:n,title:l,icon:a,closeLabel:i,header:s,headerClassName:u,panelClassName:d,showIconLabels:m},r),(0,o.createElement)(Y,{scope:"core/edit-site",identifier:n,icon:a},l))}var On=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"}));function Dn(e){let{className:t,...n}=e;return(0,o.createElement)(_.Icon,m({className:g()(t,"edit-site-global-styles-icon-with-current-color")},n))}function Gn(e){let{icon:t,children:n,...l}=e;return(0,o.createElement)(_.__experimentalItem,l,t&&(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(Dn,{icon:t,size:24}),(0,o.createElement)(_.FlexItem,null,n)),!t&&n)}function Fn(e){return(0,o.createElement)(_.__experimentalNavigatorButton,m({as:Gn},e))}var Hn=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"}));var $n=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"}));var Un=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"}));function jn(e,t){var n,l;const{size:a}=e;if(!a||"0"===a)return a;if(!0!==(null==t?void 0:t.fluid))return a;if(!1===(null==e?void 0:e.fluid))return a;const r=(0,_e.getComputedFluidTypographyValue)({minimumFontSize:null==e||null===(n=e.fluid)||void 0===n?void 0:n.min,maximumFontSize:null==e||null===(l=e.fluid)||void 0===l?void 0:l.max,fontSize:a});return r||a}const Wn="body",Yn=[{path:["color","palette"],valueKey:"color",cssVarInfix:"color",classes:[{classSuffix:"color",propertyName:"color"},{classSuffix:"background-color",propertyName:"background-color"},{classSuffix:"border-color",propertyName:"border-color"}]},{path:["color","gradients"],valueKey:"gradient",cssVarInfix:"gradient",classes:[{classSuffix:"gradient-background",propertyName:"background"}]},{path:["color","duotone"],cssVarInfix:"duotone",valueFunc:e=>{let{slug:t}=e;return`url( '#wp-duotone-${t}' )`},classes:[]},{path:["typography","fontSizes"],valueFunc:(e,t)=>{let{typography:n}=t;return jn(e,n)},valueKey:"size",cssVarInfix:"font-size",classes:[{classSuffix:"font-size",propertyName:"font-size"}]},{path:["typography","fontFamilies"],valueKey:"fontFamily",cssVarInfix:"font-family",classes:[{classSuffix:"font-family",propertyName:"font-family"}]},{path:["spacing","spacingSizes"],valueKey:"size",cssVarInfix:"spacing",valueFunc:e=>{let{size:t}=e;return t},classes:[]}],qn={"color.background":"color","color.text":"color","elements.link.color.text":"color","elements.button.color.text":"color","elements.button.backgroundColor":"background-color","elements.heading.color":"color","elements.heading.backgroundColor":"background-color","elements.heading.gradient":"gradient","color.gradient":"gradient","typography.fontSize":"font-size","typography.fontFamily":"font-family"};function Xn(e,t,n,l,a){const r=[(0,Et.get)(e,["blocks",t,...n]),(0,Et.get)(e,n)];for(const o of r)if(o){const r=["custom","theme","default"];for(const i of r){const r=o[i];if(r){const o=(0,Et.find)(r,(e=>e[l]===a));if(o){if("slug"===l)return o;return Xn(e,t,n,"slug",o.slug)[l]===o[l]?o:void 0}}}}}function Kn(e,t,n,l){if(!l)return l;const a=qn[n],r=(0,Et.find)(Yn,["cssVarInfix",a]);if(!r)return l;const{valueKey:o,path:i}=r,s=Xn(e,t,i,o,l);return s?`var:preset|${a}|${s.slug}`:l}function Zn(e,t,n){if(!n||"string"!=typeof n){var l,a;if(null===(l=n)||void 0===l||!l.ref||"string"!=typeof(null===(a=n)||void 0===a?void 0:a.ref))return n;{var r;const t=n.ref.split(".");if(!(n=(0,Et.get)(e,t))||null!==(r=n)&&void 0!==r&&r.ref)return n}}const o="var:",i="var(--wp--";let s;if(n.startsWith(o))s=n.slice(o.length).split("|");else{if(!n.startsWith(i)||!n.endsWith(")"))return n;s=n.slice(i.length,-")".length).split("--")}const[c,...u]=s;return"preset"===c?function(e,t,n,l){let[a,r]=l;const o=(0,Et.find)(Yn,["cssVarInfix",a]);if(!o)return n;const i=Xn(e.settings,t,o.path,"slug",r);if(i){const{valueKey:n}=o;return Zn(e,t,i[n])}return n}(e,t,n,u):"custom"===c?function(e,t,n,l){var a;const r=null!==(a=(0,Et.get)(e.settings,["blocks",t,"custom",...l]))&&void 0!==a?a:(0,Et.get)(e.settings,["custom",...l]);return r?Zn(e,t,r):n}(e,t,n,u):n}const Qn=(0,o.createContext)({user:{},base:{},merged:{},setUserConfig:()=>{}}),Jn={settings:{},styles:{}};function el(e,t){var n;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all";const{merged:a,base:r,user:s,setUserConfig:c}=(0,o.useContext)(Qn),u=t?`settings.blocks.${t}.${e}`:`settings.${e}`,d=t=>{c((n=>{const l=JSON.parse(JSON.stringify(n)),a=i.__EXPERIMENTAL_PATHS_WITH_MERGE[e]?u+".custom":u;return(0,Et.set)(l,a,t),l}))},m=t=>{const n=t?`settings.blocks.${t}.${e}`:`settings.${e}`,o=t=>{const l=(0,Et.get)(t,n);var a,r;return i.__EXPERIMENTAL_PATHS_WITH_MERGE[e]?null!==(a=null!==(r=null==l?void 0:l.custom)&&void 0!==r?r:null==l?void 0:l.theme)&&void 0!==a?a:null==l?void 0:l.default:l};let c;switch(l){case"all":c=o(a);break;case"user":c=o(s);break;case"base":c=o(r);break;default:throw"Unsupported source"}return c},p=null!==(n=m(t))&&void 0!==n?n:m();return[p,d]}function tl(e,t){var n;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all";const{merged:a,base:r,user:i,setUserConfig:s}=(0,o.useContext)(Qn),c=t?`styles.blocks.${t}.${e}`:`styles.${e}`,u=n=>{s((l=>{const r=JSON.parse(JSON.stringify(l));return(0,Et.set)(r,c,Kn(a.settings,t,e,n)),r}))};let d;switch(l){case"all":d=Zn(a,t,null!==(n=(0,Et.get)(i,c))&&void 0!==n?n:(0,Et.get)(r,c));break;case"user":d=Zn(a,t,(0,Et.get)(i,c));break;case"base":d=Zn(r,t,(0,Et.get)(r,c));break;default:throw"Unsupported source"}return[d,u]}const nl=["background","backgroundColor","color","linkColor","buttonColor","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","textDecoration","padding","contentSize","wideSize","blockGap"];function ll(e){var t,n,l,a,r,o,s,c;if(!e)return nl;const u=(0,i.getBlockType)(e);if(!u)return[];const d=[];return null==u||null===(t=u.supports)||void 0===t||null===(n=t.spacing)||void 0===n||!n.blockGap||!0===(null==u||null===(l=u.supports)||void 0===l||null===(a=l.spacing)||void 0===a?void 0:a.__experimentalSkipSerialization)||null!=u&&null!==(r=u.supports)&&void 0!==r&&null!==(o=r.spacing)&&void 0!==o&&null!==(s=o.__experimentalSkipSerialization)&&void 0!==s&&null!==(c=s.some)&&void 0!==c&&c.call(s,(e=>"blockGap"===e))||d.push("blockGap"),Object.keys(i.__EXPERIMENTAL_STYLE_PROPERTY).forEach((e=>{if(i.__EXPERIMENTAL_STYLE_PROPERTY[e].support)return i.__EXPERIMENTAL_STYLE_PROPERTY[e].requiresOptOut&&i.__EXPERIMENTAL_STYLE_PROPERTY[e].support[0]in u.supports&&!1!==(0,Et.get)(u.supports,i.__EXPERIMENTAL_STYLE_PROPERTY[e].support)||(0,Et.get)(u.supports,i.__EXPERIMENTAL_STYLE_PROPERTY[e].support,!1)?d.push(e):void 0})),d}function al(e){const[t]=el("color.palette.custom",e),[n]=el("color.palette.theme",e),[l]=el("color.palette.default",e),[a]=el("color.defaultPalette");return(0,o.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,h._x)("Theme","Indicates this palette comes from the theme."),colors:n}),a&&l&&l.length&&e.push({name:(0,h._x)("Default","Indicates this palette comes from WordPress."),colors:l}),t&&t.length&&e.push({name:(0,h._x)("Custom","Indicates this palette is created by the user."),colors:t}),e}),[t,n,l])}function rl(e){const[t]=el("color.gradients.custom",e),[n]=el("color.gradients.theme",e),[l]=el("color.gradients.default",e),[a]=el("color.defaultGradients");return(0,o.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,h._x)("Theme","Indicates this palette comes from the theme."),gradients:n}),a&&l&&l.length&&e.push({name:(0,h._x)("Default","Indicates this palette comes from WordPress."),gradients:l}),t&&t.length&&e.push({name:(0,h._x)("Custom","Indicates this palette is created by the user."),gradients:t}),e}),[t,n,l])}function ol(e){return[il(e),sl(e),cl(e),ul(e)].some(Boolean)}function il(e){const t=ll(e);return el("border.color",e)[0]&&t.includes("borderColor")}function sl(e){const t=ll(e);return el("border.radius",e)[0]&&t.includes("borderRadius")}function cl(e){const t=ll(e);return el("border.style",e)[0]&&t.includes("borderStyle")}function ul(e){const t=ll(e);return el("border.width",e)[0]&&t.includes("borderWidth")}function dl(e){return e?e.style||!e.color&&!e.width?e:{...e,style:"solid"}:e}function ml(e){let{name:t}=e;const[n]=tl("border",t,"user"),[l,a]=tl("border",t),r=al(t),i=il(t),s=cl(t),c=ul(t),u=sl(t),[d,m]=tl("border.radius",t),p=()=>{const e=null==n?void 0:n.radius;return"object"==typeof e?Object.entries(e).some(Boolean):!!e},g=(0,o.useCallback)((()=>a(void 0)),[a]),f=(0,o.useCallback)((e=>{const t=function(e){return e?(0,_.__experimentalHasSplitBorders)(e)?{top:dl(e.top),right:dl(e.right),bottom:dl(e.bottom),left:dl(e.left)}:dl(e):e}(e),n=(0,_.__experimentalHasSplitBorders)(t)?{color:null,style:null,width:null,...t}:{top:t,right:t,bottom:t,left:t};a({radius:null==l?void 0:l.radius,...n})}),[a]);return(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,h.__)("Border"),resetAll:g},(c||i)&&(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>(0,_.__experimentalIsDefinedBorder)(n),label:(0,h.__)("Border"),onDeselect:()=>(()=>{if(p())return a({radius:n.radius});a(void 0)})(),isShownByDefault:!0},(0,o.createElement)(_.__experimentalBorderBoxControl,{colors:r,enableAlpha:!0,enableStyle:s,onChange:f,popoverOffset:40,popoverPlacement:"left-start",value:l,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})),u&&(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:p,label:(0,h.__)("Radius"),onDeselect:()=>m(void 0),isShownByDefault:!0},(0,o.createElement)(_e.__experimentalBorderRadiusControl,{values:d,onChange:e=>{m(e||void 0)}})))}function pl(e){const t=ll(e);return t.includes("color")||t.includes("backgroundColor")||t.includes("background")||t.includes("linkColor")}var gl=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z"}));var _l=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"}));const hl=["horizontal","vertical"];function fl(e){const t=El(e),n=vl(e),l=yl(e),a=bl(e),r=wl(e);return t||n||l||a||r}function El(e){const t=ll(e),[n]=el("layout.contentSize",e);return n&&t.includes("contentSize")}function vl(e){const t=ll(e),[n]=el("layout.wideSize",e);return n&&t.includes("wideSize")}function yl(e){const t=ll(e),[n]=el("spacing.padding",e);return n&&t.includes("padding")}function bl(e){const t=ll(e),[n]=el("spacing.margin",e);return n&&t.includes("margin")}function wl(e){const t=ll(e),[n]=el("spacing.blockGap",e);return n&&t.includes("blockGap")}function xl(e,t){if(!t)return e;const n={};return t.forEach((t=>{"vertical"===t&&(n.top=e.top,n.bottom=e.bottom),"horizontal"===t&&(n.left=e.left,n.right=e.right),n[t]=e[t]})),n}function Sl(e){return e&&"string"==typeof e?{top:e,right:e,bottom:e,left:e}:e}function kl(e){let{name:t}=e;const n=El(t),l=vl(t),a=yl(t),r=bl(t),i=wl(t),s=function(){const[e]=el("spacing.spacingSizes");return e&&e.length>0}(),c=(0,_.__experimentalUseCustomUnits)({availableUnits:el("spacing.units",t)[0]||["%","px","em","rem","vw"]}),{contentSizeValue:u,setContentSizeValue:d,hasUserSetContentSizeValue:m,resetContentSizeValue:p}=function(e){const[t,n]=el("layout.contentSize",e),[l]=el("layout.contentSize",e,"user");return{contentSizeValue:t,setContentSizeValue:n,hasUserSetContentSizeValue:()=>!!l,resetContentSizeValue:()=>n("")}}(t),{wideSizeValue:f,setWideSizeValue:E,hasUserSetWideSizeValue:v,resetWideSizeValue:y}=function(e){const[t,n]=el("layout.wideSize",e),[l]=el("layout.wideSize",e,"user");return{wideSizeValue:t,setWideSizeValue:n,hasUserSetWideSizeValue:()=>!!l,resetWideSizeValue:()=>n("")}}(t),{paddingValues:b,paddingSides:w,isAxialPadding:x,setPaddingValues:S,resetPaddingValue:k,hasPaddingValue:C}=function(e){const[t,n]=tl("spacing.padding",e),l=Sl(t),a=(0,_e.__experimentalUseCustomSides)(e,"padding"),r=a&&a.some((e=>hl.includes(e))),o=e=>{const t=xl(e,a);n(t)},[i]=tl("spacing.padding",e,"user");return{paddingValues:l,paddingSides:a,isAxialPadding:r,setPaddingValues:o,resetPaddingValue:()=>o({}),hasPaddingValue:()=>!!i}}(t),{marginValues:T,marginSides:N,isAxialMargin:I,setMarginValues:M,resetMarginValue:P,hasMarginValue:z}=function(e){const[t,n]=tl("spacing.margin",e),l=Sl(t),a=(0,_e.__experimentalUseCustomSides)(e,"margin"),r=a&&a.some((e=>hl.includes(e))),o=e=>{const t=xl(e,a);n(t)};return{marginValues:l,marginSides:a,isAxialMargin:r,setMarginValues:o,resetMarginValue:()=>o({}),hasMarginValue:()=>!!l&&Object.keys(l).length}}(t),{gapValue:V,gapValues:B,gapSides:A,isAxialGap:R,setGapValue:L,setGapValues:O,resetGapValue:D,hasGapValue:G}=function(e){const[t,n]=tl("spacing.blockGap",e),l=(a=t)&&"string"==typeof a?{top:a}:a?{...a,right:null==a?void 0:a.left,bottom:null==a?void 0:a.top}:a;var a;const r=(0,_e.__experimentalUseCustomSides)(e,"blockGap"),o=r&&r.some((e=>hl.includes(e))),[i]=tl("spacing.blockGap",e,"user");return{gapValue:t,gapValues:l,gapSides:r,isAxialGap:o,setGapValue:n,setGapValues:e=>{e||n(null),!o&&null!=e&&e.hasOwnProperty("top")?n(e.top):n({top:null==e?void 0:e.top,left:null==e?void 0:e.left})},resetGapValue:()=>n(void 0),hasGapValue:()=>!!i}}(t);return(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,h.__)("Dimensions"),resetAll:()=>{k(),P(),D(),p(),y()}},(n||l)&&(0,o.createElement)("span",{className:"span-columns"},(0,h.__)("Set the width of the main content area.")),n&&(0,o.createElement)(_.__experimentalToolsPanelItem,{className:"single-column",label:(0,h.__)("Content size"),hasValue:m,onDeselect:p,isShownByDefault:!0},(0,o.createElement)(_.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,o.createElement)(_.__experimentalUnitControl,{label:(0,h.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:u||"",onChange:e=>{d(e)},units:c}),(0,o.createElement)(_.__experimentalView,null,(0,o.createElement)(ae,{icon:gl})))),l&&(0,o.createElement)(_.__experimentalToolsPanelItem,{className:"single-column",label:(0,h.__)("Wide size"),hasValue:v,onDeselect:y,isShownByDefault:!0},(0,o.createElement)(_.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,o.createElement)(_.__experimentalUnitControl,{label:(0,h.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:f||"",onChange:e=>{E(e)},units:c}),(0,o.createElement)(_.__experimentalView,null,(0,o.createElement)(ae,{icon:_l})))),a&&(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:C,label:(0,h.__)("Padding"),onDeselect:k,isShownByDefault:!0,className:g()({"tools-panel-item-spacing":s})},!s&&(0,o.createElement)(_.__experimentalBoxControl,{values:b,onChange:S,label:(0,h.__)("Padding"),sides:w,units:c,allowReset:!1,splitOnAxis:x}),s&&(0,o.createElement)(_e.__experimentalSpacingSizesControl,{values:b,onChange:S,label:(0,h.__)("Padding"),sides:w,units:c,allowReset:!1,splitOnAxis:x})),r&&(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:z,label:(0,h.__)("Margin"),onDeselect:P,isShownByDefault:!0,className:g()({"tools-panel-item-spacing":s})},!s&&(0,o.createElement)(_.__experimentalBoxControl,{values:T,onChange:M,label:(0,h.__)("Margin"),sides:N,units:c,allowReset:!1,splitOnAxis:I}),s&&(0,o.createElement)(_e.__experimentalSpacingSizesControl,{values:T,onChange:M,label:(0,h.__)("Margin"),sides:N,units:c,allowReset:!1,splitOnAxis:I})),i&&(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:G,label:(0,h.__)("Block spacing"),onDeselect:D,isShownByDefault:!0,className:g()({"tools-panel-item-spacing":s})},!s&&(R?(0,o.createElement)(_.__experimentalBoxControl,{label:(0,h.__)("Block spacing"),min:0,onChange:O,units:c,sides:A,values:B,allowReset:!1,splitOnAxis:R}):(0,o.createElement)(_.__experimentalUnitControl,{label:(0,h.__)("Block spacing"),__unstableInputWidth:"80px",min:0,onChange:L,units:c,value:V})),s&&(0,o.createElement)(_e.__experimentalSpacingSizesControl,{label:(0,h.__)("Block spacing"),min:0,onChange:O,sides:R?A:["top"],values:B,allowReset:!1,splitOnAxis:R})))}function Cl(e){const t=Tl(e),n=Nl(e),l=Il(e),a=ll(e);return t||n||l||a.includes("fontSize")}function Tl(e){const t=ll(e);return el("typography.lineHeight",e)[0]&&t.includes("lineHeight")}function Nl(e){const t=ll(e),n=el("typography.fontStyle",e)[0]&&t.includes("fontStyle"),l=el("typography.fontWeight",e)[0]&&t.includes("fontWeight");return n||l}function Il(e,t){if(!el("typography.letterSpacing",e)[0])return!1;if(!e&&"heading"===t)return!0;return ll(e).includes("letterSpacing")}function Ml(e){let{name:t,element:n}=e;const[l,a]=(0,o.useState)("heading"),r=ll(t);let i="";"heading"===n?i=`elements.${l}.`:n&&"text"!==n&&(i=`elements.${n}.`);const[s]=el("typography.fluid",t),[c]=el("typography.fontSizes",t),u=c.map((e=>(s&&(e.size=jn(e,{fluid:s})),e))),d=!el("typography.customFontSize",t)[0],[m]=el("typography.fontFamilies",t),p=el("typography.fontStyle",t)[0]&&r.includes("fontStyle"),g=el("typography.fontWeight",t)[0]&&r.includes("fontWeight"),f=Tl(t),E=Nl(t),v=Il(t,n),y=function(e,t){return!!el("typography.textTransform",e)[0]&&(!e&&"heading"===t||ll(e).includes("textTransform"))}(t,n);let b=r.includes("fontSize");"heading"===n&&"heading"===l&&(b=!1);const[w,x]=tl(i+"typography.fontFamily",t),[S,k]=tl(i+"typography.fontSize",t),[C,T]=tl(i+"typography.fontStyle",t),[N,I]=tl(i+"typography.fontWeight",t),[M,P]=tl(i+"typography.lineHeight",t),[z,V]=tl(i+"typography.letterSpacing",t),[B,A]=tl(i+"typography.textTransform",t),[R]=tl(i+"color.background",t),[L]=tl(i+"color.gradient",t),[O]=tl(i+"color.text",t),D="link"===n?{textDecoration:"underline"}:{};return(0,o.createElement)(_.PanelBody,{className:"edit-site-typography-panel",initialOpen:!0},(0,o.createElement)("div",{className:"edit-site-typography-panel__preview",style:{fontFamily:null!=w?w:"serif",background:null!=L?L:R,color:O,fontSize:S,fontStyle:C,fontWeight:N,letterSpacing:z,...D}},"Aa"),(0,o.createElement)(_.__experimentalGrid,{columns:2,rowGap:16,columnGap:8},"heading"===n&&(0,o.createElement)("div",{className:"edit-site-typography-panel__full-width-control"},(0,o.createElement)(_.__experimentalToggleGroupControl,{label:(0,h.__)("Select heading level"),hideLabelFromVision:!0,value:l,onChange:a,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0},(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"heading",label:(0,h.__)("All")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h1",label:(0,h.__)("H1")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h2",label:(0,h.__)("H2")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h3",label:(0,h.__)("H3")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h4",label:(0,h.__)("H4")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h5",label:(0,h.__)("H5")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h6",label:(0,h.__)("H6")}))),r.includes("fontFamily")&&(0,o.createElement)("div",{className:"edit-site-typography-panel__full-width-control"},(0,o.createElement)(_e.__experimentalFontFamilyControl,{fontFamilies:m,value:w,onChange:x,size:"__unstable-large",__nextHasNoMarginBottom:!0})),b&&(0,o.createElement)("div",{className:"edit-site-typography-panel__full-width-control"},(0,o.createElement)(_.FontSizePicker,{value:S,onChange:k,fontSizes:u,disableCustomFontSizes:d,size:"__unstable-large",__nextHasNoMarginBottom:!0})),E&&(0,o.createElement)(_e.__experimentalFontAppearanceControl,{value:{fontStyle:C,fontWeight:N},onChange:e=>{let{fontStyle:t,fontWeight:n}=e;T(t),I(n)},hasFontStyles:p,hasFontWeights:g,size:"__unstable-large",__nextHasNoMarginBottom:!0}),f&&(0,o.createElement)(_e.LineHeightControl,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:M,onChange:P,size:"__unstable-large"}),v&&(0,o.createElement)(_e.__experimentalLetterSpacingControl,{value:z,onChange:V,size:"__unstable-large",__unstableInputWidth:"auto"}),y&&(0,o.createElement)("div",{className:"edit-site-typography-panel__full-width-control"},(0,o.createElement)(_e.__experimentalTextTransformControl,{value:B,onChange:A,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0}))))}var Pl=function(e){let{name:t,parentMenu:n=""}=e;const l=Cl(t),a=pl(t),r=ol(t),i=fl(t),s=r||i;return(0,o.createElement)(_.__experimentalItemGroup,null,l&&(0,o.createElement)(Fn,{icon:Hn,path:n+"/typography","aria-label":(0,h.__)("Typography styles")},(0,h.__)("Typography")),a&&(0,o.createElement)(Fn,{icon:$n,path:n+"/colors","aria-label":(0,h.__)("Colors styles")},(0,h.__)("Colors")),s&&(0,o.createElement)(Fn,{icon:Un,path:n+"/layout","aria-label":(0,h.__)("Layout styles")},(0,h.__)("Layout")))},zl=window.wp.styleEngine;const Vl={__experimentalBorder:"border",color:"color",spacing:"spacing",typography:"typography"};function Bl(e){var t;const n="var:";if(null!=e&&null!==(t=e.startsWith)&&void 0!==t&&t.call(e,n)){return`var(--wp--${e.slice(n.length).split("|").join("--")})`}return e}function Al(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,Et.reduce)(Yn,((n,l)=>{let{path:a,cssVarInfix:r,classes:o}=l;if(!o)return n;const i=(0,Et.get)(t,a,[]);return["default","theme","custom"].forEach((t=>{i[t]&&i[t].forEach((t=>{let{slug:l}=t;o.forEach((t=>{let{classSuffix:a,propertyName:o}=t;const i=`.has-${(0,Et.kebabCase)(l)}-${a}`,s=e.split(",").map((e=>`${e}${i}`)).join(","),c=`var(--wp--preset--${r}--${(0,Et.kebabCase)(l)})`;n+=`${s}{${o}: ${c} !important;}`}))}))})),n}),"")}function Rl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,l=[];return Object.keys(e).forEach((a=>{const r=t+(0,Et.kebabCase)(a.replace("/","-")),o=e[a];if(o instanceof Object){const e=r+n;l=[...l,...Rl(o,e,n)]}else l.push(`${r}: ${o}`)})),l}function Ll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const a=Wn===t,r=(0,Et.reduce)(i.__EXPERIMENTAL_STYLE_PROPERTY,((t,l,r)=>{let{value:o,properties:i,useEngine:s,rootOnly:c}=l;if(c&&!a)return t;const u=o;if("elements"===u[0]||s)return t;const d=(0,Et.get)(e,u);if("--wp--style--root--padding"===r&&("string"==typeof d||!n))return t;if(i&&"string"!=typeof d)Object.entries(i).forEach((e=>{const[n,l]=e;if(!(0,Et.get)(d,[l],!1))return;const a=n.startsWith("--")?n:(0,Et.kebabCase)(n);t.push(`${a}: ${Bl((0,Et.get)(d,[l]))}`)}));else if((0,Et.get)(e,u,!1)){const n=r.startsWith("--")?r:(0,Et.kebabCase)(r);t.push(`${n}: ${Bl((0,Et.get)(e,u))}`)}return t}),[]),o=(0,zl.getCSSRules)(e);return o.forEach((e=>{var t;if(a&&n&&e.key.startsWith("padding"))return;const o=e.key.startsWith("--")?e.key:(0,Et.kebabCase)(e.key);let i=e.value;if("string"!=typeof i&&null!==(t=i)&&void 0!==t&&t.ref){var s;const e=i.ref.split(".");if(i=(0,Et.get)(l,e),!i||null!==(s=i)&&void 0!==s&&s.ref)return}var c;"font-size"===o&&(i=jn({size:i},null==l||null===(c=l.settings)||void 0===c?void 0:c.typography));r.push(`${o}: ${i}`)})),r}function Ol(e){var t,n,l,a,r;let{tree:o,style:i,selector:s,hasBlockGapSupport:c,hasFallbackGapSupport:u,fallbackGapValue:d}=e,m="",p=c?(0,_e.__experimentalGetGapCSSValue)(null==i||null===(t=i.spacing)||void 0===t?void 0:t.blockGap):"";if(u&&(s===Wn?p=p||"0.5em":!c&&d&&(p=d)),p&&null!=o&&null!==(n=o.settings)&&void 0!==n&&null!==(l=n.layout)&&void 0!==l&&l.definitions&&(Object.values(o.settings.layout.definitions).forEach((e=>{let{className:t,name:n,spacingStyles:l}=e;(c||"flex"===n)&&null!=l&&l.length&&l.forEach((e=>{const n=[];if(e.rules&&Object.entries(e.rules).forEach((e=>{let[t,l]=e;n.push(`${t}: ${l||p}`)})),n.length){let l="";l=c?s===Wn?`${s} .${t}${(null==e?void 0:e.selector)||""}`:`${s}.${t}${(null==e?void 0:e.selector)||""}`:s===Wn?`:where(.${t}${(null==e?void 0:e.selector)||""})`:`:where(${s}.${t}${(null==e?void 0:e.selector)||""})`,m+=`${l} { ${n.join("; ")}; }`}}))})),s===Wn&&c&&(m+=`${s} { --wp--style--block-gap: ${p}; }`)),s===Wn&&null!=o&&null!==(a=o.settings)&&void 0!==a&&null!==(r=a.layout)&&void 0!==r&&r.definitions){const e=["block","flex","grid"];Object.values(o.settings.layout.definitions).forEach((t=>{let{className:n,displayMode:l,baseStyles:a}=t;l&&e.includes(l)&&(m+=`${s} .${n} { display:${l}; }`),null!=a&&a.length&&a.forEach((e=>{const t=[];if(e.rules&&Object.entries(e.rules).forEach((e=>{let[n,l]=e;t.push(`${n}: ${l}`)})),t.length){const l=`${s} .${n}${(null==e?void 0:e.selector)||""}`;m+=`${l} { ${t.join("; ")}; }`}}))}))}return m}const Dl=(e,t)=>{var n,l;const a=[];if(null==e||!e.styles)return a;const r=e=>(0,Et.pickBy)(e,((e,t)=>["border","color","spacing","typography","filter","outline","shadow"].includes(t))),o=r(e.styles);return o&&a.push({styles:o,selector:Wn}),Object.entries(i.__EXPERIMENTAL_ELEMENTS).forEach((t=>{var n;let[l,r]=t;var o;null!==(n=e.styles)&&void 0!==n&&n.elements[l]&&a.push({styles:null===(o=e.styles)||void 0===o?void 0:o.elements[l],selector:r})})),Object.entries(null!==(n=null===(l=e.styles)||void 0===l?void 0:l.blocks)&&void 0!==n?n:{}).forEach((e=>{var n,l;let[o,s]=e;const c=r(s);c&&null!=t&&null!==(n=t[o])&&void 0!==n&&n.selector&&a.push({duotoneSelector:t[o].duotoneSelector,fallbackGapValue:t[o].fallbackGapValue,hasLayoutSupport:t[o].hasLayoutSupport,selector:t[o].selector,styles:c,featureSelectors:t[o].featureSelectors}),Object.entries(null!==(l=null==s?void 0:s.elements)&&void 0!==l?l:{}).forEach((e=>{let[n,l]=e;l&&null!=t&&t[o]&&null!==i.__EXPERIMENTAL_ELEMENTS&&void 0!==i.__EXPERIMENTAL_ELEMENTS&&i.__EXPERIMENTAL_ELEMENTS[n]&&a.push({styles:l,selector:t[o].selector.split(",").map((e=>i.__EXPERIMENTAL_ELEMENTS[n].split(",").map((t=>e+" "+t)))).join(",")})}))})),a},Gl=(e,t)=>{var n,l,a;const r=[];if(null==e||!e.settings)return r;const o=e=>{const t={};return Yn.forEach((n=>{let{path:l}=n;const a=(0,Et.get)(e,l,!1);!1!==a&&(0,Et.set)(t,l,a)})),t},i=o(e.settings),s=null===(n=e.settings)||void 0===n?void 0:n.custom;return(0,Et.isEmpty)(i)&&!s||r.push({presets:i,custom:s,selector:Wn}),Object.entries(null!==(l=null===(a=e.settings)||void 0===a?void 0:a.blocks)&&void 0!==l?l:{}).forEach((e=>{let[n,l]=e;const a=o(l),i=l.custom;(0,Et.isEmpty)(a)&&!i||r.push({presets:a,custom:i,selector:t[n].selector})})),r},Fl=(e,t)=>{const n=Gl(e,t);let l="";return n.forEach((t=>{let{presets:n,custom:a,selector:r}=t;const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return(0,Et.reduce)(Yn,((n,l)=>{let{path:a,valueKey:r,valueFunc:o,cssVarInfix:i}=l;const s=(0,Et.get)(e,a,[]);return["default","theme","custom"].forEach((e=>{s[e]&&s[e].forEach((e=>{r&&!o?n.push(`--wp--preset--${i}--${(0,Et.kebabCase)(e.slug)}: ${e[r]}`):o&&"function"==typeof o&&n.push(`--wp--preset--${i}--${(0,Et.kebabCase)(e.slug)}: ${o(e,t)}`)}))})),n}),[])}(n,null==e?void 0:e.settings),i=Rl(a,"--wp--custom--","--");i.length>0&&o.push(...i),o.length>0&&(l+=`${r}{${o.join(";")};}`)})),l};function Hl(e,t){return Gl(e,t).flatMap((e=>{let{presets:t}=e;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn.filter((e=>"duotone"===e.path.at(-1))).flatMap((t=>{const n=(0,Et.get)(e,t.path,{});return["default","theme"].filter((e=>n[e])).flatMap((e=>n[e].map((e=>(0,o.createElement)(_e.__unstablePresetDuotoneFilter,{preset:e,key:e.slug})))))}))}(t)}))}function $l(){const{merged:e}=(0,o.useContext)(Qn),[t]=el("spacing.blockGap"),n=null!==t,l=!n,a=(0,c.useSelect)((e=>{const{getSettings:t}=e(_e.store);return!!t().disableLayoutStyles}));return(0,o.useMemo)((()=>{if(null==e||!e.styles||null==e||!e.settings)return[];const t=(e=>{const t={};return e.forEach((e=>{var n,l,a,r,o,i,s,c,u;const d=e.name,m=null!==(n=null==e||null===(l=e.supports)||void 0===l?void 0:l.__experimentalSelector)&&void 0!==n?n:".wp-block-"+d.replace("core/","").replace("/","-"),p=null!==(a=null==e||null===(r=e.supports)||void 0===r||null===(o=r.color)||void 0===o?void 0:o.__experimentalDuotone)&&void 0!==a?a:null,g=!(null==e||null===(i=e.supports)||void 0===i||!i.__experimentalLayout),_=null==e||null===(s=e.supports)||void 0===s||null===(c=s.spacing)||void 0===c||null===(u=c.blockGap)||void 0===u?void 0:u.__experimentalDefault,h={};Object.entries(Vl).forEach((t=>{var n,l;let[a,r]=t;const o=null==e||null===(n=e.supports)||void 0===n||null===(l=n[a])||void 0===l?void 0:l.__experimentalSelector;o&&(h[r]=function(e,t){const n=e.split(","),l=t.split(","),a=[];return n.forEach((e=>{l.forEach((t=>{a.push(`${e.trim()} ${t.trim()}`)}))})),a.join(", ")}(m,o))})),t[d]={duotoneSelector:p,fallbackGapValue:_,featureSelectors:Object.keys(h).length?h:void 0,hasLayoutSupport:g,name:d,selector:m}})),t})((0,i.getBlockTypes)()),r=Fl(e,t),o=function(e,t,n,l){var a,r;let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const i=Dl(e,t),s=Gl(e,t),c=null==e||null===(a=e.settings)||void 0===a?void 0:a.useRootPaddingAwareAlignments,{contentSize:u,wideSize:d}=(null==e||null===(r=e.settings)||void 0===r?void 0:r.layout)||{};let m="body {margin: 0;";if(u&&(m+=` --wp--style--global--content-size: ${u};`),d&&(m+=` --wp--style--global--wide-size: ${d};`),c&&(m+='padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;'),m+="}",i.forEach((t=>{let{selector:a,duotoneSelector:r,styles:i,fallbackGapValue:s,hasLayoutSupport:u,featureSelectors:d}=t;d&&Object.entries(d).forEach((e=>{let[t,n]=e;if(null!=i&&i[t]){const e=Ll({[t]:i[t]});delete i[t],e.length&&(m+=`${n}{${e.join(";")} }`)}}));const p={};if(null!=i&&i.filter&&(p.filter=i.filter,delete i.filter),r){const e=Ll(p);e.length>0&&(m+=`${r}{${e.join(";")};}`)}o||Wn!==a&&!u||(m+=Ol({tree:e,style:i,selector:a,hasBlockGapSupport:n,hasFallbackGapSupport:l,fallbackGapValue:s}));const g=Ll(i,a,c,e);null!=g&&g.length&&(m+=`${a}{${g.join(";")};}`);const _=Object.entries(i).filter((e=>{let[t]=e;return t.startsWith(":")}));null!=_&&_.length&&_.forEach((e=>{let[t,n]=e;const l=Ll(n);if(null==l||!l.length)return;const r=`${a.split(",").map((e=>e+t)).join(",")}{${l.join(";")};}`;m+=r}))})),m+=".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",m+=".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",m+=".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }",n){var p,g;const t=(0,_e.__experimentalGetGapCSSValue)(null==e||null===(p=e.styles)||void 0===p||null===(g=p.spacing)||void 0===g?void 0:g.blockGap)||"0.5em";m+=".wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }",m+=`.wp-site-blocks > * + * { margin-block-start: ${t}; }`}return s.forEach((e=>{let{selector:t,presets:n}=e;Wn===t&&(t="");const l=Al(t,n);(0,Et.isEmpty)(l)||(m+=l)})),m}(e,t,n,l,a),s=Hl(e,t);return[[{css:r,isGlobalStyles:!0},{css:o,isGlobalStyles:!0}],e.settings,s]}),[n,l,e,a])}const Ul={start:{opacity:1,display:"block"},hover:{opacity:0,display:"none"}},jl={hover:{opacity:1,display:"block"},start:{opacity:0,display:"none"}};var Wl=e=>{let{label:t,isFocused:n}=e;const[l]=tl("typography.fontWeight"),[a="serif"]=tl("typography.fontFamily"),[r=a]=tl("elements.h1.typography.fontFamily"),[i=l]=tl("elements.h1.typography.fontWeight"),[s="black"]=tl("color.text"),[c=s]=tl("elements.h1.color.text"),[u="blue"]=tl("elements.link.color.text"),[d="white"]=tl("color.background"),[m]=tl("color.gradient"),[p]=$l(),g=(0,J.useReducedMotion)(),[h]=el("color.palette.core"),[f]=el("color.palette.theme"),[E]=el("color.palette.custom"),[v,y]=(0,o.useState)(!1),[b,{width:w}]=(0,J.useResizeObserver)(),x=w?w/248:1,S=(null!=f?f:[]).concat(null!=E?E:[]).concat(null!=h?h:[]),k=S.filter((e=>{let{color:t}=e;return t!==d&&t!==c})).slice(0,2),C=(0,o.useMemo)((()=>p?[...p,{css:"body{min-width: 0;padding: 0;border: none;}",isGlobalStyles:!0}]:p),[p]);return(0,o.createElement)(_e.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",head:(0,o.createElement)(_e.__unstableEditorStyles,{styles:C}),style:{height:152*x,visibility:w?"visible":"hidden"},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),tabIndex:-1},b,(0,o.createElement)(_.__unstableMotion.div,{style:{height:152*x,width:"100%",background:null!=m?m:d,cursor:"pointer"},initial:"start",animate:!v&&!n||g?"start":"hover"},(0,o.createElement)(_.__unstableMotion.div,{variants:Ul,style:{height:"100%",overflow:"hidden"}},(0,o.createElement)(_.__experimentalHStack,{spacing:10*x,justify:"center",style:{height:"100%",overflow:"hidden"}},(0,o.createElement)("div",{style:{fontFamily:r,fontSize:65*x,color:c,fontWeight:i}},"Aa"),(0,o.createElement)(_.__experimentalVStack,{spacing:4*x},k.map((e=>{let{slug:t,color:n}=e;return(0,o.createElement)("div",{key:t,style:{height:32*x,width:32*x,background:n,borderRadius:32*x/2}})}))))),(0,o.createElement)(_.__unstableMotion.div,{variants:jl,style:{height:"100%",overflow:"hidden"}},(0,o.createElement)(_.__experimentalVStack,{spacing:3*x,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*x,boxSizing:"border-box"}},t&&(0,o.createElement)("div",{style:{fontSize:35*x,fontFamily:r,color:c,fontWeight:i,lineHeight:"1em"}},t),(0,o.createElement)(_.__experimentalHStack,{spacing:2*x,justify:"flex-start"},(0,o.createElement)("div",{style:{fontFamily:a,fontSize:24*x,color:s}},"Aa"),(0,o.createElement)("div",{style:{fontFamily:a,fontSize:24*x,color:u}},"Aa")),S&&(0,o.createElement)(_.__experimentalHStack,{spacing:0},S.slice(0,4).map(((e,t)=>{let{color:n}=e;return(0,o.createElement)("div",{key:t,style:{height:10*x,width:30*x,background:n,flexGrow:1}})})))))))};var Yl=function(){const{variations:e}=(0,c.useSelect)((e=>({variations:e(u.store).__experimentalGetCurrentThemeGlobalStylesVariations()})),[]);return(0,o.createElement)(_.Card,{size:"small"},(0,o.createElement)(_.CardBody,null,(0,o.createElement)(_.__experimentalVStack,{spacing:4},(0,o.createElement)(_.Card,null,(0,o.createElement)(_.CardMedia,null,(0,o.createElement)(Wl,null))),!(null==e||!e.length)&&(0,o.createElement)(_.__experimentalItemGroup,null,(0,o.createElement)(Fn,{path:"/variations","aria-label":(0,h.__)("Browse styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,o.createElement)(_.FlexItem,null,(0,h.__)("Browse styles")),(0,o.createElement)(Dn,{icon:(0,h.isRTL)()?re:oe})))),(0,o.createElement)(Pl,null))),(0,o.createElement)(_.CardDivider,null),(0,o.createElement)(_.CardBody,null,(0,o.createElement)(_.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,h.__)("Customize the appearance of specific blocks for the whole site.")),(0,o.createElement)(_.__experimentalItemGroup,null,(0,o.createElement)(Fn,{path:"/blocks","aria-label":(0,h.__)("Blocks styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,o.createElement)(_.FlexItem,null,(0,h.__)("Blocks")),(0,o.createElement)(Dn,{icon:(0,h.isRTL)()?re:oe}))))))};var ql=function(e){let{title:t,description:n}=e;return(0,o.createElement)(_.__experimentalVStack,{spacing:0},(0,o.createElement)(_.__experimentalView,null,(0,o.createElement)(_.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3},(0,o.createElement)(_.__experimentalHStack,{spacing:2},(0,o.createElement)(_.__experimentalNavigatorBackButton,{style:{minWidth:24,padding:0},icon:(0,h.isRTL)()?oe:re,isSmall:!0,"aria-label":(0,h.__)("Navigate to the previous view")}),(0,o.createElement)(_.__experimentalSpacer,null,(0,o.createElement)(_.__experimentalHeading,{level:5},t))))),n&&(0,o.createElement)("p",{className:"edit-site-global-styles-header__description"},n))};function Xl(e){let{block:t}=e;const n=Cl(t.name),l=pl(t.name),a=ol(t.name),r=fl(t.name);if(!(n||l||(a||r)))return null;const i=(0,h.sprintf)((0,h.__)("%s block styles"),t.title);return(0,o.createElement)(Fn,{path:"/blocks/"+t.name,"aria-label":i},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(_e.BlockIcon,{icon:t.icon}),(0,o.createElement)(_.FlexItem,null,t.title)))}var Kl=function(){const e=function(){const e=(0,c.useSelect)((e=>e(i.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:l}=e;return(t.name.startsWith("core/")?n:l).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),[t,n]=(0,o.useState)(""),l=(0,J.useDebounce)(Qe.speak,500),a=(0,c.useSelect)((e=>e(i.store).isMatchingSearchTerm),[]),r=(0,o.useMemo)((()=>t?e.filter((e=>a(e,t))):e),[t,e,a]),s=(0,o.useRef)();return(0,o.useEffect)((()=>{if(!t)return;const e=s.current.childElementCount,n=(0,h.sprintf)((0,h._n)("%d result found.","%d results found.",e),e);l(n,e)}),[t,l]),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Blocks"),description:(0,h.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,o.createElement)(_.SearchControl,{className:"edit-site-block-types-search",onChange:n,value:t,label:(0,h.__)("Search for blocks"),placeholder:(0,h.__)("Search")}),(0,o.createElement)("div",{ref:s,className:"edit-site-block-types-item-list"},r.map((e=>(0,o.createElement)(Xl,{block:e,key:"menu-itemblock-"+e.name})))))};var Zl=function(e){let{name:t}=e;const n=(0,i.getBlockType)(t);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:n.title}),(0,o.createElement)(Pl,{parentMenu:"/blocks/"+t,name:t}))};var Ql=function(e){let{children:t}=e;return(0,o.createElement)(_.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:2},t)};function Jl(e){let{name:t,parentMenu:n,element:l,label:a}=e;const r=!t,i="text"!==l&&l?`elements.${l}.`:"",s="link"===l?{textDecoration:"underline"}:{},[c]=tl(i+"typography.fontFamily",t),[u]=tl(i+"typography.fontStyle",t),[d]=tl(i+"typography.fontWeight",t),[m]=tl(i+"typography.letterSpacing",t),[p]=tl(i+"color.background",t),[g]=tl(i+"color.gradient",t),[f]=tl(i+"color.text",t);if(!r)return null;const E=(0,h.sprintf)((0,h.__)("Typography %s styles"),a);return(0,o.createElement)(Fn,{path:n+"/typography/"+l,"aria-label":E},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(_.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=c?c:"serif",background:null!=g?g:p,color:f,fontStyle:u,fontWeight:d,letterSpacing:m,...s}},(0,h.__)("Aa")),(0,o.createElement)(_.FlexItem,null,a)))}var ea=function(e){let{name:t}=e;const n=void 0===t?"":"/blocks/"+t;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Typography"),description:(0,h.__)("Manage the typography settings for different elements.")}),!t&&(0,o.createElement)("div",{className:"edit-site-global-styles-screen-typography"},(0,o.createElement)(_.__experimentalVStack,{spacing:3},(0,o.createElement)(Ql,null,(0,h.__)("Elements")),(0,o.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,o.createElement)(Jl,{name:t,parentMenu:n,element:"text",label:(0,h.__)("Text")}),(0,o.createElement)(Jl,{name:t,parentMenu:n,element:"link",label:(0,h.__)("Links")}),(0,o.createElement)(Jl,{name:t,parentMenu:n,element:"heading",label:(0,h.__)("Headings")}),(0,o.createElement)(Jl,{name:t,parentMenu:n,element:"button",label:(0,h.__)("Buttons")})))),!!t&&(0,o.createElement)(Ml,{name:t,element:"text"}))};const ta={text:{description:(0,h.__)("Manage the fonts used on the site."),title:(0,h.__)("Text")},link:{description:(0,h.__)("Manage the fonts and typography used on the links."),title:(0,h.__)("Links")},heading:{description:(0,h.__)("Manage the fonts and typography used on headings."),title:(0,h.__)("Headings")},button:{description:(0,h.__)("Manage the fonts and typography used on buttons."),title:(0,h.__)("Buttons")}};var na=function(e){let{name:t,element:n}=e;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:ta[n].title,description:ta[n].description}),(0,o.createElement)(Ml,{name:t,element:n}))};var la=function(e){let{className:t,...n}=e;return(0,o.createElement)(_.Flex,m({className:g()("edit-site-global-styles__color-indicator-wrapper",t)},n))};const aa=[];var ra=function(e){let{name:t}=e;const[n]=el("color.palette.custom"),[l]=el("color.palette.theme"),[a]=el("color.palette.default"),[r]=el("color.defaultPalette",t),i=(0,o.useMemo)((()=>[...n||aa,...l||aa,...a&&r?a:aa]),[n,l,a,r]),s=t?"/blocks/"+t+"/colors/palette":"/colors/palette",c=i.length>0?(0,h.sprintf)((0,h._n)("%d color","%d colors",i.length),i.length):(0,h.__)("Add custom colors");return(0,o.createElement)(_.__experimentalVStack,{spacing:3},(0,o.createElement)(Ql,null,(0,h.__)("Palette")),(0,o.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,o.createElement)(Fn,{path:s,"aria-label":(0,h.__)("Color palettes")},(0,o.createElement)(_.__experimentalHStack,{direction:0===i.length?"row-reverse":"row"},(0,o.createElement)(_.__experimentalZStack,{isLayered:!1,offset:-8},i.slice(0,5).map((e=>{let{color:t}=e;return(0,o.createElement)(la,{key:t},(0,o.createElement)(_.ColorIndicator,{colorValue:t}))}))),(0,o.createElement)(_.FlexItem,null,c)))))};function oa(e){let{name:t,parentMenu:n}=e;const l=ll(t),a=l.includes("backgroundColor")||l.includes("background"),[r]=tl("color.background",t),[i]=tl("color.gradient",t);return a?(0,o.createElement)(Fn,{path:n+"/colors/background","aria-label":(0,h.__)("Colors background styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:null!=i?i:r,"data-testid":"background-color-indicator"})),(0,o.createElement)(_.FlexItem,{className:"edit-site-global-styles__color-label"},(0,h.__)("Background")))):null}function ia(e){let{name:t,parentMenu:n}=e;const l=ll(t).includes("color"),[a]=tl("color.text",t);return l?(0,o.createElement)(Fn,{path:n+"/colors/text","aria-label":(0,h.__)("Colors text styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:a,"data-testid":"text-color-indicator"})),(0,o.createElement)(_.FlexItem,{className:"edit-site-global-styles__color-label"},(0,h.__)("Text")))):null}function sa(e){let{name:t,parentMenu:n}=e;const l=ll(t).includes("linkColor"),[a]=tl("elements.link.color.text",t),[r]=tl("elements.link.:hover.color.text",t);return l?(0,o.createElement)(Fn,{path:n+"/colors/link","aria-label":(0,h.__)("Colors link styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(_.__experimentalZStack,{isLayered:!1,offset:-8},(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:a})),(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:r}))),(0,o.createElement)(_.FlexItem,{className:"edit-site-global-styles__color-label"},(0,h.__)("Links")))):null}function ca(e){let{name:t,parentMenu:n}=e;const l=ll(t).includes("color"),[a]=tl("elements.heading.color.text",t),[r]=tl("elements.heading.color.background",t);return l?(0,o.createElement)(Fn,{path:n+"/colors/heading","aria-label":(0,h.__)("Colors heading styles")},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(_.__experimentalZStack,{isLayered:!1,offset:-8},(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:r})),(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:a}))),(0,o.createElement)(_.FlexItem,null,(0,h.__)("Headings")))):null}function ua(e){let{name:t,parentMenu:n}=e;const l=ll(t).includes("buttonColor"),[a]=tl("elements.button.color.text",t),[r]=tl("elements.button.color.background",t);return l?(0,o.createElement)(Fn,{path:n+"/colors/button"},(0,o.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,o.createElement)(_.__experimentalZStack,{isLayered:!1,offset:-8},(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:r})),(0,o.createElement)(la,{expanded:!1},(0,o.createElement)(_.ColorIndicator,{colorValue:a}))),(0,o.createElement)(_.FlexItem,{className:"edit-site-global-styles__color-label"},(0,h.__)("Buttons")))):null}var da=function(e){let{name:t}=e;const n=void 0===t?"":"/blocks/"+t;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Colors"),description:(0,h.__)("Manage palettes and the default color of different global elements on the site.")}),(0,o.createElement)("div",{className:"edit-site-global-styles-screen-colors"},(0,o.createElement)(_.__experimentalVStack,{spacing:10},(0,o.createElement)(ra,{name:t}),(0,o.createElement)(_.__experimentalVStack,{spacing:3},(0,o.createElement)(Ql,null,(0,h.__)("Elements")),(0,o.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,o.createElement)(oa,{name:t,parentMenu:n}),(0,o.createElement)(ia,{name:t,parentMenu:n}),(0,o.createElement)(sa,{name:t,parentMenu:n}),(0,o.createElement)(ca,{name:t,parentMenu:n}),(0,o.createElement)(ua,{name:t,parentMenu:n}))))))};function ma(e){let{name:t}=e;const[n,l]=el("color.palette.theme",t),[a]=el("color.palette.theme",t,"base"),[r,i]=el("color.palette.default",t),[s]=el("color.palette.default",t,"base"),[c,u]=el("color.palette.custom",t),[d]=el("color.defaultPalette",t);return(0,o.createElement)(_.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:10},!!n&&!!n.length&&(0,o.createElement)(_.__experimentalPaletteEdit,{canReset:n!==a,canOnlyChangeValues:!0,colors:n,onChange:l,paletteLabel:(0,h.__)("Theme")}),!!r&&!!r.length&&!!d&&(0,o.createElement)(_.__experimentalPaletteEdit,{canReset:r!==s,canOnlyChangeValues:!0,colors:r,onChange:i,paletteLabel:(0,h.__)("Default")}),(0,o.createElement)(_.__experimentalPaletteEdit,{colors:c,onChange:u,paletteLabel:(0,h.__)("Custom"),emptyMessage:(0,h.__)("Custom colors are empty! Add some colors to create your own color palette."),slugPrefix:"custom-"}))}const pa=()=>{};function ga(e){let{name:t}=e;const[n,l]=el("color.gradients.theme",t),[a]=el("color.gradients.theme",t,"base"),[r,i]=el("color.gradients.default",t),[s]=el("color.gradients.default",t,"base"),[c,u]=el("color.gradients.custom",t),[d]=el("color.defaultGradients",t),[m]=el("color.duotone.custom")||[],[p]=el("color.duotone.default")||[],[g]=el("color.duotone.theme")||[],[f]=el("color.defaultDuotone"),E=[...m||[],...g||[],...p&&f?p:[]];return(0,o.createElement)(_.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:10},!!n&&!!n.length&&(0,o.createElement)(_.__experimentalPaletteEdit,{canReset:n!==a,canOnlyChangeValues:!0,gradients:n,onChange:l,paletteLabel:(0,h.__)("Theme")}),!!r&&!!r.length&&!!d&&(0,o.createElement)(_.__experimentalPaletteEdit,{canReset:r!==s,canOnlyChangeValues:!0,gradients:r,onChange:i,paletteLabel:(0,h.__)("Default")}),(0,o.createElement)(_.__experimentalPaletteEdit,{gradients:c,onChange:u,paletteLabel:(0,h.__)("Custom"),emptyMessage:(0,h.__)("Custom gradients are empty! Add some gradients to create your own palette."),slugPrefix:"custom-"}),!!E&&!!E.length&&(0,o.createElement)("div",null,(0,o.createElement)(Ql,null,(0,h.__)("Duotone")),(0,o.createElement)(_.__experimentalSpacer,{margin:3}),(0,o.createElement)(_.DuotonePicker,{duotonePalette:E,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:pa})))}var _a=function(e){let{name:t}=e;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Palette"),description:(0,h.__)("Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.")}),(0,o.createElement)(_.TabPanel,{tabs:[{name:"solid",title:"Solid",value:"solid"},{name:"gradient",title:"Gradient",value:"gradient"}]},(e=>(0,o.createElement)(o.Fragment,null,"solid"===e.value&&(0,o.createElement)(ma,{name:t}),"gradient"===e.value&&(0,o.createElement)(ga,{name:t})))))};var ha=function(e){let{name:t}=e;const n=ll(t),[l]=el("color.palette",t),[a]=el("color.gradients",t),[r]=el("color.custom",t),[i]=el("color.customGradient",t),s=al(t),c=rl(t),[u]=el("color.background",t),d=n.includes("backgroundColor")&&u&&(l.length>0||r),p=n.includes("background")&&(a.length>0||i),[g,_]=tl("color.background",t),[f]=tl("color.background",t,"user"),[E,v]=tl("color.gradient",t),[y]=tl("color.gradient",t,"user");if(!d&&!p)return null;let b={};d&&(b={colorValue:g,onColorChange:_},g&&(b.clearable=g===f));let w={};p&&(w={gradientValue:E,onGradientChange:v},E&&(w.clearable=E===y));const x={...b,...w};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Background"),description:(0,h.__)("Set a background color or gradient for the whole site.")}),(0,o.createElement)(_e.__experimentalColorGradientControl,m({className:"edit-site-screen-background-color__control",colors:s,gradients:c,disableCustomColors:!r,disableCustomGradients:!i,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0},x)))};var fa=function(e){let{name:t}=e;const n=ll(t),[l]=el("color.palette",t),[a]=el("color.custom",t),[r]=el("color.text",t),i=al(t),s=n.includes("color")&&r&&(l.length>0||a),[c,u]=tl("color.text",t),[d]=tl("color.text",t,"user");return s?(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Text"),description:(0,h.__)("Set the default color used for text across the site.")}),(0,o.createElement)(_e.__experimentalColorGradientControl,{className:"edit-site-screen-text-color__control",colors:i,disableCustomColors:!a,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:c,onColorChange:u,clearable:c===d})):null};var Ea=function(e){let{name:t}=e;const n=ll(t),[l]=el("color.palette",t),[a]=el("color.custom",t),r=al(t),[i]=el("color.link",t),s=n.includes("linkColor")&&i&&(l.length>0||a),c={default:{label:(0,h.__)("Default"),value:tl("elements.link.color.text",t)[0],handler:tl("elements.link.color.text",t)[1],userValue:tl("elements.link.color.text",t,"user")[0]},hover:{label:(0,h.__)("Hover"),value:tl("elements.link.:hover.color.text",t)[0],handler:tl("elements.link.:hover.color.text",t)[1],userValue:tl("elements.link.:hover.color.text",t,"user")[0]}};if(!s)return null;const u=Object.entries(c).map((e=>{let[t,n]=e;return{name:t,title:n.label,className:`color-text-${t}`}}));return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Links"),description:(0,h.__)("Set the colors used for links across the site.")}),(0,o.createElement)(_.TabPanel,{tabs:u},(e=>{var t;const n=null!==(t=c[e.name])&&void 0!==t?t:null;return n?(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_e.__experimentalColorGradientControl,{className:"edit-site-screen-link-color__control",colors:r,disableCustomColors:!a,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:n.value,onColorChange:n.handler,clearable:n.value===n.userValue})):null})))};var va=function(e){let{name:t}=e;const[n,l]=(0,o.useState)("heading"),a=ll(t),[r]=el("color.palette",t),[i]=el("color.gradients",t),[s]=el("color.custom",t),[c]=el("color.customGradient",t),[u]=el("color.text",t),[d]=el("color.background",t),p=al(t),g=rl(t),f=a.includes("color")&&u&&(r.length>0||s),E=a.includes("backgroundColor")&&d&&(r.length>0||s),v=a.includes("background")&&(i.length>0||c),[y,b]=tl("elements."+n+".color.text",t),[w]=tl("elements."+n+".color.text",t,"user"),[x,S]=tl("elements."+n+".color.background",t),[k]=tl("elements."+n+".color.background",t,"user"),[C,T]=tl("elements."+n+".color.gradient",t),[N]=tl("elements."+n+".color.gradient",t,"user");if(!f&&!E&&!v)return null;let I={};E&&(I={colorValue:x,onColorChange:S},x&&(I.clearable=x===k));let M={};v&&(M={gradientValue:C,onGradientChange:T},C&&(M.clearable=C===N));const P={...I,...M};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Headings"),description:(0,h.__)("Set the default color used for headings across the site.")}),(0,o.createElement)("div",{className:"edit-site-global-styles-screen-heading-color"},(0,o.createElement)("h4",null,(0,h.__)("Select heading level")),(0,o.createElement)(_.__experimentalToggleGroupControl,{label:(0,h.__)("Select heading level"),hideLabelFromVision:!0,value:n,onChange:l,isBlock:!0},(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"heading",label:(0,h.__)("All")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h1",label:(0,h.__)("H1")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h2",label:(0,h.__)("H2")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h3",label:(0,h.__)("H3")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h4",label:(0,h.__)("H4")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h5",label:(0,h.__)("H5")}),(0,o.createElement)(_.__experimentalToggleGroupControlOption,{value:"h6",label:(0,h.__)("H6")}))),f&&(0,o.createElement)("div",{className:"edit-site-global-styles-screen-heading-color"},(0,o.createElement)("h4",null,"heading"===n?(0,h.__)("Text color for all heading levels"):(0,h.sprintf)((0,h.__)("Text color for %s"),n.toUpperCase())),(0,o.createElement)(_e.__experimentalColorGradientControl,{className:"edit-site-screen-heading-text-color__control",colors:p,disableCustomColors:!s,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:y,onColorChange:b,clearable:y===w})),E&&(0,o.createElement)("div",{className:"edit-site-global-styles-screen-heading-color"},(0,o.createElement)("h4",null,"heading"===n?(0,h.__)("Background color for all heading levels"):(0,h.sprintf)((0,h.__)("Background color for %s"),n.toUpperCase())),(0,o.createElement)(_e.__experimentalColorGradientControl,m({className:"edit-site-screen-heading-background-color__control",colors:p,gradients:g,disableCustomColors:!s,disableCustomGradients:!c,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0},P))))};var ya=function(e){let{name:t}=e;const n=ll(t),[l]=el("color.palette",t),[a]=el("color.custom",t),r=al(t),[i]=el("color.background",t),s=n.includes("buttonColor")&&i&&(l.length>0||a),[c,u]=tl("elements.button.color.text",t),[d]=tl("elements.button.color.text",t,"user"),[m,p]=tl("elements.button.color.background",t),[g]=tl("elements.button.color.background",t,"user");return s?(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Buttons"),description:(0,h.__)("Set the default colors used for buttons across the site.")}),(0,o.createElement)("h4",{className:"edit-site-global-styles-section-title"},(0,h.__)("Text color")),(0,o.createElement)(_e.__experimentalColorGradientControl,{className:"edit-site-screen-button-color__control",colors:r,disableCustomColors:!a,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:c,onColorChange:u,clearable:c===d}),(0,o.createElement)("h4",{className:"edit-site-global-styles-section-title"},(0,h.__)("Background color")),(0,o.createElement)(_e.__experimentalColorGradientControl,{className:"edit-site-screen-button-color__control",colors:r,disableCustomColors:!a,__experimentalHasMultipleOrigins:!0,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:m,onColorChange:p,clearable:m===g})):null};var ba=function(e){let{name:t}=e;const n=ol(t),l=fl(t);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{title:(0,h.__)("Layout")}),l&&(0,o.createElement)(kl,{name:t}),n&&(0,o.createElement)(ml,{name:t}))};const wa=e=>e;function xa(e,t){if(Array.isArray(t))return t}function Sa(e,t){return(0,Et.mergeWith)({},e,t,xa)}const ka=e=>{if(null===e||"object"!=typeof e||Array.isArray(e))return e;const t=(0,Et.pickBy)((0,Et.mapValues)(e,ka),wa);return(0,Et.isEmpty)(t)?void 0:t};function Ca(){const[e,t,n]=function(){const{globalStylesId:e,settings:t,styles:n}=(0,c.useSelect)((e=>{const t=e(u.store).__experimentalGetCurrentGlobalStylesId(),n=t?e(u.store).getEditedEntityRecord("root","globalStyles",t):void 0;return{globalStylesId:t,settings:null==n?void 0:n.settings,styles:null==n?void 0:n.styles}}),[]),{getEditedEntityRecord:l}=(0,c.useSelect)(u.store),{editEntityRecord:a}=(0,c.useDispatch)(u.store),r=(0,o.useMemo)((()=>({settings:null!=t?t:{},styles:null!=n?n:{}})),[t,n]),i=(0,o.useCallback)((t=>{var n,r;const o=l("root","globalStyles",e),i=t({styles:null!==(n=null==o?void 0:o.styles)&&void 0!==n?n:{},settings:null!==(r=null==o?void 0:o.settings)&&void 0!==r?r:{}});a("root","globalStyles",e,{styles:ka(i.styles)||{},settings:ka(i.settings)||{}})}),[e]);return[!!t||!!n,r,i]}(),[l,a]=function(){const e=(0,c.useSelect)((e=>e(u.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),r=(0,o.useMemo)((()=>a&&t?Sa(a,t):{}),[t,a]);return(0,o.useMemo)((()=>({isReady:e&&l,user:t,base:a,merged:r,setUserConfig:n})),[r,t,a,n,e,l])}function Ta(e){let{children:t}=e;const n=Ca();return n.isReady?(0,o.createElement)(Qn.Provider,{value:n},t):null}function Na(e){let{variation:t}=e;const[n,l]=(0,o.useState)(!1),{base:a,user:r,setUserConfig:i}=(0,o.useContext)(Qn),s=(0,o.useMemo)((()=>{var e,n;return{user:{settings:null!==(e=t.settings)&&void 0!==e?e:{},styles:null!==(n=t.styles)&&void 0!==n?n:{}},base:a,merged:Sa(a,t),setUserConfig:()=>{}}}),[t,a]),c=()=>{i((()=>({settings:t.settings,styles:t.styles})))},u=(0,o.useMemo)((()=>{return e=r,n=t,(0,Et.isEqual)(e.styles,n.styles)&&(0,Et.isEqual)(e.settings,n.settings);var e,n}),[r,t]);return(0,o.createElement)(Qn.Provider,{value:s},(0,o.createElement)("div",{className:g()("edit-site-global-styles-variations_item",{"is-active":u}),role:"button",onClick:c,onKeyDown:e=>{e.keyCode===Kt.ENTER&&(e.preventDefault(),c())},tabIndex:"0","aria-label":null==t?void 0:t.title,"aria-current":u,onFocus:()=>l(!0),onBlur:()=>l(!1)},(0,o.createElement)("div",{className:"edit-site-global-styles-variations_item-preview"},(0,o.createElement)(Wl,{label:null==t?void 0:t.title,isFocused:n}))))}var Ia=function(){const{variations:e}=(0,c.useSelect)((e=>({variations:e(u.store).__experimentalGetCurrentThemeGlobalStylesVariations()})),[]),t=(0,o.useMemo)((()=>[{title:(0,h.__)("Default"),settings:{},styles:{}},...e.map((e=>{var t,n;return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}}}))]),[e]);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ql,{back:"/",title:(0,h.__)("Browse styles"),description:(0,h.__)("Choose a different style combination for the theme styles")}),(0,o.createElement)(_.Card,{size:"small",isBorderless:!0},(0,o.createElement)(_.CardBody,null,(0,o.createElement)(_.__experimentalGrid,{columns:2},null==t?void 0:t.map(((e,t)=>(0,o.createElement)(Na,{key:t,variation:e})))))))};function Ma(e){let{className:t,...n}=e;return(0,o.createElement)(_.__experimentalNavigatorScreen,m({className:["edit-site-global-styles-sidebar__navigator-screen",t].filter(Boolean).join(" ")},n))}function Pa(e){let{name:t}=e;const n=void 0===t?"":"/blocks/"+t;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ma,{path:n+"/typography"},(0,o.createElement)(ea,{name:t})),(0,o.createElement)(Ma,{path:n+"/typography/text"},(0,o.createElement)(na,{name:t,element:"text"})),(0,o.createElement)(Ma,{path:n+"/typography/link"},(0,o.createElement)(na,{name:t,element:"link"})),(0,o.createElement)(Ma,{path:n+"/typography/heading"},(0,o.createElement)(na,{name:t,element:"heading"})),(0,o.createElement)(Ma,{path:n+"/typography/button"},(0,o.createElement)(na,{name:t,element:"button"})),(0,o.createElement)(Ma,{path:n+"/colors"},(0,o.createElement)(da,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/palette"},(0,o.createElement)(_a,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/background"},(0,o.createElement)(ha,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/text"},(0,o.createElement)(fa,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/link"},(0,o.createElement)(Ea,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/heading"},(0,o.createElement)(va,{name:t})),(0,o.createElement)(Ma,{path:n+"/colors/button"},(0,o.createElement)(ya,{name:t})),(0,o.createElement)(Ma,{path:n+"/layout"},(0,o.createElement)(ba,{name:t})))}var za=function(){const e=(0,i.getBlockTypes)();return(0,o.createElement)(_.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/"},(0,o.createElement)(Ma,{path:"/"},(0,o.createElement)(Yl,null)),(0,o.createElement)(Ma,{path:"/variations"},(0,o.createElement)(Ia,null)),(0,o.createElement)(Ma,{path:"/blocks"},(0,o.createElement)(Kl,null)),e.map((e=>(0,o.createElement)(Ma,{key:"menu-block-"+e.name,path:"/blocks/"+e.name},(0,o.createElement)(Zl,{name:e.name})))),(0,o.createElement)(Pa,null),e.map((e=>(0,o.createElement)(Pa,{key:"screens-block-"+e.name,name:e.name}))))};function Va(){const[e,t]=(()=>{const{user:e,setUserConfig:t}=(0,o.useContext)(Qn);return[!!e&&!(0,Et.isEqual)(e,Jn),(0,o.useCallback)((()=>t((()=>Jn))),[t])]})(),{toggle:n}=(0,c.useDispatch)(k.store);return(0,o.createElement)(Ln,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,h.__)("Styles"),icon:On,closeLabel:(0,h.__)("Close global styles sidebar"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,o.createElement)(_.Flex,null,(0,o.createElement)(_.FlexBlock,null,(0,o.createElement)("strong",null,(0,h.__)("Styles"))),(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.DropdownMenu,{icon:te,label:(0,h.__)("More Global Styles Actions"),controls:[{title:(0,h.__)("Reset to defaults"),onClick:t,isDisabled:!e},{title:(0,h.__)("Welcome Guide"),onClick:()=>n("core/edit-site","welcomeGuideStyles")}]})))},(0,o.createElement)(za,null))}const Ba="edit-site/template",Aa="edit-site/block-inspector";var Ra=e=>{let{sidebarName:t}=e;const{enableComplementaryArea:n}=(0,c.useDispatch)(O),[l,a]=t===Ba?[(0,h.__)("Template (selected)"),"is-active"]:[(0,h.__)("Template"),""],[r,i]=t===Aa?[(0,h.__)("Block (selected)"),"is-active"]:[(0,h.__)("Block"),""];return(0,o.createElement)("ul",null,(0,o.createElement)("li",null,(0,o.createElement)(_.Button,{onClick:()=>n(Oe,Ba),className:`edit-site-sidebar__panel-tab ${a}`,"aria-label":l,"data-label":(0,h.__)("Template")},(0,h.__)("Template"))),(0,o.createElement)("li",null,(0,o.createElement)(_.Button,{onClick:()=>n(Oe,Aa),className:`edit-site-sidebar__panel-tab ${i}`,"aria-label":r,"data-label":(0,h.__)("Block")},(0,h.__)("Block"))))};function La(e){let{template:t}=e;const{revertTemplate:n}=(0,c.useDispatch)(Ut);return Je(t)?(0,o.createElement)(_.DropdownMenu,{icon:te,label:(0,h.__)("Actions"),className:"edit-site-template-card__actions",toggleProps:{isSmall:!0}},(e=>{let{onClose:l}=e;return(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,{info:(0,h.__)("Use the template as supplied by the theme."),onClick:()=>{n(t),l()}},(0,h.__)("Clear customizations")))})):null}function Oa(e){let{area:t,clientId:n}=e;const{selectBlock:l,toggleBlockHighlight:a}=(0,c.useDispatch)(_e.store),r=(0,c.useSelect)((e=>e(d.store).__experimentalGetDefaultTemplatePartAreas().find((e=>e.area===t))),[t]),i=()=>a(n,!0),s=()=>a(n,!1);return(0,o.createElement)(_.Button,{className:"edit-site-template-card__template-areas-item",icon:null==r?void 0:r.icon,onMouseOver:i,onMouseLeave:s,onFocus:i,onBlur:s,onClick:()=>{l(n)}},null==r?void 0:r.label)}function Da(){const e=(0,c.useSelect)((e=>e(Ut).getCurrentTemplateTemplateParts()),[]);return e.length?(0,o.createElement)("section",{className:"edit-site-template-card__template-areas"},(0,o.createElement)(_.__experimentalHeading,{level:3,className:"edit-site-template-card__template-areas-title"},(0,h.__)("Areas")),(0,o.createElement)("ul",{className:"edit-site-template-card__template-areas-list"},e.map((e=>{let{templatePart:t,block:n}=e;return(0,o.createElement)("li",{key:t.slug},(0,o.createElement)(Oa,{area:t.area,clientId:n.clientId}))})))):null}function Ga(){const{info:{title:e,description:t,icon:n},template:l}=(0,c.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(Ut),{getEditedEntityRecord:l}=e(u.store),{__experimentalGetTemplateInfo:a}=e(d.store),r=l("postType",t(),n());return{info:r?a(r):{},template:r}}),[]);return e||t?(0,o.createElement)("div",{className:"edit-site-template-card"},(0,o.createElement)(_.Icon,{className:"edit-site-template-card__icon",icon:n}),(0,o.createElement)("div",{className:"edit-site-template-card__content"},(0,o.createElement)("div",{className:"edit-site-template-card__header"},(0,o.createElement)("h2",{className:"edit-site-template-card__title"},e),(0,o.createElement)(La,{template:l})),(0,o.createElement)("div",{className:"edit-site-template-card__description"},t),(0,o.createElement)(Da,null))):null}const{Slot:Fa,Fill:Ha}=(0,_.createSlotFill)("EditSiteSidebarInspector"),$a=Ha;function Ua(){const{sidebar:e,isEditorSidebarOpened:t,hasBlockSelection:n,supportsGlobalStyles:l}=(0,c.useSelect)((e=>{const t=e(O).getActiveComplementaryArea(Oe),n=[Aa,Ba].includes(t),l=e(Ut).getSettings();return{sidebar:t,isEditorSidebarOpened:n,hasBlockSelection:!!e(_e.store).getBlockSelectionStart(),supportsGlobalStyles:!(null!=l&&l.supportsTemplatePartsMode)}}),[]),{enableComplementaryArea:a}=(0,c.useDispatch)(O);(0,o.useEffect)((()=>{t&&a(Oe,n?Aa:Ba)}),[n,t]);let r=e;t||(r=n?Aa:Ba);let i=o.Fragment;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ln,{identifier:r,title:(0,h.__)("Settings"),icon:Rn,closeLabel:(0,h.__)("Close settings sidebar"),header:(0,o.createElement)(Ra,{sidebarName:r}),headerClassName:"edit-site-sidebar__panel-tabs"},r===Ba&&(0,o.createElement)(_.PanelBody,null,(0,o.createElement)(Ga,null)),r===Aa&&(0,o.createElement)(Fa,{bubblesVirtually:!0})),l&&(0,o.createElement)(Va,null),(0,o.createElement)(i,null))}var ja=window.wp.htmlEntities;var Wa=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"}));var Ya=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.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"}));const qa="__experimentalMainDashboardButton",{Fill:Xa,Slot:Ka}=(0,_.createSlotFill)(qa),Za=Xa;Za.Slot=e=>{let{children:t}=e;const n=(0,_.__experimentalUseSlot)(qa);return Boolean(n.fills&&n.fills.length)?(0,o.createElement)(Ka,{bubblesVirtually:!0}):t};var Qa=Za;const Ja="site-editor";function er(e){let{params:t,replace:n,...l}=e;const a=Be(t,n);return(0,o.createElement)(_.__experimentalNavigationItem,m({},a,l))}var tr=e=>{let{activeItem:t=Ja}=e;const{homeTemplate:n,isNavigationOpen:l,isTemplatePartsMode:a,siteTitle:r}=(0,c.useSelect)((e=>{const{getEntityRecord:t}=e(u.store),{getSettings:n,isNavigationOpened:l}=e(Ut),a=t("root","__unstableBase",void 0)||{},{supportsTemplatePartsMode:r,__unstableHomeTemplate:o}=n();return{siteTitle:a.name,homeTemplate:o,isNavigationOpen:l(),isTemplatePartsMode:!!r}}),[]),{setIsNavigationPanelOpened:i}=(0,c.useDispatch)(Ut);return(0,o.createElement)("div",{className:g()("edit-site-navigation-panel",{"is-open":l}),onKeyDown:e=>{e.keyCode!==Kt.ESCAPE||e.defaultPrevented||(e.preventDefault(),i(!1))}},(0,o.createElement)("div",{className:"edit-site-navigation-panel__inner"},(0,o.createElement)("div",{className:"edit-site-navigation-panel__site-title-container"},(0,o.createElement)("div",{className:"edit-site-navigation-panel__site-title"},(0,ja.decodeEntities)(r))),(0,o.createElement)("div",{className:"edit-site-navigation-panel__scroll-container"},(0,o.createElement)(_.__experimentalNavigation,{activeItem:t},(0,o.createElement)(Qa.Slot,null,(0,o.createElement)(_.__experimentalNavigationBackButton,{backButtonLabel:(0,h.__)("Dashboard"),className:"edit-site-navigation-panel__back-to-dashboard",href:"index.php"})),(0,o.createElement)(_.__experimentalNavigationMenu,null,(0,o.createElement)(_.__experimentalNavigationGroup,{title:(0,h.__)("Editor")},!a&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(er,{icon:Wa,title:(0,h.__)("Site"),item:Ja,params:{postId:null==n?void 0:n.postId,postType:null==n?void 0:n.postType}}),(0,o.createElement)(er,{icon:Un,title:(0,h.__)("Templates"),item:"wp_template",params:{postId:void 0,postType:"wp_template"}})),(0,o.createElement)(er,{icon:Ya,title:(0,h.__)("Template Parts"),item:"wp_template_part",params:{postId:void 0,postType:"wp_template_part"}})))))))};var nr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,o.createElement)(f.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));var lr=function(e){let{icon:t}=e;const{isNavigationOpen:n,isRequestingSiteIcon:l,siteIconUrl:a}=(0,c.useSelect)((e=>{const{getEntityRecord:t,isResolving:n}=e(u.store),l=t("root","__unstableBase",void 0)||{};return{isNavigationOpen:e(Ut).isNavigationOpened(),isRequestingSiteIcon:n("core","getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:l.site_icon_url}}),[]),{setIsNavigationPanelOpened:r}=(0,c.useDispatch)(Ut),i=(0,J.useReducedMotion)(),s=(0,o.useRef)();(0,o.useEffect)((()=>{n||s.current.focus()}),[n]);let d=(0,o.createElement)(_.Icon,{size:"36px",icon:nr});const m={expand:{scale:1.25,transition:{type:"tween",duration:"0.3"}}};a?d=(0,o.createElement)(_.__unstableMotion.img,{variants:!i&&m,alt:(0,h.__)("Site Icon"),className:"edit-site-navigation-toggle__site-icon",src:a}):l?d=null:t&&(d=(0,o.createElement)(_.Icon,{size:"36px",icon:t}));const p=g()({"edit-site-navigation-toggle__button":!0,"has-icon":a});return(0,o.createElement)(_.__unstableMotion.div,{className:"edit-site-navigation-toggle"+(n?" is-open":""),whileHover:"expand"},(0,o.createElement)(_.Button,{className:p,label:(0,h.__)("Toggle navigation"),ref:s,"aria-pressed":n,onClick:()=>r(!n),showTooltip:!0},d))};const{Fill:ar,Slot:rr}=(0,_.createSlotFill)("EditSiteNavigationPanelPreview"),{Fill:or,Slot:ir}=(0,_.createSlotFill)("EditSiteNavigationSidebar");function sr(e){let{isDefaultOpen:t=!1,activeTemplateType:n}=e;const l=(0,J.useViewportMatch)("medium"),{setIsNavigationPanelOpened:a}=(0,c.useDispatch)(Ut);return(0,o.useEffect)((function(){a(t&&l)}),[t,l,a]),(0,o.createElement)(or,null,(0,o.createElement)(lr,null),(0,o.createElement)(tr,{activeItem:n}),(0,o.createElement)(rr,null))}sr.Slot=ir;var cr=sr,ur=window.wp.reusableBlocks;function dr(e){let{clientId:t}=e;const{getBlocks:n}=(0,c.useSelect)(_e.store),{replaceBlocks:l}=(0,c.useDispatch)(_e.store);return(0,c.useSelect)((e=>e(_e.store).canRemoveBlock(t)),[t])?(0,o.createElement)(_e.BlockSettingsMenuControls,null,(e=>{let{onClose:a}=e;return(0,o.createElement)(_.MenuItem,{onClick:()=>{l(t,n(t)),a()}},(0,h.__)("Detach blocks from template part"))})):null}function mr(e){let{closeModal:t,onCreate:n}=e;const[l,a]=(0,o.useState)(""),[r,i]=(0,o.useState)(De),[s,u]=(0,o.useState)(!1),m=(0,J.useInstanceId)(mr),p=(0,c.useSelect)((e=>e(d.store).__experimentalGetDefaultTemplatePartAreas()),[]);return(0,o.createElement)(_.Modal,{title:(0,h.__)("Create a template part"),closeLabel:(0,h.__)("Close"),onRequestClose:t,overlayClassName:"edit-site-create-template-part-modal"},(0,o.createElement)("form",{onSubmit:async e=>{e.preventDefault(),l&&(u(!0),await n({title:l,area:r}))}},(0,o.createElement)(_.TextControl,{label:(0,h.__)("Name"),value:l,onChange:a,required:!0}),(0,o.createElement)(_.BaseControl,{label:(0,h.__)("Area"),id:`edit-site-create-template-part-modal__area-selection-${m}`,className:"edit-site-create-template-part-modal__area-base-control"},(0,o.createElement)(_.__experimentalRadioGroup,{label:(0,h.__)("Area"),className:"edit-site-create-template-part-modal__area-radio-group",id:`edit-site-create-template-part-modal__area-selection-${m}`,onChange:i,checked:r},p.map((e=>{let{icon:t,label:n,area:l,description:a}=e;return(0,o.createElement)(_.__experimentalRadio,{key:n,value:l,className:"edit-site-create-template-part-modal__area-radio"},(0,o.createElement)(_.Flex,{align:"start",justify:"start"},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Icon,{icon:t})),(0,o.createElement)(_.FlexBlock,{className:"edit-site-create-template-part-modal__option-label"},n,(0,o.createElement)("div",null,a)),(0,o.createElement)(_.FlexItem,{className:"edit-site-create-template-part-modal__checkbox"},r===l&&(0,o.createElement)(_.Icon,{icon:E}))))})))),(0,o.createElement)(_.Flex,{className:"edit-site-create-template-part-modal__modal-actions",justify:"flex-end"},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"secondary",onClick:()=>{t()}},(0,h.__)("Cancel"))),(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"primary",type:"submit",disabled:!l,isBusy:s},(0,h.__)("Create"))))))}function pr(e){let{clientIds:t,blocks:n}=e;const[l,a]=(0,o.useState)(!1),{replaceBlocks:r}=(0,c.useDispatch)(_e.store),{saveEntityRecord:s}=(0,c.useDispatch)(u.store),{createSuccessNotice:d}=(0,c.useDispatch)(Ze.store),{canCreate:m}=(0,c.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Ut).getSettings();return{canCreate:!t}}),[]);if(!m)return null;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_e.BlockSettingsMenuControls,null,(()=>(0,o.createElement)(_.MenuItem,{icon:Ya,onClick:()=>{a(!0)}},(0,h.__)("Create Template part")))),l&&(0,o.createElement)(mr,{closeModal:()=>{a(!1)},onCreate:async e=>{let{title:l,area:a}=e;const o=(0,Et.kebabCase)(l).replace(/[^\w-]+/g,"")||"wp-custom-part",c=await s("postType","wp_template_part",{slug:o,title:l,content:(0,i.serialize)(n),area:a});r(t,(0,i.createBlock)("core/template-part",{slug:c.slug,theme:c.theme})),d((0,h.__)("Template part created."),{type:"snackbar"})}}))}function gr(){var e;const{clientIds:t,blocks:n}=(0,c.useSelect)((e=>{const{getSelectedBlockClientIds:t,getBlocksByClientId:n}=e(_e.store),l=t();return{clientIds:l,blocks:n(l)}}),[]);return 1===n.length&&"core/template-part"===(null===(e=n[0])||void 0===e?void 0:e.name)?(0,o.createElement)(dr,{clientId:t[0]}):(0,o.createElement)(pr,{clientIds:t,blocks:n})}var _r=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"}));function hr(e){let{type:t,id:n,activePage:l,onActivePageChange:a}=e;const r=(0,c.useSelect)((e=>t&&n&&"URL"!==t&&e(u.store).getEntityRecord("postType",t,n)),[t,n]),i=(0,o.useMemo)((()=>{if(null==r||!r.link)return null;const e=(0,de.getPathAndQueryString)(r.link);return e===(null==l?void 0:l.path)?null:()=>a({type:t,slug:r.slug,path:e,context:{postType:r.type,postId:r.id}})}),[r,null==l?void 0:l.path,a]);return i&&(0,o.createElement)(_.Button,{icon:_r,label:(0,h.__)("Edit Page Template"),onClick:i})}function fr(e){let{onClick:t=(()=>{})}=e;const{shortcut:n,isBlockInspectorOpen:l}=(0,c.useSelect)((e=>({shortcut:e(jt.store).getShortcutRepresentation("core/edit-site/toggle-block-settings-sidebar"),isBlockInspectorOpen:e(O).getActiveComplementaryArea(Ut.name)===Aa})),[]),{enableComplementaryArea:a,disableComplementaryArea:r}=(0,c.useDispatch)(O),i=l?(0,h.__)("Hide more settings"):(0,h.__)("Show more settings");return(0,o.createElement)(_.MenuItem,{onClick:()=>{l?(r(Oe),(0,Qe.speak)((0,h.__)("Block settings closed"))):(a(Oe,Aa),(0,Qe.speak)((0,h.__)("Additional settings are now available in the Editor block settings sidebar"))),t()},shortcut:n},i)}var Er=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"}));var vr=function(){var e;const t=Me(),n=Pe(),l="wp_template_part"===t.params.postType,a=null===(e=t.state)||void 0===e?void 0:e.fromTemplateId;return l&&a?(0,o.createElement)(_.Button,{className:"edit-site-visual-editor__back-button",icon:Er,onClick:()=>{n.back()}},(0,h.__)("Back")):null};function yr(e){let{direction:t,resizeWidthBy:n}=e;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("button",{className:`resizable-editor__drag-handle is-${t}`,"aria-label":(0,h.__)("Drag to resize"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:l}=e;"left"===t&&l===Kt.LEFT||"right"===t&&l===Kt.RIGHT?n(20):("left"===t&&l===Kt.RIGHT||"right"===t&&l===Kt.LEFT)&&n(-20)}}),(0,o.createElement)(_.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,h.__)("Use left and right arrow keys to resize the canvas.")))}const br="100%",wr="100%",xr={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};var Sr=function(e){let{enableResizing:t,settings:n,children:l,...a}=e;const{deviceType:r,isZoomOutMode:i}=(0,c.useSelect)((e=>({deviceType:e(Ut).__experimentalGetPreviewDeviceType(),isZoomOutMode:"zoom-out"===e(_e.store).__unstableGetEditorMode()})),[]),s=(0,_e.__experimentalUseResizeCanvas)(r),[u,d]=(0,o.useState)(br),[p,g]=(0,o.useState)(wr),h=(0,o.useRef)(),f=(0,_e.__unstableUseMouseMoveTypingReset)(),E=(0,J.useMergeRefs)([h,f]);(0,o.useEffect)((function(){if(!h.current||!t)return;const e=h.current;function n(){g(e.contentDocument.body.scrollHeight)}let l;function a(){var t;null===(t=l)||void 0===t||t.disconnect(),l=new e.contentWindow.ResizeObserver(n),l.observe(e.contentDocument.body),n()}return e.addEventListener("load",a),()=>{var t;null===(t=l)||void 0===t||t.disconnect(),e.removeEventListener("load",a)}}),[t,h.current]);const v=(0,o.useCallback)((e=>{h.current&&d(h.current.offsetWidth+e)}),[]);return(0,o.createElement)(_.ResizableBox,{size:{width:u,height:p},onResizeStop:(e,t,n)=>{d(n.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{right:t,left:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,o.createElement)(yr,{direction:"left",resizeWidthBy:v}),right:(0,o.createElement)(yr,{direction:"right",resizeWidthBy:v})},handleClasses:void 0,handleStyles:{left:xr,right:xr}},(0,o.createElement)(_e.__unstableIframe,m({isZoomedOut:i,style:t?{height:p}:s,head:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_e.__unstableEditorStyles,{styles:n.styles}),(0,o.createElement)("style",null,".is-root-container { display: flow-root; }"),t&&(0,o.createElement)("style",null,"html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }",".is-root-container { min-height: 0 !important; }")),assets:n.__unstableResolvedAssets,ref:E,name:"editor-canvas",className:"edit-site-visual-editor__editor-canvas"},a),n.svgFilters,l))};const kr={type:"default",alignments:[]};function Cr(e){var t,n;let{setIsInserterOpen:l}=e;const{storedSettings:a,templateType:r,templateId:i,page:s}=(0,c.useSelect)((e=>{const{getSettings:t,getEditedPostType:n,getEditedPostId:a,getPage:r}=e(Ut);return{storedSettings:t(l),templateType:n(),templateId:a(),page:r()}}),[l]),d=null!==(t=a.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:a.__experimentalBlockPatterns,p=null!==(n=a.__experimentalAdditionalBlockPatternCategories)&&void 0!==n?n:a.__experimentalBlockPatternCategories,{restBlockPatterns:_,restBlockPatternCategories:h}=(0,c.useSelect)((e=>({restBlockPatterns:e(u.store).getBlockPatterns(),restBlockPatternCategories:e(u.store).getBlockPatternCategories()})),[]),f=(0,o.useMemo)((()=>[...d||[],..._||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name)))).filter((e=>{let{postTypes:t}=e;return!t||Array.isArray(t)&&t.includes(r)}))),[d,_,r]),E=(0,o.useMemo)((()=>[...p||[],...h||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name))))),[p,h]),v=(0,o.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,__experimentalAdditionalBlockPatternCategories:t,...n}=a;return{...n,__experimentalBlockPatterns:f,__experimentalBlockPatternCategories:E}}),[a,f,E]),[y,b,w]=(0,u.useEntityBlockEditor)("postType",r),{setPage:x}=(0,c.useDispatch)(Ut),{enableComplementaryArea:S}=(0,c.useDispatch)(O),k=((0,o.useCallback)((()=>{S("core/edit-site","edit-site/navigation-menu")}),[S]),(0,o.useRef)()),C=(0,J.useMergeRefs)([k,(0,_e.__unstableUseTypingObserver)()]),T=(0,J.useViewportMatch)("small","<"),{clearSelectedBlock:N}=(0,c.useDispatch)(_e.store),I="wp_template_part"===r,M=0!==y.length;let P=o.Fragment;return(0,o.createElement)(_e.BlockEditorProvider,{settings:v,value:y,onInput:b,onChange:w,useSubRegistry:!1},(0,o.createElement)(gr,null),(0,o.createElement)(_e.__experimentalLinkControl.ViewerFill,null,(0,o.useCallback)((e=>(0,o.createElement)(hr,m({},e,{activePage:s,onActivePageChange:x}))),[s])),(0,o.createElement)($a,null,(0,o.createElement)(_e.BlockInspector,null)),(0,o.createElement)(_e.BlockTools,{className:g()("edit-site-visual-editor",{"is-focus-mode":I}),__unstableContentRef:k,onClick:e=>{e.target===e.currentTarget&&N()}},(0,o.createElement)(_e.BlockEditorKeyboardShortcuts.Register,null),(0,o.createElement)(vr,null),(0,o.createElement)(Sr,{key:i,enableResizing:I&&!T,settings:v,contentRef:C},(0,o.createElement)(_e.BlockList,{className:"edit-site-block-editor__block-list wp-site-blocks",__experimentalLayout:kr,renderAppender:(!I||!M)&&void 0})),(0,o.createElement)(_e.__unstableBlockSettingsMenuFirstItem,null,(e=>{let{onClose:t}=e;return(0,o.createElement)(fr,{onClick:t})})),(0,o.createElement)(_e.__unstableBlockToolbarLastItem,null,(0,o.createElement)(_e.__unstableBlockNameContext.Consumer,null,(e=>"core/navigation"===e&&(0,o.createElement)(P,null))))),(0,o.createElement)(ur.ReusableBlocksMenuItems,null))}var Tr=n(773);function Nr(e){let{value:t,onChange:n,onInput:l}=e;const[a,r]=(0,o.useState)(t),[i,s]=(0,o.useState)(!1),c=(0,J.useInstanceId)(Nr),u=(0,o.useRef)();i||a===t||r(t);return(0,o.useEffect)((()=>()=>{u.current&&n(u.current)}),[]),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.VisuallyHidden,{as:"label",htmlFor:`code-editor-text-area-${c}`},(0,h.__)("Type text or HTML")),(0,o.createElement)(Tr.Z,{autoComplete:"off",dir:"auto",value:a,onChange:e=>{const t=e.target.value;l(t),r(t),s(!0),u.current=t},onBlur:()=>{i&&(n(a),s(!1))},className:"edit-site-code-editor-text-area",id:`code-editor-text-area-${c}`,placeholder:(0,h.__)("Start writing with text or HTML")}))}function Ir(){const{templateType:e,shortcut:t}=(0,c.useSelect)((e=>{const{getEditedPostType:t}=e(Ut),{getShortcutRepresentation:n}=e(jt.store);return{templateType:t(),shortcut:n("core/edit-site/toggle-mode")}}),[]),[n,l]=(0,u.useEntityProp)("postType",e,"content"),[a,,r]=(0,u.useEntityBlockEditor)("postType",e);let s;s=n instanceof Function?n({blocks:a}):a?(0,i.__unstableSerializeAndClean)(a):n;const{switchEditorMode:d}=(0,c.useDispatch)(Ut);return(0,o.createElement)("div",{className:"edit-site-code-editor"},(0,o.createElement)("div",{className:"edit-site-code-editor__toolbar"},(0,o.createElement)("h2",null,(0,h.__)("Editing code")),(0,o.createElement)(_.Button,{variant:"tertiary",onClick:()=>d("visual"),shortcut:t},(0,h.__)("Exit code editor"))),(0,o.createElement)("div",{className:"edit-site-code-editor__body"},(0,o.createElement)(Nr,{value:s,onChange:e=>{r((0,i.parse)(e),{selection:void 0})},onInput:l})))}function Mr(e){let{openEntitiesSavedStates:t}=e;const{__experimentalGetDirtyEntityRecords:n,isSavingEntityRecord:l}=(0,c.useSelect)(u.store),{getEditorMode:a}=(0,c.useSelect)(Ut),r=(0,c.useSelect)((e=>e(Ut).isListViewOpened()),[]),o=(0,c.useSelect)((e=>e(O).getActiveComplementaryArea(Ut.name)===Aa),[]),{redo:i,undo:s}=(0,c.useDispatch)(u.store),{setIsListViewOpened:d,switchEditorMode:m}=(0,c.useDispatch)(Ut),{enableComplementaryArea:p,disableComplementaryArea:g}=(0,c.useDispatch)(O);return(0,jt.useShortcut)("core/edit-site/save",(e=>{e.preventDefault();const a=n(),r=!!a.length;!a.some((e=>l(e.kind,e.name,e.key)))&&r&&t()})),(0,jt.useShortcut)("core/edit-site/undo",(e=>{s(),e.preventDefault()})),(0,jt.useShortcut)("core/edit-site/redo",(e=>{i(),e.preventDefault()})),(0,jt.useShortcut)("core/edit-site/toggle-list-view",(()=>{d(!r)})),(0,jt.useShortcut)("core/edit-site/toggle-block-settings-sidebar",(e=>{e.preventDefault(),o?g(Oe):p(Oe,Aa)})),(0,jt.useShortcut)("core/edit-site/toggle-mode",(()=>{m("visual"===a()?"text":"visual")})),null}Mr.Register=function(){const{registerShortcut:e}=(0,c.useDispatch)(jt.store);return(0,o.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,h.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-site/undo",category:"global",description:(0,h.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-site/redo",category:"global",description:(0,h.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/edit-site/toggle-list-view",category:"global",description:(0,h.__)("Open the block list view."),keyCombination:{modifier:"access",character:"o"}}),e({name:"core/edit-site/toggle-block-settings-sidebar",category:"global",description:(0,h.__)("Show or hide the block settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/edit-site/keyboard-shortcuts",category:"main",description:(0,h.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-site/next-region",category:"global",description:(0,h.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-site/previous-region",category:"global",description:(0,h.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"}]}),e({name:"core/edit-site/toggle-mode",category:"global",description:(0,h.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}})}),[e]),null};var Pr=Mr;function zr(){const{setTemplate:e,setTemplatePart:t,setPage:n}=(0,c.useDispatch)(Ut),{params:{postId:l,postType:a}}=Me();return(0,o.useEffect)((()=>{"page"===a||"post"===a?n({context:{postType:a,postId:l}}):"wp_template"===a?e(l):"wp_template_part"===a&&t(l)}),[l,a]),null}var Vr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function Br(){const{setIsInserterOpened:e}=(0,c.useDispatch)(Ut),t=(0,c.useSelect)((e=>e(Ut).__experimentalGetInsertionPoint()),[]),n=(0,J.useViewportMatch)("medium","<"),l=n?"div":_.VisuallyHidden,[a,r]=(0,J.__experimentalUseDialog)({onClose:()=>e(!1),focusOnMount:null}),i=(0,o.useRef)();return(0,o.useEffect)((()=>{i.current.focusSearch()}),[]),(0,o.createElement)("div",m({ref:a},r,{className:"edit-site-editor__inserter-panel"}),(0,o.createElement)(l,{className:"edit-site-editor__inserter-panel-header"},(0,o.createElement)(_.Button,{icon:Vr,label:(0,h.__)("Close block inserter"),onClick:()=>e(!1)})),(0,o.createElement)("div",{className:"edit-site-editor__inserter-panel-content"},(0,o.createElement)(_e.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:n,rootClientId:t.rootClientId,__experimentalInsertionIndex:t.insertionIndex,__experimentalFilterValue:t.filterValue,ref:i})))}function Ar(){const{setIsListViewOpened:e}=(0,c.useDispatch)(Ut),t=(0,J.useFocusOnMount)("firstElement"),n=(0,J.useFocusReturn)(),l=(0,J.useFocusReturn)();const a=`edit-site-editor__list-view-panel-label-${(0,J.useInstanceId)(Ar)}`;return(0,o.createElement)("div",{"aria-labelledby":a,className:"edit-site-editor__list-view-panel",onKeyDown:function(t){t.keyCode!==Kt.ESCAPE||t.defaultPrevented||e(!1)}},(0,o.createElement)("div",{className:"edit-site-editor__list-view-panel-header",ref:n},(0,o.createElement)("strong",{id:a},(0,h.__)("List View")),(0,o.createElement)(_.Button,{icon:w,label:(0,h.__)("Close List View Sidebar"),onClick:()=>e(!1)})),(0,o.createElement)("div",{className:"edit-site-editor__list-view-panel-content",ref:(0,J.useMergeRefs)([l,t])},(0,o.createElement)(_e.__experimentalListView,null)))}function Rr(e){let{text:t,children:n}=e;const l=(0,J.useCopyToClipboard)(t);return(0,o.createElement)(_.Button,{variant:"secondary",ref:l},n)}function Lr(e){let{message:t,error:n,reboot:l,dashboardLink:a}=e;const r=[];return l&&r.push((0,o.createElement)(_.Button,{key:"recovery",onClick:l,variant:"secondary"},(0,h.__)("Attempt Recovery"))),n&&r.push((0,o.createElement)(Rr,{key:"copy-error",text:n.stack},(0,h.__)("Copy Error"))),a&&r.push((0,o.createElement)(_.Button,{key:"back-to-dashboard",variant:"secondary",href:a},(0,h.__)("Back to dashboard"))),(0,o.createElement)(_e.Warning,{className:"editor-error-boundary",actions:r},t)}class Or extends o.Component{constructor(){super(...arguments),this.reboot=this.reboot.bind(this),this.state={error:null}}componentDidCatch(e){(0,me.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}reboot(){this.props.onError()}render(){const{error:e}=this.state;return e?(0,o.createElement)(Lr,{message:(0,h.__)("The editor has encountered an unexpected error."),error:e,reboot:this.reboot}):this.props.children}}function Dr(e){let{nonAnimatedSrc:t,animatedSrc:n}=e;return(0,o.createElement)("picture",{className:"edit-site-welcome-guide__image"},(0,o.createElement)("source",{srcSet:t,media:"(prefers-reduced-motion: reduce)"}),(0,o.createElement)("img",{src:n,width:"312",height:"240",alt:""}))}function Gr(){const{toggle:e}=(0,c.useDispatch)(k.store);return(0,c.useSelect)((e=>!!e(k.store).get("core/edit-site","welcomeGuide")),[])?(0,o.createElement)(_.Guide,{className:"edit-site-welcome-guide",contentLabel:(0,h.__)("Welcome to the site editor"),finishButtonText:(0,h.__)("Get Started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,o.createElement)(Dr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,h.__)("Edit your site")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,h.__)("Design everything on your site — from the header right down to the footer — using blocks.")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,o.createInterpolateElement)((0,h.__)("Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,o.createElement)("img",{alt:(0,h.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})))}]}):null}function Fr(){const{toggle:e}=(0,c.useDispatch)(k.store),{isActive:t,isStylesOpen:n}=(0,c.useSelect)((e=>{const t=e(O).getActiveComplementaryArea(Ut.name);return{isActive:!!e(k.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);return t&&n?(0,o.createElement)(_.Guide,{className:"edit-site-welcome-guide",contentLabel:(0,h.__)("Welcome to styles"),finishButtonText:(0,h.__)("Get Started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,o.createElement)(Dr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,h.__)("Welcome to Styles")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,h.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")))},{image:(0,o.createElement)(Dr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,h.__)("Set the design")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,h.__)("You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ")))},{image:(0,o.createElement)(Dr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,h.__)("Personalize blocks")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,h.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")))},{image:(0,o.createElement)(Dr,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,h.__)("Learn more")),(0,o.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,h.__)("New to block themes and styling your site? "),(0,o.createElement)(_.ExternalLink,{href:(0,h.__)("https://wordpress.org/support/article/styles-overview/")},(0,h.__)("Here’s a detailed guide to learn how to make the most of it."))))}]}):null}function Hr(){return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Gr,null),(0,o.createElement)(Fr,null))}function $r(){return function(){const[e,t,n]=$l(),{getSettings:l}=(0,c.useSelect)(Ut),{updateSettings:a}=(0,c.useDispatch)(Ut);(0,o.useEffect)((()=>{if(!e||!t)return;const r=l(),o=(0,Et.filter)(r.styles,(e=>!e.isGlobalStyles));a({...r,styles:[...o,...e],svgFilters:n,__experimentalFeatures:t})}),[e,t])}(),null}function Ur(e){const t=Me(),n=(0,c.useSelect)((e=>{var t;return null===(t=e(u.store).getEntityRecord("root","site"))||void 0===t?void 0:t.title}),[]),l=(0,o.useRef)(!0);(0,o.useEffect)((()=>{l.current=!1}),[t]),(0,o.useEffect)((()=>{if(!l.current&&e&&n){const t=(0,h.sprintf)((0,h.__)("%1$s ‹ %2$s — WordPress"),(0,ja.decodeEntities)(e),(0,ja.decodeEntities)(n));document.title=t,(0,Qe.speak)((0,h.sprintf)((0,h.__)("Now displaying: %s"),document.title),"assertive")}}),[e,n,t])}const jr={header:(0,h.__)("Editor top bar"),body:(0,h.__)("Editor content"),sidebar:(0,h.__)("Editor settings"),actions:(0,h.__)("Editor publish"),footer:(0,h.__)("Editor footer"),drawer:(0,h.__)("Navigation Sidebar")};var Wr=function(e){let{onError:t}=e;const{isInserterOpen:n,isListViewOpen:l,sidebarIsOpened:a,settings:r,entityId:i,templateType:s,page:m,template:p,templateResolved:g,isNavigationOpen:f,previousShortcut:E,nextShortcut:v,editorMode:y,showIconLabels:b,blockEditorMode:w}=(0,c.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:n,getSettings:l,getEditedPostType:a,getEditedPostId:r,getPage:o,isNavigationOpened:i,getEditorMode:s}=e(Ut),{hasFinishedResolution:c,getEntityRecord:d}=e(u.store),{__unstableGetEditorMode:m}=e(_e.store),p=a(),g=r();return{isInserterOpen:t(),isListViewOpen:n(),sidebarIsOpened:!!e(O).getActiveComplementaryArea(Ut.name),settings:l(),templateType:p,page:o(),template:g?d("postType",p,g):null,templateResolved:!!g&&c("getEntityRecord",["postType",p,g]),entityId:g,isNavigationOpen:i(),previousShortcut:e(jt.store).getAllShortcutKeyCombinations("core/edit-site/previous-region"),nextShortcut:e(jt.store).getAllShortcutKeyCombinations("core/edit-site/next-region"),editorMode:s(),showIconLabels:e(k.store).get("core/edit-site","showIconLabels"),blockEditorMode:m()}}),[]),{setPage:x,setIsInserterOpened:S}=(0,c.useDispatch)(Ut),{enableComplementaryArea:C}=(0,c.useDispatch)(O),[T,N]=(0,o.useState)(!1),I=(0,o.useCallback)((()=>N(!0)),[]),M=(0,o.useCallback)((()=>{N(!1)}),[]),P=(0,o.useMemo)((()=>({...null==m?void 0:m.context,queryContext:[(null==m?void 0:m.context.queryContext)||{page:1},e=>x({...m,context:{...null==m?void 0:m.context,queryContext:{...null==m?void 0:m.context.queryContext,...e}}})]})),[null==m?void 0:m.context]);(0,o.useEffect)((()=>{f?document.body.classList.add("is-navigation-sidebar-open"):document.body.classList.remove("is-navigation-sidebar-open")}),[f]),(0,o.useEffect)((function(){"open"===new URLSearchParams(window.location.search).get("styles")&&C("core/edit-site","edit-site/global-styles")}),[C]);const z=(null==r?void 0:r.siteUrl)&&void 0!==s&&void 0!==i,V=l?(0,h.__)("List View"):(0,h.__)("Block Library");return Ur(z&&(0,h.__)("Editor (beta)")),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(zr,null),z&&(0,o.createElement)(jt.ShortcutProvider,null,(0,o.createElement)(u.EntityProvider,{kind:"root",type:"site"},(0,o.createElement)(u.EntityProvider,{kind:"postType",type:s,id:i},(0,o.createElement)(Ta,null,(0,o.createElement)(_e.BlockContextProvider,{value:P},(0,o.createElement)($r,null),(0,o.createElement)(Or,{onError:t},(0,o.createElement)(Pr.Register,null),(0,o.createElement)(Ua,null),(0,o.createElement)(ee,{labels:{...jr,secondarySidebar:V},className:b&&"show-icon-labels",secondarySidebar:"visual"===y&&n?(0,o.createElement)(Br,null):"visual"===y&&l?(0,o.createElement)(Ar,null):null,sidebar:a&&(0,o.createElement)(Q.Slot,{scope:"core/edit-site"}),drawer:(0,o.createElement)(cr.Slot,null),header:(0,o.createElement)(An,{openEntitiesSavedStates:I,showIconLabels:b}),notices:(0,o.createElement)(d.EditorSnackbars,null),content:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(d.EditorNotices,null),(0,o.createElement)(_e.BlockStyles.Slot,{scope:"core/block-inspector"}),"visual"===y&&p&&(0,o.createElement)(Cr,{setIsInserterOpen:S}),"text"===y&&p&&(0,o.createElement)(Ir,null),g&&!p&&(null==r?void 0:r.siteUrl)&&i&&(0,o.createElement)(_.Notice,{status:"warning",isDismissible:!1},(0,h.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")),(0,o.createElement)(Pr,{openEntitiesSavedStates:I})),actions:(0,o.createElement)(o.Fragment,null,T?(0,o.createElement)(d.EntitiesSavedStates,{close:M}):(0,o.createElement)("div",{className:"edit-site-editor__toggle-save-panel"},(0,o.createElement)(_.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:I,"aria-expanded":!1},(0,h.__)("Open save panel")))),footer:"zoom-out"!==w?(0,o.createElement)(_e.BlockBreadcrumb,{rootLabelText:(0,h.__)("Template")}):void 0,shortcuts:{previous:E,next:v}}),(0,o.createElement)(Hr,null),(0,o.createElement)(_.Popover.Slot,null))))))))};var Yr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"}));var qr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"}));var Xr=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z"}));var Kr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"}));var Zr=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"}));var Qr=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"}));var Jr=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"}));var eo=(0,o.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)(f.Path,{d:"M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",fillRule:"evenodd",clipRule:"evenodd"}));var to=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{fillRule:"evenodd",d:"M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",clipRule:"evenodd"}));var no=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z"}),(0,o.createElement)(f.Path,{d:"M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"}));var lo=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z"}));const ao=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z"}));const ro=()=>(0,c.useSelect)((e=>e(u.store).getEntityRecords("postType","wp_template",{per_page:-1})),[]),oo=()=>(0,c.useSelect)((e=>e(d.store).__experimentalGetDefaultTemplateTypes()),[]),io=()=>{const e=(0,c.useSelect)((e=>e(u.store).getPostTypes({per_page:-1})),[]);return(0,o.useMemo)((()=>{const t=["attachment"];return null==e?void 0:e.filter((e=>{let{viewable:n,slug:l}=e;return n&&!t.includes(l)}))}),[e])};function so(e){const t=(0,o.useMemo)((()=>null==e?void 0:e.reduce(((e,t)=>{let{labels:n}=t;const l=n.singular_name.toLowerCase();return e[l]=(e[l]||0)+1,e}),{})));return(0,o.useCallback)((e=>{let{labels:n,slug:l}=e;const a=n.singular_name.toLowerCase();return t[a]>1&&a!==l}),[t])}function co(){const e=io(),t=(0,o.useMemo)((()=>null==e?void 0:e.filter((e=>e.has_archive))),[e]),n=ro(),l=so(t);return(0,o.useMemo)((()=>(null==t?void 0:t.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{var t;let n;return n=l(e)?(0,h.sprintf)((0,h.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,h.sprintf)((0,h.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,h.sprintf)((0,h.__)("Displays an archive with the latests posts of type: %s."),e.labels.singular_name),title:n,icon:null!==(t=e.icon)&&void 0!==t&&t.startsWith("dashicons-")?e.icon.slice(10):Xr,templatePrefix:"archive"}})))||[]),[t,n,l])}const uo=e=>{const t=(()=>{const e=(0,c.useSelect)((e=>e(u.store).getTaxonomies({per_page:-1})),[]);return(0,o.useMemo)((()=>null==e?void 0:e.filter((e=>{let{visibility:t}=e;return null==t?void 0:t.publicly_queryable}))),[e])})(),n=ro(),l=oo(),a=(0,o.useMemo)((()=>null==t?void 0:t.reduce(((e,t)=>{let{slug:n}=t,l=n;return["category","post_tag"].includes(n)||(l=`taxonomy-${l}`),"post_tag"===n&&(l="tag"),e[n]=l,e}),{})),[t]),r=null==t?void 0:t.reduce(((e,t)=>{let{labels:n}=t;const l=n.singular_name.toLowerCase();return e[l]=(e[l]||0)+1,e}),{}),i=ho("taxonomy",a),s=(n||[]).map((e=>{let{slug:t}=e;return t})),d=(t||[]).reduce(((t,n)=>{var o;const{slug:c,labels:u}=n,d=a[c],m=null==l?void 0:l.find((e=>{let{slug:t}=e;return t===d})),p=null==s?void 0:s.includes(d),g=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=e.singular_name.toLowerCase();return r[n]>1&&n!==t})(u,c);let _=u.singular_name;g&&(_=(0,h.sprintf)((0,h.__)("%1$s (%2$s)"),u.singular_name,c));const f=m?{...m,templatePrefix:a[c]}:{slug:d,title:_,description:(0,h.sprintf)((0,h.__)("Displays taxonomy: %s."),u.singular_name),icon:to,templatePrefix:a[c]},E=null==i||null===(o=i[c])||void 0===o?void 0:o.hasEntities;return E&&(f.onClick=t=>{e({type:"taxonomy",slug:c,config:{queryArgs:e=>{let{search:t}=e;return{_fields:"id,name,slug,link",orderBy:t?"name":"count",exclude:i[c].existingEntitiesIds}},getSpecificTemplate:e=>{const t=`${a[c]}-${e.slug}`;return{title:t,slug:t,templatePrefix:a[c]}}},labels:u,hasGeneralTemplate:p,template:t})}),p&&!E||t.push(f),t}),[]);return(0,o.useMemo)((()=>d.reduce(((e,t)=>{const{slug:n}=t;let l="taxonomiesMenuItems";return["category","tag"].includes(n)&&(l="defaultTaxonomiesMenuItems"),e[l].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[d])},mo={user:"author"},po={user:{who:"authors"}};const go=e=>{const t=ro();return(0,o.useMemo)((()=>Object.entries(e||{}).reduce(((e,n)=>{let[l,a]=n;const r=(t||[]).reduce(((e,t)=>{const n=`${a}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return r.length&&(e[l]=r),e}),{})),[e,t])},_o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const l=go(t),a=(0,c.useSelect)((t=>Object.entries(l||{}).reduce(((l,a)=>{let[r,o]=a;const i=t(u.store).getEntityRecords(e,r,{_fields:"id",context:"view",slug:o,...n[r]});return null!=i&&i.length&&(l[r]=i),l}),{})),[l]);return a},ho=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const l=_o(e,t,n),a=(0,c.useSelect)((a=>Object.keys(t||{}).reduce(((t,r)=>{var o,i;const s=(null==l||null===(o=l[r])||void 0===o?void 0:o.map((e=>{let{id:t}=e;return t})))||[];return t[r]={hasEntities:!(null===(i=a(u.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:s,...n[r]}))||void 0===i||!i.length),existingEntitiesIds:s},t}),{})),[t,l]);return a},fo=[];function Eo(e){let{suggestion:t,search:n,onSelect:l,entityForSuggestions:a,composite:r}=e;const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,o.createElement)(_.__unstableCompositeItem,m({role:"option",as:_.Button},r,{className:i,onClick:()=>l(a.config.getSpecificTemplate(t))}),(0,o.createElement)("span",{className:`${i}__title`},(0,o.createElement)(_.TextHighlight,{text:t.name,highlight:n})),t.link&&(0,o.createElement)("span",{className:`${i}__info`},t.link))}function vo(e,t){const{config:n}=e,l=(0,o.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:a,hasResolved:r}=(0,u.useEntityRecords)(e.type,e.slug,l),[i,s]=(0,o.useState)(fo);return(0,o.useEffect)((()=>{if(!r)return;let e=fo;var t,l;null!=a&&a.length&&(e=a,n.recordNamePath&&(t=e,l=n.recordNamePath,e=(t||[]).map((e=>({...e,name:(0,ja.decodeEntities)((0,Et.get)(e,l))}))))),s(e)}),[a,r]),i}function yo(e){let{entityForSuggestions:t,onSelect:n}=e;const l=(0,_.__unstableUseCompositeState)({orientation:"vertical"}),[a,r,i]=function(){const[e,t]=(0,o.useState)(""),[n,l]=(0,o.useState)(""),a=(0,J.useDebounce)(l,250);return(0,o.useEffect)((()=>{n!==e&&a(e)}),[n,e]),[e,t,n]}(),s=vo(t,i),{labels:c}=t,[u,d]=(0,o.useState)(!1);return!u&&(null==s?void 0:s.length)>9&&d(!0),(0,o.createElement)(o.Fragment,null,u&&(0,o.createElement)(_.SearchControl,{onChange:r,value:a,label:c.search_items,placeholder:c.search_items}),!(null==s||!s.length)&&(0,o.createElement)(_.__unstableComposite,m({},l,{role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,h.__)("Suggestions list")}),s.map((e=>(0,o.createElement)(Eo,{key:e.slug,suggestion:e,search:i,onSelect:n,entityForSuggestions:t,composite:l})))),i&&!(null!=s&&s.length)&&(0,o.createElement)("p",{className:"edit-site-custom-template-modal__no-results"},c.not_found))}var bo=function(e){let{onClose:t,onSelect:n,entityForSuggestions:l}=e;const[a,r]=(0,o.useState)(l.hasGeneralTemplate),i="edit-site-custom-template-modal";return(0,o.createElement)(_.Modal,{title:(0,h.sprintf)((0,h.__)("Add template: %s"),l.labels.singular_name),className:i,closeLabel:(0,h.__)("Close"),onRequestClose:t},!a&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)("p",null,(0,h.__)("Select whether to create a single template for all items or a specific one.")),(0,o.createElement)(_.Flex,{className:`${i}__contents`,gap:"4",align:"initial"},(0,o.createElement)(_.FlexItem,{isBlock:!0,as:_.Button,onClick:()=>{const{slug:e,title:t,description:a,templatePrefix:r}=l.template;n({slug:e,title:t,description:a,templatePrefix:r})}},(0,o.createElement)(_.__experimentalText,{as:"span",weight:600},l.labels.all_items),(0,o.createElement)(_.__experimentalText,{as:"span"},(0,h.__)("For all items"))),(0,o.createElement)(_.FlexItem,{isBlock:!0,as:_.Button,onClick:()=>{r(!0)}},(0,o.createElement)(_.__experimentalText,{as:"span",weight:600},l.labels.singular_name),(0,o.createElement)(_.__experimentalText,{as:"span"},(0,h.__)("For a specific item"))))),a&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)("p",null,(0,h.__)("This template will be used only for the specific item chosen.")),(0,o.createElement)(yo,{entityForSuggestions:l,onSelect:n})))};var wo=function(e){let{onClose:t,createTemplate:n}=e;const[l,a]=(0,o.useState)(""),r=(0,h.__)("Custom Template"),[i,s]=(0,o.useState)(!1);return(0,o.createElement)(_.Modal,{title:(0,h.__)("Create custom template"),closeLabel:(0,h.__)("Close"),onRequestClose:()=>{t()},overlayClassName:"edit-site-custom-generic-template__modal"},(0,o.createElement)("form",{onSubmit:async function(e){e.preventDefault(),i||(s(!0),n({slug:"wp-custom-template-"+(0,Et.kebabCase)(l||r),title:l||r},!1))}},(0,o.createElement)(_.Flex,{align:"flex-start",gap:8},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.TextControl,{label:(0,h.__)("Name"),value:l,onChange:a,placeholder:r,disabled:i,help:(0,h.__)('Describe the template, e.g. "Post with sidebar".')}))),(0,o.createElement)(_.Flex,{className:"edit-site-custom-generic-template__modal-actions",justify:"flex-end",expanded:!1},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"tertiary",onClick:()=>{t()}},(0,h.__)("Cancel"))),(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"primary",type:"submit",isBusy:i,"aria-disabled":i},(0,h.__)("Create"))))))};const xo=["front-page","single","page","index","archive","author","category","date","tag","taxonomy","search","404"],So={"front-page":Wa,single:Yr,page:qr,archive:Xr,search:Kr,404:Zr,index:Qr,category:Jr,author:eo,taxonomy:to,date:no,tag:lo,attachment:ao};function ko(e){let{postType:t}=e;const[n,l]=(0,o.useState)(!1),[a,r]=(0,o.useState)(!1),[i,s]=(0,o.useState)({}),d=Pe(),{saveEntityRecord:m}=(0,c.useDispatch)(u.store),{createErrorNotice:p,createSuccessNotice:g}=(0,c.useDispatch)(Ze.store),{setTemplate:f}=(0,c.useDispatch)(Ut);async function E(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{const{title:n,description:l,slug:a,templatePrefix:r}=e;let o=e.content;if(!o){o=(await Ke()({path:(0,de.addQueryArgs)("/wp/v2/templates/lookup",{slug:a,is_custom:!t,template_prefix:r})})).content.raw}const i=await m("postType","wp_template",{description:l,slug:a.toString(),status:"publish",title:n,content:o,is_wp_suggestion:t},{throwOnError:!0});f(i.id,i.slug),d.push({postId:i.id,postType:i.type}),g((0,h.sprintf)((0,h.__)('"%s" successfully created.'),n),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("An error occurred while creating the template.");p(t,{type:"snackbar"})}}const v=function(e,t){const n=ro(),l=oo(),a=(n||[]).map((e=>{let{slug:t}=e;return t})),r=(l||[]).filter((e=>xo.includes(e.slug)&&!a.includes(e.slug))),i=n=>{t(!0),e(n)},s=[...r],{defaultTaxonomiesMenuItems:c,taxonomiesMenuItems:u}=uo(i),{defaultPostTypesMenuItems:d,postTypesMenuItems:m}=(e=>{const t=io(),n=ro(),l=oo(),a=so(t),r=(0,o.useMemo)((()=>null==t?void 0:t.reduce(((e,t)=>{let{slug:n}=t,l=n;return"page"!==n&&(l=`single-${l}`),e[n]=l,e}),{})),[t]),i=ho("postType",r),s=(n||[]).map((e=>{let{slug:t}=e;return t})),c=(t||[]).reduce(((t,n)=>{var o;const{slug:c,labels:u,icon:d}=n,m=r[c],p=null==l?void 0:l.find((e=>{let{slug:t}=e;return t===m})),g=null==s?void 0:s.includes(m),_=a(n);let f=(0,h.sprintf)((0,h.__)("Single item: %s"),u.singular_name);_&&(f=(0,h.sprintf)((0,h.__)("Single item: %1$s (%2$s)"),u.singular_name,c));const E=p?{...p,templatePrefix:r[c]}:{slug:m,title:f,description:(0,h.sprintf)((0,h.__)("Displays a single item: %s."),u.singular_name),icon:null!=d&&d.startsWith("dashicons-")?d.slice(10):Yr,templatePrefix:r[c]},v=null==i||null===(o=i[c])||void 0===o?void 0:o.hasEntities;return v&&(E.onClick=t=>{e({type:"postType",slug:c,config:{recordNamePath:"title.rendered",queryArgs:e=>{let{search:t}=e;return{_fields:"id,title,slug,link",orderBy:t?"relevance":"modified",exclude:i[c].existingEntitiesIds}},getSpecificTemplate:e=>{const t=`${r[c]}-${e.slug}`;return{title:t,slug:t,templatePrefix:r[c]}}},labels:u,hasGeneralTemplate:g,template:t})}),g&&!v||t.push(E),t}),[]);return(0,o.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let l="postTypesMenuItems";return"page"===n&&(l="defaultPostTypesMenuItems"),e[l].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c])})(i),p=function(e){var t,n;const l=ro(),a=oo(),r=ho("root",mo,po);let o=null==a?void 0:a.find((e=>{let{slug:t}=e;return"author"===t}));o||(o={description:(0,h.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const i=!(null==l||!l.find((e=>{let{slug:t}=e;return"author"===t})));if(null!==(t=r.user)&&void 0!==t&&t.hasEntities&&(o={...o,templatePrefix:"author"},o.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:e=>{let{search:t}=e;return{_fields:"id,name,slug,link",orderBy:t?"name":"registered_date",exclude:r.user.existingEntitiesIds,who:"authors"}},getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,h.__)("Author"),search_items:(0,h.__)("Search Authors"),not_found:(0,h.__)("No authors found."),all_items:(0,h.__)("All Authors")},hasGeneralTemplate:i,template:t})}),!i||null!==(n=r.user)&&void 0!==n&&n.hasEntities)return o}(i);[...c,...d,p].forEach((e=>{if(!e)return;const t=s.findIndex((t=>t.slug===e.slug));t>-1?s[t]=e:s.push(e)})),null==s||s.sort(((e,t)=>xo.indexOf(e.slug)-xo.indexOf(t.slug)));return[...s,...co(),...m,...u]}(s,l);return v.length?(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.DropdownMenu,{className:"edit-site-new-template-dropdown",icon:null,text:t.labels.add_new,label:t.labels.add_new_item,popoverProps:{noArrow:!1},toggleProps:{variant:"primary"}},(()=>(0,o.createElement)(_.NavigableMenu,{className:"edit-site-new-template-dropdown__popover"},(0,o.createElement)(_.MenuGroup,{label:t.labels.add_new_item},v.map((e=>{const{title:t,description:n,slug:l,onClick:a,icon:r}=e;return(0,o.createElement)(_.MenuItem,{icon:r||So[l]||Yr,iconPosition:"left",info:n,key:l,onClick:()=>a?a(e):E(e)},t)}))),(0,o.createElement)(_.MenuGroup,null,(0,o.createElement)(_.MenuItem,{icon:Un,iconPosition:"left",info:(0,h.__)("Custom templates can be applied to any post or page."),key:"custom-template",onClick:()=>r(!0)},(0,h.__)("Custom template")))))),n&&(0,o.createElement)(bo,{onClose:()=>l(!1),onSelect:E,entityForSuggestions:i}),a&&(0,o.createElement)(wo,{onClose:()=>r(!1),createTemplate:E})):null}function Co(e){let{postType:t}=e;const n=Pe(),[l,a]=(0,o.useState)(!1),{createErrorNotice:r}=(0,c.useDispatch)(Ze.store),{saveEntityRecord:i}=(0,c.useDispatch)(u.store);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.Button,{variant:"primary",onClick:()=>{a(!0)}},t.labels.add_new),l&&(0,o.createElement)(mr,{closeModal:()=>a(!1),onCreate:async function(e){let{title:t,area:l}=e;if(t)try{const e=(0,Et.kebabCase)(t).replace(/[^\w-]+/g,"")||"wp-custom-part",r=await i("postType","wp_template_part",{slug:e,title:t,content:"",area:l},{throwOnError:!0});a(!1),n.push({postId:r.id,postType:r.type})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("An error occurred while creating the template part.");r(t,{type:"snackbar"}),a(!1)}else r((0,h.__)("Title is not defined."),{type:"snackbar"})}}))}function To(e){let{templateType:t="wp_template"}=e;const n=(0,c.useSelect)((e=>e(u.store).getPostType(t)),[t]);return n?"wp_template"===t?(0,o.createElement)(ko,{postType:n}):"wp_template_part"===t?(0,o.createElement)(Co,{postType:n}):null:null}function No(e){var t;let{templateType:n}=e;const{canCreate:l,postType:a}=(0,c.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Ut).getSettings();return{postType:e(u.store).getPostType(n),canCreate:!t}}),[n]);return a?(0,o.createElement)("header",{className:"edit-site-list-header"},(0,o.createElement)(_.__experimentalHeading,{level:1,className:"edit-site-list-header__title"},null===(t=a.labels)||void 0===t?void 0:t.name),l&&(0,o.createElement)("div",{className:"edit-site-list-header__right"},(0,o.createElement)(To,{templateType:n}))):null}function Io(e){let{template:t,onClose:n}=e;const[l,a]=(0,o.useState)((()=>t.title.rendered)),[r,i]=(0,o.useState)(!1),{editEntityRecord:s,saveEditedEntityRecord:d}=(0,c.useDispatch)(u.store),{createSuccessNotice:m,createErrorNotice:p}=(0,c.useDispatch)(Ze.store);if(!t.is_custom)return null;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(_.MenuItem,{onClick:()=>{i(!0),a(t.title.rendered)}},(0,h.__)("Rename")),r&&(0,o.createElement)(_.Modal,{title:(0,h.__)("Rename"),closeLabel:(0,h.__)("Close"),onRequestClose:()=>{i(!1)},overlayClassName:"edit-site-list__rename-modal"},(0,o.createElement)("form",{onSubmit:async function(e){e.preventDefault();try{await s("postType",t.type,t.id,{title:l}),a(""),i(!1),n(),await d("postType",t.type,t.id,{throwOnError:!0}),m((0,h.__)("Entity renamed."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("An error occurred while renaming the entity.");p(t,{type:"snackbar"})}}},(0,o.createElement)(_.Flex,{align:"flex-start",gap:8},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.TextControl,{label:(0,h.__)("Name"),value:l,onChange:a,required:!0}))),(0,o.createElement)(_.Flex,{className:"edit-site-list__rename-modal-actions",justify:"flex-end",expanded:!1},(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"tertiary",onClick:()=>{i(!1)}},(0,h.__)("Cancel"))),(0,o.createElement)(_.FlexItem,null,(0,o.createElement)(_.Button,{variant:"primary",type:"submit"},(0,h.__)("Save")))))))}function Mo(e){let{template:t}=e;const{removeTemplate:n,revertTemplate:l}=(0,c.useDispatch)(Ut),{saveEditedEntityRecord:a}=(0,c.useDispatch)(u.store),{createSuccessNotice:r,createErrorNotice:i}=(0,c.useDispatch)(Ze.store),s=function(e){return!!e&&"custom"===e.source&&!e.has_theme_file}(t),d=Je(t);if(!s&&!d)return null;return(0,o.createElement)(_.DropdownMenu,{icon:te,label:(0,h.__)("Actions"),className:"edit-site-list-table__actions"},(e=>{let{onClose:c}=e;return(0,o.createElement)(_.MenuGroup,null,s&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Io,{template:t,onClose:c}),(0,o.createElement)(_.MenuItem,{isDestructive:!0,isTertiary:!0,onClick:()=>{n(t),c()}},(0,h.__)("Delete"))),d&&(0,o.createElement)(_.MenuItem,{info:(0,h.__)("Use the template as supplied by the theme."),onClick:()=>{!async function(){try{await l(t,{allowUndo:!1}),await a("postType",t.type,t.id),r((0,h.__)("Entity reverted."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,h.__)("An error occurred while reverting the entity.");i(t,{type:"snackbar"})}}(),c()}},(0,h.__)("Clear customizations")))}))}var Po=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"}));var zo=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"}));var Vo=(0,o.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(f.Path,{d:"M12 3.3c-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.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"}));const Bo=["wp_template","wp_template_part"];function Ao(e){let{isCustomized:t,children:n}=e;return t?(0,o.createElement)(_.Tooltip,{text:(0,h.__)("This template has been customized")},n):n}function Ro(e){let{text:t,icon:n,imageUrl:l,isCustomized:a}=e;const[r,i]=(0,o.useState)(!1);return(0,o.createElement)(_.__experimentalHStack,{alignment:"left"},(0,o.createElement)(Ao,{isCustomized:a},l?(0,o.createElement)("div",{className:g()("edit-site-list-added-by__avatar",{"is-loaded":r})},(0,o.createElement)("img",{onLoad:()=>i(!0),alt:"",src:l})):(0,o.createElement)("div",{className:g()("edit-site-list-added-by__icon",{"is-customized":a})},(0,o.createElement)(_.Icon,{icon:n}))),(0,o.createElement)("span",null,t))}function Lo(e){var t;let{slug:n,isCustomized:l}=e;const a=(0,c.useSelect)((e=>e(u.store).getTheme(n)),[n]);return(0,o.createElement)(Ro,{icon:Un,text:(null==a||null===(t=a.name)||void 0===t?void 0:t.rendered)||n,isCustomized:l})}function Oo(e){let{slug:t,isCustomized:n}=e;const l=(0,c.useSelect)((e=>e(u.store).getPlugin(t)),[t]);return(0,o.createElement)(Ro,{icon:Po,text:(null==l?void 0:l.name)||t,isCustomized:n})}function Do(e){var t;let{id:n}=e;const l=(0,c.useSelect)((e=>e(u.store).getUser(n)),[n]);return(0,o.createElement)(Ro,{icon:zo,imageUrl:null==l||null===(t=l.avatar_urls)||void 0===t?void 0:t[48],text:null==l?void 0:l.nickname})}function Go(){const{name:e,logoURL:t}=(0,c.useSelect)((e=>{var t;const{getEntityRecord:n,getMedia:l}=e(u.store),a=n("root","__unstableBase");return{name:null==a?void 0:a.name,logoURL:null!=a&&a.site_logo?null===(t=l(a.site_logo))||void 0===t?void 0:t.source_url:void 0}}),[]);return(0,o.createElement)(Ro,{icon:Vo,imageUrl:t,text:e})}function Fo(e){let{templateType:t,template:n}=e;if(n){if(Bo.includes(t)){if(n.has_theme_file&&("theme"===n.origin||!n.origin&&["theme","custom"].includes(n.source)))return(0,o.createElement)(Lo,{slug:n.theme,isCustomized:"custom"===n.source});if(n.has_theme_file&&"plugin"===n.origin)return(0,o.createElement)(Oo,{slug:n.theme,isCustomized:"custom"===n.source});if(!n.has_theme_file&&"custom"===n.source&&!n.author)return(0,o.createElement)(Go,null)}return(0,o.createElement)(Do,{id:n.author})}}function Ho(e){let{templateType:t}=e;const{records:n,isResolving:l}=(0,u.useEntityRecords)("postType",t,{per_page:-1}),a=(0,c.useSelect)((e=>e(u.store).getPostType(t)),[t]);return!n||l?null:n.length?(0,o.createElement)("table",{className:"edit-site-list-table",role:"table"},(0,o.createElement)("thead",null,(0,o.createElement)("tr",{className:"edit-site-list-table-head",role:"row"},(0,o.createElement)("th",{className:"edit-site-list-table-column",role:"columnheader"},(0,h.__)("Template")),(0,o.createElement)("th",{className:"edit-site-list-table-column",role:"columnheader"},(0,h.__)("Added by")),(0,o.createElement)("th",{className:"edit-site-list-table-column",role:"columnheader"},(0,o.createElement)(_.VisuallyHidden,null,(0,h.__)("Actions"))))),(0,o.createElement)("tbody",null,n.map((e=>{var n;return(0,o.createElement)("tr",{key:e.id,className:"edit-site-list-table-row",role:"row"},(0,o.createElement)("td",{className:"edit-site-list-table-column",role:"cell"},(0,o.createElement)(_.__experimentalHeading,{level:4},(0,o.createElement)(Ae,{params:{postId:e.id,postType:e.type}},(0,ja.decodeEntities)((null===(n=e.title)||void 0===n?void 0:n.rendered)||e.slug))),e.description),(0,o.createElement)("td",{className:"edit-site-list-table-column",role:"cell"},(0,o.createElement)(Fo,{templateType:t,template:e})),(0,o.createElement)("td",{className:"edit-site-list-table-column",role:"cell"},(0,o.createElement)(Mo,{template:e})))})))):(0,o.createElement)("div",null,(0,h.sprintf)((0,h.__)("No %s found."),null==a||null===(r=a.labels)||void 0===r||null===(i=r.name)||void 0===i?void 0:i.toLowerCase()));var r,i}function $o(){var e,t;const{params:{postType:n}}=Me();!function(){const{registerShortcut:e}=(0,c.useDispatch)(jt.store);(0,o.useEffect)((()=>{e({name:"core/edit-site/next-region",category:"global",description:(0,h.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-site/previous-region",category:"global",description:(0,h.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"}]})}),[])}();const{previousShortcut:l,nextShortcut:a,isNavigationOpen:r}=(0,c.useSelect)((e=>({previousShortcut:e(jt.store).getAllShortcutKeyCombinations("core/edit-site/previous-region"),nextShortcut:e(jt.store).getAllShortcutKeyCombinations("core/edit-site/next-region"),isNavigationOpen:e(Ut).isNavigationOpened()})),[]),i=(0,c.useSelect)((e=>e(u.store).getPostType(n)),[n]);Ur(null==i||null===(e=i.labels)||void 0===e?void 0:e.name);const s=null==i||null===(t=i.labels)||void 0===t?void 0:t.items_list,m=i?{header:(0,h.sprintf)((0,h.__)("%s - Header"),s),body:(0,h.sprintf)((0,h.__)("%s - Content"),s)}:void 0;return(0,o.createElement)(ee,{className:g()("edit-site-list",{"is-navigation-open":r}),labels:{drawer:(0,h.__)("Navigation Sidebar"),...m},header:(0,o.createElement)(No,{templateType:n}),drawer:(0,o.createElement)(cr.Slot,null),notices:(0,o.createElement)(d.EditorSnackbars,null),content:(0,o.createElement)(Ho,{templateType:n}),shortcuts:{previous:l,next:a}})}function Uo(e){let{postId:t,postType:n}=e;return!(t||!n)}function jo(e){let{reboot:t}=e;const{createErrorNotice:n}=(0,c.useDispatch)(Ze.store);function l(e){n((0,h.sprintf)((0,h.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}return(0,o.createElement)(_.SlotFillProvider,null,(0,o.createElement)(d.UnsavedChangesWarning,null),(0,o.createElement)(Ve,null,(e=>{let{params:n}=e;const a=Uo(n);return(0,o.createElement)(o.Fragment,null,a?(0,o.createElement)($o,null):(0,o.createElement)(Wr,{onError:t}),(0,o.createElement)(D.PluginArea,{onError:l}),(0,o.createElement)(cr,{isDefaultOpen:!!a,activeTemplateType:a?n.postType:void 0}))})))}function Wo(e){let{className:t,...n}=e;const l=(0,c.useSelect)((e=>e(Ut).getSettings().showIconLabels),[]);return(0,o.createElement)(Q,m({panelClassName:t,className:"edit-site-sidebar",scope:"core/edit-site",showIconLabels:l},n))}function Yo(e){return(0,o.createElement)(Y,m({__unstableExplicitMenuItem:!0,scope:"core/edit-site"},e))}var qo=(0,J.compose)((0,D.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:_.MenuItem,icon:t.icon||e.icon,name:"core/edit-site/plugin-more-menu"}})))(j);function Xo(e,t){if(!t.__unstableHomeTemplate)return void(0,o.render)((0,o.createElement)(Lr,{message:(0,h.__)("The editor is unable to find a block template for the homepage."),dashboardLink:"index.php"}),e);(0,me.addFilter)("blockEditor.__unstableCanInsertBlockType","removeClassicBlockFromInserter",((e,t)=>"core/freeform"!==t.name&&e)),(0,o.unmountComponentAtNode)(e);const n=Xo.bind(null,e,t);(0,c.dispatch)(k.store).setDefaults("core/edit-site",{editorMode:"visual",fixedToolbar:!1,focusMode:!1,keepCaretInsideBlock:!1,welcomeGuide:!0,welcomeGuideStyles:!0,showListViewByDefault:!1}),(0,c.select)(k.store).get("core/edit-site","showListViewByDefault")&&(0,c.dispatch)(Ut).setIsListViewOpened(!0),(0,c.dispatch)(O).setDefaultComplementaryArea("core/edit-site","edit-site/template"),(0,c.dispatch)(Ut).updateSettings(t),(0,c.dispatch)(d.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas});Uo((0,de.getQueryArgs)(window.location.href))&&(0,c.dispatch)(Ut).setIsNavigationPanelOpened((0,c.select)(b.store).isViewportMatch("medium"));window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),(0,o.render)((0,o.createElement)(jo,{reboot:n}),e)}function Ko(e,t){t.__experimentalFetchLinkSuggestions=(e,n)=>(0,u.__experimentalFetchLinkSuggestions)(e,n,t),t.__experimentalFetchRichUrlData=u.__experimentalFetchUrlData;const n=document.getElementById(e);(0,c.dispatch)(i.store).__experimentalReapplyBlockTypeFilters(),(0,s.registerCoreBlocks)(),Xo(n,t)}}(),(window.wp=window.wp||{}).editSite=l}(); |