/*! This file is auto-generated */ (()=>{var e={2591:e=>{e.exports=function(){function e(t,n,a){function r(i,o){if(!n[i]){if(!t[i]){if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,(function(e){return r(t[i][1][e]||e)}),c,c.exports,e,t,n,a)}return n[i].exports}for(var s=void 0,i=0;i=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&r))return String.fromCharCode.apply(null,a.shrinkBuf(e,t));for(var n="",i=0;i>>6,t[i++]=128|63&n):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|63&n):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new a.Buf8(e.length),n=0,r=t.length;n4)c[a++]=65533,n+=s-1;else{for(r&=2===s?31:3===s?15:7;s>1&&n1?c[a++]=65533:r<65536?c[a++]=r:(r-=65536,c[a++]=55296|r>>10&1023,c[a++]=56320|1023&r)}return l(c,a)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+i[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function a(e,t,n,a){for(var r=65535&e|0,s=e>>>16&65535|0,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{s=s+(r=r+t[a++]|0)|0}while(--i);r%=65521,s%=65521}return r|s<<16|0}t.exports=a},{}],4:[function(e,t,n){"use strict";t.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(e,t,n){"use strict";function a(){for(var e,t=[],n=0;n<256;n++){e=n;for(var a=0;a<8;a++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var r=a();function s(e,t,n,a){var s=r,i=a+n;e^=-1;for(var o=a;o>>8^s[255&(e^t[o])];return-1^e}t.exports=s},{}],6:[function(e,t,n){"use strict";function a(){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}t.exports=a},{}],7:[function(e,t,n){"use strict";var a=30,r=12;t.exports=function(e,t){var n,s,i,o,l,c,u,d,m,p,h,f,g,y,v,_,b,E,w,x,S,C,k,T,P;n=e.state,s=e.next_in,T=e.input,i=s+(e.avail_in-5),o=e.next_out,P=e.output,l=o-(t-e.avail_out),c=o+(e.avail_out-257),u=n.dmax,d=n.wsize,m=n.whave,p=n.wnext,h=n.window,f=n.hold,g=n.bits,y=n.lencode,v=n.distcode,_=(1<>>=w=E>>>24,g-=w,0==(w=E>>>16&255))P[o++]=65535&E;else{if(!(16&w)){if(0==(64&w)){E=y[(65535&E)+(f&(1<>>=w,g-=w),g<15&&(f+=T[s++]<>>=w=E>>>24,g-=w,!(16&(w=E>>>16&255))){if(0==(64&w)){E=v[(65535&E)+(f&(1<u){e.msg="invalid distance too far back",n.mode=a;break e}if(f>>>=w,g-=w,S>(w=o-l)){if((w=S-w)>m&&n.sane){e.msg="invalid distance too far back",n.mode=a;break e}if(C=0,k=h,0===p){if(C+=d-w,w2;)P[o++]=k[C++],P[o++]=k[C++],P[o++]=k[C++],x-=3;x&&(P[o++]=k[C++],x>1&&(P[o++]=k[C++]))}else{C=o-S;do{P[o++]=P[C++],P[o++]=P[C++],P[o++]=P[C++],x-=3}while(x>2);x&&(P[o++]=P[C++],x>1&&(P[o++]=P[C++]))}break}}break}}while(s>3,f&=(1<<(g-=x<<3))-1,e.next_in=s,e.next_out=o,e.avail_in=s>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ae(){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 a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function re(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=w,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new a.Buf32($),t.distcode=t.distdyn=new a.Buf32(ee),t.sane=1,t.back=-1,h):y}function se(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,re(e)):y}function ie(e,t){var n,a;return e&&e.state?(a=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?y:(null!==a.window&&a.wbits!==t&&(a.window=null),a.wrap=n,a.wbits=t,se(e))):y}function oe(e,t){var n,a;return e?(a=new ae,e.state=a,a.window=null,(n=ie(e,t))!==h&&(e.state=null),n):y}function le(e){return oe(e,te)}var ce,ue,de=!0;function me(e){if(de){var t;for(ce=new a.Buf32(512),ue=new a.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(u,e.lens,0,32,ue,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=ue,e.distbits=5}function pe(e,t,n,r){var s,i=e.state;return null===i.window&&(i.wsize=1<=i.wsize?(a.arraySet(i.window,t,n-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):((s=i.wsize-i.wnext)>r&&(s=r),a.arraySet(i.window,t,n-r,s,i.wnext),(r-=s)?(a.arraySet(i.window,t,n-r,r,0),i.wnext=r,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,n.check=s(n.check,ke,2,0),ie=0,oe=0,n.mode=x;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&ie)<<8)+(ie>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&ie)!==E){e.msg="unknown compression method",n.mode=J;break}if(oe-=4,Ee=8+(15&(ie>>>=4)),0===n.wbits)n.wbits=Ee;else if(Ee>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(ke[0]=255&ie,ke[1]=ie>>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0,n.mode=S;case S:for(;oe<32;){if(0===re)break e;re--,ie+=$[te++]<>>8&255,ke[2]=ie>>>16&255,ke[3]=ie>>>24&255,n.check=s(n.check,ke,4,0)),ie=0,oe=0,n.mode=C;case C:for(;oe<16;){if(0===re)break e;re--,ie+=$[te++]<>8),512&n.flags&&(ke[0]=255&ie,ke[1]=ie>>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0,n.mode=k;case k:if(1024&n.flags){for(;oe<16;){if(0===re)break e;re--,ie+=$[te++]<>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((ue=n.length)>re&&(ue=re),ue&&(n.head&&(Ee=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),a.arraySet(n.head.extra,$,te,ue,Ee)),512&n.flags&&(n.check=s(n.check,$,ue,te)),re-=ue,te+=ue,n.length-=ue),n.length))break e;n.length=0,n.mode=P;case P:if(2048&n.flags){if(0===re)break e;ue=0;do{Ee=$[te+ue++],n.head&&Ee&&n.length<65536&&(n.head.name+=String.fromCharCode(Ee))}while(Ee&&ue>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=O;break;case A:for(;oe<32;){if(0===re)break e;re--,ie+=$[te++]<>>=7&oe,oe-=7&oe,n.mode=Y;break}for(;oe<3;){if(0===re)break e;re--,ie+=$[te++]<>>=1)){case 0:n.mode=F;break;case 1:if(me(n),n.mode=G,t===p){ie>>>=2,oe-=2;break e}break;case 2:n.mode=V;break;case 3:e.msg="invalid block type",n.mode=J}ie>>>=2,oe-=2;break;case F:for(ie>>>=7&oe,oe-=7&oe;oe<32;){if(0===re)break e;re--,ie+=$[te++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&ie,ie=0,oe=0,n.mode=D,t===p)break e;case D:n.mode=B;case B:if(ue=n.length){if(ue>re&&(ue=re),ue>se&&(ue=se),0===ue)break e;a.arraySet(ee,$,te,ue,ae),re-=ue,te+=ue,se-=ue,ae+=ue,n.length-=ue;break}n.mode=O;break;case V:for(;oe<14;){if(0===re)break e;re--,ie+=$[te++]<>>=5,oe-=5,n.ndist=1+(31&ie),ie>>>=5,oe-=5,n.ncode=4+(15&ie),ie>>>=4,oe-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=L;case L:for(;n.have>>=3,oe-=3}for(;n.have<19;)n.lens[Te[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,xe={bits:n.lenbits},we=o(l,n.lens,0,19,n.lencode,0,n.work,xe),n.lenbits=xe.bits,we){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=z;case z:for(;n.have>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===re)break e;re--,ie+=$[te++]<>>=fe,oe-=fe,n.lens[n.have++]=ye;else{if(16===ye){for(Se=fe+2;oe>>=fe,oe-=fe,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}Ee=n.lens[n.have-1],ue=3+(3&ie),ie>>>=2,oe-=2}else if(17===ye){for(Se=fe+3;oe>>=fe)),ie>>>=3,oe-=3}else{for(Se=fe+7;oe>>=fe)),ie>>>=7,oe-=7}if(n.have+ue>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;ue--;)n.lens[n.have++]=Ee}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,xe={bits:n.lenbits},we=o(c,n.lens,0,n.nlen,n.lencode,0,n.work,xe),n.lenbits=xe.bits,we){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,xe={bits:n.distbits},we=o(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,xe),n.distbits=xe.bits,we){e.msg="invalid distances set",n.mode=J;break}if(n.mode=G,t===p)break e;case G:n.mode=H;case H:if(re>=6&&se>=258){e.next_out=ae,e.avail_out=se,e.next_in=te,e.avail_in=re,n.hold=ie,n.bits=oe,i(e,ce),ae=e.next_out,ee=e.output,se=e.avail_out,te=e.next_in,$=e.input,re=e.avail_in,ie=n.hold,oe=n.bits,n.mode===O&&(n.back=-1);break}for(n.back=0;ge=(Ce=n.lencode[ie&(1<>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===re)break e;re--,ie+=$[te++]<>ve)])>>>16&255,ye=65535&Ce,!(ve+(fe=Ce>>>24)<=oe);){if(0===re)break e;re--,ie+=$[te++]<>>=ve,oe-=ve,n.back+=ve}if(ie>>>=fe,oe-=fe,n.back+=fe,n.length=ye,0===ge){n.mode=q;break}if(32&ge){n.back=-1,n.mode=O;break}if(64&ge){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&ge,n.mode=U;case U:if(n.extra){for(Se=n.extra;oe>>=n.extra,oe-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;ge=(Ce=n.distcode[ie&(1<>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===re)break e;re--,ie+=$[te++]<>ve)])>>>16&255,ye=65535&Ce,!(ve+(fe=Ce>>>24)<=oe);){if(0===re)break e;re--,ie+=$[te++]<>>=ve,oe-=ve,n.back+=ve}if(ie>>>=fe,oe-=fe,n.back+=fe,64&ge){e.msg="invalid distance code",n.mode=J;break}n.offset=ye,n.extra=15&ge,n.mode=j;case j:if(n.extra){for(Se=n.extra;oe>>=n.extra,oe-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=Z;case Z:if(0===se)break e;if(ue=ce-se,n.offset>ue){if((ue=n.offset-ue)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}ue>n.wnext?(ue-=n.wnext,de=n.wsize-ue):de=n.wnext-ue,ue>n.length&&(ue=n.length),he=n.window}else he=ee,de=ae-n.offset,ue=n.length;ue>se&&(ue=se),se-=ue,n.length-=ue;do{ee[ae++]=he[de++]}while(--ue);0===n.length&&(n.mode=H);break;case q:if(0===se)break e;ee[ae++]=n.length,se--,n.mode=H;break;case Y:if(n.wrap){for(;oe<32;){if(0===re)break e;re--,ie|=$[te++]<=1&&0===G[N];N--);if(O>N&&(O=N),0===N)return f[g++]=20971520,f[g++]=20971520,v.bits=1,0;for(A=1;A0&&(e===o||1!==N))return-1;for(H[1]=0,I=1;Is||e===c&&B>i)return 1;for(;;){C=I-F,y[M]S?(k=U[W+y[M]],T=L[z+y[M]]):(k=96,T=0),_=1<>F)+(b-=_)]=C<<24|k<<16|T|0}while(0!==b);for(_=1<>=1;if(0!==_?(V&=_-1,V+=_):V=0,M++,0==--G[I]){if(I===N)break;I=t[n+y[M]]}if(I>O&&(V&w)!==E){for(0===F&&(F=O),x+=A,D=1<<(R=I-F);R+Fs||e===c&&B>i)return 1;f[E=V&w]=O<<24|R<<16|x-g|0}}return 0!==V&&(f[x+V]=I-F<<24|64<<16|0),v.bits=O,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.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(e,t,n){"use strict";function a(){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}t.exports=a},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var a=e("./zlib/inflate"),r=e("./utils/common"),s=e("./utils/strings"),i=e("./zlib/constants"),o=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=a.inflateInit2(this.strm,t.windowBits);if(n!==i.Z_OK)throw new Error(o[n]);if(this.header=new c,a.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=a.inflateSetDictionary(this.strm,t.dictionary))!==i.Z_OK))throw new Error(o[n])}function m(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}function p(e,t){return(t=t||{}).raw=!0,m(e,t)}d.prototype.push=function(e,t){var n,o,l,c,d,m=this.strm,p=this.options.chunkSize,h=this.options.dictionary,f=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof e?m.input=s.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?m.input=new Uint8Array(e):m.input=e,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new r.Buf8(p),m.next_out=0,m.avail_out=p),(n=a.inflate(m,i.Z_NO_FLUSH))===i.Z_NEED_DICT&&h&&(n=a.inflateSetDictionary(this.strm,h)),n===i.Z_BUF_ERROR&&!0===f&&(n=i.Z_OK,f=!1),n!==i.Z_STREAM_END&&n!==i.Z_OK)return this.onEnd(n),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&n!==i.Z_STREAM_END&&(0!==m.avail_in||o!==i.Z_FINISH&&o!==i.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(m.output,m.next_out),c=m.next_out-l,d=s.buf2string(m.output,l),m.next_out=c,m.avail_out=p-c,c&&r.arraySet(m.output,m.output,l,c,0),this.onData(d)):this.onData(r.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(f=!0)}while((m.avail_in>0||0===m.avail_out)&&n!==i.Z_STREAM_END);return n===i.Z_STREAM_END&&(o=i.Z_FINISH),o===i.Z_FINISH?(n=a.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===i.Z_OK):o!==i.Z_SYNC_FLUSH||(this.onEnd(i.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=m,n.inflateRaw=p,n.ungzip=m},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},5723:e=>{e.exports=function(){function e(t,n,a){function r(i,o){if(!n[i]){if(!t[i]){if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,(function(e){return r(t[i][1][e]||e)}),c,c.exports,e,t,n,a)}return n[i].exports}for(var s=void 0,i=0;i0},o.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var e=this.buf_ptr_,t=this.input_.read(this.buf_,e,a);if(t<0)throw new Error("Unexpected end of input");if(t=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&s]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},o.prototype.readBits=function(e){32-this.bit_pos_>>this.bit_pos_&i[e];return this.bit_pos_+=e,t},t.exports=o},{}],2:[function(e,t,n){n.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,n){var a=e("./streams").BrotliInput,r=e("./streams").BrotliOutput,s=e("./bit_reader"),i=e("./dictionary"),o=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),m=8,p=16,h=256,f=704,g=26,y=6,v=2,_=8,b=255,E=1080,w=18,x=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),S=16,C=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),k=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),T=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function P(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function I(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<1&&0===s)throw new Error("Invalid size byte");r.meta_block_length|=s<<8*a}}else for(a=0;a4&&0===i)throw new Error("Invalid size nibble");r.meta_block_length|=i<<4*a}return++r.meta_block_length,r.input_end||r.is_metadata||(r.is_uncompressed=e.readBits(1)),r}function N(e,t,n){var a;return n.fillBitWindow(),(a=e[t+=n.val_>>>n.bit_pos_&b].bits-_)>0&&(n.bit_pos_+=_,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<0;){var f,g=0;if(a.readMoreInput(),a.fillBitWindow(),g+=a.val_>>>a.bit_pos_&31,a.bit_pos_+=d[g].bits,(f=255&d[g].value)>f);else{var y,v,_=f-14,b=0;if(f===p&&(b=s),c!==b&&(i=0,c=b),y=i,i>0&&(i-=2,i<<=_),r+(v=(i+=a.readBits(_)+3)-y)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var E=0;E0;++p){var v,b=x[p],E=0;a.fillBitWindow(),E+=a.val_>>>a.bit_pos_&15,a.bit_pos_+=y[E].bits,v=y[E].value,h[b]=v,0!==v&&(f-=32>>v,++g)}if(1!==g&&0!==f)throw new Error("[ReadHuffmanCode] invalid num_codes or space");O(h,e,i,a)}if(0===(s=l(t,n,_,i,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return s}function F(e,t,n){var a,r;return a=N(e,t,n),r=u.kBlockLengthPrefixCode[a].nbits,u.kBlockLengthPrefixCode[a].offset+n.readBits(r)}function D(e,t,n){var a;return e>>5]),this.htrees=new Uint32Array(t)}function z(e,t){var n,a,r={num_htrees:null,context_map:null},s=0;t.readMoreInput();var i=r.num_htrees=I(t)+1,l=r.context_map=new Uint8Array(e);if(i<=1)return r;for(t.readBits(1)&&(s=t.readBits(4)+1),n=[],a=0;a=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[a]=0,++a}else l[a]=c-s,++a}return t.readBits(1)&&V(l,e),r}function G(e,t,n,a,r,s,i){var o,l=2*n,c=n,u=N(t,n*E,i);(o=0===u?r[l+(1&s[c])]:1===u?r[l+(s[c]-1&1)]+1:u-2)>=e&&(o-=e),a[n]=o,r[l+(1&s[c])]=o,++s[c]}function H(e,t,n,a,r,i){var o,l=r+1,c=n&r,u=i.pos_&s.IBUF_MASK;if(t<8||i.bit_pos_+(t<<3)0;)i.readMoreInput(),a[c++]=i.readBits(8),c===l&&(e.write(a,l),c=0);else{if(i.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;i.bit_pos_<32;)a[c]=i.val_>>>i.bit_pos_,i.bit_pos_+=8,++c,--t;if(u+(o=i.bit_end_pos_-i.bit_pos_>>3)>s.IBUF_MASK){for(var d=s.IBUF_MASK+1-u,m=0;m=l)for(e.write(a,l),c-=l,m=0;m=l;){if(o=l-c,i.input_.read(a,c,o)t.buffer.length){var ve=new Uint8Array(x+ne);ve.set(t.buffer),t.buffer=ve}if(C=ye.input_end,q=ye.is_uncompressed,ye.is_metadata)for(U(w);ne>0;--ne)w.readMoreInput(),w.readBits(8);else if(0!==ne)if(q)w.bit_pos_=w.bit_pos_+7&-8,H(t,ne,x,m,l,w),x+=ne;else{for(n=0;n<3;++n)se[n]=I(w)+1,se[n]>=2&&(R(se[n]+2,_,n*E,w),R(g,b,n*E,w),ae[n]=F(b,n*E,w),oe[n]=1);for(w.readMoreInput(),X=(1<<(Y=w.readBits(2)))-1,J=(K=S+(w.readBits(4)<0;){var Ee,we,xe,Se,Ce,ke,Te,Pe,Ie,Me,Ae,Ne;for(w.readMoreInput(),0===ae[1]&&(G(se[1],_,1,re,ie,oe,w),ae[1]=F(b,E,w),te=W[1].htrees[re[1]]),--ae[1],(we=(Ee=N(W[1].codes,te,w))>>6)>=2?(we-=2,Te=-1):Te=0,xe=u.kInsertRangeLut[we]+(Ee>>3&7),Se=u.kCopyRangeLut[we]+(7&Ee),Ce=u.kInsertLengthPrefixCode[xe].offset+w.readBits(u.kInsertLengthPrefixCode[xe].nbits),ke=u.kCopyLengthPrefixCode[Se].offset+w.readBits(u.kCopyLengthPrefixCode[Se].nbits),B=m[x-1&l],V=m[x-2&l],Ie=0;Ie4?3:ke-2))],(Te=N(W[2].codes,W[2].htrees[he],w))>=K&&(Ne=(Te-=K)&X,Te=K+((Oe=(2+(1&(Te>>=Y))<<(Ae=1+(Te>>1)))-4)+w.readBits(Ae)<(T=x=i.minDictionaryWordLength&&ke<=i.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+x+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Oe=i.offsetsByLength[ke],Re=Pe-T-1,Fe=i.sizeBitsByLength[ke],De=Re>>Fe;if(Oe+=(Re&(1<=p){t.write(m,r);for(var Ve=0;Ve0&&(M[3&O]=Pe,++O),ke>ne)throw new Error("Invalid backward reference. pos: "+x+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);for(Ie=0;Ie>=1;return(e&n-1)+n}function i(e,t,n,r,s){do{e[t+(r-=n)]=new a(s.bits,s.value)}while(r>0)}function o(e,t,n){for(var a=1<0;--E[u])i(e,t+m,p,y,new a(255&u,65535&_[d++])),m=s(m,u);for(f=v-1,h=-1,u=n+1,p=2;u<=r;++u,p<<=1)for(;E[u]>0;--E[u])(m&f)!==h&&(t+=y,v+=y=1<<(g=o(E,u,n)),e[b+(h=m&f)]=new a(g+n&255,t-b-h&65535)),i(e,t+(m>>n),p,y,new a(u-n&255,65535&_[d++])),m=s(m,u);return v}},{}],8:[function(e,t,n){"use strict";n.byteLength=u,n.toByteArray=m,n.fromByteArray=f;for(var a=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=i.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e){var t=c(e),n=t[0],a=t[1];return 3*(n+a)/4-a}function d(e,t,n){return 3*(t+n)/4-n}function m(e){for(var t,n=c(e),a=n[0],i=n[1],o=new s(d(e,a,i)),l=0,u=i>0?a-4:a,m=0;m>16&255,o[l++]=t>>8&255,o[l++]=255&t;return 2===i&&(t=r[e.charCodeAt(m)]<<2|r[e.charCodeAt(m+1)]>>4,o[l++]=255&t),1===i&&(t=r[e.charCodeAt(m)]<<10|r[e.charCodeAt(m+1)]<<4|r[e.charCodeAt(m+2)]>>2,o[l++]=t>>8&255,o[l++]=255&t),o}function p(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function h(e,t,n){for(var a,r=[],s=t;sl?l:o+i));return 1===r?(t=e[n-1],s.push(a[t>>2]+a[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],s.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"=")),s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],9:[function(e,t,n){function a(e,t){this.offset=e,this.nbits=t}n.kBlockLengthPrefixCode=[new a(1,2),new a(5,2),new a(9,2),new a(13,2),new a(17,3),new a(25,3),new a(33,3),new a(41,3),new a(49,4),new a(65,4),new a(81,4),new a(97,4),new a(113,5),new a(145,5),new a(177,5),new a(209,5),new a(241,6),new a(305,6),new a(369,7),new a(497,8),new a(753,9),new a(1265,10),new a(2289,11),new a(4337,12),new a(8433,13),new a(16625,24)],n.kInsertLengthPrefixCode=[new a(0,0),new a(1,0),new a(2,0),new a(3,0),new a(4,0),new a(5,0),new a(6,1),new a(8,1),new a(10,2),new a(14,2),new a(18,3),new a(26,3),new a(34,4),new a(50,4),new a(66,5),new a(98,5),new a(130,6),new a(194,7),new a(322,8),new a(578,9),new a(1090,10),new a(2114,12),new a(6210,14),new a(22594,24)],n.kCopyLengthPrefixCode=[new a(2,0),new a(3,0),new a(4,0),new a(5,0),new a(6,0),new a(7,0),new a(8,0),new a(9,0),new a(10,1),new a(12,1),new a(14,2),new a(18,2),new a(22,3),new a(30,3),new a(38,4),new a(54,4),new a(70,5),new a(102,5),new a(134,6),new a(198,7),new a(326,8),new a(582,9),new a(1094,10),new a(2118,24)],n.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],n.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(e,t,n){function a(e){this.buffer=e,this.pos=0}function r(e){this.buffer=e,this.pos=0}a.prototype.read=function(e,t,n){this.pos+n>this.buffer.length&&(n=this.buffer.length-this.pos);for(var a=0;athis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},n.BrotliOutput=r},{}],11:[function(e,t,n){var a=e("./dictionary"),r=0,s=1,i=2,o=3,l=4,c=5,u=6,d=7,m=8,p=9,h=10,f=11,g=12,y=13,v=14,_=15,b=16,E=17,w=18,x=20;function S(e,t,n){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(n.length);for(var a=0;a'),new S("",r,"\n"),new S("",o,""),new S("",r,"]"),new S("",r," for "),new S("",v,""),new S("",i,""),new S("",r," a "),new S("",r," that "),new S(" ",h,""),new S("",r,". "),new S(".",r,""),new S(" ",r,", "),new S("",_,""),new S("",r," with "),new S("",r,"'"),new S("",r," from "),new S("",r," by "),new S("",b,""),new S("",E,""),new S(" the ",r,""),new S("",l,""),new S("",r,". The "),new S("",f,""),new S("",r," on "),new S("",r," as "),new S("",r," is "),new S("",d,""),new S("",s,"ing "),new S("",r,"\n\t"),new S("",r,":"),new S(" ",r,". "),new S("",r,"ed "),new S("",x,""),new S("",w,""),new S("",u,""),new S("",r,"("),new S("",h,", "),new S("",m,""),new S("",r," at "),new S("",r,"ly "),new S(" the ",r," of "),new S("",c,""),new S("",p,""),new S(" ",h,", "),new S("",h,'"'),new S(".",r,"("),new S("",f," "),new S("",h,'">'),new S("",r,'="'),new S(" ",r,"."),new S(".com/",r,""),new S(" the ",r," of the "),new S("",h,"'"),new S("",r,". This "),new S("",r,","),new S(".",r," "),new S("",h,"("),new S("",h,"."),new S("",r," not "),new S(" ",r,'="'),new S("",r,"er "),new S(" ",f," "),new S("",r,"al "),new S(" ",f,""),new S("",r,"='"),new S("",f,'"'),new S("",h,". "),new S(" ",r,"("),new S("",r,"ful "),new S(" ",h,". "),new S("",r,"ive "),new S("",r,"less "),new S("",f,"'"),new S("",r,"est "),new S(" ",h,"."),new S("",f,'">'),new S(" ",r,"='"),new S("",h,","),new S("",r,"ize "),new S("",f,"."),new S(" ",r,""),new S(" ",r,","),new S("",h,'="'),new S("",f,'="'),new S("",r,"ous "),new S("",f,", "),new S("",h,"='"),new S(" ",h,","),new S(" ",f,'="'),new S(" ",f,", "),new S("",f,","),new S("",f,"("),new S("",f,". "),new S(" ",f,"."),new S("",f,"='"),new S(" ",f,". "),new S(" ",h,'="'),new S(" ",f,"='"),new S(" ",h,"='")];function k(e,t){return e[t]<192?(e[t]>=97&&e[t]<=122&&(e[t]^=32),1):e[t]<224?(e[t+1]^=32,2):(e[t+2]^=5,3)}n.kTransforms=C,n.kNumTransforms=C.length,n.transformDictionaryWord=function(e,t,n,r,s){var i,o=C[s].prefix,l=C[s].suffix,c=C[s].transform,u=cr&&(u=r);for(var y=0;y0;){var v=k(e,i);i+=v,r-=v}for(var _=0;_-1},get:function(e){return a[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),a.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),a.splice(t,1))}}),s=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){s=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,a=null,i=function(){e.clientWidth!==n&&m()},o=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",m,!1),e.removeEventListener("keyup",m,!1),e.removeEventListener("autosize:destroy",o,!1),e.removeEventListener("autosize:update",m,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",o,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",m,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",m,!1),e.addEventListener("autosize:update",m,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:o,update:m}),l()}function l(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),m()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var a=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,a.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function m(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r{var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e=[],t=0;t{e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},1919:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map((function(e){return a(e,n)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function o(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach((function(t){r[t]=a(e[t],n)})),s(t).forEach((function(s){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(i(e,s)&&n.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(s,n)(e[s],t[s],n):r[s]=a(t[s],n))})),r}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||r,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=a;var i=Array.isArray(n);return i===Array.isArray(e)?i?s.arrayMerge(e,n,s):o(e,n,s):a(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},9894:(e,t,n)=>{var a=n(4827);e.exports=function(e){var t=a(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var r=e.style.lineHeight;e.style.lineHeight=t+"em",t=a(e,"line-height"),n=parseFloat(t,10),r?e.style.lineHeight=r:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var s=e.nodeName,i=document.createElement(s);i.innerHTML=" ","TEXTAREA"===s.toUpperCase()&&i.setAttribute("rows","1");var o=a(e,"font-size");i.style.fontSize=o,i.style.padding="0px",i.style.border="0px";var l=document.body;l.appendChild(i),n=i.offsetHeight,l.removeChild(i)}return n}},5372:(e,t,n)=>{"use strict";var a=n(9567);function r(){}function s(){}s.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,s,i){if(i!==a){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},2652:(e,t,n)=>{e.exports=n(5372)()},9567:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},5438:function(e,t,n){"use strict";var a,r=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||Object.assign||function(e){for(var t,n=1,a=arguments.length;n{"use strict";var a=n(5438);t.Z=a.TextareaAutosize},4793:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),a=new RegExp(n,"g"),r=new RegExp(n,"");function s(e){return t[e]}var i=function(e){return e.replace(a,s)};e.exports=i,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=i},9196:e=>{"use strict";e.exports=window.React}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var s=t[a]={exports:{}};return e[a].call(s.exports,s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";n.r(a),n.d(a,{PluginMoreMenuItem:()=>mE,PluginSidebar:()=>uE,PluginSidebarMoreMenuItem:()=>dE,PluginTemplateSettingPanel:()=>ev,initializeEditor:()=>pE,reinitializeEditor:()=>hE,store:()=>ta});var e={};n.r(e),n.d(e,{closeModal:()=>B,disableComplementaryArea:()=>M,enableComplementaryArea:()=>I,openModal:()=>D,pinItem:()=>A,setDefaultComplementaryArea:()=>P,setFeatureDefaults:()=>F,setFeatureValue:()=>R,toggleFeature:()=>O,unpinItem:()=>N});var t={};n.r(t),n.d(t,{getActiveComplementaryArea:()=>V,isComplementaryAreaLoading:()=>L,isFeatureActive:()=>G,isItemPinned:()=>z,isModalActive:()=>H});var r={};n.r(r),n.d(r,{removeTemplates:()=>an,setCanvasMode:()=>tn,setEditorCanvasContainerView:()=>nn});var s={};n.r(s),n.d(s,{__experimentalSetPreviewDeviceType:()=>sn,addTemplate:()=>ln,closeGeneralSidebar:()=>Cn,openGeneralSidebar:()=>Sn,openNavigationPanelToMenu:()=>yn,removeTemplate:()=>cn,revertTemplate:()=>xn,setEditedEntity:()=>mn,setEditedPostContext:()=>hn,setHasPageContentFocus:()=>Tn,setHomeTemplateId:()=>pn,setIsInserterOpened:()=>_n,setIsListViewOpened:()=>bn,setIsNavigationPanelOpened:()=>vn,setIsSaveViewOpened:()=>wn,setNavigationMenu:()=>dn,setNavigationPanelActiveMenu:()=>gn,setPage:()=>fn,setTemplate:()=>on,setTemplatePart:()=>un,switchEditorMode:()=>kn,toggleDistractionFree:()=>Pn,toggleFeature:()=>rn,updateSettings:()=>En});var i={};n.r(i),n.d(i,{__experimentalGetInsertionPoint:()=>Hn,__experimentalGetPreviewDeviceType:()=>Nn,getCanUserCreateMedia:()=>On,getCurrentTemplateNavigationPanelSubMenu:()=>qn,getCurrentTemplateTemplateParts:()=>jn,getEditedPostContext:()=>Ln,getEditedPostId:()=>Vn,getEditedPostType:()=>Bn,getEditorMode:()=>Zn,getHomeTemplateId:()=>Dn,getNavigationPanelActiveMenu:()=>Yn,getPage:()=>zn,getReusableBlocks:()=>Rn,getSettings:()=>Fn,hasPageContentFocus:()=>Jn,isFeatureActive:()=>An,isInserterOpened:()=>Gn,isListViewOpened:()=>Un,isNavigationOpened:()=>Kn,isPage:()=>Xn,isSaveViewOpened:()=>Wn});var o={};n.r(o),n.d(o,{getCanvasMode:()=>Qn,getEditorCanvasContainerView:()=>$n});var l=n(9196);const c=window.wp.blocks,u=window.wp.blockLibrary,d=window.wp.data,m=window.wp.deprecated;var h=n.n(m);const f=window.wp.element,g=window.wp.editor;var y=n(4403),v=n.n(y);const _=window.wp.components,b=window.wp.i18n,E=window.wp.primitives,w=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),x=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})),S=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),C=window.wp.viewport,k=window.wp.preferences,T=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),P=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),I=(e,t)=>({registry:n,dispatch:a})=>{if(!t)return;n.select(k.store).get(e,"isComplementaryAreaVisible")||n.dispatch(k.store).set(e,"isComplementaryAreaVisible",!0),a({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},M=e=>({registry:t})=>{t.select(k.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(k.store).set(e,"isComplementaryAreaVisible",!1)},A=(e,t)=>({registry:n})=>{if(!t)return;const a=n.select(k.store).get(e,"pinnedItems");!0!==a?.[t]&&n.dispatch(k.store).set(e,"pinnedItems",{...a,[t]:!0})},N=(e,t)=>({registry:n})=>{if(!t)return;const a=n.select(k.store).get(e,"pinnedItems");n.dispatch(k.store).set(e,"pinnedItems",{...a,[t]:!1})};function O(e,t){return function({registry:n}){h()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(k.store).toggle(e,t)}}function R(e,t,n){return function({registry:a}){h()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),a.dispatch(k.store).set(e,t,!!n)}}function F(e,t){return function({registry:n}){h()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(k.store).setDefaults(e,t)}}function D(e){return{type:"OPEN_MODAL",name:e}}function B(){return{type:"CLOSE_MODAL"}}const V=(0,d.createRegistrySelector)((e=>(t,n)=>{const a=e(k.store).get(n,"isComplementaryAreaVisible");if(void 0!==a)return!1===a?null:t?.complementaryAreas?.[n]})),L=(0,d.createRegistrySelector)((e=>(t,n)=>{const a=e(k.store).get(n,"isComplementaryAreaVisible"),r=t?.complementaryAreas?.[n];return a&&void 0===r})),z=(0,d.createRegistrySelector)((e=>(t,n,a)=>{var r;const s=e(k.store).get(n,"pinnedItems");return null===(r=s?.[a])||void 0===r||r})),G=(0,d.createRegistrySelector)((e=>(t,n,a)=>(h()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(k.store).get(n,a))));function H(e,t){return e.activeModal===t}const U=(0,d.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:a}=t;return e[n]?e:{...e,[n]:a}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:a}=t;return{...e,[n]:a}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),W=(0,d.createReduxStore)("core/interface",{reducer:U,actions:e,selectors:t});(0,d.register)(W);const j=window.wp.plugins,Z=(0,j.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));const q=Z((function({as:e=_.Button,scope:t,identifier:n,icon:a,selectedIcon:r,name:s,...i}){const o=e,c=(0,d.useSelect)((e=>e(W).getActiveComplementaryArea(t)===n),[n,t]),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(W);return(0,l.createElement)(o,{icon:r&&c?r:a,"aria-controls":n.replace("/",":"),onClick:()=>{c?m(t):u(t,n)},...i})})),Y=({smallScreenTitle:e,children:t,className:n,toggleButtonProps:a})=>{const r=(0,l.createElement)(q,{icon:T,...a});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,l.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),r),(0,l.createElement)("div",{className:v()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},t,r))},K=()=>{};function X({name:e,as:t=_.Button,onClick:n,...a}){return(0,l.createElement)(_.Fill,{name:e},(({onClick:e})=>(0,l.createElement)(t,{onClick:n||e?(...t)=>{(n||K)(...t),(e||K)(...t)}:void 0,...a})))}X.Slot=function({name:e,as:t=_.ButtonGroup,fillProps:n={},bubblesVirtually:a,...r}){return(0,l.createElement)(_.Slot,{name:e,bubblesVirtually:a,fillProps:n},(e=>{if(!f.Children.toArray(e).length)return null;const n=[];f.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&n.push(t)}));const a=f.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&n.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(t,{...r},a)}))};const J=X,Q=({__unstableExplicitMenuItem:e,__unstableTarget:t,...n})=>(0,l.createElement)(_.MenuItem,{...n});function $({scope:e,target:t,__unstableExplicitMenuItem:n,...a}){return(0,l.createElement)(q,{as:a=>(0,l.createElement)(J,{__unstableExplicitMenuItem:n,__unstableTarget:`${e}/${t}`,as:Q,name:`${e}/plugin-more-menu`,...a}),role:"menuitemcheckbox",selectedIcon:w,name:t,scope:e,...a})}function ee({scope:e,...t}){return(0,l.createElement)(_.Fill,{name:`PinnedItems/${e}`,...t})}ee.Slot=function({scope:e,className:t,...n}){return(0,l.createElement)(_.Slot,{name:`PinnedItems/${e}`,...n},(e=>e?.length>0&&(0,l.createElement)("div",{className:v()(t,"interface-pinned-items")},e)))};const te=ee;function ne({scope:e,children:t,className:n,id:a}){return(0,l.createElement)(_.Fill,{name:`ComplementaryArea/${e}`},(0,l.createElement)("div",{id:a,className:n},t))}const ae=Z((function({children:e,className:t,closeLabel:n=(0,b.__)("Close plugin"),identifier:a,header:r,headerClassName:s,icon:i,isPinnable:o=!0,panelClassName:c,scope:u,name:m,smallScreenTitle:p,title:h,toggleShortcut:g,isActiveByDefault:y}){const{isLoading:E,isActive:T,isPinned:P,activeArea:I,isSmall:M,isLarge:A,showIconLabels:N}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:n,isItemPinned:r}=e(W),{get:s}=e(k.store),i=t(u);return{isLoading:n(u),isActive:i===a,isPinned:r(u,a),activeArea:i,isSmall:e(C.store).isViewportMatch("< medium"),isLarge:e(C.store).isViewportMatch("large"),showIconLabels:s("core","showIconLabels")}}),[a,u]);!function(e,t,n,a,r){const s=(0,f.useRef)(!1),i=(0,f.useRef)(!1),{enableComplementaryArea:o,disableComplementaryArea:l}=(0,d.useDispatch)(W);(0,f.useEffect)((()=>{a&&r&&!s.current?(l(e),i.current=!0):i.current&&!r&&s.current?(i.current=!1,o(e,t)):i.current&&n&&n!==t&&(i.current=!1),r!==s.current&&(s.current=r)}),[a,r,e,t,n,l,o])}(u,a,I,T,M);const{enableComplementaryArea:O,disableComplementaryArea:R,pinItem:F,unpinItem:D}=(0,d.useDispatch)(W);return(0,f.useEffect)((()=>{y&&void 0===I&&!M?O(u,a):void 0===I&&M&&R(u,a)}),[I,y,u,a,M,O,R]),(0,l.createElement)(l.Fragment,null,o&&(0,l.createElement)(te,{scope:u},P&&(0,l.createElement)(q,{scope:u,identifier:a,isPressed:T&&(!N||A),"aria-expanded":T,"aria-disabled":E,label:h,icon:N?w:i,showTooltip:!N,variant:N?"tertiary":void 0,size:"compact"})),m&&o&&(0,l.createElement)($,{target:m,scope:u,icon:i},h),T&&(0,l.createElement)(ne,{className:v()("interface-complementary-area",t),scope:u,id:a.replace("/",":")},(0,l.createElement)(Y,{className:s,closeLabel:n,onClose:()=>R(u),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:g,scope:u,identifier:a}},r||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,h),o&&(0,l.createElement)(_.Button,{className:"interface-complementary-area__pin-unpin-item",icon:P?x:S,label:P?(0,b.__)("Unpin from toolbar"):(0,b.__)("Pin to toolbar"),onClick:()=>(P?D:F)(u,a),isPressed:P,"aria-expanded":P}))),(0,l.createElement)(_.Panel,{className:c},e)))}));ae.Slot=function({scope:e,...t}){return(0,l.createElement)(_.Slot,{name:`ComplementaryArea/${e}`,...t})};const re=ae,se=window.wp.compose;function ie({children:e,className:t,ariaLabel:n,as:a="div",...r}){return(0,l.createElement)(a,{className:v()("interface-navigable-region",t),"aria-label":n,role:"region",tabIndex:"-1",...r},e)}const oe={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};const le=(0,f.forwardRef)((function({isDistractionFree:e,footer:t,header:n,editorNotices:a,sidebar:r,secondarySidebar:s,notices:i,content:o,actions:c,labels:u,className:d,enableRegionNavigation:m=!0,shortcuts:p},h){const g=(0,_.__unstableUseNavigateRegions)(p);!function(e){(0,f.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const y={...{header:(0,b._x)("Header","header landmark area"),body:(0,b.__)("Content"),secondarySidebar:(0,b.__)("Block Library"),sidebar:(0,b.__)("Settings"),actions:(0,b.__)("Publish"),footer:(0,b.__)("Footer")},...u};return(0,l.createElement)("div",{...m?g:{},ref:(0,se.useMergeRefs)([h,m?g.ref:void 0]),className:v()(d,"interface-interface-skeleton",g.className,!!t&&"has-footer")},(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!n&&(0,l.createElement)(ie,{as:_.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":y.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:oe,transition:e?{type:"tween",delay:.8}:void 0},n),e&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},a),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!s&&(0,l.createElement)(ie,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:y.secondarySidebar},s),!!i&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},i),(0,l.createElement)(ie,{className:"interface-interface-skeleton__content",ariaLabel:y.body},o),!!r&&(0,l.createElement)(ie,{className:"interface-interface-skeleton__sidebar",ariaLabel:y.sidebar},r),!!c&&(0,l.createElement)(ie,{className:"interface-interface-skeleton__actions",ariaLabel:y.actions},c))),!!t&&(0,l.createElement)(ie,{className:"interface-interface-skeleton__footer",ariaLabel:y.footer},t))})),ce=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ue({as:e=_.DropdownMenu,className:t,label:n=(0,b.__)("Options"),popoverProps:a,toggleProps:r,children:s}){return(0,l.createElement)(e,{className:v()("interface-more-menu-dropdown",t),icon:ce,label:n,popoverProps:{placement:"bottom-end",...a,className:v()("interface-more-menu-dropdown__content",a?.className)},toggleProps:{tooltipPosition:"bottom",...r,size:"compact"}},(e=>s(e)))}const de=window.wp.widgets,me=window.wp.hooks,pe=window.wp.mediaUtils;(0,me.addFilter)("editor.MediaUpload","core/edit-site/components/media-upload",(()=>pe.MediaUpload));const he=window.wp.blockEditor,fe=window.wp.notices,ge=window.wp.coreData;var ye={grad:.9,turn:360,rad:360/(2*Math.PI)},ve=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},_e=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},be=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Ee=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},we=function(e){return{r:be(e.r,0,255),g:be(e.g,0,255),b:be(e.b,0,255),a:be(e.a)}},xe=function(e){return{r:_e(e.r),g:_e(e.g),b:_e(e.b),a:_e(e.a,3)}},Se=/^#([0-9a-f]{3,8})$/i,Ce=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},ke=function(e){var t=e.r,n=e.g,a=e.b,r=e.a,s=Math.max(t,n,a),i=s-Math.min(t,n,a),o=i?s===t?(n-a)/i:s===n?2+(a-t)/i:4+(t-n)/i:0;return{h:60*(o<0?o+6:o),s:s?i/s*100:0,v:s/255*100,a:r}},Te=function(e){var t=e.h,n=e.s,a=e.v,r=e.a;t=t/360*6,n/=100,a/=100;var s=Math.floor(t),i=a*(1-n),o=a*(1-(t-s)*n),l=a*(1-(1-t+s)*n),c=s%6;return{r:255*[a,o,i,i,l,a][c],g:255*[l,a,a,o,i,i][c],b:255*[i,i,l,a,a,o][c],a:r}},Pe=function(e){return{h:Ee(e.h),s:be(e.s,0,100),l:be(e.l,0,100),a:be(e.a)}},Ie=function(e){return{h:_e(e.h),s:_e(e.s),l:_e(e.l),a:_e(e.a,3)}},Me=function(e){return Te((n=(t=e).s,{h:t.h,s:(n*=((a=t.l)<50?a:100-a)/100)>0?2*n/(a+n)*100:0,v:a+n,a:t.a}));var t,n,a},Ae=function(e){return{h:(t=ke(e)).h,s:(r=(200-(n=t.s))*(a=t.v)/100)>0&&r<200?n*a/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,a,r},Ne=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Re=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De={string:[[function(e){var t=Se.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?_e(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?_e(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Re.exec(e)||Fe.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:we({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Ne.exec(e)||Oe.exec(e);if(!t)return null;var n,a,r=Pe({h:(n=t[1],a=t[2],void 0===a&&(a="deg"),Number(n)*(ye[a]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Me(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,a=e.b,r=e.a,s=void 0===r?1:r;return ve(t)&&ve(n)&&ve(a)?we({r:Number(t),g:Number(n),b:Number(a),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,a=e.l,r=e.a,s=void 0===r?1:r;if(!ve(t)||!ve(n)||!ve(a))return null;var i=Pe({h:Number(t),s:Number(n),l:Number(a),a:Number(s)});return Me(i)},"hsl"],[function(e){var t=e.h,n=e.s,a=e.v,r=e.a,s=void 0===r?1:r;if(!ve(t)||!ve(n)||!ve(a))return null;var i=function(e){return{h:Ee(e.h),s:be(e.s,0,100),v:be(e.v,0,100),a:be(e.a)}}({h:Number(t),s:Number(n),v:Number(a),a:Number(s)});return Te(i)},"hsv"]]},Be=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=xe(this.rgba)).r,n=e.g,a=e.b,s=(r=e.a)<1?Ce(_e(255*r)):"","#"+Ce(t)+Ce(n)+Ce(a)+s;var e,t,n,a,r,s},e.prototype.toRgb=function(){return xe(this.rgba)},e.prototype.toRgbString=function(){return t=(e=xe(this.rgba)).r,n=e.g,a=e.b,(r=e.a)<1?"rgba("+t+", "+n+", "+a+", "+r+")":"rgb("+t+", "+n+", "+a+")";var e,t,n,a,r},e.prototype.toHsl=function(){return Ie(Ae(this.rgba))},e.prototype.toHslString=function(){return t=(e=Ie(Ae(this.rgba))).h,n=e.s,a=e.l,(r=e.a)<1?"hsla("+t+", "+n+"%, "+a+"%, "+r+")":"hsl("+t+", "+n+"%, "+a+"%)";var e,t,n,a,r},e.prototype.toHsv=function(){return e=ke(this.rgba),{h:_e(e.h),s:_e(e.s),v:_e(e.v),a:_e(e.a,3)};var e},e.prototype.invert=function(){return Ue({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Ue(Le(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Ue(Le(this.rgba,-e))},e.prototype.grayscale=function(){return Ue(Le(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Ue(Ge(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Ue(Ge(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Ue({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_e(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Ae(this.rgba);return"number"==typeof e?Ue({h:e,s:t.s,l:t.l,a:t.a}):_e(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Ue(e).toHex()},e}(),Ue=function(e){return e instanceof He?e:new He(e)},We=[],je=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Ze=function(e){return.2126*je(e.r)+.7152*je(e.g)+.0722*je(e.b)};const qe=window.wp.privateApis,{lock:Ye,unlock:Ke}=(0,qe.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-site"),{useGlobalSetting:Xe,useGlobalStyle:Je}=Ke(he.privateApis);function Qe(){const[e="black"]=Je("color.text"),[t="white"]=Je("color.background"),[n=e]=Je("elements.h1.color.text"),[a]=Xe("color.palette.core"),[r]=Xe("color.palette.theme"),[s]=Xe("color.palette.custom"),i=(null!=r?r:[]).concat(null!=s?s:[]).concat(null!=a?a:[]),o=i.filter((({color:e})=>e!==t&&e!==n)).slice(0,2);return{paletteColors:i,highlightedColors:o}}!function(e){e.forEach((function(e){We.indexOf(e)<0&&(e(He,De),We.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Ze(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,a,r,s,i,o,l,c=t instanceof e?t:new e(t);return s=this.rgba,i=c.toRgb(),n=(o=Ze(s))>(l=Ze(i))?(o+.05)/(l+.05):(l+.05)/(o+.05),void 0===(a=2)&&(a=0),void 0===r&&(r=Math.pow(10,a)),Math.floor(r*n)/r+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(s=(n=t).size)?"normal":s,"AAA"===(r=void 0===(a=n.level)?"AA":a)&&"normal"===i?7:"AA"===r&&"large"===i?3:4.5);var n,a,r,s,i}}]);const{cleanEmptyObject:$e,GlobalStylesContext:et}=Ke(he.privateApis),tt={...c.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},nt={"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"},at={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},rt=["border","color","spacing","typography"],st=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n},it=["borderColor","borderWidth","borderStyle"],ot=["top","right","bottom","left"];function lt(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:a,style:r,width:s}=t[e];return!(a||s)||r?[]:[{path:["border",e,"style"],value:"solid"}]}function ct(e,t,n){const a=function(e,t){const{supportedPanels:n}=(0,d.useSelect)((n=>({supportedPanels:Ke(n(c.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),r=n?.styles?.blocks?.[e];return(0,f.useMemo)((()=>{const e=a.flatMap((e=>{if(!tt[e])return[];const{value:n}=tt[e],a=n.join("."),r=t[at[a]],s=r?`var:preset|${nt[a]}|${r}`:st(t.style,n);if("linkColor"===e){const e=s?[{path:n,value:s}]:[],a=["elements","link",":hover","color","text"],r=st(t.style,a);return r&&e.push({path:a,value:r}),e}if(it.includes(e)&&s){const e=[{path:n,value:s}];return ot.forEach((t=>{const a=[...n];a.splice(-1,0,t),e.push({path:a,value:s})})),e}return s?[{path:n,value:s}]:[]}));return function(e,t,n){if(!e&&!t)return[];const a=[...lt("top",e,n),...lt("right",e,n),...lt("bottom",e,n),...lt("left",e,n)],{color:r,style:s,width:i}=e||{};return(t||r||i)&&!s&&ot.forEach((e=>{n?.[e]?.style||a.push({path:["border",e,"style"],value:"solid"})})),a}(t.style?.border,t.borderColor,r?.border).forEach((t=>e.push(t))),e}),[a,t,r])}function ut(e,t,n){return e&&"object"==typeof e?(t.reduce(((e,a,r)=>(void 0===e[a]&&(Number.isInteger(t[r+1])?e[a]=[]:e[a]={}),r===t.length-1&&(e[a]=n),e[a])),e),e):e}function dt(e){return e?JSON.parse(JSON.stringify(e)):{}}function mt({name:e,attributes:t,setAttributes:n}){const{user:a,setUserConfig:r}=(0,f.useContext)(et),s=ct(e,t,a),{__unstableMarkNextChangeAsNotPersistent:i}=(0,d.useDispatch)(he.store),{createSuccessNotice:o}=(0,d.useDispatch)(fe.store),u=(0,f.useCallback)((()=>{if(0!==s.length&&s.length>0){const{style:l}=t,u=dt(l),d=dt(a);for(const{path:t,value:n}of s)ut(u,t,void 0),ut(d,["styles","blocks",e,...t],n);const m={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:$e(u)};i(),n(m),r((()=>d),{undoIgnore:!0}),o((0,b.sprintf)((0,b.__)("%s styles applied."),(0,c.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick(){i(),n(t),r((()=>a),{undoIgnore:!0})}}]})}}),[i,t,s,o,e,n,r,a]);return(0,l.createElement)(_.BaseControl,{className:"edit-site-push-changes-to-global-styles-control",help:(0,b.sprintf)((0,b.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,c.getBlockType)(e).title)},(0,l.createElement)(_.BaseControl.VisualLabel,null,(0,b.__)("Styles")),(0,l.createElement)(_.Button,{variant:"primary",disabled:0===s.length,onClick:u},(0,b.__)("Apply globally")))}function pt(e){const t=(0,he.useBlockEditingMode)(),n=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme()?.is_block_theme),[]),a=rt.some((t=>(0,c.hasBlockSupport)(e.name,t)));return"default"===t&&a&&n?(0,l.createElement)(he.InspectorAdvancedControls,null,(0,l.createElement)(mt,{...e})):null}const ht=(0,se.createHigherOrderComponent)((e=>t=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),t.isSelected&&(0,l.createElement)(pt,{...t}))));(0,me.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",ht);const ft=window.wp.router,gt=window.wp.url;function yt(){return void 0!==(0,gt.getQueryArg)(window.location.href,"wp_theme_preview")}function vt(){return yt()?(0,gt.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useHistory:_t}=Ke(ft.privateApis);function bt(e,t={},n,a=!1){const r=(0,gt.getQueryArgs)(window.location.href),s=(0,gt.removeQueryArgs)(window.location.href,...Object.keys(r));yt()&&(t={...t,wp_theme_preview:vt()});return{href:(0,gt.addQueryArgs)(s,t),onClick:function(r){r?.preventDefault(),a?e.replace(t,n):e.push(t,n)}}}function Et(e,t,n){return bt(_t(),e,t,n)}function wt({params:e={},state:t,replace:n=!1,children:a,...r}){const{href:s,onClick:i}=Et(e,t,n);return(0,l.createElement)("a",{href:s,onClick:i,...r},a)}const xt=window.wp.patterns,St="wp_navigation",Ct="wp_template",kt="wp_template_part",Tt={custom:"custom",theme:"theme",plugin:"plugin"},Pt="uncategorized",{PATTERN_TYPES:It,PATTERN_DEFAULT_CATEGORY:Mt,PATTERN_USER_CATEGORY:At,EXCLUDED_PATTERN_SOURCES:Nt,PATTERN_SYNC_TYPES:Ot}=Ke(xt.privateApis),Rt=[kt,St,It.user],Ft={[Ct]:(0,b.__)("Template"),[kt]:(0,b.__)("Template part"),[It.user]:(0,b.__)("Pattern"),[St]:(0,b.__)("Navigation")},Dt="grid",Bt="table",Vt="list",Lt="enumeration",zt="in",Gt="notIn",{useLocation:Ht}=Ke(ft.privateApis);function Ut({attributes:e}){const{theme:t,slug:n}=e,{params:a}=Ht(),r=(0,d.useSelect)((e=>{const{getCurrentTheme:a,getEntityRecord:r}=e(ge.store);return r("postType",kt,`${t||a()?.stylesheet}//${n}`)}),[t,n]),s=Et({postId:r?.id,postType:r?.type,canvas:"edit"},{fromTemplateId:a.postId||r?.id});return r?(0,l.createElement)(_.ToolbarButton,{...s,onClick:e=>{s.onClick(e)}},(0,b.__)("Edit")):null}const Wt=(0,se.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:a}=t,r="core/template-part"===a&&n.slug;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{key:"edit",...t}),r&&(0,l.createElement)(he.BlockControls,{group:"other"},(0,l.createElement)(Ut,{attributes:n})))}),"withEditBlockControls");(0,me.addFilter)("editor.BlockEdit","core/edit-site/template-part-edit-button",Wt);const{useLocation:jt}=Ke(ft.privateApis);function Zt({attributes:e}){const{ref:t}=e,{params:n}=jt(),a=(0,he.useBlockEditingMode)(),r=(0,d.useSelect)((e=>e(ge.store).getEntityRecord("postType",St,t)),[t]),s=Et({postId:r?.id,postType:r?.type,canvas:"edit"},{fromTemplateId:n.postId||r?.id});return r&&"default"===a?(0,l.createElement)(he.BlockControls,{group:"other"},(0,l.createElement)(_.ToolbarButton,{...s,onClick:e=>{s.onClick(e)}},(0,b.__)("Edit"))):null}const qt=(0,se.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:a}=t,r="core/navigation"===a&&n.ref;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),r&&(0,l.createElement)(Zt,{attributes:n}))}),"withEditBlockControls");(0,me.addFilter)("editor.BlockEdit","core/edit-site/navigation-edit-button",qt);const Yt=(0,d.combineReducers)({settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},saveViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_SAVE_VIEW_OPENED":return t.isOpen;case"SET_CANVAS_MODE":return!1}return e},canvasMode:function(e="init",t){return"SET_CANVAS_MODE"===t.type?t.mode:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e}}),Kt=window.wp.apiFetch;var Xt=n.n(Kt);const Jt=window.wp.a11y,Qt="core/edit-site";function $t(e){return!!e&&(e?.source===Tt.custom&&e?.has_theme_file)}const en=window.wp.htmlEntities,tn=e=>({registry:t,dispatch:n})=>{t.dispatch(he.store).__unstableSetEditorMode("edit"),n({type:"SET_CANVAS_MODE",mode:e}),"edit"===e&&t.select(k.store).get("core","showListViewByDefault")&&!t.select(k.store).get("core","distractionFree")?t.dispatch(g.store).setIsListViewOpened(!0):t.dispatch(g.store).setIsListViewOpened(!1),t.dispatch(g.store).setIsInserterOpened(!1)},nn=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})},an=e=>async({registry:t})=>{const n=e[0].type===Ct,a=await Promise.allSettled(e.map((e=>t.dispatch(ge.store).deleteEntityRecord("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(a.every((({status:e})=>"fulfilled"===e))){let a;if(1===e.length){const t="string"==typeof e[0].title?e[0].title:e[0].title?.rendered;a=(0,b.sprintf)((0,b.__)('"%s" deleted.'),(0,en.decodeEntities)(t))}else a=n?(0,b.__)("Templates deleted."):(0,b.__)("Template parts deleted.");t.dispatch(fe.store).createSuccessNotice(a,{type:"snackbar",id:"site-editor-template-deleted-success"})}else{let e;if(1===a.length)e=a[0].reason?.message?a[0].reason.message:n?(0,b.__)("An error occurred while deleting the template."):(0,b.__)("An error occurred while deleting the template part.");else{const t=new Set,r=a.filter((({status:e})=>"rejected"===e));for(const e of r)e.reason?.message&&t.add(e.reason.message);e=0===t.size?n?(0,b.__)("An error occurred while deleting the templates."):(0,b.__)("An error occurred while deleting the template parts."):1===t.size?n?(0,b.sprintf)((0,b.__)("An error occurred while deleting the templates: %s"),[...t][0]):(0,b.sprintf)((0,b.__)("An error occurred while deleting the template parts: %s"),[...t][0]):n?(0,b.sprintf)((0,b.__)("Some errors occurred while deleting the templates: %s"),[...t].join(",")):(0,b.sprintf)((0,b.__)("Some errors occurred while deleting the template parts: %s"),[...t].join(","))}t.dispatch(fe.store).createErrorNotice(e,{type:"snackbar"})}};function rn(e){return function({registry:t}){h()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(k.store).toggle("core/edit-site",e)}}const sn=e=>({registry:t})=>{h()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(g.store).setDeviceType(e)};function on(){return h()("dispatch( 'core/edit-site' ).setTemplate",{since:"6.5",version:"6.8",hint:"The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}const ln=e=>async({dispatch:t,registry:n})=>{h()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const a=await n.dispatch(ge.store).saveEntityRecord("postType",Ct,e);e.content&&n.dispatch(ge.store).editEntityRecord("postType",Ct,a.id,{blocks:(0,c.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Ct,id:a.id})},cn=e=>an([e]);function un(e){return{type:"SET_EDITED_POST",postType:kt,id:e}}function dn(e){return{type:"SET_EDITED_POST",postType:St,id:e}}function mn(e,t,n){return{type:"SET_EDITED_POST",postType:e,id:t,context:n}}function pn(){return h()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function hn(e){return{type:"SET_EDITED_POST_CONTEXT",context:e}}function fn(){return h()("dispatch( 'core/edit-site' ).setPage",{since:"6.5",version:"6.8",hint:"The setPage is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}function gn(){return h()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function yn(){return h()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function vn(){return h()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const _n=e=>({registry:t})=>{h()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(g.store).setIsInserterOpened(e)},bn=e=>({registry:t})=>{h()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(g.store).setIsListViewOpened(e)};function En(e){return{type:"UPDATE_SETTINGS",settings:e}}function wn(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const xn=(e,{allowUndo:t=!0}={})=>async({registry:n})=>{const a="edit-site-template-reverted";if(n.dispatch(fe.store).removeNotice(a),$t(e))try{const r=n.select(ge.store).getEntityConfig("postType",e.type);if(!r)return void n.dispatch(fe.store).createErrorNotice((0,b.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const s=(0,gt.addQueryArgs)(`${r.baseURL}/${e.id}`,{context:"edit",source:"theme"}),i=await Xt()({path:s});if(!i)return void n.dispatch(fe.store).createErrorNotice((0,b.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const o=({blocks:e=[]})=>(0,c.__unstableSerializeAndClean)(e),l=n.select(ge.store).getEditedEntityRecord("postType",e.type,e.id);n.dispatch(ge.store).editEntityRecord("postType",e.type,e.id,{content:o,blocks:l.blocks,source:"custom"},{undoIgnore:!0});const u=(0,c.parse)(i?.content?.raw);if(n.dispatch(ge.store).editEntityRecord("postType",e.type,i.id,{content:o,blocks:u,source:"theme"}),t){const t=()=>{n.dispatch(ge.store).editEntityRecord("postType",e.type,l.id,{content:o,blocks:l.blocks,source:"custom"})};n.dispatch(fe.store).createSuccessNotice((0,b.__)("Template reverted."),{type:"snackbar",id:a,actions:[{label:(0,b.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("Template revert failed. Please reload.");n.dispatch(fe.store).createErrorNotice(t,{type:"snackbar"})}else n.dispatch(fe.store).createErrorNotice((0,b.__)("This template is not revertable."),{type:"snackbar"})},Sn=e=>({dispatch:t,registry:n})=>{n.select(k.store).get("core","distractionFree")&&t.toggleDistractionFree(),n.dispatch(W).enableComplementaryArea(Qt,e)},Cn=()=>({registry:e})=>{e.dispatch(W).disableComplementaryArea(Qt)},kn=e=>({dispatch:t,registry:n})=>{if(n.dispatch("core/preferences").set("core","editorMode",e),"visual"!==e&&n.dispatch(he.store).clearSelectedBlock(),"visual"===e)(0,Jt.speak)((0,b.__)("Visual editor selected"),"assertive");else if("text"===e){n.select(k.store).get("core","distractionFree")&&t.toggleDistractionFree(),(0,Jt.speak)((0,b.__)("Code editor selected"),"assertive")}},Tn=e=>({dispatch:t,registry:n})=>{h()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&n.dispatch(he.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},Pn=()=>({dispatch:e,registry:t})=>{const n=t.select(k.store).get("core","distractionFree");n||t.batch((()=>{t.dispatch(k.store).set("core","fixedToolbar",!0),t.dispatch(g.store).setIsInserterOpened(!1),t.dispatch(g.store).setIsListViewOpened(!1),e.closeGeneralSidebar()})),t.batch((()=>{t.dispatch(k.store).set("core","distractionFree",!n),t.dispatch(fe.store).createInfoNotice(n?(0,b.__)("Distraction free off."):(0,b.__)("Distraction free on."),{id:"core/edit-site/distraction-free-mode/notice",type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick:()=>{t.dispatch(k.store).toggle("core","distractionFree")}}]})}))};const In=[];const Mn=function(e,t){var n,a,r=0;function s(){var s,i,o=n,l=arguments.length;e:for(;o;){if(o.args.length===arguments.length){for(i=0;i({...e,[t.id]:t})),{}):{},a=[],r=[...e];for(;r.length;){const{innerBlocks:e,...t}=r.shift();if(r.unshift(...e),(0,c.isTemplatePart)(t)){const{attributes:{theme:e,slug:r}}=t,s=n[`${e}//${r}`];s&&a.push({templatePart:s,block:t})}}return a})),An=(0,d.createRegistrySelector)((e=>(t,n)=>(h()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(k.store).get("core/edit-site",n)))),Nn=(0,d.createRegistrySelector)((e=>()=>(h()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(g.store).getDeviceType()))),On=(0,d.createRegistrySelector)((e=>()=>e(ge.store).canUser("create","media"))),Rn=(0,d.createRegistrySelector)((e=>()=>{h()("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )",{since:"6.5",version:"6.8"});return"web"===f.Platform.OS?e(ge.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function Fn(e){return e.settings}function Dn(){h()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function Bn(e){return e.editedPost.postType}function Vn(e){return e.editedPost.id}function Ln(e){return e.editedPost.context}function zn(e){return{context:e.editedPost.context}}const Gn=(0,d.createRegistrySelector)((e=>()=>(h()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(g.store).isInserterOpened()))),Hn=(0,d.createRegistrySelector)((e=>()=>(h()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),Ke(e(g.store)).getInsertionPoint()))),Un=(0,d.createRegistrySelector)((e=>()=>(h()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(g.store).isListViewOpened())));function Wn(e){return e.saveViewPanel}const jn=(0,d.createRegistrySelector)((e=>()=>{const t=e(ge.store).getEntityRecords("postType",kt,{per_page:-1}),n=e(he.store).getBlocksByName("core/template-part"),a=e(he.store).getBlocksByClientId(n);return Mn(a,t)})),Zn=(0,d.createRegistrySelector)((e=>()=>e(k.store).get("core","editorMode")));function qn(){h()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Yn(){h()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Kn(){h()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Xn(e){return!!e.editedPost.context?.postId}function Jn(){return h()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Qn(e){return e.canvasMode}function $n(e){return e.editorCanvasContainerView}const ea={reducer:Yt,actions:s,selectors:i},ta=(0,d.createReduxStore)(Qt,ea);(0,d.register)(ta),Ke(ta).registerPrivateSelectors(o),Ke(ta).registerPrivateActions(r);const na=window.wp.keyboardShortcuts,aa=window.wp.commands,ra=window.wp.coreCommands,sa=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})),ia=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"})),oa=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,l.createElement)(E.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})),la=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),ca=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})),ua=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),da=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));function ma(e){return(0,l.createElement)(_.Button,{...e,className:v()("edit-site-sidebar-button",e.className)})}const{useLocation:pa}=Ke(ft.privateApis);function ha({isRoot:e,title:t,actions:n,meta:a,content:r,footer:s,description:i,backPath:o}){const{dashboardLink:c,dashboardLinkText:u,previewingThemeName:m}=(0,d.useSelect)((e=>{const{getSettings:t}=Ke(e(ta)),n=vt();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:n?e(ge.store).getTheme(n)?.name?.rendered:void 0}}),[]),p=pa(),h=(0,_.__experimentalUseNavigator)(),f=(0,b.isRTL)()?ua:da;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalVStack,{className:v()("edit-site-sidebar-navigation-screen__main",{"has-footer":!!s}),spacing:0,justify:"flex-start"},(0,l.createElement)(_.__experimentalHStack,{spacing:4,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon"},!e&&(0,l.createElement)(ma,{onClick:()=>{const e=null!=o?o:p.state?.backPath;e?h.goTo(e,{isBack:!0}):h.goToParent()},icon:f,label:(0,b.__)("Back"),showTooltip:!1}),e&&(0,l.createElement)(ma,{icon:f,label:u||(0,b.__)("Go to the Dashboard"),href:c||"index.php"}),(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20},yt()?(0,b.sprintf)("Previewing %1$s: %2$s",m,t):t),n&&(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__actions"},n)),a&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__meta"},a)),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__content"},i&&(0,l.createElement)("p",{className:"edit-site-sidebar-navigation-screen__description"},i),r)),s&&(0,l.createElement)("footer",{className:"edit-site-sidebar-navigation-screen__footer"},s))}const fa=(0,f.forwardRef)((function({icon:e,size:t=24,...n},a){return(0,f.cloneElement)(e,{width:t,height:t,...n,ref:a})})),ga=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})),ya=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));function va({className:e,icon:t,withChevron:n=!1,suffix:a,children:r,...s}){return(0,l.createElement)(_.__experimentalItem,{className:v()("edit-site-sidebar-navigation-item",{"with-suffix":!n&&a},e),...s},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start"},t&&(0,l.createElement)(fa,{style:{fill:"currentcolor"},icon:t,size:24}),(0,l.createElement)(_.FlexBlock,null,r),n&&(0,l.createElement)(fa,{icon:(0,b.isRTL)()?ga:ya,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&a))}const _a=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})),ba=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),Ea=ba,wa=window.wp.keycodes;var xa=n(1919),Sa=n.n(xa); /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function Ca(e){return"[object Object]"===Object.prototype.toString.call(e)}function ka(e){var t,n;return!1!==Ca(e)&&(void 0===(t=e.constructor)||!1!==Ca(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}const{GlobalStylesContext:Ta,cleanEmptyObject:Pa}=Ke(he.privateApis);function Ia(e,t){return Sa()(e,t,{isMergeableObject:ka})}function Ma(){const[e,t,n]=function(){const{globalStylesId:e,isReady:t,settings:n,styles:a}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t,hasFinishedResolution:n}=e(ge.store),a=e(ge.store).__experimentalGetCurrentGlobalStylesId(),r=a?t("root","globalStyles",a):void 0;let s=!1;return n("__experimentalGetCurrentGlobalStylesId")&&(s=!a||n("getEditedEntityRecord",["root","globalStyles",a])),{globalStylesId:a,isReady:s,settings:r?.settings,styles:r?.styles}}),[]),{getEditedEntityRecord:r}=(0,d.useSelect)(ge.store),{editEntityRecord:s}=(0,d.useDispatch)(ge.store);return[t,(0,f.useMemo)((()=>({settings:null!=n?n:{},styles:null!=a?a:{}})),[n,a]),(0,f.useCallback)(((t,n={})=>{var a,i;const o=r("root","globalStyles",e),l=t({styles:null!==(a=o?.styles)&&void 0!==a?a:{},settings:null!==(i=o?.settings)&&void 0!==i?i:{}});s("root","globalStyles",e,{styles:Pa(l.styles)||{},settings:Pa(l.settings)||{}},n)}),[e])]}(),[a,r]=function(){const e=(0,d.useSelect)((e=>e(ge.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),s=(0,f.useMemo)((()=>r&&t?Ia(r,t):{}),[t,r]);return(0,f.useMemo)((()=>({isReady:e&&a,user:t,base:r,merged:s,setUserConfig:n})),[s,t,r,n,e,a])}function Aa({children:e}){const t=Ma();return t.isReady?(0,l.createElement)(Ta.Provider,{value:t},e):null}const{useGlobalStyle:Na,useGlobalStylesOutput:Oa}=Ke(he.privateApis),Ra={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},Fa={hover:{opacity:1},start:{opacity:.5}},Da={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},Ba={leading:!0,trailing:!0},Va=({label:e,isFocused:t,withHoverView:n})=>{const[a]=Na("typography.fontWeight"),[r="serif"]=Na("typography.fontFamily"),[s=r]=Na("elements.h1.typography.fontFamily"),[i=a]=Na("elements.h1.typography.fontWeight"),[o="black"]=Na("color.text"),[c=o]=Na("elements.h1.color.text"),[u="white"]=Na("color.background"),[d]=Na("color.gradient"),[m]=Oa(),p=(0,se.useReducedMotion)(),[h,g]=(0,f.useState)(!1),[y,{width:v}]=(0,se.useResizeObserver)(),[b,E]=(0,f.useState)(v),[w,x]=(0,f.useState)(),S=(0,se.useThrottle)(E,250,Ba);(0,f.useLayoutEffect)((()=>{v&&S(v)}),[v,S]),(0,f.useLayoutEffect)((()=>{const e=b?b/248:1,t=e-(w||0);!(Math.abs(t)>.1)&&w||x(e)}),[b,w]);const C=w||(v?v/248:1),{paletteColors:k,highlightedColors:T}=Qe(),P=(0,f.useMemo)((()=>m?[...m,{css:"html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}",isGlobalStyles:!0}]:m),[m]),I=!!v;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{style:{position:"relative"}},y),I&&(0,l.createElement)(he.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",style:{width:"100%",height:152*C},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),tabIndex:-1},(0,l.createElement)(he.__unstableEditorStyles,{styles:P}),(0,l.createElement)(_.__unstableMotion.div,{style:{height:152*C,width:"100%",background:null!=d?d:u,cursor:n?"pointer":void 0},initial:"start",animate:(h||t)&&!p&&e?"hover":"start"},(0,l.createElement)(_.__unstableMotion.div,{variants:Ra,style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(_.__experimentalHStack,{spacing:10*C,justify:"center",style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(_.__unstableMotion.div,{style:{fontFamily:s,fontSize:65*C,color:c,fontWeight:i},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"}},"Aa"),(0,l.createElement)(_.__experimentalVStack,{spacing:4*C},T.map((({slug:e,color:t},n)=>(0,l.createElement)(_.__unstableMotion.div,{key:e,style:{height:32*C,width:32*C,background:t,borderRadius:32*C/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}})))))),(0,l.createElement)(_.__unstableMotion.div,{variants:n&&Fa,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1}},(0,l.createElement)(_.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"}},k.slice(0,4).map((({color:e},t)=>(0,l.createElement)("div",{key:t,style:{height:"100%",background:e,flexGrow:1}}))))),(0,l.createElement)(_.__unstableMotion.div,{variants:Da,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0}},(0,l.createElement)(_.__experimentalVStack,{spacing:3*C,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*C,boxSizing:"border-box"}},e&&(0,l.createElement)("div",{style:{fontSize:40*C,fontFamily:s,color:c,fontWeight:i,lineHeight:"1em",textAlign:"center"}},e))))))},{GlobalStylesContext:La,areGlobalStyleConfigsEqual:za}=Ke(he.privateApis);function Ga({variation:e}){const[t,n]=(0,f.useState)(!1),{base:a,user:r,setUserConfig:s}=(0,f.useContext)(La),i=(0,f.useMemo)((()=>{var t,n;return{user:{settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}},base:a,merged:Ia(a,e),setUserConfig:()=>{}}}),[e,a]),o=()=>{s((()=>({settings:e.settings,styles:e.styles})))},c=(0,f.useMemo)((()=>za(r,e)),[r,e]);let u=e?.title;return e?.description&&(u=(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),e?.title,e?.description)),(0,l.createElement)(La.Provider,{value:i},(0,l.createElement)("div",{className:v()("edit-site-global-styles-variations_item",{"is-active":c}),role:"button",onClick:o,onKeyDown:e=>{e.keyCode===wa.ENTER&&(e.preventDefault(),o())},tabIndex:"0","aria-label":u,"aria-current":c,onFocus:()=>n(!0),onBlur:()=>n(!1)},(0,l.createElement)("div",{className:"edit-site-global-styles-variations_item-preview"},(0,l.createElement)(Va,{label:e?.title,isFocused:t,withHoverView:!0}))))}function Ha(){const e=(0,d.useSelect)((e=>e(ge.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),t=(0,f.useMemo)((()=>[{title:(0,b.__)("Default"),settings:{},styles:{}},...(null!=e?e:[]).map((e=>{var t,n;return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}}}))]),[e]);return(0,l.createElement)(_.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container"},t.map(((e,t)=>(0,l.createElement)(Ga,{key:t,variation:e}))))}const Ua=20;function Wa({variation:e="default",direction:t,resizeWidthBy:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("button",{className:`resizable-editor__drag-handle is-${t} is-variation-${e}`,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:a}=e;"left"===t&&a===wa.LEFT||"right"===t&&a===wa.RIGHT?n(Ua):("left"===t&&a===wa.RIGHT||"right"===t&&a===wa.LEFT)&&n(-Ua)},type:"button"}),(0,l.createElement)(_.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,b.__)("Use left and right arrow keys to resize the canvas.")))}const ja={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};const Za=function({enableResizing:e,height:t,children:n}){const[a,r]=(0,f.useState)("100%"),s=(0,f.useRef)(),i=(0,f.useCallback)((e=>{s.current&&r(s.current.offsetWidth+e)}),[]);return(0,l.createElement)(_.ResizableBox,{ref:e=>{s.current=e?.resizable},size:{width:e?a:"100%",height:e&&t?t:"100%"},onResizeStop:(e,t,n)=>{r(n.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{left:e,right:e},showHandle:e,resizeRatio:2,handleComponent:{left:(0,l.createElement)(Wa,{direction:"left",resizeWidthBy:i}),right:(0,l.createElement)(Wa,{direction:"right",resizeWidthBy:i})},handleClasses:void 0,handleStyles:{left:ja,right:ja}},n)};function qa(e){switch(e){case"style-book":return(0,b.__)("Style Book");case"global-styles-revisions":case"global-styles-revisions:style-book":return(0,b.__)("Style Revisions");default:return""}}const{createPrivateSlotFill:Ya}=Ke(_.privateApis),{privateKey:Ka,Slot:Xa,Fill:Ja}=Ya("EditSiteEditorCanvasContainerSlot");function Qa({children:e,closeButtonLabel:t,onClose:n,enableResizing:a=!1}){const{editorCanvasContainerView:r,showListViewByDefault:s}=(0,d.useSelect)((e=>({editorCanvasContainerView:Ke(e(ta)).getEditorCanvasContainerView(),showListViewByDefault:e(k.store).get("core","showListViewByDefault")})),[]),[i,o]=(0,f.useState)(!1),{setEditorCanvasContainerView:c}=Ke((0,d.useDispatch)(ta)),{setIsListViewOpened:u}=(0,d.useDispatch)(g.store),m=(0,se.useFocusOnMount)("firstElement"),p=(0,se.useFocusReturn)(),h=(0,f.useMemo)((()=>qa(r)),[r]);function y(){u(s),c(void 0),o(!0),"function"==typeof n&&n()}const v=Array.isArray(e)?f.Children.map(e,((e,t)=>0===t?(0,f.cloneElement)(e,{ref:p}):e)):(0,f.cloneElement)(e,{ref:p});if(i)return null;const E=n||t;return(0,l.createElement)(Ja,null,(0,l.createElement)(Za,{enableResizing:a},(0,l.createElement)("section",{className:"edit-site-editor-canvas-container",ref:E?m:null,onKeyDown:function(e){e.keyCode!==wa.ESCAPE||e.defaultPrevented||(e.preventDefault(),y())},"aria-label":h},E&&(0,l.createElement)(_.Button,{className:"edit-site-editor-canvas-container__close-button",icon:T,label:t||(0,b.__)("Close"),onClick:y,showTooltip:!1}),v)))}Qa.Slot=Xa;const $a=Qa,{ExperimentalBlockEditorProvider:er,useGlobalStyle:tr,GlobalStylesContext:nr,useGlobalStylesOutputWithConfig:ar}=Ke(he.privateApis),{CompositeV2:rr,CompositeItemV2:sr,useCompositeStoreV2:ir,Tabs:or}=Ke(_.privateApis);function lr(e){return!e||0===Object.keys(e).length}function cr(){return[{name:"core/heading",title:(0,b.__)("Headings"),category:"text",blocks:[(0,c.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:1}),(0,c.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:2}),(0,c.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:3}),(0,c.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:4}),(0,c.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:5})]},...(0,c.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:a}=e;return"core/heading"!==t&&!!n&&!1!==a.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,c.getBlockFromExample)(e.name,e.example)})))]}const ur=({category:e,examples:t,isSelected:n,onClick:a,onSelect:r,settings:s,sizes:i,title:o})=>{const[c,u]=(0,f.useState)(!1),d={role:"button",onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!a||t!==wa.ENTER&&t!==wa.SPACE||(e.preventDefault(),a(e))},onClick:e=>{e.defaultPrevented||a&&(e.preventDefault(),a(e))},readonly:!0},m=a?"body { cursor: pointer; } body * { pointer-events: none; }":"";return(0,l.createElement)(he.__unstableIframe,{className:v()("edit-site-style-book__iframe",{"is-focused":c&&!!a,"is-button":!!a}),name:"style-book-canvas",tabIndex:0,...a?d:{}},(0,l.createElement)(he.__unstableEditorStyles,{styles:s.styles}),(0,l.createElement)("style",null,'.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n'+m),(0,l.createElement)(dr,{className:v()("edit-site-style-book__examples",{"is-wide":i.width>600}),examples:t,category:e,label:o?(0,b.sprintf)((0,b.__)("Examples of blocks in the %s category"),o):(0,b.__)("Examples of blocks"),isSelected:n,onSelect:r,key:e}))},dr=(0,f.memo)((({className:e,examples:t,category:n,label:a,isSelected:r,onSelect:s})=>{const i=ir({orientation:"vertical"});return(0,l.createElement)(rr,{store:i,className:e,"aria-label":a,role:"grid"},t.filter((e=>!n||e.category===n)).map((e=>(0,l.createElement)(mr,{key:e.name,id:`example-${e.name}`,title:e.title,blocks:e.blocks,isSelected:r(e.name),onClick:()=>{s?.(e.name)}}))))})),mr=({id:e,title:t,blocks:n,isSelected:a,onClick:r})=>{const s=(0,d.useSelect)((e=>e(he.store).getSettings()),[]),i=(0,f.useMemo)((()=>({...s,__unstableIsPreviewMode:!0})),[s]),o=(0,f.useMemo)((()=>Array.isArray(n)?n:[n]),[n]);return(0,l.createElement)("div",{role:"row"},(0,l.createElement)("div",{role:"gridcell"},(0,l.createElement)(sr,{className:v()("edit-site-style-book__example",{"is-selected":a}),id:e,"aria-label":(0,b.sprintf)((0,b.__)("Open %s styles in Styles panel"),t),render:(0,l.createElement)("div",null),role:"button",onClick:r},(0,l.createElement)("span",{className:"edit-site-style-book__example-title"},t),(0,l.createElement)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0},(0,l.createElement)(_.Disabled,{className:"edit-site-style-book__example-preview__content"},(0,l.createElement)(er,{value:o,settings:i},(0,l.createElement)(he.BlockList,{renderAppender:!1})))))))},pr=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:a,showCloseButton:r=!0,onClose:s,showTabs:i=!0,userConfig:o={}}){const[u,m]=(0,se.useResizeObserver)(),[p]=tr("color.text"),[h]=tr("color.background"),g=(0,f.useMemo)(cr,[]),y=(0,f.useMemo)((()=>(0,c.getCategories)().filter((e=>g.some((t=>t.category===e.slug)))).map((e=>({name:e.slug,title:e.title,icon:e.icon})))),[g]),{base:_}=(0,f.useContext)(nr),E=(0,f.useMemo)((()=>lr(o)||lr(_)?{}:Ia(_,o)),[_,o]),w=(0,d.useSelect)((e=>e(he.store).getSettings()),[]),x=(0,f.useMemo)((()=>({...w,__unstableIsPreviewMode:!0})),[w]),[S]=ar(E);return x.styles=lr(S)||lr(o)?x.styles:S,(0,l.createElement)($a,{onClose:s,enableResizing:e,closeButtonLabel:r?(0,b.__)("Close Style Book"):null},(0,l.createElement)("div",{className:v()("edit-site-style-book",{"is-wide":m.width>600,"is-button":!!n}),style:{color:p,background:h}},u,i?(0,l.createElement)("div",{className:"edit-site-style-book__tabs"},(0,l.createElement)(or,null,(0,l.createElement)(or.TabList,null,y.map((e=>(0,l.createElement)(or.Tab,{tabId:e.name,key:e.name},e.title)))),y.map((e=>(0,l.createElement)(or.TabPanel,{key:e.name,tabId:e.name,focusable:!1},(0,l.createElement)(ur,{category:e.name,examples:g,isSelected:t,onSelect:a,settings:x,sizes:m,title:e.title})))))):(0,l.createElement)(ur,{examples:g,isSelected:t,onClick:n,onSelect:a,settings:x,sizes:m})))},hr={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},fr={per_page:100,page:1},gr=[],{GlobalStylesContext:yr}=Ke(he.privateApis);function vr({query:e}={}){const{user:t}=(0,f.useContext)(yr),n={...fr,...e},{authors:a,currentUser:r,isDirty:s,revisions:i,isLoadingGlobalStylesRevisions:o,revisionsCount:l}=(0,d.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:a,getCurrentUser:r,getUsers:s,getRevisions:i,__experimentalGetCurrentGlobalStylesId:o,getEntityRecord:l,isResolving:c}=e(ge.store),u=a(),d=r(),m=u.length>0,p=o(),h=p?l("root","globalStyles",p):void 0,f=null!==(t=h?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=i("root","globalStyles",p,n)||gr;return{authors:s(hr)||gr,currentUser:d,isDirty:m,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,n]),revisionsCount:f}}),[e]);return(0,f.useMemo)((()=>{if(!a.length||o)return{revisions:gr,hasUnsavedChanges:s,isLoading:!0,revisionsCount:l};const e=i.map((e=>({...e,author:a.find((t=>t.id===e.author))})));if(i.length){if("unsaved"!==e[0].id&&1===n.page&&(e[0].isLatest=!0),s&&t&&Object.keys(t).length>0&&r&&1===n.page){const n={id:"unsaved",styles:t?.styles,settings:t?.settings,author:{name:r?.name,avatar_urls:r?.avatar_urls},modified:new Date};e.unshift(n)}n.page===Math.ceil(l/n.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:s,isLoading:!1,revisionsCount:l}}),[s,i,r,a,t,o])}const _r=window.wp.date,br=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"}));function Er({children:e}){return(0,l.createElement)(_.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__label"},e)}function wr({label:e,children:t,className:n,...a}){return(0,l.createElement)(_.__experimentalHStack,{key:e,spacing:5,alignment:"left",className:v()("edit-site-sidebar-navigation-details-screen-panel__row",n),...a},t)}function xr({children:e}){return(0,l.createElement)(_.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__value"},e)}function Sr({title:e,children:t,spacing:n}){return(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-sidebar-navigation-details-screen-panel",spacing:n},e&&(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-sidebar-navigation-details-screen-panel__heading",level:2},e),t)}function Cr({record:e,...t}){const n={};return e?._links?.["predecessor-version"]?.[0]?.id&&(n.href=(0,gt.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),n.as="a"),(0,l.createElement)(_.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-details-footer"},(0,l.createElement)(va,{"aria-label":(0,b.__)("Revisions"),...n,...t},(0,l.createElement)(wr,{justify:"space-between"},(0,l.createElement)(Er,null,(0,b.__)("Last modified")),(0,l.createElement)(xr,null,(0,f.createInterpolateElement)((0,b.sprintf)((0,b.__)(""),(0,_r.humanTimeDiff)(e.modified)),{time:(0,l.createElement)("time",{dateTime:e.modified})})),(0,l.createElement)(_.Icon,{className:"edit-site-sidebar-navigation-screen-details-footer__icon",icon:br}))))}const kr=()=>{};function Tr(e){const{openGeneralSidebar:t}=(0,d.useDispatch)(ta),{setCanvasMode:n}=Ke((0,d.useDispatch)(ta));return(0,d.useSelect)((e=>!!e(ge.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length),[])?(0,l.createElement)(_.__experimentalNavigatorButton,{...e,as:va,path:"/wp_global_styles"}):(0,l.createElement)(va,{...e,onClick:()=>{n("edit"),t("edit-site/global-styles")}})}function Pr(){const{storedSettings:e}=(0,d.useSelect)((e=>{const{getSettings:t}=Ke(e(ta));return{storedSettings:t()}}),[]);return(0,l.createElement)(he.BlockEditorProvider,{settings:e,onChange:kr,onInput:kr},(0,l.createElement)(Ha,null))}function Ir(){const{revisions:e,isLoading:t}=vr(),{openGeneralSidebar:n}=(0,d.useDispatch)(ta),{setIsListViewOpened:a}=(0,d.useDispatch)(g.store),r=(0,se.useViewportMatch)("medium","<"),{setCanvasMode:s,setEditorCanvasContainerView:i}=Ke((0,d.useDispatch)(ta)),{isViewMode:o,isStyleBookOpened:c,revisionsCount:u}=(0,d.useSelect)((e=>{var t;const{getCanvasMode:n,getEditorCanvasContainerView:a}=Ke(e(ta)),{getEntityRecord:r,__experimentalGetCurrentGlobalStylesId:s}=e(ge.store),i=s(),o=i?r("root","globalStyles",i):void 0;return{isViewMode:"view"===n(),isStyleBookOpened:"style-book"===a(),revisionsCount:null!==(t=o?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),m=(0,f.useCallback)((async()=>Promise.all([s("edit"),n("edit-site/global-styles")])),[s,n]),p=(0,f.useCallback)((async()=>{await m(),i("style-book"),a(!1)}),[m,i,a]),h=(0,f.useCallback)((async()=>{await m(),i("global-styles-revisions")}),[m,i]),y=u>0,v=e?.[0]?.modified,_=y&&!t&&v;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ha,{title:(0,b.__)("Styles"),description:(0,b.__)("Choose a different style combination for the theme styles."),content:(0,l.createElement)(Pr,null),footer:_&&(0,l.createElement)(Cr,{record:e?.[0],onClick:h}),actions:(0,l.createElement)(l.Fragment,null,!r&&(0,l.createElement)(ma,{icon:_a,label:(0,b.__)("Style Book"),onClick:()=>i(c?void 0:"style-book"),isPressed:c}),(0,l.createElement)(ma,{icon:Ea,label:(0,b.__)("Edit styles"),onClick:async()=>await m()}))}),c&&!r&&o&&(0,l.createElement)(pr,{enableResizing:!1,isSelected:()=>!1,onClick:p,onSelect:p,showCloseButton:!1,showTabs:!1}))}const Mr="isTemplatePartMoveHintVisible";function Ar(){const e=(0,d.useSelect)((e=>{var t;return null===(t=e(k.store).get("core",Mr))||void 0===t||t}),[]),{set:t}=(0,d.useDispatch)(k.store);return e?(0,l.createElement)(_.Notice,{politeness:"polite",className:"edit-site-sidebar__notice",onRemove:()=>{t("core",Mr,!1)}},(0,b.__)('Looking for template parts? Find them in "Patterns".')):null}function Nr(){const{location:e}=(0,_.__experimentalUseNavigator)(),{setEditorCanvasContainerView:t}=Ke((0,d.useDispatch)(ta));return(0,f.useEffect)((()=>{"/"===e?.path&&t(void 0)}),[t,e?.path]),(0,l.createElement)(ha,{isRoot:!0,title:(0,b.__)("Design"),description:(0,b.__)("Customize the appearance of your website using the block editor."),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(_.__experimentalNavigatorButton,{as:va,path:"/navigation",withChevron:!0,icon:sa},(0,b.__)("Navigation")),(0,l.createElement)(Tr,{withChevron:!0,icon:ia},(0,b.__)("Styles")),(0,l.createElement)(_.__experimentalNavigatorButton,{as:va,path:"/page",withChevron:!0,icon:oa},(0,b.__)("Pages")),(0,l.createElement)(_.__experimentalNavigatorButton,{as:va,path:"/wp_template",withChevron:!0,icon:la},(0,b.__)("Templates")),(0,l.createElement)(_.__experimentalNavigatorButton,{as:va,path:"/patterns",withChevron:!0,icon:ca},(0,b.__)("Patterns"))),(0,l.createElement)(Ar,null))})}const Or=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})),Rr=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})),Fr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})),Dr=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"})),Br=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})),Vr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"})),Lr=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),zr=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})),Gr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})),Hr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",d:"M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",clipRule:"evenodd"})),Ur=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})),Wr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})),jr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})),Zr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),qr=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"})),Yr=(e,t)=>{let n=e;return t.split(".").forEach((e=>{n=n?.[e]})),n},Kr=(e,t)=>(e||[]).map((e=>({...e,name:(0,en.decodeEntities)(Yr(e,t))}))),Xr=()=>(0,d.useSelect)((e=>e(ge.store).getEntityRecords("postType",Ct,{per_page:-1})),[]),Jr=()=>(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplateTypes()),[]),Qr=()=>{const e=(0,d.useSelect)((e=>e(ge.store).getPostTypes({per_page:-1})),[]);return(0,f.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n)))}),[e])};function $r(e){const t=(0,f.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})));return(0,f.useCallback)((({labels:e,slug:n})=>{const a=e.singular_name.toLowerCase();return t[a]>1&&a!==n}),[t])}function es(){const e=Qr(),t=(0,f.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=Xr(),a=$r(t);return(0,f.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=a(e)?(0,b.sprintf)((0,b.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,b.sprintf)((0,b.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,b.sprintf)((0,b.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:e.icon?.startsWith("dashicons-")?e.icon.slice(10):Dr,templatePrefix:"archive"}}))||[]),[t,n,a])}const ts=e=>{const t=Qr(),n=Xr(),a=Jr(),r=$r(t),s=(0,f.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),i=is("postType",s),o=(n||[]).map((({slug:e})=>e)),l=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c,icon:u}=n,d=s[l],m=a?.find((({slug:e})=>e===d)),p=o?.includes(d),h=r(n);let f=(0,b.sprintf)((0,b.__)("Single item: %s"),c.singular_name);h&&(f=(0,b.sprintf)((0,b.__)("Single item: %1$s (%2$s)"),c.singular_name,l));const g=m?{...m,templatePrefix:s[l]}:{slug:d,title:f,description:(0,b.sprintf)((0,b.__)("Displays a single item: %s."),c.singular_name),icon:u?.startsWith("dashicons-")?u.slice(10):qr,templatePrefix:s[l]},y=i?.[l]?.hasEntities;return y&&(g.onClick=t=>{e({type:"postType",slug:l,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${s[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:s[l]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!y||t.push(g),t}),[]),c=(0,f.useMemo)((()=>l.reduce(((e,t)=>{const{slug:n}=t;let a="postTypesMenuItems";return"page"===n&&(a="defaultPostTypesMenuItems"),e[a].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[l]);return c},ns=e=>{const t=(()=>{const e=(0,d.useSelect)((e=>e(ge.store).getTaxonomies({per_page:-1})),[]);return(0,f.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=Xr(),a=Jr(),r=(0,f.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return["category","post_tag"].includes(t)||(n=`taxonomy-${n}`),"post_tag"===t&&(n="tag"),e[t]=n,e}),{})),[t]),s=t?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),i=is("taxonomy",r),o=(n||[]).map((({slug:e})=>e)),l=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=r[l],d=a?.find((({slug:e})=>e===u)),m=o?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=e.singular_name.toLowerCase();return s[n]>1&&n!==t})(c,l);let h=c.singular_name;p&&(h=(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.singular_name,l));const f=d?{...d,templatePrefix:r[l]}:{slug:u,title:h,description:(0,b.sprintf)((0,b.__)("Displays taxonomy: %s."),c.singular_name),icon:Hr,templatePrefix:r[l]},g=i?.[l]?.hasEntities;return g&&(f.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${r[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:r[l]}}},labels:c,hasGeneralTemplate:m,template:t})}),m&&!g||t.push(f),t}),[]);return(0,f.useMemo)((()=>l.reduce(((e,t)=>{const{slug:n}=t;let a="taxonomiesMenuItems";return["category","tag"].includes(n)&&(a="defaultTaxonomiesMenuItems"),e[a].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[l])},as={user:"author"},rs={user:{who:"authors"}};const ss=(e,t,n={})=>{const a=(e=>{const t=Xr();return(0,f.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,a])=>{const r=(t||[]).reduce(((e,t)=>{const n=`${a}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return r.length&&(e[n]=r),e}),{})),[e,t])})(t);return(0,d.useSelect)((t=>Object.entries(a||{}).reduce(((a,[r,s])=>{const i=t(ge.store).getEntityRecords(e,r,{_fields:"id",context:"view",slug:s,...n[r]});return i?.length&&(a[r]=i),a}),{})),[a])},is=(e,t,n={})=>{const a=ss(e,t,n);return(0,d.useSelect)((r=>Object.keys(t||{}).reduce(((t,s)=>{const i=a?.[s]?.map((({id:e})=>e))||[];return t[s]={hasEntities:!!r(ge.store).getEntityRecords(e,s,{per_page:1,_fields:"id",context:"view",exclude:i,...n[s]})?.length,existingEntitiesIds:i},t}),{})),[t,a])},{CompositeV2:os,CompositeItemV2:ls,useCompositeStoreV2:cs}=Ke(_.privateApis),us=[];function ds({suggestion:e,search:t,onSelect:n,entityForSuggestions:a}){const r="edit-site-custom-template-modal__suggestions_list__list-item";return(0,l.createElement)(ls,{render:(0,l.createElement)(_.Button,{role:"option",className:r,onClick:()=>n(a.config.getSpecificTemplate(e))})},(0,l.createElement)(_.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${r}__title`},(0,l.createElement)(_.TextHighlight,{text:(0,en.decodeEntities)(e.name),highlight:t})),e.link&&(0,l.createElement)(_.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${r}__info`},e.link))}function ms({entityForSuggestions:e,onSelect:t}){const n=cs({orientation:"vertical"}),[a,r,s]=(0,se.useDebouncedInput)(),i=function(e,t){const{config:n}=e,a=(0,f.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:r,hasResolved:s}=(0,ge.useEntityRecords)(e.type,e.slug,a),[i,o]=(0,f.useState)(us);return(0,f.useEffect)((()=>{if(!s)return;let e=us;r?.length&&(e=r,n.recordNamePath&&(e=Kr(e,n.recordNamePath))),o(e)}),[r,s]),i}(e,s),{labels:o}=e,[c,u]=(0,f.useState)(!1);return!c&&i?.length>9&&u(!0),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(_.SearchControl,{__nextHasNoMarginBottom:!0,onChange:r,value:a,label:o.search_items,placeholder:o.search_items}),!!i?.length&&(0,l.createElement)(os,{store:n,role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,b.__)("Suggestions list")},i.map((n=>(0,l.createElement)(ds,{key:n.slug,suggestion:n,search:s,onSelect:t,entityForSuggestions:e})))),s&&!i?.length&&(0,l.createElement)(_.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results"},o.not_found))}const ps=function({onSelect:e,entityForSuggestions:t}){const[n,a]=(0,f.useState)(t.hasGeneralTemplate);return(0,l.createElement)(_.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left"},!n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalText,{as:"p"},(0,b.__)("Select whether to create a single template for all items or a specific one.")),(0,l.createElement)(_.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial"},(0,l.createElement)(_.FlexItem,{isBlock:!0,as:_.Button,onClick:()=>{const{slug:n,title:a,description:r,templatePrefix:s}=t.template;e({slug:n,title:a,description:r,templatePrefix:s})}},(0,l.createElement)(_.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.all_items),(0,l.createElement)(_.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,b.__)("For all items"))),(0,l.createElement)(_.FlexItem,{isBlock:!0,as:_.Button,onClick:()=>{a(!0)}},(0,l.createElement)(_.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.singular_name),(0,l.createElement)(_.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,b.__)("For a specific item"))))),n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalText,{as:"p"},(0,b.__)("This template will be used only for the specific item chosen.")),(0,l.createElement)(ms,{entityForSuggestions:t,onSelect:e})))};var hs=function(){return hs=Object.assign||function(e){for(var t,n=1,a=arguments.length;n{e()}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit",isBusy:s,"aria-disabled":s},(0,b.__)("Create")))))};function ws(){const e="edit-site-template-actions-loading-screen-modal";return(0,l.createElement)(_.Modal,{isFullScreen:!0,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:()=>{},__experimentalHideHeader:!0,className:e},(0,l.createElement)("div",{className:`${e}__content`},(0,l.createElement)(_.Spinner,null)))}const{useHistory:xs}=Ke(ft.privateApis),Ss=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],Cs={"front-page":Or,home:Rr,single:Fr,page:oa,archive:Dr,search:Br,404:Vr,index:Lr,category:zr,author:Gr,taxonomy:Hr,date:Ur,tag:Wr,attachment:jr};function ks({title:e,direction:t,className:n,description:a,icon:r,onClick:s,children:i}){return(0,l.createElement)(_.Button,{className:n,onClick:s,label:a,showTooltip:!!a},(0,l.createElement)(_.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t},(0,l.createElement)("div",{className:"edit-site-add-new-template__template-icon"},(0,l.createElement)(_.Icon,{icon:r})),(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0},(0,l.createElement)(_.__experimentalText,{weight:500,lineHeight:1.53846153846},e),i)))}const Ts={templatesList:1,customTemplate:2,customGenericTemplate:3};function Ps({postType:e,toggleProps:t,showIcon:n=!0}){const[a,r]=(0,f.useState)(!1),[s,i]=(0,f.useState)(Ts.templatesList),[o,c]=(0,f.useState)({}),[u,m]=(0,f.useState)(!1),p=xs(),{saveEntityRecord:h}=(0,d.useDispatch)(ge.store),{createErrorNotice:g,createSuccessNotice:y}=(0,d.useDispatch)(fe.store),{homeUrl:E}=(0,d.useSelect)((e=>{const{getUnstableBase:t}=e(ge.store);return{homeUrl:t()?.home}}),[]),w={"front-page":E,date:(0,b.sprintf)((0,b.__)("E.g. %s"),E+"/"+(new Date).getFullYear())};async function x(e,t=!0){if(!u){m(!0);try{const{title:n,description:a,slug:r}=e,s=await h("postType",Ct,{description:a,slug:r.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});p.push({postId:s.id,postType:s.type,canvas:"edit"}),y((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,en.decodeEntities)(s.title?.rendered||n)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the template.");g(t,{type:"snackbar"})}finally{m(!1)}}}const S=()=>{r(!1),i(Ts.templatesList)},C=function(e,t){const n=Xr(),a=Jr(),r=(n||[]).map((({slug:e})=>e)),s=(a||[]).filter((e=>Ss.includes(e.slug)&&!r.includes(e.slug))),i=n=>{t?.(),e(n)},o=[...s],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=ns(i),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=ts(i),m=function(e){const t=Xr(),n=Jr(),a=is("root",as,rs);let r=n?.find((({slug:e})=>"author"===e));r||(r={description:(0,b.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const s=!!t?.find((({slug:e})=>"author"===e));if(a.user?.hasEntities&&(r={...r,templatePrefix:"author"},r.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:a.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,b.__)("Author"),search_items:(0,b.__)("Search Authors"),not_found:(0,b.__)("No authors found."),all_items:(0,b.__)("All Authors")},hasGeneralTemplate:s,template:t})}),!s||a.user?.hasEntities)return r}(i);[...l,...u,m].forEach((e=>{if(!e)return;const t=o.findIndex((t=>t.slug===e.slug));t>-1?o[t]=e:o.push(e)})),o?.sort(((e,t)=>Ss.indexOf(e.slug)-Ss.indexOf(t.slug)));const p=[...o,...es(),...d,...c];return p}(c,(()=>i(Ts.customTemplate)));if(!C.length)return null;const{as:k=_.Button,...T}=null!=t?t:{};let P=(0,b.__)("Add template");return s===Ts.customTemplate?P=(0,b.sprintf)((0,b.__)("Add template: %s"),o.labels.singular_name):s===Ts.customGenericTemplate&&(P=(0,b.__)("Create custom template")),(0,l.createElement)(l.Fragment,null,u&&(0,l.createElement)(ws,null),(0,l.createElement)(k,{...T,onClick:()=>r(!0),icon:n?Zr:null,label:e.labels.add_new_item},n?null:e.labels.add_new_item),a&&(0,l.createElement)(_.Modal,{title:P,className:v()("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":s===Ts.templatesList,"edit-site-custom-template-modal":s===Ts.customTemplate}),onRequestClose:S,overlayClassName:s===Ts.customGenericTemplate?"edit-site-custom-generic-template__modal":void 0},s===Ts.templatesList&&(0,l.createElement)(_.__experimentalGrid,{columns:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents"},(0,l.createElement)(_.Flex,{className:"edit-site-add-new-template__template-list__prompt"},(0,b.__)("Select what the new template should apply to:")),C.map((e=>{const{title:t,slug:n,onClick:a}=e;return(0,l.createElement)(ks,{key:n,title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:w[n],icon:Cs[n]||la,onClick:()=>a?a(e):x(e)})})),(0,l.createElement)(ks,{title:(0,b.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:Ea,onClick:()=>i(Ts.customGenericTemplate)},(0,l.createElement)(_.__experimentalText,{lineHeight:1.53846153846},(0,b.__)("A custom template can be manually applied to any post or page.")))),s===Ts.customTemplate&&(0,l.createElement)(ps,{onSelect:x,entityForSuggestions:o}),s===Ts.customGenericTemplate&&(0,l.createElement)(Es,{onClose:S,createTemplate:x})))}function Is({templateType:e=Ct,...t}){const n=(0,d.useSelect)((t=>t(ge.store).getPostType(e)),[e]);return n&&e===Ct?(0,l.createElement)(Ps,{...t,postType:n}):null}const Ms=({postType:e,postId:t,...n})=>{const a=Et({postType:e,postId:t});return(0,l.createElement)(va,{...a,...n})};function As(){const e=(0,se.useViewportMatch)("medium","<"),{records:t,isResolving:n}=(0,ge.useEntityRecords)("postType",Ct,{per_page:-1}),a=Et({path:"/wp_template/all"}),r=!e;return(0,l.createElement)(ha,{title:(0,b.__)("Templates"),description:(0,b.__)("Express the layout of your site with templates."),actions:r&&(0,l.createElement)(Is,{templateType:Ct,toggleProps:{as:ma}}),content:(0,l.createElement)(l.Fragment,null,n&&(0,b.__)("Loading templates…"),!n&&(0,l.createElement)(Os,{templates:t})),footer:!e&&(0,l.createElement)(va,{withChevron:!0,...a},(0,b.__)("Manage all templates"))})}function Ns({title:e,templates:t}){return(0,l.createElement)(_.__experimentalItemGroup,null,!!e&&(0,l.createElement)(_.__experimentalItem,{className:"edit-site-sidebar-navigation-screen-templates__templates-group-title"},e),t.map((e=>(0,l.createElement)(Ms,{postType:Ct,postId:e.id,key:e.id,withChevron:!0},(0,en.decodeEntities)(e.title?.rendered||e.slug)))))}function Os({templates:e}){if(!e?.length)return(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(_.__experimentalItem,null,(0,b.__)("No templates found")));const t=e?[...e]:[];t.sort(((e,t)=>e.title.rendered.localeCompare(t.title.rendered)));const{hierarchyTemplates:n,customTemplates:a,...r}=t.reduce(((e,t)=>{const{original_source:n,author_text:a}=t;return"plugin"===n?(e[a]||(e[a]=[]),e[a].push(t)):t.is_custom?e.customTemplates.push(t):e.hierarchyTemplates.push(t),e}),{hierarchyTemplates:[],customTemplates:[]});return(0,l.createElement)(_.__experimentalVStack,{spacing:3},!!n.length&&(0,l.createElement)(Ns,{templates:n}),!!a.length&&(0,l.createElement)(Ns,{title:(0,b.__)("Custom"),templates:a}),Object.entries(r).map((([e,t])=>(0,l.createElement)(Ns,{key:e,title:e,templates:t}))))}function Rs({postId:e,area:t,title:n}){const a=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas().find((e=>e.area===t))),[t]),r=Et({postType:kt,postId:e});return(0,l.createElement)(va,{className:"edit-site-sidebar-navigation-screen-template__template-area-button",...r,icon:a?.icon,withChevron:!0},(0,l.createElement)(_.__experimentalTruncate,{limit:20,ellipsizeMode:"tail",numberOfLines:1,className:"edit-site-sidebar-navigation-screen-template__template-area-label-text"},(0,en.decodeEntities)(n)))}function Fs(){const{templatePartAreas:e,currentTemplateParts:t}=(0,d.useSelect)((e=>{const{getSettings:t,getCurrentTemplateTemplateParts:n}=Ke(e(ta));return{templatePartAreas:t()?.defaultTemplatePartAreas,currentTemplateParts:n()}}),[]),n=(0,f.useMemo)((()=>{const n=new Set;return t.length&&e?t.filter((e=>{if(!n.has(e.templatePart.id))return n.add(e.templatePart.id),e})).map((({templatePart:t,block:n})=>({...e?.find((({area:e})=>e===t?.area)),...t,clientId:n.clientId}))):[]}),[t,e]);return n.length?(0,l.createElement)(Sr,{title:(0,b.__)("Areas"),spacing:3},(0,l.createElement)(_.__experimentalItemGroup,null,n.map((({clientId:e,label:t,area:n,theme:a,slug:r,title:s})=>(0,l.createElement)(wr,{key:e},(0,l.createElement)(Rs,{postId:`${a}//${r}`,title:s?.rendered||t,area:n})))))):null}function Ds(e,t){const{record:n,title:a,description:r,isLoaded:s,icon:i}=(0,d.useSelect)((n=>{const{getEditedPostType:a,getEditedPostId:r}=n(ta),{getEditedEntityRecord:s,hasFinishedResolution:i}=n(ge.store),{__experimentalGetTemplateInfo:o}=n(g.store),l=null!=e?e:a(),c=null!=t?t:r(),u=s("postType",l,c),d=c&&i("getEditedEntityRecord",["postType",l,c]),m=o(u);return{record:u,title:m.title,description:m.description,isLoaded:d,icon:m.icon}}),[e,t]);return{isLoaded:s,icon:i,record:n,getTitle:()=>a?(0,en.decodeEntities)(a):null,getDescription:()=>r?(0,en.decodeEntities)(r):null}}const Bs=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"})),Vs=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"}));function Ls(e,t){return(0,d.useSelect)((n=>{const{getEntityRecord:a,getMedia:r,getUser:s,getEditedEntityRecord:i}=n(ge.store),o=i("postType",e,t),l=o?.original_source,c=o?.author_text;switch(l){case"theme":return{type:l,icon:la,text:c,isCustomized:o.source===Tt.custom};case"plugin":return{type:l,icon:Bs,text:c,isCustomized:o.source===Tt.custom};case"site":{const e=a("root","__unstableBase");return{type:l,icon:Vs,imageUrl:e?.site_logo?r(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=s(o.author);return{type:"user",icon:Gr,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}function zs({imageUrl:e}){const[t,n]=(0,f.useState)(!1);return(0,l.createElement)("div",{className:v()("edit-site-list-added-by__avatar",{"is-loaded":t})},(0,l.createElement)("img",{onLoad:()=>n(!0),alt:"",src:e}))}function Gs(e){return!!e&&(e.source===Tt.custom&&!e.has_theme_file)}function Hs({template:e,onClose:t}){const n=(0,en.decodeEntities)(e.title.rendered),[a,r]=(0,f.useState)(n),[s,i]=(0,f.useState)(!1),{editEntityRecord:o,__experimentalSaveSpecifiedEntityEdits:c}=(0,d.useDispatch)(ge.store),{createSuccessNotice:u,createErrorNotice:m}=(0,d.useDispatch)(fe.store);if(e.type===Ct&&!e.is_custom)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{onClick:()=>{i(!0),r(n)}},(0,b.__)("Rename")),s&&(0,l.createElement)(_.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>{i(!1)},overlayClassName:"edit-site-list__rename-modal"},(0,l.createElement)("form",{onSubmit:async function(n){n.preventDefault();try{await o("postType",e.type,e.id,{title:a}),r(""),i(!1),t(),await c("postType",e.type,e.id,["title"],{throwOnError:!0}),u(e.type===Ct?(0,b.__)("Template renamed."):(0,b.__)("Template part renamed."),{type:"snackbar"})}catch(t){const n=e.type===Ct?(0,b.__)("An error occurred while renaming the template."):(0,b.__)("An error occurred while renaming the template part."),a=t.message&&"unknown_error"!==t.code?t.message:n;m(a,{type:"snackbar"})}}},(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Name"),value:a,onChange:r,required:!0}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{i(!1)}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,b.__)("Save")))))))}function Us({postType:e,postId:t,className:n,toggleProps:a,onRemove:r}){const s=(0,d.useSelect)((n=>n(ge.store).getEntityRecord("postType",e,t)),[e,t]),{removeTemplate:i,revertTemplate:o}=(0,d.useDispatch)(ta),{saveEditedEntityRecord:c}=(0,d.useDispatch)(ge.store),{createSuccessNotice:u,createErrorNotice:m}=(0,d.useDispatch)(fe.store),p=Gs(s),h=$t(s);if(!p&&!h)return null;return(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Actions"),className:n,toggleProps:a},(({onClose:e})=>(0,l.createElement)(_.MenuGroup,null,p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Hs,{template:s,onClose:e}),(0,l.createElement)(Ws,{onRemove:()=>{i(s),r?.(),e()},title:s.title.rendered})),h&&(0,l.createElement)(_.MenuItem,{info:(0,b.__)("Use the template as supplied by the theme."),onClick:()=>{!async function(){try{await o(s,{allowUndo:!1}),await c("postType",s.type,s.id),u((0,b.sprintf)((0,b.__)('"%s" reverted.'),(0,en.decodeEntities)(s.title.rendered)),{type:"snackbar",id:"edit-site-template-reverted"})}catch(e){const t=s.type===Ct?(0,b.__)("An error occurred while reverting the template."):(0,b.__)("An error occurred while reverting the template part."),n=e.message&&"unknown_error"!==e.code?e.message:t;m(n,{type:"snackbar"})}}(),e()}},(0,b.__)("Clear customizations")))))}function Ws({onRemove:e,title:t}){const[n,a]=(0,f.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{isDestructive:!0,onClick:()=>a(!0)},(0,b.__)("Delete")),(0,l.createElement)(_.__experimentalConfirmDialog,{isOpen:n,onConfirm:e,onCancel:()=>a(!1),confirmButtonText:(0,b.__)("Delete")},(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(t))))}const js={};function Zs(){const{editEntityRecord:e}=(0,d.useDispatch)(ge.store),{allowCommentsOnNewPosts:t,postsPerPage:n,postsPageTitle:a,postsPageId:r}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(ge.store),n=t("root","site"),a=n?.page_for_posts?t("postType","page",n?.page_for_posts):js;return{allowCommentsOnNewPosts:"open"===n?.default_comment_status,postsPageTitle:a?.title?.rendered,postsPageId:a?.id,postsPerPage:n?.posts_per_page}}),[]),[s,i]=(0,f.useState)(""),[o,c]=(0,f.useState)(1),[u,m]=(0,f.useState)("");(0,f.useEffect)((()=>{i(t),m(a),c(n)}),[a,t,n]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Sr,{spacing:6},r&&(0,l.createElement)(wr,null,(0,l.createElement)(_.__experimentalInputControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:(0,b.__)("No Title"),size:"__unstable-large",value:u,onChange:(0,se.debounce)((t=>{m(t),e("postType","page",r,{title:t})}),300),label:(0,b.__)("Blog title"),help:(0,b.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media.")})),(0,l.createElement)(wr,null,(0,l.createElement)(_.__experimentalNumberControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:0,value:o,size:"__unstable-large",spinControls:"custom",step:"1",min:"1",onChange:t=>{c(t),e("root","site",void 0,{posts_per_page:t})},label:(0,b.__)("Posts per page"),help:(0,b.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.")}))),(0,l.createElement)(Sr,{title:(0,b.__)("Discussion"),spacing:3},(0,l.createElement)(wr,null,(0,l.createElement)(_.CheckboxControl,{className:"edit-site-sidebar-navigation-screen__input-control",label:(0,b.__)("Allow comments on new posts"),help:(0,b.__)("Changes will apply to new posts only. Individual posts may override these settings."),checked:s,onChange:t=>{i(t),e("root","site",void 0,{default_comment_status:t?"open":null})}}))))}function qs(){const e=(0,_.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{setCanvasMode:a}=Ke((0,d.useDispatch)(ta)),{title:r,content:s,description:i,footer:o}=function(e,t){const{getDescription:n,getTitle:a,record:r}=Ds(e,t),s=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme()),[]),i=Ls(e,t),o="theme"===i.type&&r.theme===s?.stylesheet,c=a();let u=n();!u&&i.text&&(u=(0,b.__)("This is a custom template that can be applied manually to any Post or Page."));const m="home"===r?.slug||"index"===r?.slug?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Zs,null),(0,l.createElement)(Fs,null)):(0,l.createElement)(Fs,null),p=r?.modified?(0,l.createElement)(Cr,{record:r}):null;return{title:c,description:(0,l.createElement)(l.Fragment,null,u,i.text&&!o&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"},i.imageUrl?(0,l.createElement)("img",{src:i.imageUrl,alt:"",width:"24",height:"24"}):(0,l.createElement)(_.Icon,{icon:i.icon})),i.text),i.isCustomized&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-customized"},(0,b._x)("(Customized)","template")))),content:m,footer:p}}(t,n);return(0,l.createElement)(ha,{title:r,actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Us,{postType:t,postId:n,toggleProps:{as:ma},onRemove:()=>{e.goTo(`/${t}/all`)}}),(0,l.createElement)(ma,{onClick:()=>a("edit"),label:(0,b.__)("Edit"),icon:ba})),description:i,content:s,footer:o})}const Ys=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})),Ks=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})),Xs=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})),Js=()=>(0,d.useSelect)((e=>e(ge.store).getEntityRecords("postType",kt,{per_page:-1})),[]),Qs=(e,t)=>{const n=e.toLowerCase(),a=t.map((e=>e.title.rendered.toLowerCase()));if(!a.includes(n))return e;let r=2;for(;a.includes(`${n} ${r}`);)r++;return`${e} ${r}`},$s=e=>bs(e).replace(/[^\w-]+/g,"")||"wp-custom-part";function ei({modalTitle:e=(0,b.__)("Create template part"),...t}){return(0,l.createElement)(_.Modal,{title:e,onRequestClose:t.closeModal,overlayClassName:"edit-site-create-template-part-modal"},(0,l.createElement)(ti,{...t}))}function ti({defaultArea:e=Pt,blocks:t=[],confirmLabel:n=(0,b.__)("Create"),closeModal:a,onCreate:r,onError:s,defaultTitle:i=""}){const{createErrorNotice:o}=(0,d.useDispatch)(fe.store),{saveEntityRecord:u}=(0,d.useDispatch)(ge.store),m=Js(),[p,h]=(0,f.useState)(i),[y,v]=(0,f.useState)(e),[E,x]=(0,f.useState)(!1),S=(0,se.useInstanceId)(ei),C=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]);return(0,l.createElement)("form",{onSubmit:async e=>{e.preventDefault(),await async function(){if(p&&!E)try{x(!0);const e=Qs(p,m),n=$s(e),a=await u("postType",kt,{slug:n,title:e,content:(0,c.serialize)(t),area:y},{throwOnError:!0});await r(a)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the template part.");o(t,{type:"snackbar"}),s?.()}finally{x(!1)}}()}},(0,l.createElement)(_.__experimentalVStack,{spacing:"4"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:p,onChange:h,required:!0}),(0,l.createElement)(_.BaseControl,{label:(0,b.__)("Area"),id:`edit-site-create-template-part-modal__area-selection-${S}`,className:"edit-site-create-template-part-modal__area-base-control"},(0,l.createElement)(_.__experimentalRadioGroup,{label:(0,b.__)("Area"),className:"edit-site-create-template-part-modal__area-radio-group",id:`edit-site-create-template-part-modal__area-selection-${S}`,onChange:v,checked:y},C.map((({icon:e,label:t,area:n,description:a})=>(0,l.createElement)(_.__experimentalRadio,{key:t,value:n,className:"edit-site-create-template-part-modal__area-radio"},(0,l.createElement)(_.Flex,{align:"start",justify:"start"},(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.Icon,{icon:e})),(0,l.createElement)(_.FlexBlock,{className:"edit-site-create-template-part-modal__option-label"},t,(0,l.createElement)("div",null,a)),(0,l.createElement)(_.FlexItem,{className:"edit-site-create-template-part-modal__checkbox"},y===n&&(0,l.createElement)(_.Icon,{icon:w})))))))),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:()=>{a()}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit","aria-disabled":!p||E,isBusy:E},n))))}const ni=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));var ai={};function ri(e){return[e]}function si(e,t,n){var a;if(e.length!==t.length)return!1;for(a=n;ae.name||"",ui=e=>e.title,di=e=>e.description||"",mi=e=>e.keywords||[],pi=()=>!1;function hi(e=""){return vs(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function fi(e=""){return e=(e=(e=li()(e)).replace(/^\//,"")).toLowerCase()}const gi=(e="")=>hi(fi(e)),yi=(e=[],t="",n={})=>{const a=gi(t),r=n.categoryId!==Mt&&!a.length,s={...n,onlyFilterByCategory:r},i=r?0:1,o=e.map((e=>[e,vi(e,t,s)])).filter((([,e])=>e>i));return 0===a.length||o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function vi(e,t,n){const{categoryId:a,getName:r=ci,getTitle:s=ui,getDescription:i=di,getKeywords:o=mi,hasCategory:l=pi,onlyFilterByCategory:c}=n;let u=a===Mt||a===At&&e.type===It.user||l(e,a)?1:0;if(!u||c)return u;const d=r(e),m=s(e),p=i(e),h=o(e),f=fi(t),g=fi(m);if(f===g)u+=30;else if(g.startsWith(f))u+=20;else{const e=[d,m,p,...h].join(" ");0===((e,t)=>e.filter((e=>!gi(t).some((t=>t.includes(e))))))(hi(f),e).length&&(u+=10)}return u}const _i=[],bi=(e,t)=>e&&t?e+"//"+t:null,Ei=ii(((e,t,n="")=>{var a;const{getEntityRecords:r,getIsResolving:s}=e(ge.store),{__experimentalGetDefaultTemplatePartAreas:i}=e(g.store),o={per_page:-1},l=(null!==(a=r("postType",kt,o))&&void 0!==a?a:_i).map((e=>(e=>({blocks:(0,c.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),categories:[e.area],description:e.description||"",isCustom:e.source===Tt.custom,keywords:e.keywords||[],id:bi(e.theme,e.slug),name:bi(e.theme,e.slug),title:(0,en.decodeEntities)(e.title.rendered),type:e.type,templatePart:e}))(e))),u=(i()||[]).map((e=>e.area)),d=s("getEntityRecords",["postType",kt,o]),m=yi(l,n,{categoryId:t,hasCategory:(e,t)=>t!==Pt?e.templatePart.area===t:e.templatePart.area===t||!u.includes(e.templatePart.area)});return{patterns:m,isResolving:d}}),(e=>[e(ge.store).getEntityRecords("postType",kt,{per_page:-1}),e(ge.store).getIsResolving("getEntityRecords",["postType",kt,{per_page:-1}]),e(g.store).__experimentalGetDefaultTemplatePartAreas()])),wi=ii((e=>{var t;const{getSettings:n}=Ke(e(ta)),a=n();return{patterns:[...(null!==(t=a.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:a.__experimentalBlockPatterns)||[],...e(ge.store).getBlockPatterns()||[]].filter((e=>!Nt.includes(e.source))).filter(ni).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:It.theme,blocks:(0,c.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:!1}}),(e=>[e(ge.store).getBlockPatterns(),Ke(e(ta)).getSettings()])),xi=ii(((e,t,n,a="")=>{const{patterns:r}=wi(e),{patterns:s}=Si(e);let i=[...r||[],...s||[]];return n&&(i=i.filter((e=>e.type===It.user?e.syncStatus===n:n===Ot.unsynced))),i=yi(i,a,t?{categoryId:t,hasCategory:(e,t)=>e.categories?.includes(t)}:{hasCategory:e=>!e.hasOwnProperty("categories")}),{patterns:i,isResolving:!1}}),(e=>[wi(e),Si(e)])),Si=ii(((e,t,n="")=>{const{getEntityRecords:a,getIsResolving:r,getUserPatternCategories:s}=e(ge.store),i={per_page:-1},o=a("postType",It.user,i),l=s(),u=new Map;l.forEach((e=>u.set(e.id,e)));let d=o?o.map((e=>((e,t)=>({blocks:(0,c.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),...e.wp_pattern_category.length>0&&{categories:e.wp_pattern_category.map((e=>t&&t.get(e)?t.get(e).slug:e))},termLabels:e.wp_pattern_category.map((e=>t?.get(e)?t.get(e).label:e)),id:e.id,name:e.slug,syncStatus:e.wp_pattern_sync_status||Ot.full,title:e.title.raw,type:e.type,patternPost:e}))(e,u))):_i;const m=r("getEntityRecords",["postType",It.user,i]);return t&&(d=d.filter((e=>e.syncStatus===t))),d=yi(d,n,{hasCategory:()=>!0}),{patterns:d,isResolving:m,categories:l}}),(e=>[e(ge.store).getEntityRecords("postType",It.user,{per_page:-1}),e(ge.store).getIsResolving("getEntityRecords",["postType",It.user,{per_page:-1}]),e(ge.store).getUserPatternCategories()])),Ci=(e,t,{search:n="",syncStatus:a}={})=>(0,d.useSelect)((r=>e===kt?Ei(r,t,n):e===It.theme?xi(r,t,a,n):e===It.user?Si(r,a,n):{patterns:_i,isResolving:!1}),[t,e,n,a]);function ki(){const e=function(){const e=(0,d.useSelect)((e=>{var t;const{getSettings:n}=Ke(e(ta)),a=n();return null!==(t=a.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:a.__experimentalBlockPatternCategories}));return[...e||[],...(0,d.useSelect)((e=>e(ge.store).getBlockPatternCategories()))||[]]}();e.push({name:Pt,label:(0,b.__)("Uncategorized")});const t=function(){const e=(0,d.useSelect)((e=>{var t;const{getSettings:n}=Ke(e(ta));return null!==(t=n().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:n().__experimentalBlockPatterns})),t=(0,d.useSelect)((e=>e(ge.store).getBlockPatterns()));return(0,f.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Nt.includes(e.source))).filter(ni).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:n,categories:a}=Ci(It.user),r=(0,f.useMemo)((()=>{const r={},s=[];e.forEach((e=>{r[e.name]||(r[e.name]={...e,count:0})})),a.forEach((e=>{r[e.name]||(r[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{r[e]&&(r[e].count+=1)})),e.categories?.length||(r.uncategorized.count+=1)})),n.forEach((e=>{e.categories?.forEach((e=>{r[e]&&(r[e].count+=1)})),e.categories?.length||(r.uncategorized.count+=1)})),[...e,...a].forEach((e=>{r[e.name].count&&!s.find((t=>t.name===e.name))&&s.push(r[e.name])}));const i=s.sort(((e,t)=>e.label.localeCompare(t.label)));return i.unshift({name:At,label:(0,b.__)("My patterns"),count:n.length}),i.unshift({name:Mt,label:(0,b.__)("All patterns"),description:(0,b.__)("A list of all patterns from all sources."),count:t.length+n.length}),i}),[e,t,a,n]);return{patternCategories:r,hasPatterns:!!r.length}}const{useHistory:Ti,useLocation:Pi}=Ke(ft.privateApis),{CreatePatternModal:Ii}=Ke(xt.privateApis);function Mi(){const e=Ti(),{params:t}=Pi(),[n,a]=(0,f.useState)(!1),[r,s]=(0,f.useState)(!1),i=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme()?.is_block_theme),[]),{createPatternFromFile:o}=Ke((0,d.useDispatch)(xt.store)),{createSuccessNotice:c,createErrorNotice:u}=(0,d.useDispatch)(fe.store),m=(0,f.useRef)(),{patternCategories:p}=ki();function h(){a(!1),s(!1)}const g=[{icon:ca,onClick:()=>a(!0),title:(0,b.__)("Create pattern")}];return i&&g.push({icon:Ks,onClick:()=>s(!0),title:(0,b.__)("Create template part")}),g.push({icon:Xs,onClick:()=>{m.current.click()},title:(0,b.__)("Import pattern from JSON")}),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.DropdownMenu,{controls:g,toggleProps:{as:ma},icon:Zr,label:(0,b.__)("Create pattern")}),n&&(0,l.createElement)(Ii,{onClose:()=>a(!1),onSuccess:function({pattern:t,categoryId:n}){a(!1),e.push({postId:t.id,postType:It.user,categoryType:It.theme,categoryId:n,canvas:"edit"})},onError:h}),r&&(0,l.createElement)(ei,{closeModal:()=>s(!1),blocks:[],onCreate:function(t){s(!1),e.push({postId:t.id,postType:kt,canvas:"edit"})},onError:h}),(0,l.createElement)("input",{type:"file",accept:".json",hidden:!0,ref:m,onChange:async n=>{const a=n.target.files?.[0];if(a)try{const n=t.categoryType!==kt&&p.find((e=>e.name===t.categoryId))?.id,r=await o(a,n?[n]:void 0);n||e.push({path:"/patterns",categoryType:It.theme,categoryId:Mt}),c((0,b.sprintf)((0,b.__)('Imported "%s" from JSON.'),r.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){u(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{n.target.value=""}}}))}function Ai({count:e,icon:t,id:n,isActive:a,label:r,type:s}){const i=Et({path:"/patterns",categoryType:s,categoryId:n});if(e)return(0,l.createElement)(va,{...i,icon:t,suffix:(0,l.createElement)("span",null,e),"aria-current":a?"true":void 0},r)}const Ni=e=>{const t=e||[],n=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]),a={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>a[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>(e[e[t.area]?t.area:Pt].templateParts.push(t),e)),a)};function Oi({areas:e,currentArea:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-patterns__group-header"},(0,l.createElement)(_.__experimentalHeading,{level:2},(0,b.__)("Template parts"))),(0,l.createElement)(_.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},Object.entries(e).map((([e,{label:a,templateParts:r}])=>(0,l.createElement)(Ai,{key:e,count:r?.length,icon:(0,g.getTemplatePartIcon)(e),label:a,id:e,type:kt,isActive:t===e&&n===kt})))))}function Ri({categories:e,currentCategory:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},e.map((e=>(0,l.createElement)(Ai,{key:e.name,count:e.count,label:e.label,icon:Ys,id:e.name,type:"pattern",isActive:t===`${e.name}`&&(n===It.theme||n===It.user)})))))}function Fi(){const e=(0,se.useViewportMatch)("medium","<"),{categoryType:t,categoryId:n}=(0,gt.getQueryArgs)(window.location.href),a=n||Mt,r=t||It.theme,{templatePartAreas:s,hasTemplateParts:i,isLoading:o}=function(){const{records:e,isResolving:t}=(0,ge.useEntityRecords)("postType",kt,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Ni(e)}}(),{patternCategories:c,hasPatterns:u}=ki(),m=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme()?.is_block_theme),[]),p=(0,d.useSelect)((e=>!!e(ta).getSettings().supportsTemplatePartsMode),[]),h=Et({path:"/wp_template_part/all",didAccessPatternsPage:!m&&p?1:void 0}),f=e?void 0:(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(va,{as:"a",href:"edit.php?post_type=wp_block",withChevron:!0},(0,b.__)("Manage all of my patterns")),(m||p)&&(0,l.createElement)(va,{withChevron:!0,...h},(0,b.__)("Manage all template parts")));return(0,l.createElement)(ha,{isRoot:!m,title:(0,b.__)("Patterns"),description:(0,b.__)("Manage what patterns are available when editing the site."),actions:(0,l.createElement)(Mi,null),footer:f,content:(0,l.createElement)(l.Fragment,null,o&&(0,b.__)("Loading patterns…"),!o&&(0,l.createElement)(l.Fragment,null,!i&&!u&&(0,l.createElement)(_.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},(0,l.createElement)(_.__experimentalItem,null,(0,b.__)("No template parts or patterns found"))),u&&(0,l.createElement)(Ri,{categories:c,currentCategory:a,currentType:r}),i&&(0,l.createElement)(Oi,{areas:s,currentArea:a,currentType:r})))})}const{useLocation:Di}=Ke(ft.privateApis),Bi=[Ct,kt,St,It.user];function Vi(){const{params:e={}}=Di(),{postType:t,postId:n,context:a,isReady:r}=function({path:e,postId:t,postType:n}){const{hasLoadedAllDependencies:a,homepageId:r,url:s,frontPageTemplateId:i}=(0,d.useSelect)((e=>{const{getSite:t,getUnstableBase:n,getEntityRecords:a}=e(ge.store),r=t(),s=n(),i=a("postType",Ct,{per_page:-1});let o;if(i){const e=i.find((e=>"front-page"===e.slug));o=!!e&&e.id}return{hasLoadedAllDependencies:!!s&&!!r,homepageId:"page"===r?.show_on_front&&["number","string"].includes(typeof r.page_on_front)?r.page_on_front.toString():null,url:s?.home,frontPageTemplateId:o}}),[]),o=(0,d.useSelect)((o=>{if(Bi.includes(n))return;const{getEditedEntityRecord:l,getEntityRecords:c,getDefaultTemplateId:u,__experimentalGetTemplateForLink:d}=o(ge.store);function m(e,t){if("page"===e&&r===t){if(void 0===i)return;if(i)return i}const n=l("postType",e,t);if(!n)return;const a=n.template;if(a){const e=c("postType",Ct,{per_page:-1})?.find((({slug:e})=>e===a));if(e)return e.id}let s;return s=n.slug?"page"===e?`${e}-${n.slug}`:`single-${e}-${n.slug}`:"page"===e?"page":`single-${e}`,u({slug:s})}if(a){if(n&&t)return m(n,t);if("/pages"===e&&t)return m("page",t);if(r)return m("page",r);if(s){const e=d(s);return e?.id}}}),[r,a,s,t,n,e,i]),l=(0,f.useMemo)((()=>Bi.includes(n)?{}:n&&t?{postType:n,postId:t}:"/pages"===e&&t?{postType:"page",postId:t}:r?{postType:"page",postId:r}:{}),[r,n,t,e]);return"/wp_template/all"===e&&t?{isReady:!0,postType:"wp_template",postId:t,context:l}:"/wp_template_part/all"===e&&t?{isReady:!0,postType:"wp_template_part",postId:t,context:l}:Bi.includes(n)?{isReady:!0,postType:n,postId:t,context:l}:a?{isReady:void 0!==o,postType:Ct,postId:o,context:l}:{isReady:!1}}(e),{setEditedEntity:s}=(0,d.useDispatch)(ta);(0,f.useEffect)((()=>{r&&s(t,n,a)}),[r,t,n,a,s])}function Li(e,t){var n=e.toLowerCase();return 0===t?function(e){return e.charAt(0).toUpperCase()+e.substr(1)}(n):n}const zi=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),Gi=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),{useLocation:Hi,useHistory:Ui}=Ke(ft.privateApis);function Wi(e){var t;let n=null!==(t=e?.path)&&void 0!==t?t:"/";if(e?.postType&&e?.postId)switch(e.postType){case It.user:case Ct:case kt:case"page":n=`/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`;break;default:n=`/navigation/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`}return n}function ji(){const e=Ui(),{params:t}=Hi(),{location:n,params:a,goTo:r}=(0,_.__experimentalUseNavigator)(),s=(0,f.useRef)(!0);(0,f.useEffect)((()=>{function r(n){if(a=n,r=t,Object.entries(a).every((([e,t])=>r[e]===t)))return;var a,r;const s={...t,...n};e.push(s)}s.current?s.current=!1:a?.postType&&a?.postId?r({postType:a?.postType,postId:a?.postId,path:void 0,layout:void 0}):n.path.startsWith("/page/")&&a?.postId?r({postType:"page",postId:a?.postId,path:void 0,layout:void 0}):"/patterns"===n.path?r({postType:void 0,postId:void 0,canvas:void 0,path:n.path}):"/wp_template/all"!==n.path||window?.__experimentalAdminViews?"/pages"===n.path&&window?.__experimentalAdminViews||"/wp_template/all"===n.path&&window?.__experimentalAdminViews||"/wp_template_part/all"===n.path&&window?.__experimentalAdminViews?r({postType:void 0,categoryType:void 0,categoryId:void 0,path:n.path}):r({postType:void 0,postId:void 0,categoryType:void 0,categoryId:void 0,layout:void 0,path:"/"===n.path?void 0:n.path}):r({postType:void 0,categoryType:void 0,categoryId:void 0,path:n.path,layout:void 0})}),[n?.path,a]),(0,f.useEffect)((()=>{const e=Wi(t);n.path!==e&&r(e)}),[t])}const Zi={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useLocation:qi,useHistory:Yi}=Ke(ft.privateApis);function Ki(e){const t=qi(),n=Yi(),{block:a}=e,{clientId:r}=a,{moveBlocksDown:s,moveBlocksUp:i,removeBlocks:o}=(0,d.useDispatch)(he.store),c=(0,b.sprintf)((0,b.__)("Remove %s"),(0,he.BlockTitle)({clientId:r,maximumLength:25})),u=(0,b.sprintf)((0,b.__)("Go to %s"),(0,he.BlockTitle)({clientId:r,maximumLength:25})),m=(0,d.useSelect)((e=>{const{getBlockRootClientId:t}=e(he.store);return t(r)}),[r]),p=(0,f.useCallback)((e=>{const{attributes:a,name:r}=e;"post-type"===a.kind&&a.id&&a.type&&n&&n.push({postType:a.type,postId:a.id,...yt()&&{wp_theme_preview:vt()}},{backPath:Wi(t.params)}),"core/page-list-item"===r&&a.id&&n&&n.push({postType:"page",postId:a.id,...yt()&&{wp_theme_preview:vt()}},{backPath:Wi(t.params)})}),[n]);return(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Zi,noIcons:!0,...e},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{icon:zi,onClick:()=>{i([r],m),e()}},(0,b.__)("Move up")),(0,l.createElement)(_.MenuItem,{icon:Gi,onClick:()=>{s([r],m),e()}},(0,b.__)("Move down")),"page"===a.attributes?.type&&a.attributes?.id&&(0,l.createElement)(_.MenuItem,{onClick:()=>{p(a),e()}},u)),(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{onClick:()=>{o([r],!1),e()}},c)))))}const{PrivateListView:Xi}=Ke(he.privateApis),Ji=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function Qi({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,d.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:a,getBlockCount:r,getBlockOrder:s}=t(he.store),{isResolving:i}=t(ge.store),o=s(e),l=1===o.length&&"core/page-list"===a(o[0])&&r(o[0])>0,c=i("getEntityRecords",Ji);return{listViewRootClientId:l?o[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:a,__unstableMarkNextChangeAsNotPersistent:r}=(0,d.useDispatch)(he.store),s=(0,f.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(r(),a(e.clientId,(0,c.createBlock)("core/navigation-link",e.attributes)))}),[r,a]);return(0,l.createElement)(l.Fragment,null,!n&&(0,l.createElement)(Xi,{rootClientId:t,onSelect:s,blockSettingsMenu:Ki,showAppender:!1}),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor"},(0,l.createElement)(he.BlockList,null)))}const $i=()=>{};function eo({navigationMenuId:e}){const{storedSettings:t}=(0,d.useSelect)((e=>{const{getSettings:t}=Ke(e(ta));return{storedSettings:t()}}),[]),n=(0,f.useMemo)((()=>e?[(0,c.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,l.createElement)(he.BlockEditorProvider,{settings:t,value:n,onChange:$i,onInput:$i},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content"},(0,l.createElement)(Qi,{rootClientId:n[0].clientId}))):null}function to(e){return(0,d.useSelect)((t=>{if(!e)return;const n=t(ge.store).getEditedEntityRecord("postType",St,e);return"trash"===n.status?void 0:n.title}),[e])}function no({id:e}){const t=to(e);return e&&void 0!==t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},t||(0,b.__)("Navigation")),(0,l.createElement)(eo,{navigationMenuId:e})):null}function ao({id:e}){const t=to(e),n=Et({postId:e,postType:St});return e&&void 0!==t?(0,l.createElement)(va,{withChevron:!0,...n},t||(0,b.__)("(no title)")):null}function ro({menus:e}){return(0,l.createElement)(_.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu-list"},e.map((e=>(0,l.createElement)(ao,{key:e,id:e}))))}function so({menus:e}){return e.length?1===e.length?(0,l.createElement)(no,{id:e[0]}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},(0,b.__)("Navigation")),(0,l.createElement)(ro,{menus:e})):null}function io(e,t){const{record:n}=Ds(e,t);if(e!==kt)return;const a=function(e){return e?.blocks?e?.blocks:e?.content&&"function"!=typeof e.content?(0,c.parse)(e.content):[]}(n),r=function(e,t){if(!e||!t?.length)return[];const n=t=>{if(!t)return[];const a=[];for(const r of t)if(r.name===e&&a.push(r),r?.innerBlocks){const e=n(r.innerBlocks);e.length&&a.push(...e)}return a};return n(t)}("core/navigation",a);if(!r.length)return;const s=r?.map((e=>e.attributes.ref)),i=[...new Set(s)].filter((e=>e));return i?.length?(0,l.createElement)(so,{menus:i}):void 0}function oo(e,t){const{getDescription:n,getTitle:a,record:r}=Ds(e,t),s=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]),{currentTheme:i,userPatternCategories:o}=(0,d.useSelect)((e=>{const{getCurrentTheme:t,getUserPatternCategories:n}=e(ge.store);return{currentTheme:t(),userPatternCategories:n()}}),[]),c=Ls(e,t),u="theme"===c.type&&r.theme===i?.stylesheet,m=a();let p=n();!p&&c.text&&(p=e===It.user?(0,b.sprintf)((0,b.__)("This is the %s pattern."),a()):(0,b.sprintf)((0,b.__)("This is the %s template part."),a())),!p&&e===It.user&&r?.title&&(p=(0,b.sprintf)((0,b.__)("This is the %s pattern."),r.title));const h=r?.modified?(0,l.createElement)(Cr,{record:r}):null,f=[];if((e===It.user||e===kt)&&(f.push({label:(0,b.__)("Syncing"),value:r.wp_pattern_sync_status===Ot.unsynced?(0,b.__)("Not synced"):(0,b.__)("Fully synced")}),0===r.wp_pattern_category?.length&&f.push({label:(0,b.__)("Categories"),value:(0,b.__)("Uncategorized")}),r.wp_pattern_category?.length>0)){const e=new Map;o.forEach((t=>e.set(t.id,t)));const t=r.wp_pattern_category.filter((t=>e.get(t))).map((t=>e.get(t).label));f.push({label:(0,b.__)("Categories"),value:t.length>0?t.join(", "):""})}if(e===kt){const e=s.find((e=>e.area===r.area));let t=e?.label;t||(t=r.area?(0,b.sprintf)((0,b.__)("%s (removed)"),(y=r.area,void 0===v&&(v={}),vs(y,hs({delimiter:" ",transform:Li},v)))):(0,b.__)("None")),f.push({label:(0,b.__)("Area"),value:t})}var y,v;e===kt&&c.text&&!u&&f.push({label:(0,b.__)("Added by"),value:(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-author"},c.text)}),e!==kt||!c.text||r.origin!==Tt.plugin&&!0!==r.has_theme_file||f.push({label:(0,b.__)("Customized"),value:(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"},c.isCustomized?(0,b.__)("Yes"):(0,b.__)("No"))});return{title:m,description:p,content:(0,l.createElement)(l.Fragment,null,io(e,t),!!f.length&&(0,l.createElement)(Sr,{spacing:5,title:(0,b.__)("Details")},f.map((({label:e,value:t})=>(0,l.createElement)(wr,{key:e},(0,l.createElement)(Er,null,e),(0,l.createElement)(xr,null,t)))))),footer:h}}function lo(){const e=(0,_.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{categoryType:a}=(0,gt.getQueryArgs)(window.location.href),{setCanvasMode:r}=Ke((0,d.useDispatch)(ta));Vi();const s=oo(t,n),i=a||t!==kt?"/patterns":"/wp_template_part/all";return(0,l.createElement)(ha,{actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Us,{postType:t,postId:n,toggleProps:{as:ma},onRemove:()=>{e.goTo(i)}}),(0,l.createElement)(ma,{onClick:()=>r("edit"),label:(0,b.__)("Edit"),icon:ba})),backPath:i,...s})}const co={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},uo=e=>e?.trim()?.length>0;function mo({menuTitle:e,onClose:t,onSave:n}){const[a,r]=(0,f.useState)(e),s=a!==e&&uo(a);return(0,l.createElement)(_.Modal,{title:(0,b.__)("Rename"),onRequestClose:t},(0,l.createElement)("form",{className:"sidebar-navigation__rename-modal-form"},(0,l.createElement)(_.__experimentalVStack,{spacing:"3"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:a,placeholder:(0,b.__)("Navigation title"),onChange:r}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,disabled:!s,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),s&&(n({title:a}),t())}},(0,b.__)("Save"))))))}function po({onClose:e,onConfirm:t}){return(0,l.createElement)(_.__experimentalConfirmDialog,{isOpen:!0,onConfirm:n=>{n.preventDefault(),t(),e()},onCancel:e,confirmButtonText:(0,b.__)("Delete")},(0,b.__)("Are you sure you want to delete this Navigation menu?"))}const ho={position:"bottom right"};function fo(e){const{onDelete:t,onSave:n,onDuplicate:a,menuTitle:r}=e,[s,i]=(0,f.useState)(!1),[o,c]=(0,f.useState)(!1),u=()=>{i(!1),c(!1)};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,b.__)("Actions"),icon:ce,popoverProps:ho},(({onClose:e})=>(0,l.createElement)("div",null,(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{onClick:()=>{i(!0),e()}},(0,b.__)("Rename")),(0,l.createElement)(_.MenuItem,{onClick:()=>{a(),e()}},(0,b.__)("Duplicate")),(0,l.createElement)(_.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()}},(0,b.__)("Delete")))))),o&&(0,l.createElement)(po,{onClose:u,onConfirm:t}),s&&(0,l.createElement)(mo,{onClose:u,menuTitle:r,onSave:n}))}function go(e,t,n){return e?.rendered?"publish"===n?(0,en.decodeEntities)(e?.rendered):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,en.decodeEntities)(e?.rendered),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function yo({postId:e}){const t=Et({postId:e,postType:St,canvas:"edit"});return(0,l.createElement)(ma,{...t,label:(0,b.__)("Edit"),icon:ba})}function vo({navigationMenu:e,handleDelete:t,handleDuplicate:n,handleSave:a}){const r=e?.title?.rendered;return(0,l.createElement)(To,{actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(fo,{menuTitle:(0,en.decodeEntities)(r),onDelete:t,onSave:a,onDuplicate:n}),(0,l.createElement)(yo,{postId:e?.id})),title:go(e?.title,e?.id,e?.status),description:(0,b.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(eo,{navigationMenuId:e?.id}))}const _o="wp_navigation";function bo(){const{params:{postId:e}}=(0,_.__experimentalUseNavigator)(),{record:t,isResolving:n}=(0,ge.useEntityRecord)("postType",_o,e),{isSaving:a,isDeleting:r}=(0,d.useSelect)((t=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:a}=t(ge.store);return{isSaving:n("postType",_o,e),isDeleting:a("postType",_o,e)}}),[e]),s=n||a||r,i=t?.title?.rendered||t?.slug,{handleSave:o,handleDelete:c,handleDuplicate:u}=So(),m=()=>c(t),p=e=>o(t,e),h=()=>u(t);return s?(0,l.createElement)(To,{description:(0,b.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(_.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):s||t?t?.content?.raw?(0,l.createElement)(vo,{navigationMenu:t,handleDelete:m,handleSave:p,handleDuplicate:h}):(0,l.createElement)(To,{actions:(0,l.createElement)(fo,{menuTitle:(0,en.decodeEntities)(i),onDelete:m,onSave:p,onDuplicate:h}),title:go(t?.title,t?.id,t?.status),description:(0,b.__)("This Navigation Menu is empty.")}):(0,l.createElement)(To,{description:(0,b.__)("Navigation Menu missing.")})}function Eo(){const{goTo:e}=(0,_.__experimentalUseNavigator)(),{deleteEntityRecord:t}=(0,d.useDispatch)(ge.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(fe.store);return async r=>{const s=r?.id;try{await t("postType",_o,s,{force:!0},{throwOnError:!0}),n((0,b.__)("Deleted Navigation menu"),{type:"snackbar"}),e("/navigation")}catch(e){a((0,b.sprintf)((0,b.__)("Unable to delete Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function wo(){const{getEditedEntityRecord:e}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t}=e(ge.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:n}=(0,d.useDispatch)(ge.store),{createSuccessNotice:a,createErrorNotice:r}=(0,d.useDispatch)(fe.store);return async(s,i)=>{if(!i)return;const o=s?.id,l=e("postType",St,o);t("postType",_o,o,i);const c=Object.keys(i);try{await n("postType",_o,o,c,{throwOnError:!0}),a((0,b.__)("Renamed Navigation menu"),{type:"snackbar"})}catch(e){t("postType",_o,o,l),r((0,b.sprintf)((0,b.__)("Unable to rename Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function xo(){const{goTo:e}=(0,_.__experimentalUseNavigator)(),{saveEntityRecord:t}=(0,d.useDispatch)(ge.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(fe.store);return async r=>{const s=r?.title?.rendered||r?.slug;try{const a=await t("postType",_o,{title:(0,b.sprintf)((0,b.__)("%s (Copy)"),s),content:r?.content?.raw,status:"publish"},{throwOnError:!0});a&&(n((0,b.__)("Duplicated Navigation menu"),{type:"snackbar"}),e(`/navigation/${_o}/${a.id}`))}catch(e){a((0,b.sprintf)((0,b.__)("Unable to duplicate Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function So(){return{handleDelete:Eo(),handleSave:wo(),handleDuplicate:xo()}}let Co=!1;function ko(){const{records:e,isResolving:t,hasResolved:n}=(0,ge.useEntityRecords)("postType",St,co),a=t&&!n,{getNavigationFallbackId:r}=Ke((0,d.useSelect)(ge.store)),s=e?.[0];s&&(Co=!0),s||t||!n||Co||r();const{handleSave:i,handleDelete:o,handleDuplicate:c}=So(),u=!!e?.length;return a?(0,l.createElement)(To,null,(0,l.createElement)(_.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):a||u?1===e?.length?(0,l.createElement)(vo,{navigationMenu:s,handleDelete:()=>o(s),handleDuplicate:()=>c(s),handleSave:e=>i(s,e)}):(0,l.createElement)(To,null,(0,l.createElement)(_.__experimentalItemGroup,null,e?.map((({id:e,title:t,status:n},a)=>(0,l.createElement)(Po,{postId:e,key:e,withChevron:!0,icon:sa},function(e,t,n){return e?"publish"===n?(0,en.decodeEntities)(e):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,en.decodeEntities)(e),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}(t?.rendered,a+1,n)))))):(0,l.createElement)(To,{description:(0,b.__)("No Navigation Menus found.")})}function To({children:e,actions:t,title:n,description:a}){return(0,l.createElement)(ha,{title:n||(0,b.__)("Navigation"),actions:t,description:a||(0,b.__)("Manage your Navigation menus."),content:e})}const Po=({postId:e,...t})=>{const n=Et({postId:e,postType:St});return(0,l.createElement)(va,{...n,...t})},Io=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})),Mo=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})),Ao=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),No=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M4.67 10.664s-2.09 1.11-2.917 1.582l.494.87 1.608-.914.002.002c.343.502.86 1.17 1.563 1.84.348.33.742.663 1.185.976L5.57 16.744l.858.515 1.02-1.701a9.1 9.1 0 0 0 4.051 1.18V19h1v-2.263a9.1 9.1 0 0 0 4.05-1.18l1.021 1.7.858-.514-1.034-1.723c.442-.313.837-.646 1.184-.977.703-.669 1.22-1.337 1.563-1.839l.002-.003 1.61.914.493-.87c-1.75-.994-2.918-1.58-2.918-1.58l-.003.005a8.29 8.29 0 0 1-.422.689 10.097 10.097 0 0 1-1.36 1.598c-1.218 1.16-3.042 2.293-5.544 2.293-2.503 0-4.327-1.132-5.546-2.293a10.099 10.099 0 0 1-1.359-1.599 8.267 8.267 0 0 1-.422-.689l-.003-.005Z"})),Oo=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})),{lock:Ro,unlock:Fo}=(0,qe.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/dataviews"),{DropdownMenuV2:Do,DropdownMenuGroupV2:Bo,DropdownMenuItemV2:Vo,DropdownMenuItemLabelV2:Lo,kebabCase:zo}=Fo(_.privateApis);function Go({action:e,onClick:t}){return(0,l.createElement)(_.Button,{label:e.label,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Ho({action:e,onClick:t}){return(0,l.createElement)(Vo,{onClick:t,hideOnClick:!e.RenderModal},(0,l.createElement)(Lo,null,e.label))}function Uo({action:e,item:t,ActionTrigger:n}){const[a,r]=(0,f.useState)(!1),s={action:e,onClick:()=>r(!0)},{RenderModal:i,hideModalHeader:o}=e;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(n,{...s}),a&&(0,l.createElement)(_.Modal,{title:e.modalHeader||e.label,__experimentalHideHeader:!!o,onRequestClose:()=>{r(!1)},overlayClassName:`dataviews-action-modal dataviews-action-modal__${zo(e.id)}`},(0,l.createElement)(i,{items:[t],closeModal:()=>r(!1)})))}function Wo({actions:e,item:t}){return(0,l.createElement)(Bo,null,e.map((e=>e.RenderModal?(0,l.createElement)(Uo,{key:e.id,action:e,item:t,ActionTrigger:Ho}):(0,l.createElement)(Ho,{key:e.id,action:e,onClick:()=>e.callback([t])}))))}function jo({item:e,actions:t,isCompact:n}){const{primaryActions:a,secondaryActions:r}=(0,f.useMemo)((()=>t.reduce(((t,n)=>(n.isEligible&&!n.isEligible(e)||(n.isPrimary&&n.icon?t.primaryActions.push(n):t.secondaryActions.push(n)),t)),{primaryActions:[],secondaryActions:[]})),[t,e]);return n?(0,l.createElement)(Zo,{item:e,primaryActions:a,secondaryActions:r}):(0,l.createElement)(_.__experimentalHStack,{spacing:1,justify:"flex-end",style:{flexShrink:"0",width:"auto"}},!!a.length&&a.map((t=>t.RenderModal?(0,l.createElement)(Uo,{key:t.id,action:t,item:e,ActionTrigger:Go}):(0,l.createElement)(Go,{key:t.id,action:t,onClick:()=>t.callback([e])}))),(0,l.createElement)(Do,{trigger:(0,l.createElement)(_.Button,{size:"compact",icon:ce,label:(0,b.__)("Actions"),disabled:!r.length}),placement:"bottom-end"},(0,l.createElement)(Wo,{actions:r,item:e})))}function Zo({item:e,primaryActions:t,secondaryActions:n}){return(0,l.createElement)(Do,{trigger:(0,l.createElement)(_.Button,{size:"compact",icon:ce,label:(0,b.__)("Actions"),disabled:!t.length&&!n.length}),placement:"bottom-end"},!!t.length&&(0,l.createElement)(Wo,{actions:t,item:e}),!!n.length&&(0,l.createElement)(Wo,{actions:n,item:e}))}const{DropdownMenuItemV2:qo}=Fo(_.privateApis),Yo=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Circle,{cx:12,cy:12,r:3})),Ko=(0,f.forwardRef)((function({checked:e,name:t,value:n,hideOnClick:a,onChange:r,onClick:s,...i},o){return(0,l.createElement)(qo,{ref:o,role:"menuitemradio",name:t,"aria-checked":e,hideOnClick:!!a,prefix:e?(0,l.createElement)(_.Icon,{icon:Yo}):(0,l.createElement)("span",{className:"dataviews-filters__custom-menu-radio-item-prefix","aria-hidden":"true"}),onClick:e=>{s?.(e),r?.({...e,target:{...e.target,value:n}})},...i})})),{DropdownMenuV2:Xo,DropdownMenuGroupV2:Jo,DropdownMenuItemV2:Qo,DropdownMenuRadioItemV2:$o,DropdownMenuSeparatorV2:el,DropdownMenuItemLabelV2:tl,DropdownMenuItemHelpTextV2:nl}=Fo(_.privateApis),al={asc:"↑",desc:"↓"},rl=(0,f.forwardRef)((function({field:e,view:t,onChangeView:n,onHide:a},r){const s=!1!==e.enableHiding,i=!1!==e.enableSorting,o=t.sort?.field===e.id;let c,u,d,m,p;const h=(e=>{let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=Object.keys(pl)),t.filter((e=>Object.keys(pl).includes(e)))})(e);e.type===ul&&h.length>0&&(c={field:e.id,operators:h,elements:e.elements||[]},u=t.filters.find((e=>e.field===c.field)),p=t.filters.filter((e=>e.field!==c.field)),d=c.elements.find((e=>e.value===u?.value)),m=u?.operator||c.operators[0]);const f=!!c;return i||s||f?(0,l.createElement)(Xo,{align:"start",trigger:(0,l.createElement)(_.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:r,variant:"tertiary"},e.header,o&&(0,l.createElement)("span",{"aria-hidden":"true"},o&&al[t.sort.direction])),style:{minWidth:"240px"}},(0,l.createElement)(sl,null,i&&(0,l.createElement)(Jo,null,Object.entries(hl).map((([a,r])=>{const s=o&&t.sort.direction===a,i=`${e.id}-${a}`;return(0,l.createElement)($o,{key:i,name:"view-table-sorting",value:i,checked:s,onChange:()=>{n({...t,sort:{field:e.id,direction:a}})}},(0,l.createElement)(tl,null,r.label))}))),s&&(0,l.createElement)(Qo,{prefix:(0,l.createElement)(_.Icon,{icon:No}),onClick:()=>{a(e),n({...t,hiddenFields:t.hiddenFields.concat(e.id)})}},(0,l.createElement)(tl,null,(0,b.__)("Hide"))),f&&(0,l.createElement)(Jo,null,(0,l.createElement)(Xo,{key:c.field,trigger:(0,l.createElement)(Qo,{prefix:(0,l.createElement)(_.Icon,{icon:Oo}),suffix:d&&(0,l.createElement)("span",{"aria-hidden":"true"},m in pl&&`${pl[m].label} `,d?.label)},(0,l.createElement)(tl,null,(0,b.__)("Filter by")))},(0,l.createElement)(sl,null,(0,l.createElement)(Jo,null,c.elements.map((e=>{const a=d?.value===e.value;return(0,l.createElement)(Ko,{key:e.value,name:`view-table-${c.field}`,value:e.value,checked:a,onClick:()=>{n({...t,page:1,filters:[...p,{field:c.field,operator:m,value:a?void 0:e.value}]})}},(0,l.createElement)(tl,null,e.label),!!e.description&&(0,l.createElement)(nl,null,e.description))}))),c.operators.length>1&&(0,l.createElement)(Xo,{trigger:(0,l.createElement)(Qo,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},pl[m]?.label)},(0,l.createElement)(tl,null,(0,b.__)("Conditions")))},Object.entries(pl).map((([e,{label:a,key:r}])=>(0,l.createElement)($o,{key:r,name:`view-table-${c.field}-conditions`,value:e,checked:m===e,onChange:e=>n({...t,page:1,filters:[...p,{field:c.field,operator:e.target.value,value:u?.value}]})},(0,l.createElement)(tl,null,a)))))))))):e.header}));function sl({children:e}){return f.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,l.createElement)(f.Fragment,{key:t},t>0&&(0,l.createElement)(el,null),e)))}function il({selection:e,onSelectionChange:t,data:n}){const a=e.length===n.length;return(0,l.createElement)(_.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:a,indeterminate:!a&&e.length,onChange:()=>{t(a?[]:n)},label:a?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function ol({selection:e,onSelectionChange:t,item:n,data:a,getItemId:r,primaryField:s}){const i=r(n),o=e.includes(i);let c;return c=s?.getValue&&n?(0,b.sprintf)(o?(0,b.__)("Deselect item: %s"):(0,b.__)("Select item: %s"),s.getValue({item:n})):o?(0,b.__)("Select a new item"):(0,b.__)("Deselect item"),(0,l.createElement)(_.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:o,label:c,onChange:()=>{t(o?a.filter((t=>{const n=r?.(t);return n!==i&&e.includes(n)})):a.filter((t=>{const n=r?.(t);return n===i||e.includes(n)})))}})}const ll=function({view:e,onChangeView:t,fields:n,actions:a,data:r,getItemId:s,isLoading:i=!1,deferredRendering:o,selection:c,onSelectionChange:u}){const d=a?.some((e=>e.supportsBulk)),m=(0,f.useRef)(new Map),p=(0,f.useRef)(),[h,g]=(0,f.useState)();(0,f.useEffect)((()=>{p.current&&(p.current.focus(),p.current=void 0)}));const y=(0,se.useAsyncList)(r),_=(0,f.useId)();if(h)return p.current=h,void g();const E=e=>{const t=m.current.get(e.id),n=m.current.get(t.fallback);g(n?.node)},w=n.filter((t=>!e.hiddenFields.includes(t.id)&&![e.layout.mediaField].includes(t.id))),x=o?y:r,S=!!x?.length,C={asc:"ascending",desc:"descending"},k=n.find((t=>t.id===e.layout.primaryField));return(0,l.createElement)("div",{className:"dataviews-view-table-wrapper"},(0,l.createElement)("table",{className:"dataviews-view-table","aria-busy":i,"aria-describedby":_},(0,l.createElement)("thead",null,(0,l.createElement)("tr",{className:"dataviews-view-table__row"},d&&(0,l.createElement)("th",{className:"dataviews-view-table__checkbox-column",style:{width:20,minWidth:20},"data-field-id":"selection",scope:"col"},(0,l.createElement)(il,{selection:c,onSelectionChange:u,data:r})),w.map(((n,a)=>(0,l.createElement)("th",{key:n.id,style:{width:n.width||void 0,minWidth:n.minWidth||void 0,maxWidth:n.maxWidth||void 0},"data-field-id":n.id,"aria-sort":e.sort?.field===n.id&&C[e.sort.direction],scope:"col"},(0,l.createElement)(rl,{ref:e=>{e?m.current.set(n.id,{node:e,fallback:w[a>0?a-1:1]?.id}):m.current.delete(n.id)},field:n,view:e,onChangeView:t,onHide:E})))),!!a?.length&&(0,l.createElement)("th",{"data-field-id":"actions",className:"dataviews-view-table__actions-column"},(0,l.createElement)("span",{className:"dataviews-view-table-header"},(0,b.__)("Actions"))))),(0,l.createElement)("tbody",null,S&&x.map(((e,t)=>(0,l.createElement)("tr",{key:s(e),className:v()("dataviews-view-table__row",{"is-selected":c.includes(s(e)||t)})},d&&(0,l.createElement)("td",{className:"dataviews-view-table__checkbox-column",style:{width:20,minWidth:20}},(0,l.createElement)("div",{className:"dataviews-view-table__cell-content-wrapper"},(0,l.createElement)(ol,{id:s(e)||t,item:e,selection:c,onSelectionChange:u,getItemId:s,data:r,primaryField:k}))),w.map((t=>(0,l.createElement)("td",{key:t.id,style:{width:t.width||void 0,minWidth:t.minWidth||void 0,maxWidth:t.maxWidth||void 0}},(0,l.createElement)("div",{className:v()("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__primary-field":k?.id===t.id})},t.render({item:e}))))),!!a?.length&&(0,l.createElement)("td",{className:"dataviews-view-table__actions-column"},(0,l.createElement)(jo,{item:e,actions:a}))))))),(0,l.createElement)("div",{className:v()({"dataviews-loading":i,"dataviews-no-results":!S&&!i}),id:_},!S&&(0,l.createElement)("p",null,i?(0,b.__)("Loading…"):(0,b.__)("No results"))))};const cl=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}));const ul="enumeration",dl="in",ml="notIn",pl={[dl]:{key:"in-filter",label:(0,b.__)("Is")},[ml]:{key:"not-in-filter",label:(0,b.__)("Is not")}},hl={asc:{label:(0,b.__)("Sort ascending")},desc:{label:(0,b.__)("Sort descending")}},fl="table",gl="list",yl=[{type:fl,label:(0,b.__)("Table"),component:ll,icon:Io},{type:"grid",label:(0,b.__)("Grid"),component:function({data:e,fields:t,view:n,actions:a,getItemId:r,deferredRendering:s}){const i=t.find((e=>e.id===n.layout.mediaField)),o=t.find((e=>e.id===n.layout.primaryField)),c=t.filter((e=>!n.hiddenFields.includes(e.id)&&![n.layout.mediaField,n.layout.primaryField].includes(e.id))),u=(0,se.useAsyncList)(e,{step:3}),d=s?u:e;return(0,l.createElement)(_.__experimentalGrid,{gap:6,columns:2,alignment:"top",className:"dataviews-view-grid"},d.map((e=>(0,l.createElement)(_.__experimentalVStack,{spacing:0,key:r(e),className:"dataviews-view-grid__card"},(0,l.createElement)("div",{className:"dataviews-view-grid__media"},i?.render({item:e})),(0,l.createElement)(_.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions"},(0,l.createElement)(_.__experimentalHStack,{className:"dataviews-view-grid__primary-field"},o?.render({item:e})),(0,l.createElement)(jo,{item:e,actions:a,isCompact:!0})),(0,l.createElement)(_.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:3},c.map((t=>{const n=t.render({item:e});return n?(0,l.createElement)(_.__experimentalVStack,{className:"dataviews-view-grid__field",key:t.id,spacing:1},(0,l.createElement)(_.Tooltip,{text:t.header,placement:"left"},(0,l.createElement)("div",{className:"dataviews-view-grid__field-value"},n))):null})))))))},icon:zr},{type:gl,label:(0,b.__)("List"),component:function({view:e,fields:t,data:n,isLoading:a,getItemId:r,onSelectionChange:s,onDetailsChange:i,selection:o,deferredRendering:c}){const u=(0,se.useAsyncList)(n,{step:3}),d=c?u:n,m=t.find((t=>t.id===e.layout.mediaField)),p=t.find((t=>t.id===e.layout.primaryField)),h=t.filter((t=>!e.hiddenFields.includes(t.id)&&![e.layout.primaryField,e.layout.mediaField].includes(t.id))),f=e=>t=>{const{keyCode:n}=t;[wa.ENTER,wa.SPACE].includes(n)&&s([e])},g=d?.length;return g?(0,l.createElement)("ul",{className:"dataviews-view-list"},d.map((e=>(0,l.createElement)("li",{key:r(e),className:v()({"is-selected":o.includes(e.id)})},(0,l.createElement)(_.__experimentalHStack,{className:"dataviews-view-list__item-wrapper"},(0,l.createElement)("div",{role:"button",tabIndex:0,"aria-pressed":o.includes(e.id),onKeyDown:f(e),className:"dataviews-view-list__item",onClick:()=>s([e])},(0,l.createElement)(_.__experimentalHStack,{spacing:3,justify:"start"},(0,l.createElement)("div",{className:"dataviews-view-list__media-wrapper"},m?.render({item:e})||(0,l.createElement)("div",{className:"dataviews-view-list__media-placeholder"})),(0,l.createElement)(_.__experimentalVStack,{spacing:1},(0,l.createElement)("span",{className:"dataviews-view-list__primary-field"},p?.render({item:e})),(0,l.createElement)("div",{className:"dataviews-view-list__fields"},h.map((t=>(0,l.createElement)("span",{key:t.id,className:"dataviews-view-list__field"},t.render({item:e})))))))),i&&(0,l.createElement)(_.Button,{className:"dataviews-view-list__details-button",onClick:()=>i([e]),icon:cl,label:(0,b.__)("View details"),size:"compact"})))))):(0,l.createElement)("div",{className:v()({"dataviews-loading":a,"dataviews-no-results":!g&&!a})},!g&&(0,l.createElement)("p",null,a?(0,b.__)("Loading…"):(0,b.__)("No results")))},icon:(0,b.isRTL)()?Mo:Ao}],{useLocation:vl}=Ke(ft.privateApis);function _l({title:e,slug:t,customViewId:n,type:a,icon:r,isActive:s,isCustom:i,suffix:o}){const{params:{path:c,layout:u}}=vl(),d=r||yl.find((e=>e.type===a)).icon,m=Et({path:c,layout:u,activeView:"true"===i?n:t,isCustom:i});return(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start",className:v()("edit-site-sidebar-dataviews-dataview-item",{"is-selected":s})},(0,l.createElement)(va,{icon:d,...m,"aria-current":s?"true":void 0},e),o)}const bl=[];function El({template:e,isActive:t}){const{text:n,icon:a}=Ls(e.type,e.id);return(0,l.createElement)(_l,{key:n,slug:n,title:n,icon:a,isActive:t,isCustom:"false"})}function wl({activeView:e,postType:t,config:n}){const{records:a}=(0,ge.useEntityRecords)("postType",t,{per_page:-1}),r=(0,f.useMemo)((()=>{var e;const t=a?.reduce(((e,t)=>{const n=t.author_text;return n&&!e[n]&&(e[n]=t),e}),{});return null!==(e=t&&Object.values(t))&&void 0!==e?e:bl}),[a]);return(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(_l,{slug:"all",title:n[t].title,icon:la,isActive:"all"===e,isCustom:"false"}),r.map((t=>(0,l.createElement)(El,{key:t.author_text,template:t,isActive:e===t.author_text}))))}const xl={[Ct]:{title:(0,b.__)("All templates"),description:(0,b.__)("Create new templates, or reset any customizations made to the templates supplied by your theme.")},[kt]:{title:(0,b.__)("All template parts"),description:(0,b.__)("Create new template parts, or reset any customizations made to the template parts supplied by your theme."),backPath:"/patterns"}},{useLocation:Sl}=Ke(ft.privateApis);function Cl(){const{params:{postType:e}}=(0,_.__experimentalUseNavigator)(),{params:{didAccessPatternsPage:t,activeView:n="all"}}=Sl(),a=(0,d.useSelect)((e=>!!e(ta).getSettings().supportsTemplatePartsMode),[]);return(0,l.createElement)(ha,{isRoot:a&&!t,title:xl[e].title,description:xl[e].description,backPath:xl[e].backPath,content:(0,l.createElement)(wl,{activeView:n,postType:e,config:xl})})}function kl({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,defaultLabel:a,icon:r,__next40pxDefaultSize:s=!1}){const{isDirty:i,isSaving:o,isSaveViewOpen:c,previewingThemeName:u}=(0,d.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n,isResolving:a}=e(ge.store),r=t(),{isSaveViewOpened:s}=e(ta),i=a("activateTheme"),o=vt();return{isDirty:r.length>0,isSaving:r.some((e=>n(e.kind,e.name,e.key)))||i,isSaveViewOpen:s(),previewingThemeName:o?e(ge.store).getTheme(o)?.name?.rendered:void 0}}),[]),{setIsSaveViewOpened:m}=(0,d.useDispatch)(ta),p=yt()||i,h=o||!p,f=yt()?o?(0,b.sprintf)((0,b.__)("Activating %s"),u):h?(0,b.__)("Saved"):i?(0,b.sprintf)((0,b.__)("Activate %s & Save"),u):(0,b.sprintf)((0,b.__)("Activate %s"),u):o?(0,b.__)("Saving"):h?(0,b.__)("Saved"):a||(0,b.__)("Save");return(0,l.createElement)(_.Button,{variant:t,className:e,"aria-disabled":h,"aria-expanded":c,isBusy:o,onClick:h?void 0:()=>m(!0),label:f,shortcut:h?void 0:wa.displayShortcut.primary("s"),showTooltip:n,icon:r,__next40pxDefaultSize:s,size:"compact"},f)}const{useLocation:Tl}=Ke(ft.privateApis),Pl=[{kind:"postType",name:St}];function Il(){const e="site-edit-save-notice",{params:t}=Tl(),{__unstableMarkLastChangeAsPersistent:n}=(0,d.useDispatch)(he.store),{createSuccessNotice:a,createErrorNotice:r,removeNotice:s}=(0,d.useDispatch)(fe.store),{dirtyCurrentEntity:i,countUnsavedChanges:o,isDirty:c,isSaving:u}=(0,d.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:n,isSavingEntityRecord:a}=e(ge.store),r=n();let s=null;return 1===r.length&&(t.path?.includes("wp_global_styles")?s=r.find((e=>"globalStyles"===e.name)):t.postId&&(s=r.find((e=>e.name===t.postType&&String(e.key)===t.postId)))),{dirtyCurrentEntity:s,isDirty:r.length>0,isSaving:r.some((e=>a(e.kind,e.name,e.key))),countUnsavedChanges:r.length}}),[t.path,t.postType,t.postId]),{editEntityRecord:m,saveEditedEntityRecord:p,__experimentalSaveSpecifiedEntityEdits:h}=(0,d.useDispatch)(ge.store),f=u||!c&&!yt();let g=i?(0,b.__)("Save"):(0,b.sprintf)((0,b._n)("Review %d change…","Review %d changes…",o),o);u&&(g=(0,b.__)("Saving"));const{homeUrl:y}=(0,d.useSelect)((e=>{const{getUnstableBase:t}=e(ge.store);return{homeUrl:t()?.home}}),[]);return(0,l.createElement)(_.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4},i?(0,l.createElement)(_.Button,{variant:"primary",onClick:async()=>{if(!i)return;s(e);const{kind:t,name:o,key:l,property:c}=i;try{"root"===i.kind&&"site"===o?await h("root","site",void 0,[c]):(Pl.some((e=>e.kind===t&&e.name===o))&&m(t,o,l,{status:"publish"}),await p(t,o,l)),n(),a((0,b.__)("Site updated."),{type:"snackbar",actions:[{label:(0,b.__)("View site"),url:y}],id:e})}catch(e){r(`${(0,b.__)("Saving failed.")} ${e}`)}},isBusy:u,disabled:u,"aria-disabled":u,className:"edit-site-save-hub__button",__next40pxDefaultSize:!0},g):(0,l.createElement)(kl,{className:"edit-site-save-hub__button",variant:f?null:"primary",showTooltip:!1,icon:f&&!u?w:null,defaultLabel:g,__next40pxDefaultSize:!0}))}function Ml({onSave:e,onClose:t}){const[n,a]=(0,f.useState)(!1),[r,s]=(0,f.useState)(""),{saveEntityRecord:i}=(0,d.useDispatch)(ge.store),{createErrorNotice:o,createSuccessNotice:c}=(0,d.useDispatch)(fe.store);return(0,l.createElement)(_.Modal,{title:(0,b.__)("Draft a new page"),onRequestClose:t},(0,l.createElement)("form",{onSubmit:async function(t){if(t.preventDefault(),!n){a(!0);try{const t=await i("postType","page",{status:"draft",title:r,slug:r||(0,b.__)("No title")},{throwOnError:!0});e(t),c((0,b.sprintf)((0,b.__)('"%s" successfully created.'),t.title?.rendered||r),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the page.");o(t,{type:"snackbar"})}finally{a(!1)}}}},(0,l.createElement)(_.__experimentalVStack,{spacing:3},(0,l.createElement)(_.TextControl,{label:(0,b.__)("Page title"),onChange:s,placeholder:(0,b.__)("No title"),value:r}),(0,l.createElement)(_.__experimentalHStack,{spacing:2,justify:"end"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit",isBusy:n,"aria-disabled":n},(0,b.__)("Create draft"))))))}const{useHistory:Al}=Ke(ft.privateApis),Nl=({postType:e="page",postId:t,...n})=>{const a=Et({postType:e,postId:t},{backPath:"/page"});return(0,l.createElement)(va,{...a,...n})};function Ol(){const{records:e,isResolving:t}=(0,ge.useEntityRecords)("postType","page",{status:"any",per_page:-1}),{records:n,isResolving:a}=(0,ge.useEntityRecords)("postType",Ct,{per_page:-1}),r=n?.filter((({slug:e})=>["404","search"].includes(e))),s=n?.find((e=>"front-page"===e.slug))||n?.find((e=>"home"===e.slug))||n?.find((e=>"index"===e.slug)),i=e?.concat(r,[s]),{frontPage:o,postsPage:c}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(ge.store),n=t("root","site");return{frontPage:n?.page_on_front,postsPage:n?.page_for_posts}}),[]),u=o===c,m=e&&[...e];if(!u&&m?.length){const e=m.findIndex((e=>e.id===o)),t=m.splice(e,1);m?.splice(0,0,...t);const n=m.findIndex((e=>e.id===c)),a=m.splice(n,1);m.splice(1,0,...a)}const[p,h]=(0,f.useState)(!1),g=Al(),y=e=>{let t=oa;const a=c&&c===e?(n?.find((e=>"home"===e.slug))||n?.find((e=>"index"===e.slug)))?.id:null;switch(e){case o:t=Or;break;case c:t=Rr}return{icon:t,postType:a?Ct:"page",postId:a||e}},v=Et({path:"/pages"});return(0,l.createElement)(l.Fragment,null,p&&(0,l.createElement)(Ml,{onSave:({type:e,id:t})=>{g.push({postId:t,postType:e,canvas:"edit"}),h(!1)},onClose:()=>h(!1)}),(0,l.createElement)(ha,{title:(0,b.__)("Pages"),description:(0,b.__)("Browse and manage pages."),actions:(0,l.createElement)(ma,{icon:Zr,label:(0,b.__)("Draft a new page"),onClick:()=>h(!0)}),content:(0,l.createElement)(l.Fragment,null,(t||a)&&(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(_.__experimentalItem,null,(0,b.__)("Loading pages…"))),!(t||a)&&(0,l.createElement)(_.__experimentalItemGroup,null,!i?.length&&(0,l.createElement)(_.__experimentalItem,null,(0,b.__)("No page found")),u&&s&&(0,l.createElement)(Nl,{postType:Ct,postId:s.id,key:s.id,icon:Or,withChevron:!0},(0,l.createElement)(_.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(s.title?.rendered||(0,b.__)("(no title)")))),m?.map((({id:e,title:t})=>(0,l.createElement)(Nl,{...y(e),key:e,withChevron:!0},(0,l.createElement)(_.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(t?.rendered||(0,b.__)("(no title)")))))))),footer:(0,l.createElement)(_.__experimentalVStack,{spacing:0},r?.map((e=>(0,l.createElement)(Nl,{postType:Ct,postId:e.id,key:e.id,icon:la,withChevron:!0},(0,l.createElement)(_.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(e.title?.rendered||(0,b.__)("(no title)")))))),(0,l.createElement)(va,{className:"edit-site-sidebar-navigation-screen-pages__see-all",...v},(0,b.__)("Manage all pages")))}))}const Rl=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})),Fl={[Bt]:{primaryField:"title"},[Dt]:{mediaField:"featured-image",primaryField:"title"},[Vt]:{primaryField:"title",mediaField:"featured-image"}},Dl={type:Bt,search:"",filters:[],page:1,perPage:20,sort:{field:"date",direction:"desc"},hiddenFields:["date","featured-image"],layout:{...Fl[Vt]}},Bl={page:[{title:(0,b.__)("All"),slug:"all",view:Dl},{title:(0,b.__)("Drafts"),slug:"drafts",view:{...Dl,filters:[{field:"status",operator:zt,value:"draft"}]}},{title:(0,b.__)("Trash"),slug:"trash",icon:Rl,view:{...Dl,filters:[{field:"status",operator:zt,value:"trash"}]}}]},{useHistory:Vl,useLocation:Ll}=Ke(ft.privateApis);function zl({type:e,setIsAdding:t}){const{params:{path:n}}=Ll(),a=Vl(),{saveEntityRecord:r}=(0,d.useDispatch)(ge.store),[s,i]=(0,f.useState)(""),[o,c]=(0,f.useState)(!1);return(0,l.createElement)("form",{onSubmit:async i=>{i.preventDefault(),c(!0);const{getEntityRecords:o}=(0,d.resolveSelect)(ge.store);let l;const u=await o("taxonomy","wp_dataviews_type",{slug:e});if(u&&u.length>0)l=u[0].id;else{const t=await r("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(l=t.id)}const m=await r("postType","wp_dataviews",{title:s,status:"publish",wp_dataviews_type:l,content:JSON.stringify(Bl[e][0].view)});a.push({path:n,activeView:m.id,isCustom:"true"}),c(!1),t(!1)}},(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:s,onChange:i,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:()=>{t(!1)}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit","aria-disabled":!s||o,isBusy:o},(0,b.__)("Create")))))}function Gl({type:e}){const[t,n]=(0,f.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(va,{icon:Zr,onClick:()=>{n(!0)},className:"dataviews__siderbar-content-add-new-item"},(0,b.__)("New view")),t&&(0,l.createElement)(_.Modal,{title:(0,b.__)("Add new view"),onRequestClose:()=>{n(!1)}},(0,l.createElement)(zl,{type:e,setIsAdding:n})))}const{useHistory:Hl,useLocation:Ul}=Ke(ft.privateApis),Wl=[];function jl({dataviewId:e,currentTitle:t,setIsRenaming:n}){const{editEntityRecord:a}=(0,d.useDispatch)(ge.store),[r,s]=(0,f.useState)(t);return(0,l.createElement)("form",{onSubmit:async t=>{t.preventDefault(),await a("postType","wp_dataviews",e,{title:r}),n(!1)}},(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:r,onChange:s,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:()=>{n(!1)}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit","aria-disabled":!r},(0,b.__)("Rename")))))}function Zl({dataviewId:e,isActive:t}){const{params:{path:n}}=Ul(),a=Hl(),{dataview:r}=(0,d.useSelect)((t=>{const{getEditedEntityRecord:n}=t(ge.store);return{dataview:n("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:s}=(0,d.useDispatch)(ge.store),i=(0,f.useMemo)((()=>JSON.parse(r.content).type),[r.content]),[o,c]=(0,f.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_l,{title:r.title,type:i,isActive:t,isCustom:"true",customViewId:e,suffix:(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"}},(({onClose:e})=>(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{onClick:()=>{c(!0),e()}},(0,b.__)("Rename")),(0,l.createElement)(_.MenuItem,{onClick:async()=>{await s("postType","wp_dataviews",r.id,{force:!0}),t&&a.replace({path:n}),e()},isDestructive:!0},(0,b.__)("Delete")))))}),o&&(0,l.createElement)(_.Modal,{title:(0,b.__)("Rename view"),onRequestClose:()=>{c(!1)}},(0,l.createElement)(jl,{dataviewId:e,setIsRenaming:c,currentTitle:r.title})))}function ql({type:e,activeView:t,isCustom:n}){const a=function(e){return(0,d.useSelect)((t=>{const{getEntityRecords:n}=t(ge.store),a=n("taxonomy","wp_dataviews_type",{slug:e});if(!a||0===a.length)return Wl;return n("postType","wp_dataviews",{wp_dataviews_type:a[0].id,orderby:"date",order:"asc"})||Wl}))}(e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header"},(0,l.createElement)(_.__experimentalHeading,{level:2},(0,b.__)("Custom Views"))),(0,l.createElement)(_.__experimentalItemGroup,null,a.map((e=>(0,l.createElement)(Zl,{key:e.id,dataviewId:e.id,isActive:"true"===n&&Number(t)===e.id}))),(0,l.createElement)(Gl,{type:e})))}const{useLocation:Yl}=Ke(ft.privateApis),Kl={"/pages":"page"};function Xl(){const{params:{path:e,activeView:t="all",isCustom:n="false"}}=Yl();if(!e||!Kl[e])return null;const a=Kl[e];return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalItemGroup,null,Bl[a].map((e=>(0,l.createElement)(_l,{key:e.slug,slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:"false"===n&&e.slug===t,isCustom:"false"})))),window?.__experimentalAdminViews&&(0,l.createElement)(ql,{activeView:t,type:a,isCustom:"true"}))}const Jl=({postType:e="page",postId:t,...n})=>{const a=Et({postType:e,postId:t},{backPath:"/page"});return(0,l.createElement)(va,{...a,...n})};function Ql(){const{records:e}=(0,ge.useEntityRecords)("postType",Ct,{per_page:-1}),{frontPage:t,postsPage:n}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(ge.store),n=t("root","site");return{frontPage:n?.page_on_front,postsPage:n?.page_for_posts}}),[]),a=(0,f.useMemo)((()=>{if(!e)return[];const a=t===n,r=e?.find((e=>"front-page"===e.slug))||e?.find((e=>"home"===e.slug))||e?.find((e=>"index"===e.slug));return[a?r:null,...e?.filter((({slug:e})=>["404","search"].includes(e)))].filter(Boolean)}),[e,t,n]);return(0,l.createElement)(ha,{title:(0,b.__)("Pages"),description:(0,b.__)("Browse and manage pages."),content:(0,l.createElement)(Xl,null),backPath:"/page",footer:(0,l.createElement)(_.__experimentalVStack,{spacing:0},a?.map((e=>(0,l.createElement)(Jl,{postType:Ct,postId:e.id,key:e.id,icon:la,withChevron:!0},(0,l.createElement)(_.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(e.title?.rendered||(0,b.__)("(no title)")))))))})}const $l=window.wp.dom,ec=window.wp.escapeHtml,tc=window.wp.wordcount;function nc({status:e,date:t,short:n}){const a=(0,_r.humanTimeDiff)(t);let r=e;switch(e){case"publish":r=t?(0,f.createInterpolateElement)((0,b.sprintf)((0,b.__)("Published "),a),{time:(0,l.createElement)("time",{dateTime:t})}):(0,b.__)("Published");break;case"future":const e=(0,_r.dateI18n)(n?"M j":"F j",(0,_r.getDate)(t));r=t?(0,f.createInterpolateElement)((0,b.sprintf)((0,b.__)("Scheduled: "),e),{time:(0,l.createElement)("time",{dateTime:t})}):(0,b.__)("Scheduled");break;case"draft":r=(0,b.__)("Draft");break;case"pending":r=(0,b.__)("Pending");break;case"private":r=(0,b.__)("Private");break;case"protected":r=(0,b.__)("Password protected")}return(0,l.createElement)("div",{className:v()("edit-site-sidebar-navigation-screen-page__status",{[`has-status has-${e}-status`]:!!e})},r)}const ac=189;function rc({id:e}){const{record:t}=(0,ge.useEntityRecord)("postType","page",e),{parentTitle:n,templateTitle:a,isPostsPage:r}=(0,d.useSelect)((e=>{const{getEditedPostId:n}=Ke(e(ta)),a=e(ge.store).getEntityRecord("postType",Ct,n()),r=a?.title?.rendered,s=t?.parent?e(ge.store).getEntityRecord("postType","page",t.parent,{_fields:["title"]})?.title?.rendered:null,{getEntityRecord:i}=e(ge.store),o=i("root","site");return{parentTitle:s,templateTitle:r,isPostsPage:t?.id===o?.page_for_posts}}),[t?.parent,t?.id]);return(0,l.createElement)(Sr,{spacing:5,title:(0,b.__)("Details")},function(e){if(!e)return[];const t=[{label:(0,b.__)("Status"),value:(0,l.createElement)(nc,{status:e?.password?"protected":e.status,date:e?.date,short:!0})},{label:(0,b.__)("Slug"),value:(0,l.createElement)(_.__experimentalTruncate,{numberOfLines:1},(0,gt.safeDecodeURIComponent)(e.slug||e.generated_slug))}];e?.templateTitle&&t.push({label:(0,b.__)("Template"),value:(0,en.decodeEntities)(e.templateTitle)}),e?.parentTitle&&t.push({label:(0,b.__)("Parent"),value:(0,en.decodeEntities)(e.parentTitle||(0,b.__)("(no title)"))});const n=(0,b._x)("words","Word count type. Do not translate!"),a=e?.content?.rendered?(0,tc.count)(e.content.rendered,n):0,r=Math.round(a/ac);return a&&!e?.isPostsPage&&t.push({label:(0,b.__)("Words"),value:a.toLocaleString()||(0,b.__)("Unknown")},{label:(0,b.__)("Time to read"),value:r>1?(0,b.sprintf)((0,b.__)("%s mins"),r.toLocaleString()):(0,b.__)("< 1 min")}),t}({parentTitle:n,templateTitle:a,isPostsPage:r,...t}).map((({label:e,value:t})=>(0,l.createElement)(wr,{key:e},(0,l.createElement)(Er,null,e),(0,l.createElement)(xr,null,t)))))}function sc({postId:e,onRemove:t}){const{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(fe.store),{deleteEntityRecord:r}=(0,d.useDispatch)(ge.store),s=(0,d.useSelect)((t=>t(ge.store).getEntityRecord("postType","page",e)),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{onClick:()=>async function(){try{await r("postType","page",e,{},{throwOnError:!0}),n((0,b.sprintf)((0,b.__)('"%s" moved to the Trash.'),(0,en.decodeEntities)(s.title.rendered)),{type:"snackbar",id:"edit-site-page-trashed"}),t?.()}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while moving the page to the trash.");a(t,{type:"snackbar"})}}(),isDestructive:!0,variant:"secondary"},(0,b.__)("Move to Trash")))}function ic({postId:e,toggleProps:t,onRemove:n}){return(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Actions"),toggleProps:t},(()=>(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(sc,{postId:e,onRemove:n}))))}const{useHistory:oc}=Ke(ft.privateApis);function lc({backPath:e}){const{setCanvasMode:t}=Ke((0,d.useDispatch)(ta)),n=oc(),{params:{postId:a},goTo:r}=(0,_.__experimentalUseNavigator)(),{record:s,hasResolved:i}=(0,ge.useEntityRecord)("postType","page",a),{featuredMediaAltText:o,featuredMediaSourceUrl:c}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(ge.store),n=s?.featured_media?t("postType","attachment",s?.featured_media):null;return{featuredMediaSourceUrl:n?.media_details.sizes?.medium?.source_url||n?.source_url,featuredMediaAltText:(0,ec.escapeAttribute)(n?.alt_text||n?.description?.raw||"")}}),[s]);(0,f.useEffect)((()=>{i&&!s&&n.push({path:"/page",postId:void 0,postType:void 0,canvas:"view"})}),[i,n]);const u=o?(0,en.decodeEntities)(o):(0,en.decodeEntities)(s?.title?.rendered||(0,b.__)("Featured image"));return s?(0,l.createElement)(ha,{backPath:e,title:(0,en.decodeEntities)(s?.title?.rendered||(0,b.__)("(no title)")),actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ic,{postId:a,toggleProps:{as:ma},onRemove:()=>{r("/page")}}),(0,l.createElement)(ma,{onClick:()=>t("edit"),label:(0,b.__)("Edit"),icon:ba})),meta:(0,l.createElement)(_.ExternalLink,{className:"edit-site-sidebar-navigation-screen__page-link",href:s.link},(0,gt.filterURLForDisplay)((0,gt.safeDecodeURIComponent)(s.link))),content:(0,l.createElement)(l.Fragment,null,!!c&&(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-sidebar-navigation-screen-page__featured-image-wrapper",alignment:"left",spacing:2},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-page__featured-image has-image"},(0,l.createElement)("img",{alt:u,src:c}))),!!s?.excerpt?.rendered&&(0,l.createElement)(_.__experimentalTruncate,{className:"edit-site-sidebar-navigation-screen-page__excerpt",numberOfLines:3},(0,$l.__unstableStripHTML)(s.excerpt.rendered)),(0,l.createElement)(rc,{id:a})),footer:s?.modified?(0,l.createElement)(Cr,{record:s}):null}):null}const{useLocation:cc}=Ke(ft.privateApis);function uc({className:e,...t}){return(0,l.createElement)(_.__experimentalNavigatorScreen,{className:v()("edit-site-sidebar__screen-wrapper",e),...t})}function dc(){return ji(),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(uc,{path:"/"},(0,l.createElement)(Nr,null)),(0,l.createElement)(uc,{path:"/navigation"},(0,l.createElement)(ko,null)),(0,l.createElement)(uc,{path:"/navigation/:postType/:postId"},(0,l.createElement)(bo,null)),(0,l.createElement)(uc,{path:"/wp_global_styles"},(0,l.createElement)(Ir,null)),(0,l.createElement)(uc,{path:"/page"},(0,l.createElement)(Ol,null)),(0,l.createElement)(uc,{path:"/pages"},(0,l.createElement)(Ql,null)),(0,l.createElement)(uc,{path:"/page/:postId"},(0,l.createElement)(lc,null)),(0,l.createElement)(uc,{path:"/:postType(wp_template)"},(0,l.createElement)(As,null)),(0,l.createElement)(uc,{path:"/patterns"},(0,l.createElement)(Fi,null)),(0,l.createElement)(uc,{path:"/:postType(wp_template|wp_template_part)/all"},(0,l.createElement)(Cl,null)),(0,l.createElement)(uc,{path:"/:postType(wp_template_part|wp_block)/:postId"},(0,l.createElement)(lo,null)),(0,l.createElement)(uc,{path:"/:postType(wp_template)/:postId"},(0,l.createElement)(qs,null)))}const mc=(0,f.memo)((function(){const{params:e}=cc(),t=(0,f.useRef)(Wi(e));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalNavigatorProvider,{className:"edit-site-sidebar__content",initialPath:t.current},(0,l.createElement)(dc,null)),(0,l.createElement)(Il,null))}));function pc({text:e,children:t}){const n=(0,se.useCopyToClipboard)(e);return(0,l.createElement)(_.Button,{variant:"secondary",ref:n},t)}function hc({message:e,error:t}){const n=[(0,l.createElement)(pc,{key:"copy-error",text:t.stack},(0,b.__)("Copy Error"))];return(0,l.createElement)(he.Warning,{className:"editor-error-boundary",actions:n},e)}class fc extends f.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,me.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(hc,{message:(0,b.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const gc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})),yc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})),vc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),_c=[{keyCombination:{modifier:"primary",character:"b"},description:(0,b.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,b.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,b.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,b.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,b.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,b.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,b.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,b.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,b.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,b.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function bc({keyCombination:e,forceAriaLabel:t}){const n=e.modifier?wa.displayShortcutList[e.modifier](e.character):e.character,a=e.modifier?wa.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,l.createElement)("kbd",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||a},(Array.isArray(n)?n:[n]).map(((e,t)=>"+"===e?(0,l.createElement)(f.Fragment,{key:t},e):(0,l.createElement)("kbd",{key:t,className:"edit-site-keyboard-shortcut-help-modal__shortcut-key"},e))))}function Ec({description:e,keyCombination:t,aliases:n=[],ariaLabel:a}){return(0,l.createElement)(f.Fragment,null,(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-description"},e),(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-term"},(0,l.createElement)(bc,{keyCombination:t,forceAriaLabel:a}),n.map(((e,t)=>(0,l.createElement)(bc,{keyCombination:e,forceAriaLabel:a,key:t})))))}function wc({name:e}){const{keyCombination:t,description:n,aliases:a}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:n,getShortcutDescription:a,getShortcutAliases:r}=t(na.store);return{keyCombination:n(e),aliases:r(e),description:a(e)}}),[e]);return t?(0,l.createElement)(Ec,{keyCombination:t,description:n,aliases:a}):null}const xc="edit-site/keyboard-shortcut-help",Sc=({shortcuts:e})=>(0,l.createElement)("ul",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,l.createElement)("li",{className:"edit-site-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,l.createElement)(wc,{name:e}):(0,l.createElement)(Ec,{...e}))))),Cc=({title:e,shortcuts:t,className:n})=>(0,l.createElement)("section",{className:v()("edit-site-keyboard-shortcut-help-modal__section",n)},!!e&&(0,l.createElement)("h2",{className:"edit-site-keyboard-shortcut-help-modal__section-title"},e),(0,l.createElement)(Sc,{shortcuts:t})),kc=({title:e,categoryName:t,additionalShortcuts:n=[]})=>{const a=(0,d.useSelect)((e=>e(na.store).getCategoryShortcuts(t)),[t]);return(0,l.createElement)(Cc,{title:e,shortcuts:a.concat(n)})};function Tc(){const e=(0,d.useSelect)((e=>e(W).isModalActive(xc))),{closeModal:t,openModal:n}=(0,d.useDispatch)(W),a=()=>e?t():n(xc);return(0,na.useShortcut)("core/edit-site/keyboard-shortcuts",a),e?(0,l.createElement)(_.Modal,{className:"edit-site-keyboard-shortcut-help-modal",title:(0,b.__)("Keyboard shortcuts"),onRequestClose:a},(0,l.createElement)(Cc,{className:"edit-site-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-site/keyboard-shortcuts"]}),(0,l.createElement)(kc,{title:(0,b.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(kc,{title:(0,b.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(kc,{title:(0,b.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,b.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,b.__)("Forward-slash")}]}),(0,l.createElement)(Cc,{title:(0,b.__)("Text formatting"),shortcuts:_c})):null}const{PreferencesModal:Pc}=Ke(g.privateApis),Ic="edit-site/preferences";function Mc(){const e=(0,d.useSelect)((e=>e(W).isModalActive(Ic))),{closeModal:t}=(0,d.useDispatch)(W);return e?(0,l.createElement)(Pc,{isActive:e,onClose:t}):null}const{Fill:Ac,Slot:Nc}=(0,_.createSlotFill)("EditSiteToolsMoreMenuGroup");Ac.Slot=({fillProps:e})=>(0,l.createElement)(Nc,{fillProps:e},(e=>e&&e.length>0));const Oc=Ac,Rc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})),Fc=window.wp.blob;function Dc(){const{createErrorNotice:e}=(0,d.useDispatch)(fe.store);return(0,l.createElement)(_.MenuItem,{role:"menuitem",icon:Rc,onClick:async function(){try{const e=await Xt()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),a=n[1]?n[1]:"edit-site-export";(0,Fc.downloadBlob)(a+".zip",t,"application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const a=n.message&&"unknown_error"!==n.code?n.message:(0,b.__)("An error occurred while creating the site export.");e(a,{type:"snackbar"})}},info:(0,b.__)("Download your theme with updated templates and styles.")},(0,b._x)("Export","site exporter menu item"))}function Bc(){const{toggle:e}=(0,d.useDispatch)(k.store);return(0,l.createElement)(_.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide")},(0,b.__)("Welcome Guide"))}function Vc(){const{createNotice:e}=(0,d.useDispatch)(fe.store),{getEditedPostId:t,getEditedPostType:n}=(0,d.useSelect)(ta),{getEditedEntityRecord:a}=(0,d.useSelect)(ge.store);const r=(0,se.useCopyToClipboard)((function(){const e=a("postType",n(),t());return e?"function"==typeof e.content?e.content(e):e.blocks?(0,c.__unstableSerializeAndClean)(e.blocks):e.content?e.content:void 0:""}),(function(){e("info",(0,b.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,l.createElement)(_.MenuItem,{ref:r},(0,b.__)("Copy all blocks"))}const Lc=[{value:"visual",label:(0,b.__)("Visual editor")},{value:"text",label:(0,b.__)("Code editor")}];const zc=function(){const{shortcut:e,mode:t}=(0,d.useSelect)((e=>({shortcut:e(na.store).getShortcutRepresentation("core/edit-site/toggle-mode"),mode:e(ta).getEditorMode()})),[]),{switchEditorMode:n}=(0,d.useDispatch)(ta),a=Lc.map((n=>n.value!==t?{...n,shortcut:e}:n));return(0,l.createElement)(_.MenuGroup,{label:(0,b.__)("Editor")},(0,l.createElement)(_.MenuItemsChoice,{choices:a,value:t,onSelect:n}))};function Gc({showIconLabels:e}){const t=(0,d.useRegistry)(),{closeGeneralSidebar:n}=(0,d.useDispatch)(ta),{setIsInserterOpened:a,setIsListViewOpened:r}=(0,d.useDispatch)(g.store),{openModal:s}=(0,d.useDispatch)(W),{set:i}=(0,d.useDispatch)(k.store),o=()=>{t.batch((()=>{i("core","fixedToolbar",!0),a(!1),r(!1),n()}))},c=()=>{i("core","distractionFree",!1)};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ue,{toggleProps:{showTooltip:!e,...e&&{variant:"tertiary"}}},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuGroup,{label:(0,b._x)("View","noun")},(0,l.createElement)(k.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:c,label:(0,b.__)("Top toolbar"),info:(0,b.__)("Access all block and document tools in a single place"),messageActivated:(0,b.__)("Top toolbar activated"),messageDeactivated:(0,b.__)("Top toolbar deactivated")}),(0,l.createElement)(k.PreferenceToggleMenuItem,{scope:"core",name:"distractionFree",onToggle:o,label:(0,b.__)("Distraction free"),info:(0,b.__)("Write with calmness"),messageActivated:(0,b.__)("Distraction free mode activated"),messageDeactivated:(0,b.__)("Distraction free mode deactivated"),shortcut:wa.displayShortcut.primaryShift("\\")}),(0,l.createElement)(k.PreferenceToggleMenuItem,{scope:"core",name:"focusMode",label:(0,b.__)("Spotlight mode"),info:(0,b.__)("Focus on one block at a time"),messageActivated:(0,b.__)("Spotlight mode activated"),messageDeactivated:(0,b.__)("Spotlight mode deactivated")})),(0,l.createElement)(zc,null),(0,l.createElement)(J.Slot,{name:"core/edit-site/plugin-more-menu",label:(0,b.__)("Plugins"),as:_.MenuGroup,fillProps:{onClick:e}}),(0,l.createElement)(_.MenuGroup,{label:(0,b.__)("Tools")},(0,l.createElement)(Dc,null),(0,l.createElement)(_.MenuItem,{onClick:()=>s(xc),shortcut:wa.displayShortcut.access("h")},(0,b.__)("Keyboard shortcuts")),(0,l.createElement)(Bc,null),(0,l.createElement)(Vc,null),(0,l.createElement)(_.MenuItem,{icon:vc,role:"menuitem",href:(0,b.__)("https://wordpress.org/documentation/article/site-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,b.__)("Help"),(0,l.createElement)(_.VisuallyHidden,{as:"span"},(0,b.__)("(opens in a new tab)"))),(0,l.createElement)(Oc.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{onClick:()=>s(Ic)},(0,b.__)("Preferences")))))),(0,l.createElement)(Tc,null),(0,l.createElement)(Mc,null))}const Hc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"})),{DocumentTools:Uc}=Ke(g.privateApis);function Wc({blockEditorMode:e,hasFixedToolbar:t,isDistractionFree:n}){const{isVisualMode:a}=(0,d.useSelect)((e=>{const{getEditorMode:t}=e(ta);return{isVisualMode:"visual"===t()}}),[]),{__unstableSetEditorMode:r}=(0,d.useDispatch)(he.store),{setDeviceType:s}=(0,d.useDispatch)(g.store),i=(0,se.useViewportMatch)("medium"),o=window?.__experimentalEnableZoomedOutView&&a,c="zoom-out"===e;return(0,l.createElement)(Uc,{disableBlockTools:!a,listViewLabel:(0,b.__)("List View")},o&&i&&!n&&!t&&(0,l.createElement)(_.ToolbarItem,{as:_.Button,className:"edit-site-header-edit-mode__zoom-out-view-toggle",icon:Hc,isPressed:c,label:(0,b.__)("Zoom-out View"),onClick:()=>{s("Desktop"),r(c?"edit":"zoom-out")},size:"compact"}))}const{PostViewLink:jc,PreviewDropdown:Zc}=Ke(g.privateApis);function qc(){const{templateType:e,isDistractionFree:t,blockEditorMode:n,blockSelectionStart:a,showIconLabels:r,editorCanvasView:s,hasFixedToolbar:i,isZoomOutMode:o}=(0,d.useSelect)((e=>{const{getEditedPostType:t}=e(ta),{getBlockSelectionStart:n,__unstableGetEditorMode:a}=e(he.store),{get:r}=e(k.store),{getDeviceType:s}=e(g.store);return{deviceType:s(),templateType:t(),blockEditorMode:a(),blockSelectionStart:n(),showIconLabels:r("core","showIconLabels"),editorCanvasView:Ke(e(ta)).getEditorCanvasContainerView(),hasFixedToolbar:r("core","fixedToolbar"),isDistractionFree:r("core","distractionFree"),isZoomOutMode:"zoom-out"===a()}}),[]),c=(0,se.useViewportMatch)("medium"),u=!o&&i&&c,m=(0,f.useRef)(),p=(0,se.useReducedMotion)(),h=!function(){const e=(0,_.__experimentalUseSlotFills)(Ka);return!!e?.length}(),y=Rt.includes(e),E="zoom-out"===n,[w,x]=(0,f.useState)(!0),S=!!a;(0,f.useEffect)((()=>{a&&x(!1)}),[a]);const C={isDistractionFree:{y:"-50px"},isDistractionFreeHovering:{y:0},view:{y:0},edit:{y:0}},T={type:"tween",duration:p?0:.2,ease:"easeOut"};return(0,l.createElement)("div",{className:v()("edit-site-header-edit-mode",{"show-icon-labels":r})},h&&(0,l.createElement)(_.__unstableMotion.div,{className:"edit-site-header-edit-mode__start",variants:C,transition:T},(0,l.createElement)(Wc,{blockEditorMode:n,isDistractionFree:t}),u&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:v()("selected-block-tools-wrapper",{"is-collapsed":w})},(0,l.createElement)(he.BlockToolbar,{hideDragHandle:!0})),(0,l.createElement)(_.Popover.Slot,{ref:m,name:"block-toolbar"}),S&&(0,l.createElement)(_.Button,{className:"edit-site-header-edit-mode__block-tools-toggle",icon:w?gc:yc,onClick:()=>{x((e=>!e))},label:w?(0,b.__)("Show block tools"):(0,b.__)("Hide block tools")}))),!t&&(0,l.createElement)("div",{className:v()("edit-site-header-edit-mode__center",{"is-collapsed":!w&&c})},h?(0,l.createElement)(g.DocumentBar,null):qa(s)),(0,l.createElement)("div",{className:"edit-site-header-edit-mode__end"},(0,l.createElement)(_.__unstableMotion.div,{className:"edit-site-header-edit-mode__actions",variants:C,transition:T},c&&(0,l.createElement)("div",{className:v()("edit-site-header-edit-mode__preview-options",{"is-zoomed-out":E})},(0,l.createElement)(Zc,{disabled:y||!h})),(0,l.createElement)(jc,null),(0,l.createElement)(kl,null),!t&&(0,l.createElement)(te.Slot,{scope:"core/edit-site"}),(0,l.createElement)(Gc,{showIconLabels:r}))))}const Yc=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,l.createElement)(E.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));const Kc=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(ge.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,l.createElement)("div",{className:"edit-site-site-icon__image"});const a=n?(0,l.createElement)("img",{className:"edit-site-site-icon__image",alt:(0,b.__)("Site Icon"),src:n}):(0,l.createElement)(_.Icon,{className:"edit-site-site-icon__icon",size:"48px",icon:Yc});return(0,l.createElement)("div",{className:v()(e,"edit-site-site-icon")},a)},Xc=(0,f.memo)((({isTransparent:e,className:t})=>{const{canvasMode:n,dashboardLink:a,homeUrl:r,siteTitle:s}=(0,d.useSelect)((e=>{const{getCanvasMode:t,getSettings:n}=Ke(e(ta)),{getSite:a,getUnstableBase:r}=e(ge.store);return{canvasMode:t(),dashboardLink:n().__experimentalDashboardLink||"index.php",homeUrl:r()?.home,siteTitle:a()?.title}}),[]),{open:i}=(0,d.useDispatch)(aa.store),o=(0,se.useReducedMotion)(),{setCanvasMode:c}=Ke((0,d.useDispatch)(ta)),{clearSelectedBlock:u}=(0,d.useDispatch)(he.store),{setDeviceType:m}=(0,d.useDispatch)(g.store),p="view"===n?{href:a,label:(0,b.__)("Go to the Dashboard")}:{href:a,role:"button",label:(0,b.__)("Open Navigation"),onClick:e=>{e.preventDefault(),"edit"===n&&(u(),m("Desktop"),c("view"))}};return(0,l.createElement)(_.__unstableMotion.div,{className:v()("edit-site-site-hub",t),variants:{isDistractionFree:{x:"-100%"},isDistractionFreeHovering:{x:0},view:{x:0},edit:{x:0}},initial:!1,transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between",alignment:"center",className:"edit-site-site-hub__container"},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start",className:"edit-site-site-hub__text-content",spacing:"0"},(0,l.createElement)(_.__unstableMotion.div,{className:v()("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),layout:!0,transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(_.Button,{...p,className:"edit-site-layout__view-mode-toggle"},(0,l.createElement)(_.__unstableMotion.div,{initial:!1,animate:{scale:"view"===n?.5:1},whileHover:{scale:"view"===n?.5:.96},transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(Kc,{className:"edit-site-layout__view-mode-toggle-icon"})))),(0,l.createElement)(_.__unstableAnimatePresence,null,(0,l.createElement)(_.__unstableMotion.div,{layout:"edit"===n,animate:{opacity:"view"===n?1:0},exit:{opacity:0},className:v()("edit-site-site-hub__site-title",{"is-transparent":e}),transition:{type:"tween",duration:o?0:.2,ease:"easeOut",delay:"view"===n?.1:0}},(0,en.decodeEntities)(s))),"view"===n&&(0,l.createElement)(_.Button,{href:r,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),"aria-label":(0,b.__)("View site (opens in a new tab)"),icon:vc,className:v()("edit-site-site-hub__site-view-link",{"is-transparent":e})})),"view"===n&&(0,l.createElement)(_.Button,{className:v()("edit-site-site-hub_toggle-command-center",{"is-transparent":e}),icon:Br,onClick:()=>i(),label:(0,b.__)("Open command palette"),shortcut:wa.displayShortcut.primary("k")})))})),Jc=Xc,Qc={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},$c=320,eu=1300,tu=9/19.5,nu={width:"100%",height:"100%"};function au(e,t){const n=1-Math.max(0,Math.min(1,(e-$c)/(eu-$c))),a=((e,t,n)=>e+(t-e)*n)(t,tu,n);return e/a}const ru=function e({isFullWidth:t,isOversized:n,setIsOversized:a,isReady:r,children:s,defaultSize:i,innerContentStyle:o}){const[c,u]=(0,f.useState)(nu),[m,p]=(0,f.useState)(),[h,g]=(0,f.useState)(!1),[y,E]=(0,f.useState)(!1),[w,x]=(0,f.useState)(1),S=(0,d.useSelect)((e=>Ke(e(ta)).getCanvasMode()),[]),{setCanvasMode:C}=Ke((0,d.useDispatch)(ta)),k={type:"tween",duration:h?0:.5},T=(0,f.useRef)(null),P=(0,se.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),I=i.width/i.height,M={default:{flexGrow:0,height:c.height},fullWidth:{flexGrow:1,height:c.height}},A=h?"active":y?"visible":"hidden";return(0,l.createElement)(_.ResizableBox,{as:_.__unstableMotion.div,ref:T,initial:!1,variants:M,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&u({width:"100%",height:"100%"})},transition:k,size:c,enable:{top:!1,right:!1,bottom:!1,left:r,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:w,handleClasses:void 0,handleStyles:{left:Qc,right:Qc},minWidth:$c,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>E(!0),onBlur:()=>E(!1),onMouseOver:()=>E(!0),onMouseOut:()=>E(!1),handleComponent:{left:"view"===S&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.Tooltip,{text:(0,b.__)("Drag to resize")},(0,l.createElement)(_.__unstableMotion.button,{key:"handle",role:"separator","aria-orientation":"vertical",className:v()("edit-site-resizable-frame__handle",{"is-resizing":h}),variants:{hidden:{opacity:0,left:0},visible:{opacity:1,left:-16},active:{opacity:1,left:-16,scaleY:1.3}},animate:A,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":P,"aria-valuenow":T.current?.resizable?.offsetWidth||void 0,"aria-valuemin":$c,"aria-valuemax":i.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1),n=Math.min(Math.max($c,T.current.resizable.offsetWidth+t),i.width);u({width:n,height:au(n,I)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"})),(0,l.createElement)("div",{hidden:!0,id:P},(0,b.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")))},onResizeStart:(e,t,n)=>{p(n.offsetWidth),g(!0)},onResize:(e,t,r,s)=>{const o=s.width/w,l=Math.abs(o),c=s.width<0?l:(i.width-m)/2,d=Math.min(l,c),p=0===l?0:d/l;x(1-p+2*p);const h=m+s.width;a(h>i.width),u({height:n?"100%":au(h,I)})},onResizeStop:(e,t,r)=>{if(g(!1),!n)return;a(!1);r.ownerDocument.documentElement.offsetWidth-r.offsetWidth>200?u(nu):C("edit")},className:v()("edit-site-resizable-frame__inner",{"is-resizing":h})},(0,l.createElement)(_.__unstableMotion.div,{className:"edit-site-resizable-frame__inner-content",animate:{borderRadius:t?0:8},transition:k,style:o},s))},{useLocation:su,useHistory:iu}=Ke(ft.privateApis);const{useHistory:ou,useLocation:lu}=Ke(ft.privateApis);const{EntitiesSavedStatesExtensible:cu}=Ke(g.privateApis),uu=({onClose:e})=>{var t,n;const a=(0,g.useEntitiesSavedStatesIsDirty)();let r;r=a.isDirty?(0,b.__)("Activate & Save"):(0,b.__)("Activate");const s=function(){const[e,t]=(0,f.useState)();return(0,f.useEffect)((()=>{const e=(0,gt.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});Xt()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),i=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme()),[]),o=(0,l.createElement)("p",null,(0,b.sprintf)((0,b.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(t=s?.name?.rendered)&&void 0!==t?t:"...",null!==(n=i?.name?.rendered)&&void 0!==n?n:"...")),c=function(){const e=ou(),t=lu(),{startResolution:n,finishResolution:a}=(0,d.useDispatch)(ge.store);return async()=>{if(yt()){const r="themes.php?action=activate&stylesheet="+vt()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;n("activateTheme"),await window.fetch(r),a("activateTheme");const{wp_theme_preview:s,...i}=t.params;e.replace(i)}}}();return(0,l.createElement)(cu,{...a,additionalPrompt:o,close:e,onSave:async e=>(await c(),e),saveEnabled:!0,saveLabel:r})},du=({onClose:e})=>yt()?(0,l.createElement)(uu,{onClose:e}):(0,l.createElement)(g.EntitiesSavedStates,{close:e});function mu(){const{isSaveViewOpen:e,canvasMode:t}=(0,d.useSelect)((e=>{const{isSaveViewOpened:t,getCanvasMode:n}=Ke(e(ta));return{isSaveViewOpen:t(),canvasMode:n()}}),[]),{setIsSaveViewOpened:n}=(0,d.useDispatch)(ta),a=()=>n(!1);return"view"===t?e?(0,l.createElement)(_.Modal,{className:"edit-site-save-panel__modal",onRequestClose:a,__experimentalHideHeader:!0,contentLabel:(0,b.__)("Save site, content, and template changes")},(0,l.createElement)(du,{onClose:a})):null:(0,l.createElement)(ie,{className:v()("edit-site-layout__actions",{"is-entity-save-view-open":e}),ariaLabel:(0,b.__)("Save panel")},e?(0,l.createElement)(du,{onClose:a}):(0,l.createElement)("div",{className:"edit-site-editor__toggle-save-panel"},(0,l.createElement)(_.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>n(!0),"aria-expanded":!1},(0,b.__)("Open save panel"))))}const pu=function(){const{registerShortcut:e}=(0,d.useDispatch)(na.store);return(0,f.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-site/toggle-block-settings-sidebar",category:"global",description:(0,b.__)("Show or hide the Settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/edit-site/keyboard-shortcuts",category:"main",description:(0,b.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-site/next-region",category:"global",description:(0,b.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-site/previous-region",category:"global",description:(0,b.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-site/toggle-mode",category:"global",description:(0,b.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/edit-site/transform-heading-to-paragraph",category:"block-library",description:(0,b.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-site/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,b.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})})),e({name:"core/edit-site/toggle-distraction-free",category:"global",description:(0,b.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}})}),[e]),null};const hu=function(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,d.useSelect)(ge.store),{setIsSaveViewOpened:n}=(0,d.useDispatch)(ta);return(0,na.useShortcut)("core/edit-site/save",(a=>{a.preventDefault();const r=e(),s=!!r.length;!r.some((e=>t(e.kind,e.name,e.key)))&&s&&n(!0)})),null},fu=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})),gu=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})),yu=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"})),vu=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"}));function _u({path:e,categoryType:t,categoryId:n},a){return["/wp_template/all","/wp_template_part/all","/pages"].includes(e)||"/patterns"===e&&(!a||!!t&&!!n)}const{useGlobalStylesReset:bu}=Ke(he.privateApis),{useHistory:Eu,useLocation:wu}=Ke(ft.privateApis);function xu(){const{openGeneralSidebar:e,setCanvasMode:t}=Ke((0,d.useDispatch)(ta)),{params:n}=wu(),a=!_u(n,(0,se.useViewportMatch)("medium","<")),{getCanvasMode:r}=Ke((0,d.useSelect)(ta)),s=Eu(),i=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,f.useMemo)((()=>i?[{name:"core/edit-site/open-styles",label:(0,b.__)("Open styles"),callback:({close:n})=>{n(),a||s.push({path:"/wp_global_styles",canvas:"edit"}),a&&"edit"!==r()&&t("edit"),e("edit-site/global-styles")},icon:ia}]:[]),[s,e,t,a,r,i])}}function Su(){const{openGeneralSidebar:e,setCanvasMode:t}=Ke((0,d.useDispatch)(ta)),{params:n}=wu(),a=!_u(n,(0,se.useViewportMatch)("medium","<")),{getCanvasMode:r}=Ke((0,d.useSelect)(ta)),{set:s}=(0,d.useDispatch)(k.store),i=Eu(),o=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,f.useMemo)((()=>o?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,b.__)("Learn about styles"),callback:({close:n})=>{n(),a||i.push({path:"/wp_global_styles",canvas:"edit"}),a&&"edit"!==r()&&t("edit"),e("edit-site/global-styles"),s("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{s("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:fu}]:[]),[i,e,t,a,r,o,s])}}function Cu(){const[e,t]=bu();return{isLoading:!1,commands:(0,f.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,b.__)("Reset styles"),icon:(0,b.isRTL)()?gu:yu,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}}function ku(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=Ke((0,d.useDispatch)(ta)),{params:a}=wu(),r=!_u(a,(0,se.useViewportMatch)("medium","<")),s=Eu(),{canEditCSS:i}=(0,d.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ge.store),a=n(),r=a?t("root","globalStyles",a):void 0;return{canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]),{getCanvasMode:o}=Ke((0,d.useSelect)(ta));return{isLoading:!1,commands:(0,f.useMemo)((()=>i?[{name:"core/edit-site/open-styles-css",label:(0,b.__)("Customize CSS"),icon:vu,callback:({close:a})=>{a(),r||s.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==o()&&n("edit"),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[s,e,t,i,r,o,n])}}function Tu(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=Ke((0,d.useDispatch)(ta)),{getCanvasMode:a}=Ke((0,d.useSelect)(ta)),{params:r}=wu(),s=!_u(r,(0,se.useViewportMatch)("medium","<")),i=Eu(),o=(0,d.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ge.store),a=n(),r=a?t("root","globalStyles",a):void 0;return!!r?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,f.useMemo)((()=>o?[{name:"core/edit-site/open-global-styles-revisions",label:(0,b.__)("Style revisions"),icon:br,callback:({close:r})=>{r(),s||i.push({path:"/wp_global_styles",canvas:"edit"}),s&&"edit"!==a()&&n("edit"),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[o,i,e,t,s,a,n])}}const Pu=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})),Iu=(0,l.createElement)(E.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})),Mu=(0,l.createElement)(E.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})),Au=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),Nu=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"}),(0,l.createElement)(E.Path,{d:"m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"})),Ou=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})),{RenamePatternModal:Ru}=Ke(xt.privateApis);function Fu(){const{record:e}=Ds(),{closeModal:t}=(0,d.useDispatch)(W);return(0,d.useSelect)((e=>e(W).isModalActive(Lu.rename)))?(0,l.createElement)(Ru,{onClose:t,pattern:e}):null}const{DuplicatePatternModal:Du}=Ke(xt.privateApis),{useHistory:Bu}=Ke(ft.privateApis);function Vu(){const{record:e}=Ds(),{categoryType:t,categoryId:n}=(0,gt.getQueryArgs)(window.location.href),{closeModal:a}=(0,d.useDispatch)(W),r=Bu();if(!(0,d.useSelect)((e=>e(W).isModalActive(Lu.duplicate))))return null;return(0,l.createElement)(Du,{onClose:a,onSuccess:function({pattern:e}){r.push({categoryType:t,categoryId:n,postType:It.user,postId:e.id}),a()},pattern:e})}const Lu={rename:"edit-site/pattern-rename",duplicate:"edit-site/pattern-duplicate"};function zu(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Vu,null),(0,l.createElement)(Fu,null))}const{useHistory:Gu}=Ke(ft.privateApis);function Hu(){const{record:e}=Ds(),{isPage:t,canvasMode:n,templateId:a,currentPostType:r}=(0,d.useSelect)((e=>{const{isPage:t,getCanvasMode:n}=Ke(e(ta)),{getCurrentPostType:a,getCurrentTemplateId:r}=e(g.store);return{isPage:t(),canvasMode:n(),templateId:r(),currentPostType:a()}}),[]),{onClick:s}=Et({postType:"wp_template",postId:a}),{setRenderingMode:i}=(0,d.useDispatch)(g.store);if(!t||"edit"!==n)return{isLoading:!1,commands:[]};const o=[];return"wp_template"!==r?o.push({name:"core/switch-to-template-focus",label:(0,b.sprintf)("Edit template: %s",(0,en.decodeEntities)(e.title)),icon:la,callback:({close:e})=>{s(),e()}}):o.push({name:"core/switch-to-page-focus",label:(0,b.__)("Back to page"),icon:oa,callback:({close:e})=>{i("template-locked"),e()}}),{isLoading:!1,commands:o}}function Uu(){const{switchEditorMode:e}=(0,d.useDispatch)(ta),{canvasMode:t,editorMode:n}=(0,d.useSelect)((e=>({canvasMode:Ke(e(ta)).getCanvasMode(),editorMode:e(ta).getEditorMode()})),[]);if("edit"!==t||"text"!==n)return{isLoading:!1,commands:[]};const a=[];return"text"===n&&a.push({name:"core/exit-code-editor",label:(0,b.__)("Exit code editor"),icon:Pu,callback:({close:t})=>{e("visual"),t()}}),{isLoading:!1,commands:a}}function Wu(){const{isLoaded:e,record:t}=Ds(),{removeTemplate:n,revertTemplate:a}=(0,d.useDispatch)(ta),r=Gu(),s=(0,d.useSelect)((e=>e(ta).isPage()&&"wp_template"!==e(g.store).getCurrentPostType()),[]);if(!e)return{isLoading:!0,commands:[]};const i=[];if($t(t)&&!s){const e=t.type===Ct?(0,b.sprintf)("Reset template: %s",(0,en.decodeEntities)(t.title)):(0,b.sprintf)("Reset template part: %s",(0,en.decodeEntities)(t.title));i.push({name:"core/reset-template",label:e,icon:(0,b.isRTL)()?gu:yu,callback:({close:e})=>{a(t),e()}})}if(Gs(t)&&!s){const e=t.type===Ct?(0,b.sprintf)("Delete template: %s",(0,en.decodeEntities)(t.title)):(0,b.sprintf)("Delete template part: %s",(0,en.decodeEntities)(t.title)),a=t.type===Ct?"/wp_template":"/wp_template_part/all";i.push({name:"core/remove-template",label:e,icon:Rl,callback:({close:e})=>{n(t),r.push({path:a}),e()}})}return{isLoading:!e,commands:i}}function ju(){const{openGeneralSidebar:e,closeGeneralSidebar:t,toggleDistractionFree:n,setIsListViewOpened:a,switchEditorMode:r}=(0,d.useDispatch)(ta),{canvasMode:s,editorMode:i,activeSidebar:o,showBlockBreadcrumbs:l,isListViewOpen:c,isDistractionFree:u,isTopToolbar:m,isFocusMode:p}=(0,d.useSelect)((e=>{const{get:t}=e(k.store),{getEditorMode:n}=e(ta),{isListViewOpened:a}=e(g.store);return{canvasMode:Ke(e(ta)).getCanvasMode(),editorMode:n(),activeSidebar:e(W).getActiveComplementaryArea(ta.name),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),isListViewOpen:a(),isDistractionFree:t("core","distractionFree"),isFocusMode:t("core","focusMode"),isTopToolbar:t("core","fixedToolbar")}}),[]),{openModal:h}=(0,d.useDispatch)(W),{toggle:f}=(0,d.useDispatch)(k.store),{createInfoNotice:y}=(0,d.useDispatch)(fe.store);if("edit"!==s)return{isLoading:!1,commands:[]};const v=[];return v.push({name:"core/open-settings-sidebar",label:(0,b.__)("Toggle settings sidebar"),icon:(0,b.isRTL)()?Iu:Mu,callback:({close:n})=>{n(),"edit-site/template"===o?t():e("edit-site/template")}}),v.push({name:"core/open-block-inspector",label:(0,b.__)("Toggle block inspector"),icon:Au,callback:({close:n})=>{n(),"edit-site/block-inspector"===o?t():e("edit-site/block-inspector")}}),v.push({name:"core/toggle-spotlight-mode",label:(0,b.__)("Toggle spotlight"),callback:({close:e})=>{f("core","focusMode"),e(),y(p?(0,b.__)("Spotlight off."):(0,b.__)("Spotlight on."),{id:"core/edit-site/toggle-spotlight-mode/notice",type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick:()=>{f("core","focusMode")}}]})}}),v.push({name:"core/toggle-distraction-free",label:u?(0,b.__)("Exit Distraction Free"):(0,b.__)("Enter Distraction Free "),callback:({close:e})=>{n(),e()}}),v.push({name:"core/toggle-top-toolbar",label:(0,b.__)("Toggle top toolbar"),callback:({close:e})=>{f("core","fixedToolbar"),u&&n(),e(),y(m?(0,b.__)("Top toolbar off."):(0,b.__)("Top toolbar on."),{id:"core/edit-site/toggle-top-toolbar/notice",type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick:()=>{f("core","fixedToolbar")}}]})}}),"visual"===i&&v.push({name:"core/toggle-code-editor",label:(0,b.__)("Open code editor"),icon:Pu,callback:({close:e})=>{r("text"),e()}}),v.push({name:"core/open-preferences",label:(0,b.__)("Editor preferences"),callback:()=>{h(Ic)}}),v.push({name:"core/open-shortcut-help",label:(0,b.__)("Keyboard shortcuts"),icon:Nu,callback:()=>{h(xc)}}),v.push({name:"core/toggle-breadcrumbs",label:l?(0,b.__)("Hide block breadcrumbs"):(0,b.__)("Show block breadcrumbs"),callback:({close:e})=>{f("core","showBlockBreadcrumbs"),e(),y(l?(0,b.__)("Breadcrumbs hidden."):(0,b.__)("Breadcrumbs visible."),{id:"core/edit-site/toggle-breadcrumbs/notice",type:"snackbar"})}}),v.push({name:"core/toggle-list-view",label:c?(0,b.__)("Close List View"):(0,b.__)("Open List View"),icon:Ou,callback:({close:e})=>{a(!c),e(),y(c?(0,b.__)("List View off."):(0,b.__)("List View on."),{id:"core/edit-site/toggle-list-view/notice",type:"snackbar"})}}),{isLoading:!1,commands:v}}function Zu(){const{isLoaded:e,record:t}=Ds(),{openModal:n}=(0,d.useDispatch)(W);if(!e)return{isLoading:!0,commands:[]};const a=[];return"wp_block"===t?.type&&(a.push({name:"core/rename-pattern",label:(0,b.__)("Rename pattern"),icon:Ea,callback:({close:e})=>{n(Lu.rename),e()}}),a.push({name:"core/duplicate-pattern",label:(0,b.__)("Duplicate pattern"),icon:ca,callback:({close:e})=>{n(Lu.duplicate),e()}})),{isLoading:!1,commands:a}}const qu=1e4;function Yu(){const{isLoaded:e}=Ds(),[t,n]=(0,f.useState)(!1),a=(0,d.useSelect)((e=>{const n=e(ge.store).hasResolvingSelectors();return!t&&!n}),[t]);return(0,f.useEffect)((()=>{let e;return t||(e=setTimeout((()=>{n(!0)}),qu)),()=>{clearTimeout(e)}}),[t]),(0,f.useEffect)((()=>{if(a){const e=setTimeout((()=>{n(!0)}),100);return()=>{clearTimeout(e)}}}),[a]),!t||!e}function Ku({className:e,identifier:t,title:n,icon:a,children:r,closeLabel:s,header:i,headerClassName:o,panelClassName:c}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(re,{className:e,scope:"core/edit-site",identifier:t,title:n,smallScreenTitle:n,icon:a,closeLabel:s,header:i,headerClassName:o,panelClassName:c},r),(0,l.createElement)($,{scope:"core/edit-site",identifier:t,icon:a},n))}function Xu({className:e,...t}){return(0,l.createElement)(_.Icon,{className:v()(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Ju({icon:e,children:t,...n}){return(0,l.createElement)(_.__experimentalItem,{...n},e&&(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(Xu,{icon:e,size:24}),(0,l.createElement)(_.FlexItem,null,t)),!e&&t)}function Qu(e){return(0,l.createElement)(_.__experimentalNavigatorButton,{as:Ju,...e})}const $u=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"})),ed=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})),{useHasDimensionsPanel:td,useHasTypographyPanel:nd,useHasColorPanel:ad,useGlobalSetting:rd,useSettingsForBlockElement:sd}=Ke(he.privateApis);const id=function(){const[e]=rd(""),t=sd(e),n=nd(t),a=ad(t),r=td(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalItemGroup,null,n&&(0,l.createElement)(Qu,{icon:$u,path:"/typography","aria-label":(0,b.__)("Typography styles")},(0,b.__)("Typography")),a&&(0,l.createElement)(Qu,{icon:ed,path:"/colors","aria-label":(0,b.__)("Colors styles")},(0,b.__)("Colors")),r&&(0,l.createElement)(Qu,{icon:la,path:"/layout","aria-label":(0,b.__)("Layout styles")},(0,b.__)("Layout"))))},{useGlobalStyle:od}=Ke(he.privateApis);const ld=function(){const[e]=od("css"),{hasVariations:t,canEditCSS:n}=(0,d.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n,__experimentalGetCurrentThemeGlobalStylesVariations:a}=e(ge.store),r=n(),s=r?t("root","globalStyles",r):void 0;return{hasVariations:!!a()?.length,canEditCSS:!!s?._links?.["wp:action-edit-css"]}}),[]);return(0,l.createElement)(_.Card,{size:"small",className:"edit-site-global-styles-screen-root"},(0,l.createElement)(_.CardBody,null,(0,l.createElement)(_.__experimentalVStack,{spacing:4},(0,l.createElement)(_.Card,null,(0,l.createElement)(_.CardMedia,null,(0,l.createElement)(Va,null))),t&&(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(Qu,{path:"/variations","aria-label":(0,b.__)("Browse styles")},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(_.FlexItem,null,(0,b.__)("Browse styles")),(0,l.createElement)(Xu,{icon:(0,b.isRTL)()?da:ua})))),(0,l.createElement)(id,null))),(0,l.createElement)(_.CardDivider,null),(0,l.createElement)(_.CardBody,null,(0,l.createElement)(_.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,b.__)("Customize the appearance of specific blocks for the whole site.")),(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(Qu,{path:"/blocks","aria-label":(0,b.__)("Blocks styles")},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(_.FlexItem,null,(0,b.__)("Blocks")),(0,l.createElement)(Xu,{icon:(0,b.isRTL)()?da:ua}))))),n&&!!e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.CardDivider,null),(0,l.createElement)(_.CardBody,null,(0,l.createElement)(_.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,b.__)("Add your own CSS to customize the appearance and layout of your site.")),(0,l.createElement)(_.__experimentalItemGroup,null,(0,l.createElement)(Qu,{path:"/css","aria-label":(0,b.__)("Additional CSS")},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(_.FlexItem,null,(0,b.__)("Additional CSS")),(0,l.createElement)(Xu,{icon:(0,b.isRTL)()?da:ua})))))))};function cd(e){const t=function(e){return e?.filter((e=>"block"===e.source))}((0,d.useSelect)((t=>{const{getBlockStyles:n}=t(c.store);return n(e)}),[e]));return t}function ud({name:e}){const t=cd(e);return(0,l.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},t.map(((t,n)=>t?.isDefault?null:(0,l.createElement)(Qu,{key:n,path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),"aria-label":t.label},t.label))))}const dd=function({title:e,description:t,onBack:n}){return(0,l.createElement)(_.__experimentalVStack,{spacing:0},(0,l.createElement)(_.__experimentalView,null,(0,l.createElement)(_.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3},(0,l.createElement)(_.__experimentalHStack,{spacing:2},(0,l.createElement)(_.__experimentalNavigatorToParentButton,{style:{minWidth:24,padding:0},icon:(0,b.isRTL)()?ua:da,isSmall:!0,"aria-label":(0,b.__)("Navigate to the previous view"),onClick:n}),(0,l.createElement)(_.__experimentalSpacer,null,(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13},e))))),t&&(0,l.createElement)("p",{className:"edit-site-global-styles-header__description"},t))},{useHasDimensionsPanel:md,useHasTypographyPanel:pd,useHasBorderPanel:hd,useGlobalSetting:fd,useSettingsForBlockElement:gd,useHasColorPanel:yd}=Ke(he.privateApis);function vd(e){const[t]=fd("",e),n=gd(t,e),a=pd(n),r=yd(n),s=hd(n),i=md(n),o=s||i,l=!!cd(e)?.length;return a||r||o||l}function _d({block:e}){if(!vd(e.name))return null;const t=(0,b.sprintf)((0,b.__)("%s block styles"),e.title);return(0,l.createElement)(Qu,{path:"/blocks/"+encodeURIComponent(e.name),"aria-label":t},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(he.BlockIcon,{icon:e.icon}),(0,l.createElement)(_.FlexItem,null,e.title)))}const bd=(0,f.memo)((function({filterValue:e}){const t=function(){const e=(0,d.useSelect)((e=>e(c.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:a}=e;return(t.name.startsWith("core/")?n:a).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),n=(0,se.useDebounce)(Jt.speak,500),{isMatchingSearchTerm:a}=(0,d.useSelect)(c.store),r=e?t.filter((t=>a(t,e))):t,s=(0,f.useRef)();return(0,f.useEffect)((()=>{if(!e)return;const t=s.current.childElementCount,a=(0,b.sprintf)((0,b._n)("%d result found.","%d results found.",t),t);n(a,t)}),[e,n]),(0,l.createElement)("div",{ref:s,className:"edit-site-block-types-item-list"},r.map((e=>(0,l.createElement)(_d,{block:e,key:"menu-itemblock-"+e.name}))))}));const Ed=function(){const[e,t]=(0,f.useState)(""),n=(0,f.useDeferredValue)(e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("Blocks"),description:(0,b.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,l.createElement)(_.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,b.__)("Search for blocks"),placeholder:(0,b.__)("Search")}),(0,l.createElement)(bd,{filterValue:n}))},wd=({name:e,variation:t=""})=>{var n;const a=(0,c.getBlockType)(e)?.example,r=(0,f.useMemo)((()=>{if(!a)return null;let n=a;return t&&(n={...n,attributes:{...n.attributes,className:"is-style-"+t}}),(0,c.getBlockFromExample)(e,n)}),[e,a,t]),s=null!==(n=a?.viewportWidth)&&void 0!==n?n:null,i="150px";return a?(0,l.createElement)(_.__experimentalSpacer,{marginX:4,marginBottom:4},(0,l.createElement)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:i,boxSizing:"initial"}},(0,l.createElement)(he.BlockPreview,{blocks:r,viewportWidth:s,minHeight:i,additionalStyles:[{css:`\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:${i};\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t`}]}))):null};const xd=function({children:e,level:t}){return(0,l.createElement)(_.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2},e)};function Sd(e){if(!e)return e;const t=e.color||e.width;return!e.style&&t?{...e,style:"solid"}:!e.style||t?e:void 0}const{useHasDimensionsPanel:Cd,useHasTypographyPanel:kd,useHasBorderPanel:Td,useGlobalSetting:Pd,useSettingsForBlockElement:Id,useHasColorPanel:Md,useHasEffectsPanel:Ad,useHasFiltersPanel:Nd,useHasImageSettingsPanel:Od,useGlobalStyle:Rd,BorderPanel:Fd,ColorPanel:Dd,TypographyPanel:Bd,DimensionsPanel:Vd,EffectsPanel:Ld,FiltersPanel:zd,ImageSettingsPanel:Gd,AdvancedPanel:Hd}=Ke(he.privateApis);const Ud=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const a=n.join("."),[r]=Rd(a,e,"user",{shouldDecodeEncode:!1}),[s,i]=Rd(a,e,"all",{shouldDecodeEncode:!1}),[o]=Pd("",e,"user"),[u,m]=Pd("",e),p=Id(u,e),h=(0,c.getBlockType)(e);p?.spacing?.blockGap&&h?.supports?.spacing?.blockGap&&(!0===h?.supports?.spacing?.__experimentalSkipSerialization||h?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(p.spacing.blockGap=!1),p?.dimensions?.aspectRatio&&"core/group"===e&&(p.dimensions.aspectRatio=!1);const g=cd(e),y=kd(p),v=Md(p),E=Td(p),w=Cd(p),x=Ad(p),S=Nd(p),C=Od(e,o,p),k=!!g?.length&&!t,{canEditCSS:T}=(0,d.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ge.store),a=n(),r=a?t("root","globalStyles",a):void 0;return{canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]),P=t?g.find((e=>e.name===t)):null,I=(0,f.useMemo)((()=>({...s,layout:p.layout})),[s,p.layout]),M=(0,f.useMemo)((()=>({...r,layout:o.layout})),[r,o.layout]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:t?P.label:h.title}),(0,l.createElement)(wd,{name:e,variation:t}),k&&(0,l.createElement)("div",{className:"edit-site-global-styles-screen-variations"},(0,l.createElement)(_.__experimentalVStack,{spacing:3},(0,l.createElement)(xd,null,(0,b.__)("Style Variations")),(0,l.createElement)(ud,{name:e}))),v&&(0,l.createElement)(Dd,{inheritedValue:s,value:r,onChange:i,settings:p}),y&&(0,l.createElement)(Bd,{inheritedValue:s,value:r,onChange:i,settings:p}),w&&(0,l.createElement)(Vd,{inheritedValue:I,value:M,onChange:e=>{const t={...e};delete t.layout,i(t),e.layout!==o.layout&&m({...o,layout:e.layout})},settings:p,includeLayoutControls:!0}),E&&(0,l.createElement)(Fd,{inheritedValue:s,value:r,onChange:e=>{if(!e?.border)return void i(e);const{radius:t,...n}=e.border,a=function(e){return e?(0,_.__experimentalHasSplitBorders)(e)?{top:Sd(e.top),right:Sd(e.right),bottom:Sd(e.bottom),left:Sd(e.left)}:Sd(e):e}(n),r=(0,_.__experimentalHasSplitBorders)(a)?{color:null,style:null,width:null,...a}:{top:a,right:a,bottom:a,left:a};i({...e,border:{...r,radius:t}})},settings:p}),x&&(0,l.createElement)(Ld,{inheritedValue:I,value:M,onChange:i,settings:p,includeLayoutControls:!0}),S&&(0,l.createElement)(zd,{inheritedValue:I,value:M,onChange:i,settings:p,includeLayoutControls:!0}),C&&(0,l.createElement)(Gd,{onChange:e=>{m(void 0===e?{...u,lightbox:void 0}:{...u,lightbox:{...u.lightbox,...e}})},value:o,inheritedValue:p}),T&&(0,l.createElement)(_.PanelBody,{title:(0,b.__)("Advanced"),initialOpen:!1},(0,l.createElement)("p",null,(0,b.sprintf)((0,b.__)("Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."),h?.title)),(0,l.createElement)(Hd,{value:r,onChange:i,inheritedValue:s})))},{useGlobalStyle:Wd}=Ke(he.privateApis);function jd({parentMenu:e,element:t,label:n}){const a="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[s]=Wd(a+"typography.fontFamily"),[i]=Wd(a+"typography.fontStyle"),[o]=Wd(a+"typography.fontWeight"),[c]=Wd(a+"typography.letterSpacing"),[u]=Wd(a+"color.background"),[d]=Wd(a+"color.gradient"),[m]=Wd(a+"color.text"),p=(0,b.sprintf)((0,b.__)("Typography %s styles"),n);return(0,l.createElement)(Qu,{path:e+"/typography/"+t,"aria-label":p},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(_.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=s?s:"serif",background:null!=d?d:u,color:m,fontStyle:i,fontWeight:o,letterSpacing:c,...r}},(0,b.__)("Aa")),(0,l.createElement)(_.FlexItem,null,n)))}const Zd=function(){return(0,l.createElement)(_.__experimentalVStack,{spacing:3},(0,l.createElement)(xd,{level:3},(0,b.__)("Elements")),(0,l.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)(jd,{parentMenu:"",element:"text",label:(0,b.__)("Text")}),(0,l.createElement)(jd,{parentMenu:"",element:"link",label:(0,b.__)("Links")}),(0,l.createElement)(jd,{parentMenu:"",element:"heading",label:(0,b.__)("Headings")}),(0,l.createElement)(jd,{parentMenu:"",element:"caption",label:(0,b.__)("Captions")}),(0,l.createElement)(jd,{parentMenu:"",element:"button",label:(0,b.__)("Buttons")})))},qd="/wp/v2/font-families",Yd="/wp/v2/font-collections";const Kd=["otf","ttf","woff","woff2"],Xd={100:(0,b._x)("Thin","font weight"),200:(0,b._x)("Extra-light","font weight"),300:(0,b._x)("Light","font weight"),400:(0,b._x)("Normal","font weight"),500:(0,b._x)("Medium","font weight"),600:(0,b._x)("Semi-bold","font weight"),700:(0,b._x)("Bold","font weight"),800:(0,b._x)("Extra-bold","font weight"),900:(0,b._x)("Black","font weight")},Jd={normal:(0,b._x)("Normal","font style"),italic:(0,b._x)("Italic","font style")};function Qd(e){return e.split(",").map((e=>(e=e.trim()).startsWith('"')||e.startsWith("'")||-1===e.indexOf(" ")?e:`"${e}"`)).join(", ")}function $d(e){const t={fontFamily:Qd(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const r=e.fontFace.filter((e=>"normal"===e.fontStyle.toLowerCase()));if(r.length>0){t.fontStyle="normal";const e=function(e){const t=[];return e.forEach((e=>{const n=String(e.fontWeight).split(" ");if(2===n.length){const e=parseInt(n[0]),a=parseInt(n[1]);for(let n=e;n<=a;n+=100)t.push(n)}else 1===n.length&&t.push(parseInt(n[0]))})),t}(r),s=(n=400,0===(a=e).length?null:(a.sort(((e,t)=>Math.abs(n-e)-Math.abs(n-t))),a[0]));t.fontWeight=String(s)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var n,a;return t}const{File:em}=window;function tm(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function nm(e){return`${Xd[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":Jd[e.fontStyle]||e.fontStyle}`}function am(e=[],t=[]){const n=new Map;for(const t of e)n.set(`${t.fontWeight}${t.fontStyle}`,t);for(const e of t)n.set(`${e.fontWeight}${e.fontStyle}`,e);return Array.from(n.values())}async function rm(e,t,n="all"){let a;if("string"==typeof t)a=`url(${t})`;else{if(!(t instanceof em))return;a=await t.arrayBuffer()}const r=new window.FontFace(Qd(e.fontFamily),a,{style:e.fontStyle,weight:e.fontWeight}),s=await r.load();if("document"!==n&&"all"!==n||document.fonts.add(s),"iframe"===n||"all"===n){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(s)}}function sm(e,t){if(!e)return;let n;var a;return n=Array.isArray(e)?e[0]:e,n.startsWith("file:.")&&t&&(n=n.replace("file:.",t)),("string"!=typeof(a=n)||a===decodeURIComponent(a))&&(n=encodeURI(n)),n}async function im(e,t){const n=t.map((t=>async function(e,t){const n={path:`${qd}/${e}/font-faces`,method:"POST",body:t},a=await Xt()(n);return{id:a.id,...a.font_face_settings}}(e,t))),a=await Promise.allSettled(n),r={errors:[],successes:[]};return a.forEach(((e,n)=>{if("fulfilled"===e.status){const a=e.value;a.id?r.successes.push(a):r.errors.push({data:t[n],message:`Error: ${a.message}`})}else r.errors.push({data:t[n],message:`Fetch error: ${e.reason.message}`})})),r}function om(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function lm(e,t,n){const a=t=>t.slug===e.slug,r=n.find(a);return t?(r=>{const s=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!r)return[...n,{...e,fontFace:[t]}];let i=r.fontFace||[];return i=i.find(s)?i.filter((e=>!s(e))):[...i,t],0===i.length?n.filter((e=>!a(e))):n.map((e=>a(e)?{...e,fontFace:i}:e))})(r):(t=>t?n.filter((e=>!a(e))):[...n,e])(r)}const{useGlobalSetting:cm}=Ke(he.privateApis),um=(0,f.createContext)({});const dm=function({children:e}){const{__experimentalSaveSpecifiedEntityEdits:t}=(0,d.useDispatch)(ge.store),{globalStylesId:n}=(0,d.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(ge.store);return{globalStylesId:t()}})),a=(0,ge.useEntityRecord)("root","globalStyles",n),r=!!a?.edits?.settings?.typography?.fontFamilies,[s,i]=(0,f.useState)(!1),[o,c]=(0,f.useState)(0),[u,m]=(0,f.useState)(null),p=()=>{c(Date.now())};(0,f.useEffect)((()=>{u&&(u.onRemove=()=>{m(null)})}),[u,m]);const{records:h=[],isResolving:g,hasResolved:y}=(0,ge.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),v=(h||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[E,w]=cm("typography.fontFamilies"),[x]=cm("typography.fontFamilies",void 0,"base"),[S,C]=(0,f.useState)(!1),[k,T]=(0,f.useState)(null),P=x?.theme?x.theme.map((e=>tm(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],I=E?.theme?E.theme.map((e=>tm(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],M=E?.custom?E.custom.map((e=>tm(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],A=v?v.map((e=>tm(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,f.useEffect)((()=>{S||T(null)}),[S]);const[N]=(0,f.useState)(new Set),{site:O,currentTheme:R}=(0,d.useSelect)((e=>({site:e(ge.store).getSite(),currentTheme:e(ge.store).getCurrentTheme()}))),F=O?.url+"/wp-content/themes/"+R?.stylesheet,D=e=>e.reduce(((e,t)=>{const n=t?.fontFace&&t.fontFace?.length>0?t?.fontFace.map((e=>`${e.fontStyle+e.fontWeight}`)):["normal400"];return e[t.slug]=n,e}),{}),B=e=>D("theme"===e?I:M),V=e=>{var t;const n=(null!==(t=E?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug));w({...E,[e.source]:n})},L=e=>{const t=function(e=[],t=[]){const n=new Map;for(const t of e)n.set(t.slug,{...t});for(const e of t)if(n.has(e.slug)){const{fontFace:t,...a}=e,r=am(n.get(e.slug).fontFace,t);n.set(e.slug,{...a,fontFace:r})}else n.set(e.slug,{...e});return Array.from(n.values())}(E?.custom,e);w({...E,custom:t}),e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{rm(e,sm(e.src),"iframe")}))}))},[z,G]=(0,f.useState)([]),H=async()=>{const e=await async function(){const e={path:`${Yd}?_fields=slug,name,description`,method:"GET"};return await Xt()(e)}();G(e)};return(0,f.useEffect)((()=>{H()}),[]),(0,l.createElement)(um.Provider,{value:{libraryFontSelected:k,handleSetLibraryFontSelected:e=>{if(m(null),!e)return void T(null);const t=("theme"===e.source?P:A).find((t=>t.slug===e.slug));T({...t||e,source:e.source})},themeFonts:I,baseThemeFonts:P,customFonts:M,baseCustomFonts:A,isFontActivated:(e,t,n,a)=>t||n?!!B(a)[e]?.includes(t+n):!!B(a)[e],getFontFacesActivated:(e,t)=>B(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=sm(e.src,F);t&&!N.has(t)&&(rm(e,t,"document"),N.add(t))},installFont:async function(e){i(!0);try{let a=await async function(e){const t={path:`${qd}?slug=${e}&_embed=true`,method:"GET"},n=await Xt()(t);if(!n||0===n.length)return null;const a=n[0];return{id:a.id,...a.font_family_settings,fontFace:a?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}(e.slug);a||(a=await async function(e){const t={path:qd,method:"POST",body:e},n=await Xt()(t);return{id:n.id,...n.font_family_settings,fontFace:[]}}(function(e){const t=new FormData,{kebabCase:n}=Ke(_.privateApis),{fontFace:a,category:r,...s}=e,i={...s,slug:n(e.slug)};return t.append("font_family_settings",JSON.stringify(i)),t}(e)));const r=a.fontFace&&e.fontFace?a.fontFace.filter((t=>om(t,e.fontFace))):[];a.fontFace&&e.fontFace&&(e.fontFace=e.fontFace.filter((e=>!om(e,a.fontFace))));let s=[],i=[];if(e?.fontFace?.length>0){const t=await im(a.id,function(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const n=new FormData;if(e.file){const a=Array.isArray(e.file)?e.file:[e.file],r=[];a.forEach(((e,a)=>{const s=`file-${t}-${a}`;n.append(s,e,e.name),r.push(s)})),e.src=1===r.length?r[0]:r,delete e.file,n.append("font_face_settings",JSON.stringify(e))}else n.append("font_face_settings",JSON.stringify(e));return n}));return t}}(e));s=t?.successes,i=t?.errors}const o=i.reduce(((e,t)=>`${e} ${t.message}`),"");if(e?.fontFace?.length>0&&0===s.length&&0===r.length)throw new Error((0,b.sprintf)((0,b.__)("No font faces were installed. %s"),o));if((s?.length>0||r?.length>0)&&(e.fontFace=[...s,...r]),L([e]),t("root","globalStyles",n,["settings.typography.fontFamilies"]),p(),i.length>0)throw new Error((0,b.sprintf)((0,b.__)("Some font faces were installed. There were some errors. %s"),o))}finally{i(!1)}},uninstallFontFamily:async function(e){try{const a=await async function(e){const t={path:`${qd}/${e}?force=true`,method:"DELETE"};return await Xt()(t)}(e.id);return a.deleted&&(V(e),await t("root","globalStyles",n,["settings.typography.fontFamilies"])),p(),a}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var n;const a=lm(e,t,null!==(n=E?.[e.source])&&void 0!==n?n:[]);w({...E,[e.source]:a})},getAvailableFontsOutline:D,modalTabOpen:S,toggleModal:e=>{C(e||null)},refreshLibrary:p,notice:u,setNotice:m,saveFontFamilies:()=>{t("root","globalStyles",n,["settings.typography.fontFamilies"])},fontFamiliesHasChanges:r,isResolvingLibrary:g,hasResolvedLibrary:y,isInstalling:s,collections:z,getFontCollection:async e=>{try{if(!!z.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${Yd}/${e}`,method:"GET"};return await Xt()(t)}(e),n=z.map((n=>n.slug===e?{...n,...t}:n));G(n)}catch(e){throw console.error(e),e}}}},e)};const mm=function({title:e,description:t,notice:n,handleBack:a,children:r,footer:s}){return(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout"},(0,l.createElement)(_.__experimentalSpacer,{margin:4}),(0,l.createElement)(_.__experimentalVStack,{spacing:4,justify:"space-between"},(0,l.createElement)(_.__experimentalVStack,{spacing:2},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start"},!!a&&(0,l.createElement)(_.Button,{variant:"tertiary",onClick:a,icon:da,size:"small"}),e&&(0,l.createElement)(_.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header"},e)),t&&(0,l.createElement)(_.__experimentalText,null,t),n&&(0,l.createElement)(_.FlexBlock,null,(0,l.createElement)(_.__experimentalSpacer,{margin:1}),(0,l.createElement)(_.Notice,{status:n.type,onRemove:n.onRemove},n.message),(0,l.createElement)(_.__experimentalSpacer,{margin:1}))),(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout__main"},r),s&&(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout__footer"},s)))};const pm=function({title:e,children:t,pageSize:n=32}){const[a,r]=(0,f.useState)(null),[s,i]=(0,f.useState)(1),o=s*n,c=t.slice(0,o);return(0,f.useEffect)((()=>{if(a){const e=new window.IntersectionObserver((([e])=>{e.isIntersecting&&i((e=>e+1))}));return e.observe(a),()=>e.disconnect()}}),[a]),(0,l.createElement)("div",{className:"font-library-modal__fonts-grid"},(0,l.createElement)(_.__experimentalVStack,{spacing:0},e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalText,{className:"font-library-modal__subtitle"},e),(0,l.createElement)(_.__experimentalSpacer,{margin:2})),(0,l.createElement)("div",{className:"font-library-modal__fonts-grid__main"},c.map(((e,t)=>t===o-1?(0,l.createElement)("div",{key:e.key,ref:r},e):(0,l.createElement)("div",{key:e.key},e))))))};const hm=function({customPreviewUrl:e,fontFace:t,text:n,style:a={}}){const r=(0,f.useRef)(null),[s,i]=(0,f.useState)(!1),[o,c]=(0,f.useState)(!1),{loadFontFaceAsset:u}=(0,f.useContext)(um),d=null!=e?e:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(t),m=d&&d.match(/\.(png|jpg|jpeg|gif|svg)$/i);var p;const h={whiteSpace:"nowrap",flexShrink:0,fontSize:"18px",opacity:o?"1":"0",transition:"opacity 0.3s ease-in-out",...{fontFamily:Qd((p=t).fontFamily),fontStyle:p.fontStyle||"normal",fontWeight:p.fontWeight||"400"},...a};return(0,f.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{i(e.isIntersecting)}),{});return e.observe(r.current),()=>e.disconnect()}),[r]),(0,f.useEffect)((()=>{(async()=>{s&&(!m&&t.src&&await u(t),c(!0))})()}),[t,s,u,m]),(0,l.createElement)("div",{ref:r},m?(0,l.createElement)("img",{src:d,loading:"lazy",alt:n,style:{height:"23px",width:"auto"}}):(0,l.createElement)(_.__experimentalText,{style:h},n))};const fm=function({face:e,font:t}){const{isFontActivated:n,toggleActivateFont:a}=(0,f.useContext)(um),r=t?.fontFace?.length>0?n(t.slug,e.fontStyle,e.fontWeight,t.source):n(t.slug,null,null,t.source),s=t.name+" "+nm(e),{kebabCase:i}=Ke(_.privateApis),o=i(`${t.slug}-${nm(e)}`);return(0,l.createElement)("label",{className:"font-library-modal__library-font-variant",htmlFor:o},(0,l.createElement)(_.Flex,{justify:"space-between",align:"center",gap:"1rem"},(0,l.createElement)(hm,{fontFace:e,text:s}),(0,l.createElement)(_.CheckboxControl,{checked:r,onChange:()=>{t?.fontFace?.length>0?a(t,e):a(t)},__nextHasNoMarginBottom:!0,id:o,label:!1})))};function gm(e){switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 500;case"lighter":return 300;default:return parseInt(e,10)}}function ym(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?gm(e.fontWeight)-gm(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const vm=function({font:e}){const t=e.fontFace&&e.fontFace.length?ym(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}];return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalSpacer,{margin:4}),(0,l.createElement)(_.__experimentalVStack,{spacing:0},(0,l.createElement)(_.__experimentalSpacer,{margin:8}),t.map(((t,n)=>(0,l.createElement)(fm,{font:e,face:t,key:`face${n}`})))),(0,l.createElement)(_.__experimentalSpacer,{margin:8}))};const _m=function({font:e,onClick:t,variantsText:n}){const a={fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0},r=e.fontFace&&e.fontFace.length?e?.fontFace?.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:a,s=$d(e),i=e.fontFace?.length||1,o={cursor:t?"pointer":"default"};return(0,l.createElement)(_.Button,{onClick:t,style:o,className:"font-library-modal__font-card"},(0,l.createElement)(_.Flex,{justify:"space-between",wrap:!1},(0,l.createElement)(hm,{customPreviewUrl:e.preview,fontFace:r,text:e.name,style:s}),(0,l.createElement)(_.Flex,{justify:"flex-end"},(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.__experimentalText,{className:"font-library-modal__font-card__count"},n||i+" "+(0,b._n)("variant","variants",i))),(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.Icon,{icon:ua})))))};const bm=function({font:e,...t}){const{getFontFacesActivated:n}=(0,f.useContext)(um),a=e?.fontFace?.length>0?e.fontFace.length:1,r=n(e.slug,e.source).length,s=(0,b.sprintf)((0,b.__)("%1$s/%2$s variants active"),r,a);return(0,l.createElement)(_m,{font:e,variantsText:s,...t})};const Em=function({font:e,isConfirmDeleteOpen:t,handleConfirmUninstall:n,handleCancelUninstall:a}){return(0,l.createElement)(_.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:a,onConfirm:n},e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name))},{ProgressBar:wm}=Ke(_.privateApis);function xm({shouldDisplayDeleteButton:e,handleUninstallClick:t}){const{saveFontFamilies:n,fontFamiliesHasChanges:a,isInstalling:r}=(0,f.useContext)(um);return(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},r&&(0,l.createElement)(wm,null),(0,l.createElement)("div",null,e&&(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Delete"))),(0,l.createElement)(_.Button,{disabled:!a,variant:"primary",onClick:n},(0,b.__)("Update")))}const Sm=function(){const{baseCustomFonts:e,libraryFontSelected:t,baseThemeFonts:n,handleSetLibraryFontSelected:a,refreshLibrary:r,uninstallFontFamily:s,isResolvingLibrary:i,notice:o,setNotice:c}=(0,f.useContext)(um),[u,d]=(0,f.useState)(!1),m=()=>{a(null)},p=e=>{a(e)},h=async()=>{c(null);try{await s(t),c({type:"success",message:(0,b.__)("Font family uninstalled successfully.")}),m(),d(!1)}catch(e){c({type:"error",message:(0,b.__)("There was an error uninstalling the font family. ")+e.message})}},g=()=>{d(!1)},y=t?(0,b.__)("Choose font variants. Keep in mind that too many variants could make your site slower."):null,v=!!t&&"theme"!==t?.source;return(0,f.useEffect)((()=>{p(t),r()}),[]),(0,l.createElement)(mm,{title:t?.name||"",description:y,notice:o,handleBack:!!t&&m,footer:(0,l.createElement)(xm,{shouldDisplayDeleteButton:v,handleUninstallClick:async()=>{d(!0)}})},(0,l.createElement)(Em,{font:t,isConfirmDeleteOpen:u,handleConfirmUninstall:h,handleCancelUninstall:g}),!t&&(0,l.createElement)(l.Fragment,null,i&&(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.__experimentalSpacer,{margin:2}),(0,l.createElement)(_.Spinner,null),(0,l.createElement)(_.__experimentalSpacer,{margin:2})),e.length>0&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(pm,null,e.map((e=>(0,l.createElement)(bm,{font:e,key:e.slug,onClick:()=>{p(e)}})))),(0,l.createElement)(_.__experimentalSpacer,{margin:8})),n.length>0&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(pm,{title:(0,b.__)("Theme Fonts")},n.map((e=>(0,l.createElement)(bm,{font:e,key:e.slug,onClick:()=>{p(e)}})))))),t&&(0,l.createElement)(vm,{font:t,isConfirmDeleteOpen:u,handleConfirmUninstall:h,handleCancelUninstall:g}))};const Cm=function({face:e,font:t,handleToggleVariant:n,selected:a}){const r=t.name+" "+nm(e),{kebabCase:s}=Ke(_.privateApis),i=s(`${t.slug}-${nm(e)}`);return(0,l.createElement)("label",{className:"font-library-modal__library-font-variant",htmlFor:i},(0,l.createElement)(_.Flex,{justify:"space-between",align:"center",gap:"1rem"},(0,l.createElement)(hm,{fontFace:e,text:r}),(0,l.createElement)(_.CheckboxControl,{checked:a,onChange:()=>{t?.fontFace?n(t,e):n(t)},__nextHasNoMarginBottom:!0,id:i,label:!1})))};function km(e,t,n){return t?!!n[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!n[e]}const Tm=function({font:e,handleToggleVariant:t,fontToInstallOutline:n}){const a=e.fontFace&&e.fontFace.length?ym(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}];return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalSpacer,{margin:4}),(0,l.createElement)(_.__experimentalVStack,{spacing:0},(0,l.createElement)(_.__experimentalSpacer,{margin:8}),a.map(((a,r)=>(0,l.createElement)(Cm,{font:e,face:a,key:`face${r}`,handleToggleVariant:t,selected:km(e.slug,e.fontFace?a:null,n)})))),(0,l.createElement)(_.__experimentalSpacer,{margin:8}))};const Pm=function(){return(0,l.createElement)("div",{className:"font-library__google-fonts-confirm"},(0,l.createElement)(_.Card,null,(0,l.createElement)(_.CardBody,null,(0,l.createElement)(_.__experimentalText,{as:"h3"},"Connect to Google Fonts"),(0,l.createElement)(_.__experimentalSpacer,{margin:6}),(0,l.createElement)(_.__experimentalText,{as:"p"},(0,b.__)("To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.")),(0,l.createElement)(_.__experimentalSpacer,{margin:3}),(0,l.createElement)(_.__experimentalText,{as:"p"},(0,b.__)("You can alternatively upload files directly on the Library tab.")),(0,l.createElement)(_.__experimentalSpacer,{margin:6}),(0,l.createElement)(_.Button,{variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))}},(0,b.__)("Allow access to Google Fonts")))))},Im={slug:"all",name:(0,b.__)("All")};function Mm({handleInstall:e}){const{isInstalling:t}=(0,f.useContext)(um);return(0,l.createElement)(_.Flex,{justify:"flex-end"},(0,l.createElement)(_.Button,{variant:"primary",onClick:e,isBusy:t,disabled:t},(0,b.__)("Install")))}const Am=function({slug:e}){var t;const n="google-fonts"===e,a=()=>"true"===window.localStorage.getItem("wp-font-library-google-fonts-permission"),[r,s]=(0,f.useState)(null),[i,o]=(0,f.useState)([]),[c,u]=(0,f.useState)({}),[d,m]=(0,f.useState)(n&&!a()),{collections:p,getFontCollection:h,installFont:g,notice:y,setNotice:v}=(0,f.useContext)(um),E=p.find((t=>t.slug===e));(0,f.useEffect)((()=>{const e=()=>{m(n&&!a())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,n]),(0,f.useEffect)((()=>{(async()=>{try{await h(e),P()}catch(e){y||v({type:"error",message:e?.message})}})()}),[e,h,v,y]),(0,f.useEffect)((()=>{s(null),v(null)}),[e,v]),(0,f.useEffect)((()=>{o([])}),[r]);const w=(0,f.useMemo)((()=>{var e;return null!==(e=E?.font_families)&&void 0!==e?e:[]}),[E]),x=null!==(t=E?.categories)&&void 0!==t?t:[],S=[Im,...x],C=(0,f.useMemo)((()=>function(e,t){const{category:n,search:a}=t;let r=e||[];return n&&"all"!==n&&(r=r.filter((e=>-1!==e.categories.indexOf(n)))),a&&(r=r.filter((e=>e.font_family_settings.name.toLowerCase().includes(a.toLowerCase())))),r}(w,c)),[w,c]),k=(0,se.debounce)((e=>{u({...c,search:e})}),300),P=()=>{u({})},I=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(i);return(0,l.createElement)(mm,{title:r?r.name:E.name,description:r?(0,b.__)("Select font variants to install."):E.description,notice:y,handleBack:!!r&&(()=>{s(null)}),footer:i.length>0&&(0,l.createElement)(Mm,{handleInstall:async()=>{v(null);const e=i[0];try{e?.fontFace&&await Promise.all(e.fontFace.map((async e=>{e.src&&(e.file=await async function(e){e=Array.isArray(e)?e:[e];const t=await Promise.all(e.map((async e=>fetch(new Request(e)).then((t=>{if(!t.ok)throw new Error(`Error downloading font face asset from ${e}. Server responded with status: ${t.status}`);return t.blob()})).then((t=>{const n=e.split("/").pop();return new em([t],n,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void v({type:"error",message:(0,b.__)("Error installing the fonts, could not be downloaded.")})}try{await g(e),v({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){v({type:"error",message:e.message})}o([])}})},d&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalSpacer,{margin:8}),(0,l.createElement)(Pm,null)),!d&&!r&&(0,l.createElement)(_.Flex,null,(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.__experimentalInputControl,{value:c.search,placeholder:(0,b.__)("Font name…"),label:(0,b.__)("Search"),onChange:k,prefix:(0,l.createElement)(_.Icon,{icon:Br}),suffix:c?.search?(0,l.createElement)(_.Icon,{icon:T,onClick:()=>{u({...c,search:""})}}):null})),(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.SelectControl,{label:(0,b.__)("Category"),value:c.category,onChange:e=>{u({...c,category:e})}},S&&S.map((e=>(0,l.createElement)("option",{value:e.slug,key:e.slug},e.name)))))),(0,l.createElement)(_.__experimentalSpacer,{margin:4}),!d&&!E?.font_families&&!y&&(0,l.createElement)(_.Spinner,null),!d&&!!E?.font_families?.length&&!C.length&&(0,l.createElement)(_.__experimentalText,null,(0,b.__)("No fonts found. Try with a different search term")),!d&&r&&(0,l.createElement)(Tm,{font:r,handleToggleVariant:(e,t)=>{const n=lm(e,t,i);o(n)},fontToInstallOutline:I}),!d&&!r&&(0,l.createElement)(pm,null,C.map((e=>(0,l.createElement)(_m,{key:e.font_family_settings.slug,font:e.font_family_settings,onClick:()=>{s(e.font_family_settings)}})))))};var Nm=n(5723),Om=n.n(Nm),Rm=n(2591),Fm=n.n(Rm);globalThis.fetch;class Dm{constructor(e,t={},n){this.type=e,this.detail=t,this.msg=n,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]`}}class Bm{constructor(){this.listeners={}}addEventListener(e,t,n){let a=this.listeners[e]||[];n?a.unshift(t):a.push(t),this.listeners[e]=a}removeEventListener(e,t){let n=this.listeners[e]||[],a=n.findIndex((e=>e===t));a>-1&&(n.splice(a,1),this.listeners[e]=n)}dispatch(e){let t=this.listeners[e.type];if(t)for(let n=0,a=t.length;n{let t=e.replace(/get(Big)?/,"").toLowerCase(),n=parseInt(e.replace(/[^\d]/g,""))/8;Object.defineProperty(this,t,{get:()=>this.getValue(e,n)})}))}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 n=this.start+this.offset;this.offset+=t;try{return this.data[e](n)}catch(n){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),n}}flags(e){if(8===e||16===e||32===e||64===e)return this[`uint${e}`].toString(2).padStart(e,0).split("").map((e=>"1"===e));console.error("Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long"),console.trace()}get tag(){const e=this.uint32;return t=[e>>24&255,e>>16&255,e>>8&255,255&e],Array.from(t).map((e=>String.fromCharCode(e))).join("");var t}get fixed(){return this.int16+Math.round(1e3*this.uint16/65356)/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 t=this.uint8;if(e=128*e+(127&t),t<128)break}return e}get longdatetime(){return new Date(Vm+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(){const e=p.uint16;return[0,1,-2,-1][e>>14]+(16383&e)/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,n=8,a=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const r=`${a?"":"u"}int${n}`,s=[];for(;e--;)s.push(this[r]);return s}}class zm{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const n=e.currentPosition,a={enumerable:!1,get:()=>n};Object.defineProperty(this,"start",a)}load(e){Object.keys(e).forEach((t=>{let n=Object.getOwnPropertyDescriptor(e,t);n.get?this[t]=n.get.bind(this):void 0!==n.value&&(this[t]=n.value)})),this.parser.length&&this.parser.verifyLength()}}class Gm extends zm{constructor(e,t,n){const{parser:a,start:r}=super(new Lm(e,t,n)),s={enumerable:!1,get:()=>a};Object.defineProperty(this,"p",s);const i={enumerable:!1,get:()=>r};Object.defineProperty(this,"tableStart",i)}}function Hm(e,t,n){let a;Object.defineProperty(e,t,{get:()=>a||(a=n(),a),enumerable:!0})}class Um extends Gm{constructor(e,t,n){const{p:a}=super({offset:0,length:12},t,"sfnt");this.version=a.uint32,this.numTables=a.uint16,this.searchRange=a.uint16,this.entrySelector=a.uint16,this.rangeShift=a.uint16,a.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Wm(a))),this.tables={},this.directory.forEach((e=>{Hm(this.tables,e.tag.trim(),(()=>n(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class Wm{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const jm=Fm().inflate||void 0;let Zm;class qm extends Gm{constructor(e,t,n){const{p:a}=super({offset:0,length:44},t,"woff");this.signature=a.tag,this.flavor=a.uint32,this.length=a.uint32,this.numTables=a.uint16,a.uint16,this.totalSfntSize=a.uint32,this.majorVersion=a.uint16,this.minorVersion=a.uint16,this.metaOffset=a.uint32,this.metaLength=a.uint32,this.metaOrigLength=a.uint32,this.privOffset=a.uint32,this.privLength=a.uint32,a.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Ym(a))),Km(this,t,n)}}class Ym{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function Km(e,t,n){e.tables={},e.directory.forEach((a=>{Hm(e.tables,a.tag.trim(),(()=>{let r=0,s=t;if(a.compLength!==a.origLength){const e=t.buffer.slice(a.offset,a.offset+a.compLength);let n;if(jm)n=jm(new Uint8Array(e));else{if(!Zm){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}n=Zm(new Uint8Array(e))}s=new DataView(n.buffer)}else r=a.offset;return n(e.tables,{tag:a.tag,offset:r,length:a.origLength},s)}))}))}const Xm=Om();let Jm;class Qm extends Gm{constructor(e,t,n){const{p:a}=super({offset:0,length:48},t,"woff2");this.signature=a.tag,this.flavor=a.uint32,this.length=a.uint32,this.numTables=a.uint16,a.uint16,this.totalSfntSize=a.uint32,this.totalCompressedSize=a.uint32,this.majorVersion=a.uint16,this.minorVersion=a.uint16,this.metaOffset=a.uint32,this.metaLength=a.uint32,this.metaOrigLength=a.uint32,this.privOffset=a.uint32,this.privLength=a.uint32,a.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new $m(a)));let r,s=a.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let n=this.directory[t+1];n&&(n.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let i=t.buffer.slice(s);if(Xm)r=Xm(new Uint8Array(i));else{if(!Jm){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}r=new Uint8Array(Jm(i))}!function(e,t,n){e.tables={},e.directory.forEach((a=>{Hm(e.tables,a.tag.trim(),(()=>{const r=a.offset,s=r+(a.transformLength?a.transformLength:a.origLength),i=new DataView(t.slice(r,s).buffer);try{return n(e.tables,{tag:a.tag,offset:0,length:a.origLength},i)}catch(e){console.error(e)}}))}))}(this,r,n)}}class $m{constructor(e){this.flags=e.uint8;const t=this.tagNumber=63&this.flags;this.tag=63===t?e.tag:["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"][63&t];let n=0!==(this.transformVersion=(192&this.flags)>>6);"glyf"!==this.tag&&"loca"!==this.tag||(n=3!==this.transformVersion),this.origLength=e.uint128,n&&(this.transformLength=e.uint128)}}const ep={};let tp=!1;function np(e,t,n){let a=t.tag.replace(/[^\w\d]/g,""),r=ep[a];return r?new r(t,n,e):(console.warn(`lib-font has no definition for ${a}. The table was skipped.`),{})}function ap(){let e=0;function t(n,a){if(!tp)return e>10?a(new Error("loading took too long")):(e++,setTimeout((()=>t(n)),250));n(np)}return new Promise(((e,n)=>t(e)))}async function rp(e,t,n={}){if(!globalThis.document)return;let a=function(e,t){let n=e.lastIndexOf("."),a=(e.substring(n+1)||"").toLowerCase(),r={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[a];if(r)return r;let s={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."}[a];if(s||(s=`${e} is not a known webfont format.`),t)throw new Error(s);console.warn(`Could not load font: ${s}`)}(t,n.errorOnStyle);if(!a)return;let r=document.createElement("style");r.className="injected-by-Font-js";let s=[];return n.styleRules&&(s=Object.entries(n.styleRules).map((([e,t])=>`${e}: ${t};`))),r.textContent=`\n@font-face {\n font-family: "${e}";\n ${s.join("\n\t")}\n src: url("${t}") format("${a}");\n}`,globalThis.document.head.appendChild(r),r}Promise.all([Promise.resolve().then((function(){return Tp})),Promise.resolve().then((function(){return Pp})),Promise.resolve().then((function(){return Ip})),Promise.resolve().then((function(){return Ap})),Promise.resolve().then((function(){return Np})),Promise.resolve().then((function(){return Fp})),Promise.resolve().then((function(){return Dp})),Promise.resolve().then((function(){return Vp})),Promise.resolve().then((function(){return Kp})),Promise.resolve().then((function(){return oh})),Promise.resolve().then((function(){return rf})),Promise.resolve().then((function(){return sf})),Promise.resolve().then((function(){return cf})),Promise.resolve().then((function(){return mf})),Promise.resolve().then((function(){return pf})),Promise.resolve().then((function(){return hf})),Promise.resolve().then((function(){return gf})),Promise.resolve().then((function(){return yf})),Promise.resolve().then((function(){return vf})),Promise.resolve().then((function(){return _f})),Promise.resolve().then((function(){return bf})),Promise.resolve().then((function(){return Ef})),Promise.resolve().then((function(){return xf})),Promise.resolve().then((function(){return Pf})),Promise.resolve().then((function(){return Mf})),Promise.resolve().then((function(){return Af})),Promise.resolve().then((function(){return Nf})),Promise.resolve().then((function(){return Of})),Promise.resolve().then((function(){return Rf})),Promise.resolve().then((function(){return Bf})),Promise.resolve().then((function(){return Hf})),Promise.resolve().then((function(){return jf})),Promise.resolve().then((function(){return qf})),Promise.resolve().then((function(){return Xf})),Promise.resolve().then((function(){return Jf})),Promise.resolve().then((function(){return Qf})),Promise.resolve().then((function(){return eg})),Promise.resolve().then((function(){return tg})),Promise.resolve().then((function(){return sg})),Promise.resolve().then((function(){return ig})),Promise.resolve().then((function(){return lg}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];ep[t]=e[t]})),tp=!0}));const sp=[0,1,0,0],ip=[79,84,84,79],op=[119,79,70,70],lp=[119,79,70,50];function cp(e,t){if(e.length===t.length){for(let n=0;n{globalThis.document&&!this.options.skipStyleSheet&&await rp(this.name,e,this.options),this.loadFont(e)})()}async loadFont(e,t){fetch(e).then((e=>function(e){if(!e.ok)throw new Error(`HTTP ${e.status} - ${e.statusText}`);return e}(e)&&e.arrayBuffer())).then((n=>this.fromDataBuffer(n,t||e))).catch((n=>{const a=new Dm("error",n,`Failed to load font at ${t||e}`);this.dispatch(a),this.onerror&&this.onerror(a)}))}async fromDataBuffer(e,t){this.fontData=new DataView(e);let n=function(e){const t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];return cp(t,sp)||cp(t,ip)?"SFNT":cp(t,op)?"WOFF":cp(t,lp)?"WOFF2":void 0}(this.fontData);if(!n)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(n);const a=new Dm("load",{font:this});this.dispatch(a),this.onload&&this.onload(a)}async parseBasicData(e){return ap().then((t=>("SFNT"===e&&(this.opentype=new Um(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new qm(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new Qm(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 0!==this.getGlyphId(e)}supportsVariation(e){return!1!==this.opentype.tables.cmap.supportsVariation(e)}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let n=document.createElement("div");n.textContent=e,n.style.fontFamily=this.name,n.style.fontSize=`${t}px`,n.style.color="transparent",n.style.background="transparent",n.style.top="0",n.style.left="0",n.style.position="absolute",document.body.appendChild(n);let a=n.getBoundingClientRect();document.body.removeChild(n);const r=this.opentype.tables["OS/2"];return a.fontSize=t,a.ascender=r.sTypoAscender,a.descender=r.sTypoDescender,a}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new Dm("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);const e=new Dm("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=up;class dp extends zm{constructor(e,t,n){super(e),this.plaformID=t,this.encodingID=n}}class mp extends dp{constructor(e,t,n){super(e,t,n),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map((t=>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}]}}class pp extends dp{constructor(e,t,n){super(e,t,n),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map((t=>e.uint16));const a=Math.max(...this.subHeaderKeys),r=e.currentPosition;Hm(this,"subHeaders",(()=>(e.currentPosition=r,[...new Array(a)].map((t=>new hp(e))))));const s=r+8*a;Hm(this,"glyphIndexArray",(()=>(e.currentPosition=s,[...new Array(a)].map((t=>e.uint16)))))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));const t=e&&255,n=e&&65280,a=this.subHeaders[n],r=this.subHeaders[a],s=r.firstCode,i=s+r.entryCount;return s<=t&&t<=i}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map((e=>({firstCode:e.firstCode,lastCode:e.lastCode}))):this.subHeaders.map((e=>({start:e.firstCode,end:e.lastCode})))}}class hp{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}}class fp extends dp{constructor(e,t,n){super(e,t,n),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;const a=e.currentPosition;Hm(this,"endCode",(()=>e.readBytes(this.segCount,a,16)));const r=a+2+this.segCountX2;Hm(this,"startCode",(()=>e.readBytes(this.segCount,r,16)));const s=r+this.segCountX2;Hm(this,"idDelta",(()=>e.readBytes(this.segCount,s,16,!0)));const i=s+this.segCountX2;Hm(this,"idRangeOffset",(()=>e.readBytes(this.segCount,i,16)));const o=i+this.segCountX2,l=this.length-(o-this.tableStart);Hm(this,"glyphIdArray",(()=>e.readBytes(l,o,16))),Hm(this,"segments",(()=>this.buildSegments(i,o,e)))}buildSegments(e,t,n){return[...new Array(this.segCount)].map(((t,a)=>{let r=this.startCode[a],s=this.endCode[a],i=this.idDelta[a],o=this.idRangeOffset[a],l=e+2*a,c=[];if(0===o)for(let e=r+i,t=s+i;e<=t;e++)c.push(e);else for(let e=0,t=s-r;e<=t;e++)n.currentPosition=l+o+2*e,c.push(n.uint16);return{startCode:r,endCode:s,idDelta:i,idRangeOffset:o,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const n=t.startCode+t.glyphIDs.indexOf(e);return{code:n,unicode:String.fromCodePoint(n)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343)return 0;if(65534==(65534&e)||65535==(65535&e))return 0;let t=this.segments.find((t=>t.startCode<=e&&e<=t.endCode));return t?t.glyphIDs[e-t.startCode]:0}supports(e){return 0!==this.getGlyphId(e)}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map((e=>({start:e.startCode,end:e.endCode})))}}class gp extends dp{constructor(e,t,n){super(e,t,n),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;Hm(this,"glyphIdArray",(()=>[...new Array(this.entryCount)].map((t=>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{};const 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}]}}class yp extends dp{constructor(e,t,n){super(e,t,n),this.format=8,e.uint16,this.length=e.uint32,this.language=e.uint32,this.is32=[...new Array(8192)].map((t=>e.uint8)),this.numGroups=e.uint32;Hm(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new vp(e)))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.")),-1!==this.groups.findIndex((t=>t.startcharCode<=e&&e<=t.endcharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 8"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startcharCode,end:e.endcharCode})))}}class vp{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class _p extends dp{constructor(e,t,n){super(e,t,n),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;Hm(this,"glyphs",(()=>[...new Array(this.numChars)].map((t=>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)&&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}]}}class bp extends dp{constructor(e,t,n){super(e,t,n),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;Hm(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Ep(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343||65534==(65534&e)||65535==(65535&e)?0:-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){for(let t of this.groups){let n=t.startGlyphID;if(n>e)continue;if(n===e)return t.startCharCode;if(n+(t.endCharCode-t.startCharCode)({start:e.startCharCode,end:e.endCharCode})))}}class Ep{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class wp extends dp{constructor(e,t,n){super(e,t,n),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;Hm(this,"groups",[...new Array(this.numGroups)].map((t=>new xp(e))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 13"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class xp{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class Sp extends dp{constructor(e,t,n){super(e,t,n),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,Hm(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new Cp(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((t=>t.varSelector===e));return t||!1}getSupportedVariations(){return this.varSelectors.map((e=>e.varSelector))}}class Cp{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class kp{constructor(e,t){const n=this.platformID=e.uint16,a=this.encodingID=e.uint16,r=this.offset=e.Offset32;Hm(this,"table",(()=>(e.currentPosition=t+r,function(e,t,n){const a=e.uint16;return 0===a?new mp(e,t,n):2===a?new pp(e,t,n):4===a?new fp(e,t,n):6===a?new gp(e,t,n):8===a?new yp(e,t,n):10===a?new _p(e,t,n):12===a?new bp(e,t,n):13===a?new wp(e,t,n):14===a?new Sp(e,t,n):{}}(e,n,a))))}}var Tp=Object.freeze({__proto__:null,cmap:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numTables=n.uint16,this.encodingRecords=[...new Array(this.numTables)].map((e=>new kp(n,this.tableStart)))}getSubTable(e){return this.encodingRecords[e].table}getSupportedEncodings(){return this.encodingRecords.map((e=>({platformID:e.platformID,encodingId:e.encodingID})))}getSupportedCharCodes(e,t){const n=this.encodingRecords.findIndex((n=>n.platformID===e&&n.encodingID===t));if(-1===n)return!1;return this.getSubTable(n).getSupportedCharCodes()}reverse(e){for(let t=0;t{let r=this.getSubTable(a);return!!r.getGlyphId&&(t=r.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,n)=>{const a=this.getSubTable(n);return a.supports&&!1!==a.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,n)=>{const a=this.getSubTable(n);return a.supportsVariation&&!1!==a.supportsVariation(e)}))}}});var Pp=Object.freeze({__proto__:null,head:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.load({majorVersion:n.uint16,minorVersion:n.uint16,fontRevision:n.fixed,checkSumAdjustment:n.uint32,magicNumber:n.uint32,flags:n.flags(16),unitsPerEm:n.uint16,created:n.longdatetime,modified:n.longdatetime,xMin:n.int16,yMin:n.int16,xMax:n.int16,yMax:n.int16,macStyle:n.flags(16),lowestRecPPEM:n.uint16,fontDirectionHint:n.uint16,indexToLocFormat:n.uint16,glyphDataFormat:n.uint16})}}});var Ip=Object.freeze({__proto__:null,hhea:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.ascender=n.fword,this.descender=n.fword,this.lineGap=n.fword,this.advanceWidthMax=n.ufword,this.minLeftSideBearing=n.fword,this.minRightSideBearing=n.fword,this.xMaxExtent=n.fword,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,n.int16,n.int16,n.int16,n.int16,this.metricDataFormat=n.int16,this.numberOfHMetrics=n.uint16,n.verifyLength()}}});class Mp{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var Ap=Object.freeze({__proto__:null,hmtx:class extends Gm{constructor(e,t,n){const{p:a}=super(e,t),r=n.hhea.numberOfHMetrics,s=n.maxp.numGlyphs,i=a.currentPosition;if(Hm(this,"hMetrics",(()=>(a.currentPosition=i,[...new Array(r)].map((e=>new Mp(a.uint16,a.int16)))))),r(a.currentPosition=e,[...new Array(s-r)].map((e=>a.int16)))))}}}});var Np=Object.freeze({__proto__:null,maxp:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.legacyFixed,this.numGlyphs=n.uint16,1===this.version&&(this.maxPoints=n.uint16,this.maxContours=n.uint16,this.maxCompositePoints=n.uint16,this.maxCompositeContours=n.uint16,this.maxZones=n.uint16,this.maxTwilightPoints=n.uint16,this.maxStorage=n.uint16,this.maxFunctionDefs=n.uint16,this.maxInstructionDefs=n.uint16,this.maxStackElements=n.uint16,this.maxSizeOfInstructions=n.uint16,this.maxComponentElements=n.uint16,this.maxComponentDepth=n.uint16),n.verifyLength()}}});class Op{constructor(e,t){this.length=e,this.offset=t}}class Rp{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,Hm(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:n,length:a}=t;if(0===a)return"";if(0===n||3===n){const t=[];for(let n=0,r=a/2;nnew Rp(n,this))),1===this.format&&(this.langTagCount=n.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new Op(n.uint16,n.Offset16)))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find((t=>t.nameID===e));if(t)return t.string}}});var Dp=Object.freeze({__proto__:null,OS2:class extends Gm{constructor(e,t){const{p:n}=super(e,t);return this.version=n.uint16,this.xAvgCharWidth=n.int16,this.usWeightClass=n.uint16,this.usWidthClass=n.uint16,this.fsType=n.uint16,this.ySubscriptXSize=n.int16,this.ySubscriptYSize=n.int16,this.ySubscriptXOffset=n.int16,this.ySubscriptYOffset=n.int16,this.ySuperscriptXSize=n.int16,this.ySuperscriptYSize=n.int16,this.ySuperscriptXOffset=n.int16,this.ySuperscriptYOffset=n.int16,this.yStrikeoutSize=n.int16,this.yStrikeoutPosition=n.int16,this.sFamilyClass=n.int16,this.panose=[...new Array(10)].map((e=>n.uint8)),this.ulUnicodeRange1=n.flags(32),this.ulUnicodeRange2=n.flags(32),this.ulUnicodeRange3=n.flags(32),this.ulUnicodeRange4=n.flags(32),this.achVendID=n.tag,this.fsSelection=n.uint16,this.usFirstCharIndex=n.uint16,this.usLastCharIndex=n.uint16,this.sTypoAscender=n.int16,this.sTypoDescender=n.int16,this.sTypoLineGap=n.int16,this.usWinAscent=n.uint16,this.usWinDescent=n.uint16,0===this.version?n.verifyLength():(this.ulCodePageRange1=n.flags(32),this.ulCodePageRange2=n.flags(32),1===this.version?n.verifyLength():(this.sxHeight=n.int16,this.sCapHeight=n.int16,this.usDefaultChar=n.uint16,this.usBreakChar=n.uint16,this.usMaxContext=n.uint16,this.version<=4?n.verifyLength():(this.usLowerOpticalPointSize=n.uint16,this.usUpperOpticalPointSize=n.uint16,5===this.version?n.verifyLength():void 0)))}}});const Bp=[".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"];var Vp=Object.freeze({__proto__:null,post:class extends Gm{constructor(e,t){const{p:n}=super(e,t);if(this.version=n.legacyFixed,this.italicAngle=n.fixed,this.underlinePosition=n.fword,this.underlineThickness=n.fword,this.isFixedPitch=n.uint32,this.minMemType42=n.uint32,this.maxMemType42=n.uint32,this.minMemType1=n.uint32,this.maxMemType1=n.uint32,1===this.version||3===this.version)return n.verifyLength();if(this.numGlyphs=n.uint16,2===this.version){this.glyphNameIndex=[...new Array(this.numGlyphs)].map((e=>n.uint16)),this.namesOffset=n.currentPosition,this.glyphNameOffsets=[1];for(let e=0;en.int8)))}getGlyphName(e){if(2!==this.version)return console.warn(`post table version ${this.version} does not support glyph name lookups`),"";let t=this.glyphNameIndex[e];if(t<258)return Bp[t];let n=this.glyphNameOffsets[e],a=this.glyphNameOffsets[e+1]-n-1;if(0===a)return".notdef.";this.parser.currentPosition=this.namesOffset+n;return this.parser.readBytes(a,this.namesOffset+n,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class Lp extends Gm{constructor(e,t){const{p:n}=super(e,t,"AxisTable");this.baseTagListOffset=n.Offset16,this.baseScriptListOffset=n.Offset16,Hm(this,"baseTagList",(()=>new zp({offset:e.offset+this.baseTagListOffset},t))),Hm(this,"baseScriptList",(()=>new Gp({offset:e.offset+this.baseScriptListOffset},t)))}}class zp extends Gm{constructor(e,t){const{p:n}=super(e,t,"BaseTagListTable");this.baseTagCount=n.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map((e=>n.tag))}}class Gp extends Gm{constructor(e,t){const{p:n}=super(e,t,"BaseScriptListTable");this.baseScriptCount=n.uint16;const a=n.currentPosition;Hm(this,"baseScriptRecords",(()=>(n.currentPosition=a,[...new Array(this.baseScriptCount)].map((e=>new Hp(this.start,n))))))}}class Hp{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,Hm(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new Up(t))))}}class Up{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 Wp(this.start,e))),Hm(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new jp(e)))),Hm(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new Zp(e))))}}class Wp{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,Hm(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new Zp(t))))}}class jp{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 Yp(this.parser)}}class Zp{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;Hm(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new qp(e))))))}}class qp{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class Yp{constructor(e){this.baseCoordFormat=e.uint16,this.coordinate=e.int16,2===this.baseCoordFormat&&(this.referenceGlyph=e.uint16,this.baseCoordPoint=e.uint16),3===this.baseCoordFormat&&(this.deviceTable=e.Offset16)}}var Kp=Object.freeze({__proto__:null,BASE:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.horizAxisOffset=n.Offset16,this.vertAxisOffset=n.Offset16,Hm(this,"horizAxis",(()=>new Lp({offset:e.offset+this.horizAxisOffset},t))),Hm(this,"vertAxis",(()=>new Lp({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,Hm(this,"itemVarStore",(()=>new Lp({offset:e.offset+this.itemVarStoreOffset},t))))}}});class Xp{constructor(e){this.classFormat=e.uint16,1===this.classFormat&&(this.startGlyphID=e.uint16,this.glyphCount=e.uint16,this.classValueArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.classFormat&&(this.classRangeCount=e.uint16,this.classRangeRecords=[...new Array(this.classRangeCount)].map((t=>new Jp(e))))}}class Jp{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class Qp extends zm{constructor(e){super(e),this.coverageFormat=e.uint16,1===this.coverageFormat&&(this.glyphCount=e.uint16,this.glyphArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.coverageFormat&&(this.rangeCount=e.uint16,this.rangeRecords=[...new Array(this.rangeCount)].map((t=>new $p(e))))}}class $p{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class eh{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((e=>t.Offset32))}}class th extends zm{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 nh(this.parser)}}class nh{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class ah extends zm{constructor(e){super(e),this.coverageOffset=e.Offset16,Hm(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new Qp(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 rh(this.parser)}}class rh extends zm{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 sh(this.parser)}}class sh{constructor(e){this.caretValueFormat=e.uint16,1===this.caretValueFormat&&(this.coordinate=e.int16),2===this.caretValueFormat&&(this.caretValuePointIndex=e.uint16),3===this.caretValueFormat&&(this.coordinate=e.int16,this.deviceOffset=e.Offset16)}}class ih extends zm{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 Qp(this.parser)}}var oh=Object.freeze({__proto__:null,GDEF:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.glyphClassDefOffset=n.Offset16,Hm(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return n.currentPosition=this.tableStart+this.glyphClassDefOffset,new Xp(n)})),this.attachListOffset=n.Offset16,Hm(this,"attachList",(()=>{if(0!==this.attachListOffset)return n.currentPosition=this.tableStart+this.attachListOffset,new th(n)})),this.ligCaretListOffset=n.Offset16,Hm(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return n.currentPosition=this.tableStart+this.ligCaretListOffset,new ah(n)})),this.markAttachClassDefOffset=n.Offset16,Hm(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return n.currentPosition=this.tableStart+this.markAttachClassDefOffset,new Xp(n)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=n.Offset16,Hm(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return n.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new ih(n)}))),3===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,Hm(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return n.currentPosition=this.tableStart+this.itemVarStoreOffset,new eh(n)})))}}});class lh extends zm{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new ch(e)))}}class ch{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class uh extends zm{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new dh(e)))}}class dh{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class mh{constructor(e){this.lookupOrder=e.Offset16,this.requiredFeatureIndex=e.uint16,this.featureIndexCount=e.uint16,this.featureIndices=[...new Array(this.featureIndexCount)].map((t=>e.uint16))}}class ph extends zm{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new hh(e)))}}class hh{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class fh extends zm{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){const e=this.parser;e.currentPosition=this.start+this.featureParams;const t=this.featureTag;if("size"===t)return new yh(e);if(t.startsWith("cc"))return new gh(e);if(t.startsWith("ss"))return new vh(e)}}}class gh{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))}}class yh{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class vh{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function _h(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class bh extends zm{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 Qp(e)}}class Eh{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class wh extends bh{constructor(e){super(e),this.deltaGlyphID=e.int16}}class xh extends bh{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 Sh(t)}}class Sh{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Ch extends bh{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 kh(t)}}class kh{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Th extends bh{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 Ph(t)}}class Ph extends zm{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 Ih(t)}}class Ih{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class Mh extends bh{constructor(e){super(e),1===this.substFormat&&(this.subRuleSetCount=e.uint16,this.subRuleSetOffsets=[...new Array(this.subRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.classDefOffset=e.Offset16,this.subClassSetCount=e.uint16,this.subClassSetOffsets=[...new Array(this.subClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(_h(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 Eh(e))))}getSubRuleSet(e){if(1!==this.substFormat)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 Ah(t)}getSubClassSet(e){if(2!==this.substFormat)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 Oh(t)}getCoverageTable(e){if(3!==this.substFormat&&!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 Qp(t)}}class Ah extends zm{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 Nh(t)}}class Nh{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 Eh(e)))}}class Oh extends zm{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 Rh(t)}}class Rh extends Nh{constructor(e){super(e)}}class Fh extends bh{constructor(e){super(e),1===this.substFormat&&(this.chainSubRuleSetCount=e.uint16,this.chainSubRuleSetOffsets=[...new Array(this.chainSubRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(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))),3===this.substFormat&&(_h(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 zh(e))))}getChainSubRuleSet(e){if(1!==this.substFormat)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 Dh(t)}getChainSubClassSet(e){if(2!==this.substFormat)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 Vh(t)}getCoverageFromOffset(e){if(3!==this.substFormat)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 Qp(t)}}class Dh extends zm{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 Bh(t)}}class Bh{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 Eh(e)))}}class Vh extends zm{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 Lh(t)}}class Lh{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 zh(e)))}}class zh extends zm{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Gh extends zm{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class Hh extends bh{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))}}var Uh={buildSubtable:function(e,t){const n=new[void 0,wh,xh,Ch,Th,Mh,Fh,Gh,Hh][e](t);return n.type=e,n}};class Wh extends zm{constructor(e){super(e)}}class jh extends Wh{constructor(e){super(e),console.log("lookup type 1")}}class Zh extends Wh{constructor(e){super(e),console.log("lookup type 2")}}class qh extends Wh{constructor(e){super(e),console.log("lookup type 3")}}class Yh extends Wh{constructor(e){super(e),console.log("lookup type 4")}}class Kh extends Wh{constructor(e){super(e),console.log("lookup type 5")}}class Xh extends Wh{constructor(e){super(e),console.log("lookup type 6")}}class Jh extends Wh{constructor(e){super(e),console.log("lookup type 7")}}class Qh extends Wh{constructor(e){super(e),console.log("lookup type 8")}}class $h extends Wh{constructor(e){super(e),console.log("lookup type 9")}}var ef={buildSubtable:function(e,t){const n=new[void 0,jh,Zh,qh,Yh,Kh,Xh,Jh,Qh,$h][e](t);return n.type=e,n}};class tf extends zm{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class nf extends zm{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((t=>e.Offset16)),this.markFilteringSet=e.uint16}get rightToLeft(){return!0&this.lookupFlag}get ignoreBaseGlyphs(){return!0&this.lookupFlag}get ignoreLigatures(){return!0&this.lookupFlag}get ignoreMarks(){return!0&this.lookupFlag}get useMarkFilteringSet(){return!0&this.lookupFlag}get markAttachmentType(){return!0&this.lookupFlag}getSubTable(e){const t="GSUB"===this.ctType?Uh:ef;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class af extends Gm{constructor(e,t,n){const{p:a,tableStart:r}=super(e,t,n);this.majorVersion=a.uint16,this.minorVersion=a.uint16,this.scriptListOffset=a.Offset16,this.featureListOffset=a.Offset16,this.lookupListOffset=a.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=a.Offset32);const s=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);Hm(this,"scriptList",(()=>s?lh.EMPTY:(a.currentPosition=r+this.scriptListOffset,new lh(a)))),Hm(this,"featureList",(()=>s?ph.EMPTY:(a.currentPosition=r+this.featureListOffset,new ph(a)))),Hm(this,"lookupList",(()=>s?tf.EMPTY:(a.currentPosition=r+this.lookupListOffset,new tf(a)))),this.featureVariationsOffset&&Hm(this,"featureVariations",(()=>s?FeatureVariations.EMPTY:(a.currentPosition=r+this.featureVariationsOffset,new FeatureVariations(a))))}getSupportedScripts(){return this.scriptList.scriptRecords.map((e=>e.scriptTag))}getScriptTable(e){let t=this.scriptList.scriptRecords.find((t=>t.scriptTag===e));this.parser.currentPosition=this.scriptList.start+t.scriptOffset;let n=new uh(this.parser);return n.scriptTag=e,n}ensureScriptTable(e){return"string"==typeof e?this.getScriptTable(e):e}getSupportedLangSys(e){const t=0!==(e=this.ensureScriptTable(e)).defaultLangSys,n=e.langSysRecords.map((e=>e.langSysTag));return t&&n.unshift("dflt"),n}getDefaultLangSysTable(e){let t=(e=this.ensureScriptTable(e)).defaultLangSys;if(0!==t){this.parser.currentPosition=e.start+t;let n=new mh(this.parser);return n.langSysTag="",n.defaultForScript=e.scriptTag,n}}getLangSysTable(e,t="dflt"){if("dflt"===t)return this.getDefaultLangSysTable(e);let n=(e=this.ensureScriptTable(e)).langSysRecords.find((e=>e.langSysTag===t));this.parser.currentPosition=e.start+n.langSysOffset;let a=new mh(this.parser);return a.langSysTag=t,a}getFeatures(e){return e.featureIndices.map((e=>this.getFeature(e)))}getFeature(e){let t;if(t=parseInt(e)==e?this.featureList.featureRecords[e]:this.featureList.featureRecords.find((t=>t.featureTag===e)),!t)return;this.parser.currentPosition=this.featureList.start+t.featureOffset;let n=new fh(this.parser);return n.featureTag=t.featureTag,n}getLookups(e){return e.lookupListIndices.map((e=>this.getLookup(e)))}getLookup(e,t){let n=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+n,new nf(this.parser,t)}}var rf=Object.freeze({__proto__:null,GSUB:class extends af{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var sf=Object.freeze({__proto__:null,GPOS:class extends af{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class of extends zm{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new lf(e)))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let n=this.start+t.svgDocOffset;return this.parser.currentPosition=n,this.parser.readBytes(t.svgDocLength)}getDocumentForGlyph(e){let t=this.documentRecords.findIndex((t=>t.startGlyphID<=e&&e<=t.endGlyphID));return-1===t?"":this.getDocument(t)}}class lf{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var cf=Object.freeze({__proto__:null,SVG:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.offsetToSVGDocumentList=n.Offset32,n.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new of(n)}}});class uf{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}}class df{constructor(e,t,n){let a=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-a(n.currentPosition=a,[...new Array(this.axisCount)].map((e=>new uf(n))))));const r=a+this.axisCount*this.axisSize;Hm(this,"instances",(()=>{let e=[];for(let t=0;te.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var pf=Object.freeze({__proto__:null,cvt:class extends Gm{constructor(e,t){const{p:n}=super(e,t),a=e.length/2;Hm(this,"items",(()=>[...new Array(a)].map((e=>n.fword))))}}});var hf=Object.freeze({__proto__:null,fpgm:class extends Gm{constructor(e,t){const{p:n}=super(e,t);Hm(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});class ff{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var gf=Object.freeze({__proto__:null,gasp:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRanges=n.uint16;Hm(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new ff(n)))))}}});var yf=Object.freeze({__proto__:null,glyf:class extends Gm{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var vf=Object.freeze({__proto__:null,loca:class extends Gm{constructor(e,t,n){const{p:a}=super(e,t),r=n.maxp.numGlyphs+1;0===n.head.indexToLocFormat?(this.x2=!0,Hm(this,"offsets",(()=>[...new Array(r)].map((e=>a.Offset16))))):Hm(this,"offsets",(()=>[...new Array(r)].map((e=>a.Offset32))))}getGlyphDataOffsetAndLength(e){let t=this.offsets[e]*this.x2?2:1;return{offset:t,length:(this.offsets[e+1]*this.x2?2:1)-t}}}});var _f=Object.freeze({__proto__:null,prep:class extends Gm{constructor(e,t){const{p:n}=super(e,t);Hm(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});var bf=Object.freeze({__proto__:null,CFF:class extends Gm{constructor(e,t){const{p:n}=super(e,t);Hm(this,"data",(()=>n.readBytes()))}}});var Ef=Object.freeze({__proto__:null,CFF2:class extends Gm{constructor(e,t){const{p:n}=super(e,t);Hm(this,"data",(()=>n.readBytes()))}}});class wf{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var xf=Object.freeze({__proto__:null,VORG:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.defaultVertOriginY=n.int16,this.numVertOriginYMetrics=n.uint16,Hm(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new wf(n)))))}}});class Sf{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new kf(e),this.vert=new kf(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}}class Cf{constructor(e){this.hori=new kf(e),this.vert=new kf(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class kf{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}}class Tf extends Gm{constructor(e,t,n){const{p:a}=super(e,t,n);this.majorVersion=a.uint16,this.minorVersion=a.uint16,this.numSizes=a.uint32,Hm(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new Sf(a)))))}}var Pf=Object.freeze({__proto__:null,EBLC:Tf});class If extends Gm{constructor(e,t,n){const{p:a}=super(e,t,n);this.majorVersion=a.uint16,this.minorVersion=a.uint16}}var Mf=Object.freeze({__proto__:null,EBDT:If});var Af=Object.freeze({__proto__:null,EBSC:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,Hm(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new Cf(n)))))}}});var Nf=Object.freeze({__proto__:null,CBLC:class extends Tf{constructor(e,t){super(e,t,"CBLC")}}});var Of=Object.freeze({__proto__:null,CBDT:class extends If{constructor(e,t){super(e,t,"CBDT")}}});var Rf=Object.freeze({__proto__:null,sbix:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.flags=n.flags(16),this.numStrikes=n.uint32,Hm(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>n.Offset32))))}}});class Ff{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class Df{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var Bf=Object.freeze({__proto__:null,COLR:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numBaseGlyphRecords=n.uint16,this.baseGlyphRecordsOffset=n.Offset32,this.layerRecordsOffset=n.Offset32,this.numLayerRecords=n.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let n=new Ff(this.parser),a=n.gID,r=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=r;let s=new Ff(this.parser),i=s.gID;if(a===e)return n;if(i===e)return s;for(;t!==r;){let n=t+(r-t)/12;this.parser.currentPosition=n;let a=new Ff(this.parser),s=a.gID;if(s===e)return a;s>e?r=n:snew Df(p)))}}});class Vf{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class Lf{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class zf{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class Gf{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var Hf=Object.freeze({__proto__:null,CPAL:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numPaletteEntries=n.uint16;const a=this.numPalettes=n.uint16;this.numColorRecords=n.uint16,this.offsetFirstColorRecord=n.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>n.uint16)),Hm(this,"colorRecords",(()=>(n.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new Vf(n)))))),1===this.version&&(this.offsetPaletteTypeArray=n.Offset32,this.offsetPaletteLabelArray=n.Offset32,this.offsetPaletteEntryLabelArray=n.Offset32,Hm(this,"paletteTypeArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new Lf(n,a)))),Hm(this,"paletteLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new zf(n,a)))),Hm(this,"paletteEntryLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new Gf(n,a)))))}}});class Uf{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class Wf{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var jf=Object.freeze({__proto__:null,DSIG:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.numSignatures=n.uint16,this.flags=n.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map((e=>new Uf(n)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new Wf(this.parser)}}});class Zf{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var qf=Object.freeze({__proto__:null,hdmx:class extends Gm{constructor(e,t,n){const{p:a}=super(e,t),r=n.hmtx.numGlyphs;this.version=a.uint16,this.numRecords=a.int16,this.sizeDeviceRecord=a.int32,this.records=[...new Array(numRecords)].map((e=>new Zf(a,r)))}}});class Yf{constructor(e){this.version=e.uint16,this.length=e.uint16,this.coverage=e.flags(8),this.format=e.uint8,0===this.format&&(this.nPairs=e.uint16,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16,Hm(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new Kf(e)))))),2===this.format&&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]}}class Kf{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var Xf=Object.freeze({__proto__:null,kern:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.nTables=n.uint16,Hm(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let a=0;a[...new Array(this.mergeClassCount)].map((e=>n.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.")}}});class $f{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)}}var eg=Object.freeze({__proto__:null,meta:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint32,this.flags=n.uint32,n.uint32,this.dataMapsCount=n.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map((e=>new $f(this.tableStart,n)))}}});var tg=Object.freeze({__proto__:null,PCLT:class extends Gm{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.")}}});class ng{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class ag{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new rg(e)))}}class rg{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var sg=Object.freeze({__proto__:null,VDMX:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRecs=n.uint16,this.numRatios=n.uint16,this.ratRanges=[...new Array(this.numRatios)].map((e=>new ng(n))),this.offsets=[...new Array(this.numRatios)].map((e=>n.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new ag(n)))}}});var ig=Object.freeze({__proto__:null,vhea:class extends Gm{constructor(e,t){const{p:n}=super(e,t);this.version=n.fixed,this.ascent=this.vertTypoAscender=n.int16,this.descent=this.vertTypoDescender=n.int16,this.lineGap=this.vertTypoLineGap=n.int16,this.advanceHeightMax=n.int16,this.minTopSideBearing=n.int16,this.minBottomSideBearing=n.int16,this.yMaxExtent=n.int16,this.caretSlopeRise=n.int16,this.caretSlopeRun=n.int16,this.caretOffset=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.reserved=n.int16,this.metricDataFormat=n.int16,this.numOfLongVerMetrics=n.uint16,n.verifyLength()}}});class og{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var lg=Object.freeze({__proto__:null,vmtx:class extends Gm{constructor(e,t,n){super(e,t);const a=n.vhea.numOfLongVerMetrics,r=n.maxp.numGlyphs,s=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=s,[...new Array(a)].map((e=>new og(p.uint16,p.int16)))))),a(p.currentPosition=e,[...new Array(r-a)].map((e=>p.int16)))))}}}});const{ProgressBar:cg}=Ke(_.privateApis);const ug=function(){const{installFont:e,notice:t,setNotice:n}=(0,f.useContext)(um),[a,r]=(0,f.useState)(!1),s=Kd.slice(0,-1).map((e=>`.${e}`)).join(", ")+` ${(0,b.__)("and")} .${Kd.slice(-1)}`,i=e=>{n(null),r(!0);const t=new Set,a=[...e].filter((e=>{if(t.has(e.name))return!1;const n=e.name.split(".").pop().toLowerCase();return!!Kd.includes(n)&&(t.add(e.name),!0)}));a.length>0&&o(a)},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await c(e);return await rm(t,t.file,"all"),t})));u(t)},c=async e=>{const t=await async function(e){return new Promise(((t,n)=>{const a=new window.FileReader;a.readAsArrayBuffer(e),a.onload=()=>t(a.result),a.onerror=n}))}(e),n=new up("Uploaded Font");n.fromDataBuffer(t,e.name);const a=(await new Promise((e=>n.onload=e))).detail.font,{name:r}=a.opentype.tables,s=r.get(16)||r.get(1),i=r.get(2).toLowerCase().includes("italic"),o=a.opentype.tables["OS/2"].usWeightClass||"normal",l=!!a.opentype.tables.fvar&&a.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:s,fontStyle:i?"italic":"normal",fontWeight:(l?`${l.minValue} ${l.maxValue}`:null)||o}},u=async t=>{const a=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:t.fontFamily.replace(/\s+/g,"-").toLowerCase(),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);if(a.length>1)return n({type:"error",message:(0,b.__)("Variants from only one font family can be uploaded at a time.")}),void r(!1);try{await e(a[0]),n({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){n({type:"error",message:e.message})}r(!1)};return(0,l.createElement)(mm,{notice:t},(0,l.createElement)(_.DropZone,{onFilesDrop:e=>{i(e)}}),(0,l.createElement)(_.__experimentalVStack,{className:"font-library-modal__local-fonts"},a&&(0,l.createElement)(_.FlexItem,null,(0,l.createElement)("div",{className:"font-library-modal__upload-area"},(0,l.createElement)(cg,null))),!a&&(0,l.createElement)(_.FormFileUpload,{accept:Kd.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{i(e.target.files)},render:({openFileDialog:e})=>(0,l.createElement)(_.Button,{className:"font-library-modal__upload-area",onClick:e},(0,l.createElement)("span",null,(0,b.__)("Upload font")))}),(0,l.createElement)(_.__experimentalSpacer,{margin:2}),(0,l.createElement)(_.__experimentalText,{className:"font-library-modal__upload-area__text"},(0,b.sprintf)((0,b.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: %s."),s))))},{Tabs:dg}=Ke(_.privateApis),mg=[{id:"installed-fonts",title:(0,b.__)("Library")},{id:"upload-fonts",title:(0,b.__)("Upload")}],pg=e=>e.map((({slug:t,name:n})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,b.__)("Install Fonts"):n})));const hg=function({onRequestClose:e,initialTabId:t="installed-fonts"}){const{collections:n,setNotice:a}=(0,f.useContext)(um),r=[...mg,...pg(n||[])];return(0,l.createElement)(_.Modal,{title:(0,b.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal"},(0,l.createElement)("div",{className:"font-library-modal__tabs"},(0,l.createElement)(dg,{initialTabId:t,onSelect:()=>{a(null)}},(0,l.createElement)(dg.TabList,null,r.map((({id:e,title:t})=>(0,l.createElement)(dg.Tab,{key:e,tabId:e},t)))),r.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,l.createElement)(ug,null);break;case"installed-fonts":t=(0,l.createElement)(Sm,null);break;default:t=(0,l.createElement)(Am,{slug:e})}return(0,l.createElement)(dg.TabPanel,{key:e,tabId:e,focusable:!1},t)})))))};const fg=function({font:e}){const{handleSetLibraryFontSelected:t,toggleModal:n}=(0,f.useContext)(um),a=e?.fontFace?.length||1,r=$d(e);return(0,l.createElement)(_.__experimentalItem,{onClick:()=>{t(e),n("installed-fonts")}},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(_.FlexItem,{style:r},e.name),(0,l.createElement)(_.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count"},(0,b.sprintf)((0,b._n)("%d variant","%d variants",a),a))))};function gg(){const{modalTabOpen:e,toggleModal:t,themeFonts:n,customFonts:a}=(0,f.useContext)(um),r=0t(),initialTabName:e}),(0,l.createElement)(_.__experimentalVStack,{spacing:3},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(xd,{level:3},(0,b.__)("Fonts")),(0,l.createElement)(_.__experimentalHStack,{justify:"flex-end"},(0,l.createElement)(_.Tooltip,{text:(0,b.__)("Manage fonts")},(0,l.createElement)(_.Button,{onClick:()=>t("installed-fonts"),"aria-label":(0,b.__)("Manage fonts"),icon:$u,size:"small"})))),r?(0,l.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},a.map((e=>(0,l.createElement)(fg,{key:e.slug,font:e}))),n.map((e=>(0,l.createElement)(fg,{key:e.slug,font:e})))):(0,l.createElement)(l.Fragment,null,(0,b.__)("No fonts installed."))))}const yg=({...e})=>(0,l.createElement)(dm,null,(0,l.createElement)(gg,{...e}));const vg=function(){const e=(0,d.useSelect)((e=>e(g.store).getEditorSettings().fontLibraryEnabled),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("Typography"),description:(0,b.__)("Manage the typography settings for different elements.")}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-typography"},(0,l.createElement)(_.__experimentalVStack,{spacing:6},e&&(0,l.createElement)(yg,null),(0,l.createElement)(Zd,null))))},{useGlobalStyle:_g,useGlobalSetting:bg,useSettingsForBlockElement:Eg,TypographyPanel:wg}=Ke(he.privateApis);function xg({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const a=n.join("."),[r]=_g(a,void 0,"user",{shouldDecodeEncode:!1}),[s,i]=_g(a,void 0,"all",{shouldDecodeEncode:!1}),[o]=bg(""),c=Eg(o,void 0,"heading"===e?t:e);return(0,l.createElement)(wg,{inheritedValue:s,value:r,onChange:i,settings:c})}const{useGlobalStyle:Sg}=Ke(he.privateApis);function Cg({name:e,element:t,headingLevel:n}){let a="";"heading"===t?a=`elements.${n}.`:t&&"text"!==t&&(a=`elements.${t}.`);const[r]=Sg(a+"typography.fontFamily",e),[s]=Sg(a+"color.gradient",e),[i]=Sg(a+"color.background",e),[o]=Sg(a+"color.text",e),[c]=Sg(a+"typography.fontSize",e),[u]=Sg(a+"typography.fontStyle",e),[d]=Sg(a+"typography.fontWeight",e),[m]=Sg(a+"typography.letterSpacing",e),p="link"===t?{textDecoration:"underline"}:{};return(0,l.createElement)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!=s?s:i,color:o,fontSize:c,fontStyle:u,fontWeight:d,letterSpacing:m,...p}},"Aa")}const kg={text:{description:(0,b.__)("Manage the fonts used on the site."),title:(0,b.__)("Text")},link:{description:(0,b.__)("Manage the fonts and typography used on the links."),title:(0,b.__)("Links")},heading:{description:(0,b.__)("Manage the fonts and typography used on headings."),title:(0,b.__)("Headings")},caption:{description:(0,b.__)("Manage the fonts and typography used on captions."),title:(0,b.__)("Captions")},button:{description:(0,b.__)("Manage the fonts and typography used on buttons."),title:(0,b.__)("Buttons")}};const Tg=function({element:e}){const[t,n]=(0,f.useState)("heading");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:kg[e].title,description:kg[e].description}),(0,l.createElement)(_.__experimentalSpacer,{marginX:4},(0,l.createElement)(Cg,{element:e,headingLevel:t})),"heading"===e&&(0,l.createElement)(_.__experimentalSpacer,{marginX:4,marginBottom:"1em"},(0,l.createElement)(_.__experimentalToggleGroupControl,{label:(0,b.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0},(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"heading",label:(0,b.__)("All")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h1",label:(0,b.__)("H1")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h2",label:(0,b.__)("H2")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h3",label:(0,b.__)("H3")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h4",label:(0,b.__)("H4")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h5",label:(0,b.__)("H5")}),(0,l.createElement)(_.__experimentalToggleGroupControlOption,{value:"h6",label:(0,b.__)("H6")}))),(0,l.createElement)(xg,{element:e,headingLevel:t}))},Pg=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG"},(0,l.createElement)(E.Path,{d:"M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"}));const Ig=function({className:e,...t}){return(0,l.createElement)(_.Flex,{className:v()("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:Mg}=Ke(he.privateApis),Ag=[];const Ng=function({name:e}){const[t]=Mg("color.palette.custom"),[n]=Mg("color.palette.theme"),[a]=Mg("color.palette.default"),[r]=Mg("color.defaultPalette",e),[s]=function(e){const[t,n]=Xe("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),a=t.map((t=>{const{color:n}=t,a=Ue(n).rotate(e).toHex();return{...t,color:a}}));n(a)}]:[]}(),i=(0,f.useMemo)((()=>[...t||Ag,...n||Ag,...a&&r?a:Ag]),[t,n,a,r]),o=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette",c=i.length>0?(0,b.sprintf)((0,b._n)("%d color","%d colors",i.length),i.length):(0,b.__)("Add custom colors");return(0,l.createElement)(_.__experimentalVStack,{spacing:3},(0,l.createElement)(xd,{level:3},(0,b.__)("Palette")),(0,l.createElement)(_.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)(Qu,{path:o,"aria-label":(0,b.__)("Color palettes")},(0,l.createElement)(_.__experimentalHStack,{direction:0===i.length?"row-reverse":"row"},(0,l.createElement)(_.__experimentalZStack,{isLayered:!1,offset:-8},i.slice(0,5).map((({color:e},t)=>(0,l.createElement)(Ig,{key:`${e}-${t}`},(0,l.createElement)(_.ColorIndicator,{colorValue:e}))))),(0,l.createElement)(_.FlexItem,null,c)))),window.__experimentalEnableColorRandomizer&&n?.length>0&&(0,l.createElement)(_.Button,{variant:"secondary",icon:Pg,onClick:s},(0,b.__)("Randomize colors")))},{useGlobalStyle:Og,useGlobalSetting:Rg,useSettingsForBlockElement:Fg,ColorPanel:Dg}=Ke(he.privateApis);const Bg=function(){const[e]=Og("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=Og("",void 0,"all",{shouldDecodeEncode:!1}),[a]=Rg(""),r=Fg(a);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("Colors"),description:(0,b.__)("Manage palettes and the default color of different global elements on the site.")}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-colors"},(0,l.createElement)(_.__experimentalVStack,{spacing:10},(0,l.createElement)(Ng,null),(0,l.createElement)(Dg,{inheritedValue:t,value:e,onChange:n,settings:r}))))},{useGlobalSetting:Vg}=Ke(he.privateApis),Lg={placement:"bottom-start",offset:8};function zg({name:e}){const[t,n]=Vg("color.palette.theme",e),[a]=Vg("color.palette.theme",e,"base"),[r,s]=Vg("color.palette.default",e),[i]=Vg("color.palette.default",e,"base"),[o,c]=Vg("color.palette.custom",e),[u]=Vg("color.defaultPalette",e),d=(0,se.useViewportMatch)("small","<")?Lg:void 0;return(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(_.__experimentalPaletteEdit,{canReset:t!==a,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:d}),!!r&&!!r.length&&!!u&&(0,l.createElement)(_.__experimentalPaletteEdit,{canReset:r!==i,canOnlyChangeValues:!0,colors:r,onChange:s,paletteLabel:(0,b.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:d}),(0,l.createElement)(_.__experimentalPaletteEdit,{colors:o,onChange:c,paletteLabel:(0,b.__)("Custom"),paletteLabelHeadingLevel:3,emptyMessage:(0,b.__)("Custom colors are empty! Add some colors to create your own color palette."),slugPrefix:"custom-",popoverProps:d}))}const{useGlobalSetting:Gg}=Ke(he.privateApis),Hg={placement:"bottom-start",offset:8},Ug=()=>{};function Wg({name:e}){const[t,n]=Gg("color.gradients.theme",e),[a]=Gg("color.gradients.theme",e,"base"),[r,s]=Gg("color.gradients.default",e),[i]=Gg("color.gradients.default",e,"base"),[o,c]=Gg("color.gradients.custom",e),[u]=Gg("color.defaultGradients",e),[d]=Gg("color.duotone.custom")||[],[m]=Gg("color.duotone.default")||[],[p]=Gg("color.duotone.theme")||[],[h]=Gg("color.defaultDuotone"),f=[...d||[],...p||[],...m&&h?m:[]],g=(0,se.useViewportMatch)("small","<")?Hg:void 0;return(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(_.__experimentalPaletteEdit,{canReset:t!==a,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:g}),!!r&&!!r.length&&!!u&&(0,l.createElement)(_.__experimentalPaletteEdit,{canReset:r!==i,canOnlyChangeValues:!0,gradients:r,onChange:s,paletteLabel:(0,b.__)("Default"),paletteLabelLevel:3,popoverProps:g}),(0,l.createElement)(_.__experimentalPaletteEdit,{gradients:o,onChange:c,paletteLabel:(0,b.__)("Custom"),paletteLabelLevel:3,emptyMessage:(0,b.__)("Custom gradients are empty! Add some gradients to create your own palette."),slugPrefix:"custom-",popoverProps:g}),!!f&&!!f.length&&(0,l.createElement)("div",null,(0,l.createElement)(xd,{level:3},(0,b.__)("Duotone")),(0,l.createElement)(_.__experimentalSpacer,{margin:3}),(0,l.createElement)(_.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:Ug})))}const{Tabs:jg}=Ke(_.privateApis);const Zg=function({name:e}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("Palette"),description:(0,b.__)("Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.")}),(0,l.createElement)(jg,null,(0,l.createElement)(jg.TabList,null,(0,l.createElement)(jg.Tab,{tabId:"solid"},"Solid"),(0,l.createElement)(jg.Tab,{tabId:"gradient"},"Gradient")),(0,l.createElement)(jg.TabPanel,{tabId:"solid",focusable:!1},(0,l.createElement)(zg,{name:e})),(0,l.createElement)(jg.TabPanel,{tabId:"gradient",focusable:!1},(0,l.createElement)(Wg,{name:e}))))},{useGlobalStyle:qg,useGlobalSetting:Yg,useSettingsForBlockElement:Kg,DimensionsPanel:Xg}=Ke(he.privateApis),Jg={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function Qg(){const[e]=qg("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=qg("",void 0,"all",{shouldDecodeEncode:!1}),[a]=Yg("",void 0,"user"),[r,s]=Yg(""),i=Kg(r),o=(0,f.useMemo)((()=>({...t,layout:i.layout})),[t,i.layout]),c=(0,f.useMemo)((()=>({...e,layout:a.layout})),[e,a.layout]);return(0,l.createElement)(Xg,{inheritedValue:o,value:c,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==a.layout){const t={...a,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,s(t)}},settings:i,includeLayoutControls:!0,defaultControls:Jg})}const{useHasDimensionsPanel:$g,useGlobalSetting:ey,useSettingsForBlockElement:ty}=Ke(he.privateApis);const ny=function(){const[e]=ey(""),t=ty(e),n=$g(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("Layout")}),n&&(0,l.createElement)(Qg,null))};const ay=function(){const{mode:e}=(0,d.useSelect)((e=>({mode:e(he.store).__unstableGetEditorMode()})),[]),t=(0,f.useRef)(null);(0,f.useEffect)((()=>{"zoom-out"!==e&&(t.current=!1)}),[e]),(0,f.useEffect)((()=>{if("zoom-out"!==e)return n("zoom-out"),t.current=!0,()=>{t.current&&n(e)}}),[]);const{__unstableSetEditorMode:n}=(0,d.useDispatch)(he.store);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{back:"/",title:(0,b.__)("Browse styles"),description:(0,b.__)("Choose a variation to change the look of the site.")}),(0,l.createElement)(_.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations"},(0,l.createElement)(_.CardBody,null,(0,l.createElement)(Ha,null))))},{useGlobalStyle:ry,AdvancedPanel:sy}=Ke(he.privateApis);const iy=function(){const e=(0,b.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=ry("",void 0,"user",{shouldDecodeEncode:!1}),[n,a]=ry("",void 0,"all",{shouldDecodeEncode:!1});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:(0,b.__)("CSS"),description:(0,l.createElement)(l.Fragment,null,e,(0,l.createElement)(_.ExternalLink,{href:"https://wordpress.org/documentation/article/css/",className:"edit-site-global-styles-screen-css-help-link"},(0,b.__)("Learn more about CSS")))}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-css"},(0,l.createElement)(sy,{value:t,onChange:a,inheritedValue:n})))},{ExperimentalBlockEditorProvider:oy,GlobalStylesContext:ly,useGlobalStylesOutputWithConfig:cy}=Ke(he.privateApis);function uy(e){return!e||0===Object.keys(e).length}const dy=function({userConfig:e,blocks:t}){const{base:n}=(0,f.useContext)(ly),a=(0,f.useMemo)((()=>uy(e)||uy(n)?{}:Ia(n,e)),[n,e]),r=(0,f.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),s=(0,d.useSelect)((e=>e(he.store).getSettings()),[]),i=(0,f.useMemo)((()=>({...s,__unstableIsPreviewMode:!0})),[s]),[o]=cy(a),c=uy(o)||uy(e)?i.styles:o;return(0,l.createElement)($a,{title:(0,b.__)("Revisions"),closeButtonLabel:(0,b.__)("Close revisions"),enableResizing:!0},(0,l.createElement)(he.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0},(0,l.createElement)(he.__unstableEditorStyles,{styles:c}),(0,l.createElement)("style",null,".is-root-container { display: flow-root; }"),(0,l.createElement)(_.Disabled,{className:"edit-site-revisions__example-preview__content"},(0,l.createElement)(oy,{value:r,settings:i},(0,l.createElement)(he.BlockList,{renderAppender:!1})))))},{getGlobalStylesChanges:my}=Ke(he.privateApis);function py({revision:e,previousRevision:t}){const n=my(e,t,{maxResults:7});return n.length?(0,l.createElement)("span",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes"},n.join(", ")):null}const hy=function({userRevisions:e,selectedRevisionId:t,onChange:n,canApplyRevision:a,onApplyRevision:r}){const{currentThemeName:s,currentUser:i}=(0,d.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:n}=e(ge.store),a=t();return{currentThemeName:a?.name?.rendered||a?.stylesheet,currentUser:n()}}),[]),o=(0,_r.getDate)().getTime(),{datetimeAbbreviated:c}=(0,_r.getSettings)().formats;return(0,l.createElement)("ol",{className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,b.__)("Global styles revisions list"),role:"group"},e.map(((u,d)=>{const{id:m,author:p,modified:h}=u,f="unsaved"===m,g=f?i:p,y=g?.name||(0,b.__)("User"),E=g?.avatar_urls?.[48],w=t?t===m:0===d,x=!a&&w,S="parent"===m,C=(0,_r.getDate)(h),k=h&&o-C.getTime()>864e5?(0,_r.dateI18n)(c,C):(0,_r.humanTimeDiff)(h),T=function(e,t,n,a){return"parent"===e?(0,b.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,b.sprintf)((0,b.__)("Unsaved changes by %s"),t):a?(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,n):(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s"),t,n)}(m,y,(0,_r.dateI18n)(c,C),x);return(0,l.createElement)("li",{className:v()("edit-site-global-styles-screen-revisions__revision-item",{"is-selected":w,"is-active":x,"is-reset":S}),key:m,"aria-current":w},(0,l.createElement)(_.Button,{className:"edit-site-global-styles-screen-revisions__revision-button",disabled:w,onClick:()=>{n(u)},"aria-label":T},S?(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__description"},(0,b.__)("Default styles"),(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__meta"},s)):(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__description"},f?(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__date"},(0,b.__)("(Unsaved)")):(0,l.createElement)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:h},k),(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__meta"},(0,l.createElement)("img",{alt:y,src:E}),y),w&&(0,l.createElement)(py,{revision:u,previousRevision:dn(1),disabled:s||1===e,"aria-label":(0,b.__)("First page")},"«"),(0,l.createElement)(_.Button,{variant:i,onClick:()=>n(e-1),disabled:s||1===e,"aria-label":(0,b.__)("Previous page")},"‹")),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.sprintf)((0,b._x)("%1$s of %2$s","paging"),e,t)),(0,l.createElement)(_.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(_.Button,{variant:i,onClick:()=>n(e+1),disabled:s||e===t,"aria-label":(0,b.__)("Next page")},"›"),(0,l.createElement)(_.Button,{variant:i,onClick:()=>n(t),disabled:s||e===t,"aria-label":(0,b.__)("Last page")},"»")))}const{GlobalStylesContext:gy,areGlobalStyleConfigsEqual:yy}=Ke(he.privateApis);const vy=function(){const{goTo:e}=(0,_.__experimentalUseNavigator)(),{user:t,setUserConfig:n}=(0,f.useContext)(gy),{blocks:a,editorCanvasContainerView:r}=(0,d.useSelect)((e=>({editorCanvasContainerView:Ke(e(ta)).getEditorCanvasContainerView(),blocks:e(he.store).getBlocks()})),[]),[s,i]=(0,f.useState)(1),[o,c]=(0,f.useState)([]),{revisions:u,isLoading:m,hasUnsavedChanges:p,revisionsCount:h}=vr({query:{per_page:10,page:s}}),g=Math.ceil(h/10),[y,v]=(0,f.useState)(t),[E,w]=(0,f.useState)(!1),{setEditorCanvasContainerView:x}=Ke((0,d.useDispatch)(ta)),S=yy(y,t),C=()=>{e("/"),x(void 0)},k=e=>{n((()=>({styles:e?.styles,settings:e?.settings}))),w(!1),C()};(0,f.useEffect)((()=>{r&&r.startsWith("global-styles-revisions")||(e("/"),x(r))}),[r]),(0,f.useEffect)((()=>{!m&&u.length&&c(u)}),[u,m]);const T=u[0],P=y?.id,I=!!T?.id&&!S&&!P;(0,f.useEffect)((()=>{I&&v({styles:T?.styles||{},settings:T?.settings||{},id:T?.id})}),[I,T]);const M=!!P&&"unsaved"!==P&&!S,A=!!o.length;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(dd,{title:h&&(0,b.sprintf)((0,b.__)("Revisions (%s)"),h),description:(0,b.__)('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}),!A&&(0,l.createElement)(_.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),A&&("global-styles-revisions:style-book"===r?(0,l.createElement)(pr,{userConfig:y,isSelected:()=>{},onClose:()=>{x("global-styles-revisions")}}):(0,l.createElement)(dy,{blocks:a,userConfig:y,closeButtonLabel:(0,b.__)("Close revisions")})),(0,l.createElement)(hy,{onChange:e=>{v({styles:e?.styles||{},settings:e?.settings||{},id:e?.id})},selectedRevisionId:P,userRevisions:o,canApplyRevision:M,onApplyRevision:()=>p?w(!0):k(y)}),g>1&&(0,l.createElement)("div",{className:"edit-site-global-styles-screen-revisions__footer"},(0,l.createElement)(fy,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:s,numPages:g,changePage:i,totalItems:h,disabled:m,label:(0,b.__)("Global Styles pagination navigation")})),E&&(0,l.createElement)(_.__experimentalConfirmDialog,{isOpen:E,confirmButtonText:(0,b.__)("Apply"),onConfirm:()=>k(y),onCancel:()=>w(!1)},(0,b.__)("Any unsaved changes will be lost when you apply this revision.")))},{useGlobalStylesReset:_y}=Ke(he.privateApis),{Slot:by,Fill:Ey}=(0,_.createSlotFill)("GlobalStylesMenu");function wy(){const[e,t]=_y(),{toggle:n}=(0,d.useDispatch)(k.store),{canEditCSS:a}=(0,d.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ge.store),a=n(),r=a?t("root","globalStyles",a):void 0;return{canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:r}=Ke((0,d.useDispatch)(ta)),{goTo:s}=(0,_.__experimentalUseNavigator)(),i=()=>{r("global-styles-css"),s("/css")};return(0,l.createElement)(Ey,null,(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("More")},(({onClose:r})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuGroup,null,a&&(0,l.createElement)(_.MenuItem,{onClick:i},(0,b.__)("Additional CSS")),(0,l.createElement)(_.MenuItem,{onClick:()=>{n("core/edit-site","welcomeGuideStyles"),r()}},(0,b.__)("Welcome Guide"))),(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(_.MenuItem,{onClick:()=>{t(),r()},disabled:!e},(0,b.__)("Reset styles")))))))}function xy({className:e,...t}){return(0,l.createElement)(_.__experimentalNavigatorScreen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Sy({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,a)=>(0,l.createElement)(xy,{key:a,path:e+"/variations/"+t.name},(0,l.createElement)(Ud,{name:n,variation:t.name}))))}function Cy({name:e,parentMenu:t=""}){const n=(0,d.useSelect)((t=>{const{getBlockStyles:n}=t(c.store);return n(e)}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(xy,{path:t+"/colors/palette"},(0,l.createElement)(Zg,{name:e})),!!n?.length&&(0,l.createElement)(Sy,{parentMenu:t,blockStyles:n,blockName:e}))}function ky(){const e=(0,_.__experimentalUseNavigator)(),{path:t}=e.location;return(0,l.createElement)(pr,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{e.goTo("/blocks/"+encodeURIComponent(t))}})}function Ty(){const e=(0,_.__experimentalUseNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(he.store),a=t();return{selectedBlockName:n(a),selectedBlockClientId:a}}),[]),a=vd(t);(0,f.useEffect)((()=>{if(!n||!a)return;const r=e.location.path;if("/blocks"!==r&&!r.startsWith("/blocks/"))return;const s="/blocks/"+encodeURIComponent(t);s!==r&&e.goTo(s,{skipFocus:!0})}),[n,t,a])}function Py(){const{goTo:e}=(0,_.__experimentalUseNavigator)(),t=(0,d.useSelect)((e=>Ke(e(ta)).getEditorCanvasContainerView()),[]);(0,f.useEffect)((()=>{switch(t){case"global-styles-revisions":case"global-styles-revisions:style-book":e("/revisions");break;case"global-styles-css":e("/css");break;default:e("/")}}),[t,e])}const Iy=function(){const e=(0,c.getBlockTypes)(),t=(0,d.useSelect)((e=>Ke(e(ta)).getEditorCanvasContainerView()),[]);return(0,l.createElement)(_.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/"},(0,l.createElement)(xy,{path:"/"},(0,l.createElement)(ld,null)),(0,l.createElement)(xy,{path:"/variations"},(0,l.createElement)(ay,null)),(0,l.createElement)(xy,{path:"/blocks"},(0,l.createElement)(Ed,null)),(0,l.createElement)(xy,{path:"/typography"},(0,l.createElement)(vg,null)),(0,l.createElement)(xy,{path:"/typography/text"},(0,l.createElement)(Tg,{element:"text"})),(0,l.createElement)(xy,{path:"/typography/link"},(0,l.createElement)(Tg,{element:"link"})),(0,l.createElement)(xy,{path:"/typography/heading"},(0,l.createElement)(Tg,{element:"heading"})),(0,l.createElement)(xy,{path:"/typography/caption"},(0,l.createElement)(Tg,{element:"caption"})),(0,l.createElement)(xy,{path:"/typography/button"},(0,l.createElement)(Tg,{element:"button"})),(0,l.createElement)(xy,{path:"/colors"},(0,l.createElement)(Bg,null)),(0,l.createElement)(xy,{path:"/layout"},(0,l.createElement)(ny,null)),(0,l.createElement)(xy,{path:"/css"},(0,l.createElement)(iy,null)),(0,l.createElement)(xy,{path:"/revisions"},(0,l.createElement)(vy,null)),e.map((e=>(0,l.createElement)(xy,{key:"menu-block-"+e.name,path:"/blocks/"+encodeURIComponent(e.name)},(0,l.createElement)(Ud,{name:e.name})))),(0,l.createElement)(Cy,null),e.map((e=>(0,l.createElement)(Cy,{key:"screens-block-"+e.name,name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)}))),"style-book"===t&&(0,l.createElement)(ky,null),(0,l.createElement)(wy,null),(0,l.createElement)(Ty,null),(0,l.createElement)(Py,null))};function My(){const{shouldClearCanvasContainerView:e,isStyleBookOpened:t,showListViewByDefault:n,hasRevisions:a,isRevisionsOpened:r,isRevisionsStyleBookOpened:s}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(W),{getEditorCanvasContainerView:n,getCanvasMode:a}=Ke(e(ta)),r=n(),s="visual"===e(ta).getEditorMode(),i="edit"===a(),o=e(k.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(ge.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===r,shouldClearCanvasContainerView:"edit-site/global-styles"!==t("core/edit-site")||!s||!i,showListViewByDefault:o,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===r,isRevisionsOpened:"global-styles-revisions"===r}}),[]),{setEditorCanvasContainerView:i}=Ke((0,d.useDispatch)(ta));(0,f.useEffect)((()=>{e&&i(void 0)}),[e]);const{setIsListViewOpened:o}=(0,d.useDispatch)(g.store),{goTo:c}=(0,_.__experimentalUseNavigator)();return(0,l.createElement)(Ku,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,b.__)("Styles"),icon:ia,closeLabel:(0,b.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,l.createElement)(_.Flex,{className:"edit-site-global-styles-sidebar__header",role:"menubar","aria-label":(0,b.__)("Styles actions")},(0,l.createElement)(_.FlexBlock,{style:{minWidth:"min-content"}},(0,l.createElement)("strong",null,(0,b.__)("Styles"))),(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.Button,{icon:_a,label:(0,b.__)("Style Book"),isPressed:t||s,disabled:e,onClick:()=>{r?i("global-styles-revisions:style-book"):s?i("global-styles-revisions"):(o(t&&n),i(t?void 0:"style-book"))}})),(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.Button,{label:(0,b.__)("Revisions"),icon:br,onClick:()=>(o(!1),s?(c("/"),void i("style-book")):r?(c("/"),void i(void 0)):(c("/revisions"),void i(t?"global-styles-revisions:style-book":"global-styles-revisions"))),disabled:!a,isPressed:r||s})),(0,l.createElement)(by,null))},(0,l.createElement)(Iy,null))}const Ay="edit-site/template",Ny="edit-site/block-inspector",Oy=({sidebarName:e})=>{const t=(0,d.useSelect)((e=>e(g.store).getPostTypeLabel()),[]),{enableComplementaryArea:n}=(0,d.useDispatch)(W),a=e===Ay?(0,b.sprintf)((0,b.__)("%s (selected)"),t):t;return(0,l.createElement)("ul",null,(0,l.createElement)("li",null,(0,l.createElement)(_.Button,{onClick:()=>n(Qt,Ay),className:v()("edit-site-sidebar-edit-mode__panel-tab",{"is-active":e===Ay}),"aria-label":a,"data-label":t},t)),(0,l.createElement)("li",null,(0,l.createElement)(_.Button,{onClick:()=>n(Qt,Ny),className:v()("edit-site-sidebar-edit-mode__panel-tab",{"is-active":e===Ny}),"aria-label":e===Ny?(0,b.__)("Block (selected)"):(0,b.__)("Block"),"data-label":(0,b.__)("Block")},(0,b.__)("Block"))))};function Ry({className:e,title:t,icon:n,description:a,actions:r,children:s}){return(0,l.createElement)("div",{className:v()("edit-site-sidebar-card",e)},(0,l.createElement)(_.Icon,{className:"edit-site-sidebar-card__icon",icon:n}),(0,l.createElement)("div",{className:"edit-site-sidebar-card__content"},(0,l.createElement)("div",{className:"edit-site-sidebar-card__header"},(0,l.createElement)("h2",{className:"edit-site-sidebar-card__title"},t),r),(0,l.createElement)("div",{className:"edit-site-sidebar-card__description"},a),s))}const{BlockQuickNavigation:Fy}=Ke(he.privateApis);function Dy(){const e=(0,d.useSelect)((e=>Ke(e(he.store)).getEnabledClientIdsTree()),[]),t=(0,f.useMemo)((()=>e.map((({clientId:e})=>e))),[e]);return(0,l.createElement)(Fy,{clientIds:t})}const{PostPanelRow:By}=Ke(g.privateApis),Vy=[{label:(0,l.createElement)(l.Fragment,null,(0,b.__)("Draft"),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.__)("Not ready to publish."))),value:"draft"},{label:(0,l.createElement)(l.Fragment,null,(0,b.__)("Pending"),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.__)("Waiting for review before publishing."))),value:"pending"},{label:(0,l.createElement)(l.Fragment,null,(0,b.__)("Private"),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.__)("Only visible to site admins and editors."))),value:"private"},{label:(0,l.createElement)(l.Fragment,null,(0,b.__)("Scheduled"),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.__)("Publish automatically on a chosen date."))),value:"future"},{label:(0,l.createElement)(l.Fragment,null,(0,b.__)("Published"),(0,l.createElement)(_.__experimentalText,{variant:"muted"},(0,b.__)("Visible to everyone."))),value:"publish"}];function Ly({postType:e,postId:t,status:n,password:a,date:r}){const[s,i]=(0,f.useState)(!!a),o=(0,se.useInstanceId)(Ly),{editEntityRecord:c}=(0,d.useDispatch)(ge.store),{createErrorNotice:u}=(0,d.useDispatch)(fe.store),[m,p]=(0,f.useState)(null),h=(0,f.useMemo)((()=>({anchor:m,"aria-label":(0,b.__)("Change status"),placement:"bottom-end"})),[m]),g=async({status:s=n,password:i=a,date:o=r})=>{try{await c("postType",e,t,{status:s,date:o,password:i})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while updating the status");u(t,{type:"snackbar"})}},y=e=>{i(e),e||g({password:""})},v=e=>{let t=r,n=a;"publish"===e?new Date(r)>new Date&&(t=null):"future"===e?(!r||new Date(r)(0,l.createElement)(_.Button,{className:"edit-site-summary-field__trigger",variant:"tertiary",onClick:e},(0,l.createElement)(nc,{status:a?"protected":n})),renderContent:({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(he.__experimentalInspectorPopoverHeader,{title:(0,b.__)("Status"),onClose:e}),(0,l.createElement)("form",null,(0,l.createElement)(_.__experimentalVStack,{spacing:5},(0,l.createElement)(_.RadioControl,{className:"edit-site-change-status__options",hideLabelFromVision:!0,label:(0,b.__)("Status"),options:Vy,onChange:v,selected:n}),"private"!==n&&(0,l.createElement)("fieldset",{className:"edit-site-change-status__password-fieldset"},(0,l.createElement)(_.__experimentalText,{as:"legend",className:"edit-site-change-status__password-legend",size:"11",lineHeight:1.4,weight:500,upperCase:!0},(0,b.__)("Password")),(0,l.createElement)(_.ToggleControl,{label:(0,b.__)("Hide this page behind a password"),checked:s,onChange:y}),s&&(0,l.createElement)("div",{className:"edit-site-change-status__password-input"},(0,l.createElement)(_.VisuallyHidden,{as:"label",htmlFor:`edit-site-change-status__password-input-${o}`},(0,b.__)("Create password")),(0,l.createElement)(_.TextControl,{onChange:e=>g({password:e}),value:a,placeholder:(0,b.__)("Use a secure password"),type:"text",id:`edit-site-change-status__password-input-${o}`}))))))}))}function zy({status:e,date:t,password:n,postId:a,postType:r}){return(0,l.createElement)(_.__experimentalVStack,{spacing:0},(0,l.createElement)(Ly,{status:e,date:t,password:n,postId:a,postType:r}),(0,l.createElement)(g.PostSchedulePanel,null),(0,l.createElement)(g.PostTemplatePanel,null),(0,l.createElement)(g.PostURLPanel,null),(0,l.createElement)(g.PostAuthorPanel,null))}function Gy(){const{id:e,type:t,hasResolved:n,status:a,date:r,password:s,title:i,modified:o,renderingMode:c}=(0,d.useSelect)((e=>{const{getEditedPostContext:t}=e(ta),{getEditedEntityRecord:n,hasFinishedResolution:a}=e(ge.store),{getRenderingMode:r}=e(g.store),s=t(),i=["postType",s.postType,s.postId],o=n(...i);return{hasResolved:a("getEditedEntityRecord",i),title:o?.title,id:o?.id,type:o?.type,status:o?.status,date:o?.date,password:o?.password,modified:o?.modified,renderingMode:r()}}),[]);return n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.PanelBody,null,(0,l.createElement)(Ry,{title:(0,en.decodeEntities)(i),icon:oa,description:(0,l.createElement)(_.__experimentalVStack,null,(0,l.createElement)(_.__experimentalText,null,(0,b.sprintf)((0,b.__)("Last edited %s"),(0,_r.humanTimeDiff)(o))))})),(0,l.createElement)(_.PanelBody,{title:(0,b.__)("Summary")},(0,l.createElement)(zy,{status:a,date:r,password:s,postId:e,postType:t})),"post-only"!==c&&(0,l.createElement)(_.PanelBody,{title:(0,b.__)("Content")},(0,l.createElement)(Dy,null)),(0,l.createElement)(g.PostLastRevisionPanel,null),(0,l.createElement)(g.PostTaxonomiesPanel,null),(0,l.createElement)(g.PostFeaturedImagePanel,null),(0,l.createElement)(g.PostExcerptPanel,null),(0,l.createElement)(g.PostDiscussionPanel,null),(0,l.createElement)(g.PageAttributesPanel,null)):null}function Hy({onClick:e,availableTemplates:t}){const{editEntityRecord:n}=(0,d.useDispatch)(ge.store),[a,r]=(0,f.useState)(!1),s=()=>{r(!1)},{postId:i,postType:o}=(0,d.useSelect)((e=>({postId:e(ta).getEditedPostId(),postType:e(ta).getEditedPostType()})),[]);return!t.length||t.length<1?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{info:(0,b.__)("Replace the contents of this template with another."),onClick:()=>r(!0)},(0,b.__)("Replace template")),a&&(0,l.createElement)(_.Modal,{title:(0,b.__)("Choose a template"),onRequestClose:s,overlayClassName:"edit-site-template-panel__replace-template-modal",isFullScreen:!0},(0,l.createElement)("div",{className:"edit-site-template-panel__replace-template-modal__content"},(0,l.createElement)(Uy,{availableTemplates:t,onSelect:async t=>{s(),e(),await n("postType",o,i,{blocks:t.blocks,content:(0,c.serialize)(t.blocks)})}}))))}function Uy({availableTemplates:e,onSelect:t}){const n=(0,se.useAsyncList)(e);return(0,l.createElement)(he.__experimentalBlockPatternsList,{label:(0,b.__)("Templates"),blockPatterns:e,shownPatterns:n,onClickPattern:t})}function Wy(e,t){return e.innerBlocks=e.innerBlocks.map((e=>Wy(e,t))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=t),e}function jy(e,t,n){return e.filter(((e,n,a)=>(e=>!Nt.includes(e.source))(e)&&((e,t,n)=>t===n.findIndex((t=>e.name===t.name)))(e,n,a)&&(e=>e.templateTypes?.includes(t.slug))(e))).map((e=>({...e,keywords:e.keywords||[],type:It.theme,blocks:(0,c.parse)(e.content,{__unstableSkipMigrationLogs:!0}).map((e=>Wy(e,n)))})))}function Zy({template:e}){const t=function(e){const{blockPatterns:t,restBlockPatterns:n,currentThemeStylesheet:a}=(0,d.useSelect)((e=>{var t;const{getSettings:n}=Ke(e(ta)),a=n();return{blockPatterns:null!==(t=a.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:a.__experimentalBlockPatterns,restBlockPatterns:e(ge.store).getBlockPatterns(),currentThemeStylesheet:e(ge.store).getCurrentTheme().stylesheet}}),[]);return(0,f.useMemo)((()=>jy([...t||[],...n||[]],e,a)),[t,n,e,a])}(e),{revertTemplate:n}=(0,d.useDispatch)(ta),a=$t(e);return a||t.length&&!(t.length<1)?(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Actions"),className:"edit-site-template-card__actions",toggleProps:{isSmall:!0}},(({onClose:r})=>(0,l.createElement)(_.MenuGroup,null,a&&(0,l.createElement)(_.MenuItem,{info:(0,b.__)("Use the template as supplied by the theme."),onClick:()=>{n(e),r()}},(0,b.__)("Clear customizations")),(0,l.createElement)(Hy,{availableTemplates:t,template:e,onClick:r})))):null}function qy({area:e,clientId:t}){const{selectBlock:n,toggleBlockHighlight:a}=(0,d.useDispatch)(he.store),r=(0,d.useSelect)((t=>t(g.store).__experimentalGetDefaultTemplatePartAreas().find((t=>t.area===e))),[e]),s=()=>a(t,!0),i=()=>a(t,!1);return(0,l.createElement)(_.Button,{className:"edit-site-template-card__template-areas-item",icon:r?.icon,onMouseOver:s,onMouseLeave:i,onFocus:s,onBlur:i,onClick:()=>{n(t)}},r?.label)}function Yy(){const e=(0,d.useSelect)((e=>e(ta).getCurrentTemplateTemplateParts()),[]);return e.length?(0,l.createElement)("section",{className:"edit-site-template-card__template-areas"},(0,l.createElement)(_.__experimentalHeading,{level:3,className:"edit-site-template-card__template-areas-title"},(0,b.__)("Areas")),(0,l.createElement)("ul",{className:"edit-site-template-card__template-areas-list"},e.map((({templatePart:e,block:t})=>(0,l.createElement)("li",{key:t.clientId},(0,l.createElement)(qy,{area:e.area,clientId:t.clientId})))))):null}const Ky={wp_block:ca,wp_navigation:sa};function Xy(){var e;const{title:t,description:n,icon:a,record:r}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(ta),{getEditedEntityRecord:a}=e(ge.store),{__experimentalGetTemplateInfo:r}=e(g.store),s=a("postType",t(),n()),i=r(s);return{title:i.title,description:i.description,icon:i.icon,record:s}}),[]);return t||n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.PanelBody,null,(0,l.createElement)(Ry,{className:"edit-site-template-card",title:(0,en.decodeEntities)(t),icon:null!==(e=Ky[r?.type])&&void 0!==e?e:a,description:(0,en.decodeEntities)(n),actions:(0,l.createElement)(Zy,{template:r})},(0,l.createElement)(Yy,null))),(0,l.createElement)(g.PostLastRevisionPanel,null),(0,l.createElement)(g.PostTaxonomiesPanel,null),(0,l.createElement)(g.PostFeaturedImagePanel,null),(0,l.createElement)(g.PostExcerptPanel,null),(0,l.createElement)(g.PostDiscussionPanel,null),(0,l.createElement)(g.PageAttributesPanel,null)):null}const{Fill:Jy,Slot:Qy}=(0,_.createSlotFill)("PluginTemplateSettingPanel"),$y=Jy;$y.Slot=Qy;const ev=$y,{Slot:tv,Fill:nv}=(0,_.createSlotFill)("EditSiteSidebarInspector"),av=nv;function rv(){const{sidebar:e,isEditorSidebarOpened:t,hasBlockSelection:n,supportsGlobalStyles:a,isEditingPage:r}=(0,d.useSelect)((e=>{const t=e(W).getActiveComplementaryArea(Qt),n=[Ny,Ay].includes(t),a=e(ta).getSettings();return{sidebar:t,isEditorSidebarOpened:n,hasBlockSelection:!!e(he.store).getBlockSelectionStart(),supportsGlobalStyles:!a?.supportsTemplatePartsMode,isEditingPage:e(ta).isPage()}}),[]),{enableComplementaryArea:s}=(0,d.useDispatch)(W);(0,f.useEffect)((()=>{t&&(n?r||s(Qt,Ny):s(Qt,Ay))}),[n,t,r,s]);let i=e;return t||(i=n?Ny:Ay),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Ku,{identifier:i,title:(0,b.__)("Settings"),icon:(0,b.isRTL)()?Iu:Mu,closeLabel:(0,b.__)("Close Settings"),header:(0,l.createElement)(Oy,{sidebarName:i}),headerClassName:"edit-site-sidebar-edit-mode__panel-tabs"},i===Ay&&(0,l.createElement)(l.Fragment,null,r?(0,l.createElement)(Gy,null):(0,l.createElement)(Xy,null),(0,l.createElement)(ev.Slot,null)),i===Ny&&(0,l.createElement)(tv,{bubblesVirtually:!0})),a&&(0,l.createElement)(My,null))}var sv=n(773);function iv(){const e=(0,se.useInstanceId)(iv),{shortcut:t,content:n,blocks:a,type:r,id:s}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t}=e(ge.store),{getEditedPostType:n,getEditedPostId:a}=e(ta),{getShortcutRepresentation:r}=e(na.store),s=n(),i=a(),o=t("postType",s,i);return{shortcut:r("core/edit-site/toggle-mode"),content:o?.content,blocks:o?.blocks,type:s,id:i}}),[]),{editEntityRecord:i}=(0,d.useDispatch)(ge.store),o=(0,f.useMemo)((()=>n instanceof Function?n({blocks:a}):a?(0,c.__unstableSerializeAndClean)(a):n),[n,a]),{switchEditorMode:u}=(0,d.useDispatch)(ta);return(0,l.createElement)("div",{className:"edit-site-code-editor"},(0,l.createElement)("div",{className:"edit-site-code-editor__toolbar"},(0,l.createElement)("h2",null,(0,b.__)("Editing code")),(0,l.createElement)(_.Button,{variant:"tertiary",onClick:()=>u("visual"),shortcut:t},(0,b.__)("Exit code editor"))),(0,l.createElement)("div",{className:"edit-site-code-editor__body"},(0,l.createElement)(_.VisuallyHidden,{as:"label",htmlFor:`code-editor-text-area-${e}`},(0,b.__)("Type text or HTML")),(0,l.createElement)(sv.Z,{autoComplete:"off",dir:"auto",value:o,onChange:e=>{i("postType",r,s,{content:e.target.value,blocks:void 0,selection:void 0})},className:"edit-site-code-editor-text-area",id:`code-editor-text-area-${e}`,placeholder:(0,b.__)("Start writing with text or HTML")})))}const ov=function(){const{getEditorMode:e}=(0,d.useSelect)(ta),t=(0,d.useSelect)((e=>e(W).getActiveComplementaryArea(ta.name)===Ny),[]),{switchEditorMode:n,toggleDistractionFree:a}=(0,d.useDispatch)(ta),{enableComplementaryArea:r,disableComplementaryArea:s}=(0,d.useDispatch)(W),{replaceBlocks:i}=(0,d.useDispatch)(he.store),{getBlockName:o,getSelectedBlockClientId:l,getBlockAttributes:u}=(0,d.useSelect)(he.store),m=(e,t)=>{e.preventDefault();const n=0===t?"core/paragraph":"core/heading",a=l();if(null===a)return;const r=o(a);if("core/paragraph"!==r&&"core/heading"!==r)return;const s=u(a),d="core/paragraph"===r?"align":"textAlign",m="core/paragraph"===n?"align":"textAlign";i(a,(0,c.createBlock)(n,{level:t,content:s.content,[m]:s[d]}))};return(0,na.useShortcut)("core/edit-site/toggle-block-settings-sidebar",(e=>{e.preventDefault(),t?s(Qt):r(Qt,Ny)})),(0,na.useShortcut)("core/edit-site/toggle-mode",(()=>{n("visual"===e()?"text":"visual")})),(0,na.useShortcut)("core/edit-site/transform-heading-to-paragraph",(e=>m(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,na.useShortcut)(`core/edit-site/transform-paragraph-to-heading-${e}`,(t=>m(t,e)))})),(0,na.useShortcut)("core/edit-site/toggle-distraction-free",(()=>{a()})),null};function lv({nonAnimatedSrc:e,animatedSrc:t}){return(0,l.createElement)("picture",{className:"edit-site-welcome-guide__image"},(0,l.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,l.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}function cv(){const{toggle:e}=(0,d.useDispatch)(k.store);return(0,d.useSelect)((e=>!!e(k.store).get("core/edit-site","welcomeGuide")),[])?(0,l.createElement)(_.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,b.__)("Welcome to the site editor"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,l.createElement)(lv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,b.__)("Edit your site")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("Design everything on your site — from the header right down to the footer — using blocks.")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,f.createInterpolateElement)((0,b.__)("Click to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,l.createElement)("img",{alt:(0,b.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})))}]}):null}function uv(){const{toggle:e}=(0,d.useDispatch)(k.store),{isActive:t,isStylesOpen:n}=(0,d.useSelect)((e=>{const t=e(W).getActiveComplementaryArea(ta.name);return{isActive:!!e(k.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const a=(0,b.__)("Welcome to Styles");return(0,l.createElement)(_.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:a,finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,l.createElement)(lv,{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,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},a),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")))},{image:(0,l.createElement)(lv,{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,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,b.__)("Set the design")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("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,l.createElement)(lv,{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,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,b.__)("Personalize blocks")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")))},{image:(0,l.createElement)(lv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,b.__)("Learn more")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("New to block themes and styling your site?")," ",(0,l.createElement)(_.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/styles-overview/")},(0,b.__)("Here’s a detailed guide to learn how to make the most of it."))))}]})}function dv(){const{toggle:e}=(0,d.useDispatch)(k.store),t=(0,d.useSelect)((e=>{const t=!!e(k.store).get("core/edit-site","welcomeGuidePage"),n=!!e(k.store).get("core/edit-site","welcomeGuide"),{isPage:a}=e(ta);return t&&!n&&a()}),[]);if(!t)return null;const n=(0,b.__)("Editing a page");return(0,l.createElement)(_.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:n,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.")))}]})}function mv(){const{toggle:e}=(0,d.useDispatch)(k.store),t=(0,d.useSelect)((e=>{const t=!!e(k.store).get("core/edit-site","welcomeGuideTemplate"),n=!!e(k.store).get("core/edit-site","welcomeGuide"),{isPage:a}=e(ta),{getCurrentPostType:r}=e(g.store);return t&&!n&&a()&&"wp_template"===r()}),[]);if(!t)return null;const n=(0,b.__)("Editing a template");return(0,l.createElement)(_.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:n,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,b.__)("Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.")))}]})}function pv(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(cv,null),(0,l.createElement)(uv,null),(0,l.createElement)(dv,null),(0,l.createElement)(mv,null))}function hv(e){const{slug:t,patterns:n}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(ta),{getEntityRecord:a}=e(ge.store),r=n(),s=a("postType",t(),r),{getSettings:i}=e(he.store);return{slug:s.slug,patterns:i().__experimentalBlockPatterns}}),[]),a=(0,d.useSelect)((e=>e(ge.store).getCurrentTheme().stylesheet));return(0,f.useMemo)((()=>[{name:"fallback",blocks:(0,c.parse)(e),title:(0,b.__)("Fallback content")},...n.filter((e=>Array.isArray(e.templateTypes)&&e.templateTypes.some((e=>t.startsWith(e))))).map((e=>({...e,blocks:(0,c.parse)(e.content).map((e=>function(e){return e.innerBlocks.find((e=>"core/template-part"===e.name))&&(e.innerBlocks=e.innerBlocks.map((e=>("core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=a),e)))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=a),e}(e)))})))]),[e,t,n])}function fv({fallbackContent:e,onChoosePattern:t,postType:n}){const[,,a]=(0,ge.useEntityBlockEditor)("postType",n),r=hv(e),s=(0,se.useAsyncList)(r);return(0,l.createElement)(he.__experimentalBlockPatternsList,{blockPatterns:r,shownPatterns:s,onClickPattern:(e,n)=>{a(n,{selection:void 0}),t()}})}function gv({slug:e,isCustom:t,onClose:n,postType:a}){const r=function(e,t=!1){return(0,d.useSelect)((n=>{const{getEntityRecord:a,getDefaultTemplateId:r}=n(ge.store),s=r({slug:e,is_custom:t,ignore_empty:!0});return s?a("postType",Ct,s)?.content?.raw:void 0}),[e,t])}(e,t);return r?(0,l.createElement)(_.Modal,{className:"edit-site-start-template-options__modal",title:(0,b.__)("Choose a pattern"),closeLabel:(0,b.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:n,isFullScreen:!0},(0,l.createElement)("div",{className:"edit-site-start-template-options__modal-content"},(0,l.createElement)(fv,{fallbackContent:r,slug:e,isCustom:t,postType:a,onChoosePattern:()=>{n()}})),(0,l.createElement)(_.Flex,{className:"edit-site-start-template-options__modal__actions",justify:"flex-end",expanded:!1},(0,l.createElement)(_.FlexItem,null,(0,l.createElement)(_.Button,{variant:"tertiary",onClick:n},(0,b.__)("Skip"))))):null}const yv={INITIAL:"INITIAL",CLOSED:"CLOSED"};function vv(){const[e,t]=(0,f.useState)(yv.INITIAL),{shouldOpenModal:n,slug:a,isCustom:r,postType:s}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(ta),a=t(),r=n(),{getEditedEntityRecord:s,hasEditsForEntityRecord:i}=e(ge.store),o=s("postType",a,r);return{shouldOpenModal:!i("postType",a,r)&&""===o.content&&Ct===a&&!e(k.store).get("core/edit-site","welcomeGuide"),slug:o.slug,isCustom:o.is_custom,postType:a}}),[]);return e===yv.INITIAL&&!n||e===yv.CLOSED?null:(0,l.createElement)(gv,{slug:a,isCustom:r,postType:s,onClose:()=>t(yv.CLOSED)})}const{useGlobalStylesOutput:_v}=Ke(he.privateApis);function bv(){return function(){const[e,t]=_v(),{getSettings:n}=(0,d.useSelect)(ta),{updateSettings:a}=(0,d.useDispatch)(ta);(0,f.useEffect)((()=>{var r;if(!e||!t)return;const s=n(),i=Object.values(null!==(r=s.styles)&&void 0!==r?r:[]).filter((e=>!e.isGlobalStyles));a({...s,styles:[...i,...e],__experimentalFeatures:t})}),[e,t,a,n])}(),null}const{useLocation:Ev}=Ke(ft.privateApis);const{ProgressBar:wv,Theme:xv}=Ke(_.privateApis),{useGlobalStyle:Sv}=Ke(he.privateApis);function Cv({id:e}){var t;const[n]=Sv("color.text"),[a]=Sv("color.background"),{highlightedColors:r}=Qe(),s=null!==(t=r[0]?.color)&&void 0!==t?t:n,{elapsed:i,total:o}=(0,d.useSelect)((e=>{var t,n;const a=e(ge.store).countSelectorsByStatus(),r=null!==(t=a.resolving)&&void 0!==t?t:0,s=null!==(n=a.finished)&&void 0!==n?n:0;return{elapsed:s,total:s+r}}),[]);return(0,l.createElement)("div",{className:"edit-site-canvas-loader"},(0,l.createElement)(xv,{accent:s,background:a},(0,l.createElement)(wv,{id:e,max:o,value:i})))}const kv=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})),{useLocation:Tv,useHistory:Pv}=Ke(ft.privateApis);const Iv=function(){const e=Tv(),t=Pv(),n=e.params.postType===kt,a=e.params.postType===St,r=e.params.postType===It.user;return e.params.focusMode||n||a||r?(0,l.createElement)(_.Button,{className:"edit-site-visual-editor__back-button",icon:kv,onClick:()=>{t.back()}},(0,b.__)("Back")):null},{EditorCanvas:Mv}=Ke(g.privateApis);const Av=function({enableResizing:e,settings:t,children:n,...a}){const{hasBlocks:r,isFocusMode:s,templateType:i,canvasMode:o,isZoomOutMode:c}=(0,d.useSelect)((e=>{const{getBlockCount:t,__unstableGetEditorMode:n}=e(he.store),{getEditedPostType:a,getCanvasMode:r}=Ke(e(ta)),s=a();return{templateType:s,isFocusMode:Rt.includes(s),isZoomOutMode:"zoom-out"===n(),canvasMode:r(),hasBlocks:!!t()}}),[]),{setCanvasMode:u}=Ke((0,d.useDispatch)(ta)),[m,p]=(0,f.useState)(!1);(0,f.useEffect)((()=>{"edit"===o&&p(!1)}),[o]);const h={"aria-label":(0,b.__)("Editor Canvas"),role:"button",tabIndex:0,onFocus:()=>p(!0),onBlur:()=>p(!1),onKeyDown:e=>{const{keyCode:t}=e;t!==wa.ENTER&&t!==wa.SPACE||(e.preventDefault(),u("edit"))},onClick:()=>u("edit"),readonly:!0},g=i===St,y=!(g&&s&&r||"view"===o)&&void 0,_=(0,f.useMemo)((()=>[...t.styles,{css:`.is-root-container{display:flow-root;${e?"min-height:0!important;":""}}body{position:relative; ${"view"===o?"cursor: pointer; min-height: 100vh;":""}}}`}]),[t.styles,e,o]);return(0,l.createElement)(Mv,{className:v()("edit-site-editor-canvas__block-list",{"is-navigation-block":g}),renderAppender:y,styles:_,iframeProps:{expand:c,scale:c?.45:void 0,frameSize:c?100:void 0,className:v()("edit-site-visual-editor__editor-canvas",{"is-focused":m&&"view"===o}),...a,..."view"===o?h:{}}},n)},{useHistory:Nv}=Ke(ft.privateApis);function Ov(){const e=Nv();return(t,n)=>bt(e,{...t,focusMode:!0,canvas:"edit"},n)}const{useBlockEditorSettings:Rv}=Ke(g.privateApis);function Fv(){const e=Ov(),{templateSlug:t,canvasMode:n,settings:a,postWithTemplate:r}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n,getEditedPostContext:a,getCanvasMode:r,getSettings:s}=Ke(e(ta)),{getEditedEntityRecord:i}=e(ge.store),o=i("postType",t(),n()),l=a();return{templateSlug:o.slug,canvasMode:r(),settings:s(),postWithTemplate:l?.postId}}),[]),s=function(e){const t=e?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);let n,a,r,s=!1;if(t)t[1]?n=t[2]?t[2]:t[1]:t[3]&&(n=t[6]?t[6]:t[4],a=t[7]),n="tag"===n?"post_tag":n;else{const t=e?.match(/^(author)$|^author-(.+)$/);t&&(s=!0,t[2]&&(r=t[2]))}return(0,d.useSelect)((e=>{const{getEntityRecords:t,getTaxonomy:i,getAuthors:o}=e(ge.store);let l,c;if(n&&(l=i(n)?.labels?.singular_name),a){const e=t("taxonomy",n,{slug:a,per_page:1});e&&e[0]&&(c=e[0].name)}if(s&&(l="Author",r)){const e=o({slug:r});e&&e[0]&&(c=e[0].name)}return{archiveTypeLabel:l,archiveNameLabel:c}}),[r,s,n,a])}(t),i=r?"template-locked":"all";return(0,f.useMemo)((()=>({...a,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==n,defaultRenderingMode:i,getPostLinkProps:e,__experimentalArchiveTitleTypeLabel:s.archiveTypeLabel,__experimentalArchiveTitleNameLabel:s.archiveNameLabel})),[a,n,i,e,s.archiveTypeLabel,s.archiveNameLabel])}const{useLocation:Dv}=Ke(ft.privateApis);function Bv(){const e=Dv(),{templateType:t,isFocusableEntity:n,isViewMode:a}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getCanvasMode:n}=Ke(e(ta)),a=t();return{templateType:a,isFocusableEntity:Rt.includes(a),isViewMode:"view"===n()}}),[]),r=e.params.focusMode||n,[s,i]=(0,se.useResizeObserver)(),o=function(){const e=Fv(),{postType:t,postId:n}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=Ke(e(ta));return{postType:t(),postId:n()}}),[]);return Rv(e,t,n)}(),c=(0,se.useViewportMatch)("small","<"),u=r&&!a&&!c,m=t===St&&r;return(0,l.createElement)($a.Slot,null,(([e])=>e?(0,l.createElement)("div",{className:"edit-site-visual-editor is-focus-mode"},e):(0,l.createElement)("div",{className:v()("edit-site-visual-editor",{"is-focus-mode":r||!!e,"is-view-mode":a})},(0,l.createElement)(Iv,null),(0,l.createElement)(Za,{enableResizing:u,height:i.height&&!m?i.height:"100%"},(0,l.createElement)(Av,{enableResizing:u,settings:o},s)))))}function Vv({clientId:e,onClose:t}){const{getBlocks:n}=(0,d.useSelect)(he.store),{replaceBlocks:a}=(0,d.useDispatch)(he.store);return(0,d.useSelect)((t=>t(he.store).canRemoveBlock(e)),[e])?(0,l.createElement)(_.MenuItem,{onClick:()=>{a(e,n(e)),t()}},(0,b.__)("Detach")):null}function Lv({clientIds:e,blocks:t}){const[n,a]=(0,f.useState)(!1),{replaceBlocks:r}=(0,d.useDispatch)(he.store),{createSuccessNotice:s}=(0,d.useDispatch)(fe.store),{canCreate:i}=(0,d.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(ta).getSettings();return{canCreate:!t}}),[]);if(!i)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{icon:Ks,onClick:()=>{a(!0)},"aria-expanded":n,"aria-haspopup":"dialog"},(0,b.__)("Create template part")),n&&(0,l.createElement)(ei,{closeModal:()=>{a(!1)},blocks:t,onCreate:async t=>{r(e,(0,c.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),s((0,b.__)("Template part created."),{type:"snackbar"})}}))}function zv(){return(0,l.createElement)(he.BlockSettingsMenuControls,null,(({selectedClientIds:e,onClose:t})=>(0,l.createElement)(Gv,{clientIds:e,onClose:t})))}function Gv({clientIds:e,onClose:t}){const n=(0,d.useSelect)((t=>t(he.store).getBlocksByClientId(e)),[e]);return 1===n.length&&"core/template-part"===n[0]?.name?(0,l.createElement)(Vv,{clientId:e[0],onClose:t}):(0,l.createElement)(Lv,{clientIds:e,blocks:n})}const{BlockRemovalWarningModal:Hv}=Ke(he.privateApis),{ExperimentalEditorProvider:Uv,InserterSidebar:Wv,ListViewSidebar:jv}=Ke(g.privateApis),Zv={body:(0,b.__)("Editor content"),sidebar:(0,b.__)("Editor settings"),actions:(0,b.__)("Editor publish"),footer:(0,b.__)("Editor footer")},qv={"core/query":(0,b.__)("Query Loop displays a list of posts or pages."),"core/post-content":(0,b.__)("Post Content displays the content of a post or page."),"core/post-template":(0,b.__)("Post Template displays each post or page in a Query Loop.")};function Yv({isLoading:e}){const{record:t,getTitle:n,isLoaded:a}=Ds(),{type:r}=t,s=(0,se.useViewportMatch)("medium"),{context:i,contextPost:o,editorMode:c,canvasMode:u,blockEditorMode:m,isRightSidebarOpen:p,isInserterOpen:h,isListViewOpen:y,showIconLabels:E,showBlockBreadcrumbs:w,postTypeLabel:x}=(0,d.useSelect)((e=>{const{get:t}=e(k.store),{getEditedPostContext:n,getEditorMode:a,getCanvasMode:r}=Ke(e(ta)),{__unstableGetEditorMode:s}=e(he.store),{getActiveComplementaryArea:i}=e(W),{getEntityRecord:o}=e(ge.store),{isInserterOpened:l,isListViewOpened:c,getPostTypeLabel:u}=e(g.store),d=n();return{context:d,contextPost:d?.postId?o("postType",d.postType,d.postId):void 0,editorMode:a(),canvasMode:r(),blockEditorMode:s(),isInserterOpen:l(),isListViewOpen:c(),isRightSidebarOpen:i(ta.name),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),showIconLabels:t("core","showIconLabels"),postTypeLabel:u()}}),[]),S="edit"===u,C="view"===u||"visual"===c,T=w&&S&&C&&"zoom-out"!==m,P=S&&C&&h,I=S&&C&&y,M=y?(0,b.__)("List View"):(0,b.__)("Block Library"),A=!!i?.postId;let N;var O;a&&(N=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s"),n(),null!==(O=Ft[r])&&void 0!==O?O:Ft[Ct]));!function(e){const t=Ev(),n=(0,d.useSelect)((e=>e(ge.store).getEntityRecord("root","site")?.title),[]),a=(0,f.useRef)(!0);(0,f.useEffect)((()=>{a.current=!1}),[t]),(0,f.useEffect)((()=>{if(!a.current&&e&&n){const t=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,en.decodeEntities)(e),(0,en.decodeEntities)(n));document.title=t,(0,Jt.speak)(e,"assertive")}}),[e,n,t])}(a&&N);const R=(0,se.useInstanceId)(Cv,"edit-site-editor__loading-progress"),F=Fv(),D=!e&&(A&&!!o&&!!t||!A&&!!t);return(0,l.createElement)(l.Fragment,null,D?null:(0,l.createElement)(Cv,{id:R}),S&&(0,l.createElement)(pv,null),a&&!t&&(0,l.createElement)(_.Notice,{status:"warning",isDismissible:!1},(0,b.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")),D&&(0,l.createElement)(Uv,{post:A?o:t,__unstableTemplate:A?t:void 0,settings:F,useSubRegistry:!1},(0,l.createElement)(rv,null),S&&(0,l.createElement)(vv,null),(0,l.createElement)(le,{isDistractionFree:!0,enableRegionNavigation:!1,className:v()("edit-site-editor__interface-skeleton",{"show-icon-labels":E}),notices:(0,l.createElement)(g.EditorSnackbars,null),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(bv,null),S&&(0,l.createElement)(g.EditorNotices,null),C&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(zv,null),(0,l.createElement)(av,null,(0,l.createElement)(he.BlockInspector,null)),!s&&(0,l.createElement)(he.BlockToolbar,{hideDragHandle:!0}),(0,l.createElement)(Bv,null),(0,l.createElement)(Hv,{rules:qv}),(0,l.createElement)(zu,null)),"text"===c&&S&&(0,l.createElement)(iv,null),S&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ov,null),(0,l.createElement)(g.EditorKeyboardShortcutsRegister,null),(0,l.createElement)(g.EditorKeyboardShortcuts,null))),secondarySidebar:S&&(P&&(0,l.createElement)(Wv,null)||I&&(0,l.createElement)(jv,null)),sidebar:S&&p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(re.Slot,{scope:"core/edit-site"})),footer:T&&(0,l.createElement)(he.BlockBreadcrumb,{rootLabelText:x}),labels:{...Zv,secondarySidebar:M}})))}const Kv=(0,f.memo)((function({view:e,onChangeView:t,paginationInfo:{totalItems:n=0,totalPages:a}}){return n&&a?!!n&&1!==a&&(0,l.createElement)(_.__experimentalHStack,{expanded:!1,spacing:6,justify:"end",className:"dataviews-pagination"},(0,l.createElement)(_.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2},(0,f.createInterpolateElement)((0,b.sprintf)((0,b._x)("Page of %s","paging"),a),{CurrenPageControl:(0,l.createElement)(_.SelectControl,{"aria-label":(0,b.__)("Current page"),value:e.page,options:Array.from(Array(a)).map(((e,t)=>{const n=t+1;return{value:n,label:n}})),onChange:n=>{t({...e,page:+n})},size:"compact",__nextHasNoMarginBottom:!0})})),(0,l.createElement)(_.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(_.Button,{onClick:()=>t({...e,page:e.page-1}),disabled:1===e.page,__experimentalIsFocusable:!0,label:(0,b.__)("Previous page"),icon:da,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,l.createElement)(_.Button,{onClick:()=>t({...e,page:e.page+1}),disabled:e.page>=a,__experimentalIsFocusable:!0,label:(0,b.__)("Next page"),icon:ua,showTooltip:!0,size:"compact",tooltipPosition:"top"}))):null})),Xv=Kv,Jv=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,l.createElement)(E.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),{DropdownMenuV2:Qv,DropdownMenuGroupV2:$v,DropdownMenuItemV2:e_,DropdownMenuRadioItemV2:t_,DropdownMenuCheckboxItemV2:n_,DropdownMenuItemLabelV2:a_}=Fo(_.privateApis);function r_({view:e,onChangeView:t,supportedLayouts:n}){let a=yl;if(n&&(a=a.filter((e=>n.includes(e.type)))),1===a.length)return null;const r=a.find((t=>e.type===t.type));return(0,l.createElement)(Qv,{trigger:(0,l.createElement)(e_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},r.label)},(0,l.createElement)(a_,null,(0,b.__)("Layout")))},a.map((n=>(0,l.createElement)(t_,{key:n.type,value:n.type,name:"view-actions-available-view",checked:n.type===e.type,hideOnClick:!0,onChange:n=>{t({...e,type:n.target.value})}},(0,l.createElement)(a_,null,n.label)))))}const s_=[10,20,50,100];function i_({view:e,onChangeView:t}){return(0,l.createElement)(Qv,{trigger:(0,l.createElement)(e_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},e.perPage)},(0,l.createElement)(a_,null,(0,b.__)("Rows per page")))},s_.map((n=>(0,l.createElement)(t_,{key:n,value:n,name:"view-actions-page-size",checked:e.perPage===n,onChange:()=>{t({...e,perPage:n,page:1})}},(0,l.createElement)(a_,null,n)))))}function o_({view:e,onChangeView:t,fields:n}){const a=n.filter((t=>!1!==t.enableHiding&&t.id!==e.layout.mediaField));return a?.length?(0,l.createElement)(Qv,{trigger:(0,l.createElement)(e_,null,(0,l.createElement)(a_,null,(0,b.__)("Fields")))},a?.map((n=>(0,l.createElement)(n_,{key:n.id,value:n.id,checked:!e.hiddenFields?.includes(n.id),onChange:()=>{t({...e,hiddenFields:e.hiddenFields?.includes(n.id)?e.hiddenFields.filter((e=>e!==n.id)):[...e.hiddenFields||[],n.id]})}},(0,l.createElement)(a_,null,n.header))))):null}function l_({fields:e,view:t,onChangeView:n}){const a=e.filter((e=>!1!==e.enableSorting));if(!a?.length)return null;const r=e.find((e=>e.id===t.sort?.field));return(0,l.createElement)(Qv,{trigger:(0,l.createElement)(e_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},r?.header)},(0,l.createElement)(a_,null,(0,b.__)("Sort by")))},a?.map((e=>{const a=t.sort?.direction;return(0,l.createElement)(Qv,{key:e.id,trigger:(0,l.createElement)(e_,null,(0,l.createElement)(a_,null,e.header)),style:{minWidth:"220px"}},Object.entries(hl).map((([s,i])=>{const o=void 0!==r&&a===s&&e.id===r.id,c=`${e.id}-${s}`;return(0,l.createElement)(t_,{key:c,name:"view-actions-sorting",value:c,checked:o,onChange:()=>{n({...t,sort:{field:e.id,direction:s}})}},(0,l.createElement)(a_,null,i.label))})))})))}const c_=(0,f.memo)((function({fields:e,view:t,onChangeView:n,supportedLayouts:a}){return(0,l.createElement)(Qv,{trigger:(0,l.createElement)(_.Button,{size:"compact",icon:Jv,label:(0,b.__)("View options")})},(0,l.createElement)($v,null,(0,l.createElement)(r_,{view:t,onChangeView:n,supportedLayouts:a}),(0,l.createElement)(l_,{fields:e,view:t,onChangeView:n}),(0,l.createElement)(o_,{fields:e,view:t,onChangeView:n}),(0,l.createElement)(i_,{view:t,onChangeView:n})))})),{DropdownMenuV2:u_,DropdownMenuGroupV2:d_,DropdownMenuItemV2:m_,DropdownMenuSeparatorV2:p_,DropdownMenuItemLabelV2:h_,DropdownMenuItemHelpTextV2:f_}=Fo(_.privateApis),g_=({activeElement:e,filterInView:t,filter:n})=>void 0===e?n.name:void 0!==e&&t?.operator===dl?(0,b.sprintf)((0,b.__)("%1$s is %2$s"),n.name,e.label):void 0!==e&&t?.operator===ml?(0,b.sprintf)((0,b.__)("%1$s is not %2$s"),n.name,e.label):(0,b.sprintf)((0,b.__)("Unknown status for %1$s"),n.name);function y_({children:e}){return f.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,l.createElement)(f.Fragment,{key:t},t>0&&(0,l.createElement)(p_,null),e)))}function v_({filter:e,view:t,onChangeView:n}){const a=t.filters.find((t=>t.field===e.field)),r=t.filters.filter((t=>t.field!==e.field)),s=e.elements.find((e=>e.value===a?.value)),i=a?.operator||e.operators[0];return(0,l.createElement)(u_,{key:e.field,trigger:(0,l.createElement)(_.Button,{variant:"tertiary",size:"compact",label:e.name},(0,l.createElement)(g_,{activeElement:s,filterInView:a,filter:e}),(0,l.createElement)(_.Icon,{icon:Gi,style:{flexShrink:0}}))},(0,l.createElement)(y_,null,(0,l.createElement)(d_,null,e.elements.map((a=>{const o=s?.value===a.value;return(0,l.createElement)(Ko,{key:a.value,name:`filter-summary-${e.field}`,value:a.value,checked:o,onClick:()=>n({...t,page:1,filters:[...r,{field:e.field,operator:i,value:o?void 0:a.value}]})},(0,l.createElement)(h_,null,a.label),!!a.description&&(0,l.createElement)(f_,null,a.description))}))),e.operators.length>1&&(0,l.createElement)(u_,{trigger:(0,l.createElement)(m_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},pl[i]?.label)},(0,l.createElement)(h_,null,(0,b.__)("Conditions")))},Object.entries(pl).map((([s,{label:o,key:c}])=>(0,l.createElement)(Ko,{key:c,name:`filter-summary-${e.field}-conditions`,value:s,checked:i===s,onChange:s=>{n({...t,page:1,filters:[...r,{field:e.field,operator:s.target.value,value:a?.value}]})}},(0,l.createElement)(h_,null,o)))))))}const{DropdownMenuV2:__,DropdownMenuGroupV2:b_,DropdownMenuItemV2:E_,DropdownMenuRadioItemV2:w_,DropdownMenuSeparatorV2:x_,DropdownMenuItemLabelV2:S_,DropdownMenuItemHelpTextV2:C_}=Fo(_.privateApis);function k_({children:e}){return f.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,l.createElement)(f.Fragment,{key:t},t>0&&(0,l.createElement)(x_,null),e)))}function T_({filters:e,view:t,onChangeView:n}){if(0===e.length)return null;const a=t.filters.reduce(((e,t)=>void 0!==t.value?e+1:e),0);return(0,l.createElement)(__,{trigger:(0,l.createElement)(_.Button,{__experimentalIsFocusable:!0,label:(0,b.__)("Filters"),size:"compact",icon:Oo,className:"dataviews-filters-button"},t.type===gl&&a>0?(0,l.createElement)("span",{className:"dataviews-filters-count"},a):null),style:{minWidth:"230px"}},(0,l.createElement)(k_,null,(0,l.createElement)(b_,null,e.map((e=>{const a=t.filters.find((t=>t.field===e.field)),r=t.filters.filter((t=>t.field!==e.field)),s=e.elements.find((e=>e.value===a?.value)),i=a?.operator||e.operators[0];return(0,l.createElement)(__,{key:e.field,trigger:(0,l.createElement)(E_,{suffix:s&&(0,l.createElement)("span",{"aria-hidden":"true"},i in pl&&`${pl[i].label} `,s.label)},(0,l.createElement)(S_,null,e.name)),style:{minWidth:"200px"}},(0,l.createElement)(k_,null,(0,l.createElement)(b_,null,e.elements.map((a=>{const o=s?.value===a.value;return(0,l.createElement)(Ko,{key:a.value,name:`add-filter-${e.field}`,value:a.value,checked:o,onChange:a=>{n({...t,page:1,filters:[...r,{field:e.field,operator:i,value:o?void 0:a.target.value}]})}},(0,l.createElement)(S_,null,a.label),!!a.description&&(0,l.createElement)(C_,null,a.description))}))),e.operators.length>1&&(0,l.createElement)(__,{trigger:(0,l.createElement)(E_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},pl[i]?.label)},(0,l.createElement)(S_,null,(0,b.__)("Conditions")))},Object.entries(pl).map((([s,{label:o,key:c}])=>(0,l.createElement)(w_,{key:c,name:`add-filter-${e.field}-conditions`,value:s,checked:i===s,onChange:s=>{n({...t,page:1,filters:[...r,{field:e.field,operator:s.target.value,value:a?.value}]})}},(0,l.createElement)(S_,null,o))))),(0,l.createElement)(E_,{key:"reset-filter-"+e.name,disabled:!s,hideOnClick:!1,onClick:()=>{n({...t,page:1,filters:t.filters.filter((t=>t.field!==e.field))})}},(0,l.createElement)(S_,null,(0,b.sprintf)((0,b.__)("Reset %1$s"),e.name.toLowerCase())))))}))),(0,l.createElement)(E_,{disabled:""===t.search&&0===t.filters?.length,hideOnClick:!1,onClick:()=>{n({...t,page:1,filters:[]})}},(0,l.createElement)(S_,null,(0,b.__)("Reset filters")))))}function P_({view:e,onChangeView:t}){return(0,l.createElement)(_.Button,{disabled:""===e.search&&0===e.filters?.length,__experimentalIsFocusable:!0,size:"compact",variant:"tertiary",onClick:()=>{t({...e,page:1,search:"",filters:[]})}},(0,b.__)("Reset filters"))}const I_=(0,f.memo)((function({fields:e,view:t,onChangeView:n}){const a=[];e.forEach((e=>{if(!e.type)return;const n=(e=>{let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[dl,ml]),t.filter((e=>[dl,ml].includes(e)))})(e);if(0!==n.length&&e.type===ul){if(!e.elements?.length)return;a.push({field:e.id,name:e.header,elements:e.elements,operators:n,isVisible:t.filters.some((t=>t.field===e.id&&[dl,ml].includes(t.operator)))})}}));const r=[(0,l.createElement)(T_,{key:"add-filter",filters:a,view:t,onChangeView:n}),...a.map((e=>e.isVisible&&t.type!==gl?(0,l.createElement)(v_,{key:e.field,filter:e,view:t,onChangeView:n}):null))];return r.length>1&&t.type!==gl&&r.push((0,l.createElement)(P_,{key:"reset-filters",view:t,onChangeView:n})),r})),M_=I_,A_=(0,f.memo)((function({label:e,view:t,onChangeView:n}){const[a,r,s]=(0,se.useDebouncedInput)(t.search);(0,f.useEffect)((()=>{r(t.search)}),[t]);const i=(0,f.useRef)(n);(0,f.useEffect)((()=>{i.current=n}),[n]),(0,f.useEffect)((()=>{i.current({...t,page:1,search:s})}),[s]);const o=e||(0,b.__)("Filter list");return(0,l.createElement)(_.SearchControl,{__nextHasNoMarginBottom:!0,onChange:r,value:a,label:o,placeholder:o,size:"compact"})})),N_=A_,{DropdownMenuV2:O_,DropdownMenuGroupV2:R_,DropdownMenuItemV2:F_,DropdownMenuSeparatorV2:D_}=Fo(_.privateApis);function B_({action:e,selectedItems:t,setActionWithModal:n,onMenuOpenChange:a}){const r=(0,f.useMemo)((()=>t.filter((t=>e.isEligible(t)))),[e,t]),{RenderModal:s,hideModalHeader:i}=e,o=(0,f.useCallback)((()=>{n(void 0)}),[n]);return(0,l.createElement)(_.Modal,{title:!i&&e.label,__experimentalHideHeader:!!i,onRequestClose:o,overlayClassName:"dataviews-action-modal"},(0,l.createElement)(s,{items:r,closeModal:o,onPerform:()=>a(!1)}))}function V_({action:e,selectedItems:t,setActionWithModal:n}){const a=(0,f.useMemo)((()=>t.filter((t=>e.isEligible(t)))),[e,t]),r=!!e.RenderModal;return(0,l.createElement)(F_,{key:e.id,disabled:0===a.length,hideOnClick:!r,onClick:async()=>{r?n(e):await e.callback(a)},suffix:a.length>0?a.length:void 0},e.label)}function L_({actions:e,selectedItems:t,setActionWithModal:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(R_,null,e.map((e=>(0,l.createElement)(V_,{key:e.id,action:e,selectedItems:t,setActionWithModal:n})))),(0,l.createElement)(D_,null))}function z_({data:e,actions:t,selection:n,onSelectionChange:a,getItemId:r}){const s=(0,f.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),i=n&&n.length===e.length,[o,c]=(0,f.useState)(!1),[u,d]=(0,f.useState)(),m=(0,f.useMemo)((()=>e.filter((e=>n.includes(r(e))))),[n,e,r]);return 0===s.length?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(O_,{open:o,onOpenChange:c,label:(0,b.__)("Bulk actions"),style:{minWidth:"240px"},trigger:(0,l.createElement)(_.Button,{className:"dataviews-bulk-edit-button",__next40pxDefaultSize:!0,variant:"tertiary",size:"compact"},n.length?(0,b.sprintf)((0,b._n)("Edit %d item","Edit %d items",n.length),n.length):(0,b.__)("Bulk edit"))},(0,l.createElement)(L_,{actions:s,setActionWithModal:d,selectedItems:m}),(0,l.createElement)(R_,null,(0,l.createElement)(F_,{disabled:i,hideOnClick:!1,onClick:()=>{a(e)},suffix:e.length},(0,b.__)("Select all")),(0,l.createElement)(F_,{disabled:0===n.length,hideOnClick:!1,onClick:()=>{a([])}},(0,b.__)("Deselect")))),u&&(0,l.createElement)(B_,{action:u,selectedItems:m,setActionWithModal:d,onMenuOpenChange:c}))}const G_=e=>e.id,H_=()=>{};function U_({view:e,onChangeView:t,fields:n,search:a=!0,searchLabel:r,actions:s,data:i,getItemId:o=G_,isLoading:c=!1,paginationInfo:u,supportedLayouts:d,onSelectionChange:m=H_,onDetailsChange:p=null,deferredRendering:h=!1}){const[g,y]=(0,f.useState)([]);(0,f.useEffect)((()=>{if(g.length>0&&g.some((e=>!i.some((t=>t.id===e))))){const e=g.filter((e=>i.some((t=>t.id===e))));y(e),m(i.filter((t=>e.includes(t.id))))}}),[g,i,m]);const v=(0,f.useCallback)((e=>{y(e.map((e=>e.id))),m(e)}),[y,m]),b=yl.find((t=>t.type===e.type)).component,E=(0,f.useMemo)((()=>n.map((e=>({...e,render:e.render||e.getValue})))),[n]);return(0,l.createElement)("div",{className:"dataviews-wrapper"},(0,l.createElement)(_.__experimentalVStack,{spacing:0,justify:"flex-start"},(0,l.createElement)(_.__experimentalHStack,{alignment:"flex-start",className:"dataviews-filters__view-actions"},(0,l.createElement)(_.__experimentalHStack,{justify:"start",wrap:!0},a&&(0,l.createElement)(N_,{label:r,view:e,onChangeView:t}),(0,l.createElement)(M_,{fields:E,view:e,onChangeView:t})),e.type===fl&&(0,l.createElement)(z_,{actions:s,data:i,onSelectionChange:v,selection:g,getItemId:o}),(0,l.createElement)(c_,{fields:E,view:e,onChangeView:t,supportedLayouts:d})),(0,l.createElement)(b,{fields:E,view:e,onChangeView:t,actions:s,data:i,getItemId:o,isLoading:c,onSelectionChange:v,onDetailsChange:p,selection:g,deferredRendering:h}),(0,l.createElement)(Xv,{view:e,onChangeView:t,paginationInfo:u})))}function W_({title:e,subTitle:t,actions:n}){return(0,l.createElement)(_.__experimentalHStack,{as:"header",alignment:"left",className:"edit-site-page-header"},(0,l.createElement)(_.FlexBlock,{className:"edit-site-page-header__page-title"},(0,l.createElement)(_.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title"},e),t&&(0,l.createElement)(_.__experimentalText,{as:"p",className:"edit-site-page-header__sub-title"},t)),(0,l.createElement)(_.FlexItem,{className:"edit-site-page-header__actions"},n))}function j_({title:e,subTitle:t,actions:n,children:a,className:r,hideTitleFromUI:s=!1}){const i=v()("edit-site-page",r);return(0,l.createElement)(ie,{className:i,ariaLabel:e},(0,l.createElement)("div",{className:"edit-site-page-content"},!s&&e&&(0,l.createElement)(W_,{title:e,subTitle:t,actions:n}),a),(0,l.createElement)(g.EditorSnackbars,null))}const{useHistory:Z_}=Ke(ft.privateApis),q_={id:"move-to-trash",label:(0,b.__)("Move to Trash"),isPrimary:!0,icon:Rl,isEligible:({status:e})=>"trash"!==e,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onPerform:n})=>{const{createSuccessNotice:a,createErrorNotice:r}=(0,d.useDispatch)(fe.store),{deleteEntityRecord:s}=(0,d.useDispatch)(ge.store);return(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.__experimentalText,null,1===e.length?(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(e[0].title.rendered)):(0,b.sprintf)((0,b.__)("Are you sure you want to delete %d pages?"),e.length)),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",onClick:async()=>{const i=await Promise.allSettled(e.map((e=>s("postType",e.type,e.id,{},{throwOnError:!0}))));if(i.every((({status:e})=>"fulfilled"===e))){let t;t=1===i.length?(0,b.sprintf)((0,b.__)('"%s" moved to the Trash.'),(0,en.decodeEntities)(e[0].title.rendered)):(0,b.__)("Pages moved to the Trash."),a(t,{type:"snackbar",id:"edit-site-page-trashed"})}else{let e;if(1===i.length)e=i[0].reason?.message?i[0].reason.message:(0,b.__)("An error occurred while moving the post to the trash.");else{const t=new Set,n=i.filter((({status:e})=>"rejected"===e));for(const e of n)e.reason?.message&&t.add(e.reason.message);e=0===t.size?(0,b.__)("An error occurred while moving the posts to the trash."):1===t.size?(0,b.sprintf)((0,b.__)("An error occurred while moving the posts to the trash: %s"),[...t][0]):(0,b.sprintf)((0,b.__)("Some errors occurred while moving the pages to the trash: %s"),[...t].join(",")),r(e,{type:"snackbar"})}}n&&n(),t()}},(0,b.__)("Delete"))))}};const Y_={id:"view-post",label:(0,b.__)("View"),isPrimary:!0,icon:vc,isEligible:e=>"trash"!==e.status,callback(e){const t=e[0];document.location.href=t.link}};const K_={id:"view-post-revisions",label:(0,b.__)("View revisions"),isPrimary:!1,isEligible:e=>{var t,n;if("trash"===e.status)return!1;const a=null!==(t=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==t?t:null,r=null!==(n=e?._links?.["version-history"]?.[0]?.count)&&void 0!==n?n:0;return a&&r>1},callback(e){const t=e[0],n=(0,gt.addQueryArgs)("revision.php",{revision:t?._links?.["predecessor-version"]?.[0]?.id});document.location.href=n}};const X_=function({id:e,size:t=["large","medium","thumbnail"],...n}){const{record:a}=(0,ge.useEntityRecord)("root","media",e),r=t.find((e=>!!a?.media_details?.sizes[e])),s=a?.media_details?.sizes[r];return s?(0,l.createElement)("img",{...n,src:s.source_url,alt:a.alt_text}):null},{useLocation:J_,useHistory:Q_}=Ke(ft.privateApis),$_=[],eb=window?.__experimentalAdminViews?[Dt,Bt,Vt]:[Dt,Bt];const tb=[{value:"draft",label:(0,b.__)("Draft")},{value:"future",label:(0,b.__)("Scheduled")},{value:"pending",label:(0,b.__)("Pending Review")},{value:"private",label:(0,b.__)("Private")},{value:"publish",label:(0,b.__)("Published")},{value:"trash",label:(0,b.__)("Trash")}],nb="draft,future,pending,private,publish";function ab({item:e,viewType:t}){const{onClick:n}=Et({postId:e.id,postType:e.type,canvas:"edit"}),a=!!e.featured_media;return(0,l.createElement)("span",{className:{"edit-site-page-pages__media-wrapper":t===Bt}},(0,l.createElement)("button",{className:"page-pages-preview-field__button",type:"button",onClick:n,"aria-label":e.title?.rendered||(0,b.__)("(no title)")},a&&(0,l.createElement)(X_,{className:"edit-site-page-pages__featured-image",id:e.featured_media,size:t===Dt?["large","full","medium","thumbnail"]:["thumbnail","medium","large","full"]})))}function rb(){const e="page",[t,n]=function(e){const{params:t}=J_(),{activeView:n="all",isCustom:a="false",layout:r}=t,s=Q_(),i=(0,f.useMemo)((()=>{const t="false"===a&&Bl[e].find((({slug:e})=>e===n))?.view;return"false"===a&&r?{...t,type:r}:t}),[a,n,r,e]),[o,l]=(0,f.useState)(i);(0,f.useEffect)((()=>{i&&l(i)}),[i]);const c=(0,d.useSelect)((e=>{if("true"!==a)return;const{getEditedEntityRecord:t}=e(ge.store);return t("postType","wp_dataviews",Number(n))}),[n,a]),{editEntityRecord:u}=(0,d.useDispatch)(ge.store),m=(0,f.useMemo)((()=>{const e=c?.content&&JSON.parse(c?.content);return e?{...e,layout:{...Fl[e?.type]||{}}}:e}),[c?.content]),p=(0,f.useCallback)((e=>{u("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)})}),[u,c?.id]),h=(0,f.useCallback)((e=>{e.type!==o?.type&&s.push({...t,layout:e.type}),l(e)}),[t,o?.type,s]);return"false"===a?[o,h]:"true"===a&&m?[m,p]:[Bl[e][0].view,h]}(e),a=Q_(),{params:r}=J_(),{isCustom:s="false"}=r,i=(0,f.useCallback)((e=>{"false"===s&&t?.type===Vt&&a.push({...r,postId:1===e.length?e[0].id:void 0})}),[a,r,t?.type,s]),o=(0,f.useMemo)((()=>{const e={};return t.filters.forEach((t=>{"status"===t.field&&t.operator===zt&&(e.status=t.value),"author"===t.field&&t.operator===zt?e.author=t.value:"author"===t.field&&t.operator===Gt&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status=nb),{per_page:t.perPage,page:t.page,_embed:"author",order:t.sort?.direction,orderby:t.sort?.field,search:t.search,...e}}),[t]),{records:c,isResolving:u,totalItems:m,totalPages:p}=(0,ge.useEntityRecords)("postType",e,o),{records:h,isResolving:g}=(0,ge.useEntityRecords)("root","user"),y=(0,f.useMemo)((()=>({totalItems:m,totalPages:p})),[m,p]),v=(0,f.useMemo)((()=>[{id:"featured-image",header:(0,b.__)("Featured Image"),getValue:({item:e})=>e.featured_media,render:({item:e})=>(0,l.createElement)(ab,{item:e,viewType:t.type}),enableSorting:!1},{header:(0,b.__)("Title"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>[Bt,Dt].includes(t.type)?(0,l.createElement)(wt,{params:{postId:e.id,postType:e.type,canvas:"edit"}},(0,en.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")):(0,en.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)"),maxWidth:400,enableHiding:!1},{header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e._embedded?.author[0]?.name,type:Lt,elements:h?.map((({id:e,name:t})=>({value:e,label:t})))||[]},{header:(0,b.__)("Status"),id:"status",getValue:({item:e})=>{var t;return null!==(t=tb.find((({value:t})=>t===e.status))?.label)&&void 0!==t?t:e.status},type:Lt,elements:tb,enableSorting:!1,filterBy:{operators:[zt]}},{header:(0,b.__)("Date"),id:"date",getValue:({item:e})=>e.date,render:({item:e})=>{const t=(0,_r.dateI18n)((0,_r.getSettings)().formats.datetimeAbbreviated,(0,_r.getDate)(e.date));return(0,l.createElement)("time",null,t)}}]),[h,t.type]),E=function(){const{createSuccessNotice:e,createErrorNotice:t}=(0,d.useDispatch)(fe.store),{deleteEntityRecord:n}=(0,d.useDispatch)(ge.store);return(0,f.useMemo)((()=>({id:"permanently-delete",label:(0,b.__)("Permanently delete"),isPrimary:!0,icon:Rl,supportsBulk:!0,isEligible:({status:e})=>"trash"===e,async callback(a){const r=await Promise.allSettled(a.map((e=>n("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(r.every((({status:e})=>"fulfilled"===e))){let t;t=1===r.length?(0,b.sprintf)((0,b.__)('"%s" permanently deleted.'),(0,en.decodeEntities)(a[0].title.rendered)):(0,b.__)("The posts were permanently deleted."),e(t,{type:"snackbar",id:"edit-site-post-permanently-deleted"})}else{let e;if(1===r.length)e=r[0].reason?.message?r[0].reason.message:(0,b.__)("An error occurred while permanently deleting the post.");else{const n=new Set,a=r.filter((({status:e})=>"rejected"===e));for(const e of a)e.reason?.message&&n.add(e.reason.message);e=0===n.size?(0,b.__)("An error occurred while permanently deleting the posts."):1===n.size?(0,b.sprintf)((0,b.__)("An error occurred while permanently deleting the posts: %s"),[...n][0]):(0,b.sprintf)((0,b.__)("Some errors occurred while permanently deleting the posts: %s"),[...n].join(",")),t(e,{type:"snackbar"})}}}})),[e,t,n])}(),w=function(){const{createSuccessNotice:e,createErrorNotice:t}=(0,d.useDispatch)(fe.store),{editEntityRecord:n,saveEditedEntityRecord:a}=(0,d.useDispatch)(ge.store);return(0,f.useMemo)((()=>({id:"restore",label:(0,b.__)("Restore"),isPrimary:!0,icon:br,supportsBulk:!0,isEligible:({status:e})=>"trash"===e,async callback(r){try{for(const e of r)await n("postType",e.type,e.id,{status:"draft"}),await a("postType",e.type,e.id,{throwOnError:!0});e(r.length>1?(0,b.sprintf)((0,b.__)("%d posts have been restored."),r.length):(0,b.sprintf)((0,b.__)('"%s" has been restored.'),(0,en.decodeEntities)(r[0].title.rendered)),{type:"snackbar",id:"edit-site-post-restored"})}catch(e){let n;n=e.message&&"unknown_error"!==e.code&&e.message?e.message:r.length>1?(0,b.__)("An error occurred while restoring the posts."):(0,b.__)("An error occurred while restoring the post."),t(n,{type:"snackbar"})}}})),[e,t,n,a])}(),x=function(){const e=Z_();return(0,f.useMemo)((()=>({id:"edit-post",label:(0,b.__)("Edit"),isEligible:({status:e})=>"trash"!==e,callback(t){const n=t[0];e.push({postId:n.id,postType:n.type,canvas:"edit"})}})),[e])}(),S=(0,f.useMemo)((()=>[Y_,q_,w,E,x,K_]),[E,w,x]),C=(0,f.useCallback)((e=>{e.type!==t.type&&(e={...e,layout:{...Fl[e.type]}}),n(e)}),[t.type,n]),[k,T]=(0,f.useState)(!1),P=(0,f.useCallback)((()=>{k||T(!0)}),[k]),I=(0,f.useCallback)((()=>{k&&T(!1)}),[k]),M=(0,f.useCallback)((({type:e,id:t})=>{a.push({postId:t,postType:e,canvas:"edit"}),I()}),[a]);return(0,l.createElement)(j_,{title:(0,b.__)("Pages"),actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.Button,{variant:"primary",onClick:P},(0,b.__)("Add new page")),k&&(0,l.createElement)(Ml,{onSave:M,onClose:I}))},(0,l.createElement)(U_,{paginationInfo:y,fields:v,actions:S,data:c||$_,isLoading:u||g,view:t,onChangeView:C,onSelectionChange:i,supportedLayouts:eb}))}const sb=({data:e,view:t,fields:n,textFields:a})=>{const r=[...e],s=t.sort.field;if(a.includes(s)){const e=n.find((e=>e.id===s));r.sort(((n,a)=>{var r,s;const i=null!==(r=e.getValue({item:n}))&&void 0!==r?r:"",o=null!==(s=e.getValue({item:a}))&&void 0!==s?s:"";return"asc"===t.sort.direction?i.localeCompare(o):o.localeCompare(i)}))}return r};function ib({data:e,view:t}){const n=(t.page-1)*t.perPage,a=e?.length||0;return e=e?.slice(n,n+t.perPage),{data:e,paginationInfo:{totalItems:a,totalPages:Math.ceil(a/t.perPage)}}}const ob=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{d:"M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),lb=(0,l.createElement)(E.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(E.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),cb=(0,l.createElement)(E.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(E.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"})),ub=window.wp.reusableBlocks,{useHistory:db}=Ke(ft.privateApis),{CreatePatternModalContents:mb,useDuplicatePatternProps:pb}=Ke(xt.privateApis),hb={id:"export-pattern",label:(0,b.__)("Export as JSON"),isEligible:e=>e.type===It.user,callback:([e])=>{const t={__file:e.type,title:e.title||e.name,content:e.patternPost.content.raw,syncStatus:e.patternPost.wp_pattern_sync_status};return(0,Fc.downloadBlob)(`${bs(e.title||e.name)}.json`,JSON.stringify(t,null,2),"application/json")}},fb={id:"rename-pattern",label:(0,b.__)("Rename"),isEligible:e=>{const t=e.type===kt,n=e.type===It.user||t&&e.isCustom,a=t&&e.templatePart.has_theme_file;return n&&!a},RenderModal:({items:e,closeModal:t})=>{const[n]=e,[a,r]=(0,f.useState)((()=>n.title)),{editEntityRecord:s,saveEditedEntityRecord:i}=(0,d.useDispatch)(ge.store),{createSuccessNotice:o,createErrorNotice:c}=(0,d.useDispatch)(fe.store);return(0,l.createElement)("form",{onSubmit:async function(e){e.preventDefault();try{await s("postType",n.type,n.id,{title:a}),r(""),t(),await i("postType",n.type,n.id,{throwOnError:!0}),o(n.type===kt?(0,b.__)("Template part renamed."):(0,b.__)("Pattern renamed."),{type:"snackbar"})}catch(e){const t=n.type===kt?(0,b.__)("An error occurred while renaming the template part."):(0,b.__)("An error occurred while renaming the pattern."),a=e.message&&"unknown_error"!==e.code?e.message:t;c(a,{type:"snackbar"})}}},(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Name"),value:a,onChange:r,required:!0}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t()}},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,b.__)("Save")))))}},gb=e=>{const t=e.type===kt;return e.type===It.user||t&&e.isCustom},yb={id:"delete-pattern",label:(0,b.__)("Delete"),isEligible:e=>{const t=e.type===kt&&e.templatePart.has_theme_file;return gb(e)&&!t},hideModalHeader:!0,RenderModal:({items:e,closeModal:t})=>{const[n]=e,{__experimentalDeleteReusableBlock:a}=(0,d.useDispatch)(ub.store),{createErrorNotice:r,createSuccessNotice:s}=(0,d.useDispatch)(fe.store),{removeTemplate:i}=(0,d.useDispatch)(ta);return(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.__experimentalText,null,(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(n.title||n.name))),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",onClick:()=>n.type===kt?i(n):(async()=>{try{await a(n.id),s((0,b.sprintf)((0,b.__)('"%s" deleted.'),n.title),{type:"snackbar",id:"edit-site-patterns-success"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern.");r(t,{type:"snackbar",id:"edit-site-patterns-error"})}})()},(0,b.__)("Delete"))))}},vb={id:"reset-action",label:(0,b.__)("Clear customizations"),isEligible:e=>{const t=e.type===kt&&e.templatePart.has_theme_file;return gb(e)&&t},hideModalHeader:!0,RenderModal:({items:e,closeModal:t})=>{const[n]=e,{removeTemplate:a}=(0,d.useDispatch)(ta);return(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.__experimentalText,null,(0,b.__)("Are you sure you want to clear these customizations?")),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",onClick:()=>a(n)},(0,b.__)("Clear"))))}},_b={id:"duplicate-pattern",label:(0,b._x)("Duplicate","action label"),isEligible:e=>e.type!==kt,modalHeader:(0,b._x)("Duplicate pattern","action label"),RenderModal:({items:e,closeModal:t})=>{const[n]=e,{categoryId:a=Mt}=(0,gt.getQueryArgs)(window.location.href),r=n.type===It.theme,s=db();const i=pb({pattern:r?n:n.patternPost,onSuccess:function({pattern:e}){s.push({categoryType:It.theme,categoryId:a,postType:It.user,postId:e.id}),t()}});return(0,l.createElement)(mb,{onClose:t,confirmLabel:(0,b._x)("Duplicate","action label"),...i})}},bb={id:"duplicate-template-part",label:(0,b._x)("Duplicate","action label"),isEligible:e=>e.type===kt,modalHeader:(0,b._x)("Duplicate template part","action label"),RenderModal:({items:e,closeModal:t})=>{const[n]=e,{createSuccessNotice:a}=(0,d.useDispatch)(fe.store),{categoryId:r=Mt}=(0,gt.getQueryArgs)(window.location.href),s=db();return(0,l.createElement)(ti,{blocks:n.blocks,defaultArea:n.templatePart.area,defaultTitle:(0,b.sprintf)((0,b.__)("%s (Copy)"),n.title),onCreate:async function(e){a((0,b.sprintf)((0,b.__)('"%s" duplicated.'),n.title),{type:"snackbar",id:"edit-site-patterns-success"}),s.push({postType:kt,postId:e?.id,categoryType:kt,categoryId:r}),t()},onError:t,confirmLabel:(0,b._x)("Duplicate","action label")})}};function Eb(){var e;const t=(0,d.useSelect)((e=>{const{getSettings:t}=Ke(e(ta));return t()}),[]),n=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,a=(0,d.useSelect)((e=>e(ge.store).getBlockPatterns()),[]),r=(0,f.useMemo)((()=>[...n||[],...a||[]].filter(ni)),[n,a]);return(0,f.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...n}=t;return{...n,__experimentalBlockPatterns:r,__unstableIsPreviewMode:!0}}),[t,r])}const{RenamePatternCategoryModal:wb}=Ke(xt.privateApis);function xb({category:e,onClose:t}){const[n,a]=(0,f.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{onClick:()=>a(!0)},(0,b.__)("Rename")),n&&(0,l.createElement)(Sb,{category:e,onClose:()=>{a(!1),t()}}))}function Sb({category:e,onClose:t}){const n={id:e.id,slug:e.slug,name:e.label},a=ki();return(0,l.createElement)(wb,{category:n,existingCategories:a,onClose:t,overlayClassName:"edit-site-list__rename-modal"})}const{useHistory:Cb}=Ke(ft.privateApis);function kb({category:e,onClose:t}){const[n,a]=(0,f.useState)(!1),r=Cb(),{createSuccessNotice:s,createErrorNotice:i}=(0,d.useDispatch)(fe.store),{deleteEntityRecord:o,invalidateResolution:c}=(0,d.useDispatch)(ge.store);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.MenuItem,{isDestructive:!0,onClick:()=>a(!0)},(0,b.__)("Delete")),(0,l.createElement)(_.__experimentalConfirmDialog,{isOpen:n,onConfirm:async()=>{try{await o("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",It.user,{per_page:-1}]),s((0,b.sprintf)((0,b.__)('"%s" deleted.'),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),r.push({path:"/patterns",categoryType:It.theme,categoryId:Mt})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern category.");i(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>a(!1),confirmButtonText:(0,b.__)("Delete"),className:"edit-site-patterns__delete-modal"},(0,b.sprintf)((0,b.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,en.decodeEntities)(e.label))))}function Tb({categoryId:e,type:t,titleId:n,descriptionId:a}){const{patternCategories:r}=ki(),s=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]);let i,o,c;if(t===kt){const t=s.find((t=>t.area===e));i=t?.label,o=t?.description}else t===It.theme&&(c=r.find((t=>t.name===e)),i=c?.label,o=c?.description);return i?(0,l.createElement)(_.__experimentalVStack,{className:"edit-site-patterns__section-header"},(0,l.createElement)(_.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(_.__experimentalHeading,{as:"h2",level:4,id:n},i),!!c?.id&&(0,l.createElement)(_.DropdownMenu,{icon:ce,label:(0,b.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",describedBy:(0,b.sprintf)((0,b.__)("Action menu for %s pattern category"),i)}},(({onClose:e})=>(0,l.createElement)(_.MenuGroup,null,(0,l.createElement)(xb,{category:c,onClose:e}),(0,l.createElement)(kb,{category:c,onClose:e}))))),o?(0,l.createElement)(_.__experimentalText,{variant:"muted",as:"p",id:a},o):null):null}const{ExperimentalBlockEditorProvider:Pb,useGlobalStyle:Ib}=Ke(he.privateApis),Mb={header:ob,footer:lb,uncategorized:Ks},Ab=[],Nb={[Dt]:{mediaField:"preview",primaryField:"title"}},Ob={type:Dt,search:"",page:1,perPage:20,hiddenFields:["sync-status"],layout:{...Nb[Dt]},filters:[]},Rb=[{value:Ot.full,label:(0,b._x)("Synced","Option that shows all synchronized patterns"),description:(0,b.__)("Patterns that are kept in sync across the site.")},{value:Ot.unsynced,label:(0,b._x)("Not synced","Option that shows all patterns that are not synchronized"),description:(0,b.__)("Patterns that can be changed freely without affecting the site.")}];function Fb({item:e,onClick:t,ariaDescribedBy:n,children:a}){return e.type===It.theme?a:(0,l.createElement)("button",{className:"page-patterns-preview-field__button",type:"button",onClick:t,"aria-label":e.title,"aria-describedby":n},a)}function Db({item:e,categoryId:t,viewType:n}){const a=(0,f.useId)(),r=e.type===It.user,s=e.type===It.theme,i=e.type===kt,o=!e.blocks?.length,c=[];r||i&&e.isCustom?c.push((0,b.__)("Press Enter to edit, or Delete to delete the pattern.")):e.description&&c.push(e.description),s&&c.push((0,b.__)("Theme & plugin patterns cannot be edited."));const[u]=Ib("color.background"),{onClick:d}=Et({postType:e.type,postId:r?e.id:e.name,categoryId:t,categoryType:i?e.type:It.theme});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:`page-patterns-preview-field is-viewtype-${n}`,style:{backgroundColor:u}},(0,l.createElement)(Fb,{item:e,onClick:d,ariaDescribedBy:c.length?c.map(((e,t)=>`${a}-${t}`)).join(" "):void 0},o&&i&&(0,b.__)("Empty template part"),o&&!i&&(0,b.__)("Empty pattern"),!o&&(0,l.createElement)(he.BlockPreview,{blocks:e.blocks}))),c.map(((e,t)=>(0,l.createElement)("div",{key:t,hidden:!0,id:`${a}-${t}`},e))))}function Bb({item:e,categoryId:t}){const n=e.type===It.user,a=e.type===It.theme,r=e.type===kt;let s;const{onClick:i}=Et({postType:e.type,postId:n?e.id:e.name,categoryId:t,categoryType:r?e.type:It.theme});return s=!n&&Mb[t]?Mb[t]:e.syncStatus===Ot.full?ca:void 0,(0,l.createElement)(_.__experimentalHStack,{alignment:"center",justify:"flex-start",spacing:2},s&&!a&&(0,l.createElement)(_.Tooltip,{placement:"top",text:(0,b.__)("Editing this pattern will also update anywhere it is used")},(0,l.createElement)(fa,{className:"edit-site-patterns__pattern-icon",icon:s})),e.type===It.theme&&(0,l.createElement)(_.Tooltip,{placement:"top",text:(0,b.__)("This pattern cannot be edited.")},(0,l.createElement)(fa,{className:"edit-site-patterns__pattern-lock-icon",icon:cb,size:24})),(0,l.createElement)(_.Flex,{as:"div",gap:0,justify:"left",className:"edit-site-patterns__pattern-title"},e.type===It.theme?e.title:(0,l.createElement)(_.Button,{variant:"link",onClick:i,tabIndex:"-1"},e.title||e.name)))}function Vb(){const{categoryType:e,categoryId:t=Mt}=(0,gt.getQueryArgs)(window.location.href),n=e||It.theme,[a,r]=(0,f.useState)(Ob),s=n===It.theme&&"uncategorized"===t,i=(0,se.usePrevious)(t),o=a.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:c,isResolving:u}=Ci(n,s?"":t,{search:a.search,syncStatus:o}),d=(0,f.useMemo)((()=>{const e=[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,l.createElement)(Db,{item:e,categoryId:t,viewType:a.type}),enableSorting:!1,enableHiding:!1},{header:(0,b.__)("Title"),id:"title",getValue:({item:e})=>e.title,render:({item:e})=>(0,l.createElement)(Bb,{item:e,categoryId:t}),enableHiding:!1}];return n===It.theme&&e.push({header:(0,b.__)("Sync Status"),id:"sync-status",render:({item:e})=>Rb.find((({value:t})=>t===e.syncStatus))?.label||Rb.find((({value:e})=>e===Ot.unsynced)).label,type:Lt,elements:Rb,filterBy:{operators:[zt]},enableSorting:!1}),e}),[a.type,t,n]);(0,f.useEffect)((()=>{i!==t&&r(Ob)}),[t,i]);const{data:m,paginationInfo:p}=(0,f.useMemo)((()=>{if(!c)return{data:Ab,paginationInfo:{totalItems:0,totalPages:0}};let e=[...c];return a.sort&&(e=sb({data:e,view:a,fields:d,textFields:["title","author"]})),ib({data:e,view:a})}),[c,a,d]),h=(0,f.useMemo)((()=>[fb,_b,bb,hb,vb,yb]),[]),g=(0,f.useCallback)((e=>{e.type!==a.type&&(e={...e,layout:{...Nb[e.type]}}),r(e)}),[a.type,r]),y=(0,f.useId)(),v=Eb();return(0,l.createElement)(Pb,{settings:v},(0,l.createElement)(j_,{title:(0,b.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0},(0,l.createElement)(Tb,{categoryId:t,type:n,titleId:`${y}-title`,descriptionId:`${y}-description`}),(0,l.createElement)(U_,{paginationInfo:p,fields:d,actions:h,data:m||Ab,getItemId:e=>e.name,isLoading:u,view:a,onChangeView:g,deferredRendering:!0,supportedLayouts:[Dt]})))}const Lb={id:"delete-template",label:(0,b.__)("Delete"),isPrimary:!0,icon:Rl,isEligible:Gs,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onPerform:n})=>{const{removeTemplates:a}=Ke((0,d.useDispatch)(ta));return(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.__experimentalText,null,e.length>1?(0,b.sprintf)((0,b._n)("Delete %d item?","Delete %d items?",e.length),e.length):(0,b.sprintf)((0,b.__)('Delete "%s"?'),(0,en.decodeEntities)(e?.[0]?.title?.rendered))),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",onClick:async()=>{await a(e,{allowUndo:!1}),n&&n(),t()}},(0,b.__)("Delete"))))}},zb={id:"rename-template",label:(0,b.__)("Rename"),isEligible:e=>!(!Gs(e)||e.type===Ct&&!e.is_custom),RenderModal:({items:e,closeModal:t})=>{const n=e[0],a=(0,en.decodeEntities)(n.title.rendered),[r,s]=(0,f.useState)(a),{editEntityRecord:i,__experimentalSaveSpecifiedEntityEdits:o}=(0,d.useDispatch)(ge.store),{createSuccessNotice:c,createErrorNotice:u}=(0,d.useDispatch)(fe.store);return(0,l.createElement)("form",{onSubmit:async function(e){e.preventDefault();try{await i("postType",n.type,n.id,{title:r}),s(""),t(),await o("postType",n.type,n.id,["title"],{throwOnError:!0}),c(n.type===Ct?(0,b.__)("Template renamed."):(0,b.__)("Template part renamed."),{type:"snackbar"})}catch(e){const t=n.type===Ct?(0,b.__)("An error occurred while renaming the template."):(0,b.__)("An error occurred while renaming the template part."),a=e.message&&"unknown_error"!==e.code?e.message:t;u(a,{type:"snackbar"})}}},(0,l.createElement)(_.__experimentalVStack,{spacing:"5"},(0,l.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:r,onChange:s,required:!0}),(0,l.createElement)(_.__experimentalHStack,{justify:"right"},(0,l.createElement)(_.Button,{variant:"tertiary",onClick:t},(0,b.__)("Cancel")),(0,l.createElement)(_.Button,{variant:"primary",type:"submit"},(0,b.__)("Save")))))}},{useHistory:Gb}=Ke(ft.privateApis);function Hb(){const{canCreate:e,postType:t}=(0,d.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(ta).getSettings();return{canCreate:!t,postType:e(ge.store).getPostType(kt)}}),[]),[n,a]=(0,f.useState)(!1),r=Gb();return e&&t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.Button,{variant:"primary",onClick:()=>a(!0)},t.labels.add_new_item),n&&(0,l.createElement)(ei,{closeModal:()=>a(!1),blocks:[],onCreate:e=>{a(!1),r.push({postId:e.id,postType:kt,canvas:"edit"})},onError:()=>a(!1)})):null}const{ExperimentalBlockEditorProvider:Ub,useGlobalStyle:Wb}=Ke(he.privateApis),{useHistory:jb,useLocation:Zb}=Ke(ft.privateApis),qb=[],Yb=window?.__experimentalAdminViews?[Bt,Dt,Vt]:[Bt,Dt],Kb={[Bt]:{primaryField:"title"},[Dt]:{mediaField:"preview",primaryField:"title"},[Vt]:{primaryField:"title",mediaField:"preview"}},Xb={type:Bt,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},hiddenFields:["preview"],layout:Kb[Bt],filters:[]};function Jb(e=""){return li()(e.trim().toLowerCase())}function Qb({item:e,viewType:t}){if(t===Vt)return(0,en.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)");const n={params:{postId:e.id,postType:e.type,canvas:"edit"}};return e.type===kt&&(n.state={backPath:"/wp_template_part/all"}),(0,l.createElement)(wt,{...n},(0,en.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)"))}function $b({item:e,viewType:t}){const{text:n,icon:a,imageUrl:r}=Ls(e.type,e.id),s=t!==Vt;return(0,l.createElement)(_.__experimentalHStack,{alignment:"left",spacing:1},s&&r&&(0,l.createElement)(zs,{imageUrl:r}),s&&!r&&(0,l.createElement)("div",{className:"edit-site-list-added-by__icon"},(0,l.createElement)(_.Icon,{icon:a})),(0,l.createElement)("span",null,n))}function eE({item:e,viewType:t}){const n=Eb(),[a="white"]=Wb("color.background"),r=(0,f.useMemo)((()=>(0,c.parse)(e.content.raw)),[e.content.raw]),{onClick:s}=Et({postId:e.id,postType:e.type,canvas:"edit"}),i=!r?.length;return(0,l.createElement)(Ub,{settings:n},(0,l.createElement)("div",{className:`page-templates-preview-field is-viewtype-${t}`,style:{backgroundColor:a}},(0,l.createElement)("button",{className:"page-templates-preview-field__button",type:"button",onClick:s,"aria-label":e.title?.rendered||e.title},i&&(e.type===Ct?(0,b.__)("Empty template"):(0,b.__)("Empty template part")),!i&&(0,l.createElement)(he.BlockPreview,{blocks:r}))))}function tE({postType:e}){const{params:t}=Zb(),{activeView:n="all",layout:a}=t,r=(0,f.useMemo)((()=>({...Xb,type:window?.__experimentalAdminViews&&null!=a?a:Xb.type,filters:"all"!==n?[{field:"author",operator:"in",value:n}]:[]})),[a,n]),[s,i]=(0,f.useState)(r);(0,f.useEffect)((()=>{i((e=>({...e,filters:"all"!==n?[{field:"author",operator:"in",value:n}]:[]})))}),[n]);const{records:o,isResolving:c}=(0,ge.useEntityRecords)("postType",e,{per_page:-1}),u=jb(),m=(0,f.useCallback)((e=>{s?.type===Vt&&u.push({...t,postId:1===e.length?e[0].id:void 0})}),[u,t,s?.type]),p=(0,f.useMemo)((()=>{if(!o)return qb;const e=new Set;return o.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[o]),h=(0,f.useMemo)((()=>{const t=[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,l.createElement)(eE,{item:e,viewType:s.type}),minWidth:120,maxWidth:120,enableSorting:!1},{header:e===Ct?(0,b.__)("Template"):(0,b.__)("Template Part"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>(0,l.createElement)(Qb,{item:e,viewType:s.type}),maxWidth:400,enableHiding:!1}];return e===Ct&&t.push({header:(0,b.__)("Description"),id:"description",getValue:({item:e})=>e.description,render:({item:e})=>e.description?(0,l.createElement)("span",{className:"page-templates-description"},(0,en.decodeEntities)(e.description)):s.type===Bt&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.__experimentalText,{variant:"muted","aria-hidden":"true"},"—"),(0,l.createElement)(_.VisuallyHidden,null,(0,b.__)("No description."))),maxWidth:400,minWidth:320,enableSorting:!1}),t.push({header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:({item:e})=>(0,l.createElement)($b,{viewType:s.type,item:e}),enableHiding:!1,type:Lt,elements:p,width:"1%"}),t}),[e,p,s.type]),{data:g,paginationInfo:y}=(0,f.useMemo)((()=>{if(!o)return{data:qb,paginationInfo:{totalItems:0,totalPages:0}};let e=[...o];if(s.search){const t=Jb(s.search);e=e.filter((e=>Jb(e.title?.rendered||e.slug).includes(t)||Jb(e.description).includes(t)))}return s.filters.length>0&&s.filters.forEach((t=>{"author"===t.field&&t.operator===zt&&t.value?e=e.filter((e=>e.author_text===t.value)):"author"===t.field&&t.operator===Gt&&t.value&&(e=e.filter((e=>e.author_text!==t.value)))})),s.sort&&(e=sb({data:e,view:s,fields:h,textFields:["title","author"]})),ib({data:e,view:s})}),[o,s,h]),v=function(){const{revertTemplate:e}=(0,d.useDispatch)(ta),{saveEditedEntityRecord:t}=(0,d.useDispatch)(ge.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(fe.store);return(0,f.useMemo)((()=>({id:"reset-template",label:(0,b.__)("Reset"),isPrimary:!0,icon:br,isEligible:$t,supportsBulk:!0,async callback(r){try{for(const n of r)await e(n,{allowUndo:!1}),await t("postType",n.type,n.id);n(r.length>1?(0,b.sprintf)((0,b.__)("%s items reverted."),r.length):(0,b.sprintf)((0,b.__)('"%s" reverted.'),(0,en.decodeEntities)(r[0].title.rendered)),{type:"snackbar",id:"edit-site-template-reverted"})}catch(e){let t;t=r[0].type===Ct?1===r.length?(0,b.__)("An error occurred while reverting the template."):(0,b.__)("An error occurred while reverting the templates."):1===r.length?(0,b.__)("An error occurred while reverting the template part."):(0,b.__)("An error occurred while reverting the template parts.");const n=e.message&&"unknown_error"!==e.code?e.message:t;a(n,{type:"snackbar"})}}})),[a,n,e,t])}(),E=(0,f.useMemo)((()=>[v,Lb,zb,K_]),[v]),w=(0,f.useCallback)((e=>{e.type!==s.type&&(e={...e,layout:{...Kb[e.type]}},u.push({...t,layout:e.type})),i(e)}),[s.type,i,u,t]);return(0,l.createElement)(j_,{title:e===Ct?(0,b.__)("Templates"):(0,b.__)("Template Parts"),actions:e===Ct?(0,l.createElement)(Is,{templateType:e,showIcon:!1,toggleProps:{variant:"primary"}}):(0,l.createElement)(Hb,null)},(0,l.createElement)(U_,{paginationInfo:y,fields:h,actions:E,data:g,isLoading:c,view:s,onChangeView:w,onSelectionChange:m,deferredRendering:!s.hiddenFields?.includes("preview"),supportedLayouts:Yb}))}const{useLocation:nE}=Ke(ft.privateApis);const{useCommands:aE}=Ke(ra.privateApis),{useCommandContext:rE}=Ke(aa.privateApis),{useGlobalStyle:sE}=Ke(he.privateApis),iE=.5;function oE(){Vi(),function(){const e=iu(),{params:t}=su(),n=(0,d.useSelect)((e=>Ke(e(ta)).getCanvasMode()),[]),{setCanvasMode:a}=Ke((0,d.useDispatch)(ta)),r=(0,f.useRef)(n),{canvas:s}=t,i=(0,f.useRef)(s),o=(0,f.useRef)(t);(0,f.useEffect)((()=>{o.current=t}),[t]),(0,f.useEffect)((()=>{r.current=n,"init"!==n&&("edit"===n&&i.current!==n&&e.push({...o.current,canvas:"edit"}),"view"===n&&void 0!==i.current&&e.push({...o.current,canvas:void 0}))}),[n,e]),(0,f.useEffect)((()=>{i.current=s,"edit"!==s&&"view"!==r.current?a("view"):"edit"===s&&"edit"!==r.current&&a("edit")}),[s,a])}(),aE(),(0,aa.useCommandLoader)({name:"core/exit-code-editor",hook:Uu,context:"site-editor-edit"}),(0,aa.useCommandLoader)({name:"core/edit-site/page-content-focus",hook:Hu,context:"site-editor-edit"}),(0,aa.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:Wu}),(0,aa.useCommandLoader)({name:"core/edit-site/patterns",hook:Zu,context:"site-editor-edit"}),(0,aa.useCommandLoader)({name:"core/edit-site/edit-ui",hook:ju}),function(){const e=(0,d.useSelect)((e=>{const{getUnstableBase:t}=e(ge.store);return t()?.home}),[]);(0,aa.useCommand)({name:"core/edit-site/view-site",label:(0,b.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:vc}),(0,aa.useCommandLoader)({name:"core/edit-site/open-styles",hook:xu}),(0,aa.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:Su}),(0,aa.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Cu}),(0,aa.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:ku}),(0,aa.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:Tu})}(),(0,he.useBlockCommands)();const e=(0,se.useViewportMatch)("medium","<"),{isDistractionFree:t,hasFixedToolbar:n,hasBlockSelected:a,canvasMode:r,previousShortcut:s,nextShortcut:i}=(0,d.useSelect)((e=>{const{getAllShortcutKeyCombinations:t}=e(na.store),{getCanvasMode:n}=Ke(e(ta));return{canvasMode:n(),previousShortcut:t("core/edit-site/previous-region"),nextShortcut:t("core/edit-site/next-region"),hasFixedToolbar:e(k.store).get("core","fixedToolbar"),isDistractionFree:e(k.store).get("core","distractionFree"),hasBlockSelected:e(he.store).getBlockSelectionStart()}}),[]),o=(0,_.__unstableUseNavigateRegions)({previous:s,next:i}),c=(0,se.useReducedMotion)(),[u,m]=(0,se.useResizeObserver)(),[p]=(0,se.useResizeObserver)(),h=Yu(),[g,y]=(0,f.useState)(!1),{areas:E,widths:w}=function(){const e=Yu(),{params:t}=nE(),{postType:n,postId:a,path:r,layout:s,isCustom:i}=null!=t?t:{};if("/page"===r)return{areas:{content:void 0,preview:(0,l.createElement)(Yv,{isLoading:e})},widths:{content:void 0}};const o="true"!==i&&"list"===s&&window?.__experimentalAdminViews;return"/pages"===r?{areas:{content:(0,l.createElement)(rb,null),preview:o&&(0,l.createElement)(Yv,{isLoading:e})},widths:{content:o?380:void 0}}:n&&a?{areas:{preview:(0,l.createElement)(Yv,{isLoading:e})}}:"/wp_template/all"===r?{areas:{content:(0,l.createElement)(tE,{postType:Ct}),preview:o&&(0,l.createElement)(Yv,{isLoading:e})},widths:{content:o?380:void 0}}:"/wp_template_part/all"===r?{areas:{content:(0,l.createElement)(tE,{postType:kt}),preview:o&&(0,l.createElement)(Yv,{isLoading:e})},widths:{content:o?380:void 0}}:"/patterns"===r?{areas:{content:(0,l.createElement)(Vb,null)}}:{areas:{preview:(0,l.createElement)(Yv,{isLoading:e})}}}();let x;x="view"===r?"view":t?"isDistractionFree":r;let S="site-editor";"edit"===r&&(S="site-editor-edit"),a&&(S="block-selection-edit"),rE(S);const[C]=sE("color.background"),[T]=sE("color.gradient");return"init"===r?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(aa.CommandMenu,null),(0,l.createElement)(pu,null),(0,l.createElement)(hu,null),p,(0,l.createElement)("div",{...o,ref:o.ref,className:v()("edit-site-layout",o.className,{"is-distraction-free":t&&"edit"===r,"is-full-canvas":"edit"===r,"has-fixed-toolbar":n,"is-block-toolbar-visible":a})},(0,l.createElement)(_.__unstableMotion.div,{className:"edit-site-layout__header-container",variants:{isDistractionFree:{opacity:0,transition:{type:"tween",delay:.8,delayChildren:.8}},isDistractionFreeHovering:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},view:{opacity:1},edit:{opacity:1}},whileHover:t?"isDistractionFreeHovering":void 0,animate:x},(0,l.createElement)(Jc,{isTransparent:g,className:"edit-site-layout__hub"}),(0,l.createElement)(_.__unstableAnimatePresence,{initial:!1},"edit"===r&&(0,l.createElement)(ie,{key:"header",className:"edit-site-layout__header",ariaLabel:(0,b.__)("Editor top bar"),as:_.__unstableMotion.div,variants:{isDistractionFree:{opacity:0,y:0},isDistractionFreeHovering:{opacity:1,y:0},view:{opacity:1,y:"-100%"},edit:{opacity:1,y:0}},exit:{y:"-100%"},initial:{opacity:t?1:0,y:t?0:"-100%"},transition:{type:"tween",duration:c?0:.2,ease:"easeOut"}},(0,l.createElement)(qc,null)))),(0,l.createElement)("div",{className:"edit-site-layout__content"},(0,l.createElement)(ie,{ariaLabel:(0,b.__)("Navigation"),className:"edit-site-layout__sidebar-region"},(0,l.createElement)(_.__unstableAnimatePresence,null,"view"===r&&(0,l.createElement)(_.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:c||e?0:iE,ease:"easeOut"},className:"edit-site-layout__sidebar"},(0,l.createElement)(mc,null)))),(0,l.createElement)(mu,null),E.content&&"edit"!==r&&(0,l.createElement)("div",{className:"edit-site-layout__area",style:{maxWidth:w?.content}},E.content),E.preview&&(0,l.createElement)("div",{className:"edit-site-layout__canvas-container"},u,!!m.width&&(0,l.createElement)(_.__unstableMotion.div,{whileHover:"view"===r?{scale:1.005,transition:{duration:c?0:.5,ease:"easeOut"}}:{},initial:!1,layout:"position",className:v()("edit-site-layout__canvas",{"is-right-aligned":g}),transition:{type:"tween",duration:c?0:iE,ease:"easeOut"}},(0,l.createElement)(fc,null,(0,l.createElement)(ru,{isReady:!h,isFullWidth:"edit"===r,defaultSize:{width:m.width-24,height:m.height},isOversized:g,setIsOversized:y,innerContentStyle:{background:null!=T?T:C}},E.preview)))))))}const{RouterProvider:lE}=Ke(ft.privateApis);function cE(){const{createErrorNotice:e}=(0,d.useDispatch)(fe.store);return(0,l.createElement)(_.SlotFillProvider,null,(0,l.createElement)(Aa,null,(0,l.createElement)(g.UnsavedChangesWarning,null),(0,l.createElement)(lE,null,(0,l.createElement)(oE,null),(0,l.createElement)(j.PluginArea,{onError:function(t){e((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),t))}}))))}function uE({className:e,...t}){return(0,l.createElement)(re,{panelClassName:e,className:"edit-site-sidebar-edit-mode",scope:"core/edit-site",...t})}function dE(e){return(0,l.createElement)($,{__unstableExplicitMenuItem:!0,scope:"core/edit-site",...e})}const mE=(0,se.compose)((0,j.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:_.MenuItem,icon:t.icon||e.icon,name:"core/edit-site/plugin-more-menu"}})))(J);function pE(e,t){const n=document.getElementById(e),a=(0,f.createRoot)(n);(0,d.dispatch)(c.store).reapplyBlockTypeFilters();const r=(0,u.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,u.registerCoreBlocks)(r),(0,d.dispatch)(c.store).setFreeformFallbackBlockName("core/html"),(0,de.registerLegacyWidgetBlock)({inserter:!1}),(0,de.registerWidgetGroupBlock)({inserter:!1}),(0,d.dispatch)(k.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,d.dispatch)(k.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1}),(0,d.dispatch)(W).setDefaultComplementaryArea("core/edit-site","edit-site/template"),(0,d.dispatch)(ta).updateSettings(t),(0,d.dispatch)(g.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas}),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),a.render((0,l.createElement)(cE,null)),a}function hE(){h()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=a})();