>=1;return(f&h-1)+h}function u(f,m,h,g,v){do g-=h,f[m+g]=new s(v.bits,v.value);while(g>0)}function d(f,m,h){for(var g=1<0;--E[y])_=new s(y&255,k[w++]&65535),u(f,m+S,x,R,_),S=c(S,y);for(A=N-1,C=-1,y=h+1,x=2;y<=l;++y,x<<=1)for(;E[y]>0;--E[y])(S&A)!==C&&(m+=R,P=d(E,y,h),R=1<>h),x,R,_),S=c(S,y);return N}},{}],8:[function(o,n,i){"use strict";i.byteLength=h,i.toByteArray=v,i.fromByteArray=y;for(var s=[],l=[],c=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=u.length;d0)throw new Error("Invalid string. Length must be a multiple of 4");var x=w.indexOf("=");x===-1&&(x=S);var C=x===S?0:4-x%4;return[x,C]}function h(w){var S=m(w),x=S[0],C=S[1];return(x+C)*3/4-C}function g(w,S,x){return(S+x)*3/4-x}function v(w){for(var S,x=m(w),C=x[0],A=x[1],P=new c(g(w,C,A)),R=0,N=A>0?C-4:C,k=0;k>16&255,P[R++]=S>>8&255,P[R++]=S&255;return A===2&&(S=l[w.charCodeAt(k)]<<2|l[w.charCodeAt(k+1)]>>4,P[R++]=S&255),A===1&&(S=l[w.charCodeAt(k)]<<10|l[w.charCodeAt(k+1)]<<4|l[w.charCodeAt(k+2)]>>2,P[R++]=S>>8&255,P[R++]=S&255),P}function b(w){return s[w>>18&63]+s[w>>12&63]+s[w>>6&63]+s[w&63]}function _(w,S,x){for(var C,A=[],P=S;PN?N:R+P));return C===1?(S=w[x-1],A.push(s[S>>2]+s[S<<4&63]+"==")):C===2&&(S=(w[x-2]<<8)+w[x-1],A.push(s[S>>10]+s[S>>4&63]+s[S<<2&63]+"=")),A.join("")}},{}],9:[function(o,n,i){function s(l,c){this.offset=l,this.nbits=c}i.kBlockLengthPrefixCode=[new s(1,2),new s(5,2),new s(9,2),new s(13,2),new s(17,3),new s(25,3),new s(33,3),new s(41,3),new s(49,4),new s(65,4),new s(81,4),new s(97,4),new s(113,5),new s(145,5),new s(177,5),new s(209,5),new s(241,6),new s(305,6),new s(369,7),new s(497,8),new s(753,9),new s(1265,10),new s(2289,11),new s(4337,12),new s(8433,13),new s(16625,24)],i.kInsertLengthPrefixCode=[new s(0,0),new s(1,0),new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,1),new s(8,1),new s(10,2),new s(14,2),new s(18,3),new s(26,3),new s(34,4),new s(50,4),new s(66,5),new s(98,5),new s(130,6),new s(194,7),new s(322,8),new s(578,9),new s(1090,10),new s(2114,12),new s(6210,14),new s(22594,24)],i.kCopyLengthPrefixCode=[new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,0),new s(7,0),new s(8,0),new s(9,0),new s(10,1),new s(12,1),new s(14,2),new s(18,2),new s(22,3),new s(30,3),new s(38,4),new s(54,4),new s(70,5),new s(102,5),new s(134,6),new s(198,7),new s(326,8),new s(582,9),new s(1094,10),new s(2118,24)],i.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],i.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(o,n,i){function s(c){this.buffer=c,this.pos=0}s.prototype.read=function(c,u,d){this.pos+d>this.buffer.length&&(d=this.buffer.length-this.pos);for(var f=0;fthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(c.subarray(0,u),this.pos),this.pos+=u,u},i.BrotliOutput=l},{}],11:[function(o,n,i){var s=o("./dictionary"),l=0,c=1,u=2,d=3,f=4,m=5,h=6,g=7,v=8,b=9,_=10,y=11,w=12,S=13,x=14,C=15,A=16,P=17,R=18,N=19,k=20;function E(F,D,z){this.prefix=new Uint8Array(F.length),this.transform=D,this.suffix=new Uint8Array(z.length);for(var L=0;L'),new E("",l,`
`),new E("",d,""),new E("",l,"]"),new E("",l," for "),new E("",x,""),new E("",u,""),new E("",l," a "),new E("",l," that "),new E(" ",_,""),new E("",l,". "),new E(".",l,""),new E(" ",l,", "),new E("",C,""),new E("",l," with "),new E("",l,"'"),new E("",l," from "),new E("",l," by "),new E("",A,""),new E("",P,""),new E(" the ",l,""),new E("",f,""),new E("",l,". The "),new E("",y,""),new E("",l," on "),new E("",l," as "),new E("",l," is "),new E("",g,""),new E("",c,"ing "),new E("",l,`
`),new E("",l,":"),new E(" ",l,". "),new E("",l,"ed "),new E("",k,""),new E("",R,""),new E("",h,""),new E("",l,"("),new E("",_,", "),new E("",v,""),new E("",l," at "),new E("",l,"ly "),new E(" the ",l," of "),new E("",m,""),new E("",b,""),new E(" ",_,", "),new E("",_,'"'),new E(".",l,"("),new E("",y," "),new E("",_,'">'),new E("",l,'="'),new E(" ",l,"."),new E(".com/",l,""),new E(" the ",l," of the "),new E("",_,"'"),new E("",l,". This "),new E("",l,","),new E(".",l," "),new E("",_,"("),new E("",_,"."),new E("",l," not "),new E(" ",l,'="'),new E("",l,"er "),new E(" ",y," "),new E("",l,"al "),new E(" ",y,""),new E("",l,"='"),new E("",y,'"'),new E("",_,". "),new E(" ",l,"("),new E("",l,"ful "),new E(" ",_,". "),new E("",l,"ive "),new E("",l,"less "),new E("",y,"'"),new E("",l,"est "),new E(" ",_,"."),new E("",y,'">'),new E(" ",l,"='"),new E("",_,","),new E("",l,"ize "),new E("",y,"."),new E("\xC2\xA0",l,""),new E(" ",l,","),new E("",_,'="'),new E("",y,'="'),new E("",l,"ous "),new E("",y,", "),new E("",_,"='"),new E(" ",_,","),new E(" ",y,'="'),new E(" ",y,", "),new E("",y,","),new E("",y,"("),new E("",y,". "),new E(" ",y,"."),new E("",y,"='"),new E(" ",y,". "),new E(" ",_,'="'),new E(" ",y,"='"),new E(" ",_,"='")];i.kTransforms=M,i.kNumTransforms=M.length;function V(F,D){return F[D]<192?(F[D]>=97&&F[D]<=122&&(F[D]^=32),1):F[D]<224?(F[D+1]^=32,2):(F[D+2]^=5,3)}i.transformDictionaryWord=function(F,D,z,L,O){var B=M[O].prefix,W=M[O].suffix,K=M[O].transform,Z=KL&&(Z=L);for(var de=0;de0;){var pe=V(F,te);te+=pe,L-=pe}for(var $=0;$typeof ra<"u"?ra:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof ra<"u"?ra:t)[r]}):e)(function(e){if(typeof ra<"u")return ra.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Sbe=(function(){var e,t,r;return(function(){function o(n,i,s){function l(d,f){if(!i[d]){if(!n[d]){var m=typeof PM=="function"&&PM;if(!f&&m)return m(d,!0);if(c)return c(d,!0);var h=new Error("Cannot find module '"+d+"'");throw h.code="MODULE_NOT_FOUND",h}var g=i[d]={exports:{}};n[d][0].call(g.exports,function(v){var b=n[d][1][v];return l(b||v)},g,g.exports,o,n,i,s)}return i[d].exports}for(var c=typeof PM=="function"&&PM,u=0;u=252?6:d>=248?5:d>=240?4:d>=224?3:d>=192?2:1;u[254]=u[254]=1,i.string2buf=function(m){var h,g,v,b,_,y=m.length,w=0;for(b=0;b>>6,h[_++]=128|g&63):g<65536?(h[_++]=224|g>>>12,h[_++]=128|g>>>6&63,h[_++]=128|g&63):(h[_++]=240|g>>>18,h[_++]=128|g>>>12&63,h[_++]=128|g>>>6&63,h[_++]=128|g&63);return h};function f(m,h){if(h<65534&&(m.subarray&&c||!m.subarray&&l))return String.fromCharCode.apply(null,s.shrinkBuf(m,h));for(var g="",v=0;v4){w[v++]=65533,g+=_-1;continue}for(b&=_===2?31:_===3?15:7;_>1&&g1){w[v++]=65533;continue}b<65536?w[v++]=b:(b-=65536,w[v++]=55296|b>>10&1023,w[v++]=56320|b&1023)}return f(w,v)},i.utf8border=function(m,h){var g;for(h=h||m.length,h>m.length&&(h=m.length),g=h-1;g>=0&&(m[g]&192)===128;)g--;return g<0||g===0?h:g+u[m[g]]>h?g:h}},{"./common":1}],3:[function(o,n,i){"use strict";function s(l,c,u,d){for(var f=l&65535|0,m=l>>>16&65535|0,h=0;u!==0;){h=u>2e3?2e3:u,u-=h;do f=f+c[d++]|0,m=m+f|0;while(--h);f%=65521,m%=65521}return f|m<<16|0}n.exports=s},{}],4:[function(o,n,i){"use strict";n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(o,n,i){"use strict";function s(){for(var u,d=[],f=0;f<256;f++){u=f;for(var m=0;m<8;m++)u=u&1?3988292384^u>>>1:u>>>1;d[f]=u}return d}var l=s();function c(u,d,f,m){var h=l,g=m+f;u^=-1;for(var v=m;v>>8^h[(u^d[v])&255];return u^-1}n.exports=c},{}],6:[function(o,n,i){"use strict";function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}n.exports=s},{}],7:[function(o,n,i){"use strict";var s=30,l=12;n.exports=function(u,d){var f,m,h,g,v,b,_,y,w,S,x,C,A,P,R,N,k,E,M,V,F,D,z,L,O;f=u.state,m=u.next_in,L=u.input,h=m+(u.avail_in-5),g=u.next_out,O=u.output,v=g-(d-u.avail_out),b=g+(u.avail_out-257),_=f.dmax,y=f.wsize,w=f.whave,S=f.wnext,x=f.window,C=f.hold,A=f.bits,P=f.lencode,R=f.distcode,N=(1<>>24,C>>>=M,A-=M,M=E>>>16&255,M===0)O[g++]=E&65535;else if(M&16){V=E&65535,M&=15,M&&(A>>=M,A-=M),A<15&&(C+=L[m++]<>>24,C>>>=M,A-=M,M=E>>>16&255,M&16){if(F=E&65535,M&=15,A_){u.msg="invalid distance too far back",f.mode=s;break e}if(C>>>=M,A-=M,M=g-v,F>M){if(M=F-M,M>w&&f.sane){u.msg="invalid distance too far back",f.mode=s;break e}if(D=0,z=x,S===0){if(D+=y-M,M2;)O[g++]=z[D++],O[g++]=z[D++],O[g++]=z[D++],V-=3;V&&(O[g++]=z[D++],V>1&&(O[g++]=z[D++]))}else{D=g-F;do O[g++]=O[D++],O[g++]=O[D++],O[g++]=O[D++],V-=3;while(V>2);V&&(O[g++]=O[D++],V>1&&(O[g++]=O[D++]))}}else if((M&64)===0){E=R[(E&65535)+(C&(1<>3,m-=V,A-=V<<3,C&=(1<>>24&255)+(se>>>8&65280)+((se&65280)<<8)+((se&255)<<24)}function Ue(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Ye(se){var Se;return!se||!se.state?S:(Se=se.state,se.total_in=se.total_out=Se.total=0,se.msg="",Se.wrap&&(se.adler=Se.wrap&1),Se.mode=R,Se.last=0,Se.havedict=0,Se.dmax=32768,Se.head=null,Se.hold=0,Se.bits=0,Se.lencode=Se.lendyn=new s.Buf32(Me),Se.distcode=Se.distdyn=new s.Buf32(Ne),Se.sane=1,Se.back=-1,_)}function st(se){var Se;return!se||!se.state?S:(Se=se.state,Se.wsize=0,Se.whave=0,Se.wnext=0,Ye(se))}function St(se,Se){var H,Pe;return!se||!se.state||(Pe=se.state,Se<0?(H=0,Se=-Se):(H=(Se>>4)+1,Se<48&&(Se&=15)),Se&&(Se<8||Se>15))?S:(Pe.window!==null&&Pe.wbits!==Se&&(Pe.window=null),Pe.wrap=H,Pe.wbits=Se,st(se))}function dt(se,Se){var H,Pe;return se?(Pe=new Ue,se.state=Pe,Pe.window=null,H=St(se,Se),H!==_&&(se.state=null),H):S}function xt(se){return dt(se,X)}var Xt=!0,Xe,ps;function Ga(se){if(Xt){var Se;for(Xe=new s.Buf32(512),ps=new s.Buf32(32),Se=0;Se<144;)se.lens[Se++]=8;for(;Se<256;)se.lens[Se++]=9;for(;Se<280;)se.lens[Se++]=7;for(;Se<288;)se.lens[Se++]=8;for(d(m,se.lens,0,288,Xe,0,se.work,{bits:9}),Se=0;Se<32;)se.lens[Se++]=5;d(h,se.lens,0,32,ps,0,se.work,{bits:5}),Xt=!1}se.lencode=Xe,se.lenbits=9,se.distcode=ps,se.distbits=5}function kr(se,Se,H,Pe){var Bt,Te=se.state;return Te.window===null&&(Te.wsize=1<=Te.wsize?(s.arraySet(Te.window,Se,H-Te.wsize,Te.wsize,0),Te.wnext=0,Te.whave=Te.wsize):(Bt=Te.wsize-Te.wnext,Bt>Pe&&(Bt=Pe),s.arraySet(Te.window,Se,H-Pe,Bt,Te.wnext),Pe-=Bt,Pe?(s.arraySet(Te.window,Se,H-Pe,Pe,0),Te.wnext=Pe,Te.whave=Te.wsize):(Te.wnext+=Bt,Te.wnext===Te.wsize&&(Te.wnext=0),Te.whave>>8&255,H.check=c(H.check,Ao,2,0),me=0,he=0,H.mode=N;break}if(H.flags=0,H.head&&(H.head.done=!1),!(H.wrap&1)||(((me&255)<<8)+(me>>8))%31){se.msg="incorrect header check",H.mode=ie;break}if((me&15)!==P){se.msg="unknown compression method",H.mode=ie;break}if(me>>>=4,he-=4,go=(me&15)+8,H.wbits===0)H.wbits=go;else if(go>H.wbits){se.msg="invalid window size",H.mode=ie;break}H.dmax=1<>8&1),H.flags&512&&(Ao[0]=me&255,Ao[1]=me>>>8&255,H.check=c(H.check,Ao,2,0)),me=0,he=0,H.mode=k;case k:for(;he<32;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>8&255,Ao[2]=me>>>16&255,Ao[3]=me>>>24&255,H.check=c(H.check,Ao,4,0)),me=0,he=0,H.mode=E;case E:for(;he<16;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>8),H.flags&512&&(Ao[0]=me&255,Ao[1]=me>>>8&255,H.check=c(H.check,Ao,2,0)),me=0,he=0,H.mode=M;case M:if(H.flags&1024){for(;he<16;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>8&255,H.check=c(H.check,Ao,2,0)),me=0,he=0}else H.head&&(H.head.extra=null);H.mode=V;case V:if(H.flags&1024&&(He=H.length,He>Ie&&(He=Ie),He&&(H.head&&(go=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),s.arraySet(H.head.extra,Pe,Te,He,go)),H.flags&512&&(H.check=c(H.check,Pe,He,Te)),Ie-=He,Te+=He,H.length-=He),H.length))break e;H.length=0,H.mode=F;case F:if(H.flags&2048){if(Ie===0)break e;He=0;do go=Pe[Te+He++],H.head&&go&&H.length<65536&&(H.head.name+=String.fromCharCode(go));while(go&&He>9&1,H.head.done=!0),se.adler=H.check=0,H.mode=B;break;case L:for(;he<32;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=he&7,he-=he&7,H.mode=ne;break}for(;he<3;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=1,he-=1,me&3){case 0:H.mode=K;break;case 1:if(Ga(H),H.mode=pe,Se===b){me>>>=2,he-=2;break e}break;case 2:H.mode=ue;break;case 3:se.msg="invalid block type",H.mode=ie}me>>>=2,he-=2;break;case K:for(me>>>=he&7,he-=he&7;he<32;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>16^65535)){se.msg="invalid stored block lengths",H.mode=ie;break}if(H.length=me&65535,me=0,he=0,H.mode=Z,Se===b)break e;case Z:H.mode=Q;case Q:if(He=H.length,He){if(He>Ie&&(He=Ie),He>mr&&(He=mr),He===0)break e;s.arraySet(Bt,Pe,Te,He,Ro),Ie-=He,Te+=He,mr-=He,Ro+=He,H.length-=He;break}H.mode=B;break;case ue:for(;he<14;){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=5,he-=5,H.ndist=(me&31)+1,me>>>=5,he-=5,H.ncode=(me&15)+4,me>>>=4,he-=4,H.nlen>286||H.ndist>30){se.msg="too many length or distance symbols",H.mode=ie;break}H.have=0,H.mode=te;case te:for(;H.have>>=3,he-=3}for(;H.have<19;)H.lens[u0[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,hs={bits:H.lenbits},ms=d(f,H.lens,0,19,H.lencode,0,H.work,hs),H.lenbits=hs.bits,ms){se.msg="invalid code lengths set",H.mode=ie;break}H.have=0,H.mode=de;case de:for(;H.have>>24,Rr=ht>>>16&255,Gr=ht&65535,!(bt<=he);){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=bt,he-=bt,H.lens[H.have++]=Gr;else{if(Gr===16){for(ea=bt+2;he>>=bt,he-=bt,H.have===0){se.msg="invalid bit length repeat",H.mode=ie;break}go=H.lens[H.have-1],He=3+(me&3),me>>>=2,he-=2}else if(Gr===17){for(ea=bt+3;he>>=bt,he-=bt,go=0,He=3+(me&7),me>>>=3,he-=3}else{for(ea=bt+7;he>>=bt,he-=bt,go=0,He=11+(me&127),me>>>=7,he-=7}if(H.have+He>H.nlen+H.ndist){se.msg="invalid bit length repeat",H.mode=ie;break}for(;He--;)H.lens[H.have++]=go}}if(H.mode===ie)break;if(H.lens[256]===0){se.msg="invalid code -- missing end-of-block",H.mode=ie;break}if(H.lenbits=9,hs={bits:H.lenbits},ms=d(m,H.lens,0,H.nlen,H.lencode,0,H.work,hs),H.lenbits=hs.bits,ms){se.msg="invalid literal/lengths set",H.mode=ie;break}if(H.distbits=6,H.distcode=H.distdyn,hs={bits:H.distbits},ms=d(h,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,hs),H.distbits=hs.bits,ms){se.msg="invalid distances set",H.mode=ie;break}if(H.mode=pe,Se===b)break e;case pe:H.mode=$;case $:if(Ie>=6&&mr>=258){se.next_out=Ro,se.avail_out=mr,se.next_in=Te,se.avail_in=Ie,H.hold=me,H.bits=he,u(se,Gt),Ro=se.next_out,Bt=se.output,mr=se.avail_out,Te=se.next_in,Pe=se.input,Ie=se.avail_in,me=H.hold,he=H.bits,H.mode===B&&(H.back=-1);break}for(H.back=0;ht=H.lencode[me&(1<>>24,Rr=ht>>>16&255,Gr=ht&65535,!(bt<=he);){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>ro)],bt=ht>>>24,Rr=ht>>>16&255,Gr=ht&65535,!(ro+bt<=he);){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=ro,he-=ro,H.back+=ro}if(me>>>=bt,he-=bt,H.back+=bt,H.length=Gr,Rr===0){H.mode=ee;break}if(Rr&32){H.back=-1,H.mode=B;break}if(Rr&64){se.msg="invalid literal/length code",H.mode=ie;break}H.extra=Rr&15,H.mode=oe;case oe:if(H.extra){for(ea=H.extra;he>>=H.extra,he-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=fe;case fe:for(;ht=H.distcode[me&(1<>>24,Rr=ht>>>16&255,Gr=ht&65535,!(bt<=he);){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>ro)],bt=ht>>>24,Rr=ht>>>16&255,Gr=ht&65535,!(ro+bt<=he);){if(Ie===0)break e;Ie--,me+=Pe[Te++]<>>=ro,he-=ro,H.back+=ro}if(me>>>=bt,he-=bt,H.back+=bt,Rr&64){se.msg="invalid distance code",H.mode=ie;break}H.offset=Gr,H.extra=Rr&15,H.mode=ve;case ve:if(H.extra){for(ea=H.extra;he>>=H.extra,he-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){se.msg="invalid distance too far back",H.mode=ie;break}H.mode=Oe;case Oe:if(mr===0)break e;if(He=Gt-mr,H.offset>He){if(He=H.offset-He,He>H.whave&&H.sane){se.msg="invalid distance too far back",H.mode=ie;break}He>H.wnext?(He-=H.wnext,xe=H.wsize-He):xe=H.wnext-He,He>H.length&&(He=H.length),it=H.window}else it=Bt,xe=Ro-H.offset,He=H.length;He>mr&&(He=mr),mr-=He,H.length-=He;do Bt[Ro++]=it[xe++];while(--He);H.length===0&&(H.mode=$);break;case ee:if(mr===0)break e;Bt[Ro++]=H.length,mr--,H.mode=$;break;case ne:if(H.wrap){for(;he<32;){if(Ie===0)break e;Ie--,me|=Pe[Te++]<=1&&$[V]===0;V--);if(F>V&&(F=V),V===0)return C[A++]=1<<24|64<<16|0,C[A++]=1<<24|64<<16|0,R.bits=1,0;for(M=1;M0&&(y===d||V!==1))return-1;for(oe[1]=0,k=1;kc||y===m&&O>u)return 1;for(;;){Oe=k-z,P[E]pe?(ee=fe[ve+P[E]],ne=te[de+P[E]]):(ee=96,ne=0),W=1<>z)+K]=Oe<<24|ee<<16|ne|0;while(K!==0);for(W=1<>=1;if(W!==0?(B&=W-1,B+=W):B=0,E++,--$[k]===0){if(k===V)break;k=w[S+P[E]]}if(k>F&&(B&Q)!==Z){for(z===0&&(z=F),ue+=M,D=k-z,L=1<c||y===m&&O>u)return 1;Z=B&Q,C[Z]=F<<24|D<<16|ue-A|0}}return B!==0&&(C[ue+B]=k-z<<24|64<<16|0),R.bits=F,0}},{"../utils/common":1}],10:[function(o,n,i){"use strict";n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(o,n,i){"use strict";function s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}n.exports=s},{}],"/lib/inflate.js":[function(o,n,i){"use strict";var s=o("./zlib/inflate"),l=o("./utils/common"),c=o("./utils/strings"),u=o("./zlib/constants"),d=o("./zlib/messages"),f=o("./zlib/zstream"),m=o("./zlib/gzheader"),h=Object.prototype.toString;function g(_){if(!(this instanceof g))return new g(_);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},_||{});var y=this.options;y.raw&&y.windowBits>=0&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),y.windowBits>=0&&y.windowBits<16&&!(_&&_.windowBits)&&(y.windowBits+=32),y.windowBits>15&&y.windowBits<48&&(y.windowBits&15)===0&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var w=s.inflateInit2(this.strm,y.windowBits);if(w!==u.Z_OK)throw new Error(d[w]);if(this.header=new m,s.inflateGetHeader(this.strm,this.header),y.dictionary&&(typeof y.dictionary=="string"?y.dictionary=c.string2buf(y.dictionary):h.call(y.dictionary)==="[object ArrayBuffer]"&&(y.dictionary=new Uint8Array(y.dictionary)),y.raw&&(w=s.inflateSetDictionary(this.strm,y.dictionary),w!==u.Z_OK)))throw new Error(d[w])}g.prototype.push=function(_,y){var w=this.strm,S=this.options.chunkSize,x=this.options.dictionary,C,A,P,R,N,k=!1;if(this.ended)return!1;A=y===~~y?y:y===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof _=="string"?w.input=c.binstring2buf(_):h.call(_)==="[object ArrayBuffer]"?w.input=new Uint8Array(_):w.input=_,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new l.Buf8(S),w.next_out=0,w.avail_out=S),C=s.inflate(w,u.Z_NO_FLUSH),C===u.Z_NEED_DICT&&x&&(C=s.inflateSetDictionary(this.strm,x)),C===u.Z_BUF_ERROR&&k===!0&&(C=u.Z_OK,k=!1),C!==u.Z_STREAM_END&&C!==u.Z_OK)return this.onEnd(C),this.ended=!0,!1;w.next_out&&(w.avail_out===0||C===u.Z_STREAM_END||w.avail_in===0&&(A===u.Z_FINISH||A===u.Z_SYNC_FLUSH))&&(this.options.to==="string"?(P=c.utf8border(w.output,w.next_out),R=w.next_out-P,N=c.buf2string(w.output,P),w.next_out=R,w.avail_out=S-R,R&&l.arraySet(w.output,w.output,P,R,0),this.onData(N)):this.onData(l.shrinkBuf(w.output,w.next_out))),w.avail_in===0&&w.avail_out===0&&(k=!0)}while((w.avail_in>0||w.avail_out===0)&&C!==u.Z_STREAM_END);return C===u.Z_STREAM_END&&(A=u.Z_FINISH),A===u.Z_FINISH?(C=s.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===u.Z_OK):(A===u.Z_SYNC_FLUSH&&(this.onEnd(u.Z_OK),w.avail_out=0),!0)},g.prototype.onData=function(_){this.chunks.push(_)},g.prototype.onEnd=function(_){_===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg};function v(_,y){var w=new g(y);if(w.push(_,!0),w.err)throw w.msg||d[w.err];return w.result}function b(_,y){return y=y||{},y.raw=!0,v(_,y)}i.Inflate=g,i.inflate=v,i.inflateRaw=b,i.ungzip=v},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")})();var ZQt=globalThis.fetch,kM=class{constructor(e,t={},r){this.type=e,this.detail=t,this.msg=r,Object.defineProperty(this,"__mayPropagate",{enumerable:!1,writable:!0}),this.__mayPropagate=!0}preventDefault(){}stopPropagation(){this.__mayPropagate=!1}valueOf(){return this}toString(){return this.msg?`[${this.type} event]: ${this.msg}`:`[${this.type} event]`}},qZe=class{constructor(){this.listeners={}}addEventListener(e,t,r){let o=this.listeners[e]||[];r?o.unshift(t):o.push(t),this.listeners[e]=o}removeEventListener(e,t){let r=this.listeners[e]||[],o=r.findIndex(n=>n===t);o>-1&&(r.splice(o,1),this.listeners[e]=r)}dispatch(e){let t=this.listeners[e.type];if(t)for(let r=0,o=t.length;rString.fromCharCode(t)).join("")}var XZe=class{constructor(e,t,r){this.name=(r||e.tag||"").trim(),this.length=e.length,this.start=e.offset,this.offset=0,this.data=t,["getInt8","getUint8","getInt16","getUint16","getInt32","getUint32","getBigInt64","getBigUint64"].forEach(o=>{let n=o.replace(/get(Big)?/,"").toLowerCase(),i=parseInt(o.replace(/[^\d]/g,""))/8;Object.defineProperty(this,n,{get:()=>this.getValue(o,i)})})}get currentPosition(){return this.start+this.offset}set currentPosition(e){this.start=e,this.offset=0}skip(e=0,t=8){this.offset+=e*t/8}getValue(e,t){let r=this.start+this.offset;this.offset+=t;try{return this.data[e](r)}catch(o){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),o}}flags(e){if(e===8||e===16||e===32||e===64)return this[`uint${e}`].toString(2).padStart(e,0).split("").map(t=>t==="1");console.error("Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long"),console.trace()}get tag(){let e=this.uint32;return ZZe([e>>24&255,e>>16&255,e>>8&255,e&255])}get fixed(){let e=this.int16,t=Math.round(1e3*this.uint16/65356);return e+t/1e3}get legacyFixed(){let e=this.uint16,t=this.uint16.toString(16).padStart(4,0);return parseFloat(`${e}.${t}`)}get uint24(){return(this.uint8<<16)+(this.uint8<<8)+this.uint8}get uint128(){let e=0;for(let t=0;t<5;t++){let r=this.uint8;if(e=e*128+(r&127),r<128)break}return e}get longdatetime(){return new Date(KZe+1e3*parseInt(this.int64.toString()))}get fword(){return this.int16}get ufword(){return this.uint16}get Offset16(){return this.uint16}get Offset32(){return this.uint32}get F2DOT14(){let e=p.uint16,t=[0,1,-2,-1][e>>14],r=e&16383;return t+r/16384}verifyLength(){this.offset!=this.length&&console.error(`unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`)}readBytes(e=0,t=0,r=8,o=!1){if(e=e||this.length,e===0)return[];t&&(this.currentPosition=t);let n=`${o?"":"u"}int${r}`,i=[];for(;e--;)i.push(this[n]);return i}},Eo=class{constructor(e){Object.defineProperty(this,"parser",{enumerable:!1,get:()=>e});let r=e.currentPosition;Object.defineProperty(this,"start",{enumerable:!1,get:()=>r})}load(e){Object.keys(e).forEach(t=>{let r=Object.getOwnPropertyDescriptor(e,t);r.get?this[t]=r.get.bind(this):r.value!==void 0&&(this[t]=r.value)}),this.parser.length&&this.parser.verifyLength()}},yt=class extends Eo{constructor(e,t,r){let{parser:o,start:n}=super(new XZe(e,t,r));Object.defineProperty(this,"p",{enumerable:!1,get:()=>o}),Object.defineProperty(this,"tableStart",{enumerable:!1,get:()=>n})}};function ze(e,t,r){let o;Object.defineProperty(e,t,{get:()=>o||(o=r(),o),enumerable:!0})}var QZe=class extends yt{constructor(e,t,r){let{p:o}=super({offset:0,length:12},t,"sfnt");this.version=o.uint32,this.numTables=o.uint16,this.searchRange=o.uint16,this.entrySelector=o.uint16,this.rangeShift=o.uint16,o.verifyLength(),this.directory=[...new Array(this.numTables)].map(n=>new JZe(o)),this.tables={},this.directory.forEach(n=>{let i=()=>r(this.tables,{tag:n.tag,offset:n.offset,length:n.length},t);ze(this.tables,n.tag.trim(),i)})}},JZe=class{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}},xbe=Sbe.inflate||void 0,Cbe=void 0,$Ze=class extends yt{constructor(e,t,r){let{p:o}=super({offset:0,length:44},t,"woff");this.signature=o.tag,this.flavor=o.uint32,this.length=o.uint32,this.numTables=o.uint16,o.uint16,this.totalSfntSize=o.uint32,this.majorVersion=o.uint16,this.minorVersion=o.uint16,this.metaOffset=o.uint32,this.metaLength=o.uint32,this.metaOrigLength=o.uint32,this.privOffset=o.uint32,this.privLength=o.uint32,o.verifyLength(),this.directory=[...new Array(this.numTables)].map(n=>new eXe(o)),tXe(this,t,r)}},eXe=class{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}};function tXe(e,t,r){e.tables={},e.directory.forEach(o=>{ze(e.tables,o.tag.trim(),()=>{let n=0,i=t;if(o.compLength!==o.origLength){let s=t.buffer.slice(o.offset,o.offset+o.compLength),l;if(xbe)l=xbe(new Uint8Array(s));else if(Cbe)l=Cbe(new Uint8Array(s));else{let c="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(c),new Error(c)}i=new DataView(l.buffer)}else n=o.offset;return r(e.tables,{tag:o.tag,offset:n,length:o.origLength},i)})})}var Ebe=_be,Tbe=void 0,rXe=class extends yt{constructor(e,t,r){let{p:o}=super({offset:0,length:48},t,"woff2");this.signature=o.tag,this.flavor=o.uint32,this.length=o.uint32,this.numTables=o.uint16,o.uint16,this.totalSfntSize=o.uint32,this.totalCompressedSize=o.uint32,this.majorVersion=o.uint16,this.minorVersion=o.uint16,this.metaOffset=o.uint32,this.metaLength=o.uint32,this.metaOrigLength=o.uint32,this.privOffset=o.uint32,this.privLength=o.uint32,o.verifyLength(),this.directory=[...new Array(this.numTables)].map(l=>new oXe(o));let n=o.currentPosition;this.directory[0].offset=0,this.directory.forEach((l,c)=>{let u=this.directory[c+1];u&&(u.offset=l.offset+(l.transformLength!==void 0?l.transformLength:l.origLength))});let i,s=t.buffer.slice(n);if(Ebe)i=Ebe(new Uint8Array(s));else if(Tbe)i=new Uint8Array(Tbe(s));else{let l="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(l),new Error(l)}nXe(this,i,r)}},oXe=class{constructor(e){this.flags=e.uint8;let t=this.tagNumber=this.flags&63;t===63?this.tag=e.tag:this.tag=iXe(t);let o=(this.transformVersion=(this.flags&192)>>6)!==0;(this.tag==="glyf"||this.tag==="loca")&&(o=this.transformVersion!==3),this.origLength=e.uint128,o&&(this.transformLength=e.uint128)}};function nXe(e,t,r){e.tables={},e.directory.forEach(o=>{ze(e.tables,o.tag.trim(),()=>{let n=o.offset,i=n+(o.transformLength?o.transformLength:o.origLength),s=new DataView(t.slice(n,i).buffer);try{return r(e.tables,{tag:o.tag,offset:0,length:o.origLength},s)}catch(l){console.error(l)}})})}function iXe(e){return["cmap","head","hhea","hmtx","maxp","name","OS/2","post","cvt ","fpgm","glyf","loca","prep","CFF ","VORG","EBDT","EBLC","gasp","hdmx","kern","LTSH","PCLT","VDMX","vhea","vmtx","BASE","GDEF","GPOS","GSUB","EBSC","JSTF","MATH","CBDT","CBLC","COLR","CPAL","SVG ","sbix","acnt","avar","bdat","bloc","bsln","cvar","fdsc","feat","fmtx","fvar","gvar","hsty","just","lcar","mort","morx","opbd","prop","trak","Zapf","Silf","Glat","Gloc","Feat","Sill"][e&63]}var Nbe={},Mbe=!1;Promise.all([Promise.resolve().then(function(){return NXe}),Promise.resolve().then(function(){return FXe}),Promise.resolve().then(function(){return LXe}),Promise.resolve().then(function(){return jXe}),Promise.resolve().then(function(){return HXe}),Promise.resolve().then(function(){return qXe}),Promise.resolve().then(function(){return ZXe}),Promise.resolve().then(function(){return QXe}),Promise.resolve().then(function(){return aQe}),Promise.resolve().then(function(){return bQe}),Promise.resolve().then(function(){return iJe}),Promise.resolve().then(function(){return aJe}),Promise.resolve().then(function(){return dJe}),Promise.resolve().then(function(){return hJe}),Promise.resolve().then(function(){return vJe}),Promise.resolve().then(function(){return yJe}),Promise.resolve().then(function(){return SJe}),Promise.resolve().then(function(){return CJe}),Promise.resolve().then(function(){return TJe}),Promise.resolve().then(function(){return kJe}),Promise.resolve().then(function(){return AJe}),Promise.resolve().then(function(){return OJe}),Promise.resolve().then(function(){return FJe}),Promise.resolve().then(function(){return VJe}),Promise.resolve().then(function(){return BJe}),Promise.resolve().then(function(){return zJe}),Promise.resolve().then(function(){return UJe}),Promise.resolve().then(function(){return GJe}),Promise.resolve().then(function(){return qJe}),Promise.resolve().then(function(){return XJe}),Promise.resolve().then(function(){return r$e}),Promise.resolve().then(function(){return s$e}),Promise.resolve().then(function(){return c$e}),Promise.resolve().then(function(){return p$e}),Promise.resolve().then(function(){return h$e}),Promise.resolve().then(function(){return v$e}),Promise.resolve().then(function(){return w$e}),Promise.resolve().then(function(){return S$e}),Promise.resolve().then(function(){return P$e}),Promise.resolve().then(function(){return R$e}),Promise.resolve().then(function(){return O$e})]).then(e=>{e.forEach(t=>{let r=Object.keys(t)[0];Nbe[r]=t[r]}),Mbe=!0});function sXe(e,t,r){let o=t.tag.replace(/[^\w\d]/g,""),n=Nbe[o];return n?new n(t,r,e):(console.warn(`lib-font has no definition for ${o}. The table was skipped.`),{})}function aXe(){let e=0;function t(r,o){if(!Mbe)return e>10?o(new Error("loading took too long")):(e++,setTimeout(()=>t(r),250));r(sXe)}return new Promise((r,o)=>t(r))}function lXe(e,t){let r=e.lastIndexOf("."),o=(e.substring(r+1)||"").toLowerCase(),n={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[o];if(n)return n;let i={eot:"The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.",svg:"The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.",fon:"The .fon format is not supported: this is an ancient Windows bitmap font format.",ttc:"Based on the current CSS specification, font collections are not (yet?) supported."}[o];if(i||(i=`${e} is not a known webfont format.`),t)throw new Error(i);console.warn(`Could not load font: ${i}`)}async function cXe(e,t,r={}){if(!globalThis.document)return;let o=lXe(t,r.errorOnStyle);if(!o)return;let n=document.createElement("style");n.className="injected-by-Font-js";let i=[];return r.styleRules&&(i=Object.entries(r.styleRules).map(([s,l])=>`${s}: ${l};`)),n.textContent=`
@font-face {
font-family: "${e}";
${i.join(`
`)}
src: url("${t}") format("${o}");
}`,globalThis.document.head.appendChild(n),n}var uXe=[0,1,0,0],dXe=[79,84,84,79],fXe=[119,79,70,70],pXe=[119,79,70,50];function RM(e,t){if(e.length===t.length){for(let r=0;r(globalThis.document&&!this.options.skipStyleSheet&&await cXe(this.name,e,this.options),this.loadFont(e)))()}async loadFont(e,t){fetch(e).then(r=>hXe(r)&&r.arrayBuffer()).then(r=>this.fromDataBuffer(r,t||e)).catch(r=>{let o=new kM("error",r,`Failed to load font at ${t||e}`);this.dispatch(o),this.onerror&&this.onerror(o)})}async fromDataBuffer(e,t){this.fontData=new DataView(e);let r=mXe(this.fontData);if(!r)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(r);let o=new kM("load",{font:this});this.dispatch(o),this.onload&&this.onload(o)}async parseBasicData(e){return aXe().then(t=>(e==="SFNT"&&(this.opentype=new QZe(this,this.fontData,t)),e==="WOFF"&&(this.opentype=new $Ze(this,this.fontData,t)),e==="WOFF2"&&(this.opentype=new rXe(this,this.fontData,t)),this.opentype))}getGlyphId(e){return this.opentype.tables.cmap.getGlyphId(e)}reverse(e){return this.opentype.tables.cmap.reverse(e)}supports(e){return this.getGlyphId(e)!==0}supportsVariation(e){return this.opentype.tables.cmap.supportsVariation(e)!==!1}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let r=document.createElement("div");r.textContent=e,r.style.fontFamily=this.name,r.style.fontSize=`${t}px`,r.style.color="transparent",r.style.background="transparent",r.style.top="0",r.style.left="0",r.style.position="absolute",document.body.appendChild(r);let o=r.getBoundingClientRect();document.body.removeChild(r);let n=this.opentype.tables["OS/2"];return o.fontSize=t,o.ascender=n.sTypoAscender,o.descender=n.sTypoDescender,o}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);let e=new kM("unload",{font:this});this.dispatch(e),this.onunload&&this.onunload(e)}this._unloaded=!0}load(){if(this.__unloaded){delete this.__unloaded,document.head.appendChild(this.styleElement);let e=new kM("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}};globalThis.Font=IM;var Sp=class extends Eo{constructor(e,t,r){super(e),this.plaformID=t,this.encodingID=r}},gXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map(o=>e.uint8)}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.")),0<=e&&e<=255}reverse(e){return console.warn("reverse not implemented for cmap subtable format 0"),{}}getSupportedCharCodes(){return[{start:1,end:256}]}},vXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map(s=>e.uint16);let o=Math.max(...this.subHeaderKeys),n=e.currentPosition;ze(this,"subHeaders",()=>(e.currentPosition=n,[...new Array(o)].map(s=>new bXe(e))));let i=n+o*8;ze(this,"glyphIndexArray",()=>(e.currentPosition=i,[...new Array(o)].map(s=>e.uint16)))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));let t=e&&255,r=e&&65280,o=this.subHeaders[r],n=this.subHeaders[o],i=n.firstCode,s=i+n.entryCount;return i<=t&&t<=s}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map(t=>({firstCode:t.firstCode,lastCode:t.lastCode})):this.subHeaders.map(t=>({start:t.firstCode,end:t.lastCode}))}},bXe=class{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}},yXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=4,this.length=e.uint16,this.language=e.uint16,this.segCountX2=e.uint16,this.segCount=this.segCountX2/2,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16;let o=e.currentPosition;ze(this,"endCode",()=>e.readBytes(this.segCount,o,16));let n=o+2+this.segCountX2;ze(this,"startCode",()=>e.readBytes(this.segCount,n,16));let i=n+this.segCountX2;ze(this,"idDelta",()=>e.readBytes(this.segCount,i,16,!0));let s=i+this.segCountX2;ze(this,"idRangeOffset",()=>e.readBytes(this.segCount,s,16));let l=s+this.segCountX2,c=this.length-(l-this.tableStart);ze(this,"glyphIdArray",()=>e.readBytes(c,l,16)),ze(this,"segments",()=>this.buildSegments(s,l,e))}buildSegments(e,t,r){let o=(n,i)=>{let s=this.startCode[i],l=this.endCode[i],c=this.idDelta[i],u=this.idRangeOffset[i],d=e+2*i,f=[];if(u===0)for(let m=s+c,h=l+c;m<=h;m++)f.push(m);else for(let m=0,h=l-s;m<=h;m++)r.currentPosition=d+u+m*2,f.push(r.uint16);return{startCode:s,endCode:l,idDelta:c,idRangeOffset:u,glyphIDs:f}};return[...new Array(this.segCount)].map(o)}reverse(e){let t=this.segments.find(o=>o.glyphIDs.includes(e));if(!t)return{};let r=t.startCode+t.glyphIDs.indexOf(e);return{code:r,unicode:String.fromCodePoint(r)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343||(e&65534)===65534||(e&65535)===65535)return 0;let t=this.segments.find(r=>r.startCode<=e&&e<=r.endCode);return t?t.glyphIDs[e-t.startCode]:0}supports(e){return this.getGlyphId(e)!==0}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map(t=>({start:t.startCode,end:t.endCode}))}},wXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=6,this.length=e.uint16,this.language=e.uint16,this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.firstCode+this.entryCount-1,ze(this,"glyphIdArray",()=>[...new Array(this.entryCount)].map(n=>e.uint16))}supports(e){if(e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.")),ethis.firstCode+this.entryCount)return{};let t=e-this.firstCode;return{code:t,unicode:String.fromCodePoint(t)}}reverse(e){let t=this.glyphIdArray.indexOf(e);if(t>-1)return this.firstCode+t}getSupportedCharCodes(e=!1){return e?[{firstCode:this.firstCode,lastCode:this.lastCode}]:[{start:this.firstCode,end:this.lastCode}]}},_Xe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=8,e.uint16,this.length=e.uint32,this.language=e.uint32,this.is32=[...new Array(8192)].map(n=>e.uint8),this.numGroups=e.uint32,ze(this,"groups",()=>[...new Array(this.numGroups)].map(n=>new SXe(e)))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.")),this.groups.findIndex(t=>t.startcharCode<=e&&e<=t.endcharCode)!==-1}reverse(e){return console.warn("reverse not implemented for cmap subtable format 8"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map(t=>({start:t.startcharCode,end:t.endcharCode}))}},SXe=class{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}},xXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=10,e.uint16,this.length=e.uint32,this.language=e.uint32,this.startCharCode=e.uint32,this.numChars=e.uint32,this.endCharCode=this.startCharCode+this.numChars,ze(this,"glyphs",()=>[...new Array(this.numChars)].map(n=>e.uint16))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.")),ethis.startCharCode+this.numChars?!1:e-this.startCharCode}reverse(e){return console.warn("reverse not implemented for cmap subtable format 10"),{}}getSupportedCharCodes(e=!1){return e?[{startCharCode:this.startCharCode,endCharCode:this.endCharCode}]:[{start:this.startCharCode,end:this.endCharCode}]}},CXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32,ze(this,"groups",()=>[...new Array(this.numGroups)].map(n=>new EXe(e)))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343||(e&65534)===65534||(e&65535)===65535?0:this.groups.findIndex(t=>t.startCharCode<=e&&e<=t.endCharCode)!==-1}reverse(e){for(let t of this.groups){let r=t.startGlyphID;if(r>e)continue;if(r===e)return t.startCharCode;if(r+(t.endCharCode-t.startCharCode)({start:t.startCharCode,end:t.endCharCode}))}},EXe=class{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}},TXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;let o=[...new Array(this.numGroups)].map(n=>new PXe(e));ze(this,"groups",o)}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),this.groups.findIndex(t=>t.startCharCode<=e&&e<=t.endCharCode)!==-1}reverse(e){return console.warn("reverse not implemented for cmap subtable format 13"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map(t=>({start:t.startCharCode,end:t.endCharCode}))}},PXe=class{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}},kXe=class extends Sp{constructor(e,t,r){super(e,t,r),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,ze(this,"varSelectors",()=>[...new Array(this.numVarSelectorRecords)].map(o=>new RXe(e)))}supports(){return console.warn("supports not implemented for cmap subtable format 14"),0}getSupportedCharCodes(){return console.warn("getSupportedCharCodes not implemented for cmap subtable format 14"),[]}reverse(e){return console.warn("reverse not implemented for cmap subtable format 14"),{}}supportsVariation(e){let t=this.varSelector.find(r=>r.varSelector===e);return t||!1}getSupportedVariations(){return this.varSelectors.map(e=>e.varSelector)}},RXe=class{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}};function AXe(e,t,r){let o=e.uint16;return o===0?new gXe(e,t,r):o===2?new vXe(e,t,r):o===4?new yXe(e,t,r):o===6?new wXe(e,t,r):o===8?new _Xe(e,t,r):o===10?new xXe(e,t,r):o===12?new CXe(e,t,r):o===13?new TXe(e,t,r):o===14?new kXe(e,t,r):{}}var IXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numTables=r.uint16,this.encodingRecords=[...new Array(this.numTables)].map(o=>new OXe(r,this.tableStart))}getSubTable(e){return this.encodingRecords[e].table}getSupportedEncodings(){return this.encodingRecords.map(e=>({platformID:e.platformID,encodingId:e.encodingID}))}getSupportedCharCodes(e,t){let r=this.encodingRecords.findIndex(n=>n.platformID===e&&n.encodingID===t);return r===-1?!1:this.getSubTable(r).getSupportedCharCodes()}reverse(e){for(let t=0;t{let n=this.getSubTable(o);return n.getGlyphId?(t=n.getGlyphId(e),t!==0):!1}),t}supports(e){return this.encodingRecords.some((t,r)=>{let o=this.getSubTable(r);return o.supports&&o.supports(e)!==!1})}supportsVariation(e){return this.encodingRecords.some((t,r)=>{let o=this.getSubTable(r);return o.supportsVariation&&o.supportsVariation(e)!==!1})}},OXe=class{constructor(e,t){let r=this.platformID=e.uint16,o=this.encodingID=e.uint16,n=this.offset=e.Offset32;ze(this,"table",()=>(e.currentPosition=t+n,AXe(e,r,o)))}},NXe=Object.freeze({__proto__:null,cmap:IXe}),MXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.load({majorVersion:r.uint16,minorVersion:r.uint16,fontRevision:r.fixed,checkSumAdjustment:r.uint32,magicNumber:r.uint32,flags:r.flags(16),unitsPerEm:r.uint16,created:r.longdatetime,modified:r.longdatetime,xMin:r.int16,yMin:r.int16,xMax:r.int16,yMax:r.int16,macStyle:r.flags(16),lowestRecPPEM:r.uint16,fontDirectionHint:r.uint16,indexToLocFormat:r.uint16,glyphDataFormat:r.uint16})}},FXe=Object.freeze({__proto__:null,head:MXe}),DXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.ascender=r.fword,this.descender=r.fword,this.lineGap=r.fword,this.advanceWidthMax=r.ufword,this.minLeftSideBearing=r.fword,this.minRightSideBearing=r.fword,this.xMaxExtent=r.fword,this.caretSlopeRise=r.int16,this.caretSlopeRun=r.int16,this.caretOffset=r.int16,r.int16,r.int16,r.int16,r.int16,this.metricDataFormat=r.int16,this.numberOfHMetrics=r.uint16,r.verifyLength()}},LXe=Object.freeze({__proto__:null,hhea:DXe}),VXe=class extends yt{constructor(e,t,r){let{p:o}=super(e,t),n=r.hhea.numberOfHMetrics,i=r.maxp.numGlyphs,s=o.currentPosition;if(ze(this,"hMetrics",()=>(o.currentPosition=s,[...new Array(n)].map(l=>new BXe(o.uint16,o.int16)))),n(o.currentPosition=l,[...new Array(i-n)].map(c=>o.int16)))}}},BXe=class{constructor(e,t){this.advanceWidth=e,this.lsb=t}},jXe=Object.freeze({__proto__:null,hmtx:VXe}),zXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.legacyFixed,this.numGlyphs=r.uint16,this.version===1&&(this.maxPoints=r.uint16,this.maxContours=r.uint16,this.maxCompositePoints=r.uint16,this.maxCompositeContours=r.uint16,this.maxZones=r.uint16,this.maxTwilightPoints=r.uint16,this.maxStorage=r.uint16,this.maxFunctionDefs=r.uint16,this.maxInstructionDefs=r.uint16,this.maxStackElements=r.uint16,this.maxSizeOfInstructions=r.uint16,this.maxComponentElements=r.uint16,this.maxComponentDepth=r.uint16),r.verifyLength()}},HXe=Object.freeze({__proto__:null,maxp:zXe}),UXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.format=r.uint16,this.count=r.uint16,this.stringOffset=r.Offset16,this.nameRecords=[...new Array(this.count)].map(o=>new GXe(r,this)),this.format===1&&(this.langTagCount=r.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map(o=>new WXe(r.uint16,r.Offset16))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find(r=>r.nameID===e);if(t)return t.string}},WXe=class{constructor(e,t){this.length=e,this.offset=t}},GXe=class{constructor(e,t){this.platformID=e.uint16,this.encodingID=e.uint16,this.languageID=e.uint16,this.nameID=e.uint16,this.length=e.uint16,this.offset=e.Offset16,ze(this,"string",()=>(e.currentPosition=t.stringStart+this.offset,YXe(e,this)))}};function YXe(e,t){let{platformID:r,length:o}=t;if(o===0)return"";if(r===0||r===3){let s=[];for(let l=0,c=o/2;lr.uint8),this.ulUnicodeRange1=r.flags(32),this.ulUnicodeRange2=r.flags(32),this.ulUnicodeRange3=r.flags(32),this.ulUnicodeRange4=r.flags(32),this.achVendID=r.tag,this.fsSelection=r.uint16,this.usFirstCharIndex=r.uint16,this.usLastCharIndex=r.uint16,this.sTypoAscender=r.int16,this.sTypoDescender=r.int16,this.sTypoLineGap=r.int16,this.usWinAscent=r.uint16,this.usWinDescent=r.uint16,this.version===0||(this.ulCodePageRange1=r.flags(32),this.ulCodePageRange2=r.flags(32),this.version===1)||(this.sxHeight=r.int16,this.sCapHeight=r.int16,this.usDefaultChar=r.uint16,this.usBreakChar=r.uint16,this.usMaxContext=r.uint16,this.version<=4)||(this.usLowerOpticalPointSize=r.uint16,this.usUpperOpticalPointSize=r.uint16,this.version===5))return r.verifyLength()}},ZXe=Object.freeze({__proto__:null,OS2:KXe}),XXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);if(this.version=r.legacyFixed,this.italicAngle=r.fixed,this.underlinePosition=r.fword,this.underlineThickness=r.fword,this.isFixedPitch=r.uint32,this.minMemType42=r.uint32,this.maxMemType42=r.uint32,this.minMemType1=r.uint32,this.maxMemType1=r.uint32,this.version===1||this.version===3)return r.verifyLength();if(this.numGlyphs=r.uint16,this.version===2){this.glyphNameIndex=[...new Array(this.numGlyphs)].map(o=>r.uint16),this.namesOffset=r.currentPosition,this.glyphNameOffsets=[1];for(let o=0;or.int8))}getGlyphName(e){if(this.version!==2)return console.warn(`post table version ${this.version} does not support glyph name lookups`),"";let t=this.glyphNameIndex[e];if(t<258)return Pbe[t];let r=this.glyphNameOffsets[e],n=this.glyphNameOffsets[e+1]-r-1;return n===0?".notdef.":(this.parser.currentPosition=this.namesOffset+r,this.parser.readBytes(n,this.namesOffset+r,8,!0).map(s=>String.fromCharCode(s)).join(""))}},Pbe=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"],QXe=Object.freeze({__proto__:null,post:XXe}),JXe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.horizAxisOffset=r.Offset16,this.vertAxisOffset=r.Offset16,ze(this,"horizAxis",()=>new nG({offset:e.offset+this.horizAxisOffset},t)),ze(this,"vertAxis",()=>new nG({offset:e.offset+this.vertAxisOffset},t)),this.majorVersion===1&&this.minorVersion===1&&(this.itemVarStoreOffset=r.Offset32,ze(this,"itemVarStore",()=>new nG({offset:e.offset+this.itemVarStoreOffset},t)))}},nG=class extends yt{constructor(e,t){let{p:r}=super(e,t,"AxisTable");this.baseTagListOffset=r.Offset16,this.baseScriptListOffset=r.Offset16,ze(this,"baseTagList",()=>new $Xe({offset:e.offset+this.baseTagListOffset},t)),ze(this,"baseScriptList",()=>new eQe({offset:e.offset+this.baseScriptListOffset},t))}},$Xe=class extends yt{constructor(e,t){let{p:r}=super(e,t,"BaseTagListTable");this.baseTagCount=r.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map(o=>r.tag)}},eQe=class extends yt{constructor(e,t){let{p:r}=super(e,t,"BaseScriptListTable");this.baseScriptCount=r.uint16;let o=r.currentPosition;ze(this,"baseScriptRecords",()=>(r.currentPosition=o,[...new Array(this.baseScriptCount)].map(n=>new tQe(this.start,r))))}},tQe=class{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,ze(this,"baseScriptTable",()=>(t.currentPosition=e+this.baseScriptOffset,new rQe(t)))}},rQe=class{constructor(e){this.start=e.currentPosition,this.baseValuesOffset=e.Offset16,this.defaultMinMaxOffset=e.Offset16,this.baseLangSysCount=e.uint16,this.baseLangSysRecords=[...new Array(this.baseLangSysCount)].map(t=>new oQe(this.start,e)),ze(this,"baseValues",()=>(e.currentPosition=this.start+this.baseValuesOffset,new nQe(e))),ze(this,"defaultMinMax",()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new Fbe(e)))}},oQe=class{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,ze(this,"minMax",()=>(t.currentPosition=e+this.minMaxOffset,new Fbe(t)))}},nQe=class{constructor(e){this.parser=e,this.start=e.currentPosition,this.defaultBaselineIndex=e.uint16,this.baseCoordCount=e.uint16,this.baseCoords=[...new Array(this.baseCoordCount)].map(t=>e.Offset16)}getTable(e){return this.parser.currentPosition=this.start+this.baseCoords[e],new sQe(this.parser)}},Fbe=class{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;let t=e.currentPosition;ze(this,"featMinMaxRecords",()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map(r=>new iQe(e))))}},iQe=class{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}},sQe=class{constructor(e){this.baseCoordFormat=e.uint16,this.coordinate=e.int16,this.baseCoordFormat===2&&(this.referenceGlyph=e.uint16,this.baseCoordPoint=e.uint16),this.baseCoordFormat===3&&(this.deviceTable=e.Offset16)}},aQe=Object.freeze({__proto__:null,BASE:JXe}),kbe=class{constructor(e){this.classFormat=e.uint16,this.classFormat===1&&(this.startGlyphID=e.uint16,this.glyphCount=e.uint16,this.classValueArray=[...new Array(this.glyphCount)].map(t=>e.uint16)),this.classFormat===2&&(this.classRangeCount=e.uint16,this.classRangeRecords=[...new Array(this.classRangeCount)].map(t=>new lQe(e)))}},lQe=class{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}},_T=class extends Eo{constructor(e){super(e),this.coverageFormat=e.uint16,this.coverageFormat===1&&(this.glyphCount=e.uint16,this.glyphArray=[...new Array(this.glyphCount)].map(t=>e.uint16)),this.coverageFormat===2&&(this.rangeCount=e.uint16,this.rangeRecords=[...new Array(this.rangeCount)].map(t=>new cQe(e)))}},cQe=class{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}},uQe=class{constructor(e,t){this.table=e,this.parser=t,this.start=t.currentPosition,this.format=t.uint16,this.variationRegionListOffset=t.Offset32,this.itemVariationDataCount=t.uint16,this.itemVariationDataOffsets=[...new Array(this.itemVariationDataCount)].map(r=>t.Offset32)}},dQe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.glyphClassDefOffset=r.Offset16,ze(this,"glyphClassDefs",()=>{if(this.glyphClassDefOffset!==0)return r.currentPosition=this.tableStart+this.glyphClassDefOffset,new kbe(r)}),this.attachListOffset=r.Offset16,ze(this,"attachList",()=>{if(this.attachListOffset!==0)return r.currentPosition=this.tableStart+this.attachListOffset,new fQe(r)}),this.ligCaretListOffset=r.Offset16,ze(this,"ligCaretList",()=>{if(this.ligCaretListOffset!==0)return r.currentPosition=this.tableStart+this.ligCaretListOffset,new mQe(r)}),this.markAttachClassDefOffset=r.Offset16,ze(this,"markAttachClassDef",()=>{if(this.markAttachClassDefOffset!==0)return r.currentPosition=this.tableStart+this.markAttachClassDefOffset,new kbe(r)}),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=r.Offset16,ze(this,"markGlyphSetsDef",()=>{if(this.markGlyphSetsDefOffset!==0)return r.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new vQe(r)})),this.minorVersion===3&&(this.itemVarStoreOffset=r.Offset32,ze(this,"itemVarStore",()=>{if(this.itemVarStoreOffset!==0)return r.currentPosition=this.tableStart+this.itemVarStoreOffset,new uQe(r)}))}},fQe=class extends Eo{constructor(e){super(e),this.coverageOffset=e.Offset16,this.glyphCount=e.uint16,this.attachPointOffsets=[...new Array(this.glyphCount)].map(t=>e.Offset16)}getPoint(e){return this.parser.currentPosition=this.start+this.attachPointOffsets[e],new pQe(this.parser)}},pQe=class{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map(t=>e.uint16)}},mQe=class extends Eo{constructor(e){super(e),this.coverageOffset=e.Offset16,ze(this,"coverage",()=>(e.currentPosition=this.start+this.coverageOffset,new _T(e))),this.ligGlyphCount=e.uint16,this.ligGlyphOffsets=[...new Array(this.ligGlyphCount)].map(t=>e.Offset16)}getLigGlyph(e){return this.parser.currentPosition=this.start+this.ligGlyphOffsets[e],new hQe(this.parser)}},hQe=class extends Eo{constructor(e){super(e),this.caretCount=e.uint16,this.caretValueOffsets=[...new Array(this.caretCount)].map(t=>e.Offset16)}getCaretValue(e){return this.parser.currentPosition=this.start+this.caretValueOffsets[e],new gQe(this.parser)}},gQe=class{constructor(e){this.caretValueFormat=e.uint16,this.caretValueFormat===1&&(this.coordinate=e.int16),this.caretValueFormat===2&&(this.caretValuePointIndex=e.uint16),this.caretValueFormat===3&&(this.coordinate=e.int16,this.deviceOffset=e.Offset16)}},vQe=class extends Eo{constructor(e){super(e),this.markGlyphSetTableFormat=e.uint16,this.markGlyphSetCount=e.uint16,this.coverageOffsets=[...new Array(this.markGlyphSetCount)].map(t=>e.Offset32)}getMarkGlyphSet(e){return this.parser.currentPosition=this.start+this.coverageOffsets[e],new _T(this.parser)}},bQe=Object.freeze({__proto__:null,GDEF:dQe}),Rbe=class extends Eo{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map(t=>new yQe(e))}},yQe=class{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}},wQe=class extends Eo{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map(t=>new _Qe(e))}},_Qe=class{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}},Abe=class{constructor(e){this.lookupOrder=e.Offset16,this.requiredFeatureIndex=e.uint16,this.featureIndexCount=e.uint16,this.featureIndices=[...new Array(this.featureIndexCount)].map(t=>e.uint16)}},Ibe=class extends Eo{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map(t=>new SQe(e))}},SQe=class{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}},xQe=class extends Eo{constructor(e){super(e),this.featureParams=e.Offset16,this.lookupIndexCount=e.uint16,this.lookupListIndices=[...new Array(this.lookupIndexCount)].map(t=>e.uint16)}getFeatureParams(){if(this.featureParams>0){let e=this.parser;e.currentPosition=this.start+this.featureParams;let t=this.featureTag;if(t==="size")return new EQe(e);if(t.startsWith("cc"))return new CQe(e);if(t.startsWith("ss"))return new TQe(e)}}},CQe=class{constructor(e){this.format=e.uint16,this.featUiLabelNameId=e.uint16,this.featUiTooltipTextNameId=e.uint16,this.sampleTextNameId=e.uint16,this.numNamedParameters=e.uint16,this.firstParamUiLabelNameId=e.uint16,this.charCount=e.uint16,this.character=[...new Array(this.charCount)].map(t=>e.uint24)}},EQe=class{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}},TQe=class{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}};function Dbe(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}var $b=class extends Eo{constructor(e){super(e),this.substFormat=e.uint16,this.coverageOffset=e.Offset16}getCoverageTable(){let e=this.parser;return e.currentPosition=this.start+this.coverageOffset,new _T(e)}},sG=class{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}},PQe=class extends $b{constructor(e){super(e),this.deltaGlyphID=e.int16}},kQe=class extends $b{constructor(e){super(e),this.sequenceCount=e.uint16,this.sequenceOffsets=[...new Array(this.sequenceCount)].map(t=>e.Offset16)}getSequence(e){let t=this.parser;return t.currentPosition=this.start+this.sequenceOffsets[e],new RQe(t)}},RQe=class{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map(t=>e.uint16)}},AQe=class extends $b{constructor(e){super(e),this.alternateSetCount=e.uint16,this.alternateSetOffsets=[...new Array(this.alternateSetCount)].map(t=>e.Offset16)}getAlternateSet(e){let t=this.parser;return t.currentPosition=this.start+this.alternateSetOffsets[e],new IQe(t)}},IQe=class{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map(t=>e.uint16)}},OQe=class extends $b{constructor(e){super(e),this.ligatureSetCount=e.uint16,this.ligatureSetOffsets=[...new Array(this.ligatureSetCount)].map(t=>e.Offset16)}getLigatureSet(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureSetOffsets[e],new NQe(t)}},NQe=class extends Eo{constructor(e){super(e),this.ligatureCount=e.uint16,this.ligatureOffsets=[...new Array(this.ligatureCount)].map(t=>e.Offset16)}getLigature(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureOffsets[e],new MQe(t)}},MQe=class{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map(t=>e.uint16)}},FQe=class extends $b{constructor(e){super(e),this.substFormat===1&&(this.subRuleSetCount=e.uint16,this.subRuleSetOffsets=[...new Array(this.subRuleSetCount)].map(t=>e.Offset16)),this.substFormat===2&&(this.classDefOffset=e.Offset16,this.subClassSetCount=e.uint16,this.subClassSetOffsets=[...new Array(this.subClassSetCount)].map(t=>e.Offset16)),this.substFormat===3&&(Dbe(this),this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.coverageOffsets=[...new Array(this.glyphCount)].map(t=>e.Offset16),this.substLookupRecords=[...new Array(this.substitutionCount)].map(t=>new sG(e)))}getSubRuleSet(e){if(this.substFormat!==1)throw new Error(`lookup type 5.${this.substFormat} has no subrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.subRuleSetOffsets[e],new DQe(t)}getSubClassSet(e){if(this.substFormat!==2)throw new Error(`lookup type 5.${this.substFormat} has no subclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.subClassSetOffsets[e],new LQe(t)}getCoverageTable(e){if(this.substFormat!==3&&!e)return super.getCoverageTable();if(!e)throw new Error(`lookup type 5.${this.substFormat} requires an coverage table index.`);let t=this.parser;return t.currentPosition=this.start+this.coverageOffsets[e],new _T(t)}},DQe=class extends Eo{constructor(e){super(e),this.subRuleCount=e.uint16,this.subRuleOffsets=[...new Array(this.subRuleCount)].map(t=>e.Offset16)}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.subRuleOffsets[e],new Lbe(t)}},Lbe=class{constructor(e){this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.inputSequence=[...new Array(this.glyphCount-1)].map(t=>e.uint16),this.substLookupRecords=[...new Array(this.substitutionCount)].map(t=>new sG(e))}},LQe=class extends Eo{constructor(e){super(e),this.subClassRuleCount=e.uint16,this.subClassRuleOffsets=[...new Array(this.subClassRuleCount)].map(t=>e.Offset16)}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.subClassRuleOffsets[e],new VQe(t)}},VQe=class extends Lbe{constructor(e){super(e)}},BQe=class extends $b{constructor(e){super(e),this.substFormat===1&&(this.chainSubRuleSetCount=e.uint16,this.chainSubRuleSetOffsets=[...new Array(this.chainSubRuleSetCount)].map(t=>e.Offset16)),this.substFormat===2&&(this.backtrackClassDefOffset=e.Offset16,this.inputClassDefOffset=e.Offset16,this.lookaheadClassDefOffset=e.Offset16,this.chainSubClassSetCount=e.uint16,this.chainSubClassSetOffsets=[...new Array(this.chainSubClassSetCount)].map(t=>e.Offset16)),this.substFormat===3&&(Dbe(this),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map(t=>e.Offset16),this.inputGlyphCount=e.uint16,this.inputCoverageOffsets=[...new Array(this.inputGlyphCount)].map(t=>e.Offset16),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[...new Array(this.lookaheadGlyphCount)].map(t=>e.Offset16),this.seqLookupCount=e.uint16,this.seqLookupRecords=[...new Array(this.substitutionCount)].map(t=>new Vbe(e)))}getChainSubRuleSet(e){if(this.substFormat!==1)throw new Error(`lookup type 6.${this.substFormat} has no chainsubrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleSetOffsets[e],new jQe(t)}getChainSubClassSet(e){if(this.substFormat!==2)throw new Error(`lookup type 6.${this.substFormat} has no chainsubclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubClassSetOffsets[e],new HQe(t)}getCoverageFromOffset(e){if(this.substFormat!==3)throw new Error(`lookup type 6.${this.substFormat} does not use contextual coverage offsets.`);let t=this.parser;return t.currentPosition=this.start+e,new _T(t)}},jQe=class extends Eo{constructor(e){super(e),this.chainSubRuleCount=e.uint16,this.chainSubRuleOffsets=[...new Array(this.chainSubRuleCount)].map(t=>e.Offset16)}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new zQe(t)}},zQe=class{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map(t=>e.uint16),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map(t=>e.uint16),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map(t=>e.uint16),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.SubstCount)].map(t=>new sG(e))}},HQe=class extends Eo{constructor(e){super(e),this.chainSubClassRuleCount=e.uint16,this.chainSubClassRuleOffsets=[...new Array(this.chainSubClassRuleCount)].map(t=>e.Offset16)}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new UQe(t)}},UQe=class{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map(t=>e.uint16),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map(t=>e.uint16),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map(t=>e.uint16),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.substitutionCount)].map(t=>new Vbe(e))}},Vbe=class extends Eo{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}},WQe=class extends Eo{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}},GQe=class extends $b{constructor(e){super(e),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map(t=>e.Offset16),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[new Array(this.lookaheadGlyphCount)].map(t=>e.Offset16),this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map(t=>e.uint16)}},YQe={buildSubtable:function(e,t){let r=new[void 0,PQe,kQe,AQe,OQe,FQe,BQe,WQe,GQe][e](t);return r.type=e,r}},xp=class extends Eo{constructor(e){super(e)}},qQe=class extends xp{constructor(e){super(e),console.log("lookup type 1")}},KQe=class extends xp{constructor(e){super(e),console.log("lookup type 2")}},ZQe=class extends xp{constructor(e){super(e),console.log("lookup type 3")}},XQe=class extends xp{constructor(e){super(e),console.log("lookup type 4")}},QQe=class extends xp{constructor(e){super(e),console.log("lookup type 5")}},JQe=class extends xp{constructor(e){super(e),console.log("lookup type 6")}},$Qe=class extends xp{constructor(e){super(e),console.log("lookup type 7")}},eJe=class extends xp{constructor(e){super(e),console.log("lookup type 8")}},tJe=class extends xp{constructor(e){super(e),console.log("lookup type 9")}},rJe={buildSubtable:function(e,t){let r=new[void 0,qQe,KQe,ZQe,XQe,QQe,JQe,$Qe,eJe,tJe][e](t);return r.type=e,r}},Obe=class extends Eo{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map(t=>e.Offset16)}},oJe=class extends Eo{constructor(e,t){super(e),this.ctType=t,this.lookupType=e.uint16,this.lookupFlag=e.uint16,this.subTableCount=e.uint16,this.subtableOffsets=[...new Array(this.subTableCount)].map(r=>e.Offset16),this.markFilteringSet=e.uint16}get rightToLeft(){return this.lookupFlag&!0}get ignoreBaseGlyphs(){return this.lookupFlag&!0}get ignoreLigatures(){return this.lookupFlag&!0}get ignoreMarks(){return this.lookupFlag&!0}get useMarkFilteringSet(){return this.lookupFlag&!0}get markAttachmentType(){return this.lookupFlag&!0}getSubTable(e){let t=this.ctType==="GSUB"?YQe:rJe;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}},Bbe=class extends yt{constructor(e,t,r){let{p:o,tableStart:n}=super(e,t,r);this.majorVersion=o.uint16,this.minorVersion=o.uint16,this.scriptListOffset=o.Offset16,this.featureListOffset=o.Offset16,this.lookupListOffset=o.Offset16,this.majorVersion===1&&this.minorVersion===1&&(this.featureVariationsOffset=o.Offset32);let i=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);ze(this,"scriptList",()=>i?Rbe.EMPTY:(o.currentPosition=n+this.scriptListOffset,new Rbe(o))),ze(this,"featureList",()=>i?Ibe.EMPTY:(o.currentPosition=n+this.featureListOffset,new Ibe(o))),ze(this,"lookupList",()=>i?Obe.EMPTY:(o.currentPosition=n+this.lookupListOffset,new Obe(o))),this.featureVariationsOffset&&ze(this,"featureVariations",()=>i?FeatureVariations.EMPTY:(o.currentPosition=n+this.featureVariationsOffset,new FeatureVariations(o)))}getSupportedScripts(){return this.scriptList.scriptRecords.map(e=>e.scriptTag)}getScriptTable(e){let t=this.scriptList.scriptRecords.find(o=>o.scriptTag===e);this.parser.currentPosition=this.scriptList.start+t.scriptOffset;let r=new wQe(this.parser);return r.scriptTag=e,r}ensureScriptTable(e){return typeof e=="string"?this.getScriptTable(e):e}getSupportedLangSys(e){e=this.ensureScriptTable(e);let t=e.defaultLangSys!==0,r=e.langSysRecords.map(o=>o.langSysTag);return t&&r.unshift("dflt"),r}getDefaultLangSysTable(e){e=this.ensureScriptTable(e);let t=e.defaultLangSys;if(t!==0){this.parser.currentPosition=e.start+t;let r=new Abe(this.parser);return r.langSysTag="",r.defaultForScript=e.scriptTag,r}}getLangSysTable(e,t="dflt"){if(t==="dflt")return this.getDefaultLangSysTable(e);e=this.ensureScriptTable(e);let r=e.langSysRecords.find(n=>n.langSysTag===t);this.parser.currentPosition=e.start+r.langSysOffset;let o=new Abe(this.parser);return o.langSysTag=t,o}getFeatures(e){return e.featureIndices.map(t=>this.getFeature(t))}getFeature(e){let t;if(parseInt(e)==e?t=this.featureList.featureRecords[e]:t=this.featureList.featureRecords.find(o=>o.featureTag===e),!t)return;this.parser.currentPosition=this.featureList.start+t.featureOffset;let r=new xQe(this.parser);return r.featureTag=t.featureTag,r}getLookups(e){return e.lookupListIndices.map(t=>this.getLookup(t))}getLookup(e,t){let r=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+r,new oJe(this.parser,t)}},nJe=class extends Bbe{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}},iJe=Object.freeze({__proto__:null,GSUB:nJe}),sJe=class extends Bbe{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}},aJe=Object.freeze({__proto__:null,GPOS:sJe}),lJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.offsetToSVGDocumentList=r.Offset32,r.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new cJe(r)}},cJe=class extends Eo{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map(t=>new uJe(e))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let r=this.start+t.svgDocOffset;return this.parser.currentPosition=r,this.parser.readBytes(t.svgDocLength)}getDocumentForGlyph(e){let t=this.documentRecords.findIndex(r=>r.startGlyphID<=e&&e<=r.endGlyphID);return t===-1?"":this.getDocument(t)}},uJe=class{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}},dJe=Object.freeze({__proto__:null,SVG:lJe}),fJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.axesArrayOffset=r.Offset16,r.uint16,this.axisCount=r.uint16,this.axisSize=r.uint16,this.instanceCount=r.uint16,this.instanceSize=r.uint16;let o=this.tableStart+this.axesArrayOffset;ze(this,"axes",()=>(r.currentPosition=o,[...new Array(this.axisCount)].map(i=>new pJe(r))));let n=o+this.axisCount*this.axisSize;ze(this,"instances",()=>{let i=[];for(let s=0;se.tag)}getAxis(e){return this.axes.find(t=>t.tag===e)}},pJe=class{constructor(e){this.tag=e.tag,this.minValue=e.fixed,this.defaultValue=e.fixed,this.maxValue=e.fixed,this.flags=e.flags(16),this.axisNameID=e.uint16}},mJe=class{constructor(e,t,r){let o=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map(n=>e.fixed),e.currentPosition-o[...new Array(o)].map(n=>r.fword))}},vJe=Object.freeze({__proto__:null,cvt:gJe}),bJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);ze(this,"instructions",()=>[...new Array(e.length)].map(o=>r.uint8))}},yJe=Object.freeze({__proto__:null,fpgm:bJe}),wJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numRanges=r.uint16,ze(this,"gaspRanges",()=>[...new Array(this.numRanges)].map(n=>new _Je(r)))}},_Je=class{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}},SJe=Object.freeze({__proto__:null,gasp:wJe}),xJe=class extends yt{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}},CJe=Object.freeze({__proto__:null,glyf:xJe}),EJe=class extends yt{constructor(e,t,r){let{p:o}=super(e,t),n=r.maxp.numGlyphs+1;r.head.indexToLocFormat===0?(this.x2=!0,ze(this,"offsets",()=>[...new Array(n)].map(i=>o.Offset16))):ze(this,"offsets",()=>[...new Array(n)].map(i=>o.Offset32))}getGlyphDataOffsetAndLength(e){let t=this.offsets[e]*this.x2?2:1,r=this.offsets[e+1]*this.x2?2:1;return{offset:t,length:r-t}}},TJe=Object.freeze({__proto__:null,loca:EJe}),PJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);ze(this,"instructions",()=>[...new Array(e.length)].map(o=>r.uint8))}},kJe=Object.freeze({__proto__:null,prep:PJe}),RJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);ze(this,"data",()=>r.readBytes())}},AJe=Object.freeze({__proto__:null,CFF:RJe}),IJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);ze(this,"data",()=>r.readBytes())}},OJe=Object.freeze({__proto__:null,CFF2:IJe}),NJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.defaultVertOriginY=r.int16,this.numVertOriginYMetrics=r.uint16,ze(this,"vertORiginYMetrics",()=>[...new Array(this.numVertOriginYMetrics)].map(o=>new MJe(r)))}},MJe=class{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}},FJe=Object.freeze({__proto__:null,VORG:NJe}),DJe=class{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new AM(e),this.vert=new AM(e),this.startGlyphIndex=e.uint16,this.endGlyphIndex=e.uint16,this.ppemX=e.uint8,this.ppemY=e.uint8,this.bitDepth=e.uint8,this.flags=e.int8}},LJe=class{constructor(e){this.hori=new AM(e),this.vert=new AM(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}},AM=class{constructor(e){this.ascender=e.int8,this.descender=e.int8,this.widthMax=e.uint8,this.caretSlopeNumerator=e.int8,this.caretSlopeDenominator=e.int8,this.caretOffset=e.int8,this.minOriginSB=e.int8,this.minAdvanceSB=e.int8,this.maxBeforeBL=e.int8,this.minAfterBL=e.int8,this.pad1=e.int8,this.pad2=e.int8}},jbe=class extends yt{constructor(e,t,r){let{p:o}=super(e,t,r);this.majorVersion=o.uint16,this.minorVersion=o.uint16,this.numSizes=o.uint32,ze(this,"bitMapSizes",()=>[...new Array(this.numSizes)].map(n=>new DJe(o)))}},VJe=Object.freeze({__proto__:null,EBLC:jbe}),zbe=class extends yt{constructor(e,t,r){let{p:o}=super(e,t,r);this.majorVersion=o.uint16,this.minorVersion=o.uint16}},BJe=Object.freeze({__proto__:null,EBDT:zbe}),jJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.numSizes=r.uint32,ze(this,"bitmapScales",()=>[...new Array(this.numSizes)].map(o=>new LJe(r)))}},zJe=Object.freeze({__proto__:null,EBSC:jJe}),HJe=class extends jbe{constructor(e,t){super(e,t,"CBLC")}},UJe=Object.freeze({__proto__:null,CBLC:HJe}),WJe=class extends zbe{constructor(e,t){super(e,t,"CBDT")}},GJe=Object.freeze({__proto__:null,CBDT:WJe}),YJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.flags=r.flags(16),this.numStrikes=r.uint32,ze(this,"strikeOffsets",()=>[...new Array(this.numStrikes)].map(o=>r.Offset32))}},qJe=Object.freeze({__proto__:null,sbix:YJe}),KJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numBaseGlyphRecords=r.uint16,this.baseGlyphRecordsOffset=r.Offset32,this.layerRecordsOffset=r.Offset32,this.numLayerRecords=r.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let r=new iG(this.parser),o=r.gID,n=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=n;let i=new iG(this.parser),s=i.gID;if(o===e)return r;if(s===e)return i;for(;t!==n;){let l=t+(n-t)/12;this.parser.currentPosition=l;let c=new iG(this.parser),u=c.gID;if(u===e)return c;u>e?n=l:unew ZJe(p))}},iG=class{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}},ZJe=class{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}},XJe=Object.freeze({__proto__:null,COLR:KJe}),QJe=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numPaletteEntries=r.uint16;let o=this.numPalettes=r.uint16;this.numColorRecords=r.uint16,this.offsetFirstColorRecord=r.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map(n=>r.uint16),ze(this,"colorRecords",()=>(r.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map(n=>new JJe(r)))),this.version===1&&(this.offsetPaletteTypeArray=r.Offset32,this.offsetPaletteLabelArray=r.Offset32,this.offsetPaletteEntryLabelArray=r.Offset32,ze(this,"paletteTypeArray",()=>(r.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new $Je(r,o))),ze(this,"paletteLabelArray",()=>(r.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new e$e(r,o))),ze(this,"paletteEntryLabelArray",()=>(r.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new t$e(r,o))))}},JJe=class{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}},$Je=class{constructor(e,t){this.paletteTypes=[...new Array(t)].map(r=>e.uint32)}},e$e=class{constructor(e,t){this.paletteLabels=[...new Array(t)].map(r=>e.uint16)}},t$e=class{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map(r=>e.uint16)}},r$e=Object.freeze({__proto__:null,CPAL:QJe}),o$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint32,this.numSignatures=r.uint16,this.flags=r.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map(o=>new n$e(r))}getData(e){let t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new i$e(this.parser)}},n$e=class{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}},i$e=class{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}},s$e=Object.freeze({__proto__:null,DSIG:o$e}),a$e=class extends yt{constructor(e,t,r){let{p:o}=super(e,t),n=r.hmtx.numGlyphs;this.version=o.uint16,this.numRecords=o.int16,this.sizeDeviceRecord=o.int32,this.records=[...new Array(numRecords)].map(i=>new l$e(o,n))}},l$e=class{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}},c$e=Object.freeze({__proto__:null,hdmx:a$e}),u$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.nTables=r.uint16,ze(this,"tables",()=>{let o=this.tableStart+4,n=[];for(let i=0;i[...new Array(this.nPairs)].map(t=>new f$e(e)))),this.format===2&&console.warn("Kern subtable format 2 is not supported: this parser currently only parses universal table data.")}get horizontal(){return this.coverage[0]}get minimum(){return this.coverage[1]}get crossstream(){return this.coverage[2]}get override(){return this.coverage[3]}},f$e=class{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}},p$e=Object.freeze({__proto__:null,kern:u$e}),m$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numGlyphs=r.uint16,this.yPels=r.readBytes(this.numGlyphs)}},h$e=Object.freeze({__proto__:null,LTSH:m$e}),g$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.mergeClassCount=r.uint16,this.mergeDataOffset=r.Offset16,this.classDefCount=r.uint16,this.offsetToClassDefOffsets=r.Offset16,ze(this,"mergeEntryMatrix",()=>[...new Array(this.mergeClassCount)].map(o=>r.readBytes(this.mergeClassCount))),console.warn("Full MERG parsing is currently not supported."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}},v$e=Object.freeze({__proto__:null,MERG:g$e}),b$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint32,this.flags=r.uint32,r.uint32,this.dataMapsCount=r.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map(o=>new y$e(this.tableStart,r))}},y$e=class{constructor(e,t){this.tableStart=e,this.parser=t,this.tag=t.tag,this.dataOffset=t.Offset32,this.dataLength=t.uint32}getData(){return this.parser.currentField=this.tableStart+this.dataOffset,this.parser.readBytes(this.dataLength)}},w$e=Object.freeze({__proto__:null,meta:b$e}),_$e=class extends yt{constructor(e,t){super(e,t),console.warn("This font uses a PCLT table, which is currently not supported by this parser."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}},S$e=Object.freeze({__proto__:null,PCLT:_$e}),x$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.uint16,this.numRecs=r.uint16,this.numRatios=r.uint16,this.ratRanges=[...new Array(this.numRatios)].map(o=>new C$e(r)),this.offsets=[...new Array(this.numRatios)].map(o=>r.Offset16),this.VDMXGroups=[...new Array(this.numRecs)].map(o=>new E$e(r))}},C$e=class{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}},E$e=class{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map(t=>new T$e(e))}},T$e=class{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}},P$e=Object.freeze({__proto__:null,VDMX:x$e}),k$e=class extends yt{constructor(e,t){let{p:r}=super(e,t);this.version=r.fixed,this.ascent=this.vertTypoAscender=r.int16,this.descent=this.vertTypoDescender=r.int16,this.lineGap=this.vertTypoLineGap=r.int16,this.advanceHeightMax=r.int16,this.minTopSideBearing=r.int16,this.minBottomSideBearing=r.int16,this.yMaxExtent=r.int16,this.caretSlopeRise=r.int16,this.caretSlopeRun=r.int16,this.caretOffset=r.int16,this.reserved=r.int16,this.reserved=r.int16,this.reserved=r.int16,this.reserved=r.int16,this.metricDataFormat=r.int16,this.numOfLongVerMetrics=r.uint16,r.verifyLength()}},R$e=Object.freeze({__proto__:null,vhea:k$e}),A$e=class extends yt{constructor(e,t,r){super(e,t);let o=r.vhea.numOfLongVerMetrics,n=r.maxp.numGlyphs,i=p.currentPosition;if(lazy(this,"vMetrics",()=>(p.currentPosition=i,[...new Array(o)].map(s=>new I$e(p.uint16,p.int16)))),o(p.currentPosition=s,[...new Array(n-o)].map(l=>p.int16)))}}},I$e=class{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}},O$e=Object.freeze({__proto__:null,vmtx:A$e});var Hbe=a(G(),1);var{kebabCase:N$e}=Tt(Hbe.privateApis);function Ube(e){let t=e.reduce((r,o)=>(r[o.fontFamily]||(r[o.fontFamily]={name:o.fontFamily,fontFamily:o.fontFamily,slug:N$e(o.fontFamily.toLowerCase()),fontFace:[]}),r[o.fontFamily].fontFace.push(o),r),{});return Object.values(t)}var Ra=a(T(),1);function M$e(){let{installFonts:e}=(0,ST.useContext)(Si),[t,r]=(0,ST.useState)(!1),[o,n]=(0,ST.useState)(null),i=h=>{l(h)},s=h=>{l(h.target.files)},l=async h=>{if(!h)return;n(null),r(!0);let g=new Set,v=[...h],b=!1,_=v.map(async w=>{if(!await u(w))return b=!0,null;if(g.has(w.name))return null;let x=(((w.name??"").split(".")??[]).pop()??"").toLowerCase();return eG.includes(x)?(g.add(w.name),w):null}),y=(await Promise.all(_)).filter(w=>w!==null);if(y.length>0)c(y);else{let w=b?(0,O_.__)("Sorry, you are not allowed to upload this file type."):(0,O_.__)("No fonts found to install.");n({type:"error",message:w}),r(!1)}},c=async h=>{let g=await Promise.all(h.map(async v=>{let b=await f(v);return await ng(b,b.file,"all"),b}));m(g)};async function u(h){let g=new IM("Uploaded Font");try{let v=await d(h);return await g.fromDataBuffer(v,"font"),!0}catch{return!1}}async function d(h){return new Promise((g,v)=>{let b=new window.FileReader;b.readAsArrayBuffer(h),b.onload=()=>g(b.result),b.onerror=v})}let f=async h=>{let g=await d(h),v=new IM("Uploaded Font");v.fromDataBuffer(g,h.name);let _=(await new Promise(R=>v.onload=R)).detail.font,{name:y}=_.opentype.tables,w=y.get(16)||y.get(1),S=y.get(2).toLowerCase().includes("italic"),x=_.opentype.tables["OS/2"].usWeightClass||"normal",A=!!_.opentype.tables.fvar&&_.opentype.tables.fvar.axes.find(({tag:R})=>R==="wght"),P=A?`${A.minValue} ${A.maxValue}`:null;return{file:h,fontFamily:w,fontStyle:S?"italic":"normal",fontWeight:P||x}},m=async h=>{let g=Ube(h);try{await e(g),n({type:"success",message:(0,O_.__)("Fonts were installed successfully.")})}catch(v){let b=v;n({type:"error",message:b.message,errors:b?.installationErrors})}r(!1)};return(0,Ra.jsxs)("div",{className:"font-library__tabpanel-layout",children:[(0,Ra.jsx)(ns.DropZone,{onFilesDrop:i}),(0,Ra.jsxs)(ns.__experimentalVStack,{className:"font-library__local-fonts",justify:"start",children:[o&&(0,Ra.jsxs)(ns.Notice,{status:o.type,__unstableHTML:!0,onRemove:()=>n(null),children:[o.message,o.errors&&(0,Ra.jsx)("ul",{children:o.errors.map((h,g)=>(0,Ra.jsx)("li",{children:h},g))})]}),t&&(0,Ra.jsx)(ns.FlexItem,{children:(0,Ra.jsx)("div",{className:"font-library__upload-area",children:(0,Ra.jsx)(ns.ProgressBar,{})})}),!t&&(0,Ra.jsx)(ns.FormFileUpload,{accept:eG.map(h=>`.${h}`).join(","),multiple:!0,onChange:s,render:({openFileDialog:h})=>(0,Ra.jsx)(ns.Button,{__next40pxDefaultSize:!0,className:"font-library__upload-area",onClick:h,children:(0,O_.__)("Upload font")})}),(0,Ra.jsx)(ns.__experimentalText,{className:"font-library__upload-area__text",children:(0,O_.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})}var OM=M$e;var $c=a(T(),1),{Tabs:NM}=Tt(MM.privateApis),F$e={id:"installed-fonts",title:(0,N_._x)("Library","Font library")},D$e={id:"upload-fonts",title:(0,N_._x)("Upload","noun")},L$e=e=>e.map(({slug:t,name:r})=>({id:t,title:e.length===1&&t==="google-fonts"?(0,N_.__)("Install Fonts"):r}));function V$e({onRequestClose:e,defaultTabId:t="installed-fonts"}){let{records:r=[]}=(0,FM.useEntityRecords)("root","fontCollection",{_fields:"slug,name,description"}),o=(0,Wbe.useSelect)(i=>i(FM.store).canUser("create",{kind:"postType",name:"wp_font_family"}),[]),n=[F$e];return o&&(n.push(D$e),n.push(...L$e(r||[]))),(0,$c.jsx)(MM.Modal,{title:(0,N_.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,$c.jsxs)(NM,{defaultTabId:t,children:[(0,$c.jsx)("div",{className:"font-library-modal__tablist-container",children:(0,$c.jsx)(NM.TabList,{children:n.map(({id:i,title:s})=>(0,$c.jsx)(NM.Tab,{tabId:i,children:s},i))})}),n.map(({id:i})=>{let s;switch(i){case"upload-fonts":s=(0,$c.jsx)(OM,{});break;case"installed-fonts":s=(0,$c.jsx)(xM,{});break;default:s=(0,$c.jsx)(EM,{slug:i})}return(0,$c.jsx)(NM.TabPanel,{tabId:i,focusable:!1,className:"font-library-modal__tab-panel",children:s},i)})]})})}var Gbe=V$e;var DM=a(j(),1),ey=a(G(),1),Ybe=a(U(),1);var M_=a(T(),1);function B$e({font:e}){let{handleSetLibraryFontSelected:t,setModalTabOpen:r}=(0,Ybe.useContext)(Si),o=e?.fontFace?.length||1,n=()=>{t?.(e),r?.("installed-fonts")},i=Gb(e);return(0,M_.jsx)(ey.__experimentalItem,{onClick:n,children:(0,M_.jsxs)(ey.__experimentalHStack,{justify:"space-between",children:[(0,M_.jsx)(ey.FlexItem,{style:i,children:e.name}),(0,M_.jsx)(ey.FlexItem,{className:"global-styles-ui-screen-typography__font-variants-count",children:(0,DM.sprintf)((0,DM._n)("%d variant","%d variants",o),o)})]})})}var qbe=B$e;var yn=a(T(),1);function Kbe(e,t){return e?e.map(r=>wp(r,{source:t})):[]}function j$e(){let{baseCustomFonts:e,modalTabOpen:t,setModalTabOpen:r}=(0,Zbe.useContext)(Si),[o]=Le("typography.fontFamilies"),[n]=Le("typography.fontFamilies",void 0,"base"),i=Kbe(o?.theme,"theme"),s=Kbe(o?.custom,"custom"),l=[...i,...s].sort((d,f)=>d.name.localeCompare(f.name)),c=00||(e?.length??0)>0;return(0,yn.jsxs)(yn.Fragment,{children:[!!t&&(0,yn.jsx)(Gbe,{onRequestClose:()=>r?.(""),defaultTabId:t}),(0,yn.jsxs)(eu.__experimentalVStack,{spacing:2,children:[(0,yn.jsxs)(eu.__experimentalHStack,{justify:"space-between",children:[(0,yn.jsx)(Uo,{level:3,children:(0,ty.__)("Fonts")}),(0,yn.jsx)(eu.Button,{onClick:()=>r?.("installed-fonts"),label:(0,ty.__)("Manage fonts"),icon:jB,size:"small"})]}),l.length>0&&(0,yn.jsx)(yn.Fragment,{children:(0,yn.jsx)(eu.__experimentalItemGroup,{size:"large",isBordered:!0,isSeparated:!0,children:l.map(d=>(0,yn.jsx)(qbe,{font:d},d.slug))})}),!c&&(0,yn.jsxs)(yn.Fragment,{children:[(0,yn.jsx)(eu.__experimentalText,{as:"p",children:u?(0,ty.__)("No fonts activated."):(0,ty.__)("No fonts installed.")}),(0,yn.jsx)(eu.Button,{className:"global-styles-ui-font-families__manage-fonts",variant:"secondary",__next40pxDefaultSize:!0,onClick:()=>{r?.(u?"installed-fonts":"upload-fonts")},children:u?(0,ty.__)("Manage fonts"):(0,ty.__)("Add fonts")})]})]})]})}function Xbe({...e}){return(0,yn.jsx)(vM,{children:(0,yn.jsx)(j$e,{...e})})}var xT=a(j(),1),Cp=a(G(),1);var Fd=a(T(),1);function z$e(){return(0,Fd.jsxs)(Cp.__experimentalVStack,{spacing:2,children:[(0,Fd.jsx)(Cp.__experimentalHStack,{justify:"space-between",children:(0,Fd.jsx)(Uo,{level:3,children:(0,xT.__)("Font Sizes")})}),(0,Fd.jsx)(Cp.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,Fd.jsx)(xo,{path:"/typography/font-sizes",children:(0,Fd.jsxs)(Cp.__experimentalHStack,{direction:"row",children:[(0,Fd.jsx)(Cp.FlexItem,{children:(0,xT.__)("Font size presets")}),(0,Fd.jsx)(En,{icon:(0,xT.isRTL)()?Ar:hr})]})})})]})}var Qbe=z$e;var ec=a(T(),1);function H$e(){let{fontLibraryEnabled:e}=(0,$be.useContext)(on);return(0,ec.jsxs)(ec.Fragment,{children:[(0,ec.jsx)(sr,{title:(0,LM.__)("Typography"),description:(0,LM.__)("Available fonts, typographic styles, and the application of those styles.")}),(0,ec.jsx)(tg,{children:(0,ec.jsxs)(Jbe.__experimentalVStack,{spacing:7,children:[(0,ec.jsx)(k_,{title:(0,LM.__)("Typesets")}),e&&(0,ec.jsx)(Xbe,{}),(0,ec.jsx)(zve,{}),(0,ec.jsx)(Qbe,{})]})})]})}var eye=H$e;var Or=a(j(),1),pl=a(G(),1),aye=a(U(),1);var tye=a(be(),1);var rye=a(T(),1),{useSettingsForBlockElement:U$e,TypographyPanel:W$e}=Tt(tye.privateApis);function oye({element:e,headingLevel:t}){let r=[];e==="heading"?r=r.concat(["elements",t]):e&&e!=="text"&&(r=r.concat(["elements",e]));let o=r.join("."),[n]=qe(o,"","user",!1),[i,s]=qe(o,"","merged",!1),[l]=Le(""),u=U$e(l,void 0,e==="heading"?t:e);return(0,rye.jsx)(W$e,{inheritedValue:i,value:n,onChange:s,settings:u,showInheritanceLabelIndicators:!1})}var nye=a(T(),1);function iye({name:e,element:t,headingLevel:r}){let o="";t==="heading"?o=`elements.${r}.`:t&&t!=="text"&&(o=`elements.${t}.`);let[n]=qe(o+"typography.fontFamily",e),[i]=qe(o+"color.gradient",e),[s]=qe(o+"color.background",e),[l]=qe("color.background"),[c]=qe(o+"color.text",e),[u]=qe(o+"typography.fontSize",e),[d]=qe(o+"typography.fontStyle",e),[f]=qe(o+"typography.fontWeight",e),[m]=qe(o+"typography.letterSpacing",e);return(0,nye.jsx)("div",{className:"global-styles-ui-typography-preview",style:{fontFamily:n??"serif",background:i??s??l,color:c,fontSize:u,fontStyle:d,fontWeight:f,letterSpacing:m,...t==="link"?{textDecoration:"underline"}:{}},children:"Aa"})}var ti=a(T(),1),sye={text:{description:(0,Or.__)("Manage the fonts used on the site."),title:(0,Or.__)("Text")},link:{description:(0,Or.__)("Manage the fonts and typography used on the links."),title:(0,Or.__)("Links")},heading:{description:(0,Or.__)("Manage the fonts and typography used on headings."),title:(0,Or.__)("Headings")},caption:{description:(0,Or.__)("Manage the fonts and typography used on captions."),title:(0,Or.__)("Captions")},button:{description:(0,Or.__)("Manage the fonts and typography used on buttons."),title:(0,Or.__)("Buttons")}};function G$e({element:e}){let[t,r]=(0,aye.useState)("heading");return(0,ti.jsxs)(ti.Fragment,{children:[(0,ti.jsx)(sr,{title:sye[e].title,description:sye[e].description}),(0,ti.jsx)(pl.__experimentalSpacer,{marginX:4,children:(0,ti.jsx)(iye,{element:e,headingLevel:t})}),e==="heading"&&(0,ti.jsx)(pl.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,ti.jsxs)(pl.__experimentalToggleGroupControl,{label:(0,Or.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:o=>r(o),isBlock:!0,children:[(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"heading",showTooltip:!0,"aria-label":(0,Or.__)("All headings"),label:(0,Or._x)("All","heading levels")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h1",showTooltip:!0,"aria-label":(0,Or.__)("Heading 1"),label:(0,Or.__)("H1")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h2",showTooltip:!0,"aria-label":(0,Or.__)("Heading 2"),label:(0,Or.__)("H2")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h3",showTooltip:!0,"aria-label":(0,Or.__)("Heading 3"),label:(0,Or.__)("H3")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h4",showTooltip:!0,"aria-label":(0,Or.__)("Heading 4"),label:(0,Or.__)("H4")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h5",showTooltip:!0,"aria-label":(0,Or.__)("Heading 5"),label:(0,Or.__)("H5")}),(0,ti.jsx)(pl.__experimentalToggleGroupControlOption,{value:"h6",showTooltip:!0,"aria-label":(0,Or.__)("Heading 6"),label:(0,Or.__)("H6")})]})}),(0,ti.jsx)(oye,{element:e,headingLevel:t})]})}var F_=G$e;var aG=a(j(),1),pye=a(G(),1),mye=a(be(),1);var ml=a(G(),1),D_=a(j(),1);var dye=a(U(),1);var lye=a(G(),1),cye=a(T(),1);function Y$e({className:e,children:t,...r}){return(0,cye.jsx)(lye.Flex,{className:J("global-styles-ui__color-indicator-wrapper",e),...r,children:t})}var uye=Y$e;var is=a(T(),1),VM=[];function q$e({name:e}){let[t]=Le("color.palette.custom"),[r]=Le("color.palette.theme"),[o]=Le("color.palette.default"),[n]=Le("color.defaultPalette",e),i=t||VM,s=r||VM,l=o||VM,c=n??!0,u=(0,dye.useMemo)(()=>[...i,...s,...l&&c?l:VM],[i,s,l,c]),d=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette";return(0,is.jsxs)(ml.__experimentalVStack,{spacing:3,children:[(0,is.jsx)(Uo,{level:3,children:(0,D_.__)("Palette")}),(0,is.jsx)(ml.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,is.jsx)(xo,{path:d,children:(0,is.jsxs)(ml.__experimentalHStack,{direction:"row",children:[u.length>0?(0,is.jsxs)(is.Fragment,{children:[(0,is.jsx)(ml.__experimentalZStack,{isLayered:!1,offset:-8,children:u.slice(0,5).map(({color:f},m)=>(0,is.jsx)(uye,{children:(0,is.jsx)(ml.ColorIndicator,{colorValue:f})},`${f}-${m}`))}),(0,is.jsx)(ml.FlexItem,{isBlock:!0,children:(0,D_.__)("Edit palette")})]}):(0,is.jsx)(ml.FlexItem,{children:(0,D_.__)("Add colors")}),(0,is.jsx)(En,{icon:(0,D_.isRTL)()?Ar:hr})]})})})]})}var fye=q$e;var Dd=a(T(),1),{useSettingsForBlockElement:K$e,ColorPanel:Z$e}=Tt(mye.privateApis);function X$e(){let[e,t]=qe("",void 0,"user",!1),[r]=qe("",void 0,"merged",!1),[o]=Le(""),n=K$e(o);return(0,Dd.jsxs)(Dd.Fragment,{children:[(0,Dd.jsx)(sr,{title:(0,aG.__)("Colors"),description:(0,aG.__)("Palette colors and the application of those colors on site elements.")}),(0,Dd.jsx)(tg,{children:(0,Dd.jsx)(pye.__experimentalVStack,{spacing:7,children:(0,Dd.jsx)(fye,{})})}),(0,Dd.jsx)(Z$e,{inheritedValue:r,value:e,onChange:t,settings:n,showInheritanceLabelIndicators:!1})]})}var hye=X$e;var TT=a(j(),1);var wye=a(Ce(),1),Tp=a(G(),1),V_=a(j(),1);var jM=a(G(),1);var BM=a(G(),1);var gye=a(T(),1);function vye(){let{paletteColors:e}=x_();return e.slice(0,4).map(({slug:t,color:r},o)=>(0,gye.jsx)("div",{style:{flexGrow:1,height:"100%",background:r}},`${t}-${o}`))}var CT=a(T(),1),Q$e={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},J$e=({label:e,isFocused:t,withHoverView:r})=>(0,CT.jsx)(E_,{label:e,isFocused:t,withHoverView:r,children:({key:o})=>(0,CT.jsx)(BM.__unstableMotion.div,{variants:Q$e,style:{height:"100%",overflow:"hidden"},children:(0,CT.jsx)(BM.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,CT.jsx)(vye,{})})},o)}),bye=J$e;var ry=a(T(),1),yye=["color"];function L_({title:e,gap:t=2}){let r=iM(yye);return r?.length<=1?null:(0,ry.jsxs)(jM.__experimentalVStack,{spacing:3,children:[e&&(0,ry.jsx)(Uo,{level:3,children:e}),(0,ry.jsx)(jM.__experimentalGrid,{gap:t,children:r.map((o,n)=>(0,ry.jsx)(P_,{variation:o,isPill:!0,properties:yye,showTooltip:!0,children:()=>(0,ry.jsx)(bye,{})},n))})]})}var Ep=a(T(),1),$$e={placement:"bottom-start",offset:8};function _ye({name:e}){let[t,r]=Le("color.palette.theme",e),[o]=Le("color.palette.theme",e,"base"),[n,i]=Le("color.palette.default",e),[s]=Le("color.palette.default",e,"base"),[l,c]=Le("color.palette.custom",e),[u]=Le("color.defaultPalette",e),f=(0,wye.useViewportMatch)("small","<")?$$e:void 0,[m]=ive(e);return(0,Ep.jsxs)(Tp.__experimentalVStack,{className:"global-styles-ui-color-palette-panel",spacing:8,children:[(0,Ep.jsxs)(Tp.__experimentalVStack,{spacing:4,children:[!!t&&!!t.length&&(0,Ep.jsx)(Tp.__experimentalPaletteEdit,{canReset:t!==o,canOnlyChangeValues:!0,colors:t,onChange:r,paletteLabel:(0,V_.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:f}),window.__experimentalEnableColorRandomizer&&t?.length>0&&m&&(0,Ep.jsx)(Tp.Button,{__next40pxDefaultSize:!0,variant:"secondary",icon:UB,onClick:m,children:(0,V_.__)("Randomize colors")})]}),!!n&&!!n.length&&!!u&&(0,Ep.jsx)(Tp.__experimentalPaletteEdit,{canReset:n!==s,canOnlyChangeValues:!0,colors:n,onChange:i,paletteLabel:(0,V_.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:f}),(0,Ep.jsx)(Tp.__experimentalPaletteEdit,{colors:l,onChange:c,paletteLabel:(0,V_.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:f}),(0,Ep.jsx)(L_,{title:(0,V_.__)("Palettes")})]})}var Sye=a(Ce(),1),Vd=a(G(),1),ET=a(j(),1);var Ld=a(T(),1),eet={placement:"bottom-start",offset:8},tet=()=>{};function xye({name:e}){let[t,r]=Le("color.gradients.theme",e),[o]=Le("color.gradients.theme",e,"base"),[n,i]=Le("color.gradients.default",e),[s]=Le("color.gradients.default",e,"base"),[l,c]=Le("color.gradients.custom",e),[u]=Le("color.defaultGradients",e),[d]=Le("color.duotone.custom")||[],[f]=Le("color.duotone.default")||[],[m]=Le("color.duotone.theme")||[],[h]=Le("color.defaultDuotone"),g=[...d||[],...m||[],...f&&h?f:[]],b=(0,Sye.useViewportMatch)("small","<")?eet:void 0;return(0,Ld.jsxs)(Vd.__experimentalVStack,{className:"global-styles-ui-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,Ld.jsx)(Vd.__experimentalPaletteEdit,{canReset:t!==o,canOnlyChangeValues:!0,gradients:t,onChange:r,paletteLabel:(0,ET.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:b}),!!n&&!!n.length&&!!u&&(0,Ld.jsx)(Vd.__experimentalPaletteEdit,{canReset:n!==s,canOnlyChangeValues:!0,gradients:n,onChange:i,paletteLabel:(0,ET.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:b}),(0,Ld.jsx)(Vd.__experimentalPaletteEdit,{gradients:l,onChange:c,paletteLabel:(0,ET.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:b}),!!g&&!!g.length&&(0,Ld.jsxs)("div",{children:[(0,Ld.jsx)(Uo,{level:3,children:(0,ET.__)("Duotone")}),(0,Ld.jsx)(Vd.__experimentalSpacer,{margin:3}),(0,Ld.jsx)(Vd.DuotonePicker,{duotonePalette:g,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:tet,colorPalette:[]})]})]})}var Ys=a(T(),1);function ret({name:e}){return(0,Ys.jsxs)(Ys.Fragment,{children:[(0,Ys.jsx)(sr,{title:(0,TT.__)("Edit palette"),description:(0,TT.__)("The combination of colors used across the site and in color pickers.")}),(0,Ys.jsxs)(Pn.Root,{defaultValue:"color",children:[(0,Ys.jsx)("div",{className:"global-styles-ui-color-palette__tablist-container",children:(0,Ys.jsxs)(Pn.List,{className:"global-styles-ui-color-palette__tablist",children:[(0,Ys.jsx)(Pn.Tab,{value:"color",children:(0,TT.__)("Color")}),(0,Ys.jsx)(Pn.Tab,{value:"gradient",children:(0,TT.__)("Gradient")})]})}),(0,Ys.jsx)(Pn.Panel,{value:"color",tabIndex:-1,children:(0,Ys.jsx)(_ye,{name:e})}),(0,Ys.jsx)(Pn.Panel,{value:"gradient",tabIndex:-1,children:(0,Ys.jsx)(xye,{name:e})})]})]})}var Cye=ret;var lG=a(j(),1),kye=a(be(),1),Rye=a(G(),1);var Eye=a(be(),1);var Tye=a(T(),1),oet={backgroundSize:"auto"},{BackgroundPanel:net}=Tt(Eye.privateApis);function Pye(){let[e]=qe("",void 0,"user",!1),[t,r]=qe("",void 0,"merged",!1),[o]=Le("");return(0,Tye.jsx)(net,{inheritedValue:t,value:e,onChange:r,settings:o,defaultValues:oet,showInheritanceLabelIndicators:!1})}var ag=a(T(),1),{useHasBackgroundPanel:iet}=Tt(kye.privateApis);function set(){let[e]=Le(""),t=iet(e);return(0,ag.jsxs)(ag.Fragment,{children:[(0,ag.jsx)(sr,{title:(0,lG.__)("Background"),description:(0,ag.jsx)(Rye.__experimentalText,{children:(0,lG.__)("Set styles for the site's background.")})}),t&&(0,ag.jsx)(Pye,{})]})}var Aye=set;var as=a(G(),1),ss=a(j(),1);var Fye=a(U(),1);var Iye=a(G(),1),Oye=a(j(),1),Nye=a(T(),1);function aet({text:e,confirmButtonText:t,isOpen:r,toggleOpen:o,onConfirm:n}){let i=async()=>{o(),n()},s=()=>{o()};return(0,Nye.jsx)(Iye.__experimentalConfirmDialog,{isOpen:r,cancelButtonText:(0,Oye.__)("Cancel"),confirmButtonText:t,onCancel:s,onConfirm:i,size:"medium",children:e})}var Mye=aet;var _r=a(T(),1),{Menu:PT}=Tt(as.privateApis),uG="6px 6px 9px rgba(0, 0, 0, 0.2)";function Dye(){let[e]=Le("shadow.presets.default"),[t]=Le("shadow.defaultPresets"),[r]=Le("shadow.presets.theme"),[o,n]=Le("shadow.presets.custom"),i=d=>{n([...o||[],d])},s=()=>{n([])},[l,c]=(0,Fye.useState)(!1),u=()=>c(!l);return(0,_r.jsxs)(_r.Fragment,{children:[l&&(0,_r.jsx)(Mye,{text:(0,ss.__)("Are you sure you want to remove all custom shadows?"),confirmButtonText:(0,ss.__)("Remove"),isOpen:l,toggleOpen:u,onConfirm:s}),(0,_r.jsx)(sr,{title:(0,ss.__)("Shadows"),description:(0,ss.__)("Manage and create shadow styles for use across the site.")}),(0,_r.jsx)(tg,{children:(0,_r.jsxs)(as.__experimentalVStack,{className:"global-styles-ui__shadows-panel",spacing:7,children:[t&&(0,_r.jsx)(cG,{label:(0,ss.__)("Default"),shadows:e||[],category:"default"}),r&&r.length>0&&(0,_r.jsx)(cG,{label:(0,ss.__)("Theme"),shadows:r||[],category:"theme"}),(0,_r.jsx)(cG,{label:(0,ss.__)("Custom"),shadows:o||[],category:"custom",canCreate:!0,onCreate:i,onReset:u})]})})]})}function cG({label:e,shadows:t,category:r,canCreate:o,onCreate:n,onReset:i}){let s=()=>{let l=nM(t,"shadow-");n?.({name:(0,ss.sprintf)((0,ss.__)("Shadow %d"),l),shadow:uG,slug:`shadow-${l}`})};return(0,_r.jsxs)(as.__experimentalVStack,{spacing:2,children:[(0,_r.jsxs)(as.__experimentalHStack,{justify:"space-between",children:[(0,_r.jsx)(Uo,{level:3,children:e}),(0,_r.jsxs)(as.FlexItem,{className:"global-styles-ui__shadows-panel__options-container",children:[o&&(0,_r.jsx)(as.Button,{size:"small",icon:Cc,label:(0,ss.__)("Add shadow"),onClick:()=>{s()}}),!!t?.length&&r==="custom"&&(0,_r.jsxs)(PT,{children:[(0,_r.jsx)(PT.TriggerButton,{render:(0,_r.jsx)(as.Button,{size:"small",icon:bo,label:(0,ss.__)("Shadow options")})}),(0,_r.jsx)(PT.Popover,{children:(0,_r.jsx)(PT.Item,{onClick:i,children:(0,_r.jsx)(PT.ItemLabel,{children:(0,ss.__)("Remove all custom shadows")})})})]})]})]}),t.length>0&&(0,_r.jsx)(as.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(l=>(0,_r.jsx)(cet,{shadow:l,category:r},l.slug))})]})}function cet({shadow:e,category:t}){return(0,_r.jsx)(xo,{path:`/shadows/edit/${t}/${e.slug}`,children:(0,_r.jsxs)(as.__experimentalHStack,{children:[(0,_r.jsx)(as.FlexItem,{children:e.name}),(0,_r.jsx)(En,{icon:(0,ss.isRTL)()?Ar:hr})]})})}var ot=a(G(),1),zr=a(j(),1);var hl=a(U(),1);function Lye(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map(r=>r.trim())}function Vye(e){let t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e||e.includes("none"))return t;let r=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,o=e.match(r)||[];if(o.length!==1)return t;let n=o[0].split(" ").map(g=>g.trim()).filter(g=>g);if(n.length<2)return t;let i=e.match(/inset/gi)||[];if(i.length>1)return t;let s=i.length===1,l=e.replace(r,"").trim();s&&(l=l.replace("inset","").replace("INSET","").trim());let c=/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi,u=(l.match(c)||[]).map(g=>g?.trim()).filter(g=>g);if(u.length>1)return t;if(u.length===0&&(u=l.trim().split(" ").filter(g=>g),u.length>1))return t;let[d,f,m,h]=n;return{x:d,y:f,blur:m||t.blur,spread:h||t.spread,inset:s,color:l||t.color}}function Bye(e){let t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}var We=a(T(),1),{Menu:kT}=Tt(ot.privateApis),uet=[{label:(0,zr.__)("Rename"),action:"rename"},{label:(0,zr.__)("Delete"),action:"delete"}],det=[{label:(0,zr.__)("Reset"),action:"reset"}];function jye(){let{goBack:e,params:t}=(0,ot.useNavigator)(),{category:r,slug:o}=t,[n,i]=Le(`shadow.presets.${r}`);(0,hl.useEffect)(()=>{let S=n?.some(x=>x.slug===o);o&&!S&&e()},[n,o,e]);let[s]=Le(`shadow.presets.${r}`,void 0,"base"),[l,c]=(0,hl.useState)(()=>(n||[]).find(S=>S.slug===o)),u=(0,hl.useMemo)(()=>(s||[]).find(S=>S.slug===o),[s,o]),[d,f]=(0,hl.useState)(!1),[m,h]=(0,hl.useState)(!1),[g,v]=(0,hl.useState)(l?.name);if(!r||!o)return null;let b=S=>{c({...l,shadow:S});let x=n.map(C=>C.slug===o?{...l,shadow:S}:C);i(x)},_=S=>{if(S==="reset"){let x=n.map(C=>C.slug===o?u:C);c(u),i(x)}else S==="delete"?f(!0):S==="rename"&&h(!0)},y=()=>{i(n.filter(S=>S.slug!==o))},w=S=>{if(!S)return;let x=n.map(C=>C.slug===o?{...l,name:S}:C);c({...l,name:S}),i(x)};return l?(0,We.jsxs)(We.Fragment,{children:[(0,We.jsxs)(ot.__experimentalHStack,{justify:"space-between",children:[(0,We.jsx)(sr,{title:l.name}),(0,We.jsx)(ot.FlexItem,{children:(0,We.jsx)(ot.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,We.jsxs)(kT,{children:[(0,We.jsx)(kT.TriggerButton,{render:(0,We.jsx)(ot.Button,{size:"small",icon:bo,label:(0,zr.__)("Menu")})}),(0,We.jsx)(kT.Popover,{children:(r==="custom"?uet:det).map(S=>(0,We.jsx)(kT.Item,{onClick:()=>_(S.action),disabled:S.action==="reset"&&l.shadow===u?.shadow,children:(0,We.jsx)(kT.ItemLabel,{children:S.label})},S.action))})]})})})]}),(0,We.jsxs)(tg,{children:[(0,We.jsx)(fet,{shadow:l.shadow}),(0,We.jsx)(pet,{shadow:l.shadow,onChange:b})]}),d&&(0,We.jsx)(ot.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{y(),f(!1)},onCancel:()=>{f(!1)},confirmButtonText:(0,zr.__)("Delete"),size:"medium",children:(0,zr.sprintf)((0,zr.__)('Are you sure you want to delete "%s" shadow preset?'),l.name)}),m&&(0,We.jsx)(ot.Modal,{title:(0,zr.__)("Rename"),onRequestClose:()=>h(!1),size:"small",children:(0,We.jsxs)("form",{onSubmit:S=>{S.preventDefault(),w(g),h(!1)},children:[(0,We.jsx)(ot.__experimentalInputControl,{autoComplete:"off",label:(0,zr.__)("Name"),placeholder:(0,zr.__)("Shadow name"),value:g??"",onChange:v}),(0,We.jsx)(ot.__experimentalSpacer,{marginBottom:6}),(0,We.jsxs)(ot.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,We.jsx)(ot.FlexItem,{children:(0,We.jsx)(ot.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>h(!1),children:(0,zr.__)("Cancel")})}),(0,We.jsx)(ot.FlexItem,{children:(0,We.jsx)(ot.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,zr.__)("Save")})})]})]})})]}):(0,We.jsx)(sr,{title:""})}function fet({shadow:e}){return(0,We.jsx)(ot.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,We.jsx)(ot.__experimentalHStack,{alignment:"center",justify:"center",className:"global-styles-ui__shadow-preview-panel",children:(0,We.jsx)("div",{className:"global-styles-ui__shadow-preview-block",style:{boxShadow:e}})})})}function pet({shadow:e,onChange:t}){let r=(0,hl.useRef)(null),o=(0,hl.useMemo)(()=>Lye(e),[e]),n=(l,c)=>{let u=[...o];u[l]=c,t(u.join(", "))},i=()=>{t([...o,uG].join(", "))},s=l=>{t(o.filter((c,u)=>u!==l).join(", ")),r.current?.focus()};return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(ot.__experimentalVStack,{spacing:2,children:(0,We.jsxs)(ot.__experimentalHStack,{justify:"space-between",children:[(0,We.jsx)(Uo,{level:3,children:(0,zr.__)("Shadows")}),(0,We.jsx)(ot.FlexItem,{className:"global-styles-ui__shadows-panel__options-container",children:(0,We.jsx)(ot.Button,{size:"small",icon:Cc,label:(0,zr.__)("Add shadow"),onClick:()=>{i()},ref:r})})]})}),(0,We.jsx)(ot.__experimentalSpacer,{}),(0,We.jsx)(ot.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:o.map((l,c)=>(0,We.jsx)(met,{shadow:l,onChange:u=>n(c,u),canRemove:o.length>1,onRemove:()=>s(c)},c))})]})}function met({shadow:e,onChange:t,canRemove:r,onRemove:o}){let n={placement:"left-start",offset:36,shift:!0},i=(0,hl.useMemo)(()=>Vye(e),[e]),s=l=>{t(Bye(l))};return(0,We.jsx)(ot.Dropdown,{popoverProps:n,className:"global-styles-ui__shadow-editor__dropdown",renderToggle:({onToggle:l,isOpen:c})=>{let u={onClick:l,className:J("global-styles-ui__shadow-editor__dropdown-toggle",{"is-open":c}),"aria-expanded":c},d={onClick:()=>{c&&l(),o()},className:J("global-styles-ui__shadow-editor__remove-button",{"is-open":c}),label:(0,zr.__)("Remove shadow")};return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(ot.Button,{__next40pxDefaultSize:!0,icon:E1,...u,children:i.inset?(0,zr.__)("Inner shadow"):(0,zr.__)("Drop shadow")}),r&&(0,We.jsx)(ot.Button,{size:"small",icon:NB,...d})]})},renderContent:()=>(0,We.jsx)(ot.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"global-styles-ui__shadow-editor__dropdown-content",children:(0,We.jsx)(het,{shadowObj:i,onChange:s})})})}function het({shadowObj:e,onChange:t}){let n=(i,s)=>{let l={...e,[i]:s};t(l)};return(0,We.jsxs)(ot.__experimentalVStack,{spacing:4,className:"global-styles-ui__shadow-editor-panel",children:[(0,We.jsx)(ot.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:i=>n("color",i)}),(0,We.jsxs)(ot.__experimentalToggleGroupControl,{label:(0,zr.__)("Shadow Type"),value:e.inset?"inset":"outset",isBlock:!0,onChange:i=>n("inset",i==="inset"),hideLabelFromVision:!0,children:[(0,We.jsx)(ot.__experimentalToggleGroupControlOption,{value:"outset",label:(0,zr.__)("Outset")}),(0,We.jsx)(ot.__experimentalToggleGroupControlOption,{value:"inset",label:(0,zr.__)("Inset")})]}),(0,We.jsxs)(ot.__experimentalGrid,{columns:2,gap:4,children:[(0,We.jsx)(zM,{label:(0,zr.__)("X Position"),value:e.x,onChange:i=>n("x",i)}),(0,We.jsx)(zM,{label:(0,zr.__)("Y Position"),value:e.y,onChange:i=>n("y",i)}),(0,We.jsx)(zM,{label:(0,zr.__)("Blur"),value:e.blur,onChange:i=>n("blur",i)}),(0,We.jsx)(zM,{label:(0,zr.__)("Spread"),value:e.spread,onChange:i=>n("spread",i)})]})]})}function zM({label:e,value:t,onChange:r}){return(0,We.jsx)(ot.__experimentalUnitControl,{label:e,value:t,onChange:n=>{let s=n!==void 0&&!isNaN(parseFloat(n))?n:"0px";r(s)}})}var dG=a(T(),1);function zye(){return(0,dG.jsx)(Dye,{})}function Hye(){return(0,dG.jsx)(jye,{})}var Yye=a(j(),1),qye=a(be(),1);var Uye=a(be(),1),fG=a(U(),1);var Wye=a(T(),1),{useSettingsForBlockElement:get,DimensionsPanel:vet}=Tt(Uye.privateApis),bet={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,height:!0,minHeight:!0,minWidth:!0,width:!0,childLayout:!1};function Gye(){let[e]=qe("",void 0,"user",!1),[t,r]=qe("",void 0,"merged",!1),[o]=Le("",void 0,"user"),[n,i]=Le(""),s=get(n),l=(0,fG.useMemo)(()=>({...t,layout:s.layout}),[t,s.layout]),c=(0,fG.useMemo)(()=>({...e,layout:o.layout}),[e,o.layout]);return(0,Wye.jsx)(vet,{inheritedValue:l,value:c,onChange:d=>{let f={...d};if(delete f.layout,r(f),d.layout!==o.layout){let m={...o,layout:d.layout};m.layout?.definitions&&delete m.layout.definitions,i(m)}},settings:s,includeLayoutControls:!0,defaultControls:bet,showInheritanceLabelIndicators:!1})}var oy=a(T(),1),{useHasDimensionsPanel:yet,useSettingsForBlockElement:wet}=Tt(qye.privateApis);function _et(){let[e]=Le(""),t=wet(e),r=yet(t);return(0,oy.jsxs)(oy.Fragment,{children:[(0,oy.jsx)(sr,{title:(0,Yye.__)("Layout")}),r&&(0,oy.jsx)(Gye,{})]})}var Kye=_et;var GM=a(G(),1),mG=a(j(),1);var pG=a(j(),1),$ye=a(G(),1);var Zye=a(le(),1),Xye=a(Y(),1),UM=a(U(),1),Qye=a(G(),1),Jye=a(j(),1);var HM=a(T(),1);function xet({gap:e=2}){let{user:t}=(0,UM.useContext)(on),r=t?.styles,n=(0,Xye.useSelect)(s=>{let l=s(Zye.store).__experimentalGetCurrentThemeGlobalStylesVariations();return Array.isArray(l)?l:void 0},[])?.filter(s=>!fT(s,["color"])&&!fT(s,["typography","spacing"])),i=(0,UM.useMemo)(()=>[...[{title:(0,Jye.__)("Default"),settings:{},styles:{}},...n??[]].map(l=>{let c=l?.styles?.blocks?{...l.styles.blocks}:{};r?.blocks&&Object.keys(r.blocks).forEach(m=>{if(r.blocks?.[m]?.css){let h=c[m]||{},g={css:`${c[m]?.css||""} ${r.blocks?.[m]?.css?.trim()||""}`};c[m]={...h,...g}}});let u=r?.css||l.styles?.css?{css:`${l.styles?.css||""} ${r?.css||""}`}:{},d=Object.keys(c).length>0?{blocks:c}:{},f={...l.styles,...u,...d};return{...l,settings:l.settings??{},styles:f}})],[n,r?.blocks,r?.css]);return!n||n.length<1?null:(0,HM.jsx)(Qye.__experimentalGrid,{columns:2,className:"global-styles-ui-style-variations-container",gap:e,children:i.map((s,l)=>(0,HM.jsx)(P_,{variation:s,children:c=>(0,HM.jsx)(aM,{label:s?.title,withHoverView:!0,isFocused:c,variation:s})},l))})}var WM=xet;var B_=a(T(),1);function e0e(){return(0,B_.jsxs)($ye.__experimentalVStack,{spacing:10,className:"global-styles-ui-variation-container",children:[(0,B_.jsx)(WM,{gap:3}),(0,B_.jsx)(L_,{title:(0,pG.__)("Color Variations"),gap:3}),(0,B_.jsx)(k_,{title:(0,pG.__)("Typography"),gap:3})]})}var Pp=a(T(),1);function Cet(){return(0,Pp.jsxs)(Pp.Fragment,{children:[(0,Pp.jsx)(sr,{title:(0,mG.__)("Browse styles"),description:(0,mG.__)("Choose a variation to change the look of the site.")}),(0,Pp.jsx)(GM.Card,{size:"small",isBorderless:!0,className:"global-styles-ui-screen-style-variations",children:(0,Pp.jsx)(GM.CardBody,{children:(0,Pp.jsx)(e0e,{})})})]})}var t0e=Cet;var RT=a(j(),1),r0e=a(G(),1),o0e=a(be(),1);var tc=a(T(),1),{AdvancedPanel:Eet}=Tt(o0e.privateApis);function Tet(){let[e]=qe("",void 0,"user",!1),[t,r]=qe("",void 0,"merged",!1);return(0,tc.jsxs)(tc.Fragment,{children:[(0,tc.jsx)(sr,{title:(0,RT.__)("Additional CSS"),description:(0,tc.jsxs)(tc.Fragment,{children:[(0,RT.__)("You can add custom CSS to further customize the appearance and layout of your site."),(0,tc.jsx)("br",{}),(0,tc.jsx)(r0e.ExternalLink,{href:(0,RT.__)("https://developer.wordpress.org/advanced-administration/wordpress/css/"),className:"global-styles-ui-screen-css-help-link",children:(0,RT.__)("Learn more about CSS")})]})}),(0,tc.jsx)("div",{className:"global-styles-ui-screen-css",children:(0,tc.jsx)(Eet,{value:e,onChange:r,inheritedValue:t})})]})}var n0e=Tet;var kp=a(j(),1),j_=a(G(),1),sy=a(U(),1);var i0e=a(Y(),1),s0e=a(le(),1),AT=a(U(),1);var Pet={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},ket={per_page:100,page:1},YM=[];function ny({query:e}={}){let{user:t}=(0,AT.useContext)(on),r=(0,AT.useMemo)(()=>({...ket,...e}),[e]),{authors:o,currentUser:n,isDirty:i,revisions:s,isLoadingGlobalStylesRevisions:l,revisionsCount:c}=(0,i0e.useSelect)(u=>{let{__experimentalGetDirtyEntityRecords:d,getCurrentUser:f,getUsers:m,getRevisions:h,__experimentalGetCurrentGlobalStylesId:g,getEntityRecord:v,isResolving:b}=u(s0e.store),_=d()||[],y=f(),w=_.length>0,S=g(),C=(S?v("root","globalStyles",S):void 0)?._links?.["version-history"]?.[0]?.count??0,A=S&&h("root","globalStyles",S,r)||YM,P=m(Pet)||YM,R=S?b("getRevisions",["root","globalStyles",S,r]):!1;return{authors:P,currentUser:y,isDirty:w,revisions:A,isLoadingGlobalStylesRevisions:R,revisionsCount:C}},[r]);return(0,AT.useMemo)(()=>{if(!o.length||l)return{revisions:YM,hasUnsavedChanges:i,isLoading:!0,revisionsCount:c};let u=s.map(f=>({...f,author:o.find(m=>m.id===f.author)}));if(s.length){if(u[0].id!=="unsaved"&&r.page===1&&(u[0].isLatest=!0),i&&t&&Object.keys(t).length>0&&n&&r.page===1){let f={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:n?.name||"",avatar_urls:n?.avatar_urls||{}},modified:new Date};u.unshift(f)}r.per_page&&r.page===Math.ceil(c/r.per_page)&&u.push({id:"parent",styles:{},settings:{}})}return{revisions:u,hasUnsavedChanges:i,isLoading:!1,revisionsCount:c}},[i,s,n,o,t,l,c,r.page,r.per_page])}var xi=a(j(),1),iy=a(G(),1),Bd=a(cn(),1),a0e=a(le(),1),l0e=a(Y(),1);var qM=a(Mo(),1);var ri=a(T(),1),{Badge:Ret}=Tt(iy.privateApis),Aet=3600*1e3*24;function Iet({revision:e,previousRevision:t}){let r=N1(e,t,{maxResults:7});return r.length?(0,ri.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"global-styles-ui-screen-revisions__changes",children:r.map(o=>(0,ri.jsx)("li",{children:o},o))}):null}function Oet(e,t,r,o){return e==="parent"?(0,xi.__)("Reset the styles to the theme defaults"):e==="unsaved"?(0,xi.sprintf)((0,xi.__)("Unsaved changes by %s"),t):o?(0,xi.sprintf)((0,xi.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,r):(0,xi.sprintf)((0,xi.__)("Changes saved by %1$s on %2$s"),t,r)}function Net({userRevisions:e,selectedRevisionId:t,onChange:r,canApplyRevision:o,onApplyRevision:n}){let{currentThemeName:i,currentUser:s}=(0,l0e.useSelect)(u=>{let{getCurrentTheme:d,getCurrentUser:f}=u(a0e.store),m=d();return{currentThemeName:m?.name?.rendered||m?.stylesheet,currentUser:f()}},[]),l=(0,Bd.getDate)(null).getTime(),{datetimeAbbreviated:c}=(0,Bd.getSettings)().formats;return(0,ri.jsx)(iy.Composite,{orientation:"vertical",className:"global-styles-ui-screen-revisions__revisions-list","aria-label":(0,xi.__)("Global styles revisions list"),role:"listbox",children:e.map((u,d)=>{let{id:f,author:m,modified:h}=u,g=f==="unsaved",v=g?s:m,b=v?.name||(0,xi.__)("User"),_=v?.avatar_urls?.["48"],w=t?t===f:d===0,S=!o&&w,x=f==="parent",C=h instanceof Date?h.toISOString():h,A=(0,Bd.getDate)(C??null),P=C&&l-A.getTime()>Aet?(0,Bd.dateI18n)(c,A):(0,Bd.humanTimeDiff)(C??A,void 0),R=Oet(f,b,(0,Bd.dateI18n)(c,A),S);return(0,ri.jsxs)(iy.Composite.Item,{className:"global-styles-ui-screen-revisions__revision-item","aria-current":w,role:"option",onKeyDown:N=>{let{keyCode:k}=N;(k===qM.ENTER||k===qM.SPACE)&&r(u)},onClick:N=>{N.preventDefault(),r(u)},"aria-selected":w,"aria-label":R,render:(0,ri.jsx)("div",{}),children:[(0,ri.jsx)("span",{className:"global-styles-ui-screen-revisions__revision-item-wrapper",children:x?(0,ri.jsxs)("span",{className:"global-styles-ui-screen-revisions__description",children:[(0,xi.__)("Default styles"),(0,ri.jsx)("span",{className:"global-styles-ui-screen-revisions__meta",children:i})]}):(0,ri.jsxs)("span",{className:"global-styles-ui-screen-revisions__description",children:[g?(0,ri.jsx)("span",{className:"global-styles-ui-screen-revisions__date",children:(0,xi.__)("(Unsaved)")}):(0,ri.jsx)("time",{className:"global-styles-ui-screen-revisions__date",dateTime:C,children:P}),(0,ri.jsxs)("span",{className:"global-styles-ui-screen-revisions__meta",children:[(0,ri.jsx)("img",{alt:b,src:_}),b]}),w&&(0,ri.jsx)(Iet,{revision:u,previousRevision:dr(1),accessibleWhenDisabled:!0,disabled:i||e===1,label:(0,oi.__)("First page"),icon:(0,oi.isRTL)()?kl:Rl,size:"compact"}),(0,tu.jsx)(rc.Button,{variant:s,onClick:()=>r(e-1),accessibleWhenDisabled:!0,disabled:i||e===1,label:(0,oi.__)("Previous page"),icon:(0,oi.isRTL)()?hr:Ar,size:"compact"})]}),(0,tu.jsx)(rc.__experimentalText,{variant:"muted",children:(0,oi.sprintf)((0,oi._x)("%1$d of %2$d","paging"),e,t)}),(0,tu.jsxs)(rc.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,tu.jsx)(rc.Button,{variant:s,onClick:()=>r(e+1),accessibleWhenDisabled:!0,disabled:i||e===t,label:(0,oi.__)("Next page"),icon:(0,oi.isRTL)()?Ar:hr,size:"compact"}),(0,tu.jsx)(rc.Button,{variant:s,onClick:()=>r(t),accessibleWhenDisabled:!0,disabled:i||e===t,label:(0,oi.__)("Last page"),icon:(0,oi.isRTL)()?Rl:kl,size:"compact"})]})]})}var ru=a(T(),1),d0e=10;function Met({onClose:e}={}){let{user:t,onChange:r}=(0,sy.useContext)(on),{params:o,goTo:n}=(0,j_.useNavigator)(),{revisionId:i}=o,[s,l]=(0,sy.useState)(1),{revisions:c,isLoading:u,hasUnsavedChanges:d,revisionsCount:f}=ny({query:{per_page:d0e,page:s}}),m=Math.ceil(f/d0e),[h,g]=(0,sy.useState)(!1),v=(0,sy.useMemo)(()=>i&&c.find(P=>String(P.id)===String(i))||t,[i,c,t]),b=yv(v,t),_=()=>{e&&e()},y=A=>{r(A),g(!1),_()},w=A=>{n(`/revisions/${A.id}`)},S=v?.id??c[0]?.id,x=!!S&&S!=="unsaved"&&!b,C=!!c.length;return(0,ru.jsxs)(ru.Fragment,{children:[(0,ru.jsx)(sr,{title:f?(0,kp.sprintf)((0,kp.__)("Revisions (%d)"),f):(0,kp.__)("Revisions"),description:(0,kp.__)(`Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you're ready, use the Save button to save your changes.`),onBack:_}),!C&&(0,ru.jsx)(j_.Spinner,{className:"global-styles-ui-screen-revisions__loading"}),(0,ru.jsx)(c0e,{onChange:w,selectedRevisionId:S,userRevisions:c,canApplyRevision:x,onApplyRevision:()=>d?g(!0):y(v)}),m>1&&(0,ru.jsx)("div",{className:"global-styles-ui-screen-revisions__footer",children:(0,ru.jsx)(u0e,{className:"global-styles-ui-screen-revisions__pagination",currentPage:s,numPages:m,changePage:l,totalItems:f,disabled:u,label:(0,kp.__)("Global Styles pagination")})}),h&&(0,ru.jsx)(j_.__experimentalConfirmDialog,{isOpen:h,confirmButtonText:(0,kp.__)("Apply"),onConfirm:()=>y(v),onCancel:()=>g(!1),size:"medium",children:(0,kp.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})}var f0e=Met;var Mn=a(j(),1),Wo=a(G(),1);var v0e=a(U(),1);var p0e=a(G(),1),m0e=a(j(),1),h0e=a(T(),1);function Fet({text:e,confirmButtonText:t,isOpen:r,toggleOpen:o,onConfirm:n}){let i=async()=>{o(),n()},s=()=>{o()};return(0,h0e.jsx)(p0e.__experimentalConfirmDialog,{isOpen:r,cancelButtonText:(0,m0e.__)("Cancel"),confirmButtonText:t,onCancel:s,onConfirm:i,size:"medium",children:e})}var g0e=Fet;var ar=a(T(),1),{Menu:IT}=Tt(Wo.privateApis);function hG({label:e,origin:t,sizes:r,handleAddFontSize:o,handleResetFontSizes:n}){let[i,s]=(0,v0e.useState)(!1),l=()=>s(!i),c=t==="custom"?(0,Mn.__)("Are you sure you want to remove all custom font size presets?"):(0,Mn.__)("Are you sure you want to reset all font size presets to their default values?");return(0,ar.jsxs)(ar.Fragment,{children:[n&&i&&(0,ar.jsx)(g0e,{text:c,confirmButtonText:t==="custom"?(0,Mn.__)("Remove"):(0,Mn.__)("Reset"),isOpen:i,toggleOpen:l,onConfirm:n}),(0,ar.jsxs)(Wo.__experimentalVStack,{spacing:4,children:[(0,ar.jsxs)(Wo.__experimentalHStack,{children:[(0,ar.jsx)(Uo,{level:3,children:e}),(0,ar.jsxs)(Wo.FlexItem,{className:"global-styles-ui__typography-panel__options-container",children:[t==="custom"&&(0,ar.jsx)(Wo.Button,{label:(0,Mn.__)("Add font size"),icon:Cc,size:"small",onClick:o}),!!n&&(0,ar.jsxs)(IT,{children:[(0,ar.jsx)(IT.TriggerButton,{render:(0,ar.jsx)(Wo.Button,{size:"small",icon:bo,label:(0,Mn.__)("Font size presets options")})}),(0,ar.jsx)(IT.Popover,{children:(0,ar.jsx)(IT.Item,{onClick:l,children:(0,ar.jsx)(IT.ItemLabel,{children:t==="custom"?(0,Mn.__)("Remove font size presets"):(0,Mn.__)("Reset font size presets")})})})]})]})]}),!!r.length&&(0,ar.jsx)(Wo.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:r.map(u=>(0,ar.jsx)(xo,{path:`/typography/font-sizes/${t}/${u.slug}`,children:(0,ar.jsxs)(Wo.__experimentalHStack,{children:[(0,ar.jsx)(Wo.FlexItem,{className:"global-styles-ui-font-size__item",children:u.name}),(0,ar.jsx)(Wo.FlexItem,{display:"flex",children:(0,ar.jsx)(En,{icon:(0,Mn.isRTL)()?Ar:hr})})]})},u.slug))})]})]})}function Det(){let[e,t]=Le("typography.fontSizes.theme"),[r]=Le("typography.fontSizes.theme","base"),[o,n]=Le("typography.fontSizes.default"),[i]=Le("typography.fontSizes.default","base"),[s=[],l]=Le("typography.fontSizes.custom"),[c]=Le("typography.defaultFontSizes"),u=()=>{let f=nM(s,"custom-"),m={name:(0,Mn.sprintf)((0,Mn.__)("New Font Size %d"),f),size:"16px",slug:`custom-${f}`};l([...s,m])},d=(f,m)=>f.map(h=>h.size).join("")===m.map(h=>h.size).join("");return(0,ar.jsxs)(Wo.__experimentalVStack,{spacing:2,children:[(0,ar.jsx)(sr,{title:(0,Mn.__)("Font size presets"),description:(0,Mn.__)("Create and edit the presets used for font sizes across the site.")}),(0,ar.jsx)(Wo.__experimentalView,{children:(0,ar.jsx)(Wo.__experimentalSpacer,{paddingX:4,children:(0,ar.jsxs)(Wo.__experimentalVStack,{spacing:8,children:[!!e?.length&&(0,ar.jsx)(hG,{label:(0,Mn.__)("Theme"),origin:"theme",sizes:e,handleAddFontSize:u,handleResetFontSizes:d(e,r)?void 0:()=>t(r)}),c&&!!o?.length&&(0,ar.jsx)(hG,{label:(0,Mn.__)("Default"),origin:"default",sizes:o,handleAddFontSize:u,handleResetFontSizes:d(o,i)?void 0:()=>n(i)}),(0,ar.jsx)(hG,{label:(0,Mn.__)("Custom"),origin:"custom",sizes:s,handleAddFontSize:u,handleResetFontSizes:s.length>0?()=>l([]):void 0})]})})})]})}var b0e=Det;var Aa=a(j(),1),Go=a(G(),1);var OT=a(U(),1);var y0e=a(be(),1),w0e=a(j(),1);var _0e=a(T(),1);function Let({fontSize:e}){let[t]=qe("typography"),r=typeof e?.fluid=="object"&&e?.fluid?.min&&e?.fluid?.max?{minimumFontSize:e.fluid.min,maximumFontSize:e.fluid.max}:{fontSize:e.size},o=(0,y0e.getComputedFluidTypographyValue)(r);return(0,_0e.jsx)("div",{className:"global-styles-ui-typography-preview",style:{fontSize:o,fontFamily:t?.fontFamily??"serif"},children:(0,w0e.__)("Aa")})}var S0e=Let;var x0e=a(G(),1),z_=a(j(),1),C0e=a(T(),1);function Vet({fontSize:e,isOpen:t,toggleOpen:r,handleRemoveFontSize:o}){let n=async()=>{r(),o(e)},i=()=>{r()};return(0,C0e.jsx)(x0e.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,z_.__)("Cancel"),confirmButtonText:(0,z_.__)("Delete"),onCancel:i,onConfirm:n,size:"medium",children:e&&(0,z_.sprintf)((0,z_.__)('Are you sure you want to delete "%s" font size preset?'),e.name)})}var E0e=Vet;var ou=a(G(),1),H_=a(j(),1),T0e=a(U(),1),Rp=a(T(),1);function Bet({fontSize:e,toggleOpen:t,handleRename:r}){let[o,n]=(0,T0e.useState)(e.name),i=()=>{o&&o.trim()&&r(o),t()};return(0,Rp.jsx)(ou.Modal,{onRequestClose:t,focusOnMount:"firstContentElement",title:(0,H_.__)("Rename"),size:"small",children:(0,Rp.jsx)("form",{onSubmit:s=>{s.preventDefault(),i(),t()},children:(0,Rp.jsxs)(ou.__experimentalVStack,{spacing:"3",children:[(0,Rp.jsx)(ou.__experimentalInputControl,{autoComplete:"off",value:o,onChange:n,label:(0,H_.__)("Name"),placeholder:(0,H_.__)("Font size preset name")}),(0,Rp.jsxs)(ou.__experimentalHStack,{justify:"right",children:[(0,Rp.jsx)(ou.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,H_.__)("Cancel")}),(0,Rp.jsx)(ou.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,H_.__)("Save")})]})]})})})}var P0e=Bet;var Fn=a(G(),1),Ap=a(T(),1),jet=["px","em","rem","vw","vh"];function KM(e){let{baseControlProps:t}=(0,Fn.useBaseControlProps)(e),{value:r,onChange:o,fallbackValue:n,disabled:i,label:s}=e,l=(0,Fn.__experimentalUseCustomUnits)({availableUnits:jet}),[c,u="px"]=(0,Fn.__experimentalParseQuantityAndUnitFromRawValue)(r,l),d=!!u&&["em","rem","vw","vh"].includes(u);return(0,Ap.jsx)(Fn.BaseControl,{...t,children:(0,Ap.jsxs)(Fn.Flex,{children:[(0,Ap.jsx)(Fn.FlexItem,{isBlock:!0,children:(0,Ap.jsx)(Fn.__experimentalUnitControl,{label:s,hideLabelFromVision:!0,value:r,onChange:h=>{o?.(h)},units:l,min:0,disabled:i})}),(0,Ap.jsx)(Fn.FlexItem,{isBlock:!0,children:(0,Ap.jsx)(Fn.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,Ap.jsx)(Fn.RangeControl,{label:s,hideLabelFromVision:!0,value:c,initialPosition:n,withInputField:!1,onChange:h=>{o?.(h!==void 0?h+u:void 0)},min:0,max:d?10:100,step:d?.1:1,disabled:i})})})]})})}var rr=a(T(),1),{Menu:ay}=Tt(Go.privateApis);function zet(){let[e,t]=(0,OT.useState)(!1),[r,o]=(0,OT.useState)(!1),{params:{origin:n,slug:i},goBack:s}=(0,Go.useNavigator)(),[l,c]=Le("typography.fontSizes"),[u]=Le("typography.fluid"),d=l?.[n]??[],f=d.find(P=>P.slug===i);if((0,OT.useEffect)(()=>{i&&!f&&s()},[i,f,s]),!n||!i||!f)return null;let m=f?.fluid!==void 0?!!f.fluid:!!u,h=typeof f?.fluid=="object",g=P=>{S("name",P)},v=P=>{S("size",P)},b=P=>{S("fluid",P)},_=P=>{P?S("fluid",{min:f.size,max:f.size}):S("fluid",!0)},y=P=>{let R=typeof f.fluid=="object"?f.fluid:{};S("fluid",{...R,min:P})},w=P=>{let R=typeof f.fluid=="object"?f.fluid:{};S("fluid",{...R,max:P})},S=(P,R)=>{let N=d.map(k=>k.slug===i?{...k,[P]:R}:k);c({...l,[n]:N})},x=()=>{let P=d.filter(R=>R.slug!==i);c({...l,[n]:P})},C=()=>{t(!e)},A=()=>{o(!r)};return(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(E0e,{fontSize:f,isOpen:e,toggleOpen:C,handleRemoveFontSize:x}),r&&(0,rr.jsx)(P0e,{fontSize:f,toggleOpen:A,handleRename:g}),(0,rr.jsxs)(Go.__experimentalVStack,{spacing:4,children:[(0,rr.jsxs)(Go.__experimentalHStack,{justify:"space-between",alignment:"flex-start",children:[(0,rr.jsx)(sr,{title:f.name,description:(0,Aa.sprintf)((0,Aa.__)("Manage the font size %s."),f.name)}),n==="custom"&&(0,rr.jsx)(Go.FlexItem,{children:(0,rr.jsx)(Go.__experimentalSpacer,{marginTop:3,marginBottom:0,paddingX:4,children:(0,rr.jsxs)(ay,{children:[(0,rr.jsx)(ay.TriggerButton,{render:(0,rr.jsx)(Go.Button,{size:"small",icon:bo,label:(0,Aa.__)("Font size options")})}),(0,rr.jsxs)(ay.Popover,{children:[(0,rr.jsx)(ay.Item,{onClick:A,children:(0,rr.jsx)(ay.ItemLabel,{children:(0,Aa.__)("Rename")})}),(0,rr.jsx)(ay.Item,{onClick:C,children:(0,rr.jsx)(ay.ItemLabel,{children:(0,Aa.__)("Delete")})})]})]})})})]}),(0,rr.jsx)(Go.__experimentalView,{children:(0,rr.jsx)(Go.__experimentalSpacer,{paddingX:4,marginBottom:0,paddingBottom:6,children:(0,rr.jsxs)(Go.__experimentalVStack,{spacing:4,children:[(0,rr.jsx)(Go.FlexItem,{children:(0,rr.jsx)(S0e,{fontSize:f})}),(0,rr.jsx)(KM,{label:(0,Aa.__)("Size"),value:!h&&f.size?String(f.size):"",onChange:v,disabled:h}),(0,rr.jsx)(Go.ToggleControl,{label:(0,Aa.__)("Fluid typography"),help:(0,Aa.__)("Scale the font size dynamically to fit the screen or viewport."),checked:m,onChange:b}),m&&(0,rr.jsx)(Go.ToggleControl,{label:(0,Aa.__)("Custom fluid values"),help:(0,Aa.__)("Set custom min and max values for the fluid font size."),checked:h,onChange:_}),h&&(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(KM,{label:(0,Aa.__)("Minimum"),value:typeof f?.fluid=="object"?f.fluid?.min:void 0,onChange:y}),(0,rr.jsx)(KM,{label:(0,Aa.__)("Maximum"),value:typeof f?.fluid=="object"?f.fluid?.max:void 0,onChange:w})]})]})})})]})]})}var k0e=zet;var $e=a(T(),1);function Het({parentMenu:e,blockStyles:t,blockName:r,selectedViewport:o,showResponsiveStateControls:n,showBlockStateControls:i}){return(0,$e.jsx)($e.Fragment,{children:t.map((s,l)=>(0,$e.jsx)(U_.Navigator.Screen,{path:e+"/variations/"+s.name,children:(0,$e.jsx)(JW,{name:r,variation:s.name,selectedViewport:o,showResponsiveStateControls:n,showBlockStateControls:i})},l))})}function Uet({name:e,parentMenu:t="",selectedViewport:r,showResponsiveStateControls:o,showBlockStateControls:n}){let i=(0,R0e.useSelect)(s=>{if(!e)return[];let{getBlockStyles:l}=s(ZM.store);return l(e)},[e]);return i?.length?(0,$e.jsx)(Het,{parentMenu:t,blockStyles:i,blockName:e||"",selectedViewport:r,showResponsiveStateControls:o,showBlockStateControls:n}):null}function vG({value:e,baseValue:t,onChange:r,path:o,onPathChange:n,fontLibraryEnabled:i=!1,serverCSS:s,serverSettings:l,selectedViewport:c,showResponsiveStateControls:u=!0,showBlockStateControls:d=!0}){let f=(0,ZM.getBlockTypes)(),m=(0,lg.useMemo)(()=>Di(t,e),[t,e]),[h,g]=wv(m,[],{styleOptions:{variationStyles:!0}}),v=(0,lg.useMemo)(()=>[...s??[],...h??[]],[s,h]),b=(0,lg.useMemo)(()=>({...l,__experimentalFeatures:g,styles:v}),[g,l,v]);return(0,$e.jsx)(uT,{value:e,baseValue:t,onChange:r,fontLibraryEnabled:i,children:(0,$e.jsx)(A0e.BlockEditorProvider,{settings:b,children:(0,$e.jsxs)(U_.Navigator,{className:"global-styles-ui-sidebar__navigator-provider",initialPath:o||"/",children:[(o||n)&&(0,$e.jsx)(Wet,{path:o,onPathChange:n}),(0,$e.jsx)(wn,{path:"/",children:(0,$e.jsx)(yve,{})}),(0,$e.jsx)(wn,{path:"/colors",children:(0,$e.jsx)(hye,{})}),(0,$e.jsx)(wn,{path:"/typography",children:(0,$e.jsx)(eye,{})}),(0,$e.jsx)(wn,{path:"/typography/font-sizes",children:(0,$e.jsx)(b0e,{})}),(0,$e.jsx)(wn,{path:"/typography/font-sizes/:origin/:slug",children:(0,$e.jsx)(k0e,{})}),(0,$e.jsx)(wn,{path:"/layout",children:(0,$e.jsx)(Kye,{})}),(0,$e.jsx)(wn,{path:"/colors/palette",children:(0,$e.jsx)(Cye,{})}),(0,$e.jsx)(wn,{path:"/variations",children:(0,$e.jsx)(t0e,{})}),(0,$e.jsx)(wn,{path:"/css",children:(0,$e.jsx)(n0e,{})}),(0,$e.jsx)(wn,{path:"/revisions/:revisionId?",children:(0,$e.jsx)(f0e,{})}),(0,$e.jsx)(wn,{path:"/shadows",children:(0,$e.jsx)(zye,{})}),(0,$e.jsx)(wn,{path:"/shadows/edit/:category/:slug",children:(0,$e.jsx)(Hye,{})}),(0,$e.jsx)(wn,{path:"/background",children:(0,$e.jsx)(Aye,{})}),(0,$e.jsx)(wn,{path:"/typography/text",children:(0,$e.jsx)(F_,{element:"text"})}),(0,$e.jsx)(wn,{path:"/typography/link",children:(0,$e.jsx)(F_,{element:"link"})}),(0,$e.jsx)(wn,{path:"/typography/heading",children:(0,$e.jsx)(F_,{element:"heading"})}),(0,$e.jsx)(wn,{path:"/typography/caption",children:(0,$e.jsx)(F_,{element:"caption"})}),(0,$e.jsx)(wn,{path:"/typography/button",children:(0,$e.jsx)(F_,{element:"button"})}),(0,$e.jsx)(wn,{path:"/blocks",children:(0,$e.jsx)(Pve,{})}),f.map(_=>(0,$e.jsxs)(lg.Fragment,{children:[(0,$e.jsx)(wn,{path:"/blocks/"+encodeURIComponent(_.name),children:(0,$e.jsx)(JW,{name:_.name,selectedViewport:c,showResponsiveStateControls:u,showBlockStateControls:d})}),(0,$e.jsx)(Uet,{name:_.name,parentMenu:"/blocks/"+encodeURIComponent(_.name),selectedViewport:c,showResponsiveStateControls:u,showBlockStateControls:d})]},_.name))]})})})}function wn({path:e,children:t}){return(0,$e.jsx)(U_.Navigator.Screen,{className:"global-styles-ui-sidebar__navigator-screen",path:e,children:t})}function Wet({path:e,onPathChange:t}){let r=(0,U_.useNavigator)(),{path:o}=r.location,n=(0,gG.usePrevious)(e),i=(0,gG.usePrevious)(o);return(0,lg.useEffect)(()=>{e&&e!==o&&(e!==n?r.goTo(e):o!==i&&t&&t(o??"/"))},[t,e,i,n,o,r]),null}var bG=a(T(),1);function W_(e){return function({value:r,baseValue:o,onChange:n,...i}){return(0,bG.jsx)(uT,{value:r,baseValue:o,onChange:n,children:(0,bG.jsx)(e,{...i})})}}var Get=W_(WM);var Yet=W_(L_);var qet=W_(k_);var Ket=a(T(),1);var B0e=a(Ef(),1);var I0e=a(Y(),1),O0e=a(U(),1),N0e=a(be(),1),M0e=a(Ce(),1);function F0e({path:e,onPathChange:t}){let{selectedBlockName:r,selectedBlockClientId:o}=(0,I0e.useSelect)(s=>{let{getSelectedBlockClientId:l,getBlockName:c}=s(N0e.store),u=l();return{selectedBlockName:c(u),selectedBlockClientId:u}},[]),n=!0,i=(0,M0e.usePrevious)(o);return(0,O0e.useEffect)(()=>{if(o===i||!o||!n||!e||e!=="/blocks"&&!e.startsWith("/blocks/"))return;let s="/blocks/"+encodeURIComponent(r);s!==e&&t?.(s)},[o,i,r,n,e,t]),null}var ly=a(U(),1);var G_=a(le(),1),Y_=a(Y(),1),D0e=a(be(),1);var{cleanEmptyObject:yG}=q(D0e.privateApis);function Zet(){let{globalStylesId:e,isReady:t,settings:r,styles:o,_links:n}=(0,Y_.useSelect)(u=>{let{getEntityRecord:d,getEditedEntityRecord:f,hasFinishedResolution:m,canUser:h}=u(G_.store),g=u(G_.store).__experimentalGetCurrentGlobalStylesId(),v,b=g?h("update",{kind:"root",name:"globalStyles",id:g}):null;g&&typeof b=="boolean"&&(b?v=f("root","globalStyles",g):v=d("root","globalStyles",g,{context:"view"}));let _=!1;return m("__experimentalGetCurrentGlobalStylesId")&&(g?_=b?m("getEditedEntityRecord",["root","globalStyles",g]):m("getEntityRecord",["root","globalStyles",g,{context:"view"}]):_=!0),{globalStylesId:g,isReady:_,settings:v?.settings,styles:v?.styles,_links:v?._links}},[]),{getEditedEntityRecord:i}=(0,Y_.useSelect)(G_.store),{editEntityRecord:s}=(0,Y_.useDispatch)(G_.store),l=(0,ly.useMemo)(()=>({settings:r??{},styles:o??{},_links:n??{}}),[r,o,n]),c=(0,ly.useCallback)((u,d={})=>{let f=i("root","globalStyles",e),m={styles:f?.styles??{},settings:f?.settings??{},_links:f?._links??{}},h=typeof u=="function"?u(m):u;s("root","globalStyles",e,{styles:yG(h.styles)||{},settings:yG(h.settings)||{},_links:yG(h._links)||{}},d)},[e,s,i]);return[t,l,c]}function Xet(){let e=(0,Y_.useSelect)(t=>t(G_.store).__experimentalGetCurrentThemeBaseGlobalStyles(),[]);return[!!e,e]}function Hr(){let[e,t,r]=Zet(),[o,n]=Xet();return{merged:(0,ly.useMemo)(()=>!e||!o?{}:Di(n||{},t),[e,o,n,t]),base:n||{},user:t,setUser:r,isReady:e&&o}}function cg(e,t){let{merged:r}=Hr();return(0,ly.useMemo)(()=>bm(r,e,t),[r,e,t])}function wG(e,t){let{merged:r}=Hr();return(0,ly.useMemo)(()=>vv(r,e,t),[r,e,t])}var cy=a(T(),1);function Qet(e){let t=e?.styles,r=e?.__unstableResolvedAssets,o=e?.colors,n=e?.gradients,i=e?.__experimentalDiscussionSettings,s=e?.fontLibraryEnabled??!0,l=e?.responsiveEditingEnabled??!0,c=e?.blockStatesEditingEnabled??!0,u=(0,V0e.useSelect)(m=>{let{canUser:h}=m(L0e.store);return h("create",{kind:"postType",name:"attachment"})?B0e.uploadMedia:void 0},[]),d=(0,_G.useMemo)(()=>t?t.filter(m=>!m.isGlobalStyles):[],[t]),f=(0,_G.useMemo)(()=>({__unstableResolvedAssets:r,settings:{color:{palette:{theme:o??[]},gradients:{theme:n??[]},duotone:{theme:[]}}},__experimentalDiscussionSettings:i,mediaUpload:u}),[r,o,n,i,u]);return{serverCSS:d,serverSettings:f,fontLibraryEnabled:s,responsiveEditingEnabled:l,blockStatesEditingEnabled:c}}function XM({path:e,onPathChange:t,settings:r,selectedViewport:o,showResponsiveStateControls:n=!0}){let{user:i,base:s,setUser:l,isReady:c}=Hr(),{serverCSS:u,serverSettings:d,fontLibraryEnabled:f,responsiveEditingEnabled:m,blockStatesEditingEnabled:h}=Qet(r);return c?(0,cy.jsxs)(cy.Fragment,{children:[(0,cy.jsx)(vG,{value:i,baseValue:s||{},onChange:l,path:e,onPathChange:t,fontLibraryEnabled:f,serverCSS:u,serverSettings:d,selectedViewport:o,showResponsiveStateControls:n&&m,showBlockStateControls:h}),(0,cy.jsx)(F0e,{path:e,onPathChange:t})]}):null}var{store:Jet}=q(S_),j0e={};function $et(e){let{RECEIVE_INTERMEDIATE_RESULTS:t}=q(Ia.privateApis),{getEntityRecords:r}=e(Ia.store);return r("postType","wp_block",{per_page:-1,[t]:!0})}function ett(e){return e(Ia.store).getUserPatternCategories()}var ttt=["__experimentalBlockBindingsSupportedAttributes","__experimentalBlockDirectory","__experimentalDiscussionSettings","__experimentalFeatures","__experimentalGlobalStylesBaseStyles","allImageSizes","alignWide","blockStatesEditingEnabled","blockInspectorTabs","maxUploadFileSize","allowedMimeTypes","bodyPlaceholder","canEditCSS","canLockBlocks","canUpdateBlockBindings","capabilities","clearBlockSelection","codeEditingEnabled","colors","disableContentOnlyForTemplateParts","disableContentOnlyForUnsyncedPatterns","disableCustomColors","disableCustomFontSizes","disableCustomSpacingSizes","disableCustomGradients","disableLayoutStyles","enableCustomLineHeight","enableCustomSpacing","enableCustomUnits","enableOpenverseMediaCategory","fontSizes","gradients","generateAnchors","onNavigateToEntityRecord","imageDefaultSize","imageDimensions","imageEditing","imageSizes","isPreviewMode","isRTL","locale","maxWidth","postContentAttributes","postsPerPage","readOnly","styles","titlePlaceholder","supportsLayout","widgetTypesToHideFromLegacyWidgetBlock","__unstableHasCustomAppender","__unstableResolvedAssets","__unstableIsBlockBasedTheme"],{globalStylesDataKey:rtt,globalStylesLinksDataKey:ott,selectBlockPatternsKey:ntt,reusableBlocksSelectKey:itt,userPatternCategoriesSelectKey:stt,sectionRootClientIdKey:att,mediaEditKey:ltt,getMediaSelectKey:ctt,isIsolatedEditorKey:utt,deviceTypeKey:dtt,isNavigationOverlayContextKey:ftt,isNavigationPostEditorKey:ptt,mediaUploadOnSuccessKey:mtt,mediaSideloadFromUrlKey:htt,openMediaEditorModalKey:gtt}=q(QM.privateApis);function vtt(e,t,r,o){let n=(0,U0e.useViewportMatch)("medium"),{allImageSizes:i,bigImageSizeThreshold:s,imageStripMeta:l,imageMaxBitDepth:c,allowRightClickOverrides:u,blockTypes:d,focusMode:f,hasFixedToolbar:m,isDistractionFree:h,keepCaretInsideBlock:g,hasUploadPermissions:v,hiddenBlockTypes:b,canUseUnfilteredHTML:_,userCanCreatePages:y,pageOnFront:w,pageForPosts:S,restBlockPatternCategories:x,sectionRootClientId:C,deviceType:A,isNavigationOverlayContext:P,isRevisionsMode:R,viewablePostTypeLabel:N,currentPostId:k}=(0,uy.useSelect)(pe=>{let{canUser:$,getRawEntityRecord:oe,getEntityRecord:fe,getBlockPatternCategories:ve,getPostType:Oe}=pe(Ia.store),{get:ee}=pe(H0e.store),{getBlockTypes:ne}=pe(W0e.store),{getCurrentPostId:ce,getCurrentPostType:re}=pe(I),{getDeviceType:ie,isRevisionsMode:Ee}=q(pe(I)),{getBlocksByName:ke,getBlockAttributes:Me}=pe(QM.store),Ne=$("read",{kind:"root",name:"site"})?fe("root","site"):void 0,Fe=fe("root","__unstableBase"),X=re(),ge=X?Oe(X):void 0;function Ue(){return o==="template-locked"?ke("core/post-content")?.[0]??"":ke("core/group").find(Ye=>Me(Ye)?.tagName==="main")??""}return{allImageSizes:Fe?.image_sizes,bigImageSizeThreshold:Fe?.image_size_threshold,imageStripMeta:Fe?.image_strip_meta,imageMaxBitDepth:Fe?.image_max_bit_depth,allowRightClickOverrides:ee("core","allowRightClickOverrides"),blockTypes:ne(),canUseUnfilteredHTML:oe("postType",t,r)?._links?.hasOwnProperty("wp:action-unfiltered-html"),focusMode:ee("core","focusMode"),hasFixedToolbar:ee("core","fixedToolbar")||!n,hiddenBlockTypes:ee("core","hiddenBlockTypes"),isDistractionFree:ee("core","distractionFree"),keepCaretInsideBlock:ee("core","keepCaretInsideBlock"),hasUploadPermissions:$("create",{kind:"postType",name:"attachment"})??!0,userCanCreatePages:$("create",{kind:"postType",name:"page"}),pageOnFront:Ne?.page_on_front,pageForPosts:Ne?.page_for_posts,viewablePostTypeLabel:ge?.viewable?ge?.labels?.singular_name:void 0,currentPostId:ce(),restBlockPatternCategories:ve(),sectionRootClientId:Ue(),deviceType:ie(),isNavigationOverlayContext:t==="wp_template_part"&&r?fe("postType","wp_template_part",r)?.area==="navigation-overlay":!1,isRevisionsMode:Ee()}},[t,r,n,o]),{merged:E}=Hr(),M=E.styles??j0e,V=E._links??j0e,F=e.__experimentalAdditionalBlockPatterns??e.__experimentalBlockPatterns,D=e.__experimentalAdditionalBlockPatternCategories??e.__experimentalBlockPatternCategories,z=(0,ug.useMemo)(()=>[...F||[]].filter(({postTypes:pe})=>!pe||Array.isArray(pe)&&pe.includes(t)),[F,t]),L=(0,ug.useMemo)(()=>[...D||[],...x||[]].filter((pe,$,oe)=>$===oe.findIndex(fe=>pe.name===fe.name)),[D,x]),{undo:O,setIsInserterOpened:B}=(0,uy.useDispatch)(I),{editMediaEntity:W}=q((0,uy.useDispatch)(Ia.store)),{saveEntityRecord:K}=(0,uy.useDispatch)(Ia.store),{openMediaEditorModal:Z}=(0,uy.useDispatch)(Jet),Q=(0,ug.useCallback)(pe=>y?K("postType","page",pe):Promise.reject({message:(0,z0e.__)("You do not have permission to create Pages.")}),[K,y]),ue=(0,ug.useMemo)(()=>b&&b.length>0?(e.allowedBlockTypes===!0?d.map(({name:$})=>$):e.allowedBlockTypes||[]).filter($=>!b.includes($)):e.allowedBlockTypes,[e.allowedBlockTypes,b,d]),te=e.focusMode===!1,de=(0,ug.useMemo)(()=>Ige(k,N),[k,N]);return(0,ug.useMemo)(()=>{let pe={...Object.fromEntries(Object.entries(e).filter(([$])=>ttt.includes($))),[rtt]:M,[ott]:V,allImageSizes:i,bigImageSizeThreshold:s,imageStripMeta:l,imageMaxBitDepth:c,allowedBlockTypes:ue,allowRightClickOverrides:u,focusMode:f&&!te,hasFixedToolbar:m,isDistractionFree:h,keepCaretInsideBlock:g,[ctt]:($,oe)=>$(Ia.store).getEntityRecord("postType","attachment",oe),[ltt]:v?W:void 0,[gtt]:({id:$,onUpdate:oe,onClose:fe})=>Z({id:$,onUpdate:oe,onClose:fe}),mediaUpload:v?D2:void 0,[mtt]:v?Mge:void 0,mediaSideload:v?Dge:void 0,[htt]:v?jge:void 0,mediaFinalize:v?Uge:void 0,mediaDelete:v?Gge:void 0,__experimentalBlockPatterns:z,[ntt]:$=>{let{hasFinishedResolution:oe,getBlockPatternsForPostType:fe}=q($(Ia.store)),ve=fe(t);return oe("getBlockPatterns")?ve:void 0},[itt]:$et,[stt]:ett,__experimentalBlockPatternCategories:L,__experimentalFetchLinkSuggestions:($,oe)=>(0,Ia.__experimentalFetchLinkSuggestions)($,oe,e),inserterMediaCategories:de,__experimentalFetchRichUrlData:Ia.__experimentalFetchUrlData,__experimentalCanUserUseUnfilteredHTML:_,__experimentalUndo:O,outlineMode:!h&&t==="wp_template",__experimentalCreatePageEntity:Q,__experimentalUserCanCreatePages:y,pageOnFront:w,pageForPosts:S,__experimentalPreferPatternsOnRoot:t==="wp_template",templateLock:t==="wp_navigation"?"insert":e.templateLock,template:t==="wp_navigation"?[["core/navigation",{},[]]]:e.template,__experimentalSetIsInserterOpened:B,[att]:C,editorTool:o==="post-only"&&t!=="wp_template"?"edit":void 0,[utt]:["wp_template_part","wp_block","wp_navigation"].includes(t),[ptt]:t==="wp_navigation",disableContentOnlyForTemplateParts:o==="template-locked"||e.disableContentOnlyForTemplateParts,...A?{[dtt]:A}:{},[ftt]:P};return R&&(pe.isPreviewMode=!0),pe},[R,ue,u,f,te,m,h,g,e,v,z,L,de,_,O,Q,y,w,S,t,B,C,M,V,o,W,Z,A,i,s,l,c,P])}var G0e=vtt;var NT=a(Y(),1),q_=a(be(),1),$M=a(U(),1);var Y0e=a(U(),1),q0e=a(zn(),1),btt=["core/post-title","core/post-featured-image","core/post-content"];function JM(){return(0,Y0e.useMemo)(()=>[...(0,q0e.applyFilters)("editor.postContentBlockTypes",btt)],[])}function K0e(){let e=JM(),{contentOnlyIds:t,templateParts:r}=(0,NT.useSelect)(i=>{let{getPostBlocksByName:s}=q(i(I)),{getBlocksByName:l}=i(q_.store);return{contentOnlyIds:s(e),templateParts:l("core/template-part")}},[e]),o=(0,NT.useSelect)(i=>{let{getBlockOrder:s}=i(q_.store);return r.flatMap(l=>s(l))},[r]),n=(0,NT.useRegistry)();return(0,$M.useEffect)(()=>{let{setBlockEditingMode:i,unsetBlockEditingMode:s,__unstableMarkNextChangeAsNotPersistent:l}=n.dispatch(q_.store);return l(),i("","disabled"),()=>{l(),s("")}},[n]),(0,$M.useEffect)(()=>{let{setBlockEditingMode:i,unsetBlockEditingMode:s,__unstableMarkNextChangeAsNotPersistent:l}=n.dispatch(q_.store);return n.batch(()=>{for(let c of r)l(),i(c,"contentOnly")}),()=>{n.batch(()=>{for(let c of r)l(),s(c)})}},[r,n]),(0,$M.useEffect)(()=>{let{setBlockEditingMode:i,unsetBlockEditingMode:s,__unstableMarkNextChangeAsNotPersistent:l}=n.dispatch(q_.store),c=new Set(t);return n.batch(()=>{for(let u of t)l(),i(u,"contentOnly");for(let u of o)c.has(u)||(l(),i(u,"disabled"))}),()=>{n.batch(()=>{for(let u of t)l(),s(u);for(let u of o)c.has(u)||(l(),s(u))})}},[t,o,n]),null}var Z0e=a(U(),1),e3=a(Y(),1),SG=a(be(),1);function X0e(){let e=(0,e3.useRegistry)(),t=(0,e3.useSelect)(r=>r(SG.store).getBlockOrder()?.[0],[]);(0,Z0e.useEffect)(()=>{if(!t)return;let{setBlockEditingMode:r,unsetBlockEditingMode:o,__unstableMarkNextChangeAsNotPersistent:n}=e.dispatch(SG.store);return n(),r(t,"contentOnly"),()=>{n(),o(t)}},[e,t])}var J0e=a(U(),1),K_=a(zn(),1),Q0e=["wp_block","wp_template","wp_template_part"];function $0e(e,t){(0,J0e.useEffect)(()=>((0,K_.addFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter",(r,o)=>!Q0e.includes(e)&&o.name==="core/template-part"&&t==="post-only"?!1:r),(0,K_.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",(r,o,n,{getBlockParentsByBlockName:i})=>!Q0e.includes(e)&&o.name==="core/post-content"?i(n,"core/query").length>0:r),()=>{(0,K_.removeFilter)("blockEditor.__unstableCanInsertBlockType","removeTemplatePartsFromInserter"),(0,K_.removeFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter")}),[e,t])}var hwe=a(Y(),1),a3=a(U(),1),l3=a(Pt(),1);var oc=class{diff(t,r,o={}){let n;typeof o=="function"?(n=o,o={}):"callback"in o&&(n=o.callback);let i=this.castInput(t,o),s=this.castInput(r,o),l=this.removeEmpty(this.tokenize(i,o)),c=this.removeEmpty(this.tokenize(s,o));return this.diffWithOptionsObj(l,c,o,n)}diffWithOptionsObj(t,r,o,n){var i;let s=y=>{if(y=this.postProcess(y,o),n){setTimeout(function(){n(y)},0);return}else return y},l=r.length,c=t.length,u=1,d=l+c;o.maxEditLength!=null&&(d=Math.min(d,o.maxEditLength));let f=(i=o.timeout)!==null&&i!==void 0?i:1/0,m=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],r,t,0,o);if(h[0].oldPos+1>=c&&g+1>=l)return s(this.buildValues(h[0].lastComponent,r,t));let v=-1/0,b=1/0,_=()=>{for(let y=Math.max(v,-u);y<=Math.min(b,u);y+=2){let w,S=h[y-1],x=h[y+1];S&&(h[y-1]=void 0);let C=!1;if(x){let P=x.oldPos-y;C=x&&0<=P&&P=c&&g+1>=l)return s(this.buildValues(w.lastComponent,r,t))||!0;h[y]=w,w.oldPos+1>=c&&(b=Math.min(b,y-1)),g+1>=l&&(v=Math.max(v,y+1))}u++};if(n)(function y(){setTimeout(function(){if(u>d||Date.now()>m)return n(void 0);_()||y()},0)})();else for(;u<=d&&Date.now()<=m;){let y=_();if(y)return y}}addToPath(t,r,o,n,i){let s=t.lastComponent;return s&&!i.oneChangePerToken&&s.added===r&&s.removed===o?{oldPos:t.oldPos+n,lastComponent:{count:s.count+1,added:r,removed:o,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+n,lastComponent:{count:1,added:r,removed:o,previousComponent:s}}}extractCommon(t,r,o,n,i){let s=r.length,l=o.length,c=t.oldPos,u=c-n,d=0;for(;u+1m.length?g:m}),d.value=this.join(f)}else d.value=this.join(r.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return n}};var xG=class extends oc{},ytt=new xG;function CG(e,t,r){return ytt.diff(e,t,r)}function EG(e,t){let r;for(r=0;rt.length&&(r=e.length-t.length);let o=t.length;e.length0&&t[s]!=t[i];)i=n[i];t[s]==t[i]&&i++}i=0;for(let s=r;s0&&e[s]!=t[i];)i=n[i];e[s]==t[i]&&i++}return i}function kG(e,t){let r=[];for(let o of Array.from(t.segment(e))){let n=o.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(n)?r[r.length-1]+=n:r.push(n)}return r}function o3(e,t){if(t)return X_(e,t)[1];let r;for(r=e.length-1;r>=0&&e[r].match(/\s/);r--);return e.substring(r+1)}function dy(e,t){if(t)return X_(e,t)[0];let r=e.match(/^\s*/);return r?r[0]:""}function X_(e,t){if(!t)return[dy(e),o3(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let r=kG(e,t),o=r[0],n=r[r.length-1],i=/\s/.test(o)?o:"",s=/\s/.test(n)?n:"";return[i,s]}var n3="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",_tt=new RegExp(`[${n3}]+|\\s+|[^${n3}]`,"ug"),RG=class extends oc{equals(t,r,o){return o.ignoreCase&&(t=t.toLowerCase(),r=r.toLowerCase()),t.trim()===r.trim()}tokenize(t,r={}){let o;if(r.intlSegmenter){let s=r.intlSegmenter;if(s.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');o=kG(t,s)}else o=t.match(_tt)||[];let n=[],i=null;return o.forEach(s=>{/\s/.test(s)?i==null?n.push(s):n.push(n.pop()+s):i!=null&&/\s/.test(i)?n[n.length-1]==i?n.push(n.pop()+s):n.push(i+s):n.push(s),i=s}),n}join(t){return t.map((r,o)=>o==0?r:r.replace(/^\s+/,"")).join("")}postProcess(t,r){if(!t||r.oneChangePerToken)return t;let o=null,n=null,i=null;return t.forEach(s=>{s.added?n=s:s.removed?i=s:((n||i)&&ewe(o,i,n,s,r.intlSegmenter),o=s,n=null,i=null)}),(n||i)&&ewe(o,i,n,null,r.intlSegmenter),t}},Stt=new RG;function ewe(e,t,r,o,n){if(t&&r){let[i,s]=X_(t.value,n),[l,c]=X_(r.value,n);if(e){let u=EG(i,l);e.value=r3(e.value,l,u),t.value=Z_(t.value,u),r.value=Z_(r.value,u)}if(o){let u=TG(s,c);o.value=t3(o.value,c,u),t.value=MT(t.value,u),r.value=MT(r.value,u)}}else if(r){if(e){let i=dy(r.value,n);r.value=r.value.substring(i.length)}if(o){let i=dy(o.value,n);o.value=o.value.substring(i.length)}}else if(e&&o){let i=dy(o.value,n),[s,l]=X_(t.value,n),c=EG(i,s);t.value=Z_(t.value,c);let u=TG(Z_(i,c),l);t.value=MT(t.value,u),o.value=t3(o.value,i,u),e.value=r3(e.value,i,i.slice(0,i.length-u.length))}else if(o){let i=dy(o.value,n),s=o3(t.value,n),l=PG(s,i);t.value=MT(t.value,l)}else if(e){let i=o3(e.value,n),s=dy(t.value,n),l=PG(i,s);t.value=Z_(t.value,l)}}var AG=class extends oc{tokenize(t){let r=new RegExp(`(\\r?\\n)|[${n3}]+|[^\\S\\n\\r]+|[^${n3}]`,"ug");return t.match(r)||[]}},twe=new AG;function Q_(e,t,r){return twe.diff(e,t,r)}var IG=class extends oc{constructor(){super(...arguments),this.tokenize=Ctt}equals(t,r,o){return o.ignoreWhitespace?((!o.newlineIsToken||!t.includes(`
`))&&(t=t.trim()),(!o.newlineIsToken||!r.includes(`
`))&&(r=r.trim())):o.ignoreNewlineAtEof&&!o.newlineIsToken&&(t.endsWith(`
`)&&(t=t.slice(0,-1)),r.endsWith(`
`)&&(r=r.slice(0,-1))),super.equals(t,r,o)}},xtt=new IG;function rwe(e,t,r){return xtt.diff(e,t,r)}function Ctt(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
`));let r=[],o=e.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let n=0;nnull})}function lwe(){for(let e of swe)(0,i3.unregisterFormatType)(e.name)}var{parseRawBlock:dwe}=q(s3.privateApis);function cwe(e){return e.blockName===null&&(!e.innerHTML||!e.innerHTML.trim())}function uwe(e){return e==null?"":typeof e=="object"?JSON.stringify(e,null,2):String(e)}function Ett(e,t){if(!e&&!t)return 1;if(!e||!t)return 0;let r=new Intl.Segmenter(void 0,{granularity:"word"}),o=/[\p{L}\p{N}]/u,n=d=>{let f=[];for(let{segment:m,isWordLike:h}of r.segment(d))(h||o.test(m))&&f.push(m);return f},i=n(e),s=n(t);if(i.length===0&&s.length===0)return 1;let l=new Set(i),c=0;for(let d of s)l.has(d)&&c++;let u=Math.max(i.length,s.length);return u>0?c/u:0}function Ttt(e){let t=[],r=[];if(e.forEach((d,f)=>{let m=d.__revisionDiffStatus?.status;m==="removed"?t.push({block:d,index:f}):m==="added"&&r.push({block:d,index:f})}),t.length===0||r.length===0)return e;let o=new Set,n=new Set,i=new Map,s=.5,l=new Map;for(let d of r){let f=d.block.blockName;l.has(f)||l.set(f,[]),l.get(f).push(d)}let c=new Map;for(let d of t){let f=d.block.blockName;c.has(f)||c.set(f,[]),c.get(f).push(d)}let u=-1;for(let d of t){let f=l.get(d.block.blockName)||[],m=c.get(d.block.blockName)||[],h=f.filter(v=>!i.has(v.index)&&v.index>u);if(h.length===0)continue;let g=null;if(m.length===1&&h.length===1){let v=h[0],b=JSON.stringify(d.block.attrs)===JSON.stringify(v.block.attrs);(!((d.block.innerHTML||"")===(v.block.innerHTML||""))||!b)&&(g=v)}else{let v=0;for(let b of h){let _=Ett(d.block.innerHTML||"",b.block.innerHTML||""),y=JSON.stringify(d.block.attrs)===JSON.stringify(b.block.attrs);_>v&&_>s&&(_<1||!y)&&(v=_,g=b)}}if(g){u=g.index;let v={...g.block,__revisionDiffStatus:{status:"modified"},__previousRawBlock:d.block},b=Math.min(d.index,g.index),_=Math.max(d.index,g.index),y=!1;for(let w=b+1;w<_;w++){let S=e[w].__revisionDiffStatus?.status;if(S===void 0){y=!0;break}if(S==="added"&&!n.has(w)){y=!0;break}}y?(i.set(g.index,v),o.add(d.index)):(i.set(d.index,v),n.add(g.index))}}return e.map((d,f)=>o.has(f)||n.has(f)?null:i.has(f)?i.get(f):d).filter(Boolean)}function fwe(e,t){e=e.filter(u=>!cwe(u)),t=t.filter(u=>!cwe(u));let r=u=>JSON.stringify({name:u.blockName,attrs:u.attrs,html:(u.innerContent||[]).filter(d=>d!==null&&d.trim()!=="")}),o=e.map(r),n=t.map(r),i=FT(n,o),s=[],l=0,c=0;for(let u of i)if(u.added)for(let d=0;dc.type===s.type&&JSON.stringify(c.attributes)===JSON.stringify(s.attributes)))return!0;return!1}function ktt(e,t,r,o){let n=e[r]||[],i=t[o]||[],s=0,l=0,c=0;for(let d of n){let f=i.find(m=>m.type===d.type);f?JSON.stringify(d.attributes)!==JSON.stringify(f.attributes)&&c++:s++}for(let d of i)n.find(m=>m.type===d.type)||l++;if(s>0&&l===0&&c===0)return{type:"added",description:(0,Oa.sprintf)((0,Oa._n)("%d format added","%d formats added",s),s)};if(l>0&&s===0&&c===0)return{type:"removed",description:(0,Oa.sprintf)((0,Oa._n)("%d format removed","%d formats removed",l),l)};let u=[];return s>0&&u.push((0,Oa.sprintf)((0,Oa._n)("%d format added","%d formats added",s),s)),l>0&&u.push((0,Oa.sprintf)((0,Oa._n)("%d format removed","%d formats removed",l),l)),c>0&&u.push((0,Oa.sprintf)((0,Oa._n)("%d format changed","%d formats changed",c),c)),{type:"changed",description:u.join(", ")||(0,Oa.__)("Formatting changed")}}function Rtt(e,t){let r=e.toPlainText(),o=t.toPlainText(),n=Q_(o,r),i=(0,Dn.create)({text:""}),s=0,l=0;for(let c of n)if(c.removed){let u=(0,Dn.slice)(t,l,l+c.value.length),d=(0,Dn.applyFormat)(u,{type:"revision/diff-removed",attributes:{"aria-describedby":nc.removed}},0,c.value.length);i=(0,Dn.concat)(i,d),l+=c.value.length}else if(c.added){let u=(0,Dn.slice)(e,s,s+c.value.length),d=(0,Dn.applyFormat)(u,{type:"revision/diff-added",attributes:{"aria-describedby":nc.added}},0,c.value.length);i=(0,Dn.concat)(i,d),s+=c.value.length}else{let u=e.formats||[],d=t.formats||[],f=c.value.length,m=v=>Ptt(u,d,s+v,l+v),h=0,g=m(0);for(let v=1;v<=f;v++){let b=v0&&(r.changedAttributes=n)}function pwe(e,t){if(t.__revisionDiffStatus){if(t.__revisionDiffStatus.status==="modified"&&t.__previousRawBlock){let r=dwe(t.__previousRawBlock);r&&Att(e,r,t.__revisionDiffStatus)}e.__revisionDiffStatus=t.__revisionDiffStatus,e.attributes.__revisionDiffStatus=t.__revisionDiffStatus}if(e.innerBlocks&&t.innerBlocks)for(let r=0;r{let s=dwe(i);return s&&pwe(s,i),s}).filter(Boolean)}function MG(e,t){if(!t?.length||!e?.length)return e;let r=e.map(c=>c.name),o=t.map(c=>c.name),n=FT(o,r),i=0,s=0,l=[];for(let c of n)if(c.removed)s+=c.count;else if(c.added)for(let u=0;u{let{isRevisionsMode:c,isShowingRevisionDiff:u,getCurrentRevision:d,getPreviousRevision:f}=q(l(I)),{getCurrentPostType:m}=l(I),h=c();return{isInRevisionsMode:h,showDiff:u(),revision:h?d():void 0,previousRevision:h?f():void 0,postType:m()}},[]),i=(0,a3.useRef)([]);return(0,a3.useMemo)(()=>{if(!e)return i.current=[],null;if(!r)return[];let l=r?.content?.raw??"",c;if(t){let d=o?.content?.raw||"";c=mwe(l,d)}else c=(0,l3.parse)(l);n==="wp_navigation"&&(c=[(0,l3.createBlock)("core/navigation",{templateLock:!1},c)]);let u=MG(c,i.current);return i.current=u,u},[e,r,r?.content?.raw,o?.content?.raw,n,t])}var ni=a(Y(),1),At=a(j(),1);var $_=a(FG(),1),VG=a(Lt(),1),Twe=a(It(),1),VT=a(be(),1),eS=a(le(),1);var c3=a(Nt(),1);var DT=a(Y(),1),bwe=a(Nl(),1),ywe=a(le(),1);var wwe=a(T(),1),{RenamePatternModal:Itt}=q(bwe.privateApis),DG="editor/pattern-rename";function _we(){let e=(0,DT.useSelect)(n=>n(je).isModalActive(DG)),{record:t,postType:r}=(0,DT.useSelect)(n=>{if(!e)return{};let{getCurrentPostType:i,getCurrentPostId:s}=n(I),{getEditedEntityRecord:l}=n(ywe.store),c=i();return{record:l("postType",c,s()),postType:c}},[e]),{closeModal:o}=(0,DT.useDispatch)(je);return!e||r!==Nu?null:(0,wwe.jsx)(Itt,{onClose:o,pattern:t})}var LT=a(Y(),1),Swe=a(Nl(),1),xwe=a(le(),1);var Cwe=a(T(),1),{DuplicatePatternModal:Ott}=q(Swe.privateApis),LG="editor/pattern-duplicate";function Ewe(){let e=(0,LT.useSelect)(n=>n(je).isModalActive(LG)),{record:t,postType:r}=(0,LT.useSelect)(n=>{if(!e)return{};let{getCurrentPostType:i,getCurrentPostId:s}=n(I),{getEditedEntityRecord:l}=n(xwe.store),c=i();return{record:l("postType",c,s()),postType:c}},[e]),{closeModal:o}=(0,LT.useDispatch)(je);return!e||r!==Nu?null:(0,Cwe.jsx)(Ott,{onClose:o,onSuccess:()=>o(),pattern:t})}function Pwe({disableContentOnlyForPatternsAndTemplateParts:e,stopEditingContentOnlySection:t,updateEditorSettings:r}){return{name:"core/toggle-pattern-editing",label:e?(0,At.__)("Disable editing all patterns"):(0,At.__)("Enable editing all patterns"),icon:m0,category:"command",callback:({close:o})=>{let n=!e;t(),r({disableContentOnlyForUnsyncedPatterns:n,disableContentOnlyForTemplateParts:n}),o()}}}function Ntt(e,t){return!!t?.metadata?.patternName||e==="core/template-part"}var Mtt=()=>function(){let{editorMode:t,isListViewOpen:r,showBlockBreadcrumbs:o,isDistractionFree:n,isFocusMode:i,isPreviewMode:s,isViewable:l,isCodeEditingEnabled:c,isRichEditingEnabled:u,isPublishSidebarEnabled:d,disableContentOnlyForUnsyncedPatterns:f,disableContentOnlyForTemplateParts:m}=(0,ni.useSelect)(F=>{let{get:D}=F(VG.store),{isListViewOpened:z,getCurrentPostType:L,getEditorSettings:O}=F(I),{getSettings:B}=F(VT.store),{getPostType:W}=F(eS.store);return{editorMode:D("core","editorMode")??"visual",isListViewOpen:z(),showBlockBreadcrumbs:D("core","showBlockBreadcrumbs"),isDistractionFree:D("core","distractionFree"),isFocusMode:D("core","focusMode"),isPreviewMode:B().isPreviewMode,isViewable:W(L())?.viewable??!1,isCodeEditingEnabled:O().codeEditingEnabled,isRichEditingEnabled:O().richEditingEnabled,isPublishSidebarEnabled:F(I).isPublishSidebarEnabled(),disableContentOnlyForUnsyncedPatterns:!!O().disableContentOnlyForUnsyncedPatterns,disableContentOnlyForTemplateParts:!!O().disableContentOnlyForTemplateParts}},[]),{getActiveComplementaryArea:h}=(0,ni.useSelect)(je),{toggle:g}=(0,ni.useDispatch)(VG.store),{createInfoNotice:v}=(0,ni.useDispatch)(Twe.store),{__unstableSaveForPreview:b,setIsListViewOpened:_,switchEditorMode:y,toggleDistractionFree:w,toggleSpotlightMode:S,toggleTopToolbar:x,updateEditorSettings:C}=(0,ni.useDispatch)(I),{stopEditingContentOnlySection:A}=q((0,ni.useDispatch)(VT.store)),{openModal:P,enableComplementaryArea:R,disableComplementaryArea:N}=(0,ni.useDispatch)(je),{getCurrentPostId:k}=(0,ni.useSelect)(I),E=c&&u;if(s)return{commands:[],isLoading:!1};let M=[],V=f&&m;return M.push({name:"core/open-shortcut-help",label:(0,At.__)("Keyboard shortcuts"),icon:p1,category:"view",callback:({close:F})=>{F(),P("editor/keyboard-shortcut-help")}}),M.push({name:"core/toggle-distraction-free",label:n?(0,At.__)("Exit Distraction free"):(0,At.__)("Enter Distraction free"),category:"command",callback:({close:F})=>{w(),F()}}),M.push({name:"core/open-preferences",label:(0,At.__)("Editor preferences"),category:"view",callback:({close:F})=>{F(),P("editor/preferences")}}),M.push({name:"core/toggle-spotlight-mode",label:i?(0,At.__)("Exit Spotlight mode"):(0,At.__)("Enter Spotlight mode"),category:"command",callback:({close:F})=>{S(),F()}}),M.push({name:"core/toggle-list-view",label:r?(0,At.__)("Close List View"):(0,At.__)("Open List View"),icon:m1,category:"command",callback:({close:F})=>{_(!r),F(),v(r?(0,At.__)("List View off."):(0,At.__)("List View on."),{id:"core/editor/toggle-list-view/notice",type:"snackbar"})}}),M.push({name:"core/toggle-top-toolbar",label:(0,At.__)("Top toolbar"),category:"command",callback:({close:F})=>{x(),F()}}),M.push(Pwe({disableContentOnlyForPatternsAndTemplateParts:V,stopEditingContentOnlySection:A,updateEditorSettings:C})),E&&M.push({name:"core/toggle-code-editor",label:t==="visual"?(0,At.__)("Open code editor"):(0,At.__)("Exit code editor"),icon:TV,category:"command",callback:({close:F})=>{y(t==="visual"?"text":"visual"),F()}}),M.push({name:"core/toggle-breadcrumbs",label:o?(0,At.__)("Hide block breadcrumbs"):(0,At.__)("Show block breadcrumbs"),category:"command",callback:({close:F})=>{g("core","showBlockBreadcrumbs"),F(),v(o?(0,At.__)("Breadcrumbs hidden."):(0,At.__)("Breadcrumbs visible."),{id:"core/editor/toggle-breadcrumbs/notice",type:"snackbar"})}}),M.push({name:"core/open-settings-sidebar",label:(0,At.__)("Show or hide the Settings panel"),icon:(0,At.isRTL)()?dv:wf,category:"command",callback:({close:F})=>{let D=h("core");F(),D==="edit-post/document"?N("core"):R("core","edit-post/document")}}),M.push({name:"core/open-block-inspector",label:(0,At.__)("Show or hide the Block settings panel"),icon:sV,category:"command",callback:({close:F})=>{let D=h("core");F(),D==="edit-post/block"?N("core"):R("core","edit-post/block")}}),M.push({name:"core/toggle-publish-sidebar",label:d?(0,At.__)("Disable pre-publish checks"):(0,At.__)("Enable pre-publish checks"),icon:l1,category:"command",callback:({close:F})=>{F(),g("core","isPublishSidebarEnabled"),v(d?(0,At.__)("Pre-publish checks disabled."):(0,At.__)("Pre-publish checks enabled."),{id:"core/editor/publish-sidebar/notice",type:"snackbar"})}}),l&&M.push({name:"core/preview-link",label:(0,At.__)("Preview in a new tab"),icon:gs,category:"view",callback:async({close:F})=>{F();let D=k(),z=await b();window.open(z,`wp-preview-${D}`)}}),{commands:M,isLoading:!1}},Ftt=()=>function({search:t}){let{disableContentOnlyForPatternsAndTemplateParts:r,hasPatternOrTemplatePartSelection:o,isPreviewMode:n}=(0,ni.useSelect)(l=>{let{getBlockAttributes:c,getBlockName:u,getBlockParents:d,getSelectedBlockClientId:f,getSelectedBlockClientIds:m,getSettings:h}=l(VT.store),{getEditorSettings:g}=l(I),v=g(),b=f(),_=m(),y=b&&_.length===1?[b,...d(b,!0)]:[];return{disableContentOnlyForPatternsAndTemplateParts:!!v.disableContentOnlyForUnsyncedPatterns&&!!v.disableContentOnlyForTemplateParts,hasPatternOrTemplatePartSelection:y.some(w=>Ntt(u(w),c(w))),isPreviewMode:h().isPreviewMode}},[]),{updateEditorSettings:i}=(0,ni.useDispatch)(I),{stopEditingContentOnlySection:s}=q((0,ni.useDispatch)(VT.store));return t||!o&&!r||n?{isLoading:!1,commands:[]}:{isLoading:!1,commands:[Pwe({disableContentOnlyForPatternsAndTemplateParts:r,stopEditingContentOnlySection:s,updateEditorSettings:i})]}},Dtt=()=>function(){let{postType:t}=(0,ni.useSelect)(n=>{let{getCurrentPostType:i}=n(I);return{postType:i()}},[]),{openModal:r}=(0,ni.useDispatch)(je),o=[];return t===Nu&&(o.push({name:"core/rename-pattern",label:(0,At.__)("Rename pattern"),icon:y1,category:"edit",callback:({close:n})=>{r(DG),n()}}),o.push({name:"core/duplicate-pattern",label:(0,At.__)("Duplicate pattern"),icon:m0,category:"command",callback:({close:n})=>{r(LG),n()}})),{isLoading:!1,commands:o}},Ltt=()=>function(){let{onNavigateToEntityRecord:t,goBack:r,templateId:o,isPreviewMode:n,canEditTemplate:i}=(0,ni.useSelect)(u=>{let{getRenderingMode:d,getEditorSettings:f,getCurrentTemplateId:m}=q(u(I)),h=f(),g=m();return{isTemplateHidden:d()==="post-only",onNavigateToEntityRecord:h.onNavigateToEntityRecord,getEditorSettings:f,goBack:h.onNavigateToPreviousEntityRecord,templateId:g,isPreviewMode:h.isPreviewMode,canEditTemplate:!!g&&u(eS.store).canUser("update",{kind:"postType",name:"wp_template",id:g})}},[]),{editedRecord:s,hasResolved:l}=(0,eS.useEntityRecord)("postType","wp_template",o);if(n)return{isLoading:!1,commands:[]};let c=[];return o&&l&&i&&c.push({name:"core/switch-to-template-focus",label:(0,At.sprintf)((0,At.__)("Edit template: %s"),(0,c3.decodeEntities)(s.title)),icon:Ka,category:"edit",callback:({close:u})=>{t({postId:o,postType:"wp_template"}),u()}}),r&&c.push({name:"core/switch-to-previous-entity",label:(0,At.__)("Go back"),icon:mm,category:"view",callback:({close:u})=>{r(),u()}}),{isLoading:!1,commands:c}},Vtt=()=>function(){let{postType:t,postId:r}=(0,ni.useSelect)(l=>{let{getCurrentPostId:c,getCurrentPostType:u}=l(I);return{postType:u(),postId:c()}},[]),{editedRecord:o,hasResolved:n}=(0,eS.useEntityRecord)("postType",t,r),{revertTemplate:i}=q((0,ni.useDispatch)(I));if(!n||![Mi,Cr].includes(t))return{isLoading:!0,commands:[]};let s=[];if(F2(o)){let l=o.type===Cr?(0,At.sprintf)((0,At.__)("Reset template: %s"),(0,c3.decodeEntities)(o.title)):(0,At.sprintf)((0,At.__)("Reset template part: %s"),(0,c3.decodeEntities)(o.title));s.push({name:"core/reset-template",label:l,icon:(0,At.isRTL)()?S1:_1,category:"command",callback:({close:c})=>{i(o),c()}})}return{isLoading:!n,commands:s}};function kwe(){(0,$_.useCommandLoader)({name:"core/editor/edit-ui",hook:Mtt()}),(0,$_.useCommandLoader)({name:"core/editor/contextual-commands",hook:Dtt(),context:"entity-edit"}),(0,$_.useCommandLoader)({name:"core/editor/pattern-editing-contextual-commands",hook:Ftt(),context:"block-selection-edit"}),(0,$_.useCommandLoader)({name:"core/editor/page-content-focus",hook:Ltt(),context:"entity-edit"}),(0,$_.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:Vtt()})}var d3=a(Y(),1),Awe=a(U(),1),Iwe=a(u3(),1);var tS="upload-in-progress";function Owe(){let e=(0,d3.useSelect)(i=>i(Iwe.store).isUploading(),[]),{lockPostSaving:t,unlockPostSaving:r,lockPostAutosaving:o,unlockPostAutosaving:n}=(0,d3.useDispatch)(I);(0,Awe.useEffect)(()=>(e?(t(tS),o(tS)):(r(tS),n(tS)),()=>{r(tS),n(tS)}),[e,t,r,o,n])}var Nwe=a(U(),1),Mwe=a(Y(),1),BG=a(u3(),1);function Fwe(){let e=window.__clientSideMediaProcessing,t=(0,Mwe.useRegistry)();(0,Nwe.useEffect)(()=>{if(!e)return;let r=()=>{q(t.dispatch(BG.store)).pauseQueue()},o=()=>{q(t.dispatch(BG.store)).resumeQueue()};return window.addEventListener("offline",r),window.addEventListener("online",o),()=>{window.removeEventListener("offline",r),window.removeEventListener("online",o)}},[e,t])}var fy=a(j(),1),Dwe=a(be(),1),Lwe=a(Y(),1),Vwe=a(U(),1);var Bwe=a(T(),1),{BlockRemovalWarningModal:Btt}=q(Dwe.privateApis),jtt=["core/post-content","core/post-template","core/query"],ztt=[{postTypes:["wp_template","wp_template_part"],callback(e){if(e.filter(({name:o})=>o==="core/post-content").length)return{description:(0,fy.__)("This block displays the content of posts and pages using this template."),warning:(0,fy.__)("If you delete it, posts or pages using this template will not display any content."),subtext:(0,fy.__)("Visitors will see blank pages."),requireConfirmation:!0};if(e.filter(({name:o})=>jtt.includes(o)).length)return(0,fy._n)("Deleting this block will stop your post or page content from displaying on this template. It is not recommended.","Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.",e.length)}},{postTypes:["wp_block"],callback(e){if(e.filter(({attributes:r})=>r?.metadata?.bindings&&Object.values(r.metadata.bindings).some(o=>o.source==="core/pattern-overrides")).length)return(0,fy._n)("The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?","Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?",e.length)}}];function jwe(){let e=(0,Lwe.useSelect)(r=>r(I).getCurrentPostType(),[]),t=(0,Vwe.useMemo)(()=>ztt.filter(r=>r.postTypes.includes(e)),[e]);return t?(0,Bwe.jsx)(Btt,{rules:t}):null}var dg=a(G(),1),jG=a(j(),1),py=a(U(),1),f3=a(be(),1),zd=a(Y(),1),zG=a(le(),1),zwe=a(Pt(),1),HG=a(Lt(),1);var jd=a(T(),1);function Htt(){let{blockPatternsWithPostContentBlockType:e,postType:t}=(0,zd.useSelect)(r=>{let{getPatternsByBlockTypes:o,getBlocksByName:n}=r(f3.store),{getCurrentPostType:i,getRenderingMode:s}=r(I),l=s()==="post-only"?"":n("core/post-content")?.[0];return{blockPatternsWithPostContentBlockType:o("core/post-content",l),postType:i()}},[]);return(0,py.useMemo)(()=>e?.length?e.filter(r=>t==="page"&&!r.postTypes||Array.isArray(r.postTypes)&&r.postTypes.includes(t)):[],[t,e])}function Utt({blockPatterns:e,onChoosePattern:t}){let{editEntityRecord:r}=(0,zd.useDispatch)(zG.store),{postType:o,postId:n}=(0,zd.useSelect)(i=>{let{getCurrentPostType:s,getCurrentPostId:l}=i(I);return{postType:s(),postId:l()}},[]);return(0,jd.jsx)(f3.__experimentalBlockPatternsList,{blockPatterns:e,onClickPattern:(i,s)=>{r("postType",o,n,{blocks:s,content:({blocks:l=[]})=>(0,zwe.__unstableSerializeAndClean)(l)}),t()}})}function Wtt({onClose:e}){let[t,r]=(0,py.useState)(!0),{set:o}=(0,zd.useDispatch)(HG.store),n=Htt();if(!(n.length>0))return null;function s(){e(),o("core","enableChoosePatternModal",t)}return(0,jd.jsxs)(dg.Modal,{className:"editor-start-page-options__modal",title:(0,jG.__)("Choose a pattern"),isFullScreen:!0,onRequestClose:s,children:[(0,jd.jsx)("div",{className:"editor-start-page-options__modal-content",children:(0,jd.jsx)(Utt,{blockPatterns:n,onChoosePattern:s})}),(0,jd.jsx)(dg.Flex,{className:"editor-start-page-options__modal__actions",justify:"flex-start",expanded:!1,children:(0,jd.jsx)(dg.FlexItem,{children:(0,jd.jsx)(dg.CheckboxControl,{checked:t,label:(0,jG.__)("Always show starter patterns for new pages"),onChange:l=>{r(l)}})})})]})}function Hwe(){let[e,t]=(0,py.useState)(!1),{isEditedPostEmpty:r}=(0,zd.useSelect)(I),{getEntityRecordNonTransientEdits:o}=(0,zd.useSelect)(zG.store),{isModalActive:n}=(0,zd.useSelect)(je),{enabled:i,postType:s,postId:l}=(0,zd.useSelect)(c=>{let{getCurrentPostId:u,getCurrentPostType:d}=c(I),f=c(HG.store).get("core","enableChoosePatternModal"),m=d();return{postType:m,postId:u(),enabled:f&&Pl!==m&&Cr!==m&&Mi!==m}},[]);return(0,py.useEffect)(()=>{let u=!(Object.keys(o("postType",s,l)??{}).length>0)&&r(),d=n("editor/preferences");!i||!u||d||t(!0)},[i,s,l,o,r,n]),e?(0,jd.jsx)(Wtt,{onClose:()=>t(!1)}):null}var Qwe=a(G(),1),Hd=a(j(),1),g3=a(xa(),1),BT=a(Y(),1);var ic=a(j(),1),Uwe=[{keyCombination:{modifier:"primary",character:"b"},description:(0,ic.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,ic.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,ic.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,ic.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,ic.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,ic.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,ic.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,ic.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},aliases:[{modifier:"access",character:"7"}],description:(0,ic.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,ic.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")},{keyCombination:{modifier:"primaryShift",character:"SPACE"},description:(0,ic.__)("Add non breaking space.")}];var Gwe=a(U(),1),p3=a(Mo(),1),sc=a(T(),1);function Wwe({keyCombination:e,forceAriaLabel:t}){let r=e.modifier?p3.displayShortcutList[e.modifier](e.character):e.character,o=e.modifier?p3.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,sc.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||o,children:(Array.isArray(r)?r:[r]).map((n,i)=>n==="+"?(0,sc.jsx)(Gwe.Fragment,{children:n},i):(0,sc.jsx)("kbd",{className:"editor-keyboard-shortcut-help-modal__shortcut-key",children:n},i))})}function Gtt({description:e,keyCombination:t,aliases:r=[],ariaLabel:o}){return(0,sc.jsxs)(sc.Fragment,{children:[(0,sc.jsx)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-description",children:e}),(0,sc.jsxs)("div",{className:"editor-keyboard-shortcut-help-modal__shortcut-term",children:[(0,sc.jsx)(Wwe,{keyCombination:t,forceAriaLabel:o}),r.map((n,i)=>(0,sc.jsx)(Wwe,{keyCombination:n,forceAriaLabel:o},i))]})]})}var m3=Gtt;var Ywe=a(Y(),1),qwe=a(xa(),1);var Kwe=a(T(),1);function Ytt({name:e}){let{keyCombination:t,description:r,aliases:o}=(0,Ywe.useSelect)(n=>{let{getShortcutKeyCombination:i,getShortcutDescription:s,getShortcutAliases:l}=n(qwe.store);return{keyCombination:i(e),aliases:l(e),description:s(e)}},[e]);return t?(0,Kwe.jsx)(m3,{keyCombination:t,description:r,aliases:o}):null}var Zwe=Ytt;var Ci=a(T(),1),Xwe="editor/keyboard-shortcut-help",qtt=({shortcuts:e})=>(0,Ci.jsx)("ul",{className:"editor-keyboard-shortcut-help-modal__shortcut-list",role:"list",children:e.map((t,r)=>(0,Ci.jsx)("li",{className:"editor-keyboard-shortcut-help-modal__shortcut",children:typeof t=="string"?(0,Ci.jsx)(Zwe,{name:t}):(0,Ci.jsx)(m3,{...t})},r))}),UG=({title:e,shortcuts:t,className:r})=>(0,Ci.jsxs)("section",{className:J("editor-keyboard-shortcut-help-modal__section",r),children:[!!e&&(0,Ci.jsx)("h2",{className:"editor-keyboard-shortcut-help-modal__section-title",children:e}),(0,Ci.jsx)(qtt,{shortcuts:t})]}),h3=({title:e,categoryName:t,additionalShortcuts:r=[]})=>{let o=(0,BT.useSelect)(n=>n(g3.store).getCategoryShortcuts(t),[t]);return(0,Ci.jsx)(UG,{title:e,shortcuts:o.concat(r)})};function Ktt(){let e=(0,BT.useSelect)(n=>n(je).isModalActive(Xwe),[]),{openModal:t,closeModal:r}=(0,BT.useDispatch)(je),o=()=>{e?r():t(Xwe)};return(0,g3.useShortcut)("core/editor/keyboard-shortcuts",o),e?(0,Ci.jsxs)(Qwe.Modal,{className:"editor-keyboard-shortcut-help-modal",title:(0,Hd.__)("Keyboard shortcuts"),closeButtonLabel:(0,Hd.__)("Close"),onRequestClose:o,children:[(0,Ci.jsx)(UG,{className:"editor-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/editor/keyboard-shortcuts"]}),(0,Ci.jsx)(h3,{title:(0,Hd.__)("Global shortcuts"),categoryName:"global"}),(0,Ci.jsx)(h3,{title:(0,Hd.__)("Selection shortcuts"),categoryName:"selection"}),(0,Ci.jsx)(h3,{title:(0,Hd.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,Hd.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,Hd.__)("Forward-slash")}]}),(0,Ci.jsx)(UG,{title:(0,Hd.__)("Text formatting"),shortcuts:Uwe}),(0,Ci.jsx)(h3,{title:(0,Hd.__)("List View shortcuts"),categoryName:"list-view"})]}):null}var Jwe=Ktt;var fg=a(G(),1),jT=a(j(),1),rS=a(U(),1),$we=a(be(),1),zT=a(Y(),1),WG=a(Pt(),1),my=a(le(),1);var Ud=a(T(),1);function Ztt(e,t=!1){return(0,zT.useSelect)(r=>{let{getEntityRecord:o,getDefaultTemplateId:n}=r(my.store),i=n({slug:e,is_custom:t,ignore_empty:!0});return i?o("postType",Cr,i)?.content?.raw:void 0},[e,t])}function Xtt(e){let{slug:t,patterns:r}=(0,zT.useSelect)(i=>{let{getCurrentPostType:s,getCurrentPostId:l}=i(I),{getEntityRecord:c,getBlockPatterns:u}=i(my.store),d=l(),f=s();return{slug:c("postType",f,d).slug,patterns:u()}},[]),o=(0,zT.useSelect)(i=>i(my.store).getCurrentTheme().stylesheet);function n(i){return i.innerBlocks.find(s=>s.name==="core/template-part")&&(i.innerBlocks=i.innerBlocks.map(s=>(s.name==="core/template-part"&&s.attributes.theme===void 0&&(s.attributes.theme=o),s))),i.name==="core/template-part"&&i.attributes.theme===void 0&&(i.attributes.theme=o),i}return(0,rS.useMemo)(()=>[{name:"fallback",blocks:(0,WG.parse)(e),title:(0,jT.__)("Fallback content")},...r.filter(i=>Array.isArray(i.templateTypes)&&i.templateTypes.some(s=>t.startsWith(s))).map(i=>({...i,blocks:(0,WG.parse)(i.content).map(s=>n(s))}))],[e,t,r])}function Qtt({fallbackContent:e,onChoosePattern:t,postType:r}){let[,,o]=(0,my.useEntityBlockEditor)("postType",r),n=Xtt(e);return(0,Ud.jsx)($we.__experimentalBlockPatternsList,{blockPatterns:n,onClickPattern:(i,s)=>{o(s,{selection:void 0}),t()}})}function Jtt({slug:e,isCustom:t,onClose:r,postType:o}){let n=Ztt(e,t);return n?(0,Ud.jsxs)(fg.Modal,{className:"editor-start-template-options__modal",title:(0,jT.__)("Choose a pattern"),closeLabel:(0,jT.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:r,isFullScreen:!0,children:[(0,Ud.jsx)("div",{className:"editor-start-template-options__modal-content",children:(0,Ud.jsx)(Qtt,{fallbackContent:n,slug:e,isCustom:t,postType:o,onChoosePattern:()=>{r()}})}),(0,Ud.jsx)(fg.Flex,{className:"editor-start-template-options__modal__actions",justify:"flex-end",expanded:!1,children:(0,Ud.jsx)(fg.FlexItem,{children:(0,Ud.jsx)(fg.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:r,children:(0,jT.__)("Skip")})})})]}):null}function e_e(){let[e,t]=(0,rS.useState)(!1),{shouldOpenModal:r,slug:o,isCustom:n,postType:i,postId:s}=(0,zT.useSelect)(l=>{let{getCurrentPostType:c,getCurrentPostId:u}=l(I),d=c(),f=u(),{getEditedEntityRecord:m,getEntityRecordNonTransientEdits:h}=l(my.store),g=m("postType",d,f);return{shouldOpenModal:!(Object.keys(h("postType",d,f)??{}).length>0)&&g.content===""&&Cr===d,slug:g.slug,isCustom:g.is_custom,postType:d,postId:f}},[]);return(0,rS.useEffect)(()=>{t(!1)},[i,s]),!r||e?null:(0,Ud.jsx)(Jtt,{slug:o,isCustom:n,postType:i,onClose:()=>t(!0)})}var pg=a(xa(),1),mg=a(Y(),1);var v3=a(be(),1);var{usesNativeUndo:t_e}=q(v3.privateApis);function oS(){let e=(0,mg.useSelect)(b=>{let{richEditingEnabled:_,codeEditingEnabled:y}=b(I).getEditorSettings();return!_||!y},[]),{getBlockSelectionStart:t}=(0,mg.useSelect)(v3.store),{getActiveComplementaryArea:r}=(0,mg.useSelect)(je),{enableComplementaryArea:o,disableComplementaryArea:n}=(0,mg.useDispatch)(je),{redo:i,undo:s,savePost:l,setIsListViewOpened:c,switchEditorMode:u,toggleDistractionFree:d}=(0,mg.useDispatch)(I),{isEditedPostDirty:f,isPostSavingLocked:m,isListViewOpened:h,getEditorMode:g,isSavingNonPostEntityChanges:v}=(0,mg.useSelect)(I);return(0,pg.useShortcut)("core/editor/toggle-mode",()=>{u(g()==="visual"?"text":"visual")},{isDisabled:e}),(0,pg.useShortcut)("core/editor/toggle-distraction-free",()=>{d()}),(0,pg.useShortcut)("core/editor/undo",b=>{t_e(b)||(s(),b.preventDefault())}),(0,pg.useShortcut)("core/editor/redo",b=>{t_e(b)||(i(),b.preventDefault())}),(0,pg.useShortcut)("core/editor/save",b=>{b.preventDefault(),!(m()||v())&&f()&&l()}),(0,pg.useShortcut)("core/editor/toggle-list-view",b=>{h()||(b.preventDefault(),c(!0))}),(0,pg.useShortcut)("core/editor/toggle-sidebar",b=>{if(b.preventDefault(),["edit-post/document","edit-post/block"].includes(r("core")))n("core");else{let y=t()?"edit-post/block":"edit-post/document";o("core",y)}}),null}var f_e=a(Y(),1),w3=a(be(),1);var HT=a(Y(),1),b3=a(be(),1),r_e=a(le(),1),y3=a(G(),1),Wd=a(j(),1),o_e=a(Nt(),1),n_e=a(U(),1),hy=a(T(),1);function i_e({clientId:e,onClose:t}){let[r,o]=(0,n_e.useState)(!1),{getBlocks:n}=(0,HT.useSelect)(b3.store),{replaceBlocks:i}=(0,HT.useDispatch)(b3.store),{canRemove:s,templatePartTitle:l}=(0,HT.useSelect)(d=>{let{canRemoveBlock:f,getBlock:m}=d(b3.store),{getEntityRecord:h,getCurrentTheme:g}=d(r_e.store),v=m(e),{slug:b,theme:_}=v?.attributes??{},y=_||g()?.stylesheet,w=y&&b?`${y}//${b}`:null,S=w?h("postType","wp_template_part",w):null;return{canRemove:f(e),templatePartTitle:S?.title?.rendered?(0,o_e.decodeEntities)(S.title.rendered):null}},[e]);if(!s)return null;let c=l?(0,Wd.sprintf)((0,Wd.__)("Detach %s?"),l):(0,Wd.__)("Detach template part?"),u=l?(0,Wd.sprintf)((0,Wd.__)("The blocks will be separated from the original template part and will be fully editable. Future changes to the %s template part will not apply here."),l):(0,Wd.__)("The blocks will be separated from the original template part and will be fully editable. Future changes to the template part will not apply here.");return(0,hy.jsxs)(hy.Fragment,{children:[(0,hy.jsx)(y3.MenuItem,{onClick:()=>o(!0),children:(0,Wd.__)("Detach")}),(0,hy.jsx)(y3.__experimentalConfirmDialog,{isOpen:r,onConfirm:()=>{i(e,n(e)),t()},onCancel:()=>o(!1),confirmButtonText:(0,Wd.__)("Detach"),size:"medium",title:c,__experimentalHideHeader:!1,children:u})]})}var UT=a(Y(),1),GG=a(be(),1),s_e=a(G(),1),a_e=a(Pt(),1),YG=a(j(),1),l_e=a(U(),1),c_e=a(It(),1);var u_e=a(le(),1);var gy=a(T(),1);function d_e({clientIds:e,blocks:t}){let[r,o]=(0,l_e.useState)(!1),{replaceBlocks:n}=(0,UT.useDispatch)(GG.store),{createSuccessNotice:i}=(0,UT.useDispatch)(c_e.store),{isBlockBasedTheme:s,canCreate:l}=(0,UT.useSelect)(u=>({isBlockBasedTheme:u(u_e.store).getCurrentTheme()?.is_block_theme,canCreate:u(GG.store).canInsertBlockType("core/template-part")}),[]);if(!s||!l)return null;let c=async u=>{n(e,(0,a_e.createBlock)("core/template-part",{slug:u.slug,theme:u.theme})),i((0,YG.__)("Template part created."),{type:"snackbar"})};return(0,gy.jsxs)(gy.Fragment,{children:[(0,gy.jsx)(s_e.MenuItem,{icon:hv,onClick:()=>{o(!0)},"aria-expanded":r,"aria-haspopup":"dialog",children:(0,YG.__)("Create template part")}),r&&(0,gy.jsx)(Tw,{closeModal:()=>{o(!1)},blocks:t,onCreate:c})]})}var WT=a(T(),1);function p_e(){return(0,WT.jsx)(w3.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>(0,WT.jsx)($tt,{clientIds:e,onClose:t})})}function $tt({clientIds:e,onClose:t}){let{blocks:r}=(0,f_e.useSelect)(o=>{let{getBlocksByClientId:n}=o(w3.store);return{blocks:n(e)}},[e]);return r.length===1&&r[0]?.name==="core/template-part"?(0,WT.jsx)(i_e,{clientId:e[0],onClose:t}):(0,WT.jsx)(d_e,{clientIds:e,blocks:r})}var h_e=a(be(),1),g_e=a(Y(),1),v_e=a(U(),1);var m_e=a(U(),1),_3=a(Y(),1);function ert({postType:e}){let{registerPostTypeSchema:t}=q((0,_3.useDispatch)(I));(0,m_e.useEffect)(()=>{t(e)},[t,e]);let{fields:r}=(0,_3.useSelect)(o=>{let{getEntityFields:n}=q(o(I));return{fields:n("postType",e)}},[e]);return r}var nS=ert;var qG=a(T(),1),{MediaEditorModal:trt,store:rrt}=q(S_);function ort(e){if(e==null)return NaN;let[t,r,...o]=String(e).split("/").map(Number);return t<=0||r<=0||Number.isNaN(t)||Number.isNaN(r)||o.length?NaN:r?t/r:t}function nrt({name:e,ratio:t}={}){let r=ort(t);return!e||!Number.isFinite(r)||r<=0?null:{label:e,value:r}}function b_e(){return(0,g_e.useSelect)(t=>t(rrt).isOpen(),[])?(0,qG.jsx)(irt,{}):null}function irt(){let e=nS({postType:"attachment"}),[t,r,o]=(0,h_e.useSettings)("dimensions.aspectRatios.default","dimensions.aspectRatios.theme","dimensions.defaultAspectRatios"),n=(0,v_e.useMemo)(()=>{if(!(Array.isArray(t)||Array.isArray(r)||typeof o=="boolean"))return;let l=[...o&&Array.isArray(t)?t:[],...Array.isArray(r)?r:[]].map(nrt).filter(Boolean);if(l.length||o===!1)return l},[t,r,o]);return(0,qG.jsx)(trt,{fields:e,aspectRatioPresets:n})}var Yo=a(T(),1),{ExperimentalBlockEditorProvider:srt}=q(iS.privateApis),{PatternsMenuItems:art}=q(w_e.privateApis),GT=()=>{},lrt=["wp_block","wp_navigation","wp_template_part"];function crt(e,t,r){let o=gwe(),n=r==="template-locked"?"template":"post",[i,s,l]=(0,Ip.useEntityBlockEditor)("postType",e.type,{id:e.id}),[c,u,d]=(0,Ip.useEntityBlockEditor)("postType",t?.type,{id:t?.id}),f=(0,gl.useMemo)(()=>{if(e.type==="wp_navigation")return[(0,__e.createBlock)("core/navigation",{ref:e.id,templateLock:!1})]},[e.type,e.id]),m=(0,gl.useMemo)(()=>f||(n==="template"?c:i),[f,n,c,i]);return o!==null?[o,GT,GT]:!!t&&r==="template-locked"||e.type==="wp_navigation"?[m,GT,GT]:[m,n==="post"?s:u,n==="post"?l:d]}var ZG=xae(({post:e,settings:t,recovery:r,initialEdits:o,children:n,BlockEditorProviderComponent:i=srt,__unstableTemplate:s})=>{let l=!!s,{editorSettings:c,selection:u,isReady:d,mode:f,defaultMode:m,postTypeEntities:h,isInRevisionsMode:g,currentRevisionId:v}=(0,hg.useSelect)(W=>{let{getEditorSettings:K,getRenderingMode:Z,__unstableIsEditorReady:Q,getDefaultRenderingMode:ue,isRevisionsMode:te,getCurrentRevisionId:de}=q(W(I)),{getEntitiesConfig:pe,getEntityRecordEdits:$}=W(Ip.store),oe=Z(),fe=ue(e.type),ve=fe==="template-locked"?l:fe!==void 0,Oe=fe!==void 0,ee=$("postType",e.type,e.id);return{editorSettings:K(),isReady:Q(),mode:Oe?oe:void 0,defaultMode:ve?fe:void 0,selection:ee?.selection,postTypeEntities:e.type==="wp_template"?pe("postType"):null,isInRevisionsMode:te(),currentRevisionId:de()}},[e.type,e.id,l]),b=l&&f!=="post-only",_=b?s:e,y=(0,gl.useMemo)(()=>{let W={};if(e.type==="wp_template"){if(e.slug==="page")W.postType="page";else if(e.slug==="single")W.postType="post";else if(e.slug.split("-")[0]==="single"){let K=h?.map(Q=>Q.name)||[],Z=e.slug.match(`^single-(${K.join("|")})(?:-.+)?$`);Z&&(W.postType=Z[1])}}else(!lrt.includes(_.type)||b)&&(W.postId=e.id,W.postType=e.type);return{...W,templateSlug:_.type==="wp_template"?_.slug:void 0}},[b,e.id,e.type,e.slug,_.type,_.slug,h]),{id:w,type:S}=_,x=G0e(c,S,w,f),[C,A,P]=crt(e,s,f),{updatePostLock:R,setupEditor:N,updateEditorSettings:k,setCurrentTemplateId:E,setEditedPost:M,setRenderingMode:V,setCurrentRevisionId:F}=q((0,hg.useDispatch)(I)),{editEntityRecord:D}=(0,hg.useDispatch)(Ip.store),z=(0,hg.useRegistry)(),L=(0,gl.useCallback)(W=>{D("postType",e.type,e.id,{selection:W},{undoIgnore:!0})},[D,e.type,e.id]),{createWarningNotice:O,removeNotice:B}=(0,hg.useDispatch)(y_e.store);return(0,gl.useLayoutEffect)(()=>{if(!r&&(R(t.postLock),z.select(I).__unstableIsEditorReady()||N(e,o,t.template),t.autosave)){let W=Number((0,S_e.getQueryArg)(t.autosave.editLink,"revision"));O((0,KG.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:(0,KG.__)("View the autosave"),...W?{onClick:()=>{let{disableVisualRevisions:K}=z.select(I).getEditorSettings();if(K){window.location.href=t.autosave.editLink;return}F(W)}}:{url:t.autosave.editLink}}]})}},[]),(0,gl.useEffect)(()=>(M(e.type,e.id),typeof window<"u"&&window.__experimentalTemplateActivate&&B("template-activate-notice"),()=>M(null,null)),[e.type,e.id,M,B]),(0,gl.useLayoutEffect)(()=>{k(t)},[t,k]),(0,gl.useEffect)(()=>{E(s?.id)},[s?.id,E]),(0,gl.useEffect)(()=>{m&&V(m)},[m,V]),$0e(e.type,f),kwe(),Owe(),Fwe(),!d||!f?null:(0,Yo.jsx)(Ip.EntityProvider,{kind:"root",type:"site",children:(0,Yo.jsx)(Ip.EntityProvider,{kind:"postType",type:e.type,id:e.id,revisionId:v??void 0,children:(0,Yo.jsx)(iS.BlockContextProvider,{value:y,children:(0,Yo.jsxs)(i,{value:C,onChange:P,onInput:A,selection:g?void 0:u,onChangeSelection:g?GT:L,settings:x,useSubRegistry:!1,children:[n,!t.isPreviewMode&&(0,Yo.jsxs)(Yo.Fragment,{children:[(0,Yo.jsx)(art,{}),(0,Yo.jsx)(p_e,{}),f==="template-locked"&&(0,Yo.jsx)(K0e,{}),S==="wp_navigation"&&(0,Yo.jsx)(X0e,{}),(0,Yo.jsx)(oS,{}),(0,Yo.jsx)(Jwe,{}),(0,Yo.jsx)(jwe,{}),(0,Yo.jsx)(Hwe,{}),(0,Yo.jsx)(e_e,{}),(0,Yo.jsx)(_we,{}),(0,Yo.jsx)(Ewe,{}),(0,Yo.jsx)(b_e,{})]})]})})})})});function XG(e){return(0,Yo.jsx)(ZG,{...e,BlockEditorProviderComponent:iS.BlockEditorProvider,children:e.children})}var x_e=XG;var gg=a(T(),1);function urt({template:e,post:t}){let[r="white"]=cg("color.background"),[o]=(0,YT.useEntityBlockEditor)("postType",t.type,{id:t.id}),[n]=(0,YT.useEntityBlockEditor)("postType",e?.type,{id:e?.id}),i=e&&n?n:o,s=!i?.length;return(0,gg.jsxs)("div",{className:"editor-fields-content-preview",style:{backgroundColor:r},children:[s&&(0,gg.jsx)("span",{className:"editor-fields-content-preview__empty",children:(0,C_e.__)("Empty content")}),!s&&(0,gg.jsx)(QG.BlockPreview.Async,{children:(0,gg.jsx)(QG.BlockPreview,{blocks:i})})]})}function T_e({item:e}){let{settings:t,template:r}=(0,E_e.useSelect)(o=>{let{canUser:n,getPostType:i,getTemplateId:s,getEntityRecord:l}=q(o(YT.store)),c=n("read",{kind:"postType",name:"wp_template"}),u=o(I).getEditorSettings(),d=u.supportsTemplateMode,f=i(e.type)?.viewable??!1,m=d&&f&&c?s(e.type,e.id):null;return{settings:u,template:m?l("postType","wp_template",m):void 0}},[e.type,e.id]);return(0,gg.jsx)(XG,{post:e,settings:t,__unstableTemplate:r,children:(0,gg.jsx)(urt,{template:r,post:e})})}var drt={type:"media",id:"content-preview",label:(0,P_e.__)("Content preview"),render:T_e,enableSorting:!1},k_e=drt;function frt(e){let t=e?.editor;return Array.isArray(t)?!!t[0]?.notes:!1}function prt(e,t,r){return{type:"REGISTER_ENTITY_ACTION",kind:e,name:t,config:r}}function mrt(e,t,r){return{type:"UNREGISTER_ENTITY_ACTION",kind:e,name:t,actionId:r}}function hrt(e,t,r){return{type:"REGISTER_ENTITY_FIELD",kind:e,name:t,config:r}}function grt(e,t,r){return{type:"UNREGISTER_ENTITY_FIELD",kind:e,name:t,fieldId:r}}function vrt(e,t){return{type:"SET_IS_READY",kind:e,name:t}}var brt=[MH,OH,LH,jH,VH,BH,IH,U2,kH,NH,DH],yrt=e=>async({registry:t})=>{if(q(t.select(I)).isEntityReady("postType",e))return;q(t.dispatch(I)).setIsReady("postType",e);let o=await t.resolveSelect(S3.store).getPostType(e),n=await t.resolveSelect(S3.store).canUser("create",{kind:"postType",name:e}),i=await t.resolveSelect(S3.store).getCurrentTheme(),{disablePostFormats:s}=t.select(I).getEditorSettings(),l=!["wp_block","wp_template_part"].includes(o.slug)&&n&&lH;o.slug!=="wp_template"&&(l=void 0),o.slug==="wp_template"&&!window?.__experimentalTemplateActivate&&(l=void 0);let c=[o.viewable?oH:void 0,o.supports?.revisions?vH:void 0,l,o.slug==="wp_template_part"&&n&&i?.is_block_theme?PH:void 0,n&&o.slug==="wp_block"?fH:void 0,o.supports?.title?uH:void 0,o.supports?.["page-attributes"]?iH:void 0,o.slug==="wp_block"?gH:void 0,wH,dH,EH,SH,yH].filter(Boolean),u;if(e===Pl)u=brt;else{let d=o.slug,f=pm.includes(d),m=d==="wp_block";if(u=[o.supports?.thumbnail&&i?.theme_supports?.["post-thumbnails"]&&bz,!f&&o.supports?.author&&eE,d==="wp_template"&&Bz,d==="wp_template_part"&&jz,!f&&Rz,!f&&Mz,!f&&Fz,Dz,!f&&Y8,!f&&o.supports?.excerpt&&Wz,m&&o.supports?.excerpt&&kj,o.supports?.["page-attributes"]&&Pz,o.supports?.comments&&Az,o.supports?.trackbacks&&Oz,(o.supports?.comments||o.supports?.trackbacks)&&Nz,!f&&xz,o.supports?.["post-formats"]&&!s&&Kz,(!f||m)&&o.supports?.editor&&Zz,!f&&kz,d==="post"&&Qz,d==="wp_template"&&qz,d==="wp_template"&&Yz,d==="wp_template"&&rH,d==="wp_template"&&$z,d==="wp_template"&&eH,o.supports?.editor&&o.viewable&&k_e,frt(o.supports)&&zz,m&&Rj].filter(Boolean),o.supports?.title){let h;e==="page"?h=Q8:e==="wp_template"?h=q1:["wp_block","wp_template_part"].includes(e)?h=RC:h=U2,u.push(h)}}t.batch(()=>{c.forEach(d=>{q(t.dispatch(I)).registerEntityAction("postType",e,d)}),u.forEach(d=>{q(t.dispatch(I)).registerEntityField("postType",e,d)})}),(0,R_e.doAction)("core.registerPostTypeSchema",e)};function wrt(e){return{type:"SET_CURRENT_TEMPLATE_ID",id:e}}var _rt=e=>async({select:t,dispatch:r,registry:o})=>{let n=await o.dispatch(sn.store).saveEntityRecord("postType","wp_template",e);return o.dispatch(sn.store).editEntityRecord("postType",t.getCurrentPostType(),t.getCurrentPostId(),{template:n.slug}),o.dispatch(ii.store).createSuccessNotice((0,zt.__)("Custom template created. You're in template mode now."),{type:"snackbar",actions:[{label:(0,zt.__)("Go back"),onClick:()=>r.setRenderingMode(t.getEditorSettings().defaultRenderingMode)}]}),n},Srt=e=>({registry:t})=>{let o=(t.select(vy.store).get("core","hiddenBlockTypes")??[]).filter(n=>!(Array.isArray(e)?e:[e]).includes(n));t.dispatch(vy.store).set("core","hiddenBlockTypes",o)},xrt=e=>({registry:t})=>{let r=t.select(vy.store).get("core","hiddenBlockTypes")??[],o=new Set([...r,...Array.isArray(e)?e:[e]]);t.dispatch(vy.store).set("core","hiddenBlockTypes",[...o])},Crt=({onSave:e,dirtyEntityRecords:t=[],entitiesToSkip:r=[],close:o,successNoticeContent:n}={})=>({registry:i})=>{let s=[{kind:"postType",name:"wp_navigation"}],l="site-editor-save-success",c=i.select(sn.store).getEntityRecord("root","__unstableBase")?.home;i.dispatch(ii.store).removeNotice(l);let u=t.filter(({kind:h,name:g,key:v,property:b})=>!r.some(_=>_.kind===h&&_.name===g&&_.key===v&&_.property===b));o?.(u);let d=[],f=[];return u.forEach(({kind:h,name:g,key:v,property:b})=>{h==="root"&&g==="site"?d.push(b):(s.some(_=>_.kind===h&&_.name===g)&&i.dispatch(sn.store).editEntityRecord(h,g,v,{status:"publish"}),f.push(i.dispatch(sn.store).saveEditedEntityRecord(h,g,v,{throwOnError:!0}).catch(m)))}),d.length&&f.push(i.dispatch(sn.store).__experimentalSaveSpecifiedEntityEdits("root","site",void 0,d,{throwOnError:!0}).catch(m)),i.dispatch(x3.store).__unstableMarkLastChangeAsPersistent(),Promise.all(f).then(async h=>(e&&await e(),h)).then(h=>{let g=h.filter(v=>v instanceof Error);if(g.length){let v=g.find(b=>b.message)?.message;i.dispatch(ii.store).createErrorNotice((0,qT.decodeEntities)(v||(0,zt.__)("Saving failed.")),{type:"snackbar",id:l})}else i.dispatch(ii.store).createSuccessNotice(n||(0,zt.__)("Site updated."),{type:"snackbar",id:l,actions:[{label:(0,zt.__)("View site"),url:c,openInNewTab:!0}]})}).catch(h=>i.dispatch(ii.store).createErrorNotice((0,qT.decodeEntities)(h?.message||(0,zt.__)("Saving failed.")),{type:"snackbar",id:l}));function m(h){if(h instanceof Error)return h;let g;if(h){if(typeof h.message=="string")g=h.message;else if(typeof h=="string")g=h;else if(Object.hasOwn(h,"toString")&&typeof h.toString=="function"){let v=h.toString();typeof v=="string"&&(g=v)}}return new Error(g,{cause:h})}},Ert=(e,{allowUndo:t=!0}={})=>async({registry:r})=>{let o="edit-site-template-reverted";if(r.dispatch(ii.store).removeNotice(o),!F2(e)){r.dispatch(ii.store).createErrorNotice((0,zt.__)("This template is not revertable."),{type:"snackbar"});return}try{let n=r.select(sn.store).getEntityConfig("postType",e.type);if(!n){r.dispatch(ii.store).createErrorNotice((0,zt.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});return}let i=(0,$G.addQueryArgs)(`${n.baseURL}/${e.id}`,{context:"edit",source:e.origin}),s=await(0,eY.default)({path:i});if(!s){r.dispatch(ii.store).createErrorNotice((0,zt.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});return}let l=({blocks:d=[]})=>(0,C3.__unstableSerializeAndClean)(d),c=r.select(sn.store).getEditedEntityRecord("postType",e.type,e.id);r.dispatch(sn.store).editEntityRecord("postType",e.type,e.id,{content:l,blocks:c.blocks,source:"custom"},{undoIgnore:!0});let u=(0,C3.parse)(s?.content?.raw);if(r.dispatch(sn.store).editEntityRecord("postType",e.type,s.id,{content:l,blocks:u,source:"theme"}),t){let d=()=>{r.dispatch(sn.store).editEntityRecord("postType",e.type,c.id,{content:l,blocks:c.blocks,source:"custom"})};r.dispatch(ii.store).createSuccessNotice((0,zt.__)("Template reset."),{type:"snackbar",id:o,actions:[{label:(0,zt.__)("Undo"),onClick:d}]})}}catch(n){let i=n.message&&n.code!=="unknown_error"?n.message:(0,zt.__)("Template revert failed. Please reload.");r.dispatch(ii.store).createErrorNotice(i,{type:"snackbar"})}},Trt=e=>async({registry:t})=>{let r=e.every(n=>n?.has_theme_file),o=await Promise.allSettled(e.map(n=>t.dispatch(sn.store).deleteEntityRecord("postType",n.type,n.id,{force:!0},{throwOnError:!0})));if(o.every(({status:n})=>n==="fulfilled")){let n;if(e.length===1){let i;typeof e[0].title=="string"?i=e[0].title:typeof e[0].title?.rendered=="string"?i=e[0].title?.rendered:typeof e[0].title?.raw=="string"&&(i=e[0].title?.raw),n=r?(0,zt.sprintf)((0,zt.__)('"%s" reset.'),(0,qT.decodeEntities)(i)):(0,zt.sprintf)((0,zt._x)('"%s" deleted.',"template part"),(0,qT.decodeEntities)(i))}else n=r?(0,zt.__)("Items reset."):(0,zt.__)("Items deleted.");t.dispatch(ii.store).createSuccessNotice(n,{type:"snackbar",id:"editor-template-deleted-success"})}else{let n;if(o.length===1)o[0].reason?.message?n=o[0].reason.message:n=r?(0,zt.__)("An error occurred while reverting the item."):(0,zt.__)("An error occurred while deleting the item.");else{let i=new Set,s=o.filter(({status:l})=>l==="rejected");for(let l of s)l.reason?.message&&i.add(l.reason.message);i.size===0?n=(0,zt.__)("An error occurred while deleting the items."):i.size===1?n=r?(0,zt.sprintf)((0,zt.__)("An error occurred while reverting the items: %s"),[...i][0]):(0,zt.sprintf)((0,zt.__)("An error occurred while deleting the items: %s"),[...i][0]):n=r?(0,zt.sprintf)((0,zt.__)("Some errors occurred while reverting the items: %s"),[...i].join(",")):(0,zt.sprintf)((0,zt.__)("Some errors occurred while deleting the items: %s"),[...i].join(","))}t.dispatch(ii.store).createErrorNotice(n,{type:"snackbar"})}},Prt=e=>({select:t,registry:r})=>{let o=t.getCurrentPostType(),n=r.select(sn.store).getCurrentTheme()?.stylesheet,i=r.select(vy.store).get("core","renderingModes")?.[n]??{};if(i[o]===e)return;let s={[n]:{...i,[o]:e}};r.dispatch(vy.store).set("core","renderingModes",s)};function krt(e){return{type:"SET_STYLES_PATH",path:e}}function Rrt(e){return{type:"SET_SHOW_STYLEBOOK",show:e}}function Art(){return{type:"RESET_STYLES_NAVIGATION"}}function tY(e){return({dispatch:t,registry:r})=>{t({type:"SET_CANVAS_WIDTH",width:e});let o=q(r.select(x3.store));if(o.isResponsiveEditing()){let n=o.getSettings().__experimentalFeatures?.viewport,i=A2(e,n);q(r.dispatch(x3.store)).setStyleStateViewport(R2[i]??"default")}}}function Irt(e){return{type:"SET_CURRENT_REVISION_ID",revisionId:e}}var Ort=e=>async({dispatch:t,select:r,registry:o})=>{let n=r.getCurrentPostType(),i=r.getCurrentPostId(),l=o.select(sn.store).getEntityConfig("postType",n)?.revisionKey||"id",c=await o.resolveSelect(sn.store).getRevisions("postType",n,i,_v(l,e));o.batch(()=>{t({type:"SET_REVISION_PAGE",page:e}),c?.length&&t.setCurrentRevisionId(c[0][l])})};function JG(e){e.dispatch(ii.store).createNotice("warning",(0,zt.__)("Revisions could not be loaded."),{type:"snackbar",id:"editor-revisions-load-failed"})}var Nrt=e=>async({dispatch:t,select:r,registry:o})=>{t.setCurrentRevisionId(e);let n=r.getCurrentPostType(),i=r.getCurrentPostId(),s=o.select(sn.store).getEntityConfig("postType",n),l=s?.revisionKey||"id",c=await o.resolveSelect(sn.store).getRevisions("postType",n,i,{per_page:-1,context:"edit",orderby:"date",order:"desc",_fields:l});if(r.getCurrentRevisionId()!==e)return;if(!c){JG(o);return}let u=c.findIndex(f=>f[l]===e);if(u===-1){let f;try{f=await(0,eY.default)({path:(0,$G.addQueryArgs)(s.getRevisionsUrl(i,e),{context:"edit"})})}catch(m){if(r.getCurrentRevisionId()!==e)return;if(m?.data?.status!==404){JG(o);return}t.setCurrentRevisionId(null),o.dispatch(ii.store).createNotice("warning",(0,zt.__)("Invalid revision ID."),{type:"snackbar",id:"editor-revision-invalid"});return}if(r.getCurrentRevisionId()!==e)return;if(!f){JG(o);return}await o.dispatch(sn.store).receiveRevisions("postType",n,i,f,{context:"edit"});return}let d=Math.floor(u/r.getRevisionsPerPage())+1;d!==r.getRevisionPage()&&t({type:"SET_REVISION_PAGE",page:d})};function Mrt(e){return{type:"SET_SHOW_REVISION_DIFF",showDiff:e}}var Frt=e=>async({select:t,dispatch:r,registry:o})=>{let n=t.getCurrentPostType(),i=t.getCurrentPostId(),l=o.select(sn.store).getEntityConfig("postType",n)?.revisionKey||"id",c=await o.resolveSelect(sn.store).getRevision("postType",n,i,e,{context:"edit",_fields:[...new Set(["id","date","modified","author","meta","title.raw","excerpt.raw","content.raw",l])].join()});if(!c)return;let u={blocks:void 0,content:c.content.raw};c.title?.raw!==void 0&&(u.title=c.title.raw),c.excerpt?.raw!==void 0&&(u.excerpt=c.excerpt.raw),c.meta!==void 0&&(u.meta=c.meta),r.editPost(u),r.setCurrentRevisionId(null),await r.savePost(),!t.didPostSaveRequestFail()&&(o.dispatch(ii.store).removeNotice("autosave-exists"),o.dispatch(ii.store).createSuccessNotice((0,zt.sprintf)((0,zt.__)("Restored to revision from %s."),(0,E3.dateI18n)((0,E3.getSettings)().formats.datetime,c.date)),{type:"snackbar",id:"editor-revision-restored"}))};function Drt(e,t={focus:!1}){return{type:"SELECT_NOTE",noteId:e,options:t}}var Lrt=(e,t,r)=>({dispatch:o})=>{if(o.setEditedPost(e.type,e.id),e.status==="auto-draft"&&r){let i;"content"in t?i=t.content:i=e.content.raw;let s=(0,sS.parse)(i);s=(0,sS.synchronizeBlocksWithTemplate)(s,r),o.resetEditorBlocks(s,{__unstableShouldCreateUndoLevel:!1})}t&&Object.entries(t).some(([i,s])=>s!==(e[i]?.raw??e[i]))&&o.editPost(t)};function Vrt(){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor",{since:"6.5"}),{type:"DO_NOTHING"}}function Brt(){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).resetPost",{since:"6.0",version:"6.3",alternative:"Initialize the editor with the setupEditorState action"}),{type:"DO_NOTHING"}}function jrt(){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).updatePost",{since:"5.7",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function zrt(e){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).setupEditorState",{since:"6.5",alternative:"wp.data.dispatch( 'core/editor' ).setEditedPost"}),I_e(e.type,e.id)}function I_e(e,t){return{type:"SET_EDITED_POST",postType:e,postId:t}}var Hrt=(e,t)=>({select:r,registry:o})=>{let{id:n,type:i}=r.getCurrentPost();o.dispatch(qs.store).editEntityRecord("postType",i,n,e,t)},Urt=(e={})=>async({select:t,dispatch:r,registry:o})=>{if(!t.isEditedPostSaveable())return;let n=t.getEditedPostContent();r.editPost({content:n},{undoIgnore:!0});let i=t.getCurrentPost(),s={id:i.id,...o.select(qs.store).getEntityRecordNonTransientEdits("postType",i.type,i.id),content:n};r({type:"REQUEST_POST_UPDATE_START",options:e});let l=!1;try{s=await(0,aS.applyFiltersAsync)("editor.preSavePost",s,e)}catch(c){l=c}if(!l)try{await o.dispatch(qs.store).saveEntityRecord("postType",i.type,s,e)}catch(c){l=c.message&&c.code!=="unknown_error"?c.message:(0,_n.__)("An error occurred while updating.")}if(l||(l=o.select(qs.store).getLastEntitySaveError("postType",i.type,i.id)),!l)try{await(0,aS.applyFilters)("editor.__unstableSavePost",Promise.resolve(),e)}catch(c){l=c}if(!l)try{await(0,aS.doActionAsync)("editor.savePost",{id:i.id,type:i.type},e)}catch(c){l=c}if(r({type:"REQUEST_POST_UPDATE_FINISH",options:e}),typeof window<"u"&&window.__experimentalTemplateActivate&&!e.isAutosave&&i.type==="wp_template"&&(typeof i.id=="number"||/^\d+$/.test(i.id))&&Wrt({select:t,dispatch:r,registry:o}),l){let c=WX({post:i,edits:s,error:l});c.length&&o.dispatch(nu.store).createErrorNotice(...c)}else{let c=t.getCurrentPost(),u=UX({previousPost:i,post:c,postType:await o.resolveSelect(qs.store).getPostType(c.type),options:e});u.length&&o.dispatch(nu.store).createSuccessNotice(...u),e.isAutosave||o.dispatch(Op.store).__unstableMarkLastChangeAsPersistent()}};async function Wrt({select:e,registry:t}){if(e.getEditorSettings().onNavigateToPreviousEntityRecord)return;let{id:o,slug:n}=e.getCurrentPost();if((await t.select(qs.store).getEntityRecord("root","site")).active_templates[n]===o)return;let l=(await t.resolveSelect(qs.store).getCurrentTheme())?.default_template_types.find(c=>c.slug===n);await t.dispatch(nu.store).createNotice("info",(0,_n.sprintf)((0,_n.__)('Do you want to activate this "%s" template?'),l?.title??n),{id:"template-activate-notice",actions:[{label:(0,_n.__)("Activate"),onClick:async()=>{await t.dispatch(nu.store).createNotice("info",(0,_n.__)("Activating template\u2026"),{id:"template-activate-notice"});try{let c=await t.select(qs.store).getEntityRecord("root","site");await t.dispatch(qs.store).saveEntityRecord("root","site",{active_templates:{...c.active_templates,[n]:o}},{throwOnError:!0}),await t.dispatch(nu.store).createSuccessNotice((0,_n.__)("Template activated."),{id:"template-activate-notice"})}catch(c){throw await t.dispatch(nu.store).createErrorNotice((0,_n.__)("Template activation failed."),{id:"template-activate-notice"}),c}}}]})}function Grt(){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).refreshPost",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}var Yrt=()=>async({select:e,dispatch:t,registry:r})=>{let o=e.getCurrentPostType(),n=await r.resolveSelect(qs.store).getPostType(o),{rest_base:i,rest_namespace:s="wp/v2"}=n;t({type:"REQUEST_POST_DELETE_START"});try{let l=e.getCurrentPost();await(0,A_e.default)({path:`/${s}/${i}/${l.id}`,method:"DELETE"}),await t.savePost()}catch(l){r.dispatch(nu.store).createErrorNotice(...GX({error:l}))}t({type:"REQUEST_POST_DELETE_FINISH"})},qrt=({local:e=!1,...t}={})=>async({select:r,dispatch:o})=>{let n=r.getCurrentPost();if(e){let i=r.isEditedPostNew(),s=r.getEditedPostAttribute("title"),l=r.getEditedPostAttribute("content"),c=r.getEditedPostAttribute("excerpt");HX(n.id,i,s,l,c)}else await o.savePost({isAutosave:!0,...t})},Krt=({forceIsAutosaveable:e}={})=>async({select:t,dispatch:r})=>((e||t.isEditedPostAutosaveable())&&!t.isPostLocked()&&(["draft","auto-draft"].includes(t.getEditedPostAttribute("status"))?await r.savePost({isPreview:!0}):await r.autosave({isPreview:!0})),t.getEditedPostPreviewLink()),Zrt=()=>({registry:e})=>{e.dispatch(qs.store).redo()},Xrt=()=>({registry:e})=>{e.dispatch(qs.store).undo()};function Qrt(){return(0,vg.default)("wp.data.dispatch( 'core/editor' ).createUndoLevel",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function Jrt(e){return{type:"UPDATE_POST_LOCK",lock:e}}var $rt=()=>({registry:e})=>{e.dispatch(an.store).set("core","isPublishSidebarEnabled",!0)},eot=()=>({registry:e})=>{e.dispatch(an.store).set("core","isPublishSidebarEnabled",!1)};function tot(e){return{type:"LOCK_POST_SAVING",lockName:e}}function rot(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function oot(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function not(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}var iot=(e,t={})=>({select:r,dispatch:o,registry:n})=>{let{__unstableShouldCreateUndoLevel:i,selection:s}=t,l={blocks:e,selection:s};if(i!==!1){let{id:c,type:u}=r.getCurrentPost();if(n.select(qs.store).getEditedEntityRecord("postType",u,c).blocks===l.blocks){n.dispatch(qs.store).__unstableCreateUndoLevel("postType",u,c);return}l.content=({blocks:f=[]})=>(0,sS.__unstableSerializeAndClean)(f)}o.editPost(l)};function sot(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}var aot=e=>({dispatch:t,registry:r,select:o})=>{o.__unstableIsEditorReady()&&!o.getEditorSettings().isPreviewMode&&r.dispatch(Op.store).clearSelectedBlock(),t({type:"SET_RENDERING_MODE",mode:e})};function lot(e){return({dispatch:t,registry:r})=>{let o=q(r.select(Op.store)).getSettings().__experimentalFeatures?.viewport,n=kX(e,o);t(tY(n))}}var cot=e=>({registry:t})=>{let r=t.select(an.store).get("core","inactivePanels")??[],o=!!r?.includes(e),n;o?n=r.filter(i=>i!==e):n=[...r,e],t.dispatch(an.store).set("core","inactivePanels",n)},uot=e=>({registry:t})=>{let r=t.select(an.store).get("core","openPanels")??[],o=!!r?.includes(e),n;o?n=r.filter(i=>i!==e):n=[...r,e],t.dispatch(an.store).set("core","openPanels",n)};function dot(e){return{type:"REMOVE_PANEL",panelName:e}}var fot=e=>({dispatch:t,registry:r})=>{typeof e=="object"&&e.hasOwnProperty("rootClientId")&&e.hasOwnProperty("insertionIndex")&&q(r.dispatch(Op.store)).setInsertionPoint({rootClientId:e.rootClientId,index:e.insertionIndex}),t({type:"SET_IS_INSERTER_OPENED",value:e})};function pot(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}var mot=({createNotice:e=!0}={})=>({dispatch:t,registry:r})=>{let o=r.select(an.store).get("core","distractionFree");o&&r.dispatch(an.store).set("core","fixedToolbar",!1),o||r.batch(()=>{r.dispatch(an.store).set("core","fixedToolbar",!0),t.setIsInserterOpened(!1),t.setIsListViewOpened(!1),q(r.dispatch(Op.store)).resetZoomLevel()}),r.batch(()=>{r.dispatch(an.store).set("core","distractionFree",!o),e&&r.dispatch(nu.store).createInfoNotice(o?(0,_n.__)("Distraction free mode deactivated."):(0,_n.__)("Distraction free mode activated."),{id:"core/editor/distraction-free-mode/notice",type:"snackbar",actions:[{label:(0,_n.__)("Undo"),onClick:()=>{r.batch(()=>{r.dispatch(an.store).set("core","fixedToolbar",o),r.dispatch(an.store).toggle("core","distractionFree")})}}]})})},hot=()=>({registry:e})=>{e.dispatch(an.store).toggle("core","focusMode");let t=e.select(an.store).get("core","focusMode");e.dispatch(nu.store).createInfoNotice(t?(0,_n.__)("Spotlight mode activated."):(0,_n.__)("Spotlight mode deactivated."),{id:"core/editor/toggle-spotlight-mode/notice",type:"snackbar",actions:[{label:(0,_n.__)("Undo"),onClick:()=>{e.dispatch(an.store).toggle("core","focusMode")}}]})},got=()=>({registry:e})=>{e.dispatch(an.store).toggle("core","fixedToolbar");let t=e.select(an.store).get("core","fixedToolbar");e.dispatch(nu.store).createInfoNotice(t?(0,_n.__)("Top toolbar activated."):(0,_n.__)("Top toolbar deactivated."),{id:"core/editor/toggle-top-toolbar/notice",type:"snackbar",actions:[{label:(0,_n.__)("Undo"),onClick:()=>{e.dispatch(an.store).toggle("core","fixedToolbar")}}]})},vot=e=>({dispatch:t,registry:r})=>{r.dispatch(an.store).set("core","editorMode",e),e!=="visual"&&(r.dispatch(Op.store).clearSelectedBlock(),q(r.dispatch(Op.store)).resetZoomLevel()),e==="visual"?(0,oY.speak)((0,_n.__)("Visual editor selected"),"assertive"):e==="text"&&(r.select(an.store).get("core","distractionFree")&&t.toggleDistractionFree(),(0,oY.speak)((0,_n.__)("Code editor selected"),"assertive"))};function bot(){return{type:"OPEN_PUBLISH_SIDEBAR"}}function yot(){return{type:"CLOSE_PUBLISH_SIDEBAR"}}function wot(){return{type:"TOGGLE_PUBLISH_SIDEBAR"}}var lr=e=>(...t)=>({registry:r})=>{(0,vg.default)("`wp.data.dispatch( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`",version:"6.2"}),r.dispatch(Op.store)[e](...t)},_ot=lr("resetBlocks"),Sot=lr("receiveBlocks"),xot=lr("updateBlock"),Cot=lr("updateBlockAttributes"),Eot=lr("selectBlock"),Tot=lr("startMultiSelect"),Pot=lr("stopMultiSelect"),kot=lr("multiSelect"),Rot=lr("clearSelectedBlock"),Aot=lr("toggleSelection"),Iot=lr("replaceBlocks"),Oot=lr("replaceBlock"),Not=lr("moveBlocksDown"),Mot=lr("moveBlocksUp"),Fot=lr("moveBlockToPosition"),Dot=lr("insertBlock"),Lot=lr("insertBlocks"),Vot=lr("showInsertionPoint"),Bot=lr("hideInsertionPoint"),jot=lr("setTemplateValidity"),zot=lr("synchronizeTemplate"),Hot=lr("mergeBlocks"),Uot=lr("removeBlocks"),Wot=lr("removeBlock"),Got=lr("toggleBlockMode"),Yot=lr("startTyping"),qot=lr("stopTyping"),Kot=lr("enterFormattedText"),Zot=lr("exitFormattedText"),Xot=lr("insertDefaultBlock"),Qot=lr("updateBlockListSettings");var iE={reducer:gZ,selectors:D8,actions:nY},I=(0,T3.createReduxStore)(xZ,{...iE});(0,T3.register)(I);q(I).registerPrivateActions(rY);q(I).registerPrivateSelectors(G8);var L_e=a(T(),1),Jot=e=>(0,F_e.createHigherOrderComponent)(t=>({attributes:r,setAttributes:o,...n})=>{let i=(0,O_e.useSelect)(u=>u(I).getCurrentPostType(),[]),[s,l]=(0,N_e.useEntityProp)("postType",i,"meta"),c=(0,M_e.useMemo)(()=>({...r,...Object.fromEntries(Object.entries(e).map(([u,d])=>[u,s[d]]))}),[r,s]);return(0,L_e.jsx)(t,{attributes:c,setAttributes:u=>{let d=Object.fromEntries(Object.entries(u??{}).filter(([f])=>f in e).map(([f,m])=>[e[f],m]));Object.entries(d).length&&l(d),o(u)},...n})},"withMetaAttributeSource");function $ot(e){let t=Object.fromEntries(Object.entries(e.attributes??{}).filter(([,{source:r}])=>r==="meta").map(([r,{meta:o}])=>[r,o]));return Object.entries(t).length&&(e.edit=Jot(t)(e.edit)),e}(0,D_e.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",$ot);var YPe=a(zn(),1);var V_e=a(Vu(),1),B_e=a(vo(),1);var j_e=a(Nt(),1),by=a(T(),1),ent=10,P3={name:"links",className:"editor-autocompleters__link",triggerPrefix:"[[",isDebounced:!0,async options(e){return(await(0,V_e.default)({path:(0,B_e.addQueryArgs)("/wp/v2/search",{per_page:ent,search:e,type:"post"})})).filter(r=>r.title!=="")},getOptionKeywords(e){return[...e.title.split(/\s+/)]},getOptionLabel(e){return(0,by.jsxs)(by.Fragment,{children:[(0,by.jsx)(En,{icon:e.subtype==="page"?mm:kB}),(0,j_e.decodeEntities)(e.title)]})},getOptionCompletion(e){return(0,by.jsx)("a",{href:e.url,children:e.title})}};var z_e=a(U(),1),H_e=a(Y(),1),U_e=a(le(),1),Np=a(T(),1);function iY(e){let t=e.avatar_urls&&e.avatar_urls[24]?(0,Np.jsx)("img",{className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):(0,Np.jsx)("span",{className:"editor-autocompleters__no-avatar"});return(0,Np.jsxs)(Np.Fragment,{children:[t,(0,Np.jsx)("span",{className:"editor-autocompleters__user-name",children:e.name}),(0,Np.jsx)("span",{className:"editor-autocompleters__user-slug",children:e.slug})]})}var k3={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",useItems(e){let t=(0,H_e.useSelect)(o=>{let{getUsers:n}=o(U_e.store);return n({context:"view",search:e})},[e]);return[(0,z_e.useMemo)(()=>t?t.map(o=>({key:`user-${o.slug}`,value:o,label:iY(o)})):[],[t])]},getOptionCompletion(e){return`@${e.slug}`}};var cS=a(U(),1),lS=a(Y(),1),W_e=a(le(),1);function tnt(e,t){let r=(0,cS.useRef)(e);(0,cS.useEffect)(()=>{r.current=e},[e]),(0,cS.useEffect)(()=>{if(!t)return;let o=setInterval(()=>r.current(),t*1e3);return()=>clearInterval(o)},[t])}function R3({interval:e,autosave:t}){let{autosave:r}=(0,lS.useDispatch)(I),o=t??r,{getReferenceByDistinctEdits:n}=(0,lS.useSelect)(W_e.store),{isEditedPostDirty:i,isEditedPostAutosaveable:s,isAutosavingPost:l}=(0,lS.useSelect)(I),c=(0,lS.useSelect)(d=>e!==void 0?e:d(I).getEditorSettings().autosaveInterval,[e]),u=(0,cS.useRef)();return tnt(()=>{if(!s())return;let d=n();d!==u.current&&i()&&!l()&&(u.current=d,o())},c),null}var Sg=a(j(),1),JT=a(Y(),1),au=a(G(),1),$T=a(be(),1);var kSe=a(le(),1),RSe=a(FG(),1),W3=a(U(),1),ASe=a(Ce(),1),ISe=a(Nt(),1),OSe=a(Mp(),1);var sY=a(j(),1),Y_e=a(Y(),1),q_e=a(le(),1);function A3(e){let{isFrontPage:t,isPostsPage:r}=(0,Y_e.useSelect)(o=>{let{canUser:n,getEditedEntityRecord:i}=o(q_e.store),s=n("read",{kind:"root",name:"site"})?i("root","site"):void 0,l=parseInt(e,10);return{isFrontPage:s?.page_on_front===l,isPostsPage:s?.page_for_posts===l}});return t?(0,sY.__)("Homepage"):r?(0,sY.__)("Posts Page"):!1}var _Se=a(G(),1),SSe=a(Mo(),1),H3=a(j(),1),QT=a(Y(),1);var U3=a(Ce(),1),xSe=a(Lt(),1);var ZT=a(U(),1);var wy=a(G(),1),iu=a(j(),1),Ln=a(be(),1),_y=a(Y(),1);var Wr=a(U(),1),L3=a(Mo(),1),oSe=a(Ef(),1),nSe=a(le(),1);var Ur=a(j(),1),uS=[{slug:"theme-colors",title:(0,Ur.__)("Theme Colors"),origin:"theme",type:"colors"},{slug:"theme-gradients",title:(0,Ur.__)("Theme Gradients"),origin:"theme",type:"gradients"},{slug:"custom-colors",title:(0,Ur.__)("Custom Colors"),origin:"custom",type:"colors"},{slug:"custom-gradients",title:(0,Ur.__)("Custom Gradients"),origin:"custom",type:"gradients"},{slug:"duotones",title:(0,Ur.__)("Duotones"),origin:"theme",type:"duotones"},{slug:"default-colors",title:(0,Ur.__)("Default Colors"),origin:"default",type:"colors"},{slug:"default-gradients",title:(0,Ur.__)("Default Gradients"),origin:"default",type:"gradients"}],I3=[{slug:"site-identity",title:(0,Ur.__)("Site Identity"),blocks:["core/site-logo","core/site-title","core/site-tagline"]},{slug:"design",title:(0,Ur.__)("Design"),blocks:["core/navigation","core/avatar","core/post-time-to-read"],exclude:["core/home-link","core/navigation-link"]},{slug:"posts",title:(0,Ur.__)("Posts"),blocks:["core/post-title","core/post-excerpt","core/post-author","core/post-author-name","core/post-author-biography","core/post-date","core/post-terms","core/term-description","core/query-title","core/query-no-results","core/query-pagination","core/query-numbers"]},{slug:"comments",title:(0,Ur.__)("Comments"),blocks:["core/comments-title","core/comments-pagination","core/comments-pagination-numbers","core/comments","core/comments-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/post-comments-count","core/post-comments-link"]}],aY=[{slug:"overview",title:(0,Ur.__)("Overview"),blocks:[]},{slug:"text",title:(0,Ur.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,Ur.__)("Colors"),blocks:[]},{slug:"theme",title:(0,Ur.__)("Theme"),subcategories:I3},{slug:"media",title:(0,Ur.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,Ur.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,Ur.__)("Embeds"),include:[]}],rnt=[...I3,{slug:"media",title:(0,Ur.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,Ur.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,Ur.__)("Embeds"),include:[]}],K_e=[{slug:"overview",title:(0,Ur.__)("Overview"),blocks:[]},{slug:"text",title:(0,Ur.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,Ur.__)("Colors"),blocks:[]},{slug:"blocks",title:(0,Ur.__)("All Blocks"),blocks:[],subcategories:rnt}],ont=`
.is-root-container {
display: flow-root;
}
`,Z_e=`
body {
position: relative;
padding: 32px !important;
}
${ont}
.editor-style-book__examples {
max-width: 1200px;
margin: 0 auto;
}
.editor-style-book__example {
max-width: 900px;
border-radius: 2px;
cursor: var(--wpds-cursor-control, pointer);
display: flex;
flex-direction: column;
gap: 40px;
padding: 16px;
width: 100%;
box-sizing: border-box;
scroll-margin-top: 32px;
scroll-margin-bottom: 32px;
margin: 0 auto 40px auto;
}
.editor-style-book__example.is-selected {
box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
}
.editor-style-book__example.is-disabled-example {
pointer-events: none;
}
.editor-style-book__example:focus:not(:disabled) {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
outline: 3px solid transparent;
}
.editor-style-book__duotone-example > div:first-child {
display: flex;
aspect-ratio: 16 / 9;
grid-row: span 1;
grid-column: span 2;
}
.editor-style-book__duotone-example img {
width: 100%;
height: 100%;
object-fit: cover;
}
.editor-style-book__duotone-example > div:not(:first-child) {
height: 20px;
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
}
.editor-style-book__color-example {
border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
}
.editor-style-book__subcategory-title,
.editor-style-book__example-title {
font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
font-weight: normal;
line-height: normal;
margin: 0;
text-align: left;
padding-top: 8px;
border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
color: color-mix( in srgb, currentColor 60%, transparent );
}
.editor-style-book__subcategory-title {
font-size: 16px;
margin-bottom: 40px;
padding-bottom: 8px;
}
.editor-style-book__example-preview {
width: 100%;
}
.editor-style-book__example-preview .block-editor-block-list__insertion-point,
.editor-style-book__example-preview .block-list-appender {
display: none;
}
:where(.is-root-container > .wp-block:first-child) {
margin-top: 0;
}
:where(.is-root-container > .wp-block:last-child) {
margin-bottom: 0;
}
`;var X_e=a(Pt(),1);function KT(e,t){if(!e?.slug||!t?.length)return;let r=e?.subcategories??[];if(r.length)return r.reduce((s,l)=>{let c=KT(l,t);return c&&(s.subcategories||(s.subcategories=[]),s.subcategories=[...s.subcategories,c]),s},{title:e.title,slug:e.slug});let o=e?.blocks||[],n=e?.exclude||[],i=t.filter(s=>!n.includes(s.name)&&(s.category===e.slug||o.includes(s.name)));if(i.length)return{title:e.title,slug:e.slug,examples:i}}function lY(){let e=[...I3,...aY].map(({slug:o})=>o),r=(0,X_e.getCategories)().filter(({slug:o})=>!e.includes(o));return[...aY,...r]}var Gd=a(j(),1),Ei=a(Pt(),1);var Q_e=a(G(),1),O3=a(be(),1),cY=a(T(),1),nnt=({colors:e,type:t,templateColumns:r="1fr 1fr",itemHeight:o="52px"})=>e?(0,cY.jsx)(Q_e.__experimentalGrid,{templateColumns:r,rowGap:8,columnGap:16,children:e.map(n=>{let i=t==="gradients"?(0,O3.__experimentalGetGradientClass)(n.slug):(0,O3.getColorClassName)("background-color",n.slug),s=J("editor-style-book__color-example",i);return(0,cY.jsx)("div",{className:s,style:{height:o}},n.slug)})}):null,uY=nnt;var dY=a(G(),1),yy=a(T(),1),int=({duotones:e})=>e?(0,yy.jsx)(dY.__experimentalGrid,{columns:2,rowGap:16,columnGap:16,children:e.map(t=>(0,yy.jsxs)(dY.__experimentalGrid,{className:"editor-style-book__duotone-example",columns:2,rowGap:8,columnGap:8,children:[(0,yy.jsx)("div",{children:(0,yy.jsx)("img",{alt:`Duotone example: ${t.slug}`,src:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",style:{filter:`url(#wp-duotone-${t.slug})`}})}),t.colors.map(r=>(0,yy.jsx)("div",{className:"editor-style-book__color-example",style:{backgroundColor:r}},r))]},t.slug))}):null,J_e=int;var N3=a(T(),1);function snt(e){if(!e)return[];let t=[];return uS.forEach(r=>{let o=e[r.type],n=Array.isArray(o)?o.find(i=>i.slug===r.origin):void 0;if(n?.[r.type]){let i={name:r.slug,title:r.title,category:"colors"};r.type==="duotones"?(i.content=(0,N3.jsx)(J_e,{duotones:n[r.type]}),t.push(i)):(i.content=(0,N3.jsx)(uY,{colors:n[r.type],type:r.type}),t.push(i))}}),t}function ant(e){let t=[],r=Array.isArray(e?.colors)?e.colors.find(i=>i.slug==="theme"):void 0;if(r){let i={name:"theme-colors",title:(0,Gd.__)("Colors"),category:"overview",content:(0,N3.jsx)(uY,{colors:r.colors,type:"colors",templateColumns:"repeat(auto-fill, minmax( 200px, 1fr ))",itemHeight:"32px"})};t.push(i)}let o=[];if((0,Ei.getBlockType)("core/heading")){let i=(0,Ei.createBlock)("core/heading",{content:(0,Gd.__)("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9"),level:1});o.push(i)}if((0,Ei.getBlockType)("core/paragraph")){let i=(0,Ei.createBlock)("core/paragraph",{content:(0,Gd.__)("A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.")}),s=(0,Ei.createBlock)("core/paragraph",{content:(0,Gd.__)("Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.")});if((0,Ei.getBlockType)("core/group")){let l=(0,Ei.createBlock)("core/group",{layout:{type:"grid",columnCount:2,minimumColumnWidth:"12rem"},style:{spacing:{blockGap:"1.5rem"}}},[i,s]);o.push(l)}else o.push(i)}return o.length&&t.push({name:"typography",title:(0,Gd.__)("Typography"),category:"overview",blocks:o}),["core/image","core/separator","core/buttons","core/pullquote","core/search"].forEach(i=>{let s=(0,Ei.getBlockType)(i);if(s&&s.example){let l={name:i,title:s.title,category:"overview",blocks:(0,Ei.getBlockFromExample)(i,{...s.example,attributes:{...s.example.attributes,style:void 0}})};t.push(l)}}),t}function fY(e){let t=(0,Ei.getBlockTypes)().filter(s=>{let{name:l,example:c,supports:u}=s;return l!=="core/heading"&&!!c&&u?.inserter!==!1}).map(s=>({name:s.name,title:s.title,category:s.category,blocks:(0,Ei.getBlockFromExample)(s.name,{...s.example,attributes:{...s.example?.attributes,style:void 0}})}));if(!!!(0,Ei.getBlockType)("core/heading"))return t;let o={name:"core/heading",title:(0,Gd.__)("Headings"),category:"text",blocks:[1,2,3,4,5,6].map(s=>(0,Ei.createBlock)("core/heading",{content:(0,Gd.sprintf)((0,Gd.__)("Heading %d"),s),level:s}))},n=snt(e),i=ant(e);return[o,...n,...t,...i]}var rSe=a(U(),1),F3=a(Y(),1);var M3=a(Pt(),1),$_e=a(Y(),1),eSe=a(U(),1);function dS(e={},t=!1){let o=wG("spacing.blockGap")!==null,n=!o,{disableLayoutStyles:i,getBlockStyles:s}=(0,$_e.useSelect)(l=>{let{getEditorSettings:c}=l(I),{getBlockStyles:u}=l(M3.store);return{disableLayoutStyles:!!c()?.disableLayoutStyles,getBlockStyles:u}},[]);return(0,eSe.useMemo)(()=>{if(!e?.styles||!e?.settings)return[[],{}];let l=(0,M3.getBlockTypes)();return wv(e,l,{hasBlockGapSupport:o,hasFallbackGapSupport:n,disableLayoutStyles:i,disableRootPadding:t,getBlockStyles:s})},[o,n,e,i,t,s])}function tSe(e=!1){let{merged:t}=Hr();return dS(t,e)}function lnt(e){let[t,r]=tSe(e),{getEditorSettings:o}=(0,F3.useSelect)(I),{updateEditorSettings:n}=(0,F3.useDispatch)(I);(0,rSe.useEffect)(()=>{if(!t||!r)return;let i=o(),s=Object.values(i.styles??[]).filter(l=>!l.isGlobalStyles);n({...i,styles:[...s,...t],__experimentalFeatures:r})},[t,r,n,o])}function D3({disableRootPadding:e}){return lnt(e),null}var Wt=a(T(),1),{ExperimentalBlockEditorProvider:cnt}=q(Ln.privateApis);function bg(e){return!e||Object.keys(e).length===0}var unt=(e,t)=>{if(!e||!t||!t?.contentDocument)return;let r=e==="top"?t.contentDocument.body:t.contentDocument.getElementById(e);r&&r.scrollIntoView({behavior:"smooth"})},iSe=e=>e&&typeof e=="string"&&(e==="/"||e.startsWith("/typography")||e.startsWith("/colors")||e.startsWith("/blocks"))?{top:!0}:null;function sSe(){let{colors:e,gradients:t}=(0,Ln.__experimentalUseMultipleOriginColorsAndGradients)(),[r,o,n,i]=(0,Ln.useSettings)("color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default");return(0,Wr.useMemo)(()=>{let l={colors:e,gradients:t,duotones:[]};return n&&n.length&&l.duotones.push({name:(0,iu._x)("Theme","Indicates these duotone filters come from the theme."),slug:"theme",duotones:n}),r&&i&&i.length&&l.duotones.push({name:(0,iu._x)("Default","Indicates these duotone filters come from WordPress."),slug:"default",duotones:i}),o&&o.length&&l.duotones.push({name:(0,iu._x)("Custom","Indicates these doutone filters are created by the user."),slug:"custom",duotones:o}),l},[e,t,o,n,i,r])}function aSe(e){let t=[],r=KT({slug:"overview"},e);t.push(...r.examples);let o=e.filter(n=>n.category!=="overview"&&!r.examples.find(i=>i.name===n.name));return t.push(...o),t}function dnt(e,t){return t?e.map(r=>({...r,variation:t,blocks:Array.isArray(r.blocks)?r.blocks.map(o=>({...o,attributes:{...o.attributes,style:void 0,className:`is-style-${t}`}})):{...r.blocks,attributes:{...r.blocks.attributes,style:void 0,className:`is-style-${t}`}}})):e}function fnt({isSelected:e,onClick:t,onSelect:r,showTabs:o=!0,userConfig:n={},path:i=""},s){let l=cg("color.text"),c=cg("color.background"),u=sSe(),d=(0,Wr.useMemo)(()=>fY(u),[u]),f=(0,Wr.useMemo)(()=>lY().filter(w=>d.some(S=>S.category===w.slug)),[d]),m=aSe(d),{base:h}=Hr(),g=iSe(i),v=(0,Wr.useMemo)(()=>!bg(n)&&!bg(h)?Di(h,n):{},[h,n]),b=(0,_y.useSelect)(w=>w(Ln.store).getSettings(),[]),[_]=dS(v),y=(0,Wr.useMemo)(()=>({...b,styles:!bg(_)&&!bg(n)?_:b.styles,isPreviewMode:!0}),[_,b,n]);return(0,Wt.jsx)("div",{ref:s,className:J("editor-style-book",{"is-button":!!t}),style:{color:l,background:c},children:o?(0,Wt.jsxs)(Pn.Root,{className:"editor-style-book__tabs",defaultValue:f[0]?.slug,children:[(0,Wt.jsx)("div",{className:"editor-style-book__tablist-container",children:(0,Wt.jsx)(Pn.List,{children:f.map(w=>(0,Wt.jsx)(Pn.Tab,{value:w.slug,children:w.title},w.slug))})}),f.map(w=>{let S=w.slug?lY().find(C=>C.slug===w.slug):null,x=S?KT(S,d):{examples:d};return(0,Wt.jsx)(Pn.Panel,{value:w.slug,tabIndex:-1,className:"editor-style-book__tabpanel",children:(0,Wt.jsx)(pY,{category:w.slug,examples:x,isSelected:e,onSelect:r,settings:y,title:w.title,goTo:g})},w.slug)})]}):(0,Wt.jsx)(pY,{examples:{examples:m},isSelected:e,onClick:t,onSelect:r,settings:y,goTo:g})})}var lSe=({userConfig:e={},isStatic:t=!1,path:r,onPathChange:o,settings:n})=>{let i=(0,_y.useSelect)(N=>n??N(I).getEditorSettings(),[n]),s=(0,_y.useSelect)(N=>N(nSe.store).canUser("create",{kind:"postType",name:"attachment"}),[]);(0,Wr.useEffect)(()=>{(0,_y.dispatch)(Ln.store).updateSettings({...i,mediaUpload:s?oSe.uploadMedia:void 0})},[i,s]);let[l,c]=(0,Wr.useState)("/"),u=r??l,d=o??c,f=N=>u===`/blocks/${encodeURIComponent(N)}`||u.startsWith(`/blocks/${encodeURIComponent(N)}/`),m=(N,k=!1)=>{if(uS.find(E=>E.slug===N)){d("/colors/palette");return}if(N==="typography"){d("/typography");return}k||d(`/blocks/${encodeURIComponent(N)}`)},h=sSe(),g=fY(h),v=aSe(g),b=null,_=null;if(u.includes("/colors"))b="colors";else if(u.includes("/typography"))b="text";else if(u.includes("/blocks")){b="blocks";let N=decodeURIComponent(u).split("/blocks/")[1];N?.includes("/variations")&&([N,_]=N.split("/variations/")),N&&g.find(k=>k.name===N)&&(b=N)}else t||(b="overview");let y=K_e.find(N=>N.slug===b),w=(0,Wr.useMemo)(()=>y?KT(y,g):{examples:[g.find(N=>N.name===b)]},[y,g,b]),S=(0,Wr.useMemo)(()=>b?_&&w?.examples?.length?{examples:dnt(w.examples,_)}:w:{examples:v},[b,v,_,w]),{base:x}=Hr(),C=iSe(u),A=(0,Wr.useMemo)(()=>!bg(e)&&!bg(x)?Di(x,e):{},[x,e]),[P]=dS(A),R=(0,Wr.useMemo)(()=>({...i,styles:!bg(P)&&!bg(e)?P:i.styles,isPreviewMode:!0}),[P,i,e]);return(0,Wt.jsx)("div",{className:"editor-style-book",children:(0,Wt.jsxs)(Ln.BlockEditorProvider,{settings:R,children:[(0,Wt.jsx)(D3,{disableRootPadding:!0}),(0,Wt.jsx)(pY,{examples:S,settings:R,goTo:C,isSelected:t?null:f,onSelect:t?null:m})]})})},pY=({examples:e,isSelected:t,onClick:r,onSelect:o,settings:n,title:i,goTo:s})=>{let[l,c]=(0,Wr.useState)(!1),[u,d]=(0,Wr.useState)(!1),f=(0,Wr.useRef)(null),m={role:"button",onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:g=>{if(g.defaultPrevented)return;let{keyCode:v}=g;r&&(v===L3.ENTER||v===L3.SPACE)&&(g.preventDefault(),r(g))},onClick:g=>{g.defaultPrevented||r&&(g.preventDefault(),r(g))},readonly:!0},h=()=>d(!0);return(0,Wr.useLayoutEffect)(()=>{u&&f.current&&s?.top&&unt("top",f.current)},[s?.top,u]),(0,Wt.jsxs)(Ln.__unstableIframe,{onLoad:h,ref:f,className:J("editor-style-book__iframe",{"is-focused":l&&!!r,"is-button":!!r}),name:"style-book-canvas",tabIndex:0,...r?m:{},children:[(0,Wt.jsx)(Ln.__unstableEditorStyles,{styles:n.styles}),(0,Wt.jsxs)("style",{children:[Z_e,!!r&&"body { cursor: var(--wpds-cursor-control, pointer); } body * { pointer-events: none; }"]}),(0,Wt.jsx)(pnt,{className:"editor-style-book__examples",filteredExamples:e,label:i?(0,iu.sprintf)((0,iu.__)("Examples of blocks in the %s category"),i):(0,iu.__)("Examples of blocks"),isSelected:t,onSelect:o},i)]})},pnt=(0,Wr.memo)(({className:e,filteredExamples:t,label:r,isSelected:o,onSelect:n})=>(0,Wt.jsxs)(wy.Composite,{orientation:"vertical",className:e,"aria-label":r,role:"grid",children:[!!t?.examples?.length&&t.examples.map(i=>(0,Wt.jsx)(cSe,{id:`example-${i.name}`,title:i.title,content:i.content,blocks:i.blocks,isSelected:o?.(i.name),onClick:n?()=>n(i.name,!!i.variation):null},i.name)),!!t?.subcategories?.length&&t.subcategories.map(i=>(0,Wt.jsxs)(wy.Composite.Group,{className:"editor-style-book__subcategory",children:[(0,Wt.jsx)(wy.Composite.GroupLabel,{children:(0,Wt.jsx)("h2",{className:"editor-style-book__subcategory-title",children:i.title})}),(0,Wt.jsx)(mnt,{examples:i.examples,isSelected:o,onSelect:n})]},`subcategory-${i.slug}`))]})),mnt=({examples:e,isSelected:t,onSelect:r})=>!!e?.length&&e.map(o=>(0,Wt.jsx)(cSe,{id:`example-${o.name}`,title:o.title,content:o.content,blocks:o.blocks,isSelected:t?.(o.name),onClick:r?()=>r(o.name):null},o.name)),hnt=["example-duotones"],cSe=({id:e,title:t,blocks:r,isSelected:o,onClick:n,content:i})=>{let s=(0,_y.useSelect)(d=>d(Ln.store).getSettings(),[]),l=(0,Wr.useMemo)(()=>({...s,focusMode:!1,isPreviewMode:!0}),[s]),c=(0,Wr.useMemo)(()=>Array.isArray(r)?r:[r],[r]),u=hnt.includes(e)||!n?{disabled:!0,accessibleWhenDisabled:!!n}:{};return(0,Wt.jsx)("div",{role:"row",children:(0,Wt.jsx)("div",{role:"gridcell",children:(0,Wt.jsxs)(wy.Composite.Item,{className:J("editor-style-book__example",{"is-selected":o,"is-disabled-example":!!u?.disabled}),id:e,"aria-label":n?(0,iu.sprintf)((0,iu.__)("Open %s styles in Styles panel"),t):void 0,render:(0,Wt.jsx)("div",{}),role:n?"button":null,onClick:n,...u,children:[(0,Wt.jsx)("span",{className:"editor-style-book__example-title",children:t}),(0,Wt.jsx)("div",{className:"editor-style-book__example-preview","aria-hidden":!0,children:(0,Wt.jsx)(wy.Disabled,{className:"editor-style-book__example-preview__content",children:i||(0,Wt.jsxs)(cnt,{value:c,settings:l,children:[(0,Wt.jsx)(Ln.__unstableEditorStyles,{}),(0,Wt.jsx)(Ln.BlockList,{renderAppender:!1})]})})})]})})})},uSe=(0,Wr.forwardRef)(fnt);var XT=a(T(),1);function dSe({path:e,onPathChange:t,userConfig:r,forwardedRef:o}){return(0,XT.jsx)(uSe,{ref:o,path:e,userConfig:r,isSelected:n=>e===`/blocks/${encodeURIComponent(n)}`||e?.startsWith(`/blocks/${encodeURIComponent(n)}/`),onSelect:n=>{if(uS.find(i=>i.slug===n)){t?.("/colors/palette");return}if(n==="typography"){t?.("/typography");return}t?.("/blocks/"+encodeURIComponent(n))}})}function gnt({path:e,onPathChange:t,forwardedRef:r}){let{user:o}=Hr(),{revisions:n,isLoading:i}=ny(),s=(0,ZT.useMemo)(()=>{let c=e?.match(/^\/revisions\/(.+)$/);return c?c[1]:null},[e]),l=(0,ZT.useMemo)(()=>!s||!n.length?null:n.find(c=>String(c.id)===String(s)),[s,n]);return i?null:(0,XT.jsx)(dSe,{forwardedRef:r,path:e,onPathChange:t,userConfig:l||o})}function vnt({path:e,onPathChange:t},r){return e?.startsWith("/revisions")?(0,XT.jsx)(gnt,{forwardedRef:r,path:e,onPathChange:t}):(0,XT.jsx)(dSe,{forwardedRef:r,path:e,onPathChange:t})}var fSe=(0,ZT.forwardRef)(vnt);var pSe=a(G(),1),su=a(be(),1),mY=a(Y(),1),yg=a(U(),1);var Fp=a(T(),1),{ExperimentalBlockEditorProvider:bnt,BlockStyleVariationOverridesWithConfig:ynt}=q(su.privateApis);function V3(e){return!e||Object.keys(e).length===0}function wnt({path:e},t){let r=(0,mY.useSelect)(b=>b(su.store).getBlocks(),[]),{user:o,base:n}=Hr(),{revisions:i,isLoading:s}=ny(),l=(0,yg.useMemo)(()=>{let b=e?.match(/^\/revisions\/(.+)$/);return b?b[1]:null},[e]),u=(0,yg.useMemo)(()=>!l||!i.length?null:i.find(b=>String(b.id)===String(l)),[l,i])||o,d=(0,yg.useMemo)(()=>!V3(u)&&!V3(n)?Di(n,u):{},[n,u]),f=(0,yg.useMemo)(()=>Array.isArray(r)?r:[r],[r]),m=(0,mY.useSelect)(b=>b(su.store).getSettings(),[]),h=(0,yg.useMemo)(()=>({...m,isPreviewMode:!0}),[m]),[g]=dS(d),v=!V3(g)&&!V3(u)?g:h.styles;return s?null:(0,Fp.jsxs)(su.__unstableIframe,{ref:t,className:"editor-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,Fp.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,Fp.jsx)(pSe.Disabled,{className:"editor-revisions__example-preview__content",children:(0,Fp.jsxs)(bnt,{value:f,settings:h,children:[(0,Fp.jsx)(su.BlockList,{renderAppender:!1}),(0,Fp.jsx)(su.__unstableEditorStyles,{styles:v}),(0,Fp.jsx)(ynt,{config:d})]})})]})}var mSe=(0,yg.forwardRef)(wnt);var ySe=a(Y(),1),Sy=a(U(),1),z3=a(G(),1),wSe=a(Ce(),1);var B3=a(j(),1),wg=a(Mo(),1),gSe=a(G(),1);var Yd=a(T(),1),hSe=20;function hY({direction:e,resizeWidthBy:t}){function r(i){let{keyCode:s}=i;s!==wg.LEFT&&s!==wg.RIGHT||(i.preventDefault(),e==="left"&&s===wg.LEFT||e==="right"&&s===wg.RIGHT?t(hSe):(e==="left"&&s===wg.RIGHT||e==="right"&&s===wg.LEFT)&&t(-hSe))}let o={active:{opacity:1,scaleY:1.3}},n=`resizable-editor__resize-help-${e}`;return(0,Yd.jsxs)(Yd.Fragment,{children:[(0,Yd.jsxs)(Ze.Root,{children:[(0,Yd.jsx)(Ze.Trigger,{render:(0,Yd.jsx)(gSe.__unstableMotion.button,{className:`editor-resizable-editor__resize-handle is-${e}`,"aria-label":(0,B3.__)("Drag to resize"),"aria-describedby":n,onKeyDown:r,variants:o,whileFocus:"active",whileHover:"active",whileTap:"active",role:"separator","aria-orientation":"vertical"},"handle")}),(0,Yd.jsx)(Ze.Popup,{children:(0,B3.__)("Drag to resize")})]}),(0,Yd.jsx)(Yt,{id:n,children:(0,B3.__)("Use left and right arrow keys to resize the canvas.")})]})}var j3=a(T(),1),vSe={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};function bSe(e,t,r=0){return t>0&&e>=t-r}function _nt({className:e,enableResizing:t,width:r="100%",height:o="100%",children:n}){let[i,s]=(0,Sy.useState)(!1),l=(0,wSe.useReducedMotion)(),{setCanvasWidth:c}=q((0,ySe.useDispatch)(I)),u=(0,Sy.useRef)(),d=(0,Sy.useCallback)(m=>{if(u.current){let h=bSe(u.current.offsetWidth+m,u.current.parentElement?.offsetWidth??0,80);c(h?void 0:u.current.offsetWidth+m)}},[c]),f=(0,Sy.useCallback)((m,h)=>{let g=m.offsetWidth,v=m.parentElement?.offsetWidth??0;c(h&&bSe(g,v,80)?void 0:g)},[c]);return(0,j3.jsx)(z3.ResizableBox,{as:z3.__unstableMotion.div,initial:!1,animate:{height:o},transition:{type:"tween",duration:i||l?0:.2,ease:"easeOut"},className:J("editor-resizable-editor",e,{"is-resizable":t,"is-resizing":i}),ref:m=>{u.current=m?.resizable},size:{width:r,height:o},onResizeStart:()=>{s(!0)},onResize:(m,h,g)=>{f(g)},onResizeStop:(m,h,g)=>{f(g,!0),s(!1)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{left:t,right:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,j3.jsx)(hY,{direction:"left",resizeWidthBy:d}),right:(0,j3.jsx)(hY,{direction:"right",resizeWidthBy:d})},handleClasses:void 0,handleStyles:{left:vSe,right:vSe},children:n})}var fS=_nt;var _g=a(T(),1);function gY(e,t){return t?(0,H3.__)("Style Book"):e?.startsWith("/revisions")?(0,H3.__)("Style Revisions"):""}function CSe(){let{stylesPath:e,showStylebook:t,showListViewByDefault:r}=(0,QT.useSelect)(m=>{let{getStylesPath:h,getShowStylebook:g}=q(m(I)),v=m(xSe.store).get("core","showListViewByDefault");return{stylesPath:h(),showStylebook:g(),showListViewByDefault:v}},[]),{resetStylesNavigation:o,setStylesPath:n}=q((0,QT.useDispatch)(I)),{setIsListViewOpened:i}=(0,QT.useDispatch)(I),s=(0,U3.useFocusOnMount)("firstElement"),l=(0,U3.useFocusReturn)(),c=null;t?c=(0,_g.jsx)(fSe,{path:e,onPathChange:n,ref:l}):e?.startsWith("/revisions")&&(c=(0,_g.jsx)(mSe,{path:e,ref:l}));let u=gY(e,t),d=()=>{i(r),o()};return(0,_g.jsx)("div",{className:"editor-styles-canvas",children:(0,_g.jsx)(fS,{enableResizing:!1,children:(0,_g.jsxs)("section",{className:"editor-styles-canvas__section",ref:s,onKeyDown:m=>{m.keyCode===SSe.ESCAPE&&!m.defaultPrevented&&(m.preventDefault(),d())},"aria-label":u,children:[(0,_g.jsx)(_Se.Button,{size:"compact",className:"editor-styles-canvas__close-button",icon:Fi,label:(0,H3.__)("Close"),onClick:d}),c]})})})}var ESe=a(Y(),1),vY=a(Nt(),1),bY=a(be(),1),TSe=a(le(),1);function PSe(){return(0,ESe.useSelect)(e=>{let{getBlockAttributes:t,getBlockName:r,__experimentalGetParsedPattern:o}=e(bY.store),{getEditedEntityRecord:n,getCurrentTheme:i}=e(TSe.store),{getEditedContentOnlySection:s}=q(e(bY.store)),l=s();if(!l)return null;let c=t(l),u=c?.metadata?.patternName;if(u){let f=typeof o=="function"?o(u):null;return{patternName:u,patternTitle:f?.title||c?.metadata?.name,type:"pattern"}}let d=r(l);if(d==="core/block"&&c?.ref){let f=n("postType","wp_block",c.ref);if(f?.title)return{patternName:c.ref,patternTitle:(0,vY.decodeEntities)(f.title),type:"synced-pattern"}}if(d==="core/template-part"&&c?.slug){let f=c.theme||i()?.stylesheet,m=f?`${f}//${c.slug}`:null;if(m){let h=n("postType","wp_template_part",m);if(h?.title)return{patternName:c.slug,patternTitle:(0,vY.decodeEntities)(h.title),type:"template-part"}}}return null},[])}var Ks=a(T(),1),Snt=au.__unstableMotion.create(au.Button);function G3(e){let{stopEditingContentOnlySection:t}=q((0,JT.useDispatch)($T.store)),r=PSe(),{postId:o,postType:n,postTypeLabel:i,documentTitle:s,isNotFound:l,templateTitle:c,onNavigateToPreviousEntityRecord:u,isTemplatePreview:d,stylesCanvasTitle:f}=(0,JT.useSelect)(C=>{let{getCurrentPostType:A,getCurrentPostId:P,getEditorSettings:R,getRenderingMode:N}=C(I),{getEditedEntityRecord:k,getPostType:E,getCurrentTheme:M,isResolving:V}=C(kSe.store),F=A(),D=P(),z=k("postType",F,D),{default_template_types:L=[]}=M()??{},O=Al({templateTypes:L,template:z}),B=E(F)?.labels?.singular_name,{getStylesPath:W,getShowStylebook:K}=q(C(I)),Z=W(),Q=K(),ue=gY(Z,Q);return{postId:D,postType:F,postTypeLabel:B,documentTitle:z.title,isNotFound:!z&&!V("getEditedEntityRecord","postType",F,D),templateTitle:O.title,onNavigateToPreviousEntityRecord:R().onNavigateToPreviousEntityRecord,isTemplatePreview:N()==="template-locked",stylesCanvasTitle:ue}},[]),{open:m}=(0,JT.useDispatch)(RSe.store),h=(0,ASe.useReducedMotion)(),g=B4.includes(n),v=!!u||!!r,b=g?c:s,_=r?.patternTitle||e.title||f||b,y=e.icon,w=C=>{C.stopPropagation(),r?t():u&&u()},S=A3(o),x=(0,W3.useRef)(!1);return(0,W3.useEffect)(()=>{x.current=!0},[]),(0,Ks.jsxs)("div",{className:J("editor-document-bar",{"has-back-button":v}),children:[(0,Ks.jsx)(au.__unstableAnimatePresence,{children:v&&(0,Ks.jsx)(Snt,{className:"editor-document-bar__back",icon:(0,Sg.isRTL)()?hV:fV,onClick:w,size:"compact",initial:x.current?{opacity:0,transform:"translateX(15%)"}:!1,animate:{opacity:1,transform:"translateX(0%)"},exit:{opacity:0,transform:"translateX(15%)"},transition:h?{duration:0}:void 0,children:(0,Sg.__)("Back")})}),!g&&d&&!v&&(0,Ks.jsx)($T.BlockIcon,{icon:Ka,className:"editor-document-bar__icon-layout"}),l?(0,Ks.jsx)(au.__experimentalText,{children:(0,Sg.__)("Document not found")}):(0,Ks.jsx)(au.Button,{className:"editor-document-bar__command",onClick:()=>m(),size:"compact",children:(0,Ks.jsxs)(au.__unstableMotion.div,{className:"editor-document-bar__title",initial:x.current?{opacity:0,transform:v?"translateX(15%)":"translateX(-15%)"}:!1,animate:{opacity:1,transform:"translateX(0%)"},transition:h?{duration:0}:void 0,children:[y&&(0,Ks.jsx)($T.BlockIcon,{icon:y}),(0,Ks.jsxs)(au.__experimentalText,{size:"body",as:"h1",children:[(0,Ks.jsx)("span",{className:"editor-document-bar__post-title",children:_?(0,OSe.__unstableStripHTML)(_):(0,Sg.__)("No title")}),r&&(0,Ks.jsx)("span",{className:"editor-document-bar__post-type-label",children:r.type==="template-part"?`\xB7 ${(0,Sg.__)("Template Part")}`:`\xB7 ${(0,Sg.__)("Pattern")}`}),!r&&S&&(0,Ks.jsx)("span",{className:"editor-document-bar__post-type-label",children:`\xB7 ${S}`}),!r&&i&&!e.title&&!S&&(0,Ks.jsx)("span",{className:"editor-document-bar__post-type-label",children:`\xB7 ${(0,ISe.decodeEntities)(i)}`})]})]},v)})]})}var Cy=a(j(),1),pS=a(Y(),1),q3=a(U(),1),K3=a(hd(),1),Y3=a(be(),1),NSe=a(le(),1),si=a(G(),1);var xy=a(T(),1),xnt=({children:e,isValid:t,isDisabled:r,level:o,href:n,onSelect:i})=>{function s(l){if(r){l.preventDefault();return}i()}return(0,xy.jsx)("li",{className:J("document-outline__item",`is-${o.toLowerCase()}`,{"is-invalid":!t,"is-disabled":r}),children:(0,xy.jsxs)("a",{href:n,className:"document-outline__button","aria-disabled":r,onClick:s,children:[(0,xy.jsx)("span",{className:"document-outline__emdash","aria-hidden":"true"}),(0,xy.jsx)("strong",{className:"document-outline__level",children:o}),(0,xy.jsx)("span",{className:"document-outline__item-content",children:e})]})})},yY=xnt;var dr=a(T(),1),Cnt=(0,dr.jsx)("em",{children:(0,Cy.__)("(Empty heading)")}),Ent=[(0,dr.jsx)("br",{},"incorrect-break"),(0,dr.jsx)("em",{children:(0,Cy.__)("(Incorrect heading level)")},"incorrect-message")],Tnt=[(0,dr.jsx)("br",{},"incorrect-break-h1"),(0,dr.jsx)("em",{children:(0,Cy.__)("(Your theme may already use a H1 for the post title)")},"incorrect-message-h1")],Pnt=[(0,dr.jsx)("br",{},"incorrect-break-multiple-h1"),(0,dr.jsx)("em",{children:(0,Cy.__)("(Multiple H1 headings are not recommended)")},"incorrect-message-multiple-h1")];function knt(){return(0,dr.jsxs)(si.SVG,{width:"138",height:"148",viewBox:"0 0 138 148",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,dr.jsx)(si.Rect,{width:"138",height:"148",rx:"4",fill:"#F0F6FC"}),(0,dr.jsx)(si.Line,{x1:"44",y1:"28",x2:"24",y2:"28",stroke:"#DDDDDD"}),(0,dr.jsx)(si.Rect,{x:"48",y:"16",width:"27",height:"23",rx:"4",fill:"#DDDDDD"}),(0,dr.jsx)(si.Path,{d:"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",fill:"black"}),(0,dr.jsx)(si.Line,{x1:"55",y1:"59",x2:"24",y2:"59",stroke:"#DDDDDD"}),(0,dr.jsx)(si.Rect,{x:"59",y:"47",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,dr.jsx)(si.Path,{d:"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",fill:"black"}),(0,dr.jsx)(si.Line,{x1:"80",y1:"90",x2:"24",y2:"90",stroke:"#DDDDDD"}),(0,dr.jsx)(si.Rect,{x:"84",y:"78",width:"30",height:"23",rx:"4",fill:"#F0B849"}),(0,dr.jsx)(si.Path,{d:"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",fill:"black"}),(0,dr.jsx)(si.Line,{x1:"66",y1:"121",x2:"24",y2:"121",stroke:"#DDDDDD"}),(0,dr.jsx)(si.Rect,{x:"70",y:"109",width:"29",height:"23",rx:"4",fill:"#DDDDDD"}),(0,dr.jsx)(si.Path,{d:"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",fill:"black"})]})}var Rnt=(e=[])=>e.filter(t=>t.name==="core/heading").map(t=>({...t,level:t.attributes.level,isEmpty:Ant(t)})),Ant=e=>!e.attributes.content||e.attributes.content.trim().length===0;function mS({onSelect:e,hasOutlineItemsDisabled:t}){let{selectBlock:r}=(0,pS.useDispatch)(Y3.store),{title:o,isTitleSupported:n}=(0,pS.useSelect)(g=>{let{getEditedPostAttribute:v}=g(I),{getPostType:b}=g(NSe.store),_=b(v("type"));return{title:v("title"),isTitleSupported:_?.supports?.title??!1}}),i=(0,pS.useSelect)(g=>{let{getClientIdsWithDescendants:v,getBlock:b}=g(Y3.store);return v().map(y=>b(y))}),s=(0,pS.useSelect)(g=>{if(g(I).getRenderingMode()==="post-only")return;let{getBlocksByName:v,getClientIdsOfDescendants:b}=g(Y3.store),[_]=v("core/post-content");if(_)return b(_)},[]),l=(0,q3.useRef)(1),c=(0,q3.useMemo)(()=>Rnt(i),[i]);if(c.length<1)return(0,dr.jsxs)("div",{className:"editor-document-outline has-no-headings",children:[(0,dr.jsx)(knt,{}),(0,dr.jsx)("p",{children:(0,Cy.__)("Navigate the structure of your document and address issues like empty or incorrect heading levels.")})]});let u=document.querySelector(".editor-post-title__input"),d=n&&o&&u,m=c.reduce((g,v)=>({...g,[v.level]:(g[v.level]||0)+1}),{})[1]>1;function h(g){return Array.isArray(s)?s.includes(g):!0}return(0,dr.jsx)("div",{className:"document-outline",children:(0,dr.jsxs)("ul",{children:[d&&(0,dr.jsx)(yY,{level:(0,Cy.__)("Title"),isValid:!0,onSelect:e,href:`#${u.id}`,isDisabled:t,children:o}),c.map(g=>{let v=g.level>l.current+1,b=!g.isEmpty&&!v&&!!g.level&&(g.level!==1||!m&&!d);return l.current=g.level,(0,dr.jsxs)(yY,{level:`H${g.level}`,isValid:b,isDisabled:t||!h(g.clientId),href:`#block-${g.clientId}`,onSelect:()=>{r(g.clientId),e?.()},children:[g.isEmpty?Cnt:(0,K3.getTextContent)((0,K3.create)({html:g.attributes.content})),v&&Ent,g.level===1&&m&&Pnt,d&&g.level===1&&!m&&Tnt]},g.clientId)})]})})}var MSe=a(Y(),1),FSe=a(be(),1);function DSe({children:e}){return(0,MSe.useSelect)(r=>{let{getGlobalBlockCount:o}=r(FSe.store);return o("core/heading")>0})?e:null}var LSe=a(U(),1),VSe=a(Y(),1),ac=a(j(),1),BSe=a(be(),1),jSe=a(xa(),1),zSe=a(Mo(),1),HSe=a(T(),1);function Int(){let{registerShortcut:e}=(0,VSe.useDispatch)(jSe.store);return(0,LSe.useEffect)(()=>{e({name:"core/editor/toggle-mode",category:"global",description:(0,ac.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/editor/save",category:"global",description:(0,ac.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:(0,ac.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:(0,ac.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,zSe.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/editor/toggle-list-view",category:"global",description:(0,ac.__)("Show or hide the List View."),keyCombination:{modifier:"access",character:"o"}}),e({name:"core/editor/toggle-distraction-free",category:"global",description:(0,ac.__)("Enter or exit distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}}),e({name:"core/editor/toggle-sidebar",category:"global",description:(0,ac.__)("Show or hide the Settings panel."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/editor/keyboard-shortcuts",category:"main",description:(0,ac.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/editor/new-note",category:"block",description:(0,ac.__)("Add a new note."),keyCombination:{modifier:"primaryAlt",character:"m"}}),e({name:"core/editor/next-region",category:"global",description:(0,ac.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/editor/previous-region",category:"global",description:(0,ac.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]})},[e]),(0,HSe.jsx)(BSe.BlockEditorKeyboardShortcuts.Register,{})}var USe=Int;var Z3=a(j(),1),WSe=a(G(),1),X3=a(Y(),1),eP=a(Mo(),1);var GSe=a(U(),1);var YSe=a(T(),1);function Ont(e,t){let r=(0,eP.isAppleOS)()?eP.displayShortcut.primaryShift("z"):eP.displayShortcut.primary("y"),o=(0,X3.useSelect)(i=>i(I).hasEditorRedo(),[]),{redo:n}=(0,X3.useDispatch)(I);return(0,YSe.jsx)(WSe.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,Z3.isRTL)()?gv:pv,label:(0,Z3.__)("Redo"),shortcut:r,"aria-disabled":!o,onClick:o?n:void 0,className:"editor-history__redo"})}var Q3=(0,GSe.forwardRef)(Ont);var J3=a(j(),1),qSe=a(G(),1),$3=a(Y(),1),KSe=a(Mo(),1);var ZSe=a(U(),1);var XSe=a(T(),1);function Nnt(e,t){let r=(0,$3.useSelect)(n=>n(I).hasEditorUndo(),[]),{undo:o}=(0,$3.useDispatch)(I);return(0,XSe.jsx)(qSe.Button,{__next40pxDefaultSize:!0,...e,ref:t,icon:(0,J3.isRTL)()?pv:gv,label:(0,J3.__)("Undo"),shortcut:KSe.displayShortcut.primary("z"),"aria-disabled":!r,onClick:r?o:void 0,className:"editor-history__undo"})}var e6=(0,ZSe.forwardRef)(Nnt);var JSe=a(qa(),1),$Se=a(Y(),1),exe=a(be(),1),txe=a(It(),1);var t6=a(G(),1),hS=a(j(),1),r6=a(Y(),1),QSe=a(U(),1),wY=a(be(),1),Ey=a(T(),1);function o6(){let[e,t]=(0,QSe.useState)(!1),r=(0,r6.useSelect)(i=>i(wY.store).isValidTemplate(),[]),{setTemplateValidity:o,synchronizeTemplate:n}=(0,r6.useDispatch)(wY.store);return r?null:(0,Ey.jsxs)(Ey.Fragment,{children:[(0,Ey.jsx)(t6.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:(0,hS.__)("Keep it as is"),onClick:()=>o(!0)},{label:(0,hS.__)("Reset the template"),onClick:()=>t(!0)}],children:(0,hS.__)("The content of your post doesn\u2019t match the template assigned to your post type.")}),(0,Ey.jsx)(t6.__experimentalConfirmDialog,{isOpen:e,confirmButtonText:(0,hS.__)("Reset"),onConfirm:()=>{t(!1),n()},onCancel:()=>t(!1),size:"medium",children:(0,hS.__)("Resetting the template may result in loss of content, do you want to continue?")})]})}var _Y=a(T(),1);function Mnt(){(0,JSe.default)("wp.editor.EditorNotices",{since:"7.0",version:"7.2",alternative:"wp.notices.InlineNotices"});let e=(0,$Se.useSelect)(t=>t(exe.store).isValidTemplate(),[]);return(0,_Y.jsx)(txe.InlineNotices,{pinnedNoticesClassName:"components-editor-notices__pinned",dismissibleNoticesClassName:"components-editor-notices__dismissible",children:!e&&(0,_Y.jsx)(o6,{})})}var rxe=Mnt;var oxe=a(qa(),1),nxe=a(It(),1),ixe=a(T(),1);function sxe(){return(0,oxe.default)("wp.editor.EditorSnackbars",{since:"7.0",version:"7.2",alternative:"wp.notices.SnackbarNotices"}),(0,ixe.jsx)(nxe.SnackbarNotices,{className:"components-editor-notices__snackbar"})}var Bp=a(G(),1),Vp=a(j(),1),gS=a(U(),1),tP=a(Ce(),1),pxe=a(Y(),1);var Ty=a(j(),1),CY=a(Y(),1),i6=a(G(),1),EY=a(le(),1);var n6=a(G(),1),SY=a(j(),1),axe=a(Y(),1),xY=a(le(),1),lxe=a(Nt(),1);var Dp=a(T(),1);function cxe({record:e,checked:t,onChange:r}){let{name:o,kind:n,title:i,key:s}=e,{entityRecordTitle:l,hasPostMetaChanges:c}=(0,axe.useSelect)(u=>{if(n!=="postType"||o!=="wp_template")return{entityRecordTitle:i,hasPostMetaChanges:q(u(I)).hasPostMetaChanges(o,s)};let d=u(xY.store).getEditedEntityRecord(n,o,s),{default_template_types:f=[]}=u(xY.store).getCurrentTheme()??{};return{entityRecordTitle:Al({template:d,templateTypes:f}).title,hasPostMetaChanges:q(u(I)).hasPostMetaChanges(o,s)}},[o,n,i,s]);return(0,Dp.jsxs)(Dp.Fragment,{children:[(0,Dp.jsx)(n6.PanelRow,{children:(0,Dp.jsx)(n6.CheckboxControl,{label:(0,lxe.decodeEntities)(l)||(0,SY.__)("Untitled"),checked:t,onChange:r,className:"entities-saved-states__change-control"})}),c&&(0,Dp.jsx)("ul",{className:"entities-saved-states__changes",children:(0,Dp.jsx)("li",{children:(0,SY.__)("Post Meta.")})})]})}var Lp=a(T(),1);function Fnt(e,t){switch(e){case"site":return t===1?(0,Ty.__)("This change will affect your whole site."):(0,Ty.__)("These changes will affect your whole site.");case"wp_template":return(0,Ty.__)("This change will affect other parts of your site that use this template.");case"page":case"post":return(0,Ty.__)("The following has been modified.")}}function Dnt({record:e}){let{editedRecord:t,savedRecord:r}=(0,CY.useSelect)(n=>{let{getEditedEntityRecord:i,getEntityRecord:s}=n(EY.store);return{editedRecord:i(e.kind,e.name,e.key),savedRecord:s(e.kind,e.name,e.key)}},[e.kind,e.name,e.key]),o=N1(t,r,{maxResults:10});return o.length?(0,Lp.jsx)("ul",{className:"entities-saved-states__changes",children:o.map(n=>(0,Lp.jsx)("li",{children:n},n))}):null}function Lnt({record:e,count:t}){if(e?.name==="globalStyles")return null;let r=Fnt(e?.name,t);return r?(0,Lp.jsx)(i6.PanelRow,{children:r}):null}function uxe({list:e,unselectedEntities:t,setUnselectedEntities:r}){let o=e.length,n=e[0],s=(0,CY.useSelect)(l=>l(EY.store).getEntityConfig(n.kind,n.name),[n.kind,n.name]).label;return n?.name==="wp_template_part"&&(s=o===1?(0,Ty.__)("Template Part"):(0,Ty.__)("Template Parts")),(0,Lp.jsxs)(i6.PanelBody,{title:s,initialOpen:!0,className:"entities-saved-states__panel-body",children:[(0,Lp.jsx)(Lnt,{record:n,count:o}),e.map(l=>(0,Lp.jsx)(cxe,{record:l,checked:!t.some(c=>c.kind===l.kind&&c.name===l.name&&c.key===l.key&&c.property===l.property),onChange:c=>r(l,c)},l.key||l.property)),n?.name==="globalStyles"&&(0,Lp.jsx)(Dnt,{record:n})]})}var dxe=a(Y(),1),fxe=a(le(),1),s6=a(U(),1),a6=()=>{let{editedEntities:e,siteEdits:t,siteEntityConfig:r}=(0,dxe.useSelect)(c=>{let{__experimentalGetDirtyEntityRecords:u,getEntityRecordEdits:d,getEntityConfig:f}=c(fxe.store);return{editedEntities:u(),siteEdits:d("root","site"),siteEntityConfig:f("root","site")}},[]),o=(0,s6.useMemo)(()=>{let c=e.filter(_=>!(_.kind==="root"&&_.name==="site")),u=r?.meta?.labels??{},{title:d,description:f,site_logo:m,site_icon:h,...g}=t??{},b=[d!==void 0&&"title",f!==void 0&&"description",m!==void 0&&"site_logo",h!==void 0&&"site_icon",...Object.keys(g)].filter(Boolean).map(_=>({kind:"root",name:"site",title:u[_]||_,property:_}));return[...c,...b]},[e,t,r]),[n,i]=(0,s6.useState)([]),s=({kind:c,name:u,key:d,property:f},m)=>{i(m?n.filter(h=>h.kind!==c||h.name!==u||h.key!==d||h.property!==f):[...n,{kind:c,name:u,key:d,property:f}])},l=o.length-n.length>0;return{dirtyEntityRecords:o,isDirty:l,setUnselectedEntities:s,unselectedEntities:n}};var ai=a(T(),1);function l6({close:e,renderDialog:t,variant:r}){let o=a6();return(0,ai.jsx)(rP,{close:e,renderDialog:t,variant:r,...o})}function rP({additionalPrompt:e=void 0,close:t,onSave:r=void 0,saveEnabled:o=void 0,saveLabel:n=(0,Vp.__)("Save"),renderDialog:i,dirtyEntityRecords:s,isDirty:l,setUnselectedEntities:c,unselectedEntities:u,variant:d="default",successNoticeContent:f}){let m=(0,gS.useRef)(),{saveDirtyEntities:h}=q((0,pxe.useDispatch)(I)),g=s.reduce((M,V)=>{let{name:F}=V;return M[F]||(M[F]=[]),M[F].push(V),M},{}),{site:v,wp_template:b,wp_template_part:_,...y}=g,w=[v,b,_,...Object.values(y)].filter(Array.isArray),S=o??l,x=(0,gS.useCallback)(()=>t(),[t]),[C,A]=(0,tP.__experimentalUseDialog)({onClose:()=>x()}),P=(0,tP.useInstanceId)(rP,"entities-saved-states__panel-label"),R=(0,tP.useInstanceId)(rP,"entities-saved-states__panel-description"),N=s.length?(0,Vp.__)("Select the items you want to save."):void 0,k=d==="inline",E=(0,ai.jsxs)(ai.Fragment,{children:[(0,ai.jsx)(Bp.FlexItem,{isBlock:!k,as:Bp.Button,variant:k?"tertiary":"secondary",size:k?void 0:"compact",onClick:x,children:(0,Vp.__)("Cancel")}),(0,ai.jsx)(Bp.FlexItem,{isBlock:!k,as:Bp.Button,ref:m,variant:"primary",size:k?void 0:"compact",disabled:!S,accessibleWhenDisabled:!0,onClick:()=>h({onSave:r,dirtyEntityRecords:s,entitiesToSkip:u,close:t,successNoticeContent:f}),className:"editor-entities-saved-states__save-button",children:n})]});return(0,ai.jsxs)("div",{ref:i?C:void 0,...i&&A,className:J("entities-saved-states__panel",{"is-inline":k}),role:i?"dialog":void 0,"aria-labelledby":i?P:void 0,"aria-describedby":i?R:void 0,children:[!k&&(0,ai.jsx)(Bp.Flex,{className:"entities-saved-states__panel-header",gap:2,children:E}),(0,ai.jsxs)("div",{className:"entities-saved-states__text-prompt",children:[(0,ai.jsx)("div",{className:"entities-saved-states__text-prompt--header-wrapper",children:(0,ai.jsx)("strong",{id:i?P:void 0,className:"entities-saved-states__text-prompt--header",children:(0,Vp.__)("Are you ready to save?")})}),(0,ai.jsxs)("div",{id:i?R:void 0,children:[e,(0,ai.jsx)("p",{className:"entities-saved-states__text-prompt--changes-count",children:l?(0,gS.createInterpolateElement)((0,Vp.sprintf)((0,Vp._n)("There is %d site change waiting to be saved.","There are %d site changes waiting to be saved.",s.length),s.length),{strong:(0,ai.jsx)("strong",{})}):N})]})]}),w.map(M=>(0,ai.jsx)(uxe,{list:M,unselectedEntities:u,setUnselectedEntities:c},M[0].name)),k&&(0,ai.jsx)(Bp.Flex,{direction:"row",justify:"flex-end",className:"entities-saved-states__panel-footer",children:E})]})}var hxe=a(U(),1),c6=a(j(),1),Py=a(G(),1),gxe=a(Y(),1),vxe=a(Ce(),1),bxe=a(zn(),1);var xg=a(T(),1);function Vnt(){try{return(0,gxe.select)(I).getEditedPostContent()}catch{}}function mxe({text:e,children:t,variant:r="secondary"}){let o=(0,vxe.useCopyToClipboard)(e);return(0,xg.jsx)(Py.Button,{__next40pxDefaultSize:!0,variant:r,ref:o,children:t})}var Bnt=class extends hxe.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,bxe.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state,{canCopyContent:t=!1}=this.props;return e?(0,xg.jsxs)(Py.__experimentalHStack,{className:"editor-error-boundary",alignment:"baseline",spacing:4,justify:"space-between",expanded:!1,wrap:!0,children:[(0,xg.jsx)(Py.__experimentalText,{as:"p",children:(0,c6.__)("The editor has encountered an unexpected error.")}),(0,xg.jsxs)(Py.__experimentalHStack,{expanded:!1,children:[t&&(0,xg.jsx)(mxe,{text:Vnt,children:(0,c6.__)("Copy contents")}),(0,xg.jsx)(mxe,{variant:"primary",text:e?.stack,children:(0,c6.__)("Copy error")})]})]}):this.props.children}},yxe=Bnt;var jp=a(U(),1),nP=a(Ce(),1),Cg=a(Y(),1),TY=a(j(),1),wxe=a(Pt(),1),_xe=a(It(),1);var Sxe=a(T(),1),jnt=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame,oP,znt=()=>{if(oP!==void 0)return oP;try{window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),oP=!0}catch{oP=!1}return oP};function Hnt(){let e=(0,Cg.useRegistry)(),{postId:t,isEditedPostNew:r}=(0,Cg.useSelect)(o=>({postId:o(I).getCurrentPostId(),isEditedPostNew:o(I).isEditedPostNew()}),[]);(0,jp.useEffect)(()=>{let o=zX(t,r);if(!o)return;try{o=JSON.parse(o)}catch{return}let{post_title:n,content:i,excerpt:s}=o,l={title:n,content:i,excerpt:s},{getEditedPostAttribute:c,getEditorSettings:u}=e.select(I);if(!Object.keys(l).some(_=>l[_]!==c(_))){M2(t,r);return}if(!!u().autosave)return;let{createWarningNotice:m,removeNotice:h}=e.dispatch(_xe.store),{editPost:g,resetEditorBlocks:v}=e.dispatch(I),b="wpEditorAutosaveRestore";m((0,TY.__)("The backup of this post in your browser is different from the version below."),{id:b,actions:[{label:(0,TY.__)("Restore the backup"),onClick(){let{content:_,...y}=l;g(y),v((0,wxe.parse)(l.content)),h(b)}}]})},[e,t,r])}function Unt(){let{postId:e,isEditedPostNew:t,isDirty:r,isAutosaving:o,didError:n}=(0,Cg.useSelect)(u=>({postId:u(I).getCurrentPostId(),isEditedPostNew:u(I).isEditedPostNew(),isDirty:u(I).isEditedPostDirty(),isAutosaving:u(I).isAutosavingPost(),didError:u(I).didPostSaveRequestFail()}),[]),i=(0,jp.useRef)(r),s=(0,jp.useRef)(o);(0,jp.useEffect)(()=>{!n&&(s.current&&!o||i.current&&!r)&&M2(e,t),i.current=r,s.current=o},[r,o,n]);let l=(0,nP.usePrevious)(t),c=(0,nP.usePrevious)(e);(0,jp.useEffect)(()=>{c===e&&l&&!t&&M2(e,!0)},[t,e])}function Wnt(){let{autosave:e}=(0,Cg.useDispatch)(I),t=(0,jp.useCallback)(()=>{jnt(()=>e({local:!0}))},[]);Hnt(),Unt();let r=(0,Cg.useSelect)(o=>o(I).getEditorSettings().localAutosaveInterval,[]);return(0,Sxe.jsx)(R3,{interval:r,autosave:t})}var xxe=(0,nP.ifCondition)(znt)(Wnt);var Cxe=a(Y(),1),Exe=a(le(),1);function Gnt({children:e}){return(0,Cxe.useSelect)(r=>{let{getEditedPostAttribute:o}=r(I),{getPostType:n}=r(Exe.store);return!!n(o("type"))?.supports?.["page-attributes"]},[])?e:null}var vS=Gnt;var PY=a(j(),1),yS=a(G(),1),u6=a(Y(),1),kxe=a(U(),1);var Txe=a(Y(),1),Pxe=a(le(),1);function Ynt(e={},t){if(e[t]!==void 0)return!!e[t];let[r,o]=t.split("."),[n]=Array.isArray(e[r])?e[r]:[];return Array.isArray(n)?n.includes(o):!!n?.[o]}function qnt({children:e,supportKeys:t}){let r=(0,Txe.useSelect)(n=>{let{getEditedPostAttribute:i}=n(I),{getPostType:s}=n(Pxe.store);return s(i("type"))},[]),o=!!r;return r&&(o=(Array.isArray(t)?t:[t]).some(n=>Ynt(r.supports,n))),o?e:null}var uo=qnt;var bS=a(T(),1);function Knt(){let e=(0,u6.useSelect)(s=>s(I).getEditedPostAttribute("menu_order")??0,[]),{editPost:t}=(0,u6.useDispatch)(I),[r,o]=(0,kxe.useState)(null),n=s=>{o(s);let l=Number(s);Number.isInteger(l)&&s.trim?.()!==""&&t({menu_order:l})},i=r??e;return(0,bS.jsx)(yS.Flex,{children:(0,bS.jsx)(yS.FlexBlock,{children:(0,bS.jsx)(yS.__experimentalNumberControl,{label:(0,PY.__)("Order"),help:(0,PY.__)("Set the page order."),value:i,onChange:n,hideLabelFromVision:!0,onBlur:()=>{o(null)}})})})}function Rxe(){return(0,bS.jsx)(uo,{supportKeys:"page-attributes",children:(0,bS.jsx)(Knt,{})})}var zxe=a(Y(),1),Hxe=a(le(),1);var RY=a(pw(),1),Ma=a(j(),1),Eg=a(G(),1),Fxe=a(Ce(),1),qd=a(U(),1),_S=a(Y(),1),IY=a(Nt(),1),f6=a(le(),1),Dxe=a(be(),1),Lxe=a(vo(),1);var Axe=a(G(),1),Ixe=a(U(),1),iP=a(T(),1),Znt=(0,Ixe.forwardRef)(({className:e,label:t,children:r},o)=>(0,iP.jsxs)(Axe.__experimentalHStack,{className:J("editor-post-panel__row",e),ref:o,children:[t&&(0,iP.jsx)("div",{className:"editor-post-panel__row-label",children:t}),(0,iP.jsx)("div",{className:"editor-post-panel__row-control",children:r})]})),fr=Znt;var Oxe=a(Nt(),1);function d6(e){let t=e.map(n=>({children:[],parent:void 0,...n}));if(t.some(({parent:n})=>n===void 0))return t;let r=t.reduce((n,i)=>{let{parent:s}=i;return n[s]||(n[s]=[]),n[s].push(i),n},{}),o=n=>n.map(i=>{let s=r[i.id];return{...i,children:s&&s.length?o(s):[]}});return o(r[0]||[])}var wS=e=>(0,Oxe.decodeEntities)(e),kY=e=>({...e,name:wS(e.name)}),Nxe=e=>(e??[]).map(kY);var Na=a(T(),1);function AY(e){return e?.title?.rendered?(0,IY.decodeEntities)(e.title.rendered):`#${e.id} (${(0,Ma.__)("no title")})`}var Mxe=(e,t)=>{let r=(0,RY.default)(e||"").toLowerCase(),o=(0,RY.default)(t||"").toLowerCase();return r===o?0:r.startsWith(o)?r.length:1/0};function Vxe(){let{editPost:e}=(0,_S.useDispatch)(I),[t,r]=(0,qd.useState)(""),{isHierarchical:o,parentPostId:n,parentPostTitle:i,pageItems:s,isLoading:l}=(0,_S.useSelect)(f=>{let{getPostType:m,getEntityRecords:h,getEntityRecord:g,isResolving:v}=f(f6.store),{getCurrentPostId:b,getEditedPostAttribute:_}=f(I),y=_("type"),w=_("parent"),S=m(y),x=b(),C=S?.hierarchical??!1,A={per_page:100,exclude:x,parent_exclude:x,orderby:"menu_order",order:"asc",_fields:"id,title,parent"};t&&(A.search=t,A.orderby="relevance",A.search_columns=["post_title"]);let P=w?g("postType",y,w):null;return{isHierarchical:C,parentPostId:w,parentPostTitle:P?AY(P):"",pageItems:C?h("postType",y,A):null,isLoading:C?v("getEntityRecords",["postType",y,A]):!1}},[t]),c=(0,qd.useMemo)(()=>{let f=(v,b=0)=>v.map(w=>[{value:w.id,label:"\u2014 ".repeat(b)+(0,IY.decodeEntities)(w.name),rawName:w.name},...f(w.children||[],b+1)]).sort(([w],[S])=>{let x=Mxe(w.rawName,t),C=Mxe(S.rawName,t);return x>=C?1:-1}).flat();if(!s)return[];let m=s.map(v=>({id:v.id,parent:v.parent,name:AY(v)}));t||(m=d6(m));let h=f(m),g=h.find(v=>v.value===n);return i&&!g&&h.unshift({value:n,label:i}),h},[s,t,i,n]);if(!o)return null;let u=f=>{r(f)},d=f=>{e({parent:f})};return(0,Na.jsx)(Eg.ComboboxControl,{className:"editor-page-attributes__parent",label:(0,Ma.__)("Parent"),help:(0,Ma.__)("Choose a parent page."),value:n,options:c,onFilterValueChange:(0,Fxe.debounce)(u,300),onChange:d,hideLabelFromVision:!0,isLoading:l})}function Xnt({isOpen:e,onClick:t}){let r=(0,_S.useSelect)(n=>{let{getEditedPostAttribute:i}=n(I),s=i("parent");if(!s)return null;let{getEntityRecord:l}=n(f6.store),c=i("type");return l("postType",c,s)},[]),o=(0,qd.useMemo)(()=>r?AY(r):(0,Ma.__)("None"),[r]);return(0,Na.jsx)(Eg.Button,{size:"compact",className:"editor-post-parent__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,Ma.sprintf)((0,Ma.__)("Change parent: %s"),o),onClick:t,children:o})}function Bxe(){let e=(0,_S.useSelect)(n=>n(f6.store).getEntityRecord("root","__unstableBase")?.home,[]),[t,r]=(0,qd.useState)(null),o=(0,qd.useMemo)(()=>({anchor:t,placement:"left-start",offset:36,shift:!0}),[t]);return(0,Na.jsx)(fr,{label:(0,Ma.__)("Parent"),ref:r,children:(0,Na.jsx)(Eg.Dropdown,{popoverProps:o,className:"editor-post-parent__panel-dropdown",contentClassName:"editor-post-parent__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:n,onToggle:i})=>(0,Na.jsx)(Xnt,{isOpen:n,onClick:i}),renderContent:({onClose:n})=>(0,Na.jsxs)("div",{className:"editor-post-parent",children:[(0,Na.jsx)(Dxe.__experimentalInspectorPopoverHeader,{title:(0,Ma.__)("Parent"),onClose:n}),(0,Na.jsxs)("div",{children:[(0,qd.createInterpolateElement)((0,Ma.sprintf)((0,Ma.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s /services /pricing.'),(0,Lxe.filterURLForDisplay)(e).replace(/([/.])/g," $1")),{wbr:(0,Na.jsx)("wbr",{})}),(0,Na.jsx)("p",{children:(0,qd.createInterpolateElement)((0,Ma.__)("They also show up as sub-items in the default navigation menu. Learn more. "),{a:(0,Na.jsx)(Eg.ExternalLink,{href:(0,Ma.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes")})})})]}),(0,Na.jsx)(Vxe,{})]})})})}var jxe=Vxe;var p6=a(T(),1),Qnt="page-attributes";function Jnt(){let{isEnabled:e,postType:t}=(0,zxe.useSelect)(r=>{let{getEditedPostAttribute:o,isEditorPanelEnabled:n}=r(I),{getPostType:i}=r(Hxe.store);return{isEnabled:n(Qnt),postType:i(o("type"))}},[]);return!e||!t?null:(0,p6.jsx)(Bxe,{})}function m6(){return(0,p6.jsx)(vS,{children:(0,p6.jsx)(Jnt,{})})}var lc=a(j(),1),Hp=a(G(),1),xS=a(Y(),1),FY=a(le(),1),Gxe=a(be(),1),CS=a(U(),1);var Yxe=a(It(),1);var h6=a(Y(),1),NY=a(U(),1),lu=a(Pt(),1),cu=a(G(),1),ky=a(j(),1);var zp=a(T(),1),OY=(0,ky.__)("Custom Template");function Tg({onClose:e}){let{defaultBlockTemplate:t,onNavigateToEntityRecord:r}=(0,h6.useSelect)(d=>{let{getEditorSettings:f,getCurrentTemplateId:m}=d(I);return{defaultBlockTemplate:f().defaultBlockTemplate,onNavigateToEntityRecord:f().onNavigateToEntityRecord,getTemplateId:m}}),{createTemplate:o}=q((0,h6.useDispatch)(I)),[n,i]=(0,NY.useState)(""),[s,l]=(0,NY.useState)(!1),c=()=>{i(""),e()},u=async d=>{if(d.preventDefault(),s)return;l(!0);let f=t??(0,lu.serialize)([(0,lu.createBlock)("core/group",{tagName:"header",layout:{inherit:!0}},[(0,lu.createBlock)("core/site-title"),(0,lu.createBlock)("core/site-tagline")]),(0,lu.createBlock)("core/separator"),(0,lu.createBlock)("core/group",{tagName:"main"},[(0,lu.createBlock)("core/group",{layout:{inherit:!0}},[(0,lu.createBlock)("core/post-title")]),(0,lu.createBlock)("core/post-content",{layout:{inherit:!0}})])]),m=await o({slug:Jv(n||OY)||"wp-custom-template",content:f,title:n||OY,status:"publish"});l(!1),r({postId:m.id,postType:"wp_template"}),c()};return(0,zp.jsx)(cu.Modal,{title:(0,ky.__)("Create custom template"),onRequestClose:c,focusOnMount:"firstContentElement",size:"small",overlayClassName:"editor-post-template__create-template-modal",children:(0,zp.jsx)("form",{onSubmit:u,children:(0,zp.jsxs)(cu.__experimentalVStack,{spacing:"3",children:[(0,zp.jsx)(cu.TextControl,{label:(0,ky.__)("Name"),value:n,onChange:i,placeholder:OY,disabled:s,help:(0,ky.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,zp.jsxs)(cu.__experimentalHStack,{justify:"right",children:[(0,zp.jsx)(cu.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:c,children:(0,ky.__)("Cancel")}),(0,zp.jsx)(cu.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:s,"aria-disabled":s,children:(0,ky.__)("Create")})]})]})})})}var Ry=a(Y(),1),Uxe=a(U(),1),Pg=a(le(),1),g6=a(j(),1);function Ay(){return(0,Ry.useSelect)(e=>{let{getCurrentPostId:t,getCurrentPostType:r}=e(I);return{postId:t(),postType:r()}},[])}function Iy(){let{postType:e,postId:t}=Ay();return(0,Ry.useSelect)(r=>{let{canUser:o,getEntityRecord:n,getEntityRecords:i}=r(Pg.store),s=o("read",{kind:"root",name:"site"})?n("root","site"):void 0,l=+t===s?.page_for_posts,c=e==="page"&&+t===s?.page_on_front,u=c?i("postType","wp_template",{per_page:-1}):[],d=c&&!!u?.some(({slug:f})=>f==="front-page");return!l&&!d},[t,e])}function Wxe(e){return(0,Ry.useSelect)(t=>t(Pg.store).getEntityRecords("postType","wp_template",{per_page:-1,post_type:e}),[e])}function sP(){let{postType:e,postId:t}=Ay(),[r]=(0,Pg.useEntityProp)("postType",e,"slug",t),o=MY(),n=Iy(),i=Wxe(e),s=(0,Ry.useSelect)(l=>{if(!window?.__experimentalDataFormInspector||!o)return null;let{getDefaultTemplateId:c,getEntityRecord:u}=l(Pg.store),d;r?d=e==="page"?`${e}-${r}`:`single-${e}-${r}`:d=e==="page"?"page":`single-${e}`;let f=c({slug:d});return f?u("postType","wp_template",f):null},[o,r,e]);return(0,Uxe.useMemo)(()=>n&&[...(i||[]).filter(l=>l.is_custom&&l.slug!==o&&!!l.content.raw),s&&{...s,title:{rendered:(0,g6.sprintf)((0,g6.__)("%s (default)"),s.title.rendered)},isDefault:!0}].filter(Boolean),[i,s,o,n])}function SS(){return(0,Ry.useSelect)(e=>{let{getEditorSettings:t,getCurrentTemplateId:r,getCurrentPostType:o}=e(I),{getPostType:n,canUser:i}=e(Pg.store),s=o(),l=n(s),c=t(),u=c.__unstableIsBlockBasedTheme,d=!!c.availableTemplates&&Object.keys(c.availableTemplates).length>0,f;l?.viewable?d?f=!0:c.supportsTemplateMode?f=i("create",{kind:"postType",name:"wp_template"})??!1:f=!1:f=!1;let m=f?!!i("read",{kind:"postType",name:"wp_template"}):!1;return(!u||!m)&&f?"classic":u&&r()?"block-theme":null},[])}function MY(){let{postType:e,postId:t}=Ay(),r=Wxe(e),o=(0,Ry.useSelect)(n=>n(Pg.store).getEditedEntityRecord("postType",e,t)?.template,[e,t]);if(o)return r?.find(n=>n.slug===o)?.slug}var Fa=a(T(),1);function $nt({isOpen:e,onClick:t}){let r=(0,xS.useSelect)(o=>{let n=o(I).getEditedPostAttribute("template"),{supportsTemplateMode:i,availableTemplates:s}=o(I).getEditorSettings();if(!i&&s[n])return s[n];let l=o(FY.store).canUser("create",{kind:"postType",name:"wp_template"})&&o(I).getCurrentTemplateId();return l?.title||l?.slug||s?.[n]},[]);return(0,Fa.jsx)(Hp.Button,{__next40pxDefaultSize:!0,variant:"tertiary","aria-expanded":e,"aria-label":(0,lc.__)("Template options"),onClick:t,children:r??(0,lc.__)("Default template")})}function eit({onClose:e}){let t=Iy(),{availableTemplates:r,fetchedTemplates:o,selectedTemplateSlug:n,canCreate:i,canEdit:s,currentTemplateId:l,onNavigateToEntityRecord:c,getEditorSettings:u}=(0,xS.useSelect)(b=>{let{canUser:_,getEntityRecords:y}=b(FY.store),w=b(I).getEditorSettings(),S=_("create",{kind:"postType",name:"wp_template"}),x=b(I).getCurrentTemplateId();return{availableTemplates:w.availableTemplates,fetchedTemplates:S?y("postType","wp_template",{post_type:b(I).getCurrentPostType(),per_page:-1}):void 0,selectedTemplateSlug:b(I).getEditedPostAttribute("template"),canCreate:t&&S&&w.supportsTemplateMode,canEdit:t&&S&&w.supportsTemplateMode&&!!x,currentTemplateId:x,onNavigateToEntityRecord:w.onNavigateToEntityRecord,getEditorSettings:b(I).getEditorSettings}},[t]),d=(0,CS.useMemo)(()=>Object.entries({...r,...Object.fromEntries((o??[]).map(({slug:b,title:_})=>[b,_.rendered]))}).map(([b,_])=>({value:b,label:_})),[r,o]),f=d.find(b=>b.value===n)??d.find(b=>!b.value),{editPost:m}=(0,xS.useDispatch)(I),{createSuccessNotice:h}=(0,xS.useDispatch)(Yxe.store),[g,v]=(0,CS.useState)(!1);return(0,Fa.jsxs)("div",{className:"editor-post-template__classic-theme-dropdown",children:[(0,Fa.jsx)(Gxe.__experimentalInspectorPopoverHeader,{title:(0,lc.__)("Template"),help:(0,lc.__)("Templates define the way content is displayed when viewing your site."),actions:i?[{icon:z4,label:(0,lc.__)("Add template"),onClick:()=>v(!0)}]:[],onClose:e}),t?(0,Fa.jsx)(Hp.SelectControl,{hideLabelFromVision:!0,label:(0,lc.__)("Template"),value:f?.value??"",options:d,onChange:b=>m({template:b||""})}):(0,Fa.jsx)(Hp.Notice,{status:"warning",isDismissible:!1,children:(0,lc.__)("The posts page template cannot be changed.")}),s&&c&&(0,Fa.jsx)("p",{children:(0,Fa.jsx)(Hp.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>{c({postId:l,postType:"wp_template"}),e(),h((0,lc.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:[{label:(0,lc.__)("Go back"),onClick:()=>u().onNavigateToPreviousEntityRecord()}]})},children:(0,lc.__)("Edit template")})}),g&&(0,Fa.jsx)(Tg,{onClose:()=>v(!1)})]})}function tit(){let[e,t]=(0,CS.useState)(null),r=(0,CS.useMemo)(()=>({anchor:e,className:"editor-post-template__dropdown",placement:"left-start",offset:36,shift:!0}),[e]);return(0,Fa.jsx)(fr,{label:(0,lc.__)("Template"),ref:t,children:(0,Fa.jsx)(Hp.Dropdown,{popoverProps:r,focusOnMount:!0,renderToggle:({isOpen:o,onToggle:n})=>(0,Fa.jsx)($nt,{isOpen:o,onClick:n}),renderContent:({onClose:o})=>(0,Fa.jsx)(eit,{onClose:o})})})}var v6=tit;var w6=a(G(),1),Qxe=a(zh(),1),_6=a(Y(),1),Jxe=a(KU(),1);var Zxe=a(G(),1);var b6=a(Y(),1),qxe=a(Lt(),1);var Kxe=a(T(),1),{PreferenceBaseOption:rit}=q(qxe.privateApis);function kg(e){let{toggleEditorPanelEnabled:t}=(0,b6.useDispatch)(I),{isChecked:r,isRemoved:o}=(0,b6.useSelect)(n=>{let{isEditorPanelEnabled:i,isEditorPanelRemoved:s}=n(I);return{isChecked:i(e.panelName),isRemoved:s(e.panelName)}},[e.panelName]);return o?null:(0,Kxe.jsx)(rit,{isChecked:r,onChange:()=>t(e.panelName),...e})}var DY=a(T(),1),{Fill:oit,Slot:nit}=(0,Zxe.createSlotFill)("EnablePluginDocumentSettingPanelOption"),Xxe=({label:e,panelName:t})=>(0,DY.jsx)(oit,{children:(0,DY.jsx)(kg,{label:e,panelName:t})});Xxe.Slot=nit;var y6=Xxe;var Rg=a(T(),1),{Fill:iit,Slot:sit}=(0,w6.createSlotFill)("PluginDocumentSettingPanel"),$xe=({name:e,className:t,title:r,icon:o,children:n})=>{let{name:i}=(0,Qxe.usePluginContext)(),s=`${i}/${e}`,{opened:l,isEnabled:c}=(0,_6.useSelect)(d=>{let{isEditorPanelOpened:f,isEditorPanelEnabled:m}=d(I);return{opened:f(s),isEnabled:m(s)}},[s]),{toggleEditorPanelOpened:u}=(0,_6.useDispatch)(I);return e===void 0&&(0,Jxe.default)("PluginDocumentSettingPanel requires a name property."),(0,Rg.jsxs)(Rg.Fragment,{children:[(0,Rg.jsx)(y6,{label:r,panelName:s}),(0,Rg.jsx)(iit,{children:c&&(0,Rg.jsx)(w6.PanelBody,{className:t,title:r,icon:o,opened:l,onToggle:()=>u(s),children:n})})]})};$xe.Slot=sit;var S6=$xe;var e1e=a(be(),1),t1e=a(G(),1),r1e=a(Ce(),1),LY=a(T(),1),ait=(e,t)=>e.filter(r=>!t.includes(r)).length===0,lit=(e,t)=>!Array.isArray(t)||ait(e,t),cit=({allowedBlocks:e,icon:t,label:r,onClick:o,small:n,role:i})=>(0,LY.jsx)(e1e.BlockSettingsMenuControls,{children:({selectedBlocks:s,onClose:l})=>lit(s,e)?(0,LY.jsx)(t1e.MenuItem,{onClick:(0,r1e.compose)(o,l),icon:t,label:n?r:void 0,role:i,children:!n&&r}):null}),o1e=cit;var n1e=a(G(),1),i1e=a(zh(),1);var s1e=a(T(),1);function a1e(e){let t=(0,i1e.usePluginContext)();return(0,s1e.jsx)(Yl,{name:"core/plugin-more-menu",as:e.as??n1e.MenuItem,icon:e.icon||t.icon,...e})}var l1e=a(zh(),1),x6=a(G(),1),VY=a(T(),1),{Fill:uit,Slot:dit}=(0,x6.createSlotFill)("PluginPostPublishPanel"),c1e=({children:e,className:t,title:r,initialOpen:o=!1,icon:n})=>{let{icon:i}=(0,l1e.usePluginContext)();return(0,VY.jsx)(uit,{children:(0,VY.jsx)(x6.PanelBody,{className:t,initialOpen:o||!r,title:r,icon:n??i,children:e})})};c1e.Slot=dit;var C6=c1e;var E6=a(G(),1),BY=a(T(),1),{Fill:fit,Slot:pit}=(0,E6.createSlotFill)("PluginPostStatusInfo"),u1e=({children:e,className:t})=>(0,BY.jsx)(fit,{children:(0,BY.jsx)(E6.PanelRow,{className:t,children:e})});u1e.Slot=pit;var ES=u1e;var T6=a(G(),1),d1e=a(zh(),1),jY=a(T(),1),{Fill:mit,Slot:hit}=(0,T6.createSlotFill)("PluginPrePublishPanel"),f1e=({children:e,className:t,title:r,initialOpen:o=!1,icon:n})=>{let{icon:i}=(0,d1e.usePluginContext)();return(0,jY.jsx)(mit,{children:(0,jY.jsx)(T6.PanelBody,{className:t,initialOpen:o||!r,title:r,icon:n??i,children:e})})};f1e.Slot=hit;var P6=f1e;var p1e=a(G(),1),m1e=a(zh(),1);var h1e=a(T(),1);function g1e(e){let t=(0,m1e.usePluginContext)();return(0,h1e.jsx)(Yl,{name:"core/plugin-preview-menu",as:e.as??p1e.MenuItem,icon:e.icon||t.icon,...e})}var v1e=a(T(),1);function Oy({className:e,...t}){return(0,v1e.jsx)(Kl,{panelClassName:e,className:"editor-sidebar",scope:"core",...t})}var b1e=a(T(),1);function y1e(e){return(0,b1e.jsx)(Uh,{__unstableExplicitMenuItem:!0,scope:"core",...e})}var Up=a(Y(),1),z1e=a(Nt(),1),Ag=a(G(),1),k6=a(U(),1),My=a(j(),1),RS=a(le(),1);var H1e=a(It(),1),U1e=a(Lt(),1);var PS=a(U(),1),x1e=a(Nt(),1),C1e=a(be(),1),kS=a(G(),1),TS=a(j(),1),E1e=a(Y(),1),T1e=a(le(),1),P1e=a(Pt(),1);var _1e=a(pw(),1);function w1e(e=""){return e=(0,_1e.default)(e),e=e.trim().toLowerCase(),e}function git(e,t){let r=w1e(t),o=w1e(e.title),n=0;return r===o?n+=30:o.startsWith(r)?n+=20:r.split(" ").every(l=>o.includes(l))&&(n+=10),n}function S1e(e=[],t=""){if(!t)return e;let r=e.map(o=>[o,git(o,t)]).filter(([,o])=>o>0);return r.sort(([,o],[,n])=>n-o),r.map(([o])=>o)}var Da=a(T(),1);function zY({onRequestClose:e,onSelect:t}){let{postType:r,postId:o}=Ay(),{editEntityRecord:n}=(0,E1e.useDispatch)(T1e.store),i=async s=>{n("postType",r,o,{template:s.isDefault?"":s.name},{undoIgnore:!0}),e(),t?.()};return(0,Da.jsx)(kS.Modal,{title:(0,TS.__)("Choose a template"),onRequestClose:e,overlayClassName:"editor-post-template__swap-template-modal",isFullScreen:!0,children:(0,Da.jsx)("div",{className:"editor-post-template__swap-template-modal-content",children:(0,Da.jsx)(vit,{onSelect:i})})})}function k1e({onClick:e}){let[t,r]=(0,PS.useState)(!1),o=sP();return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(kS.MenuItem,{disabled:!o?.length,accessibleWhenDisabled:!0,onClick:()=>r(!0),children:(0,TS.__)("Change template")}),t&&(0,Da.jsx)(zY,{onRequestClose:()=>r(!1),onSelect:e})]})}function vit({onSelect:e}){let[t,r]=(0,PS.useState)(""),o=sP(),n=(0,PS.useMemo)(()=>o.map(s=>({name:s.slug,blocks:(0,P1e.parse)(s.content.raw),title:(0,x1e.decodeEntities)(s.title.rendered),id:s.id,isDefault:s.isDefault})),[o]),i=(0,PS.useMemo)(()=>S1e(n,t),[n,t]);return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(kS.SearchControl,{onChange:r,value:t,label:(0,TS.__)("Search"),placeholder:(0,TS.__)("Search"),className:"editor-post-template__swap-template-search"}),(0,Da.jsx)(C1e.__experimentalBlockPatternsList,{label:(0,TS.__)("Templates"),blockPatterns:i,onClickPattern:e})]})}var R1e=a(G(),1),A1e=a(j(),1),I1e=a(Y(),1),O1e=a(le(),1);var N1e=a(T(),1);function M1e({onClick:e}){let t=MY(),r=Iy(),{postType:o,postId:n}=Ay(),{editEntityRecord:i}=(0,I1e.useDispatch)(O1e.store);return!t||!r?null:(0,N1e.jsx)(R1e.MenuItem,{onClick:()=>{i("postType",o,n,{template:""},{undoIgnore:!0}),e()},children:(0,A1e.__)("Use default template")})}var F1e=a(G(),1),D1e=a(j(),1),L1e=a(Y(),1),V1e=a(le(),1),B1e=a(U(),1);var Ny=a(T(),1);function j1e(){let{canCreateTemplates:e}=(0,L1e.useSelect)(n=>{let{canUser:i}=n(V1e.store);return{canCreateTemplates:i("create",{kind:"postType",name:"wp_template"})}},[]),[t,r]=(0,B1e.useState)(!1),o=Iy();return!e||!o?null:(0,Ny.jsxs)(Ny.Fragment,{children:[(0,Ny.jsx)(F1e.MenuItem,{onClick:()=>{r(!0)},children:(0,D1e.__)("Create new template")}),t&&(0,Ny.jsx)(Tg,{onClose:()=>{r(!1)}})]})}var La=a(T(),1);function W1e(){let{isTemplateHidden:e,onNavigateToEntityRecord:t,getEditorSettings:r,hasGoBack:o,hasSpecificTemplate:n,id:i}=(0,Up.useSelect)(S=>{let{getRenderingMode:x,getEditorSettings:C,getCurrentPost:A,getCurrentTemplateId:P}=q(S(I)),R=C(),N=A();return{isTemplateHidden:x()==="post-only",onNavigateToEntityRecord:R.onNavigateToEntityRecord,getEditorSettings:C,hasGoBack:R.hasOwnProperty("onNavigateToPreviousEntityRecord"),hasSpecificTemplate:!!N.template,id:P()}},[]),{get:s}=(0,Up.useSelect)(U1e.store),{editedRecord:l,hasResolved:c}=(0,RS.useEntityRecord)("postType","wp_template",i),{getEntityRecord:u}=(0,Up.useSelect)(RS.store),{editEntityRecord:d}=(0,Up.useDispatch)(RS.store),{createSuccessNotice:f}=(0,Up.useDispatch)(H1e.store),{setRenderingMode:m,setDefaultRenderingMode:h}=q((0,Up.useDispatch)(I)),g=(0,Up.useSelect)(S=>!!S(RS.store).canUser("create",{kind:"postType",name:"wp_template"}),[]),[v,b]=(0,k6.useState)(null),_=(0,k6.useMemo)(()=>({anchor:v,className:"editor-post-template__dropdown",placement:"left-start",offset:36,shift:!0}),[v]);if(!c)return null;let y=o?[{label:(0,My.__)("Go back"),onClick:()=>r().onNavigateToPreviousEntityRecord()}]:void 0,w=()=>{s("core/edit-site","welcomeGuideTemplate")||f((0,My.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:y})};return(0,La.jsx)(fr,{label:(0,My.__)("Template"),ref:b,children:(0,La.jsx)(Ag.DropdownMenu,{popoverProps:_,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},label:(0,My.__)("Template options"),text:(0,z1e.decodeEntities)(l.title),icon:null,children:({onClose:S})=>(0,La.jsxs)(La.Fragment,{children:[(0,La.jsxs)(Ag.MenuGroup,{children:[g&&(0,La.jsx)(Ag.MenuItem,{onClick:async()=>{if(t({postId:l.id,postType:"wp_template"}),!n&&window?.__experimentalTemplateActivate){let x=await u("root","site").active_templates;x[l.slug]!==l.id&&d("root","site",void 0,{active_templates:{...x,[l.slug]:l.id}})}S(),w()},children:(0,My.__)("Edit template")}),(0,La.jsx)(k1e,{onClick:S}),(0,La.jsx)(M1e,{onClick:S}),g&&(0,La.jsx)(j1e,{})]}),(0,La.jsx)(Ag.MenuGroup,{children:(0,La.jsx)(Ag.MenuItem,{icon:e?void 0:Io,isSelected:!e,role:"menuitemcheckbox",onClick:()=>{let x=e?"template-locked":"post-only";m(x),h(x)},children:(0,My.__)("Show template")})})]})})})}var HY=a(T(),1);function R6(){let e=SS();return e==="classic"?(0,HY.jsx)(v6,{}):e==="block-theme"?(0,HY.jsx)(W1e,{}):null}var aCe=a(Y(),1),lCe=a(le(),1);var Z1e=a(Ce(),1),X1e=a(U(),1),Q1e=a(Y(),1),J1e=a(j(),1),$1e=a(G(),1);var G1e=a(j(),1),Y1e=a(U(),1),q1e=a(Y(),1),UY=a(Nt(),1),K1e=a(le(),1);var aP={_fields:"id,name",context:"view"},A6={who:"authors",per_page:100,...aP};function I6(e){let{authorId:t,authors:r,postAuthor:o,isLoading:n}=(0,q1e.useSelect)(s=>{let{getUser:l,getUsers:c,isResolving:u}=s(K1e.store),{getEditedPostAttribute:d}=s(I),f=d("author"),m={...A6};return e&&(m.search=e,m.search_columns=["name"]),{authorId:f,authors:c(m),postAuthor:l(f,aP),isLoading:u("getUsers",[m])}},[e]),i=(0,Y1e.useMemo)(()=>{let s=(r??[]).map(u=>({value:u.id,label:(0,UY.decodeEntities)(u.name)})),l=s.findIndex(({value:u})=>o?.id===u),c=[];return l<0&&o?c=[{value:o.id,label:(0,UY.decodeEntities)(o.name)}]:l<0&&!o&&(c=[{value:0,label:(0,G1e.__)("(No author)")}]),[...c,...s]},[r,o]);return{authorId:t,authorOptions:i,postAuthor:o,isLoading:n}}var eCe=a(T(),1);function tCe(){let[e,t]=(0,X1e.useState)(),{editPost:r}=(0,Q1e.useDispatch)(I),{authorId:o,authorOptions:n,isLoading:i}=I6(e),s=l=>{l&&r({author:l})};return(0,eCe.jsx)($1e.ComboboxControl,{label:(0,J1e.__)("Author"),options:n,value:o,onFilterValueChange:(0,Z1e.debounce)(t,300),onChange:s,allowReset:!1,hideLabelFromVision:!0,isLoading:i})}var rCe=a(j(),1),oCe=a(Y(),1),nCe=a(G(),1);var iCe=a(T(),1);function sCe(){let{editPost:e}=(0,oCe.useDispatch)(I),{authorId:t,authorOptions:r}=I6(),o=n=>{let i=Number(n);e({author:i})};return(0,iCe.jsx)(nCe.SelectControl,{className:"post-author-selector",label:(0,rCe.__)("Author"),options:r,onChange:o,value:t,hideLabelFromVision:!0})}var WY=a(T(),1),bit=25;function yit(){return(0,aCe.useSelect)(t=>t(lCe.store).getUsers(A6)?.length>=bit,[])?(0,WY.jsx)(tCe,{}):(0,WY.jsx)(sCe,{})}var O6=yit;var cCe=a(Y(),1);var uCe=a(T(),1);function N6({children:e}){let{hasAssignAuthorAction:t}=(0,cCe.useSelect)(r=>({hasAssignAuthorAction:!!r(I).getCurrentPost()?._links?.["wp:action-assign-author"]}),[]);return t?(0,uCe.jsx)(uo,{supportKeys:"author",children:e}):null}var Fy=a(j(),1),M6=a(G(),1),F6=a(U(),1),dCe=a(Nt(),1),fCe=a(be(),1),pCe=a(Y(),1),mCe=a(le(),1);var Kd=a(T(),1);function wit({isOpen:e,onClick:t}){let{postAuthor:r}=(0,pCe.useSelect)(n=>{let i=n(I).getEditedPostAttribute("author");return{postAuthor:n(mCe.store).getUser(i,aP)}},[]),o=(0,dCe.decodeEntities)(r?.name)||(0,Fy.__)("(No author)");return(0,Kd.jsx)(M6.Button,{size:"compact",variant:"tertiary","aria-expanded":e,"aria-label":(0,Fy.sprintf)((0,Fy.__)("Change author: %s"),o),onClick:t,children:o})}function _it(){let[e,t]=(0,F6.useState)(null),r=(0,F6.useMemo)(()=>({anchor:e,placement:"left-start",offset:36,shift:!0}),[e]);return(0,Kd.jsx)(N6,{children:(0,Kd.jsx)(fr,{label:(0,Fy.__)("Author"),ref:t,children:(0,Kd.jsx)(M6.Dropdown,{popoverProps:r,contentClassName:"editor-post-author__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:o,onToggle:n})=>(0,Kd.jsx)(wit,{isOpen:o,onClick:n}),renderContent:({onClose:o})=>(0,Kd.jsxs)("div",{className:"editor-post-author",children:[(0,Kd.jsx)(fCe.__experimentalInspectorPopoverHeader,{title:(0,Fy.__)("Author"),onClose:o}),(0,Kd.jsx)(O6,{onClose:o})]})})})})}var D6=_it;var Ig=a(j(),1),V6=a(G(),1),B6=a(Y(),1);var L6=a(T(),1),Sit=[{label:(0,Ig._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,Ig.__)("Visitors can add new comments and replies.")},{label:(0,Ig.__)("Closed"),value:"closed",description:[(0,Ig.__)("Visitors cannot add new comments or replies."),(0,Ig.__)("Existing comments remain visible.")].join(" ")}];function xit(){let e=(0,B6.useSelect)(o=>o(I).getEditedPostAttribute("comment_status")??"open",[]),{editPost:t}=(0,B6.useDispatch)(I),r=o=>t({comment_status:o});return(0,L6.jsx)("form",{children:(0,L6.jsx)(V6.__experimentalVStack,{spacing:4,children:(0,L6.jsx)(V6.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,Ig.__)("Comment status"),options:Sit,onChange:r,selected:e})})})}var j6=xit;var uu=a(j(),1),AS=a(G(),1),YY=a(Y(),1),G6=a(U(),1),hCe=a(be(),1),gCe=a(le(),1);var z6=a(j(),1),H6=a(G(),1),U6=a(Y(),1);var GY=a(T(),1);function Cit(){let e=(0,U6.useSelect)(o=>o(I).getEditedPostAttribute("ping_status")??"open",[]),{editPost:t}=(0,U6.useDispatch)(I),r=()=>t({ping_status:e==="open"?"closed":"open"});return(0,GY.jsx)(H6.CheckboxControl,{label:(0,z6.__)("Enable pingbacks & trackbacks"),checked:e==="open",onChange:r,help:(0,GY.jsx)(H6.ExternalLink,{href:(0,z6.__)("https://wordpress.org/documentation/article/trackbacks-and-pingbacks/"),children:(0,z6.__)("Learn more about pingbacks & trackbacks")})})}var W6=Cit;var Zs=a(T(),1),Eit="discussion-panel";function Tit({onClose:e}){return(0,Zs.jsxs)("div",{className:"editor-post-discussion",children:[(0,Zs.jsx)(hCe.__experimentalInspectorPopoverHeader,{title:(0,uu.__)("Discussion"),onClose:e}),(0,Zs.jsxs)(AS.__experimentalVStack,{spacing:4,children:[(0,Zs.jsx)(uo,{supportKeys:"comments",children:(0,Zs.jsx)(j6,{})}),(0,Zs.jsx)(uo,{supportKeys:"trackbacks",children:(0,Zs.jsx)(W6,{})})]})]})}function Pit({isOpen:e,onClick:t}){let{commentStatus:r,pingStatus:o,commentsSupported:n,trackbacksSupported:i}=(0,YY.useSelect)(l=>{let{getEditedPostAttribute:c}=l(I),{getPostType:u}=l(gCe.store),d=u(c("type"));return{commentStatus:c("comment_status")??"open",pingStatus:c("ping_status")??"open",commentsSupported:!!d.supports.comments,trackbacksSupported:!!d.supports.trackbacks}},[]),s;return r==="open"?o==="open"?s=(0,uu._x)("Open",'Adjective: e.g. "Comments are open"'):s=i?(0,uu.__)("Comments only"):(0,uu._x)("Open",'Adjective: e.g. "Comments are open"'):o==="open"?s=n?(0,uu.__)("Pings only"):(0,uu.__)("Pings enabled"):s=(0,uu.__)("Closed"),(0,Zs.jsx)(AS.Button,{size:"compact",className:"editor-post-discussion__panel-toggle",variant:"tertiary","aria-label":(0,uu.__)("Change discussion options"),"aria-expanded":e,onClick:t,children:s})}function Y6(){let{isEnabled:e}=(0,YY.useSelect)(n=>{let{isEditorPanelEnabled:i}=n(I);return{isEnabled:i(Eit)}},[]),[t,r]=(0,G6.useState)(null),o=(0,G6.useMemo)(()=>({anchor:t,placement:"left-start",offset:36,shift:!0}),[t]);return e?(0,Zs.jsx)(uo,{supportKeys:["comments","trackbacks"],children:(0,Zs.jsx)(fr,{label:(0,uu.__)("Discussion"),ref:r,children:(0,Zs.jsx)(AS.Dropdown,{popoverProps:o,className:"editor-post-discussion__panel-dropdown",contentClassName:"editor-post-discussion__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:n,onToggle:i})=>(0,Zs.jsx)(Pit,{isOpen:n,onClick:i}),renderContent:({onClose:n})=>(0,Zs.jsx)(Tit,{onClose:n})})})}):null}var IS=a(j(),1),K6=a(G(),1),Z6=a(Y(),1),vCe=a(U(),1),bCe=a(Nt(),1);var q6=a(T(),1);function lP({hideLabelFromVision:e=!1,updateOnBlur:t=!1}){let{excerpt:r,shouldUseDescriptionLabel:o,usedAttribute:n}=(0,Z6.useSelect)(d=>{let{getCurrentPostType:f,getEditedPostAttribute:m}=d(I),h=f(),g=["wp_template","wp_template_part"].includes(h)?"description":"excerpt";return{excerpt:m(g),shouldUseDescriptionLabel:["wp_template","wp_template_part","wp_block"].includes(h),usedAttribute:g}},[]),{editPost:i}=(0,Z6.useDispatch)(I),[s,l]=(0,vCe.useState)((0,bCe.decodeEntities)(r)),c=d=>{i({[n]:d})},u=o?(0,IS.__)("Write a description (optional)"):(0,IS.__)("Write an excerpt (optional)");return(0,q6.jsx)("div",{className:"editor-post-excerpt",children:(0,q6.jsx)(K6.TextareaControl,{label:u,hideLabelFromVision:e,className:"editor-post-excerpt__textarea",onChange:t?l:c,onBlur:t?()=>c(s):void 0,value:t?s:r,help:o?(0,IS.__)("Write a description"):(0,q6.jsx)(K6.ExternalLink,{href:(0,IS.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt"),children:(0,IS.__)("Learn more about manual excerpts")})})})}var yCe=a(T(),1);function kit({children:e}){return(0,yCe.jsx)(uo,{supportKeys:"excerpt",children:e})}var Dy=kit;var Wp=a(j(),1),du=a(G(),1),uP=a(Y(),1),J6=a(U(),1),_Ce=a(be(),1),KY=a(le(),1),SCe=a(Nt(),1);var X6=a(G(),1),qY=a(T(),1),{Fill:Rit,Slot:Ait}=(0,X6.createSlotFill)("PluginPostExcerpt"),wCe=({children:e,className:t})=>(0,qY.jsx)(Rit,{children:(0,qY.jsx)(X6.PanelRow,{className:t,children:e})});wCe.Slot=Ait;var cP=wCe;var fo=a(T(),1),Q6="post-excerpt";function Iit(){let{isOpened:e,isEnabled:t,postType:r}=(0,uP.useSelect)(s=>{let{isEditorPanelOpened:l,isEditorPanelEnabled:c,getCurrentPostType:u}=s(I);return{isOpened:l(Q6),isEnabled:c(Q6),postType:u()}},[]),{toggleEditorPanelOpened:o}=(0,uP.useDispatch)(I),n=()=>o(Q6);if(!t)return null;let i=["wp_template","wp_template_part","wp_block"].includes(r);return(0,fo.jsx)(du.PanelBody,{title:i?(0,Wp.__)("Description"):(0,Wp.__)("Excerpt"),opened:e,onToggle:n,children:(0,fo.jsx)(cP.Slot,{children:s=>(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(lP,{}),s]})})})}function xCe(){return(0,fo.jsx)(Dy,{children:(0,fo.jsx)(Iit,{})})}function CCe(){return(0,fo.jsx)(Dy,{children:(0,fo.jsx)(Oit,{})})}function Oit(){let{shouldRender:e,excerpt:t,shouldBeUsedAsDescription:r,allowEditing:o}=(0,uP.useSelect)(f=>{let{getCurrentPostType:m,getCurrentPostId:h,getEditedPostAttribute:g,isEditorPanelEnabled:v}=f(I),b=m(),_=["wp_template","wp_template_part"].includes(b),y=b==="wp_block",w=_||y,x=g(_?"description":"excerpt"),C=_&&f(KY.store).getEntityRecord("postType",b,h()),A=!x&&_?Al({template:C,templateTypes:f(KY.store).getCurrentTheme()?.default_template_types})?.description:void 0,P=v(Q6)||w;return{excerpt:x??A,shouldRender:P,shouldBeUsedAsDescription:w,allowEditing:P&&(!w||y||C&&C.source===Rk.custom&&!C.has_theme_file&&C.is_custom)}},[]),[n,i]=(0,J6.useState)(null),s=r?(0,Wp.__)("Description"):(0,Wp.__)("Excerpt"),l=(0,J6.useMemo)(()=>({anchor:n,"aria-label":s,headerTitle:s,placement:"left-start",offset:36,shift:!0}),[n,s]);if(!e)return!1;let c=!!t&&(0,fo.jsx)(du.__experimentalText,{align:"left",numberOfLines:4,truncate:o,children:(0,SCe.decodeEntities)(t)});if(!o)return c;let u=r?(0,Wp.__)("Add a description\u2026"):(0,Wp.__)("Add an excerpt\u2026"),d=r?(0,Wp.__)("Edit description"):(0,Wp.__)("Edit excerpt");return(0,fo.jsxs)(du.__experimentalVStack,{children:[c,(0,fo.jsx)(du.Dropdown,{className:"editor-post-excerpt__dropdown",contentClassName:"editor-post-excerpt__dropdown__content",popoverProps:l,focusOnMount:!0,ref:i,renderToggle:({onToggle:f})=>(0,fo.jsx)(du.Button,{__next40pxDefaultSize:!0,onClick:f,variant:"link",children:c?d:u}),renderContent:({onClose:f})=>(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(_Ce.__experimentalInspectorPopoverHeader,{title:s,onClose:f}),(0,fo.jsx)(du.__experimentalVStack,{spacing:4,children:(0,fo.jsx)(cP.Slot,{children:m=>(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(lP,{hideLabelFromVision:!0,updateOnBlur:!0}),m]})})})]})})]})}var vl=a(j(),1),XY=a(zn(),1),ls=a(G(),1),kCe=a(sI(),1),eF=a(U(),1),RCe=a(Ce(),1),OS=a(Y(),1),Ly=a(be(),1),ACe=a(le(),1);var ECe=a(Y(),1),TCe=a(le(),1);function $6({children:e,supportKeys:t}){let{postType:r,themeSupports:o}=(0,ECe.useSelect)(i=>({postType:i(I).getEditedPostAttribute("type"),themeSupports:i(TCe.store).getThemeSupports()}),[]);return(Array.isArray(t)?t:[t]).some(i=>{let s=o?.[i]??!1;return i==="post-thumbnails"&&Array.isArray(s)?s.includes(r):s})?e:null}var ZY=a(T(),1);function Nit({children:e}){return(0,ZY.jsx)($6,{supportKeys:"post-thumbnails",children:(0,ZY.jsx)(uo,{supportKeys:"thumbnail",children:e})})}var Gp=Nit;var Ti=a(T(),1),PCe=["image"],Mit=(0,vl.__)("Featured image"),Fit=(0,vl.__)("Add a featured image"),Dit=(0,Ti.jsx)("p",{children:(0,vl.__)("To edit the featured image, you need permission to upload media.")});function Lit(e,t){if(!e)return{};let r=(0,XY.applyFilters)("editor.PostFeaturedImage.imageSize","large",e.id,t);if(r in(e?.media_details?.sizes??{}))return{mediaWidth:e.media_details.sizes[r].width,mediaHeight:e.media_details.sizes[r].height,mediaSourceUrl:e.media_details.sizes[r].source_url};let o=(0,XY.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",e.id,t);return o in(e?.media_details?.sizes??{})?{mediaWidth:e.media_details.sizes[o].width,mediaHeight:e.media_details.sizes[o].height,mediaSourceUrl:e.media_details.sizes[o].source_url}:{mediaWidth:e.media_details.width,mediaHeight:e.media_details.height,mediaSourceUrl:e.source_url}}function Vit({currentPostId:e,featuredImageId:t,onUpdateImage:r,onRemoveImage:o,media:n,postType:i,noticeUI:s,noticeOperations:l,isRequestingFeaturedImageMedia:c}){let u=(0,eF.useRef)(!1),[d,f]=(0,eF.useState)(!1),{getSettings:m}=(0,OS.useSelect)(Ly.store),{mediaSourceUrl:h}=Lit(n,e);function g(y){m().mediaUpload({allowedTypes:PCe,filesList:y,onFileChange([w]){if((0,kCe.isBlobURL)(w?.url)){f(!0);return}w&&r(w),f(!1)},onError(w){l.removeAllNotices(),l.createErrorNotice(w)},multiple:!1})}function v(y){return y.alt_text?(0,vl.sprintf)((0,vl.__)("Current image: %s"),y.alt_text):(0,vl.sprintf)((0,vl.__)("The current image has no alternative text. The file name is: %s"),y.media_details.sizes?.full?.file||y.slug)}function b(y){u.current&&y&&(y.focus(),u.current=!1)}let _=!c&&!!t&&!n;return(0,Ti.jsxs)(Gp,{children:[s,(0,Ti.jsxs)("div",{className:"editor-post-featured-image",children:[n&&(0,Ti.jsx)("div",{id:`editor-post-featured-image-${t}-describedby`,className:"hidden",children:v(n)}),(0,Ti.jsx)(Ly.MediaUploadCheck,{fallback:Dit,children:(0,Ti.jsx)(Ly.MediaUpload,{title:i?.labels?.featured_image||Mit,onSelect:r,unstableFeaturedImageFlow:!0,allowedTypes:PCe,modalClass:"editor-post-featured-image__media-modal",render:({open:y})=>(0,Ti.jsxs)("div",{className:"editor-post-featured-image__container",children:[_?(0,Ti.jsx)(ls.Notice,{status:"warning",isDismissible:!1,children:(0,vl.__)("Could not retrieve the featured image data.")}):(0,Ti.jsxs)(ls.Button,{__next40pxDefaultSize:!0,ref:b,className:t?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:y,"aria-label":t?(0,vl.__)("Edit or replace the featured image"):null,"aria-describedby":t?`editor-post-featured-image-${t}-describedby`:null,"aria-haspopup":"dialog",disabled:d,accessibleWhenDisabled:!0,children:[!!t&&n&&(0,Ti.jsx)("img",{className:"editor-post-featured-image__preview-image",src:h,alt:v(n)}),(d||c)&&(0,Ti.jsx)(ls.Spinner,{}),!t&&!d&&(i?.labels?.set_featured_image||Fit)]}),!!t&&(0,Ti.jsxs)(ls.__experimentalHStack,{className:J("editor-post-featured-image__actions",{"editor-post-featured-image__actions-missing-image":_,"editor-post-featured-image__actions-is-requesting-image":c}),children:[(0,Ti.jsx)(ls.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:y,"aria-haspopup":"dialog",variant:_?"secondary":void 0,children:(0,vl.__)("Replace")}),(0,Ti.jsx)(ls.Button,{__next40pxDefaultSize:!0,className:"editor-post-featured-image__action",onClick:()=>{o(),u.current=!0},variant:_?"secondary":void 0,isDestructive:_,children:(0,vl.__)("Remove")})]}),(0,Ti.jsx)(ls.DropZone,{onFilesDrop:g})]}),value:t})})]})]})}var Bit=(0,OS.withSelect)(e=>{let{getEntityRecord:t,getPostType:r,hasFinishedResolution:o}=e(ACe.store),{getCurrentPostId:n,getEditedPostAttribute:i}=e(I),s=i("featured_media");return{media:s?t("postType","attachment",s,{context:"view"}):null,currentPostId:n(),postType:r(i("type")),featuredImageId:s,isRequestingFeaturedImageMedia:!!s&&!o("getEntityRecord",["postType","attachment",s,{context:"view"}])}}),jit=(0,OS.withDispatch)((e,{noticeOperations:t},{select:r})=>{let{editPost:o}=e(I);return{onUpdateImage(n){o({featured_media:n.id})},onDropImage(n){r(Ly.store).getSettings().mediaUpload({allowedTypes:["image"],filesList:n,onFileChange([i]){o({featured_media:i.id})},onError(i){t.removeAllNotices(),t.createErrorNotice(i)},multiple:!1})},onRemoveImage(){o({featured_media:0})}}}),dP=(0,RCe.compose)(ls.withNotices,Bit,jit,(0,ls.withFilters)("editor.PostFeaturedImage"))(Vit);var ICe=a(j(),1),OCe=a(G(),1),tF=a(Y(),1),NCe=a(le(),1);var NS=a(T(),1),QY="featured-image";function rF({withPanelBody:e=!0}){let{postType:t,isEnabled:r,isOpened:o}=(0,tF.useSelect)(i=>{let{getEditedPostAttribute:s,isEditorPanelEnabled:l,isEditorPanelOpened:c}=i(I),{getPostType:u}=i(NCe.store);return{postType:u(s("type")),isEnabled:l(QY),isOpened:c(QY)}},[]),{toggleEditorPanelOpened:n}=(0,tF.useDispatch)(I);return r?e?(0,NS.jsx)(Gp,{children:(0,NS.jsx)(OCe.PanelBody,{title:t?.labels?.featured_image??(0,ICe.__)("Featured image"),opened:o,onToggle:()=>n(QY),children:(0,NS.jsx)(dP,{})})}):(0,NS.jsx)(Gp,{children:(0,NS.jsx)(dP,{})}):null}var Xs=a(j(),1),oF=a(G(),1),nF=a(Y(),1),DCe=a(Ce(),1),LCe=a(le(),1);var MCe=a(Y(),1);var FCe=a(T(),1);function MS({children:e}){return(0,MCe.useSelect)(r=>r(I).getEditorSettings().disablePostFormats,[])?null:(0,FCe.jsx)(uo,{supportKeys:"post-formats",children:e})}var Vy=a(T(),1),fP=[{id:"aside",caption:(0,Xs.__)("Aside")},{id:"audio",caption:(0,Xs.__)("Audio")},{id:"chat",caption:(0,Xs.__)("Chat")},{id:"gallery",caption:(0,Xs.__)("Gallery")},{id:"image",caption:(0,Xs.__)("Image")},{id:"link",caption:(0,Xs.__)("Link")},{id:"quote",caption:(0,Xs.__)("Quote")},{id:"standard",caption:(0,Xs.__)("Standard")},{id:"status",caption:(0,Xs.__)("Status")},{id:"video",caption:(0,Xs.__)("Video")}].sort((e,t)=>{let r=e.caption.toUpperCase(),o=t.caption.toUpperCase();return ro?1:0});function pP(){let t=`post-format-selector-${(0,DCe.useInstanceId)(pP)}`,{postFormat:r,suggestedFormat:o,supportedFormats:n}=(0,nF.useSelect)(u=>{let{getEditedPostAttribute:d,getSuggestedPostFormat:f}=u(I),m=d("format"),h=u(LCe.store).getThemeSupports();return{postFormat:m??"standard",suggestedFormat:f(),supportedFormats:h.formats}},[]),i=fP.filter(u=>n?.includes(u.id)||r===u.id),s=i.find(u=>u.id===o),{editPost:l}=(0,nF.useDispatch)(I),c=u=>l({format:u});return(0,Vy.jsx)(MS,{children:(0,Vy.jsxs)("div",{className:"editor-post-format",children:[(0,Vy.jsx)(oF.RadioControl,{className:"editor-post-format__options",label:(0,Xs.__)("Post Format"),selected:r,onChange:u=>c(u),id:t,options:i.map(u=>({label:u.caption,value:u.id})),hideLabelFromVision:!0}),s&&s.id!==r&&(0,Vy.jsx)("p",{className:"editor-post-format__suggestion",children:(0,Vy.jsx)(oF.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>c(s.id),children:(0,Xs.sprintf)((0,Xs.__)("Apply suggested format: %s"),s.caption)})})]})})}var Og=a(j(),1),JY=a(G(),1),mP=a(Y(),1);var $Y=a(vo(),1);var VCe=a(Y(),1);var BCe=a(T(),1);function zit({children:e}){let{lastRevisionId:t,revisionsCount:r}=(0,VCe.useSelect)(o=>{let{getCurrentPostLastRevisionId:n,getCurrentPostRevisionsCount:i}=o(I);return{lastRevisionId:n(),revisionsCount:i()}},[]);return!t||r<2?null:(0,BCe.jsx)(uo,{supportKeys:"revisions",children:e})}var By=zit;var FS=a(T(),1);function jCe(){return(0,mP.useSelect)(e=>{let{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:r,getEditorSettings:o}=e(I);return{lastRevisionId:t(),revisionsCount:r(),disableVisualRevisions:!!o().disableVisualRevisions}},[])}function Hit(){let{lastRevisionId:e,revisionsCount:t,disableVisualRevisions:r}=jCe(),{setCurrentRevisionId:o}=q((0,mP.useDispatch)(I)),n=r?{href:(0,$Y.addQueryArgs)("revision.php",{revision:e})}:{onClick:()=>o(e)};return(0,FS.jsx)(By,{children:(0,FS.jsx)(JY.Button,{__next40pxDefaultSize:!0,...n,className:"editor-post-last-revision__title",icon:yf,iconPosition:"right",text:(0,Og.sprintf)((0,Og.__)("Revisions (%s)"),t)})})}function zCe(){let{lastRevisionId:e,revisionsCount:t,disableVisualRevisions:r}=jCe(),{setCurrentRevisionId:o}=q((0,mP.useDispatch)(I)),n=r?{href:(0,$Y.addQueryArgs)("revision.php",{revision:e})}:{onClick:()=>o(e)};return(0,FS.jsx)(By,{children:(0,FS.jsx)(fr,{label:(0,Og.__)("Revisions"),children:(0,FS.jsx)(JY.Button,{...n,className:"editor-private-post-last-revision__button",text:t,"aria-label":(0,Og.sprintf)((0,Og._n)("Open revisions screen: %d revision","Open revisions screen: %d revisions",t),t),variant:"tertiary",size:"compact"})})})}var iF=Hit;var HCe=a(G(),1);var sF=a(T(),1);function Uit(){return(0,sF.jsx)(By,{children:(0,sF.jsx)(HCe.PanelBody,{className:"editor-post-last-revision__panel",children:(0,sF.jsx)(iF,{})})})}var UCe=Uit;var li=a(j(),1),pu=a(G(),1),gP=a(Y(),1),rq=a(vo(),1),hP=a(U(),1),DS=a(zn(),1),KCe=a(Ce(),1),oq=a(le(),1);var fu=a(j(),1),Wit="authentication-failed",Git="connection-expired",Yit="connection-limit-exceeded",WCe="document-size-limit-exceeded",tq="protocol-mismatch",GCe="unknown-error",eq={[Wit]:{title:(0,fu.__)("Unable to connect"),description:(0,fu.__)("Real-time collaboration couldn't verify your permissions. Check that you have access to edit this post or contact your site administrator.")},[Git]:{title:(0,fu.__)("Connection expired"),description:(0,fu.__)("Your connection to real-time collaboration has timed out. Editing is paused to prevent conflicts with other editors.")},[Yit]:{title:(0,fu.__)("Too many editors connected"),description:(0,fu.__)("Real-time collaboration has reached its connection limit. Try again later or contact your site administrator.")},[tq]:{title:(0,fu.__)("Protocol update"),description:(0,fu.__)("Real-time collaboration has been updated. Please refresh the page to continue editing.")},[GCe]:{title:(0,fu.__)("Connection lost"),description:(0,fu.__)("The connection to real-time collaboration was interrupted. Editing is paused to prevent conflicts with other editors.")}};function YCe(e){return e?.code&&eq[e?.code]?eq[e.code]:eq[GCe]}var Jr=a(T(),1);function qCe(){let{isCollaborationSupported:e,syncConnectionStatus:t}=(0,gP.useSelect)(r=>{let{isCollaborationSupported:o,getSyncConnectionStatus:n}=q(r(oq.store));return{isCollaborationSupported:o(),syncConnectionStatus:n()}},[]);return e?null:WCe===t?.error?.code?(0,Jr.jsx)("p",{children:(0,li.__)("Because this post is too large for real-time collaboration, only one person can edit at a time.")}):(0,Jr.jsx)("p",{children:(0,li.__)("Because this post uses plugins that aren\u2019t compatible with real-time collaboration, only one person can edit at a time.")})}function ZCe(){let t="core/editor/post-locked-modal-"+(0,KCe.useInstanceId)(ZCe),{autosave:r,updatePostLock:o}=(0,gP.useDispatch)(I),{isCollaborationEnabled:n,isLocked:i,isTakeover:s,user:l,postId:c,postLockUtils:u,activePostLock:d,postType:f,previewLink:m}=(0,gP.useSelect)(y=>{let{isPostLocked:w,isPostLockTakeover:S,getPostLockUser:x,getCurrentPostId:C,getActivePostLock:A,getEditedPostAttribute:P,getEditedPostPreviewLink:R,getEditorSettings:N,isCollaborationEnabledForCurrentPost:k}=q(y(I)),{getPostType:E}=y(oq.store);return{isCollaborationEnabled:k(),isLocked:w(),isTakeover:S(),user:x(),postId:C(),postLockUtils:N().postLockUtils,activePostLock:A(),postType:E(P("type")),previewLink:R()}},[]);if((0,hP.useEffect)(()=>{function y(x){i||(x["wp-refresh-post-lock"]={lock:d,post_id:c})}function w(x){if(!x["wp-refresh-post-lock"])return;let C=x["wp-refresh-post-lock"];C.lock_error?(r(),o({isLocked:!0,isTakeover:!0,user:{name:C.lock_error.name,avatar:C.lock_error.avatar_src_2x}})):C.new_lock&&o({isLocked:!1,activePostLock:C.new_lock})}function S(){if(i||!d)return;let x=new window.FormData;if(x.append("action","wp-remove-post-lock"),x.append("_wpnonce",u.unlockNonce),x.append("post_ID",c),x.append("active_post_lock",d),window.navigator.sendBeacon)window.navigator.sendBeacon(u.ajaxUrl,x);else{let C=new window.XMLHttpRequest;C.open("POST",u.ajaxUrl,!1),C.send(x)}}return(0,DS.addAction)("heartbeat.send",t,y),(0,DS.addAction)("heartbeat.tick",t,w),window.addEventListener("beforeunload",S),()=>{(0,DS.removeAction)("heartbeat.send",t),(0,DS.removeAction)("heartbeat.tick",t),window.removeEventListener("beforeunload",S)}},[]),!i||n)return null;let h=l.name,g=l.avatar,v=(0,rq.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:c,action:"edit",_wpnonce:u.nonce}),b=(0,rq.addQueryArgs)("edit.php",{post_type:f?.slug}),_=(0,li.__)("Exit editor");return(0,Jr.jsx)(pu.Modal,{title:s?(0,li.__)("Someone else has taken over this post"):(0,li.__)("This post is already being edited"),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal",size:"medium",children:(0,Jr.jsxs)(pu.__experimentalHStack,{alignment:"top",spacing:6,children:[!!g&&(0,Jr.jsx)("img",{src:g,alt:(0,li.__)("Avatar"),className:"editor-post-locked-modal__avatar",width:64,height:64}),(0,Jr.jsxs)("div",{children:[!!s&&(0,Jr.jsxs)(Jr.Fragment,{children:[(0,Jr.jsx)("p",{children:(0,hP.createInterpolateElement)(h?(0,li.sprintf)((0,li.__)("%s now has editing control of this post ( ). Don\u2019t worry, your changes up to this moment have been saved."),h):(0,li.__)("Another user now has editing control of this post ( ). Don\u2019t worry, your changes up to this moment have been saved."),{strong:(0,Jr.jsx)("strong",{}),PreviewLink:(0,Jr.jsx)(pu.ExternalLink,{href:m,children:(0,li.__)("preview")})})}),(0,Jr.jsx)(qCe,{})]}),!s&&(0,Jr.jsxs)(Jr.Fragment,{children:[(0,Jr.jsx)("p",{children:(0,hP.createInterpolateElement)(h?(0,li.sprintf)((0,li.__)("%s is currently working on this post ( ), which means you cannot make changes, unless you take over."),h):(0,li.__)("Another user is currently working on this post ( ), which means you cannot make changes, unless you take over."),{strong:(0,Jr.jsx)("strong",{}),PreviewLink:(0,Jr.jsx)(pu.ExternalLink,{href:m,children:(0,li.__)("preview")})})}),(0,Jr.jsx)(qCe,{}),(0,Jr.jsx)("p",{children:(0,li.__)("If you take over, the other user will lose editing control to the post, but their changes will be saved.")})]}),(0,Jr.jsxs)(pu.__experimentalHStack,{className:"editor-post-locked-modal__buttons",justify:"flex-end",children:[!s&&(0,Jr.jsx)(pu.Button,{__next40pxDefaultSize:!0,variant:"tertiary",href:v,children:(0,li.__)("Take over")}),(0,Jr.jsx)(pu.Button,{__next40pxDefaultSize:!0,variant:"primary",href:b,children:_})]})]})]})})}var XCe=ZCe;var JCe=a(j(),1),$Ce=a(G(),1),lF=a(Y(),1);var QCe=a(Y(),1);function qit({children:e}){let{hasPublishAction:t,isPublished:r}=(0,QCe.useSelect)(o=>{let{isCurrentPostPublished:n,getCurrentPost:i}=o(I);return{hasPublishAction:i()._links?.["wp:action-publish"]??!1,isPublished:n()}},[]);return r||!t?null:e}var aF=qit;var nq=a(T(),1);function Kit(){let e=(0,lF.useSelect)(o=>o(I).getEditedPostAttribute("status"),[]),{editPost:t}=(0,lF.useDispatch)(I),r=()=>{t({status:e==="pending"?"draft":"pending"})};return(0,nq.jsx)(aF,{children:(0,nq.jsx)($Ce.CheckboxControl,{label:(0,JCe.__)("Pending review"),checked:e==="pending",onChange:r})})}var eEe=Kit;var tEe=a(U(),1),Yp=a(G(),1),jy=a(j(),1),cF=a(Y(),1),rEe=a(zn(),1),oEe=a(le(),1);var Va=a(T(),1);function Zit(){let e=(0,tEe.renderToString)((0,Va.jsxs)("div",{className:"editor-post-preview-button__interstitial-message",children:[(0,Va.jsxs)(Yp.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96",children:[(0,Va.jsx)(Yp.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),(0,Va.jsx)(Yp.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})]}),(0,Va.jsx)("p",{children:(0,jy.__)("Generating preview\u2026")})]}));return e+=`
`,e=(0,rEe.applyFilters)("editor.PostPreview.interstitialMarkup",e),e}function Xit(e,t){e.write(t),e.title=(0,jy.__)("Generating preview\u2026"),e.close()}async function Qit(e){try{return e.document}catch{}e.location="about:blank";let t=1e3,r=50,o=Date.now()+t;do{await new Promise(n=>setTimeout(n,r));try{return e.document}catch{}}while(Date.now(){let m=f(I),v=f(oEe.store).getPostType(m.getCurrentPostType("type"))?.viewable??!1;return v?{postId:m.getCurrentPostId(),currentPostLink:m.getCurrentPostAttribute("link"),previewLink:m.getEditedPostPreviewLink(),isSaveable:m.isEditedPostSaveable(),isViewable:v}:{isViewable:v}},[]),{__unstableSaveForPreview:l}=(0,cF.useDispatch)(I);if(!s)return null;let c=`wp-preview-${r}`;return{href:n||o,target:c,disabled:!i,onClick:async f=>{f.preventDefault();let m=window.open("",c);m.focus(),await Jit(m);let h=await l({forceIsAutosaveable:e});m.location=h,t?.()}}}function iEe({forceIsAutosaveable:e,onPreview:t}){let r=nEe({forceIsAutosaveable:e,onPreview:t});return r?(0,Va.jsx)(Yp.MenuItem,{icon:gs,...r,children:(0,jy.__)("Preview in new tab")}):null}function LS({className:e,textContent:t,forceIsAutosaveable:r,role:o,onPreview:n}){let i=nEe({forceIsAutosaveable:r,onPreview:n});return i?(0,Va.jsx)(Yp.Button,{variant:e?void 0:"tertiary",className:e||"editor-post-preview",role:o,size:"compact",accessibleWhenDisabled:!0,...i,children:t||(0,Va.jsxs)(Va.Fragment,{children:[(0,jy._x)("Preview","imperative verb"),(0,Va.jsx)(Yt,{render:(0,Va.jsx)("span",{}),children:(0,jy.__)("(opens in a new tab)")})]})}):null}var cEe=a(G(),1),dF=a(Y(),1);var Ng=a(j(),1),sEe=a(Y(),1),aEe=a(Ce(),1);function uF(){let e=(0,aEe.useViewportMatch)("medium","<"),{isPublished:t,isBeingScheduled:r,isSaving:o,isPublishing:n,hasPublishAction:i,isAutosaving:s,hasNonPostEntityChanges:l,postStatusHasChanged:c,postStatus:u,isPostSavingLocked:d}=(0,sEe.useSelect)(f=>{let{isCurrentPostPublished:m,isEditedPostBeingScheduled:h,isSavingPost:g,isPublishingPost:v,getCurrentPost:b,isAutosavingPost:_,getPostEdits:y,getEditedPostAttribute:w}=f(I);return{isPublished:m(),isBeingScheduled:h(),isSaving:g(),isPublishing:v(),hasPublishAction:b()._links?.["wp:action-publish"]??!1,isAutosaving:_(),hasNonPostEntityChanges:f(I).hasNonPostEntityChanges(),isPostSavingLocked:f(I).isPostSavingLocked(),postStatusHasChanged:!!y()?.status,postStatus:w("status")}},[]);return n?(0,Ng.__)("Publishing\u2026"):(t||r)&&o&&!s?(0,Ng.__)("Saving\u2026"):i?l&&!d||t||c&&!["future","publish"].includes(u)||!c&&u==="future"?(0,Ng.__)("Save"):r?(0,Ng.__)("Schedule"):(0,Ng.__)("Publish"):e?(0,Ng.__)("Publish"):(0,Ng.__)("Submit for Review")}var iq=a(T(),1),lEe=()=>{};function $it({forceIsDirty:e,isOpen:t,isToggle:r,onSubmit:o=lEe,onToggle:n,setEntitiesSavedStatesCallback:i}){let{hasPublishAction:s,isBeingScheduled:l,isPostSavingLocked:c,isPublishable:u,isPublished:d,isSaveable:f,isSaving:m,isAutoSaving:h,visibility:g,hasNonPostEntityChanges:v,isSavingNonPostEntityChanges:b,postStatus:_,postStatusHasChanged:y,postType:w,postId:S}=(0,dF.useSelect)(z=>{let L=z(I);return{isSaving:L.isSavingPost(),isAutoSaving:L.isAutosavingPost(),isBeingScheduled:L.isEditedPostBeingScheduled(),visibility:L.getEditedPostVisibility(),isSaveable:L.isEditedPostSaveable(),isPostSavingLocked:L.isPostSavingLocked(),isPublishable:L.isEditedPostPublishable(),isPublished:L.isCurrentPostPublished(),hasPublishAction:!!L.getCurrentPost()?._links?.["wp:action-publish"],postType:L.getCurrentPostType(),postId:L.getCurrentPostId(),postStatus:L.getEditedPostAttribute("status"),postStatusHasChanged:L.getPostEdits()?.status,hasNonPostEntityChanges:L.hasNonPostEntityChanges(),isSavingNonPostEntityChanges:L.isSavingNonPostEntityChanges()}},[]),{editPost:x,savePost:C}=(0,dF.useDispatch)(I),A=z=>{x({status:z},{undoIgnore:!0}),C()},P=z=>(...L)=>{if(v&&i){let O=B=>{B&&B.some(W=>W.kind==="postType"&&W.name===w&&W.key===S)&&z(...L)};return i(()=>O),lEe}return z(...L)},R=c||b||(m||!f||!u&&!e)&&!v,N=c||b||(d||m||!f||!u&&!e)&&!v,k="publish";y?k=_:s?g==="private"?k="private":l&&(k="future"):k="pending";let E=()=>{R||(o(),A(k))},M=()=>{N||n()},V={"aria-disabled":R,className:"editor-post-publish-button",isBusy:!h&&m,variant:"primary",onClick:P(E),"aria-haspopup":v?"dialog":void 0},F={"aria-disabled":N,"aria-expanded":t,className:"editor-post-publish-panel__toggle",isBusy:m&&d,variant:"primary",size:"compact",onClick:P(M),"aria-haspopup":v?"dialog":void 0},D=r?F:V;return(0,iq.jsx)(cEe.Button,{...D,className:`${D.className} editor-post-publish-button__button`,size:"compact",children:(0,iq.jsx)(uF,{})})}var VS=$it;var kF=a(j(),1),YS=a(U(),1),Xy=a(G(),1),RF=a(Y(),1),Lg=a(Ce(),1);var nTe=a(le(),1);var mu=a(j(),1),SP=a(G(),1),YEe=a(Y(),1);var qEe=a(vo(),1),KEe=a(le(),1),ZEe=a(Nt(),1);var BS=a(j(),1),uEe=a(U(),1),jS=a(G(),1),dEe=a(Ce(),1),pF=a(Y(),1),fEe=a(be(),1);var zy=a(j(),1),fF=[{label:(0,zy.__)("Public"),value:"public",description:(0,zy.__)("Visible to everyone.")},{label:(0,zy.__)("Private"),value:"private",description:(0,zy.__)("Only visible to site admins and editors.")},{label:(0,zy.__)("Password protected"),value:"password",description:(0,zy.__)("Only visible to those who know the password.")}];var Hy=a(T(),1);function vP({onClose:e}){let t=(0,dEe.useInstanceId)(vP),{status:r,visibility:o,password:n}=(0,pF.useSelect)(d=>({status:d(I).getEditedPostAttribute("status"),visibility:d(I).getEditedPostVisibility(),password:d(I).getEditedPostAttribute("password")})),{editPost:i}=(0,pF.useDispatch)(I),[s,l]=(0,uEe.useState)(!!n);function c(d){i({public:{status:o==="private"?"draft":r,password:""},private:{status:"private",password:""},password:{status:o==="private"?"draft":r,password:n||""}}[d]),l(d==="password")}let u=d=>{i({password:d})};return(0,Hy.jsxs)("div",{className:"editor-post-visibility",children:[(0,Hy.jsx)(fEe.__experimentalInspectorPopoverHeader,{title:(0,BS.__)("Visibility"),help:(0,BS.__)("Control how this post is viewed."),onClose:e}),(0,Hy.jsxs)(jS.__experimentalVStack,{spacing:4,children:[(0,Hy.jsx)(jS.RadioControl,{label:(0,BS.__)("Visibility"),hideLabelFromVision:!0,options:fF,selected:s?"password":o,onChange:c}),s&&(0,Hy.jsx)(jS.TextControl,{label:(0,BS.__)("Password"),onChange:u,value:n,placeholder:(0,BS.__)("Use a secure password"),type:"text",id:`editor-post-visibility__password-input-${t}`,maxLength:255})]})]})}var pEe=a(Y(),1);function mF(){return sq()}function sq(){let e=(0,pEe.useSelect)(t=>t(I).getEditedPostVisibility(),[]);return fF.find(t=>t.value===e)?.label}var mEe=a(cn(),1),hEe=a(j(),1),bP=a(Y(),1),gEe=a(be(),1),hF=a(U(),1),vEe=a(le(),1);var aq=a(T(),1),{PrivatePublishDateTimePicker:est}=q(gEe.privateApis);function zS(e){return(0,aq.jsx)(lq,{...e,showPopoverHeaderActions:!0,isCompact:!1})}function lq({onClose:e,showPopoverHeaderActions:t,isCompact:r}){let{postDate:o,postType:n}=(0,bP.useSelect)(h=>({postDate:h(I).getEditedPostAttribute("date"),postType:h(I).getCurrentPostType()}),[]),{editPost:i}=(0,bP.useDispatch)(I),s=h=>i({date:h}),[l,c]=(0,hF.useState)(IE(new Date(o))),u=(0,bP.useSelect)(h=>h(vEe.store).getEntityRecords("postType",n,{status:"publish,future",after:IE(l).toISOString(),before:Jue(l).toISOString(),exclude:[h(I).getCurrentPostId()],per_page:100,_fields:"id,date"}),[l,n]),d=(0,hF.useMemo)(()=>(u||[]).map(({date:h})=>({date:new Date(h)})),[u]),f=(0,mEe.getSettings)(),m=/a(?!\\)/i.test(f.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,aq.jsx)(est,{currentDate:o,onChange:s,is12Hour:m,dateOrder:(0,hEe._x)("dmy","date order"),events:d,onMonthPreviewed:h=>c(vde(h)),onClose:e,isCompact:r,showPopoverHeaderActions:t})}var Qs=a(j(),1),cc=a(cn(),1),yEe=a(Y(),1);function HS(e){return US(e)}function US({full:e=!1}={}){let{date:t,isFloating:r}=(0,yEe.useSelect)(o=>({date:o(I).getEditedPostAttribute("date"),isFloating:o(I).isEditedPostDateFloating()}),[]);return e?wEe(t):tst(t,{isFloating:r})}function wEe(e){let t=(0,cc.getDate)(e),r=rst(),o=(0,cc.dateI18n)((0,Qs._x)("F j, Y g:i\xA0a","post schedule full date format"),t);return(0,Qs.isRTL)()?`${r} ${o}`:`${o} ${r}`}function tst(e,{isFloating:t=!1,now:r=new Date}={}){if(!e||t)return(0,Qs.__)("Immediately");if(!ost(r))return wEe(e);let o=(0,cc.getDate)(e);if(bEe(o,r))return(0,Qs.sprintf)((0,Qs.__)("Today at %s"),(0,cc.dateI18n)((0,Qs._x)("g:i\xA0a","post schedule time format"),o));let n=new Date(r);return n.setDate(n.getDate()+1),bEe(o,n)?(0,Qs.sprintf)((0,Qs.__)("Tomorrow at %s"),(0,cc.dateI18n)((0,Qs._x)("g:i\xA0a","post schedule time format"),o)):o.getFullYear()===r.getFullYear()?(0,cc.dateI18n)((0,Qs._x)("F j g:i\xA0a","post schedule date format without year"),o):(0,cc.dateI18n)((0,Qs._x)("F j, Y g:i\xA0a","post schedule full date format"),o)}function rst(){let{timezone:e}=(0,cc.getSettings)();return e.abbr&&isNaN(Number(e.abbr))?e.abbr:`UTC${e.offset<0?"":"+"}${e.offsetFormatted}`}function ost(e){let{timezone:t}=(0,cc.getSettings)(),r=Number(t.offset),o=-1*(e.getTimezoneOffset()/60);return r===o}function bEe(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}var Yy=a(j(),1),AEe=a(U(),1),fq=a(Y(),1),IEe=a(G(),1),wF=a(le(),1);var Pi=a(j(),1),Gy=a(U(),1),bF=a(G(),1);var Wy=a(Y(),1),vF=a(le(),1),EEe=a(Ce(),1),TEe=a(Ol(),1),PEe=a(It(),1);var gF=a(G(),1),_Ee=a(Y(),1),SEe=a(le(),1);var Uy=a(T(),1),nst=3,ist={per_page:10,orderby:"count",order:"desc",hide_empty:!0,_fields:"id,name,count",context:"view"};function xEe({onSelect:e,taxonomy:t}){let{_terms:r,showTerms:o}=(0,_Ee.useSelect)(i=>{let s=i(SEe.store).getEntityRecords("taxonomy",t.slug,ist);return{_terms:s,showTerms:s?.length>=nst}},[t.slug]);if(!o)return null;let n=Nxe(r);return(0,Uy.jsxs)("div",{className:"editor-post-taxonomies__flat-term-most-used",children:[(0,Uy.jsx)(gF.BaseControl.VisualLabel,{as:"h3",className:"editor-post-taxonomies__flat-term-most-used-label",children:t.labels.most_used}),(0,Uy.jsx)("ul",{role:"list",className:"editor-post-taxonomies__flat-term-most-used-list",children:n.map(i=>(0,Uy.jsx)("li",{children:(0,Uy.jsx)(gF.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>e(i),children:i.name})},i.id))})]})}var yP=a(T(),1),cq=[],kEe=100,CEe={per_page:kEe,_fields:"id,name",context:"view"},REe=(e,t)=>wS(e).toLowerCase()===wS(t).toLowerCase(),uq=(e,t)=>e.map(r=>t.find(o=>REe(o.name,r))?.id).filter(r=>r!==void 0);function dq({slug:e}){let[t,r]=(0,Gy.useState)([]),[o,n]=(0,Gy.useState)(""),i=(0,EEe.useDebounce)(n,500),{terms:s,termIds:l,taxonomy:c,hasAssignAction:u,hasCreateAction:d,hasResolvedTerms:f}=(0,Wy.useSelect)(N=>{let{getCurrentPost:k,getEditedPostAttribute:E}=N(I),{getEntityRecords:M,getEntityRecord:V,hasFinishedResolution:F}=N(vF.store),D=k(),z=V("root","taxonomy",e),L=z?E(z.rest_base):cq,O={...CEe,include:L?.join(","),per_page:-1};return{hasCreateAction:z?D._links?.["wp:action-create-"+z.rest_base]??!1:!1,hasAssignAction:z?D._links?.["wp:action-assign-"+z.rest_base]??!1:!1,taxonomy:z,termIds:L,terms:L?.length?M("taxonomy",e,O):cq,hasResolvedTerms:F("getEntityRecords",["taxonomy",e,O])}},[e]),{searchResults:m}=(0,Wy.useSelect)(N=>{let{getEntityRecords:k}=N(vF.store);return{searchResults:o?k("taxonomy",e,{...CEe,search:o}):cq}},[o,e]);(0,Gy.useEffect)(()=>{if(f){let N=(s??[]).map(k=>wS(k.name));r(N)}},[s,f]);let h=(0,Gy.useMemo)(()=>(m??[]).map(N=>wS(N.name)),[m]),{editPost:g}=(0,Wy.useDispatch)(I),{saveEntityRecord:v}=(0,Wy.useDispatch)(vF.store),{createErrorNotice:b}=(0,Wy.useDispatch)(PEe.store);if(!u)return null;async function _(N){try{let k=await v("taxonomy",e,N,{throwOnError:!0});return kY(k)}catch(k){if(k.code!=="term_exists")throw k;return{id:k.data.term_id,name:N.name}}}function y(N){g({[c.rest_base]:N})}function w(N){let k=[...s??[],...m??[]],E=N.reduce((V,F)=>(V.some(D=>D.toLowerCase()===F.toLowerCase())||V.push(F),V),[]),M=E.filter(V=>!k.find(F=>REe(F.name,V)));if(r(E),M.length===0){y(uq(E,k));return}d&&Promise.all(M.map(V=>_({name:V}))).then(V=>{let F=k.concat(V);y(uq(E,F))}).catch(V=>{b(V.message,{type:"snackbar"}),y(uq(E,k))})}function S(N){if(l.includes(N.id))return;let k=[...l,N.id],E=e==="post_tag"?(0,Pi.__)("Tag"):(0,Pi.__)("Term"),M=(0,Pi.sprintf)((0,Pi._x)("%s added","term"),c?.labels?.singular_name??E);(0,TEe.speak)(M,"assertive"),y(k)}let x=c?.labels?.add_new_item??(e==="post_tag"?(0,Pi.__)("Add Tag"):(0,Pi.__)("Add Term")),C=c?.labels?.singular_name??(e==="post_tag"?(0,Pi.__)("Tag"):(0,Pi.__)("Term")),A=(0,Pi.sprintf)((0,Pi._x)("%s added","term"),C),P=(0,Pi.sprintf)((0,Pi._x)("%s removed","term"),C),R=(0,Pi.sprintf)((0,Pi._x)("Remove %s","term"),C);return(0,yP.jsxs)(ae,{direction:"column",gap:"lg",children:[(0,yP.jsx)(bF.FormTokenField,{value:t,suggestions:h,onChange:w,onInputChange:i,maxSuggestions:kEe,label:x,messages:{added:A,removed:P,remove:R}}),(0,yP.jsx)(xEe,{taxonomy:c,onSelect:S})]})}var yF=(0,bF.withFilters)("editor.PostTaxonomyType")(dq);var qy=a(T(),1),sst=()=>{let e=(0,fq.useSelect)(n=>n(wF.store).getTaxonomy("post_tag")?.labels,[]),t=e?.add_new_item??(0,Yy.__)("Add tag"),r=e?.name??(0,Yy.__)("Tags"),o=[(0,Yy.__)("Suggestion:"),(0,qy.jsx)("span",{className:"editor-post-publish-panel__link",children:t},"label")];return(0,qy.jsxs)(IEe.PanelBody,{initialOpen:!1,title:o,children:[(0,qy.jsx)("p",{children:(0,Yy.sprintf)((0,Yy.__)("%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post."),r)}),(0,qy.jsx)(yF,{slug:"post_tag"})]})},ast=()=>{let{postHasTags:e,siteHasTags:t,isPostTypeSupported:r}=(0,fq.useSelect)(n=>{let i=n(I).getCurrentPostType(),s=n(wF.store).getEntityRecord("root","taxonomy","post_tag"),l=s?.types?.includes(i),c=s!==void 0,u=s&&n(I).getEditedPostAttribute(s.rest_base),d=l?!!n(wF.store).getEntityRecords("taxonomy","post_tag",{per_page:1})?.length:!1;return{postHasTags:!!u?.length,siteHasTags:d,isPostTypeSupported:c&&l}},[]),[o]=(0,AEe.useState)(e);return!r||!t||o?null:(0,qy.jsx)(sst,{})},OEe=ast;var _F=a(G(),1),SF=a(Y(),1),Ky=a(j(),1),NEe=a(le(),1);var Mg=a(T(),1),lst=(e,t)=>fP.filter(o=>e?.includes(o.id)).find(o=>o.id===t),cst=({suggestedPostFormat:e,suggestionText:t,onUpdatePostFormat:r})=>(0,Mg.jsx)(_F.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>r(e),children:t});function MEe(){let{currentPostFormat:e,suggestion:t}=(0,SF.useSelect)(i=>{let{getEditedPostAttribute:s,getSuggestedPostFormat:l}=i(I),c=i(NEe.store).getThemeSupports().formats??[];return{currentPostFormat:s("format"),suggestion:lst(c,l())}},[]),{editPost:r}=(0,SF.useDispatch)(I),o=i=>r({format:i}),n=[(0,Ky.__)("Suggestion:"),(0,Mg.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,Ky.__)("Use a post format")},"label")];return!t||t.id===e?null:(0,Mg.jsxs)(_F.PanelBody,{initialOpen:!1,title:n,children:[(0,Mg.jsx)("p",{children:(0,Ky.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")}),(0,Mg.jsx)("p",{children:(0,Mg.jsx)(cst,{onUpdatePostFormat:o,suggestedPostFormat:t.id,suggestionText:(0,Ky.sprintf)((0,Ky.__)('Apply the "%1$s" format.'),t.caption)})})]})}var CF=a(j(),1),zEe=a(Y(),1),HEe=a(G(),1),hq=a(le(),1),EF=a(U(),1);var ui=a(j(),1),qp=a(U(),1),VEe=a(It(),1),po=a(G(),1),WS=a(Y(),1),BEe=a(Ce(),1),wP=a(le(),1),pq=a(Ol(),1),jEe=a(Nt(),1);var ci=a(T(),1),{normalizeTextString:FEe}=q(po.privateApis),{RECEIVE_INTERMEDIATE_RESULTS:ust}=q(wP.privateApis),DEe={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view",[ust]:!0},dst=8,LEe=[];function fst(e,t){let r=i=>t.indexOf(i.id)!==-1?!0:i.children===void 0?!1:i.children.map(r).filter(s=>s).length>0,o=(i,s)=>{let l=r(i),c=r(s);return l===c?0:l&&!c?-1:!l&&c?1:0},n=[...e];return n.sort(o),n}function pst(e,t,r){return e.find(o=>(!o.parent&&!t||parseInt(o.parent)===parseInt(t))&&o.name.toLowerCase()===r.toLowerCase())}function mst(e){let t=r=>{if(e==="")return r;let o={...r};return o.children.length>0&&(o.children=o.children.map(t).filter(n=>n)),FEe(o.name).indexOf(FEe(e))!==-1||o.children.length>0?o:!1};return t}function mq({slug:e}){let[t,r]=(0,qp.useState)(!1),[o,n]=(0,qp.useState)(""),[i,s]=(0,qp.useState)(""),[l,c]=(0,qp.useState)(!1),[u,d]=(0,qp.useState)(""),[f,m]=(0,qp.useState)([]),h=(0,BEe.useDebounce)(pq.speak,500),{hasCreateAction:g,hasAssignAction:v,terms:b,loading:_,availableTerms:y,taxonomy:w}=(0,WS.useSelect)(te=>{let{getCurrentPost:de,getEditedPostAttribute:pe}=te(I),{getEntityRecord:$,getEntityRecords:oe,isResolving:fe}=te(wP.store),ve=$("root","taxonomy",e),Oe=de();return{hasCreateAction:ve?!!Oe._links?.["wp:action-create-"+ve.rest_base]:!1,hasAssignAction:ve?!!Oe._links?.["wp:action-assign-"+ve.rest_base]:!1,terms:ve?pe(ve.rest_base):LEe,loading:fe("getEntityRecords",["taxonomy",e,DEe]),availableTerms:oe("taxonomy",e,DEe)||LEe,taxonomy:ve}},[e]),{editPost:S}=(0,WS.useDispatch)(I),{saveEntityRecord:x}=(0,WS.useDispatch)(wP.store),C=(0,qp.useMemo)(()=>fst(d6(y),b),[y]),{createErrorNotice:A}=(0,WS.useDispatch)(VEe.store);if(!v)return null;let P=te=>x("taxonomy",e,te,{throwOnError:!0}),R=te=>{S({[w.rest_base]:te})},N=te=>{let pe=b.includes(te)?b.filter($=>$!==te):[...b,te];R(pe)},k=te=>{n(te)},E=te=>{s(te)},M=()=>{c(!l)},V=async te=>{if(te.preventDefault(),o===""||t)return;let de=pst(y,i,o);if(de){b.some(fe=>fe===de.id)||R([...b,de.id]),n(""),s("");return}r(!0);let pe;try{pe=await P({name:o,parent:i||void 0})}catch(fe){A(fe.message,{type:"snackbar"});return}let $=e==="category"?(0,ui.__)("Category"):(0,ui.__)("Term"),oe=(0,ui.sprintf)((0,ui._x)("%s added","term"),w?.labels?.singular_name??$);(0,pq.speak)(oe,"assertive"),r(!1),n(""),s(""),R([...b,pe.id])},F=te=>{let de=C.map(mst(te)).filter(fe=>fe),pe=fe=>{let ve=0;for(let Oe=0;Oete.map(de=>(0,ci.jsxs)("div",{className:"editor-post-taxonomies__hierarchical-terms-choice",children:[(0,ci.jsx)(po.CheckboxControl,{checked:b.indexOf(de.id)!==-1,onChange:()=>{let pe=parseInt(de.id,10);N(pe)},label:(0,jEe.decodeEntities)(de.name)}),!!de.children.length&&(0,ci.jsx)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices",children:D(de.children)})]},de.id)),z=(te,de,pe)=>w?.labels?.[te]??(e==="category"?de:pe),L=z("add_new_item",(0,ui.__)("Add Category"),(0,ui.__)("Add Term")),O=z("new_item_name",(0,ui.__)("Add Category"),(0,ui.__)("Add Term")),B=z("parent_item",(0,ui.__)("Parent Category"),(0,ui.__)("Parent Term")),W=`\u2014 ${B} \u2014`,K=L,Z=w?.labels?.search_items??(0,ui.__)("Search Terms"),Q=w?.name??(0,ui.__)("Terms"),ue=y.length>=dst;return(0,ci.jsxs)(po.Flex,{direction:"column",gap:"4",children:[ue&&!_&&(0,ci.jsx)(po.SearchControl,{label:Z,placeholder:Z,value:u,onChange:F}),_&&(0,ci.jsx)(po.Flex,{justify:"center",style:{height:"40px"},children:(0,ci.jsx)(po.Spinner,{})}),(0,ci.jsx)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",tabIndex:"0",role:"group","aria-label":Q,children:D(u!==""?f:C)}),!_&&g&&(0,ci.jsx)(po.FlexItem,{children:(0,ci.jsx)(po.Button,{__next40pxDefaultSize:!0,onClick:M,className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":l,variant:"link",children:L})}),l&&(0,ci.jsx)("form",{onSubmit:V,children:(0,ci.jsxs)(po.Flex,{direction:"column",gap:"4",children:[(0,ci.jsx)(po.TextControl,{className:"editor-post-taxonomies__hierarchical-terms-input",label:O,value:o,onChange:k,required:!0}),!!y.length&&(0,ci.jsx)(po.TreeSelect,{label:B,noOptionLabel:W,onChange:E,selectedId:i,tree:C}),(0,ci.jsx)(po.FlexItem,{children:(0,ci.jsx)(po.Button,{__next40pxDefaultSize:!0,variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit",children:K})})]})})]})}var xF=(0,po.withFilters)("editor.PostTaxonomyType")(mq);var GS=a(T(),1);function hst(){let{hasNoCategory:e,hasSiteCategories:t}=(0,zEe.useSelect)(i=>{let s=i(I).getCurrentPostType(),{canUser:l,getEntityRecord:c}=i(hq.store),u=c("root","taxonomy","category"),d=l("read",{kind:"root",name:"site"})?c("root","site")?.default_category:void 0,f=d?c("taxonomy","category",d):void 0,m=u&&u.types.some(b=>b===s),h=u&&i(I).getEditedPostAttribute(u.rest_base),g=m?!!i(hq.store).getEntityRecords("taxonomy","category",{exclude:[d],per_page:1})?.length:!1;return{hasNoCategory:!!u&&!!f&&m&&(h?.length===0||h?.length===1&&f?.id===h[0]),hasSiteCategories:g}},[]),[r,o]=(0,EF.useState)(!1);if((0,EF.useEffect)(()=>{e&&o(!0)},[e]),!r||!t)return null;let n=[(0,CF.__)("Suggestion:"),(0,GS.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,CF.__)("Assign a category")},"label")];return(0,GS.jsxs)(HEe.PanelBody,{initialOpen:!1,title:n,children:[(0,GS.jsx)("p",{children:(0,CF.__)("Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.")}),(0,GS.jsx)(xF,{slug:"category"})]})}var UEe=hst;var Zd=a(G(),1),_P=a(Y(),1),Fg=a(j(),1),Zy=a(be(),1),TF=a(U(),1);var uc=a(T(),1),{mediaSideloadFromUrlKey:gst}=q(Zy.privateApis);function WEe(e){let t=[];return e.forEach(r=>{t.push(r),t.push(...WEe(r.innerBlocks))}),t}function vst(e){if(e.name==="core/image"||e.name==="core/cover")return e.attributes.url&&!e.attributes.id;if(e.name==="core/media-text")return e.attributes.mediaUrl&&!e.attributes.mediaId}function gq(e){if(e.name==="core/image"||e.name==="core/cover"){let{url:t,alt:r,id:o}=e.attributes;return{url:t,alt:r,id:o}}if(e.name==="core/media-text"){let{mediaUrl:t,mediaAlt:r,mediaId:o}=e.attributes;return{url:t,alt:r,id:o}}return{}}function bst({clientId:e,alt:t,url:r}){let{selectBlock:o}=(0,_P.useDispatch)(Zy.store);return(0,uc.jsx)(Zd.__unstableMotion.img,{tabIndex:0,role:"button","aria-label":(0,Fg.__)("Select image block."),onClick:()=>{o(e)},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(o(e),n.preventDefault())},alt:t,src:r,animate:{opacity:1},exit:{opacity:0,scale:0},style:{width:"32px",height:"32px",objectFit:"cover",borderRadius:"2px",cursor:"var(--wpds-cursor-control, pointer)"},whileHover:{scale:1.08}},e)}function GEe(){let[e,t]=(0,TF.useState)(!1),[r,o]=(0,TF.useState)(!1),[n,i]=(0,TF.useState)(!1),{editorBlocks:s,mediaSideloadFromUrl:l}=(0,_P.useSelect)(h=>({editorBlocks:h(Zy.store).getBlocks(),mediaSideloadFromUrl:h(Zy.store).getSettings()[gst]}),[]),c=WEe(s).filter(h=>vst(h)),{updateBlockAttributes:u}=(0,_P.useDispatch)(Zy.store);if(!l||!c.length)return null;let d=[(0,Fg.__)("Suggestion:"),(0,uc.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,Fg.__)("External media")},"label")];function f(h,g){(h.name==="core/image"||h.name==="core/cover")&&u(h.clientId,{id:g.id,url:g.url}),h.name==="core/media-text"&&u(h.clientId,{mediaId:g.id,mediaUrl:g.url})}function m(){t(!0),i(!1);let h=new Set(c.map(v=>{let{url:b}=gq(v);return b})),g=Object.fromEntries([...h].map(v=>{let b=new Promise((_,y)=>{l({url:v,onSuccess:w=>_(w),onError:()=>y()})});return[v,b]}));Promise.allSettled(c.map(v=>{let{url:b}=gq(v);return g[b].then(_=>f(v,_)).then(()=>o(!0)).catch(()=>i(!0))})).finally(()=>{t(!1)})}return(0,uc.jsxs)(Zd.PanelBody,{initialOpen:!0,title:d,children:[(0,uc.jsx)("p",{children:(0,Fg.__)("Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.")}),(0,uc.jsxs)("div",{style:{display:"inline-flex",flexWrap:"wrap",gap:"8px"},children:[(0,uc.jsx)(Zd.__unstableAnimatePresence,{onExitComplete:()=>o(!1),children:c.map(h=>{let{url:g,alt:v}=gq(h);return(0,uc.jsx)(bst,{clientId:h.clientId,url:g,alt:v},h.clientId)})}),e||r?(0,uc.jsx)(Zd.Spinner,{}):(0,uc.jsx)(Zd.Button,{size:"compact",variant:"primary",onClick:m,children:(0,Fg._x)("Upload","verb")})]}),n&&(0,uc.jsx)("p",{children:(0,Fg.__)("Upload failed, try again.")})]})}var Nr=a(T(),1);function yst({children:e}){let{isBeingScheduled:t,isRequestingSiteIcon:r,hasPublishAction:o,siteIconUrl:n,siteTitle:i,siteHome:s}=(0,YEe.useSelect)(d=>{let{getCurrentPost:f,isEditedPostBeingScheduled:m}=d(I),{getEntityRecord:h,isResolving:g}=d(KEe.store),v=h("root","__unstableBase",void 0)||{};return{hasPublishAction:f()._links?.["wp:action-publish"]??!1,isBeingScheduled:m(),isRequestingSiteIcon:g("getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:v.site_icon_url,siteTitle:v.name,siteHome:v.home&&(0,qEe.filterURLForDisplay)(v.home)}},[]),l=(0,Nr.jsx)(SP.Icon,{className:"components-site-icon",size:"36px",icon:f8});n&&(l=(0,Nr.jsx)("img",{alt:(0,mu.__)("Site Icon"),className:"components-site-icon",src:n})),r&&(l=null);let c,u;return o?t?(c=(0,mu.__)("Are you ready to schedule?"),u=(0,mu.__)("Your work will be published at the specified date and time.")):(c=(0,mu.__)("Are you ready to publish?"),u=(0,mu.__)("Double-check your settings before publishing.")):(c=(0,mu.__)("Are you ready to submit for review?"),u=(0,mu.__)("Your work will be reviewed and then approved.")),(0,Nr.jsxs)("div",{className:"editor-post-publish-panel__prepublish",children:[(0,Nr.jsx)("div",{children:(0,Nr.jsx)("strong",{children:c})}),(0,Nr.jsx)("p",{children:u}),(0,Nr.jsxs)("div",{className:"components-site-card",children:[l,(0,Nr.jsxs)("div",{className:"components-site-info",children:[(0,Nr.jsx)("span",{className:"components-site-name",children:(0,ZEe.decodeEntities)(i)||(0,mu.__)("(Untitled)")}),(0,Nr.jsx)("span",{className:"components-site-home",children:s})]})]}),(0,Nr.jsx)(GEe,{}),o&&(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(SP.PanelBody,{initialOpen:!1,title:[(0,mu.__)("Visibility:"),(0,Nr.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,Nr.jsx)(mF,{})},"label")],children:(0,Nr.jsx)(vP,{})}),(0,Nr.jsx)(SP.PanelBody,{initialOpen:!1,title:[(0,mu.__)("Publish:"),(0,Nr.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,Nr.jsx)(HS,{})},"label")],children:(0,Nr.jsx)(zS,{})})]}),(0,Nr.jsx)(MEe,{}),(0,Nr.jsx)(OEe,{}),(0,Nr.jsx)(UEe,{}),e]})}var XEe=yst;var gu=a(G(),1),hu=a(j(),1),Dg=a(U(),1),$Ee=a(Y(),1),PF=a(vo(),1),eTe=a(Nt(),1),tTe=a(Ce(),1),rTe=a(le(),1);var qo=a(T(),1),QEe="%postname%",JEe="%pagename%",wst=e=>{let{slug:t}=e;return e.permalink_template.includes(QEe)?e.permalink_template.replace(QEe,t):e.permalink_template.includes(JEe)?e.permalink_template.replace(JEe,t):e.permalink_template};function _st({text:e}){let[t,r]=(0,Dg.useState)(!1),o=(0,Dg.useRef)(),n=(0,tTe.useCopyToClipboard)(e,()=>{r(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{r(!1)},4e3)});return(0,Dg.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),(0,qo.jsx)(gu.Button,{__next40pxDefaultSize:!0,variant:"secondary",ref:n,children:t?(0,hu.__)("Copied!"):(0,hu.__)("Copy")})}function oTe({focusOnMount:e,children:t}){let{post:r,postType:o,isScheduled:n}=(0,$Ee.useSelect)(m=>{let{getEditedPostAttribute:h,getCurrentPost:g,isCurrentPostScheduled:v}=m(I),{getPostType:b}=m(rTe.store);return{post:g(),postType:b(h("type")),isScheduled:v()}},[]),i=o?.labels?.singular_name,s=o?.labels?.view_item,l=o?.labels?.add_new_item,c=r.status==="future"?wst(r):r.link,u=(0,PF.addQueryArgs)("post-new.php",{post_type:r.type}),d=(0,Dg.useCallback)(m=>{e&&m&&m.focus()},[e]),f=n?(0,qo.jsxs)(qo.Fragment,{children:[(0,hu.__)("is now scheduled. It will go live on")," ",(0,qo.jsx)(HS,{}),"."]}):(0,hu.__)("is now live.");return(0,qo.jsxs)("div",{className:"post-publish-panel__postpublish",children:[(0,qo.jsxs)(gu.PanelBody,{className:"post-publish-panel__postpublish-header",children:[(0,qo.jsx)(gu.ExternalLink,{ref:d,href:c,children:(0,eTe.decodeEntities)(r.title)||(0,hu.__)("(no title)")})," ",f]}),(0,qo.jsxs)(gu.PanelBody,{children:[(0,qo.jsx)("p",{className:"post-publish-panel__postpublish-subheader",children:(0,qo.jsx)("strong",{children:(0,hu.__)("What\u2019s next?")})}),(0,qo.jsxs)("div",{className:"post-publish-panel__postpublish-post-address-container",children:[(0,qo.jsx)(gu.TextControl,{className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:(0,hu.sprintf)((0,hu.__)("%s address"),i),value:(0,PF.safeDecodeURIComponent)(c),onFocus:m=>m.target.select()}),(0,qo.jsx)("div",{className:"post-publish-panel__postpublish-post-address__copy-button-wrap",children:(0,qo.jsx)(_st,{text:c})})]}),(0,qo.jsxs)("div",{className:"post-publish-panel__postpublish-buttons",children:[!n&&(0,qo.jsxs)(gu.Button,{variant:"primary",href:c,__next40pxDefaultSize:!0,icon:gs,iconPosition:"right",target:"_blank",children:[s,(0,qo.jsx)(Yt,{render:(0,qo.jsx)("span",{}),children:(0,hu.__)("(opens in a new tab)")})]}),(0,qo.jsx)(gu.Button,{variant:n?"primary":"secondary",__next40pxDefaultSize:!0,href:u,children:l})]})]}),t]})}var Sn=a(T(),1);function AF({forceIsDirty:e,onClose:t,PostPublishExtension:r,PrePublishExtension:o,...n}){let{hasPublishAction:i,isPostTypeViewable:s,isBeingScheduled:l,isDirty:c,isPublished:u,isPublishSidebarEnabled:d,isSaving:f,isSavingNonPostEntityChanges:m,isScheduled:h,currentPostId:g}=(0,RF.useSelect)(N=>{let{getPostType:k}=N(nTe.store),{getCurrentPost:E,getCurrentPostId:M,getEditedPostAttribute:V,isCurrentPostPublished:F,isCurrentPostScheduled:D,isEditedPostBeingScheduled:z,isEditedPostDirty:L,isAutosavingPost:O,isSavingPost:B,isSavingNonPostEntityChanges:W,isPublishSidebarEnabled:K}=N(I),Z=k(V("type"));return{hasPublishAction:E()._links?.["wp:action-publish"]??!1,isPostTypeViewable:Z?.viewable,isBeingScheduled:z(),isDirty:L(),isPublished:F(),isPublishSidebarEnabled:K(),isSaving:B()&&!O(),isSavingNonPostEntityChanges:W(),isScheduled:D(),currentPostId:M()}},[]),{disablePublishSidebar:v,enablePublishSidebar:b}=(0,RF.useDispatch)(I),_=(0,YS.useRef)(null),y=(0,Lg.useMergeRefs)([(0,Lg.useFocusReturn)(),(0,Lg.useConstrainedTabbing)()]);(0,YS.useEffect)(()=>{_.current?.focus()},[]);let w=(0,YS.useRef)(g),S=(0,Lg.useEvent)(t);(0,YS.useEffect)(()=>{let N=g!==w.current;w.current=g,(N||u&&!f&&c)&&S()},[u,f,c,g,S]);function x(){d?v():b()}function C(){(!i||!s)&&t()}let A=u||h&&l,P=!A&&!f,R=A&&!f;return(0,Sn.jsxs)("div",{ref:y,tabIndex:-1,className:"editor-post-publish-panel",...n,children:[(0,Sn.jsx)("div",{className:"editor-post-publish-panel__header",children:R?(0,Sn.jsx)(Xy.Button,{size:"compact",onClick:t,icon:Fi,label:(0,kF.__)("Close panel")}):(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)("div",{className:"editor-post-publish-panel__header-cancel-button",children:(0,Sn.jsx)(Xy.Button,{ref:_,accessibleWhenDisabled:!0,disabled:m,onClick:t,variant:"secondary",size:"compact",children:(0,kF.__)("Cancel")})}),(0,Sn.jsx)("div",{className:"editor-post-publish-panel__header-publish-button",children:(0,Sn.jsx)(VS,{onSubmit:C,forceIsDirty:e})})]})}),(0,Sn.jsxs)("div",{className:"editor-post-publish-panel__content",children:[P&&(0,Sn.jsx)(XEe,{children:o&&(0,Sn.jsx)(o,{})}),R&&(0,Sn.jsx)(oTe,{focusOnMount:!0,children:r&&(0,Sn.jsx)(r,{})}),f&&(0,Sn.jsx)(Xy.Spinner,{})]}),(0,Sn.jsx)("div",{className:"editor-post-publish-panel__footer",children:(0,Sn.jsx)(Xy.CheckboxControl,{label:(0,kF.__)("Always show pre-publish checks."),checked:d,onChange:x})})]})}var DF=a(G(),1),LF=a(Ce(),1),VF=a(Y(),1),BF=a(U(),1),Qy=a(j(),1);var uTe=a(Mo(),1),dTe=a(Lt(),1);var bl=a(G(),1),Sr=a(j(),1),FF=a(Y(),1),xP=a(U(),1),aTe=a(le(),1),lTe=a(be(),1),cTe=a(Ce(),1);var vq=a(j(),1),sTe=a(G(),1),OF=a(Y(),1);var iTe=a(Y(),1);function IF({children:e}){let{hasStickyAction:t,postType:r}=(0,iTe.useSelect)(o=>({hasStickyAction:o(I).getCurrentPost()._links?.["wp:action-sticky"]??!1,postType:o(I).getCurrentPostType()}),[]);return r!=="post"||!t?null:e}var bq=a(T(),1);function NF(){let e=(0,OF.useSelect)(r=>r(I).getEditedPostAttribute("sticky")??!1,[]),{editPost:t}=(0,OF.useDispatch)(I);return(0,bq.jsx)(IF,{children:(0,bq.jsx)(sTe.CheckboxControl,{className:"editor-post-sticky__checkbox-control",label:(0,vq.__)("Sticky"),help:(0,vq.__)("Pin this post to the top of the blog."),checked:e,onChange:()=>t({sticky:!e})})})}var xn=a(T(),1),MF={"auto-draft":{label:(0,Sr.__)("Draft"),icon:f0},draft:{label:(0,Sr.__)("Draft"),icon:f0},pending:{label:(0,Sr.__)("Pending"),icon:w1},private:{label:(0,Sr.__)("Private"),icon:g1},future:{label:(0,Sr.__)("Scheduled"),icon:hm},publish:{label:(0,Sr.__)("Published"),icon:fv}},yq=[{label:(0,Sr.__)("Draft"),value:"draft",description:(0,Sr.__)("Not ready to publish.")},{label:(0,Sr.__)("Pending"),value:"pending",description:(0,Sr.__)("Waiting for review before publishing.")},{label:(0,Sr.__)("Private"),value:"private",description:(0,Sr.__)("Only visible to site admins and editors.")},{label:(0,Sr.__)("Scheduled"),value:"future",description:(0,Sr.__)("Publish automatically on a chosen date.")},{label:(0,Sr.__)("Published"),value:"publish",description:(0,Sr.__)("Visible to everyone.")}];function wq(){let{status:e,date:t,password:r,postId:o,postType:n,canEdit:i}=(0,FF.useSelect)(b=>{let{getEditedPostAttribute:_,getCurrentPostId:y,getCurrentPostType:w,getCurrentPost:S}=b(I);return{status:_("status"),date:_("date"),password:_("password"),postId:y(),postType:w(),canEdit:S()._links?.["wp:action-publish"]??!1}},[]),[s,l]=(0,xP.useState)(!!r),c=(0,cTe.useInstanceId)(wq,"editor-change-status__password-input"),{editEntityRecord:u}=(0,FF.useDispatch)(aTe.store),[d,f]=(0,xP.useState)(null),m=(0,xP.useMemo)(()=>({anchor:d,"aria-label":(0,Sr.__)("Status & visibility"),headerTitle:(0,Sr.__)("Status & visibility"),placement:"left-start",offset:36,shift:!0}),[d]);if(pm.includes(n))return null;let h=({status:b=e,password:_=r,date:y=t})=>{u("postType",n,o,{status:b,date:y,password:_})},g=b=>{l(b),b||h({password:""})},v=b=>{let _=t,y=r;e==="future"&&new Date(t)>new Date&&(_=null),b==="private"&&r&&(y=""),h({status:b,date:_,password:y})};return(0,xn.jsx)(fr,{label:(0,Sr.__)("Status"),ref:f,children:i?(0,xn.jsx)(bl.Dropdown,{className:"editor-post-status",contentClassName:"editor-change-status__content",popoverProps:m,focusOnMount:!0,renderToggle:({onToggle:b,isOpen:_})=>(0,xn.jsx)(bl.Button,{className:"editor-post-status__toggle",variant:"tertiary",size:"compact",onClick:b,icon:MF[e]?.icon,"aria-label":(0,Sr.sprintf)((0,Sr.__)("Change status: %s"),MF[e]?.label),"aria-expanded":_,children:MF[e]?.label}),renderContent:({onClose:b})=>(0,xn.jsxs)(xn.Fragment,{children:[(0,xn.jsx)(lTe.__experimentalInspectorPopoverHeader,{title:(0,Sr.__)("Status & visibility"),onClose:b}),(0,xn.jsx)("form",{onSubmit:_=>{_.preventDefault(),b()},children:(0,xn.jsxs)(bl.__experimentalVStack,{spacing:4,children:[(0,xn.jsx)(bl.RadioControl,{className:"editor-change-status__options",hideLabelFromVision:!0,label:(0,Sr.__)("Status"),options:yq,onChange:v,selected:e==="auto-draft"?"draft":e}),e==="future"&&(0,xn.jsx)("div",{className:"editor-change-status__publish-date-wrapper",children:(0,xn.jsx)(lq,{showPopoverHeaderActions:!1,isCompact:!0})}),e!=="private"&&(0,xn.jsxs)(bl.__experimentalVStack,{as:"fieldset",spacing:4,className:"editor-change-status__password-fieldset",children:[(0,xn.jsx)(bl.CheckboxControl,{label:(0,Sr.__)("Password protected"),help:(0,Sr.__)("Only visible to those who know the password."),checked:s,onChange:g}),s&&(0,xn.jsx)("div",{className:"editor-change-status__password-input",children:(0,xn.jsx)(bl.TextControl,{label:(0,Sr.__)("Password"),onChange:_=>h({password:_}),value:r,placeholder:(0,Sr.__)("Use a secure password"),type:"text",id:c,maxLength:255})})]}),(0,xn.jsx)(NF,{})]})})]})}):(0,xn.jsx)("div",{className:"editor-post-status is-read-only",children:MF[e]?.label})})}var jF=a(T(),1);function zF({forceIsDirty:e}){let[t,r]=(0,BF.useState)(!1),o=(0,LF.useViewportMatch)("small"),{isAutosaving:n,isDirty:i,isNew:s,isPublished:l,isSaveable:c,isSaving:u,isSavingLocked:d,isSavingNonPostEntityChanges:f,isScheduled:m,hasPublishAction:h,showIconLabels:g,postStatus:v,postStatusHasChanged:b,postType:_}=(0,VF.useSelect)(E=>{let M=E(I),{get:V}=E(dTe.store);return{isAutosaving:M.isAutosavingPost(),isDirty:e||M.isEditedPostDirty(),isNew:M.isEditedPostNew(),isPublished:M.isCurrentPostPublished(),isSaving:M.isSavingPost(),isSaveable:M.isEditedPostSaveable(),isSavingLocked:M.isPostSavingLocked(),isSavingNonPostEntityChanges:M.isSavingNonPostEntityChanges(),isScheduled:M.isCurrentPostScheduled(),hasPublishAction:!!M.getCurrentPost()?._links?.["wp:action-publish"],showIconLabels:V("core","showIconLabels"),postStatus:M.getEditedPostAttribute("status"),postStatusHasChanged:!!M.getPostEdits()?.status,postType:M.getCurrentPostType()}},[e]),y=v==="pending",{savePost:w}=(0,VF.useDispatch)(I),S=(0,LF.usePrevious)(u);if((0,BF.useEffect)(()=>{let E;return S&&!u&&(r(!0),E=setTimeout(()=>{r(!1)},1e3)),()=>clearTimeout(E)},[u]),_===Pl||!h&&y)return null;let x=!["pending","draft","auto-draft"].includes(v)&&yq.map(({value:E})=>E).includes(v);if(l||m||x||b&&["pending","draft"].includes(v))return null;let C=y?(0,Qy.__)("Save as pending"):(0,Qy.__)("Save draft"),A=(0,Qy.__)("Save"),P=t||!s&&!i,R=u||P,N=u||P||!c||d||f,k;return u?k=n?(0,Qy.__)("Autosaving"):(0,Qy.__)("Saving"):P?k=(0,Qy.__)("Saved"):o?k=C:g&&(k=A),(0,jF.jsxs)(DF.Button,{className:c||u?J({"editor-post-save-draft":!R,"editor-post-saved-state":R,"is-saving":u,"is-autosaving":n,"is-saved":P,[(0,DF.__unstableGetAnimateClassName)({type:"loading"})]:u}):void 0,onClick:N?void 0:()=>w(),shortcut:N?void 0:uTe.displayShortcut.primary("s"),variant:"tertiary",size:"compact",icon:o?void 0:SV,label:k||C,"aria-disabled":N,children:[R&&(0,jF.jsx)(En,{icon:P?Io:CV}),k]})}var fTe=a(Y(),1);function HF({children:e}){return(0,fTe.useSelect)(r=>r(I).getCurrentPost()._links?.["wp:action-publish"]??!1,[])?e:null}var UF=a(G(),1),KS=a(j(),1),WF=a(U(),1),pTe=a(Y(),1);var qS=a(T(),1);function GF(){let[e,t]=(0,WF.useState)(null),r=(0,pTe.useSelect)(s=>s(I).getCurrentPostType(),[]),o=(0,WF.useMemo)(()=>({anchor:e,"aria-label":(0,KS.__)("Change publish date"),placement:"left-start",offset:36,shift:!0}),[e]),n=US(),i=US({full:!0});return pm.includes(r)?null:(0,qS.jsx)(HF,{children:(0,qS.jsx)(fr,{label:(0,KS.__)("Publish"),ref:t,children:(0,qS.jsx)(UF.Dropdown,{popoverProps:o,focusOnMount:!0,className:"editor-post-schedule__panel-dropdown",contentClassName:"editor-post-schedule__dialog",renderToggle:({onToggle:s,isOpen:l})=>(0,qS.jsx)(UF.Button,{size:"compact",className:"editor-post-schedule__dialog-toggle",variant:"tertiary",tooltipPosition:"middle left",onClick:s,"aria-label":(0,KS.sprintf)((0,KS.__)("Change date: %s"),n),label:i,showTooltip:n!==i,"aria-expanded":l,children:n}),renderContent:({onClose:s})=>(0,qS.jsx)(zS,{onClose:s})})})})}var YF=a(G(),1),ZS=a(j(),1),qF=a(Y(),1),mTe=a(U(),1),hTe=a(qa(),1);var Jy=a(T(),1);function gTe(){(0,hTe.default)("wp.editor.PostSwitchToDraftButton",{since:"6.7",version:"6.9"});let[e,t]=(0,mTe.useState)(!1),{editPost:r,savePost:o}=(0,qF.useDispatch)(I),{isSaving:n,isPublished:i,isScheduled:s}=(0,qF.useSelect)(f=>{let{isSavingPost:m,isCurrentPostPublished:h,isCurrentPostScheduled:g}=f(I);return{isSaving:m(),isPublished:h(),isScheduled:g()}},[]),l=n||!i&&!s,c,u;i?(c=(0,ZS.__)("Are you sure you want to unpublish this post?"),u=(0,ZS.__)("Unpublish")):s&&(c=(0,ZS.__)("Are you sure you want to unschedule this post?"),u=(0,ZS.__)("Unschedule"));let d=()=>{t(!1),r({status:"draft"}),o()};return(0,Jy.jsxs)(Jy.Fragment,{children:[(0,Jy.jsx)(YF.Button,{__next40pxDefaultSize:!0,className:"editor-post-switch-to-draft",onClick:()=>{l||t(!0)},"aria-disabled":l,variant:"secondary",style:{flexGrow:"1",justifyContent:"center"},children:(0,ZS.__)("Switch to draft")}),(0,Jy.jsx)(YF.__experimentalConfirmDialog,{isOpen:e,onConfirm:d,onCancel:()=>t(!1),confirmButtonText:u,children:c})]})}var vTe=a(Y(),1),CP=a(j(),1);var _q=a(T(),1);function KF(){let{syncStatus:e,postType:t}=(0,vTe.useSelect)(r=>{let{getEditedPostAttribute:o}=r(I);return{syncStatus:o("meta")?.wp_pattern_sync_status==="unsynced"?"unsynced":o("wp_pattern_sync_status"),postType:o("type")}});return t!=="wp_block"?null:(0,_q.jsx)(fr,{label:(0,CP.__)("Sync status"),children:(0,_q.jsx)("div",{className:"editor-post-sync-status__value",children:e==="unsynced"?(0,CP._x)("Not synced","pattern (singular)"):(0,CP._x)("Synced","pattern (singular)")})})}var bTe=a(U(),1),yTe=a(Y(),1),wTe=a(le(),1);var Sq=a(T(),1),Sst=e=>e;function xst({taxonomyWrapper:e=Sst}){let{postType:t,taxonomies:r}=(0,yTe.useSelect)(n=>({postType:n(I).getCurrentPostType(),taxonomies:n(wTe.store).getEntityRecords("root","taxonomy")}),[]);return(r??[]).filter(n=>n.types.includes(t)&&n.visibility?.show_ui).map(n=>{let i=n.hierarchical?xF:yF;return(0,Sq.jsx)(bTe.Fragment,{children:e((0,Sq.jsx)(i,{slug:n.slug}),n)},`taxonomy-${n.slug}`)})}var XS=xst;var _Te=a(Y(),1),STe=a(le(),1);function ZF({children:e}){return(0,_Te.useSelect)(r=>{let o=r(I).getCurrentPostType();return r(STe.store).getEntityRecords("root","taxonomy")?.some(i=>i.types.includes(o))},[])?e:null}var xTe=a(G(),1),XF=a(Y(),1);var EP=a(T(),1);function Cst({taxonomy:e,children:t}){let r=e?.slug,o=r?`taxonomy-panel-${r}`:"",{isEnabled:n,isOpened:i}=(0,XF.useSelect)(c=>{let{isEditorPanelEnabled:u,isEditorPanelOpened:d}=c(I);return{isEnabled:r?u(o):!1,isOpened:r?d(o):!1}},[o,r]),{toggleEditorPanelOpened:s}=(0,XF.useDispatch)(I);if(!n)return null;let l=e?.labels?.menu_name;return l?(0,EP.jsx)(xTe.PanelBody,{title:l,opened:i,onToggle:()=>s(o),children:t}):null}function QF(){return(0,EP.jsx)(ZF,{children:(0,EP.jsx)(XS,{taxonomyWrapper:(e,t)=>(0,EP.jsx)(Cst,{taxonomy:t,children:e})})})}var WTe=a(zTe(),1),QS=a(U(),1),Tq=a(j(),1),GTe=a(le(),1),tD=a(Y(),1),YTe=a(Ce(),1);var HTe=1e3;function UTe(e,t){if(Math.max(e.length,t.length)<=HTe)return CG(e,t);let o=0,n=Math.min(e.length,t.length);for(;oo&&s>o&&e[i-1]===t[s-1];)i--,s--;let l=e.slice(o,i),c=t.slice(o,s),u=Math.max(l.length,c.length),d;return u<=HTe?d=CG(l,c):d=rwe(l,c),o>0&&d.unshift({value:e.slice(0,o)}),i{let{getCurrentPostType:d,getCurrentPostId:f,getEditedPostContent:m}=u(I);return{value:m(),type:d(),id:f()}},[]),{editEntityRecord:l}=(0,tD.useDispatch)(GTe.store);(0,QS.useLayoutEffect)(()=>{let u=t.current,d=r.current;if(r.current=n,!u||d===void 0||d===n||!o.current)return;let{selectionStart:f,selectionEnd:m,selectionDirection:h}=o.current,g=UTe(d,n),v=Eq(f,g,d,n),b=Eq(m,g,d,n);u.setSelectionRange(v,b,h),o.current={selectionStart:v,selectionEnd:b,selectionDirection:h}},[n]);let c=u=>{let{selectionStart:d,selectionEnd:f,selectionDirection:m}=u.target;o.current={selectionStart:d,selectionEnd:f,selectionDirection:m}};return(0,Vg.jsxs)(Vg.Fragment,{children:[(0,Vg.jsx)(Yt,{render:(0,Vg.jsx)("label",{htmlFor:`post-content-${e}`}),children:(0,Tq.__)("Type text or HTML")}),(0,Vg.jsx)(WTe.default,{autoComplete:"off",dir:"auto",ref:t,value:n,onChange:u=>{c(u),r.current=u.target.value,l("postType",i,s,{content:u.target.value,blocks:void 0,selection:void 0})},onFocus:c,onMouseUp:c,onKeyUp:c,className:"editor-post-text-editor",id:`post-content-${e}`,placeholder:(0,Tq.__)("Start writing with text or HTML")})]})}var KTe=a(j(),1),$S=a(U(),1),ZTe=a(Nt(),1),lD=a(Y(),1),Pq=a(be(),1),XTe=a(Mo(),1),QTe=a(Pt(),1),ex=a(hd(),1),JTe=a(Ce(),1),kq=a(Mp(),1);var rD="wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text",oD=/[\r\n]+/g;var JS=a(U(),1),qTe=a(Y(),1);function nD(e){let t=(0,JS.useRef)(),{isCleanNewPost:r}=(0,qTe.useSelect)(o=>{let{isCleanNewPost:n}=o(I);return{isCleanNewPost:n()}},[]);return(0,JS.useImperativeHandle)(e,()=>({focus:()=>{t?.current?.focus()}})),(0,JS.useEffect)(()=>{if(!t.current)return;let{defaultView:o}=t.current.ownerDocument,{name:n,parent:i}=o,s=n==="editor-canvas"?i.document:o.document,{activeElement:l,body:c}=s;r&&(!l||c===l)&&t.current.focus()},[r]),{ref:t}}var iD=a(Y(),1);function sD(){let{editPost:e}=(0,iD.useDispatch)(I),{title:t}=(0,iD.useSelect)(o=>{let{getEditedPostAttribute:n}=o(I);return{title:n("title")}},[]);function r(o){e({title:o})}return{title:t,setTitle:r}}var aD=a(T(),1),{useRichText:Lst}=q(ex.privateApis),Vst=(0,$S.forwardRef)((e,t)=>{let{placeholder:r,isEditingContentOnlySection:o,isPreview:n}=(0,lD.useSelect)(k=>{let{getSettings:E,getEditedContentOnlySection:M}=q(k(Pq.store)),{titlePlaceholder:V,isPreviewMode:F}=E();return{placeholder:V,isEditingContentOnlySection:!!M(),isPreview:F}},[]),[i,s]=(0,$S.useState)(!1),{ref:l}=nD(t),{title:c,setTitle:u}=sD(),[d,f]=(0,$S.useState)({}),{clearSelectedBlock:m,insertBlocks:h,insertDefaultBlock:g}=(0,lD.useDispatch)(Pq.store),v=(0,ZTe.decodeEntities)(r)||(0,KTe.__)("Add title"),{value:b,onChange:_,ref:y}=Lst({value:c,onChange(k){u(k.replace(oD," "))},placeholder:v,selectionStart:d.start,selectionEnd:d.end,onSelectionChange(k,E){f(M=>{let{start:V,end:F}=M;return V===k&&F===E?M:{start:k,end:E}})},__unstableDisableFormats:!1});function w(k){h(k,0)}function S(){s(!0),m()}function x(){s(!1),f({})}function C(){g(void 0,void 0,0)}function A(k){k.keyCode===XTe.ENTER&&(k.preventDefault(),C())}function P(k){let E=k.clipboardData,M="",V="";try{M=E.getData("text/plain"),V=E.getData("text/html")}catch{return}let F=(0,QTe.pasteHandler)({HTML:V,plainText:M});if(k.preventDefault(),!!F.length)if(typeof F!="string"){let[D]=F;if(!c&&(D.name==="core/heading"||D.name==="core/paragraph")){let z=(0,kq.__unstableStripHTML)(D.attributes.content);u(z),w(F.slice(1))}else w(F)}else{let D=(0,kq.__unstableStripHTML)(F);_((0,ex.insert)(b,(0,ex.create)({html:D})))}}let R=J(rD,{"is-selected":i}),N=o?{opacity:.2}:void 0;return(0,aD.jsx)("h1",{ref:(0,JTe.useMergeRefs)([y,l]),contentEditable:!o&&!n,className:R,"aria-label":v,role:"textbox","aria-multiline":"true",onFocus:S,onBlur:x,onKeyDown:A,onPaste:P,style:N})}),cD=(0,$S.forwardRef)((e,t)=>(0,aD.jsx)(uo,{supportKeys:"title",children:(0,aD.jsx)(Vst,{ref:t})}));var $Te=a(G(),1),ePe=a(j(),1),tPe=a(Nt(),1),rPe=a(Y(),1),oPe=a(be(),1),uD=a(U(),1);var nPe=a(T(),1);function Bst(e,t){let{placeholder:r}=(0,rPe.useSelect)(h=>{let{getSettings:g}=h(oPe.store),{titlePlaceholder:v}=g();return{placeholder:v}},[]),[o,n]=(0,uD.useState)(!1),{title:i,setTitle:s}=sD(),{ref:l}=nD(t);function c(h){s(h.replace(oD," "))}function u(){n(!0)}function d(){n(!1)}let f=J(rD,{"is-selected":o,"is-raw-text":!0}),m=(0,tPe.decodeEntities)(r)||(0,ePe.__)("Add title");return(0,nPe.jsx)($Te.TextareaControl,{ref:l,value:i,onChange:c,onFocus:u,onBlur:d,label:r,className:f,placeholder:m,hideLabelFromVision:!0,autoComplete:"off",dir:"auto",rows:1})}var dD=(0,uD.forwardRef)(Bst);var tx=a(j(),1),pD=a(G(),1),rx=a(Y(),1),aPe=a(U(),1);var iPe=a(Y(),1),sPe=a(le(),1);function fD({children:e}){let{canTrashPost:t}=(0,iPe.useSelect)(r=>{let{isEditedPostNew:o,getCurrentPostId:n,getCurrentPostType:i}=r(I),{canUser:s}=r(sPe.store),l=i(),c=n(),u=o(),d=c?s("delete",{kind:"postType",name:l,id:c}):!1;return{canTrashPost:(!u||c)&&d&&!EZ.includes(l)}},[]);return t?e:null}var kP=a(T(),1);function ox({onActionPerformed:e}){let t=(0,rx.useRegistry)(),{isNew:r,isDeleting:o,postId:n,title:i}=(0,rx.useSelect)(d=>{let f=d(I);return{isNew:f.isEditedPostNew(),isDeleting:f.isDeletingPost(),postId:f.getCurrentPostId(),title:f.getCurrentPostAttribute("title")}},[]),{trashPost:s}=(0,rx.useDispatch)(I),[l,c]=(0,aPe.useState)(!1);if(r||!n)return null;let u=async()=>{c(!1),await s();let d=await t.resolveSelect(I).getCurrentPost();e?.("move-to-trash",[d])};return(0,kP.jsxs)(fD,{children:[(0,kP.jsx)(pD.Button,{__next40pxDefaultSize:!0,className:"editor-post-trash",isDestructive:!0,variant:"secondary",isBusy:o,"aria-disabled":o,onClick:o?void 0:()=>c(!0),children:(0,tx.__)("Move to trash")}),(0,kP.jsx)(pD.__experimentalConfirmDialog,{isOpen:l,onConfirm:u,onCancel:()=>c(!1),confirmButtonText:(0,tx.__)("Move to trash"),size:"small",children:(0,tx.sprintf)((0,tx.__)('Are you sure you want to move "%s" to the trash?'),i)})]})}var RP=a(Y(),1),AP=a(vo(),1),mD=a(U(),1),lPe=a(be(),1),$y=a(j(),1),Ba=a(G(),1),cPe=a(It(),1);var uPe=a(le(),1),hD=a(Ce(),1);var To=a(T(),1);function IP({onClose:e}){let{isEditable:t,postSlug:r,postLink:o,permalinkPrefix:n,permalinkSuffix:i,permalink:s}=(0,RP.useSelect)(h=>{let g=h(I).getCurrentPost(),v=h(I).getCurrentPostType(),b=h(uPe.store).getPostType(v),_=h(I).getPermalinkParts(),y=g?._links?.["wp:action-publish"]??!1;return{isEditable:h(I).isPermalinkEditable()&&y,postSlug:(0,AP.safeDecodeURIComponent)(h(I).getEditedPostSlug()),viewPostLabel:b?.labels?.view_item,postLink:g.link,permalinkPrefix:_?.prefix,permalinkSuffix:_?.suffix,permalink:(0,AP.safeDecodeURIComponent)(h(I).getPermalink())}},[]),{editPost:l}=(0,RP.useDispatch)(I),{createNotice:c}=(0,RP.useDispatch)(cPe.store),[u,d]=(0,mD.useState)(!1),f=(0,hD.useCopyToClipboard)(s,()=>{c("info",(0,$y.__)("Copied Permalink to clipboard."),{isDismissible:!0,type:"snackbar"})}),m="editor-post-url__slug-description-"+(0,hD.useInstanceId)(IP);return(0,To.jsxs)("div",{className:"editor-post-url",children:[(0,To.jsx)(lPe.__experimentalInspectorPopoverHeader,{title:(0,$y.__)("Slug"),onClose:e}),(0,To.jsxs)(Ba.__experimentalVStack,{spacing:3,children:[t&&(0,To.jsx)("p",{className:"editor-post-url__intro",children:(0,mD.createInterpolateElement)((0,$y.__)("Customize the last part of the Permalink. Learn more. "),{span:(0,To.jsx)("span",{id:m}),a:(0,To.jsx)(Ba.ExternalLink,{href:(0,$y.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink")})})}),(0,To.jsxs)("div",{children:[t&&(0,To.jsxs)(To.Fragment,{children:[(0,To.jsx)(Ba.__experimentalInputControl,{prefix:(0,To.jsx)(Ba.__experimentalInputControlPrefixWrapper,{children:"/"}),suffix:(0,To.jsx)(Ba.__experimentalInputControlSuffixWrapper,{variant:"control",children:(0,To.jsx)(Ba.Button,{icon:s1,ref:f,size:"small",label:"Copy"})}),label:(0,$y.__)("Slug"),hideLabelFromVision:!0,value:u?"":r,autoComplete:"off",spellCheck:"false",type:"text",className:"editor-post-url__input",onChange:h=>{if(l({slug:h}),!h){u||d(!0);return}u&&d(!1)},onBlur:h=>{l({slug:(0,AP.cleanForSlug)(h.target.value)}),u&&d(!1)},"aria-describedby":m}),(0,To.jsxs)("p",{className:"editor-post-url__permalink",children:[(0,To.jsx)("span",{className:"editor-post-url__permalink-visual-label",children:(0,$y.__)("Permalink:")}),(0,To.jsxs)(Ba.ExternalLink,{className:"editor-post-url__link",href:o,target:"_blank",children:[(0,To.jsx)("span",{className:"editor-post-url__link-prefix",children:n}),(0,To.jsx)("span",{className:"editor-post-url__link-slug",children:r}),(0,To.jsx)("span",{className:"editor-post-url__link-suffix",children:i})]})]})]}),!t&&(0,To.jsx)(Ba.ExternalLink,{className:"editor-post-url__link",href:o,target:"_blank",children:o})]})]})]})}var dPe=a(Y(),1),fPe=a(le(),1);function gD({children:e}){return(0,dPe.useSelect)(r=>{let o=r(I).getCurrentPostType();return!(!r(fPe.store).getPostType(o)?.viewable||!r(I).getCurrentPost().link||!r(I).getPermalinkParts())},[])?e:null}var pPe=a(Y(),1),vD=a(vo(),1);function mPe(){return Rq()}function Rq(){let e=(0,pPe.useSelect)(t=>t(I).getPermalink(),[]);return(0,vD.filterURLForDisplay)((0,vD.safeDecodeURIComponent)(e))}var bD=a(U(),1),yD=a(Y(),1),ix=a(G(),1),nx=a(j(),1),hPe=a(vo(),1),gPe=a(le(),1);var yl=a(T(),1);function wD(){let{isFrontPage:e}=(0,yD.useSelect)(i=>{let{getCurrentPostId:s}=i(I),{getEditedEntityRecord:l,canUser:c}=i(gPe.store),u=c("read",{kind:"root",name:"site"})?l("root","site"):void 0,d=s();return{isFrontPage:u?.page_on_front===d}},[]),[t,r]=(0,bD.useState)(null),o=(0,bD.useMemo)(()=>({anchor:t,placement:"left-start",offset:36,shift:!0}),[t]),n=e?(0,nx.__)("Link"):(0,nx.__)("Slug");return(0,yl.jsx)(gD,{children:(0,yl.jsxs)(fr,{label:n,ref:r,children:[!e&&(0,yl.jsx)(ix.Dropdown,{popoverProps:o,className:"editor-post-url__panel-dropdown",contentClassName:"editor-post-url__panel-dialog",focusOnMount:!0,renderToggle:({isOpen:i,onToggle:s})=>(0,yl.jsx)(jst,{isOpen:i,onClick:s}),renderContent:({onClose:i})=>(0,yl.jsx)(IP,{onClose:i})}),e&&(0,yl.jsx)(zst,{})]})})}function jst({isOpen:e,onClick:t}){let{slug:r}=(0,yD.useSelect)(n=>({slug:n(I).getEditedPostSlug()}),[]),o=(0,hPe.safeDecodeURIComponent)(r);return(0,yl.jsx)(ix.Button,{size:"compact",className:"editor-post-url__panel-toggle",variant:"tertiary","aria-expanded":e,"aria-label":(0,nx.sprintf)((0,nx.__)("Change link: %s"),o),onClick:t,children:(0,yl.jsx)(yl.Fragment,{children:o})})}function zst(){let{postLink:e}=(0,yD.useSelect)(t=>{let{getCurrentPost:r}=t(I);return{postLink:r()?.link}},[]);return(0,yl.jsx)(ix.ExternalLink,{className:"editor-post-url__front-page-link",href:e,target:"_blank",children:e})}var vPe=a(Y(),1);function bPe({render:e}){let t=(0,vPe.useSelect)(r=>r(I).getCurrentPost()._links?.["wp:action-publish"]??!1);return e({canEdit:t})}var APe=a(j(),1),xD=a(G(),1),IPe=a(Y(),1);var OPe=a(U(),1),NPe=a(be(),1);var Zp=a(j(),1),PPe=a(Y(),1),kPe=a(be(),1);var yPe=a(Y(),1),wPe=a(j(),1),_Pe=a(_w(),1);var SPe=a(T(),1);function sx(){let e=(0,yPe.useSelect)(r=>r(I).getEditedPostAttribute("content"),[]),t=(0,wPe._x)("words","Word count type. Do not translate!");return(0,SPe.jsx)("span",{className:"word-count",children:(0,_Pe.count)(e,t)})}var xPe=a(Y(),1),Bg=a(j(),1),CPe=a(_w(),1),Aq=a(U(),1);var _D=a(T(),1),Hst=189;function ax(){let e=(0,xPe.useSelect)(n=>n(I).getEditedPostAttribute("content"),[]),t=(0,Bg._x)("words","Word count type. Do not translate!"),r=Math.round((0,CPe.count)(e,t)/Hst),o=r===0?(0,Aq.createInterpolateElement)((0,Bg.__)("< 1 minute"),{span:(0,_D.jsx)("span",{})}):(0,Aq.createInterpolateElement)((0,Bg.sprintf)((0,Bg._n)("%s minute","%s minutes",r),r),{span:(0,_D.jsx)("span",{})});return(0,_D.jsx)("span",{className:"time-to-read",children:o})}var EPe=a(Y(),1),TPe=a(_w(),1);function lx(){let e=(0,EPe.useSelect)(t=>t(I).getEditedPostAttribute("content"),[]);return(0,TPe.count)(e,"characters_including_spaces")}var $r=a(T(),1);function Ust({hasOutlineItemsDisabled:e,onRequestClose:t}){let{headingCount:r,paragraphCount:o,numberOfBlocks:n}=(0,PPe.useSelect)(i=>{let{getGlobalBlockCount:s}=i(kPe.store);return{headingCount:s("core/heading"),paragraphCount:s("core/paragraph"),numberOfBlocks:s()}},[]);return(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":(0,Zp.__)("Document Statistics"),tabIndex:"0",children:(0,$r.jsxs)("ul",{role:"list",className:"table-of-contents__counts",children:[(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Words"),(0,$r.jsx)(sx,{})]}),(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Characters"),(0,$r.jsx)("span",{className:"table-of-contents__number",children:(0,$r.jsx)(lx,{})})]}),(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Time to read"),(0,$r.jsx)(ax,{})]}),(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Headings"),(0,$r.jsx)("span",{className:"table-of-contents__number",children:r})]}),(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Paragraphs"),(0,$r.jsx)("span",{className:"table-of-contents__number",children:o})]}),(0,$r.jsxs)("li",{className:"table-of-contents__count",children:[(0,Zp.__)("Blocks"),(0,$r.jsx)("span",{className:"table-of-contents__number",children:n})]})]})}),r>0&&(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)("hr",{}),(0,$r.jsx)("h2",{className:"table-of-contents__title",children:(0,Zp.__)("Document Outline")}),(0,$r.jsx)(mS,{onSelect:t,hasOutlineItemsDisabled:e})]})]})}var RPe=Ust;var SD=a(T(),1);function Wst({hasOutlineItemsDisabled:e,repositionDropdown:t,...r},o){let n=(0,IPe.useSelect)(i=>!!i(NPe.store).getBlockCount(),[]);return(0,SD.jsx)(xD.Dropdown,{popoverProps:{placement:t?"right":"bottom"},className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:({isOpen:i,onToggle:s})=>(0,SD.jsx)(xD.Button,{__next40pxDefaultSize:!0,...r,ref:o,onClick:n?s:void 0,icon:sB,"aria-expanded":i,"aria-haspopup":"true",label:(0,APe.__)("Details"),tooltipPosition:"bottom","aria-disabled":!n}),renderContent:({onClose:i})=>(0,SD.jsx)(RPe,{onRequestClose:i,hasOutlineItemsDisabled:e})})}var MPe=(0,OPe.forwardRef)(Wst);var FPe=a(j(),1),DPe=a(U(),1),LPe=a(Y(),1),VPe=a(le(),1);function BPe(){let{__experimentalGetDirtyEntityRecords:e}=(0,LPe.useSelect)(VPe.store);return(0,DPe.useEffect)(()=>{let t=r=>{if(e().length>0)return r.returnValue=(0,FPe.__)("You have unsaved changes. If you proceed, they will be lost."),r.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[e]),null}var Iq=a(qa(),1),HPe=a(U(),1),ye=a(be(),1),UPe=a(zPe(),1),WPe=a(T(),1);function wt(e,t,r=[]){let o=(0,HPe.forwardRef)((n,i)=>((0,Iq.default)("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),(0,WPe.jsx)(t,{ref:i,...n})));return r.forEach(n=>{o[n]=wt(e+"."+n,t[n])}),o}function Xd(e,t){return(...r)=>((0,Iq.default)("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),t(...r))}var GPe=wt("RichText",ye.RichText,["Content"]);GPe.isEmpty=Xd("RichText.isEmpty",ye.RichText.isEmpty);var Gst=wt("Autocomplete",ye.Autocomplete),Yst=wt("AlignmentToolbar",ye.AlignmentToolbar),qst=wt("BlockAlignmentToolbar",ye.BlockAlignmentToolbar),Kst=wt("BlockControls",ye.BlockControls,["Slot"]),Zst=wt("BlockEdit",ye.BlockEdit),Xst=wt("BlockEditorKeyboardShortcuts",ye.BlockEditorKeyboardShortcuts),Qst=wt("BlockFormatControls",ye.BlockFormatControls,["Slot"]),Jst=wt("BlockIcon",ye.BlockIcon),$st=wt("BlockInspector",ye.BlockInspector),eat=wt("BlockList",ye.BlockList),tat=wt("BlockMover",ye.BlockMover),rat=wt("BlockNavigationDropdown",ye.BlockNavigationDropdown),oat=wt("BlockSelectionClearer",ye.BlockSelectionClearer),nat=wt("BlockSettingsMenu",ye.BlockSettingsMenu),iat=wt("BlockTitle",ye.BlockTitle),sat=wt("BlockToolbar",ye.BlockToolbar),aat=wt("ColorPalette",ye.ColorPalette),lat=wt("ContrastChecker",ye.ContrastChecker),cat=wt("CopyHandler",ye.CopyHandler),uat=wt("DefaultBlockAppender",ye.DefaultBlockAppender),dat=wt("FontSizePicker",ye.FontSizePicker),fat=wt("Inserter",ye.Inserter),pat=wt("InnerBlocks",ye.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),mat=wt("InspectorAdvancedControls",ye.InspectorAdvancedControls,["Slot"]),hat=wt("InspectorControls",ye.InspectorControls,["Slot"]),gat=wt("PanelColorSettings",ye.PanelColorSettings),vat=wt("PlainText",ye.PlainText),bat=wt("RichTextShortcut",ye.RichTextShortcut),yat=wt("RichTextToolbarButton",ye.RichTextToolbarButton),wat=wt("__unstableRichTextInputEvent",ye.__unstableRichTextInputEvent),_at=wt("MediaPlaceholder",ye.MediaPlaceholder),Sat=wt("MediaUpload",ye.MediaUpload),xat=wt("MediaUploadCheck",ye.MediaUploadCheck),Cat=wt("MultiSelectScrollIntoView",ye.MultiSelectScrollIntoView),Eat=wt("NavigableToolbar",ye.NavigableToolbar),Tat=wt("ObserveTyping",ye.ObserveTyping),Pat=wt("SkipToSelectedBlock",ye.SkipToSelectedBlock),kat=wt("URLInput",ye.URLInput),Rat=wt("URLInputButton",ye.URLInputButton),Aat=wt("URLPopover",ye.URLPopover),Iat=wt("Warning",ye.Warning),Oat=wt("WritingFlow",ye.WritingFlow),Nat=Xd("createCustomColorsHOC",ye.createCustomColorsHOC),Mat=Xd("getColorClassName",ye.getColorClassName),Fat=Xd("getColorObjectByAttributeValues",ye.getColorObjectByAttributeValues),Dat=Xd("getColorObjectByColorValue",ye.getColorObjectByColorValue),Lat=Xd("getFontSize",ye.getFontSize),Vat=Xd("getFontSizeClass",ye.getFontSizeClass),Bat=Xd("withColorContext",ye.withColorContext),jat=Xd("withColors",ye.withColors),zat=Xd("withFontSizes",ye.withFontSizes);var Hat=oS,Uat=oS;function Wat(e=[]){return e.push({...P3},{...k3}),e}(0,YPe.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",Wat);var qPe=a(U(),1),Oq=a(zn(),1),KPe=a(qa(),1),CD=a(Ef(),1);var cx=a(T(),1),{MediaUploadModal:Gat}=q(CD.privateApis),Yat=class extends qPe.Component{constructor(e){super(e),this.state={isOpen:!1},this.openModal=this.openModal.bind(this),this.closeModal=this.closeModal.bind(this)}openModal(){this.setState({isOpen:!0})}closeModal(){this.setState({isOpen:!1}),this.props.onClose?.()}render(){let{allowedTypes:e,multiple:t,value:r,onSelect:o,title:n,modalClass:i,render:s}=this.props,{isOpen:l}=this.state;return(0,cx.jsxs)(cx.Fragment,{children:[s({open:this.openModal}),(0,cx.jsx)(Gat,{allowedTypes:e,multiple:t,value:r,onSelect:c=>{o(c),this.closeModal()},onClose:this.closeModal,title:n,isOpen:l,modalClass:i})]})}};window.__experimentalDataViewsMediaModal?(0,Oq.addFilter)("editor.MediaUpload","core/editor/components/media-upload",()=>((0,KPe.default)("Extending MediaUpload as a class component",{since:"7.0",version:"7.2",hint:"MediaUpload will become a function component in WordPress 7.2 Please update any custom implementations to use function components instead."}),Yat)):(0,Oq.addFilter)("editor.MediaUpload","core/editor/components/media-upload",()=>CD.MediaUpload);var XPe=a(zn(),1),QPe=a(Nl(),1),JPe=a(Ce(),1),ED=a(be(),1),Nq=a(Y(),1),$Pe=a(Pt(),1);var vu=a(T(),1),{PatternOverridesControls:qat,ResetOverridesControl:Kat,PATTERN_TYPES:Zat,PATTERN_SYNC_TYPES:ZPe}=q(QPe.privateApis),Xat=(0,JPe.createHigherOrderComponent)(e=>t=>{let r=(0,Nq.useSelect)(o=>{let{__experimentalBlockBindingsSupportedAttributes:n}=o(ED.store).getSettings();return!!n?.[t.name]},[t.name]);return(0,vu.jsxs)(vu.Fragment,{children:[(0,vu.jsx)(e,{...t},"edit"),t.isSelected&&r&&(0,vu.jsx)(Qat,{...t})]})},"withPatternOverrideControls");function Qat(e){let t=(0,ED.useBlockEditingMode)(),{hasPatternOverridesSource:r,isEditingSyncedPattern:o}=(0,Nq.useSelect)(c=>{let{getCurrentPostType:u,getEditedPostAttribute:d}=c(I);return{hasPatternOverridesSource:!!(0,$Pe.getBlockBindingsSource)("core/pattern-overrides"),isEditingSyncedPattern:u()===Zat.user&&d("meta")?.wp_pattern_sync_status!==ZPe.unsynced&&d("wp_pattern_sync_status")!==ZPe.unsynced}},[]),n=e.attributes.metadata?.bindings,i=!!n&&Object.values(n).some(c=>c.source==="core/pattern-overrides"),s=o&&t==="default",l=!o&&!!e.attributes.metadata?.name&&t!=="disabled"&&i;return r?(0,vu.jsxs)(vu.Fragment,{children:[s&&(0,vu.jsx)(qat,{...e}),l&&(0,vu.jsx)(Kat,{...e})]}):null}(0,XPe.addFilter)("editor.BlockEdit","core/editor/with-pattern-override-controls",Xat);var eke=a(zn(),1),tke=a(Ce(),1),rke=a(U(),1),Mq=a(j(),1),ux=a(be(),1),TD=a(G(),1),oke=a(Y(),1),Qd=a(T(),1),Jat=["core/navigation-link","core/navigation-submenu"];function $at({attributes:e}){let{kind:t,id:r,type:o}=e,n=(0,ux.useBlockEditingMode)(),i=(0,oke.useSelect)(l=>l(ux.store).getSettings().onNavigateToEntityRecord,[]),s=(0,rke.useCallback)(()=>{t==="post-type"&&o==="page"&&r&&i&&i({postId:r,postType:o})},[t,r,o,i]);return t!=="post-type"||o!=="page"||!r||!i||n!=="contentOnly"?null:(0,Qd.jsx)(ux.__unstableBlockToolbarLastItem,{children:(0,Qd.jsx)(TD.ToolbarGroup,{children:(0,Qd.jsx)(TD.ToolbarButton,{name:"view",title:(0,Mq.__)("View"),onClick:s,children:(0,Mq.__)("View")})})})}var elt=(0,tke.createHigherOrderComponent)(e=>t=>{let r=Jat.includes(t.name);return(0,Qd.jsxs)(Qd.Fragment,{children:[(0,Qd.jsx)(e,{...t},"edit"),t.isSelected&&r&&(0,Qd.jsx)($at,{...t})]})},"withNavigationViewButton");(0,eke.addFilter)("editor.BlockEdit","core/editor/with-navigation-view-button",elt);var nke=a(zn(),1),ike=a(Ce(),1),ske=a(U(),1),Fq=a(j(),1),dx=a(be(),1),PD=a(G(),1),jg=a(Y(),1);var Jd=a(T(),1),tlt="core/navigation",rlt="core/template-part",olt="edit-post/block";function nlt({clientId:e}){let t=(0,jg.useRegistry)(),{selectBlock:r,flashBlock:o}=(0,jg.useDispatch)(dx.store),{requestInspectorTab:n}=q((0,jg.useDispatch)(dx.store)),{enableComplementaryArea:i}=(0,jg.useDispatch)(je),{hasNavigationBlocks:s,firstNavigationBlockId:l,isNavigationEditable:c}=(0,jg.useSelect)(d=>{let{getClientIdsOfDescendants:f,getBlockName:m,getBlockEditingMode:h}=d(dx.store),v=f(e).filter(y=>m(y)===tlt),b=v.length>0,_=b?v[0]:null;return{hasNavigationBlocks:b,firstNavigationBlockId:_,isNavigationEditable:h(_)!=="disabled"}},[e]),u=(0,ske.useCallback)(()=>{l&&t.batch(()=>{r(l),o(l,500),i("core",olt),n("list",{openPanel:l})})},[l,t,r,o,i,n]);return!s||!c?null:(0,Jd.jsx)(dx.__unstableBlockToolbarLastItem,{children:(0,Jd.jsx)(PD.ToolbarGroup,{children:(0,Jd.jsx)(PD.ToolbarButton,{label:(0,Fq.__)("Edit navigation"),onClick:u,children:(0,Fq.__)("Edit navigation")})})})}var ilt=(0,ike.createHigherOrderComponent)(e=>t=>{let r=t.name===rlt;return(0,Jd.jsxs)(Jd.Fragment,{children:[(0,Jd.jsx)(e,{...t},"edit"),t.isSelected&&r&&(0,Jd.jsx)(nlt,{clientId:t.clientId})]})},"withTemplatePartNavigationEditButton");(0,nke.addFilter)("editor.BlockEdit","core/editor/with-template-part-navigation-edit-button",ilt);var _ke=a(zn(),1),Ske=a(Ce(),1),zg=a(be(),1),OP=a(G(),1),Qp=a(j(),1),Jp=a(Pt(),1),mx=a(U(),1),px=a(Y(),1),xke=a(It(),1),Cke=a(le(),1);function Dq(e,t,r){return!e||typeof e!="object"||t.reduce((o,n,i)=>(o[n]===void 0&&(Number.isInteger(t[i+1])?o[n]=[]:o[n]={}),i===t.length-1&&(o[n]=r),o[n]),e),e}var gke=a(G(),1);var bu=a(j(),1),vke=a(Pt(),1),fx=a(U(),1);var mke=a(U(),1);var xr=a(j(),1),ake={"typography.fontFamily":(0,xr.__)("Font family"),"typography.fontSize":(0,xr.__)("Font size"),"typography.fontStyle":(0,xr.__)("Font style"),"typography.fontWeight":(0,xr.__)("Font weight"),"typography.lineHeight":(0,xr.__)("Line height"),"typography.letterSpacing":(0,xr.__)("Letter spacing"),"typography.textDecoration":(0,xr.__)("Text decoration"),"typography.textTransform":(0,xr.__)("Letter case"),"typography.textColumns":(0,xr.__)("Text columns"),"typography.writingMode":(0,xr.__)("Orientation"),"color.text":(0,xr.__)("Text color"),"color.background":(0,xr.__)("Background color"),"color.gradient":(0,xr.__)("Gradient"),"elements.link.color.text":(0,xr.__)("Link color"),"spacing.padding":(0,xr.__)("Padding"),"spacing.margin":(0,xr.__)("Margin"),"spacing.blockGap":(0,xr.__)("Block spacing"),border:(0,xr.__)("Border"),"border.top":(0,xr.__)("Border top"),"border.right":(0,xr.__)("Border right"),"border.bottom":(0,xr.__)("Border bottom"),"border.left":(0,xr.__)("Border left"),"border.color":(0,xr.__)("Border color"),"border.width":(0,xr.__)("Border width"),"border.style":(0,xr.__)("Border style"),"border.radius":(0,xr.__)("Border radius"),"dimensions.minHeight":(0,xr.__)("Minimum height"),"dimensions.aspectRatio":(0,xr.__)("Aspect ratio")};function lke(e){let t=e.join(".");return ake[t]?ake[t]:YI(e[e.length-1]??"")}var $d="\u2014",slt="var:preset|",alt=/^var\(\s*--wp--preset--[a-z0-9-]+?\s*(?:,[^)]*)?\)$/i;function llt(e){if(e.startsWith(slt))return e.split("|").pop();if(alt.test(e))return e.replace(/^var\(\s*/,"").replace(/\s*(?:,[^)]*)?\)$/,"").split("--").pop()}var Vn=e=>e!=null&&e!=="",clt=["top","right","bottom","left"];function ult(e){if(Vn(e.width)||Vn(e.style)||Vn(e.color))return e;let t=clt.filter(o=>e[o]);if(!t.length)return e;let r=o=>{let n=t.map(i=>e[i]?.[o]);return n.every(i=>i===n[0])?n[0]:void 0};return{width:r("width"),style:r("style"),color:r("color")}}function e0(e){if(!Vn(e))return $d;if(typeof e=="string"){let t=llt(e);return t?YI(t):e}if(typeof e=="number")return String(e);if(typeof e=="object")try{let t=JSON.stringify(e);return t&&t!=="{}"&&t!=="[]"?t:$d}catch{return $d}return String(e)}function cke(e){if(!e||typeof e!="object")return e0(e);let{width:t,style:r,color:o}=ult(e),n=[t,r,o].filter(Vn).map(i=>e0(i));return n.length?n.join(" "):$d}var dlt=["topLeft","topRight","bottomRight","bottomLeft"];function uke(e){if(e&&typeof e=="object"){let t=dlt.map(r=>e[r]).filter(Vn);return t.length?t.join(" "):$d}return e0(e)}function dke(e,t=r=>r){let r=l=>e0(t(l));if(!e||typeof e!="object")return r(e);let{top:o,right:n,bottom:i,left:s}=e;return Vn(o)&&Vn(n)&&Vn(i)&&Vn(s)?o===n&&n===i&&i===s?r(o):o===i&&s===n?`${r(o)} ${r(s)}`:[o,n,i,s].map(r).join(" "):!Vn(o)&&!Vn(n)&&!Vn(i)&&!Vn(s)?$d:[o,n,i,s].map(l=>Vn(l)?r(l):$d).join(" ")}function fke(e,t=r=>r){let r=l=>e0(t(l));if(!e||typeof e!="object")return r(e);let{top:o,left:n}=e;if(!Vn(o)&&!Vn(n))return $d;if(o===n)return r(o);let i=Vn(o)?r(o):$d,s=Vn(n)?r(n):$d;return`${i} - ${s}`}function pke(e,t,r){return e==="border"?cke(t):e==="borderRadius"?uke(t):e==="spacing"?dke(t,r):e==="blockGap"?fke(t,r):e0(t)}function hke(e,t,r){return(0,mke.useMemo)(()=>{let o=n=>bv(t,r,n);return e.map(n=>{let i=bm(t,n.primaryPath.join("."),r,!1);return{...n,label:lke(n.primaryPath),currentValue:i,formattedCurrentValue:pke(n.format,i,o),formattedNewValue:pke(n.format,n.newValue,o)}})},[e,t,r])}var Xp=a(T(),1),flt={pickerTable:{}},plt=e=>e.id;function bke({name:e,rows:t,onApply:r,onRequestClose:o}){let{merged:n}=Hr(),i=hke(t,n,e),[s,l]=(0,fx.useState)(()=>i.map(h=>h.id)),[c,u]=(0,fx.useState)(()=>({type:"pickerTable",titleField:"label",fields:["current","new"],page:1,perPage:i.length,layout:{enableMoving:!1}})),d=(0,fx.useMemo)(()=>[{id:"label",label:(0,bu.__)("Style"),enableSorting:!1,enableHiding:!1,filterBy:!1,getValue:({item:h})=>h.label,render:({item:h})=>h.label},{id:"current",label:(0,bu.__)("Current"),enableSorting:!1,enableHiding:!1,filterBy:!1,getValue:({item:h})=>h.formattedCurrentValue,render:({item:h})=>(0,Xp.jsx)("span",{className:"editor-push-changes-to-global-styles-modal__value",children:h.formattedCurrentValue})},{id:"new",label:(0,bu.__)("New"),enableSorting:!1,enableHiding:!1,filterBy:!1,getValue:({item:h})=>h.formattedNewValue,render:({item:h})=>(0,Xp.jsx)("span",{className:"editor-push-changes-to-global-styles-modal__value",children:h.formattedNewValue})}],[]),f=(0,fx.useMemo)(()=>[{id:"apply",label:(0,bu.__)("Apply"),isPrimary:!0,supportsBulk:!0,callback(h){r(h),o()}}],[r,o]),m=(0,vke.getBlockType)(e)?.title;return(0,Xp.jsxs)(gke.Modal,{title:(0,bu.sprintf)((0,bu.__)("Apply %s styles globally"),m),onRequestClose:o,size:"large",className:"editor-push-changes-to-global-styles-modal",children:[(0,Xp.jsx)("p",{children:(0,bu.sprintf)((0,bu.__)("Choose which styles to make default for all %s blocks."),m)}),(0,Xp.jsxs)(lp,{data:i,fields:d,view:c,onChangeView:u,actions:f,selection:s,onChangeSelection:l,getItemId:plt,paginationInfo:{totalItems:i.length,totalPages:1},defaultLayouts:flt,search:!1,itemListLabel:(0,bu.__)("Styles to apply"),children:[(0,Xp.jsx)(lp.Layout,{}),(0,Xp.jsx)(lp.Footer,{})]})]})}var wl=a(T(),1),{cleanEmptyObject:mlt}=q(zg.privateApis),Lq={...Jp.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},hlt={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},glt={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},vlt=["border","color","spacing","typography"],yke=(e,t)=>{let r=e;return t.forEach(o=>{r=r?.[o]}),r},Eke=["top","right","bottom","left"];function blt(e,t,r){let o=[],n=t.style?.border,i=r?.border,s=e.includes("borderColor"),l=e.includes("borderWidth"),c=e.includes("borderStyle"),u=t.borderColor,d=u?`var:preset|color|${u}`:n?.color,f=wke({id:"border",primaryPath:["border"],side:null,color:s?d:void 0,width:l?n?.width:void 0,style:c?n?.style:void 0,userBorder:i,presetAttributes:u?["borderColor"]:[]});return f&&o.push(f),Eke.forEach(m=>{let h=n?.[m],g=wke({id:`border.${m}`,primaryPath:["border",m],side:m,color:s?h?.color:void 0,width:l?h?.width:void 0,style:c?h?.style:void 0,userBorder:i,presetAttributes:[]});g&&o.push(g)}),e.includes("borderRadius")&&n?.radius!==void 0&&n?.radius!==""&&o.push({id:"border.radius",primaryPath:["border","radius"],paths:[{path:["border","radius"],value:n.radius}],presetAttributes:[],newValue:n.radius,format:"borderRadius"}),o}function wke({id:e,primaryPath:t,side:r,color:o,width:n,style:i,userBorder:s,presetAttributes:l}){if(!o&&!n&&!i)return null;let c=[],u=r?[r]:Eke,d=(m,h)=>{h!==void 0&&(r||c.push({path:["border",m],value:h}),u.forEach(g=>{c.push({path:["border",g,m],value:h})}))};d("color",o),d("width",n),d("style",i);let f=i;if(!i&&(o||n)){let m=u.map(g=>s?.[g]?.style);u.forEach((g,v)=>{m[v]||c.push({path:["border",g,"style"],value:"solid"})}),f=(m.every(g=>g===m[0])?m[0]:void 0)||"solid"}return{id:e,primaryPath:t,paths:c,presetAttributes:l,newValue:{color:o,width:n,style:f},format:"border"}}function ylt(e,t,r){let o=[];return e.forEach(n=>{if(!Lq[n]||n.startsWith("border")||Lq[n].rootOnly)return;let{value:i}=Lq[n],s=i.join("."),l=glt[s],c=l?t[l]:void 0,u=c?`var:preset|${hlt[s]}|${c}`:yke(t.style,i),d=c?[l]:[];if(n==="linkColor"){let f=u?[{path:i,value:u}]:[],m=["elements","link",":hover","color","text"],h=yke(t.style,m);if(h&&f.push({path:m,value:h}),f.length===0)return;o.push({id:s,primaryPath:i,paths:f,presetAttributes:d,newValue:u??h});return}if(u){let f;n==="padding"||n==="margin"?f="spacing":n==="blockGap"&&(f="blockGap"),o.push({id:s,primaryPath:i,paths:[{path:i,value:u}],presetAttributes:d,newValue:u,format:f})}}),o.push(...blt(e,t,r)),o}function wlt(e,t,r){let o=(0,px.useSelect)(i=>q(i(Jp.store)).getSupportedStyles(e),[e]),n=r?.styles?.blocks?.[e];return(0,mx.useMemo)(()=>ylt(o,t,n),[o,t,n])}function _lt({rowsToPush:e,attributes:t,userConfig:r,name:o}){if(!e||e.length===0)return null;let n=e.flatMap(u=>u.paths);if(n.length===0)return null;let{style:i}=t,s=structuredClone(i),l=structuredClone(r);for(let{path:u,value:d}of n)Dq(s,u,void 0),Dq(l,["styles","blocks",o,...u],d);let c={style:mlt(s)};for(let u of e.flatMap(d=>d.presetAttributes))c[u]=void 0;return{newBlockAttributes:c,newUserConfig:l}}function Slt({name:e,attributes:t,setAttributes:r}){let{user:o,setUser:n}=Hr(),i=wlt(e,t,o),[s,l]=(0,mx.useState)(!1),{__unstableMarkNextChangeAsNotPersistent:c}=(0,px.useDispatch)(zg.store),{createSuccessNotice:u}=(0,px.useDispatch)(xke.store),d=(0,mx.useCallback)(f=>{let m=_lt({rowsToPush:f,attributes:t,userConfig:o,name:e});if(!m)return;let{newBlockAttributes:h,newUserConfig:g}=m;c(),r(h),n(g,{undoIgnore:!0}),u((0,Qp.sprintf)((0,Qp.__)("%s styles applied."),(0,Jp.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,Qp.__)("Undo"),onClick(){c(),r(t),n(o,{undoIgnore:!0})}}]})},[c,t,u,e,r,n,o]);return(0,wl.jsxs)(OP.BaseControl,{className:"editor-push-changes-to-global-styles-control",help:(0,Qp.sprintf)((0,Qp.__)("Review and apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks."),(0,Jp.getBlockType)(e).title),children:[(0,wl.jsx)(OP.BaseControl.VisualLabel,{children:(0,Qp.__)("Styles")}),(0,wl.jsx)(OP.Button,{__next40pxDefaultSize:!0,variant:"secondary",accessibleWhenDisabled:!0,disabled:i.length===0,onClick:()=>l(!0),children:(0,Qp.__)("Apply globally")}),s&&(0,wl.jsx)(bke,{name:e,rows:i,onApply:d,onRequestClose:()=>l(!1)})]})}function xlt(e){let t=(0,zg.useBlockEditingMode)(),r=(0,px.useSelect)(i=>i(Cke.store).getCurrentTheme()?.is_block_theme,[]),o=vlt.some(i=>(0,Jp.hasBlockSupport)(e.name,i));return t==="default"&&o&&r?(0,wl.jsx)(zg.InspectorAdvancedControls,{children:(0,wl.jsx)(Slt,{...e})}):null}var Clt=(0,Ske.createHigherOrderComponent)(e=>t=>(0,wl.jsxs)(wl.Fragment,{children:[(0,wl.jsx)(e,{...t},"edit"),t.isSelected&&(0,wl.jsx)(xlt,{...t})]}));(0,_ke.addFilter)("editor.BlockEdit","core/editor/push-changes-to-global-styles",Clt);var Rke=a(hd(),1);var Tke=a(j(),1),Pke=a(U(),1),MP=a(Y(),1);var hx="edit-post/collab-history-sidebar",Hg="edit-post/collab-sidebar",NP=[hx,Hg];var kD="core/note",kke={title:(0,Tke.__)("Note"),tagName:"mark",className:"wp-note",attributes:{"data-id":"data-id"},edit:Elt};function Elt({isActive:e,activeAttributes:t}){let{getActiveComplementaryArea:r}=(0,MP.useSelect)(je),{getSelectedNote:o}=q((0,MP.useSelect)(I)),{selectNote:n}=q((0,MP.useDispatch)(I)),i=t?.["data-id"];return(0,Pke.useEffect)(()=>{!e||!i||NP.includes(r("core"))&&String(o())!==String(i)&&n(Number(i))},[e,i,r,o,n]),null}(0,Rke.registerFormatType)(kD,kke);var FP=a(G(),1),Ake=a(T(),1),Vq="__experimentalMainDashboardButton",Ike=()=>{let e=(0,FP.__experimentalUseSlotFills)(Vq);return!!(e&&e.length)},{Fill:Tlt,Slot:Plt}=(0,FP.createSlotFill)(Vq),Oke=Tlt,klt=()=>{let e=(0,FP.__experimentalUseSlotFills)(Vq);return(0,Ake.jsx)(Plt,{bubblesVirtually:!0,fillProps:{length:e?e.length:0}})};Oke.Slot=klt;var RD=Oke;var O5e=a(Y(),1),N5e=a(le(),1),M5e=a(G(),1),F5e=a(j(),1);var $P=a(Y(),1),Jg=a(j(),1),gAe=a(Lt(),1),Px=a(be(),1),vAe=a(Ce(),1),AL=a(U(),1),bAe=a(Nt(),1),yAe=a(It(),1),wAe=a(J9(),1);var u2e=a(be(),1),d2e=a(Y(),1),WP=a(Ce(),1),f2e=a(Lt(),1),p2e=a(U(),1);var gx=a(be(),1),Nke=a(U(),1),AD=a(G(),1),Bq=a(j(),1);var Mke=a(Y(),1);var $p=a(T(),1),{useHasBlockToolbar:Rlt}=q(gx.privateApis);function Fke({isCollapsed:e,onToggle:t}){let{blockSelectionStart:r}=(0,Mke.useSelect)(i=>({blockSelectionStart:i(gx.store).getBlockSelectionStart()}),[]),o=Rlt(),n=!!r;return(0,Nke.useEffect)(()=>{r&&t(!1)},[r,t]),o?(0,$p.jsxs)($p.Fragment,{children:[(0,$p.jsx)("div",{className:J("editor-collapsible-block-toolbar",{"is-collapsed":e||!n}),children:(0,$p.jsx)(gx.BlockToolbar,{hideDragHandle:!0})}),(0,$p.jsx)(AD.Popover.Slot,{name:"block-toolbar"}),(0,$p.jsx)(AD.Button,{className:"editor-collapsible-block-toolbar__toggle",icon:e?kl:Rl,onClick:()=>{t(!e)},label:e?(0,Bq.__)("Show block tools"):(0,Bq.__)("Hide block tools"),size:"compact"})]}):null}var Dke=a(Ce(),1),ID=a(Y(),1),t0=a(j(),1),Lke=a(be(),1),vx=a(G(),1);var jq=a(U(),1),Vke=a(xa(),1),Bke=a(Lt(),1);var yu=a(T(),1);function Alt({className:e,disableBlockTools:t=!1}){let{setIsInserterOpened:r,setIsListViewOpened:o}=(0,ID.useDispatch)(I),{isDistractionFree:n,isInserterOpened:i,isListViewOpen:s,listViewShortcut:l,inserterSidebarToggleRef:c,listViewToggleRef:u,showIconLabels:d}=(0,ID.useSelect)(y=>{let{get:w}=y(Bke.store),{isListViewOpened:S,getEditorMode:x,getInserterSidebarToggleRef:C,getListViewToggleRef:A}=q(y(I)),{getShortcutRepresentation:P}=y(Vke.store);return{isInserterOpened:y(I).isInserterOpened(),isListViewOpen:S(),listViewShortcut:P("core/editor/toggle-list-view"),inserterSidebarToggleRef:C(),listViewToggleRef:A(),showIconLabels:w("core","showIconLabels"),isDistractionFree:w("core","distractionFree"),isVisualMode:x()==="visual"}},[]),f=y=>{i&&y.preventDefault()},m=(0,Dke.useViewportMatch)("wide"),h=(0,t0.__)("Document tools"),g=(0,jq.useCallback)(()=>o(!s),[o,s]),v=(0,jq.useCallback)(()=>r(!i),[i,r]),b=(0,t0._x)("Block Inserter","Generic label for block inserter button"),_=i?(0,t0.__)("Close"):(0,t0.__)("Add");return(0,yu.jsx)(Lke.NavigableToolbar,{className:J("editor-document-tools","edit-post-header-toolbar",e),"aria-label":h,variant:"unstyled",children:(0,yu.jsxs)("div",{className:"editor-document-tools__left",children:[!n&&(0,yu.jsx)(vx.ToolbarButton,{ref:c,className:"editor-document-tools__inserter-toggle",variant:"primary",isPressed:i,onMouseDown:f,onClick:v,disabled:t,icon:Cc,label:d?_:b,showTooltip:!d,"aria-expanded":i}),(m||!d)&&(0,yu.jsxs)(yu.Fragment,{children:[(0,yu.jsx)(vx.ToolbarItem,{as:e6,showTooltip:!d,variant:d?"tertiary":void 0,size:"compact"}),(0,yu.jsx)(vx.ToolbarItem,{as:Q3,showTooltip:!d,variant:d?"tertiary":void 0,size:"compact"}),!n&&(0,yu.jsx)(vx.ToolbarButton,{className:"editor-document-tools__document-overview-toggle",icon:m1,disabled:t,isPressed:s,label:(0,t0.__)("Document Overview"),onClick:g,shortcut:l,showTooltip:!d,variant:d?"tertiary":void 0,"aria-expanded":s,ref:u})]})]})})}var jke=Alt;var DP=a(G(),1);var Ug=a(T(),1),zq={distractionFreeDisabled:{y:"-50px"},distractionFreeHover:{y:0},distractionFreeHidden:{y:"-50px"},visible:{y:0},hidden:{y:0}},Ilt={distractionFreeDisabled:{x:"-100%"},distractionFreeHover:{x:0},distractionFreeHidden:{x:"-100%"},visible:{x:0},hidden:{x:0}};function OD({className:e,toolbar:t,center:r,settings:o}){let n=Ike();return(0,Ug.jsxs)("div",{className:J("editor-header edit-post-header",e),children:[n&&(0,Ug.jsx)(DP.__unstableMotion.div,{className:"editor-header__back-button",variants:Ilt,transition:{type:"tween"},children:(0,Ug.jsx)(RD.Slot,{})}),(0,Ug.jsx)(DP.__unstableMotion.div,{variants:zq,className:"editor-header__toolbar",transition:{type:"tween"},children:t}),r&&(0,Ug.jsx)(DP.__unstableMotion.div,{variants:zq,className:"editor-header__center",transition:{type:"tween"},children:r}),(0,Ug.jsx)(DP.__unstableMotion.div,{variants:zq,transition:{type:"tween"},className:"editor-header__settings",children:o})]})}var Po=a(j(),1),bx=a(Y(),1),Wq=a(Mo(),1);var ef=a(G(),1),r0=a(Lt(),1);var zke=a(G(),1),ND=a(Y(),1),Hq=a(j(),1),Hke=a(Ce(),1),Uke=a(It(),1);var Wke=a(T(),1);function Gke(){let{createNotice:e}=(0,ND.useDispatch)(Uke.store),{getEditedPostContent:t}=(0,ND.useSelect)(I);function r(){return t()}function o(){e("info",(0,Hq.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}let n=(0,Hke.useCopyToClipboard)(r,o);return(0,Wke.jsx)(zke.MenuItem,{ref:n,children:(0,Hq.__)("Copy all blocks")})}var LP=a(j(),1),MD=a(G(),1),FD=a(Y(),1),Yke=a(xa(),1);var Uq=a(T(),1),Olt=[{value:"visual",label:(0,LP.__)("Visual editor")},{value:"text",label:(0,LP.__)("Code editor")}];function Nlt(){let{shortcut:e,isRichEditingEnabled:t,isCodeEditingEnabled:r,mode:o}=(0,FD.useSelect)(l=>({shortcut:l(Yke.store).getShortcutRepresentation("core/editor/toggle-mode"),isRichEditingEnabled:l(I).getEditorSettings().richEditingEnabled,isCodeEditingEnabled:l(I).getEditorSettings().codeEditingEnabled,mode:l(I).getEditorMode()}),[]),{switchEditorMode:n}=(0,FD.useDispatch)(I),i=o;!t&&o==="visual"&&(i="text"),!r&&o==="text"&&(i="visual");let s=Olt.map(l=>(!r&&l.value==="text"&&(l={...l,disabled:!0}),!t&&l.value==="visual"&&(l={...l,disabled:!0,info:(0,LP.__)("You can enable the visual editor in your profile settings.")}),l.value!==i&&!l.disabled?{...l,shortcut:e}:l));return(0,Uq.jsx)(MD.MenuGroup,{label:(0,LP.__)("Editor"),children:(0,Uq.jsx)(MD.MenuItemsChoice,{choices:s,value:i,onSelect:n})})}var qke=Nlt;var Kke=a(G(),1),Zke=a(T(),1),{Fill:Xke,Slot:Mlt}=(0,Kke.createSlotFill)("ToolsMoreMenuGroup");Xke.Slot=({fillProps:e})=>(0,Zke.jsx)(Mlt,{fillProps:e});var DD=Xke;var Qke=a(G(),1),Jke=a(T(),1),{Fill:$ke,Slot:Flt}=(0,Qke.createSlotFill)(Symbol("ViewMoreMenuGroup"));$ke.Slot=({fillProps:e})=>(0,Jke.jsx)(Flt,{fillProps:e});var LD=$ke;var mo=a(T(),1);function VD({disabled:e=!1}){let{openModal:t}=(0,bx.useDispatch)(je),{set:r}=(0,bx.useDispatch)(r0.store),{toggleDistractionFree:o}=(0,bx.useDispatch)(I),n=(0,bx.useSelect)(s=>s(r0.store).get("core","showIconLabels"),[]),i=()=>{r("core","distractionFree",!1)};return(0,mo.jsx)(mo.Fragment,{children:(0,mo.jsx)(ef.DropdownMenu,{icon:bo,label:(0,Po.__)("Options"),popoverProps:{placement:"bottom-end",className:"more-menu-dropdown__content"},toggleProps:{showTooltip:!n,...n&&{variant:"tertiary"},tooltipPosition:"bottom",size:"compact",disabled:e},children:({onClose:s})=>(0,mo.jsxs)(mo.Fragment,{children:[(0,mo.jsxs)(ef.MenuGroup,{label:(0,Po._x)("View","noun"),children:[(0,mo.jsx)(r0.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:i,label:(0,Po.__)("Top toolbar"),info:(0,Po.__)("Access all block and document tools in a single place"),messageActivated:(0,Po.__)("Top toolbar activated."),messageDeactivated:(0,Po.__)("Top toolbar deactivated.")}),(0,mo.jsx)(r0.PreferenceToggleMenuItem,{scope:"core",name:"distractionFree",label:(0,Po.__)("Distraction free"),info:(0,Po.__)("Write with calmness"),handleToggling:!1,onToggle:()=>o({createNotice:!1}),messageActivated:(0,Po.__)("Distraction free mode activated."),messageDeactivated:(0,Po.__)("Distraction free mode deactivated."),shortcut:Wq.displayShortcut.primaryShift("\\")}),(0,mo.jsx)(r0.PreferenceToggleMenuItem,{scope:"core",name:"focusMode",label:(0,Po.__)("Spotlight mode"),info:(0,Po.__)("Focus on one block at a time"),messageActivated:(0,Po.__)("Spotlight mode activated."),messageDeactivated:(0,Po.__)("Spotlight mode deactivated.")}),(0,mo.jsx)(LD.Slot,{fillProps:{onClose:s}})]}),(0,mo.jsx)(qke,{}),(0,mo.jsx)(Yl.Slot,{name:"core/plugin-more-menu",label:(0,Po.__)("Panels"),fillProps:{onClick:s}}),(0,mo.jsxs)(ef.MenuGroup,{label:(0,Po.__)("Tools"),children:[(0,mo.jsx)(ef.MenuItem,{onClick:()=>t("editor/keyboard-shortcut-help"),shortcut:Wq.displayShortcut.access("h"),children:(0,Po.__)("Keyboard shortcuts")}),(0,mo.jsx)(Gke,{}),(0,mo.jsxs)(ef.MenuItem,{icon:gs,href:(0,Po.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),target:"_blank",rel:"noopener",children:[(0,Po.__)("Help"),(0,mo.jsx)(Yt,{render:(0,mo.jsx)("span",{}),children:(0,Po.__)("(opens in a new tab)")})]}),(0,mo.jsx)(DD.Slot,{fillProps:{onClose:s}})]}),(0,mo.jsx)(ef.MenuGroup,{children:(0,mo.jsx)(ef.MenuItem,{onClick:()=>t("editor/preferences"),children:(0,Po.__)("Preferences")})})]})})})}var tRe=a(Ce(),1),BD=a(Y(),1);var rRe=a(T(),1),eRe="toggle",Gq="button";function oRe({forceIsDirty:e,setEntitiesSavedStatesCallback:t}){let r,o=(0,tRe.useViewportMatch)("medium","<"),{togglePublishSidebar:n}=(0,BD.useDispatch)(I),{hasPublishAction:i,isBeingScheduled:s,isPending:l,isPublished:c,isPublishSidebarEnabled:u,isPublishSidebarOpened:d,isScheduled:f,postStatus:m,postStatusHasChanged:h,postType:g}=(0,BD.useSelect)(v=>({hasPublishAction:!!v(I).getCurrentPost()?._links?.["wp:action-publish"],isBeingScheduled:v(I).isEditedPostBeingScheduled(),isPending:v(I).isCurrentPostPending(),isPublished:v(I).isCurrentPostPublished(),isPublishSidebarEnabled:v(I).isPublishSidebarEnabled(),isPublishSidebarOpened:v(I).isPublishSidebarOpened(),isScheduled:v(I).isCurrentPostScheduled(),postStatus:v(I).getEditedPostAttribute("status"),postStatusHasChanged:v(I).getPostEdits()?.status,postType:v(I).getCurrentPostType()}),[]);return g===Pl||c||h&&!["future","publish"].includes(m)||f&&s||l&&!i&&!o?r=Gq:o||u?r=eRe:r=Gq,(0,rRe.jsx)(VS,{forceIsDirty:e,isOpen:d,isToggle:r===eRe,onToggle:n,setEntitiesSavedStatesCallback:t})}var nRe=a(j(),1),iRe=a(G(),1);var sRe=a(le(),1),aRe=a(Y(),1),lRe=a(Lt(),1);var cRe=a(T(),1);function uRe(){let{hasLoaded:e,permalink:t,isPublished:r,label:o,showIconLabels:n}=(0,aRe.useSelect)(i=>{let s=i(I).getCurrentPostType(),l=i(sRe.store).getPostType(s),{get:c}=i(lRe.store);return{permalink:i(I).getPermalink(),isPublished:i(I).isCurrentPostPublished(),label:l?.labels?.view_item,hasLoaded:!!l,showIconLabels:c("core","showIconLabels")}},[]);return!r||!t||!e?null:(0,cRe.jsx)(iRe.Button,{icon:gs,label:o||(0,nRe.__)("View post"),href:t,target:"_blank",showTooltip:!n,size:"compact"})}var dRe=a(Ce(),1),ja=a(G(),1),ki=a(j(),1);var yx=a(Y(),1),fRe=a(le(),1),pRe=a(Lt(),1);var Yq=a(be(),1);var cs={document:"edit-post/document",block:"edit-post/block"};var Bn=a(T(),1),{getViewportBreakpoints:Dlt}=q(Du);function mRe({forceIsAutosaveable:e,disabled:t}){let{deviceType:r,homeUrl:o,hasMobileViewport:n,hasTabletViewport:i,isTemplate:s,isViewable:l,showIconLabels:c,isTemplateHidden:u,templateId:d,isResponsiveEditing:f,isResponsiveEditingEnabled:m,hasBlockSelection:h,activeComplementaryArea:g}=(0,yx.useSelect)(V=>{let{getCurrentPostType:F,getCurrentTemplateId:D,getRenderingMode:z,getDeviceType:L,getEditorSettings:O}=q(V(I)),{isResponsiveEditing:B,getBlockSelectionStart:W,getSettings:K}=q(V(Yq.store)),{getEntityRecord:Z,getPostType:Q}=V(fRe.store),{get:ue}=V(pRe.store),te=F(),de=Dlt(K().__experimentalFeatures?.viewport);return{deviceType:L(),homeUrl:Z("root","__unstableBase")?.home,hasMobileViewport:de.mobile!==void 0,hasTabletViewport:de.tablet!==void 0,isTemplate:te==="wp_template",isViewable:Q(te)?.viewable??!1,showIconLabels:ue("core","showIconLabels"),isTemplateHidden:z()==="post-only",templateId:D(),isResponsiveEditing:B(),isResponsiveEditingEnabled:O().responsiveEditingEnabled,hasBlockSelection:!!W(),activeComplementaryArea:V(je).getActiveComplementaryArea("core")}},[]),{setDeviceType:v,setRenderingMode:b,setDefaultRenderingMode:_}=q((0,yx.useDispatch)(I)),{resetZoomLevel:y,setStyleStateViewport:w,setResponsiveEditing:S}=q((0,yx.useDispatch)(Yq.store)),{enableComplementaryArea:x}=(0,yx.useDispatch)(je),C=V=>{v(V),y()},A=()=>{let V=!f;S(V),w(V?R2[r]??"default":"default"),V&&h&&!g&&x("core",cs.block)};if((0,dRe.useViewportMatch)("medium","<"))return null;let R={placement:"bottom-end"},N={className:"editor-preview-dropdown__toggle",iconPosition:"right",size:"compact",showTooltip:!c,disabled:t,accessibleWhenDisabled:t},k={"aria-label":(0,ki.__)("View options")},E={desktop:uR,mobile:p0,tablet:c2},M=[{value:"Desktop",label:(0,ki.__)("Desktop"),icon:uR,info:f?(0,ki.__)("Style all viewports."):(0,ki.__)("Preview desktop viewport.")},...i?[{value:"Tablet",label:(0,ki.__)("Tablet"),icon:c2,info:f?(0,ki.__)("Style tablet only."):(0,ki.__)("Preview tablet viewport.")}]:[],...n?[{value:"Mobile",label:(0,ki.__)("Mobile"),icon:p0,info:f?(0,ki.__)("Style mobile only."):(0,ki.__)("Preview mobile viewport.")}]:[]];return(0,Bn.jsx)(ja.DropdownMenu,{className:J("editor-preview-dropdown",`editor-preview-dropdown--${r.toLowerCase()}`,{"is-responsive-editing":f}),popoverProps:R,toggleProps:N,menuProps:k,icon:E[r.toLowerCase()],label:(0,ki.__)("View"),disableOpenOnArrowDown:t,children:({onClose:V})=>(0,Bn.jsxs)(Bn.Fragment,{children:[(0,Bn.jsx)(ja.MenuGroup,{children:(0,Bn.jsx)(ja.MenuItemsChoice,{choices:M,value:r,onSelect:C})}),m&&(0,Bn.jsx)(ja.MenuGroup,{children:(0,Bn.jsx)(ja.MenuItem,{icon:f?Io:void 0,isSelected:f,role:"menuitemcheckbox",onClick:A,info:(0,ki.__)("Style changes apply only to the selected viewport."),children:(0,ki.__)("Responsive styles")})}),s&&(0,Bn.jsx)(ja.MenuGroup,{children:(0,Bn.jsxs)(ja.MenuItem,{href:o,target:"_blank",icon:gs,onClick:V,children:[(0,ki.__)("View site"),(0,Bn.jsx)(Yt,{render:(0,Bn.jsx)("span",{}),children:(0,ki.__)("(opens in a new tab)")})]})}),!s&&!!d&&(0,Bn.jsx)(ja.MenuGroup,{children:(0,Bn.jsx)(ja.MenuItem,{icon:u?void 0:Io,isSelected:!u,role:"menuitemcheckbox",onClick:()=>{let F=u?"template-locked":"post-only";b(F),_(F),y()},children:(0,ki.__)("Show template")})}),l&&(0,Bn.jsx)(ja.MenuGroup,{children:(0,Bn.jsx)(iEe,{forceIsAutosaveable:e,onPreview:V})}),(0,Bn.jsx)(Yl.Slot,{name:"core/plugin-preview-menu",fillProps:{onClick:V}})]})})}var hRe=a(G(),1),qq=a(j(),1),gRe=a(U(),1),VP=a(Y(),1),Kq=a(be(),1);var Zq=a(Lt(),1),jD=a(xa(),1),vRe=a(Mo(),1);var bRe=a(T(),1),Llt=({disabled:e})=>{let{isZoomOut:t,showIconLabels:r,isDistractionFree:o}=(0,VP.useSelect)(u=>({isZoomOut:q(u(Kq.store)).isZoomOut(),showIconLabels:u(Zq.store).get("core","showIconLabels"),isDistractionFree:u(Zq.store).get("core","distractionFree")})),{resetZoomLevel:n,setZoomLevel:i}=q((0,VP.useDispatch)(Kq.store)),{registerShortcut:s,unregisterShortcut:l}=(0,VP.useDispatch)(jD.store);return(0,gRe.useEffect)(()=>(s({name:"core/editor/zoom",category:"global",description:(0,qq.__)("Enter or exit zoom out."),keyCombination:{modifier:(0,vRe.isAppleOS)()?"primaryShift":"secondary",character:"0"}}),()=>{l("core/editor/zoom")}),[s,l]),(0,jD.useShortcut)("core/editor/zoom",()=>{t?n():i("auto-scaled")},{isDisabled:o}),(0,bRe.jsx)(hRe.Button,{accessibleWhenDisabled:!0,disabled:e,onClick:()=>{t?n():i("auto-scaled")},icon:YB,label:(0,qq.__)("Zoom Out"),isPressed:t,size:"compact",showTooltip:!r,className:"editor-zoom-out-toggle"})},yRe=Llt;var l2e=a(G(),1),Cx=a(U(),1),c2e=a(le(),1),rL=a(j(),1);var SRe=a(G(),1),xRe=a(U(),1);var wx=a(U(),1);function wRe(e){let[t,r]=(0,wx.useState)(e),[o,n]=(0,wx.useState)(e?"loading":"idle");t!==e&&(r(e),n(e?"loading":"idle"));let i=(0,wx.useCallback)(()=>n("loaded"),[]),s=(0,wx.useCallback)(()=>n("error"),[]);return{status:o,handleLoad:i,handleError:s}}var wu=a(T(),1);C2([rM]);var _Re="#1e1e1e",Vlt="#fff";function Blt({className:e,src:t,name:r,label:o,variant:n,size:i="default",borderColor:s,dimmed:l=!1,statusIndicator:c,style:u,...d}){let{status:f,handleLoad:m,handleError:h}=wRe(t),g=f==="loaded",v=n==="badge"&&!!r,b=r?r.split(/\s+/).slice(0,2).map(S=>S[0]).join("").toUpperCase():void 0,_=(0,xRe.useMemo)(()=>s&&Oo(s).isReadable(_Re,{level:"AA",size:"normal"})?_Re:Vlt,[s]),y={...u,...s?{"--editor-avatar-outline-color":s,"--editor-avatar-name-color":_}:{}},w=(0,wu.jsxs)("div",{className:J("editor-avatar",e,{"has-avatar-border-color":!!s,"has-src":g,"is-badge":v,"is-small":i==="small","is-dimmed":l}),style:y,role:r?"img":void 0,"aria-label":r||void 0,...d,children:[(0,wu.jsxs)("span",{className:"editor-avatar__image",children:[t&&(0,wu.jsx)("img",{src:t,alt:"",crossOrigin:"anonymous",className:"editor-avatar__img",onLoad:m,onError:h}),!g&&b]}),l&&!!c&&(0,wu.jsx)("span",{className:"editor-avatar__status-indicator",children:(0,wu.jsx)(SRe.Icon,{icon:c})}),v&&(0,wu.jsx)("span",{className:"editor-avatar__name",children:o||r})]});return r&&(!v||o)?(0,wu.jsxs)(Ze.Root,{children:[(0,wu.jsx)(Ze.Trigger,{render:w}),(0,wu.jsx)(Ze.Popup,{children:r})]}):w}var em=Blt;var CRe=a(U(),1),zD=a(j(),1),HD=a(T(),1);function jlt({className:e,max:t=3,children:r,...o}){let n=CRe.Children.toArray(r),i=n.slice(0,t),s=n.length-t;return(0,HD.jsxs)("div",{role:"group",className:J("editor-avatar-group",e),...o,children:[i,s>0&&(0,HD.jsx)("span",{className:"editor-avatar-group__overflow","aria-label":(0,zD.sprintf)((0,zD._n)("%d more collaborator","%d more collaborators",s),s),children:`+${s}`})]})}var Xq=jlt;var HP=a(j(),1),GD=a(G(),1);var BRe=a(Ol(),1);function tm(e){return e?.["48"]||e?.["96"]||e?.["24"]}var PRe=a(j(),1),Wg=a(hd(),1),kRe=a(Mp(),1);function RRe(e){return e.trim()}var BP=-16,zlt=16,ERe=20,TRe=["#6F42C1","#D94145","#FBBF24","#FF35EE","#879F11","#0F766E","#00CFFF"];function za(e){return TRe[e%TRe.length]}function ARe(e,t=10){if(!e)return"";let r=(0,PRe._x)("words","Word count type. Do not translate!"),o=e.trim(),n="";if(r==="words")n=o.split(" ",t).join(" ");else if(r==="characters_excluding_spaces"){let s=o.split("",t).join(""),l=s.length-s.replaceAll(" ","").length;n=o.split("",t+l).join("")}else r==="characters_including_spaces"&&(n=o.split("",t).join(""));return n!==o?n+"\u2026":n}function Gg(e){let t=e?.noteId,r=Array.isArray(t)?t:[t],o=new Set;for(let n of r){let i=Number(n);Number.isFinite(i)&&i>0&&o.add(i)}return[...o]}function IRe(e,t){let r=new Set(Gg(e)),o=Number(t);return r.has(o)?e:(r.add(o),{...e,noteId:[...r]})}var jP="core/note";function Hlt(e,t){if(t==null)return null;let r=null;if(e instanceof Wg.RichTextData?r=e.toHTMLString():typeof e=="string"&&(r=e),!r||r.indexOf("wp-note")===-1)return null;let o=String(t),i=(0,Wg.create)({html:r}).formats,s=-1;for(let l=0;ld.type===jP&&d.attributes&&d.attributes["data-id"]===o))s===-1&&(s=l);else if(s!==-1)return{start:s,end:l};return s!==-1?{start:s,end:i.length}:null}function UD(e,t){if(!e)return null;for(let r of Object.keys(e)){let o=Hlt(e[r],t);if(o)return{attributeKey:r,start:o.start,end:o.end}}return null}function WD(e){return`mark.wp-note[data-id="${String(e).replace(/["\\\n\r\f]/g,r=>r==='"'||r==="\\"?`\\${r}`:`\\${r.codePointAt(0).toString(16)} `)}"]`}function ORe(e){let t=e.ownerDocument.defaultView?.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;let r=t.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;let o=(0,kRe.getRectangleFromRange)(r);return!o||o.width===0&&o.height===0?null:o}var Ult=-1;function NRe(e,t){let r=UD(t,e?.id);return r?r.start:Ult}function MRe(e,t,r,o){let n=e.formats.slice();for(let l=r;l{let c=i.get(l);return c?c.end-c.start:0};for(let l=0;lf.type===jP);if(u.length===0)continue;u.length>1&&u.sort((f,m)=>s(m.attributes?.["data-id"])-s(f.attributes?.["data-id"]));let d=c.filter(f=>f.type!==jP);n[l]=[...u,...d]}return{...e,formats:n}}function Qq(e,t){if(!(e instanceof Wg.RichTextData))return null;let r=String(t),o=(0,Wg.create)({html:e.toHTMLString()}),n=!1,i=o.formats.map(s=>{if(!s)return s;let l=s.filter(c=>!(c.type===jP&&c.attributes?.["data-id"]===r));return l.length===s.length?s:(n=!0,l.length?l:void 0)});return n?Wg.RichTextData.fromHTMLString(new Wg.RichTextData({...o,formats:i}).toHTMLString()):null}function zP(e){return e.find(t=>t.status==="hold")??e[0]??null}function FRe(e,t){let r=new Set(Gg(e));return r.delete(Number(t)),{...e,noteId:r.size>0?[...r]:void 0}}function DRe({threads:e,selectedNoteId:t,blockRects:r,heights:o,scrollTop:n=0}){let i={},s=[...e].sort((b,_)=>(r[b.id]?.top??Number.MAX_VALUE)-(r[_.id]?.top??Number.MAX_VALUE)),l=Math.max(0,s.findIndex(b=>b.id===t)),c=s[l];if(!c||!r[c.id])return{positions:{}};let d=r[c.id].top||0,f=o[c.id]||0;i[c.id]=BP;let m=d+BP,h=f;for(let b=l+1;b=0;b--){let _=s[b],y=r[_.id];if(!y)continue;let w=y.top||0,S=o[_.id]||0,x=BP;w+S>g&&(x=g-w-S-ERe),i[_.id]=x,g=w+x}let v={};for(let b of s){let _=r[b.id];_&&i[b.id]!==void 0&&(v[b.id]=_.top+n+i[b.id])}return{positions:v}}function LRe(e,t,r){if(!t)return Promise.resolve(null);let o=e&&e!=="new"?`[role=treeitem][id="note-thread-${e}"]`:"[role=treeitem]:not([id])",n=r?`${o} ${r}`:o;return new Promise(i=>{if(t.querySelector(n))return i(t.querySelector(n));let s=null,l=new window.MutationObserver(()=>{t.querySelector(n)&&(clearTimeout(s),l.disconnect(),i(t.querySelector(n)))});l.observe(t,{childList:!0,subtree:!0}),s=setTimeout(()=>{l.disconnect(),i(null)},3e3)})}function us(e,t,r){return LRe(e,t,r).then(o=>{o&&(o.focus(),o.scrollIntoView({block:"nearest"}))})}function VRe(e,t){return LRe(e,t).then(r=>{r?.scrollIntoView({block:"nearest"})})}var Ha=a(T(),1);function jRe({activeCollaborators:e,popoverAnchor:t,setIsPopoverVisible:r,cursorRegistry:o}){let n=i=>{o.scrollToCursor(i,{behavior:"smooth",block:"center",highlightDuration:2e3})&&((0,BRe.speak)((0,HP.__)("Scrolled to cursor"),"polite"),r(!1))};return(0,Ha.jsx)(GD.Popover,{anchor:t,placement:"bottom",offset:8,className:"editor-collaborators-presence__list",onClose:()=>r(!1),children:(0,Ha.jsxs)("div",{className:"editor-collaborators-presence__list-content",children:[(0,Ha.jsxs)("div",{className:"editor-collaborators-presence__list-header",children:[(0,Ha.jsxs)("div",{className:"editor-collaborators-presence__list-header-title",children:[(0,HP.__)("Collaborators"),(0,Ha.jsx)("span",{children:e.length})]}),(0,Ha.jsx)("div",{className:"editor-collaborators-presence__list-header-action",children:(0,Ha.jsx)(GD.Button,{__next40pxDefaultSize:!0,icon:Fi,iconSize:24,label:(0,HP.__)("Close Collaborators List"),onClick:()=>r(!1)})})]}),(0,Ha.jsx)("div",{className:"editor-collaborators-presence__list-items",children:e.map(i=>{let s=i.isMe;return(0,Ha.jsxs)("button",{className:"editor-collaborators-presence__list-item",disabled:s,onClick:()=>n(i.clientId),children:[(0,Ha.jsx)(em,{src:tm(i.collaboratorInfo.avatar_urls),name:i.collaboratorInfo.name,borderColor:s?"var(--wp-admin-theme-color)":za(i.collaboratorInfo.id),dimmed:!i.isConnected}),(0,Ha.jsx)("div",{className:"editor-collaborators-presence__list-item-info",children:(0,Ha.jsx)("div",{className:"editor-collaborators-presence__list-item-name",children:s?(0,HP.__)("You"):i.collaboratorInfo.name})})]},i.clientId)})})]})})}function Wlt(e,t){e.classList.add("collaborators-overlay-cursor-highlighted"),setTimeout(()=>{e.classList.remove("collaborators-overlay-cursor-highlighted")},t)}function zRe(){let e=new Map;return{registerCursor(t,r){e.set(t,r)},unregisterCursor(t){e.delete(t)},scrollToCursor(t,r){let o=e.get(t);return o?(o.scrollIntoView({behavior:r?.behavior??"smooth",block:r?.block??"center",inline:r?.inline??"nearest"}),r?.highlightDuration&&Wlt(o,r.highlightDuration),!0):!1},removeAll(){e.clear()}}}var a2e=a(be(),1);var eL=a(Ce(),1),_u=a(U(),1),i2e=a(j(),1);var YD="0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)",Jq="9999px",$q="32px",eK="24px",qD="4px",KD="8px",tK="1px",HRe="2px",Yg="#fff",URe="11px",WRe="13px",rK="var(--wpds-typography-font-weight-emphasis, 600)",GRe="20px";var YRe=`
.editor-avatar {
position: relative;
display: inline-flex;
align-items: center;
border-radius: ${Jq};
flex-shrink: 0;
box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 2px) ${Yg}, ${YD};
}
.editor-avatar__image {
box-sizing: border-box;
position: relative;
width: ${$q};
height: ${$q};
border-radius: ${Jq};
border: 0;
background-color: var(--wp-admin-theme-color, #3858e9);
overflow: hidden;
overflow: clip;
flex-shrink: 0;
font-size: 0;
color: ${Yg};
}
.is-small > .editor-avatar__image {
width: ${eK};
height: ${eK};
}
.has-avatar-border-color > .editor-avatar__image {
border: var(--wp-admin-border-width-focus, 2px) solid var(--editor-avatar-outline-color);
background-clip: padding-box;
}
.has-avatar-border-color > .editor-avatar__image::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus, 2px) ${Yg};
pointer-events: none;
z-index: 1;
}
.editor-avatar__img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
opacity: 0;
}
.has-src > .editor-avatar__image > .editor-avatar__img {
opacity: 1;
}
.editor-avatar:not(.has-src) > .editor-avatar__image {
display: flex;
align-items: center;
justify-content: center;
font-size: ${URe};
font-weight: ${rK};
border: 0;
background-clip: border-box;
}
.editor-avatar:not(.has-src) > .editor-avatar__image::after {
content: none;
}
.editor-avatar:not(.has-src).has-avatar-border-color > .editor-avatar__image {
background-color: var(--editor-avatar-outline-color);
}
.editor-avatar__name {
font-size: ${WRe};
font-weight: ${rK};
line-height: ${GRe};
color: var(--editor-avatar-name-color, ${Yg});
min-width: 0;
padding-bottom: 2px; /* $grid-unit-05 / 2 */
overflow: hidden;
opacity: 0;
white-space: nowrap;
transition: opacity 0.15s cubic-bezier(0.15, 0, 0.15, 1);
}
.editor-avatar.is-badge {
display: inline-grid;
grid-template-columns: min-content 0fr;
column-gap: 0;
padding-inline-end: 0;
background-color: var(--wp-admin-theme-color, #3858e9);
transition:
grid-template-columns 0.3s cubic-bezier(0.15, 0, 0.15, 1),
column-gap 0.3s cubic-bezier(0.15, 0, 0.15, 1),
padding-inline-end 0.3s cubic-bezier(0.15, 0, 0.15, 1);
}
.editor-avatar.is-badge:hover {
grid-template-columns: min-content 1fr;
column-gap: ${qD};
padding-inline-end: ${KD};
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
}
.editor-avatar.is-badge:hover .editor-avatar__name {
opacity: 1;
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
}
.editor-avatar.is-badge.has-avatar-border-color {
background-color: var(--editor-avatar-outline-color);
}
@media (prefers-reduced-motion: reduce) {
.editor-avatar.is-badge,
.editor-avatar__name {
transition: none;
}
}
`;var qRe=`
.block-canvas-cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 20000;
}
.block-canvas-cover .collaborators-overlay-full {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.block-canvas-cover .collaborators-overlay-fixed {
position: fixed;
width: 100%;
height: 100%;
}
.collaborators-overlay-user {
position: absolute;
}
/* Cursor lines render below avatar labels across all users. The parent
.collaborators-overlay-user has no z-index so it does not create a
stacking context \u2014 children participate in the shared overlay context. */
.collaborators-overlay-user-cursor {
position: absolute;
z-index: 0;
width: ${HRe};
border-radius: ${tK};
outline: ${tK} solid ${Yg};
box-shadow: ${YD};
animation: collaborators-overlay-cursor-blink 1s infinite;
}
.collaborators-overlay-selection-rect {
position: absolute;
opacity: 0.15;
pointer-events: none;
border-radius: 2px;
}
/* Overlay-specific positioning applied to the Avatar cursor label. */
.collaborators-overlay-user-label.editor-avatar {
position: absolute;
z-index: 1;
transform: translate(-11px, -100%);
margin-top: -${qD};
pointer-events: auto;
overflow: visible;
width: max-content;
}
/* Avatar positioned above a highlighted block as a label. */
.collaborators-overlay-block-label.editor-avatar {
position: absolute;
z-index: 1;
transform: translateY(calc(-100% - ${KD}));
pointer-events: auto;
overflow: visible;
width: max-content;
}
@keyframes collaborators-overlay-cursor-blink {
0%, 45% { opacity: 1; }
55%, 95% { opacity: 0; }
100% { opacity: 1; }
}
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {
animation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;
}
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {
animation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;
}
@keyframes collaborators-overlay-cursor-highlight {
0%, 100% {
transform: scale(1);
filter: drop-shadow(0 0 0 transparent);
}
50% {
transform: scale(1.2);
filter: drop-shadow(0 0 8px currentColor);
}
}
@keyframes collaborators-overlay-label-highlight {
0%, 100% {
transform: translate(-11px, -100%) scale(1);
filter: drop-shadow(0 0 0 transparent);
}
50% {
transform: translate(-11px, -100%) scale(1.1);
filter: drop-shadow(0 0 6px currentColor);
}
}
.block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {
content: "";
position: absolute;
pointer-events: none;
top: 0;
right: 0;
bottom: 0;
left: 0;
outline-color: var(--collaborator-outline-color);
outline-style: solid;
outline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
outline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
box-shadow: inset 0 0 0 calc((var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1)) + 0.5px) rgba(${Yg}, 0.7);
z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
.collaborators-overlay-user-label,
.collaborators-overlay-user-cursor {
animation: none;
}
}
`;function KRe(e,t){let r=null,o=()=>{try{e()}catch{}r=setTimeout(o,t)};return r=setTimeout(o,t),()=>{r&&clearTimeout(r)}}var nK=a(le(),1),Sx=a(U(),1);var _x=a(U(),1);function ZD(e){let[t,r]=(0,_x.useState)(0),o=(0,_x.useRef)(null),n=(0,_x.useCallback)(()=>(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{r(i=>i+1)},e),()=>{o.current&&clearTimeout(o.current)}),[e]);return[t,n]}var{useActiveCollaborators:Glt,useResolvedSelection:Ylt}=q(nK.privateApis),{SelectionType:qlt}=q(nK.privateApis);function ZRe(e,t,r,o,n){let i=(0,Sx.useRef)(new Set),s=Glt(r??null,o??null),l=Ylt(r??null,o??null),[c,u]=(0,Sx.useState)([]),[d,f]=ZD(n);return(0,Sx.useEffect)(()=>{if(!t){u([]);return}let m=i.current,h=new Set,g=s.filter(y=>{let w=y.editorState?.selection?.type===qlt.WholeBlock;return!y.isMe&&w}).map(y=>{let w;try{({localClientId:w}=l(y.editorState?.selection))}catch{return null}return w?{blockId:w,color:y.isMe?"var(--wp-admin-theme-color)":za(y.collaboratorInfo.id),userName:y.collaboratorInfo.name,avatarUrl:tm(y.collaboratorInfo.avatar_urls)}:null}).filter(y=>!y||h.has(y.blockId)?!1:(h.add(y.blockId),!0)),v=new Set(g.map(y=>y.blockId));for(let y of m)if(!v.has(y)){let w=oK(t,y);w&&(w.classList.remove("is-collaborator-selected"),w.style.removeProperty("--collaborator-outline-color")),m.delete(y)}let b=[],_=e?.getBoundingClientRect()??null;return g.forEach(y=>{let{color:w,blockId:S,userName:x,avatarUrl:C}=y,A=oK(t,S);if(A&&(A.classList.add("is-collaborator-selected"),A.style.setProperty("--collaborator-outline-color",w),m.add(S),_)){let P=A.getBoundingClientRect();b.push({blockId:S,userName:x,avatarUrl:C,color:w,x:P.left-_.left,y:P.top-_.top})}}),u(b),()=>{for(let y of m){let w=oK(t,y);w&&(w.classList.remove("is-collaborator-selected"),w.style.removeProperty("--collaborator-outline-color"))}m.clear()}},[s,t,e,d,l]),{highlights:c,rerenderHighlightsAfterDelay:f}}var oK=(e,t)=>e.querySelector(`[data-block="${t}"]`);var sK=a(le(),1),t2e=a(Y(),1),$D=a(U(),1),r2e=a(Lt(),1);var $Re=a(le(),1);var Klt=500,XD=(e,t,r,o)=>e===null||!t?null:Zlt(t,e,r,o)??null,Zlt=(e,t,r,o)=>{let{node:n,offset:i}=iK(e,t,r),s=r.createRange();try{s.setStart(n,i)}catch{return null}s.collapse(!0);let l=s.getBoundingClientRect(),c=e.getBoundingClientRect(),u=0,d=0;l.x===0&&l.y===0&&l.width===0&&l.height===0?(u=c.left-o.left,d=c.top-o.top):(u=l.left-o.left,d=l.top-o.top);let f=l.height;if(f===0){let m=r.defaultView??window;f=parseInt(m.getComputedStyle(e).lineHeight,10)||c.height}return{x:u,y:d,height:f}},QD=(e,t,r,o,n)=>{let i=t,s=r;i>s&&([i,s]=[s,i]);let l=iK(e,i,o),c=iK(e,s,o),u=o.createRange();try{u.setStart(l.node,l.offset),u.setEnd(c.node,c.offset)}catch{return null}let d=u.getClientRects(),f=[];for(let m of d){if(m.width===0&&m.height===0)continue;let h=m.left-n.left,g=m.top-n.top;f.some(b=>b.x===h&&b.y===g&&b.width===m.width&&b.height===m.height)||f.push({x:h,y:g,width:m.width,height:m.height})}return f.length>0?f:null},XRe=(e,t,r)=>{let o=t.createRange();o.selectNodeContents(e);let n=o.getClientRects(),i=[];for(let s of n)s.width===0&&s.height===0||i.push({x:s.left-r.left,y:s.top-r.top,width:s.width,height:s.height});if(i.length===0){let s=e.getBoundingClientRect();s.width>0&&s.height>0&&i.push({x:s.left-r.left,y:s.top-r.top,width:s.width,height:s.height})}return i},QRe=(e,t,r)=>{let o=r.querySelectorAll("[data-block]"),n=-1,i=-1;for(let l=0;li&&([n,i]=[i,n]);let s=[];for(let l=n+1;l{let o=r.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT),n=0,i=null,s=null,l=1;for(;s=o.nextNode();){if(l++,l>Klt)return i?{node:i,offset:0}:{node:e,offset:0};let c=s.nodeValue?.length??0;if(s.nodeType===Node.ELEMENT_NODE)if(s.nodeName==="BR"){if(n+1>=t){let u=o.nextNode();return u?.nodeType===Node.TEXT_NODE?{node:u,offset:0}:i?{node:i,offset:i.nodeValue?.length??0}:{node:e,offset:0}}n+=1;continue}else continue;if(c!==0){if(n+c>=t)return{node:s,offset:t-n};n+=c,s.nodeType===Node.TEXT_NODE&&(i=s)}}return i&&i.nodeValue?.length?{node:i,offset:i.nodeValue.length}:{node:e,offset:0}},JRe=(e,t)=>e.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_FOLLOWING;var{SelectionDirection:Xlt,SelectionType:JD}=q($Re.privateApis);function UP(e,t){if(!t.localClientId)return null;let r=e.querySelector(`[data-block="${t.localClientId}"]`);if(!r||!t.attributeKey)return r;let o=CSS.escape(t.attributeKey);return r.querySelector(`[data-wp-block-attribute-key="${o}"]`)??r}function e2e(e,t,r,o){return e.type===JD.None||e.type===JD.WholeBlock?{}:e.type===JD.Cursor?Qlt(t,o):r?Jlt(e,t,r,o):{}}function Qlt(e,t){if(!e.localClientId)return{};let r=UP(t.editorDocument,e);return{coords:XD(e.richTextOffset,r,t.editorDocument,t.overlayRect)}}function Jlt(e,t,r,o){if(!t.localClientId||!r.localClientId||t.richTextOffset===null||r.richTextOffset===null)return{};let i=e.selectionDirection===Xlt.Backward?t:r,s,l=null;if(e.type===JD.SelectionInOneBlock){let u=$lt(t,r,o);s=u.rects,l=u.blockElement}else{let u=ect(t,r,o);s=u.rects,l=i.localClientId===u.firstBlockClientId?u.firstBlock:u.lastBlock}if(s.length>0)return{coords:XD(i.richTextOffset,l,o.editorDocument,o.overlayRect),selectionRects:s};let c=UP(o.editorDocument,t);return{coords:XD(t.richTextOffset,c,o.editorDocument,o.overlayRect)}}function $lt(e,t,r){let o=UP(r.editorDocument,e);return!o||e.richTextOffset===null||t.richTextOffset===null?{rects:[],blockElement:null}:{rects:QD(o,e.richTextOffset,t.richTextOffset,r.editorDocument,r.overlayRect)??[],blockElement:o}}function ect(e,t,r){let o=e,n=t,i=UP(r.editorDocument,o),s=UP(r.editorDocument,n);if(i&&s&&JRe(s,i)&&(o=t,n=e,[i,s]=[s,i]),!i||!s||o.richTextOffset===null||n.richTextOffset===null||!o.localClientId||!n.localClientId)return{rects:[],firstBlock:null,lastBlock:null,firstBlockClientId:null};let l=[],c=QD(i,o.richTextOffset,Number.MAX_SAFE_INTEGER,r.editorDocument,r.overlayRect);c&&l.push(...c);let u=QRe(o.localClientId,n.localClientId,r.editorDocument);for(let f of u){let m=XRe(f,r.editorDocument,r.overlayRect);l.push(...m)}let d=QD(s,0,n.richTextOffset,r.editorDocument,r.overlayRect);return d&&l.push(...d),{rects:l,firstBlock:i,lastBlock:s,firstBlockClientId:o.localClientId}}var{useActiveCollaborators:tct,useResolvedSelection:rct}=q(sK.privateApis),{SelectionType:xx}=q(sK.privateApis);function o2e(e,t,r,o,n){let i=tct(r??null,o??null),s=rct(r??null,o??null),l=(0,t2e.useSelect)(m=>m(r2e.store).get("core","showCollaborationCursor"),[]),[c,u]=(0,$D.useState)([]),[d,f]=ZD(n);return(0,$D.useEffect)(()=>{if(!e||!t){u([]);return}let m=e.getBoundingClientRect(),h={editorDocument:t,overlayRect:m},g=[],v=i.some(b=>!b.isMe);i.forEach(b=>{if(b.isMe&&(!l||!v))return;let _=b.editorState?.selection??{type:xx.None},y={richTextOffset:null,localClientId:null,attributeKey:null},w;if(_.type===xx.Cursor)try{y=s(_)}catch{return}else if(_.type===xx.SelectionInOneBlock||_.type===xx.SelectionInMultipleBlocks)try{y=s({type:xx.Cursor,cursorPosition:_.cursorStartPosition}),w=s({type:xx.Cursor,cursorPosition:_.cursorEndPosition})}catch{return}let S=b.collaboratorInfo.name,x=b.clientId,C=b.isMe?"var(--wp-admin-theme-color)":za(b.collaboratorInfo.id),A=tm(b.collaboratorInfo.avatar_urls),P=e2e(_,y,w,h);if(P.coords){let R={userName:S,clientId:x,color:C,avatarUrl:A,isMe:b.isMe,...P.coords};P.selectionRects&&(R.selectionRects=P.selectionRects),g.push(R)}}),u(g)},[t,s,e,i,l,d]),{cursors:c,rerenderCursorsAfterDelay:f}}var tf=a(T(),1),n2e=500,oct=1e4;function s2e({blockEditorDocument:e,postId:t,postType:r,cursorRegistry:o}){let[n,i]=(0,_u.useState)(null),{cursors:s,rerenderCursorsAfterDelay:l}=o2e(n,e??null,t??null,r??null,n2e),{highlights:c,rerenderHighlightsAfterDelay:u}=ZRe(n,e??null,t??null,r??null,n2e),d=(0,_u.useCallback)(()=>{l(),u()},[l,u]),f=(0,eL.useResizeObserver)(d);(0,_u.useEffect)(()=>{let v=l(),b=u();return()=>{v(),b()}},[l,u]),(0,_u.useEffect)(()=>{if(s.length!==0)return KRe(l,oct)},[s.length,l]);let m=(0,eL.useMergeRefs)([i,f]),h=(0,_u.useRef)(new Map);(0,_u.useEffect)(()=>{if(!o)return;let v=h.current,b=new Set(s.map(_=>_.clientId));for(let _ of v.keys())b.has(_)||(o.unregisterCursor(_),v.delete(_));for(let[_,y]of v.entries())o.registerCursor(_,y);return()=>o.removeAll()},[s,o]);let g=(0,_u.useCallback)(v=>b=>{b?h.current.set(v,b):h.current.delete(v)},[]);return(0,tf.jsxs)("div",{className:"collaborators-overlay-full",ref:m,children:[(0,tf.jsx)("style",{children:YRe+qRe}),s.map(v=>(0,tf.jsxs)("div",{children:[!v.isMe&&v.selectionRects?.map((b,_)=>(0,tf.jsx)("div",{className:"collaborators-overlay-selection-rect",style:{left:`${b.x}px`,top:`${b.y}px`,width:`${b.width}px`,height:`${b.height}px`,backgroundColor:v.color}},`${v.clientId}-sel-${_}`)),(0,tf.jsxs)("div",{ref:g(v.clientId),className:"collaborators-overlay-user",style:{left:`${v.x}px`,top:`${v.y}px`},children:[!v.isMe&&(0,tf.jsx)("div",{className:"collaborators-overlay-user-cursor",style:{backgroundColor:v.color,height:`${v.height}px`}}),(0,tf.jsx)(em,{className:"collaborators-overlay-user-label",variant:"badge",size:"small",src:v.avatarUrl,name:v.userName,label:v.isMe?(0,i2e.__)("You"):void 0,borderColor:v.color})]})]},v.clientId)),c.map(v=>(0,tf.jsx)(em,{className:"collaborators-overlay-block-label",variant:"badge",size:"small",src:v.avatarUrl,name:v.userName,borderColor:v.color,style:{left:`${v.x}px`,top:`${v.y}px`}},v.blockId))]})}var aK=a(T(),1),{BlockCanvasCover:nct}=q(a2e.privateApis);function tL({postId:e,postType:t,cursorRegistry:r}){return(0,aK.jsx)(nct.Fill,{children:({containerRef:o})=>(0,aK.jsx)(s2e,{blockEditorDocument:o.current?.ownerDocument,postId:e,postType:t,cursorRegistry:r})})}var dc=a(T(),1),{useActiveCollaborators:ict}=q(c2e.privateApis);function lK({postId:e,postType:t}){let r=ict(e,t),o=r.filter(f=>!f.isMe),n=(0,Cx.useMemo)(()=>[...r].sort((f,m)=>f.isMe&&!m.isMe?-1:!f.isMe&&m.isMe?1:0),[r]),[i]=(0,Cx.useState)(zRe),[s,l]=(0,Cx.useState)(!1),[c,u]=(0,Cx.useState)(null);if(o.length===0)return null;let d=r.find(f=>f.isMe);return(0,dc.jsxs)(dc.Fragment,{children:[(0,dc.jsxs)("div",{className:"editor-collaborators-presence",children:[(0,dc.jsx)(l2e.Button,{__next40pxDefaultSize:!0,className:"editor-collaborators-presence__button",onClick:()=>l(!s),isPressed:s,ref:u,"aria-label":(0,rL.sprintf)((0,rL.__)("Collaborators list, %d online"),n.length),children:(0,dc.jsxs)(Xq,{max:4,children:[d&&(0,dc.jsx)(em,{src:tm(d.collaboratorInfo.avatar_urls),name:d.collaboratorInfo.name,borderColor:"var(--wp-admin-theme-color)",size:"small"},d.clientId),o.map(f=>(0,dc.jsx)(em,{src:tm(f.collaboratorInfo.avatar_urls),name:f.collaboratorInfo.name,borderColor:za(f.collaboratorInfo.id),size:"small"},f.clientId))]})}),s&&(0,dc.jsx)(jRe,{activeCollaborators:n,popoverAnchor:c,setIsPopoverVisible:l,cursorRegistry:i})]}),(0,dc.jsx)(tL,{postId:e,postType:t,cursorRegistry:i})]})}var ko=a(T(),1);function sct({customSaveButton:e,forceIsDirty:t,setEntitiesSavedStatesCallback:r}){let o=(0,WP.useViewportMatch)("large"),n=(0,WP.useViewportMatch)("medium"),i=(0,WP.useMediaQuery)("(max-width: 403px)"),{postId:s,postType:l,isTextEditor:c,isPublishSidebarOpened:u,showIconLabels:d,hasFixedToolbar:f,hasBlockSelection:m,hasSectionRootClientId:h,isStylesCanvasActive:g}=(0,d2e.useSelect)(w=>{let{get:S}=w(f2e.store),{getEditorMode:x,getCurrentPostType:C,getCurrentPostId:A,isPublishSidebarOpened:P}=w(I),{getStylesPath:R,getShowStylebook:N}=q(w(I)),{getBlockSelectionStart:k,getSectionRootClientId:E}=q(w(u2e.store));return{postId:A(),postType:C(),isTextEditor:x()==="text",isPublishSidebarOpened:P(),showIconLabels:S("core","showIconLabels"),hasFixedToolbar:S("core","fixedToolbar"),hasBlockSelection:!!k(),hasSectionRootClientId:!!E(),isStylesCanvasActive:!!R()?.startsWith("/revisions")||N()}},[]),v=["post","page","wp_template"].includes(l)&&h,[b,_]=(0,p2e.useState)(!0),y=!i&&(!f||f&&(!m||b));return(0,ko.jsx)(OD,{toolbar:(0,ko.jsxs)(ko.Fragment,{children:[(0,ko.jsx)(jke,{disableBlockTools:g||c}),f&&n&&(0,ko.jsx)(Fke,{isCollapsed:b,onToggle:_})]}),center:y?(0,ko.jsxs)(ko.Fragment,{children:[(0,ko.jsx)(lK,{postType:l,postId:s}),(0,ko.jsx)(G3,{})]}):void 0,settings:(0,ko.jsxs)(ko.Fragment,{children:[!y&&!i&&(0,ko.jsx)(lK,{postType:l,postId:s}),!e&&!u&&(0,ko.jsx)(zF,{forceIsDirty:t}),(0,ko.jsx)(uRe,{}),(0,ko.jsx)(mRe,{forceIsAutosaveable:t,disabled:g}),(0,ko.jsx)(LS,{className:"editor-header__post-preview-button",forceIsAutosaveable:t}),o&&v&&(0,ko.jsx)(yRe,{disabled:g}),(o||!d)&&(0,ko.jsx)(Wh.Slot,{scope:"core"}),!e&&(0,ko.jsx)(oRe,{forceIsDirty:t,setEntitiesSavedStatesCallback:r}),e,(0,ko.jsx)(VD,{})]})})}var m2e=sct;var GP=a(Y(),1),nL=a(be(),1),h2e=a(Ce(),1),YP=a(U(),1),g2e=a(Lt(),1),v2e=a(Mo(),1);var oL=a(T(),1),{PrivateInserterLibrary:act}=q(nL.privateApis);function b2e(){let{blockSectionRootClientId:e,inserterSidebarToggleRef:t,inserter:r,showMostUsedBlocks:o,sidebarIsOpened:n}=(0,GP.useSelect)(m=>{let{getInserterSidebarToggleRef:h,getInserter:g,isPublishSidebarOpened:v}=q(m(I)),{getBlockRootClientId:b,isZoomOut:_,getSectionRootClientId:y}=q(m(nL.store)),{get:w}=m(g2e.store),{getActiveComplementaryArea:S}=m(je),x=()=>{if(_()){let C=y();if(C)return C}return b()};return{inserterSidebarToggleRef:h(),inserter:g(),showMostUsedBlocks:w("core","mostUsedBlocks"),blockSectionRootClientId:x(),sidebarIsOpened:!!(S("core")||v())}},[]),{setIsInserterOpened:i}=(0,GP.useDispatch)(I),{disableComplementaryArea:s}=(0,GP.useDispatch)(je),l=(0,h2e.useViewportMatch)("medium","<"),c=(0,YP.useRef)(),u=(0,YP.useCallback)(()=>{i(!1),t.current?.focus()},[t,i]),d=(0,YP.useCallback)(m=>{m.keyCode===v2e.ESCAPE&&!m.defaultPrevented&&(m.preventDefault(),u())},[u]),f=(0,oL.jsx)("div",{className:"editor-inserter-sidebar__content",children:(0,oL.jsx)(act,{showMostUsedBlocks:o,showInserterHelpPanel:!0,shouldFocusBlock:l,rootClientId:e??r.rootClientId,__experimentalInsertionIndex:r.insertionIndex,onSelect:r.onSelect,__experimentalInitialTab:r.tab,__experimentalInitialCategory:r.category,__experimentalFilterValue:r.filterValue,onPatternCategorySelection:n?()=>s("core"):void 0,ref:c,onClose:u})});return(0,oL.jsx)("div",{onKeyDown:d,className:"editor-inserter-sidebar",children:f})}var sL=a(be(),1),aL=a(Ce(),1),lL=a(Y(),1),cK=a(Mp(),1),Su=a(U(),1),KP=a(j(),1),w2e=a(xa(),1),_2e=a(Mo(),1);var qP=a(G(),1),iL=a(j(),1);var Ri=a(T(),1);function y2e(){return(0,Ri.jsxs)(Ri.Fragment,{children:[(0,Ri.jsxs)("div",{className:"editor-list-view-sidebar__outline",children:[(0,Ri.jsxs)("div",{children:[(0,Ri.jsx)(qP.__experimentalText,{children:(0,iL.__)("Characters:")}),(0,Ri.jsx)(qP.__experimentalText,{children:(0,Ri.jsx)(lx,{})})]}),(0,Ri.jsxs)("div",{children:[(0,Ri.jsx)(qP.__experimentalText,{children:(0,iL.__)("Words:")}),(0,Ri.jsx)(sx,{})]}),(0,Ri.jsxs)("div",{children:[(0,Ri.jsx)(qP.__experimentalText,{children:(0,iL.__)("Time to read:")}),(0,Ri.jsx)(ax,{})]})]}),(0,Ri.jsx)(mS,{})]})}var qg=a(T(),1),{TabbedSidebar:lct}=q(sL.privateApis);function S2e(){let{setIsListViewOpened:e}=(0,lL.useDispatch)(I),{getListViewToggleRef:t}=q((0,lL.useSelect)(I)),r=(0,aL.useFocusOnMount)("firstElement"),o=(0,Su.useCallback)(()=>{e(!1),t().current?.focus()},[t,e]),n=(0,Su.useCallback)(v=>{v.keyCode===_2e.ESCAPE&&!v.defaultPrevented&&(v.preventDefault(),o())},[o]),[i,s]=(0,Su.useState)(null),[l,c]=(0,Su.useState)("list-view"),u=(0,Su.useRef)(),d=(0,Su.useRef)(),f=(0,Su.useRef)(),m=(0,aL.useMergeRefs)([r,f,s]);function h(v){let b=cK.focus.tabbable.find(d.current)[0];if(v==="list-view"){let _=cK.focus.tabbable.find(f.current)[0];(u.current.contains(_)?_:b).focus()}else b.focus()}let g=(0,Su.useCallback)(()=>{u.current.contains(u.current.ownerDocument.activeElement)?o():h(l)},[o,l]);return(0,w2e.useShortcut)("core/editor/toggle-list-view",g),(0,qg.jsx)("div",{className:"editor-list-view-sidebar",onKeyDown:n,ref:u,children:(0,qg.jsx)(lct,{tabs:[{name:"list-view",title:(0,KP._x)("List View","Post overview"),panel:(0,qg.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,qg.jsx)("div",{className:"editor-list-view-sidebar__list-view-panel-content",children:(0,qg.jsx)(sL.__experimentalListView,{dropZoneElement:i})})}),panelRef:m},{name:"outline",title:(0,KP._x)("Outline","Post overview"),panel:(0,qg.jsx)("div",{className:"editor-list-view-sidebar__list-view-container",children:(0,qg.jsx)(y2e,{})})}],onClose:o,onSelect:v=>c(v),defaultTabId:"list-view",ref:d,closeButtonLabel:(0,KP.__)("Close")})})}var XP=a(Y(),1),ZP=a(G(),1);var Zg=a(j(),1);var cL=a(Y(),1),Kg=a(G(),1),x2e=a(le(),1),rm=a(j(),1),uL=a(cn(),1),C2e=a(U(),1);var E2e=a(Ce(),1);var xu=a(T(),1);function cct(){let{revisions:e,perPage:t,currentRevisionId:r,revisionKey:o,revisionPage:n,totalRevisions:i}=(0,cL.useSelect)(w=>{let{getCurrentRevisionId:S,getRevisionPage:x,getPageRevisions:C,getRevisionsPerPage:A}=q(w(I)),P=w(I).getCurrentPostType();if(!P)return{};let N=w(x2e.store).getEntityConfig("postType",P)?.revisionKey||"id",k=x();return{revisions:C(k),perPage:A(),currentRevisionId:S(),revisionKey:N,revisionPage:k,totalRevisions:w(I).getCurrentPostRevisionsCount()}},[]),{setCurrentRevisionId:s,setRevisionPage:l}=q((0,cL.useDispatch)(I)),c=(0,E2e.useFocusOnMount)(!0),u=!e,d=Math.ceil(i/t)||1,f=(0,C2e.useMemo)(()=>e&&[...e].reverse(),[e]),m=f?.findIndex(w=>w[o]===r),h=w=>{let S=f?.[w];S&&s(S[o])},g=(0,uL.getSettings)(),v=w=>{let S=f?.[w];return S?(0,uL.dateI18n)(g.formats.datetime,S.date):w},b=d>1;if(u&&!b)return(0,xu.jsx)(Kg.Spinner,{});if(!u&&!f?.length)return(0,xu.jsx)("span",{className:"editor-revisions-header__no-revisions",children:(0,rm.__)("No revisions found.")});if(i<=1)return(0,xu.jsx)("span",{className:"editor-revisions-header__no-revisions",children:(0,rm.__)("Only one revision found.")});let _=w=>{let S=i-(w-1)*t,x=Math.max(1,S-t+1);return(0,rm.sprintf)((0,rm.__)("Revisions %1$s\u2013%2$s"),x,S)},y=u||m===-1?(0,xu.jsx)(Kg.Spinner,{}):(0,xu.jsx)(Kg.RangeControl,{ref:c,"aria-valuetext":v(m),className:"editor-revisions-header__slider",hideLabelFromVision:!0,label:(0,rm.__)("Revision"),max:f?.length-1,min:0,marks:!0,onChange:h,renderTooltipContent:v,value:m,withInputField:!1});return b?(0,xu.jsxs)(ae,{direction:"row",gap:"sm",align:"center",style:{flex:1},children:[(0,xu.jsx)(Kg.Button,{icon:Ar,label:nl(n+1),disabled:u||n>=d,size:"compact",accessibleWhenDisabled:!0}),(0,xu.jsx)("div",{style:{flex:1,minWidth:0,display:"flex",justifyContent:"center"},children:y}),(0,xu.jsx)(Kg.Button,{icon:hr,label:n>1?_(n-1):(0,rm.__)("No newer revisions"),onClick:()=>l(n-1),disabled:u||n<=1,size:"compact",accessibleWhenDisabled:!0})]}):y}var T2e=cct;var _l=a(T(),1);function uct({showDiff:e,onToggleDiff:t}){let{currentRevisionId:r,sidebarIsOpened:o}=(0,XP.useSelect)(d=>({currentRevisionId:q(d(I)).getCurrentRevisionId(),sidebarIsOpened:!!d(je).getActiveComplementaryArea("core")}),[]),{setCurrentRevisionId:n,restoreRevision:i}=q((0,XP.useDispatch)(I)),{enableComplementaryArea:s,disableComplementaryArea:l}=(0,XP.useDispatch)(je),c=!!r,u=()=>{r&&i(r)};return(0,_l.jsx)(OD,{className:"editor-revisions-header",toolbar:(0,_l.jsx)(ZP.Button,{__next40pxDefaultSize:!0,size:"compact",icon:mv,label:(0,Zg._x)("Show changes","revisions"),isPressed:e,onClick:t}),center:(0,_l.jsx)(T2e,{}),settings:(0,_l.jsxs)(_l.Fragment,{children:[(0,_l.jsx)(LS,{className:"editor-header__post-preview-button"}),(0,_l.jsx)(ZP.Button,{__next40pxDefaultSize:!0,icon:(0,Zg.isRTL)()?dv:wf,label:(0,Zg._x)("Settings","panel button label"),isPressed:o,"aria-expanded":o,onClick:()=>{o?l("core"):s("core",cs.document)},size:"compact"}),(0,_l.jsx)(ZP.Button,{__next40pxDefaultSize:!0,variant:"secondary",size:"compact",onClick:()=>n(null),children:(0,Zg.__)("Exit")}),(0,_l.jsx)(ZP.Button,{__next40pxDefaultSize:!0,accessibleWhenDisabled:!0,variant:"primary",size:"compact",className:"editor-revisions-header__restore-button",disabled:!c,onClick:u,children:(0,Zg.__)("Restore")}),(0,_l.jsx)(VD,{disabled:!0})]})})}var uK=uct;var tAe=a(G(),1),rAe=a(be(),1),wK=a(Y(),1),CL=a(U(),1),oAe=a(zn(),1),nAe=a(Pt(),1),Cl=a(j(),1);var fc=a(be(),1),Sl=a(U(),1),wL=a(Y(),1),gK=a(Pt(),1),K2e=a(le(),1),Tx=a(Ce(),1);var dK=a(Y(),1),P2e=a(le(),1),dL=a(U(),1),fK=a(j(),1),k2e=a(G(),1);var R2e=a(T(),1);function A2e({contentRef:e}){let{onNavigateToEntityRecord:t,templateId:r}=(0,dK.useSelect)(s=>{let{getEditorSettings:l,getCurrentTemplateId:c}=s(I);return{onNavigateToEntityRecord:l().onNavigateToEntityRecord,templateId:c()}},[]),o=(0,dK.useSelect)(s=>!!s(P2e.store).canUser("create",{kind:"postType",name:"wp_template"}),[]),[n,i]=(0,dL.useState)(!1);return(0,dL.useEffect)(()=>{let s=c=>{o&&(!c.target.classList.contains("is-root-container")||c.target.dataset?.type==="core/template-part"||c.defaultPrevented||(c.preventDefault(),i(!0)))},l=e.current;return l?.addEventListener("dblclick",s),()=>{l?.removeEventListener("dblclick",s)}},[e,o]),o?(0,R2e.jsx)(k2e.__experimentalConfirmDialog,{isOpen:n,confirmButtonText:(0,fK.__)("Edit template"),onConfirm:()=>{i(!1),t({postId:r,postType:"wp_template"})},onCancel:()=>i(!1),size:"medium",children:(0,fK.__)("You\u2019ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?")}):null}var O2e=a(Ce(),1),fL=a(Y(),1),pK=a(be(),1);var dct=500;function I2e(e,t,r){return Math.min(Math.max(e,t),r)}function fct(e,t,r){let o=e-I2e(e,r.left,r.right),n=t-I2e(t,r.top,r.bottom);return Math.sqrt(o*o+n*n)}function N2e({isEnabled:e=!0}={}){let{getEnabledClientIdsTree:t,getBlockName:r,getBlockOrder:o}=q((0,fL.useSelect)(pK.store)),{selectBlock:n}=(0,fL.useDispatch)(pK.store);return(0,O2e.useRefEffect)(i=>{if(!e)return;let s=(c,u)=>{let d=t().flatMap(({clientId:h})=>{let g=r(h);if(g==="core/template-part")return[];if(g==="core/post-content"){let v=o(h);if(v.length)return v}return[h]}),f=1/0,m=null;for(let h of d){let g=i.querySelector(`[data-block="${h}"]`);if(!g)continue;let v=g.getBoundingClientRect(),b=fct(c,u,v);b{(c.target===i||c.target.classList.contains("is-root-container"))&&s(c.clientX,c.clientY)};return i.addEventListener("click",l),()=>i.removeEventListener("click",l)},[e])}var pL=a(Y(),1),M2e=a(Ce(),1),mK=a(be(),1);function F2e(){let{getSettings:e,isZoomOut:t}=q((0,pL.useSelect)(mK.store)),{resetZoomLevel:r}=q((0,pL.useDispatch)(mK.store));return(0,M2e.useRefEffect)(o=>{function n(i){if(t()&&!i.defaultPrevented){i.preventDefault();let{__experimentalSetIsInserterOpened:s}=e();typeof s=="function"&&s(!1),r()}}return o.addEventListener("dblclick",n),()=>{o.removeEventListener("dblclick",n)}},[e,t,r])}var D2e=a(Y(),1),L2e=a(Ce(),1),mL=a(be(),1),V2e=a(Pt(),1),pct=':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';function B2e(e){let t=(0,D2e.useRegistry)(),r=(0,L2e.useRefEffect)(o=>{function n(s){if(s.target!==o&&s.target!==o.parentElement)return;let l=o.lastElementChild;if(!l)return;let c=l.getBoundingClientRect();if(s.clientY{i.removeEventListener("pointerdown",n)}},[t]);return e?[r,pct]:[]}var hL=a(Y(),1),j2e=a(Ce(),1),hK=a(be(),1);function z2e(){let{getEditedContentOnlySection:e}=q((0,hL.useSelect)(hK.store)),{stopEditingContentOnlySection:t}=q((0,hL.useDispatch)(hK.store));return(0,j2e.useRefEffect)(r=>{function o(n){let i=e();if(!i)return;!n.target.closest(`[data-block="${i}"]`)&&!n.defaultPrevented&&(n.preventDefault(),t())}return r.addEventListener("click",o),()=>{r.removeEventListener("click",o)}},[e,t])}var gL=a(Y(),1),U2e=a(Ce(),1),W2e=a(Pt(),1),vL=a(le(),1),bL=a(be(),1),rf=a(G(),1),G2e=a(zn(),1),Xg=a(U(),1),Eu=a(j(),1);var Ex=a(U(),1);function H2e(e){let[t,r]=(0,Ex.useState)(),o=(0,Ex.useRef)(!1);return(0,Ex.useEffect)(()=>{if(!e)return;if(e.status==="connected"){r(void 0),o.current=!1;return}if(e.status!=="disconnected"||!e.willAutoRetryInMs)return;let{willAutoRetryInMs:n}=e,i=Date.now()+n,s=o.current;o.current=!0,s&&r(0);let l=null,c=()=>{r(Math.ceil((i-Date.now())/1e3)),l=setInterval(()=>{let d=Math.ceil((i-Date.now())/1e3);r(Math.max(0,d)),d<=0&&l&&clearInterval(l)},1e3)},u=s?setTimeout(c,500):null;return u||c(),()=>{u&&clearTimeout(u),l&&clearInterval(l)}},[e]),{onManualRetry:()=>{r(0)},secondsRemaining:t}}var Cu=a(T(),1),{BlockCanvasCover:mct}=q(bL.privateApis),{retrySyncConnection:hct}=q(vL.privateApis),gct=2e4;function Y2e(){let[e,t]=(0,Xg.useState)(!1),[r,o]=(0,Xg.useState)(!1),[n,i]=(0,Xg.useState)(!1),{connectionStatus:s,isCollaborationEnabled:l,postType:c}=(0,gL.useSelect)(S=>{let{getSyncConnectionStatus:x,getPostType:C}=q(S(vL.store)),{getCurrentPostType:A,isCollaborationEnabledForCurrentPost:P}=q(S(I)),R=A();return{connectionStatus:x()||null,isCollaborationEnabled:P(),postType:R?C(R):null}},[]),{onManualRetry:u,secondsRemaining:d}=H2e(s),f=(0,U2e.useCopyToClipboard)(()=>{let S=(0,gL.select)(bL.store).getBlocks();return(0,W2e.serialize)(S)});(0,Xg.useEffect)(()=>{let S=setTimeout(()=>{t(!0)},gct);return()=>clearTimeout(S)},[]),(0,Xg.useEffect)(()=>{s?.status!=="connecting"&&i(s!==null&&"canManuallyRetry"in s&&s.canManuallyRetry===!0)},[s]);let m=s&&s.status==="disconnected"&&(s.canManuallyRetry||s.willAutoRetryInMs);(0,Xg.useEffect)(()=>{if(s?.status==="connected"){o(!1);return}s?.status&&s.status!=="connecting"&&(!m||s.backgroundRetriesFailed)&&o(!0)},[s,m]);let h=s?.status==="disconnected"&&"error"in s&&s.error?.code===tq;if(!l||!e&&!h||!r)return null;let g=s&&"error"in s?s?.error:void 0;if(!m&&(0,G2e.applyFilters)("editor.isSyncConnectionErrorHandled",!1,g?.code)!==!1)return null;let v=n?()=>{u(),hct()}:void 0,b=YCe(g),_="",y=!1;d&&d>0?_=(0,Eu.sprintf)((0,Eu._n)("Retrying connection in %d second\u2026","Retrying connection in %d seconds\u2026",d),d):d===0&&(y=!0,_=(0,Eu.__)("Retrying\u2026"));let w="edit.php";return c?.slug&&(w=`edit.php?post_type=${c.slug}`),(0,Cu.jsx)(mct.Fill,{children:(0,Cu.jsx)(rf.Modal,{overlayClassName:"editor-sync-connection-error-modal",isDismissible:!1,onRequestClose:()=>{},shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,size:"medium",title:b.title,children:(0,Cu.jsxs)(rf.__experimentalVStack,{spacing:6,children:[(0,Cu.jsx)("p",{children:b.description}),_&&(0,Cu.jsx)("p",{className:"editor-sync-connection-error-modal__retry-countdown",children:_}),(0,Cu.jsxs)(rf.__experimentalHStack,{justify:"right",children:[(0,Cu.jsx)(rf.Button,{__next40pxDefaultSize:!0,href:w,isDestructive:!0,variant:"tertiary",children:(0,Eu.sprintf)((0,Eu.__)("Back to %s"),c?.labels?.name??(0,Eu.__)("Posts"))}),(0,Cu.jsx)(rf.Button,{__next40pxDefaultSize:!0,ref:f,variant:v?"secondary":"primary",children:(0,Eu.__)("Copy Post Content")}),v&&(0,Cu.jsx)(rf.Button,{__next40pxDefaultSize:!0,accessibleWhenDisabled:!0,"aria-disabled":y,disabled:y,isBusy:y,variant:"primary",onClick:v,children:(0,Eu.__)("Retry")})]})]})})})}var di=a(T(),1),{LayoutStyle:yL,useLayoutClasses:vct,useLayoutStyles:bct,ExperimentalBlockCanvas:yct,useFlashEditableBlocks:wct}=q(fc.privateApis);function vK(e){for(let t=0;ti+(s-i)*l,o=1-Math.max(0,Math.min(1,(e-bK)/(t.width-bK))),n=r(t.width/t.height,_ct,o);return Math.min(Math.round(e/n),t.height)}function xct({autoFocus:e,iframeProps:t,contentRef:r,className:o}){let n=(0,Tx.useViewportMatch)("small","<"),{renderingMode:i,postContentAttributes:s,editedPostTemplate:l={},wrapperBlockName:c,wrapperUniqueId:u,deviceType:d,isFocusedEntity:f,isDesignPostType:m,postType:h,isPreview:g,styles:v,hasCanvasWidth:b,canvasWidth:_}=(0,wL.useSelect)(ce=>{let{getCurrentPostId:re,getCurrentPostType:ie,getCurrentTemplateId:Ee,getEditorSettings:ke,getRenderingMode:Me,getDeviceType:Ne,getCanvasWidth:Fe}=q(ce(I)),{getPostType:X,getEditedEntityRecord:ge}=ce(K2e.store),Ue=ie(),Ye=Me(),st;Ue===Nu?st="core/block":Ye==="post-only"&&(st="core/post-content");let St=ke(),dt=St.supportsTemplateMode,xt=X(Ue),Xt=Ee(),Xe=Fe(),ps=Xt?ge("postType",Cr,Xt):void 0;return{renderingMode:Ye,postContentAttributes:St.postContentAttributes,isDesignPostType:pm.includes(Ue),editedPostTemplate:xt?.viewable&&dt?ps:void 0,wrapperBlockName:st,wrapperUniqueId:re(),deviceType:Ne(),isFocusedEntity:!!St.onNavigateToPreviousEntityRecord,postType:Ue,isPreview:St.isPreviewMode,styles:St.styles,hasCanvasWidth:Xe!==void 0,canvasWidth:Xe}},[]),{isCleanNewPost:y}=(0,wL.useSelect)(I),{hasRootPaddingAwareAlignments:w,themeHasDisabledLayoutStyles:S,themeSupportsLayout:x,isZoomedOut:C}=(0,wL.useSelect)(ce=>{let{getSettings:re,isZoomOut:ie}=q(ce(fc.store)),Ee=re();return{themeHasDisabledLayoutStyles:Ee.disableLayoutStyles,themeSupportsLayout:Ee.supportsLayout,hasRootPaddingAwareAlignments:Ee.__experimentalFeatures?.useRootPaddingAwareAlignments,isZoomedOut:ie()}},[]),A=(0,Sl.useRef)(),[P]=(0,fc.useSettings)("layout"),[R,N]=(0,Sl.useState)(),k=(0,Tx.useResizeObserver)(ce=>{let{width:re,height:ie}=ce[0].contentRect;N(Ee=>Ee?.width===re&&Ee?.height===ie?Ee:{width:re,height:ie})}),E=(0,Sl.useMemo)(()=>i!=="post-only"||m?{type:"default"}:x?{...P,type:"constrained"}:{type:"default"},[i,x,P,m]),M=(0,Sl.useMemo)(()=>{if(!l?.content&&!l?.blocks&&s)return s;if(l?.blocks)return vK(l?.blocks);let ce=typeof l?.content=="string"?l?.content:"";return vK((0,gK.parse)(ce))||{}},[l?.content,l?.blocks,s]),V=(0,Sl.useMemo)(()=>{if(!l?.content&&!l?.blocks)return!1;if(l?.blocks)return q2e(l?.blocks);let ce=typeof l?.content=="string"?l?.content:"";return q2e((0,gK.parse)(ce))||!1},[l?.content,l?.blocks]),{layout:F={},align:D=""}=M||{},z=vct(M,"core/post-content"),L=J({"is-layout-flow":!x},x&&z,D&&`align${D}`),O=bct(M,"core/post-content",".block-editor-block-list__layout.is-root-container"),B=(0,Sl.useMemo)(()=>F&&(F?.type==="constrained"||F?.inherit||F?.contentSize||F?.wideSize)?{...P,...F,type:"constrained"}:{...P,...F,type:"default"},[F?.type,F?.inherit,F?.contentSize,F?.wideSize,P]),W=s?B:E,K=W?.type==="default"&&!V?E:W,Z=(0,Sl.useRef)();(0,Sl.useEffect)(()=>{!e||!y()||Z?.current?.focus()},[e,y]);let Q=`.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}
.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}
.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`,ue=[kk,Mi,Nu].includes(h),te=ue&&!g&&!n&&!C||b,de=h===kk&&g,[pe,$]=B2e(!g&&i==="post-only"&&!m),fe=te&&_&&R?.height>0&&R?.width>bK?Sct(_,R):"100%",ve="display:flex;align-items:center;justify-content:center;",Oe=b&&!ue?"min-height:100vh;":"",ee=(0,Sl.useMemo)(()=>[...v??[],{css:`:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${te||de?"min-height:0!important;":""}}
${$||""}
${te?`.block-editor-iframe__html{background:var(--wp-editor-canvas-background);min-height:100vh;${ve}}.block-editor-iframe__body{width:100%;${Oe}}`:""}${de?`.block-editor-iframe__body{${ve}padding:var(--wp--style--block-gap,2em);}`:""}`}],[v,te,ve,Oe,de,$]),ne=(0,fc.__unstableUseTypewriter)();return r=(0,Tx.useMergeRefs)([A,r,i==="post-only"?ne:null,wct({isEnabled:i==="template-locked"}),N2e({isEnabled:i==="template-locked"}),F2e(),pe,z2e()]),(0,di.jsxs)("div",{ref:k,className:J("editor-visual-editor","edit-post-visual-editor",o,{"has-vertical-padding":f||b,"has-horizontal-padding":f||te}),children:[(0,di.jsx)(Y2e,{}),(0,di.jsx)(fS,{enableResizing:te,width:te&&_?_+"px":"100%",height:fe,children:(0,di.jsxs)(yct,{shouldIframe:!0,contentRef:r,styles:ee,height:"100%",iframeProps:{...t,style:t?.style},children:[x&&!S&&i==="post-only"&&!m&&(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)(yL,{selector:".editor-visual-editor__post-title-wrapper",layout:E}),(0,di.jsx)(yL,{selector:".block-editor-block-list__layout.is-root-container",layout:K}),D&&(0,di.jsx)(yL,{css:Q}),O&&(0,di.jsx)(yL,{layout:B,css:O})]}),i==="post-only"&&!m&&(0,di.jsx)("div",{className:J("editor-visual-editor__post-title-wrapper","edit-post-visual-editor__post-title-wrapper",{"has-global-padding":w}),contentEditable:!1,style:{marginTop:"4rem"},children:(0,di.jsx)(cD,{ref:Z})}),(0,di.jsxs)(fc.RecursionProvider,{blockName:c,uniqueId:u,children:[(0,di.jsx)(fc.BlockList,{className:J("is-"+d.toLowerCase()+"-preview",i!=="post-only"||m?"wp-site-blocks":`${L} wp-block-post-content`,{"has-global-padding":i==="post-only"&&!m&&w}),layout:W,dropZoneElement:A.current?.parentNode,__unstableDisableDropZone:i==="template-locked"}),i==="template-locked"&&(0,di.jsx)(A2e,{contentRef:A})]})]})})]})}var _L=xct;var xl=a(U(),1),SL=a(Ce(),1),X2e=a(Y(),1),xL=a(be(),1),QP=a(j(),1);var Qg=a(T(),1),{useBlockElementRef:Cct}=q(xL.privateApis);function Q2e(e){let t=[];for(let r of e)r.__revisionDiffStatus?.status&&t.push({clientId:r.clientId,status:r.__revisionDiffStatus.status}),r.innerBlocks?.length&&t.push(...Q2e(r.innerBlocks));return t}var Z2e={added:(0,QP.__)("Go to added block"),removed:(0,QP.__)("Go to removed block"),modified:(0,QP.__)("Go to modified block")};function yK(e){if(!e)return null;let t=e.ownerDocument,r=t.documentElement.scrollHeight,o=e.getBoundingClientRect(),n=t.documentElement.scrollTop;return{top:(o.top+n)/r*100,height:o.height/r*100}}function Ect({clientId:e,status:t,subscribe:r}){let o=(0,xl.useRef)();Cct(e,o);let[n,i]=(0,xl.useState)(()=>yK(o.current));return(0,xl.useEffect)(()=>r(()=>{i(yK(o.current))}),[r]),(0,xl.useEffect)(()=>{i(yK(o.current))},[t]),n?(0,Qg.jsxs)(Ze.Root,{children:[(0,Qg.jsx)(Ze.Trigger,{render:(0,Qg.jsx)("button",{className:`revision-diff-marker is-${t}`,style:{top:`${n.top}%`,height:`${Math.max(n.height,.5)}%`},onClick:()=>o.current?.focus(),"aria-label":Z2e[t]})}),(0,Qg.jsx)(Ze.Popup,{children:Z2e[t]})]}):null}function J2e(){let[e,t]=(0,xl.useState)(!1),r=(0,xl.useRef)(new Set),o=(0,X2e.useSelect)(l=>l(xL.store).getBlocks(),[]),n=(0,xl.useMemo)(()=>Q2e(o),[o]),i=(0,xl.useCallback)(l=>(r.current.add(l),()=>r.current.delete(l)),[]),s=(0,SL.useRefEffect)(l=>{let{ownerDocument:c}=l,{defaultView:u}=c,d=new u.ResizeObserver(()=>{r.current.forEach(f=>f())});return d.observe(c.body),()=>{d.disconnect()}},[]);return[(0,SL.useMergeRefs)([s,t]),(0,Qg.jsx)("div",{className:"revision-diff-markers",role:"navigation","aria-label":(0,QP.__)("Document changes"),children:e&&n.map(({clientId:l,status:c})=>(0,Qg.jsx)(Ect,{clientId:l,status:c,subscribe:i},l))},"diff-markers")]}var ho=a(T(),1),{usePrivateStyleOverride:$2e,PrivateBlockContext:eAe}=q(rAe.privateApis),Tct=`
`,Pct=`
.is-revision-added {
box-shadow: inset 0 0 0 9999px color-mix(in srgb, currentColor 5%, #00a32a 15%), 0 0 0 4px color-mix(in srgb, currentColor 5%, #00a32a 15%);
outline: 3px solid #00a32a;
outline-offset: 2px;
}
.is-revision-removed,
.revision-diff-removed {
text-decoration: line-through;
filter: url(#revision-removed-filter);
}
.is-revision-removed {
outline: 3px dashed #d63638;
outline-offset: 2px;
}
.is-revision-modified {
outline: 3px dotted #9a7000 !important;
outline-offset: 2px;
}
.revision-diff-added {
background-color: color-mix(in srgb, currentColor 5%, #00a32a 15%);
text-decoration: none;
}
/* Reset UA styles so format markers keep the same look as before. */
mark.revision-diff-format-added,
mark.revision-diff-format-removed,
mark.revision-diff-format-changed {
background: transparent;
color: inherit;
padding: 0;
}
.revision-diff-format-added {
text-decoration: underline wavy color-mix(in srgb, currentColor 30%, #00a32a 70%);
text-decoration-thickness: 2px;
}
.revision-diff-format-removed {
text-decoration: underline wavy color-mix(in srgb, currentColor 20%, #d63638 80%);
text-decoration-thickness: 2px;
}
.revision-diff-format-changed {
text-decoration: underline wavy color-mix(in srgb, currentColor 30%, #dba617 70%);
text-decoration-thickness: 2px;
}
`;function kct(e,t){switch(e){case"added":return(0,Cl.sprintf)((0,Cl.__)("Added block: %s"),t);case"removed":return(0,Cl.sprintf)((0,Cl.__)("Removed block: %s"),t);case"modified":return(0,Cl.sprintf)((0,Cl.__)("Modified block: %s"),t)}}function Rct({status:e,name:t,attributes:r,children:o}){let n=(0,CL.useContext)(eAe),i=(0,wK.useSelect)(s=>{let{getActiveBlockVariation:l,getBlockType:c}=s(nAe.store);return l(t,r)?.title??c(t)?.title},[t,r]);return(0,ho.jsx)(eAe.Provider,{value:{...n,ariaLabel:i?kct(e,i):void 0},children:o})}function Act(e){return function(r){let{block:o,className:n,name:i,attributes:s}=r,l=o?.__revisionDiffStatus?.status,c=J(n,{"is-revision-added":l==="added","is-revision-removed":l==="removed","is-revision-modified":l==="modified"});return l?(0,ho.jsx)(Rct,{status:l,name:i,attributes:s,children:(0,ho.jsx)(e,{...r,className:c})}):(0,ho.jsx)(e,{...r,className:c})}}var Ict="editor/revisions-canvas/withRevisionDiffClasses";(0,oAe.addFilter)("editor.BlockListBlock",Ict,Act);function Oct({showDiff:e}){return $2e({css:e?Pct:""}),$2e({assets:e?Tct:"",__unstableType:"svgs"}),null}function Nct(){return(0,ho.jsxs)(Yt,{children:[(0,ho.jsx)("span",{id:nc.removed,children:(0,Cl.__)("Removed")}),(0,ho.jsx)("span",{id:nc.added,children:(0,Cl.__)("Added")}),(0,ho.jsx)("span",{id:nc.formatAdded,children:(0,Cl.__)("Format added")}),(0,ho.jsx)("span",{id:nc.formatRemoved,children:(0,Cl.__)("Format removed")}),(0,ho.jsx)("span",{id:nc.formatChanged,children:(0,Cl.__)("Format changed")})]})}function Mct({showDiff:e}){let[t,r]=J2e();return(0,ho.jsxs)(ho.Fragment,{children:[e&&(0,ho.jsx)(Nct,{}),(0,ho.jsx)(_L,{contentRef:t}),e&&r]})}function _K(){(0,CL.useEffect)(()=>(awe(),()=>{lwe()}),[]);let{revision:e,showDiff:t}=(0,wK.useSelect)(r=>{let{getCurrentRevision:o,isShowingRevisionDiff:n}=q(r(I));return{revision:o(),showDiff:n()}},[]);return e?(0,ho.jsxs)(ho.Fragment,{children:[(0,ho.jsx)(Oct,{showDiff:t}),(0,ho.jsx)("div",{className:"editor-revisions-canvas__content",children:(0,ho.jsx)(Mct,{showDiff:t})})]}):(0,ho.jsx)("div",{className:"editor-revisions-canvas__loading",children:(0,ho.jsx)(tAe.Spinner,{})})}var TL=a(Y(),1),EL=a(U(),1),pc=a(j(),1),iAe=a(It(),1),sAe=a(le(),1),aAe=a(Lt(),1);var{useOnCollaboratorJoin:Fct,useOnCollaboratorLeave:Dct,useOnPostSave:Lct}=q(sAe.privateApis),SK={COLLAB_POST_UPDATED:"collab-post-updated",COLLAB_USER_ENTERED:"collab-user-entered",COLLAB_USER_EXITED:"collab-user-exited"},xK=["publish","private","future"];function Vct(e,t,r){return r?(0,pc.sprintf)((0,pc.__)("Post published by %s."),e):xK.includes(t)?(0,pc.sprintf)((0,pc.__)("Post updated by %s."),e):(0,pc.sprintf)((0,pc.__)("Draft saved by %s."),e)}function lAe(e,t){let{postStatus:r,isCollaborationEnabled:o,showJoinNotifications:n,showLeaveNotifications:i,showPostSaveNotifications:s}=(0,TL.useSelect)(y=>{let{getCurrentPostAttribute:w,isCollaborationEnabledForCurrentPost:S}=q(y(I)),x=C=>y(aAe.store).get("core",C)??!0;return{postStatus:w("status"),isCollaborationEnabled:S(),showJoinNotifications:x("showCollaborationJoinNotifications"),showLeaveNotifications:x("showCollaborationLeaveNotifications"),showPostSaveNotifications:x("showCollaborationPostSaveNotifications")}},[]),{createNotice:l}=(0,TL.useDispatch)(iAe.store),c=o&&n,u=o&&i,d=o&&s,f=y=>y?[e,t]:[null,null],[m,h]=f(c),[g,v]=f(u),[b,_]=f(d);Fct(m,h,(0,EL.useCallback)((y,w)=>{c&&(w&&y.collaboratorInfo.enteredAt{u&&l("info",(0,pc.sprintf)((0,pc.__)("%s has left the post."),y.collaboratorInfo.name),{id:`${SK.COLLAB_USER_EXITED}-${y.collaboratorInfo.id}`,type:"snackbar",isDismissible:!1})},[l,u])),Lct(b,_,(0,EL.useCallback)((y,w,S)=>{if(!d||!r)return;let x=y.postStatus??r??"draft",C=S?.postStatus??r,A=!(C&&xK.includes(C))&&xK.includes(x),P=Vct(w.collaboratorInfo.name,x,A);l("info",P,{id:`${SK.COLLAB_POST_UPDATED}-${w.collaboratorInfo.id}`,type:"snackbar",isDismissible:!1})},[l,r,d]))}var PL=a(Y(),1),JP=a(G(),1),CK=a(j(),1),cAe=a(U(),1);var mc=a(T(),1),{Fill:Q_r,Slot:Bct}=(0,JP.createSlotFill)("ActionsPanel");function uAe({setEntitiesSavedStatesCallback:e,closeEntitiesSavedStates:t,isEntitiesSavedStatesOpen:r,forceIsDirtyPublishPanel:o}){let{closePublishSidebar:n,togglePublishSidebar:i}=(0,PL.useDispatch)(I),{publishSidebarOpened:s,isPublishable:l,isDirty:c,hasOtherEntitiesChanges:u}=(0,PL.useSelect)(m=>{let{isPublishSidebarOpened:h,isEditedPostPublishable:g,isCurrentPostPublished:v,isEditedPostDirty:b,hasNonPostEntityChanges:_}=m(I),y=_();return{publishSidebarOpened:h(),isPublishable:!v()&&g(),isDirty:y||b(),hasOtherEntitiesChanges:y}},[]),d=(0,cAe.useCallback)(()=>e(!0),[]),f;return s?f=(0,mc.jsx)(AF,{onClose:n,forceIsDirty:o,PrePublishExtension:P6.Slot,PostPublishExtension:C6.Slot}):l&&!u?f=(0,mc.jsx)("div",{className:"editor-layout__toggle-publish-panel",children:(0,mc.jsx)(JP.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:i,"aria-expanded":!1,children:(0,CK.__)("Open publish panel")})}):f=(0,mc.jsx)("div",{className:"editor-layout__toggle-entities-saved-states-panel",children:(0,mc.jsx)(JP.Button,{__next40pxDefaultSize:!0,variant:"secondary",onClick:d,"aria-expanded":!1,"aria-haspopup":"dialog",disabled:!c,accessibleWhenDisabled:!0,children:(0,CK.__)("Open save panel")})}),(0,mc.jsxs)(mc.Fragment,{children:[r&&(0,mc.jsx)(l6,{close:t,renderDialog:!0}),(0,mc.jsx)(Bct,{bubblesVirtually:!0}),!r&&f]})}var dAe=a(G(),1),kL=a(Y(),1),EK=a(j(),1),fAe=a(xa(),1),RL=a(U(),1);var om=a(T(),1);function pAe({autoFocus:e=!1}){let{switchEditorMode:t}=(0,kL.useDispatch)(I),{shortcut:r,isRichEditingEnabled:o}=(0,kL.useSelect)(i=>{let{getEditorSettings:s}=i(I),{getShortcutRepresentation:l}=i(fAe.store);return{shortcut:l("core/editor/toggle-mode"),isRichEditingEnabled:s().richEditingEnabled}},[]),n=(0,RL.useRef)();return(0,RL.useEffect)(()=>{e||n?.current?.focus()},[e]),(0,om.jsxs)("div",{className:"editor-text-editor",children:[o&&(0,om.jsxs)("div",{className:"editor-text-editor__toolbar",children:[(0,om.jsx)("h2",{children:(0,EK.__)("Editing code")}),(0,om.jsx)(dAe.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>t("visual"),shortcut:r,children:(0,EK.__)("Exit code editor")})]}),(0,om.jsxs)("div",{className:"editor-text-editor__body",children:[(0,om.jsx)(dD,{ref:n}),(0,om.jsx)(PP,{})]})]})}var Pr=a(T(),1),mAe={header:(0,Jg.__)("Editor top bar"),body:(0,Jg.__)("Editor content"),sidebar:(0,Jg.__)("Editor settings"),actions:(0,Jg.__)("Editor publish"),footer:(0,Jg.__)("Editor footer")};function hAe(){let e=(0,$P.useSelect)(t=>t(Px.store).isValidTemplate(),[]);return(0,Pr.jsx)(wAe.ThemeProvider,{cornerRadius:"none",children:(0,Pr.jsx)(yAe.InlineNotices,{className:"editor-notices",pinnedNoticesClassName:"editor-notices__pinned",dismissibleNoticesClassName:"editor-notices__dismissible",children:!e&&(0,Pr.jsx)(o6,{})})})}function _Ae({className:e,children:t,forceIsDirty:r,contentRef:o,autoFocus:n,customSaveButton:i,customSavePanel:s,forceDisableBlockTools:l,iframeProps:c}){let{mode:u,postId:d,postType:f,isInserterOpened:m,isListViewOpened:h,isDistractionFree:g,isPreviewMode:v,showBlockBreadcrumbs:b,postTypeLabel:_,stylesPath:y,showStylebook:w,isRevisionsMode:S,showDiff:x}=(0,$P.useSelect)(V=>{let{get:F}=V(gAe.store),{getEditorSettings:D,getPostTypeLabel:z,getCurrentPostType:L,getCurrentPostId:O}=V(I),{getStylesPath:B,getShowStylebook:W,isRevisionsMode:K,isShowingRevisionDiff:Z}=q(V(I)),Q=D(),ue=V(I).getEditorMode();return!Q.richEditingEnabled&&ue==="visual"&&(ue="text"),!Q.codeEditingEnabled&&ue==="text"&&(ue="visual"),{mode:ue,postId:O(),postType:L(),isInserterOpened:V(I).isInserterOpened(),isListViewOpened:V(I).isListViewOpened(),isDistractionFree:F("core","distractionFree"),isPreviewMode:Q.isPreviewMode,showBlockBreadcrumbs:F("core","showBlockBreadcrumbs"),postTypeLabel:z(),stylesPath:B(),showStylebook:W(),isRevisionsMode:K(),showDiff:Z()}},[]),{setShowRevisionDiff:C}=q((0,$P.useDispatch)(I));lAe(d,f);let A=(0,vAe.useViewportMatch)("medium"),P=h?(0,Jg.__)("Document Overview"):(0,Jg.__)("Block Library"),R=w||y?.startsWith("/revisions"),N=!R,[k,E]=(0,AL.useState)(!1),M=(0,AL.useCallback)(V=>{typeof k=="function"&&k(V),E(!1)},[k]);return S?(0,Pr.jsx)(Fb,{className:J("editor-editor-interface",e),labels:mAe,header:(0,Pr.jsx)(uK,{showDiff:x,onToggleDiff:()=>C(!x)}),content:(0,Pr.jsx)(_K,{}),sidebar:(0,Pr.jsx)(Kl.Slot,{scope:"core"})}):(0,Pr.jsx)(Fb,{isDistractionFree:g,className:J("editor-editor-interface",e,{"is-entity-save-view-open":!!k,"is-distraction-free":g&&!v}),labels:{...mAe,secondarySidebar:P},header:!v&&(0,Pr.jsx)(m2e,{forceIsDirty:r,setEntitiesSavedStatesCallback:E,customSaveButton:i,forceDisableBlockTools:l}),editorNotices:(0,Pr.jsx)(hAe,{}),secondarySidebar:!v&&u==="visual"&&(m&&(0,Pr.jsx)(b2e,{})||h&&(0,Pr.jsx)(S2e,{})),sidebar:!v&&!g&&(0,Pr.jsx)(Kl.Slot,{scope:"core"}),content:(0,Pr.jsxs)(Pr.Fragment,{children:[!g&&!v&&(0,Pr.jsx)(hAe,{}),R&&(0,Pr.jsx)(CSe,{}),N&&(0,Pr.jsxs)(Pr.Fragment,{children:[!v&&u==="text"&&(0,Pr.jsx)(pAe,{autoFocus:n}),!v&&!A&&u==="visual"&&(0,Pr.jsx)(Px.BlockToolbar,{hideDragHandle:!0}),(v||u==="visual")&&(0,Pr.jsx)(_L,{contentRef:o,autoFocus:n,iframeProps:c}),t,(0,Pr.jsx)(tL,{postId:d,postType:f})]})]}),footer:!v&&!g&&A&&b&&u==="visual"&&(0,Pr.jsx)(Px.BlockBreadcrumb,{rootLabelText:_?(0,bAe.decodeEntities)(_):void 0}),actions:v?void 0:s||(0,Pr.jsx)(uAe,{closeEntitiesSavedStates:M,isEntitiesSavedStatesOpen:k,setEntitiesSavedStatesCallback:E,forceIsDirtyPublishPanel:r})})}var n4=a(be(),1),lk=a(Y(),1),iv=a(U(),1),Gx=a(j(),1);var IOe=a(xa(),1),OOe=a(G(),1);var SAe=a(Y(),1),xAe=a(Nl(),1);var CAe=a(T(),1),{OverridesPanel:jct}=q(xAe.privateApis);function EAe(){return(0,SAe.useSelect)(t=>t(I).getCurrentPostType()==="wp_block",[])?(0,CAe.jsx)(jct,{}):null}var cIe=a(Y(),1);var El=a(G(),1);var LAe=a(le(),1),VAe=a(Y(),1),BAe=a(U(),1),tv=a(j(),1),jAe=a(Mp(),1);var DL=a(Y(),1),tk=a(U(),1),MAe=a(j(),1),Ox=a(G(),1);var FAe=a(le(),1);var ek=a(Y(),1),ML=a(U(),1),OAe=a(le(),1);var hc=a(j(),1),TAe=a(U(),1),nm=a(G(),1),Rx=a(Y(),1),OL=a(le(),1),PAe=a(It(),1);var IL=a(Nt(),1);function kx(e){return typeof e.title=="string"?(0,IL.decodeEntities)(e.title):e.title&&"rendered"in e.title?(0,IL.decodeEntities)(e.title.rendered):e.title&&"raw"in e.title?(0,IL.decodeEntities)(e.title.raw):""}var $g=a(T(),1),zct=({items:e,closeModal:t})=>{let[r]=e,o=kx(r),{showOnFront:n,currentHomePage:i,isSaving:s}=(0,Rx.useSelect)(g=>{let{getEntityRecord:v,isSavingEntityRecord:b}=g(OL.store),_=v("root","site"),y=v("postType","page",_?.page_on_front);return{showOnFront:_?.show_on_front,currentHomePage:y,isSaving:b("root","site")}}),{saveEntityRecord:l}=(0,Rx.useDispatch)(OL.store),{createSuccessNotice:c,createErrorNotice:u}=(0,Rx.useDispatch)(PAe.store);async function d(g){g.preventDefault();try{await l("root","site",{page_on_front:r.id,show_on_front:"page"}),c((0,hc.__)("Homepage updated."),{type:"snackbar"})}catch(v){let b=v.message&&v.code!=="unknown_error"?v.message:(0,hc.__)("An error occurred while setting the homepage.");u(b,{type:"snackbar"})}finally{t?.()}}let f="";n==="posts"?f=(0,hc.__)("This will replace the current homepage which is set to display latest posts."):i&&(f=(0,hc.sprintf)((0,hc.__)('This will replace the current homepage: "%s"'),kx(i)));let m=(0,hc.sprintf)((0,hc.__)('Set "%1$s" as the site homepage? %2$s'),o,f).trim(),h=(0,hc.__)("Set homepage");return(0,$g.jsx)("form",{onSubmit:d,children:(0,$g.jsxs)(nm.__experimentalVStack,{spacing:"5",children:[(0,$g.jsx)(nm.__experimentalText,{children:m}),(0,$g.jsxs)(nm.__experimentalHStack,{justify:"right",children:[(0,$g.jsx)(nm.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},disabled:s,accessibleWhenDisabled:!0,children:(0,hc.__)("Cancel")}),(0,$g.jsx)(nm.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:s,accessibleWhenDisabled:!0,children:h})]})]})})},kAe=()=>{let{pageOnFront:e,pageForPosts:t}=(0,Rx.useSelect)(r=>{let{getEntityRecord:o,canUser:n}=r(OL.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0;return{pageOnFront:i?.page_on_front,pageForPosts:i?.page_for_posts}});return(0,TAe.useMemo)(()=>({id:"set-as-homepage",label:(0,hc.__)("Set as homepage"),isEligible(r){return!(r.status!=="publish"||r.type!=="page"||e===r.id||t===r.id)},modalFocusOnMount:"firstContentElement",RenderModal:zct}),[t,e])};var gc=a(j(),1),RAe=a(U(),1),im=a(G(),1),Ax=a(Y(),1),NL=a(le(),1),AAe=a(It(),1);var ev=a(T(),1),Hct=({items:e,closeModal:t})=>{let[r]=e,o=kx(r),{currentPostsPage:n,isPageForPostsSet:i,isSaving:s}=(0,Ax.useSelect)(g=>{let{getEntityRecord:v,isSavingEntityRecord:b}=g(NL.store),_=v("root","site");return{currentPostsPage:v("postType","page",_?.page_for_posts),isPageForPostsSet:_?.page_for_posts!==0,isSaving:b("root","site")}}),{saveEntityRecord:l}=(0,Ax.useDispatch)(NL.store),{createSuccessNotice:c,createErrorNotice:u}=(0,Ax.useDispatch)(AAe.store);async function d(g){g.preventDefault();try{await l("root","site",{page_for_posts:r.id,show_on_front:"page"}),c((0,gc.__)("Posts page updated."),{type:"snackbar"})}catch(v){let b=v.message&&v.code!=="unknown_error"?v.message:(0,gc.__)("An error occurred while setting the posts page.");u(b,{type:"snackbar"})}finally{t?.()}}let f=i&&n?(0,gc.sprintf)((0,gc.__)('This will replace the current posts page: "%s"'),kx(n)):(0,gc.__)("This page will show the latest posts."),m=(0,gc.sprintf)((0,gc.__)('Set "%1$s" as the posts page? %2$s'),o,f),h=(0,gc.__)("Set posts page");return(0,ev.jsx)("form",{onSubmit:d,children:(0,ev.jsxs)(im.__experimentalVStack,{spacing:"5",children:[(0,ev.jsx)(im.__experimentalText,{children:m}),(0,ev.jsxs)(im.__experimentalHStack,{justify:"right",children:[(0,ev.jsx)(im.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t?.()},disabled:s,accessibleWhenDisabled:!0,children:(0,gc.__)("Cancel")}),(0,ev.jsx)(im.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",disabled:s,accessibleWhenDisabled:!0,children:h})]})]})})},IAe=()=>{let{pageOnFront:e,pageForPosts:t}=(0,Ax.useSelect)(r=>{let{getEntityRecord:o,canUser:n}=r(NL.store),i=n("read",{kind:"root",name:"site"})?o("root","site"):void 0;return{pageOnFront:i?.page_on_front,pageForPosts:i?.page_for_posts}});return(0,RAe.useMemo)(()=>({id:"set-as-posts-page",label:(0,gc.__)("Set as posts page"),isEligible(r){return!(r.status!=="publish"||r.type!=="page"||e===r.id||t===r.id)},modalFocusOnMount:"firstContentElement",RenderModal:Hct}),[t,e])};var NAe=a(T(),1);function FL({postType:e,onActionPerformed:t,context:r}){let{defaultActions:o}=(0,ek.useSelect)(c=>{let{getEntityActions:u}=q(c(I));return{defaultActions:u("postType",e)}},[e]),n=(0,ek.useSelect)(c=>{if(e!=="page")return!1;let{getDefaultTemplateId:u,getEntityRecord:d,canUser:f}=c(OAe.store);if(!f("update",{kind:"root",name:"site"}))return!1;let h=u({slug:"front-page"});if(!h)return!0;let g=d("postType","wp_template",h);return g?g.slug!=="front-page":!0},[e]),i=kAe(),s=IAe(),{registerPostTypeSchema:l}=q((0,ek.useDispatch)(I));return(0,ML.useEffect)(()=>{l(e)},[l,e]),(0,ML.useMemo)(()=>{let c=[...o];if(n&&c.push(i,s),c=c.sort((u,d)=>d.id==="move-to-trash"?-1:0),c=c.filter(u=>u.context?u.context===r:!0),t)for(let u=0;u{d(f,{...m,onActionPerformed:h=>{m?.onActionPerformed&&m.onActionPerformed(h),t(c[u].id,h)}})}}}if(c[u].RenderModal){let d=c[u].RenderModal;c[u]={...c[u],RenderModal:f=>(0,NAe.jsx)(d,{...f,onActionPerformed:m=>{f.onActionPerformed&&f.onActionPerformed(m),t(c[u].id,m)}})}}}return c},[r,o,t,i,s,n])}var Ai=a(T(),1),{Menu:Ix,kebabCase:Uct}=q(Ox.privateApis);function DAe({postType:e,postId:t,onActionPerformed:r}){let[o,n]=(0,tk.useState)(null),{item:i,permissions:s}=(0,DL.useSelect)(d=>{let{getEditedEntityRecord:f,getEntityRecordPermissions:m}=q(d(FAe.store));return{item:f("postType",e,t),permissions:m("postType",e,t)}},[t,e]),l=(0,tk.useMemo)(()=>({...i,permissions:s}),[i,s]),c=FL({postType:e,onActionPerformed:r}),u=(0,tk.useMemo)(()=>c.filter(d=>!d.isEligible||d.isEligible(l)),[c,l]);return(0,Ai.jsxs)(Ai.Fragment,{children:[(0,Ai.jsxs)(Ix,{placement:"bottom-end",children:[(0,Ai.jsx)(Ix.TriggerButton,{render:(0,Ai.jsx)(Ox.Button,{size:"small",icon:bo,label:(0,MAe.__)("Actions"),disabled:!u.length,accessibleWhenDisabled:!0,className:"editor-all-actions-button"})}),(0,Ai.jsx)(Ix.Popover,{children:(0,Ai.jsx)(Yct,{actions:u,items:[l],setActiveModalAction:n})})]}),!!o&&(0,Ai.jsx)(Gct,{action:o,items:[l],closeModal:()=>n(null)})]})}function Wct({action:e,onClick:t,items:r}){let o=typeof e.label=="string"?e.label:e.label(r);return(0,Ai.jsx)(Ix.Item,{onClick:t,children:(0,Ai.jsx)(Ix.ItemLabel,{children:o})})}function Gct({action:e,items:t,closeModal:r}){let o=typeof e.label=="string"?e.label:e.label(t);return(0,Ai.jsx)(Ox.Modal,{title:e.modalHeader||o,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:r??(()=>{}),focusOnMount:"firstContentElement",size:"medium",overlayClassName:`editor-action-modal editor-action-modal__${Uct(e.id)}`,children:(0,Ai.jsx)(e.RenderModal,{items:t,closeModal:r})})}function Yct({actions:e,items:t,setActiveModalAction:r}){let o=(0,DL.useRegistry)();return(0,Ai.jsx)(Ix.Group,{children:e.map(n=>(0,Ai.jsx)(Wct,{action:n,onClick:()=>{if("RenderModal"in n){r(n);return}n.callback(t,{registry:o})},items:t},n.id))})}var Tu=a(T(),1),{Badge:qct}=q(El.privateApis);function rv({postType:e,postId:t,hideActions:r=!1,onActionPerformed:o,onClose:n}){let i=(0,BAe.useMemo)(()=>Array.isArray(t)?t:[t],[t]),{postTitle:s,icon:l,labels:c}=(0,VAe.useSelect)(f=>{let{getEditedEntityRecord:m,getCurrentTheme:h,getPostType:g}=f(LAe.store),{getPostIcon:v,getCurrentPostType:b,isRevisionsMode:_,getCurrentRevision:y}=q(f(I)),w="";if(_()){let x=b(),C=y();return w=C?.title?.rendered||C?.title?.raw||"",{postTitle:w,icon:v(x,{area:C?.area}),labels:g(x)?.labels}}let S=m("postType",e,i[0]);if(i.length===1){let{default_template_types:x=[]}=h()??{};w=([Cr,Mi].includes(e)?Al({template:S,templateTypes:x}):{})?.title||S?.title}return{postTitle:w,icon:v(e,{area:S?.area}),labels:g(e)?.labels}},[i,e]),u=A3(t),d=(0,tv.__)("No title");return c?.name&&i.length>1?d=(0,tv.sprintf)((0,tv.__)("%1$d %2$s"),i.length,c?.name):s&&(d=(0,jAe.__unstableStripHTML)(s)),(0,Tu.jsxs)(El.__experimentalVStack,{spacing:1,className:"editor-post-card-panel",children:[(0,Tu.jsxs)(El.__experimentalHStack,{spacing:2,className:"editor-post-card-panel__header",alignment:"flex-start",children:[(0,Tu.jsx)(El.Icon,{className:"editor-post-card-panel__icon",icon:l}),(0,Tu.jsxs)(El.__experimentalText,{numberOfLines:2,truncate:!0,className:"editor-post-card-panel__title",as:"h2",children:[(0,Tu.jsx)("span",{className:"editor-post-card-panel__title-name",children:d}),u&&i.length===1&&(0,Tu.jsx)(qct,{children:u})]}),!r&&i.length===1&&(0,Tu.jsx)(DAe,{postType:e,postId:i[0],onActionPerformed:o}),n&&(0,Tu.jsx)(El.Button,{size:"small",icon:i1,label:(0,tv.__)("Close"),onClick:n})]}),i.length>1&&(0,Tu.jsx)(El.__experimentalText,{className:"editor-post-card-panel__description",children:(0,tv.sprintf)((0,tv.__)("Changes will be applied to all selected %s."),c?.name?.toLowerCase())})]})}var zAe=a(G(),1),HAe=a(Y(),1),vc=a(j(),1),UAe=a(_w(),1),WAe=a(U(),1),TK=a(le(),1);var LL=a(T(),1),Kct=189;function GAe(){let e=(0,HAe.useSelect)(t=>{let{getEditedPostAttribute:r,getCurrentPostType:o,getCurrentPostId:n}=t(I),{canUser:i}=t(TK.store),{getEntityRecord:s}=t(TK.store),l=i("read",{kind:"root",name:"site"})?s("root","site"):void 0,c=o();return!(+n()===l?.page_for_posts)&&![Cr,Mi].includes(c)&&r("content")},[]);return(0,LL.jsx)(PK,{postContent:e})}function PK({postContent:e}){let t=(0,vc._x)("words","Word count type. Do not translate!"),r=(0,WAe.useMemo)(()=>e?(0,UAe.count)(e,t):0,[e,t]);if(!r)return null;let o=Math.round(r/Kct),n=(0,vc.sprintf)((0,vc._n)("%s word","%s words",r),r.toLocaleString()),i=o<=1?(0,vc.__)("1 minute"):(0,vc.sprintf)((0,vc._n)("%s minute","%s minutes",o),o.toLocaleString());return(0,LL.jsx)("div",{className:"editor-post-content-information",children:(0,LL.jsx)(zAe.__experimentalText,{children:(0,vc.sprintf)((0,vc.__)("%1$s, %2$s read time."),n,i)})})}var VL=a(G(),1),Nx=a(j(),1),YAe=a(Y(),1),BL=a(U(),1),qAe=a(be(),1);var sm=a(T(),1);function Zct(){let{postFormat:e}=(0,YAe.useSelect)(i=>{let{getEditedPostAttribute:s}=i(I);return{postFormat:s("format")??"standard"}},[]),t=fP.find(i=>i.id===e),[r,o]=(0,BL.useState)(null),n=(0,BL.useMemo)(()=>({anchor:r,placement:"left-start",offset:36,shift:!0}),[r]);return(0,sm.jsx)(MS,{children:(0,sm.jsx)(fr,{label:(0,Nx.__)("Format"),ref:o,children:(0,sm.jsx)(VL.Dropdown,{popoverProps:n,contentClassName:"editor-post-format__dialog",focusOnMount:!0,renderToggle:({isOpen:i,onToggle:s})=>(0,sm.jsx)(VL.Button,{size:"compact",variant:"tertiary","aria-expanded":i,"aria-label":(0,Nx.sprintf)((0,Nx.__)("Change format: %s"),t?.caption),onClick:s,children:t?.caption}),renderContent:({onClose:i})=>(0,sm.jsxs)("div",{className:"editor-post-format__dialog-content",children:[(0,sm.jsx)(qAe.__experimentalInspectorPopoverHeader,{title:(0,Nx.__)("Format"),onClose:i}),(0,sm.jsx)(pP,{})]})})})})}var KAe=Zct;var ZAe=a(G(),1),XAe=a(Y(),1),jL=a(j(),1),QAe=a(cn(),1);var kK=a(T(),1);function JAe(){let e=(0,XAe.useSelect)(t=>t(I).getEditedPostAttribute("modified"),[]);return e?(0,kK.jsx)("div",{className:"editor-post-last-edited-panel",children:(0,kK.jsx)(ZAe.__experimentalText,{children:(0,jL.sprintf)((0,jL.__)("Last edited %s."),(0,QAe.humanTimeDiff)(e))})}):null}var $Ae=a(G(),1),eIe=a(T(),1);function Xct({className:e,children:t}){return(0,eIe.jsx)($Ae.__experimentalVStack,{className:J("editor-post-panel__section",e),children:t})}var Mx=Xct;var am=a(j(),1),tIe=a(Ce(),1),zL=a(Y(),1),RK=a(le(),1),rIe=a(Nt(),1),Fx=a(G(),1),HL=a(U(),1),oIe=a(be(),1);var of=a(T(),1),Qct={};function nIe(){let{editEntityRecord:e}=(0,zL.useDispatch)(RK.store),{postsPageTitle:t,postsPageId:r,isTemplate:o,postSlug:n}=(0,zL.useSelect)(d=>{let{getEntityRecord:f,getEditedEntityRecord:m,canUser:h}=d(RK.store),g=h("read",{kind:"root",name:"site"})?f("root","site"):void 0,v=g?.page_for_posts?m("postType","page",g?.page_for_posts):Qct,{getEditedPostAttribute:b,getCurrentPostType:_}=d(I);return{postsPageId:v?.id,postsPageTitle:v?.title,isTemplate:_()===Cr,postSlug:b("slug")}},[]),[i,s]=(0,HL.useState)(null),l=(0,HL.useMemo)(()=>({anchor:i,placement:"left-start",offset:36,shift:!0}),[i]);if(!o||!["home","index"].includes(n)||!r)return null;let c=d=>{e("postType","page",r,{title:d})},u=(0,rIe.decodeEntities)(t);return(0,of.jsx)(fr,{label:(0,am.__)("Blog title"),ref:s,children:(0,of.jsx)(Fx.Dropdown,{popoverProps:l,contentClassName:"editor-blog-title-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:d,onToggle:f})=>(0,of.jsx)(Fx.Button,{size:"compact",variant:"tertiary","aria-expanded":d,"aria-label":(0,am.sprintf)((0,am.__)("Change blog title: %s"),u),onClick:f,children:u}),renderContent:({onClose:d})=>(0,of.jsxs)(of.Fragment,{children:[(0,of.jsx)(oIe.__experimentalInspectorPopoverHeader,{title:(0,am.__)("Blog title"),onClose:d}),(0,of.jsx)(Fx.__experimentalInputControl,{placeholder:(0,am.__)("No title"),value:t,onChange:(0,tIe.debounce)(c,300),label:(0,am.__)("Blog title"),help:(0,am.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media."),hideLabelFromVision:!0})]})})})}var Dx=a(j(),1),UL=a(Y(),1),AK=a(le(),1),Lx=a(G(),1),WL=a(U(),1),iIe=a(be(),1);var nf=a(T(),1);function sIe(){let{editEntityRecord:e}=(0,UL.useDispatch)(AK.store),{postsPerPage:t,isTemplate:r,postSlug:o}=(0,UL.useSelect)(c=>{let{getEditedPostAttribute:u,getCurrentPostType:d}=c(I),{getEditedEntityRecord:f,canUser:m}=c(AK.store),h=m("read",{kind:"root",name:"site"})?f("root","site"):void 0;return{isTemplate:d()===Cr,postSlug:u("slug"),postsPerPage:h?.posts_per_page||1}},[]),[n,i]=(0,WL.useState)(null),s=(0,WL.useMemo)(()=>({anchor:n,placement:"left-start",offset:36,shift:!0}),[n]);if(!r||!["home","index"].includes(o))return null;let l=c=>{e("root","site",void 0,{posts_per_page:c})};return(0,nf.jsx)(fr,{label:(0,Dx.__)("Posts per page"),ref:i,children:(0,nf.jsx)(Lx.Dropdown,{popoverProps:s,contentClassName:"editor-posts-per-page-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:c,onToggle:u})=>(0,nf.jsx)(Lx.Button,{size:"compact",variant:"tertiary","aria-expanded":c,"aria-label":(0,Dx.__)("Change posts per page"),onClick:u,children:t}),renderContent:({onClose:c})=>(0,nf.jsxs)(nf.Fragment,{children:[(0,nf.jsx)(iIe.__experimentalInspectorPopoverHeader,{title:(0,Dx.__)("Posts per page"),onClose:c}),(0,nf.jsx)(Lx.__experimentalNumberControl,{placeholder:0,value:t,spinControls:"custom",step:"1",min:"1",onChange:l,label:(0,Dx.__)("Posts per page"),help:(0,Dx.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting."),hideLabelFromVision:!0})]})})})}var Ua=a(j(),1),GL=a(Y(),1),IK=a(le(),1),sf=a(G(),1),YL=a(U(),1),aIe=a(be(),1);var bc=a(T(),1),Jct=[{label:(0,Ua._x)("Open",'Adjective: e.g. "Comments are open"'),value:"open",description:(0,Ua.__)("Visitors can add new comments and replies.")},{label:(0,Ua.__)("Closed"),value:"",description:[(0,Ua.__)("Visitors cannot add new comments or replies."),(0,Ua.__)("Existing comments remain visible.")].join(" ")}];function lIe(){let{editEntityRecord:e}=(0,GL.useDispatch)(IK.store),{allowCommentsOnNewPosts:t,isTemplate:r,postSlug:o}=(0,GL.useSelect)(c=>{let{getEditedPostAttribute:u,getCurrentPostType:d}=c(I),{getEditedEntityRecord:f,canUser:m}=c(IK.store),h=m("read",{kind:"root",name:"site"})?f("root","site"):void 0;return{isTemplate:d()===Cr,postSlug:u("slug"),allowCommentsOnNewPosts:h?.default_comment_status||""}},[]),[n,i]=(0,YL.useState)(null),s=(0,YL.useMemo)(()=>({anchor:n,placement:"left-start",offset:36,shift:!0}),[n]);if(!r||!["home","index"].includes(o))return null;let l=c=>{e("root","site",void 0,{default_comment_status:c?"open":null})};return(0,bc.jsx)(fr,{label:(0,Ua.__)("Discussion"),ref:i,children:(0,bc.jsx)(sf.Dropdown,{popoverProps:s,contentClassName:"editor-site-discussion-dropdown__content",focusOnMount:!0,renderToggle:({isOpen:c,onToggle:u})=>(0,bc.jsx)(sf.Button,{size:"compact",variant:"tertiary","aria-expanded":c,"aria-label":(0,Ua.__)("Change discussion settings"),onClick:u,children:t?(0,Ua.__)("Comments open"):(0,Ua.__)("Comments closed")}),renderContent:({onClose:c})=>(0,bc.jsxs)(bc.Fragment,{children:[(0,bc.jsx)(aIe.__experimentalInspectorPopoverHeader,{title:(0,Ua.__)("Discussion"),onClose:c}),(0,bc.jsxs)(sf.__experimentalVStack,{spacing:3,children:[(0,bc.jsx)(sf.__experimentalText,{children:(0,Ua.__)("Changes will apply to new posts only. Individual posts may override these settings.")}),(0,bc.jsx)(sf.RadioControl,{className:"editor-site-discussion__options",hideLabelFromVision:!0,label:(0,Ua.__)("Comment status"),options:Jct,onChange:l,selected:t})]})]})})})}var pr=a(T(),1),$ct="post-status";function uIe({onActionPerformed:e}){let{isRemovedPostStatusPanel:t,postType:r,postId:o}=(0,cIe.useSelect)(n=>{let{isEditorPanelRemoved:i,getCurrentPostType:s,getCurrentPostId:l}=n(I);return{isRemovedPostStatusPanel:i($ct),postType:s(),postId:l()}},[]);return(0,pr.jsx)(Mx,{className:"editor-post-summary",children:(0,pr.jsx)(ES.Slot,{children:n=>(0,pr.jsx)(pr.Fragment,{children:(0,pr.jsxs)(ae,{direction:"column",gap:"lg",children:[(0,pr.jsx)(rv,{postType:r,postId:o,onActionPerformed:e}),(0,pr.jsx)(rF,{withPanelBody:!1}),(0,pr.jsx)(CCe,{}),(0,pr.jsxs)(ae,{direction:"column",gap:"xs",children:[(0,pr.jsx)(GAe,{}),(0,pr.jsx)(JAe,{})]}),!t&&(0,pr.jsxs)(ae,{direction:"column",gap:"lg",children:[(0,pr.jsxs)(ae,{direction:"column",gap:"xs",children:[(0,pr.jsx)(wq,{}),(0,pr.jsx)(GF,{}),(0,pr.jsx)(wD,{}),(0,pr.jsx)(D6,{}),(0,pr.jsx)(R6,{}),(0,pr.jsx)(Y6,{}),(0,pr.jsx)(zCe,{}),(0,pr.jsx)(m6,{}),(0,pr.jsx)(KF,{}),(0,pr.jsx)(nIe,{}),(0,pr.jsx)(sIe,{}),(0,pr.jsx)(lIe,{}),(0,pr.jsx)(KAe,{}),n]}),(0,pr.jsx)(ox,{onActionPerformed:e})]})]})})})})}var xIe=a(j(),1),lm=a(Y(),1),Vx=a(le(),1);var rk=a(U(),1);var dIe=a(U(),1),fIe=a(Y(),1),out=a(Lt(),1);var nut=a(Y(),1),iut=a(Lt(),1);var hIe=a(Y(),1),gIe=a(le(),1);var pIe=a(xf(),1),{lock:Xxr,unlock:mIe}=(0,pIe.__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/views");function OK({kind:e,name:t,fields:r}){let o=Array.isArray(r)?r:r?.split(","),n=o?[...o].sort().join(","):void 0;return(0,hIe.useSelect)(i=>mIe(i(gIe.store)).getViewConfig(e,t,{fields:n}),[e,t,n])}var _Ie=a(j(),1);var vIe=a(G(),1),qL=a(Y(),1),KL=a(j(),1),bIe=a(vo(),1);var yIe=a(T(),1);function wIe(){let{lastRevisionId:e,revisionsCount:t,disableVisualRevisions:r}=(0,qL.useSelect)(i=>{let{getCurrentPostLastRevisionId:s,getCurrentPostRevisionsCount:l,getEditorSettings:c}=i(I);return{lastRevisionId:s(),revisionsCount:l(),disableVisualRevisions:!!c().disableVisualRevisions}},[]),{setCurrentRevisionId:o}=q((0,qL.useDispatch)(I)),n=r?{href:(0,bIe.addQueryArgs)("revision.php",{revision:e})}:{onClick:()=>o(e)};return(0,yIe.jsx)(vIe.Button,{...n,variant:"link",text:String(t),"aria-label":(0,KL.sprintf)((0,KL._n)("Open revisions screen: %d revision","Open revisions screen: %d revisions",t),t)})}var sut={id:"revisions",label:(0,_Ie.__)("Revisions"),readOnly:!0,enableSorting:!1,render:wIe,isVisible:e=>{let t=e._links?.["version-history"]?.[0]?.count??0;return!!(e._links?.["predecessor-version"]?.[0]?.id??null)&&t>=2}},SIe=sut;var yc=a(T(),1),aut={layout:{type:"panel"},fields:[]},lut=["form"];function cut(e){let{isPostStatusRemoved:t,featuredImageEnabled:r,excerptEnabled:o,discussionEnabled:n,pageAttributesEnabled:i}=(0,lm.useSelect)(l=>{let{isEditorPanelRemoved:c,isEditorPanelEnabled:u}=l(I);return{isPostStatusRemoved:c("post-status"),featuredImageEnabled:u("featured-image"),excerptEnabled:u("post-excerpt"),discussionEnabled:u("discussion-panel"),pageAttributesEnabled:u("page-attributes")}},[]);return(0,rk.useMemo)(()=>{if(!e.fields?.length)return e;let l={featured_media:r,excerpt:o,"post-content-info":!0,discussion:n&&!t,parent:i&&!t},c=d=>d in l?l[d]:!t,u=d=>d.reduce((f,m)=>{let h=typeof m=="string"?m:m.id;if(!c(h))return f;if(typeof m!="string"&&Array.isArray(m.children)){let g=u(m.children);return g.length&&f.push({...m,children:g}),f}return f.push(m),f},[]);return{...e,fields:u(e.fields)}},[e,t,r,o,n,i])}var ZL={wp_template:{root_site:{kind:"root",name:"site",fields:["posts_per_page","default_comment_status"],isVisible:e=>["home","index"].includes(e.slug??"")},posttype_page:{kind:"postType",name:"page",getId:e=>e(Vx.store).getEditedEntityRecord("root","site")?.page_for_posts,fields:["posts_page_title"],isVisible:e=>["home","index"].includes(e.slug??"")}}};function uut(e,t,r=()=>!0){let o=n=>n?.[t]??{};return{...e,getValue:({item:n})=>e.getValue?e.getValue({item:o(n)}):o(n)[e.id],setValue:({item:n,value:i})=>({[t]:e.setValue({item:o(n),value:i})}),render:e.render?n=>e.render({...n,item:o(n.item)}):void 0,isVisible:n=>r(n)&&!!n[t]}}function CIe({onActionPerformed:e}){let{postType:t,postId:r,isPostStatusRemoved:o,availableTemplates:n}=(0,lm.useSelect)(_=>{let{getCurrentPostType:y,getCurrentPostId:w,isEditorPanelRemoved:S,getEditorSettings:x}=_(I),C=_(Vx.store).getCurrentTheme()?.is_block_theme?null:x().availableTemplates??null;return{postType:y(),postId:w(),isPostStatusRemoved:S("post-status"),availableTemplates:C}},[]),{form:i}=OK({kind:"postType",name:t,fields:lut}),s=cut(i??aut),l=(0,lm.useSelect)(_=>!t||!r?null:_(Vx.store).getEditedEntityRecord("postType",t,r),[t,r]),c=SS(),u=(0,lm.useSelect)(_=>{let{getEditedEntityRecord:y,canUser:w}=_(Vx.store),S={};for(let[x,C]of Object.entries(ZL[t]??{})){if(!w("read",{kind:C.kind,name:C.name}))continue;let A=C.getId?C.getId(_):void 0;C.getId&&!A||(S[x]=y(C.kind,C.name,A))}return S},[t]),d=(0,rk.useMemo)(()=>{if(!l)return l;let _={...u};return n&&Object.keys(n).length&&(_.available_templates=n),{...l,..._}},[l,u,n]),{editEntityRecord:f}=(0,lm.useDispatch)(Vx.store),m=(0,lm.useRegistry)(),h=(0,rk.useMemo)(()=>{let _={};for(let[y,w]of Object.entries(ZL[t]??{}))for(let S of w.fields??[])_[S]=y;return _},[t]),g=nS({postType:t}),v=(0,rk.useMemo)(()=>g?.map(_=>{let y=h[_.id];return y?uut(_,y,ZL[t]?.[y]?.isVisible):_.id==="status"?{..._,elements:_.elements.filter(w=>w.value!=="trash")}:_.id==="template"?c?c==="classic"&&Object.keys(n??{}).length===0?{..._,readOnly:!0,render:()=>(0,xIe.__)("Default template")}:_:null:_}).filter(Boolean).concat(SIe),[g,c,n,h,t]);return(0,yc.jsx)(Mx,{className:"editor-post-summary",children:(0,yc.jsxs)(ae,{direction:"column",gap:"lg",children:[(0,yc.jsx)(rv,{postType:t,postId:r,onActionPerformed:e}),(0,yc.jsx)(GE,{data:d,fields:v,form:s,onChange:_=>{let y=ZL[t]??{},w={};for(let[S,x]of Object.entries(_)){let C=y[S];if(C){let A=C.getId?C.getId(m.select):void 0;f(C.kind,C.name,A,x)}else w[S]=x}Object.keys(w).length&&(w.status&&w.status!=="future"&&l?.status==="future"&&new Date(l.date)>new Date&&(w.date=null),w.status&&w.status==="private"&&l?.password&&(w.password=""),f("postType",t,r,w))}}),!o&&(0,yc.jsxs)(yc.Fragment,{children:[(0,yc.jsx)(ES.Slot,{children:_=>_.length>0&&(0,yc.jsx)(ae,{direction:"column",gap:"xs",children:_})}),(0,yc.jsx)(ox,{onActionPerformed:e})]})]})})}var VIe=a(Y(),1),JL=a(G(),1),BIe=a(j(),1),jIe=a(vo(),1);var XL=a(Y(),1),PIe=a(le(),1);var cm=a(cn(),1),Pu=a(U(),1),ov=a(j(),1);var wc=a(T(),1),dut=10,EIe=[],fut={pickerActivity:!0},put={type:"pickerActivity",titleField:"date",descriptionField:"details",fields:["author"],layout:{density:"compact"},page:1,perPage:dut},mut=864e5;function TIe(e){let t=(0,cm.getDate)(null).getTime(),r=(0,cm.getDate)(e??null);return t-r.getTime()>mut?(0,cm.dateI18n)((0,cm.getSettings)().formats.datetimeAbbreviated,r):(0,cm.humanTimeDiff)(r)}function kIe(e){return e.slug?.endsWith("-autosave-v1")??!1}function hut({item:e}){return kIe(e)?(0,wc.jsx)(xC,{intent:"none",children:(0,ov.__)("Autosave")}):null}function RIe(){let{setCurrentRevisionId:e}=q((0,XL.useDispatch)(I)),[t,r]=(0,Pu.useState)(put),{revisions:o,revisionKey:n,currentRevisionId:i}=(0,XL.useSelect)(h=>{let{getCurrentPostType:g}=h(I),{getCurrentRevisionId:v,getRevisionPage:b,getPageRevisions:_}=q(h(I)),{getEntityConfig:y}=h(PIe.store),w=g(),x=y("postType",w)?.revisionKey||"id",C=v();return{revisions:_(b()),revisionKey:x,currentRevisionId:C}},[]),s=!o,l=(0,Pu.useMemo)(()=>[{id:"date",label:(0,ov.__)("Date"),getValue:({item:h})=>{let g=TIe(h.date);return kIe(h)?(0,ov.sprintf)((0,ov.__)("%1$s, %2$s"),g,(0,ov.__)("Autosave")):g},render:({item:h})=>(0,wc.jsxs)(ae,{direction:"row",align:"center",gap:"sm",children:[(0,wc.jsx)(Ss,{variant:"heading-sm",render:(0,wc.jsx)("time",{dateTime:h.date}),children:TIe(h.date)}),(0,wc.jsx)(hut,{item:h})]}),enableSorting:!1,enableHiding:!1},eE,{id:"details",label:(0,ov.__)("Details"),render:({item:h})=>String(h[n])!==String(i)?null:(0,wc.jsx)(PK,{postContent:h.content?.raw}),enableSorting:!1,enableHiding:!1}],[n,i]),{data:c,paginationInfo:u}=(0,Pu.useMemo)(()=>gW(o||EIe,t,l),[o,t,l]);(0,Pu.useEffect)(()=>{if(!i||!o)return;let h=o.findIndex(v=>String(v[n])===String(i));if(h<0)return;let g=Math.floor(h/t.perPage)+1;r(v=>v.page===g?v:{...v,page:g})},[i,o,n,t.perPage]);let d=(0,Pu.useMemo)(()=>i?[String(i)]:EIe,[i]),f=(0,Pu.useCallback)(h=>{if(h.length===0)return;let g=h[h.length-1];e(Number(g))},[e]),m=(0,Pu.useCallback)(h=>String(h[n]),[n]);return(0,wc.jsx)("div",{className:"editor-post-revisions-timeline",children:(0,wc.jsxs)(lp,{view:t,onChangeView:r,fields:l,data:c,isLoading:s,paginationInfo:u,defaultLayouts:fut,getItemId:m,selection:d,onChangeSelection:f,children:[(0,wc.jsx)(lp.Layout,{}),(0,wc.jsx)(lp.Footer,{})]})})}var NIe=a(Y(),1),MIe=a(U(),1),FIe=a(j(),1);var AIe=a(G(),1);var nv=a(T(),1);function QL({title:e,entries:t,initialOpen:r,className:o}){if(!t)return null;let n=Object.entries(t).map(([i,s])=>(0,nv.jsx)(fr,{label:i,children:(0,nv.jsx)("span",{className:"editor-revision-fields-diff__value",children:s.map((l,c)=>l.added?(0,nv.jsx)("ins",{className:"editor-revision-fields-diff__added",children:l.value},c):l.removed?(0,nv.jsx)("del",{className:"editor-revision-fields-diff__removed",children:l.value},c):(0,nv.jsx)("span",{children:l.value},c))})},i));return(0,nv.jsx)(AIe.PanelBody,{title:e,initialOpen:r,children:(0,nv.jsx)("div",{className:o,children:n})})}var DIe=a(T(),1);function IIe(e){return e==null?"":typeof e=="object"?JSON.stringify(e,null,2):String(e)}function OIe(e){return!e||e==="[]"||e==="{}"}function LIe(){let{revision:e,previousRevision:t}=(0,NIe.useSelect)(o=>{let{getCurrentRevision:n,getPreviousRevision:i}=q(o(I));return{revision:n(),previousRevision:i()}},[]),r=(0,MIe.useMemo)(()=>{if(!e)return null;let o=e.meta??{},n=t?.meta??{},i=new Set([...Object.keys(o),...Object.keys(n)]),s={};for(let l of i){let c=IIe(o[l]),u=IIe(n[l]);OIe(c)&&OIe(u)||(s[l]=Q_(u,c))}return Object.keys(s).length===0?null:s},[e,t]);return(0,DIe.jsx)(QL,{title:(0,FIe.__)("Meta"),entries:r,initialOpen:!1,className:"editor-revision-meta-diff__content"})}var ku=a(T(),1);function zIe(){let{revisionId:e,postId:t}=(0,VIe.useSelect)(r=>{let{getCurrentRevisionId:o,getCurrentPostId:n}=q(r(I));return{revisionId:o(),postId:n()}},[]);return e?(0,ku.jsxs)(ku.Fragment,{children:[(0,ku.jsx)(Mx,{className:"editor-post-summary",children:(0,ku.jsxs)(JL.__experimentalVStack,{spacing:4,children:[(0,ku.jsx)(rv,{postId:t,hideActions:!0}),(0,ku.jsx)(JL.ExternalLink,{href:(0,jIe.addQueryArgs)("revision.php",{revision:e}),children:(0,BIe.__)("Open classic revisions screen")})]})}),(0,ku.jsx)(LIe,{}),(0,ku.jsx)(RIe,{})]}):null}var nk=a(Y(),1),MK=a(le(),1),KIe=a(G(),1),FK=a(j(),1),ZIe=a(be(),1),XIe=a(Pt(),1);var HIe=a(Y(),1),UIe=a(U(),1),NK=a(le(),1),WIe=a(Pt(),1),GIe=a(Nl(),1);var{EXCLUDED_PATTERN_SOURCES:gut,PATTERN_TYPES:vut}=q(GIe.privateApis);function YIe(e,t){return e.innerBlocks=e.innerBlocks.map(r=>YIe(r,t)),e.name==="core/template-part"&&e.attributes.theme===void 0&&(e.attributes.theme=t),e}function but(e,t){let r=(i,s,l)=>s===l.findIndex(c=>i.name===c.name),o=i=>t.area==="navigation-overlay"&&i.blockTypes?.includes("core/template-part/navigation-overlay")?!0:!gut.includes(i.source),n=i=>i.templateTypes?.includes(t.slug)||i.blockTypes?.includes("core/template-part/"+t.area);return e.filter((i,s,l)=>r(i,s,l)&&o(i)&&n(i))}function yut(e,t){return e.map(r=>({...r,keywords:r.keywords||[],type:vut.theme,blocks:(0,WIe.parse)(r.content,{__unstableSkipMigrationLogs:!0}).map(o=>YIe(o,t))}))}function qIe({area:e,name:t,slug:r}){let{blockPatterns:o,restBlockPatterns:n,currentThemeStylesheet:i}=(0,HIe.useSelect)(s=>{let{getEditorSettings:l}=s(I),c=l();return{blockPatterns:c.__experimentalAdditionalBlockPatterns??c.__experimentalBlockPatterns,restBlockPatterns:s(NK.store).getBlockPatterns(),currentThemeStylesheet:s(NK.store).getCurrentTheme().stylesheet}},[]);return(0,UIe.useMemo)(()=>{let s=[...o||[],...n||[]],l=but(s,{area:e,name:t,slug:r});return yut(l,i)},[e,t,r,o,n,i])}var ok=a(T(),1);function wut({availableTemplates:e,onSelect:t}){return!e||e?.length===0?null:(0,ok.jsx)(ZIe.__experimentalBlockPatternsList,{label:(0,FK.__)("Templates"),blockPatterns:e,onClickPattern:t,showTitlesAsTooltip:!0})}function _ut(){let{area:e,name:t,slug:r,postType:o,postId:n}=(0,nk.useSelect)(c=>{let{getCurrentPostType:u,getCurrentPostId:d}=c(I),{getEditedEntityRecord:f}=c(MK.store),m=u(),h=d(),g=f("postType",m,h);return{area:g?.area,name:g?.name,slug:g?.slug,postType:m,postId:h}},[]),{editEntityRecord:i}=(0,nk.useDispatch)(MK.store),s=qIe({area:e,name:t,slug:r}),l=async c=>{await i("postType",o,n,{blocks:c.blocks,content:(0,XIe.serialize)(c.blocks)})};return s?.length?(0,ok.jsx)(KIe.PanelBody,{title:(0,FK.__)("Design"),initialOpen:o===Mi,children:(0,ok.jsx)(wut,{availableTemplates:s,onSelect:l})}):null}function QIe(){let{postType:e}=(0,nk.useSelect)(t=>{let{getCurrentPostType:r}=t(I);return{postType:r()}},[]);return[Mi,Cr].includes(e)?(0,ok.jsx)(_ut,{}):null}var JIe=a(G(),1),ik=a(j(),1),$Ie=a(Y(),1),eOe=a(U(),1),tOe=a(Nt(),1);var sk=a(T(),1),{Tabs:DK}=q(JIe.privateApis),Sut=(e,t)=>{let{postTypeLabel:r,isRevisionsMode:o}=(0,$Ie.useSelect)(i=>{let{getPostTypeLabel:s}=i(I),{isRevisionsMode:l}=q(i(I));return{postTypeLabel:s(),isRevisionsMode:l()}},[]),n;return o?n=(0,ik.__)("Revision"):r?n=(0,tOe.decodeEntities)(r):n=(0,ik._x)("Document","noun, panel"),(0,sk.jsxs)(DK.TabList,{ref:t,children:[(0,sk.jsx)(DK.Tab,{tabId:cs.document,"data-tab-id":cs.document,children:n}),(0,sk.jsx)(DK.Tab,{tabId:cs.block,"data-tab-id":cs.block,children:(0,ik.__)("Block")})]})},rOe=(0,eOe.forwardRef)(Sut);var Bx=a(Y(),1),jx=a(le(),1),LK=a(be(),1),dm=a(G(),1),VK=a(U(),1),um=a(j(),1),oOe=a(Nt(),1),$L=a(Mo(),1),nOe=a(It(),1),iOe=a(Lt(),1);var jn=a(T(),1);function sOe(){let e=(0,Bx.useSelect)(x=>x(I).getCurrentTemplateId(),[]),[t,r]=(0,VK.useState)(!1),[o,n]=(0,VK.useState)(!1),s=!!sP()?.length,{onNavigateToEntityRecord:l,canCreateTemplate:c,hasGoBack:u,getEditorSettings:d}=(0,Bx.useSelect)(x=>{let{getEditorSettings:C}=x(I),A=C();return{onNavigateToEntityRecord:A.onNavigateToEntityRecord,canCreateTemplate:!!x(jx.store).canUser("create",{kind:"postType",name:"wp_template"}),hasGoBack:A.hasOwnProperty("onNavigateToPreviousEntityRecord"),getEditorSettings:C}},[]),{get:f}=(0,Bx.useSelect)(iOe.store),{createSuccessNotice:m}=(0,Bx.useDispatch)(nOe.store),{editedRecord:h,hasResolved:g}=(0,jx.useEntityRecord)("postType","wp_template",e),[v]=(0,jx.useEntityBlockEditor)("postType","wp_template",{id:e});if(!g)return null;let b=u?[{label:(0,um.__)("Go back"),onClick:()=>d().onNavigateToPreviousEntityRecord()}]:void 0,_=()=>{f("core/edit-site","welcomeGuideTemplate")||m((0,um.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:b})},y=(0,oOe.decodeEntities)(h.title),w=!!v?.length&&(0,jn.jsx)(LK.BlockPreview.Async,{children:(0,jn.jsx)(LK.BlockPreview,{blocks:v})}),S=()=>{if(!w)return null;if(s){let x=(0,um.__)("Change template");return(0,jn.jsxs)(Ze.Root,{children:[(0,jn.jsx)(Ze.Trigger,{render:(0,jn.jsx)("div",{className:"editor-template-actions-panel__preview",role:"button",tabIndex:0,"aria-label":x,onClick:()=>n(!0),onKeyDown:C=>{(C.keyCode===$L.ENTER||C.keyCode===$L.SPACE)&&(C.preventDefault(),n(!0))},children:w})}),(0,jn.jsx)(Ze.Popup,{children:x})]})}return(0,jn.jsx)("div",{className:"editor-template-actions-panel__preview",children:w})};return(0,jn.jsxs)(jn.Fragment,{children:[(0,jn.jsx)(dm.PanelBody,{title:(0,um.sprintf)((0,um.__)("Template: %s"),y),initialOpen:!1,children:(0,jn.jsxs)(dm.__experimentalVStack,{children:[S(),(0,jn.jsxs)(dm.__experimentalHStack,{children:[l&&(0,jn.jsx)(dm.Button,{className:"editor-template-actions-panel__action",__next40pxDefaultSize:!0,variant:"secondary",onClick:()=>{l({postId:h.id,postType:"wp_template"}),_()},children:(0,um.__)("Edit")}),c&&(0,jn.jsx)(dm.Button,{className:"editor-template-actions-panel__action",__next40pxDefaultSize:!0,variant:"secondary",onClick:()=>r(!0),children:(0,um.__)("Create new")})]})]})}),t&&(0,jn.jsx)(Tg,{onClose:()=>r(!1)}),o&&(0,jn.jsx)(zY,{onRequestClose:()=>n(!1)})]})}var zx=a(Y(),1),Hx=a(le(),1),BK=a(be(),1),Au=a(G(),1),aOe=a(U(),1),Ru=a(j(),1),lOe=a(Nt(),1),cOe=a(It(),1),uOe=a(Lt(),1);var Js=a(T(),1);function dOe(){let e=(0,zx.useSelect)(v=>v(I).getCurrentTemplateId(),[]),[t,r]=(0,aOe.useState)(!1),{onNavigateToEntityRecord:o,canCreateTemplate:n,hasGoBack:i,getEditorSettings:s}=(0,zx.useSelect)(v=>{let{getEditorSettings:b}=v(I),_=b();return{onNavigateToEntityRecord:_.onNavigateToEntityRecord,canCreateTemplate:!!v(Hx.store).canUser("create",{kind:"postType",name:"wp_template"})&&_.supportsTemplateMode,hasGoBack:_.hasOwnProperty("onNavigateToPreviousEntityRecord"),getEditorSettings:b}},[]),{get:l}=(0,zx.useSelect)(uOe.store),{createSuccessNotice:c}=(0,zx.useDispatch)(cOe.store),{editedRecord:u}=(0,Hx.useEntityRecord)("postType","wp_template",e),[d]=(0,Hx.useEntityBlockEditor)("postType","wp_template",{id:e});if(!e&&!n)return null;let f=i?[{label:(0,Ru.__)("Go back"),onClick:()=>s().onNavigateToPreviousEntityRecord()}]:void 0,m=()=>{l("core/edit-site","welcomeGuideTemplate")||c((0,Ru.__)("Editing template. Changes made here affect all posts and pages that use the template."),{type:"snackbar",actions:f})},h=u?(0,lOe.decodeEntities)(u.title):void 0,g=!!d?.length&&(0,Js.jsx)(BK.BlockPreview.Async,{children:(0,Js.jsx)(BK.BlockPreview,{blocks:d})});return(0,Js.jsxs)(Js.Fragment,{children:[(0,Js.jsx)(Au.PanelBody,{title:u?(0,Ru.sprintf)((0,Ru.__)("Template: %s"),h):(0,Ru.__)("Template"),initialOpen:!1,children:(0,Js.jsxs)(Au.__experimentalVStack,{children:[!e&&(0,Js.jsx)(Au.__experimentalText,{children:(0,Ru.__)("This page uses a classic template. To edit this template with blocks, create a block template.")}),u&&g&&(0,Js.jsx)("div",{className:"editor-template-actions-panel__preview",children:g}),(0,Js.jsxs)(Au.__experimentalHStack,{children:[u&&o&&(0,Js.jsx)(Au.Button,{className:"editor-template-actions-panel__action",__next40pxDefaultSize:!0,variant:"secondary",onClick:()=>{o({postId:u.id,postType:"wp_template"}),m()},children:(0,Ru.__)("Edit")}),n&&(0,Js.jsx)(Au.Button,{className:"editor-template-actions-panel__action",__next40pxDefaultSize:!0,variant:"secondary",onClick:()=>r(!0),children:e?(0,Ru.__)("Create new"):(0,Ru.__)("Create block template")})]})]})}),t&&(0,Js.jsx)(Tg,{onClose:()=>r(!1)})]})}var jK=a(T(),1);function fOe(){let e=SS();return e==="classic"?(0,jK.jsx)(dOe,{}):e==="block-theme"?(0,jK.jsx)(sOe,{}):null}var ak=a(Y(),1),pOe=a(be(),1),mOe=a(G(),1),hOe=a(j(),1);var e4=a(T(),1),{BlockQuickNavigation:xut}=q(pOe.privateApis),Cut="core/template-part";function Eut({postType:e}){let t=JM(),r=(0,ak.useSelect)(n=>{let{getPostBlocksByName:i}=q(n(I));return i(Cr===e?Cut:t)},[e,t]),{enableComplementaryArea:o}=(0,ak.useDispatch)(je);return r.length===0?null:(0,e4.jsx)(mOe.PanelBody,{title:(0,hOe.__)("Content"),children:(0,e4.jsx)(xut,{clientIds:r,onSelect:()=>{o("core","edit-post/document")}})})}function gOe(){let{postType:e,renderingMode:t}=(0,ak.useSelect)(r=>{let{getCurrentPostType:o,getRenderingMode:n}=q(r(I));return{postType:o(),renderingMode:n()}},[]);return t==="post-only"&&e!==Cr?null:(0,e4.jsx)(Eut,{postType:e})}var t4=a(Y(),1),vOe=a(U(),1),bOe=a(Pt(),1),o4=a(be(),1),yOe=a(G(),1),wOe=a(j(),1);var r4=a(T(),1),{BlockQuickNavigation:Tut}=q(o4.privateApis);function Put(){let e=(0,t4.useSelect)(o=>{let{getBlockTypes:n}=o(bOe.store);return n()},[]),t=(0,vOe.useMemo)(()=>e.filter(o=>o.category==="theme").map(({name:o})=>o),[e]),r=(0,t4.useSelect)(o=>{let{getBlocksByName:n}=o(o4.store);return n(t)},[t]);return r.length===0?null:(0,r4.jsx)(yOe.PanelBody,{title:(0,wOe.__)("Content"),children:(0,r4.jsx)(Tut,{clientIds:r})})}function _Oe(){return(0,t4.useSelect)(t=>{let{getCurrentPostType:r}=t(I);return r()},[])!==Mi?null:(0,r4.jsx)(Put,{})}var SOe=a(be(),1),xOe=a(Y(),1),COe=a(j(),1);var EOe=a(T(),1);function TOe(){let{block:e}=(0,xOe.useSelect)(r=>{let{getSelectedBlock:o}=r(SOe.store);return{block:o()}},[]);if(!e)return null;let t=e.attributes?.__revisionDiffStatus?.changedAttributes;return(0,EOe.jsx)(QL,{title:(0,COe.__)("Changed attributes"),entries:t,initialOpen:!0})}var Ux=a(Y(),1),POe=a(U(),1),kOe=a(be(),1),ROe=a(Lt(),1);function kut(){let{hasBlockSelection:e}=(0,Ux.useSelect)(n=>({hasBlockSelection:!!n(kOe.store).getBlockSelectionStart()}),[]),{getActiveComplementaryArea:t}=(0,Ux.useSelect)(je),{enableComplementaryArea:r}=(0,Ux.useDispatch)(je),{get:o}=(0,Ux.useSelect)(ROe.store);(0,POe.useEffect)(()=>{let n=t("core"),i=["edit-post/document","edit-post/block"].includes(n),s=o("core","distractionFree");!i||s||(e?r("core","edit-post/block"):r("core","edit-post/document"))},[e,t,r,o])}var AOe=kut;var eo=a(T(),1),{Tabs:Wx}=q(OOe.privateApis),Rut=!0,Aut=({tabName:e,keyboardShortcut:t,onActionPerformed:r,extraPanels:o})=>{let n=(0,iv.useRef)(null),i=(0,iv.useContext)(Wx.Context),s=(0,lk.useSelect)(c=>q(c(I)).isRevisionsMode());(0,iv.useEffect)(()=>{let c=Array.from(n.current?.querySelectorAll('[role="tab"]')||[]),u=c.find(m=>m.getAttribute("data-tab-id")===e),d=u?.ownerDocument.activeElement;c.some(m=>d&&d.id===m.id)&&u&&u.id!==d?.id&&u?.focus()},[e]);let l;if(s)l=(0,eo.jsx)(zIe,{});else{let c=window?.__experimentalDataFormInspector;l=(0,eo.jsxs)(eo.Fragment,{children:[c?(0,eo.jsx)(CIe,{onActionPerformed:r}):(0,eo.jsx)(uIe,{onActionPerformed:r}),(0,eo.jsx)(S6.Slot,{}),(0,eo.jsx)(gOe,{}),c&&(0,eo.jsx)(fOe,{}),(0,eo.jsx)(_Oe,{}),(0,eo.jsx)(QIe,{}),(0,eo.jsx)(QF,{}),(0,eo.jsx)(EAe,{}),o]})}return(0,eo.jsx)(Oy,{identifier:e,header:(0,eo.jsx)(Wx.Context.Provider,{value:i,children:(0,eo.jsx)(rOe,{ref:n})}),closeLabel:(0,Gx.__)("Close Settings"),className:"editor-sidebar__panel",headerClassName:"editor-sidebar__panel-tabs",title:(0,Gx._x)("Settings","panel button label"),toggleShortcut:t,icon:(0,Gx.isRTL)()?dv:wf,isActiveByDefault:Rut,children:(0,eo.jsxs)(Wx.Context.Provider,{value:i,children:[(0,eo.jsx)(Wx.TabPanel,{tabId:cs.document,focusable:!1,children:l}),(0,eo.jsxs)(Wx.TabPanel,{tabId:cs.block,focusable:!1,children:[(0,eo.jsx)(n4.BlockInspector,{}),s&&(0,eo.jsx)(TOe,{})]})]})})},Iut=({extraPanels:e,onActionPerformed:t})=>{AOe();let{tabName:r,keyboardShortcut:o}=(0,lk.useSelect)(s=>{let l=s(IOe.store).getShortcutRepresentation("core/editor/toggle-sidebar"),c=s(je).getActiveComplementaryArea("core"),u=[cs.block,cs.document].includes(c),d=c;return u||(d=s(n4.store).getBlockSelectionStart()?cs.block:cs.document),{tabName:d,keyboardShortcut:l}},[]),{enableComplementaryArea:n}=(0,lk.useDispatch)(je),i=(0,iv.useCallback)(s=>{s&&n("core",s)},[n]);return(0,eo.jsx)(Wx,{selectedTabId:r,onSelect:i,selectOnMove:!1,children:(0,eo.jsx)(Aut,{tabName:r,keyboardShortcut:o,onActionPerformed:t,extraPanels:e})})},NOe=Iut;var w4=a(j(),1),ff=a(Y(),1),y5e=a(U(),1),w5e=a(Ce(),1),_5e=a(xa(),1);var GK=a(be(),1);var S5e=a(Lt(),1);var df=a(U(),1),h4=a(j(),1),Xx=a(Y(),1);var pk=a(be(),1);var Kx=a(U(),1),d4=a(G(),1);var f4=a(Ce(),1),Ii=a(j(),1),fk=a(Y(),1),XOe=a(Mp(),1),p4=a(be(),1);var l4=a(j(),1),KOe=a(U(),1),ZOe=a(Ce(),1),i0=a(Y(),1),ck=a(be(),1);var VOe=a(G(),1);var i4=a(j(),1),af=a(cn(),1),MOe=a(le(),1),FOe=a(Y(),1),DOe=a(be(),1);var _c=a(T(),1);function LOe({avatar:e,name:t,date:r,userId:o}){let n=!!e,i=(0,af.getSettings)(),{currentUserAvatar:s,currentUserName:l,currentUserId:c,dateFormat:u=i.formats.date}=(0,FOe.useSelect)(v=>{let{canUser:b,getCurrentUser:_,getEntityRecord:y}=v(MOe.store),w=b("read",{kind:"root",name:"site"})?y("root","site"):void 0;if(n)return{dateFormat:w?.date_format};let{getSettings:S}=v(DOe.store),{__experimentalDiscussionSettings:x}=S(),C=x?.avatarURL,A=_();return{currentUserAvatar:A?.avatar_urls?.[48]??C,currentUserName:A?.name,currentUserId:A?.id,dateFormat:w?.date_format}},[n]),d=(0,af.getDate)(r),f=(0,af.dateI18n)("c",d),h=Math.floor((new Date-d)/(1e3*60*60*24))<30?(0,af.humanTimeDiff)(d):(0,af.dateI18n)(u,d),g=(0,af.dateI18n)((0,i4._x)("F j, Y g:i\xA0a","Note date full date format"),r);return(0,_c.jsxs)(_c.Fragment,{children:[(0,_c.jsx)("img",{src:e||s,className:"editor-collab-sidebar-panel__user-avatar",alt:(0,i4.__)("User avatar"),width:32,height:32,style:{borderColor:za(o??c)}}),(0,_c.jsxs)(ae,{direction:"column",children:[(0,_c.jsx)("span",{className:"editor-collab-sidebar-panel__user-name",children:t??l}),r&&(0,_c.jsxs)(Ze.Root,{children:[(0,_c.jsx)(Ze.Trigger,{render:(0,_c.jsx)("time",{dateTime:f,className:"editor-collab-sidebar-panel__user-time",children:h})}),(0,_c.jsx)(Ze.Popup,{children:g})]})]})]})}var o0=a(T(),1);function Yx({note:e,actions:t,className:r,children:o,...n}){return(0,o0.jsxs)(ae,{direction:"column",gap:"sm",className:r,...n,children:[(0,o0.jsxs)(ae,{direction:"row",align:"center",justify:"flex-start",gap:"md",children:[(0,o0.jsx)(LOe,{avatar:e?.author_avatar_urls?.[48],name:e?.author_name,date:e?.date,userId:e?.author}),t&&(0,o0.jsx)(VOe.FlexItem,{className:"editor-collab-sidebar-panel__note-actions",onClick:i=>i.stopPropagation(),children:(0,o0.jsx)(ae,{direction:"row",align:"center",children:t})})]}),o]})}var zK=a(U(),1),qx=a(G(),1);var s4=a(j(),1),WOe=a(Ce(),1),GOe=a(Mo(),1);var YOe=a(Mp(),1);var BOe=a(U(),1),jOe=a(Y(),1),zOe=a(le(),1);var HOe=a(T(),1),Out={name:"note-mentions",className:"editor-autocompleters__user editor-collab-sidebar-panel__mention-suggestion",triggerPrefix:"@",useItems(e){let t=(0,jOe.useSelect)(o=>{let{getUsers:n}=o(zOe.store);return n({context:"view",search:e})},[e]);return[(0,BOe.useMemo)(()=>t?t.map(o=>({key:`note-mention-${o.slug}`,value:o,label:iY(o)})):[],[t])]},getOptionCompletion(e){return{action:"insert-at-caret",value:(0,HOe.jsx)("span",{className:`wp-note-mention user-${e.id}`,children:"@"+e.name})}}},UOe=Out;var lf=a(T(),1),{RichTextControl:Nut}=q(gN),Mut=["core/bold","core/italic","core/link","core/code"],Fut=[UOe];function n0({onSubmit:e,onCancel:t,note:r,labels:o}){let[n,i]=(0,zK.useState)(r?.content?.raw??""),[s,l]=(0,zK.useState)(!1),c=(0,WOe.useInstanceId)(n0,"comment-input"),u=RRe((0,YOe.__unstableStripHTML)(n)),d=s||n===r?.content?.raw||!u.length;async function f(){if(d)return;l(!0);let m=n;await e(m)&&i(g=>g===m?"":g),l(!1)}return(0,lf.jsxs)(ae,{className:"editor-collab-sidebar-panel__note-form",direction:"column",gap:"lg",render:(0,lf.jsx)("form",{}),onSubmit:m=>{m.preventDefault(),f()},onKeyDown:m=>{if(GOe.isKeyboardEvent.primary(m,"Enter")){m.preventDefault(),f();return}m.key==="Escape"&&!m.defaultPrevented&&(m.preventDefault(),t(m))},children:[(0,lf.jsx)(Nut,{id:c,label:o?.input??(0,s4.__)("Note"),hideLabelFromVision:!0,value:n,onChange:i,placeholder:o?.placeholder,allowedFormats:Mut,completers:Fut}),(0,lf.jsxs)(ae,{direction:"row",align:"center",justify:"flex-end",gap:"sm",wrap:"wrap",children:[(0,lf.jsx)(qx.Button,{size:"compact",variant:"tertiary",onClick:t,children:(0,lf.jsx)(qx.__experimentalTruncate,{children:(0,s4.__)("Cancel")})}),(0,lf.jsx)(qx.Button,{size:"compact",accessibleWhenDisabled:!0,variant:"primary",type:"submit",disabled:d,children:(0,lf.jsx)(qx.__experimentalTruncate,{children:o?.submit??(0,s4.__)("Add note")})})]})]})}var qOe=a(T(),1);function a4({floating:e,className:t,style:r,children:o,...n}){let i=!!e;return(0,qOe.jsx)(ae,{direction:"column",className:J(t,{"is-floating":i}),ref:i?e.ref:void 0,style:i?{top:e.y,...r}:r,...n,children:o})}var c4=a(T(),1),{useBlockElement:Dut}=q(ck.privateApis);function uk({onSubmit:e,sidebarRef:t,floating:r}){let{clientId:o}=(0,i0.useSelect)(m=>{let{getSelectedBlockClientId:h}=m(ck.store);return{clientId:h()}},[]),n=(0,i0.useSelect)(m=>q(m(I)).getSelectedNote(),[]),i=Dut(o),{toggleBlockSpotlight:s}=q((0,i0.useDispatch)(ck.store)),{selectNote:l}=q((0,i0.useDispatch)(I)),{getSelectedNote:c}=q((0,i0.useSelect)(I)),u=(0,KOe.useRef)(!1),d=(0,ZOe.__experimentalUseFocusOutside)(m=>{m.relatedTarget?.closest(".editor-collab-sidebar-panel__add-note")||u.current||c()==="new"&&(s(o,!1),l(void 0))}),f=()=>{l(void 0),i?.focus(),s(o,!1)};return n!=="new"||!o?null:(0,c4.jsx)(a4,{floating:r,className:"editor-collab-sidebar-panel__add-note is-selected",gap:"md",tabIndex:0,"aria-label":(0,l4.__)("New note"),role:"treeitem",style:r?{opacity:r.y?void 0:0}:void 0,...d,children:(0,c4.jsx)(Yx,{children:(0,c4.jsx)(n0,{onSubmit:async m=>{u.current=!0;try{let h=await e({content:m});return h&&(l(h.id),us(h.id,t.current)),h}finally{u.current=!1}},onCancel:f,labels:{input:(0,l4.__)("New note"),placeholder:(0,l4.__)("Add a note or @ mention")}})})})}var cf=a(U(),1),s0=a(G(),1);var Cn=a(j(),1);var fi=a(T(),1),{Menu:dk}=q(s0.privateApis);function Lut({items:e,buttonRef:t}){return(0,fi.jsxs)(dk,{placement:"bottom-end",children:[(0,fi.jsx)(dk.TriggerButton,{render:(0,fi.jsx)(s0.Button,{ref:t,size:"small",icon:bo,label:(0,Cn.__)("Actions"),disabled:!e.length,accessibleWhenDisabled:!0})}),(0,fi.jsx)(dk.Popover,{modal:!1,children:e.map(r=>(0,fi.jsx)(dk.Item,{onClick:r.onClick,children:(0,fi.jsx)(dk.ItemLabel,{children:r.title})},r.id))})]})}function u4({note:e,parentNote:t,isSelected:r,onEditNote:o,onDeleteNote:n,onResolve:i}){let[s,l]=(0,cf.useState)(null),c=(0,cf.useRef)(null),u=(0,cf.useRef)(null),d=e?.content?.raw,[f,m]=(0,cf.useState)(d),[h,g]=(0,cf.useState)(!1),[v,b]=(0,cf.useState)(!1);f!==d&&(m(d),g(!1)),(0,cf.useLayoutEffect)(()=>{let R=u.current;R&&b(R.scrollHeight>R.clientHeight)},[d]);let _=e.parent===0,y=e.type==="note"&&e.meta&&(e.meta._wp_note_status==="resolved"||e.meta._wp_note_status==="reopen"),w=[{id:"edit",title:(0,Cn.__)("Edit"),isEligible:({status:R})=>R!=="approved",onClick:()=>l("edit")},{id:"reopen",title:(0,Cn._x)("Reopen","Reopen note"),isEligible:({status:R})=>R==="approved",onClick:()=>o({id:e.id,status:"hold"})},{id:"delete",title:(0,Cn.__)("Delete"),isEligible:()=>!0,onClick:()=>l("delete")}],S=t?.status!=="approved"?w.filter(R=>R.isEligible(e)):[],x=e.parent===0?(0,Cn.__)("Are you sure you want to delete this note? This will also delete all of this note's replies."):(0,Cn.__)("Are you sure you want to delete this reply?"),C=()=>{l(null),c.current?.focus()},A;if(s==="edit")A=(0,fi.jsx)(n0,{onSubmit:async R=>{let N=await o({id:e.id,content:R});return N&&C(),N},onCancel:C,note:e,labels:{submit:(0,Cn._x)("Update","verb"),input:(0,Cn.sprintf)((0,Cn.__)("Edit note %1$s by %2$s"),e.id,e.author_name)}});else{let R;if(y){let N=e.meta._wp_note_status==="resolved"?(0,Cn.__)("Marked as resolved"):(0,Cn.__)("Reopened"),k=e?.content?.raw;R=k&&typeof k=="string"&&k.trim()!==""?(0,Cn.sprintf)((0,Cn.__)("%1$s: %2$s"),N,k):N}else R=e?.content?.rendered;A=(0,fi.jsx)("div",{ref:u,className:J("editor-collab-sidebar-panel__note-content",{"editor-collab-sidebar-panel__resolution-text":y,"is-collapsed":!h}),dangerouslySetInnerHTML:{__html:R??""}})}let P=r?(0,fi.jsxs)(fi.Fragment,{children:[_&&i&&(0,fi.jsx)(s0.Button,{label:(0,Cn._x)("Resolve","Mark note as resolved"),size:"small",icon:fv,disabled:e.status==="approved",accessibleWhenDisabled:e.status==="approved",onClick:i}),(0,fi.jsx)(Lut,{items:S,buttonRef:c})]}):null;return(0,fi.jsxs)(Yx,{note:e,actions:P,role:e.parent!==0?"treeitem":void 0,children:[A,s==="delete"&&(0,fi.jsx)(s0.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{n(e),l(null)},onCancel:C,confirmButtonText:(0,Cn.__)("Delete"),children:x}),v&&s!=="edit"&&(0,fi.jsx)(Bte,{className:"editor-collab-sidebar-panel__show-more-button",variant:"unstyled",size:"small",onClick:()=>g(!h),children:h?(0,Cn.__)("Show less"):(0,Cn.__)("Show more")})]})}var Wa=a(T(),1),{useBlockElement:Vut}=q(p4.privateApis);function QOe({note:e,onEditNote:t,onAddReply:r,onDeleteNote:o,isSelected:n,sidebarRef:i,floating:s,onKeyDown:l}){let c=!!s,{toggleBlockHighlight:u,selectBlock:d,toggleBlockSpotlight:f}=q((0,fk.useDispatch)(p4.store)),{selectNote:m}=q((0,fk.useDispatch)(I)),{getSelectedNote:h}=q((0,fk.useSelect)(I)),g=Vut(e.blockClientId),v=(0,f4.useDebounce)(u,50),b=(0,Kx.useRef)(null),_=(0,Kx.useRef)(!1),y=s?.registerThread,w=s?.unregisterThread;(0,Kx.useEffect)(()=>{let D=b.current;return D&&y&&y(e.id,g,D),()=>w?.(e.id)},[g,e.id,y,w]),(0,Kx.useEffect)(()=>{!n||e.id==="new"||VRe(e.id,i.current)},[n,s?.y,e.id,i]);let S=(0,f4.__experimentalUseFocusOutside)(D=>{let z=D.relatedTarget?.closest(".editor-collab-sidebar-panel__thread");z&&!_.current||(z||(v.cancel(),u(e.blockClientId,!1)),h()===e.id&&R())});function x(){v(e.blockClientId,!0)}function C(){v(e.blockClientId,!1)}function A(D){S.onFocus(D),v.cancel(),u(e.blockClientId,!0)}function P(){n||(m(e.id),us(e.id,i.current),f(e.blockClientId,!0),e.blockClientId&&d(e.blockClientId,null))}function R(){m(void 0),f(e.blockClientId,!1)}function N(){t({id:e.id,status:"approved"}),R(),c?g?.focus():us(e.id,i.current)}let k=e?.reply||[],E=k.length>0?k[k.length-1]:void 0,M=k.length>0?k.slice(0,-1):[],V=ARe((0,XOe.__unstableStripHTML)(e.content?.rendered),10),F=e.blockClientId?(0,Ii.sprintf)((0,Ii.__)("Note: %s"),V):(0,Ii.sprintf)((0,Ii.__)("Original block deleted. Note: %s"),V);return c&&e.id==="new"?(0,Wa.jsx)(uk,{onSubmit:r,sidebarRef:i,floating:{y:s.y,ref:b}}):(0,Wa.jsxs)(a4,{floating:c?{y:s.y,ref:b}:void 0,className:J("editor-collab-sidebar-panel__thread",{"is-selected":n}),id:`note-thread-${e.id}`,gap:"md",onClick:P,onMouseEnter:x,onMouseLeave:C,...S,onFocus:A,onKeyUp:D=>{D.key==="Tab"&&(_.current=!1)},onKeyDown:D=>{D.key==="Tab"?_.current=!0:l(D)},tabIndex:0,role:"treeitem","aria-label":F,"aria-expanded":n,children:[(0,Wa.jsx)(d4.Button,{className:"editor-collab-sidebar-panel__skip-to-note",variant:"secondary",size:"compact",onClick:()=>{us(e.id,i.current,'[role="textbox"]')},children:(0,Ii.__)("Add new reply")}),!e.blockClientId&&(0,Wa.jsx)("p",{className:"editor-collab-sidebar-panel__deleted-block-notice",children:(0,Ii.__)("Original block deleted.")}),(0,Wa.jsx)(u4,{note:e,isSelected:n,onEditNote:t,onDeleteNote:o,onResolve:N}),n&&k.map(D=>(0,Wa.jsx)(u4,{note:D,parentNote:e,isSelected:n,onEditNote:t,onDeleteNote:o},D.id)),!n&&M.length>0&&(0,Wa.jsx)(ae,{direction:"row",align:"center",justify:"space-between",className:"editor-collab-sidebar-panel__more-reply-separator",children:(0,Wa.jsx)(d4.Button,{size:"compact",variant:"tertiary",className:"editor-collab-sidebar-panel__more-reply-button",onClick:D=>{D.stopPropagation(),P()},children:(0,Ii.sprintf)((0,Ii._n)("%s more reply","%s more replies",M.length),M.length)})}),!n&&E&&(0,Wa.jsx)(u4,{note:E,parentNote:e,isSelected:!1,onEditNote:t,onDeleteNote:o}),n&&(0,Wa.jsx)(Yx,{role:"treeitem",children:(0,Wa.jsx)(n0,{onSubmit:D=>e.status==="approved"?t({id:e.id,status:"hold",content:D}):r({content:D,parent:e.id}),onCancel:D=>{D.stopPropagation(),R(),us(e.id,i.current)},labels:{submit:e.status==="approved"?(0,Ii.__)("Reopen & Reply"):(0,Ii.__)("Reply"),input:(0,Ii.sprintf)((0,Ii.__)("Reply to note %1$s by %2$s"),e.id,e.author_name),placeholder:(0,Ii.__)("Reply or @ mention")}})}),!!e.blockClientId&&(0,Wa.jsx)(d4.Button,{className:"editor-collab-sidebar-panel__skip-to-block",variant:"secondary",size:"compact",onClick:D=>{D.stopPropagation(),g?.focus()},children:(0,Ii.__)("Back to block")})]})}var e5e=a(Ol(),1),sv=a(j(),1),uf=a(U(),1),m4=a(le(),1),Iu=a(Y(),1),a0=a(be(),1),t5e=a(It(),1),r5e=a(Mp(),1),o5e=a(Nt(),1);var Zx=a(hd(),1);function JOe(){let e=new Set,t=new Map,r=new Map,o=new WeakMap,n={},i={};function s(){i={...n};for(let c of e)c()}let l=new window.ResizeObserver(c=>{let u=!1;for(let d of c){let f=o.get(d.target),m=d.borderBoxSize[0].blockSize;n[f]!==m&&(n[f]=m,u=!0)}u&&s()});return{subscribe(c){return e.add(c),()=>{e.delete(c),e.size===0&&l.disconnect()}},getSnapshot(){return i},registerThread(c,u,d){t.set(c,u);let f=r.get(c);f&&f!==d&&(l.unobserve(f),o.delete(f)),d&&(r.set(c,d),o.set(d,c),l.observe(d)),s()},unregisterThread(c){t.delete(c);let u=r.get(c);u&&(l.unobserve(u),o.delete(u),r.delete(c)),delete n[c]},getAnchorRects(){return Object.fromEntries(Array.from(t).flatMap(([c,u])=>{if(!u)return[];if(c==="new"){let f=ORe(u)??u.getBoundingClientRect();return[[c,f]]}let d=u.querySelector(WD(c))??u;return[[c,d.getBoundingClientRect()]]}))},getFirstBlockElement(){return t.values().next().value??null}}}var{cleanEmptyObject:$Oe}=q(a0.privateApis);function n5e(e){let t={post:e,type:"note",status:"all",per_page:-1},{records:r}=(0,m4.useEntityRecords)("root","comment",t,{enabled:!!e&&typeof e=="number"}),{getBlockAttributes:o}=(0,Iu.useSelect)(a0.store),{clientIds:n}=(0,Iu.useSelect)(l=>{let{getClientIdsWithDescendants:c}=l(a0.store);return{clientIds:c()}},[]),{notes:i,unresolvedNotes:s}=(0,uf.useMemo)(()=>{if(!r||r.length===0)return{notes:[],unresolvedNotes:[]};let l={},c=new Map;for(let g of n){let v=o(g)?.metadata,b=Gg(v);if(b.length>0){l[g]=b;for(let _ of b)c.set(_,g)}}let u=new Map,d=[];for(let g of r){let v={...g,reply:[],blockClientId:g.parent===0?c.get(g.id)??null:null};u.set(g.id,v),g.parent===0&&d.push(v)}for(let g of r)g.parent!==0&&u.get(g.parent)?.reply.unshift(u.get(g.id));if(d.length===0)return{notes:[],unresolvedNotes:[]};let f=[],m=[];for(let[g,v]of Object.entries(l)){let b=o(g),_=v.map(y=>{let w=u.get(y);return w?{thread:w,start:NRe(w,b)}:null}).filter(Boolean).sort((y,w)=>y.start!==w.start?y.start-w.start:y.thread.id-w.thread.id);for(let{thread:y}of _)y.status==="hold"?f.push(y):y.status==="approved"&&m.push(y)}let h=d.filter(g=>!g.blockClientId);return{notes:[...f,...h,...m],unresolvedNotes:f}},[n,r,o]);return{notes:i,unresolvedNotes:s}}function But(e,t){let r=e(),o=t();if(!r?.clientId||r.clientId!==o.clientId||!r.attributeKey||r.offset===void 0||o.offset===void 0||r.offset===o.offset)return null;let[n,i]=r.offset{let v=g.message&&g.code!=="unknown_error"?(0,o5e.decodeEntities)(g.message):(0,sv.__)("An error occurred while performing an update.");e("error",v,{type:"snackbar",isDismissible:!0})};return{onCreate:async({content:g,parent:v})=>{try{let b=v?null:But(l,c),_=v?null:b?.clientId||s(),y=await t("root","comment",{post:o(),content:g,status:"hold",type:"note",parent:v||0},{throwOnError:!0});if(!v&&y?.id&&_){let w=n(_),S=w?.metadata,x=IRe(S,y.id),C={metadata:$Oe(x)};if(b){let A=jut(w?.[b.attributeKey],y.id,b.start,b.end);A&&(C[b.attributeKey]=A)}u(_,C)}return e("snackbar",v?(0,sv.__)("Reply added."):(0,sv.__)("Note added."),{type:"snackbar",isDismissible:!0}),y}catch(b){d(b)}},onEdit:async({id:g,content:v,status:b})=>{try{if(b==="approved"||b==="hold"){await t("root","comment",{id:g,status:b},{throwOnError:!0});let w={post:o(),content:v||"",type:"note",status:b,parent:g,meta:{_wp_note_status:b==="approved"?"resolved":"reopen"}},S=await t("root","comment",w,{throwOnError:!0});return b==="approved"&&zut(g,i,n,u),(0,e5e.speak)(b==="approved"?(0,sv.__)("Note marked as resolved."):(0,sv.__)("Note reopened.")),S}let y=await t("root","comment",{id:g,content:v,status:b},{throwOnError:!0});return e("snackbar",(0,sv.__)("Note updated."),{type:"snackbar",isDismissible:!0}),y}catch(_){d(_)}},onDelete:async g=>{try{let v=g.parent?null:g.blockClientId||s();if(await r("root","comment",g.id,void 0,{throwOnError:!0}),v){let b=n(v),_={metadata:$Oe(FRe(b?.metadata,g.id))},y=UD(b,g.id);if(y){let w=Qq(b[y.attributeKey],g.id);w&&(_[y.attributeKey]=w)}u(v,_)}return e("snackbar",(0,sv.__)("Note deleted."),{type:"snackbar",isDismissible:!0}),!0}catch(v){d(v)}}}}function s5e(e=!1){let t=(0,Iu.useRegistry)();(0,uf.useEffect)(()=>{if(!e)return;let{getActiveComplementaryArea:r}=t.select(je),{disableComplementaryArea:o,enableComplementaryArea:n}=t.dispatch(je),i=t.subscribe(()=>{r("core")===null&&n("core",Hg)});return()=>{i(),r("core")===Hg&&o("core",Hg)}},[e,t])}function a5e({threads:e,selectedNoteId:t,isFloating:r,sidebarRef:o}){let[n,i]=(0,uf.useState)({}),[s]=(0,uf.useState)(JOe),l=(0,uf.useSyncExternalStore)(s.subscribe,s.getSnapshot);return(0,uf.useEffect)(()=>{if(!r||!o?.current)return;let c=o.current,u=s.getFirstBlockElement(),d=u?.closest(".is-root-container")??u,f=d?(0,r5e.getScrollContainer)(d):null,m=()=>{c.style.setProperty("--canvas-scroll",`${-(f?.scrollTop??0)}px`)},h,g=()=>{window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{let y=DRe({threads:e,selectedNoteId:t,blockRects:s.getAnchorRects(),heights:l,scrollTop:f?.scrollTop??0});i(y.positions),m()})};g();let v=new window.ResizeObserver(g);d&&v.observe(d);let b=f?.ownerDocument?.defaultView,_={passive:!0,capture:!0};return b?.addEventListener("scroll",m,_),()=>{window.cancelAnimationFrame(h),v.disconnect(),b?.removeEventListener("scroll",m,_)}},[o,l,r,t,s,e]),{notePositions:n,registerThread:s.registerThread,unregisterThread:s.unregisterThread}}var Tl=a(T(),1),{useBlockElement:Hut}=q(pk.privateApis);function HK({notes:e,sidebarRef:t,isFloating:r=!1,styles:o}){let{onCreate:n,onEdit:i,onDelete:s}=i5e(),{selectNote:l}=q((0,Xx.useDispatch)(I)),{selectBlock:c,toggleBlockSpotlight:u}=q((0,Xx.useDispatch)(pk.store)),{noteId:d,selectedBlockClientId:f,orderedBlockIds:m}=(0,Xx.useSelect)(N=>{let{getBlockAttributes:k,getSelectedBlockClientId:E,getClientIdsWithDescendants:M}=N(pk.store),V=E();return{noteId:V?k(V)?.metadata?.noteId:null,selectedBlockClientId:V,orderedBlockIds:M()}},[]),{selectedNote:h,noteFocused:g}=(0,Xx.useSelect)(N=>{let{getSelectedNote:k,isNoteFocused:E}=q(N(I));return{selectedNote:k(),noteFocused:E()}},[]),v=Hut(f),b=(0,df.useMemo)(()=>{if(!r||h!=="new")return e;let N={id:"new",blockClientId:f,content:{rendered:""}},k=[];return m.forEach(E=>{let M=e.filter(V=>V.blockClientId===E);k.push(...M),E===f&&k.push(N)}),k},[e,r,h,f,m]),_=async N=>{let k=b.findIndex(D=>D.id===N.id),E=b[k+1],M=b[k-1];if(!await s(N))return;if(N.parent!==0){l(N.parent),us(N.parent,t.current);return}let F=E??M;F?(l(F.id),us(F.id,t.current),F.blockClientId&&(u(F.blockClientId,!0),c(F.blockClientId,null))):(l(void 0),u(N.blockClientId,!1),v?.focus())},y=(0,df.useMemo)(()=>{let N=Gg({noteId:d}),k=e.filter(E=>N.includes(E.id));return zP(k)?.id},[d,e]),w=(0,df.useRef)(f);(0,df.useEffect)(()=>{w.current!==f&&(w.current=f,l(y))},[f,y,l]),(0,df.useEffect)(()=>{g&&h&&(us(h,t.current,h==="new"?'[role="textbox"]':void 0),l(h))},[g,h,l,t]);let{notePositions:S,registerThread:x,unregisterThread:C}=a5e({threads:b,selectedNoteId:h,isFloating:r,sidebarRef:t}),A=Array.isArray(b)&&b.length>0,P=(N,k,E)=>{if(N.defaultPrevented)return;let M=b.findIndex(F=>F.id===k.id),V=N.currentTarget===N.target;(N.key==="Enter"||N.key==="ArrowRight")&&V&&!E?(l(k.id),k.blockClientId&&(c(k.blockClientId,null),u(k.blockClientId,!0))):(N.key==="Enter"||N.key==="ArrowLeft")&&V&&E||N.key==="Escape"?(l(void 0),k.blockClientId&&u(k.blockClientId,!1),us(k.id,t.current)):N.key==="ArrowDown"&&M0&&V?us(b[M-1].id,t.current):N.key==="Home"&&V?us(b[0].id,t.current):N.key==="End"&&V&&us(b[b.length-1].id,t.current)},R=r?-1:b.findIndex(N=>N.status==="approved"&&!!N.blockClientId);return(0,Tl.jsx)(ae,{className:"editor-collab-sidebar-panel",style:o,role:"tree",direction:"column",gap:"md",justify:"flex-start",ref:N=>{N&&(t.current=N)},"aria-label":r?(0,h4.__)("Unresolved notes"):(0,h4.__)("All notes"),children:!A&&!r?(0,Tl.jsx)(uk,{onSubmit:n,sidebarRef:t}):(0,Tl.jsxs)(Tl.Fragment,{children:[!r&&h==="new"&&(0,Tl.jsx)(uk,{onSubmit:n,sidebarRef:t}),b.map((N,k)=>(0,Tl.jsxs)(df.Fragment,{children:[k===R&&(0,Tl.jsx)(ae,{direction:"row",align:"center",justify:"center",gap:"sm",className:"editor-collab-sidebar-panel__status-separator",children:(0,Tl.jsx)(Ss,{variant:"heading-sm",render:(0,Tl.jsx)("p",{}),children:(0,h4.__)("Resolved")})}),(0,Tl.jsx)(QOe,{note:N,onAddReply:n,onDeleteNote:_,onEditNote:i,isSelected:h===N.id,sidebarRef:t,floating:r?{y:S[N.id],registerThread:x,unregisterThread:C}:void 0,onKeyDown:E=>P(E,N,h===N.id)})]},N.id))]})})}var l5e=a(G(),1),g4=a(j(),1),b4=a(be(),1),UK=a(Y(),1),c5e=a(Pt(),1),u5e=a(xa(),1);var v4=a(T(),1),{NoteIconSlotFill:Uut}=q(b4.privateApis);function Wut({clientId:e,onClick:t,isDistractionFree:r}){let o=(0,UK.useSelect)(l=>l(b4.store).getBlock(e),[e]),n=(0,UK.useSelect)(l=>l(u5e.store).getShortcutRepresentation("core/editor/new-note"),[]);if(!o?.isValid||o?.name===(0,c5e.getUnregisteredTypeHandlerName)())return null;let i=r||o?.name==="core/freeform",s;return r?s=(0,g4.__)("Notes are disabled in distraction free mode."):o?.name==="core/freeform"&&(s=(0,g4.__)("Convert to blocks to add notes.")),(0,v4.jsx)(l5e.MenuItem,{onClick:t,"aria-haspopup":"dialog",disabled:i,info:s,shortcut:n,children:(0,g4.__)("Add note")})}function WK({onClick:e,isDistractionFree:t}){return(0,v4.jsx)(Uut.Fill,{children:({clientId:r,onClose:o})=>(0,v4.jsx)(Wut,{clientId:r,isDistractionFree:t,onClick:()=>{e(r),o()}})})}var d5e=a(G(),1);var Qx=a(j(),1),f5e=a(U(),1),y4=a(be(),1),p5e=a(Y(),1);var av=a(T(),1),{NoteIconToolbarSlotFill:Gut}=q(y4.privateApis);function Yut({participants:e}){let t=(0,p5e.useSelect)(c=>{let{getSettings:u}=c(y4.store),{__experimentalDiscussionSettings:d}=u();return d?.avatarURL},[]),r=3,n=e.length>r?e.slice(0,r-1):e,i=Math.max(0,e.length-n.length),l=e.length>100&&i>0?(0,Qx.__)("100+"):(0,Qx.sprintf)((0,Qx.__)("+%s"),i);return(0,av.jsxs)(ae,{direction:"row",align:"center",gap:"xs",children:[n.map(c=>(0,av.jsx)("img",{src:c.avatar||t,alt:c.name,className:"editor-note-indicator__avatar",style:{borderColor:za(c.id)}},c.id)),i>0&&(0,av.jsx)("span",{className:"editor-note-indicator__overflow",children:l})]})}function m5e({onClick:e,note:t}){let r=(0,f5e.useMemo)(()=>{if(!t)return[];let o=new Map,n=[t,...t.reply].sort((i,s)=>new Date(i.date)-new Date(s.date));for(let i of n)!i.author_name||o.has(i.author)||o.set(i.author,{id:i.author,name:i.author_name,avatar:i.author_avatar_urls?.["48"]||i.author_avatar_urls?.["96"]});return Array.from(o.values())},[t]);return r.length?(0,av.jsx)(Gut.Fill,{children:(0,av.jsx)(d5e.ToolbarButton,{className:"editor-note-indicator",label:(0,Qx.__)("View notes"),onClick:()=>e(),showTooltip:!0,children:(0,av.jsx)(Yut,{participants:r})})}):null}var g5e=a(U(),1),v5e=a(be(),1);var qut="40",h5e="80",Kut="mark.wp-note{background-color:transparent;color:inherit;}";function Zut(e,t=null){let r=[Kut];for(let o of e??[]){if(!o?.id)continue;let n=za(o.author??0),i=WD(o.id);r.push(`${i}{background-color:${n}${qut};}`),r.push(`${i}:hover,${i}:focus-within{background-color:${n}${h5e};}`),t&&String(t)===String(o.id)&&r.push(`${i}{background-color:${n}${h5e};}`)}return r.join("")}function b5e({threads:e,selectedId:t}){let r=(0,g5e.useMemo)(()=>Zut(e,t),[e,t]);return(0,v5e.useStyleOverride)({id:"core-note-highlights",css:r}),null}var ds=a(T(),1);function Xut({postId:e}){let{getActiveComplementaryArea:t}=(0,ff.useSelect)(je),{enableComplementaryArea:r}=(0,ff.useDispatch)(je),{toggleBlockSpotlight:o,selectBlock:n}=q((0,ff.useDispatch)(GK.store)),{selectNote:i}=q((0,ff.useDispatch)(I)),s=(0,w5e.useViewportMatch)("medium"),l=(0,y5e.useRef)(null),{clientId:c,noteId:u,isClassicBlock:d}=(0,ff.useSelect)(R=>{let{getBlockAttributes:N,getSelectedBlockClientId:k,getBlockName:E}=R(GK.store),M=k();return{clientId:M,noteId:M?N(M)?.metadata?.noteId:null,isClassicBlock:M?E(M)==="core/freeform":!1}},[]),f=Gg({noteId:u}),{isDistractionFree:m}=(0,ff.useSelect)(R=>{let{get:N}=R(S5e.store);return{isDistractionFree:N("core","distractionFree")}},[]),h=(0,ff.useSelect)(R=>q(R(I)).getSelectedNote(),[]),{notes:g,unresolvedNotes:v}=n5e(e),b=s,_=g.length>0||!b;s5e(b&&(v.length>0||h!==void 0));async function y({targetClientId:R,noteId:N,isApproved:k}){if(!R)return;let E=await t("core");k?r("core",hx):(!NP.includes(E)||!_)&&r("core",b?Hg:hx);let M=await t("core");NP.includes(M)&&(n(R,null),o(R,!0),i(N,{focus:!0}))}function w(R){let N=g.filter(E=>E.blockClientId===R),k=zP(N);return y({targetClientId:R,noteId:k?.id??"new",isApproved:k?.status==="approved"})}function S(R){return y({targetClientId:R,noteId:"new",isApproved:!1})}(0,_5e.useShortcut)("core/editor/new-note",R=>{R.preventDefault(),S(c)},{isDisabled:m||d||!c});let{merged:x}=Hr(),C=x?.styles?.color?.background,A=f.length>0?g.filter(R=>f.includes(R.id)):[],P=zP(A);return m?(0,ds.jsx)(WK,{isDistractionFree:!0}):(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)(b5e,{threads:v,selectedId:h}),!!P&&(0,ds.jsx)(m5e,{note:P,onClick:()=>w(c)}),(0,ds.jsx)(WK,{onClick:R=>S(R)}),_&&(0,ds.jsx)(Oy,{identifier:hx,name:hx,title:(0,w4.__)("All notes"),header:(0,ds.jsx)("h2",{className:"interface-complementary-area-header__title",children:(0,w4.__)("All notes")}),icon:NV,closeLabel:(0,w4.__)("Close Notes"),children:(0,ds.jsx)(HK,{notes:g,sidebarRef:l})}),s&&(0,ds.jsx)(Oy,{isPinnable:!1,header:!1,identifier:Hg,className:"editor-collab-sidebar",headerClassName:"editor-collab-sidebar__header",backgroundColor:C,children:(0,ds.jsx)(HK,{notes:v,sidebarRef:l,styles:{backgroundColor:C},isFloating:!0})})]})}function x5e(){let{postId:e,editorMode:t,revisionsMode:r}=(0,ff.useSelect)(o=>{let{getCurrentPostId:n,getEditorMode:i,isRevisionsMode:s}=q(o(I));return{postId:n(),editorMode:i(),revisionsMode:s()}},[]);return!e||typeof e!="number"||t==="text"||r?null:(0,ds.jsx)(uo,{supportKeys:"editor.notes",children:(0,ds.jsx)(Xut,{postId:e})})}var pf=a(G(),1),Jx=a(j(),1);var vk=a(Y(),1),qK=a(U(),1),k5e=a(Lt(),1),E4=a(Ce(),1),R5e=a(le(),1);var A5e=a(be(),1);var fm=a(G(),1),_4=a(Y(),1),mk=a(j(),1),C5e=a(Lt(),1);var E5e=a(le(),1);var Ou=a(T(),1);function S4({hideWelcomeGuide:e=!1,onChangePath:t}){let{user:r,setUser:o}=Hr(),n=!!r&&(Object.keys(r?.styles??{}).length>0||Object.keys(r?.settings??{}).length>0),i=()=>{o({styles:{},settings:{}})},{toggle:s}=(0,_4.useDispatch)(C5e.store),{canEditCSS:l}=(0,_4.useSelect)(u=>{let{getEntityRecord:d,__experimentalGetCurrentGlobalStylesId:f}=u(E5e.store),m=f();return{canEditCSS:!!(m?d("root","globalStyles",m):void 0)?._links?.["wp:action-edit-css"]}},[]),c=()=>{t("/css")};return(0,Ou.jsx)(fm.DropdownMenu,{icon:bo,label:(0,mk.__)("More"),toggleProps:{size:"compact"},children:({onClose:u})=>(0,Ou.jsxs)(Ou.Fragment,{children:[(0,Ou.jsxs)(fm.MenuGroup,{children:[l&&(0,Ou.jsx)(fm.MenuItem,{onClick:c,children:(0,mk.__)("Additional CSS")}),!e&&(0,Ou.jsx)(fm.MenuItem,{onClick:()=>{s("core/edit-site","welcomeGuideStyles"),u()},children:(0,mk.__)("Welcome Guide")})]}),(0,Ou.jsx)(fm.MenuGroup,{children:(0,Ou.jsx)(fm.MenuItem,{onClick:()=>{i(),u()},disabled:!n,children:(0,mk.__)("Reset styles")})})]})})}var l0=a(T(),1);function T5e({className:e,identifier:t,title:r,icon:o,children:n,closeLabel:i,header:s,headerClassName:l,panelClassName:c,isActiveByDefault:u}){return(0,l0.jsxs)(l0.Fragment,{children:[(0,l0.jsx)(Kl,{className:e,scope:"core",identifier:t,title:r,icon:o,closeLabel:i,header:s,headerClassName:l,panelClassName:c,isActiveByDefault:u,children:n}),(0,l0.jsx)(Uh,{scope:"core",identifier:t,icon:o,children:r})]})}var x4=a(Y(),1),C4=a(G(),1),Sc=a(j(),1),YK=a(Lt(),1);var hk=a(T(),1);function gk({nonAnimatedSrc:e,animatedSrc:t}){return(0,hk.jsxs)("picture",{className:"editor-welcome-guide__image",children:[(0,hk.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,hk.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}var to=a(T(),1);function P5e(){let{toggle:e}=(0,x4.useDispatch)(YK.store),{isActive:t,isStylesOpen:r}=(0,x4.useSelect)(n=>{let i=n(je).getActiveComplementaryArea("core");return{isActive:!!n(YK.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:i==="edit-site/global-styles"}},[]);if(!t||!r)return null;let o=(0,Sc.__)("Welcome to Styles");return(0,to.jsx)(C4.Guide,{className:"editor-welcome-guide guide-styles",contentLabel:o,finishButtonText:(0,Sc.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,to.jsx)(gk,{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,to.jsxs)(to.Fragment,{children:[(0,to.jsx)("h1",{className:"editor-welcome-guide__heading",children:o}),(0,to.jsx)("p",{className:"editor-welcome-guide__text",children:(0,Sc.__)("Tweak your site, or give it a whole new look! Get creative \u2014 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,to.jsx)(gk,{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,to.jsxs)(to.Fragment,{children:[(0,to.jsx)("h1",{className:"editor-welcome-guide__heading",children:(0,Sc.__)("Set the design")}),(0,to.jsx)("p",{className:"editor-welcome-guide__text",children:(0,Sc.__)("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,to.jsx)(gk,{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,to.jsxs)(to.Fragment,{children:[(0,to.jsx)("h1",{className:"editor-welcome-guide__heading",children:(0,Sc.__)("Personalize blocks")}),(0,to.jsx)("p",{className:"editor-welcome-guide__text",children:(0,Sc.__)("You can adjust your blocks to ensure a cohesive experience across your site \u2014 add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")})]})},{image:(0,to.jsx)(gk,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,to.jsxs)(to.Fragment,{children:[(0,to.jsx)("h1",{className:"editor-welcome-guide__heading",children:(0,Sc.__)("Learn more")}),(0,to.jsxs)("p",{className:"editor-welcome-guide__text",children:[(0,Sc.__)("New to block themes and styling your site?")," ",(0,to.jsx)(C4.ExternalLink,{href:(0,Sc.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,Sc.__)("Here\u2019s a detailed guide to learn how to make the most of it.")})]})]})}]})}var Oi=a(T(),1);function I5e(){let{shouldResetNavigation:e,stylesPath:t,showStylebook:r,showListViewByDefault:o,hasRevisions:n,activeComplementaryArea:i,editorSettings:s,styleStateViewport:l}=(0,vk.useSelect)(y=>{let{getActiveComplementaryArea:w}=y(je),{getStylesPath:S,getShowStylebook:x}=q(y(I)),C=y(I).getEditorMode()==="visual",A=y(k5e.store).get("core","showListViewByDefault"),{getEntityRecord:P,__experimentalGetCurrentGlobalStylesId:R}=y(R5e.store),N=R(),k=N?P("root","globalStyles",N):void 0;return{stylesPath:S(),showStylebook:x(),shouldResetNavigation:w("core")!=="edit-site/global-styles"||!C,showListViewByDefault:A,hasRevisions:!!k?._links?.["version-history"]?.[0]?.count,activeComplementaryArea:y(je).getActiveComplementaryArea("core"),editorSettings:y(I).getEditorSettings(),styleStateViewport:q(y(A5e.store)).getStyleStateViewport()}},[]),{setStylesPath:c,setShowStylebook:u,resetStylesNavigation:d}=q((0,vk.useDispatch)(I)),f=(0,E4.useViewportMatch)("medium","<"),m=t.startsWith("/revisions")&&!r,h=t.startsWith("/revisions")&&r,g=(0,E4.usePrevious)(i);(0,qK.useEffect)(()=>{i==="edit-site/global-styles"&&g!=="edit-site/global-styles"&&d()},[i,g,d]),(0,qK.useEffect)(()=>{e&&d()},[e,d]);let{setIsListViewOpened:v}=(0,vk.useDispatch)(I),b=()=>{v(!1),c(m||h?"/":"/revisions")},_=()=>{v(r&&o),u(!r)};return(0,Oi.jsxs)(Oi.Fragment,{children:[(0,Oi.jsx)(T5e,{className:"editor-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,Jx.__)("Styles"),icon:JB,closeLabel:(0,Jx.__)("Close Styles"),panelClassName:"editor-global-styles-sidebar__panel",header:(0,Oi.jsxs)(pf.Flex,{className:"editor-global-styles-sidebar__header",gap:1,children:[(0,Oi.jsx)(pf.FlexItem,{children:(0,Oi.jsx)("h2",{className:"editor-global-styles-sidebar__header-title",children:(0,Jx.__)("Styles")})}),(0,Oi.jsxs)(pf.Flex,{justify:"flex-end",gap:1,className:"editor-global-styles-sidebar__header-actions",children:[!f&&(0,Oi.jsx)(pf.FlexItem,{children:(0,Oi.jsx)(pf.Button,{icon:mv,label:(0,Jx.__)("Style Book"),isPressed:r,accessibleWhenDisabled:!0,disabled:e,onClick:_,size:"compact"})}),(0,Oi.jsx)(pf.FlexItem,{children:(0,Oi.jsx)(pf.Button,{label:(0,Jx.__)("Revisions"),icon:yf,onClick:b,accessibleWhenDisabled:!0,disabled:!n,isPressed:m||h,size:"compact"})}),(0,Oi.jsx)(S4,{onChangePath:c})]})]}),children:(0,Oi.jsx)(XM,{path:t,onPathChange:c,settings:s,selectedViewport:l,showResponsiveStateControls:!1})}),(0,Oi.jsx)(P5e,{})]})}var xc=a(T(),1);function Qut({postType:e,postId:t,templateId:r,settings:o,children:n,initialEdits:i,onActionPerformed:s,extraContent:l,extraSidebarPanels:c,...u}){let{post:d,template:f,hasLoadedPost:m,error:h,isBlockTheme:g,showGlobalStyles:v}=(0,O5e.useSelect)(b=>{let{getEntityRecord:_,getResolutionError:y,hasFinishedResolution:w,getCurrentTheme:S,__experimentalGetCurrentGlobalStylesId:x,canUser:C}=b(N5e.store),{getRenderingMode:A,getCurrentPostType:P}=b(I),R=["postType",e,t],N=A(),k=P(),E=S()?.is_block_theme,M=x(),V=M?C("update",{kind:"root",name:"globalStyles",id:M}):!1;return{post:_(...R),template:r?_("postType",Cr,r):void 0,hasLoadedPost:w("getEntityRecord",R),error:y("getEntityRecord",R)?.message,isBlockTheme:E,showGlobalStyles:E&&V&&(k==="wp_template"||N==="template-locked")}},[e,t,r]);return(0,xc.jsxs)(xc.Fragment,{children:[m&&!d&&(0,xc.jsx)(M5e.Notice,{status:h?"error":"warning",isDismissible:!1,children:h||(0,F5e.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")}),!!d&&(0,xc.jsxs)(ZG,{post:d,__unstableTemplate:f,settings:o,initialEdits:i,useSubRegistry:!1,children:[(0,xc.jsx)(_Ae,{...u,children:l}),n,(0,xc.jsx)(NOe,{onActionPerformed:s,extraPanels:c}),(0,xc.jsx)(x5e,{}),g&&(0,xc.jsx)(D3,{}),v&&(0,xc.jsx)(I5e,{})]})]})}var D5e=Qut;var Ge=a(j(),1),G5e=a(Ce(),1),c0=a(Y(),1),Y5e=a(U(),1),bk=a(Lt(),1);var T4=a(Y(),1),L5e=a(Lt(),1);var V5e=a(T(),1),{PreferenceBaseOption:Jut}=q(L5e.privateApis);function B5e(e){let t=(0,T4.useSelect)(n=>n(I).isPublishSidebarEnabled(),[]),{enablePublishSidebar:r,disablePublishSidebar:o}=(0,T4.useDispatch)(I);return(0,V5e.jsx)(Jut,{isChecked:t,onChange:n=>n?r():o(),...e})}var P4=a(Y(),1),j5e=a(Lt(),1),k4=a(Pt(),1),z5e=a(U(),1),H5e=a(G(),1),e1=a(j(),1),U5e=a(be(),1);var $x=a(T(),1),{BlockManager:$ut}=q(U5e.privateApis),edt=[];function W5e(){let{showBlockTypes:e,hideBlockTypes:t}=q((0,P4.useDispatch)(I)),{blockTypes:r,allowedBlockTypes:o,hiddenBlockTypes:n}=(0,P4.useSelect)(m=>({blockTypes:m(k4.store).getBlockTypes(),allowedBlockTypes:m(I).getEditorSettings().allowedBlockTypes,hiddenBlockTypes:m(j5e.store).get("core","hiddenBlockTypes")??edt}),[]),s=(0,z5e.useMemo)(()=>o===!0?r:r.filter(({name:m})=>o?.includes(m)),[o,r]).filter(m=>(0,k4.hasBlockSupport)(m,"inserter",!0)&&(!m.parent||m.parent.includes("core/post-content"))),l=n.filter(m=>s.some(h=>h.name===m)),c=s.filter(m=>!l.includes(m.name)),u=s.length-c.length;function d(){f(s)}let f=m=>{if(c.length>m.length){let h=c.filter(g=>!m.find(({name:v})=>v===g.name));t(h.map(({name:g})=>g))}else if(c.length!c.find(({name:v})=>v===g.name));e(h.map(({name:g})=>g))}};return(0,$x.jsxs)("div",{className:"editor-block-visibility",children:[!!u&&(0,$x.jsxs)("div",{className:"editor-block-visibility__disabled-blocks-count",children:[(0,e1.sprintf)((0,e1._n)("%d block is hidden.","%d blocks are hidden.",u),u),(0,$x.jsx)(H5e.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:d,children:(0,e1.__)("Reset")})]}),(0,$x.jsx)($ut,{blockTypes:s,selectedBlockTypes:c,onChange:f,showSelectAll:!1})]})}var nt=a(T(),1),{PreferencesModal:tdt,PreferencesModalTabs:rdt,PreferencesModalSection:mf,PreferenceToggleControl:fs}=q(bk.privateApis);function q5e({extraSections:e={}}){let t=(0,c0.useSelect)(o=>o(je).isModalActive("editor/preferences"),[]),{closeModal:r}=(0,c0.useDispatch)(je);return t?(0,nt.jsx)(tdt,{closeModal:r,children:(0,nt.jsx)(odt,{extraSections:e})}):null}function odt({extraSections:e={}}){let t=(0,G5e.useViewportMatch)("medium"),{showBlockBreadcrumbsOption:r,showCollaborationOptions:o}=(0,c0.useSelect)(c=>{let{getEditorSettings:u,isCollaborationEnabledForCurrentPost:d}=q(c(I)),{get:f}=c(bk.store),m=u().richEditingEnabled;return{showBlockBreadcrumbsOption:!f("core","distractionFree")&&t&&m,showCollaborationOptions:d()}},[t]),{setIsListViewOpened:n,setIsInserterOpened:i}=(0,c0.useDispatch)(I),{set:s}=(0,c0.useDispatch)(bk.store),l=(0,Y5e.useMemo)(()=>[{name:"general",tabLabel:(0,Ge.__)("General"),content:(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsxs)(mf,{title:(0,Ge.__)("Interface"),children:[(0,nt.jsx)(fs,{scope:"core",featureName:"showListViewByDefault",help:(0,Ge.__)("Opens the List View panel by default."),label:(0,Ge.__)("Always open List View")}),r&&(0,nt.jsx)(fs,{scope:"core",featureName:"showBlockBreadcrumbs",help:(0,Ge.__)("Display the block hierarchy trail at the bottom of the editor."),label:(0,Ge.__)("Show block breadcrumbs")}),(0,nt.jsx)(fs,{scope:"core",featureName:"allowRightClickOverrides",help:(0,Ge.__)("Allows contextual List View menus via right-click, overriding browser defaults."),label:(0,Ge.__)("Allow right-click contextual menus")}),(0,nt.jsx)(fs,{scope:"core",featureName:"enableChoosePatternModal",help:(0,Ge.__)("Pick from starter content when creating a new page."),label:(0,Ge.__)("Show starter patterns")}),o&&(0,nt.jsx)(fs,{scope:"core",featureName:"showCollaborationCursor",help:(0,Ge.__)("Show your own avatar inside blocks during collaborative editing sessions."),label:(0,Ge.__)("Show avatar in blocks")})]}),o&&(0,nt.jsxs)(mf,{title:(0,Ge.__)("Collaboration notifications"),children:[(0,nt.jsx)(fs,{scope:"core",featureName:"showCollaborationJoinNotifications",help:(0,Ge.__)("Show notifications when collaborators join the post."),label:(0,Ge.__)("Collaborator joined")}),(0,nt.jsx)(fs,{scope:"core",featureName:"showCollaborationLeaveNotifications",help:(0,Ge.__)("Show notifications when collaborators leave the post."),label:(0,Ge.__)("Collaborator left")}),(0,nt.jsx)(fs,{scope:"core",featureName:"showCollaborationPostSaveNotifications",help:(0,Ge.__)("Show notifications when collaborators save, update, or publish the post."),label:(0,Ge.__)("Post updated")})]}),(0,nt.jsxs)(mf,{title:(0,Ge.__)("Document settings"),description:(0,Ge.__)("Select what settings are shown in the document panel."),children:[(0,nt.jsx)(y6.Slot,{}),(0,nt.jsx)(XS,{taxonomyWrapper:(c,u)=>(0,nt.jsx)(kg,{label:u.labels.menu_name,panelName:`taxonomy-panel-${u.slug}`})}),(0,nt.jsx)(Gp,{children:(0,nt.jsx)(kg,{label:(0,Ge.__)("Featured image"),panelName:"featured-image"})}),(0,nt.jsx)(Dy,{children:(0,nt.jsx)(kg,{label:(0,Ge.__)("Excerpt"),panelName:"post-excerpt"})}),(0,nt.jsx)(uo,{supportKeys:["comments","trackbacks"],children:(0,nt.jsx)(kg,{label:(0,Ge.__)("Discussion"),panelName:"discussion-panel"})}),(0,nt.jsx)(vS,{children:(0,nt.jsx)(kg,{label:(0,Ge.__)("Page attributes"),panelName:"page-attributes"})})]}),t&&(0,nt.jsx)(mf,{title:(0,Ge.__)("Publishing"),children:(0,nt.jsx)(B5e,{help:(0,Ge.__)("Review settings, such as visibility and tags."),label:(0,Ge.__)("Enable pre-publish checks")})}),e?.general]})},{name:"appearance",tabLabel:(0,Ge.__)("Appearance"),content:(0,nt.jsxs)(mf,{title:(0,Ge.__)("Appearance"),description:(0,Ge.__)("Customize the editor interface to suit your needs."),children:[(0,nt.jsx)(fs,{scope:"core",featureName:"fixedToolbar",onToggle:()=>s("core","distractionFree",!1),help:(0,Ge.__)("Access all block and document tools in a single place."),label:(0,Ge.__)("Top toolbar")}),(0,nt.jsx)(fs,{scope:"core",featureName:"distractionFree",onToggle:()=>{s("core","fixedToolbar",!0),i(!1),n(!1)},help:(0,Ge.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,Ge.__)("Distraction free")}),(0,nt.jsx)(fs,{scope:"core",featureName:"focusMode",help:(0,Ge.__)("Highlights the current block and fades other content."),label:(0,Ge.__)("Spotlight mode")}),e?.appearance]})},{name:"accessibility",tabLabel:(0,Ge.__)("Accessibility"),content:(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)(mf,{title:(0,Ge.__)("Navigation"),description:(0,Ge.__)("Optimize the editing experience for enhanced control."),children:(0,nt.jsx)(fs,{scope:"core",featureName:"keepCaretInsideBlock",help:(0,Ge.__)("Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users."),label:(0,Ge.__)("Contain text cursor inside block")})}),(0,nt.jsx)(mf,{title:(0,Ge.__)("Interface"),children:(0,nt.jsx)(fs,{scope:"core",featureName:"showIconLabels",label:(0,Ge.__)("Show button text labels"),help:(0,Ge.__)("Show text instead of icons on buttons across the interface.")})})]})},{name:"blocks",tabLabel:(0,Ge.__)("Blocks"),content:(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)(mf,{title:(0,Ge.__)("Inserter"),children:(0,nt.jsx)(fs,{scope:"core",featureName:"mostUsedBlocks",help:(0,Ge.__)("Adds a category with the most frequently used blocks in the inserter."),label:(0,Ge.__)("Show most used blocks")})}),(0,nt.jsx)(mf,{title:(0,Ge.__)("Manage block visibility"),description:(0,Ge.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."),children:(0,nt.jsx)(W5e,{})})]})},window.__clientSideMediaProcessing&&{name:"media",tabLabel:(0,Ge.__)("Media"),content:(0,nt.jsx)(nt.Fragment,{children:(0,nt.jsxs)(mf,{title:(0,Ge.__)("General"),description:(0,Ge.__)("Customize options related to the media upload flow."),children:[(0,nt.jsx)(fs,{scope:"core/media",featureName:"optimizeOnUpload",help:(0,Ge.__)("Compress media items before uploading to the server."),label:(0,Ge.__)("Pre-upload compression")}),(0,nt.jsx)(fs,{scope:"core/media",featureName:"requireApproval",help:(0,Ge.__)("Require approval step when optimizing existing media."),label:(0,Ge.__)("Approval step")})]})})}].filter(Boolean),[r,o,e,i,n,s,t]);return(0,nt.jsx)(rdt,{sections:l})}var Sk=a(Pt(),1);var yk=a(be(),1),K5e="content",Z5e={name:"core/pattern-overrides",getValues({select:e,clientId:t,context:r,bindings:o}){let n=r["pattern/overrides"],{getBlockAttributes:i}=e(yk.store),s=i(t),l={};for(let c of Object.keys(o)){let u=n?.[s?.metadata?.name]?.[c];if(u===void 0){l[c]=s?.[c];continue}else l[c]=u===""?void 0:u}return l},setValues({select:e,dispatch:t,clientId:r,bindings:o}){let{getBlockAttributes:n,getBlockParentsByBlockName:i,getBlocks:s}=e(yk.store),c=n(r)?.metadata?.name;if(!c)return;let[u]=i(r,"core/block",!0),d=Object.entries(o).reduce((m,[h,{newValue:g}])=>(m[h]=g,m),{});if(!u){let m=h=>{for(let g of h)g.attributes?.metadata?.name===c&&t(yk.store).updateBlockAttributes(g.clientId,d),m(g.innerBlocks)};m(s());return}let f=n(u)?.[K5e];t(yk.store).updateBlockAttributes(u,{[K5e]:{...f,[c]:{...f?.[c],...Object.entries(d).reduce((m,[h,g])=>(m[h]=g===void 0?"":g,m),{})}}})},canUserEditValue:()=>!0};var R4=a(j(),1),A4=a(le(),1),wk=a(be(),1),KK=["core/navigation-link","core/navigation-submenu"],X5e=[{label:(0,R4.__)("Post Date"),args:{field:"date"},type:"string"},{label:(0,R4.__)("Post Modified Date"),args:{field:"modified"},type:"string"},{label:(0,R4.__)("Post Link"),args:{field:"link"},type:"string"}],Q5e={name:"core/post-data",getValues({select:e,context:t,bindings:r,clientId:o}){let{getBlockAttributes:n,getBlockName:i}=e(wk.store),s=i(o),l=KK.includes(s),c,u;if(l){let h=n(o);c=h?.id,u=h?.type}else c=t?.postId,u=t?.postType;let{getEditedEntityRecord:d}=e(A4.store),f=d("postType",u,c),m={};for(let[h,g]of Object.entries(r)){let v=X5e.find(b=>b.args.field===g.args.field);v?f?m[h]=f[g.args.field]:m[h]=v.label:m[h]=g.args.field}return m},setValues({dispatch:e,context:t,bindings:r,clientId:o,select:n}){let{getBlockName:i}=n(wk.store),s=i(o);if(KK.includes(s))return!1;let l={};Object.values(r).forEach(({args:c,newValue:u})=>{l[c.field]=u}),e(A4.store).editEntityRecord("postType",t?.postType,t?.postId,l)},canUserEditValue({select:e,context:t}){let{getBlockName:r,getSelectedBlockClientId:o}=e(wk.store),n=o(),i=r(n);return!(KK.includes(i)||t?.query||t?.queryId||!t?.postType||!e(A4.store).canUser("update",{kind:"postType",name:t?.postType,id:t?.postId}))},getFieldsList({context:e,select:t}){return t(wk.store).getSelectedBlock()?.name!=="core/post-date"?[]:!e||!e.postId||!e.postType?[]:X5e}};var _k=a(le(),1);function ZK(e,t){let{getRegisteredPostMeta:r}=q(e(_k.store)),o=r(t?.postType),n=[];return Object.entries(o).forEach(([i,s])=>{i==="footnotes"||i.charAt(0)==="_"||n.push({label:s.title||i,args:{key:i},default:s.default,type:s.type})}),n}function ndt({select:e,context:t,args:r}){let n=ZK(e,t).find(l=>l.args.key===r.key);if(!n)return r.key;if(!t?.postId)return n.default||n.label||r.key;let{getEditedEntityRecord:i}=e(_k.store);return i("postType",t?.postType,t?.postId).meta?.[r.key]??n?.label??r.key}var J5e={name:"core/post-meta",getValues({select:e,context:t,bindings:r}){let o={};for(let[n,i]of Object.entries(r))o[n]=ndt({select:e,context:t,args:i.args});return o},setValues({dispatch:e,context:t,bindings:r}){let o={};Object.values(r).forEach(({args:n,newValue:i})=>{o[n.key]=i}),e(_k.store).editEntityRecord("postType",t?.postType,t?.postId,{meta:o})},canUserEditValue({select:e,context:t,args:r}){return!(t?.query||t?.queryId||!t?.postType||!ZK(e,t).some(l=>l.args.key===r.key)||e(I).getEditorSettings().enableCustomFields||!e(_k.store).canUser("update",{kind:"postType",name:t?.postType,id:t?.postId}))},getFieldsList({select:e,context:t}){return ZK(e,t).map(({default:o,...n})=>({...n}))}};var lv=a(j(),1),$5e=a(le(),1),I4=a(be(),1),XK=["core/navigation-link","core/navigation-submenu"],QK=[{label:(0,lv.__)("Term ID"),args:{field:"id"},type:"string"},{label:(0,lv.__)("Name"),args:{field:"name"},type:"string"},{label:(0,lv.__)("Slug"),args:{field:"slug"},type:"string"},{label:(0,lv.__)("Link"),args:{field:"link"},type:"string"},{label:(0,lv.__)("Description"),args:{field:"description"},type:"string"},{label:(0,lv.__)("Parent ID"),args:{field:"parent"},type:"string"},{label:(0,lv.__)("Count"),args:{field:"count"},type:"string"}],eNe={name:"core/term-data",usesContext:["taxonomy","termId","termData"],getValues({select:e,context:t,bindings:r,clientId:o}){let{getEntityRecord:n}=e($5e.store),{getBlockAttributes:i,getBlockName:s}=e(I4.store),l=s(o),c=XK.includes(l),u;if(c){let f=i(o),m=f?.type;u=n("taxonomy",m==="tag"?"post_tag":m,f?.id)}else t.termId&&t.taxonomy&&(u=n("taxonomy",t.taxonomy,t.termId));!u&&t?.termData&&!c&&(u=t.termData);let d={};for(let[f,m]of Object.entries(r)){let h=QK.find(g=>g.args.field===m.args.field);h?!u||u[m.args.field]===void 0?d[f]=h.label:m.args.field==="count"?d[f]="("+u[m.args.field]+")":d[f]=u[m.args.field]:d[f]=m.args.field}return d},setValues({dispatch:e,context:t,bindings:r}){return!1},canUserEditValue({select:e,context:t}){let{getBlockName:r,getSelectedBlockClientId:o}=e(I4.store),n=o(),i=r(n);return XK.includes(i)||t?.termQuery||!t?.taxonomy||!t?.termId,!1},getFieldsList({context:e,select:t}){let{getBlockAttributes:r,getBlockName:o,getSelectedBlockClientId:n}=t(I4.store),i=n(),s=o(i);if(XK.includes(s)){let l=r(i);return!l||!l.id||!l.type?[]:QK}return e?e.taxonomy&&e.termId||e.termData?QK:[]:[]}};function tNe(){(0,Sk.registerBlockBindingsSource)(Z5e),(0,Sk.registerBlockBindingsSource)(Q5e),(0,Sk.registerBlockBindingsSource)(J5e),(0,Sk.registerBlockBindingsSource)(eNe)}var O4=a(Y(),1),gf=a(U(),1),hf=a(j(),1),$K=a(Ol(),1),oNe=a(u3(),1),nNe=a(It(),1),N4=a(G(),1);var xk=a(T(),1),JK="upload-progress",idt=3e3,rNe=40;function sdt(e){if(e.length<=rNe)return e;let t="\u2026",r=rNe-t.length,o=Math.ceil(r/2),n=Math.floor(r/2);return e.slice(0,o)+t+e.slice(e.length-n)}var adt=(0,xk.jsx)("span",{className:"editor-upload-progress-snackbar__spinner","aria-hidden":"true",children:(0,xk.jsx)(N4.Spinner,{})}),ldt=(0,xk.jsx)("span",{className:"editor-upload-progress-snackbar__check","aria-hidden":"true",children:(0,xk.jsx)(N4.Icon,{icon:Io})});function iNe(){let e=(0,O4.useSelect)(h=>h(oNe.store).getItems(),[]),t=iQ(),r=(0,gf.useMemo)(()=>e.filter(h=>!h.parentId),[e]),o=r.length,n=t?t.total-t.completed:0,i=o+n,s=o+(t?t.total:0),l=(0,gf.useRef)(0),{createNotice:c,removeNotice:u}=(0,O4.useDispatch)(nNe.store),d=(0,gf.useRef)(!1),f=(0,gf.useRef)(!1),m=(0,gf.useRef)(null);return(0,gf.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,gf.useEffect)(()=>{let h=i>0;if(h&&!f.current?(d.current=!1,(0,$K.speak)((0,hf.__)("Media upload started"),"polite"),m.current&&(clearTimeout(m.current),m.current=null,l.current=0)):!h&&f.current&&((0,$K.speak)((0,hf.__)("Media upload complete"),"polite"),d.current?l.current=0:(c("info",(0,hf.__)("Upload complete"),{id:JK,type:"snackbar",isDismissible:!1,explicitDismiss:!1,speak:!1,icon:ldt,onDismiss:()=>{d.current=!0}}),m.current=setTimeout(()=>{u(JK),m.current=null,l.current=0},idt))),f.current=h,!h||d.current)return;s>l.current&&(l.current=s);let g=l.current,v=g-i+1,b=sdt(r[0]?.sourceFile?.name||t?.pending[0]||(0,hf.__)("Uploading")),_=g===1?(0,hf.sprintf)((0,hf.__)("Uploading \u2014 %s"),b):(0,hf.sprintf)((0,hf.__)("Uploading %1$d of %2$d \u2014 %3$s"),v,g,b);c("info",_,{id:JK,type:"snackbar",isDismissible:!1,explicitDismiss:!0,speak:!1,icon:adt,onDismiss:()=>{d.current=!0}})},[i,s,r,t,c,u]),null}var{store:cdt,...udt}=xW,sNe={};AZ(sNe,{CreateTemplatePartModal:Tw,patternTitleField:RC,templateTitleField:q1,BackButton:RD,EntitiesSavedStatesExtensible:rP,Editor:D5e,PluginPostExcerpt:cP,PostCardPanel:rv,PreferencesModal:q5e,usePostActions:FL,usePostFields:nS,ToolsMoreMenuGroup:DD,ViewMoreMenuGroup:LD,ResizableEditor:fS,UploadProgressSnackbar:iNe,registerCoreBlockBindingsSources:tNe,getTemplateInfo:Al,GlobalStylesUIWrapper:XM,GlobalStylesActionMenu:S4,StyleBookPreview:lSe,useGlobalStyles:Hr,useStyle:cg,interfaceStore:cdt,...udt});var Ck=a(Y(),1);function ddt(e,t,r){let{registerEntityAction:o}=q((0,Ck.dispatch)(I))}function fdt(e,t,r){let{unregisterEntityAction:o}=q((0,Ck.dispatch)(I))}function pdt(e,t,r){let{registerEntityField:o}=q((0,Ck.dispatch)(I))}function mdt(e,t,r){let{unregisterEntityField:o}=q((0,Ck.dispatch)(I))}var aNe=a(be(),1);return hNe(hdt);})();
/*! Bundled license information:
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
(**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
(**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
autosize/dist/autosize.js:
(*!
autosize 4.0.2
license: MIT
http://www.jacklmoore.com/autosize
*)
is-plain-object/dist/is-plain-object.mjs:
(*!
* is-plain-object
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
*/
(window.wp ||= {}).editor = wp.editor;
})();