var wp;(wp||={}).formatLibrary=(()=>{var Ur=Object.create;var ra=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Dr=Object.getOwnPropertyNames;var Or=Object.getPrototypeOf,Wr=Object.prototype.hasOwnProperty;var Gr=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,a)=>(typeof require<"u"?require:e)[a]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Kr=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Dr(e))!Wr.call(t,s)&&s!==a&&ra(t,s,{get:()=>e[s],enumerable:!(o=zr(e,s))||o.enumerable});return t};var r=(t,e,a)=>(a=t!=null?Ur(Or(t)):{},Kr(e||!t||!t.__esModule?ra(a,"default",{value:t,enumerable:!0}):a,t));var x=I((Co,oa)=>{oa.exports=window.wp.richText});var b=I((_o,sa)=>{sa.exports=window.wp.i18n});var k=I((So,la)=>{la.exports=window.wp.blockEditor});var E=I((To,fa)=>{fa.exports=window.wp.element});var L=I((Io,ia)=>{ia.exports=window.wp.primitives});var n=I((Bo,ma)=>{ma.exports=window.ReactJSXRuntime});var na=I((ls,ua)=>{ua.exports=window.wp.privateApis});var tt=I((cs,xa)=>{xa.exports=window.wp.components});var jt=I((ws,ya)=>{ya.exports=window.wp.url});var Ca=I((ks,va)=>{va.exports=window.wp.htmlEntities});var Pt=I((ys,_a)=>{_a.exports=window.wp.a11y});var Oe=I((vs,Sa)=>{Sa.exports=window.wp.data});var Na=I((_s,Ba)=>{Ba.exports=window.wp.compose});var Pr=r(x());var pa=r(b()),Ee=r(x()),O=r(k());var wt=r(E()),se=(0,wt.forwardRef)(({icon:t,size:e=24,...a},o)=>(0,wt.cloneElement)(t,{width:e,height:e,...a,ref:o}));var kt=r(L()),le=r(n()),fe=(0,le.jsx)(kt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,le.jsx)(kt.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})});var yt=r(L()),ie=r(n()),me=(0,ie.jsx)(yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,ie.jsx)(yt.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})});var vt=r(L()),ue=r(n()),ne=(0,ue.jsx)(vt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,ue.jsx)(vt.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 Ct=r(L()),de=r(n()),pe=(0,de.jsx)(Ct.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,de.jsx)(Ct.Path,{d:"M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"})});var _t=r(L()),ce=r(n()),he=(0,ce.jsx)(_t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ce.jsx)(_t.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})});var St=r(L()),ge=r(n()),xe=(0,ge.jsx)(St.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ge.jsx)(St.Path,{d:"M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"})});var Tt=r(L()),be=r(n()),we=(0,be.jsx)(Tt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,be.jsx)(Tt.Path,{d:"M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z"})});var Lt=r(L()),ke=r(n()),ye=(0,ke.jsx)(Lt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ke.jsx)(Lt.Path,{d:"M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"})});var It=r(L()),ve=r(n()),Ce=(0,ve.jsx)(It.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ve.jsx)(It.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})});var Bt=r(L()),_e=r(n()),Se=(0,_e.jsx)(Bt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,_e.jsx)(Bt.Path,{d:"M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z"})});var Nt=r(L()),Te=r(n()),Le=(0,Te.jsx)(Nt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Te.jsx)(Nt.Path,{d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})});var Vt=r(L()),Ie=r(n()),Be=(0,Ie.jsx)(Vt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Ie.jsx)(Vt.Path,{d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})});var Rt=r(L()),Ne=r(n()),Ve=(0,Ne.jsx)(Rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Ne.jsx)(Rt.Path,{d:"M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"})});var da=r(na()),{lock:fs,unlock:j}=(0,da.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/format-library");var D=r(n()),{essentialFormatKey:Zr}=j(O.privateApis),Re="core/bold",Fe=(0,pa.__)("Bold"),ca={name:Re,title:Fe,tagName:"strong",className:null,[Zr]:!0,edit({isActive:t,value:e,onChange:a,onFocus:o,isVisible:s=!0}){function l(){a((0,Ee.toggleFormat)(e,{type:Re,title:Fe}))}function f(){a((0,Ee.toggleFormat)(e,{type:Re})),o()}return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(O.RichTextShortcut,{type:"primary",character:"b",onUse:l}),s&&(0,D.jsx)(O.RichTextToolbarButton,{name:"bold",icon:pe,title:Fe,onClick:f,isActive:t,shortcutType:"primary",shortcutCharacter:"b"}),(0,D.jsx)(O.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:l})]})}};var ha=r(b()),J=r(x()),Ft=r(k());var X=r(n()),je="core/code",Pe=(0,ha.__)("Inline code"),ga={name:je,title:Pe,tagName:"code",className:null,__unstableInputRule(t){let{start:a,text:o}=t;if(o[a-1]!=="`"||a-2<0)return t;let l=o.lastIndexOf("`",a-2);if(l===-1)return t;let f=l,i=a-2;return f===i||(t=(0,J.remove)(t,f,f+1),t=(0,J.remove)(t,i,i+1),t=(0,J.applyFormat)(t,{type:je},f,i)),t},edit({value:t,onChange:e,onFocus:a,isActive:o}){function s(){e((0,J.toggleFormat)(t,{type:je,title:Pe})),a()}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ft.RichTextShortcut,{type:"access",character:"x",onUse:s}),(0,X.jsx)(Ft.RichTextToolbarButton,{icon:me,title:Pe,onClick:s,isActive:o,role:"menuitemcheckbox"})]})}};var y=r(tt()),V=r(b()),Ae=r(E()),Et=r(x()),mt=r(k()),g=r(n()),qr=["image"],Me="core/image",ba=(0,V.__)("Inline image");function $r(t){if(!t?.className)return;let[,e]=t.className.match(/wp-image-(\d+)/)??[];return e?parseInt(e,10):void 0}var He={name:Me,title:ba,keywords:[(0,V.__)("photo"),(0,V.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:Qr};function Yr({value:t,onChange:e,activeObjectAttributes:a,contentRef:o}){let{style:s,alt:l}=a,f=s?.replace(/\D/g,""),[i,m]=(0,Ae.useState)(f),[u,h]=(0,Ae.useState)(l),v=i!==f||u!==l,R=(0,Et.useAnchor)({editableContentElement:o.current,settings:He});return(0,g.jsx)(y.Popover,{focusOnMount:!1,anchor:R,className:"block-editor-format-toolbar__image-popover",children:(0,g.jsx)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:_=>{let C=t.replacements.slice();C[t.start]={type:Me,attributes:{...a,style:i?`width: ${i}px;`:"",alt:u}},e({...t,replacements:C}),_.preventDefault()},children:(0,g.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,g.jsx)(y.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,V.__)("Width"),value:i,min:1,onChange:_=>{m(_)}}),(0,g.jsx)(y.TextareaControl,{label:(0,V.__)("Alternative text"),value:u,onChange:_=>{h(_)},help:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(y.ExternalLink,{href:(0,V.__)("https://www.w3.org/WAI/tutorials/images/decision-tree/"),children:(0,V.__)("Describe the purpose of the image.")}),(0,g.jsx)("br",{}),(0,V.__)("Leave empty if decorative.")]})}),(0,g.jsx)(y.__experimentalHStack,{justify:"right",children:(0,g.jsx)(y.Button,{disabled:!v,accessibleWhenDisabled:!0,variant:"primary",type:"submit",size:"compact",children:(0,V.__)("Apply")})})]})})})}function Qr({value:t,onChange:e,onFocus:a,isObjectActive:o,activeObjectAttributes:s,contentRef:l}){return(0,g.jsxs)(mt.MediaUploadCheck,{children:[(0,g.jsx)(mt.MediaUpload,{allowedTypes:qr,value:$r(s),onSelect:({id:f,url:i,alt:m,width:u})=>{e((0,Et.insertObject)(t,{type:Me,attributes:{className:`wp-image-${f}`,style:`width: ${Math.min(u,150)}px;`,url:i,alt:m}})),a()},render:({open:f})=>(0,g.jsx)(mt.RichTextToolbarButton,{icon:(0,g.jsx)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,g.jsx)(y.Path,{d:"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"})}),title:o?(0,V.__)("Replace image"):ba,onClick:f,isActive:o})}),o&&(0,g.jsx)(Yr,{value:t,onChange:e,activeObjectAttributes:s,contentRef:l})]})}var wa=r(b()),De=r(x()),G=r(k());var W=r(n()),{essentialFormatKey:Jr}=j(G.privateApis),Ue="core/italic",ze=(0,wa.__)("Italic"),ka={name:Ue,title:ze,tagName:"em",className:null,[Jr]:!0,edit({isActive:t,value:e,onChange:a,onFocus:o,isVisible:s=!0}){function l(){a((0,De.toggleFormat)(e,{type:Ue,title:ze}))}function f(){a((0,De.toggleFormat)(e,{type:Ue})),o()}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(G.RichTextShortcut,{type:"primary",character:"i",onUse:l}),s&&(0,W.jsx)(G.RichTextToolbarButton,{name:"italic",icon:he,title:ze,onClick:f,isActive:t,shortcutType:"primary",shortcutCharacter:"i"}),(0,W.jsx)(G.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:l})]})}};var zt=r(b()),et=r(E()),w=r(x()),rt=r(jt()),at=r(k()),Ma=r(Ca());var Ha=r(Pt());var Mt=r(E()),P=r(b()),ht=r(Pt()),ja=r(tt()),Pa=r(jt()),p=r(x()),ut=r(k()),Ht=r(Oe());var c=r(jt());function At(t){if(!t)return!1;let e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){let a=(0,c.getProtocol)(e);if(!(0,c.isValidProtocol)(a)||a.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;let o=(0,c.getAuthority)(e);if(!(0,c.isValidAuthority)(o))return!1;let s=(0,c.getPath)(e);if(s&&!(0,c.isValidPath)(s))return!1;let l=(0,c.getQueryString)(e);if(l&&!(0,c.isValidQueryString)(l))return!1;let f=(0,c.getFragment)(e);if(f&&!(0,c.isValidFragment)(f))return!1}return!(e.startsWith("#")&&!(0,c.isValidFragment)(e))}function Ta({url:t,type:e,id:a,opensInNewWindow:o,nofollow:s,cssClasses:l}){let f={type:"core/link",attributes:{url:t}};e&&(f.attributes.type=e),a&&(f.attributes.id=a),o&&(f.attributes.target="_blank",f.attributes.rel=f.attributes.rel?f.attributes.rel+" noreferrer noopener":"noreferrer noopener"),s&&(f.attributes.rel=f.attributes.rel?f.attributes.rel+" nofollow":"nofollow");let i=l?.trim();return i?.length&&(f.attributes.class=i),f}function We(t,e,a=t.start,o=t.end){let s={start:null,end:null},{formats:l}=t,f,i;if(!l?.length)return s;let m=l.slice(),u=m[a]?.find(({type:C})=>C===e.type),h=m[o]?.find(({type:C})=>C===e.type),v=m[o-1]?.find(({type:C})=>C===e.type);if(u)f=u,i=a;else if(h)f=h,i=o;else if(v)f=v,i=o-1;else return s;let R=m[i].indexOf(f),_=[m,i,f,R];return a=Xr(..._),o=to(..._),a=a<0?0:a,{start:a,end:o}}function La(t,e,a,o,s){let l=e,i={forwards:1,backwards:-1}[s]||1,m=i*-1;for(;t[l]&&t[l][o]===a;)l=l+i;return l=l+m,l}var Ia=(t,...e)=>(...a)=>t(...a,...e),Xr=Ia(La,"backwards"),to=Ia(La,"forwards");var Va=r(E()),Ra=r(Na()),Ge=r(b()),Z=r(tt()),K=r(n()),Fa=({setting:t,value:e,onChange:a})=>{let o=e?e?.cssClasses?.length>0:!1,[s,l]=(0,Va.useState)(o),i=`css-classes-setting-${(0,Ra.useInstanceId)(Fa)}`,m=h=>{let v=typeof h=="string"?h.replace(/,/g," ").replace(/\s+/g," ").trim():h;a({...e,[t.id]:v})},u=()=>{s?(o&&m(""),l(!1)):l(!0)};return(0,K.jsxs)("fieldset",{children:[(0,K.jsx)(Z.VisuallyHidden,{as:"legend",children:t.title}),(0,K.jsxs)(Z.__experimentalVStack,{spacing:3,children:[(0,K.jsx)(Z.CheckboxControl,{label:t.title,onChange:u,checked:s||o,"aria-expanded":s,"aria-controls":s?i:void 0}),s&&(0,K.jsx)("div",{id:i,children:(0,K.jsx)(Z.__experimentalInputControl,{label:(0,Ge.__)("CSS classes"),value:e?.cssClasses,onChange:m,help:(0,Ge.__)("Separate multiple classes with spaces."),__unstableInputWidth:"100%",__next40pxDefaultSize:!0})})]})]})},Ea=Fa;var gt=r(n()),eo=[...ut.LinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,P.__)("Mark as nofollow")},{id:"cssClasses",title:(0,P.__)("Additional CSS class(es)"),render:(t,e,a)=>(0,gt.jsx)(Ea,{setting:t,value:e,onChange:a})}];function ao({isActive:t,activeAttributes:e,value:a,onChange:o,onFocusOutside:s,stopAddingLink:l,contentRef:f,focusOnMount:i}){let u=ro(a,t).text,{selectionChange:h}=(0,Ht.useDispatch)(ut.store),{createPageEntity:v,userCanCreatePages:R,selectionStart:_}=(0,Ht.useSelect)(d=>{let{getSettings:Q,getSelectionStart:re}=d(ut.store),ft=Q();return{createPageEntity:ft.__experimentalCreatePageEntity,userCanCreatePages:ft.__experimentalUserCanCreatePages,selectionStart:re()}},[]),C=(0,Mt.useMemo)(()=>({url:e.url,type:e.type,id:e.id,opensInNewTab:e.target==="_blank",nofollow:e.rel?.includes("nofollow"),title:u,cssClasses:e.class}),[e.class,e.id,e.rel,e.target,e.type,e.url,u]);function te(){let d=(0,p.removeFormat)(a,"core/link");o(d),l(),(0,ht.speak)((0,P.__)("Link removed."),"assertive")}function ee(d){let re=!C?.url;d={...C,...d};let ft=(0,Pa.prependHTTP)(d.url),oe=Ta({url:ft,type:d.type,id:d.id!==void 0&&d.id!==null?String(d.id):void 0,opensInNewWindow:d.opensInNewTab,nofollow:d.nofollow,cssClasses:d.cssClasses}),it=d.title||ft,M;if((0,p.isCollapsed)(a)&&!t){let bt=(0,p.insert)(a,it);M=(0,p.applyFormat)(bt,oe,a.start,a.start+it.length),o(M),l(),h({clientId:_.clientId,identifier:_.attributeKey,start:a.start+it.length+1});return}else if(it===u)M=(0,p.applyFormat)(a,oe);else{M=(0,p.create)({text:it}),M=(0,p.applyFormat)(M,oe,0,it.length);let bt=We(a,{type:"core/link"}),[Ar,Mr]=(0,p.split)(a,bt.start,bt.start),Hr=(0,p.replace)(Mr,u,M);M=(0,p.concat)(Ar,Hr)}o(M),re||l(),At(ft)?t?(0,ht.speak)((0,P.__)("Link edited."),"assertive"):(0,ht.speak)((0,P.__)("Link inserted."),"assertive"):(0,ht.speak)((0,P.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}let F=(0,p.useAnchor)({editableContentElement:f.current,settings:{...Ut,isActive:t}});async function S(d){let Q=await v({title:d,status:"draft"});return{id:Q.id,type:Q.type,title:Q.title.rendered,url:Q.link,kind:"post-type"}}function ae(d){return(0,Mt.createInterpolateElement)((0,P.sprintf)((0,P.__)("Create page: %s"),d),{mark:(0,gt.jsx)("mark",{})})}return(0,gt.jsx)(ja.Popover,{anchor:F,animate:!1,onClose:l,onFocusOutside:s,placement:"bottom",offset:8,shift:!0,focusOnMount:i,constrainTabbing:!0,children:(0,gt.jsx)(ut.LinkControl,{value:C,onChange:ee,onRemove:te,hasRichPreviews:!0,createSuggestion:v&&S,withCreateSuggestion:R,createSuggestionButtonText:ae,hasTextControl:!0,settings:eo,showInitialSuggestions:!0,suggestionsQuery:{initialSuggestionsSearchOptions:{type:"post",subtype:"page",perPage:20}}})})}function ro(t,e){let a=t.start,o=t.end;if(e){let s=We(t,{type:"core/link"});a=s.start,o=s.end+1}return(0,p.slice)(t,a,o)}var Aa=ao;var H=r(n()),{essentialFormatKey:oo}=j(at.privateApis),nt="core/link",Ua=(0,zt.__)("Link");function so({isActive:t,activeAttributes:e,value:a,onChange:o,onFocus:s,contentRef:l,isVisible:f=!0}){let[i,m]=(0,et.useState)(!1),[u,h]=(0,et.useState)(null);(0,et.useEffect)(()=>{t||m(!1)},[t]),(0,et.useLayoutEffect)(()=>{let F=l.current;if(!F)return;function S(ae){let d=ae.target.closest("[contenteditable] a");!d||!t||(m(!0),h({el:d,action:"click"}))}return F.addEventListener("click",S),()=>{F.removeEventListener("click",S)}},[l,t]);function v(F){let S=(0,w.getTextContent)((0,w.slice)(a));!t&&S&&(0,rt.isURL)(S)&&At(S)?o((0,w.applyFormat)(a,{type:nt,attributes:{url:S}})):!t&&S&&(0,rt.isEmail)(S)?o((0,w.applyFormat)(a,{type:nt,attributes:{url:`mailto:${S}`}})):!t&&S&&(0,rt.isPhoneNumber)(S)?o((0,w.applyFormat)(a,{type:nt,attributes:{url:`tel:${S.replace(/\D/g,"")}`}})):(F&&h({el:F,action:null}),m(!0))}function R(){m(!1),u?.el?.tagName==="BUTTON"?u.el.focus():s(),h(null)}function _(){m(!1),h(null)}function C(){o((0,w.removeFormat)(a,nt)),(0,Ha.speak)((0,zt.__)("Link removed."),"assertive")}let te=!(u?.el?.tagName==="A"&&u?.action==="click"),ee=!(0,w.isCollapsed)(a);return(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(at.RichTextShortcut,{type:"primary",character:"k",onUse:v}),(0,H.jsx)(at.RichTextShortcut,{type:"primaryShift",character:"k",onUse:C}),f&&(0,H.jsx)(at.RichTextToolbarButton,{name:"link",icon:Ce,title:t?(0,zt.__)("Link"):Ua,onClick:F=>{v(F.currentTarget)},isActive:t||i,shortcutType:"primary",shortcutCharacter:"k","aria-haspopup":"true","aria-expanded":i}),f&&i&&(0,H.jsx)(Aa,{stopAddingLink:R,onFocusOutside:_,isActive:t,activeAttributes:e,value:a,onChange:o,contentRef:l,focusOnMount:te?"firstElement":!1})]})}var Ut={name:nt,title:Ua,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",_id:"id",target:"target",rel:"rel",class:"class"},[oo]:!0,__unstablePasteRule(t,{html:e,plainText:a}){let o=(e||a).replace(/<[^>]+>/g,"").trim();if(!(0,rt.isURL)(o)||!/^https?:/.test(o))return t;window.console.log(`Created link: `,o);let s={type:nt,attributes:{url:(0,Ma.decodeEntities)(o)}};return(0,w.isCollapsed)(t)?(0,w.insert)(t,(0,w.applyFormat)((0,w.create)({text:a}),s,0,a.length)):(0,w.applyFormat)(t,s)},edit:so};var Da=r(b()),Oa=r(x()),Dt=r(k());var ot=r(n()),za="core/strikethrough",Ke=(0,Da.__)("Strikethrough"),Wa={name:za,title:Ke,tagName:"s",className:null,edit({isActive:t,value:e,onChange:a,onFocus:o}){function s(){a((0,Oa.toggleFormat)(e,{type:za,title:Ke})),o()}return(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)(Dt.RichTextShortcut,{type:"access",character:"d",onUse:s}),(0,ot.jsx)(Dt.RichTextToolbarButton,{icon:xe,title:Ke,onClick:s,isActive:t,role:"menuitemcheckbox"})]})}};var Za=r(b()),qa=r(x()),Ot=r(k()),st=r(n()),Ga="core/underline",Ka=(0,Za.__)("Underline"),$a={name:Ga,title:Ka,tagName:"span",className:null,attributes:{style:"style"},edit({value:t,onChange:e}){let a=()=>{e((0,qa.toggleFormat)(t,{type:Ga,attributes:{style:"text-decoration: underline;"},title:Ka}))};return(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)(Ot.RichTextShortcut,{type:"primary",character:"u",onUse:a}),(0,st.jsx)(Ot.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:a})]})}};var tr=r(b()),$t=r(E()),Yt=r(k());var er=r(x());var Qa=r(E()),Ja=r(Oe()),q=r(x()),A=r(k()),Gt=r(tt()),Ze=r(b());var U=r(n()),{Tabs:Wt}=j(Gt.privateApis),Ya=[{name:"color",title:(0,Ze.__)("Text")},{name:"backgroundColor",title:(0,Ze.__)("Background")}];function lo(t=""){return t.split(";").reduce((e,a)=>{if(a){let[o,s]=a.split(":");o==="color"&&(e.color=s),o==="background-color"&&s!==xt&&(e.backgroundColor=s)}return e},{})}function fo(t="",e){return t.split(" ").reduce((a,o)=>{if(o.startsWith("has-")&&o.endsWith("-color")){let s=o.replace(/^has-/,"").replace(/-color$/,""),l=(0,A.getColorObjectByAttributeValues)(e,s);a.color=l.color}return a},{})}function Kt(t,e,a){let o=(0,q.getActiveFormat)(t,e);return o?{...lo(o.attributes.style),...fo(o.attributes.class,a)}:{}}function io(t,e,a,o){let{color:s,backgroundColor:l}={...Kt(t,e,a),...o};if(!s&&!l)return(0,q.removeFormat)(t,e);let f=[],i=[],m={};if(l?f.push(["background-color",l].join(":")):f.push(["background-color",xt].join(":")),s){let u=(0,A.getColorObjectByColorValue)(a,s);u?i.push((0,A.getColorClassName)("color",u.slug)):f.push(["color",s].join(":"))}return f.length&&(m.style=f.join(";")),i.length&&(m.class=i.join(" ")),(0,q.applyFormat)(t,{type:e,attributes:m})}function mo({name:t,property:e,value:a,onChange:o}){let s=(0,Ja.useSelect)(f=>{let{getSettings:i}=f(A.store);return i().colors??[]},[]),l=(0,Qa.useMemo)(()=>Kt(a,t,s),[t,a,s]);return(0,U.jsx)(A.ColorPalette,{value:l[e],onChange:f=>{o(io(a,t,s,{[e]:f}))},enableAlpha:!0,__experimentalIsRenderedInSidebar:!0})}function Xa({name:t,value:e,onChange:a,onClose:o,contentRef:s,isActive:l}){let f=(0,q.useAnchor)({editableContentElement:s.current,settings:{...Zt,isActive:l}});return(0,U.jsx)(Gt.Popover,{onClose:o,className:"format-library__inline-color-popover",anchor:f,children:(0,U.jsxs)(Wt,{children:[(0,U.jsx)(Wt.TabList,{children:Ya.map(i=>(0,U.jsx)(Wt.Tab,{tabId:i.name,children:i.title},i.name))}),Ya.map(i=>(0,U.jsx)(Wt.TabPanel,{tabId:i.name,focusable:!1,children:(0,U.jsx)(mo,{name:t,property:i.name,value:e,onChange:a})},i.name))]})})}var $=r(n()),xt="rgba(0, 0, 0, 0)",qt="core/text-color",ar=(0,tr.__)("Highlight"),uo=[];function qe(t,e){let{ownerDocument:a}=t,{defaultView:o}=a,l=o.getComputedStyle(t).getPropertyValue(e);return e==="background-color"&&l===xt&&t.parentElement?qe(t.parentElement,e):l}function no(t,{color:e,backgroundColor:a}){if(!(!e&&!a))return{color:e||qe(t,"color"),backgroundColor:a===xt?qe(t,"background-color"):a}}function po({value:t,onChange:e,isActive:a,activeAttributes:o,contentRef:s}){let[l,f=uo]=(0,Yt.useSettings)("color.custom","color.palette"),[i,m]=(0,$t.useState)(!1),u=(0,$t.useMemo)(()=>no(s.current,Kt(t,qt,f)),[s,t,f]),h=!!f.length||l;return!h&&!a?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Yt.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:a,icon:(0,$.jsx)(se,{icon:Object.keys(o).length?Ve:ne,style:u}),title:ar,onClick:h?()=>m(!0):()=>e((0,er.removeFormat)(t,qt)),role:"menuitemcheckbox"}),i&&(0,$.jsx)(Xa,{name:qt,onClose:()=>m(!1),activeAttributes:o,value:t,onChange:e,contentRef:s,isActive:a})]})}var Zt={name:qt,title:ar,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:po};var or=r(b()),sr=r(x()),lr=r(k());var fr=r(n()),rr="core/subscript",$e=(0,or.__)("Subscript"),ir={name:rr,title:$e,tagName:"sub",className:null,edit({isActive:t,value:e,onChange:a,onFocus:o}){function s(){a((0,sr.toggleFormat)(e,{type:rr,title:$e}))}function l(){s(),o()}return(0,fr.jsx)(lr.RichTextToolbarButton,{icon:Le,title:$e,onClick:l,isActive:t,role:"menuitemcheckbox"})}};var ur=r(b()),nr=r(x()),dr=r(k());var pr=r(n()),mr="core/superscript",Ye=(0,ur.__)("Superscript"),cr={name:mr,title:Ye,tagName:"sup",className:null,edit({isActive:t,value:e,onChange:a,onFocus:o}){function s(){a((0,nr.toggleFormat)(e,{type:mr,title:Ye}))}function l(){s(),o()}return(0,pr.jsx)(dr.RichTextToolbarButton,{icon:Be,title:Ye,onClick:l,isActive:t,role:"menuitemcheckbox"})}};var gr=r(b()),xr=r(x()),br=r(k());var wr=r(n()),hr="core/keyboard",Qe=(0,gr.__)("Keyboard input"),kr={name:hr,title:Qe,tagName:"kbd",className:null,edit({isActive:t,value:e,onChange:a,onFocus:o}){function s(){a((0,xr.toggleFormat)(e,{type:hr,title:Qe}))}function l(){s(),o()}return(0,wr.jsx)(br.RichTextToolbarButton,{icon:fe,title:Qe,onClick:l,isActive:t,role:"menuitemcheckbox"})}};var vr=r(b()),dt=r(x()),Cr=r(k());var _r=r(n()),Je="core/unknown",yr=(0,vr.__)("Clear Unknown Formatting");function co(t){return(0,dt.isCollapsed)(t)?!1:(0,dt.slice)(t).formats.some(a=>a.some(o=>o.type===Je))}var Sr={name:Je,title:yr,tagName:"*",className:null,edit({isActive:t,value:e,onChange:a,onFocus:o}){if(!t&&!co(e))return null;function s(){a((0,dt.removeFormat)(e,Je)),o()}return(0,_r.jsx)(Cr.RichTextToolbarButton,{name:"unknown",icon:we,title:yr,onClick:s,isActive:!0})}};var lt=r(b()),Tr=r(k()),N=r(tt()),Qt=r(E()),pt=r(x());var B=r(n()),Xe="core/language",Jt=(0,lt.__)("Language"),ta={name:Xe,tagName:"bdo",className:null,edit:ho,title:Jt};function ho({isActive:t,value:e,onChange:a,contentRef:o}){let[s,l]=(0,Qt.useState)(!1),f=()=>{l(i=>!i)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Tr.RichTextToolbarButton,{icon:ye,label:Jt,title:Jt,onClick:()=>{t?a((0,pt.removeFormat)(e,Xe)):f()},isActive:t,role:"menuitemcheckbox"}),s&&(0,B.jsx)(go,{value:e,onChange:a,onClose:f,contentRef:o})]})}function go({value:t,contentRef:e,onChange:a,onClose:o}){let s=(0,pt.useAnchor)({editableContentElement:e.current,settings:ta}),[l,f]=(0,Qt.useState)(""),[i,m]=(0,Qt.useState)("ltr");return(0,B.jsx)(N.Popover,{className:"block-editor-format-toolbar__language-popover",anchor:s,onClose:o,children:(0,B.jsxs)(N.__experimentalVStack,{as:"form",spacing:4,className:"block-editor-format-toolbar__language-container-content",onSubmit:u=>{u.preventDefault(),a((0,pt.applyFormat)(t,{type:Xe,attributes:{lang:l,dir:i}})),o()},children:[(0,B.jsx)(N.TextControl,{__next40pxDefaultSize:!0,label:Jt,value:l,onChange:u=>f(u),help:(0,lt.__)('A valid language attribute, like "en" or "fr".')}),(0,B.jsx)(N.SelectControl,{__next40pxDefaultSize:!0,label:(0,lt.__)("Text direction"),value:i,options:[{label:(0,lt.__)("Left to right"),value:"ltr"},{label:(0,lt.__)("Right to left"),value:"rtl"}],onChange:u=>m(u)}),(0,B.jsx)(N.__experimentalHStack,{alignment:"right",children:(0,B.jsx)(N.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",text:(0,lt.__)("Apply")})})]})})}var z=r(b()),ct=r(E()),Xt=r(x()),Lr=r(k()),Y=r(tt());var Ir=r(Pt());var T=r(n()),{Badge:xo}=j(Y.privateApis),ea="core/math",Br=(0,z.__)("Math");function bo({value:t,onChange:e,activeAttributes:a,contentRef:o,latexToMathML:s}){let[l,f]=(0,ct.useState)(a?.["data-latex"]||""),[i,m]=(0,ct.useState)(null),u=(0,Xt.useAnchor)({editableContentElement:o.current,settings:aa}),h=v=>{let R="";if(f(v),v)try{R=s(v,{displayMode:!1}),m(null)}catch(C){m(C.message),(0,Ir.speak)((0,z.sprintf)((0,z.__)("Error parsing mathematical expression: %s"),C.message));return}let _=t.replacements.slice();_[t.start]={type:ea,attributes:{"data-latex":v},innerHTML:R},e({...t,replacements:_})};return(0,T.jsx)(Y.Popover,{placement:"bottom-start",offset:8,focusOnMount:!1,anchor:u,className:"block-editor-format-toolbar__math-popover",children:(0,T.jsx)("div",{style:{minWidth:"300px",padding:"4px"},children:(0,T.jsxs)(Y.__experimentalVStack,{spacing:1,children:[(0,T.jsx)(Y.TextControl,{__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,z.__)("LaTeX math syntax"),value:l,onChange:h,placeholder:(0,z.__)("e.g., x^2, \\frac{a}{b}"),autoComplete:"off",className:"block-editor-format-toolbar__math-input"}),i&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(xo,{intent:"error",className:"wp-block-math__error",children:(0,z.sprintf)((0,z.__)("Error: %s"),i)}),(0,T.jsx)("style",{children:".wp-block-math__error .components-badge__content{white-space:normal}"})]})]})})})}function wo({value:t,onChange:e,onFocus:a,isObjectActive:o,activeObjectAttributes:s,contentRef:l}){let[f,i]=(0,ct.useState)();return(0,ct.useEffect)(()=>{import("@wordpress/latex-to-mathml").then(m=>{i(()=>m.default)})},[]),(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Lr.RichTextToolbarButton,{icon:Se,title:Br,onClick:()=>{let m=(0,Xt.insertObject)(t,{type:ea,attributes:{"data-latex":""},innerHTML:""});m.start=m.end-1,e(m),a()},isActive:o}),o&&(0,T.jsx)(bo,{value:t,onChange:e,activeAttributes:s,contentRef:l,latexToMathML:f})]})}var aa={name:ea,title:Br,tagName:"math",className:null,attributes:{"data-latex":"data-latex"},contentEditable:!1,edit:wo};var Nr=r(b()),Vr=r(x()),Rr=r(k()),Fr=r(n()),ko="core/non-breaking-space",yo=(0,Nr.__)("Non breaking space"),Er={name:ko,title:yo,tagName:"nbsp",className:null,edit({value:t,onChange:e}){function a(){e((0,Vr.insert)(t,"\xA0"))}return(0,Fr.jsx)(Rr.RichTextShortcut,{type:"primaryShift",character:" ",onUse:a})}};var jr=[ca,ga,He,ka,Ut,Wa,$a,Zt,ir,cr,kr,Sr,ta,aa,Er];jr.forEach(({name:t,...e})=>(0,Pr.registerFormatType)(t,e));})();