{const t="Mobile"===e?"768px":"1024px";switch(e){case"Tablet":case"Mobile":return{width:r(e),margin:(window.innerHeight<800?36:72)+"px auto",height:t,borderRadius:"2px 2px 2px 2px",border:"1px solid #ddd",overflowY:"auto"};default:return null}})(e)}var SE=(0,d.withSelect)((e=>({selectedBlockClientId:e(sr).getBlockSelectionStart()})))((e=>{let{selectedBlockClientId:t}=e;const n=Tr(t);return t?(0,a.createElement)(f.Button,{variant:"secondary",className:"block-editor-skip-to-selected-block",onClick:()=>{n.current.focus()}},(0,m.__)("Skip to the selected block")):null})),EE=window.wp.wordcount;var wE=(0,d.withSelect)((e=>{const{getMultiSelectedBlocks:t}=e(sr);return{blocks:t()}}))((function(e){let{blocks:t}=e;const n=(0,EE.count)((0,o.serialize)(t),"words");return(0,a.createElement)("div",{className:"block-editor-multi-selection-inspector__card"},(0,a.createElement)(Au,{icon:ly,showColors:!0}),(0,a.createElement)("div",{className:"block-editor-multi-selection-inspector__card-content"},(0,a.createElement)("div",{className:"block-editor-multi-selection-inspector__card-title"},(0,m.sprintf)((0,m._n)("%d block","%d blocks",t.length),t.length)),(0,a.createElement)("div",{className:"block-editor-multi-selection-inspector__card-description"},(0,m.sprintf)((0,m._n)("%d word","%d words",n),n))))}));function AE(e){let{blockName:t}=e;const{preferredStyle:n,onUpdatePreferredStyleVariations:r,styles:i}=(0,d.useSelect)((e=>{var n,r;const i=e(sr).getSettings().__experimentalPreferredStyleVariations;return{preferredStyle:null==i||null===(n=i.value)||void 0===n?void 0:n[t],onUpdatePreferredStyleVariations:null!==(r=null==i?void 0:i.onChange)&&void 0!==r?r:null,styles:e(o.store).getBlockStyles(t)}}),[t]),l=(0,a.useMemo)((()=>[{label:(0,m.__)("Not set"),value:""},...i.map((e=>{let{label:t,name:n}=e;return{label:t,value:n}}))]),[i]),s=(0,a.useMemo)((()=>{var e;return null===(e=my(i))||void 0===e?void 0:e.name}),[i]),c=(0,a.useCallback)((e=>{r(t,e)}),[t,r]);return n&&n!==s?r&&(0,a.createElement)("div",{className:"default-style-picker__default-switcher"},(0,a.createElement)(f.SelectControl,{options:l,value:n||"",label:(0,m.__)("Default Style"),onChange:c})):null}function CE(e,t){const n=(0,a.useMemo)((()=>e.reduce(((e,t)=>("core/list-item"!==t.name&&Object.entries(t.attributes).some((e=>{let[,{__experimentalRole:t}]=e;return"content"===t}))&&(e[t.name]=!0),e)),{})),[e]),r=(0,a.useCallback)((e=>!!n[e]),[e]);return(0,a.useMemo)((()=>IE([t],r)),[t,r])}function IE(e,t){const n=[];for(const r of e)t(r.name)&&n.push(r),n.push(...IE(r.innerBlocks,t));return n}function xE(e){let{blockTypes:t,block:n,selectedBlock:r}=e;const{selectBlock:o}=(0,d.useDispatch)(sr),i=t.find((e=>{let{name:t}=e;return t===n.name})),l=r&&r.clientId===n.clientId;return(0,a.createElement)(f.Button,{isPressed:l,onClick:()=>o(n.clientId)},(0,a.createElement)(f.__experimentalHStack,{justify:"flex-start"},(0,a.createElement)(Au,{icon:i.icon}),(0,a.createElement)(f.FlexItem,null,i.title)))}function BE(e){let{topLevelLockedBlock:t}=e;const{blockTypes:n,block:r,selectedBlock:i}=(0,d.useSelect)((e=>({blockTypes:e(o.store).getBlockTypes(),block:e(sr).getBlock(t),selectedBlock:e(sr).getSelectedBlock()})),[t]),l=Rf(t),s=CE(n,r);return(0,a.createElement)("div",{className:"block-editor-block-inspector"},(0,a.createElement)(Cu,l),(0,a.createElement)(S_,{blockClientId:t}),(0,a.createElement)(f.__experimentalVStack,{spacing:1,padding:4,className:"block-editor-block-inspector__block-buttons-container"},(0,a.createElement)("h2",{className:"block-editor-block-card__title"},(0,m.__)("Content")),s.map((e=>(0,a.createElement)(xE,{selectedBlock:i,key:e.clientId,block:e,blockTypes:n})))))}const PE=e=>{let{clientId:t,blockName:n}=e;const r=(0,d.useSelect)((e=>{const{getBlockStyles:t}=e(o.store),r=t(n);return r&&r.length>0}),[n]),i=Rf(t);return(0,a.createElement)("div",{className:"block-editor-block-inspector"},(0,a.createElement)(Cu,i),(0,a.createElement)(S_,{blockClientId:t}),r&&(0,a.createElement)("div",null,(0,a.createElement)(f.PanelBody,{title:(0,m.__)("Styles")},(0,a.createElement)(l_,{scope:"core/block-inspector",clientId:t}),(0,o.hasBlockSupport)(n,"defaultStylePicker",!0)&&(0,a.createElement)(AE,{blockName:n}))),(0,a.createElement)(go.Slot,null),(0,a.createElement)(go.Slot,{__experimentalGroup:"color",label:(0,m.__)("Color"),className:"color-block-support-panel__inner-wrapper"}),(0,a.createElement)(go.Slot,{__experimentalGroup:"typography",label:(0,m.__)("Typography")}),(0,a.createElement)(go.Slot,{__experimentalGroup:"dimensions",label:(0,m.__)("Dimensions")}),(0,a.createElement)(go.Slot,{__experimentalGroup:"border",label:(0,m.__)("Border")}),(0,a.createElement)("div",null,(0,a.createElement)(TE,null)),(0,a.createElement)(SE,{key:"back"}))},TE=()=>{const e=(0,f.__experimentalUseSlot)(mo.slotName);return Boolean(e.fills&&e.fills.length)?(0,a.createElement)(f.PanelBody,{className:"block-editor-block-inspector__advanced",title:(0,m.__)("Advanced"),initialOpen:!1},(0,a.createElement)(go.Slot,{__experimentalGroup:"advanced"})):null};var OE=e=>{let{showNoBlockSelectedMessage:t=!0}=e;const{count:n,selectedBlockName:r,selectedBlockClientId:i,blockType:l,topLevelLockedBlock:s}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getSelectedBlockCount:n,getBlockName:r,__unstableGetContentLockingParent:i,getTemplateLock:l}=e(sr),a=t(),s=a&&r(a),c=s&&(0,o.getBlockType)(s);return{count:n(),selectedBlockClientId:a,selectedBlockName:s,blockType:c,topLevelLockedBlock:i(a)||("contentOnly"===l(a)?a:void 0)}}),[]);if(n>1)return(0,a.createElement)("div",{className:"block-editor-block-inspector"},(0,a.createElement)(wE,null),(0,a.createElement)(go.Slot,null),(0,a.createElement)(go.Slot,{__experimentalGroup:"color",label:(0,m.__)("Color"),className:"color-block-support-panel__inner-wrapper"}),(0,a.createElement)(go.Slot,{__experimentalGroup:"typography",label:(0,m.__)("Typography")}),(0,a.createElement)(go.Slot,{__experimentalGroup:"dimensions",label:(0,m.__)("Dimensions")}),(0,a.createElement)(go.Slot,{__experimentalGroup:"border",label:(0,m.__)("Border")}));const c=r===(0,o.getUnregisteredTypeHandlerName)();return l&&i&&!c?s?(0,a.createElement)(BE,{topLevelLockedBlock:s}):(0,a.createElement)(PE,{clientId:i,blockName:l.name}):t?(0,a.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,m.__)("No block selected.")):null};var RE=function(e){let{__unstableContentRef:t}=e;const[n,r]=(0,a.useState)(!1),o=(0,d.useSelect)((e=>e(sr).getBlockOrder()),[]);return(0,a.useEffect)((()=>{const e=setTimeout((()=>{r(!0)}),500);return()=>{clearTimeout(e)}}),[]),n?o.map(((e,n)=>n===o.length-1?null:(0,a.createElement)(Cf,{key:e,previousClientId:e,nextClientId:o[n+1],__unstableContentRef:t},(0,a.createElement)("div",{className:"block-editor-block-list__insertion-point-inserter is-with-inserter"},(0,a.createElement)(vf,{position:"bottom center",clientId:o[n+1],__experimentalIsQuick:!0}))))):null};function NE(e){let{children:t,__unstableContentRef:n,...r}=e;const o=(0,p.useViewportMatch)("medium"),{hasFixedToolbar:i,isZoomOutMode:s}=(0,d.useSelect)((e=>{const{__unstableGetEditorMode:t,getSettings:n}=e(sr);return{isZoomOutMode:"zoom-out"===t(),hasFixedToolbar:n().hasFixedToolbar}}),[]),c=(0,Lu.__unstableUseShortcutEventMatch)(),{getSelectedBlockClientIds:u,getBlockRootClientId:y}=(0,d.useSelect)(sr),{duplicateBlocks:m,removeBlocks:g,insertAfterBlock:h,insertBeforeBlock:b,clearSelectedBlock:v,moveBlocksUp:_,moveBlocksDown:k}=(0,d.useDispatch)(sr);const S=vo(n),E=vo(n);return(0,a.createElement)("div",l({},r,{onKeyDown:function(e){if(!e.defaultPrevented)if(c("core/block-editor/move-up",e)){const t=u();if(t.length){e.preventDefault();const n=y(t[0]);_(t,n)}}else if(c("core/block-editor/move-down",e)){const t=u();if(t.length){e.preventDefault();const n=y(t[0]);k(t,n)}}else if(c("core/block-editor/duplicate",e)){const t=u();t.length&&(e.preventDefault(),m(t))}else if(c("core/block-editor/remove",e)){const t=u();t.length&&(e.preventDefault(),g(t))}else if(c("core/block-editor/insert-after",e)){const t=u();t.length&&(e.preventDefault(),h(t[t.length-1]))}else if(c("core/block-editor/insert-before",e)){const t=u();t.length&&(e.preventDefault(),b(t[0]))}else if(c("core/block-editor/unselect",e)){u().length&&(e.preventDefault(),v(),e.target.ownerDocument.defaultView.getSelection().removeAllRanges(),null==n||n.current.focus())}}}),(0,a.createElement)(If.Provider,{value:(0,a.useRef)(!1)},!s&&(0,a.createElement)(Bf,{__unstableContentRef:n}),!s&&(i||!o)&&(0,a.createElement)(hm,{isFixed:!0}),(0,a.createElement)(wm,{__unstableContentRef:n}),(0,a.createElement)(f.Popover.Slot,{name:"block-toolbar",ref:S}),t,(0,a.createElement)(f.Popover.Slot,{name:"__unstable-block-tools-after",ref:E}),s&&(0,a.createElement)(RE,{__unstableContentRef:n})))}const FE=()=>{};var ME=(0,a.forwardRef)((function(e,t){let{rootClientId:n,clientId:r,isAppender:o,showInserterHelpPanel:i,showMostUsedBlocks:l=!1,__experimentalInsertionIndex:s,__experimentalFilterValue:c,onSelect:u=FE,shouldFocusBlock:p=!1}=e;const{destinationRootClientId:f,prioritizePatterns:y}=(0,d.useSelect)((e=>{const{getBlockRootClientId:t,getSettings:o}=e(sr);return{destinationRootClientId:n||t(r)||void 0,prioritizePatterns:o().__experimentalPreferPatternsOnRoot}}),[r,n]);return(0,a.createElement)(mf,{onSelect:u,rootClientId:f,clientId:r,isAppender:o,showInserterHelpPanel:i,showMostUsedBlocks:l,__experimentalInsertionIndex:s,__experimentalFilterValue:c,shouldFocusBlock:p,prioritizePatterns:y,ref:t})}));function DE(){return null}DE.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(Lu.store);return(0,a.useEffect)((()=>{e({name:"core/block-editor/duplicate",category:"block",description:(0,m.__)("Duplicate the selected block(s)."),keyCombination:{modifier:"primaryShift",character:"d"}}),e({name:"core/block-editor/remove",category:"block",description:(0,m.__)("Remove the selected block(s)."),keyCombination:{modifier:"access",character:"z"}}),e({name:"core/block-editor/insert-before",category:"block",description:(0,m.__)("Insert a new block before the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"t"}}),e({name:"core/block-editor/insert-after",category:"block",description:(0,m.__)("Insert a new block after the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"y"}}),e({name:"core/block-editor/delete-multi-selection",category:"block",description:(0,m.__)("Delete selection."),keyCombination:{character:"del"},aliases:[{character:"backspace"}]}),e({name:"core/block-editor/select-all",category:"selection",description:(0,m.__)("Select all text when typing. Press again to select all blocks."),keyCombination:{modifier:"primary",character:"a"}}),e({name:"core/block-editor/unselect",category:"selection",description:(0,m.__)("Clear selection."),keyCombination:{character:"escape"}}),e({name:"core/block-editor/focus-toolbar",category:"global",description:(0,m.__)("Navigate to the nearest toolbar."),keyCombination:{modifier:"alt",character:"F10"}}),e({name:"core/block-editor/move-up",category:"block",description:(0,m.__)("Move the selected block(s) up."),keyCombination:{modifier:"secondary",character:"t"}}),e({name:"core/block-editor/move-down",category:"block",description:(0,m.__)("Move the selected block(s) down."),keyCombination:{modifier:"secondary",character:"y"}})}),[e]),null};var LE=DE;function UE(){return j()("wp.blockEditor.MultiSelectScrollIntoView",{hint:"This behaviour is now built-in.",since:"5.8"}),null}const jE=new Set([cu.UP,cu.RIGHT,cu.DOWN,cu.LEFT,cu.ENTER,cu.BACKSPACE]);function zE(){const e=(0,d.useSelect)((e=>e(sr).isTyping()),[]),{stopTyping:t}=(0,d.useDispatch)(sr);return(0,p.useRefEffect)((n=>{if(!e)return;const{ownerDocument:r}=n;let o,i;function l(e){const{clientX:n,clientY:r}=e;o&&i&&(o!==n||i!==r)&&t(),o=n,i=r}return r.addEventListener("mousemove",l),()=>{r.removeEventListener("mousemove",l)}}),[e,t])}function VE(){const{isTyping:e,hasInlineToolbar:t}=(0,d.useSelect)((e=>{const{isTyping:t,getSettings:n}=e(sr);return{isTyping:t(),hasInlineToolbar:n().hasInlineToolbar}}),[]),{startTyping:n,stopTyping:r}=(0,d.useDispatch)(sr),o=zE(),i=(0,p.useRefEffect)((o=>{const{ownerDocument:i}=o,{defaultView:l}=i,a=l.getSelection();if(e){let c;function u(e){const{target:t}=e;c=l.setTimeout((()=>{(0,Hi.isTextField)(t)||r()}))}function p(e){const{keyCode:t}=e;t!==cu.ESCAPE&&t!==cu.TAB||r()}function d(){a.isCollapsed||r()}return o.addEventListener("focus",u),o.addEventListener("keydown",p),t||i.addEventListener("selectionchange",d),()=>{l.clearTimeout(c),o.removeEventListener("focus",u),o.removeEventListener("keydown",p),i.removeEventListener("selectionchange",d)}}function s(e){const{type:t,target:r}=e;(0,Hi.isTextField)(r)&&o.contains(r)&&("keydown"!==t||function(e){const{keyCode:t,shiftKey:n}=e;return!n&&jE.has(t)}(e))&&n()}return o.addEventListener("keypress",s),o.addEventListener("keydown",s),()=>{o.removeEventListener("keypress",s),o.removeEventListener("keydown",s)}}),[e,t,n,r]);return(0,p.useMergeRefs)([o,i])}var GE=function(e){let{children:t}=e;return(0,a.createElement)("div",{ref:VE()},t)};const HE=-1!==window.navigator.userAgent.indexOf("Trident"),WE=new Set([cu.UP,cu.DOWN,cu.LEFT,cu.RIGHT]);function $E(){const e=(0,d.useSelect)((e=>e(sr).hasSelectedBlock()),[]);return(0,p.useRefEffect)((t=>{if(!e)return;const{ownerDocument:n}=t,{defaultView:r}=n;let o,i,l;function a(){o||(o=r.requestAnimationFrame((()=>{d(),o=null})))}function s(e){i&&r.cancelAnimationFrame(i),i=r.requestAnimationFrame((()=>{c(e),i=null}))}function c(e){let{keyCode:o}=e;if(!f())return;const i=(0,Hi.computeCaretRect)(r);if(!i)return;if(!l)return void(l=i);if(WE.has(o))return void(l=i);const a=i.top-l.top;if(0===a)return;const s=(0,Hi.getScrollContainer)(t);if(!s)return;const c=s===n.body,u=c?r.scrollY:s.scrollTop,p=c?0:s.getBoundingClientRect().top,d=c?l.top/r.innerHeight:(l.top-p)/(r.innerHeight-p);if(0===u&&d<.75&&function(){const e=t.querySelectorAll('[contenteditable="true"]');return e[e.length-1]===n.activeElement}())return void(l=i);const y=c?r.innerHeight:s.clientHeight;l.top+l.height>p+y||l.top{r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a,!0),t.removeEventListener("keydown",s),t.removeEventListener("keyup",c),t.removeEventListener("mousedown",u),t.removeEventListener("touchstart",u),n.removeEventListener("selectionchange",p),r.cancelAnimationFrame(o),r.cancelAnimationFrame(i)}}),[e])}var KE=HE?e=>e.children:function(e){let{children:t}=e;return(0,a.createElement)("div",{ref:$E(),className:"block-editor__typewriter"},t)};const qE=(0,a.createContext)({});function JE(e){let{children:t,uniqueId:n,blockName:r=""}=e;const o=(0,a.useContext)(qE),{name:i}=dr();r=r||i;const l=(0,a.useMemo)((()=>function(e,t,n){const r={...e,[t]:e[t]?new Set(e[t]):new Set};return r[t].add(n),r}(o,r,n)),[o,r,n]);return(0,a.createElement)(qE.Provider,{value:l},t)}function YE(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=(0,a.useContext)(qE),{name:o}=dr();return n=n||o,Boolean(null===(t=r[n])||void 0===t?void 0:t.has(e))}var QE=(0,a.createElement)(M.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(M.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));function ZE(e){let{title:t,help:n,actions:r=[],onClose:o}=e;return(0,a.createElement)(f.__experimentalVStack,{className:"block-editor-inspector-popover-header",spacing:4},(0,a.createElement)(f.__experimentalHStack,{alignment:"center"},(0,a.createElement)(f.__experimentalHeading,{className:"block-editor-inspector-popover-header__heading",level:2,size:13},t),(0,a.createElement)(f.__experimentalSpacer,null),r.map((e=>{let{label:t,icon:n,onClick:r}=e;return(0,a.createElement)(f.Button,{key:t,className:"block-editor-inspector-popover-header__action",label:t,icon:n,variant:!n&&"tertiary",onClick:r},!n&&t)})),o&&(0,a.createElement)(f.Button,{className:"block-editor-inspector-popover-header__action",label:(0,m.__)("Close"),icon:QE,onClick:o})),n&&(0,a.createElement)(f.__experimentalText,null,n))}var XE=(0,a.forwardRef)((function(e,t){let{onClose:n,onChange:r,...o}=e;return(0,a.createElement)("div",{ref:t,className:"block-editor-publish-date-time-picker"},(0,a.createElement)(ZE,{title:(0,m.__)("Publish"),actions:[{label:(0,m.__)("Now"),onClick:()=>null==r?void 0:r(null)}],onClose:n}),(0,a.createElement)(f.DateTimePicker,l({startOfWeek:(0,C_.getSettings)().l10n.startOfWeek,__nextRemoveHelpButton:!0,__nextRemoveResetButton:!0,onChange:r},o)))}));const ew={button:"wp-element-button",caption:"wp-element-caption"},tw=e=>ew[e]?ew[e]:"";function nw(e,t){return Object.entries(t).every((t=>{let[n,r]=t;return"object"==typeof r&&"object"==typeof e[n]?nw(e[n],r):e[n]===r}))}const rw=(e,t)=>{if(!t||!e)return;const n=t.filter((t=>{let{attributes:n}=t;return!(!n||!Object.keys(n).length)&&nw(e,n)}));return 1===n.length?n[0]:void 0};function ow(e){const t=null==e?void 0:e.trim().match(/^(0?[-.]?\d*\.?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/);return isNaN(e)||isNaN(parseFloat(e))?t?{value:parseFloat(t[1])||t[1],unit:t[2]}:{value:e,unit:void 0}:{value:parseFloat(e),unit:"px"}}function iw(e,t){const n=e.split(/[(),]/g).filter(Boolean),r=n.slice(1).map((e=>ow(uw(e,t)).value)).filter(Boolean);switch(n[0]){case"min":return Math.min(...r)+"px";case"max":return Math.max(...r)+"px";case"clamp":return 3!==r.length?null:r[1]r[2]?r[2]+"px":r[1]+"px";case"calc":return r[0]+"px"}}function lw(e){for(;;){const t=e,n=/(max|min|calc|clamp)\(([^()]*)\)/g.exec(e)||[];if(n[0]){const t=iw(n[0]);e=e.replace(n[0],t)}if(e===t||parseFloat(e))break}return ow(e)}function aw(e){for(let t=0;to.height?o.width:o.height)*r,"%":("font"===o.type?o.fontSize:o.width)*r,ch:8,ex:7.15625,lh:o.lineHeight},l={in:n,cm:37.79527559055118,mm:3.7795275590551185,pt:1.3333333333333333,pc:16,px:1,Q:.9448818897637794};return i[e.unit]?(i[e.unit]*e.value).toFixed(0)+"px":l[e.unit]?(l[e.unit]*e.value).toFixed(0)+"px":null}function uw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Number.isFinite(e))return e.toFixed(0)+"px";if(void 0===e)return null;let n=ow(e);return n.unit||(n=lw(e)),aw(e)&&!n.unit?sw(e):cw(n,t)}const pw={};function dw(e){let t="";return e.hasOwnProperty("fontSize")&&(t=":"+e.width),e.hasOwnProperty("lineHeight")&&(t=":"+e.lineHeight),e.hasOwnProperty("width")&&(t=":"+e.width),e.hasOwnProperty("height")&&(t=":"+e.height),e.hasOwnProperty("type")&&(t=":"+e.type),t}var fw=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e+dw(t);return pw[n]||(pw[n]=uw(e,t)),pw[n]}}(),(window.wp=window.wp||{}).blockEditor=r}();