diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/js/dist/edit-site.min.js --- a/wp/wp-includes/js/dist/edit-site.min.js Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/js/dist/edit-site.min.js Fri Sep 05 18:52:52 2025 +0200 @@ -1,11 +1,11 @@ /*! This file is auto-generated */ -(()=>{var e,t,s={4660:e=>{e.exports=function(){function e(t,s,n){function i(o,a){if(!s[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=s[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,s,n)}return s[o].exports}for(var r=void 0,o=0;o=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var s="",o=0;o>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},s.buf2binstring=function(e){return l(e,e.length)},s.binstring2buf=function(e){for(var t=new n.Buf8(e.length),s=0,i=t.length;s4)c[n++]=65533,s+=r-1;else{for(i&=2===r?31:3===r?15:7;r>1&&s1?c[n++]=65533:i<65536?c[n++]=i:(i-=65536,c[n++]=55296|i>>10&1023,c[n++]=56320|1023&i)}return l(c,n)},s.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0||0===s?t:s+o[e[s]]>t?s:t}},{"./common":1}],3:[function(e,t,s){"use strict";function n(e,t,s,n){for(var i=65535&e|0,r=e>>>16&65535|0,o=0;0!==s;){s-=o=s>2e3?2e3:s;do{r=r+(i=i+t[n++]|0)|0}while(--o);i%=65521,r%=65521}return i|r<<16|0}t.exports=n},{}],4:[function(e,t,s){"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,s){"use strict";function n(){for(var e,t=[],s=0;s<256;s++){e=s;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}var i=n();function r(e,t,s,n){var r=i,o=n+s;e^=-1;for(var a=n;a>>8^r[255&(e^t[a])];return-1^e}t.exports=r},{}],6:[function(e,t,s){"use strict";function n(){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=n},{}],7:[function(e,t,s){"use strict";var n=30,i=12;t.exports=function(e,t){var s,r,o,a,l,c,u,d,h,p,f,m,g,v,y,x,b,w,_,S,j,C,k,E,P;s=e.state,r=e.next_in,E=e.input,o=r+(e.avail_in-5),a=e.next_out,P=e.output,l=a-(t-e.avail_out),c=a+(e.avail_out-257),u=s.dmax,d=s.wsize,h=s.whave,p=s.wnext,f=s.window,m=s.hold,g=s.bits,v=s.lencode,y=s.distcode,x=(1<>>=_=w>>>24,g-=_,0==(_=w>>>16&255))P[a++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=v[(65535&w)+(m&(1<<_)-1)];continue t}if(32&_){s.mode=i;break e}e.msg="invalid literal/length code",s.mode=n;break e}S=65535&w,(_&=15)&&(g<_&&(m+=E[r++]<>>=_,g-=_),g<15&&(m+=E[r++]<>>=_=w>>>24,g-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=y[(65535&w)+(m&(1<<_)-1)];continue s}e.msg="invalid distance code",s.mode=n;break e}if(j=65535&w,g<(_&=15)&&(m+=E[r++]<u){e.msg="invalid distance too far back",s.mode=n;break e}if(m>>>=_,g-=_,j>(_=a-l)){if((_=j-_)>h&&s.sane){e.msg="invalid distance too far back",s.mode=n;break e}if(C=0,k=f,0===p){if(C+=d-_,_2;)P[a++]=k[C++],P[a++]=k[C++],P[a++]=k[C++],S-=3;S&&(P[a++]=k[C++],S>1&&(P[a++]=k[C++]))}else{C=a-j;do{P[a++]=P[C++],P[a++]=P[C++],P[a++]=P[C++],S-=3}while(S>2);S&&(P[a++]=P[C++],S>1&&(P[a++]=P[C++]))}break}}break}}while(r>3,m&=(1<<(g-=S<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ne(){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 n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(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=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32($),t.distcode=t.distdyn=new n.Buf32(ee),t.sane=1,t.back=-1,f):v}function re(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function oe(e,t){var s,n;return e&&e.state?(n=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=s,n.wbits=t,re(e))):v}function ae(e,t){var s,n;return e?(n=new ne,e.state=n,n.window=null,(s=oe(e,t))!==f&&(e.state=null),s):v}function le(e){return ae(e,te)}var ce,ue,de=!0;function he(e){if(de){var t;for(ce=new n.Buf32(512),ue=new n.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(a(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(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,s,i){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(n.arraySet(o.window,t,s-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),n.arraySet(o.window,t,s-i,r,o.wnext),(i-=r)?(n.arraySet(o.window,t,s-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,s.check=r(s.check,ke,2,0),oe=0,ae=0,s.mode=S;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&oe)<<8)+(oe>>8))%31){e.msg="incorrect header check",s.mode=J;break}if((15&oe)!==w){e.msg="unknown compression method",s.mode=J;break}if(ae-=4,we=8+(15&(oe>>>=4)),0===s.wbits)s.wbits=we;else if(we>s.wbits){e.msg="invalid window size",s.mode=J;break}s.dmax=1<>8&1),512&s.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0,s.mode=j;case j:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,ke[2]=oe>>>16&255,ke[3]=oe>>>24&255,s.check=r(s.check,ke,4,0)),oe=0,ae=0,s.mode=C;case C:for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>8),512&s.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0,s.mode=k;case k:if(1024&s.flags){for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0}else s.head&&(s.head.extra=null);s.mode=E;case E:if(1024&s.flags&&((ue=s.length)>ie&&(ue=ie),ue&&(s.head&&(we=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),n.arraySet(s.head.extra,$,te,ue,we)),512&s.flags&&(s.check=r(s.check,$,ue,te)),ie-=ue,te+=ue,s.length-=ue),s.length))break e;s.length=0,s.mode=P;case P:if(2048&s.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],s.head&&we&&s.length<65536&&(s.head.name+=String.fromCharCode(we))}while(we&&ue>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=M;break;case O:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>=7&ae,ae-=7&ae,s.mode=K;break}for(;ae<3;){if(0===ie)break e;ie--,oe+=$[te++]<>>=1)){case 0:s.mode=F;break;case 1:if(he(s),s.mode=z,t===p){oe>>>=2,ae-=2;break e}break;case 2:s.mode=B;break;case 3:e.msg="invalid block type",s.mode=J}oe>>>=2,ae-=2;break;case F:for(oe>>>=7&ae,ae-=7&ae;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=J;break}if(s.length=65535&oe,oe=0,ae=0,s.mode=V,t===p)break e;case V:s.mode=R;case R:if(ue=s.length){if(ue>ie&&(ue=ie),ue>re&&(ue=re),0===ue)break e;n.arraySet(ee,$,te,ue,ne),ie-=ue,te+=ue,re-=ue,ne+=ue,s.length-=ue;break}s.mode=M;break;case B:for(;ae<14;){if(0===ie)break e;ie--,oe+=$[te++]<>>=5,ae-=5,s.ndist=1+(31&oe),oe>>>=5,ae-=5,s.ncode=4+(15&oe),oe>>>=4,ae-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=J;break}s.have=0,s.mode=D;case D:for(;s.have>>=3,ae-=3}for(;s.have<19;)s.lens[Ee[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Se={bits:s.lenbits},_e=a(l,s.lens,0,19,s.lencode,0,s.work,Se),s.lenbits=Se.bits,_e){e.msg="invalid code lengths set",s.mode=J;break}s.have=0,s.mode=L;case L:for(;s.have>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=me,ae-=me,s.lens[s.have++]=ve;else{if(16===ve){for(je=me+2;ae>>=me,ae-=me,0===s.have){e.msg="invalid bit length repeat",s.mode=J;break}we=s.lens[s.have-1],ue=3+(3&oe),oe>>>=2,ae-=2}else if(17===ve){for(je=me+3;ae>>=me)),oe>>>=3,ae-=3}else{for(je=me+7;ae>>=me)),oe>>>=7,ae-=7}if(s.have+ue>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=J;break}for(;ue--;)s.lens[s.have++]=we}}if(s.mode===J)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=J;break}if(s.lenbits=9,Se={bits:s.lenbits},_e=a(c,s.lens,0,s.nlen,s.lencode,0,s.work,Se),s.lenbits=Se.bits,_e){e.msg="invalid literal/lengths set",s.mode=J;break}if(s.distbits=6,s.distcode=s.distdyn,Se={bits:s.distbits},_e=a(u,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Se),s.distbits=Se.bits,_e){e.msg="invalid distances set",s.mode=J;break}if(s.mode=z,t===p)break e;case z:s.mode=G;case G:if(ie>=6&&re>=258){e.next_out=ne,e.avail_out=re,e.next_in=te,e.avail_in=ie,s.hold=oe,s.bits=ae,o(e,ce),ne=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,oe=s.hold,ae=s.bits,s.mode===M&&(s.back=-1);break}for(s.back=0;ge=(Ce=s.lencode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=ye,ae-=ye,s.back+=ye}if(oe>>>=me,ae-=me,s.back+=me,s.length=ve,0===ge){s.mode=Z;break}if(32&ge){s.back=-1,s.mode=M;break}if(64&ge){e.msg="invalid literal/length code",s.mode=J;break}s.extra=15&ge,s.mode=H;case H:if(s.extra){for(je=s.extra;ae>>=s.extra,ae-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=U;case U:for(;ge=(Ce=s.distcode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=ye,ae-=ye,s.back+=ye}if(oe>>>=me,ae-=me,s.back+=me,64&ge){e.msg="invalid distance code",s.mode=J;break}s.offset=ve,s.extra=15&ge,s.mode=W;case W:if(s.extra){for(je=s.extra;ae>>=s.extra,ae-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=J;break}s.mode=q;case q:if(0===re)break e;if(ue=ce-re,s.offset>ue){if((ue=s.offset-ue)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=J;break}ue>s.wnext?(ue-=s.wnext,de=s.wsize-ue):de=s.wnext-ue,ue>s.length&&(ue=s.length),fe=s.window}else fe=ee,de=ne-s.offset,ue=s.length;ue>re&&(ue=re),re-=ue,s.length-=ue;do{ee[ne++]=fe[de++]}while(--ue);0===s.length&&(s.mode=G);break;case Z:if(0===re)break e;ee[ne++]=s.length,re--,s.mode=G;break;case K:if(s.wrap){for(;ae<32;){if(0===ie)break e;ie--,oe|=$[te++]<=1&&0===z[A];A--);if(M>A&&(M=A),0===A)return m[g++]=20971520,m[g++]=20971520,y.bits=1,0;for(O=1;O0&&(e===a||1!==A))return-1;for(G[1]=0,I=1;Ir||e===c&&R>o)return 1;for(;;){C=I-F,v[T]j?(k=H[U+v[T]],E=D[L+v[T]]):(k=96,E=0),x=1<>F)+(b-=x)]=C<<24|k<<16|E|0}while(0!==b);for(x=1<>=1;if(0!==x?(B&=x-1,B+=x):B=0,T++,0==--z[I]){if(I===A)break;I=t[s+v[T]]}if(I>M&&(B&_)!==w){for(0===F&&(F=M),S+=O,V=1<<(N=I-F);N+Fr||e===c&&R>o)return 1;m[w=B&_]=M<<24|N<<16|S-g|0}}return 0!==B&&(m[S+B]=I-F<<24|64<<16|0),y.bits=M,0}},{"../utils/common":1}],10:[function(e,t,s){"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,s){"use strict";function n(){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=n},{}],"/lib/inflate.js":[function(e,t,s){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=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=i.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 s=n.inflateInit2(this.strm,t.windowBits);if(s!==o.Z_OK)throw new Error(a[s]);if(this.header=new c,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=n.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[s])}function h(e,t){var s=new d(t);if(s.push(e,!0),s.err)throw s.msg||a[s.err];return s.result}function p(e,t){return(t=t||{}).raw=!0,h(e,t)}d.prototype.push=function(e,t){var s,a,l,c,d,h=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(s=n.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(s=n.inflateSetDictionary(this.strm,f)),s===o.Z_BUF_ERROR&&!0===m&&(s=o.Z_OK,m=!1),s!==o.Z_STREAM_END&&s!==o.Z_OK)return this.onEnd(s),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&s!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(h.output,h.next_out),c=h.next_out-l,d=r.buf2string(h.output,l),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,l,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&s!==o.Z_STREAM_END);return s===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(s=n.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},s.Inflate=d,s.inflate=h,s.inflateRaw=p,s.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},8572:e=>{e.exports=function(){function e(t,s,n){function i(o,a){if(!s[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=s[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,s,n)}return s[o].exports}for(var r=void 0,o=0;o0},a.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,n);if(t<0)throw new Error("Unexpected end of input");if(t=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&r]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},a.prototype.readBits=function(e){32-this.bit_pos_>>this.bit_pos_&o[e];return this.bit_pos_+=e,t},t.exports=a},{}],2:[function(e,t,s){s.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]),s.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,s){var n=e("./streams").BrotliInput,i=e("./streams").BrotliOutput,r=e("./bit_reader"),o=e("./dictionary"),a=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),h=8,p=16,f=256,m=704,g=26,v=6,y=2,x=8,b=255,w=1080,_=18,S=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),j=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]),E=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===r)throw new Error("Invalid size byte");i.meta_block_length|=r<<8*n}}else for(n=0;n4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*n}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function A(e,t,s){var n;return s.fillBitWindow(),(n=e[t+=s.val_>>>s.bit_pos_&b].bits-x)>0&&(s.bit_pos_+=x,t+=e[t].value,t+=s.val_>>>s.bit_pos_&(1<0;){var m,g=0;if(n.readMoreInput(),n.fillBitWindow(),g+=n.val_>>>n.bit_pos_&31,n.bit_pos_+=d[g].bits,(m=255&d[g].value)>m);else{var v,y,x=m-14,b=0;if(m===p&&(b=r),c!==b&&(o=0,c=b),v=o,o>0&&(o-=2,o<<=x),i+(y=(o+=n.readBits(x)+3)-v)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var w=0;w0;++p){var y,b=S[p],w=0;n.fillBitWindow(),w+=n.val_>>>n.bit_pos_&15,n.bit_pos_+=v[w].bits,y=v[w].value,f[b]=y,0!==y&&(m-=32>>y,++g)}if(1!==g&&0!==m)throw new Error("[ReadHuffmanCode] invalid num_codes or space");M(f,e,o,n)}if(0===(r=l(t,s,x,o,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return r}function F(e,t,s){var n,i;return n=A(e,t,s),i=u.kBlockLengthPrefixCode[n].nbits,u.kBlockLengthPrefixCode[n].offset+s.readBits(i)}function V(e,t,s){var n;return e>>5]),this.htrees=new Uint32Array(t)}function L(e,t){var s,n,i={num_htrees:null,context_map:null},r=0;t.readMoreInput();var o=i.num_htrees=I(t)+1,l=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(r=t.readBits(4)+1),s=[],n=0;n=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[n]=0,++n}else l[n]=c-r,++n}return t.readBits(1)&&B(l,e),i}function z(e,t,s,n,i,r,o){var a,l=2*s,c=s,u=A(t,s*w,o);(a=0===u?i[l+(1&r[c])]:1===u?i[l+(r[c]-1&1)]+1:u-2)>=e&&(a-=e),n[s]=a,i[l+(1&r[c])]=a,++r[c]}function G(e,t,s,n,i,o){var a,l=i+1,c=s&i,u=o.pos_&r.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),n[c++]=o.readBits(8),c===l&&(e.write(n,l),c=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)n[c]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++c,--t;if(u+(a=o.bit_end_pos_-o.bit_pos_>>3)>r.IBUF_MASK){for(var d=r.IBUF_MASK+1-u,h=0;h=l)for(e.write(n,l),c-=l,h=0;h=l;){if(a=l-c,o.input_.read(n,c,a)t.buffer.length){var ye=new Uint8Array(S+se);ye.set(t.buffer),t.buffer=ye}if(C=ve.input_end,Z=ve.is_uncompressed,ve.is_metadata)for(H(_);se>0;--se)_.readMoreInput(),_.readBits(8);else if(0!==se)if(Z)_.bit_pos_=_.bit_pos_+7&-8,G(t,se,S,h,l,_),S+=se;else{for(s=0;s<3;++s)re[s]=I(_)+1,re[s]>=2&&(N(re[s]+2,x,s*w,_),N(g,b,s*w,_),ne[s]=F(b,s*w,_),ae[s]=1);for(_.readMoreInput(),X=(1<<(K=_.readBits(2)))-1,J=(Y=j+(_.readBits(4)<0;){var we,_e,Se,je,Ce,ke,Ee,Pe,Ie,Te,Oe,Ae;for(_.readMoreInput(),0===ne[1]&&(z(re[1],x,1,ie,oe,ae,_),ne[1]=F(b,w,_),te=U[1].htrees[ie[1]]),--ne[1],(_e=(we=A(U[1].codes,te,_))>>6)>=2?(_e-=2,Ee=-1):Ee=0,Se=u.kInsertRangeLut[_e]+(we>>3&7),je=u.kCopyRangeLut[_e]+(7&we),Ce=u.kInsertLengthPrefixCode[Se].offset+_.readBits(u.kInsertLengthPrefixCode[Se].nbits),ke=u.kCopyLengthPrefixCode[je].offset+_.readBits(u.kCopyLengthPrefixCode[je].nbits),R=h[S-1&l],B=h[S-2&l],Ie=0;Ie4?3:ke-2))],(Ee=A(U[2].codes,U[2].htrees[fe],_))>=Y&&(Ae=(Ee-=Y)&X,Ee=Y+((Me=(2+(1&(Ee>>=K))<<(Oe=1+(Ee>>1)))-4)+_.readBits(Oe)<(E=S=o.minDictionaryWordLength&&ke<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+se);var Me=o.offsetsByLength[ke],Ne=Pe-E-1,Fe=o.sizeBitsByLength[ke],Ve=Ne>>Fe;if(Me+=(Ne&(1<=p){t.write(h,i);for(var Be=0;Be0&&(T[3&M]=Pe,++M),ke>se)throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+se);for(Ie=0;Ie>=1;return(e&s-1)+s}function o(e,t,s,i,r){do{e[t+(i-=s)]=new n(r.bits,r.value)}while(i>0)}function a(e,t,s){for(var n=1<0;--w[u])o(e,t+h,p,v,new n(255&u,65535&x[d++])),h=r(h,u);for(m=y-1,f=-1,u=s+1,p=2;u<=i;++u,p<<=1)for(;w[u]>0;--w[u])(h&m)!==f&&(t+=v,y+=v=1<<(g=a(w,u,s)),e[b+(f=h&m)]=new n(g+s&255,t-b-f&65535)),o(e,t+(h>>s),p,v,new n(u-s&255,65535&x[d++])),h=r(h,u);return y}},{}],8:[function(e,t,s){"use strict";s.byteLength=u,s.toByteArray=h,s.fromByteArray=m;for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function u(e){var t=c(e),s=t[0],n=t[1];return 3*(s+n)/4-n}function d(e,t,s){return 3*(t+s)/4-s}function h(e){for(var t,s=c(e),n=s[0],o=s[1],a=new r(d(e,n,o)),l=0,u=o>0?n-4:n,h=0;h>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function f(e,t,s){for(var n,i=[],r=t;rl?l:a+o));return 1===i?(t=e[s-1],r.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[s-2]<<8)+e[s-1],r.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],9:[function(e,t,s){function n(e,t){this.offset=e,this.nbits=t}s.kBlockLengthPrefixCode=[new n(1,2),new n(5,2),new n(9,2),new n(13,2),new n(17,3),new n(25,3),new n(33,3),new n(41,3),new n(49,4),new n(65,4),new n(81,4),new n(97,4),new n(113,5),new n(145,5),new n(177,5),new n(209,5),new n(241,6),new n(305,6),new n(369,7),new n(497,8),new n(753,9),new n(1265,10),new n(2289,11),new n(4337,12),new n(8433,13),new n(16625,24)],s.kInsertLengthPrefixCode=[new n(0,0),new n(1,0),new n(2,0),new n(3,0),new n(4,0),new n(5,0),new n(6,1),new n(8,1),new n(10,2),new n(14,2),new n(18,3),new n(26,3),new n(34,4),new n(50,4),new n(66,5),new n(98,5),new n(130,6),new n(194,7),new n(322,8),new n(578,9),new n(1090,10),new n(2114,12),new n(6210,14),new n(22594,24)],s.kCopyLengthPrefixCode=[new n(2,0),new n(3,0),new n(4,0),new n(5,0),new n(6,0),new n(7,0),new n(8,0),new n(9,0),new n(10,1),new n(12,1),new n(14,2),new n(18,2),new n(22,3),new n(30,3),new n(38,4),new n(54,4),new n(70,5),new n(102,5),new n(134,6),new n(198,7),new n(326,8),new n(582,9),new n(1094,10),new n(2118,24)],s.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],s.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(e,t,s){function n(e){this.buffer=e,this.pos=0}function i(e){this.buffer=e,this.pos=0}n.prototype.read=function(e,t,s){this.pos+s>this.buffer.length&&(s=this.buffer.length-this.pos);for(var n=0;nthis.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},s.BrotliOutput=i},{}],11:[function(e,t,s){var n=e("./dictionary"),i=0,r=1,o=2,a=3,l=4,c=5,u=6,d=7,h=8,p=9,f=10,m=11,g=12,v=13,y=14,x=15,b=16,w=17,_=18,S=20;function j(e,t,s){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(s.length);for(var n=0;n'),new j("",i,"\n"),new j("",a,""),new j("",i,"]"),new j("",i," for "),new j("",y,""),new j("",o,""),new j("",i," a "),new j("",i," that "),new j(" ",f,""),new j("",i,". "),new j(".",i,""),new j(" ",i,", "),new j("",x,""),new j("",i," with "),new j("",i,"'"),new j("",i," from "),new j("",i," by "),new j("",b,""),new j("",w,""),new j(" the ",i,""),new j("",l,""),new j("",i,". The "),new j("",m,""),new j("",i," on "),new j("",i," as "),new j("",i," is "),new j("",d,""),new j("",r,"ing "),new j("",i,"\n\t"),new j("",i,":"),new j(" ",i,". "),new j("",i,"ed "),new j("",S,""),new j("",_,""),new j("",u,""),new j("",i,"("),new j("",f,", "),new j("",h,""),new j("",i," at "),new j("",i,"ly "),new j(" the ",i," of "),new j("",c,""),new j("",p,""),new j(" ",f,", "),new j("",f,'"'),new j(".",i,"("),new j("",m," "),new j("",f,'">'),new j("",i,'="'),new j(" ",i,"."),new j(".com/",i,""),new j(" the ",i," of the "),new j("",f,"'"),new j("",i,". This "),new j("",i,","),new j(".",i," "),new j("",f,"("),new j("",f,"."),new j("",i," not "),new j(" ",i,'="'),new j("",i,"er "),new j(" ",m," "),new j("",i,"al "),new j(" ",m,""),new j("",i,"='"),new j("",m,'"'),new j("",f,". "),new j(" ",i,"("),new j("",i,"ful "),new j(" ",f,". "),new j("",i,"ive "),new j("",i,"less "),new j("",m,"'"),new j("",i,"est "),new j(" ",f,"."),new j("",m,'">'),new j(" ",i,"='"),new j("",f,","),new j("",i,"ize "),new j("",m,"."),new j(" ",i,""),new j(" ",i,","),new j("",f,'="'),new j("",m,'="'),new j("",i,"ous "),new j("",m,", "),new j("",f,"='"),new j(" ",f,","),new j(" ",m,'="'),new j(" ",m,", "),new j("",m,","),new j("",m,"("),new j("",m,". "),new j(" ",m,"."),new j("",m,"='"),new j(" ",m,". "),new j(" ",f,'="'),new j(" ",m,"='"),new j(" ",f,"='")];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)}s.kTransforms=C,s.kNumTransforms=C.length,s.transformDictionaryWord=function(e,t,s,i,r){var o,a=C[r].prefix,l=C[r].suffix,c=C[r].transform,u=ci&&(u=i);for(var v=0;v0;){var y=k(e,o);o+=y,i-=y}for(var x=0;x{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",й:"и",Й:"И",ё:"е",Ё:"Е"},s=Object.keys(t).join("|"),n=new RegExp(s,"g"),i=new RegExp(s,"");function r(e){return t[e]}var o=function(e){return e.replace(n,r)};e.exports=o,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=o},8477:(e,t,s)=>{"use strict"; +(()=>{var e,t,n={83:(e,t,n)=>{"use strict"; /** * @license React - * use-sync-external-store-shim.production.min.js + * use-sync-external-store-shim.production.js * - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var n=s(1609);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,o=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!i(e,s)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),n=r({inst:{value:s,getSnapshot:t}}),i=n[0].inst,u=n[1];return a((function(){i.value=s,i.getSnapshot=t,c(i)&&u({inst:i})}),[e,s,t]),o((function(){return c(i)&&u({inst:i}),e((function(){c(i)&&u({inst:i})}))}),[e]),l(s),s};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u},422:(e,t,s)=>{"use strict";e.exports=s(8477)},1609:e=>{"use strict";e.exports=window.React}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(s,n){if(1&n&&(s=this(s)),8&n)return s;if("object"==typeof s&&s){if(4&n&&s.__esModule)return s;if(16&n&&"function"==typeof s.then)return s}var r=Object.create(null);i.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&n&&s;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>s[e]));return o.default=()=>s,i.d(r,o),r},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{PluginMoreMenuItem:()=>uk,PluginSidebar:()=>dk,PluginSidebarMoreMenuItem:()=>hk,PluginTemplateSettingPanel:()=>Bn,initializeEditor:()=>pk,reinitializeEditor:()=>fk,store:()=>Kt});var e={};i.r(e),i.d(e,{__experimentalSetPreviewDeviceType:()=>$e,addTemplate:()=>tt,closeGeneralSidebar:()=>yt,openGeneralSidebar:()=>vt,openNavigationPanelToMenu:()=>ut,removeTemplate:()=>st,revertTemplate:()=>gt,setEditedEntity:()=>rt,setEditedPostContext:()=>at,setHasPageContentFocus:()=>bt,setHomeTemplateId:()=>ot,setIsInserterOpened:()=>ht,setIsListViewOpened:()=>pt,setIsNavigationPanelOpened:()=>dt,setIsSaveViewOpened:()=>mt,setNavigationMenu:()=>it,setNavigationPanelActiveMenu:()=>ct,setPage:()=>lt,setTemplate:()=>et,setTemplatePart:()=>nt,switchEditorMode:()=>xt,toggleDistractionFree:()=>wt,toggleFeature:()=>Qe,updateSettings:()=>ft});var t={};i.r(t),i.d(t,{setCanvasMode:()=>_t,setEditorCanvasContainerView:()=>St});var s={};i.r(s),i.d(s,{__experimentalGetInsertionPoint:()=>Ft,__experimentalGetPreviewDeviceType:()=>Ct,getCanUserCreateMedia:()=>kt,getCurrentTemplateNavigationPanelSubMenu:()=>Lt,getCurrentTemplateTemplateParts:()=>Bt,getEditedPostContext:()=>At,getEditedPostId:()=>Ot,getEditedPostType:()=>Tt,getEditorMode:()=>Dt,getHomeTemplateId:()=>It,getNavigationPanelActiveMenu:()=>zt,getPage:()=>Mt,getReusableBlocks:()=>Et,getSettings:()=>Pt,hasPageContentFocus:()=>Ut,isFeatureActive:()=>jt,isInserterOpened:()=>Nt,isListViewOpened:()=>Vt,isNavigationOpened:()=>Gt,isPage:()=>Ht,isSaveViewOpened:()=>Rt});var n={};i.r(n),i.d(n,{getCanvasMode:()=>Wt,getEditorCanvasContainerView:()=>qt});const o=window.wp.blocks,a=window.wp.blockLibrary,l=window.wp.data,c=window.wp.deprecated;var u=i.n(c);const d=window.wp.element,h=window.wp.editor,f=window.wp.preferences,m=window.wp.widgets,g=window.wp.hooks,v=window.wp.compose,y=window.wp.blockEditor,x=window.wp.components,b=window.wp.i18n,w=window.wp.notices,_=window.wp.coreData;var S={grad:.9,turn:360,rad:360/(2*Math.PI)},j=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},C=function(e,t,s){return void 0===t&&(t=0),void 0===s&&(s=Math.pow(10,t)),Math.round(s*e)/s+0},k=function(e,t,s){return void 0===t&&(t=0),void 0===s&&(s=1),e>s?s:e>t?e:t},E=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},P=function(e){return{r:k(e.r,0,255),g:k(e.g,0,255),b:k(e.b,0,255),a:k(e.a)}},I=function(e){return{r:C(e.r),g:C(e.g),b:C(e.b),a:C(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},A=function(e){var t=e.r,s=e.g,n=e.b,i=e.a,r=Math.max(t,s,n),o=r-Math.min(t,s,n),a=o?r===t?(s-n)/o:r===s?2+(n-t)/o:4+(t-s)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:i}},M=function(e){var t=e.h,s=e.s,n=e.v,i=e.a;t=t/360*6,s/=100,n/=100;var r=Math.floor(t),o=n*(1-s),a=n*(1-(t-r)*s),l=n*(1-(1-t+r)*s),c=r%6;return{r:255*[n,a,o,o,l,n][c],g:255*[l,n,n,a,o,o][c],b:255*[o,o,l,n,n,a][c],a:i}},N=function(e){return{h:E(e.h),s:k(e.s,0,100),l:k(e.l,0,100),a:k(e.a)}},F=function(e){return{h:C(e.h),s:C(e.s),l:C(e.l),a:C(e.a,3)}},V=function(e){return M((s=(t=e).s,{h:t.h,s:(s*=((n=t.l)<50?n:100-n)/100)>0?2*s/(n+s)*100:0,v:n+s,a:t.a}));var t,s,n},R=function(e){return{h:(t=A(e)).h,s:(i=(200-(s=t.s))*(n=t.v)/100)>0&&i<200?s*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,s,n,i},B=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G={string:[[function(e){var t=T.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?C(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?C(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||z.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:P({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=B.exec(e)||D.exec(e);if(!t)return null;var s,n,i=N({h:(s=t[1],n=t[2],void 0===n&&(n="deg"),Number(s)*(S[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return V(i)},"hsl"]],object:[[function(e){var t=e.r,s=e.g,n=e.b,i=e.a,r=void 0===i?1:i;return j(t)&&j(s)&&j(n)?P({r:Number(t),g:Number(s),b:Number(n),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,s=e.s,n=e.l,i=e.a,r=void 0===i?1:i;if(!j(t)||!j(s)||!j(n))return null;var o=N({h:Number(t),s:Number(s),l:Number(n),a:Number(r)});return V(o)},"hsl"],[function(e){var t=e.h,s=e.s,n=e.v,i=e.a,r=void 0===i?1:i;if(!j(t)||!j(s)||!j(n))return null;var o=function(e){return{h:E(e.h),s:k(e.s,0,100),v:k(e.v,0,100),a:k(e.a)}}({h:Number(t),s:Number(s),v:Number(n),a:Number(r)});return M(o)},"hsv"]]},H=function(e,t){for(var s=0;s=.5},e.prototype.toHex=function(){return t=(e=I(this.rgba)).r,s=e.g,n=e.b,r=(i=e.a)<1?O(C(255*i)):"","#"+O(t)+O(s)+O(n)+r;var e,t,s,n,i,r},e.prototype.toRgb=function(){return I(this.rgba)},e.prototype.toRgbString=function(){return t=(e=I(this.rgba)).r,s=e.g,n=e.b,(i=e.a)<1?"rgba("+t+", "+s+", "+n+", "+i+")":"rgb("+t+", "+s+", "+n+")";var e,t,s,n,i},e.prototype.toHsl=function(){return F(R(this.rgba))},e.prototype.toHslString=function(){return t=(e=F(R(this.rgba))).h,s=e.s,n=e.l,(i=e.a)<1?"hsla("+t+", "+s+"%, "+n+"%, "+i+")":"hsl("+t+", "+s+"%, "+n+"%)";var e,t,s,n,i},e.prototype.toHsv=function(){return e=A(this.rgba),{h:C(e.h),s:C(e.s),v:C(e.v),a:C(e.a,3)};var e},e.prototype.invert=function(){return Y({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),Y(W(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,-e))},e.prototype.grayscale=function(){return Y(W(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Y(Z(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?Y({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):C(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=R(this.rgba);return"number"==typeof e?Y({h:e,s:t.s,l:t.l,a:t.a}):C(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Y(e).toHex()},e}(),Y=function(e){return e instanceof K?e:new K(e)},X=[],J=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Q=function(e){return.2126*J(e.r)+.7152*J(e.g)+.0722*J(e.b)};function $(e){return e?JSON.parse(JSON.stringify(e)):{}}const ee=window.wp.privateApis,{lock:te,unlock:se}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{GlobalStylesContext:ne}=se(y.privateApis),{mergeBaseAndUserConfigs:ie}=se(h.privateApis);function re(e,t){if(!t||"string"!=typeof t)return e;if("object"!=typeof e||!e||!Object.keys(e).length)return e;for(const s in e)s===t?delete e[s]:"object"==typeof e[s]&&re(e[s],t);return e}function oe({property:e}){const{variationsFromTheme:t}=(0,l.useSelect)((e=>({variationsFromTheme:e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()||[]})),[]),{user:s}=(0,d.useContext)(ne);return(0,d.useMemo)((()=>{const n=re($(s),e);n.title=(0,b.__)("Default");const i=t.filter((t=>le(t,e))).map((e=>ie(n,e)));return[n,...i]}),[e,s,t])}const ae=(e,t)=>{if(!e)return{};const s={};return Object.keys(e).forEach((n=>{if(n===t)s[n]=e[n];else if("object"==typeof e[n]){const i=ae(e[n],t);Object.keys(i).length&&(s[n]=i)}})),s};function le(e,t){const s=ae($(e),t);return JSON.stringify(s?.styles)===JSON.stringify(e?.styles)&&JSON.stringify(s?.settings)===JSON.stringify(e?.settings)}const{useGlobalSetting:ce,useGlobalStyle:ue}=se(y.privateApis);function de(){const[e="black"]=ue("color.text"),[t="white"]=ue("color.background"),[s=e]=ue("elements.h1.color.text"),[n=s]=ue("elements.link.color.text"),[i=n]=ue("elements.button.color.background"),[r]=ce("color.palette.core"),[o]=ce("color.palette.theme"),[a]=ce("color.palette.custom"),l=(null!=o?o:[]).concat(null!=a?a:[]).concat(null!=r?r:[]),c=l.filter((({color:t})=>t===e)),u=l.filter((({color:e})=>e===i)),d=c.concat(u).concat(l).filter((({color:e})=>e!==t)).slice(0,2);return{paletteColors:l,highlightedColors:d}}function he(){const e=oe({property:"color"});return e?.length?e.filter((e=>{const{settings:t,styles:s,title:n}=e;return n===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(s).length>0})):[]}function pe(){const e=oe({property:"typography"});return e?.length?e.filter((e=>{const{settings:t,styles:s,title:n}=e;return n===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(s).length>0})):[]}function fe(e,t,s){return e&&"object"==typeof e?(t.reduce(((e,n,i)=>(void 0===e[n]&&(Number.isInteger(t[i+1])?e[n]=[]:e[n]={}),i===t.length-1&&(e[n]=s),e[n])),e),e):e}!function(e){e.forEach((function(e){X.indexOf(e)<0&&(e(K,G),X.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Q(this.rgba),void 0===(t=2)&&(t=0),void 0===s&&(s=Math.pow(10,t)),Math.round(s*e)/s+0;var e,t,s},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var s,n,i,r,o,a,l,c=t instanceof e?t:new e(t);return r=this.rgba,o=c.toRgb(),s=(a=Q(r))>(l=Q(o))?(a+.05)/(l+.05):(l+.05)/(a+.05),void 0===(n=2)&&(n=0),void 0===i&&(i=Math.pow(10,n)),Math.floor(i*s)/i+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(o=void 0===(r=(s=t).size)?"normal":r,"AAA"===(i=void 0===(n=s.level)?"AA":n)&&"normal"===o?7:"AA"===i&&"large"===o?3:4.5);var s,n,i,r,o}}]);const me=window.ReactJSXRuntime,{cleanEmptyObject:ge,GlobalStylesContext:ve}=se(y.privateApis),ye={...o.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},xe={"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"},be={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},we=["border","color","spacing","typography"],_e=(e,t)=>{let s=e;return t.forEach((e=>{s=s?.[e]})),s},Se=["borderColor","borderWidth","borderStyle"],je=["top","right","bottom","left"];function Ce(e,t,s){if(!t?.[e]||s?.[e]?.style)return[];const{color:n,style:i,width:r}=t[e];return!(n||r)||i?[]:[{path:["border",e,"style"],value:"solid"}]}function ke(e,t,s){const n=function(e,t){const{supportedPanels:s}=(0,l.useSelect)((s=>({supportedPanels:se(s(o.store)).getSupportedStyles(e,t)})),[e,t]);return s}(e),i=s?.styles?.blocks?.[e];return(0,d.useMemo)((()=>{const e=n.flatMap((e=>{if(!ye[e])return[];const{value:s}=ye[e],n=s.join("."),i=t[be[n]],r=i?`var:preset|${xe[n]}|${i}`:_e(t.style,s);if("linkColor"===e){const e=r?[{path:s,value:r}]:[],n=["elements","link",":hover","color","text"],i=_e(t.style,n);return i&&e.push({path:n,value:i}),e}if(Se.includes(e)&&r){const e=[{path:s,value:r}];return je.forEach((t=>{const n=[...s];n.splice(-1,0,t),e.push({path:n,value:r})})),e}return r?[{path:s,value:r}]:[]}));return function(e,t,s){if(!e&&!t)return[];const n=[...Ce("top",e,s),...Ce("right",e,s),...Ce("bottom",e,s),...Ce("left",e,s)],{color:i,style:r,width:o}=e||{};return(t||i||o)&&!r&&je.forEach((e=>{s?.[e]?.style||n.push({path:["border",e,"style"],value:"solid"})})),n}(t.style?.border,t.borderColor,i?.border).forEach((t=>e.push(t))),e}),[n,t,i])}function Ee({name:e,attributes:t,setAttributes:s}){const{user:n,setUserConfig:i}=(0,d.useContext)(ve),r=ke(e,t,n),{__unstableMarkNextChangeAsNotPersistent:a}=(0,l.useDispatch)(y.store),{createSuccessNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useCallback)((()=>{if(0!==r.length&&r.length>0){const{style:l}=t,u=$(l),d=$(n);for(const{path:t,value:s}of r)fe(u,t,void 0),fe(d,["styles","blocks",e,...t],s);const h={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:ge(u)};a(),s(h),i(d,{undoIgnore:!0}),c((0,b.sprintf)((0,b.__)("%s styles applied."),(0,o.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick(){a(),s(t),i(n,{undoIgnore:!0})}}]})}}),[a,t,r,c,e,s,i,n]);return(0,me.jsxs)(x.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,o.getBlockType)(e).title),children:[(0,me.jsx)(x.BaseControl.VisualLabel,{children:(0,b.__)("Styles")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"secondary",__experimentalIsFocusable:!0,disabled:0===r.length,onClick:u,children:(0,b.__)("Apply globally")})]})}function Pe(e){const t=(0,y.useBlockEditingMode)(),s=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),n=we.some((t=>(0,o.hasBlockSupport)(e.name,t)));return"default"===t&&n&&s?(0,me.jsx)(y.InspectorAdvancedControls,{children:(0,me.jsx)(Ee,{...e})}):null}const Ie=(0,v.createHigherOrderComponent)((e=>t=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(e,{...t}),t.isSelected&&(0,me.jsx)(Pe,{...t})]})));(0,g.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",Ie);const Te=(0,l.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}}),Oe=window.wp.patterns,Ae="wp_navigation",Me="wp_template",Ne="wp_template_part",Fe={custom:"custom",theme:"theme",plugin:"plugin"},Ve="uncategorized",Re="all-parts",{PATTERN_TYPES:Be,PATTERN_DEFAULT_CATEGORY:De,PATTERN_USER_CATEGORY:Le,EXCLUDED_PATTERN_SOURCES:ze,PATTERN_SYNC_TYPES:Ge}=se(Oe.privateApis),He=[Ne,Ae,Be.user],Ue={[Me]:(0,b.__)("Template"),[Ne]:(0,b.__)("Template part"),[Be.user]:(0,b.__)("Pattern"),[Ae]:(0,b.__)("Navigation")},We="grid",qe="table",Ze="list",Ke="is",Ye="isAny",Xe="isNone",{interfaceStore:Je}=se(h.privateApis);function Qe(e){return function({registry:t}){u()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(f.store).toggle("core/edit-site",e)}}const $e=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(h.store).setDeviceType(e)};function et(){return u()("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 tt=e=>async({dispatch:t,registry:s})=>{u()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const n=await s.dispatch(_.store).saveEntityRecord("postType",Me,e);e.content&&s.dispatch(_.store).editEntityRecord("postType",Me,n.id,{blocks:(0,o.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Me,id:n.id})},st=e=>({registry:t})=>se(t.dispatch(h.store)).removeTemplates([e]);function nt(e){return{type:"SET_EDITED_POST",postType:Ne,id:e}}function it(e){return{type:"SET_EDITED_POST",postType:Ae,id:e}}function rt(e,t,s){return{type:"SET_EDITED_POST",postType:e,id:t,context:s}}function ot(){return u()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function at(e){return{type:"SET_EDITED_POST_CONTEXT",context:e}}function lt(){return u()("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 ct(){return u()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function ut(){return u()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function dt(){return u()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const ht=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(h.store).setIsInserterOpened(e)},pt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(h.store).setIsListViewOpened(e)};function ft(e){return{type:"UPDATE_SETTINGS",settings:e}}function mt(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const gt=(e,t)=>({registry:s})=>se(s.dispatch(h.store)).revertTemplate(e,t),vt=e=>({registry:t})=>{t.dispatch(Je).enableComplementaryArea("core",e)},yt=()=>({registry:e})=>{e.dispatch(Je).disableComplementaryArea("core")},xt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(h.store).switchEditorMode(e)},bt=e=>({dispatch:t,registry:s})=>{u()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&s.dispatch(y.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},wt=()=>({registry:e})=>{u()("dispatch( 'core/edit-site' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(h.store).toggleDistractionFree()},_t=e=>({registry:t,dispatch:s})=>{const n=window.matchMedia("(min-width: 782px)").matches,i=()=>{t.batch((()=>{t.dispatch(y.store).clearSelectedBlock(),t.dispatch(h.store).setDeviceType("Desktop"),t.dispatch(y.store).__unstableSetEditorMode("edit");const i=t.select(h.store).isPublishSidebarOpened();s({type:"SET_CANVAS_MODE",mode:e});const r="edit"===e;i&&!r&&t.dispatch(h.store).closePublishSidebar(),n&&r&&t.select(f.store).get("core","showListViewByDefault")&&!t.select(f.store).get("core","distractionFree")?t.dispatch(h.store).setIsListViewOpened(!0):t.dispatch(h.store).setIsListViewOpened(!1),t.dispatch(h.store).setIsInserterOpened(!1)}))};if(n&&document.startViewTransition){document.documentElement.classList.add(`canvas-mode-${e}-transition`);document.startViewTransition((()=>i())).finished.finally((()=>{document.documentElement.classList.remove(`canvas-mode-${e}-transition`)}))}else i()},St=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})},jt=(0,l.createRegistrySelector)((e=>(t,s)=>(u()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(f.store).get("core/edit-site",s)))),Ct=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(h.store).getDeviceType()))),kt=(0,l.createRegistrySelector)((e=>()=>e(_.store).canUser("create","media"))),Et=(0,l.createRegistrySelector)((e=>()=>{u()("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )",{since:"6.5",version:"6.8"});return"web"===d.Platform.OS?e(_.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function Pt(e){return e.settings}function It(){u()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function Tt(e){return e.editedPost.postType}function Ot(e){return e.editedPost.id}function At(e){return e.editedPost.context}function Mt(e){return{context:e.editedPost.context}}const Nt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(h.store).isInserterOpened()))),Ft=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),se(e(h.store)).getInsertionPoint()))),Vt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(h.store).isListViewOpened())));function Rt(e){return e.saveViewPanel}const Bt=(0,l.createRegistrySelector)((e=>()=>se(e(h.store)).getCurrentTemplateTemplateParts())),Dt=(0,l.createRegistrySelector)((e=>()=>e(f.store).get("core","editorMode")));function Lt(){u()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function zt(){u()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Gt(){u()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Ht(e){return!!e.editedPost.context?.postId}function Ut(){return u()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Wt(e){return e.canvasMode}function qt(e){return e.editorCanvasContainerView}const Zt={reducer:Te,actions:e,selectors:s},Kt=(0,l.createReduxStore)("core/edit-site",Zt);(0,l.register)(Kt),se(Kt).registerPrivateSelectors(n),se(Kt).registerPrivateActions(t);const Yt=window.wp.plugins,Xt=window.wp.router;function Jt(e){var t,s,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t{const{getSite:t,getUnstableBase:s,getEntityRecords:n}=e(_.store),i=t(),r=s(),o=n("postType",Me,{per_page:-1}),a="page"===i?.show_on_front&&["number","string"].includes(typeof i.page_on_front)&&+i.page_on_front?i.page_on_front.toString():null,l="page"===i?.show_on_front&&["number","string"].includes(typeof i.page_for_posts)?i.page_for_posts.toString():null;let c;if(o){const e=o.find((e=>"front-page"===e.slug));c=!!e&&e.id}return{hasLoadedAllDependencies:!!r&&!!i,homepageId:a,postsPageId:l,url:r?.home,frontPageTemplateId:c}}),[]),a=(0,l.useSelect)((a=>{if(os.includes(t)&&e)return;const{getEditedEntityRecord:l,getEntityRecords:c,getDefaultTemplateId:u,__experimentalGetTemplateForLink:d}=a(_.store);function h(e,t){if("page"===e&&n===t){if(void 0===o)return;if(o)return o}const s=l("postType",e,t);if(!s)return;if("page"===e&&i===t)return d(s.link)?.id;const r=s.template;if(r){const e=c("postType",Me,{per_page:-1})?.find((({slug:e})=>e===r));if(e)return e.id}let a;return a=s.slug?"page"===e?`${e}-${s.slug}`:`single-${e}-${s.slug}`:"page"===e?"page":`single-${e}`,u({slug:a})}if(s){if(t&&e&&as.includes(t))return h(t,e);if(n)return h("page",n);if(r){const e=d(r);return e?.id}}}),[n,i,s,r,e,t,o]),c=(0,d.useMemo)((()=>os.includes(t)&&e?{}:t&&e&&as.includes(t)?{postType:t,postId:e}:n?{postType:"page",postId:n}:{}),[n,t,e]);return os.includes(t)&&e?{isReady:!0,postType:t,postId:e,context:c}:s?{isReady:void 0!==a,postType:Me,postId:a,context:c}:{isReady:!1}}(e),{setEditedEntity:r}=(0,l.useDispatch)(Kt);(0,d.useEffect)((()=>{i&&r(t,s,n)}),[i,t,s,n,r])}const cs=window.wp.htmlEntities,us=window.wp.primitives,ds=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),hs=window.wp.keycodes,ps=window.wp.url,fs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,me.jsx)(us.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 ms=function({className:e}){const{isRequestingSite:t,siteIconUrl:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),s=t("root","__unstableBase",void 0);return{isRequestingSite:!s,siteIconUrl:s?.site_icon_url}}),[]);if(t&&!s)return(0,me.jsx)("div",{className:"edit-site-site-icon__image"});const n=s?(0,me.jsx)("img",{className:"edit-site-site-icon__image",alt:(0,b.__)("Site Icon"),src:s}):(0,me.jsx)(x.Icon,{className:"edit-site-site-icon__icon",icon:fs,size:48});return(0,me.jsx)("div",{className:Qt(e,"edit-site-site-icon"),children:n})},gs=window.wp.dom,vs=(0,d.createContext)((()=>{}));function ys(){let e={direction:null,focusSelector:null};return{get:()=>e,navigate(t,s=null){e={direction:t,focusSelector:"forward"===t&&s?s:e.focusSelector}}}}function xs({children:e}){const t=(0,d.useContext)(vs),s=(0,d.useRef)(),[n,i]=(0,d.useState)(null);(0,d.useLayoutEffect)((()=>{const{direction:e,focusSelector:n}=t.get();!function(e,t,s){let n;if("back"===t&&s&&(n=e.querySelector(s)),null!==t&&!n){const[t]=gs.focus.tabbable.find(e);n=null!=t?t:e}n?.focus()}(s.current,e,n),i(e)}),[t]);const r=Qt("edit-site-sidebar__screen-wrapper",{"slide-from-left":"back"===n,"slide-from-right":"forward"===n});return(0,me.jsx)("div",{ref:s,className:r,children:e})}function bs({routeKey:e,children:t}){const[s]=(0,d.useState)(ys);return(0,me.jsx)(vs.Provider,{value:s,children:(0,me.jsx)("div",{className:"edit-site-sidebar__content",children:(0,me.jsx)(xs,{children:t},e)})})}const{useHistory:ws}=se(Xt.privateApis),_s=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{dashboardLink:s,homeUrl:n,siteTitle:i}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt)),{getSite:s,getUnstableBase:n}=e(_.store),i=s();return{dashboardLink:t().__experimentalDashboardLink||"index.php",homeUrl:n()?.home,siteTitle:!i?.title&&i?.url?(0,ps.filterURLForDisplay)(i?.url):i?.title}}),[]),{open:r}=(0,l.useDispatch)(es.store);return(0,me.jsx)("div",{className:"edit-site-site-hub",children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,me.jsx)("div",{className:Qt("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,me.jsx)(x.Button,{ref:t,href:s,label:(0,b.__)("Go to the Dashboard"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},children:(0,me.jsx)(ms,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,me.jsxs)(x.__experimentalHStack,{children:[(0,me.jsx)("div",{className:"edit-site-site-hub__title",children:(0,me.jsx)(x.Button,{variant:"link",href:n,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),children:(0,cs.decodeEntities)(i)})}),(0,me.jsx)(x.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,me.jsx)(x.Button,{className:"edit-site-site-hub_toggle-command-center",icon:ds,onClick:()=>r(),label:(0,b.__)("Open command palette"),shortcut:hs.displayShortcut.primary("k")})})]})]})})}))),Ss=_s,js=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const s=ws(),{navigate:n}=(0,d.useContext)(vs),{homeUrl:i,siteTitle:r}=(0,l.useSelect)((e=>{const{getSite:t,getUnstableBase:s}=e(_.store),n=t();return{homeUrl:s()?.home,siteTitle:!n?.title&&n?.url?(0,ps.filterURLForDisplay)(n?.url):n?.title}}),[]),{open:o}=(0,l.useDispatch)(es.store);return(0,me.jsx)("div",{className:"edit-site-site-hub",children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,me.jsx)("div",{className:Qt("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,me.jsx)(x.Button,{ref:t,label:(0,b.__)("Go to Site Editor"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},onClick:()=>{s.push({}),n("back")},children:(0,me.jsx)(ms,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,me.jsxs)(x.__experimentalHStack,{children:[(0,me.jsx)("div",{className:"edit-site-site-hub__title",children:(0,me.jsx)(x.Button,{variant:"link",href:i,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),children:(0,cs.decodeEntities)(r)})}),(0,me.jsx)(x.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,me.jsx)(x.Button,{className:"edit-site-site-hub_toggle-command-center",icon:ds,onClick:()=>o(),label:(0,b.__)("Open command palette"),shortcut:hs.displayShortcut.primary("k")})})]})]})})}))),Cs={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},ks=320,Es=1300,Ps=9/19.5,Is={width:"100%",height:"100%"};function Ts(e,t){const s=1-Math.max(0,Math.min(1,(e-ks)/(Es-ks))),n=((e,t,s)=>e+(t-e)*s)(t,Ps,s);return e/n}const Os=function e({isFullWidth:t,isOversized:s,setIsOversized:n,isReady:i,children:r,defaultSize:o,innerContentStyle:a}){const c=(0,v.useReducedMotion)(),[u,h]=(0,d.useState)(Is),[p,f]=(0,d.useState)(),[m,g]=(0,d.useState)(!1),[y,w]=(0,d.useState)(!1),[_,S]=(0,d.useState)(1),j=(0,l.useSelect)((e=>se(e(Kt)).getCanvasMode()),[]),{setCanvasMode:C}=se((0,l.useDispatch)(Kt)),k={type:"tween",duration:m?0:.5},E=(0,d.useRef)(null),P=(0,v.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),I=o.width/o.height,T={default:{flexGrow:0,height:u.height},fullWidth:{flexGrow:1,height:u.height}},O=m?"active":y?"visible":"hidden";return(0,me.jsx)(x.ResizableBox,{as:x.__unstableMotion.div,ref:E,initial:!1,variants:T,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&h({width:"100%",height:"100%"})},whileHover:"view"===j?{scale:1.005,transition:{duration:c?0:.5,ease:"easeOut"}}:{},transition:k,size:u,enable:{top:!1,right:!1,bottom:!1,left:i,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:_,handleClasses:void 0,handleStyles:{left:Cs,right:Cs},minWidth:ks,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>w(!0),onBlur:()=>w(!1),onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),handleComponent:{left:"view"===j&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Tooltip,{text:(0,b.__)("Drag to resize"),children:(0,me.jsx)(x.__unstableMotion.button,{role:"separator","aria-orientation":"vertical",className:Qt("edit-site-resizable-frame__handle",{"is-resizing":m}),variants:{hidden:{opacity:0,left:0},visible:{opacity:1,left:-14},active:{opacity:1,left:-14,scaleY:1.3}},animate:O,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":P,"aria-valuenow":E.current?.resizable?.offsetWidth||void 0,"aria-valuemin":ks,"aria-valuemax":o.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1),s=Math.min(Math.max(ks,E.current.resizable.offsetWidth+t),o.width);h({width:s,height:Ts(s,I)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"},"handle")}),(0,me.jsx)("div",{hidden:!0,id:P,children:(0,b.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")})]})},onResizeStart:(e,t,s)=>{f(s.offsetWidth),g(!0)},onResize:(e,t,i,r)=>{const a=r.width/_,l=Math.abs(a),c=r.width<0?l:(o.width-p)/2,u=Math.min(l,c),d=0===l?0:u/l;S(1-d+2*d);const f=p+r.width;n(f>o.width),h({height:s?"100%":Ts(f,I)})},onResizeStop:(e,t,i)=>{if(g(!1),!s)return;n(!1);i.ownerDocument.documentElement.offsetWidth-i.offsetWidth>200?h(Is):C("edit")},className:Qt("edit-site-resizable-frame__inner",{"is-resizing":m}),showHandle:!1,children:(0,me.jsx)("div",{className:"edit-site-resizable-frame__inner-content",style:a,children:r})})},{useLocation:As,useHistory:Ms}=se(Xt.privateApis);const Ns=function(){const{registerShortcut:e}=(0,l.useDispatch)($t.store);return(0,d.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}})}),[e]),null};const Fs=function(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,l.useSelect)(_.store),{hasNonPostEntityChanges:s}=(0,l.useSelect)(h.store),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{setIsSaveViewOpened:i}=(0,l.useDispatch)(Kt);return(0,$t.useShortcut)("core/edit-site/save",(r=>{r.preventDefault();const o=e(),a=!!o.length,l=o.some((e=>t(e.kind,e.name,e.key))),c=s(),u="view"===n();(a&&c&&!l||u)&&i(!0)})),null},Vs=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),Rs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Bs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Ds=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Ls=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),zs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Gs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),{useGlobalStylesReset:Hs}=se(y.privateApis),{useHistory:Us,useLocation:Ws}=se(Xt.privateApis);function qs(){const{openGeneralSidebar:e,setCanvasMode:t}=se((0,l.useDispatch)(Kt)),{params:s}=Ws(),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),i=Us(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles",label:(0,b.__)("Open styles"),callback:({close:r})=>{r(),s.postId||i.push({path:"/wp_global_styles",canvas:"edit"}),s.postId&&"edit"!==n()&&t("edit"),e("edit-site/global-styles")},icon:Vs}]:[]),[i,e,t,n,r,s.postId])}}function Zs(){const{openGeneralSidebar:e,setCanvasMode:t}=se((0,l.useDispatch)(Kt)),{params:s}=Ws(),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{set:i}=(0,l.useDispatch)(f.store),r=Us(),o=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>o?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,b.__)("Learn about styles"),callback:({close:o})=>{o(),s.postId||r.push({path:"/wp_global_styles",canvas:"edit"}),s.postId&&"edit"!==n()&&t("edit"),e("edit-site/global-styles"),i("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{i("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:Rs}]:[]),[r,e,t,n,o,i,s.postId])}}function Ks(){const[e,t]=Hs();return{isLoading:!1,commands:(0,d.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,b.__)("Reset styles"),icon:(0,b.isRTL)()?Bs:Ds,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}}function Ys(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:s}=se((0,l.useDispatch)(Kt)),{params:n}=Ws(),i=Us(),{canEditCSS:r}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{getCanvasMode:o}=se((0,l.useSelect)(Kt));return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles-css",label:(0,b.__)("Customize CSS"),icon:Ls,callback:({close:r})=>{r(),n.postId||i.push({path:"/wp_global_styles",canvas:"edit"}),n.postId&&"edit"!==o()&&s("edit"),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[i,e,t,r,o,s,n.postId])}}function Xs(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:s}=se((0,l.useDispatch)(Kt)),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{params:i}=Ws(),r=Us(),o=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return!!i?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>o?[{name:"core/edit-site/open-global-styles-revisions",label:(0,b.__)("Style revisions"),icon:zs,callback:({close:o})=>{o(),i.postId||r.push({path:"/wp_global_styles",canvas:"edit"}),i.postId&&"edit"!==n()&&s("edit"),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[o,r,e,t,n,s,i.postId])}}const Js=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Qs=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,me.jsx)(us.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"})]}),$s=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})});function en(e,t){const{record:s,title:n,description:i,isLoaded:r,icon:o}=(0,l.useSelect)((s=>{const{getEditedPostType:n,getEditedPostId:i}=s(Kt),{getEditedEntityRecord:r,hasFinishedResolution:o}=s(_.store),{__experimentalGetTemplateInfo:a}=s(h.store),l=null!=e?e:n(),c=null!=t?t:i(),u=r("postType",l,c),d=c&&o("getEditedEntityRecord",["postType",l,c]),p=a(u);return{record:u,title:p.title,description:p.description,isLoaded:d,icon:p.icon}}),[e,t]);return{isLoaded:r,icon:o,record:s,getTitle:()=>n?(0,cs.decodeEntities)(n):null,getDescription:()=>i?(0,cs.decodeEntities)(i):null}}function tn(){return void 0!==(0,ps.getQueryArg)(window.location.href,"wp_theme_preview")}function sn(){return tn()?(0,ps.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useHistory:nn}=se(Xt.privateApis);function rn(e,t,s=!1){const n=nn();const i=(0,ps.getQueryArgs)(window.location.href),r=(0,ps.removeQueryArgs)(window.location.href,...Object.keys(i));tn()&&(e={...e,wp_theme_preview:sn()});return{href:(0,ps.addQueryArgs)(r,e),onClick:function(i){i?.preventDefault(),s?n.replace(e,t):n.push(e,t)}}}function on({params:e={},state:t,replace:s=!1,children:n,...i}){const{href:r,onClick:o}=rn(e,t,s);return(0,me.jsx)("a",{href:r,onClick:o,...i,children:n})}const{useHistory:an}=se(Xt.privateApis);function ln(){const{record:e}=en(),{isPage:t,canvasMode:s,templateId:n,currentPostType:i}=(0,l.useSelect)((e=>{const{isPage:t,getCanvasMode:s}=se(e(Kt)),{getCurrentPostType:n,getCurrentTemplateId:i}=e(h.store);return{isPage:t(),canvasMode:s(),templateId:i(),currentPostType:n()}}),[]),{onClick:r}=rn({postType:"wp_template",postId:n}),{setRenderingMode:o}=(0,l.useDispatch)(h.store);if(!t||"edit"!==s)return{isLoading:!1,commands:[]};const a=[];return"wp_template"!==i?a.push({name:"core/switch-to-template-focus",label:(0,b.sprintf)((0,b.__)("Edit template: %s"),(0,cs.decodeEntities)(e.title)),icon:Js,callback:({close:e})=>{r(),e()}}):a.push({name:"core/switch-to-page-focus",label:(0,b.__)("Back to page"),icon:Qs,callback:({close:e})=>{o("template-locked"),e()}}),{isLoading:!1,commands:a}}function cn(){const{isLoaded:e,record:t}=en(),{removeTemplate:s,revertTemplate:n}=(0,l.useDispatch)(Kt),i=an(),r=(0,l.useSelect)((e=>e(Kt).isPage()&&"wp_template"!==e(h.store).getCurrentPostType()),[]);if(!e)return{isLoading:!0,commands:[]};const o=[];if(function(e){return!!e&&e?.source===Fe.custom&&e?.has_theme_file}(t)&&!r){const e=t.type===Me?(0,b.sprintf)((0,b.__)("Reset template: %s"),(0,cs.decodeEntities)(t.title)):(0,b.sprintf)((0,b.__)("Reset template part: %s"),(0,cs.decodeEntities)(t.title));o.push({name:"core/reset-template",label:e,icon:(0,b.isRTL)()?Bs:Ds,callback:({close:e})=>{n(t),e()}})}if(function(e){return!!e&&e.source===Fe.custom&&!e.has_theme_file}(t)&&!r){const e=t.type===Me?(0,b.sprintf)((0,b.__)("Delete template: %s"),(0,cs.decodeEntities)(t.title)):(0,b.sprintf)((0,b.__)("Delete template part: %s"),(0,cs.decodeEntities)(t.title));o.push({name:"core/remove-template",label:e,icon:$s,callback:({close:e})=>{s(t),i.push({postType:t.type}),e()}})}return{isLoading:!e,commands:o}}const un=1e4;function dn(){const{isLoaded:e}=en(),[t,s]=(0,d.useState)(!1),n=(0,l.useSelect)((e=>{const s=e(_.store).hasResolvingSelectors();return!t&&!s}),[t]);return(0,d.useEffect)((()=>{let e;return t||(e=setTimeout((()=>{s(!0)}),un)),()=>{clearTimeout(e)}}),[t]),(0,d.useEffect)((()=>{if(n){const e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[n]),!t||!e}function hn({nonAnimatedSrc:e,animatedSrc:t}){return(0,me.jsxs)("picture",{className:"edit-site-welcome-guide__image",children:[(0,me.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,me.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function pn(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isBlockBasedTheme:s}=(0,l.useSelect)((e=>({isActive:!!e(f.store).get("core/edit-site","welcomeGuide"),isBlockBasedTheme:e(_.store).getCurrentTheme()?.is_block_theme})),[]);return t&&s?(0,me.jsx)(x.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,me.jsx)(hn,{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,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Edit your site")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Design everything on your site — from the header right down to the footer — using blocks.")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,d.createInterpolateElement)((0,b.__)("Click to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,me.jsx)("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}const{interfaceStore:fn}=se(h.privateApis);function mn(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isStylesOpen:s}=(0,l.useSelect)((e=>{const t=e(fn).getActiveComplementaryArea("core");return{isActive:!!e(f.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!s)return null;const n=(0,b.__)("Welcome to Styles");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:n,finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,me.jsx)(hn,{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,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:n}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,me.jsx)(hn,{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,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Set the design")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,me.jsx)(hn,{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,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Personalize blocks")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,me.jsx)(hn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Learn more")}),(0,me.jsxs)("p",{className:"edit-site-welcome-guide__text",children:[(0,b.__)("New to block themes and styling your site?")," ",(0,me.jsx)(x.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,b.__)("Here’s a detailed guide to learn how to make the most of it.")})]})]})}]})}function gn(){const{toggle:e}=(0,l.useDispatch)(f.store),t=(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuidePage"),s=!!e(f.store).get("core/edit-site","welcomeGuide"),{isPage:n}=e(Kt);return t&&!s&&n()}),[]);if(!t)return null;const s=(0,b.__)("Editing a page");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,me.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,me.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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 vn(){const{toggle:e}=(0,l.useDispatch)(f.store),t=(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuideTemplate"),s=!!e(f.store).get("core/edit-site","welcomeGuide"),{isPage:n}=e(Kt),{getCurrentPostType:i}=e(h.store);return t&&!s&&n()&&"wp_template"===i()}),[]);if(!t)return null;const s=(0,b.__)("Editing a template");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,me.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,me.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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 yn(){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(pn,{}),(0,me.jsx)(mn,{}),(0,me.jsx)(gn,{}),(0,me.jsx)(vn,{})]})}const{useGlobalStylesOutput:xn}=se(y.privateApis);function bn(){return function(){const e=(0,l.useSelect)((e=>e(Kt).getEditedPostType())),[t,s]=xn(e!==Me),{getSettings:n}=(0,l.useSelect)(Kt),{updateSettings:i}=(0,l.useDispatch)(Kt);(0,d.useEffect)((()=>{var e;if(!t||!s)return;const r=n(),o=Object.values(null!==(e=r.styles)&&void 0!==e?e:[]).filter((e=>!e.isGlobalStyles));i({...r,styles:[...o,...t],__experimentalFeatures:s})}),[t,s,i,n])}(),null}const{Theme:wn}=se(x.privateApis),{useGlobalStyle:_n}=se(y.privateApis);function Sn({id:e}){var t;const[s]=_n("color.text"),[n]=_n("color.background"),{highlightedColors:i}=de(),r=null!==(t=i[0]?.color)&&void 0!==t?t:s,{elapsed:o,total:a}=(0,l.useSelect)((e=>{var t,s;const n=e(_.store).countSelectorsByStatus(),i=null!==(t=n.resolving)&&void 0!==t?t:0,r=null!==(s=n.finished)&&void 0!==s?s:0;return{elapsed:r,total:r+i}}),[]);return(0,me.jsx)("div",{className:"edit-site-canvas-loader",children:(0,me.jsx)(wn,{accent:r,background:n,children:(0,me.jsx)(x.ProgressBar,{id:e,max:a,value:o})})})}function jn({clientId:e,onClose:t}){const{getBlocks:s}=(0,l.useSelect)(y.store),{replaceBlocks:n}=(0,l.useDispatch)(y.store);return(0,l.useSelect)((t=>t(y.store).canRemoveBlock(e)),[e])?(0,me.jsx)(x.MenuItem,{onClick:()=>{n(e,s(e)),t()},children:(0,b.__)("Detach")}):null}const Cn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),{CreateTemplatePartModal:kn}=se(h.privateApis);function En({clientIds:e,blocks:t}){const[s,n]=(0,d.useState)(!1),{replaceBlocks:i}=(0,l.useDispatch)(y.store),{createSuccessNotice:r}=(0,l.useDispatch)(w.store),{canCreate:a}=(0,l.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Kt).getSettings();return{canCreate:!t}}),[]);if(!a)return null;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{icon:Cn,onClick:()=>{n(!0)},"aria-expanded":s,"aria-haspopup":"dialog",children:(0,b.__)("Create template part")}),s&&(0,me.jsx)(kn,{closeModal:()=>{n(!1)},blocks:t,onCreate:async t=>{i(e,(0,o.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),r((0,b.__)("Template part created."),{type:"snackbar"})}})]})}function Pn(){return(0,me.jsx)(y.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>(0,me.jsx)(In,{clientIds:e,onClose:t})})}function In({clientIds:e,onClose:t}){const{isContentOnly:s,blocks:n}=(0,l.useSelect)((t=>{const{getBlocksByClientId:s,getBlockEditingMode:n}=t(y.store);return{blocks:s(e),isContentOnly:1===e.length&&"contentOnly"===n(e[0])}}),[e]);return s?null:1===n.length&&"core/template-part"===n[0]?.name?(0,me.jsx)(jn,{clientId:e[0],onClose:t}):(0,me.jsx)(En,{clientIds:e,blocks:n})}const{useHistory:Tn}=se(Xt.privateApis);const{useBlockEditorSettings:On}=se(h.privateApis),{useLocation:An,useHistory:Mn}=se(Xt.privateApis);function Nn(){const e=function(){const e=Tn();return(0,d.useCallback)((t=>{e.push({...t,focusMode:!0,canvas:"edit"})}),[e])}(),{templateSlug:t,canvasMode:s,settings:n,postWithTemplate:i}=(0,l.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:s,getEditedPostContext:n,getCanvasMode:i,getSettings:r}=se(e(Kt)),{getEditedEntityRecord:o}=e(_.store),a=o("postType",t(),s()),l=n();return{templateSlug:a.slug,canvasMode:i(),settings:r(),postWithTemplate:l?.postId}}),[]),r=function(e){const t=e?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);let s,n,i,r=!1;if(t)t[1]?s=t[2]?t[2]:t[1]:t[3]&&(s=t[6]?t[6]:t[4],n=t[7]),s="tag"===s?"post_tag":s;else{const t=e?.match(/^(author)$|^author-(.+)$/);t&&(r=!0,t[2]&&(i=t[2]))}return(0,l.useSelect)((e=>{const{getEntityRecords:t,getTaxonomy:o,getAuthors:a}=e(_.store);let l,c;if(s&&(l=o(s)?.labels?.singular_name),n){const e=t("taxonomy",s,{slug:n,per_page:1});e&&e[0]&&(c=e[0].name)}if(r&&(l="Author",i)){const e=a({slug:i});e&&e[0]&&(c=e[0].name)}return{archiveTypeLabel:l,archiveNameLabel:c}}),[i,r,s,n])}(t),o=i?"template-locked":"post-only",a=function(){const e=An(),t=(0,v.usePrevious)(e),s=Mn();return(0,d.useMemo)((()=>{const n=e.params.focusMode||e.params.postId&&He.includes(e.params.postType),i="edit"===t?.params.canvas;return n&&i?()=>s.back():void 0}),[e,s])}();return(0,d.useMemo)((()=>({...n,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==s,defaultRenderingMode:o,onNavigateToEntityRecord:e,onNavigateToPreviousEntityRecord:a,__experimentalArchiveTitleTypeLabel:r.archiveTypeLabel,__experimentalArchiveTitleNameLabel:r.archiveNameLabel,__unstableIsPreviewMode:"view"===s})),[n,s,o,e,a,r.archiveTypeLabel,r.archiveNameLabel])}const{Fill:Fn,Slot:Vn}=(0,x.createSlotFill)("PluginTemplateSettingPanel"),Rn=({children:e})=>{u()("wp.editSite.PluginTemplateSettingPanel",{since:"6.6",version:"6.8",alternative:"wp.editor.PluginDocumentSettingPanel"});return(0,l.useSelect)((e=>"wp_template"===e(h.store).getCurrentPostType()),[])?(0,me.jsx)(Fn,{children:e}):null};Rn.Slot=Vn;const Bn=Rn,Dn=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),Ln=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),zn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})}),Gn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})});function Hn({className:e,...t}){return(0,me.jsx)(x.Icon,{className:Qt(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Un({icon:e,children:t,...s}){return(0,me.jsxs)(x.__experimentalItem,{...s,children:[e&&(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(Hn,{icon:e,size:24}),(0,me.jsx)(x.FlexItem,{children:t})]}),!e&&t]})}function Wn(e){return(0,me.jsx)(x.__experimentalNavigatorButton,{as:Un,...e})}const qn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Zn=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),Kn=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})}),{useHasDimensionsPanel:Yn,useHasTypographyPanel:Xn,useHasColorPanel:Jn,useGlobalSetting:Qn,useSettingsForBlockElement:$n}=se(y.privateApis);const ei=function(){const[e]=Qn(""),t=$n(e),s=Xn(t),n=Jn(t),i=Yn(t);return(0,me.jsx)(me.Fragment,{children:(0,me.jsxs)(x.__experimentalItemGroup,{children:[s&&(0,me.jsx)(Wn,{icon:qn,path:"/typography","aria-label":(0,b.__)("Typography styles"),children:(0,b.__)("Typography")}),n&&(0,me.jsx)(Wn,{icon:Zn,path:"/colors","aria-label":(0,b.__)("Colors styles"),children:(0,b.__)("Colors")}),(0,me.jsx)(Wn,{icon:Kn,path:"/shadows","aria-label":(0,b.__)("Shadow styles"),children:(0,b.__)("Shadows")}),i&&(0,me.jsx)(Wn,{icon:Js,path:"/layout","aria-label":(0,b.__)("Layout styles"),children:(0,b.__)("Layout")})]})})};function ti(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,s=e.trim(),n=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return s.includes(",")?s.split(",").map(n).filter((e=>""!==e)).join(", "):n(s)}function si(e){if(!e)return"";let t=e.trim();return t.includes(",")&&(t=t.split(",").find((e=>""!==e.trim())).trim()),t=t.replace(/^["']|["']$/g,""),window.navigator.userAgent.toLowerCase().includes("firefox")&&(t=`"${t}"`),t}function ni(e){const t={fontFamily:ti(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const i=e.fontFace.filter((e=>e?.fontStyle&&"normal"===e.fontStyle.toLowerCase()));if(i.length>0){t.fontStyle="normal";const e=function(e){const t=[];return e.forEach((e=>{const s=String(e.fontWeight).split(" ");if(2===s.length){const e=parseInt(s[0]),n=parseInt(s[1]);for(let s=e;s<=n;s+=100)t.push(s)}else 1===s.length&&t.push(parseInt(s[0]))})),t}(i),r=(s=400,0===(n=e).length?null:(n.sort(((e,t)=>Math.abs(s-e)-Math.abs(s-t))),n[0]));t.fontWeight=String(r)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var s,n;return t}function ii(e){return e?`is-style-${e}`:""}function ri(e,t){if(!Array.isArray(e)||!t)return null;const s=t.replace("var(","").replace(")",""),n=s?.split("--").slice(-1)[0];return e.find((e=>e.slug===n))}const{GlobalStylesContext:oi}=se(y.privateApis),{mergeBaseAndUserConfigs:ai}=se(h.privateApis);function li({fontSize:e,variation:t}){const{base:s}=(0,d.useContext)(oi);let n=s;t&&(n=ai(s,t));const[i,r]=function(e){const t=e?.settings?.typography?.fontFamilies?.theme,s=e?.styles?.typography?.fontFamily,n=ri(t,s),i=e?.styles?.elements?.heading?.typography?.fontFamily;let r;return r=i?ri(t,e?.styles?.elements?.heading?.typography?.fontFamily):n,[n,r]}(n),o=i?ni(i):{},a=r?ni(r):{};return e&&(o.fontSize=e,a.fontSize=e),(0,me.jsxs)(x.__unstableMotion.div,{animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},style:{textAlign:"center"},children:[(0,me.jsx)("span",{style:a,children:(0,b._x)("A","Uppercase letter A")}),(0,me.jsx)("span",{style:o,children:(0,b._x)("a","Lowercase letter A")})]})}function ci({normalizedColorSwatchSize:e,ratio:t}){const{highlightedColors:s}=de(),n=e*t;return s.map((({slug:e,color:t},s)=>(0,me.jsx)(x.__unstableMotion.div,{style:{height:n,width:n,background:t,borderRadius:n/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===s?.2:.1}},`${e}-${s}`)))}const{useGlobalStyle:ui,useGlobalStylesOutput:di}=se(y.privateApis),hi=248,pi=152,fi={leading:!0,trailing:!0};function mi({children:e,label:t,isFocused:s,withHoverView:n}){const[i="white"]=ui("color.background"),[r]=ui("color.gradient"),[o]=di(),a=(0,v.useReducedMotion)(),[l,c]=(0,d.useState)(!1),[u,{width:h}]=(0,v.useResizeObserver)(),[p,f]=(0,d.useState)(h),[m,g]=(0,d.useState)(),b=(0,v.useThrottle)(f,250,fi);(0,d.useLayoutEffect)((()=>{h&&b(h)}),[h,b]),(0,d.useLayoutEffect)((()=>{const e=p?p/hi:1,t=e-(m||0);!(Math.abs(t)>.1)&&m||g(e)}),[p,m]);const w=m||(h?h/hi:1),_=(0,d.useMemo)((()=>o?[...o,{css:"html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}",isGlobalStyles:!0}]:o),[o]),S=!!h;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("div",{style:{position:"relative"},children:u}),S&&(0,me.jsxs)(y.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",style:{height:pi*w},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),tabIndex:-1,children:[(0,me.jsx)(y.__unstableEditorStyles,{styles:_}),(0,me.jsx)(x.__unstableMotion.div,{style:{height:pi*w,width:"100%",background:null!=r?r:i,cursor:n?"pointer":void 0},initial:"start",animate:(l||s)&&!a&&t?"hover":"start",children:[].concat(e).map(((e,t)=>e({ratio:w,key:t})))})]})]})}const{useGlobalStyle:gi}=se(y.privateApis),vi={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},yi={hover:{opacity:1},start:{opacity:.5}},xi={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},bi=({label:e,isFocused:t,withHoverView:s,variation:n})=>{const[i]=gi("typography.fontWeight"),[r="serif"]=gi("typography.fontFamily"),[o=r]=gi("elements.h1.typography.fontFamily"),[a=i]=gi("elements.h1.typography.fontWeight"),[l="black"]=gi("color.text"),[c=l]=gi("elements.h1.color.text"),{paletteColors:u}=de();return(0,me.jsxs)(mi,{label:e,isFocused:t,withHoverView:s,children:[({ratio:e,key:t})=>(0,me.jsx)(x.__unstableMotion.div,{variants:vi,style:{height:"100%",overflow:"hidden"},children:(0,me.jsxs)(x.__experimentalHStack,{spacing:10*e,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,me.jsx)(li,{fontSize:65*e,variation:n}),(0,me.jsx)(x.__experimentalVStack,{spacing:4*e,children:(0,me.jsx)(ci,{normalizedColorSwatchSize:32,ratio:e})})]})},t),({key:e})=>(0,me.jsx)(x.__unstableMotion.div,{variants:s&&yi,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,me.jsx)(x.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:u.slice(0,4).map((({color:e},t)=>(0,me.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},t)))})},e),({ratio:t,key:s})=>(0,me.jsx)(x.__unstableMotion.div,{variants:xi,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,me.jsx)(x.__experimentalVStack,{spacing:3*t,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*t,boxSizing:"border-box"},children:e&&(0,me.jsx)("div",{style:{fontSize:40*t,fontFamily:o,color:c,fontWeight:a,lineHeight:"1em",textAlign:"center"},children:e})})},s)]})},{useGlobalStyle:wi}=se(y.privateApis);const _i=function(){const[e]=wi("css"),{hasVariations:t,canEditCSS:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s,__experimentalGetCurrentThemeGlobalStylesVariations:n}=e(_.store),i=s(),r=i?t("root","globalStyles",i):void 0;return{hasVariations:!!n()?.length,canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]);return(0,me.jsxs)(x.Card,{size:"small",className:"edit-site-global-styles-screen-root",children:[(0,me.jsx)(x.CardBody,{children:(0,me.jsxs)(x.__experimentalVStack,{spacing:4,children:[(0,me.jsx)(x.Card,{children:(0,me.jsx)(x.CardMedia,{children:(0,me.jsx)(bi,{})})}),t&&(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(Wn,{path:"/variations","aria-label":(0,b.__)("Browse styles"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Browse styles")}),(0,me.jsx)(Hn,{icon:(0,b.isRTL)()?zn:Gn})]})})}),(0,me.jsx)(ei,{})]})}),(0,me.jsx)(x.CardDivider,{}),(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Customize the appearance of specific blocks for the whole site.")}),(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(Wn,{path:"/blocks","aria-label":(0,b.__)("Blocks styles"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Blocks")}),(0,me.jsx)(Hn,{icon:(0,b.isRTL)()?zn:Gn})]})})})]}),s&&!!e&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.CardDivider,{}),(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Add your own CSS to customize the appearance and layout of your site.")}),(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(Wn,{path:"/css","aria-label":(0,b.__)("Additional CSS"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Additional CSS")}),(0,me.jsx)(Hn,{icon:(0,b.isRTL)()?zn:Gn})]})})})]})]})]})},Si=window.wp.a11y,{useGlobalStyle:ji}=se(y.privateApis);function Ci(e){const t=(0,l.useSelect)((t=>{const{getBlockStyles:s}=t(o.store);return s(e)}),[e]),[s]=ji("variations",e);return function(e,t){return e?.filter((e=>"block"===e.source||t.includes(e.name)))}(t,Object.keys(null!=s?s:{}))}function ki({name:e}){const t=Ci(e);return(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(((t,s)=>t?.isDefault?null:(0,me.jsx)(Wn,{path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),"aria-label":t.label,children:t.label},s)))})}const Ei=function({title:e,description:t,onBack:s}){return(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalView,{children:(0,me.jsx)(x.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,me.jsxs)(x.__experimentalHStack,{spacing:2,children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{style:{minWidth:24,padding:0},icon:(0,b.isRTL)()?Gn:zn,size:"small",label:(0,b.__)("Back"),onClick:s}),(0,me.jsx)(x.__experimentalSpacer,{children:(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,me.jsx)("p",{className:"edit-site-global-styles-header__description",children:t})]})},{useHasDimensionsPanel:Pi,useHasTypographyPanel:Ii,useHasBorderPanel:Ti,useGlobalSetting:Oi,useSettingsForBlockElement:Ai,useHasColorPanel:Mi}=se(y.privateApis);function Ni(e){const[t]=Oi("",e),s=Ai(t,e),n=Ii(s),i=Mi(s),r=Ti(s),o=Pi(s),a=r||o,l=!!Ci(e)?.length;return n||i||a||l}function Fi({block:e}){if(!Ni(e.name))return null;const t=(0,b.sprintf)((0,b.__)("%s block styles"),e.title);return(0,me.jsx)(Wn,{path:"/blocks/"+encodeURIComponent(e.name),"aria-label":t,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(y.BlockIcon,{icon:e.icon}),(0,me.jsx)(x.FlexItem,{children:e.title})]})})}const Vi=(0,d.memo)((function({filterValue:e}){const t=function(){const e=(0,l.useSelect)((e=>e(o.store).getBlockTypes()),[]),{core:t,noncore:s}=e.reduce(((e,t)=>{const{core:s,noncore:n}=e;return(t.name.startsWith("core/")?s:n).push(t),e}),{core:[],noncore:[]});return[...t,...s]}(),s=(0,v.useDebounce)(Si.speak,500),{isMatchingSearchTerm:n}=(0,l.useSelect)(o.store),i=e?t.filter((t=>n(t,e))):t,r=(0,d.useRef)();return(0,d.useEffect)((()=>{if(!e)return;const t=r.current.childElementCount,n=(0,b.sprintf)((0,b._n)("%d result found.","%d results found.",t),t);s(n,t)}),[e,s]),(0,me.jsx)("div",{ref:r,className:"edit-site-block-types-item-list",children:i.map((e=>(0,me.jsx)(Fi,{block:e},"menu-itemblock-"+e.name)))})}));const Ri=function(){const[e,t]=(0,d.useState)(""),s=(0,d.useDeferredValue)(e);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Blocks"),description:(0,b.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,b.__)("Search for blocks"),placeholder:(0,b.__)("Search")}),(0,me.jsx)(Vi,{filterValue:s})]})},Bi=({name:e,variation:t=""})=>{var s;const n=(0,o.getBlockType)(e)?.example,i=(0,d.useMemo)((()=>{if(!n)return null;let s=n;return t&&(s={...s,attributes:{...s.attributes,className:ii(t)}}),(0,o.getBlockFromExample)(e,s)}),[e,n,t]),r=null!==(s=n?.viewportWidth)&&void 0!==s?s:null;return n?(0,me.jsx)(x.__experimentalSpacer,{marginX:4,marginBottom:4,children:(0,me.jsx)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:150,boxSizing:"initial"},children:(0,me.jsx)(y.BlockPreview,{blocks:i,viewportWidth:r,minHeight:150,additionalStyles:[{css:"\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:150px;\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 Di=function({children:e,level:t}){return(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2,children:e})};function Li(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:zi,useHasTypographyPanel:Gi,useHasBorderPanel:Hi,useGlobalSetting:Ui,useSettingsForBlockElement:Wi,useHasColorPanel:qi,useHasFiltersPanel:Zi,useHasImageSettingsPanel:Ki,useGlobalStyle:Yi,BorderPanel:Xi,ColorPanel:Ji,TypographyPanel:Qi,DimensionsPanel:$i,FiltersPanel:er,ImageSettingsPanel:tr,AdvancedPanel:sr}=se(y.privateApis);const nr=function({name:e,variation:t}){let s=[];t&&(s=["variations",t].concat(s));const n=s.join("."),[i]=Yi(n,e,"user",{shouldDecodeEncode:!1}),[r,a]=Yi(n,e,"all",{shouldDecodeEncode:!1}),[c]=Ui("",e,"user"),[u,h]=Ui("",e),p=Wi(u,e),f=(0,o.getBlockType)(e);p?.spacing?.blockGap&&f?.supports?.spacing?.blockGap&&(!0===f?.supports?.spacing?.__experimentalSkipSerialization||f?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(p.spacing.blockGap=!1),p?.dimensions?.aspectRatio&&"core/group"===e&&(p.dimensions.aspectRatio=!1);const m=Ci(e),g=Gi(p),v=qi(p),y=Hi(p),w=zi(p),S=Zi(p),j=Ki(e,c,p),C=!!m?.length&&!t,{canEditCSS:k}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),E=t?m.find((e=>e.name===t)):null,P=(0,d.useMemo)((()=>({...r,layout:p.layout})),[r,p.layout]),I=(0,d.useMemo)((()=>({...i,layout:c.layout})),[i,c.layout]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:t?E?.label:f.title}),(0,me.jsx)(Bi,{name:e,variation:t}),C&&(0,me.jsx)("div",{className:"edit-site-global-styles-screen-variations",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Di,{children:(0,b.__)("Style Variations")}),(0,me.jsx)(ki,{name:e})]})}),v&&(0,me.jsx)(Ji,{inheritedValue:r,value:i,onChange:a,settings:p}),g&&(0,me.jsx)(Qi,{inheritedValue:r,value:i,onChange:a,settings:p}),w&&(0,me.jsx)($i,{inheritedValue:P,value:I,onChange:e=>{const t={...e};delete t.layout,a(t),e.layout!==c.layout&&h({...c,layout:e.layout})},settings:p,includeLayoutControls:!0}),y&&(0,me.jsx)(Xi,{inheritedValue:r,value:i,onChange:e=>{if(!e?.border)return void a(e);const{radius:t,...s}=e.border,n=function(e){return e?(0,x.__experimentalHasSplitBorders)(e)?{top:Li(e.top),right:Li(e.right),bottom:Li(e.bottom),left:Li(e.left)}:Li(e):e}(s),i=(0,x.__experimentalHasSplitBorders)(n)?{color:null,style:null,width:null,...n}:{top:n,right:n,bottom:n,left:n};a({...e,border:{...i,radius:t}})},settings:p}),S&&(0,me.jsx)(er,{inheritedValue:P,value:I,onChange:a,settings:p,includeLayoutControls:!0}),j&&(0,me.jsx)(tr,{onChange:e=>{h(void 0===e?{...u,lightbox:void 0}:{...u,lightbox:{...u.lightbox,...e}})},value:c,inheritedValue:p}),k&&(0,me.jsxs)(x.PanelBody,{title:(0,b.__)("Advanced"),initialOpen:!1,children:[(0,me.jsx)("p",{children:(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."),f?.title)}),(0,me.jsx)(sr,{value:i,onChange:a,inheritedValue:r})]})]})},{useGlobalStyle:ir}=se(y.privateApis);function rr({parentMenu:e,element:t,label:s}){var n;const i="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[o]=ir(i+"typography.fontFamily"),[a]=ir(i+"typography.fontStyle"),[l]=ir(i+"typography.fontWeight"),[c]=ir(i+"typography.letterSpacing"),[u]=ir(i+"color.background"),[d]=ir("color.background"),[h]=ir(i+"color.gradient"),[p]=ir(i+"color.text"),f=(0,b.sprintf)((0,b.__)("Typography %s styles"),s);return(0,me.jsx)(Wn,{path:e+"/typography/"+t,"aria-label":f,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=o?o:"serif",background:null!==(n=null!=h?h:u)&&void 0!==n?n:d,color:p,fontStyle:a,fontWeight:l,letterSpacing:c,...r},children:(0,b.__)("Aa")}),(0,me.jsx)(x.FlexItem,{children:s})]})})}const or=function(){return(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Di,{level:3,children:(0,b.__)("Elements")}),(0,me.jsxs)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[(0,me.jsx)(rr,{parentMenu:"",element:"text",label:(0,b.__)("Text")}),(0,me.jsx)(rr,{parentMenu:"",element:"link",label:(0,b.__)("Links")}),(0,me.jsx)(rr,{parentMenu:"",element:"heading",label:(0,b.__)("Headings")}),(0,me.jsx)(rr,{parentMenu:"",element:"caption",label:(0,b.__)("Captions")}),(0,me.jsx)(rr,{parentMenu:"",element:"button",label:(0,b.__)("Buttons")})]})]})},{mergeBaseAndUserConfigs:ar}=se(h.privateApis),{GlobalStylesContext:lr,areGlobalStyleConfigsEqual:cr}=se(y.privateApis);function ur({variation:e,children:t,isPill:s,property:n}){const[i,r]=(0,d.useState)(!1),{base:o,user:a,setUserConfig:l}=(0,d.useContext)(lr),c=(0,d.useMemo)((()=>{let t=ar(o,e);return n&&(t=ae(t,n)),{user:e,base:o,merged:t,setUserConfig:()=>{}}}),[e,o,n]),u=()=>l(e),h=(0,d.useMemo)((()=>cr(a,e)),[a,e]);let p=e?.title;return e?.description&&(p=(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),e?.title,e?.description)),(0,me.jsx)(lr.Provider,{value:c,children:(0,me.jsx)("div",{className:Qt("edit-site-global-styles-variations_item",{"is-active":h}),role:"button",onClick:u,onKeyDown:e=>{e.keyCode===hs.ENTER&&(e.preventDefault(),u())},tabIndex:"0","aria-label":p,"aria-current":h,onFocus:()=>r(!0),onBlur:()=>r(!1),children:(0,me.jsx)("div",{className:Qt("edit-site-global-styles-variations_item-preview",{"is-pill":s}),children:t(i)})})})}function dr({title:e,gap:t=2}){const s=pe();return s?.length<=1?null:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[e&&(0,me.jsx)(Di,{level:3,children:e}),(0,me.jsx)(x.__experimentalGrid,{columns:3,gap:t,className:"edit-site-global-styles-style-variations-container",children:s&&s.length&&s.map(((e,t)=>(0,me.jsx)(ur,{variation:e,property:"typography",children:t=>(0,me.jsx)(mi,{label:e?.title,isFocused:t,children:({ratio:t,key:s})=>(0,me.jsx)(x.__experimentalVStack,{spacing:10*t,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(li,{variation:e,fontSize:85*t})},s)})},t)))})]})}const hr=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.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,me.jsx)(us.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"})]}),pr=window.wp.apiFetch;var fr=i.n(pr);const mr="/wp/v2/font-families",gr="/wp/v2/font-collections";async function vr(e){const t={path:mr,method:"POST",body:e},s=await fr()(t);return{id:s.id,...s.font_family_settings,fontFace:[]}}async function yr(e,t){const s={path:`${mr}/${e}/font-faces`,method:"POST",body:t},n=await fr()(s);return{id:n.id,...n.font_face_settings}}async function xr(e){const t={path:`${mr}?slug=${e}&_embed=true`,method:"GET"},s=await fr()(t);if(!s||0===s.length)return null;const n=s[0];return{id:n.id,...n.font_family_settings,fontFace:n?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function br(e){const t={path:`${mr}/${e}?force=true`,method:"DELETE"};return await fr()(t)}const wr=["otf","ttf","woff","woff2"],_r={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")},Sr={normal:(0,b._x)("Normal","font style"),italic:(0,b._x)("Italic","font style")},{File:jr}=window,{kebabCase:Cr}=se(x.privateApis);function kr(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function Er(e){return`${_r[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":Sr[e.fontStyle]||e.fontStyle}`}function Pr(e=[],t=[]){const s=new Map;for(const t of e)s.set(`${t.fontWeight}${t.fontStyle}`,t);for(const e of t)s.set(`${e.fontWeight}${e.fontStyle}`,e);return Array.from(s.values())}function Ir(e=[],t=[]){const s=new Map;for(const t of e)s.set(t.slug,{...t});for(const e of t)if(s.has(e.slug)){const{fontFace:t,...n}=e,i=Pr(s.get(e.slug).fontFace,t);s.set(e.slug,{...n,fontFace:i})}else s.set(e.slug,{...e});return Array.from(s.values())}async function Tr(e,t,s="all"){let n;if("string"==typeof t)n=`url(${t})`;else{if(!(t instanceof jr))return;n=await t.arrayBuffer()}const i=new window.FontFace(si(e.fontFamily),n,{style:e.fontStyle,weight:e.fontWeight}),r=await i.load();if("document"!==s&&"all"!==s||document.fonts.add(r),"iframe"===s||"all"===s){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(r)}}function Or(e,t="all"){const s=t=>{t.forEach((s=>{s.family===si(e?.fontFamily)&&s.weight===e?.fontWeight&&s.style===e?.fontStyle&&t.delete(s)}))};if("document"!==t&&"all"!==t||s(document.fonts),"iframe"===t||"all"===t){s(document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts)}}function Ar(e){if(!e)return;let t;var s;return t=Array.isArray(e)?e[0]:e,t.startsWith("file:.")?void 0:(("string"!=typeof(s=t)||s===decodeURIComponent(s))&&(t=encodeURI(t)),t)}function Mr(e){const t=new FormData,{fontFace:s,category:n,...i}=e,r={...i,slug:Cr(e.slug)};return t.append("font_family_settings",JSON.stringify(r)),t}function Nr(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const s={...e},n=new FormData;if(s.file){const e=Array.isArray(s.file)?s.file:[s.file],i=[];e.forEach(((e,s)=>{const r=`file-${t}-${s}`;n.append(r,e,e.name),i.push(r)})),s.src=1===i.length?i[0]:i,delete s.file,n.append("font_face_settings",JSON.stringify(s))}else n.append("font_face_settings",JSON.stringify(s));return n}));return t}}async function Fr(e,t){const s=[];for(const n of t)try{const t=await yr(e,n);s.push({status:"fulfilled",value:t})}catch(e){s.push({status:"rejected",reason:e})}const n={errors:[],successes:[]};return s.forEach(((e,s)=>{if("fulfilled"===e.status){const i=e.value;i.id?n.successes.push(i):n.errors.push({data:t[s],message:`Error: ${i.message}`})}else n.errors.push({data:t[s],message:e.reason.message})})),n}function Vr(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function Rr(e,t,s){const n=t=>t.slug===e.slug,i=s.find(n);return t?(i=>{const r=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!i)return[...s,{...e,fontFace:[t]}];let o=i.fontFace||[];return o=o.find(r)?o.filter((e=>!r(e))):[...o,t],0===o.length?s.filter((e=>!n(e))):s.map((e=>n(e)?{...e,fontFace:o}:e))})(i):(t=>t?s.filter((e=>!n(e))):[...s,e])(i)}const{useGlobalSetting:Br}=se(y.privateApis),Dr=(0,d.createContext)({});const Lr=function({children:e}){const{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{globalStylesId:s}=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return{globalStylesId:t()}})),n=(0,_.useEntityRecord)("root","globalStyles",s),[i,r]=(0,d.useState)(!1),[o,a]=(0,d.useState)(0),[c,u]=(0,d.useState)(null),h=()=>{a(Date.now())},{records:p=[],isResolving:f}=(0,_.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),m=(p||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[g,v]=Br("typography.fontFamilies"),y=async e=>{const s=n.record;fe(s,["settings","typography","fontFamilies"],e),await t("root","globalStyles",s)},[x,w]=(0,d.useState)(!1),[S,j]=(0,d.useState)(null),C=g?.theme?g.theme.map((e=>kr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=g?.custom?g.custom.map((e=>kr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],E=m?m.map((e=>kr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,d.useEffect)((()=>{x||j(null)}),[x]);const[P]=(0,d.useState)(new Set),I=e=>e.reduce(((e,t)=>{const s=t?.fontFace&&t.fontFace?.length>0?t?.fontFace.map((e=>`${e.fontStyle+e.fontWeight}`)):["normal400"];return e[t.slug]=s,e}),{}),T=e=>I("theme"===e?C:k),O=(e,t,s,n)=>t||s?!!T(n)[e]?.includes(t+s):!!T(n)[e],A=e=>{var t;const s=(null!==(t=g?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug)),n={...g,[e.source]:s};return v(n),e.fontFace&&e.fontFace.forEach((e=>{Or(e,"all")})),n},M=e=>{const t=N(e),s={...g,custom:Ir(g?.custom,t)};return v(s),F(t),s},N=e=>e.map((({id:e,fontFace:t,...s})=>({...s,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}}))),F=e=>{e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{Tr(e,Ar(e.src),"all")}))}))},[V,R]=(0,d.useState)([]),B=async()=>{const e=await async function(){const e={path:`${gr}?_fields=slug,name,description`,method:"GET"};return await fr()(e)}();R(e)};return(0,d.useEffect)((()=>{B()}),[]),(0,me.jsx)(Dr.Provider,{value:{libraryFontSelected:S,handleSetLibraryFontSelected:e=>{if(u(null),!e)return void j(null);const t=("theme"===e.source?C:E).find((t=>t.slug===e.slug));j({...t||e,source:e.source})},fontFamilies:g,baseCustomFonts:E,isFontActivated:O,getFontFacesActivated:(e,t)=>T(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=Ar(e.src);t&&!P.has(t)&&(Tr(e,t,"document"),P.add(t))},installFonts:async function(e){r(!0);try{const t=[];let s=[];for(const n of e){let e=!1,i=await xr(n.slug);i||(e=!0,i=await vr(Mr(n)));const r=i.fontFace&&n.fontFace?i.fontFace.filter((e=>Vr(e,n.fontFace))):[];i.fontFace&&n.fontFace&&(n.fontFace=n.fontFace.filter((e=>!Vr(e,i.fontFace))));let o=[],a=[];if(n?.fontFace?.length>0){const e=await Fr(i.id,Nr(n));o=e?.successes,a=e?.errors}(o?.length>0||r?.length>0)&&(i.fontFace=[...o],t.push(i)),i&&!n?.fontFace?.length&&t.push(i),e&&n?.fontFace?.length>0&&0===o?.length&&await br(i.id),s=s.concat(a)}if(s=s.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),t.length>0){const e=M(t);await y(e),h()}if(s.length>0){const e=new Error((0,b.__)("There was an error installing fonts."));throw e.installationErrors=s,e}}finally{r(!1)}},uninstallFontFamily:async function(e){try{const t=await br(e.id);if(t.deleted){const t=A(e);await y(t)}return h(),t}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var s;const n=Rr(e,t,null!==(s=g?.[e.source])&&void 0!==s?s:[]);v({...g,[e.source]:n});O(e.slug,t?.fontStyle,t?.fontWeight,e.source)?Tr(t,Ar(t?.src),"all"):Or(t,"all")},getAvailableFontsOutline:I,modalTabOpen:x,setModalTabOpen:w,refreshLibrary:h,notice:c,setNotice:u,saveFontFamilies:y,isResolvingLibrary:f,isInstalling:i,collections:V,getFontCollection:async e=>{try{if(!!V.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${gr}/${e}`,method:"GET"};return await fr()(t)}(e),s=V.map((s=>s.slug===e?{...s,...t}:s));R(s)}catch(e){throw console.error(e),e}}},children:e})};const zr=function({font:e,text:t}){const s=(0,d.useRef)(null),n=function(e){return e.fontStyle||e.fontWeight?e:e.fontFace&&e.fontFace.length?e.fontFace.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:{fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0}}(e),i=ni(e);t=t||e.name;const r=e.preview,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),{loadFontFaceAsset:u}=(0,d.useContext)(Dr),h=null!=r?r:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(n),p=h&&h.match(/\.(png|jpg|jpeg|gif|svg)$/i);var f;const m={fontSize:"18px",lineHeight:1,opacity:l?"1":"0",...i,...{fontFamily:ti((f=n).fontFamily),fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"400"}};return(0,d.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{a(e.isIntersecting)}),{});return e.observe(s.current),()=>e.disconnect()}),[s]),(0,d.useEffect)((()=>{(async()=>{o&&(!p&&n.src&&await u(n),c(!0))})()}),[n,o,u,p]),(0,me.jsx)("div",{ref:s,children:p?(0,me.jsx)("img",{src:h,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,me.jsx)(x.__experimentalText,{style:m,className:"font-library-modal__font-variant_demo-text",children:t})})};const Gr=function({font:e,onClick:t,variantsText:s,navigatorPath:n}){const i=e.fontFace?.length||1,r={cursor:t?"pointer":"default"},o=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(x.Button,{onClick:()=>{t(),n&&o.goTo(n)},style:r,className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"space-between",wrap:!1,children:[(0,me.jsx)(zr,{font:e}),(0,me.jsxs)(x.Flex,{justify:"flex-end",children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.__experimentalText,{className:"font-library-modal__font-card__count",children:s||(0,b.sprintf)((0,b._n)("%d variant","%d variants",i),i)})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Icon,{icon:Gn})})]})]})})},{kebabCase:Hr}=se(x.privateApis);const Ur=function({face:e,font:t}){const{isFontActivated:s,toggleActivateFont:n}=(0,d.useContext)(Dr),i=t?.fontFace?.length>0?s(t.slug,e.fontStyle,e.fontWeight,t.source):s(t.slug,null,null,t.source),r=()=>{t?.fontFace?.length>0?n(t,e):n(t)},o=t.name+" "+Er(e),a=Hr(`${t.slug}-${Er(e)}`);return(0,me.jsx)("div",{className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,me.jsx)(x.CheckboxControl,{checked:i,onChange:r,__nextHasNoMarginBottom:!0,id:a}),(0,me.jsx)("label",{htmlFor:a,children:(0,me.jsx)(zr,{font:e,text:o,onClick:r})})]})})};function Wr(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 qr(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?Wr(e.fontWeight)-Wr(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{useGlobalSetting:Zr}=se(y.privateApis);function Kr({font:e,isOpen:t,setIsOpen:s,setNotice:n,uninstallFontFamily:i,handleSetLibraryFontSelected:r}){const o=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{s(!1)},onConfirm:async()=>{n(null),s(!1);try{await i(e),o.goBack(),r(null),n({type:"success",message:(0,b.__)("Font family uninstalled successfully.")})}catch(e){n({type:"error",message:(0,b.__)("There was an error uninstalling the font family. ")+e.message})}},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name)})}const Yr=function(){const{baseCustomFonts:e,libraryFontSelected:t,handleSetLibraryFontSelected:s,refreshLibrary:n,uninstallFontFamily:i,isResolvingLibrary:r,isInstalling:o,saveFontFamilies:a,getFontFacesActivated:c,notice:u,setNotice:h,fontFamilies:p}=(0,d.useContext)(Dr),[f,m]=(0,d.useState)(!1),[g]=Zr("typography.fontFamilies",void 0,"base"),v=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return t()})),y=(0,_.useEntityRecord)("root","globalStyles",v),w=!!y?.edits?.settings?.typography?.fontFamilies,S=p?.theme?p.theme.map((e=>kr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],j=new Set(S.map((e=>e.slug))),C=g?.theme?S.concat(g.theme.filter((e=>!j.has(e.slug))).map((e=>kr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],k="custom"===t?.source&&t?.id,E=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return k&&t("delete","font-families",k)}),[k]),P=!!t&&"theme"!==t?.source&&E,I=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,s=c(e.slug,e.source).length;return(0,b.sprintf)((0,b.__)("%1$s/%2$s variants active"),s,t)};return(0,d.useEffect)((()=>{s(t),n()}),[]),(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[r&&(0,me.jsx)("div",{className:"font-library-modal__loading",children:(0,me.jsx)(x.ProgressBar,{})}),!r&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalNavigatorProvider,{initialPath:t?"/fontFamily":"/",children:[(0,me.jsx)(x.__experimentalNavigatorScreen,{path:"/",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"8",children:[u&&(0,me.jsx)(x.Notice,{status:u.type,onRemove:()=>h(null),children:u.message}),e.length>0&&(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b.__)("Installed Fonts")}),(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:e.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(Gr,{font:e,navigatorPath:"/fontFamily",variantsText:I(e),onClick:()=>{s(e)}})},e.slug)))})]}),C.length>0&&(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b.__)("Theme Fonts")}),(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:C.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(Gr,{font:e,navigatorPath:"/fontFamily",variantsText:I(e),onClick:()=>{s(e)}})},e.slug)))})]})]})}),(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/fontFamily",children:[(0,me.jsx)(Kr,{font:t,isOpen:f,setIsOpen:m,setNotice:h,uninstallFontFamily:i,handleSetLibraryFontSelected:s}),(0,me.jsxs)(x.Flex,{justify:"flex-start",children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{icon:zn,size:"small",onClick:()=>{s(null)},label:(0,b.__)("Back")}),(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:t?.name})]}),u&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalSpacer,{margin:1}),(0,me.jsx)(x.Notice,{status:u.type,onRemove:()=>h(null),children:u.message}),(0,me.jsx)(x.__experimentalSpacer,{margin:1})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalSpacer,{margin:8}),(e=>e?e.fontFace&&e.fontFace.length?qr(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(t).map(((e,s)=>(0,me.jsx)(Ur,{font:t,face:e},`face${s}`)))]})]})]}),(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer",children:[o&&(0,me.jsx)(x.ProgressBar,{}),P&&(0,me.jsx)(x.Button,{isDestructive:!0,variant:"tertiary",onClick:()=>{m(!0)},children:(0,b.__)("Delete")}),(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>{a(p)},disabled:!w,__experimentalIsFocusable:!0,children:(0,b.__)("Update")})]})]})]})};function Xr(e,t,s){return t?!!s[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!s[e]}const Jr=function(){return(0,me.jsx)("div",{className:"font-library__google-fonts-confirm",children:(0,me.jsx)(x.Card,{children:(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalHeading,{level:2,children:(0,b.__)("Connect to Google Fonts")}),(0,me.jsx)(x.__experimentalSpacer,{margin:6}),(0,me.jsx)(x.__experimentalText,{as:"p",children:(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,me.jsx)(x.__experimentalSpacer,{margin:3}),(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("You can alternatively upload files directly on the Upload tab.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:6}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))},children:(0,b.__)("Allow access to Google Fonts")})]})})})},{kebabCase:Qr}=se(x.privateApis);const $r=function({face:e,font:t,handleToggleVariant:s,selected:n}){const i=()=>{t?.fontFace?s(t,e):s(t)},r=t.name+" "+Er(e),o=Qr(`${t.slug}-${Er(e)}`);return(0,me.jsx)("div",{className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,me.jsx)(x.CheckboxControl,{checked:n,onChange:i,__nextHasNoMarginBottom:!0,id:o}),(0,me.jsx)("label",{htmlFor:o,children:(0,me.jsx)(zr,{font:e,text:r,onClick:i})})]})})},eo={slug:"all",name:(0,b._x)("All","font categories")},to="wp-font-library-google-fonts-permission";const so=function({slug:e}){var t;const s="google-fonts"===e,n=()=>"true"===window.localStorage.getItem(to),[i,r]=(0,d.useState)(null),[o,a]=(0,d.useState)([]),[l,c]=(0,d.useState)(1),[u,h]=(0,d.useState)({}),[p,f]=(0,d.useState)(s&&!n()),{collections:m,getFontCollection:g,installFonts:y,isInstalling:w,notice:_,setNotice:S}=(0,d.useContext)(Dr),j=m.find((t=>t.slug===e));(0,d.useEffect)((()=>{const e=()=>{f(s&&!n())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,s]);const C=()=>{window.localStorage.setItem(to,"false"),window.dispatchEvent(new Event("storage"))};(0,d.useEffect)((()=>{(async()=>{try{await g(e),B()}catch(e){_||S({type:"error",message:e?.message})}})()}),[e,g,S,_]),(0,d.useEffect)((()=>{r(null),S(null)}),[e,S]),(0,d.useEffect)((()=>{a([])}),[i]);const k=(0,d.useMemo)((()=>{var e;return null!==(e=j?.font_families)&&void 0!==e?e:[]}),[j]),E=null!==(t=j?.categories)&&void 0!==t?t:[],P=[eo,...E],I=(0,d.useMemo)((()=>function(e,t){const{category:s,search:n}=t;let i=e||[];return s&&"all"!==s&&(i=i.filter((e=>-1!==e.categories.indexOf(s)))),n&&(i=i.filter((e=>e.font_family_settings.name.toLowerCase().includes(n.toLowerCase())))),i}(k,u)),[k,u]),T=!j?.font_families&&!_,O=Math.max(window.innerHeight,500),A=Math.floor((O-417)/61),M=Math.ceil(I.length/A),N=(l-1)*A,F=l*A,V=I.slice(N,F),R=(0,v.debounce)((e=>{h({...u,search:e}),c(1)}),300),B=()=>{h({}),c(1)},D=(e,t)=>{const s=Rr(e,t,o);a(s)},L=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(o);if(p)return(0,me.jsx)(Jr,{});const z=()=>"google-fonts"!==e||p||i?null:(0,me.jsx)(x.DropdownMenu,{icon:Ln,label:(0,b.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,b.__)("Revoke access to Google Fonts"),onClick:C}]});return(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[T&&(0,me.jsx)("div",{className:"font-library-modal__loading",children:(0,me.jsx)(x.ProgressBar,{})}),!T&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalNavigatorProvider,{initialPath:"/",className:"font-library-modal__tabpanel-layout",children:[(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,children:j.name}),(0,me.jsx)(x.__experimentalText,{children:j.description})]}),(0,me.jsx)(z,{})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.Flex,{children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.SearchControl,{className:"font-library-modal__search",value:u.search,placeholder:(0,b.__)("Font name…"),label:(0,b.__)("Search"),onChange:R,__nextHasNoMarginBottom:!0,hideLabelFromVision:!1})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.SelectControl,{label:(0,b.__)("Category"),value:u.category,onChange:e=>{h({...u,category:e}),c(1)},children:P&&P.map((e=>(0,me.jsx)("option",{value:e.slug,children:e.name},e.slug)))})})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),!!j?.font_families?.length&&!I.length&&(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("No fonts found. Try with a different search term")}),(0,me.jsxs)("div",{className:"font-library-modal__fonts-grid__main",children:[(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:V.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(Gr,{font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{r(e.font_family_settings)}})},e.font_family_settings.slug)))})," "]})]}),(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/fontFamily",children:[(0,me.jsxs)(x.Flex,{justify:"flex-start",children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{icon:zn,size:"small",onClick:()=>{r(null),S(null)},label:(0,b.__)("Back")}),(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:i?.name})]}),_&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalSpacer,{margin:1}),(0,me.jsx)(x.Notice,{status:_.type,onRemove:()=>S(null),children:_.message}),(0,me.jsx)(x.__experimentalSpacer,{margin:1})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("Select font variants to install.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalSpacer,{margin:8}),(G=i,G?G.fontFace&&G.fontFace.length?qr(G.fontFace):[{fontFamily:G.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,me.jsx)($r,{font:i,face:e,handleToggleVariant:D,selected:Xr(i.slug,i.fontFace?e:null,L)},`face${t}`)))]}),(0,me.jsx)(x.__experimentalSpacer,{margin:16})]})]}),i&&(0,me.jsx)(x.Flex,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer",children:(0,me.jsx)(x.Button,{variant:"primary",onClick:async()=>{S(null);const e=o[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 s=e.split("/").pop();return new jr([t],s,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void S({type:"error",message:(0,b.__)("Error installing the fonts, could not be downloaded.")})}try{await y([e]),S({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){S({type:"error",message:e.message})}a([])},isBusy:w,disabled:0===o.length||w,__experimentalIsFocusable:!0,children:(0,b.__)("Install")})}),!i&&(0,me.jsxs)(x.Flex,{justify:"center",className:"font-library-modal__tabpanel-layout__footer",children:[(0,me.jsx)(x.Button,{label:(0,b.__)("First page"),size:"compact",onClick:()=>c(1),disabled:1===l,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"«"})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Previous page"),size:"compact",onClick:()=>c(l-1),disabled:1===l,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"‹"})}),(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2,children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("Page of %s","paging"),M),{CurrentPageControl:(0,me.jsx)(x.SelectControl,{"aria-label":(0,b.__)("Current page"),value:l,options:[...Array(M)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>c(parseInt(e)),size:"compact",__nextHasNoMarginBottom:!0})})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Next page"),size:"compact",onClick:()=>c(l+1),disabled:l===M,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"›"})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Last page"),size:"compact",onClick:()=>c(M),disabled:l===M,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"»"})})]})]})]});var G};var no=i(8572),io=i.n(no),ro=i(4660),oo=i.n(ro);globalThis.fetch;class ao{constructor(e,t={},s){this.type=e,this.detail=t,this.msg=s,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 lo{constructor(){this.listeners={}}addEventListener(e,t,s){let n=this.listeners[e]||[];s?n.unshift(t):n.push(t),this.listeners[e]=n}removeEventListener(e,t){let s=this.listeners[e]||[],n=s.findIndex((e=>e===t));n>-1&&(s.splice(n,1),this.listeners[e]=s)}dispatch(e){let t=this.listeners[e.type];if(t)for(let s=0,n=t.length;s{let t=e.replace(/get(Big)?/,"").toLowerCase(),s=parseInt(e.replace(/[^\d]/g,""))/8;Object.defineProperty(this,t,{get:()=>this.getValue(e,s)})}))}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 s=this.start+this.offset;this.offset+=t;try{return this.data[e](s)}catch(s){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),s}}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(co+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,s=8,n=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const i=`${n?"":"u"}int${s}`,r=[];for(;e--;)r.push(this[i]);return r}}class ho{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const s=e.currentPosition,n={enumerable:!1,get:()=>s};Object.defineProperty(this,"start",n)}load(e){Object.keys(e).forEach((t=>{let s=Object.getOwnPropertyDescriptor(e,t);s.get?this[t]=s.get.bind(this):void 0!==s.value&&(this[t]=s.value)})),this.parser.length&&this.parser.verifyLength()}}class po extends ho{constructor(e,t,s){const{parser:n,start:i}=super(new uo(e,t,s)),r={enumerable:!1,get:()=>n};Object.defineProperty(this,"p",r);const o={enumerable:!1,get:()=>i};Object.defineProperty(this,"tableStart",o)}}function fo(e,t,s){let n;Object.defineProperty(e,t,{get:()=>n||(n=s(),n),enumerable:!0})}class mo extends po{constructor(e,t,s){const{p:n}=super({offset:0,length:12},t,"sfnt");this.version=n.uint32,this.numTables=n.uint16,this.searchRange=n.uint16,this.entrySelector=n.uint16,this.rangeShift=n.uint16,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new go(n))),this.tables={},this.directory.forEach((e=>{fo(this.tables,e.tag.trim(),(()=>s(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class go{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const vo=oo().inflate||void 0;let yo;class xo extends po{constructor(e,t,s){const{p:n}=super({offset:0,length:44},t,"woff");this.signature=n.tag,this.flavor=n.uint32,this.length=n.uint32,this.numTables=n.uint16,n.uint16,this.totalSfntSize=n.uint32,this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.metaOffset=n.uint32,this.metaLength=n.uint32,this.metaOrigLength=n.uint32,this.privOffset=n.uint32,this.privLength=n.uint32,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new bo(n))),wo(this,t,s)}}class bo{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function wo(e,t,s){e.tables={},e.directory.forEach((n=>{fo(e.tables,n.tag.trim(),(()=>{let i=0,r=t;if(n.compLength!==n.origLength){const e=t.buffer.slice(n.offset,n.offset+n.compLength);let s;if(vo)s=vo(new Uint8Array(e));else{if(!yo){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}s=yo(new Uint8Array(e))}r=new DataView(s.buffer)}else i=n.offset;return s(e.tables,{tag:n.tag,offset:i,length:n.origLength},r)}))}))}const _o=io();let So;class jo extends po{constructor(e,t,s){const{p:n}=super({offset:0,length:48},t,"woff2");this.signature=n.tag,this.flavor=n.uint32,this.length=n.uint32,this.numTables=n.uint16,n.uint16,this.totalSfntSize=n.uint32,this.totalCompressedSize=n.uint32,this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.metaOffset=n.uint32,this.metaLength=n.uint32,this.metaOrigLength=n.uint32,this.privOffset=n.uint32,this.privLength=n.uint32,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Co(n)));let i,r=n.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let s=this.directory[t+1];s&&(s.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let o=t.buffer.slice(r);if(_o)i=_o(new Uint8Array(o));else{if(!So){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}i=new Uint8Array(So(o))}!function(e,t,s){e.tables={},e.directory.forEach((n=>{fo(e.tables,n.tag.trim(),(()=>{const i=n.offset,r=i+(n.transformLength?n.transformLength:n.origLength),o=new DataView(t.slice(i,r).buffer);try{return s(e.tables,{tag:n.tag,offset:0,length:n.origLength},o)}catch(e){console.error(e)}}))}))}(this,i,s)}}class Co{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 s=0!==(this.transformVersion=(192&this.flags)>>6);"glyf"!==this.tag&&"loca"!==this.tag||(s=3!==this.transformVersion),this.origLength=e.uint128,s&&(this.transformLength=e.uint128)}}const ko={};let Eo=!1;function Po(e,t,s){let n=t.tag.replace(/[^\w\d]/g,""),i=ko[n];return i?new i(t,s,e):(console.warn(`lib-font has no definition for ${n}. The table was skipped.`),{})}function Io(){let e=0;function t(s,n){if(!Eo)return e>10?n(new Error("loading took too long")):(e++,setTimeout((()=>t(s)),250));s(Po)}return new Promise(((e,s)=>t(e)))}async function To(e,t,s={}){if(!globalThis.document)return;let n=function(e,t){let s=e.lastIndexOf("."),n=(e.substring(s+1)||"").toLowerCase(),i={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[n];if(i)return i;let r={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."}[n];if(r||(r=`${e} is not a known webfont format.`),t)throw new Error(r);console.warn(`Could not load font: ${r}`)}(t,s.errorOnStyle);if(!n)return;let i=document.createElement("style");i.className="injected-by-Font-js";let r=[];return s.styleRules&&(r=Object.entries(s.styleRules).map((([e,t])=>`${e}: ${t};`))),i.textContent=`\n@font-face {\n font-family: "${e}";\n ${r.join("\n\t")}\n src: url("${t}") format("${n}");\n}`,globalThis.document.head.appendChild(i),i}Promise.all([Promise.resolve().then((function(){return $o})),Promise.resolve().then((function(){return ea})),Promise.resolve().then((function(){return ta})),Promise.resolve().then((function(){return na})),Promise.resolve().then((function(){return ia})),Promise.resolve().then((function(){return aa})),Promise.resolve().then((function(){return la})),Promise.resolve().then((function(){return ua})),Promise.resolve().then((function(){return wa})),Promise.resolve().then((function(){return Ma})),Promise.resolve().then((function(){return Tl})),Promise.resolve().then((function(){return Ol})),Promise.resolve().then((function(){return Nl})),Promise.resolve().then((function(){return Rl})),Promise.resolve().then((function(){return Bl})),Promise.resolve().then((function(){return Dl})),Promise.resolve().then((function(){return zl})),Promise.resolve().then((function(){return Gl})),Promise.resolve().then((function(){return Hl})),Promise.resolve().then((function(){return Ul})),Promise.resolve().then((function(){return Wl})),Promise.resolve().then((function(){return ql})),Promise.resolve().then((function(){return Kl})),Promise.resolve().then((function(){return $l})),Promise.resolve().then((function(){return tc})),Promise.resolve().then((function(){return sc})),Promise.resolve().then((function(){return nc})),Promise.resolve().then((function(){return ic})),Promise.resolve().then((function(){return rc})),Promise.resolve().then((function(){return lc})),Promise.resolve().then((function(){return pc})),Promise.resolve().then((function(){return gc})),Promise.resolve().then((function(){return yc})),Promise.resolve().then((function(){return wc})),Promise.resolve().then((function(){return _c})),Promise.resolve().then((function(){return Sc})),Promise.resolve().then((function(){return Cc})),Promise.resolve().then((function(){return kc})),Promise.resolve().then((function(){return Tc})),Promise.resolve().then((function(){return Oc})),Promise.resolve().then((function(){return Mc}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];ko[t]=e[t]})),Eo=!0}));const Oo=[0,1,0,0],Ao=[79,84,84,79],Mo=[119,79,70,70],No=[119,79,70,50];function Fo(e,t){if(e.length===t.length){for(let s=0;s{globalThis.document&&!this.options.skipStyleSheet&&await To(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((s=>this.fromDataBuffer(s,t||e))).catch((s=>{const n=new ao("error",s,`Failed to load font at ${t||e}`);this.dispatch(n),this.onerror&&this.onerror(n)}))}async fromDataBuffer(e,t){this.fontData=new DataView(e);let s=function(e){const t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];return Fo(t,Oo)||Fo(t,Ao)?"SFNT":Fo(t,Mo)?"WOFF":Fo(t,No)?"WOFF2":void 0}(this.fontData);if(!s)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(s);const n=new ao("load",{font:this});this.dispatch(n),this.onload&&this.onload(n)}async parseBasicData(e){return Io().then((t=>("SFNT"===e&&(this.opentype=new mo(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new xo(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new jo(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 s=document.createElement("div");s.textContent=e,s.style.fontFamily=this.name,s.style.fontSize=`${t}px`,s.style.color="transparent",s.style.background="transparent",s.style.top="0",s.style.left="0",s.style.position="absolute",document.body.appendChild(s);let n=s.getBoundingClientRect();document.body.removeChild(s);const i=this.opentype.tables["OS/2"];return n.fontSize=t,n.ascender=i.sTypoAscender,n.descender=i.sTypoDescender,n}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new ao("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 ao("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Vo;class Ro extends ho{constructor(e,t,s){super(e),this.plaformID=t,this.encodingID=s}}class Bo extends Ro{constructor(e,t,s){super(e,t,s),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 Do extends Ro{constructor(e,t,s){super(e,t,s),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map((t=>e.uint16));const n=Math.max(...this.subHeaderKeys),i=e.currentPosition;fo(this,"subHeaders",(()=>(e.currentPosition=i,[...new Array(n)].map((t=>new Lo(e))))));const r=i+8*n;fo(this,"glyphIndexArray",(()=>(e.currentPosition=r,[...new Array(n)].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,s=e&&65280,n=this.subHeaders[s],i=this.subHeaders[n],r=i.firstCode,o=r+i.entryCount;return r<=t&&t<=o}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 Lo{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 zo extends Ro{constructor(e,t,s){super(e,t,s),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 n=e.currentPosition;fo(this,"endCode",(()=>e.readBytes(this.segCount,n,16)));const i=n+2+this.segCountX2;fo(this,"startCode",(()=>e.readBytes(this.segCount,i,16)));const r=i+this.segCountX2;fo(this,"idDelta",(()=>e.readBytes(this.segCount,r,16,!0)));const o=r+this.segCountX2;fo(this,"idRangeOffset",(()=>e.readBytes(this.segCount,o,16)));const a=o+this.segCountX2,l=this.length-(a-this.tableStart);fo(this,"glyphIdArray",(()=>e.readBytes(l,a,16))),fo(this,"segments",(()=>this.buildSegments(o,a,e)))}buildSegments(e,t,s){return[...new Array(this.segCount)].map(((t,n)=>{let i=this.startCode[n],r=this.endCode[n],o=this.idDelta[n],a=this.idRangeOffset[n],l=e+2*n,c=[];if(0===a)for(let e=i+o,t=r+o;e<=t;e++)c.push(e);else for(let e=0,t=r-i;e<=t;e++)s.currentPosition=l+a+2*e,c.push(s.uint16);return{startCode:i,endCode:r,idDelta:o,idRangeOffset:a,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const s=t.startCode+t.glyphIDs.indexOf(e);return{code:s,unicode:String.fromCodePoint(s)}}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 Go extends Ro{constructor(e,t,s){super(e,t,s),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;fo(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 Ho extends Ro{constructor(e,t,s){super(e,t,s),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;fo(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Uo(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 Uo{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class Wo extends Ro{constructor(e,t,s){super(e,t,s),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;fo(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 qo extends Ro{constructor(e,t,s){super(e,t,s),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;fo(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Zo(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 s=t.startGlyphID;if(s>e)continue;if(s===e)return t.startCharCode;if(s+(t.endCharCode-t.startCharCode)({start:e.startCharCode,end:e.endCharCode})))}}class Zo{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class Ko extends Ro{constructor(e,t,s){super(e,t,s),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;fo(this,"groups",[...new Array(this.numGroups)].map((t=>new Yo(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 Yo{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class Xo extends Ro{constructor(e,t,s){super(e,t,s),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,fo(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new Jo(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 Jo{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class Qo{constructor(e,t){const s=this.platformID=e.uint16,n=this.encodingID=e.uint16,i=this.offset=e.Offset32;fo(this,"table",(()=>(e.currentPosition=t+i,function(e,t,s){const n=e.uint16;return 0===n?new Bo(e,t,s):2===n?new Do(e,t,s):4===n?new zo(e,t,s):6===n?new Go(e,t,s):8===n?new Ho(e,t,s):10===n?new Wo(e,t,s):12===n?new qo(e,t,s):13===n?new Ko(e,t,s):14===n?new Xo(e,t,s):{}}(e,s,n))))}}var $o=Object.freeze({__proto__:null,cmap:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numTables=s.uint16,this.encodingRecords=[...new Array(this.numTables)].map((e=>new Qo(s,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 s=this.encodingRecords.findIndex((s=>s.platformID===e&&s.encodingID===t));if(-1===s)return!1;return this.getSubTable(s).getSupportedCharCodes()}reverse(e){for(let t=0;t{let i=this.getSubTable(n);return!!i.getGlyphId&&(t=i.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,s)=>{const n=this.getSubTable(s);return n.supports&&!1!==n.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,s)=>{const n=this.getSubTable(s);return n.supportsVariation&&!1!==n.supportsVariation(e)}))}}});var ea=Object.freeze({__proto__:null,head:class extends po{constructor(e,t){const{p:s}=super(e,t);this.load({majorVersion:s.uint16,minorVersion:s.uint16,fontRevision:s.fixed,checkSumAdjustment:s.uint32,magicNumber:s.uint32,flags:s.flags(16),unitsPerEm:s.uint16,created:s.longdatetime,modified:s.longdatetime,xMin:s.int16,yMin:s.int16,xMax:s.int16,yMax:s.int16,macStyle:s.flags(16),lowestRecPPEM:s.uint16,fontDirectionHint:s.uint16,indexToLocFormat:s.uint16,glyphDataFormat:s.uint16})}}});var ta=Object.freeze({__proto__:null,hhea:class extends po{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.ascender=s.fword,this.descender=s.fword,this.lineGap=s.fword,this.advanceWidthMax=s.ufword,this.minLeftSideBearing=s.fword,this.minRightSideBearing=s.fword,this.xMaxExtent=s.fword,this.caretSlopeRise=s.int16,this.caretSlopeRun=s.int16,this.caretOffset=s.int16,s.int16,s.int16,s.int16,s.int16,this.metricDataFormat=s.int16,this.numberOfHMetrics=s.uint16,s.verifyLength()}}});class sa{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var na=Object.freeze({__proto__:null,hmtx:class extends po{constructor(e,t,s){const{p:n}=super(e,t),i=s.hhea.numberOfHMetrics,r=s.maxp.numGlyphs,o=n.currentPosition;if(fo(this,"hMetrics",(()=>(n.currentPosition=o,[...new Array(i)].map((e=>new sa(n.uint16,n.int16)))))),i(n.currentPosition=e,[...new Array(r-i)].map((e=>n.int16)))))}}}});var ia=Object.freeze({__proto__:null,maxp:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.legacyFixed,this.numGlyphs=s.uint16,1===this.version&&(this.maxPoints=s.uint16,this.maxContours=s.uint16,this.maxCompositePoints=s.uint16,this.maxCompositeContours=s.uint16,this.maxZones=s.uint16,this.maxTwilightPoints=s.uint16,this.maxStorage=s.uint16,this.maxFunctionDefs=s.uint16,this.maxInstructionDefs=s.uint16,this.maxStackElements=s.uint16,this.maxSizeOfInstructions=s.uint16,this.maxComponentElements=s.uint16,this.maxComponentDepth=s.uint16),s.verifyLength()}}});class ra{constructor(e,t){this.length=e,this.offset=t}}class oa{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,fo(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:s,length:n}=t;if(0===n)return"";if(0===s||3===s){const t=[];for(let s=0,i=n/2;snew oa(s,this))),1===this.format&&(this.langTagCount=s.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new ra(s.uint16,s.Offset16)))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find((t=>t.nameID===e));if(t)return t.string}}});var la=Object.freeze({__proto__:null,OS2:class extends po{constructor(e,t){const{p:s}=super(e,t);return this.version=s.uint16,this.xAvgCharWidth=s.int16,this.usWeightClass=s.uint16,this.usWidthClass=s.uint16,this.fsType=s.uint16,this.ySubscriptXSize=s.int16,this.ySubscriptYSize=s.int16,this.ySubscriptXOffset=s.int16,this.ySubscriptYOffset=s.int16,this.ySuperscriptXSize=s.int16,this.ySuperscriptYSize=s.int16,this.ySuperscriptXOffset=s.int16,this.ySuperscriptYOffset=s.int16,this.yStrikeoutSize=s.int16,this.yStrikeoutPosition=s.int16,this.sFamilyClass=s.int16,this.panose=[...new Array(10)].map((e=>s.uint8)),this.ulUnicodeRange1=s.flags(32),this.ulUnicodeRange2=s.flags(32),this.ulUnicodeRange3=s.flags(32),this.ulUnicodeRange4=s.flags(32),this.achVendID=s.tag,this.fsSelection=s.uint16,this.usFirstCharIndex=s.uint16,this.usLastCharIndex=s.uint16,this.sTypoAscender=s.int16,this.sTypoDescender=s.int16,this.sTypoLineGap=s.int16,this.usWinAscent=s.uint16,this.usWinDescent=s.uint16,0===this.version?s.verifyLength():(this.ulCodePageRange1=s.flags(32),this.ulCodePageRange2=s.flags(32),1===this.version?s.verifyLength():(this.sxHeight=s.int16,this.sCapHeight=s.int16,this.usDefaultChar=s.uint16,this.usBreakChar=s.uint16,this.usMaxContext=s.uint16,this.version<=4?s.verifyLength():(this.usLowerOpticalPointSize=s.uint16,this.usUpperOpticalPointSize=s.uint16,5===this.version?s.verifyLength():void 0)))}}});const ca=[".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 ua=Object.freeze({__proto__:null,post:class extends po{constructor(e,t){const{p:s}=super(e,t);if(this.version=s.legacyFixed,this.italicAngle=s.fixed,this.underlinePosition=s.fword,this.underlineThickness=s.fword,this.isFixedPitch=s.uint32,this.minMemType42=s.uint32,this.maxMemType42=s.uint32,this.minMemType1=s.uint32,this.maxMemType1=s.uint32,1===this.version||3===this.version)return s.verifyLength();if(this.numGlyphs=s.uint16,2===this.version){this.glyphNameIndex=[...new Array(this.numGlyphs)].map((e=>s.uint16)),this.namesOffset=s.currentPosition,this.glyphNameOffsets=[1];for(let e=0;es.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 ca[t];let s=this.glyphNameOffsets[e],n=this.glyphNameOffsets[e+1]-s-1;if(0===n)return".notdef.";this.parser.currentPosition=this.namesOffset+s;return this.parser.readBytes(n,this.namesOffset+s,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class da extends po{constructor(e,t){const{p:s}=super(e,t,"AxisTable");this.baseTagListOffset=s.Offset16,this.baseScriptListOffset=s.Offset16,fo(this,"baseTagList",(()=>new ha({offset:e.offset+this.baseTagListOffset},t))),fo(this,"baseScriptList",(()=>new pa({offset:e.offset+this.baseScriptListOffset},t)))}}class ha extends po{constructor(e,t){const{p:s}=super(e,t,"BaseTagListTable");this.baseTagCount=s.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map((e=>s.tag))}}class pa extends po{constructor(e,t){const{p:s}=super(e,t,"BaseScriptListTable");this.baseScriptCount=s.uint16;const n=s.currentPosition;fo(this,"baseScriptRecords",(()=>(s.currentPosition=n,[...new Array(this.baseScriptCount)].map((e=>new fa(this.start,s))))))}}class fa{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,fo(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new ma(t))))}}class ma{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 ga(this.start,e))),fo(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new va(e)))),fo(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new ya(e))))}}class ga{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,fo(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new ya(t))))}}class va{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 ba(this.parser)}}class ya{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;fo(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new xa(e))))))}}class xa{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class ba{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 wa=Object.freeze({__proto__:null,BASE:class extends po{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.horizAxisOffset=s.Offset16,this.vertAxisOffset=s.Offset16,fo(this,"horizAxis",(()=>new da({offset:e.offset+this.horizAxisOffset},t))),fo(this,"vertAxis",(()=>new da({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=s.Offset32,fo(this,"itemVarStore",(()=>new da({offset:e.offset+this.itemVarStoreOffset},t))))}}});class _a{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 Sa(e))))}}class Sa{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class ja extends ho{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 Ca(e))))}}class Ca{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class ka{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 Ea extends ho{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 Pa(this.parser)}}class Pa{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class Ia extends ho{constructor(e){super(e),this.coverageOffset=e.Offset16,fo(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new ja(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 Ta(this.parser)}}class Ta extends ho{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 Oa(this.parser)}}class Oa{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 Aa extends ho{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 ja(this.parser)}}var Ma=Object.freeze({__proto__:null,GDEF:class extends po{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.glyphClassDefOffset=s.Offset16,fo(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return s.currentPosition=this.tableStart+this.glyphClassDefOffset,new _a(s)})),this.attachListOffset=s.Offset16,fo(this,"attachList",(()=>{if(0!==this.attachListOffset)return s.currentPosition=this.tableStart+this.attachListOffset,new Ea(s)})),this.ligCaretListOffset=s.Offset16,fo(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return s.currentPosition=this.tableStart+this.ligCaretListOffset,new Ia(s)})),this.markAttachClassDefOffset=s.Offset16,fo(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return s.currentPosition=this.tableStart+this.markAttachClassDefOffset,new _a(s)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=s.Offset16,fo(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return s.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new Aa(s)}))),3===this.minorVersion&&(this.itemVarStoreOffset=s.Offset32,fo(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return s.currentPosition=this.tableStart+this.itemVarStoreOffset,new ka(s)})))}}});class Na extends ho{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new Fa(e)))}}class Fa{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Va extends ho{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new Ra(e)))}}class Ra{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class Ba{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 Da extends ho{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new La(e)))}}class La{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class za extends ho{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 Ha(e);if(t.startsWith("cc"))return new Ga(e);if(t.startsWith("ss"))return new Ua(e)}}}class Ga{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 Ha{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class Ua{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function Wa(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class qa extends ho{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 ja(e)}}class Za{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Ka extends qa{constructor(e){super(e),this.deltaGlyphID=e.int16}}class Ya extends qa{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 Xa(t)}}class Xa{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Ja extends qa{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 Qa(t)}}class Qa{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class $a extends qa{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 el(t)}}class el extends ho{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 tl(t)}}class tl{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class sl extends qa{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&&(Wa(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 Za(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 nl(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 rl(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 ja(t)}}class nl extends ho{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 il(t)}}class il{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 Za(e)))}}class rl extends ho{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 ol(t)}}class ol extends il{constructor(e){super(e)}}class al extends qa{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&&(Wa(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 hl(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 ll(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 ul(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 ja(t)}}class ll extends ho{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 cl(t)}}class cl{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 Za(e)))}}class ul extends ho{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 dl(t)}}class dl{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 hl(e)))}}class hl extends ho{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class pl extends ho{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class fl extends qa{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 ml={buildSubtable:function(e,t){const s=new[void 0,Ka,Ya,Ja,$a,sl,al,pl,fl][e](t);return s.type=e,s}};class gl extends ho{constructor(e){super(e)}}class vl extends gl{constructor(e){super(e),console.log("lookup type 1")}}class yl extends gl{constructor(e){super(e),console.log("lookup type 2")}}class xl extends gl{constructor(e){super(e),console.log("lookup type 3")}}class bl extends gl{constructor(e){super(e),console.log("lookup type 4")}}class wl extends gl{constructor(e){super(e),console.log("lookup type 5")}}class _l extends gl{constructor(e){super(e),console.log("lookup type 6")}}class Sl extends gl{constructor(e){super(e),console.log("lookup type 7")}}class jl extends gl{constructor(e){super(e),console.log("lookup type 8")}}class Cl extends gl{constructor(e){super(e),console.log("lookup type 9")}}var kl={buildSubtable:function(e,t){const s=new[void 0,vl,yl,xl,bl,wl,_l,Sl,jl,Cl][e](t);return s.type=e,s}};class El extends ho{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class Pl extends ho{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?ml:kl;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class Il extends po{constructor(e,t,s){const{p:n,tableStart:i}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.scriptListOffset=n.Offset16,this.featureListOffset=n.Offset16,this.lookupListOffset=n.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=n.Offset32);const r=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);fo(this,"scriptList",(()=>r?Na.EMPTY:(n.currentPosition=i+this.scriptListOffset,new Na(n)))),fo(this,"featureList",(()=>r?Da.EMPTY:(n.currentPosition=i+this.featureListOffset,new Da(n)))),fo(this,"lookupList",(()=>r?El.EMPTY:(n.currentPosition=i+this.lookupListOffset,new El(n)))),this.featureVariationsOffset&&fo(this,"featureVariations",(()=>r?FeatureVariations.EMPTY:(n.currentPosition=i+this.featureVariationsOffset,new FeatureVariations(n))))}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 s=new Va(this.parser);return s.scriptTag=e,s}ensureScriptTable(e){return"string"==typeof e?this.getScriptTable(e):e}getSupportedLangSys(e){const t=0!==(e=this.ensureScriptTable(e)).defaultLangSys,s=e.langSysRecords.map((e=>e.langSysTag));return t&&s.unshift("dflt"),s}getDefaultLangSysTable(e){let t=(e=this.ensureScriptTable(e)).defaultLangSys;if(0!==t){this.parser.currentPosition=e.start+t;let s=new Ba(this.parser);return s.langSysTag="",s.defaultForScript=e.scriptTag,s}}getLangSysTable(e,t="dflt"){if("dflt"===t)return this.getDefaultLangSysTable(e);let s=(e=this.ensureScriptTable(e)).langSysRecords.find((e=>e.langSysTag===t));this.parser.currentPosition=e.start+s.langSysOffset;let n=new Ba(this.parser);return n.langSysTag=t,n}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 s=new za(this.parser);return s.featureTag=t.featureTag,s}getLookups(e){return e.lookupListIndices.map((e=>this.getLookup(e)))}getLookup(e,t){let s=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+s,new Pl(this.parser,t)}}var Tl=Object.freeze({__proto__:null,GSUB:class extends Il{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var Ol=Object.freeze({__proto__:null,GPOS:class extends Il{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class Al extends ho{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Ml(e)))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let s=this.start+t.svgDocOffset;return this.parser.currentPosition=s,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 Ml{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var Nl=Object.freeze({__proto__:null,SVG:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.offsetToSVGDocumentList=s.Offset32,s.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new Al(s)}}});class Fl{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 Vl{constructor(e,t,s){let n=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-n(s.currentPosition=n,[...new Array(this.axisCount)].map((e=>new Fl(s))))));const i=n+this.axisCount*this.axisSize;fo(this,"instances",(()=>{let e=[];for(let t=0;te.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var Bl=Object.freeze({__proto__:null,cvt:class extends po{constructor(e,t){const{p:s}=super(e,t),n=e.length/2;fo(this,"items",(()=>[...new Array(n)].map((e=>s.fword))))}}});var Dl=Object.freeze({__proto__:null,fpgm:class extends po{constructor(e,t){const{p:s}=super(e,t);fo(this,"instructions",(()=>[...new Array(e.length)].map((e=>s.uint8))))}}});class Ll{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var zl=Object.freeze({__proto__:null,gasp:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numRanges=s.uint16;fo(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Ll(s)))))}}});var Gl=Object.freeze({__proto__:null,glyf:class extends po{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var Hl=Object.freeze({__proto__:null,loca:class extends po{constructor(e,t,s){const{p:n}=super(e,t),i=s.maxp.numGlyphs+1;0===s.head.indexToLocFormat?(this.x2=!0,fo(this,"offsets",(()=>[...new Array(i)].map((e=>n.Offset16))))):fo(this,"offsets",(()=>[...new Array(i)].map((e=>n.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 Ul=Object.freeze({__proto__:null,prep:class extends po{constructor(e,t){const{p:s}=super(e,t);fo(this,"instructions",(()=>[...new Array(e.length)].map((e=>s.uint8))))}}});var Wl=Object.freeze({__proto__:null,CFF:class extends po{constructor(e,t){const{p:s}=super(e,t);fo(this,"data",(()=>s.readBytes()))}}});var ql=Object.freeze({__proto__:null,CFF2:class extends po{constructor(e,t){const{p:s}=super(e,t);fo(this,"data",(()=>s.readBytes()))}}});class Zl{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var Kl=Object.freeze({__proto__:null,VORG:class extends po{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.defaultVertOriginY=s.int16,this.numVertOriginYMetrics=s.uint16,fo(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new Zl(s)))))}}});class Yl{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new Jl(e),this.vert=new Jl(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 Xl{constructor(e){this.hori=new Jl(e),this.vert=new Jl(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class Jl{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 Ql extends po{constructor(e,t,s){const{p:n}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,fo(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new Yl(n)))))}}var $l=Object.freeze({__proto__:null,EBLC:Ql});class ec extends po{constructor(e,t,s){const{p:n}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16}}var tc=Object.freeze({__proto__:null,EBDT:ec});var sc=Object.freeze({__proto__:null,EBSC:class extends po{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.numSizes=s.uint32,fo(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new Xl(s)))))}}});var nc=Object.freeze({__proto__:null,CBLC:class extends Ql{constructor(e,t){super(e,t,"CBLC")}}});var ic=Object.freeze({__proto__:null,CBDT:class extends ec{constructor(e,t){super(e,t,"CBDT")}}});var rc=Object.freeze({__proto__:null,sbix:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.flags=s.flags(16),this.numStrikes=s.uint32,fo(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>s.Offset32))))}}});class oc{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class ac{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var lc=Object.freeze({__proto__:null,COLR:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numBaseGlyphRecords=s.uint16,this.baseGlyphRecordsOffset=s.Offset32,this.layerRecordsOffset=s.Offset32,this.numLayerRecords=s.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let s=new oc(this.parser),n=s.gID,i=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=i;let r=new oc(this.parser),o=r.gID;if(n===e)return s;if(o===e)return r;for(;t!==i;){let s=t+(i-t)/12;this.parser.currentPosition=s;let n=new oc(this.parser),r=n.gID;if(r===e)return n;r>e?i=s:rnew ac(p)))}}});class cc{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class uc{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class dc{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class hc{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var pc=Object.freeze({__proto__:null,CPAL:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numPaletteEntries=s.uint16;const n=this.numPalettes=s.uint16;this.numColorRecords=s.uint16,this.offsetFirstColorRecord=s.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>s.uint16)),fo(this,"colorRecords",(()=>(s.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new cc(s)))))),1===this.version&&(this.offsetPaletteTypeArray=s.Offset32,this.offsetPaletteLabelArray=s.Offset32,this.offsetPaletteEntryLabelArray=s.Offset32,fo(this,"paletteTypeArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new uc(s,n)))),fo(this,"paletteLabelArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new dc(s,n)))),fo(this,"paletteEntryLabelArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new hc(s,n)))))}}});class fc{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class mc{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var gc=Object.freeze({__proto__:null,DSIG:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint32,this.numSignatures=s.uint16,this.flags=s.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map((e=>new fc(s)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new mc(this.parser)}}});class vc{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var yc=Object.freeze({__proto__:null,hdmx:class extends po{constructor(e,t,s){const{p:n}=super(e,t),i=s.hmtx.numGlyphs;this.version=n.uint16,this.numRecords=n.int16,this.sizeDeviceRecord=n.int32,this.records=[...new Array(numRecords)].map((e=>new vc(n,i)))}}});class xc{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,fo(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new bc(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 bc{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var wc=Object.freeze({__proto__:null,kern:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.nTables=s.uint16,fo(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let n=0;n[...new Array(this.mergeClassCount)].map((e=>s.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 jc{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 Cc=Object.freeze({__proto__:null,meta:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint32,this.flags=s.uint32,s.uint32,this.dataMapsCount=s.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map((e=>new jc(this.tableStart,s)))}}});var kc=Object.freeze({__proto__:null,PCLT:class extends po{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 Ec{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class Pc{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new Ic(e)))}}class Ic{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var Tc=Object.freeze({__proto__:null,VDMX:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numRecs=s.uint16,this.numRatios=s.uint16,this.ratRanges=[...new Array(this.numRatios)].map((e=>new Ec(s))),this.offsets=[...new Array(this.numRatios)].map((e=>s.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new Pc(s)))}}});var Oc=Object.freeze({__proto__:null,vhea:class extends po{constructor(e,t){const{p:s}=super(e,t);this.version=s.fixed,this.ascent=this.vertTypoAscender=s.int16,this.descent=this.vertTypoDescender=s.int16,this.lineGap=this.vertTypoLineGap=s.int16,this.advanceHeightMax=s.int16,this.minTopSideBearing=s.int16,this.minBottomSideBearing=s.int16,this.yMaxExtent=s.int16,this.caretSlopeRise=s.int16,this.caretSlopeRun=s.int16,this.caretOffset=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.metricDataFormat=s.int16,this.numOfLongVerMetrics=s.uint16,s.verifyLength()}}});class Ac{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Mc=Object.freeze({__proto__:null,vmtx:class extends po{constructor(e,t,s){super(e,t);const n=s.vhea.numOfLongVerMetrics,i=s.maxp.numGlyphs,r=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=r,[...new Array(n)].map((e=>new Ac(p.uint16,p.int16)))))),n(p.currentPosition=e,[...new Array(i-n)].map((e=>p.int16)))))}}}});const{kebabCase:Nc}=se(x.privateApis);const Fc=function(){const{installFonts:e,notice:t,setNotice:s}=(0,d.useContext)(Dr),[n,i]=(0,d.useState)(!1),r=async e=>{s(null),i(!0);const t=new Set,n=[...e];let r=!1;const l=n.map((async e=>{const s=await async function(e){const t=new Vo("Uploaded Font");try{const s=await a(e);return await t.fromDataBuffer(s,"font"),!0}catch(e){return!1}}(e);if(!s)return r=!0,null;if(t.has(e.name))return null;const n=e.name.split(".").pop().toLowerCase();return wr.includes(n)?(t.add(e.name),e):null})),c=(await Promise.all(l)).filter((e=>null!==e));if(c.length>0)o(c);else{const e=r?(0,b.__)("Sorry, you are not allowed to upload this file type."):(0,b.__)("No fonts found to install.");s({type:"error",message:e}),i(!1)}},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await l(e);return await Tr(t,t.file,"all"),t})));c(t)};async function a(e){return new Promise(((t,s)=>{const n=new window.FileReader;n.readAsArrayBuffer(e),n.onload=()=>t(n.result),n.onerror=s}))}const l=async e=>{const t=await a(e),s=new Vo("Uploaded Font");s.fromDataBuffer(t,e.name);const n=(await new Promise((e=>s.onload=e))).detail.font,{name:i}=n.opentype.tables,r=i.get(16)||i.get(1),o=i.get(2).toLowerCase().includes("italic"),l=n.opentype.tables["OS/2"].usWeightClass||"normal",c=!!n.opentype.tables.fvar&&n.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:r,fontStyle:o?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||l}},c=async t=>{const n=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:Nc(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(n),s({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){s({type:"error",message:e.message,errors:e?.installationErrors})}i(!1)};return(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[(0,me.jsx)(x.DropZone,{onFilesDrop:e=>{r(e)}}),(0,me.jsxs)(x.__experimentalVStack,{className:"font-library-modal__local-fonts",children:[t&&(0,me.jsxs)(x.Notice,{status:t.type,__unstableHTML:!0,onRemove:()=>s(null),children:[t.message,t.errors&&(0,me.jsx)("ul",{children:t.errors.map(((e,t)=>(0,me.jsx)("li",{children:e},t)))})]}),n&&(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)("div",{className:"font-library-modal__upload-area",children:(0,me.jsx)(x.ProgressBar,{})})}),!n&&(0,me.jsx)(x.FormFileUpload,{accept:wr.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{r(e.target.files)},render:({openFileDialog:e})=>(0,me.jsx)(x.Button,{className:"font-library-modal__upload-area",onClick:e,children:(0,b.__)("Upload font")})}),(0,me.jsx)(x.__experimentalSpacer,{margin:2}),(0,me.jsx)(x.__experimentalText,{className:"font-library-modal__upload-area__text",children:(0,b.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})},{Tabs:Vc}=se(x.privateApis),Rc={id:"installed-fonts",title:(0,b._x)("Library","Font library")},Bc={id:"upload-fonts",title:(0,b.__)("Upload")};const Dc=function({onRequestClose:e,defaultTabId:t="installed-fonts"}){const{collections:s,setNotice:n}=(0,d.useContext)(Dr),i=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return t("create","font-families")}),[]),r=[Rc];return i&&(r.push(Bc),r.push(...(e=>e.map((({slug:t,name:s})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,b.__)("Install Fonts"):s}))))(s||[]))),(0,me.jsx)(x.Modal,{title:(0,b.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,me.jsx)("div",{className:"font-library-modal__tabs",children:(0,me.jsxs)(Vc,{defaultTabId:t,onSelect:()=>{n(null)},children:[(0,me.jsx)(Vc.TabList,{children:r.map((({id:e,title:t})=>(0,me.jsx)(Vc.Tab,{tabId:e,children:t},e)))}),r.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,me.jsx)(Fc,{});break;case"installed-fonts":t=(0,me.jsx)(Yr,{});break;default:t=(0,me.jsx)(so,{slug:e})}return(0,me.jsx)(Vc.TabPanel,{tabId:e,focusable:!1,children:t},e)}))]})})})};const Lc=function({font:e}){const{handleSetLibraryFontSelected:t,setModalTabOpen:s}=(0,d.useContext)(Dr),n=e?.fontFace?.length||1,i=ni(e);return(0,me.jsx)(x.__experimentalItem,{onClick:()=>{t(e),s("installed-fonts")},children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{style:i,children:e.name}),(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count",children:(0,b.sprintf)((0,b._n)("%d variant","%d variants",n),n)})]})})},{useGlobalSetting:zc}=se(y.privateApis);function Gc(){const{modalTabOpen:e,setModalTabOpen:t}=(0,d.useContext)(Dr),[s]=zc("typography.fontFamilies"),n=s?.theme?s.theme.map((e=>kr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],i=s?.custom?s.custom.map((e=>kr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],r=0t(null),defaultTabId:e}),(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Di,{level:3,children:(0,b.__)("Fonts")}),(0,me.jsx)(x.Button,{onClick:()=>t("installed-fonts"),label:(0,b.__)("Manage fonts"),icon:hr,size:"small"})]}),r?(0,me.jsxs)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[i.map((e=>(0,me.jsx)(Lc,{font:e},e.slug))),n.map((e=>(0,me.jsx)(Lc,{font:e},e.slug)))]}):(0,me.jsxs)(me.Fragment,{children:[(0,b.__)("No fonts installed."),(0,me.jsx)(x.Button,{className:"edit-site-global-styles-font-families__add-fonts",variant:"secondary",onClick:()=>t("upload-fonts"),children:(0,b.__)("Add fonts")})]})]})]})}const Hc=({...e})=>(0,me.jsx)(Lr,{children:(0,me.jsx)(Gc,{...e})});const Uc=function(){const e=(0,l.useSelect)((e=>e(h.store).getEditorSettings().fontLibraryEnabled),[]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Typography"),description:(0,b.__)("Typography styles and the application of those styles on site elements.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:7,children:[!window.__experimentalDisableFontLibrary&&e&&(0,me.jsx)(Hc,{}),(0,me.jsx)(or,{}),(0,me.jsx)(dr,{title:(0,b.__)("Presets")})]})})]})},{useGlobalStyle:Wc,useGlobalSetting:qc,useSettingsForBlockElement:Zc,TypographyPanel:Kc}=se(y.privateApis);function Yc({element:e,headingLevel:t}){let s=[];"heading"===e?s=s.concat(["elements",t]):e&&"text"!==e&&(s=s.concat(["elements",e]));const n=s.join("."),[i]=Wc(n,void 0,"user",{shouldDecodeEncode:!1}),[r,o]=Wc(n,void 0,"all",{shouldDecodeEncode:!1}),[a]=qc(""),l=Zc(a,void 0,"heading"===e?t:e);return(0,me.jsx)(Kc,{inheritedValue:r,value:i,onChange:o,settings:l})}const{useGlobalStyle:Xc}=se(y.privateApis);function Jc({name:e,element:t,headingLevel:s}){var n;let i="";"heading"===t?i=`elements.${s}.`:t&&"text"!==t&&(i=`elements.${t}.`);const[r]=Xc(i+"typography.fontFamily",e),[o]=Xc(i+"color.gradient",e),[a]=Xc(i+"color.background",e),[l]=Xc("color.background"),[c]=Xc(i+"color.text",e),[u]=Xc(i+"typography.fontSize",e),[d]=Xc(i+"typography.fontStyle",e),[h]=Xc(i+"typography.fontWeight",e),[p]=Xc(i+"typography.letterSpacing",e),f="link"===t?{textDecoration:"underline"}:{};return(0,me.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!==(n=null!=o?o:a)&&void 0!==n?n:l,color:c,fontSize:u,fontStyle:d,fontWeight:h,letterSpacing:p,...f},children:"Aa"})}const Qc={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 $c=function({element:e}){const[t,s]=(0,d.useState)("heading");return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:Qc[e].title,description:Qc[e].description}),(0,me.jsx)(x.__experimentalSpacer,{marginX:4,children:(0,me.jsx)(Jc,{element:e,headingLevel:t})}),"heading"===e&&(0,me.jsx)(x.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,me.jsxs)(x.__experimentalToggleGroupControl,{label:(0,b.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:s,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"heading",label:(0,b._x)("All","heading levels")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h1",label:(0,b.__)("H1")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h2",label:(0,b.__)("H2")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h3",label:(0,b.__)("H3")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h4",label:(0,b.__)("H4")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h5",label:(0,b.__)("H5")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h6",label:(0,b.__)("H6")})]})}),(0,me.jsx)(Yc,{element:e,headingLevel:t})]})};const eu=(0,d.forwardRef)((function({icon:e,size:t=24,...s},n){return(0,d.cloneElement)(e,{width:t,height:t,...s,ref:n})})),tu=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG",children:(0,me.jsx)(us.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 su=function({className:e,...t}){return(0,me.jsx)(x.Flex,{className:Qt("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:nu}=se(y.privateApis),iu=[];const ru=function({name:e}){const[t]=nu("color.palette.custom"),[s]=nu("color.palette.theme"),[n]=nu("color.palette.default"),[i]=nu("color.defaultPalette",e),[r]=function(e){const[t,s]=ce("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),n=t.map((t=>{const{color:s}=t,n=Y(s).rotate(e).toHex();return{...t,color:n}}));s(n)}]:[]}(),o=(0,d.useMemo)((()=>[...t||iu,...s||iu,...n&&i?n:iu]),[t,s,n,i]),a=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette",l=o.length>0?(0,b.__)("Edit palette"):(0,b.__)("Add colors");return(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Di,{level:3,children:(0,b.__)("Palette")}),(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,me.jsx)(Wn,{path:a,"aria-label":l,children:(0,me.jsxs)(x.__experimentalHStack,{direction:"row",children:[o.length<=0&&(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Add colors")}),(0,me.jsx)(x.__experimentalZStack,{isLayered:!1,offset:-8,children:o.slice(0,5).map((({color:e},t)=>(0,me.jsx)(su,{children:(0,me.jsx)(x.ColorIndicator,{colorValue:e})},`${e}-${t}`)))}),(0,me.jsx)(eu,{icon:(0,b.isRTL)()?zn:Gn})]})})}),window.__experimentalEnableColorRandomizer&&s?.length>0&&(0,me.jsx)(x.Button,{variant:"secondary",icon:tu,onClick:r,children:(0,b.__)("Randomize colors")})]})},{useGlobalStyle:ou,useGlobalSetting:au,useSettingsForBlockElement:lu,ColorPanel:cu}=se(y.privateApis);const uu=function(){const[e]=ou("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=ou("",void 0,"all",{shouldDecodeEncode:!1}),[n]=au(""),i=lu(n);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Colors"),description:(0,b.__)("Palette colors and the application of those colors on site elements.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:7,children:[(0,me.jsx)(ru,{}),(0,me.jsx)(cu,{inheritedValue:t,value:e,onChange:s,settings:i})]})})]})};function du(){const{paletteColors:e}=de();return e.slice(0,5).map((({slug:e,color:t},s)=>(0,me.jsx)("div",{style:{flexGrow:1,height:"100%",background:t}},`${e}-${s}`)))}const hu={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},pu=({label:e,isFocused:t,withHoverView:s})=>(0,me.jsx)(mi,{label:e,isFocused:t,withHoverView:s,children:({key:e})=>(0,me.jsx)(x.__unstableMotion.div,{variants:hu,style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(x.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(du,{})})},e)});function fu({title:e,gap:t=2}){const s=he();return s?.length<=1?null:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[e&&(0,me.jsx)(Di,{level:3,children:e}),(0,me.jsx)(x.__experimentalGrid,{spacing:t,children:s.map(((e,t)=>(0,me.jsx)(ur,{variation:e,isPill:!0,property:"color",children:()=>(0,me.jsx)(pu,{})},t)))})]})}const{useGlobalSetting:mu}=se(y.privateApis),gu={placement:"bottom-start",offset:8};function vu({name:e}){const[t,s]=mu("color.palette.theme",e),[n]=mu("color.palette.theme",e,"base"),[i,r]=mu("color.palette.default",e),[o]=mu("color.palette.default",e,"base"),[a,l]=mu("color.palette.custom",e),[c]=mu("color.defaultPalette",e),u=(0,v.useViewportMatch)("small","<")?gu:void 0;return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:t!==n,canOnlyChangeValues:!0,colors:t,onChange:s,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:u}),!!i&&!!i.length&&!!c&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,colors:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:u}),(0,me.jsx)(x.__experimentalPaletteEdit,{colors:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:u}),(0,me.jsx)(fu,{title:(0,b.__)("Palettes")})]})}const{useGlobalSetting:yu}=se(y.privateApis),xu={placement:"bottom-start",offset:8},bu=()=>{};function wu({name:e}){const[t,s]=yu("color.gradients.theme",e),[n]=yu("color.gradients.theme",e,"base"),[i,r]=yu("color.gradients.default",e),[o]=yu("color.gradients.default",e,"base"),[a,l]=yu("color.gradients.custom",e),[c]=yu("color.defaultGradients",e),[u]=yu("color.duotone.custom")||[],[d]=yu("color.duotone.default")||[],[h]=yu("color.duotone.theme")||[],[p]=yu("color.defaultDuotone"),f=[...u||[],...h||[],...d&&p?d:[]],m=(0,v.useViewportMatch)("small","<")?xu:void 0;return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:t!==n,canOnlyChangeValues:!0,gradients:t,onChange:s,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:m}),!!i&&!!i.length&&!!c&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,gradients:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelLevel:3,popoverProps:m}),(0,me.jsx)(x.__experimentalPaletteEdit,{gradients:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelLevel:3,slugPrefix:"custom-",popoverProps:m}),!!f&&!!f.length&&(0,me.jsxs)("div",{children:[(0,me.jsx)(Di,{level:3,children:(0,b.__)("Duotone")}),(0,me.jsx)(x.__experimentalSpacer,{margin:3}),(0,me.jsx)(x.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:bu})]})]})}const{Tabs:_u}=se(x.privateApis);const Su=function({name:e}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Edit palette"),description:(0,b.__)("The combination of colors used across the site and in color pickers.")}),(0,me.jsxs)(_u,{children:[(0,me.jsxs)(_u.TabList,{children:[(0,me.jsx)(_u.Tab,{tabId:"color",children:(0,b.__)("Color")}),(0,me.jsx)(_u.Tab,{tabId:"gradient",children:(0,b.__)("Gradient")})]}),(0,me.jsx)(_u.TabPanel,{tabId:"color",focusable:!1,children:(0,me.jsx)(vu,{name:e})}),(0,me.jsx)(_u.TabPanel,{tabId:"gradient",focusable:!1,children:(0,me.jsx)(wu,{name:e})})]})]})},ju=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),{useGlobalSetting:Cu}=se(y.privateApis),ku="6px 6px 9px rgba(0, 0, 0, 0.2)";function Eu(){const[e]=Cu("shadow.presets.default"),[t]=Cu("shadow.defaultPresets"),[s]=Cu("shadow.presets.theme"),[n,i]=Cu("shadow.presets.custom");return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Shadows"),description:(0,b.__)("Manage and create shadow styles for use across the site.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles__shadows-panel",spacing:7,children:[t&&(0,me.jsx)(Pu,{label:(0,b.__)("Default"),shadows:e||[],category:"default"}),s&&s.length>0&&(0,me.jsx)(Pu,{label:(0,b.__)("Theme"),shadows:s||[],category:"theme"}),(0,me.jsx)(Pu,{label:(0,b.__)("Custom"),shadows:n||[],category:"custom",canCreate:!0,onCreate:e=>{i([...n||[],e])}})]})})]})}function Pu({label:e,shadows:t,category:s,canCreate:n,onCreate:i}){const r=()=>{const e=function(e,t){const s=new RegExp(`^${t}([\\d]+)$`),n=e.reduce(((e,t)=>{if("string"==typeof t?.slug){const n=t?.slug.match(s);if(n){const t=parseInt(n[1],10);if(t>e)return t}}return e}),0);return n+1}(t,"shadow-");i({name:(0,b.sprintf)((0,b.__)("Shadow %s"),e),shadow:ku,slug:`shadow-${e}`})};return(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,me.jsx)(Di,{level:3,children:e})}),n&&(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,me.jsx)(x.Button,{size:"small",icon:ju,label:(0,b.__)("Add shadow"),onClick:()=>{r()}})})]}),t.length>0&&(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map((e=>(0,me.jsx)(Iu,{shadow:e,category:s},e.slug)))})]})}function Iu({shadow:e,category:t}){return(0,me.jsx)(Wn,{path:`/shadows/edit/${t}/${e.slug}`,"aria-label":(0,b.sprintf)("Edit shadow %s",e.name),icon:Kn,children:e.name})}const Tu=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M7 11.5h10V13H7z"})}),Ou={px:{max:20,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:10,step:.1},rm:{max:10,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};const{useGlobalSetting:Au}=se(y.privateApis),{DropdownMenuV2:Mu,DropdownMenuItemV2:Nu,DropdownMenuItemLabelV2:Fu}=se(x.privateApis),Vu=[{label:(0,b.__)("Rename"),action:"rename"},{label:(0,b.__)("Delete"),action:"delete"}],Ru=[{label:(0,b.__)("Reset"),action:"reset"}];function Bu(){const{params:{category:e,slug:t},goTo:s}=(0,x.__experimentalUseNavigator)(),[n,i]=Au(`shadow.presets.${e}`),[r]=Au(`shadow.presets.${e}`,void 0,"base"),[o,a]=(0,d.useState)((()=>(n||[]).find((e=>e.slug===t)))),l=(0,d.useMemo)((()=>(r||[]).find((e=>e.slug===t))),[r,t]),[c,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(!1),[f,m]=(0,d.useState)(o.name);return o?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Ei,{title:o.name}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,me.jsx)(Mu,{trigger:(0,me.jsx)(x.Button,{size:"small",icon:Ln,label:(0,b.__)("Menu")}),children:("custom"===e?Vu:Ru).map((e=>(0,me.jsx)(Nu,{onClick:()=>(e=>{if("reset"===e){const e=n.map((e=>e.slug===t?l:e));a(l),i(e)}else"delete"===e?u(!0):"rename"===e&&p(!0)})(e.action),disabled:"reset"===e.action&&o.shadow===l.shadow,children:(0,me.jsx)(Fu,{children:e.label})},e.action)))})})})]}),(0,me.jsxs)("div",{className:"edit-site-global-styles-screen",children:[(0,me.jsx)(Du,{shadow:o.shadow}),(0,me.jsx)(Lu,{shadow:o.shadow,onChange:e=>{a({...o,shadow:e});const s=n.map((s=>s.slug===t?{...o,shadow:e}:s));i(s)}})]}),c&&(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{(()=>{const e=n.filter((e=>e.slug!==t));i(e),s("/shadows")})(),u(!1)},onCancel:()=>{u(!1)},confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.sprintf)('Are you sure you want to delete "%s"?',o.name)}),h&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>p(!1),size:"small",children:(0,me.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(e=>{if(!e)return;const s=n.map((s=>s.slug===t?{...o,name:e}:s));a({...o,name:e}),i(s)})(f),p(!1)},children:[(0,me.jsx)(x.__experimentalInputControl,{autoComplete:"off",label:(0,b.__)("Name"),placeholder:(0,b.__)("Shadow name"),value:f,onChange:e=>m(e)}),(0,me.jsx)(x.__experimentalSpacer,{marginBottom:6}),(0,me.jsxs)(x.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>p(!1),children:(0,b.__)("Cancel")})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{variant:"primary",type:"submit",children:(0,b.__)("Save")})})]})]})})]}):(0,me.jsx)(Ei,{title:""})}function Du({shadow:e}){const t={boxShadow:e};return(0,me.jsx)(x.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,me.jsx)(x.__experimentalHStack,{align:"center",justify:"center",className:"edit-site-global-styles__shadow-preview-panel",children:(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-preview-block",style:t})})})}function Lu({shadow:e,onChange:t}){const s=(0,d.useMemo)((()=>function(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map((e=>e.trim()))}(e)),[e]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalVStack,{spacing:2,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,me.jsx)(Di,{level:3,children:(0,b.__)("Shadows")})}),(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,me.jsx)(x.Button,{size:"small",icon:ju,label:(0,b.__)("Add shadow"),onClick:()=>{s.push(ku),t(s.join(", "))}})})]})}),(0,me.jsx)(x.__experimentalSpacer,{}),(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:s.map(((e,n)=>(0,me.jsx)(zu,{shadow:e,onChange:e=>((e,n)=>{s[e]=n,t(s.join(", "))})(n,e),canRemove:s.length>1,onRemove:()=>(e=>{s.splice(e,1),t(s.join(", "))})(n)},n)))})]})}function zu({shadow:e,onChange:t,canRemove:s,onRemove:n}){const i=(0,d.useMemo)((()=>function(e){const t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e)return t;if(e.includes("none"))return t;const s=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,n=e.match(s)||[];if(1!==n.length)return t;const i=n[0].split(" ").map((e=>e.trim())).filter((e=>e));if(i.length<2)return t;const r=e.match(/inset/gi)||[];if(r.length>1)return t;const o=1===r.length;let a=e.replace(s,"").trim();o&&(a=a.replace("inset","").replace("INSET","").trim());let l=(a.match(/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi)||[]).map((e=>e?.trim())).filter((e=>e));if(l.length>1)return t;if(0===l.length&&(l=a.trim().split(" ").filter((e=>e)),l.length>1))return t;const[c,u,d,h]=i;return{x:c,y:u,blur:d||t.blur,spread:h||t.spread,inset:o,color:a||t.color}}(e)),[e]),r=e=>{t(function(e){const t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}(e))};return(0,me.jsx)(x.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"edit-site-global-styles__shadow-editor__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const r={onClick:e,className:Qt("edit-site-global-styles__shadow-editor__dropdown-toggle",{"is-open":t}),"aria-expanded":t},o={onClick:n,className:Qt("edit-site-global-styles__shadow-editor__remove-button",{"is-open":t}),label:(0,b.__)("Remove shadow")};return(0,me.jsxs)(x.__experimentalHStack,{align:"center",justify:"flex-start",spacing:0,children:[(0,me.jsx)(x.FlexItem,{style:{flexGrow:1},children:(0,me.jsx)(x.Button,{icon:Kn,...r,children:i.inset?(0,b.__)("Inner shadow"):(0,b.__)("Drop shadow")})}),s&&(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{icon:Tu,...o})})]})},renderContent:()=>(0,me.jsx)(x.__experimentalDropdownContentWrapper,{paddingSize:"none",children:(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor__dropdown-content",children:(0,me.jsx)(Gu,{shadowObj:i,onChange:r})})})})}function Gu({shadowObj:e,onChange:t}){const s=(s,n)=>{const i={...e,[s]:n};t(i)};return(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor-panel",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsx)(x.__experimentalHeading,{level:5,children:(0,b.__)("Shadow")}),(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor-color-palette",children:(0,me.jsx)(x.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:e=>s("color",e)})}),(0,me.jsxs)(x.__experimentalToggleGroupControl,{value:e.inset?"inset":"outset",isBlock:!0,onChange:e=>s("inset","inset"===e),hideLabelFromVision:!0,__next40pxDefaultSize:!0,children:[(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"outset",label:(0,b.__)("Outset")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"inset",label:(0,b.__)("Inset")})]}),(0,me.jsxs)(x.__experimentalGrid,{columns:2,gap:4,children:[(0,me.jsx)(Hu,{label:(0,b.__)("X Position"),value:e.x,hasNegativeRange:!0,onChange:e=>s("x",e)}),(0,me.jsx)(Hu,{label:(0,b.__)("Y Position"),value:e.y,hasNegativeRange:!0,onChange:e=>s("y",e)}),(0,me.jsx)(Hu,{label:(0,b.__)("Blur"),value:e.blur,onChange:e=>s("blur",e)}),(0,me.jsx)(Hu,{label:(0,b.__)("Spread"),value:e.spread,hasNegativeRange:!0,onChange:e=>s("spread",e)})]})]})})}function Hu({label:e,value:t,onChange:s,hasNegativeRange:n}){var i,r,o;const[a,l]=(0,d.useState)(!1),[c,u]=(0,x.__experimentalParseQuantityAndUnitFromRawValue)(t);return(0,me.jsxs)(x.__experimentalVStack,{justify:"flex-start",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Di,{children:e}),(0,me.jsx)(x.Button,{label:(0,b.__)("Use custom size"),icon:hr,onClick:()=>{l(!a)},isPressed:a,size:"small"})]}),a?(0,me.jsx)(x.__experimentalUnitControl,{label:e,hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:t,onChange:e=>{const t=void 0!==e&&!isNaN(parseFloat(e));s(t?e:"0px")}}):(0,me.jsx)(x.RangeControl,{value:null!=c?c:0,onChange:e=>{s(void 0!==e?[e,u||"px"].join(""):"0px")},withInputField:!1,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,min:n?-(null!==(i=Ou[null!=u?u:"px"]?.max)&&void 0!==i?i:10):0,max:null!==(r=Ou[null!=u?u:"px"]?.max)&&void 0!==r?r:10,step:null!==(o=Ou[null!=u?u:"px"]?.step)&&void 0!==o?o:.1})]})}function Uu(){return(0,me.jsx)(Eu,{})}function Wu(){return(0,me.jsx)(Bu,{})}const{useGlobalStyle:qu,useGlobalSetting:Zu,useSettingsForBlockElement:Ku,DimensionsPanel:Yu}=se(y.privateApis),Xu={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function Ju(){const[e]=qu("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=qu("",void 0,"all",{shouldDecodeEncode:!1}),[n]=Zu("",void 0,"user"),[i,r]=Zu(""),o=Ku(i),a=(0,d.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),l=(0,d.useMemo)((()=>({...e,layout:n.layout})),[e,n.layout]);return(0,me.jsx)(Yu,{inheritedValue:a,value:l,onChange:e=>{const t={...e};if(delete t.layout,s(t),e.layout!==n.layout){const t={...n,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:Xu})}const Qu={backgroundSize:"auto"},{useGlobalStyle:$u,useGlobalSetting:ed,useGlobalStyleLinks:td,BackgroundPanel:sd}=se(y.privateApis);function nd(e){return!!e?.background?.backgroundImage?.id||!!e?.background?.backgroundImage?.url||"string"==typeof e?.background?.backgroundImage}function id(){const[e]=$u("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=$u("",void 0,"all",{shouldDecodeEncode:!1}),n=td(),[i]=ed(""),r={backgroundImage:!0,backgroundSize:nd(e)||nd(t)};return(0,me.jsx)(sd,{inheritedValue:t,value:e,onChange:s,settings:i,defaultValues:Qu,defaultControls:r,themeFileURIs:n?.["wp:theme-file"]})}const{useHasBackgroundPanel:rd,useHasDimensionsPanel:od,useGlobalSetting:ad,useSettingsForBlockElement:ld}=se(y.privateApis);const cd=function(){const[e]=ad(""),t=ld(e),s=od(t),n=rd(t);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Layout")}),s&&(0,me.jsx)(Ju,{}),n&&(0,me.jsx)(id,{})]})},{GlobalStylesContext:ud}=se(y.privateApis);function dd({gap:e=2}){const{user:t}=(0,d.useContext)(ud),[s,n]=(0,d.useState)(t),i=s?.styles;(0,d.useEffect)((()=>{n(t)}),[t]);const r=(0,l.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),o=r?.filter((e=>!le(e,"color")&&!le(e,"typography"))),a=(0,d.useMemo)((()=>[...[{title:(0,b.__)("Default"),settings:{},styles:{}},...null!=o?o:[]].map((e=>{var t;const s={...e?.styles?.blocks}||{};i?.blocks&&Object.keys(i.blocks).forEach((e=>{if(i.blocks[e].css){const t=s[e]||{},n={css:`${s[e]?.css||""} ${i.blocks[e].css.trim()||""}`};s[e]={...t,...n}}}));const n=i?.css||e.styles?.css?{css:`${e.styles?.css||""} ${i?.css||""}`}:{},r=Object.keys(s).length>0?{blocks:s}:{},o={...e.styles,...n,...r};return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:o}}))]),[o,i?.blocks,i?.css]);return(0,me.jsx)(x.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container",gap:e,children:a.map(((e,t)=>(0,me.jsx)(ur,{variation:e,children:t=>(0,me.jsx)(bi,{label:e?.title,withHoverView:!0,isFocused:t,variation:e})},t)))})}const hd=function(){return(0,y.useZoomOut)(),(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("Browse styles"),description:(0,b.__)("Choose a variation to change the look of the site.")}),(0,me.jsx)(x.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations",children:(0,me.jsx)(x.CardBody,{children:(0,me.jsx)(dd,{})})})]})},pd=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),{EditorContentSlotFill:fd,ResizableEditor:md}=se(h.privateApis);function gd(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 vd=function({children:e,closeButtonLabel:t,onClose:s,enableResizing:n=!1}){const{editorCanvasContainerView:i,showListViewByDefault:r}=(0,l.useSelect)((e=>({editorCanvasContainerView:se(e(Kt)).getEditorCanvasContainerView(),showListViewByDefault:e(f.store).get("core","showListViewByDefault")})),[]),[o,a]=(0,d.useState)(!1),{setEditorCanvasContainerView:c}=se((0,l.useDispatch)(Kt)),{setIsListViewOpened:u}=(0,l.useDispatch)(h.store),p=(0,v.useFocusOnMount)("firstElement"),m=(0,v.useFocusReturn)();function g(){u(r),c(void 0),a(!0),"function"==typeof s&&s()}const y=Array.isArray(e)?d.Children.map(e,((e,t)=>0===t?(0,d.cloneElement)(e,{ref:m}):e)):(0,d.cloneElement)(e,{ref:m});if(o)return null;const w=gd(i),_=s||t;return(0,me.jsx)(fd.Fill,{children:(0,me.jsx)("div",{className:"edit-site-editor-canvas-container",children:(0,me.jsx)(md,{enableResizing:n,children:(0,me.jsxs)("section",{className:"edit-site-editor-canvas-container__section",ref:_?p:null,onKeyDown:function(e){e.keyCode!==hs.ESCAPE||e.defaultPrevented||(e.preventDefault(),g())},"aria-label":w,children:[_&&(0,me.jsx)(x.Button,{className:"edit-site-editor-canvas-container__close-button",icon:pd,label:t||(0,b.__)("Close"),onClick:g}),y]})})})})},{ExperimentalBlockEditorProvider:yd,useGlobalStyle:xd,GlobalStylesContext:bd,useGlobalStylesOutputWithConfig:wd}=se(y.privateApis),{mergeBaseAndUserConfigs:_d}=se(h.privateApis),{CompositeV2:Sd,CompositeItemV2:jd,useCompositeStoreV2:Cd,Tabs:kd}=se(x.privateApis);function Ed(e){return!e||0===Object.keys(e).length}function Pd(){return[{name:"core/heading",title:(0,b.__)("Headings"),category:"text",blocks:[(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:1}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:2}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:3}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:4}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:5})]},...(0,o.getBlockTypes)().filter((e=>{const{name:t,example:s,supports:n}=e;return"core/heading"!==t&&!!s&&!1!==n.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,o.getBlockFromExample)(e.name,e.example)})))]}const Id=({category:e,examples:t,isSelected:s,onClick:n,onSelect:i,settings:r,sizes:o,title:a})=>{const[l,c]=(0,d.useState)(!1),u={role:"button",onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!n||t!==hs.ENTER&&t!==hs.SPACE||(e.preventDefault(),n(e))},onClick:e=>{e.defaultPrevented||n&&(e.preventDefault(),n(e))},readonly:!0},h=n?"body { cursor: pointer; } body * { pointer-events: none; }":"";return(0,me.jsxs)(y.__unstableIframe,{className:Qt("edit-site-style-book__iframe",{"is-focused":l&&!!n,"is-button":!!n}),name:"style-book-canvas",tabIndex:0,...n?u:{},children:[(0,me.jsx)(y.__unstableEditorStyles,{styles:r.styles}),(0,me.jsx)("style",{children:'.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'+h}),(0,me.jsx)(Td,{className:Qt("edit-site-style-book__examples",{"is-wide":o.width>600}),examples:t,category:e,label:a?(0,b.sprintf)((0,b.__)("Examples of blocks in the %s category"),a):(0,b.__)("Examples of blocks"),isSelected:s,onSelect:i},e)]})},Td=(0,d.memo)((({className:e,examples:t,category:s,label:n,isSelected:i,onSelect:r})=>{const o=Cd({orientation:"vertical"});return(0,me.jsx)(Sd,{store:o,className:e,"aria-label":n,role:"grid",children:t.filter((e=>!s||e.category===s)).map((e=>(0,me.jsx)(Od,{id:`example-${e.name}`,title:e.title,blocks:e.blocks,isSelected:i(e.name),onClick:()=>{r?.(e.name)}},e.name)))})})),Od=({id:e,title:t,blocks:s,isSelected:n,onClick:i})=>{const r=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,focusMode:!1,__unstableIsPreviewMode:!0})),[r]),a=(0,d.useMemo)((()=>Array.isArray(s)?s:[s]),[s]);return(0,me.jsx)("div",{role:"row",children:(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsxs)(jd,{className:Qt("edit-site-style-book__example",{"is-selected":n}),id:e,"aria-label":(0,b.sprintf)((0,b.__)("Open %s styles in Styles panel"),t),render:(0,me.jsx)("div",{}),role:"button",onClick:i,children:[(0,me.jsx)("span",{className:"edit-site-style-book__example-title",children:t}),(0,me.jsx)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0,children:(0,me.jsx)(x.Disabled,{className:"edit-site-style-book__example-preview__content",children:(0,me.jsx)(yd,{value:a,settings:o,children:(0,me.jsx)(y.BlockList,{renderAppender:!1})})})})]})})})},Ad=function({enableResizing:e=!0,isSelected:t,onClick:s,onSelect:n,showCloseButton:i=!0,onClose:r,showTabs:a=!0,userConfig:c={}}){const[u,h]=(0,v.useResizeObserver)(),[p]=xd("color.text"),[f]=xd("color.background"),[m]=(0,d.useState)(Pd),g=(0,d.useMemo)((()=>(0,o.getCategories)().filter((e=>m.some((t=>t.category===e.slug)))).map((e=>({name:e.slug,title:e.title,icon:e.icon})))),[m]),{base:x}=(0,d.useContext)(bd),w=(0,d.useMemo)((()=>Ed(c)||Ed(x)?{}:_d(x,c)),[x,c]),_=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),S=(0,d.useMemo)((()=>({..._,__unstableIsPreviewMode:!0})),[_]),[j]=wd(w);return S.styles=Ed(j)||Ed(c)?S.styles:j,(0,me.jsx)(vd,{onClose:r,enableResizing:e,closeButtonLabel:i?(0,b.__)("Close"):null,children:(0,me.jsxs)("div",{className:Qt("edit-site-style-book",{"is-wide":h.width>600,"is-button":!!s}),style:{color:p,background:f},children:[u,a?(0,me.jsx)("div",{className:"edit-site-style-book__tabs",children:(0,me.jsxs)(kd,{children:[(0,me.jsx)(kd.TabList,{children:g.map((e=>(0,me.jsx)(kd.Tab,{tabId:e.name,children:e.title},e.name)))}),g.map((e=>(0,me.jsx)(kd.TabPanel,{tabId:e.name,focusable:!1,children:(0,me.jsx)(Id,{category:e.name,examples:m,isSelected:t,onSelect:n,settings:S,sizes:h,title:e.title})},e.name)))]})}):(0,me.jsx)(Id,{examples:m,isSelected:t,onClick:s,onSelect:n,settings:S,sizes:h})]})})},{useGlobalStyle:Md,AdvancedPanel:Nd}=se(y.privateApis);const Fd=function(){const e=(0,b.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=Md("",void 0,"user",{shouldDecodeEncode:!1}),[s,n]=Md("",void 0,"all",{shouldDecodeEncode:!1});return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:(0,b.__)("CSS"),description:(0,me.jsxs)(me.Fragment,{children:[e,(0,me.jsx)(x.ExternalLink,{href:"https://developer.wordpress.org/advanced-administration/wordpress/css/",className:"edit-site-global-styles-screen-css-help-link",children:(0,b.__)("Learn more about CSS")})]})}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen-css",children:(0,me.jsx)(Nd,{value:t,onChange:n,inheritedValue:s})})]})},{ExperimentalBlockEditorProvider:Vd,GlobalStylesContext:Rd,useGlobalStylesOutputWithConfig:Bd,__unstableBlockStyleVariationOverridesWithConfig:Dd}=se(y.privateApis),{mergeBaseAndUserConfigs:Ld}=se(h.privateApis);function zd(e){return!e||0===Object.keys(e).length}const Gd=function({userConfig:e,blocks:t}){const{base:s}=(0,d.useContext)(Rd),n=(0,d.useMemo)((()=>zd(e)||zd(s)?{}:Ld(s,e)),[s,e]),i=(0,d.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),r=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,__unstableIsPreviewMode:!0})),[r]),[a]=Bd(n),c=zd(a)||zd(e)?o.styles:a;return(0,me.jsx)(vd,{title:(0,b.__)("Revisions"),closeButtonLabel:(0,b.__)("Close revisions"),enableResizing:!0,children:(0,me.jsxs)(y.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,me.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,me.jsx)(x.Disabled,{className:"edit-site-revisions__example-preview__content",children:(0,me.jsxs)(Vd,{value:i,settings:o,children:[(0,me.jsx)(y.BlockList,{renderAppender:!1}),(0,me.jsx)(y.__unstableEditorStyles,{styles:c}),(0,me.jsx)(Dd,{config:n})]})})]})})},Hd={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},Ud={per_page:100,page:1},Wd=[],{GlobalStylesContext:qd}=se(y.privateApis);function Zd({query:e}={}){const{user:t}=(0,d.useContext)(qd),s={...Ud,...e},{authors:n,currentUser:i,isDirty:r,revisions:o,isLoadingGlobalStylesRevisions:a,revisionsCount:c}=(0,l.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:n,getCurrentUser:i,getUsers:r,getRevisions:o,__experimentalGetCurrentGlobalStylesId:a,getEntityRecord:l,isResolving:c}=e(_.store),u=n(),d=i(),h=u.length>0,p=a(),f=p?l("root","globalStyles",p):void 0,m=null!==(t=f?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=o("root","globalStyles",p,s)||Wd;return{authors:r(Hd)||Wd,currentUser:d,isDirty:h,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,s]),revisionsCount:m}}),[e]);return(0,d.useMemo)((()=>{if(!n.length||a)return{revisions:Wd,hasUnsavedChanges:r,isLoading:!0,revisionsCount:c};const e=o.map((e=>({...e,author:n.find((t=>t.id===e.author))})));if(o.length){if("unsaved"!==e[0].id&&1===s.page&&(e[0].isLatest=!0),r&&t&&Object.keys(t).length>0&&i&&1===s.page){const s={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:i?.name,avatar_urls:i?.avatar_urls},modified:new Date};e.unshift(s)}s.page===Math.ceil(c/s.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:r,isLoading:!1,revisionsCount:c}}),[r,o,i,n,t,a])}const Kd=window.wp.date,{getGlobalStylesChanges:Yd}=se(y.privateApis);function Xd({revision:e,previousRevision:t}){const s=Yd(e,t,{maxResults:7});return s.length?(0,me.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes",children:s.map((e=>(0,me.jsx)("li",{children:e},e)))}):null}const Jd=function({userRevisions:e,selectedRevisionId:t,onChange:s,canApplyRevision:n,onApplyRevision:i}){const{currentThemeName:r,currentUser:o}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:s}=e(_.store),n=t();return{currentThemeName:n?.name?.rendered||n?.stylesheet,currentUser:s()}}),[]),a=(0,Kd.getDate)().getTime(),{datetimeAbbreviated:c}=(0,Kd.getSettings)().formats;return(0,me.jsx)("ol",{className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,b.__)("Global styles revisions list"),role:"group",children:e.map(((l,u)=>{const{id:d,author:h,modified:p}=l,f="unsaved"===d,m=f?o:h,g=m?.name||(0,b.__)("User"),v=m?.avatar_urls?.[48],y=t?t===d:0===u,w=!n&&y,_="parent"===d,S=(0,Kd.getDate)(p),j=p&&a-S.getTime()>864e5?(0,Kd.dateI18n)(c,S):(0,Kd.humanTimeDiff)(p),C=function(e,t,s,n){return"parent"===e?(0,b.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,b.sprintf)((0,b.__)("Unsaved changes by %s"),t):n?(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,s):(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s"),t,s)}(d,g,(0,Kd.dateI18n)(c,S),w);return(0,me.jsxs)("li",{className:Qt("edit-site-global-styles-screen-revisions__revision-item",{"is-selected":y,"is-active":w,"is-reset":_}),"aria-current":y,children:[(0,me.jsx)(x.Button,{className:"edit-site-global-styles-screen-revisions__revision-button",__experimentalIsFocusable:!0,disabled:y,onClick:()=>{s(l)},"aria-label":C,children:_?(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[(0,b.__)("Default styles"),(0,me.jsx)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:r})]}):(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[f?(0,me.jsx)("span",{className:"edit-site-global-styles-screen-revisions__date",children:(0,b.__)("(Unsaved)")}):(0,me.jsx)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:p,children:j}),(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:[(0,me.jsx)("img",{alt:g,src:v}),g]}),y&&(0,me.jsx)(Xd,{revision:l,previousRevision:us(1),__experimentalIsFocusable:!0,disabled:r||1===e,label:(0,b.__)("First page"),icon:Qd,size:"compact"}),(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(e-1),__experimentalIsFocusable:!0,disabled:r||1===e,label:(0,b.__)("Previous page"),icon:zn,size:"compact"})]}),(0,me.jsx)(x.__experimentalText,{variant:"muted",children:(0,b.sprintf)((0,b._x)("%1$s of %2$s","paging"),e,t)}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(e+1),__experimentalIsFocusable:!0,disabled:r||e===t,label:(0,b.__)("Next page"),icon:Gn,size:"compact"}),(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(t),__experimentalIsFocusable:!0,disabled:r||e===t,label:(0,b.__)("Last page"),icon:$d,size:"compact"})]})]})}const{GlobalStylesContext:th,areGlobalStyleConfigsEqual:sh}=se(y.privateApis);const nh=function(){const{goTo:e}=(0,x.__experimentalUseNavigator)(),{user:t,setUserConfig:s}=(0,d.useContext)(th),{blocks:n,editorCanvasContainerView:i}=(0,l.useSelect)((e=>({editorCanvasContainerView:se(e(Kt)).getEditorCanvasContainerView(),blocks:e(y.store).getBlocks()})),[]),[r,o]=(0,d.useState)(1),[a,c]=(0,d.useState)([]),{revisions:u,isLoading:h,hasUnsavedChanges:p,revisionsCount:f}=Zd({query:{per_page:10,page:r}}),m=Math.ceil(f/10),[g,v]=(0,d.useState)(t),[w,_]=(0,d.useState)(!1),{setEditorCanvasContainerView:S}=se((0,l.useDispatch)(Kt)),j=sh(g,t),C=()=>{e("/");S("global-styles-revisions:style-book"===i?"style-book":void 0)},k=e=>{s((()=>e)),_(!1),C()};(0,d.useEffect)((()=>{i&&i.startsWith("global-styles-revisions")||e("/")}),[i]),(0,d.useEffect)((()=>{!h&&u.length&&c(u)}),[u,h]);const E=u[0],P=g?.id,I=!!E?.id&&!j&&!P;(0,d.useEffect)((()=>{I&&v(E)}),[I,E]);const T=!!P&&"unsaved"!==P&&!j,O=!!a.length;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ei,{title:f&&(0,b.sprintf)((0,b.__)("Revisions (%s)"),f),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}),!O&&(0,me.jsx)(x.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),O&&("global-styles-revisions:style-book"===i?(0,me.jsx)(Ad,{userConfig:g,isSelected:()=>{},onClose:()=>{S("global-styles-revisions")}}):(0,me.jsx)(Gd,{blocks:n,userConfig:g,closeButtonLabel:(0,b.__)("Close revisions")})),(0,me.jsx)(Jd,{onChange:v,selectedRevisionId:P,userRevisions:a,canApplyRevision:T,onApplyRevision:()=>p?_(!0):k(g)}),m>1&&(0,me.jsx)("div",{className:"edit-site-global-styles-screen-revisions__footer",children:(0,me.jsx)(eh,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:r,numPages:m,changePage:o,totalItems:f,disabled:h,label:(0,b.__)("Global Styles pagination navigation")})}),w&&(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:w,confirmButtonText:(0,b.__)("Apply"),onConfirm:()=>k(g),onCancel:()=>_(!1),size:"medium",children:(0,b.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})},{useGlobalStylesReset:ih}=se(y.privateApis),{Slot:rh,Fill:oh}=(0,x.createSlotFill)("GlobalStylesMenu");function ah(){const[e,t]=ih(),{toggle:s}=(0,l.useDispatch)(f.store),{canEditCSS:n}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:i}=se((0,l.useDispatch)(Kt)),{goTo:r}=(0,x.__experimentalUseNavigator)(),o=()=>{i("global-styles-css"),r("/css")};return(0,me.jsx)(oh,{children:(0,me.jsx)(x.DropdownMenu,{icon:Ln,label:(0,b.__)("More"),toggleProps:{size:"compact"},children:({onClose:i})=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.MenuGroup,{children:[n&&(0,me.jsx)(x.MenuItem,{onClick:o,children:(0,b.__)("Additional CSS")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{s("core/edit-site","welcomeGuideStyles"),i()},children:(0,b.__)("Welcome Guide")})]}),(0,me.jsx)(x.MenuGroup,{children:(0,me.jsx)(x.MenuItem,{onClick:()=>{t(),i()},disabled:!e,children:(0,b.__)("Reset styles")})})]})})})}function lh({className:e,...t}){return(0,me.jsx)(x.__experimentalNavigatorScreen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function ch({parentMenu:e,blockStyles:t,blockName:s}){return t.map(((t,n)=>(0,me.jsx)(lh,{path:e+"/variations/"+t.name,children:(0,me.jsx)(nr,{name:s,variation:t.name})},n)))}function uh({name:e,parentMenu:t=""}){const s=(0,l.useSelect)((t=>{const{getBlockStyles:s}=t(o.store);return s(e)}),[e]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(lh,{path:t+"/colors/palette",children:(0,me.jsx)(Su,{name:e})}),!!s?.length&&(0,me.jsx)(ch,{parentMenu:t,blockStyles:s,blockName:e})]})}function dh(){const e=(0,x.__experimentalUseNavigator)(),{path:t}=e.location;return(0,me.jsx)(Ad,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{e.goTo("/blocks/"+encodeURIComponent(t))}})}function hh(){const e=(0,x.__experimentalUseNavigator)(),{selectedBlockName:t,selectedBlockClientId:s}=(0,l.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:s}=e(y.store),n=t();return{selectedBlockName:s(n),selectedBlockClientId:n}}),[]),n=Ni(t);(0,d.useEffect)((()=>{if(!s||!n)return;const i=e.location.path;if("/blocks"!==i&&!i.startsWith("/blocks/"))return;const r="/blocks/"+encodeURIComponent(t);r!==i&&e.goTo(r,{skipFocus:!0})}),[s,t,n])}function ph(){const{goTo:e,location:t}=(0,x.__experimentalUseNavigator)(),s=(0,l.useSelect)((e=>se(e(Kt)).getEditorCanvasContainerView()),[]),n=t?.path,i="/revisions"===n;(0,d.useEffect)((()=>{switch(s){case"global-styles-revisions":case"global-styles-revisions:style-book":e("/revisions");break;case"global-styles-css":e("/css");break;case"style-book":i&&e("/");break;default:if("/"!==n&&!i)return;e("/")}}),[s,i,e])}const fh=function(){const e=(0,o.getBlockTypes)(),t=(0,l.useSelect)((e=>se(e(Kt)).getEditorCanvasContainerView()),[]);return(0,me.jsxs)(x.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/",children:[(0,me.jsx)(lh,{path:"/",children:(0,me.jsx)(_i,{})}),(0,me.jsx)(lh,{path:"/variations",children:(0,me.jsx)(hd,{})}),(0,me.jsx)(lh,{path:"/blocks",children:(0,me.jsx)(Ri,{})}),(0,me.jsx)(lh,{path:"/typography",children:(0,me.jsx)(Uc,{})}),(0,me.jsx)(lh,{path:"/typography/text",children:(0,me.jsx)($c,{element:"text"})}),(0,me.jsx)(lh,{path:"/typography/link",children:(0,me.jsx)($c,{element:"link"})}),(0,me.jsx)(lh,{path:"/typography/heading",children:(0,me.jsx)($c,{element:"heading"})}),(0,me.jsx)(lh,{path:"/typography/caption",children:(0,me.jsx)($c,{element:"caption"})}),(0,me.jsx)(lh,{path:"/typography/button",children:(0,me.jsx)($c,{element:"button"})}),(0,me.jsx)(lh,{path:"/colors",children:(0,me.jsx)(uu,{})}),(0,me.jsx)(lh,{path:"/shadows",children:(0,me.jsx)(Uu,{})}),(0,me.jsx)(lh,{path:"/shadows/edit/:category/:slug",children:(0,me.jsx)(Wu,{})}),(0,me.jsx)(lh,{path:"/layout",children:(0,me.jsx)(cd,{})}),(0,me.jsx)(lh,{path:"/css",children:(0,me.jsx)(Fd,{})}),(0,me.jsx)(lh,{path:"/revisions",children:(0,me.jsx)(nh,{})}),e.map((e=>(0,me.jsx)(lh,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,me.jsx)(nr,{name:e.name})},"menu-block-"+e.name))),(0,me.jsx)(uh,{}),e.map((e=>(0,me.jsx)(uh,{name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)},"screens-block-"+e.name))),"style-book"===t&&(0,me.jsx)(dh,{}),(0,me.jsx)(ah,{}),(0,me.jsx)(hh,{}),(0,me.jsx)(ph,{})]})},{ComplementaryArea:mh,ComplementaryAreaMoreMenuItem:gh}=se(h.privateApis);function vh({className:e,identifier:t,title:s,icon:n,children:i,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(mh,{className:e,scope:"core",identifier:t,title:s,smallScreenTitle:s,icon:n,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c,children:i}),(0,me.jsx)(gh,{scope:"core",identifier:t,icon:n,children:s})]})}const{interfaceStore:yh}=se(h.privateApis);function xh(){const{shouldClearCanvasContainerView:e,isStyleBookOpened:t,showListViewByDefault:s,hasRevisions:n,isRevisionsOpened:i,isRevisionsStyleBookOpened:r}=(0,l.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(yh),{getEditorCanvasContainerView:s,getCanvasMode:n}=se(e(Kt)),i=s(),r="visual"===e(h.store).getEditorMode(),o="edit"===n(),a=e(f.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(_.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===i,shouldClearCanvasContainerView:"edit-site/global-styles"!==t("core")||!r||!o,showListViewByDefault:a,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===i,isRevisionsOpened:"global-styles-revisions"===i}}),[]),{setEditorCanvasContainerView:o}=se((0,l.useDispatch)(Kt));(0,d.useEffect)((()=>{e&&o(void 0)}),[e]);const{setIsListViewOpened:a}=(0,l.useDispatch)(h.store),{goTo:c}=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(vh,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,b.__)("Styles"),icon:Vs,closeLabel:(0,b.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,me.jsxs)(x.Flex,{className:"edit-site-global-styles-sidebar__header",gap:1,children:[(0,me.jsx)(x.FlexBlock,{style:{minWidth:"min-content"},children:(0,me.jsx)("h2",{className:"edit-site-global-styles-sidebar__header-title",children:(0,b.__)("Styles")})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{icon:Dn,label:(0,b.__)("Style Book"),isPressed:t||r,__experimentalIsFocusable:!0,disabled:e,onClick:()=>{i?o("global-styles-revisions:style-book"):r?o("global-styles-revisions"):(a(t&&s),o(t?void 0:"style-book"))},size:"compact"})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{label:(0,b.__)("Revisions"),icon:zs,onClick:()=>(a(!1),r?(c("/"),void o("style-book")):i?(c("/"),void o(void 0)):(c("/revisions"),void o(t?"global-styles-revisions:style-book":"global-styles-revisions"))),__experimentalIsFocusable:!0,disabled:!n,isPressed:i||r,size:"compact"})}),(0,me.jsx)(rh,{})]}),children:(0,me.jsx)(fh,{})})}const{useLocation:bh}=se(Xt.privateApis);function wh({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:s=!0,showReviewMessage:n,icon:i,size:r,__next40pxDefaultSize:o=!1}){const{params:a}=bh(),{setIsSaveViewOpened:c}=(0,l.useDispatch)(Kt),{saveDirtyEntities:u}=se((0,l.useDispatch)(h.store)),{dirtyEntityRecords:d}=(0,h.useEntitiesSavedStatesIsDirty)(),{isSaving:p,isSaveViewOpen:f,previewingThemeName:m}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:t,isResolving:s}=e(_.store),{isSaveViewOpened:n}=e(Kt),i=s("activateTheme"),r=sn();return{isSaving:d.some((e=>t(e.kind,e.name,e.key)))||i,isSaveViewOpen:n(),previewingThemeName:r?e(_.store).getTheme(r)?.name?.rendered:void 0}}),[d]),g=!!d.length;let v;1===d.length&&(a.postId?v=`${d[0].key}`===a.postId&&d[0].name===a.postType:a.path?.includes("wp_global_styles")&&(v="globalStyles"===d[0].name));const y=p||!g&&!tn(),w=tn()?p?(0,b.sprintf)((0,b.__)("Activating %s"),m):y?(0,b.__)("Saved"):g?(0,b.sprintf)((0,b.__)("Activate %s & Save"),m):(0,b.sprintf)((0,b.__)("Activate %s"),m):p?(0,b.__)("Saving"):y?(0,b.__)("Saved"):!v&&n?(0,b.sprintf)((0,b._n)("Review %d change…","Review %d changes…",d.length),d.length):(0,b.__)("Save"),S=v?()=>u({dirtyEntityRecords:d}):()=>c(!0);return(0,me.jsx)(x.Button,{variant:t,className:e,"aria-disabled":y,"aria-expanded":f,isBusy:p,onClick:y?void 0:S,label:w,shortcut:y?void 0:hs.displayShortcut.primary("s"),showTooltip:s,icon:i,__next40pxDefaultSize:o,size:r,children:w})}const{useHistory:_h}=se(Xt.privateApis);const{EntitiesSavedStatesExtensible:Sh,NavigableRegion:jh}=se(h.privateApis),Ch=({onClose:e})=>{var t,s;const n=(0,h.useEntitiesSavedStatesIsDirty)();let i;i=n.isDirty?(0,b.__)("Activate & Save"):(0,b.__)("Activate");const r=function(){const[e,t]=(0,d.useState)();return(0,d.useEffect)((()=>{const e=(0,ps.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});fr()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),o=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()),[]),a=(0,me.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(t=r?.name?.rendered)&&void 0!==t?t:"...",null!==(s=o?.name?.rendered)&&void 0!==s?s:"...")}),c=function(){const e=_h(),{startResolution:t,finishResolution:s}=(0,l.useDispatch)(_.store);return async()=>{if(tn()){const n="themes.php?action=activate&stylesheet="+sn()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;t("activateTheme"),await window.fetch(n),s("activateTheme");const{params:i}=e.getLocationWithParams();e.replace({...i,wp_theme_preview:void 0})}}}();return(0,me.jsx)(Sh,{...n,additionalPrompt:a,close:e,onSave:async e=>(await c(),e),saveEnabled:!0,saveLabel:i})},kh=({onClose:e,renderDialog:t})=>tn()?(0,me.jsx)(Ch,{onClose:e}):(0,me.jsx)(h.EntitiesSavedStates,{close:e,renderDialog:t});function Eh(){const{isSaveViewOpen:e,canvasMode:t,isDirty:s,isSaving:n}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:s,isResolving:n}=e(_.store),i=t(),r=n("activateTheme"),{isSaveViewOpened:o,getCanvasMode:a}=se(e(Kt));return{isSaveViewOpen:o(),canvasMode:a(),isDirty:i.length>0,isSaving:i.some((e=>s(e.kind,e.name,e.key)))||r}}),[]),{setIsSaveViewOpened:i}=(0,l.useDispatch)(Kt),r=()=>i(!1);if("view"===t)return e?(0,me.jsx)(x.Modal,{className:"edit-site-save-panel__modal",onRequestClose:r,__experimentalHideHeader:!0,contentLabel:(0,b.__)("Save site, content, and template changes"),children:(0,me.jsx)(kh,{onClose:r})}):null;const o=tn()||s,a=n||!o;return(0,me.jsxs)(jh,{className:Qt("edit-site-layout__actions",{"is-entity-save-view-open":e}),ariaLabel:(0,b.__)("Save panel"),children:[(0,me.jsx)("div",{className:Qt("edit-site-editor__toggle-save-panel",{"screen-reader-text":e}),children:(0,me.jsx)(x.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>i(!0),"aria-haspopup":"dialog",disabled:a,__experimentalIsFocusable:!0,children:(0,b.__)("Open save panel")})}),e&&(0,me.jsx)(kh,{onClose:r,renderDialog:!0})]})}const Ph=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Ih=window.wp.blob;function Th(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,me.jsx)(x.MenuItem,{role:"menuitem",icon:Ph,onClick:async function(){try{const e=await fr()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),s=e.headers.get("content-disposition").match(/=(.+)\.zip/),n=s[1]?s[1]:"edit-site-export";(0,Ih.downloadBlob)(n+".zip",t,"application/zip")}catch(t){let s={};try{s=await t.json()}catch(e){}const n=s.message&&"unknown_error"!==s.code?s.message:(0,b.__)("An error occurred while creating the site export.");e(n,{type:"snackbar"})}},info:(0,b.__)("Download your theme with updated templates and styles."),children:(0,b._x)("Export","site exporter menu item")})}function Oh(){const{toggle:e}=(0,l.useDispatch)(f.store);return(0,me.jsx)(x.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide"),children:(0,b.__)("Welcome Guide")})}const{ToolsMoreMenuGroup:Ah,PreferencesModal:Mh}=se(h.privateApis);function Nh(){const e=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(Ah,{children:[e&&(0,me.jsx)(Th,{}),(0,me.jsx)(Oh,{})]}),(0,me.jsx)(Mh,{})]})}const{useLocation:Fh}=se(Xt.privateApis);const Vh=function(){const{record:e,getTitle:t,isLoaded:s}=en();let n;var i;s&&(n=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s"),t(),null!==(i=Ue[e.type])&&void 0!==i?i:Ue[Me])),function(e){const t=Fh(),s=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]),n=(0,d.useRef)(!0);(0,d.useEffect)((()=>{n.current=!1}),[t]),(0,d.useEffect)((()=>{if(!n.current&&e&&s){const t=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,cs.decodeEntities)(e),(0,cs.decodeEntities)(s));document.title=t,(0,Si.speak)(e,"assertive")}}),[e,s,t])}(s&&n)},{Editor:Rh,BackButton:Bh}=se(h.privateApis),{useHistory:Dh}=se(Xt.privateApis),{BlockKeyboardShortcuts:Lh}=se(a.privateApis);function zh({isLoading:e}){const{editedPostType:t,editedPostId:s,contextPostType:n,contextPostId:i,editorMode:r,canvasMode:o,isEditingPage:a,supportsGlobalStyles:c,showIconLabels:u,editorCanvasView:p,currentPostIsTrashed:m}=(0,l.useSelect)((e=>{const{getEditedPostContext:t,getCanvasMode:s,isPage:n,getEditedPostType:i,getEditedPostId:r}=se(e(Kt)),{get:o}=e(f.store),{getCurrentTheme:a}=e(_.store),{getEditorMode:l}=e(h.store),c=t();return{editedPostType:i(),editedPostId:r(),contextPostType:c?.postId?c.postType:void 0,contextPostId:c?.postId?c.postId:void 0,editorMode:l(),canvasMode:s(),isEditingPage:n(),supportsGlobalStyles:a()?.is_block_theme,showIconLabels:o("core","showIconLabels"),editorCanvasView:se(e(Kt)).getEditorCanvasContainerView(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status")}}),[]);Vh();const g=tn(),y=!function(){const e=(0,x.__experimentalUseSlotFills)(fd.privateKey);return!!e?.length}(),S=function(){const{canvasMode:e,currentPostIsTrashed:t}=(0,l.useSelect)((e=>{const{getCanvasMode:t}=se(e(Kt));return{canvasMode:t(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status")}}),[]),{setCanvasMode:s}=se((0,l.useDispatch)(Kt)),[n,i]=(0,d.useState)(!1);(0,d.useEffect)((()=>{"edit"===e&&i(!1)}),[e]);const r={"aria-label":(0,b.__)("Edit"),"aria-disabled":t,title:null,role:"button",tabIndex:0,onFocus:()=>i(!0),onBlur:()=>i(!1),onKeyDown:e=>{const{keyCode:n}=e;n!==hs.ENTER&&n!==hs.SPACE||t||(e.preventDefault(),s("edit"))},onClick:()=>{s("edit")},onClickCapture:e=>{t&&(e.preventDefault(),e.stopPropagation())},readonly:!0};return{className:Qt("edit-site-visual-editor__editor-canvas",{"is-focused":n&&"view"===e}),..."view"===e?r:{}}}(),j="edit"===o,C="view"===o||"visual"===r,k=!!i,E=(0,v.useInstanceId)(Sn,"edit-site-editor__loading-progress"),P=Nn(),I=(0,d.useMemo)((()=>[...P.styles,{css:`body{${"view"===o?"min-height: 100vh; "+(m?"":"cursor: pointer;"):""}}}`}]),[P.styles,o,m]),{setCanvasMode:T}=se((0,l.useDispatch)(Kt)),{createSuccessNotice:O}=(0,l.useDispatch)(w.store),A=Dh(),M=(0,d.useCallback)(((e,t)=>{switch(e){case"move-to-trash":case"delete-post":A.push({postType:t[0].type});break;case"duplicate-post":{const e=t[0],s="string"==typeof e.title?e.title:e.title?.rendered;O((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(s)),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,b.__)("Edit"),onClick:()=>{A.push({postId:e.id,postType:e.type,canvas:"edit"})}}]})}}}),[A,O]),N=!e;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(bn,{}),(0,me.jsx)(h.EditorKeyboardShortcutsRegister,{}),j&&(0,me.jsx)(Lh,{}),C&&(0,me.jsx)(Pn,{}),N?null:(0,me.jsx)(Sn,{id:E}),j&&(0,me.jsx)(yn,{}),N&&(0,me.jsxs)(Rh,{postType:k?n:t,postId:k?i:s,templateId:k?s:void 0,settings:P,className:Qt("edit-site-editor__editor-interface",{"show-icon-labels":u}),styles:I,enableRegionNavigation:!1,customSaveButton:g&&(0,me.jsx)(wh,{size:"compact"}),customSavePanel:g&&(0,me.jsx)(Eh,{}),forceDisableBlockTools:!y,title:y?void 0:gd(p),iframeProps:S,onActionPerformed:M,extraSidebarPanels:!a&&(0,me.jsx)(Bn.Slot,{}),children:[j&&(0,me.jsx)(Bh,{children:({length:e})=>e<=1&&(0,me.jsx)(x.Button,{label:(0,b.__)("Open Navigation"),className:"edit-site-layout__view-mode-toggle",onClick:()=>T("view"),children:(0,me.jsx)(ms,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,me.jsx)(Nh,{}),c&&(0,me.jsx)(xh,{})]})]})}const Gh=(0,d.memo)((function({view:e,onChangeView:t,paginationInfo:{totalItems:s=0,totalPages:n}}){var i;if(!s||!n)return null;const r=null!==(i=e.page)&&void 0!==i?i:1;return!!s&&1!==n&&(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:6,justify:"end",className:"dataviews-pagination",children:[(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2,className:"dataviews-pagination__page-selection",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("Page of %s","paging"),n),{CurrentPageControl:(0,me.jsx)(x.SelectControl,{"aria-label":(0,b.__)("Current page"),value:e.page?.toString(),options:Array.from(Array(n)).map(((e,t)=>{const s=t+1;return{value:s.toString(),label:s.toString()}})),onChange:s=>{t({...e,page:+s})},size:"compact",__nextHasNoMarginBottom:!0})})}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,me.jsx)(x.Button,{onClick:()=>t({...e,page:r-1}),disabled:1===r,__experimentalIsFocusable:!0,label:(0,b.__)("Previous page"),icon:zn,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,me.jsx)(x.Button,{onClick:()=>t({...e,page:r+1}),disabled:r>=n,__experimentalIsFocusable:!0,label:(0,b.__)("Next page"),icon:Gn,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})})),Hh=Gh,{lock:Uh,unlock:Wh}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),qh="is",Zh="isNot",Kh="isAny",Yh="isNone",Xh="isAll",Jh="isNotAll",Qh=[qh,Zh,Kh,Yh,Xh,Jh],$h={[qh]:{key:"is-filter",label:(0,b.__)("Is")},[Zh]:{key:"is-not-filter",label:(0,b.__)("Is not")},[Kh]:{key:"is-any-filter",label:(0,b.__)("Is any")},[Yh]:{key:"is-none-filter",label:(0,b.__)("Is none")},[Xh]:{key:"is-all-filter",label:(0,b.__)("Is all")},[Jh]:{key:"is-not-all-filter",label:(0,b.__)("Is not all")}},ep=["asc","desc"],tp={asc:"↑",desc:"↓"},sp={asc:"ascending",desc:"descending"},np={asc:(0,b.__)("Sort ascending"),desc:(0,b.__)("Sort descending")},ip="table",rp="grid",op=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),ap=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),lp=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),cp=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),up=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})}),dp=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})});function hp({selection:e,onSelectionChange:t,item:s,data:n,getItemId:i,primaryField:r,disabled:o}){const a=i(s),l=!o&&e.includes(a);let c;return c=r?.getValue&&s?(0,b.sprintf)(l?(0,b.__)("Deselect item: %s"):(0,b.__)("Select item: %s"),r.getValue({item:s})):l?(0,b.__)("Select a new item"):(0,b.__)("Deselect item"),(0,me.jsx)(x.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":c,"aria-disabled":o,checked:l,onChange:()=>{o||t(l?n.filter((t=>{const s=i?.(t);return s!==a&&e.includes(s)})):n.filter((t=>{const s=i?.(t);return s===a||e.includes(s)})))}})}const{DropdownMenuV2:pp,DropdownMenuGroupV2:fp,DropdownMenuItemV2:mp,DropdownMenuItemLabelV2:gp,kebabCase:vp}=Wh(x.privateApis);function yp({action:e,onClick:t,items:s}){const n="string"==typeof e.label?e.label:e.label(s);return(0,me.jsx)(x.Button,{label:n,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t})}function xp({action:e,onClick:t,items:s}){const n="string"==typeof e.label?e.label:e.label(s);return(0,me.jsx)(mp,{onClick:t,hideOnClick:!("RenderModal"in e),children:(0,me.jsx)(gp,{children:n})})}function bp({action:e,items:t,closeModal:s}){const n="string"==typeof e.label?e.label:e.label(t);return(0,me.jsx)(x.Modal,{title:e.modalHeader||n,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:null!=s?s:()=>{},overlayClassName:`dataviews-action-modal dataviews-action-modal__${vp(e.id)}`,children:(0,me.jsx)(e.RenderModal,{items:t,closeModal:s,onActionStart:e.onActionStart,onActionPerformed:e.onActionPerformed})})}function wp({action:e,items:t,ActionTrigger:s,isBusy:n}){const[i,r]=(0,d.useState)(!1),o={action:e,onClick:()=>{r(!0)},items:t,isBusy:n};return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(s,{...o}),i&&(0,me.jsx)(bp,{action:e,items:t,closeModal:()=>r(!1)})]})}function _p({actions:e,item:t}){return(0,me.jsx)(fp,{children:e.map((e=>"RenderModal"in e?(0,me.jsx)(wp,{action:e,items:[t],ActionTrigger:xp},e.id):(0,me.jsx)(xp,{action:e,onClick:()=>e.callback([t]),items:[t]},e.id)))})}function Sp({item:e,actions:t,isCompact:s}){const{primaryActions:n,eligibleActions:i}=(0,d.useMemo)((()=>{const s=t.filter((t=>!t.isEligible||t.isEligible(e)));return{primaryActions:s.filter((e=>e.isPrimary&&!!e.icon)),eligibleActions:s}}),[t,e]);return s?(0,me.jsx)(jp,{item:e,actions:i}):(0,me.jsxs)(x.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[!!n.length&&n.map((t=>"RenderModal"in t?(0,me.jsx)(wp,{action:t,items:[e],ActionTrigger:yp},t.id):(0,me.jsx)(yp,{action:t,onClick:()=>t.callback([e]),items:[e]},t.id))),(0,me.jsx)(jp,{item:e,actions:i})]})}function jp({item:e,actions:t}){return(0,me.jsx)(pp,{trigger:(0,me.jsx)(x.Button,{size:"compact",icon:Ln,label:(0,b.__)("Actions"),__experimentalIsFocusable:!0,disabled:!t.length,className:"dataviews-all-actions-button"}),placement:"bottom-end",children:(0,me.jsx)(_p,{actions:t,item:e})})}function Cp(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[Kh,Yh]),t=t.filter((e=>Qh.includes(e))),(t.includes(qh)||t.includes(Zh))&&(t=t.filter((e=>[qh,Zh].includes(e)))),t}const{DropdownMenuV2:kp,DropdownMenuGroupV2:Ep,DropdownMenuItemV2:Pp,DropdownMenuSeparatorV2:Ip}=Wh(x.privateApis);function Tp(e,t){return(0,d.useMemo)((()=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))),[e,t])}function Op({action:e,selectedItems:t,setActionWithModal:s,onMenuOpenChange:n}){const i=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]),{RenderModal:r,hideModalHeader:o}=e,a=(0,d.useCallback)((()=>{s(void 0)}),[s]);if(!i.length)return null;const l="string"==typeof e.label?e.label:e.label(t);return(0,me.jsx)(x.Modal,{title:o?void 0:l,__experimentalHideHeader:!!o,onRequestClose:a,overlayClassName:"dataviews-action-modal",children:(0,me.jsx)(r,{items:i,closeModal:a,onActionPerformed:()=>n(!1)})})}function Ap({action:e,selectedItems:t,setActionWithModal:s}){const n=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]),i="RenderModal"in e;return(0,me.jsx)(Pp,{disabled:0===n.length,hideOnClick:!i,onClick:async()=>{i?s(e):await e.callback(n)},suffix:n.length>0?n.length:void 0,children:e.label},e.id)}function Mp({actions:e,selectedItems:t,setActionWithModal:s}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Ep,{children:e.map((e=>(0,me.jsx)(Ap,{action:e,selectedItems:t,setActionWithModal:s},e.id)))}),(0,me.jsx)(Ip,{})]})}function Np({data:e,actions:t,selection:s,onSelectionChange:n,getItemId:i}){const r=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(),u=(0,d.useMemo)((()=>e.filter((e=>r.some((t=>!t.isEligible||t.isEligible(e)))))),[e,r]),h=u.length,p=(0,d.useMemo)((()=>e.filter((e=>s.includes(i(e))&&u.includes(e)))),[s,e,i,u]),f=p.length===h;return 0===r.length?null:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(kp,{open:o,onOpenChange:a,label:(0,b.__)("Bulk actions"),style:{minWidth:"240px"},trigger:(0,me.jsx)(x.Button,{className:"dataviews-bulk-edit-button",__next40pxDefaultSize:!0,variant:"tertiary",size:"compact",children:p.length?(0,b.sprintf)((0,b._n)("Edit %d item","Edit %d items",p.length),p.length):(0,b.__)("Bulk edit")}),children:[(0,me.jsx)(Mp,{actions:r,setActionWithModal:c,selectedItems:p}),(0,me.jsxs)(Ep,{children:[(0,me.jsx)(Pp,{disabled:f,hideOnClick:!1,onClick:()=>{n(u)},suffix:h,children:(0,b.__)("Select all")}),(0,me.jsx)(Pp,{disabled:0===s.length,hideOnClick:!1,onClick:()=>{n([])},children:(0,b.__)("Deselect")})]})]}),l&&(0,me.jsx)(Op,{action:l,selectedItems:p,setActionWithModal:c,onMenuOpenChange:a})]})}const{DropdownMenuV2:Fp,DropdownMenuGroupV2:Vp,DropdownMenuItemV2:Rp,DropdownMenuRadioItemV2:Bp,DropdownMenuItemLabelV2:Dp,DropdownMenuSeparatorV2:Lp}=Wh(x.privateApis);function zp({children:e}){return d.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,me.jsxs)(d.Fragment,{children:[t>0&&(0,me.jsx)(Lp,{}),e]},t)))}const Gp=(0,d.forwardRef)((function({field:e,view:t,onChangeView:s,onHide:n,setOpenedFilter:i},r){const o=!1!==e.enableHiding,a=!1!==e.enableSorting,l=t.sort?.field===e.id,c=Cp(e),u=!(t.filters?.some((t=>e.id===t.field))||!e.elements?.length||!c.length||e.filterBy?.isPrimary);return a||o||u?(0,me.jsx)(Fp,{align:"start",trigger:(0,me.jsxs)(x.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:r,variant:"tertiary",children:[e.header,t.sort&&l&&(0,me.jsx)("span",{"aria-hidden":"true",children:tp[t.sort.direction]})]}),style:{minWidth:"240px"},children:(0,me.jsxs)(zp,{children:[a&&(0,me.jsx)(Vp,{children:ep.map((n=>{const i=t.sort&&l&&t.sort.direction===n,r=`${e.id}-${n}`;return(0,me.jsx)(Bp,{name:"view-table-sorting",value:r,checked:i,onChange:()=>{s({...t,sort:{field:e.id,direction:n}})},children:(0,me.jsx)(Dp,{children:np[n]})},r)}))}),u&&(0,me.jsx)(Vp,{children:(0,me.jsx)(Rp,{prefix:(0,me.jsx)(x.Icon,{icon:up}),onClick:()=>{i(e.id),s({...t,page:1,filters:[...t.filters||[],{field:e.id,value:void 0,operator:c[0]}]})},children:(0,me.jsx)(Dp,{children:(0,b.__)("Add filter")})})}),o&&(0,me.jsx)(Rp,{prefix:(0,me.jsx)(x.Icon,{icon:dp}),onClick:()=>{n(e),s({...t,hiddenFields:t.hiddenFields.concat(e.id)})},children:(0,me.jsx)(Dp,{children:(0,b.__)("Hide")})})]})}):e.header}));function Hp({selection:e,onSelectionChange:t,data:s,actions:n,getItemId:i}){const r=(0,d.useMemo)((()=>s.filter((e=>n.some((t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e))))))),[s,n]),o=s.filter((t=>e.includes(i(t))&&r.includes(t))),a=o.length===r.length;return(0,me.jsx)(x.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:a,indeterminate:!a&&!!o.length,onChange:()=>{t(a?[]:r)},"aria-label":a?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function Up({hasBulkActions:e,item:t,actions:s,id:n,visibleFields:i,primaryField:r,selection:o,getItemId:a,onSelectionChange:l,data:c}){const u=Tp(s,t),h=u&&o.includes(n),[p,f]=(0,d.useState)(!1),m=(0,d.useRef)(!1);return(0,me.jsxs)("tr",{className:Qt("dataviews-view-table__row",{"is-selected":u&&h,"is-hovered":p,"has-bulk-actions":u}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},onTouchStart:()=>{m.current=!0},onClick:()=>{u&&(m.current||"Range"===document.getSelection()?.type||l(h?c.filter((e=>{const t=a?.(e);return t!==n&&o.includes(t)})):c.filter((e=>{const t=a?.(e);return t===n||o.includes(t)}))))},children:[e&&(0,me.jsx)("td",{className:"dataviews-view-table__checkbox-column",style:{width:"1%"},children:(0,me.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,me.jsx)(hp,{item:t,selection:o,onSelectionChange:l,getItemId:a,data:c,primaryField:r,disabled:!u})})}),i.map((e=>(0,me.jsx)("td",{style:{width:e.width||void 0,minWidth:e.minWidth||void 0,maxWidth:e.maxWidth||void 0},children:(0,me.jsx)("div",{className:Qt("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__primary-field":r?.id===e.id}),children:e.render({item:t})})},e.id))),!!s?.length&&(0,me.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,me.jsx)(Sp,{item:t,actions:s})})]})}const Wp=function({actions:e,data:t,fields:s,getItemId:n,isLoading:i=!1,onChangeView:r,onSelectionChange:o,selection:a,setOpenedFilter:l,view:c}){const u=(0,d.useRef)(new Map),h=(0,d.useRef)(),[p,f]=(0,d.useState)(),m=function(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}(e,t);(0,d.useEffect)((()=>{h.current&&(h.current.focus(),h.current=void 0)}));const g=(0,d.useId)();if(p)return h.current=p,void f(void 0);const v=e=>{const t=u.current.get(e.id),s=t?u.current.get(t.fallback):void 0;f(s?.node)},y=s.filter((e=>!c.hiddenFields.includes(e.id)&&![c.layout.mediaField].includes(e.id))),w=!!t?.length,_=s.find((e=>e.id===c.layout.primaryField));return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)("table",{className:"dataviews-view-table","aria-busy":i,"aria-describedby":g,children:[(0,me.jsx)("thead",{children:(0,me.jsxs)("tr",{className:"dataviews-view-table__row",children:[m&&(0,me.jsx)("th",{className:"dataviews-view-table__checkbox-column",style:{width:"1%"},"data-field-id":"selection",scope:"col",children:(0,me.jsx)(Hp,{selection:a,onSelectionChange:o,data:t,actions:e,getItemId:n})}),y.map(((e,t)=>(0,me.jsx)("th",{style:{width:e.width||void 0,minWidth:e.minWidth||void 0,maxWidth:e.maxWidth||void 0},"data-field-id":e.id,"aria-sort":c.sort?.field===e.id?sp[c.sort.direction]:void 0,scope:"col",children:(0,me.jsx)(Gp,{ref:s=>{s?u.current.set(e.id,{node:s,fallback:y[t>0?t-1:1]?.id}):u.current.delete(e.id)},field:e,view:c,onChangeView:r,onHide:v,setOpenedFilter:l})},e.id))),!!e?.length&&(0,me.jsx)("th",{"data-field-id":"actions",className:"dataviews-view-table__actions-column",children:(0,me.jsx)("span",{className:"dataviews-view-table-header",children:(0,b.__)("Actions")})})]})}),(0,me.jsx)("tbody",{children:w&&t.map(((s,i)=>(0,me.jsx)(Up,{item:s,hasBulkActions:m,actions:e,id:n(s)||i.toString(),visibleFields:y,primaryField:_,selection:a,getItemId:n,onSelectionChange:o,data:t},n(s))))})]}),(0,me.jsx)("div",{className:Qt({"dataviews-loading":i,"dataviews-no-results":!w&&!i}),id:g,children:!w&&(0,me.jsx)("p",{children:i?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})]})};function qp({selection:e,data:t,onSelectionChange:s,getItemId:n,item:i,actions:r,mediaField:o,primaryField:a,visibleFields:l,badgeFields:c,columnFields:u}){const d=Tp(r,i),h=n(i),p=e.includes(h);return(0,me.jsxs)(x.__experimentalVStack,{spacing:0,className:Qt("dataviews-view-grid__card",{"is-selected":d&&p}),onClickCapture:i=>{if(i.ctrlKey||i.metaKey){if(i.stopPropagation(),i.preventDefault(),!d)return;s(p?t.filter((t=>{const s=n?.(t);return s!==h&&e.includes(s)})):t.filter((t=>{const s=n?.(t);return s===h||e.includes(s)})))}},children:[(0,me.jsx)("div",{className:"dataviews-view-grid__media",children:o?.render({item:i})}),(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,me.jsx)(hp,{item:i,selection:e,onSelectionChange:s,getItemId:n,data:t,primaryField:a,disabled:!d}),(0,me.jsx)(x.__experimentalHStack,{className:"dataviews-view-grid__primary-field",children:a?.render({item:i})}),(0,me.jsx)(Sp,{item:i,actions:r,isCompact:!0})]}),!!c?.length&&(0,me.jsx)(x.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:c.map((e=>{const t=e.render({item:i});return t?(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-value",children:t},e.id):null}))}),!!l?.length&&(0,me.jsx)(x.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:3,children:l.map((e=>{const t=e.render({item:i});return t?(0,me.jsx)(x.Flex,{className:Qt("dataviews-view-grid__field",u?.includes(e.id)?"is-column":"is-row"),gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:u?.includes(e.id)?"column":"row",children:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:t})]})},e.id):null}))})]},h)}const{useCompositeStoreV2:Zp,CompositeV2:Kp,CompositeItemV2:Yp,CompositeRowV2:Xp,DropdownMenuV2:Jp}=Wh(x.privateApis);function Qp({actions:e,id:t,isSelected:s,item:n,mediaField:i,onSelect:r,primaryField:o,store:a,visibleFields:l}){const c=(0,d.useRef)(null),u=`${t}-label`,h=`${t}-description`,[p,f]=(0,d.useState)(!1);(0,d.useEffect)((()=>{s&&c.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})}),[s]);const{primaryAction:m,eligibleActions:g}=(0,d.useMemo)((()=>{const t=e.filter((e=>!e.isEligible||e.isEligible(n))),s=t.filter((e=>e.isPrimary&&!!e.icon));return{primaryAction:s?.[0],eligibleActions:t}}),[e,n]),[v,y]=(0,d.useState)(!1),w=m&&("string"==typeof m.label?m.label:m.label([n]));return(0,me.jsx)(Xp,{ref:c,render:(0,me.jsx)("li",{}),role:"row",className:Qt({"is-selected":s,"is-hovered":p}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:(0,me.jsxs)(x.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",alignment:"center",spacing:0,children:[(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(Yp,{store:a,render:(0,me.jsx)("div",{}),role:"button",id:t,"aria-pressed":s,"aria-labelledby":u,"aria-describedby":h,className:"dataviews-view-list__item",onClick:()=>r(n),children:(0,me.jsxs)(x.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[(0,me.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:i?.render({item:n})||(0,me.jsx)("div",{className:"dataviews-view-list__media-placeholder"})}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)("span",{className:"dataviews-view-list__primary-field",id:u,children:o?.render({item:n})}),(0,me.jsx)("div",{className:"dataviews-view-list__fields",id:h,children:l.map((e=>(0,me.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,me.jsx)(x.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.header}),(0,me.jsx)("span",{className:"dataviews-view-list__field-value",children:e.render({item:n})})]},e.id)))})]})]})})}),g?.length>0&&(0,me.jsxs)(x.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-view-list__item-actions",style:{flexShrink:"0",width:"auto"},children:[m&&"RenderModal"in m&&(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(Yp,{store:a,render:(0,me.jsx)(x.Button,{label:w,icon:m.icon,isDestructive:m.isDestructive,size:"compact",onClick:()=>y(!0)}),children:v&&(0,me.jsx)(bp,{action:m,items:[n],closeModal:()=>y(!1)})})}),m&&!("RenderModal"in m)&&(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(Yp,{store:a,render:(0,me.jsx)(x.Button,{label:w,icon:m.icon,isDestructive:m.isDestructive,size:"compact",onClick:()=>m.callback([n])})})},m.id),(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(Jp,{trigger:(0,me.jsx)(Yp,{store:a,render:(0,me.jsx)(x.Button,{size:"compact",icon:Ln,label:(0,b.__)("Actions"),__experimentalIsFocusable:!0,disabled:!e.length,onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),a.move(a.down())),"ArrowUp"===e.key&&(e.preventDefault(),a.move(a.up()))}})}),placement:"bottom-end",children:(0,me.jsx)(_p,{actions:g,item:n})})})]})]})})}const $p=[{type:ip,label:(0,b.__)("Table"),component:Wp,icon:op},{type:rp,label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:s,getItemId:n,isLoading:i,onSelectionChange:r,selection:o,view:a}){const l=s.find((e=>e.id===a.layout.mediaField)),c=s.find((e=>e.id===a.layout.primaryField)),{visibleFields:u,badgeFields:d}=s.reduce(((e,t)=>{if(a.hiddenFields.includes(t.id)||[a.layout.mediaField,a.layout.primaryField].includes(t.id))return e;return e[a.layout.badgeFields?.includes(t.id)?"badgeFields":"visibleFields"].push(t),e}),{visibleFields:[],badgeFields:[]}),h=!!t?.length;return(0,me.jsxs)(me.Fragment,{children:[h&&(0,me.jsx)(x.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid","aria-busy":i,children:t.map((s=>(0,me.jsx)(qp,{selection:o,data:t,onSelectionChange:r,getItemId:n,item:s,actions:e,mediaField:l,primaryField:c,visibleFields:u,badgeFields:d,columnFields:a.layout.columnFields},n(s))))}),!h&&(0,me.jsx)("div",{className:Qt({"dataviews-loading":i,"dataviews-no-results":!i}),children:(0,me.jsx)("p",{children:i?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})]})},icon:ap},{type:"list",label:(0,b.__)("List"),component:function e(t){const{actions:s,data:n,fields:i,getItemId:r,isLoading:o,onSelectionChange:a,selection:l,view:c}=t,u=(0,v.useInstanceId)(e,"view-list"),h=n?.findLast((e=>l.includes(r(e)))),p=i.find((e=>e.id===c.layout.mediaField)),f=i.find((e=>e.id===c.layout.primaryField)),m=i.filter((e=>!c.hiddenFields.includes(e.id)&&![c.layout.primaryField,c.layout.mediaField].includes(e.id))),g=(0,d.useCallback)((e=>a([e])),[a]),y=(0,d.useCallback)((e=>e?`${u}-${r(e)}`:void 0),[u,r]),w=Zp({defaultActiveId:y(h)}),_=w.useState((e=>e.items.some((t=>t.id===e.activeId))));(0,d.useEffect)((()=>{_||(w.down()?w.move(w.down()):w.up()&&w.move(w.up()))}),[_]);const S=n?.length;return S?(0,me.jsx)(Kp,{id:u,render:(0,me.jsx)("ul",{}),className:"dataviews-view-list",role:"grid",store:w,children:n.map((e=>{const t=y(e);return(0,me.jsx)(Qp,{id:t,actions:s,item:e,isSelected:e===h,onSelect:g,mediaField:p,primaryField:f,store:w,visibleFields:m},t)}))}):(0,me.jsx)("div",{className:Qt({"dataviews-loading":o,"dataviews-no-results":!S&&!o}),children:!S&&(0,me.jsx)("p",{children:o?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})},icon:(0,b.isRTL)()?lp:cp}],{DropdownMenuV2:ef,DropdownMenuGroupV2:tf,DropdownMenuItemV2:sf,DropdownMenuRadioItemV2:nf,DropdownMenuCheckboxItemV2:rf,DropdownMenuItemLabelV2:of}=Wh(x.privateApis);function af({view:e,onChangeView:t,supportedLayouts:s}){let n=$p;if(s&&(n=n.filter((e=>s.includes(e.type)))),1===n.length)return null;const i=n.find((t=>e.type===t.type));return(0,me.jsx)(ef,{trigger:(0,me.jsx)(sf,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:i?.label}),children:(0,me.jsx)(of,{children:(0,b.__)("Layout")})}),children:n.map((s=>(0,me.jsx)(nf,{value:s.type,name:"view-actions-available-view",checked:s.type===e.type,hideOnClick:!0,onChange:s=>{switch(s.target.value){case"list":case"grid":case"table":return t({...e,type:s.target.value,layout:{}})}throw new Error("Invalid dataview")},children:(0,me.jsx)(of,{children:s.label})},s.type)))})}const lf=[10,20,50,100];function cf({view:e,onChangeView:t}){return(0,me.jsx)(ef,{trigger:(0,me.jsx)(sf,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:e.perPage}),children:(0,me.jsx)(of,{children:(0,b.__)("Items per page")})}),children:lf.map((s=>(0,me.jsx)(nf,{value:s,name:"view-actions-page-size",checked:e.perPage===s,onChange:()=>{t({...e,perPage:s,page:1})},children:(0,me.jsx)(of,{children:s})},s)))})}function uf({view:e,onChangeView:t,fields:s}){const n=s.filter((t=>!1!==t.enableHiding&&t.id!==e.layout.mediaField));return n?.length?(0,me.jsx)(ef,{trigger:(0,me.jsx)(sf,{children:(0,me.jsx)(of,{children:(0,b.__)("Fields")})}),children:n?.map((s=>(0,me.jsx)(rf,{value:s.id,checked:!e.hiddenFields?.includes(s.id),onChange:()=>{t({...e,hiddenFields:e.hiddenFields?.includes(s.id)?e.hiddenFields.filter((e=>e!==s.id)):[...e.hiddenFields||[],s.id]})},children:(0,me.jsx)(of,{children:s.header})},s.id)))}):null}function df({fields:e,view:t,onChangeView:s}){const n=e.filter((e=>!1!==e.enableSorting));if(!n?.length)return null;const i=e.find((e=>e.id===t.sort?.field));return(0,me.jsx)(ef,{trigger:(0,me.jsx)(sf,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:i?.header}),children:(0,me.jsx)(of,{children:(0,b.__)("Sort by")})}),children:n?.map((e=>{const n=t.sort?.direction;return(0,me.jsx)(ef,{trigger:(0,me.jsx)(sf,{children:(0,me.jsx)(of,{children:e.header})}),style:{minWidth:"220px"},children:ep.map((r=>{const o=void 0!==i&&n===r&&e.id===i.id,a=`${e.id}-${r}`;return(0,me.jsx)(nf,{name:"view-actions-sorting",value:a,checked:o,onChange:()=>{s({...t,sort:{field:e.id,direction:r}})},children:(0,me.jsx)(of,{children:np[r]})},a)}))},e.id)}))})}const hf=(0,d.memo)((function({fields:e,view:t,onChangeView:s,supportedLayouts:n}){return(0,me.jsx)(ef,{trigger:(0,me.jsx)(x.Button,{size:"compact",icon:hr,label:(0,b.__)("View options")}),children:(0,me.jsxs)(tf,{children:[(0,me.jsx)(af,{view:t,onChangeView:s,supportedLayouts:n}),(0,me.jsx)(df,{fields:e,view:t,onChangeView:s}),(0,me.jsx)(uf,{fields:e,view:t,onChangeView:s}),(0,me.jsx)(cf,{view:t,onChangeView:s})]})})}));var pf={id:null};function ff(e,t){return t&&e.item(t)||null}var mf=Symbol("FOCUS_SILENTLY");function gf(e,t,s){if(!t)return!1;if(t===s)return!1;const n=e.item(t.id);return!!n&&(!s||n.element!==s)}var vf=Object.defineProperty,yf=Object.defineProperties,xf=Object.getOwnPropertyDescriptors,bf=Object.getOwnPropertySymbols,wf=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable,Sf=(e,t,s)=>t in e?vf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,jf=(e,t)=>{for(var s in t||(t={}))wf.call(t,s)&&Sf(e,s,t[s]);if(bf)for(var s of bf(t))_f.call(t,s)&&Sf(e,s,t[s]);return e},Cf=(e,t)=>yf(e,xf(t)),kf=(e,t)=>{var s={};for(var n in e)wf.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&bf)for(var n of bf(e))t.indexOf(n)<0&&_f.call(e,n)&&(s[n]=e[n]);return s},Ef=i(1609),Pf=i.t(Ef,2),If=Object.defineProperty,Tf=Object.defineProperties,Of=Object.getOwnPropertyDescriptors,Af=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Nf=Object.prototype.propertyIsEnumerable,Ff=(e,t,s)=>t in e?If(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Vf=(e,t)=>{for(var s in t||(t={}))Mf.call(t,s)&&Ff(e,s,t[s]);if(Af)for(var s of Af(t))Nf.call(t,s)&&Ff(e,s,t[s]);return e},Rf=(e,t)=>Tf(e,Of(t)),Bf=(e,t)=>{var s={};for(var n in e)Mf.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&Af)for(var n of Af(e))t.indexOf(n)<0&&Nf.call(e,n)&&(s[n]=e[n]);return s};function Df(...e){}function Lf(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function zf(...e){return(...t)=>{for(const s of e)"function"==typeof s&&s(...t)}}function Gf(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Hf(e){return e}function Uf(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function Wf(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function qf(...e){for(const t of e)if(void 0!==t)return t}function Zf(e){return function(e){return!!e&&!!(0,Ef.isValidElement)(e)&&"ref"in e}(e)?e.ref:null}var Kf,Yf="undefined"!=typeof window&&!!(null==(Kf=window.document)?void 0:Kf.createElement);function Xf(e){return e?e.ownerDocument||e:document}function Jf(e,t=!1){const{activeElement:s}=Xf(e);if(!(null==s?void 0:s.nodeName))return null;if("IFRAME"===s.tagName&&s.contentDocument)return Jf(s.contentDocument.body,t);if(t){const e=s.getAttribute("aria-activedescendant");if(e){const t=Xf(s).getElementById(e);if(t)return t}}return s}function Qf(e,t){return e===t||e.contains(t)}function $f(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==em.indexOf(e.type)}var em=["button","color","file","image","reset","submit"];function tm(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function sm(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,s="TEXTAREA"===e.tagName;return t||s||!1}catch(e){return!1}}function nm(e,t){const s=null==e?void 0:e.getAttribute("role");return s&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(s)?s:t}function im(e,t){var s;const n=nm(e);if(!n)return t;return null!=(s={menu:"menuitem",listbox:"option",tree:"treeitem",grid:"gridcell"}[n])?s:t}function rm(e){if(!e)return null;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}return rm(e.parentElement)||document.scrollingElement||document.body}function om(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function am(){return Yf&&!!navigator.maxTouchPoints}function lm(){return!!Yf&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function cm(){return Yf&&lm()&&/apple/i.test(navigator.vendor)}function um(e){return Boolean(e.currentTarget&&!Qf(e.currentTarget,e.target))}function dm(e){return e.target===e.currentTarget}function hm(e,t){const s=new FocusEvent("blur",t),n=e.dispatchEvent(s),i=Rf(Vf({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),n}function pm(e,t){const s=new MouseEvent("click",t);return e.dispatchEvent(s)}function fm(e,t){const s=t||e.currentTarget,n=e.relatedTarget;return!n||!Qf(s,n)}function mm(e,t,s){const n=requestAnimationFrame((()=>{e.removeEventListener(t,i,!0),s()})),i=()=>{cancelAnimationFrame(n),s()};return e.addEventListener(t,i,{once:!0,capture:!0}),n}function gm(e,t,s,n=window){const i=[];try{n.document.addEventListener(e,t,s);for(const r of Array.from(n.frames))i.push(gm(e,t,s,r))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,s)}catch(e){}i.forEach((e=>e()))}}var vm=jf({},Pf),ym=vm.useId,xm=(vm.useDeferredValue,vm.useInsertionEffect),bm=Yf?Ef.useLayoutEffect:Ef.useEffect;function wm(e){const t=(0,Ef.useRef)(e);return bm((()=>{t.current=e})),t}function _m(e){const t=(0,Ef.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return xm?xm((()=>{t.current=e})):t.current=e,(0,Ef.useCallback)(((...e)=>{var s;return null==(s=t.current)?void 0:s.call(t,...e)}),[])}function Sm(...e){return(0,Ef.useMemo)((()=>{if(e.some(Boolean))return t=>{e.forEach((e=>function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)))}}),e)}function jm(e){if(ym){const t=ym();return e||t}const[t,s]=(0,Ef.useState)(e);return bm((()=>{if(e||t)return;const n=Math.random().toString(36).substr(2,6);s(`id-${n}`)}),[e,t]),e||t}function Cm(e,t){const s=e=>{if("string"==typeof e)return e},[n,i]=(0,Ef.useState)((()=>s(t)));return bm((()=>{const n=e&&"current"in e?e.current:e;i((null==n?void 0:n.tagName.toLowerCase())||s(t))}),[e,t]),n}function km(e,t){const s=(0,Ef.useRef)(!1);(0,Ef.useEffect)((()=>{if(s.current)return e();s.current=!0}),t),(0,Ef.useEffect)((()=>()=>{s.current=!1}),[])}Symbol("setNextState");function Em(e){return _m("function"==typeof e?e:()=>e)}function Pm(e,t,s=[]){const n=(0,Ef.useCallback)((s=>(e.wrapElement&&(s=e.wrapElement(s)),t(s))),[...s,e.wrapElement]);return Cf(jf({},e),{wrapElement:n})}var Im=!1,Tm=0,Om=0;function Am(e){(function(e){const t=e.movementX||e.screenX-Tm,s=e.movementY||e.screenY-Om;return Tm=e.screenX,Om=e.screenY,t||s||!1})(e)&&(Im=!0)}function Mm(){Im=!1}function Nm(e){return Ef.forwardRef(((t,s)=>e(jf({ref:s},t))))}function Fm(e){const t=Nm(e);return Ef.memo(t)}function Vm(e,t){const s=t,{as:n,wrapElement:i,render:r}=s,o=kf(s,["as","wrapElement","render"]);let a;const l=Sm(t.ref,Zf(r));if(n&&"string"!=typeof n)a=(0,me.jsx)(n,Cf(jf({},o),{render:r}));else if(Ef.isValidElement(r)){const e=Cf(jf({},r.props),{ref:l});a=Ef.cloneElement(r,function(e,t){const s=jf({},e);for(const n in t){if(!Lf(t,n))continue;if("className"===n){const n="className";s[n]=e[n]?`${e[n]} ${t[n]}`:t[n];continue}if("style"===n){const n="style";s[n]=e[n]?jf(jf({},e[n]),t[n]):t[n];continue}const i=t[n];if("function"==typeof i&&n.startsWith("on")){const t=e[n];if("function"==typeof t){s[n]=(...e)=>{i(...e),t(...e)};continue}}s[n]=i}return s}(o,e))}else if(r)a=r(o);else if("function"==typeof t.children){0;const e=o,{children:s}=e,n=kf(e,["children"]);a=t.children(n)}else a=n?(0,me.jsx)(n,jf({},o)):(0,me.jsx)(e,jf({},o));return i?i(a):a}function Rm(e){return(t={})=>{const s=e(t),n={};for(const e in s)Lf(s,e)&&void 0!==s[e]&&(n[e]=s[e]);return n}}function Bm(e=[],t=[]){const s=Ef.createContext(void 0),n=Ef.createContext(void 0),i=()=>Ef.useContext(s),r=t=>e.reduceRight(((e,s)=>(0,me.jsx)(s,Cf(jf({},t),{children:e}))),(0,me.jsx)(s.Provider,jf({},t)));return{context:s,scopedContext:n,useContext:i,useScopedContext:(e=!1)=>{const t=Ef.useContext(n),s=i();return e?t:t||s},useProviderContext:()=>{const e=Ef.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:r,ScopedContextProvider:e=>(0,me.jsx)(r,Cf(jf({},e),{children:t.reduceRight(((t,s)=>(0,me.jsx)(s,Cf(jf({},e),{children:t}))),(0,me.jsx)(n.Provider,jf({},e)))}))}}var Dm=Bm(),Lm=Dm.useContext,zm=(Dm.useScopedContext,Dm.useProviderContext,Bm([Dm.ContextProvider],[Dm.ScopedContextProvider])),Gm=zm.useContext,Hm=(zm.useScopedContext,zm.useProviderContext),Um=zm.ContextProvider,Wm=zm.ScopedContextProvider,qm=(0,Ef.createContext)(void 0),Zm=(0,Ef.createContext)(void 0),Km="";function Ym(){Km=""}function Xm(e,t){var s;const n=(null==(s=e.element)?void 0:s.textContent)||e.children;return!!n&&Gf(n).trim().toLowerCase().startsWith(t.toLowerCase())}function Jm(e,t,s){if(!s)return e;const n=e.find((e=>e.id===s));return n&&Xm(n,t)?Km!==t&&Xm(n,Km)?e:(Km=t,function(e,t,s=!1){const n=e.findIndex((e=>e.id===t));return[...e.slice(n+1),...s?[pf]:[],...e.slice(0,n)]}(e.filter((e=>Xm(e,Km))),s).filter((e=>e.id!==s))):e}var Qm=Rm((e=>{var t=e,{store:s,typeahead:n=!0}=t,i=kf(t,["store","typeahead"]);const r=Gm();Uf(s=s||r,!1);const o=i.onKeyDownCapture,a=(0,Ef.useRef)(0),l=_m((e=>{if(null==o||o(e),e.defaultPrevented)return;if(!n)return;if(!s)return;const{items:t,activeId:i}=s.getState();if(!function(e){const t=e.target;return(!t||!sm(t))&&(!(" "!==e.key||!Km.length)||1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&/^[\p{Letter}\p{Number}]$/u.test(e.key))}(e))return Ym();let r=function(e){return e.filter((e=>!e.disabled))}(t);if(!function(e,t){if(dm(e))return!0;const s=e.target;return!!s&&t.some((e=>e.element===s))}(e,r))return Ym();e.preventDefault(),window.clearTimeout(a.current),a.current=window.setTimeout((()=>{Km=""}),500);const l=e.key.toLowerCase();Km+=l,r=Jm(r,l,i);const c=r.find((e=>Xm(e,Km)));c?s.move(c.id):Ym()}));return i=Cf(jf({},i),{onKeyDownCapture:l})})),$m=Nm((e=>Vm("div",Qm(e))));var eg="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function tg(e){return!!tm(e,eg)&&(!!function(e){const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!function(e,t){if("closest"in e)return e.closest(t);do{if(tm(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}(e,"[inert]"))}function sg(e){const t=Jf(e);if(!t)return!1;if(t===e)return!0;const s=t.getAttribute("aria-activedescendant");return!!s&&s===e.id}function ng(e){const t=Jf(e);if(!t)return!1;if(Qf(e,t))return!0;const s=t.getAttribute("aria-activedescendant");return!!s&&("id"in e&&(s===e.id||!!e.querySelector(`#${CSS.escape(s)}`)))}function ig(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var rg=Symbol("composite-hover");var og=Rm((e=>{var t=e,{store:s,focusOnHover:n=!0,blurOnHoverEnd:i=!!n}=t,r=kf(t,["store","focusOnHover","blurOnHoverEnd"]);const o=Gm();Uf(s=s||o,!1);const a=((0,Ef.useEffect)((()=>{gm("mousemove",Am,!0),gm("mousedown",Mm,!0),gm("mouseup",Mm,!0),gm("keydown",Mm,!0),gm("scroll",Mm,!0)}),[]),_m((()=>Im))),l=r.onMouseMove,c=Em(n),u=_m((e=>{if(null==l||l(e),!e.defaultPrevented&&a()&&c(e)){if(!ng(e.currentTarget)){const e=null==s?void 0:s.getState().baseElement;e&&!sg(e)&&e.focus()}null==s||s.setActiveId(e.currentTarget.id)}})),d=r.onMouseLeave,h=Em(i),p=_m((e=>{var t;null==d||d(e),e.defaultPrevented||a()&&(function(e){const t=ig(e);return!!t&&Qf(e.currentTarget,t)}(e)||function(e){let t=ig(e);if(!t)return!1;do{if(Lf(t,rg)&&t[rg])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&h(e)&&(null==s||s.setActiveId(null),null==(t=null==s?void 0:s.getState().baseElement)||t.focus()))})),f=(0,Ef.useCallback)((e=>{e&&(e[rg]=!0)}),[]);return r=Cf(jf({},r),{ref:Sm(f,r.ref),onMouseMove:u,onMouseLeave:p})})),ag=Fm((e=>Vm("div",og(e))));function lg(e,t){const s=e.__unstableInternals;return Uf(s,"Invalid store"),s[t]}function cg(e,...t){let s=e,n=s,i=Symbol(),r=Df;const o=new Set,a=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,h=new WeakMap,p=(e,t,s=c)=>(s.add(t),h.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),h.delete(t),s.delete(t)}),f=(e,r,o=!1)=>{if(!Lf(s,e))return;const l=function(e,t){if(function(e){return"function"==typeof e}(e))return e(function(e){return"function"==typeof e}(t)?t():t);return e}(r,s[e]);if(l===s[e])return;o||t.forEach((t=>{var s;null==(s=null==t?void 0:t.setState)||s.call(t,e,l)}));const p=s;s=Rf(Vf({},s),{[e]:l});const f=Symbol();i=f,a.add(e);const m=(t,n,i)=>{var r;const o=h.get(t);o&&!o.some((t=>i?i.has(t):t===e))||(null==(r=d.get(t))||r(),d.set(t,t(s,n)))};c.forEach((e=>{m(e,p)})),queueMicrotask((()=>{if(i!==f)return;const e=s;u.forEach((e=>{m(e,n,a)})),n=e,a.clear()}))},m={getState:()=>s,setState:f,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=o.size,n=Symbol();o.add(n);const i=()=>{o.delete(n),o.size||r()};if(e)return i;const a=(c=s,Object.keys(c)).map((e=>zf(...t.map((t=>{var s;const n=null==(s=null==t?void 0:t.getState)?void 0:s.call(t);if(n&&Lf(n,e))return pg(t,[e],(t=>{f(e,t[e],!0)}))})))));var c;const u=[];l.forEach((e=>u.push(e())));const d=t.map(dg);return r=zf(...a,...u,...d),i},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(s,s)),p(e,t)),batch:(e,t)=>(d.set(t,t(s,n)),p(e,t,u)),pick:e=>cg(function(e,t){const s={};for(const n of t)Lf(e,n)&&(s[n]=e[n]);return s}(s,e),m),omit:e=>cg(function(e,t){const s=Vf({},e);for(const e of t)Lf(s,e)&&delete s[e];return s}(s,e),m)}};return m}function ug(e,...t){if(e)return lg(e,"setup")(...t)}function dg(e,...t){if(e)return lg(e,"init")(...t)}function hg(e,...t){if(e)return lg(e,"subscribe")(...t)}function pg(e,...t){if(e)return lg(e,"sync")(...t)}function fg(e,...t){if(e)return lg(e,"batch")(...t)}function mg(e,...t){if(e)return lg(e,"omit")(...t)}function gg(...e){const t=e.reduce(((e,t)=>{var s;const n=null==(s=null==t?void 0:t.getState)?void 0:s.call(t);return n?Vf(Vf({},e),n):e}),{});return cg(t,...e)}var vg=i(422),{useSyncExternalStore:yg}=vg,xg=()=>()=>{};function bg(e,t=Hf){const s=Ef.useCallback((t=>e?hg(e,null,t):xg()),[e]),n=()=>{const s="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&s&&Lf(i,s)?i[s]:void 0};return yg(s,n,n)}function wg(e,t,s,n){const i=Lf(t,s)?t[s]:void 0,r=n?t[n]:void 0,o=wm({value:i,setValue:r});bm((()=>pg(e,[s],((e,t)=>{const{value:n,setValue:i}=o.current;i&&e[s]!==t[s]&&e[s]!==n&&i(e[s])}))),[e,s]),bm((()=>{if(void 0!==i)return e.setState(s,i),fg(e,[s],(()=>{void 0!==i&&e.setState(s,i)}))}))}function _g(e,t,s){return km(t,[s.store]),wg(e,s,"items","setItems"),e}function Sg(e,t,s){return wg(e=_g(e,t,s),s,"activeId","setActiveId"),wg(e,s,"includesBaseElement"),wg(e,s,"virtualFocus"),wg(e,s,"orientation"),wg(e,s,"rtl"),wg(e,s,"focusLoop"),wg(e,s,"focusWrap"),wg(e,s,"focusShift"),e}function jg(e,t,s){return km(t,[s.store,s.disclosure]),wg(e,s,"open","setOpen"),wg(e,s,"mounted","setMounted"),wg(e,s,"animated"),e}function Cg(e,t,s){return jg(e,t,s)}function kg(e,t,s){return km(t,[s.popover]),wg(e=Cg(e,t,s),s,"placement"),e}function Eg(e={}){return function(e={}){const t=gg(e.store,mg(e.disclosure,["contentElement","disclosureElement"])),s=null==t?void 0:t.getState(),n=qf(e.open,null==s?void 0:s.open,e.defaultOpen,!1),i=qf(e.animated,null==s?void 0:s.animated,!1),r=cg({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:qf(null==s?void 0:s.contentElement,null),disclosureElement:qf(null==s?void 0:s.disclosureElement,null)},t);return ug(r,(()=>pg(r,["animated","animating"],(e=>{e.animated||r.setState("animating",!1)})))),ug(r,(()=>hg(r,["open"],(()=>{r.getState().animated&&r.setState("animating",!0)})))),ug(r,(()=>pg(r,["open","animating"],(e=>{r.setState("mounted",e.open||e.animating)})))),Rf(Vf({},r),{setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",(e=>!e)),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)})}(e)}function Pg(e){const t=e.map(((e,t)=>[t,e]));let s=!1;return t.sort((([e,t],[n,i])=>{const r=t.element,o=i.element;return r===o?0:r&&o?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(r,o)?(e>n&&(s=!0),-1):(et)):e}function Ig(e={}){var t;e.store;const s=null==(t=e.store)?void 0:t.getState(),n=qf(e.items,null==s?void 0:s.items,e.defaultItems,[]),i=new Map(n.map((e=>[e.id,e]))),r={items:n,renderedItems:qf(null==s?void 0:s.renderedItems,[])},o=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),a=cg({items:n,renderedItems:r.renderedItems},o),l=cg(r,e.store),c=e=>{const t=Pg(e);a.setState("renderedItems",t),l.setState("renderedItems",t)};ug(l,(()=>dg(a))),ug(a,(()=>fg(a,["items"],(e=>{l.setState("items",e.items)})))),ug(a,(()=>fg(a,["renderedItems"],(e=>{let t=!0,s=requestAnimationFrame((()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(s);const n=function(e){var t;const s=e.find((e=>!!e.element)),n=[...e].reverse().find((e=>!!e.element));let i=null==(t=null==s?void 0:s.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){if(n&&i.contains(n.element))return i;i=i.parentElement}return Xf(i).body}(e.renderedItems),i=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(s),s=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:n});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(s),i.disconnect()}}))));const u=(e,t,s=!1)=>{let n;t((t=>{const s=t.findIndex((({id:t})=>t===e.id)),r=t.slice();if(-1!==s){n=t[s];const o=Vf(Vf({},n),e);r[s]=o,i.set(e.id,o)}else r.push(e),i.set(e.id,e);return r}));return()=>{t((t=>{if(!n)return s&&i.delete(e.id),t.filter((({id:t})=>t!==e.id));const r=t.findIndex((({id:t})=>t===e.id));if(-1===r)return t;const o=t.slice();return o[r]=n,i.set(e.id,n),o}))}},d=e=>u(e,(e=>a.setState("items",e)),!0);return Rf(Vf({},l),{registerItem:d,renderItem:e=>zf(d(e),u(e,(e=>a.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:s}=l.getState();t=s.find((t=>t.id===e)),t&&i.set(e,t)}return t||null},__unstablePrivateStore:a})}function Tg(e){const t=[];for(const s of e)t.push(...s);return t}function Og(e){return e.slice().reverse()}var Ag={id:null};function Mg(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function Ng(e,t){return e.filter((e=>e.rowId===t))}function Fg(e){const t=[];for(const s of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===s.rowId}));e?e.push(s):t.push([s])}return t}function Vg(e){let t=0;for(const{length:s}of e)s>t&&(t=s);return t}function Rg(e,t,s){const n=Vg(e);for(const i of e)for(let e=0;epg(r,["renderedItems","activeId"],(e=>{r.setState("activeId",(t=>{var s;return void 0!==t?t:null==(s=Mg(e.renderedItems))?void 0:s.id}))}))));const o=(e,t,s,n)=>{var i,o;const{activeId:a,rtl:l,focusLoop:c,focusWrap:u,includesBaseElement:d}=r.getState(),h=l&&"vertical"!==t?Og(e):e;if(null==a)return null==(i=Mg(h))?void 0:i.id;const p=h.find((e=>e.id===a));if(!p)return null==(o=Mg(h))?void 0:o.id;const f=!!p.rowId,m=h.indexOf(p),g=h.slice(m+1),v=Ng(g,p.rowId);if(void 0!==n){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(v,a),t=e.slice(n)[0]||e[e.length-1];return null==t?void 0:t.id}const y=function(e){return"vertical"===e?"horizontal":"horizontal"===e?"vertical":void 0}(f?t||"horizontal":t),x=c&&c!==y,b=f&&u&&u!==y;if(s=s||!f&&x&&d,x){const e=function(e,t,s=!1){const n=e.findIndex((e=>e.id===t));return[...e.slice(n+1),...s?[Ag]:[],...e.slice(0,n)]}(b&&!s?h:Ng(h,p.rowId),a,s),t=Mg(e,a);return null==t?void 0:t.id}if(b){const e=Mg(s?v:g,a);return s?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const w=Mg(v,a);return!w&&s?null:null==w?void 0:w.id};return Rf(Vf(Vf({},n),r),{setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=Mg(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=Mg(Og(r.getState().renderedItems)))?void 0:e.id},next:e=>{const{renderedItems:t,orientation:s}=r.getState();return o(t,s,!1,e)},previous:e=>{var t;const{renderedItems:s,orientation:n,includesBaseElement:i}=r.getState(),a=!!!(null==(t=Mg(s))?void 0:t.rowId)&&i;return o(Og(s),n,a,e)},down:e=>{const{activeId:t,renderedItems:s,focusShift:n,focusLoop:i,includesBaseElement:a}=r.getState(),l=n&&!e,c=Bg(Tg(Rg(Fg(s),t,l)));return o(c,"vertical",i&&"horizontal"!==i&&a,e)},up:e=>{const{activeId:t,renderedItems:s,focusShift:n,includesBaseElement:i}=r.getState(),a=n&&!e,l=Bg(Og(Tg(Rg(Fg(s),t,a))));return o(l,"vertical",i,e)}})}var Lg=cm()&&am();function zg(e={}){var t;e.store;const s=null==(t=e.store)?void 0:t.getState(),n=qf(e.activeId,null==s?void 0:s.activeId,e.defaultActiveId,null),i=Dg(Rf(Vf({},e),{activeId:n,includesBaseElement:qf(e.includesBaseElement,null==s?void 0:s.includesBaseElement,!0),orientation:qf(e.orientation,null==s?void 0:s.orientation,"vertical"),focusLoop:qf(e.focusLoop,null==s?void 0:s.focusLoop,!0),focusWrap:qf(e.focusWrap,null==s?void 0:s.focusWrap,!0),virtualFocus:qf(e.virtualFocus,null==s?void 0:s.virtualFocus,!Lg)})),r=function(e={}){var t=e,{popover:s}=t,n=Bf(t,["popover"]);const i=gg(n.store,mg(s,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),r=null==i?void 0:i.getState(),o=Eg(Rf(Vf({},n),{store:i})),a=qf(n.placement,null==r?void 0:r.placement,"bottom"),l=cg(Rf(Vf({},o.getState()),{placement:a,currentPlacement:a,anchorElement:qf(null==r?void 0:r.anchorElement,null),popoverElement:qf(null==r?void 0:r.popoverElement,null),arrowElement:qf(null==r?void 0:r.arrowElement,null),rendered:Symbol("rendered")}),o,i);return Rf(Vf(Vf({},o),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(Rf(Vf({},e),{placement:qf(e.placement,null==s?void 0:s.placement,"bottom-start")})),o=qf(e.value,null==s?void 0:s.value,e.defaultValue,""),a=qf(e.selectedValue,null==s?void 0:s.selectedValue,e.defaultSelectedValue,""),l=Array.isArray(a),c=cg(Rf(Vf(Vf({},i.getState()),r.getState()),{value:o,selectedValue:a,resetValueOnSelect:qf(e.resetValueOnSelect,null==s?void 0:s.resetValueOnSelect,l),resetValueOnHide:qf(e.resetValueOnHide,null==s?void 0:s.resetValueOnHide,l),activeValue:null==s?void 0:s.activeValue}),i,r,e.store);return ug(c,(()=>pg(c,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||c.setState("value",o))})))),ug(c,(()=>pg(c,["resetValueOnSelect","selectedValue"],(e=>{e.resetValueOnSelect&&c.setState("value",o)})))),ug(c,(()=>fg(c,["mounted"],(e=>{e.mounted||(c.setState("activeId",n),c.setState("moves",0))})))),ug(c,(()=>pg(c,["moves","activeId"],((e,t)=>{e.moves===t.moves&&c.setState("activeValue",void 0)})))),ug(c,(()=>fg(c,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:s}=c.getState(),n=i.item(s);c.setState("activeValue",null==n?void 0:n.value)})))),Rf(Vf(Vf(Vf({},r),i),c),{setValue:e=>c.setState("value",e),setSelectedValue:e=>c.setState("selectedValue",e)})}function Gg(e={}){const[t,s]=function(e,t){const[s,n]=Ef.useState((()=>e(t)));bm((()=>dg(s)),[s]);const i=Ef.useCallback((e=>bg(s,e)),[s]);return[Ef.useMemo((()=>Cf(jf({},s),{useState:i})),[s,i]),_m((()=>{n((s=>e(jf(jf({},t),s.getState()))))}))]}(zg,e);return function(e,t,s){return wg(e=Sg(e=kg(e,t,s),t,s),s,"value","setValue"),wg(e,s,"selectedValue","setSelectedValue"),wg(e,s,"resetValueOnHide"),wg(e,s,"resetValueOnSelect"),e}(t,s,e)}var Hg=Bm(),Ug=(Hg.useContext,Hg.useScopedContext,Hg.useProviderContext),Wg=Bm([Hg.ContextProvider],[Hg.ScopedContextProvider]),qg=(Wg.useContext,Wg.useScopedContext,Wg.useProviderContext,Wg.ContextProvider),Zg=Wg.ScopedContextProvider,Kg=((0,Ef.createContext)(void 0),(0,Ef.createContext)(void 0),Bm([qg],[Zg])),Yg=(Kg.useContext,Kg.useScopedContext,Kg.useProviderContext),Xg=Kg.ContextProvider,Jg=Kg.ScopedContextProvider,Qg=Bm([Xg,Um],[Jg,Wm]),$g=(Qg.useContext,Qg.useScopedContext),ev=Qg.useProviderContext,tv=Qg.ContextProvider,sv=Qg.ScopedContextProvider,nv=(0,Ef.createContext)(void 0),iv=(0,Ef.createContext)(!1);function rv(e={}){const t=Gg(e);return(0,me.jsx)(tv,{value:t,children:e.children})}var ov=Rm((e=>{var t=e,{store:s}=t,n=kf(t,["store"]);const i=ev();Uf(s=s||i,!1);const r=s.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return n=jf({htmlFor:r},n)})),av=Fm((e=>Vm("label",ov(e))));var lv=Rm((e=>{var t=e,{store:s}=t,n=kf(t,["store"]);const i=Yg();return s=s||i,n=Cf(jf({},n),{ref:Sm(null==s?void 0:s.setAnchorElement,n.ref)})}));Nm((e=>Vm("div",lv(e))));var cv=(0,Ef.createContext)(!0),uv=cm(),dv=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"];function hv(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function pv(e,t,s,n,i){return e?t?s&&!n?-1:void 0:s?i:i||0:i}function fv(e,t){return _m((s=>{null==e||e(s),s.defaultPrevented||t&&(s.stopPropagation(),s.preventDefault())}))}var mv=!0;function gv(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(mv=!1))}function vv(e){e.metaKey||e.ctrlKey||e.altKey||(mv=!0)}var yv=Rm((e=>{var t=e,{focusable:s=!0,accessibleWhenDisabled:n,autoFocus:i,onFocusVisible:r}=t,o=kf(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const a=(0,Ef.useRef)(null);(0,Ef.useEffect)((()=>{s&&(gm("mousedown",gv,!0),gm("keydown",vv,!0))}),[s]),uv&&(0,Ef.useEffect)((()=>{if(!s)return;const e=a.current;if(!e)return;if(!hv(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const n=()=>queueMicrotask((()=>e.focus()));return t.forEach((e=>e.addEventListener("mouseup",n))),()=>{t.forEach((e=>e.removeEventListener("mouseup",n)))}}),[s]);const l=s&&Wf(o),c=!!l&&!n,[u,d]=(0,Ef.useState)(!1);(0,Ef.useEffect)((()=>{s&&c&&u&&d(!1)}),[s,c,u]),(0,Ef.useEffect)((()=>{if(!s)return;if(!u)return;const e=a.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{tg(e)||d(!1)}));return t.observe(e),()=>t.disconnect()}),[s,u]);const h=fv(o.onKeyPressCapture,l),p=fv(o.onMouseDownCapture,l),f=fv(o.onClickCapture,l),m=o.onMouseDown,g=_m((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!s)return;const t=e.currentTarget;if(!uv)return;if(um(e))return;if(!$f(t)&&!hv(t))return;let n=!1;const i=()=>{n=!0};t.addEventListener("focusin",i,{capture:!0,once:!0}),mm(t,"mouseup",(()=>{t.removeEventListener("focusin",i,!0),n||function(e){!ng(e)&&tg(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!s)return;const n=e.currentTarget;n&&sg(n)&&(null==r||r(e),e.defaultPrevented||d(!0))},y=o.onKeyDownCapture,x=_m((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!s)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!dm(e))return;const t=e.currentTarget;queueMicrotask((()=>v(e,t)))})),b=o.onFocusCapture,w=_m((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!s)return;if(!dm(e))return void d(!1);const t=e.currentTarget,n=()=>v(e,t);mv||function(e){const{tagName:t,readOnly:s,type:n}=e;return"TEXTAREA"===t&&!s||"SELECT"===t&&!s||("INPUT"!==t||s?!!e.isContentEditable:dv.includes(n))}(e.target)?queueMicrotask(n):!function(e){return"combobox"===e.getAttribute("role")&&!!e.dataset.name}(e.target)?d(!1):mm(e.target,"focusout",n)})),_=o.onBlur,S=_m((e=>{null==_||_(e),s&&fm(e)&&d(!1)})),j=(0,Ef.useContext)(cv),C=_m((e=>{s&&i&&e&&j&&queueMicrotask((()=>{sg(e)||tg(e)&&e.focus()}))})),k=Cm(a,o.as),E=s&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),P=s&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),I=c?jf({pointerEvents:"none"},o.style):o.style;return o=Cf(jf({"data-focus-visible":s&&u?"":void 0,"data-autofocus":!!i||void 0,"aria-disabled":!!l||void 0},o),{ref:Sm(a,C,o.ref),style:I,tabIndex:pv(s,c,E,P,o.tabIndex),disabled:!(!P||!c)||void 0,contentEditable:l?void 0:o.contentEditable,onKeyPressCapture:h,onClickCapture:f,onMouseDownCapture:p,onMouseDown:g,onKeyDownCapture:x,onFocusCapture:w,onBlur:S})}));Nm((e=>Vm("div",e=yv(e))));function xv(e,t,s){return _m((n=>{var i;if(null==t||t(n),n.defaultPrevented)return;if(n.isPropagationStopped())return;if(!dm(n))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(n))return;if(function(e){const t=e.target;return!(t&&!sm(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(n))return;const r=e.getState(),o=null==(i=ff(e,r.activeId))?void 0:i.element;if(!o)return;const a=n,{view:l}=a,c=kf(a,["view"]);o!==(null==s?void 0:s.current)&&o.focus(),function(e,t,s){const n=new KeyboardEvent(t,s);return e.dispatchEvent(n)}(o,n.type,c)||n.preventDefault(),n.currentTarget.contains(o)&&n.stopPropagation()}))}var bv=Rm((e=>{var t=e,{store:s,composite:n=!0,focusOnMove:i=n,moveOnKeyPress:r=!0}=t,o=kf(t,["store","composite","focusOnMove","moveOnKeyPress"]);const a=Hm();Uf(s=s||a,!1);const l=(0,Ef.useRef)(null),c=function(e){const[t,s]=(0,Ef.useState)(!1),n=(0,Ef.useCallback)((()=>s(!0)),[]),i=e.useState((t=>ff(e,t.activeId)));return(0,Ef.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(s(!1),e.focus({preventScroll:!0}))}),[i,t]),n}(s),u=s.useState("moves");(0,Ef.useEffect)((()=>{var e;if(!s)return;if(!u)return;if(!n)return;if(!i)return;const{activeId:t}=s.getState(),r=null==(e=ff(s,t))?void 0:e.element;var o,a;r&&("scrollIntoView"in(o=r)?(o.focus({preventScroll:!0}),o.scrollIntoView(Vf({block:"nearest",inline:"nearest"},a))):o.focus())}),[s,u,n,i]),bm((()=>{if(!s)return;if(!u)return;if(!n)return;const{baseElement:e,activeId:t}=s.getState();if(!(null===t))return;if(!e)return;const i=l.current;l.current=null,i&&hm(i,{relatedTarget:e}),sg(e)||e.focus()}),[s,u,n]);const d=s.useState("activeId"),h=s.useState("virtualFocus");bm((()=>{var e;if(!s)return;if(!n)return;if(!h)return;const t=l.current;if(l.current=null,!t)return;const i=(null==(e=ff(s,d))?void 0:e.element)||Jf(t);i!==t&&hm(t,{relatedTarget:i})}),[s,d,h,n]);const p=xv(s,o.onKeyDownCapture,l),f=xv(s,o.onKeyUpCapture,l),m=o.onFocusCapture,g=_m((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!s)return;const{virtualFocus:t}=s.getState();if(!t)return;const n=e.relatedTarget,i=function(e){const t=e[mf];return delete e[mf],t}(e.currentTarget);dm(e)&&i&&(e.stopPropagation(),l.current=n)})),v=o.onFocus,y=_m((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!n)return;if(!s)return;const{relatedTarget:t}=e,{virtualFocus:i}=s.getState();i?dm(e)&&!gf(s,t)&&queueMicrotask(c):dm(e)&&s.setActiveId(null)})),x=o.onBlurCapture,b=_m((e=>{var t;if(null==x||x(e),e.defaultPrevented)return;if(!s)return;const{virtualFocus:n,activeId:i}=s.getState();if(!n)return;const r=null==(t=ff(s,i))?void 0:t.element,o=e.relatedTarget,a=gf(s,o),c=l.current;if(l.current=null,dm(e)&&a)o===r?c&&c!==o&&hm(c,e):r?hm(r,e):c&&hm(c,e),e.stopPropagation();else{!gf(s,e.target)&&r&&hm(r,e)}})),w=o.onKeyDown,_=Em(r),S=_m((e=>{var t;if(null==w||w(e),e.defaultPrevented)return;if(!s)return;if(!dm(e))return;const{orientation:n,items:i,renderedItems:r,activeId:o}=s.getState(),a=ff(s,o);if(null==(t=null==a?void 0:a.element)?void 0:t.isConnected)return;const l="horizontal"!==n,c="vertical"!==n,u=function(e){return e.some((e=>!!e.rowId))}(r);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&sm(e.currentTarget))return;const d={ArrowUp:(u||l)&&(()=>{if(u){const e=i&&function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(Tg(Og(function(e){const t=[];for(const s of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===s.rowId}));e?e.push(s):t.push([s])}return t}(e))))}(i);return null==e?void 0:e.id}return null==s?void 0:s.last()}),ArrowRight:(u||c)&&s.first,ArrowDown:(u||l)&&s.first,ArrowLeft:(u||c)&&s.last,Home:s.first,End:s.last,PageUp:s.first,PageDown:s.last},h=d[e.key];if(h){const t=h();if(void 0!==t){if(!_(e))return;e.preventDefault(),s.move(t)}}}));o=Pm(o,(e=>(0,me.jsx)(Um,{value:s,children:e})),[s]);const j=s.useState((e=>{var t;if(s&&n&&e.virtualFocus)return null==(t=ff(s,e.activeId))?void 0:t.id}));o=Cf(jf({"aria-activedescendant":j},o),{ref:Sm(n?s.setBaseElement:null,o.ref),onKeyDownCapture:p,onKeyUpCapture:f,onFocusCapture:g,onFocus:y,onBlurCapture:b,onKeyDown:S});const C=s.useState((e=>n&&(e.virtualFocus||null===e.activeId)));return o=yv(jf({focusable:C},o))}));Nm((e=>Vm("div",bv(e))));const wv=window.ReactDOM;function _v(e,t,s){if(!s)return!1;const n=e.find((e=>!e.disabled&&e.value));return(null==n?void 0:n.value)===t}function Sv(e,t){return!!t&&(null!=e&&(e=Gf(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var jv=Rm((e=>{var t=e,{store:s,focusable:n=!0,autoSelect:i=!1,getAutoSelectId:r,showOnChange:o=!0,setValueOnChange:a=!0,showOnMouseDown:l=!0,setValueOnClick:c=!0,showOnKeyDown:u=!0,moveOnKeyPress:d=!0,autoComplete:h="list"}=t,p=kf(t,["store","focusable","autoSelect","getAutoSelectId","showOnChange","setValueOnChange","showOnMouseDown","setValueOnClick","showOnKeyDown","moveOnKeyPress","autoComplete"]);const f=ev();Uf(s=s||f,!1);const m=(0,Ef.useRef)(null),[g,v]=(0,Ef.useReducer)((()=>[]),[]),y=(0,Ef.useRef)(!1),x=(0,Ef.useRef)(!1),b=s.useState((e=>!!i&&e.virtualFocus)),w="inline"===h||"both"===h,[_,S]=(0,Ef.useState)(w);!function(e,t){const s=(0,Ef.useRef)(!1);bm((()=>{if(s.current)return e();s.current=!0}),t),bm((()=>()=>{s.current=!1}),[])}((()=>{w&&S(!0)}),[w]);const j=s.useState("value"),C=s.useState((e=>w&&_?e.activeValue:void 0)),k=s.useState("renderedItems"),E=s.useState("open"),P=s.useState("contentElement"),I=(0,Ef.useMemo)((()=>{if(!w)return j;if(!_)return j;if(_v(k,C,b)){if(Sv(j,C)){const e=(null==C?void 0:C.slice(j.length))||"";return j+e}return j}return C||j}),[w,_,k,C,b,j]);(0,Ef.useEffect)((()=>{const e=m.current;if(!e)return;const t=()=>S(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,Ef.useEffect)((()=>{if(!w)return;if(!_)return;if(!C)return;_v(k,C,b)&&Sv(j,C)&&queueMicrotask((()=>{const e=m.current;e&&om(e,j.length,C.length)}))}),[g,w,_,C,k,b,j]);const T=(0,Ef.useRef)(null),O=_m(r),A=(0,Ef.useRef)(null);(0,Ef.useEffect)((()=>{if(!E)return;if(!P)return;const e=rm(P);if(!e)return;T.current=e;const t=()=>{y.current=!1},n=()=>{if(!s)return;if(!y.current)return;const{activeId:e}=s.getState();null!==e&&e!==A.current&&(y.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("scroll",n,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("scroll",n,!0)}}),[E,P,s]),bm((()=>{j&&(x.current||(y.current=!0))}),[j]),bm((()=>{E||(y.current=!1)}),[E]);const M=s.useState("resetValueOnSelect");km((()=>{var e;const t=y.current;if(!s)return;if(!(b&&t||M))return;const{baseElement:n,contentElement:i,activeId:r}=s.getState();if(!n||sg(n)){if(null==i?void 0:i.hasAttribute("data-placing")){const e=new MutationObserver(v);return e.observe(i,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(b&&t){const e=O(k),t=void 0!==e?e:s.first();A.current=t,s.move(null!=t?t:null)}else{const t=null==(e=s.item(r))?void 0:e.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[s,g,j,b,M,O,k]),(0,Ef.useEffect)((()=>{if(!w)return;const e=m.current;if(!e)return;const t=[e,P].filter((e=>!!e)),n=e=>{t.every((t=>fm(e,t)))&&(null==s||s.setValue(I))};return t.forEach((e=>e.addEventListener("focusout",n))),()=>{t.forEach((e=>e.removeEventListener("focusout",n)))}}),[w,P,s,I]);const N=p.onChange,F=Em(o),V=Em(a),R=_m((e=>{if(null==N||N(e),e.defaultPrevented)return;if(!s)return;const{value:t,selectionStart:n,selectionEnd:i}=e.target,r=e.nativeEvent;if(y.current=!0,function(e){return"input"===e.type}(r)&&(r.isComposing&&(y.current=!1,x.current=!0),w)){const e="insertText"===r.inputType||"insertCompositionText"===r.inputType,s=n===t.length;S(e&&s)}if(V(e)){const r=t===s.getState().value;(0,wv.flushSync)((()=>null==s?void 0:s.setValue(t))),om(e.currentTarget,n,i),w&&b&&r&&v()}F(e)&&s.show(),b&&y.current||s.setActiveId(null)})),B=p.onCompositionEnd,D=_m((e=>{y.current=!0,x.current=!1,null==B||B(e),e.defaultPrevented||b&&v()})),L=p.onMouseDown,z=Em(c),G=Em(l),H=_m((e=>{null==L||L(e),e.defaultPrevented||e.button||e.ctrlKey||s&&(s.setActiveId(null),z(e)&&s.setValue(I),G(e)&&mm(e.currentTarget,"mouseup",s.show))})),U=p.onKeyDown,W=Em(u),q=_m((e=>{if(null==U||U(e),e.repeat||(y.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!s)return;const{open:t,activeId:n}=s.getState();t||null===n&&("ArrowUp"!==e.key&&"ArrowDown"!==e.key||W(e)&&(e.preventDefault(),s.show()))})),Z=p.onBlur,K=_m((e=>{y.current=!1,null==Z||Z(e),e.defaultPrevented})),Y=jm(p.id),X=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(h)?h:void 0,J=s.useState((e=>null===e.activeId));return p=Cf(jf({id:Y,role:"combobox","aria-autocomplete":X,"aria-haspopup":nm(P,"listbox"),"aria-expanded":E,"aria-controls":null==P?void 0:P.id,"data-active-item":J||void 0,value:I},p),{ref:Sm(m,p.ref),onChange:R,onCompositionEnd:D,onMouseDown:H,onKeyDown:q,onBlur:K}),p=bv(Cf(jf({store:s,focusable:n},p),{moveOnKeyPress:e=>!function(e,...t){const s="function"==typeof e?e(...t):e;return null!=s&&!s}(d,e)&&(w&&S(!0),!0)})),p=lv(jf({store:s},p)),jf({autoComplete:"off"},p)})),Cv=Nm((e=>Vm("input",jv(e))));function kv(e,t){const s=setTimeout(t,e);return()=>clearTimeout(s)}function Ev(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const s=1e3*parseFloat(t||"0s");return s>e?s:e}),0)}function Pv(e,t,s){return!(s||!1===t||e&&!t)}var Iv=Rm((e=>{var t=e,{store:s,alwaysVisible:n}=t,i=kf(t,["store","alwaysVisible"]);const r=Ug();Uf(s=s||r,!1);const o=jm(i.id),[a,l]=(0,Ef.useState)(null),c=s.useState("open"),u=s.useState("mounted"),d=s.useState("animated"),h=s.useState("contentElement");bm((()=>{if(d){if(null==h?void 0:h.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{l(c?"enter":"leave")}));l(null)}}),[d,h,c]),bm((()=>{if(!s)return;if(!d)return;if(!h)return;if(!a)return;if("enter"===a&&!c)return;if("leave"===a&&c)return;if("number"==typeof d){return kv(d,s.stopAnimation)}const{transitionDuration:e,animationDuration:t,transitionDelay:n,animationDelay:i}=getComputedStyle(h),r=Ev(n,i)+Ev(e,t);return r?kv(r,s.stopAnimation):void 0}),[s,d,h,c,a]);const p=Pv(u,(i=Pm(i,(e=>(0,me.jsx)(Zg,{value:s,children:e})),[s])).hidden,n),f=p?Cf(jf({},i.style),{display:"none"}):i.style;return i=Cf(jf({id:o,"data-enter":"enter"===a?"":void 0,"data-leave":"leave"===a?"":void 0,hidden:p},i),{ref:Sm(o?s.setContentElement:null,i.ref),style:f})})),Tv=Nm((e=>Vm("div",Iv(e))));Nm((e=>{var t=e,{unmountOnHide:s}=t,n=kf(t,["unmountOnHide"]);const i=Ug();return!1===bg(n.store||i,(e=>!s||(null==e?void 0:e.mounted)))?null:(0,me.jsx)(Tv,jf({},n))}));var Ov=Rm((e=>{var t=e,{store:s,focusable:n=!0,alwaysVisible:i}=t,r=kf(t,["store","focusable","alwaysVisible"]);const o=ev();Uf(s=s||o,!1);const a=(0,Ef.useRef)(null),l=jm(r.id),c=r.onKeyDown,u=_m((e=>{null==c||c(e),e.defaultPrevented||"Escape"===e.key&&(null==s||s.move(null))})),d=(0,Ef.useRef)(!1),h=r.onFocusVisible,p=_m((e=>{if(null==h||h(e),e.defaultPrevented)return;if("focus"!==e.type)return;if(!s)return;const{virtualFocus:t}=s.getState();if(!t)return;const{relatedTarget:n,currentTarget:i}=e;n&&i.contains(n)||(d.current=!0,s.setState("virtualFocus",!1))})),f=r.onBlur,m=_m((e=>{null==f||f(e),e.defaultPrevented||d.current&&fm(e)&&(d.current=!1,null==s||s.setState("virtualFocus",!0))}));r=Pm(r,(e=>(0,me.jsx)(sv,{value:s,children:e})),[s]);const g=Pv(s.useState("mounted"),r.hidden,i),v=g?Cf(jf({},r.style),{display:"none"}):r.style,y=s.useState((e=>Array.isArray(e.selectedValue))),x=function(e,t,s){const[n,i]=(0,Ef.useState)(s);return bm((()=>{const s=e&&"current"in e?e.current:e,n=null==s?void 0:s.getAttribute(t);null!=n&&i(n)}),[e,t]),n}(a,"role",r.role);return r=Cf(jf({id:l,hidden:g,role:"listbox",tabIndex:n?-1:void 0,"aria-multiselectable":("listbox"===x||"tree"===x||"grid"===x)&&y||void 0},r),{ref:Sm(l?s.setContentElement:null,a,r.ref),style:v,onKeyDown:u,onFocusVisible:p,onBlur:m}),r=yv(jf({focusable:n},r))})),Av=Nm((e=>Vm("div",Ov(e))));function Mv(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?$f(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&($f(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var Nv=Symbol("command"),Fv=Rm((e=>{var t=e,{clickOnEnter:s=!0,clickOnSpace:n=!0}=t,i=kf(t,["clickOnEnter","clickOnSpace"]);const r=(0,Ef.useRef)(null),o=Cm(r,i.as),a=i.type,[l,c]=(0,Ef.useState)((()=>!!o&&$f({tagName:o,type:a})));(0,Ef.useEffect)((()=>{r.current&&c($f(r.current))}),[]);const[u,d]=(0,Ef.useState)(!1),h=(0,Ef.useRef)(!1),p=Wf(i),[f,m]=function(e,t,s){const n=e.onLoadedMetadataCapture,i=(0,Ef.useMemo)((()=>Object.assign((()=>{}),Cf(jf({},n),{[t]:s}))),[n,t,s]);return[null==n?void 0:n[t],{onLoadedMetadataCapture:i}]}(i,Nv,!0),g=i.onKeyDown,v=_m((e=>{null==g||g(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(f)return;if(p)return;if(!dm(e))return;if(sm(t))return;if(t.isContentEditable)return;const i=s&&"Enter"===e.key,r=n&&" "===e.key,o="Enter"===e.key&&!s,a=" "===e.key&&!n;if(o||a)e.preventDefault();else if(i||r){const s=Mv(e);if(i){if(!s){e.preventDefault();const s=e,{view:n}=s,i=kf(s,["view"]),r=()=>pm(t,i);Yf&&/firefox\//i.test(navigator.userAgent)?mm(t,"keyup",r):queueMicrotask(r)}}else r&&(h.current=!0,s||(e.preventDefault(),d(!0)))}})),y=i.onKeyUp,x=_m((e=>{if(null==y||y(e),e.defaultPrevented)return;if(f)return;if(p)return;if(e.metaKey)return;const t=n&&" "===e.key;if(h.current&&t&&(h.current=!1,!Mv(e))){e.preventDefault(),d(!1);const t=e.currentTarget,s=e,{view:n}=s,i=kf(s,["view"]);queueMicrotask((()=>pm(t,i)))}}));return i=Cf(jf(jf({"data-active":u?"":void 0,type:l?"button":void 0},m),i),{ref:Sm(r,i.ref),onKeyDown:v,onKeyUp:x}),i=yv(i)}));Nm((e=>Vm("button",e=Fv(e))));var Vv=Rm((e=>{var t=e,{store:s,shouldRegisterItem:n=!0,getItem:i=Hf,element:r}=t,o=kf(t,["store","shouldRegisterItem","getItem","element"]);const a=Lm();s=s||a;const l=jm(o.id),c=(0,Ef.useRef)(r);return(0,Ef.useEffect)((()=>{const e=c.current;if(!l)return;if(!e)return;if(!n)return;const t=i({id:l,element:e});return null==s?void 0:s.renderItem(t)}),[l,n,i,s]),o=Cf(jf({},o),{ref:Sm(c,o.ref)})}));Nm((e=>Vm("div",Vv(e))));function Rv(e,t=!1){const{top:s}=e.getBoundingClientRect();return t?s+e.clientHeight:s}function Bv(e,t,s,n=!1){var i;if(!t)return;if(!s)return;const{renderedItems:r}=t.getState(),o=rm(e);if(!o)return;const a=function(e,t=!1){const s=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*s,s-40),r=t?s-i+n:i+n;return"HTML"===e.tagName?r+e.scrollTop:r}(o,n);let l,c;for(let e=0;e=0){void 0!==c&&c{var t=e,{store:s,rowId:n,preventScrollOnKeyDown:i=!1,moveOnKeyPress:r=!0,tabbable:o=!1,getItem:a,"aria-setsize":l,"aria-posinset":c}=t,u=kf(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const d=Gm();s=s||d;const h=jm(u.id),p=(0,Ef.useRef)(null),f=(0,Ef.useContext)(Zm),m=bg(s,(e=>n||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0))),g=Wf(u)&&!u.accessibleWhenDisabled,v=(0,Ef.useCallback)((e=>{const t=Cf(jf({},e),{id:h||e.id,rowId:m,disabled:!!g});return a?a(t):t}),[h,m,g,a]),y=u.onFocus,x=(0,Ef.useRef)(!1),b=_m((e=>{if(null==y||y(e),e.defaultPrevented)return;if(um(e))return;if(!h)return;if(!s)return;const{activeId:t,virtualFocus:n,baseElement:i}=s.getState();if(function(e,t){return!dm(e)&&gf(t,e.target)}(e,s))return;if(t!==h&&s.setActiveId(h),!n)return;if(!dm(e))return;if((r=e.currentTarget).isContentEditable||sm(r)||"INPUT"===r.tagName&&!$f(r))return;var r;if(!(null==i?void 0:i.isConnected))return;x.current=!0;e.relatedTarget===i||gf(s,e.relatedTarget)?function(e){e[mf]=!0,e.focus({preventScroll:!0})}(i):i.focus()})),w=u.onBlurCapture,_=_m((e=>{if(null==w||w(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState();(null==t?void 0:t.virtualFocus)&&x.current&&(x.current=!1,e.preventDefault(),e.stopPropagation())})),S=u.onKeyDown,j=Em(i),C=Em(r),k=_m((e=>{if(null==S||S(e),e.defaultPrevented)return;if(!dm(e))return;if(!s)return;const{currentTarget:t}=e,n=s.getState(),i=s.item(h),r=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,a="vertical"!==n.orientation,l=()=>!!r||(!!a||(!n.baseElement||!sm(n.baseElement))),c={ArrowUp:(r||o)&&s.up,ArrowRight:(r||a)&&s.next,ArrowDown:(r||o)&&s.down,ArrowLeft:(r||a)&&s.previous,Home:()=>{if(l())return!r||e.ctrlKey?null==s?void 0:s.first():null==s?void 0:s.previous(-1)},End:()=>{if(l())return!r||e.ctrlKey?null==s?void 0:s.last():null==s?void 0:s.next(-1)},PageUp:()=>Bv(t,s,null==s?void 0:s.up,!0),PageDown:()=>Bv(t,s,null==s?void 0:s.down)}[e.key];if(c){const t=c();if(j(e)||void 0!==t){if(!C(e))return;e.preventDefault(),s.move(t)}}})),E=bg(s,(e=>(null==e?void 0:e.baseElement)||void 0)),P=(0,Ef.useMemo)((()=>({id:h,baseElement:E})),[h,E]);u=Pm(u,(e=>(0,me.jsx)(qm.Provider,{value:P,children:e})),[P]);const I=bg(s,(e=>!!e&&e.activeId===h)),T=bg(s,"virtualFocus"),O=function(e,t){const s=t.role,[n,i]=(0,Ef.useState)(s);return bm((()=>{const t=e.current;t&&i(t.getAttribute("role")||s)}),[s]),n}(p,u);let A;I&&(!function(e){return"option"===e||"treeitem"===e}(O)?T&&function(e){return"option"===e||"tab"===e||"treeitem"===e||"gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e}(O)&&(A=!0):A=!0);const M=bg(s,(e=>null!=l?l:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0)),N=bg(s,(e=>{if(null!=c)return c;if(!e)return;if(!(null==f?void 0:f.ariaPosInSet))return;if(f.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===m));return f.ariaPosInSet+t.findIndex((e=>e.id===h))})),F=bg(s,(e=>!(null==e?void 0:e.renderedItems.length)||!e.virtualFocus&&(!!o||e.activeId===h)));return u=Cf(jf({id:h,"aria-selected":A,"data-active-item":I?"":void 0},u),{ref:Sm(p,u.ref),tabIndex:F?u.tabIndex:-1,onFocus:b,onBlurCapture:_,onKeyDown:k}),u=Fv(u),u=Vv(Cf(jf({store:s},u),{getItem:v,shouldRegisterItem:!!h&&u.shouldRegisterItem})),Cf(jf({},u),{"aria-setsize":M,"aria-posinset":N})}));Fm((e=>Vm("button",Dv(e))));var Lv=Rm((e=>{var t=e,{store:s,value:n,hideOnClick:i,selectValueOnClick:r=!0,setValueOnClick:o,focusOnHover:a=!1,moveOnKeyPress:l=!0,getItem:c}=t,u=kf(t,["store","value","hideOnClick","selectValueOnClick","setValueOnClick","focusOnHover","moveOnKeyPress","getItem"]);const d=$g();Uf(s=s||d,!1);const h=(0,Ef.useCallback)((e=>{const t=Cf(jf({},e),{value:n});return c?c(t):t}),[n,c]),p=s.useState((e=>Array.isArray(e.selectedValue)));o=null!=o?o:!p,i=null!=i?i:null!=n&&!p;const f=u.onClick,m=Em(o),g=Em(r),v=Em(i),y=_m((e=>{null==f||f(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const s=t.tagName.toLowerCase();return!!e.altKey&&("a"===s||"button"===s&&"submit"===t.type||"input"===s&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const s=lm();if(s&&!e.metaKey)return!1;if(!s&&!e.ctrlKey)return!1;const n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(e)||(null!=n&&(g(e)&&(null==s||s.setSelectedValue((e=>Array.isArray(e)?e.includes(n)?e.filter((e=>e!==n)):[...e,n]:n))),m(e)&&(null==s||s.setValue(n))),v(e)&&(null==s||s.move(null),null==s||s.hide()))})),x=u.onKeyDown,b=_m((e=>{if(null==x||x(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState().baseElement;if(!t)return;if(sg(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),sm(t)&&(null==s||s.setValue(t.value)))})),w=s.useState((e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,n)));p&&null!=w&&(u=jf({"aria-selected":w},u)),u=Pm(u,(e=>(0,me.jsx)(nv.Provider,{value:n,children:(0,me.jsx)(iv.Provider,{value:null!=w&&w,children:e})})),[n,w]);const _=s.useState("contentElement");u=Cf(jf({role:im(_),children:n},u),{onClick:y,onKeyDown:b});const S=Em(l);return u=Dv(Cf(jf({store:s},u),{getItem:h,moveOnKeyPress:e=>{if(!S(e))return!1;const t=new Event("combobox-item-move"),n=null==s?void 0:s.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),u=og(jf({store:s,focusOnHover:a},u))})),zv=Fm((e=>Vm("div",Lv(e))));function Gv(e){return Gf(e).toLowerCase()}var Hv=Rm((e=>{var t=e,{store:s,value:n}=t,i=kf(t,["store","value"]);const r=$g();s=s||r;const o=(0,Ef.useContext)(nv),a=null!=n?n:o;Uf(s,!1);const l=s.useState((e=>a&&e.value?e.value:void 0)),c=(0,Ef.useMemo)((()=>a&&l?function(e,t){t=Gv(t);let s=Gv(e).indexOf(t);const n=[];for(;-1!==s;)0!==s&&n.push((0,me.jsx)("span",{"data-autocomplete-value":"",children:e.substr(0,s)},n.length)),n.push((0,me.jsx)("span",{"data-user-value":"",children:e.substr(s,t.length)},n.length)),s=Gv(e=e.substr(s+t.length)).indexOf(t);return e&&n.push((0,me.jsx)("span",{"data-autocomplete-value":"",children:e},n.length)),n}(a,l):a),[a,l]);return i=jf({children:c},i)})),Uv=Nm((e=>Vm("span",Hv(e))));var Wv=i(9681),qv=i.n(Wv);const Zv=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),{CompositeV2:Kv,CompositeItemV2:Yv,useCompositeStoreV2:Xv}=Wh(x.privateApis),Jv=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Circle,{cx:12,cy:12,r:3})});function Qv(e=""){return qv()(e.trim().toLowerCase())}const $v=[],ey=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:$v,ty=(e,t,s)=>e.singleSelection?s:Array.isArray(t?.value)?t.value.includes(s)?t.value.filter((e=>e!==s)):[...t.value,s]:[s];function sy({view:e,filter:t,onChangeView:s}){const n=Xv({virtualFocus:!0,focusLoop:!0,defaultActiveId:1===t.operators?.length?void 0:null}),i=e.filters.find((e=>e.field===t.field)),r=ey(t,i);return(0,me.jsx)(Kv,{store:n,role:"listbox",className:"dataviews-search-widget-listbox","aria-label":(0,b.sprintf)((0,b.__)("List of: %1$s"),t.name),onFocusVisible:()=>{n.getState().activeId||n.move(n.first())},render:(0,me.jsx)($m,{store:n}),children:t.elements.map((o=>(0,me.jsxs)(ag,{store:n,render:(0,me.jsx)(Yv,{render:(0,me.jsx)("div",{"aria-label":o.label,role:"option",className:"dataviews-search-widget-listitem"}),onClick:()=>{const n=i?[...e.filters.map((e=>e.field===t.field?{...e,operator:i.operator||t.operators[0],value:ty(t,i,o.value)}:e))]:[...e.filters,{field:t.field,operator:t.operators[0],value:ty(t,i,o.value)}];s({...e,page:1,filters:n})}}),children:[(0,me.jsxs)("span",{className:"dataviews-search-widget-listitem-check",children:[t.singleSelection&&r===o.value&&(0,me.jsx)(x.Icon,{icon:Jv}),!t.singleSelection&&r.includes(o.value)&&(0,me.jsx)(x.Icon,{icon:Zv})]}),(0,me.jsxs)("span",{children:[o.label,!!o.description&&(0,me.jsx)("span",{className:"dataviews-search-widget-listitem-description",children:o.description})]})]},o.value)))})}function ny({view:e,filter:t,onChangeView:s}){const[n,i]=(0,d.useState)(""),r=(0,d.useDeferredValue)(n),o=e.filters.find((e=>e.field===t.field)),a=ey(t,o),l=(0,d.useMemo)((()=>{const e=Qv(r);return t.elements.filter((t=>Qv(t.label).includes(e)))}),[t.elements,r]);return(0,me.jsxs)(rv,{resetValueOnSelect:!1,selectedValue:a,setSelectedValue:n=>{const i=o?[...e.filters.map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:n}:e))]:[...e.filters,{field:t.field,operator:t.operators[0],value:n}];s({...e,page:1,filters:i})},setValue:i,children:[(0,me.jsxs)("div",{className:"dataviews-search-widget-filter-combobox__wrapper",children:[(0,me.jsx)(av,{render:(0,me.jsx)(x.VisuallyHidden,{children:(0,b.__)("Search items")}),children:(0,b.__)("Search items")}),(0,me.jsx)(Cv,{autoSelect:"always",placeholder:(0,b.__)("Search"),className:"dataviews-search-widget-filter-combobox__input"}),(0,me.jsx)("div",{className:"dataviews-search-widget-filter-combobox__icon",children:(0,me.jsx)(x.Icon,{icon:ds})})]}),(0,me.jsxs)(Av,{className:"dataviews-search-widget-filter-combobox-list",alwaysVisible:!0,children:[l.map((e=>(0,me.jsxs)(zv,{value:e.value,className:"dataviews-search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,me.jsxs)("span",{className:"dataviews-search-widget-listitem-check",children:[t.singleSelection&&a===e.value&&(0,me.jsx)(x.Icon,{icon:Jv}),!t.singleSelection&&a.includes(e.value)&&(0,me.jsx)(x.Icon,{icon:Zv})]}),(0,me.jsxs)("span",{children:[(0,me.jsx)(Uv,{className:"dataviews-search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,me.jsx)("span",{className:"dataviews-search-widget-listitem-description",children:e.description})]})]},e.value))),!l.length&&(0,me.jsx)("p",{children:(0,b.__)("No results found")})]})]})}function iy(e){const t=e.filter.elements.length>10?ny:sy;return(0,me.jsx)(t,{...e})}const ry="Enter",oy=" ",ay=({activeElements:e,filterInView:t,filter:s})=>{if(void 0===e||0===e.length)return s.name;const n={Name:(0,me.jsx)("span",{className:"dataviews-filter-summary__filter-text-name"}),Value:(0,me.jsx)("span",{className:"dataviews-filter-summary__filter-text-value"})};return t?.operator===Kh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is any: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Yh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is none: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Xh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is all: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Jh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not all: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===qh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is: %2$s"),s.name,e[0].label),n):t?.operator===Zh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not: %2$s"),s.name,e[0].label),n):(0,b.sprintf)((0,b.__)("Unknown status for %1$s"),s.name)};function ly({filter:e,view:t,onChangeView:s}){const n=e.operators?.map((e=>({value:e,label:$h[e]?.label}))),i=t.filters.find((t=>t.field===e.field)),r=i?.operator||e.operators[0];return n.length>1&&(0,me.jsxs)(x.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filter-summary__operators-container",children:[(0,me.jsx)(x.FlexItem,{className:"dataviews-filter-summary__operators-filter-name",children:e.name}),(0,me.jsx)(x.SelectControl,{label:(0,b.__)("Conditions"),value:r,options:n,onChange:n=>{const r=n,o=i?[...t.filters.map((t=>t.field===e.field?{...t,operator:r}:t))]:[...t.filters,{field:e.field,operator:r,value:void 0}];s({...t,page:1,filters:o})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function cy({addFilterRef:e,openedFilter:t,...s}){const n=(0,d.useRef)(null),{filter:i,view:r,onChangeView:o}=s,a=r.filters.find((e=>e.field===i.field)),l=i.elements.filter((e=>i.singleSelection?e.value===a?.value:a?.value?.includes(e.value))),c=i.isPrimary,u=void 0!==a?.value,h=!c||u;return(0,me.jsx)(x.Dropdown,{defaultOpen:t===i.field,contentClassName:"dataviews-filter-summary__popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{n.current?.focus()},renderToggle:({isOpen:t,onToggle:s})=>(0,me.jsxs)("div",{className:"dataviews-filter-summary__chip-container",children:[(0,me.jsx)(x.Tooltip,{text:(0,b.sprintf)((0,b.__)("Filter by: %1$s"),i.name.toLowerCase()),placement:"top",children:(0,me.jsx)("div",{className:Qt("dataviews-filter-summary__chip",{"has-reset":h,"has-values":u}),role:"button",tabIndex:0,onClick:s,onKeyDown:e=>{[ry,oy].includes(e.key)&&(s(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:n,children:(0,me.jsx)(ay,{activeElements:l,filterInView:a,filter:i})})}),h&&(0,me.jsx)(x.Tooltip,{text:c?(0,b.__)("Reset"):(0,b.__)("Remove"),placement:"top",children:(0,me.jsx)("button",{className:Qt("dataviews-filter-summary__chip-remove",{"has-values":u}),onClick:()=>{o({...r,page:1,filters:r.filters.filter((e=>e.field!==i.field))}),c?n.current?.focus():e.current?.focus()},children:(0,me.jsx)(x.Icon,{icon:pd})})})]}),renderContent:()=>(0,me.jsxs)(x.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,me.jsx)(ly,{...s}),(0,me.jsx)(iy,{...s})]})})}const{DropdownMenuV2:uy,DropdownMenuItemV2:dy,DropdownMenuItemLabelV2:hy}=Wh(x.privateApis);const py=(0,d.forwardRef)((function({filters:e,view:t,onChangeView:s,setOpenedFilter:n},i){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const r=e.filter((e=>!e.isVisible));return(0,me.jsx)(uy,{trigger:(0,me.jsx)(x.Button,{__experimentalIsFocusable:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:i,children:(0,b.__)("Add filter")}),children:r.map((e=>(0,me.jsx)(dy,{onClick:()=>{n(e.field),s({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,me.jsx)(hy,{children:e.name})},e.field)))})}));function fy({filters:e,view:t,onChangeView:s}){const n=!t.search&&!t.filters?.some((t=>{return void 0!==t.value||(s=t.field,!e.some((e=>e.field===s&&e.isPrimary)));var s}));return(0,me.jsx)(x.Button,{disabled:n,__experimentalIsFocusable:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{s({...t,page:1,search:"",filters:[]})},children:(0,b.__)("Reset")})}const my=(0,d.memo)((function({fields:e,view:t,onChangeView:s,openedFilter:n,setOpenedFilter:i}){const r=(0,d.useRef)(null),o=[];e.forEach((e=>{if(!e.elements?.length)return;const s=Cp(e);if(0===s.length)return;const n=!!e.filterBy?.isPrimary;o.push({field:e.id,name:e.header,elements:e.elements,singleSelection:s.some((e=>[qh,Zh].includes(e))),operators:s,isVisible:n||t.filters.some((t=>t.field===e.id&&Qh.includes(t.operator))),isPrimary:n})})),o.sort(((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)));const a=(0,me.jsx)(py,{filters:o,view:t,onChangeView:s,ref:r,setOpenedFilter:i},"add-filter"),l=[...o.map((e=>e.isVisible?(0,me.jsx)(cy,{filter:e,view:t,onChangeView:s,addFilterRef:r,openedFilter:n},e.field):null)),a];return l.length>1&&l.push((0,me.jsx)(fy,{filters:o,view:t,onChangeView:s},"reset-filters")),(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0,children:l})})),gy=my,vy=(0,d.memo)((function({label:e,view:t,onChangeView:s}){const[n,i,r]=(0,v.useDebouncedInput)(t.search);(0,d.useEffect)((()=>{var e;i(null!==(e=t.search)&&void 0!==e?e:"")}),[t.search,i]);const o=(0,d.useRef)(s),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{o.current=s,a.current=t}),[s,t]),(0,d.useEffect)((()=>{o.current({...a.current,page:1,search:r})}),[r]);const l=e||(0,b.__)("Search");return(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,onChange:i,value:n,label:l,placeholder:l,size:"compact"})})),yy=vy;function xy(e){return e.map((e=>{const t=e.getValue||(({item:t})=>t[e.id]);return{...e,header:e.header||e.id,getValue:t,render:e.render||t}}))}const by={init:{bottom:-48},open:{bottom:24,transition:{bottom:{type:"tween",duration:.2,ease:[0,0,.2,1]}}},exit:{opacity:0,bottom:24,transition:{opacity:{type:"tween",duration:.2,ease:[0,0,.2,1]}}}};function wy({action:e,onClick:t,isBusy:s,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,me.jsx)(x.ToolbarButton,{disabled:s,label:i,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:s,__experimentalIsFocusable:!0,tooltipPosition:"top"})}const _y=[];function Sy({action:e,selectedItems:t,actionInProgress:s,setActionInProgress:n}){const i=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]);return"RenderModal"in e?(0,me.jsx)(wp,{action:e,items:i,ActionTrigger:wy},e.id):(0,me.jsx)(wy,{action:e,onClick:()=>{n(e.id),e.callback(t)},items:i,isBusy:s===e.id},e.id)}function jy(e,t,s,n,i,r){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.ToolbarGroup,{children:(0,me.jsx)("div",{className:"dataviews-bulk-actions__selection-count",children:1===e.length?(0,b.__)("1 item selected"):(0,b.sprintf)((0,b._n)("%s item selected","%s items selected",e.length),e.length)})}),(0,me.jsx)(x.ToolbarGroup,{children:t.map((e=>(0,me.jsx)(Sy,{action:e,selectedItems:s,actionInProgress:n,setActionInProgress:i},e.id)))}),(0,me.jsx)(x.ToolbarGroup,{children:(0,me.jsx)(x.ToolbarButton,{icon:pd,showTooltip:!0,tooltipPosition:"top",label:(0,b.__)("Cancel"),disabled:!!n,onClick:()=>{r(_y)}})})]})}function Cy({selection:e,actionsToShow:t,selectedItems:s,onSelectionChange:n}){const[i,r]=(0,d.useState)(null),o=(0,d.useRef)(null);return i?(o.current||(o.current=jy(e,t,s,i,r,n)),o.current):(o.current&&(o.current=null),jy(e,t,s,i,r,n))}function ky({data:e,selection:t,actions:s=_y,onSelectionChange:n,getItemId:i}){const r=(0,v.useReducedMotion)(),o=(0,d.useMemo)((()=>e.filter((e=>t.includes(i(e))))),[t,e,i]),a=(0,d.useMemo)((()=>s.filter((e=>e.supportsBulk&&e.icon&&o.some((t=>!e.isEligible||e.isEligible(t)))))),[s,o]);return t&&0===t.length||0===a.length?null:(0,me.jsx)(x.__unstableAnimatePresence,{children:(0,me.jsx)(x.__unstableMotion.div,{layout:!r,initial:"init",animate:"open",exit:"exit",variants:r?void 0:by,className:"dataviews-bulk-actions",children:(0,me.jsx)(x.Toolbar,{label:(0,b.__)("Bulk actions"),children:(0,me.jsx)("div",{className:"dataviews-bulk-actions-toolbar-wrapper",children:(0,me.jsx)(Cy,{selection:t,actionsToShow:a,selectedItems:o,onSelectionChange:n})})})})})}const Ey=e=>e.id,Py=()=>{};function Iy({view:e,onChangeView:t,fields:s,search:n=!0,searchLabel:i,actions:r=[],data:o,getItemId:a=Ey,isLoading:l=!1,paginationInfo:c,supportedLayouts:u,selection:h,setSelection:p,onSelectionChange:f=Py}){const[m,g]=(0,d.useState)([]);let v,y;void 0!==h&&void 0!==p?(v=h,y=p):(v=m,y=g);const[b,w]=(0,d.useState)(null),_=(0,d.useCallback)((e=>{y(e.map((e=>a(e)))),f(e)}),[y,a,f]),S=$p.find((t=>t.type===e.type))?.component,j=(0,d.useMemo)((()=>xy(s)),[s]),C=function(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}(r,o),k=(0,d.useMemo)((()=>v.filter((e=>o.some((t=>a(t)===e))))),[v,o,a]);return(0,me.jsxs)("div",{className:"dataviews-wrapper",children:[(0,me.jsxs)(x.__experimentalHStack,{alignment:"top",justify:"start",className:"dataviews-filters__view-actions",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"start",className:"dataviews-filters__container",wrap:!0,children:[n&&(0,me.jsx)(yy,{label:i,view:e,onChangeView:t}),(0,me.jsx)(gy,{fields:j,view:e,onChangeView:t,openedFilter:b,setOpenedFilter:w})]}),[ip,rp].includes(e.type)&&C&&(0,me.jsx)(Np,{actions:r,data:o,onSelectionChange:_,selection:k,getItemId:a}),(0,me.jsx)(hf,{fields:j,view:e,onChangeView:t,supportedLayouts:u})]}),(0,me.jsx)(S,{actions:r,data:o,fields:j,getItemId:a,isLoading:l,onChangeView:t,onSelectionChange:_,selection:k,setOpenedFilter:w,view:e}),(0,me.jsx)(Hh,{view:e,onChangeView:t,paginationInfo:c}),[ip,rp].includes(e.type)&&C&&(0,me.jsx)(ky,{data:o,actions:r,selection:k,onSelectionChange:_,getItemId:a})]})}function Ty({title:e,subTitle:t,actions:s}){return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-page-header",as:"header",spacing:0,children:[(0,me.jsxs)(x.__experimentalHStack,{className:"edit-site-page-header__page-title",children:[(0,me.jsx)(x.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title",children:e}),(0,me.jsx)(x.FlexItem,{className:"edit-site-page-header__actions",children:s})]}),t&&(0,me.jsx)(x.__experimentalText,{variant:"muted",as:"p",className:"edit-site-page-header__sub-title",children:t})]})}const{NavigableRegion:Oy}=se(h.privateApis);function Ay({title:e,subTitle:t,actions:s,children:n,className:i,hideTitleFromUI:r=!1}){const o=Qt("edit-site-page",i);return(0,me.jsx)(Oy,{className:o,ariaLabel:e,children:(0,me.jsxs)("div",{className:"edit-site-page-content",children:[!r&&e&&(0,me.jsx)(Ty,{title:e,subTitle:t,actions:s}),n]})})}const My=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,me.jsx)(us.Path,{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}),(0,me.jsx)(us.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})]}),Ny=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})}),Fy=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),Vy=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"})}),Ry=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"})}),By=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"})}),Dy={[qe]:{primaryField:"title"},[We]:{mediaField:"featured-image",primaryField:"title"},[Ze]:{primaryField:"title",mediaField:"featured-image"}},Ly={type:Ze,search:"",filters:[],page:1,perPage:20,sort:{field:"date",direction:"desc"},hiddenFields:["date","featured-image"],layout:{...Dy[Ze]}},zy={page:[{title:(0,b.__)("All pages"),slug:"all",icon:My,view:Ly},{title:(0,b.__)("Published"),slug:"published",icon:Ny,view:{...Ly,filters:[{field:"status",operator:Ye,value:"publish"}]}},{title:(0,b.__)("Scheduled"),slug:"future",icon:Fy,view:{...Ly,filters:[{field:"status",operator:Ye,value:"future"}]}},{title:(0,b.__)("Drafts"),slug:"drafts",icon:Vy,view:{...Ly,filters:[{field:"status",operator:Ye,value:"draft"}]}},{title:(0,b.__)("Pending"),slug:"pending",icon:Ry,view:{...Ly,filters:[{field:"status",operator:Ye,value:"pending"}]}},{title:(0,b.__)("Private"),slug:"private",icon:By,view:{...Ly,filters:[{field:"status",operator:Ye,value:"private"}]}},{title:(0,b.__)("Trash"),slug:"trash",icon:$s,view:{...Ly,filters:[{field:"status",operator:Ye,value:"trash"}]}}]};function Gy({onSave:e,onClose:t}){const[s,n]=(0,d.useState)(!1),[i,r]=(0,d.useState)(""),{saveEntityRecord:a}=(0,l.useDispatch)(_.store),{createErrorNotice:c,createSuccessNotice:u}=(0,l.useDispatch)(w.store),{resolveSelect:h}=(0,l.useRegistry)();return(0,me.jsx)(x.Modal,{title:(0,b.__)("Draft a new page"),onRequestClose:t,children:(0,me.jsx)("form",{onSubmit:async function(t){if(t.preventDefault(),!s){n(!0);try{const t=await h(_.store).getPostType("page"),s=await a("postType","page",{status:"draft",title:i,slug:i||(0,b.__)("No title"),content:t.template&&t.template.length?(0,o.serialize)((0,o.synchronizeBlocksWithTemplate)([],t.template)):void 0},{throwOnError:!0});e(s),u((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(s.title?.rendered||i)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the page.");c(t,{type:"snackbar"})}finally{n(!1)}}},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(x.TextControl,{__next40pxDefaultSize:!0,label:(0,b.__)("Page title"),onChange:r,placeholder:(0,b.__)("No title"),value:i}),(0,me.jsxs)(x.__experimentalHStack,{spacing:2,justify:"end",children:[(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:s,"aria-disabled":s,children:(0,b.__)("Create draft")})]})]})})})}const Hy=function({id:e,size:t=["large","medium","thumbnail"],...s}){const{record:n}=(0,_.useEntityRecord)("root","media",e),i=t.find((e=>!!n?.media_details?.sizes[e])),r=n?.media_details?.sizes[i]?.source_url||n?.source_url;return r?(0,me.jsx)("img",{...s,src:r,alt:n.alt_text}):null},Uy=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),{useHistory:Wy}=se(Xt.privateApis),qy=()=>{const e=Wy();return(0,d.useMemo)((()=>({id:"edit-post",label:(0,b.__)("Edit"),isPrimary:!0,icon:Uy,isEligible:e=>"trash"!==e.status&&e.type!==Be.theme,callback(t){const s=t[0];e.push({postId:s.id,postType:s.type,canvas:"edit"})}})),[e])},{usePostActions:Zy}=se(h.privateApis),{useLocation:Ky,useHistory:Yy}=se(Xt.privateApis),Xy=[],Jy=e=>(0,Kd.dateI18n)((0,Kd.getSettings)().formats.datetimeAbbreviated,(0,Kd.getDate)(e));const Qy=[{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")}],$y="draft,future,pending,private,publish";function ex({item:e,viewType:t}){const s="trash"===e.status,{onClick:n}=rn({postId:e.id,postType:e.type,canvas:"edit"}),i=!!e.featured_media,r=t===We?["large","full","medium","thumbnail"]:["thumbnail","medium","large","full"],o=i?(0,me.jsx)(Hy,{className:"edit-site-page-pages__featured-image",id:e.featured_media,size:r}):null,a=t!==Ze&&!s;return(0,me.jsx)("div",{className:`edit-site-page-pages__featured-image-wrapper is-layout-${t}`,children:a?(0,me.jsx)("button",{className:"page-pages-preview-field__button",type:"button",onClick:n,"aria-label":e.title?.rendered||(0,b.__)("(no title)"),children:o}):o})}function tx(e){return e.id.toString()}function sx(){var e,t;const s="page",[n,i]=function(e){const{params:{activeView:t="all",isCustom:s="false",layout:n}}=Ky(),i=Yy(),r=(0,d.useMemo)((()=>{const i="false"===s&&zy[e].find((({slug:e})=>e===t))?.view;return"false"===s&&n?{...i,type:n,layout:{...Dy[n]||{}}}:i}),[s,t,n,e]),[o,a]=(0,d.useState)(r);(0,d.useEffect)((()=>{r&&a(r)}),[r]);const c=(0,l.useSelect)((e=>{if("true"!==s)return;const{getEditedEntityRecord:n}=e(_.store);return n("postType","wp_dataviews",Number(t))}),[t,s]),{editEntityRecord:u}=(0,l.useDispatch)(_.store),h=(0,d.useMemo)((()=>{const e=c?.content&&JSON.parse(c?.content);return e?{...e,layout:{...Dy[e?.type]||{}}}:e}),[c?.content]),p=(0,d.useCallback)((e=>{u("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)})}),[u,c?.id]),f=(0,d.useCallback)((e=>{if(e.type!==o?.type){const{params:t}=i.getLocationWithParams();i.push({...t,layout:e.type})}a(e)}),[i,o?.type]);return"false"===s?[o,f]:"true"===s&&h?[h,p]:[zy[e][0].view,f]}(s),r=Yy(),{params:{postId:o}}=Ky(),[a,c]=(0,d.useState)([o]),u=(0,d.useCallback)((e=>{var t;const{params:s}=r.getLocationWithParams();"false"===(null!==(t=s.isCustom)&&void 0!==t?t:"false")&&n?.type===Ze&&r.push({...s,postId:1===e.length?e[0].id:void 0})}),[r,n?.type]),h=(0,d.useMemo)((()=>{const e={};return n.filters.forEach((t=>{"status"===t.field&&t.operator===Ye&&(e.status=t.value),"author"===t.field&&t.operator===Ye?e.author=t.value:"author"===t.field&&t.operator===Xe&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status=$y),{per_page:n.perPage,page:n.page,_embed:"author",order:n.sort?.direction,orderby:n.sort?.field,search:n.search,...e}}),[n]),{records:p,isResolving:f,totalItems:m,totalPages:g}=(0,_.useEntityRecords)("postType",s,h),y=null!==(e=p?.map((e=>tx(e))))&&void 0!==e?e:[],w=(null!==(t=(0,v.usePrevious)(y))&&void 0!==t?t:[]).filter((e=>!y.includes(e))).includes(o);(0,d.useEffect)((()=>{w&&r.push({...r.getLocationWithParams().params,postId:void 0})}),[w,r]);const{records:S,isResolving:j}=(0,_.useEntityRecords)("root","user",{per_page:-1}),C=(0,d.useMemo)((()=>({totalItems:m,totalPages:g})),[m,g]),{frontPageId:k,postsPageId:E,addNewLabel:P,canCreatePage:I}=(0,l.useSelect)((e=>{const{getEntityRecord:t,getPostType:s,canUser:n}=e(_.store),i=t("root","site");return{frontPageId:i?.page_on_front,postsPageId:i?.page_for_posts,addNewLabel:s("page")?.labels?.add_new_item,canCreatePage:n("create","pages")}})),T=(0,d.useMemo)((()=>[{id:"featured-image",header:(0,b.__)("Featured Image"),getValue:({item:e})=>e.featured_media,render:({item:e})=>(0,me.jsx)(ex,{item:e,viewType:n.type}),enableSorting:!1,width:"1%"},{header:(0,b.__)("Title"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>{const t=[qe,We].includes(n.type)&&"trash"!==e.status?(0,me.jsx)(on,{params:{postId:e.id,postType:e.type,canvas:"edit"},children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")}):(0,me.jsx)("span",{children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")});let s="";return e.id===k?s=(0,me.jsx)("span",{className:"edit-site-page-pages__title-badge",children:(0,b.__)("Front Page")}):e.id===E&&(s=(0,me.jsx)("span",{className:"edit-site-page-pages__title-badge",children:(0,b.__)("Posts Page")})),(0,me.jsxs)(x.__experimentalHStack,{className:"edit-site-page-pages-title",alignment:"center",justify:"flex-start",children:[t,s]})},maxWidth:300,enableHiding:!1},{header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e._embedded?.author[0]?.name,elements:S?.map((({id:e,name:t})=>({value:e,label:t})))||[]},{header:(0,b.__)("Status"),id:"status",getValue:({item:e})=>{var t;return null!==(t=Qy.find((({value:t})=>t===e.status))?.label)&&void 0!==t?t:e.status},elements:Qy,enableSorting:!1,filterBy:{operators:[Ye]}},{header:(0,b.__)("Date"),id:"date",render:({item:e})=>{if(["draft","private"].includes(e.status))return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Modified: "),Jy(e.date)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});if("future"===e.status)return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Scheduled: "),Jy(e.date)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});const t=(0,Kd.getDate)(e.modified)>(0,Kd.getDate)(e.date)?e.modified:e.date;if("pending"===e.status)return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Modified: "),Jy(t)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});return"publish"===e.status?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Published: "),Jy(t)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})}):(0,me.jsx)("time",{children:Jy(e.date)})}}]),[S,n.type,k,E]),O=Zy({postType:"page",context:"list"}),A=qy(),M=(0,d.useMemo)((()=>[A,...O]),[O,A]),N=(0,d.useCallback)((e=>{e.type!==n.type&&(e={...e,layout:{...Dy[e.type]}}),i(e)}),[n.type,i]),[F,V]=(0,d.useState)(!1),R=()=>V(!1);return(0,me.jsx)(Ay,{title:(0,b.__)("Pages"),actions:P&&I&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>V(!0),__next40pxDefaultSize:!0,children:P}),F&&(0,me.jsx)(Gy,{onSave:({type:e,id:t})=>{r.push({postId:t,postType:e,canvas:"edit"}),R()},onClose:R})]}),children:(0,me.jsx)(Iy,{paginationInfo:C,fields:T,actions:M,data:p||Xy,isLoading:f||j,view:n,onChangeView:N,selection:a,setSelection:c,onSelectionChange:u,getItemId:tx})})}function nx(e=""){return qv()(e.trim().toLowerCase())}const ix=[];function rx(e,t,s){if(!e)return{data:ix,paginationInfo:{totalItems:0,totalPages:0}};const n=xy(s);let i=[...e];if(t.search){const e=nx(t.search);i=i.filter((t=>n.filter((e=>e.enableGlobalSearch)).map((e=>nx(e.getValue({item:t})))).some((t=>t.includes(e)))))}if(t.filters.length>0&&t.filters.forEach((e=>{const t=n.find((t=>t.id===e.field));t&&(e.operator===Kh&&e?.value?.length>0?i=i.filter((s=>{const n=t.getValue({item:s});return Array.isArray(n)?e.value.some((e=>n.includes(e))):"string"==typeof n&&e.value.includes(n)})):e.operator===Yh&&e?.value?.length>0?i=i.filter((s=>{const n=t.getValue({item:s});return Array.isArray(n)?!e.value.some((e=>n.includes(e))):"string"==typeof n&&!e.value.includes(n)})):e.operator===Xh&&e?.value?.length>0?i=i.filter((s=>e.value.every((e=>t.getValue({item:s})?.includes(e))))):e.operator===Jh&&e?.value?.length>0?i=i.filter((s=>e.value.every((e=>!t.getValue({item:s})?.includes(e))))):e.operator===qh?i=i.filter((s=>e.value===t.getValue({item:s}))):e.operator===Zh&&(i=i.filter((s=>e.value!==t.getValue({item:s})))))})),t.sort){const e=t.sort.field,s=n.find((t=>t.id===e));s&&i.sort(((e,n)=>{var i,r;const o=null!==(i=s.getValue({item:e}))&&void 0!==i?i:"",a=null!==(r=s.getValue({item:n}))&&void 0!==r?r:"";return"asc"===t.sort?.direction?o.localeCompare(a):a.localeCompare(o)}))}let r=i.length,o=1;if(void 0!==t.page&&void 0!==t.perPage){const e=(t.page-1)*t.perPage;r=i?.length||0,o=Math.ceil(r/t.perPage),i=i?.slice(e,e+t.perPage)}return{data:i,paginationInfo:{totalItems:r,totalPages:o}}}const ox=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),ax=(0,window.wp.priorityQueue.createQueue)();function lx({children:e,placeholder:t}){const[s,n]=(0,d.useState)(!1);return(0,d.useEffect)((()=>{const e={};return ax.add(e,(()=>{(0,d.flushSync)((()=>{n(!0)}))})),()=>{ax.cancel(e)}}),[]),s?e:t}const cx=(e,t,s)=>t===s.findIndex((t=>e.name===t.name));function ux(){var e;const t=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return t()}),[]),s=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,n=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()),[]),i=(0,d.useMemo)((()=>[...s||[],...n||[]].filter(cx)),[s,n]);return(0,d.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...s}=t;return{...s,__experimentalBlockPatterns:i,__unstableIsPreviewMode:!0}}),[t,i])}const{extractWords:dx,getNormalizedSearchTerms:hx,normalizeString:px}=se(y.privateApis),fx=e=>e.name||"",mx=e=>e.title,gx=e=>e.description||"",vx=e=>e.keywords||[],yx=()=>!1,xx=(e=[],t="",s={})=>{const n=hx(t),i=s.categoryId!==De&&!n.length,r={...s,onlyFilterByCategory:i},o=i?0:1,a=e.map((e=>[e,bx(e,t,r)])).filter((([,e])=>e>o));return 0===n.length||a.sort((([,e],[,t])=>t-e)),a.map((([e])=>e))};function bx(e,t,s){const{categoryId:n,getName:i=fx,getTitle:r=mx,getDescription:o=gx,getKeywords:a=vx,hasCategory:l=yx,onlyFilterByCategory:c}=s;let u=n===De||n===Re||n===Le&&e.type===Be.user||l(e,n)?1:0;if(!u||c)return u;const d=i(e),h=r(e),p=o(e),f=a(e),m=px(t),g=px(h);if(m===g)u+=30;else if(g.startsWith(m))u+=20;else{const e=[d,h,p,...f].join(" ");0===((e,t)=>e.filter((e=>!hx(t).some((t=>t.includes(e))))))(dx(m),e).length&&(u+=10)}return u}const wx=[],_x=(e,t)=>e&&t?e+"//"+t:null,Sx=(0,l.createSelector)(((e,t,s="")=>{var n;const{getEntityRecords:i,isResolving:r}=e(_.store),{__experimentalGetDefaultTemplatePartAreas:a}=e(h.store),l={per_page:-1},c=(null!==(n=i("postType",Ne,l))&&void 0!==n?n:wx).map((e=>(e=>({blocks:(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),categories:[e.area],description:e.description||"",isCustom:e.source===Fe.custom,keywords:e.keywords||[],id:_x(e.theme,e.slug),name:_x(e.theme,e.slug),title:(0,cs.decodeEntities)(e.title.rendered),type:e.type,_links:e._links,templatePart:e}))(e))),u=(a()||[]).map((e=>e.area)),d=r("getEntityRecords",["postType",Ne,l]),p=xx(c,s,{categoryId:t,hasCategory:(e,t)=>t!==Ve?e.templatePart.area===t:e.templatePart.area===t||!u.includes(e.templatePart.area)});return{patterns:p,isResolving:d}}),(e=>[e(_.store).getEntityRecords("postType",Ne,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ne,{per_page:-1}]),e(h.store).__experimentalGetDefaultTemplatePartAreas()])),jx=(0,l.createSelector)((e=>{var t;const{getSettings:s}=se(e(Kt)),{isResolving:n}=e(_.store),i=s();return{patterns:[...(null!==(t=i.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:i.__experimentalBlockPatterns)||[],...e(_.store).getBlockPatterns()||[]].filter((e=>!ze.includes(e.source))).filter(cx).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:Be.theme,blocks:(0,o.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:n("getBlockPatterns")}}),(e=>[e(_.store).getBlockPatterns(),e(_.store).isResolving("getBlockPatterns"),se(e(Kt)).getSettings()])),Cx=(0,l.createSelector)(((e,t,s,n="")=>{const{patterns:i,isResolving:r}=jx(e),{patterns:o,isResolving:a}=kx(e);let l=[...i||[],...o||[]];return s&&(l=l.filter((e=>e.type===Be.user?e.syncStatus===s:s===Ge.unsynced))),l=xx(l,n,t?{categoryId:t,hasCategory:(e,t)=>e.categories?.includes(t)}:{hasCategory:e=>!e.hasOwnProperty("categories")}),{patterns:l,isResolving:r||a}}),(e=>[jx(e),kx(e)])),kx=(0,l.createSelector)(((e,t,s="")=>{const{getEntityRecords:n,isResolving:i,getUserPatternCategories:r}=e(_.store),a={per_page:-1},l=n("postType",Be.user,a),c=r(),u=new Map;c.forEach((e=>u.set(e.id,e)));let d=l?l.map((e=>((e,t)=>({blocks:(0,o.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||Ge.full,title:e.title.raw,type:e.type,description:e.excerpt.raw,patternPost:e}))(e,u))):wx;const h=i("getEntityRecords",["postType",Be.user,a]);return t&&(d=d.filter((e=>e.syncStatus===t))),d=xx(d,s,{hasCategory:()=>!0}),{patterns:d,isResolving:h,categories:c}}),(e=>[e(_.store).getEntityRecords("postType",Be.user,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Be.user,{per_page:-1}]),e(_.store).getUserPatternCategories()])),Ex=(e,t,{search:s="",syncStatus:n}={})=>(0,l.useSelect)((i=>{if(e===Ne)return Sx(i,t,s);if(e===Be.user&&t){return Cx(i,"uncategorized"===t?"":t,n,s)}return e===Be.user?kx(i,n,s):{patterns:wx,isResolving:!1}}),[t,e,s,n]),Px=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Ix=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),{useHistory:Tx}=se(Xt.privateApis),{CreatePatternModal:Ox,useAddPatternCategory:Ax}=se(Oe.privateApis),{CreateTemplatePartModal:Mx}=se(h.privateApis);function Nx(){const e=Tx(),[t,s]=(0,d.useState)(!1),[n,i]=(0,d.useState)(!1),{createPatternFromFile:r}=se((0,l.useDispatch)(Oe.store)),{createSuccessNotice:o,createErrorNotice:a}=(0,l.useDispatch)(w.store),c=(0,d.useRef)(),{isBlockBasedTheme:u,addNewPatternLabel:h,addNewTemplatePartLabel:p,canCreatePattern:f,canCreateTemplatePart:m}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getPostType:s,canUser:n}=e(_.store);return{isBlockBasedTheme:t()?.is_block_theme,addNewPatternLabel:s(Be.user)?.labels?.add_new_item,addNewTemplatePartLabel:s(Ne)?.labels?.add_new_item,canCreatePattern:n("create","blocks"),canCreateTemplatePart:n("create","template-parts")}}),[]);function g(){s(!1),i(!1)}const v=[];f&&v.push({icon:Px,onClick:()=>s(!0),title:h}),u&&m&&v.push({icon:Cn,onClick:()=>i(!0),title:p}),f&&v.push({icon:Ix,onClick:()=>{c.current.click()},title:(0,b.__)("Import pattern from JSON")});const{categoryMap:y,findOrCreateTerm:S}=Ax();return 0===v.length?null:(0,me.jsxs)(me.Fragment,{children:[h&&(0,me.jsx)(x.DropdownMenu,{controls:v,icon:null,toggleProps:{variant:"primary",showTooltip:!1,__next40pxDefaultSize:!0},text:h,label:h}),t&&(0,me.jsx)(Ox,{onClose:()=>s(!1),onSuccess:function({pattern:t}){s(!1),e.push({postId:t.id,postType:Be.user,canvas:"edit"})},onError:g}),n&&(0,me.jsx)(Mx,{closeModal:()=>i(!1),blocks:[],onCreate:function(t){i(!1),e.push({postId:t.id,postType:Ne,canvas:"edit"})},onError:g}),(0,me.jsx)("input",{type:"file",accept:".json",hidden:!0,ref:c,onChange:async t=>{const s=t.target.files?.[0];if(s)try{const{params:{postType:t,categoryId:n}}=e.getLocationWithParams();let i;if(t!==Ne){const e=y.values().find((e=>e.name===n));e&&(i=e.id||await S(e.label))}const a=await r(s,i?[i]:void 0);i||"my-patterns"===n||e.push({postType:Be.user,categoryId:De}),o((0,b.sprintf)((0,b.__)('Imported "%s" from JSON.'),a.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){a(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{t.target.value=""}}})]})}function Fx(){const e=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:s}=se(e(Kt)),n=s();return null!==(t=n.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:n.__experimentalBlockPatternCategories}));return[...e||[],...(0,l.useSelect)((e=>e(_.store).getBlockPatternCategories()))||[]]}();e.push({name:Ve,label:(0,b.__)("Uncategorized")});const t=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:s}=se(e(Kt));return null!==(t=s().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:s().__experimentalBlockPatterns})),t=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()));return(0,d.useMemo)((()=>[...e||[],...t||[]].filter((e=>!ze.includes(e.source))).filter(cx).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:s,categories:n}=Ex(Be.user),i=(0,d.useMemo)((()=>{const i={},r=[];e.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),n.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),s.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),[...e,...n].forEach((e=>{i[e.name].count&&!r.find((t=>t.name===e.name))&&r.push(i[e.name])}));const o=r.sort(((e,t)=>e.label.localeCompare(t.label)));return o.unshift({name:Le,label:(0,b.__)("My patterns"),count:s.length}),o.unshift({name:De,label:(0,b.__)("All patterns"),description:(0,b.__)("A list of all patterns from all sources."),count:t.length+s.length}),o}),[e,t,n,s]);return{patternCategories:i,hasPatterns:!!i.length}}const{RenamePatternCategoryModal:Vx}=se(Oe.privateApis);function Rx({category:e,onClose:t}){const[s,n]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>n(!0),children:(0,b.__)("Rename")}),s&&(0,me.jsx)(Bx,{category:e,onClose:()=>{n(!1),t()}})]})}function Bx({category:e,onClose:t}){const s={id:e.id,slug:e.slug,name:e.label},n=Fx();return(0,me.jsx)(Vx,{category:s,existingCategories:n,onClose:t,overlayClassName:"edit-site-list__rename-modal"})}const{useHistory:Dx}=se(Xt.privateApis);function Lx({category:e,onClose:t}){const[s,n]=(0,d.useState)(!1),i=Dx(),{createSuccessNotice:r,createErrorNotice:o}=(0,l.useDispatch)(w.store),{deleteEntityRecord:a,invalidateResolution:c}=(0,l.useDispatch)(_.store);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{isDestructive:!0,onClick:()=>n(!0),children:(0,b.__)("Delete")}),(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:s,onConfirm:async()=>{try{await a("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",Be.user,{per_page:-1}]),r((0,b.sprintf)((0,b.__)('"%s" deleted.'),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),i.push({postType:Be.user,categoryId:De})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern category.");o(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>n(!1),confirmButtonText:(0,b.__)("Delete"),className:"edit-site-patterns__delete-modal",title:(0,b.sprintf)((0,b.__)('Delete "%s"?'),(0,cs.decodeEntities)(e.label)),size:"medium",__experimentalHideHeader:!1,children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,cs.decodeEntities)(e.label))})]})}function zx({categoryId:e,type:t,titleId:s,descriptionId:n}){const{patternCategories:i}=Fx(),r=(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplatePartAreas()),[]);let o,a,c;if(t===Ne){const t=r.find((t=>t.area===e));o=t?.label||(0,b.__)("All Template Parts"),a=t?.description||(0,b.__)("Includes every template part defined for any area.")}else t===Be.user&&e&&(c=i.find((t=>t.name===e)),o=c?.label,a=c?.description);return o?(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-patterns__section-header",spacing:0,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",className:"edit-site-patterns__title",children:[(0,me.jsx)(x.__experimentalHeading,{as:"h2",level:3,id:s,weight:500,children:o}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,children:[(0,me.jsx)(Nx,{}),!!c?.id&&(0,me.jsx)(x.DropdownMenu,{icon:Ln,label:(0,b.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",describedBy:(0,b.sprintf)((0,b.__)("Action menu for %s pattern category"),o),size:"compact"},children:({onClose:e})=>(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(Rx,{category:c,onClose:e}),(0,me.jsx)(Lx,{category:c,onClose:e})]})})]})]}),a?(0,me.jsx)(x.__experimentalText,{variant:"muted",as:"p",id:n,className:"edit-site-patterns__sub-title",children:a}):null]}):null}const Gx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Hx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),Ux=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})});function Wx(e,t){return(0,l.useSelect)((s=>{const{getEntityRecord:n,getMedia:i,getUser:r,getEditedEntityRecord:o}=s(_.store),a=o("postType",e,t),l=a?.original_source,c=a?.author_text;switch(l){case"theme":return{type:l,icon:Js,text:c,isCustomized:a.source===Fe.custom};case"plugin":return{type:l,icon:Gx,text:c,isCustomized:a.source===Fe.custom};case"site":{const e=n("root","__unstableBase");return{type:l,icon:Hx,imageUrl:e?.site_logo?i(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=r(a.author);return{type:"user",icon:Ux,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}const{ExperimentalBlockEditorProvider:qx,useGlobalStyle:Zx}=se(y.privateApis),{usePostActions:Kx}=se(h.privateApis),{useLocation:Yx}=se(Xt.privateApis),Xx=[],Jx={[qe]:{primaryField:"title"},[We]:{mediaField:"preview",primaryField:"title",badgeFields:["sync-status"]}},Qx={type:We,search:"",page:1,perPage:20,hiddenFields:[],layout:{...Jx[We]},filters:[]},$x=[{value:Ge.full,label:(0,b._x)("Synced","pattern (singular)"),description:(0,b.__)("Patterns that are kept in sync across the site.")},{value:Ge.unsynced,label:(0,b._x)("Not synced","pattern (singular)"),description:(0,b.__)("Patterns that can be changed freely without affecting the site.")}];function eb({item:e,onClick:t,ariaDescribedBy:s,children:n}){return(0,me.jsx)("button",{className:"page-patterns-preview-field__button",type:"button",onClick:e.type!==Be.theme?t:void 0,"aria-label":e.title,"aria-describedby":s,"aria-disabled":e.type===Be.theme,children:n})}function tb({item:e,viewType:t}){const s=(0,d.useId)(),n=e.type===Be.user,i=e.type===Ne,r=!e.blocks?.length,[o]=Zx("color.background"),{onClick:a}=rn({postType:e.type,postId:n?e.id:e.name,canvas:"edit"});return(0,me.jsxs)("div",{className:`page-patterns-preview-field is-viewtype-${t}`,style:{backgroundColor:o},children:[(0,me.jsxs)(eb,{item:e,onClick:a,ariaDescribedBy:e.description?s:void 0,children:[r&&i&&(0,b.__)("Empty template part"),r&&!i&&(0,b.__)("Empty pattern"),!r&&(0,me.jsx)(lx,{children:(0,me.jsx)(y.BlockPreview,{blocks:e.blocks,viewportWidth:e.viewportWidth})})]}),e.description&&(0,me.jsx)("div",{hidden:!0,id:s,children:e.description})]})}function sb({item:e,viewType:t}){const[s,n]=(0,d.useState)(!1),{text:i,icon:r,imageUrl:o}=Wx(e.type,e.id),a=t!==Ze;return(0,me.jsxs)(x.__experimentalHStack,{alignment:"left",spacing:1,children:[a&&o&&(0,me.jsx)("div",{className:Qt("page-templates-author-field__avatar",{"is-loaded":s}),children:(0,me.jsx)("img",{onLoad:()=>n(!0),alt:"",src:o})}),a&&!o&&(0,me.jsx)("div",{className:"page-templates-author-field__icon",children:(0,me.jsx)(eu,{icon:r})}),(0,me.jsx)("span",{className:"page-templates-author-field__name",children:i})]})}function nb({item:e}){const t=e.type===Be.user,{onClick:s}=rn({postType:e.type,postId:t?e.id:e.name,canvas:"edit"});return(0,me.jsxs)(x.__experimentalHStack,{alignment:"center",justify:"flex-start",spacing:2,children:[(0,me.jsx)(x.Flex,{as:"div",gap:0,justify:"left",className:"edit-site-patterns__pattern-title",children:e.type===Be.theme?e.title:(0,me.jsx)(x.Button,{variant:"link",onClick:s,tabIndex:"-1",children:e.title||e.name})}),e.type===Be.theme&&(0,me.jsx)(x.Tooltip,{placement:"top",text:(0,b.__)("This pattern cannot be edited."),children:(0,me.jsx)(eu,{className:"edit-site-patterns__pattern-lock-icon",icon:ox,size:24})})]})}function ib(){const{params:{postType:e,categoryId:t}}=Yx(),s=e||Be.user,n=t||De,[i,r]=(0,d.useState)(Qx),o=(0,v.usePrevious)(n),a=i.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:l,isResolving:c}=Ex(s,n,{search:i.search,syncStatus:a}),{records:u}=(0,_.useEntityRecords)("postType",Ne,{per_page:-1}),h=(0,d.useMemo)((()=>{if(!u)return Xx;const e=new Set;return u.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[u]),p=(0,d.useMemo)((()=>{const e=[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,me.jsx)(tb,{item:e,viewType:i.type}),enableSorting:!1,enableHiding:!1,width:"1%"},{header:(0,b.__)("Title"),id:"title",render:({item:e})=>(0,me.jsx)(nb,{item:e}),enableHiding:!1}];return s===Be.user?e.push({header:(0,b.__)("Sync status"),id:"sync-status",render:({item:e})=>(0,me.jsx)("span",{className:`edit-site-patterns__field-sync-status-${e.syncStatus}`,children:($x.find((({value:t})=>t===e.syncStatus))||$x.find((({value:e})=>e===Ge.unsynced))).label}),elements:$x,filterBy:{operators:[Ke],isPrimary:!0},enableSorting:!1}):s===Ne&&e.push({header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.templatePart.author_text,render:({item:e})=>(0,me.jsx)(sb,{viewType:i.type,item:e}),elements:h,filterBy:{isPrimary:!0},width:"1%"}),e}),[i.type,s,h]);(0,d.useEffect)((()=>{o!==n&&r(Qx)}),[n,o]);const{data:f,paginationInfo:m}=(0,d.useMemo)((()=>{const e={...i};return delete e.search,s!==Ne&&(e.filters=[]),rx(l,e,p)}),[l,i,p,s]),g=Kx({postType:Ne,context:"list"}),y=Kx({postType:Be.user,context:"list"}),x=qy(),w=(0,d.useMemo)((()=>s===Ne?[x,...g].filter(Boolean):[x,...y].filter(Boolean)),[x,s,g,y]),S=(0,d.useCallback)((e=>{e.type!==i.type&&(e={...e,layout:{...Jx[e.type]}}),r(e)}),[i.type,r]),j=(0,d.useId)(),C=ux();return(0,me.jsx)(qx,{settings:C,children:(0,me.jsxs)(Ay,{title:(0,b.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0,children:[(0,me.jsx)(zx,{categoryId:n,type:s,titleId:`${j}-title`,descriptionId:`${j}-description`}),(0,me.jsx)(Iy,{paginationInfo:m,fields:p,actions:w,data:f||Xx,getItemId:e=>e.name,isLoading:c,view:i,onChangeView:S,supportedLayouts:[We,qe]})]})})}const rb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),ob=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),ab=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),lb=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),cb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),ub=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),db=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),hb=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})}),pb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),fb=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,me.jsx)(us.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"})]}),mb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.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"})}),gb={},vb=(e,t)=>{let s=e;return t.split(".").forEach((e=>{s=s?.[e]})),s},yb=(e,t)=>(e||[]).map((e=>({...e,name:(0,cs.decodeEntities)(vb(e,t))}))),xb=()=>(0,l.useSelect)((e=>e(_.store).getEntityRecords("postType",Me,{per_page:-1})),[]),bb=()=>(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplateTypes()),[]),wb=()=>{const e=(0,l.useSelect)((e=>e(_.store).getPostTypes({per_page:-1})),[]);return(0,d.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:s})=>e&&!t.includes(s)))}),[e])};function _b(){const e=wb(),t=(0,d.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),s=xb(),n=(0,d.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const s=t.singular_name.toLowerCase();return e[s]=(e[s]||0)+1,e}),{})),[e]),i=(0,d.useCallback)((({labels:e,slug:t})=>{const s=e.singular_name.toLowerCase();return n[s]>1&&s!==t}),[n]);return(0,d.useMemo)((()=>t?.filter((e=>!(s||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=i(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:"string"==typeof e.icon&&e.icon.startsWith("dashicons-")?e.icon.slice(10):lb,templatePrefix:"archive"}}))||[]),[t,s,i])}const Sb=e=>{const t=wb(),s=xb(),n=bb(),i=(0,d.useMemo)((()=>t?.reduce(((e,{labels:t})=>{const s=(t.template_name||t.singular_name).toLowerCase();return e[s]=(e[s]||0)+1,e}),{})),[t]),r=(0,d.useCallback)((({labels:e,slug:t})=>{const s=(e.template_name||e.singular_name).toLowerCase();return i[s]>1&&s!==t}),[i]),o=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let s=t;return"page"!==t&&(s=`single-${s}`),e[t]=s,e}),{})),[t]),a=Pb("postType",o),l=(s||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,s)=>{const{slug:i,labels:c,icon:u}=s,d=o[i],h=n?.find((({slug:e})=>e===d)),p=l?.includes(d),f=r(s);let m=c.template_name||(0,b.sprintf)((0,b.__)("Single item: %s"),c.singular_name);f&&(m=c.template_name?(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.template_name,i):(0,b.sprintf)((0,b.__)("Single item: %1$s (%2$s)"),c.singular_name,i));const g=h?{...h,templatePrefix:o[i]}:{slug:d,title:m,description:(0,b.sprintf)((0,b.__)("Displays a single item: %s."),c.singular_name),icon:"string"==typeof u&&u.startsWith("dashicons-")?u.slice(10):mb,templatePrefix:o[i]},v=a?.[i]?.hasEntities;return v&&(g.onClick=t=>{e({type:"postType",slug:i,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:a[i].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${o[i]}-${e.slug}`;return{title:t,slug:t,templatePrefix:o[i]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!v||t.push(g),t}),[]),u=(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:s}=t;let n="postTypesMenuItems";return"page"===s&&(n="defaultPostTypesMenuItems"),e[n].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u},jb=e=>{const t=(()=>{const e=(0,l.useSelect)((e=>e(_.store).getTaxonomies({per_page:-1})),[]);return(0,d.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),s=xb(),n=bb(),i=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let s=t;return["category","post_tag"].includes(t)||(s=`taxonomy-${s}`),"post_tag"===t&&(s="tag"),e[t]=s,e}),{})),[t]),r=t?.reduce(((e,{labels:t})=>{const s=(t.template_name||t.singular_name).toLowerCase();return e[s]=(e[s]||0)+1,e}),{}),o=Pb("taxonomy",i),a=(s||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,s)=>{const{slug:l,labels:c}=s,u=i[l],d=n?.find((({slug:e})=>e===u)),h=a?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const s=(e.template_name||e.singular_name).toLowerCase();return r[s]>1&&s!==t})(c,l);let f=c.template_name||c.singular_name;p&&(f=c.template_name?(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.template_name,l):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.singular_name,l));const m=d?{...d,templatePrefix:i[l]}:{slug:u,title:f,description:(0,b.sprintf)((0,b.__)("Displays taxonomy: %s."),c.singular_name),icon:db,templatePrefix:i[l]},g=o?.[l]?.hasEntities;return g&&(m.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:o[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${i[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:i[l]}}},labels:c,hasGeneralTemplate:h,template:t})}),h&&!g||t.push(m),t}),[]);return(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:s}=t;let n="taxonomiesMenuItems";return["category","tag"].includes(s)&&(n="defaultTaxonomiesMenuItems"),e[n].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[c])},Cb={user:"author"},kb={user:{who:"authors"}};const Eb=(e,t,s={})=>{const n=(e=>{const t=xb();return(0,d.useMemo)((()=>Object.entries(e||{}).reduce(((e,[s,n])=>{const i=(t||[]).reduce(((e,t)=>{const s=`${n}-`;return t.slug.startsWith(s)&&e.push(t.slug.substring(s.length)),e}),[]);return i.length&&(e[s]=i),e}),{})),[e,t])})(t);return(0,l.useSelect)((t=>Object.entries(n||{}).reduce(((n,[i,r])=>{const o=t(_.store).getEntityRecords(e,i,{_fields:"id",context:"view",slug:r,...s[i]});return o?.length&&(n[i]=o),n}),{})),[n])},Pb=(e,t,s=gb)=>{const n=Eb(e,t,s),i=(0,l.useSelect)((i=>Object.keys(t||{}).reduce(((t,r)=>{const o=n?.[r]?.map((({id:e})=>e))||[];return t[r]=!!i(_.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:o,...s[r]})?.length,t}),{})),[t,n,e,s]);return(0,d.useMemo)((()=>Object.keys(t||{}).reduce(((e,t)=>{const s=n?.[t]?.map((({id:e})=>e))||[];return e[t]={hasEntities:i[t],existingEntitiesIds:s},e}),{})),[t,n,i])},{CompositeV2:Ib,CompositeItemV2:Tb,useCompositeStoreV2:Ob}=se(x.privateApis),Ab=[];function Mb({suggestion:e,search:t,onSelect:s,entityForSuggestions:n}){const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,me.jsxs)(Tb,{render:(0,me.jsx)(x.Button,{role:"option",className:i,onClick:()=>s(n.config.getSpecificTemplate(e))}),children:[(0,me.jsx)(x.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${i}__title`,children:(0,me.jsx)(x.TextHighlight,{text:(0,cs.decodeEntities)(e.name),highlight:t})}),e.link&&(0,me.jsx)(x.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${i}__info`,children:e.link})]})}function Nb({entityForSuggestions:e,onSelect:t}){const s=Ob({orientation:"vertical"}),[n,i,r]=(0,v.useDebouncedInput)(),o=function(e,t){const{config:s}=e,n=(0,d.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...s.queryArgs(t)})),[t,s]),{records:i,hasResolved:r}=(0,_.useEntityRecords)(e.type,e.slug,n),[o,a]=(0,d.useState)(Ab);return(0,d.useEffect)((()=>{if(!r)return;let e=Ab;i?.length&&(e=i,s.recordNamePath&&(e=yb(e,s.recordNamePath))),a(e)}),[i,r]),o}(e,r),{labels:a}=e,[l,c]=(0,d.useState)(!1);return!l&&o?.length>9&&c(!0),(0,me.jsxs)(me.Fragment,{children:[l&&(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,onChange:i,value:n,label:a.search_items,placeholder:a.search_items}),!!o?.length&&(0,me.jsx)(Ib,{store:s,role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,b.__)("Suggestions list"),children:o.map((s=>(0,me.jsx)(Mb,{suggestion:s,search:r,onSelect:t,entityForSuggestions:e},s.slug)))}),r&&!o?.length&&(0,me.jsx)(x.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results",children:a.not_found})]})}const Fb=function({onSelect:e,entityForSuggestions:t}){const[s,n]=(0,d.useState)(t.hasGeneralTemplate);return(0,me.jsxs)(x.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left",children:[!s&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("Select whether to create a single template for all items or a specific one.")}),(0,me.jsxs)(x.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial",children:[(0,me.jsxs)(x.FlexItem,{isBlock:!0,as:x.Button,onClick:()=>{const{slug:s,title:n,description:i,templatePrefix:r}=t.template;e({slug:s,title:n,description:i,templatePrefix:r})},children:[(0,me.jsx)(x.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.all_items}),(0,me.jsx)(x.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For all items")})]}),(0,me.jsxs)(x.FlexItem,{isBlock:!0,as:x.Button,onClick:()=>{n(!0)},children:[(0,me.jsx)(x.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.singular_name}),(0,me.jsx)(x.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For a specific item")})]})]})]}),s&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("This template will be used only for the specific item chosen.")}),(0,me.jsx)(Nb,{entityForSuggestions:t,onSelect:e})]})]})};var Vb=function(){return Vb=Object.assign||function(e){for(var t,s=1,n=arguments.length;s{e()},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,b.__)("Create")})]})]})})},{useHistory:Hb}=se(Xt.privateApis),Ub=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],Wb={"front-page":rb,home:ob,single:ab,page:Qs,archive:lb,search:ds,404:cb,index:ub,category:ap,author:Ux,taxonomy:db,date:hb,tag:pb,attachment:fb};function qb({title:e,direction:t,className:s,description:n,icon:i,onClick:r,children:o}){return(0,me.jsx)(x.Button,{className:s,onClick:r,label:n,showTooltip:!!n,children:(0,me.jsxs)(x.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t,children:[(0,me.jsx)("div",{className:"edit-site-add-new-template__template-icon",children:(0,me.jsx)(x.Icon,{icon:i})}),(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0,children:[(0,me.jsx)(x.__experimentalText,{align:"center",weight:500,lineHeight:1.53846153846,children:e}),o]})]})})}const Zb={templatesList:1,customTemplate:2,customGenericTemplate:3};function Kb({onClose:e}){const[t,s]=(0,d.useState)(Zb.templatesList),[n,i]=(0,d.useState)({}),[r,o]=(0,d.useState)(!1),a=function(e,t){const s=xb(),n=bb(),i=(s||[]).map((({slug:e})=>e)),r=(n||[]).filter((e=>Ub.includes(e.slug)&&!i.includes(e.slug))),o=s=>{t?.(),e(s)},a=[...r],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=jb(o),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=Sb(o),h=function(e){const t=xb(),s=bb(),n=Pb("root",Cb,kb);let i=s?.find((({slug:e})=>"author"===e));i||(i={description:(0,b.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const r=!!t?.find((({slug:e})=>"author"===e));if(n.user?.hasEntities&&(i={...i,templatePrefix:"author"},i.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:n.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:r,template:t})}),!r||n.user?.hasEntities)return i}(o);[...l,...u,h].forEach((e=>{if(!e)return;const t=a.findIndex((t=>t.slug===e.slug));t>-1?a[t]=e:a.push(e)})),a?.sort(((e,t)=>Ub.indexOf(e.slug)-Ub.indexOf(t.slug)));const p=[...a,..._b(),...d,...c];return p}(i,(()=>s(Zb.customTemplate))),c=Hb(),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),{homeUrl:f}=(0,l.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return{homeUrl:t()?.home}}),[]),m={"front-page":f,date:(0,b.sprintf)((0,b.__)("E.g. %s"),f+"/"+(new Date).getFullYear())};async function g(e,t=!0){if(!r){o(!0);try{const{title:s,description:n,slug:i}=e,r=await u("postType",Me,{description:n,slug:i.toString(),status:"publish",title:s,is_wp_suggestion:t},{throwOnError:!0});c.push({postId:r.id,postType:Me,canvas:"edit"}),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(r.title?.rendered||s)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the template.");h(t,{type:"snackbar"})}finally{o(!1)}}}const v=()=>{e(),s(Zb.templatesList)};let y=(0,b.__)("Add template");return t===Zb.customTemplate?y=(0,b.sprintf)((0,b.__)("Add template: %s"),n.labels.singular_name):t===Zb.customGenericTemplate&&(y=(0,b.__)("Create custom template")),(0,me.jsxs)(x.Modal,{title:y,className:Qt("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":t===Zb.templatesList,"edit-site-custom-template-modal":t===Zb.customTemplate}),onRequestClose:v,overlayClassName:t===Zb.customGenericTemplate?"edit-site-custom-generic-template__modal":void 0,children:[t===Zb.templatesList&&(0,me.jsxs)(x.__experimentalGrid,{columns:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents",children:[(0,me.jsx)(x.Flex,{className:"edit-site-add-new-template__template-list__prompt",children:(0,b.__)("Select what the new template should apply to:")}),a.map((e=>{const{title:t,slug:s,onClick:n}=e;return(0,me.jsx)(qb,{title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:m[s],icon:Wb[s]||Js,onClick:()=>n?n(e):g(e)},s)})),(0,me.jsx)(qb,{title:(0,b.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:Uy,onClick:()=>s(Zb.customGenericTemplate),children:(0,me.jsx)(x.__experimentalText,{lineHeight:1.53846153846,children:(0,b.__)("A custom template can be manually applied to any post or page.")})})]}),t===Zb.customTemplate&&(0,me.jsx)(Fb,{onSelect:g,entityForSuggestions:n}),t===Zb.customGenericTemplate&&(0,me.jsx)(Gb,{onClose:v,createTemplate:g})]})}const Yb=(0,d.memo)((function(){const[e,t]=(0,d.useState)(!1),{postType:s}=(0,l.useSelect)((e=>{const{getPostType:t}=e(_.store);return{postType:t(Me)}}),[]);return s?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>t(!0),label:s.labels.add_new_item,__next40pxDefaultSize:!0,children:s.labels.add_new_item}),e&&(0,me.jsx)(Kb,{onClose:()=>t(!1)})]}):null})),{usePostActions:Xb}=se(h.privateApis),{ExperimentalBlockEditorProvider:Jb,useGlobalStyle:Qb}=se(y.privateApis),{useHistory:$b,useLocation:ew}=se(Xt.privateApis),tw=[],sw={[qe]:{primaryField:"title"},[We]:{mediaField:"preview",primaryField:"title",columnFields:["description"]},[Ze]:{primaryField:"title",mediaField:"preview"}},nw={type:We,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},hiddenFields:["preview"],layout:sw[We],filters:[]};function iw({item:e,viewType:t}){if(t===Ze)return(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)");const s={params:{postId:e.id,postType:e.type,canvas:"edit"}};return(0,me.jsx)(on,{...s,children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")})}function rw({item:e,viewType:t}){const[s,n]=(0,d.useState)(!1),{text:i,icon:r,imageUrl:o}=Wx(e.type,e.id),a=t!==Ze;return(0,me.jsxs)(x.__experimentalHStack,{alignment:"left",spacing:1,children:[a&&o&&(0,me.jsx)("div",{className:Qt("page-templates-author-field__avatar",{"is-loaded":s}),children:(0,me.jsx)("img",{onLoad:()=>n(!0),alt:"",src:o})}),a&&!o&&(0,me.jsx)("div",{className:"page-templates-author-field__icon",children:(0,me.jsx)(x.Icon,{icon:r})}),(0,me.jsx)("span",{className:"page-templates-author-field__name",children:i})]})}function ow({item:e,viewType:t}){const s=ux(),[n="white"]=Qb("color.background"),i=(0,d.useMemo)((()=>(0,o.parse)(e.content.raw)),[e.content.raw]),{onClick:r}=rn({postId:e.id,postType:e.type,canvas:"edit"}),a=!i?.length;return(0,me.jsx)(Jb,{settings:s,children:(0,me.jsxs)("div",{className:`page-templates-preview-field is-viewtype-${t}`,style:{backgroundColor:n},children:[t===Ze&&!a&&(0,me.jsx)(lx,{children:(0,me.jsx)(y.BlockPreview,{blocks:i})}),t!==Ze&&(0,me.jsxs)("button",{className:"page-templates-preview-field__button",type:"button",onClick:r,"aria-label":e.title?.rendered||e.title,children:[a&&(0,b.__)("Empty template"),!a&&(0,me.jsx)(lx,{children:(0,me.jsx)(y.BlockPreview,{blocks:i})})]})]})})}function aw(){const{params:e}=ew(),{activeView:t="all",layout:s,postId:n}=e,[i,r]=(0,d.useState)([n]),o=(0,d.useMemo)((()=>{const e=null!=s?s:nw.type;return{...nw,type:e,layout:sw[e],filters:"all"!==t?[{field:"author",operator:"isAny",value:[t]}]:[]}}),[s,t]),[a,l]=(0,d.useState)(o);(0,d.useEffect)((()=>{l((e=>({...e,filters:"all"!==t?[{field:"author",operator:Ye,value:[t]}]:[]})))}),[t]);const{records:c,isResolving:u}=(0,_.useEntityRecords)("postType",Me,{per_page:-1}),h=$b(),p=(0,d.useCallback)((t=>{a?.type===Ze&&h.push({...e,postId:1===t.length?t[0].id:void 0})}),[h,e,a?.type]),f=(0,d.useMemo)((()=>{if(!c)return tw;const e=new Set;return c.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[c]),m=(0,d.useMemo)((()=>[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,me.jsx)(ow,{item:e,viewType:a.type}),minWidth:120,maxWidth:120,enableSorting:!1},{header:(0,b.__)("Template"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>(0,me.jsx)(iw,{item:e,viewType:a.type}),maxWidth:400,enableHiding:!1,enableGlobalSearch:!0},{header:(0,b.__)("Description"),id:"description",render:({item:e})=>e.description?(0,me.jsx)("span",{className:"page-templates-description",children:(0,cs.decodeEntities)(e.description)}):a.type===qe&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{variant:"muted","aria-hidden":"true",children:"—"}),(0,me.jsx)(x.VisuallyHidden,{children:(0,b.__)("No description.")})]}),maxWidth:400,minWidth:320,enableSorting:!1,enableGlobalSearch:!0},{header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:({item:e})=>(0,me.jsx)(rw,{viewType:a.type,item:e}),elements:f,width:"1%"}]),[f,a.type]),{data:g,paginationInfo:v}=(0,d.useMemo)((()=>rx(c,a,m)),[c,a,m]),y=Xb({postType:Me,context:"list"}),w=qy(),S=(0,d.useMemo)((()=>[w,...y]),[y,w]),j=(0,d.useCallback)((t=>{t.type!==a.type&&(t={...t,layout:{...sw[t.type]}},h.push({...e,layout:t.type})),l(t)}),[a.type,l,h,e]);return(0,me.jsx)(Ay,{className:"edit-site-page-templates",title:(0,b.__)("Templates"),actions:(0,me.jsx)(Yb,{}),children:(0,me.jsx)(Iy,{paginationInfo:v,fields:m,actions:S,data:g,isLoading:u,view:a,onChangeView:j,onSelectionChange:p,selection:i,setSelection:r})})}function lw(e){return(0,me.jsx)(x.Button,{...e,className:Qt("edit-site-sidebar-button",e.className)})}const{useHistory:cw,useLocation:uw}=se(Xt.privateApis);function dw({isRoot:e,title:t,actions:s,meta:n,content:i,footer:r,description:o,backPath:a}){const{dashboardLink:c,dashboardLinkText:u,previewingThemeName:h}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt)),s=sn();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:s?e(_.store).getTheme(s)?.name?.rendered:void 0}}),[]),p=uw(),f=cw(),{navigate:m}=(0,d.useContext)(vs),g=null!=a?a:p.state?.backPath,v=(0,b.isRTL)()?Gn:zn;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalVStack,{className:Qt("edit-site-sidebar-navigation-screen__main",{"has-footer":!!r}),spacing:0,justify:"flex-start",children:[(0,me.jsxs)(x.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon",children:[!e&&(0,me.jsx)(lw,{onClick:()=>{f.push(g),m("back")},icon:v,label:(0,b.__)("Back"),showTooltip:!1}),e&&(0,me.jsx)(lw,{icon:v,label:u||(0,b.__)("Go to the Dashboard"),href:c||"index.php"}),(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20,children:tn()?(0,b.sprintf)("Previewing %1$s: %2$s",h,t):t}),s&&(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen__actions",children:s})]}),n&&(0,me.jsx)(me.Fragment,{children:(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen__meta",children:n})}),(0,me.jsxs)("div",{className:"edit-site-sidebar-navigation-screen__content",children:[o&&(0,me.jsx)("p",{className:"edit-site-sidebar-navigation-screen__description",children:o}),i]})]}),r&&(0,me.jsx)("footer",{className:"edit-site-sidebar-navigation-screen__footer",children:r})]})}const hw=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),pw=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),{useHistory:fw}=se(Xt.privateApis);function mw({className:e,icon:t,withChevron:s=!1,suffix:n,uid:i,params:r,onClick:o,children:a,...l}){const c=fw(),{navigate:u}=(0,d.useContext)(vs);return(0,me.jsx)(x.__experimentalItem,{className:Qt("edit-site-sidebar-navigation-item",{"with-suffix":!s&&n},e),onClick:function(e){o?(o(e),u("forward")):r&&(e.preventDefault(),c.push(r),u("forward",`[id="${i}"]`))},id:i,...l,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[t&&(0,me.jsx)(eu,{style:{fill:"currentcolor"},icon:t,size:24}),(0,me.jsx)(x.FlexBlock,{children:a}),s&&(0,me.jsx)(eu,{icon:(0,b.isRTL)()?hw:pw,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!s&&n]})})}function gw({children:e}){return(0,me.jsx)(x.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__label",children:e})}function vw({label:e,children:t,className:s,...n}){return(0,me.jsx)(x.__experimentalHStack,{spacing:5,alignment:"left",className:Qt("edit-site-sidebar-navigation-details-screen-panel__row",s),...n,children:t},e)}function yw({children:e}){return(0,me.jsx)(x.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__value",children:e})}function xw({record:e,...t}){var s,n;const i={},r=null!==(s=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==s?s:null,o=null!==(n=e?._links?.["version-history"]?.[0]?.count)&&void 0!==n?n:0;return r&&o>1&&(i.href=(0,ps.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),i.as="a"),(0,me.jsx)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-details-footer",children:(0,me.jsx)(mw,{"aria-label":(0,b.__)("Revisions"),...i,...t,children:(0,me.jsxs)(vw,{justify:"space-between",children:[(0,me.jsx)(gw,{children:(0,b.__)("Last modified")}),(0,me.jsx)(yw,{children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)(""),(0,Kd.humanTimeDiff)(e.modified)),{time:(0,me.jsx)("time",{dateTime:e.modified})})}),(0,me.jsx)(x.Icon,{className:"edit-site-sidebar-navigation-screen-details-footer__icon",icon:zs})]})})})}const bw=()=>{};function ww(e){const{openGeneralSidebar:t}=(0,l.useDispatch)(Kt),{setCanvasMode:s}=se((0,l.useDispatch)(Kt));return(0,l.useSelect)((e=>!!e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length),[])?(0,me.jsx)(mw,{...e,params:{path:"/wp_global_styles"},uid:"global-styles-navigation-item"}):(0,me.jsx)(mw,{...e,onClick:()=>{s("edit"),t("edit-site/global-styles")}})}function _w(){const{storedSettings:e}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return{storedSettings:t()}}),[]),t=he(),s=pe();return(0,me.jsx)(y.BlockEditorProvider,{settings:e,onChange:bw,onInput:bw,children:(0,me.jsxs)(x.__experimentalVStack,{spacing:10,className:"edit-site-global-styles-variation-container",children:[(0,me.jsx)(dd,{gap:3}),t?.length&&(0,me.jsx)(fu,{title:(0,b.__)("Palettes"),gap:3}),s?.length&&(0,me.jsx)(dr,{title:(0,b.__)("Typography"),gap:3})]})})}function Sw({backPath:e}){const{revisions:t,isLoading:s}=Zd(),{openGeneralSidebar:n}=(0,l.useDispatch)(Kt),{setIsListViewOpened:i}=(0,l.useDispatch)(h.store),r=(0,v.useViewportMatch)("medium","<"),{setCanvasMode:o,setEditorCanvasContainerView:a}=se((0,l.useDispatch)(Kt)),{isViewMode:c,isStyleBookOpened:u,revisionsCount:p}=(0,l.useSelect)((e=>{var t;const{getCanvasMode:s,getEditorCanvasContainerView:n}=se(e(Kt)),{getEntityRecord:i,__experimentalGetCurrentGlobalStylesId:r}=e(_.store),o=r(),a=o?i("root","globalStyles",o):void 0;return{isViewMode:"view"===s(),isStyleBookOpened:"style-book"===n(),revisionsCount:null!==(t=a?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),{set:m}=(0,l.useDispatch)(f.store),g=(0,d.useCallback)((async()=>Promise.all([m("core","distractionFree",!1),o("edit"),n("edit-site/global-styles")])),[o,n,m]),y=(0,d.useCallback)((async()=>{await g(),a("style-book"),i(!1)}),[g,a,i]),x=(0,d.useCallback)((async()=>{await g(),a("global-styles-revisions")}),[g,a]),w=p>0,S=t?.[0]?.modified,j=w&&!s&&S;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(dw,{title:(0,b.__)("Styles"),description:(0,b.__)("Choose a different style combination for the theme styles."),backPath:e,content:(0,me.jsx)(_w,{}),footer:j&&(0,me.jsx)(xw,{record:t?.[0],onClick:x}),actions:(0,me.jsxs)(me.Fragment,{children:[!r&&(0,me.jsx)(lw,{icon:Dn,label:(0,b.__)("Style Book"),onClick:()=>a(u?void 0:"style-book"),isPressed:u}),(0,me.jsx)(lw,{icon:Uy,label:(0,b.__)("Edit styles"),onClick:async()=>await g()})]})}),u&&!r&&c&&(0,me.jsx)(Ad,{enableResizing:!1,isSelected:()=>!1,onClick:y,onSelect:y,showCloseButton:!1,showTabs:!1})]})}const jw=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})});function Cw(){const{setEditorCanvasContainerView:e}=se((0,l.useDispatch)(Kt));return(0,d.useEffect)((()=>{e(void 0)}),[e]),(0,me.jsx)(dw,{isRoot:!0,title:(0,b.__)("Design"),description:(0,b.__)("Customize the appearance of your website using the block editor."),content:(0,me.jsx)(me.Fragment,{children:(0,me.jsxs)(x.__experimentalItemGroup,{children:[(0,me.jsx)(mw,{uid:"navigation-navigation-item",params:{postType:Ae},withChevron:!0,icon:jw,children:(0,b.__)("Navigation")}),(0,me.jsx)(ww,{uid:"styles-navigation-item",withChevron:!0,icon:Vs,children:(0,b.__)("Styles")}),(0,me.jsx)(mw,{uid:"page-navigation-item",params:{postType:"page"},withChevron:!0,icon:Qs,children:(0,b.__)("Pages")}),(0,me.jsx)(mw,{uid:"template-navigation-item",params:{postType:Me},withChevron:!0,icon:Js,children:(0,b.__)("Templates")}),(0,me.jsx)(mw,{uid:"patterns-navigation-item",params:{postType:Be.user},withChevron:!0,icon:Px,children:(0,b.__)("Patterns")})]})})})}const kw={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},Ew=e=>e?.trim()?.length>0;function Pw({menuTitle:e,onClose:t,onSave:s}){const[n,i]=(0,d.useState)(e),r=n!==e&&Ew(n);return(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename"),onRequestClose:t,children:(0,me.jsx)("form",{className:"sidebar-navigation__rename-modal-form",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"3",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:n,placeholder:(0,b.__)("Navigation title"),onChange:i}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,__experimentalIsFocusable:!0,disabled:!r,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),r&&(s({title:n}),t())},children:(0,b.__)("Save")})]})]})})})}function Iw({onClose:e,onConfirm:t}){return(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{t(),e()},onCancel:e,confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.__)("Are you sure you want to delete this Navigation Menu?")})}const{useHistory:Tw}=se(Xt.privateApis),Ow={position:"bottom right"};function Aw(e){const{onDelete:t,onSave:s,onDuplicate:n,menuTitle:i,menuId:r}=e,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),u=Tw(),h=()=>{a(!1),c(!1)};return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,b.__)("Actions"),icon:Ln,popoverProps:Ow,children:({onClose:e})=>(0,me.jsx)("div",{children:(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{u.push({postId:r,postType:"wp_navigation",canvas:"edit"})},children:(0,b.__)("Edit")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{n(),e()},children:(0,b.__)("Duplicate")}),(0,me.jsx)(x.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()},children:(0,b.__)("Delete")})]})})}),l&&(0,me.jsx)(Iw,{onClose:h,onConfirm:t}),o&&(0,me.jsx)(Pw,{onClose:h,menuTitle:i,onSave:s})]})}const Mw=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Nw=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Fw={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useHistory:Vw}=se(Xt.privateApis);function Rw(e){const t=Vw(),{block:s}=e,{clientId:n}=s,{moveBlocksDown:i,moveBlocksUp:r,removeBlocks:o}=(0,l.useDispatch)(y.store),a=(0,b.sprintf)((0,b.__)("Remove %s"),(0,y.BlockTitle)({clientId:n,maximumLength:25})),c=(0,b.sprintf)((0,b.__)("Go to %s"),(0,y.BlockTitle)({clientId:n,maximumLength:25})),u=(0,l.useSelect)((e=>{const{getBlockRootClientId:t}=e(y.store);return t(n)}),[n]),h=(0,d.useCallback)((e=>{const{attributes:s,name:n}=e;if("post-type"===s.kind&&s.id&&s.type&&t){const{params:e}=t.getLocationWithParams();t.push({postType:s.type,postId:s.id,canvas:"edit"},{backPath:e})}if("core/page-list-item"===n&&s.id&&t){const{params:e}=t.getLocationWithParams();t.push({postType:"page",postId:s.id,canvas:"edit"},{backPath:e})}}),[t]);return(0,me.jsx)(x.DropdownMenu,{icon:Ln,label:(0,b.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Fw,noIcons:!0,...e,children:({onClose:e})=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{icon:Mw,onClick:()=>{r([n],u),e()},children:(0,b.__)("Move up")}),(0,me.jsx)(x.MenuItem,{icon:Nw,onClick:()=>{i([n],u),e()},children:(0,b.__)("Move down")}),"page"===s.attributes?.type&&s.attributes?.id&&(0,me.jsx)(x.MenuItem,{onClick:()=>{h(s),e()},children:c})]}),(0,me.jsx)(x.MenuGroup,{children:(0,me.jsx)(x.MenuItem,{onClick:()=>{o([n],!1),e()},children:a})})]})})}const{PrivateListView:Bw}=se(y.privateApis),Dw=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function Lw({rootClientId:e}){const{listViewRootClientId:t,isLoading:s}=(0,l.useSelect)((t=>{const{areInnerBlocksControlled:s,getBlockName:n,getBlockCount:i,getBlockOrder:r}=t(y.store),{isResolving:o}=t(_.store),a=r(e),l=1===a.length&&"core/page-list"===n(a[0])&&i(a[0])>0,c=o("getEntityRecords",Dw);return{listViewRootClientId:l?a[0]:e,isLoading:!s(e)||c}}),[e]),{replaceBlock:n,__unstableMarkNextChangeAsNotPersistent:i}=(0,l.useDispatch)(y.store),r=(0,d.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(i(),n(e.clientId,(0,o.createBlock)("core/navigation-link",e.attributes)))}),[i,n]);return(0,me.jsxs)(me.Fragment,{children:[!s&&(0,me.jsx)(Bw,{rootClientId:t,onSelect:r,blockSettingsMenu:Rw,showAppender:!1}),(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",children:(0,me.jsx)(y.BlockList,{})})]})}const zw=()=>{};function Gw({navigationMenuId:e}){const{storedSettings:t}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return{storedSettings:t()}}),[]),s=(0,d.useMemo)((()=>e?[(0,o.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&s?.length?(0,me.jsx)(y.BlockEditorProvider,{settings:t,value:s,onChange:zw,onInput:zw,children:(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content",children:(0,me.jsx)(Lw,{rootClientId:s[0].clientId})})}):null}function Hw(e,t,s){return e?.rendered?"publish"===s?(0,cs.decodeEntities)(e?.rendered):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,cs.decodeEntities)(e?.rendered),s):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function Uw({navigationMenu:e,backPath:t,handleDelete:s,handleDuplicate:n,handleSave:i}){const r=e?.title?.rendered;return(0,me.jsx)(s_,{actions:(0,me.jsx)(me.Fragment,{children:(0,me.jsx)(Aw,{menuId:e?.id,menuTitle:(0,cs.decodeEntities)(r),onDelete:s,onSave:i,onDuplicate:n})}),backPath:t,title:Hw(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."),children:(0,me.jsx)(Gw,{navigationMenuId:e?.id})})}const{useLocation:Ww}=se(Xt.privateApis),qw="wp_navigation";function Zw({backPath:e}){const{params:{postId:t}}=Ww(),{record:s,isResolving:n}=(0,_.useEntityRecord)("postType",qw,t),{isSaving:i,isDeleting:r}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:s,isDeletingEntityRecord:n}=e(_.store);return{isSaving:s("postType",qw,t),isDeleting:n("postType",qw,t)}}),[t]),o=n||i||r,a=s?.title?.rendered||s?.slug,{handleSave:c,handleDelete:u,handleDuplicate:d}=Qw(),h=()=>u(s),p=e=>c(s,e),f=()=>d(s);return o?(0,me.jsx)(s_,{description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),backPath:e,children:(0,me.jsx)(x.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):o||s?s?.content?.raw?(0,me.jsx)(Uw,{navigationMenu:s,backPath:e,handleDelete:h,handleSave:p,handleDuplicate:f}):(0,me.jsx)(s_,{actions:(0,me.jsx)(Aw,{menuId:s?.id,menuTitle:(0,cs.decodeEntities)(a),onDelete:h,onSave:p,onDuplicate:f}),backPath:e,title:Hw(s?.title,s?.id,s?.status),description:(0,b.__)("This Navigation Menu is empty.")}):(0,me.jsx)(s_,{description:(0,b.__)("Navigation Menu missing."),backPath:e})}const{useHistory:Kw}=se(Xt.privateApis);function Yw(){const{deleteEntityRecord:e}=(0,l.useDispatch)(_.store),{createSuccessNotice:t,createErrorNotice:s}=(0,l.useDispatch)(w.store),n=Kw();return async i=>{const r=i?.id;try{await e("postType",qw,r,{force:!0},{throwOnError:!0}),t((0,b.__)("Navigation Menu successfully deleted."),{type:"snackbar"}),n.push({postType:"wp_navigation"})}catch(e){s((0,b.sprintf)((0,b.__)("Unable to delete Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Xw(){const{getEditedEntityRecord:e}=(0,l.useSelect)((e=>{const{getEditedEntityRecord:t}=e(_.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:s}=(0,l.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:i}=(0,l.useDispatch)(w.store);return async(r,o)=>{if(!o)return;const a=r?.id,l=e("postType",Ae,a);t("postType",qw,a,o);const c=Object.keys(o);try{await s("postType",qw,a,c,{throwOnError:!0}),n((0,b.__)("Renamed Navigation Menu"),{type:"snackbar"})}catch(e){t("postType",qw,a,l),i((0,b.sprintf)((0,b.__)("Unable to rename Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Jw(){const e=Kw(),{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{createSuccessNotice:s,createErrorNotice:n}=(0,l.useDispatch)(w.store);return async i=>{const r=i?.title?.rendered||i?.slug;try{const n=await t("postType",qw,{title:(0,b.sprintf)((0,b.__)("%s (Copy)"),r),content:i?.content?.raw,status:"publish"},{throwOnError:!0});n&&(s((0,b.__)("Duplicated Navigation Menu"),{type:"snackbar"}),e.push({postType:qw,postId:n.id}))}catch(e){n((0,b.sprintf)((0,b.__)("Unable to duplicate Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Qw(){return{handleDelete:Yw(),handleSave:Xw(),handleDuplicate:Jw()}}function $w(e,t,s){return e?"publish"===s?(0,cs.decodeEntities)(e):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,cs.decodeEntities)(e),s):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}let e_=!1;function t_({backPath:e}){const{records:t,isResolving:s,hasResolved:n}=(0,_.useEntityRecords)("postType",Ae,kw),i=s&&!n,{getNavigationFallbackId:r}=se((0,l.useSelect)(_.store)),o=t?.[0];o&&(e_=!0),o||s||!n||e_||r();const{handleSave:a,handleDelete:c,handleDuplicate:u}=Qw(),d=!!t?.length;return i?(0,me.jsx)(s_,{backPath:e,children:(0,me.jsx)(x.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):i||d?1===t?.length?(0,me.jsx)(Uw,{navigationMenu:o,backPath:e,handleDelete:()=>c(o),handleDuplicate:()=>u(o),handleSave:e=>a(o,e)}):(0,me.jsx)(s_,{backPath:e,children:(0,me.jsx)(x.__experimentalItemGroup,{children:t?.map((({id:e,title:t,status:s},n)=>(0,me.jsx)(n_,{postId:e,withChevron:!0,icon:jw,children:$w(t?.rendered,n+1,s)},e)))})}):(0,me.jsx)(s_,{description:(0,b.__)("No Navigation Menus found."),backPath:e})}function s_({children:e,actions:t,title:s,description:n,backPath:i}){return(0,me.jsx)(dw,{title:s||(0,b.__)("Navigation"),actions:t,description:n||(0,b.__)("Manage your Navigation Menus."),backPath:i,content:e})}const n_=({postId:e,...t})=>{const s=rn({postId:e,postType:"wp_navigation"});return(0,me.jsx)(mw,{...s,...t})},{useLocation:i_}=se(Xt.privateApis);function r_({title:e,slug:t,customViewId:s,type:n,icon:i,isActive:r,isCustom:o,suffix:a}){const{params:{postType:l,layout:c}}=i_(),u=i||$p.find((e=>e.type===n)).icon;let d=o?s:t;"all"===d&&(d=void 0);const h=rn({postType:l,layout:c,activeView:d,isCustom:o?"true":void 0});return(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",className:Qt("edit-site-sidebar-dataviews-dataview-item",{"is-selected":r}),children:[(0,me.jsx)(mw,{icon:u,...h,"aria-current":r?"true":void 0,children:e}),a]})}const o_=[];function a_({template:e,isActive:t}){const{text:s,icon:n}=Wx(e.type,e.id);return(0,me.jsx)(r_,{slug:s,title:s,icon:n,isActive:t,isCustom:!1},s)}function l_({activeView:e,title:t}){const{records:s}=(0,_.useEntityRecords)("postType",Me,{per_page:-1}),n=(0,d.useMemo)((()=>{var e;const t=s?.reduce(((e,t)=>{const s=t.author_text;return s&&!e[s]&&(e[s]=t),e}),{});return null!==(e=t&&Object.values(t))&&void 0!==e?e:o_}),[s]);return(0,me.jsxs)(x.__experimentalItemGroup,{children:[(0,me.jsx)(r_,{slug:"all",title:t,icon:Js,isActive:"all"===e,isCustom:!1}),n.map((t=>(0,me.jsx)(a_,{template:t,isActive:e===t.author_text},t.author_text)))]})}const{useLocation:c_}=se(Xt.privateApis);function u_({backPath:e}){const{params:{activeView:t="all"}}=c_();return(0,me.jsx)(dw,{title:(0,b.__)("Templates"),description:(0,b.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),backPath:e,content:(0,me.jsx)(l_,{activeView:t,title:(0,b.__)("All templates")})})}const d_=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.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"})});function h_({count:e,icon:t,id:s,isActive:n,label:i,type:r}){const o=rn({categoryId:s!==Re&&s!==De?s:void 0,postType:r===Ne?Ne:Be.user});if(e)return(0,me.jsx)(mw,{...o,icon:t,suffix:(0,me.jsx)("span",{children:e}),"aria-current":n?"true":void 0,children:i})}const p_=e=>{const t=e||[],s=(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplatePartAreas()),[]),n={header:{},footer:{},sidebar:{},uncategorized:{}};s.forEach((e=>n[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>(e[e[t.area]?t.area:Ve].templateParts.push(t),e)),n)};const{useLocation:f_}=se(Xt.privateApis);function m_({templatePartAreas:e,patternCategories:t,currentCategory:s,currentType:n}){const[i,...r]=t;return(0,me.jsxs)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:[(0,me.jsx)(h_,{count:Object.values(e).map((({templateParts:e})=>e?.length||0)).reduce(((e,t)=>e+t),0),icon:(0,h.getTemplatePartIcon)(),label:(0,b.__)("All template parts"),id:Re,type:Ne,isActive:s===Re&&n===Ne},"all"),Object.entries(e).map((([e,{label:t,templateParts:i}])=>(0,me.jsx)(h_,{count:i?.length,icon:(0,h.getTemplatePartIcon)(e),label:t,id:e,type:Ne,isActive:s===e&&n===Ne},e))),(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-patterns__divider"}),i&&(0,me.jsx)(h_,{count:i.count,label:i.label,icon:d_,id:i.name,type:Be.user,isActive:s===`${i.name}`&&n===Be.user},i.name),r.map((e=>(0,me.jsx)(h_,{count:e.count,label:e.label,icon:d_,id:e.name,type:Be.user,isActive:s===`${e.name}`&&n===Be.user},e.name)))]})}function g_({backPath:e}){const{params:{postType:t,categoryId:s}}=f_(),n=t||Be.user,i=s||(n===Be.user?De:Re),{templatePartAreas:r,hasTemplateParts:o,isLoading:a}=function(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType",Ne,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:p_(e)}}(),{patternCategories:c,hasPatterns:u}=Fx(),d=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]);return(0,me.jsx)(dw,{isRoot:!d,title:(0,b.__)("Patterns"),description:(0,b.__)("Manage what patterns are available when editing the site."),backPath:e,content:(0,me.jsxs)(me.Fragment,{children:[a&&(0,b.__)("Loading items…"),!a&&(0,me.jsxs)(me.Fragment,{children:[!o&&!u&&(0,me.jsx)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:(0,me.jsx)(x.__experimentalItem,{children:(0,b.__)("No items found")})}),(0,me.jsx)(m_,{templatePartAreas:r,patternCategories:c,currentCategory:i,currentType:n})]})]})})}const{useHistory:v_}=se(Xt.privateApis);function y_({type:e,setIsAdding:t}){const s=v_(),{saveEntityRecord:n}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(""),[o,a]=(0,d.useState)(!1);return(0,me.jsx)("form",{onSubmit:async r=>{r.preventDefault(),a(!0);const{getEntityRecords:o}=(0,l.resolveSelect)(_.store);let c;const u=await o("taxonomy","wp_dataviews_type",{slug:e});if(u&&u.length>0)c=u[0].id;else{const t=await n("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(c=t.id)}const d=await n("postType","wp_dataviews",{title:i,status:"publish",wp_dataviews_type:c,content:JSON.stringify(zy[e][0].view)}),{params:{postType:h}}=s.getLocationWithParams();s.push({postType:h,activeView:d.id,isCustom:"true"}),a(!1),t(!1)},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"5",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>{t(!1)},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{variant:"primary",type:"submit","aria-disabled":!i||o,isBusy:o,children:(0,b.__)("Create")})]})]})})}function x_({type:e}){const[t,s]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(mw,{icon:ju,onClick:()=>{s(!0)},className:"dataviews__siderbar-content-add-new-item",children:(0,b.__)("New view")}),t&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Add new view"),onRequestClose:()=>{s(!1)},children:(0,me.jsx)(y_,{type:e,setIsAdding:s})})]})}const{useHistory:b_}=se(Xt.privateApis),w_=[];function __({dataviewId:e,currentTitle:t,setIsRenaming:s}){const{editEntityRecord:n}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(t);return(0,me.jsx)("form",{onSubmit:async t=>{t.preventDefault(),await n("postType","wp_dataviews",e,{title:i}),s(!1)},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"5",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>{s(!1)},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{variant:"primary",type:"submit","aria-disabled":!i,children:(0,b.__)("Rename")})]})]})})}function S_({dataviewId:e,isActive:t}){const s=b_(),{dataview:n}=(0,l.useSelect)((t=>{const{getEditedEntityRecord:s}=t(_.store);return{dataview:s("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:i}=(0,l.useDispatch)(_.store),r=(0,d.useMemo)((()=>JSON.parse(n.content).type),[n.content]),[o,a]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(r_,{title:n.title,type:r,isActive:t,isCustom:!0,customViewId:e,suffix:(0,me.jsx)(x.DropdownMenu,{icon:Ln,label:(0,b.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"},children:({onClose:e})=>(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,me.jsx)(x.MenuItem,{onClick:async()=>{if(await i("postType","wp_dataviews",n.id,{force:!0}),t){const{params:{postType:e}}=s.getLocationWithParams();s.replace({postType:e})}e()},isDestructive:!0,children:(0,b.__)("Delete")})]})})}),o&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename view"),onRequestClose:()=>{a(!1)},children:(0,me.jsx)(__,{dataviewId:e,setIsRenaming:a,currentTitle:n.title})})]})}function j_({type:e,activeView:t,isCustom:s}){const n=function(e){return(0,l.useSelect)((t=>{const{getEntityRecords:s}=t(_.store),n=s("taxonomy","wp_dataviews_type",{slug:e});if(!n||0===n.length)return w_;return s("postType","wp_dataviews",{wp_dataviews_type:n[0].id,orderby:"date",order:"asc"})||w_}))}(e);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header",children:(0,me.jsx)(x.__experimentalHeading,{level:2,children:(0,b.__)("Custom Views")})}),(0,me.jsxs)(x.__experimentalItemGroup,{children:[n.map((e=>(0,me.jsx)(S_,{dataviewId:e.id,isActive:s&&Number(t)===e.id},e.id))),(0,me.jsx)(x_,{type:e})]})]})}const{useLocation:C_}=se(Xt.privateApis);function k_(){const{params:{postType:e,activeView:t="all",isCustom:s="false"}}=C_();if(!e)return null;const n="true"===s;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalItemGroup,{children:zy[e].map((e=>(0,me.jsx)(r_,{slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:!n&&e.slug===t,isCustom:!1},e.slug)))}),window?.__experimentalCustomViews&&(0,me.jsx)(j_,{activeView:t,type:e,isCustom:!0})]})}const{useLocation:E_,useHistory:P_}=se(Xt.privateApis);function I_(){const e=dn(),{params:t}=E_(),{postType:s,postId:n,path:i,layout:r,isCustom:o,canvas:a}=t,l="edit"===a;if(function(){const e=P_(),{params:t}=E_();(0,d.useEffect)((()=>{const{postType:s,path:n,categoryType:i,...r}=t;"/wp_template_part/all"===n&&e.replace({postType:Ne}),"/page"===n&&e.replace({postType:"page",...r}),"/wp_template"===n&&e.replace({postType:Me,...r}),"/patterns"===n&&e.replace({postType:i===Ne?Ne:Be.user,...r}),"/navigation"===n&&e.replace({postType:Ae,...r})}),[e,t])}(),"page"===s){const t="list"===r||!r;return{key:"pages",areas:{sidebar:(0,me.jsx)(dw,{title:(0,b.__)("Pages"),backPath:{},content:(0,me.jsx)(k_,{})}),content:(0,me.jsx)(sx,{}),preview:(t||l)&&(0,me.jsx)(zh,{isLoading:e}),mobile:l?(0,me.jsx)(zh,{isLoading:e}):(0,me.jsx)(sx,{})},widths:{content:t?380:void 0}}}if(s===Me){const t="true"!==o&&"list"===r;return{key:"templates",areas:{sidebar:(0,me.jsx)(u_,{backPath:{}}),content:(0,me.jsx)(aw,{}),preview:(t||l)&&(0,me.jsx)(zh,{isLoading:e}),mobile:l?(0,me.jsx)(zh,{isLoading:e}):(0,me.jsx)(aw,{})},widths:{content:t?380:void 0}}}return[Ne,Be.user].includes(s)?{key:"patterns",areas:{sidebar:(0,me.jsx)(g_,{backPath:{}}),content:(0,me.jsx)(ib,{}),mobile:l?(0,me.jsx)(zh,{isLoading:e}):(0,me.jsx)(ib,{}),preview:l&&(0,me.jsx)(zh,{isLoading:e})}}:"/wp_global_styles"===i?{key:"styles",areas:{sidebar:(0,me.jsx)(Sw,{backPath:{}}),preview:(0,me.jsx)(zh,{isLoading:e}),mobile:l&&(0,me.jsx)(zh,{isLoading:e})}}:s===Ae?n?{key:"navigation",areas:{sidebar:(0,me.jsx)(Zw,{backPath:{postType:Ae}}),preview:(0,me.jsx)(zh,{isLoading:e}),mobile:l&&(0,me.jsx)(zh,{isLoading:e})}}:{key:"navigation",areas:{sidebar:(0,me.jsx)(t_,{backPath:{}}),preview:(0,me.jsx)(zh,{isLoading:e}),mobile:l&&(0,me.jsx)(zh,{isLoading:e})}}:{key:"default",areas:{sidebar:(0,me.jsx)(Cw,{}),preview:(0,me.jsx)(zh,{isLoading:e}),mobile:l&&(0,me.jsx)(zh,{isLoading:e})}}}var T_=q_(),O_=e=>G_(e,T_),A_=q_();O_.write=e=>G_(e,A_);var M_=q_();O_.onStart=e=>G_(e,M_);var N_=q_();O_.onFrame=e=>G_(e,N_);var F_=q_();O_.onFinish=e=>G_(e,F_);var V_=[];O_.setTimeout=(e,t)=>{let s=O_.now()+t,n=()=>{let e=V_.findIndex((e=>e.cancel==n));~e&&V_.splice(e,1),L_-=~e?1:0},i={time:s,handler:e,cancel:n};return V_.splice(R_(s),0,i),L_+=1,H_(),i};var R_=e=>~(~V_.findIndex((t=>t.time>e))||~V_.length);O_.cancel=e=>{M_.delete(e),N_.delete(e),F_.delete(e),T_.delete(e),A_.delete(e)},O_.sync=e=>{z_=!0,O_.batchedUpdates(e),z_=!1},O_.throttle=e=>{let t;function s(){try{e(...t)}finally{t=null}}function n(...e){t=e,O_.onStart(s)}return n.handler=e,n.cancel=()=>{M_.delete(s),t=null},n};var B_=typeof window<"u"?window.requestAnimationFrame:()=>{};O_.use=e=>B_=e,O_.now=typeof performance<"u"?()=>performance.now():Date.now,O_.batchedUpdates=e=>e(),O_.catch=console.error,O_.frameLoop="always",O_.advance=()=>{"demand"!==O_.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):W_()};var D_=-1,L_=0,z_=!1;function G_(e,t){z_?(t.delete(e),e(0)):(t.add(e),H_())}function H_(){D_<0&&(D_=0,"demand"!==O_.frameLoop&&B_(U_))}function U_(){~D_&&(B_(U_),O_.batchedUpdates(W_))}function W_(){let e=D_;D_=O_.now();let t=R_(D_);t&&(Z_(V_.splice(0,t),(e=>e.handler())),L_-=t),L_?(M_.flush(),T_.flush(e?Math.min(64,D_-e):16.667),N_.flush(),A_.flush(),F_.flush()):D_=-1}function q_(){let e=new Set,t=e;return{add(s){L_+=t!=e||e.has(s)?0:1,e.add(s)},delete:s=>(L_-=t==e&&e.has(s)?1:0,e.delete(s)),flush(s){t.size&&(e=new Set,L_-=t.size,Z_(t,(t=>t(s)&&e.add(t))),L_+=e.size,t=e)}}}function Z_(e,t){e.forEach((e=>{try{t(e)}catch(e){O_.catch(e)}}))}var K_=Object.defineProperty,Y_={};function X_(){}((e,t)=>{for(var s in t)K_(e,s,{get:t[s],enumerable:!0})})(Y_,{assign:()=>uS,colors:()=>aS,createStringInterpolator:()=>nS,skipAnimation:()=>lS,to:()=>iS,willAdvance:()=>cS});var J_={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function Q_(e,t){if(J_.arr(e)){if(!J_.arr(t)||e.length!==t.length)return!1;for(let s=0;se.forEach(t);function eS(e,t,s){if(J_.arr(e))for(let n=0;nJ_.und(e)?[]:J_.arr(e)?e:[e];function sS(e,t){if(e.size){let s=Array.from(e);e.clear(),$_(s,t)}}var nS,iS,rS=(e,...t)=>sS(e,(e=>e(...t))),oS=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),aS=null,lS=!1,cS=X_,uS=e=>{e.to&&(iS=e.to),e.now&&(O_.now=e.now),void 0!==e.colors&&(aS=e.colors),null!=e.skipAnimation&&(lS=e.skipAnimation),e.createStringInterpolator&&(nS=e.createStringInterpolator),e.requestAnimationFrame&&O_.use(e.requestAnimationFrame),e.batchedUpdates&&(O_.batchedUpdates=e.batchedUpdates),e.willAdvance&&(cS=e.willAdvance),e.frameLoop&&(O_.frameLoop=e.frameLoop)},dS=new Set,hS=[],pS=[],fS=0,mS={get idle(){return!dS.size&&!hS.length},start(e){fS>e.priority?(dS.add(e),O_.onStart(gS)):(vS(e),O_(xS))},advance:xS,sort(e){if(fS)O_.onFrame((()=>mS.sort(e)));else{let t=hS.indexOf(e);~t&&(hS.splice(t,1),yS(e))}},clear(){hS=[],dS.clear()}};function gS(){dS.forEach(vS),dS.clear(),O_(xS)}function vS(e){hS.includes(e)||yS(e)}function yS(e){hS.splice(function(e,t){let s=e.findIndex(t);return s<0?e.length:s}(hS,(t=>t.priority>e.priority)),0,e)}function xS(e){let t=pS;for(let s=0;s0}var bS="[-+]?\\d*\\.?\\d+",wS=bS+"%";function _S(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var SS=new RegExp("rgb"+_S(bS,bS,bS)),jS=new RegExp("rgba"+_S(bS,bS,bS,bS)),CS=new RegExp("hsl"+_S(bS,wS,wS)),kS=new RegExp("hsla"+_S(bS,wS,wS,bS)),ES=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,PS=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,IS=/^#([0-9a-fA-F]{6})$/,TS=/^#([0-9a-fA-F]{8})$/;function OS(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+6*(t-e)*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function AS(e,t,s){let n=s<.5?s*(1+t):s+t-s*t,i=2*s-n,r=OS(i,n,e+1/3),o=OS(i,n,e),a=OS(i,n,e-1/3);return Math.round(255*r)<<24|Math.round(255*o)<<16|Math.round(255*a)<<8}function MS(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function NS(e){return(parseFloat(e)%360+360)%360/360}function FS(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function VS(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function RS(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=IS.exec(e))?parseInt(t[1]+"ff",16)>>>0:aS&&void 0!==aS[e]?aS[e]:(t=SS.exec(e))?(MS(t[1])<<24|MS(t[2])<<16|MS(t[3])<<8|255)>>>0:(t=jS.exec(e))?(MS(t[1])<<24|MS(t[2])<<16|MS(t[3])<<8|FS(t[4]))>>>0:(t=ES.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=TS.exec(e))?parseInt(t[1],16)>>>0:(t=PS.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=CS.exec(e))?(255|AS(NS(t[1]),VS(t[2]),VS(t[3])))>>>0:(t=kS.exec(e))?(AS(NS(t[1]),VS(t[2]),VS(t[3]))|FS(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var BS=(e,t,s)=>{if(J_.fun(e))return e;if(J_.arr(e))return BS({range:e,output:t,extrapolate:s});if(J_.str(e.output[0]))return nS(e);let n=e,i=n.output,r=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",a=n.extrapolateRight||n.extrapolate||"extend",l=n.easing||(e=>e);return e=>{let t=function(e,t){for(var s=1;s=e);++s);return s-1}(e,r);return function(e,t,s,n,i,r,o,a,l){let c=l?l(e):e;if(cs){if("identity"===a)return c;"clamp"===a&&(c=s)}return n===i?n:t===s?e<=t?n:i:(t===-1/0?c=-c:s===1/0?c-=t:c=(c-t)/(s-t),c=r(c),n===-1/0?c=-c:i===1/0?c+=n:c=c*(i-n)+n,c)}(e,r[t],r[t+1],i[t],i[t+1],l,o,a,n.map)}};var DS=1.70158,LS=1.525*DS,zS=DS+1,GS=2*Math.PI/3,HS=2*Math.PI/4.5,US=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,WS={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>zS*e*e*e-DS*e*e,easeOutBack:e=>1+zS*Math.pow(e-1,3)+DS*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(LS+1)*e-LS)/2:(Math.pow(2*e-2,2)*((LS+1)*(2*e-2)+LS)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*GS),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*GS)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*HS)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*HS)/2+1,easeInBounce:e=>1-US(1-e),easeOutBounce:US,easeInOutBounce:e=>e<.5?(1-US(1-2*e))/2:(1+US(2*e-1))/2,steps:(e,t="end")=>s=>{let n=(s="end"===t?Math.min(s,.999):Math.max(s,.001))*e;return((e,t,s)=>Math.min(Math.max(s,e),t))(0,1,("end"===t?Math.floor(n):Math.ceil(n))/e)}},qS=Symbol.for("FluidValue.get"),ZS=Symbol.for("FluidValue.observers"),KS=e=>Boolean(e&&e[qS]),YS=e=>e&&e[qS]?e[qS]():e,XS=e=>e[ZS]||null;function JS(e,t){let s=e[ZS];s&&s.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var QS=class{[qS];[ZS];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");$S(this,e)}},$S=(e,t)=>nj(e,qS,t);function ej(e,t){if(e[qS]){let s=e[ZS];s||nj(e,ZS,s=new Set),s.has(t)||(s.add(t),e.observerAdded&&e.observerAdded(s.size,t))}return t}function tj(e,t){let s=e[ZS];if(s&&s.has(t)){let n=s.size-1;n?s.delete(t):e[ZS]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var sj,nj=(e,t,s)=>Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0}),ij=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rj=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,oj=new RegExp(`(${ij.source})(%|[a-z]+)`,"i"),aj=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,lj=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,cj=e=>{let[t,s]=uj(e);if(!t||oS())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(s&&s.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(s)||e}return s&&lj.test(s)?cj(s):s||e},uj=e=>{let t=lj.exec(e);if(!t)return[,];let[,s,n]=t;return[s,n]},dj=(e,t,s,n,i)=>`rgba(${Math.round(t)}, ${Math.round(s)}, ${Math.round(n)}, ${i})`,hj=e=>{sj||(sj=aS?new RegExp(`(${Object.keys(aS).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>YS(e).replace(lj,cj).replace(rj,RS).replace(sj,RS))),s=t.map((e=>e.match(ij).map(Number))),n=s[0].map(((e,t)=>s.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>BS({...e,output:t})));return e=>{let s=!oj.test(t[0])&&t.find((e=>oj.test(e)))?.replace(ij,""),i=0;return t[0].replace(ij,(()=>`${n[i++](e)}${s||""}`)).replace(aj,dj)}},pj="react-spring: ",fj=e=>{let t=e,s=!1;if("function"!=typeof t)throw new TypeError(`${pj}once requires a function parameter`);return(...e)=>{s||(t(...e),s=!0)}},mj=fj(console.warn);fj(console.warn);function gj(e){return J_.str(e)&&("#"==e[0]||/\d/.test(e)||!oS()&&lj.test(e)||e in(aS||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var vj=oS()?Ef.useEffect:Ef.useLayoutEffect;function yj(){let e=(0,Ef.useState)()[1],t=(()=>{let e=(0,Ef.useRef)(!1);return vj((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var xj=[];var bj=Symbol.for("Animated:node"),wj=e=>e&&e[bj],_j=(e,t)=>((e,t,s)=>Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0}))(e,bj,t),Sj=e=>e&&e[bj]&&e[bj].getPayload(),jj=class{payload;constructor(){_j(this,this)}getPayload(){return this.payload||[]}},Cj=class extends jj{constructor(e){super(),this._value=e,J_.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new Cj(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return J_.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,J_.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},kj=class extends Cj{_string=null;_toString;constructor(e){super(0),this._toString=BS({output:[e,e]})}static create(e){return new kj(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(J_.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=BS({output:[this.getValue(),e]})),this._value=0,super.reset()}},Ej={dependencies:null},Pj=class extends jj{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return eS(this.source,((s,n)=>{(e=>!!e&&e[bj]===e)(s)?t[n]=s.getValue(e):KS(s)?t[n]=YS(s):e||(t[n]=s)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&$_(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return eS(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ej.dependencies&&KS(e)&&Ej.dependencies.add(e);let t=Sj(e);t&&$_(t,(e=>this.add(e)))}},Ij=class extends Pj{constructor(e){super(e)}static create(e){return new Ij(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,s)=>t.setValue(e[s]))).some(Boolean):(super.setValue(e.map(Tj)),!0)}};function Tj(e){return(gj(e)?kj:Cj).create(e)}function Oj(e){let t=wj(e);return t?t.constructor:J_.arr(e)?Ij:gj(e)?kj:Cj}var Aj=(e,t)=>{let s=!J_.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Ef.forwardRef)(((n,i)=>{let r=(0,Ef.useRef)(null),o=s&&(0,Ef.useCallback)((e=>{r.current=function(e,t){return e&&(J_.fun(e)?e(t):e.current=t),t}(i,e)}),[i]),[a,l]=function(e,t){let s=new Set;return Ej.dependencies=s,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Pj(e),Ej.dependencies=null,[e,s]}(n,t),c=yj(),u=()=>{let e=r.current;s&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&c()},d=new Mj(u,l),h=(0,Ef.useRef)();vj((()=>(h.current=d,$_(l,(e=>ej(e,d))),()=>{h.current&&($_(h.current.deps,(e=>tj(e,h.current))),O_.cancel(h.current.update))}))),(0,Ef.useEffect)(u,[]),(e=>{(0,Ef.useEffect)(e,xj)})((()=>()=>{let e=h.current;$_(e.deps,(t=>tj(t,e)))}));let p=t.getComponentProps(a.getValue());return Ef.createElement(e,{...p,ref:o})}))},Mj=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&O_.write(this.update)}};var Nj=Symbol.for("AnimatedComponent"),Fj=e=>J_.str(e)?e:e&&J_.str(e.displayName)?e.displayName:J_.fun(e)&&e.name||null;function Vj(e,...t){return J_.fun(e)?e(...t):e}var Rj=(e,t)=>!0===e||!!(t&&e&&(J_.fun(e)?e(t):tS(e).includes(t))),Bj=(e,t)=>J_.obj(e)?t&&e[t]:e,Dj=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Lj=e=>e,zj=(e,t=Lj)=>{let s=Gj;e.default&&!0!==e.default&&(e=e.default,s=Object.keys(e));let n={};for(let i of s){let s=t(e[i],i);J_.und(s)||(n[i]=s)}return n},Gj=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Hj={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Uj(e){let t=function(e){let t={},s=0;if(eS(e,((e,n)=>{Hj[n]||(t[n]=e,s++)})),s)return t}(e);if(t){let s={to:t};return eS(e,((e,n)=>n in t||(s[n]=e))),s}return{...e}}function Wj(e){return e=YS(e),J_.arr(e)?e.map(Wj):gj(e)?Y_.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function qj(e){return J_.fun(e)||J_.arr(e)&&J_.obj(e[0])}var Zj={tension:170,friction:26,mass:1,damping:1,easing:WS.linear,clamp:!1},Kj=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Zj)}};function Yj(e,t){if(J_.und(t.decay)){let s=!J_.und(t.tension)||!J_.und(t.friction);(s||!J_.und(t.frequency)||!J_.und(t.damping)||!J_.und(t.mass))&&(e.duration=void 0,e.decay=void 0),s&&(e.frequency=void 0)}else e.duration=void 0}var Xj=[],Jj=class{changed=!1;values=Xj;toValues=null;fromValues=Xj;to;from;config=new Kj;immediate=!1};function Qj(e,{key:t,props:s,defaultProps:n,state:i,actions:r}){return new Promise(((o,a)=>{let l,c,u=Rj(s.cancel??n?.cancel,t);if(u)p();else{J_.und(s.pause)||(i.paused=Rj(s.pause,t));let e=n?.pause;!0!==e&&(e=i.paused||Rj(e,t)),l=Vj(s.delay||0,t),e?(i.resumeQueue.add(h),r.pause()):(r.resume(),h())}function d(){i.resumeQueue.add(h),i.timeouts.delete(c),c.cancel(),l=c.time-O_.now()}function h(){l>0&&!Y_.skipAnimation?(i.delayed=!0,c=O_.setTimeout(p,l),i.pauseQueue.add(d),i.timeouts.add(c)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(c),e<=(i.cancelId||0)&&(u=!0);try{r.start({...s,callId:e,cancel:u},o)}catch(e){a(e)}}}))}var $j=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?sC(e.get()):t.every((e=>e.noop))?eC(e.get()):tC(e.get(),t.every((e=>e.finished))),eC=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),tC=(e,t,s=!1)=>({value:e,finished:t,cancelled:s}),sC=e=>({value:e,cancelled:!0,finished:!1});function nC(e,t,s,n){let{callId:i,parentId:r,onRest:o}=t,{asyncTo:a,promise:l}=s;return r||e!==a||t.reset?s.promise=(async()=>{s.asyncId=i,s.asyncTo=e;let c,u,d,h=zj(t,((e,t)=>"onRest"===t?void 0:e)),p=new Promise(((e,t)=>(c=e,u=t))),f=e=>{let t=i<=(s.cancelId||0)&&sC(n)||i!==s.asyncId&&tC(n,!1);if(t)throw e.result=t,u(e),e},m=(e,t)=>{let r=new rC,o=new oC;return(async()=>{if(Y_.skipAnimation)throw iC(s),o.result=tC(n,!1),u(o),o;f(r);let a=J_.obj(e)?{...e}:{...t,to:e};a.parentId=i,eS(h,((e,t)=>{J_.und(a[t])&&(a[t]=e)}));let l=await n.start(a);return f(r),s.paused&&await new Promise((e=>{s.resumeQueue.add(e)})),l})()};if(Y_.skipAnimation)return iC(s),tC(n,!1);try{let t;t=J_.arr(e)?(async e=>{for(let t of e)await m(t)})(e):Promise.resolve(e(m,n.stop.bind(n))),await Promise.all([t.then(c),p]),d=tC(n.get(),!0,!1)}catch(e){if(e instanceof rC)d=e.result;else{if(!(e instanceof oC))throw e;d=e.result}}finally{i==s.asyncId&&(s.asyncId=r,s.asyncTo=r?a:void 0,s.promise=r?l:void 0)}return J_.fun(o)&&O_.batchedUpdates((()=>{o(d,n,n.item)})),d})():l}function iC(e,t){sS(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var rC=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},oC=class extends Error{result;constructor(){super("SkipAnimationSignal")}},aC=e=>e instanceof cC,lC=1,cC=class extends QS{id=lC++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=wj(this);return e&&e.getValue()}to(...e){return Y_.to(this,e)}interpolate(...e){return mj(`${pj}The "interpolate" function is deprecated in v9 (use "to" instead)`),Y_.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){JS(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||mS.sort(this),JS(this,{type:"priority",parent:this,priority:e})}},uC=Symbol.for("SpringPhase"),dC=e=>(1&e[uC])>0,hC=e=>(2&e[uC])>0,pC=e=>(4&e[uC])>0,fC=(e,t)=>t?e[uC]|=3:e[uC]&=-3,mC=(e,t)=>t?e[uC]|=4:e[uC]&=-5,gC=class extends cC{key;animation=new Jj;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!J_.und(e)||!J_.und(t)){let s=J_.obj(e)?{...e}:{...t,from:e};J_.und(s.default)&&(s.default=!0),this.start(s)}}get idle(){return!(hC(this)||this._state.asyncTo)||pC(this)}get goal(){return YS(this.animation.to)}get velocity(){let e=wj(this);return e instanceof Cj?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return dC(this)}get isAnimating(){return hC(this)}get isPaused(){return pC(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,s=!1,n=this.animation,{config:i,toValues:r}=n,o=Sj(n.to);!o&&KS(n.to)&&(r=tS(YS(n.to))),n.values.forEach(((a,l)=>{if(a.done)return;let c=a.constructor==kj?1:o?o[l].lastPosition:r[l],u=n.immediate,d=c;if(!u){if(d=a.lastPosition,i.tension<=0)return void(a.done=!0);let t,s=a.elapsedTime+=e,r=n.fromValues[l],o=null!=a.v0?a.v0:a.v0=J_.arr(i.velocity)?i.velocity[l]:i.velocity,h=i.precision||(r==c?.005:Math.min(1,.001*Math.abs(c-r)));if(J_.und(i.duration))if(i.decay){let e=!0===i.decay?.998:i.decay,n=Math.exp(-(1-e)*s);d=r+o/(1-e)*(1-n),u=Math.abs(a.lastPosition-d)<=h,t=o*n}else{t=null==a.lastVelocity?o:a.lastVelocity;let s,n=i.restVelocity||h/10,l=i.clamp?0:i.bounce,p=!J_.und(l),f=r==c?a.v0>0:rn,s||(u=Math.abs(c-d)<=h,!u));++e){p&&(m=d==c||d>c==f,m&&(t=-t*l,d=c)),t+=(1e-6*-i.tension*(d-c)+.001*-i.friction*t)/i.mass*g,d+=t*g}}else{let n=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,a.durationProgress>0&&(a.elapsedTime=i.duration*a.durationProgress,s=a.elapsedTime+=e)),n=(i.progress||0)+s/this._memoizedDuration,n=n>1?1:n<0?0:n,a.durationProgress=n),d=r+i.easing(n)*(c-r),t=(d-a.lastPosition)/e,u=1==n}a.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}o&&!o[l].done&&(u=!1),u?a.done=!0:t=!1,a.setValue(d,i.round)&&(s=!0)}));let a=wj(this),l=a.getValue();if(t){let e=YS(n.to);l===e&&!s||i.decay?s&&i.decay&&this._onChange(l):(a.setValue(e),this._onChange(e)),this._stop()}else s&&this._onChange(l)}set(e){return O_.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(hC(this)){let{to:e,config:t}=this.animation;O_.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let s;return J_.und(e)?(s=this.queue||[],this.queue=[]):s=[J_.obj(e)?e:{...t,to:e}],Promise.all(s.map((e=>this._update(e)))).then((e=>$j(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),iC(this._state,e&&this._lastCallId),O_.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:s,from:n}=e;s=J_.obj(s)?s[t]:s,(null==s||qj(s))&&(s=void 0),n=J_.obj(n)?n[t]:n,null==n&&(n=void 0);let i={to:s,from:n};return dC(this)||(e.reverse&&([s,n]=[n,s]),n=YS(n),J_.und(n)?wj(this)||this._set(s):this._set(n)),i}_update({...e},t){let{key:s,defaultProps:n}=this;e.default&&Object.assign(n,zj(e,((e,t)=>/^on/.test(t)?Bj(e,s):e))),_C(this,e,"onProps"),SC(this,"onProps",e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let r=this._state;return Qj(++this._lastCallId,{key:s,props:e,defaultProps:n,state:r,actions:{pause:()=>{pC(this)||(mC(this,!0),rS(r.pauseQueue),SC(this,"onPause",tC(this,vC(this,this.animation.to)),this))},resume:()=>{pC(this)&&(mC(this,!1),hC(this)&&this._resume(),rS(r.resumeQueue),SC(this,"onResume",tC(this,vC(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((s=>{if(e.loop&&s.finished&&(!t||!s.noop)){let t=yC(e);if(t)return this._update(t,!0)}return s}))}_merge(e,t,s){if(t.cancel)return this.stop(!0),s(sC(this));let n=!J_.und(e.to),i=!J_.und(e.from);if(n||i){if(!(t.callId>this._lastToId))return s(sC(this));this._lastToId=t.callId}let{key:r,defaultProps:o,animation:a}=this,{to:l,from:c}=a,{to:u=l,from:d=c}=e;i&&!n&&(!t.default||J_.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let h=!Q_(d,c);h&&(a.from=d),d=YS(d);let p=!Q_(u,l);p&&this._focus(u);let f=qj(t.to),{config:m}=a,{decay:g,velocity:v}=m;(n||i)&&(m.velocity=0),t.config&&!f&&function(e,t,s){s&&(Yj(s={...s},t),t={...s,...t}),Yj(e,t),Object.assign(e,t);for(let t in Zj)null==e[t]&&(e[t]=Zj[t]);let{mass:n,frequency:i,damping:r}=e;J_.und(i)||(i<.01&&(i=.01),r<0&&(r=0),e.tension=Math.pow(2*Math.PI/i,2)*n,e.friction=4*Math.PI*r*n/i)}(m,Vj(t.config,r),t.config!==o.config?Vj(o.config,r):void 0);let y=wj(this);if(!y||J_.und(u))return s(tC(this,!0));let x=J_.und(t.reset)?i&&!t.default:!J_.und(d)&&Rj(t.reset,r),b=x?d:this.get(),w=Wj(u),_=J_.num(w)||J_.arr(w)||gj(w),S=!f&&(!_||Rj(o.immediate||t.immediate,r));if(p){let e=Oj(u);if(e!==y.constructor){if(!S)throw Error(`Cannot animate between ${y.constructor.name} and ${e.name}, as the "to" prop suggests`);y=this._set(w)}}let j=y.constructor,C=KS(u),k=!1;if(!C){let e=x||!dC(this)&&h;(p||e)&&(k=Q_(Wj(b),w),C=!k),(!Q_(a.immediate,S)&&!S||!Q_(m.decay,g)||!Q_(m.velocity,v))&&(C=!0)}if(k&&hC(this)&&(a.changed&&!x?C=!0:C||this._stop(l)),!f&&((C||KS(l))&&(a.values=y.getPayload(),a.toValues=KS(u)?null:j==kj?[1]:tS(w)),a.immediate!=S&&(a.immediate=S,!S&&!x&&this._set(l)),C)){let{onRest:e}=a;$_(wC,(e=>_C(this,t,e)));let n=tC(this,vC(this,l));rS(this._pendingCalls,n),this._pendingCalls.add(s),a.changed&&O_.batchedUpdates((()=>{a.changed=!x,e?.(n,this),x?Vj(o.onRest,n):a.onStart?.(n,this)}))}x&&this._set(b),f?s(nC(t.to,t,this._state,this)):C?this._start():hC(this)&&!p?this._pendingCalls.add(s):s(eC(b))}_focus(e){let t=this.animation;e!==t.to&&(XS(this)&&this._detach(),t.to=e,XS(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;KS(t)&&(ej(t,this),aC(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;KS(e)&&tj(e,this)}_set(e,t=!0){let s=YS(e);if(!J_.und(s)){let e=wj(this);if(!e||!Q_(s,e.getValue())){let n=Oj(s);e&&e.constructor==n?e.setValue(s):_j(this,n.create(s)),e&&O_.batchedUpdates((()=>{this._onChange(s,t)}))}}return wj(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,SC(this,"onStart",tC(this,vC(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Vj(this.animation.onChange,e,this)),Vj(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;wj(this).reset(YS(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),hC(this)||(fC(this,!0),pC(this)||this._resume())}_resume(){Y_.skipAnimation?this.finish():mS.start(this)}_stop(e,t){if(hC(this)){fC(this,!1);let s=this.animation;$_(s.values,(e=>{e.done=!0})),s.toValues&&(s.onChange=s.onPause=s.onResume=void 0),JS(this,{type:"idle",parent:this});let n=t?sC(this.get()):tC(this.get(),vC(this,e??s.to));rS(this._pendingCalls,n),s.changed&&(s.changed=!1,SC(this,"onRest",n,this))}}};function vC(e,t){let s=Wj(t);return Q_(Wj(e.get()),s)}function yC(e,t=e.loop,s=e.to){let n=Vj(t);if(n){let i=!0!==n&&Uj(n),r=(i||e).reverse,o=!i||i.reset;return xC({...e,loop:t,default:!1,pause:void 0,to:!r||qj(s)?s:void 0,from:o?e.from:void 0,reset:o,...i})}}function xC(e){let{to:t,from:s}=e=Uj(e),n=new Set;return J_.obj(t)&&bC(t,n),J_.obj(s)&&bC(s,n),e.keys=n.size?Array.from(n):null,e}function bC(e,t){eS(e,((e,s)=>null!=e&&t.add(s)))}var wC=["onStart","onRest","onChange","onPause","onResume"];function _C(e,t,s){e.animation[s]=t[s]!==Dj(t,s)?Bj(t[s],e.key):void 0}function SC(e,t,...s){e.animation[t]?.(...s),e.defaultProps[t]?.(...s)}var jC=["onStart","onChange","onRest"],CC=1,kC=class{id=CC++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,s)=>e[s]=t.get())),e}set(e){for(let t in e){let s=e[t];J_.und(s)||this.springs[t].set(s)}}update(e){return e&&this.queue.push(xC(e)),this}start(e){let{queue:t}=this;return e?t=tS(e).map(xC):this.queue=[],this._flush?this._flush(this,t):(OC(this,t),EC(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let s=this.springs;$_(tS(t),(t=>s[t].stop(!!e)))}else iC(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(J_.und(e))this.start({pause:!0});else{let t=this.springs;$_(tS(e),(e=>t[e].pause()))}return this}resume(e){if(J_.und(e))this.start({pause:!1});else{let t=this.springs;$_(tS(e),(e=>t[e].resume()))}return this}each(e){eS(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:s}=this._events,n=this._active.size>0,i=this._changed.size>0;(n&&!this._started||i&&!this._started)&&(this._started=!0,sS(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let r=!n&&this._started,o=i||r&&s.size?this.get():null;i&&t.size&&sS(t,(([e,t])=>{t.value=o,e(t,this,this._item)})),r&&(this._started=!1,sS(s,(([e,t])=>{t.value=o,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}O_.onFrame(this._onFrame)}};function EC(e,t){return Promise.all(t.map((t=>PC(e,t)))).then((t=>$j(e,t)))}async function PC(e,t,s){let{keys:n,to:i,from:r,loop:o,onRest:a,onResolve:l}=t,c=J_.obj(t.default)&&t.default;o&&(t.loop=!1),!1===i&&(t.to=null),!1===r&&(t.from=null);let u=J_.arr(i)||J_.fun(i)?i:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):$_(jC,(s=>{let n=t[s];if(J_.fun(n)){let i=e._events[s];t[s]=({finished:e,cancelled:t})=>{let s=i.get(n);s?(e||(s.finished=!1),t&&(s.cancelled=!0)):i.set(n,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[s]=t[s])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,rS(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let h=(n||Object.keys(e.springs)).map((s=>e.springs[s].start(t))),p=!0===t.cancel||!0===Dj(t,"cancel");(u||p&&d.asyncId)&&h.push(Qj(++e._lastAsyncId,{props:t,state:d,actions:{pause:X_,resume:X_,start(t,s){p?(iC(d,e._lastAsyncId),s(sC(e))):(t.onRest=a,s(nC(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let f=$j(e,await Promise.all(h));if(o&&f.finished&&(!s||!f.noop)){let s=yC(t,o,i);if(s)return OC(e,[s]),PC(e,s,!0)}return l&&O_.batchedUpdates((()=>l(f,e,e.item))),f}function IC(e,t){let s=new gC;return s.key=e,t&&ej(s,t),s}function TC(e,t,s){t.keys&&$_(t.keys,(n=>{(e[n]||(e[n]=s(n)))._prepareNode(t)}))}function OC(e,t){$_(t,(t=>{TC(e.springs,t,(t=>IC(t,e)))}))}var AC=({children:e,...t})=>{let s=(0,Ef.useContext)(MC),n=t.pause||!!s.pause,i=t.immediate||!!s.immediate;t=function(e,t){let[s]=(0,Ef.useState)((()=>({inputs:t,result:e()}))),n=(0,Ef.useRef)(),i=n.current,r=i;return r?Boolean(t&&r.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let s=0;s{n.current=r,i==s&&(s.inputs=s.result=void 0)}),[r]),r.result}((()=>({pause:n,immediate:i})),[n,i]);let{Provider:r}=MC;return Ef.createElement(r,{value:t},e)},MC=function(e,t){return Object.assign(e,Ef.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(AC,{});AC.Provider=MC.Provider,AC.Consumer=MC.Consumer;var NC=class extends cC{constructor(e,t){super(),this.source=e,this.calc=BS(...t);let s=this._get(),n=Oj(s);_j(this,n.create(s))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();Q_(t,this.get())||(wj(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&VC(this._active)&&RC(this)}_get(){let e=J_.arr(this.source)?this.source.map(YS):tS(YS(this.source));return this.calc(...e)}_start(){this.idle&&!VC(this._active)&&(this.idle=!1,$_(Sj(this),(e=>{e.done=!1})),Y_.skipAnimation?(O_.batchedUpdates((()=>this.advance())),RC(this)):mS.start(this))}_attach(){let e=1;$_(tS(this.source),(t=>{KS(t)&&ej(t,this),aC(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){$_(tS(this.source),(e=>{KS(e)&&tj(e,this)})),this._active.clear(),RC(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=tS(this.source).reduce(((e,t)=>Math.max(e,(aC(t)?t.priority:0)+1)),0))}};function FC(e){return!1!==e.idle}function VC(e){return!e.size||Array.from(e).every(FC)}function RC(e){e.idle||(e.idle=!0,$_(Sj(e),(e=>{e.done=!0})),JS(e,{type:"idle",parent:e}))}Y_.assign({createStringInterpolator:hj,to:(e,t)=>new NC(e,t)});mS.advance;var BC=/^--/;function DC(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||BC.test(e)||zC.hasOwnProperty(e)&&zC[e]?(""+t).trim():t+"px"}var LC={};var zC={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GC=["Webkit","Ms","Moz","O"];zC=Object.keys(zC).reduce(((e,t)=>(GC.forEach((s=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(s,t)]=e[t])),e)),zC);var HC=/^(matrix|translate|scale|rotate|skew)/,UC=/^(translate)/,WC=/^(rotate|skew)/,qC=(e,t)=>J_.num(e)&&0!==e?e+t:e,ZC=(e,t)=>J_.arr(e)?e.every((e=>ZC(e,t))):J_.num(e)?e===t:parseFloat(e)===t,KC=class extends Pj{constructor({x:e,y:t,z:s,...n}){let i=[],r=[];(e||t||s)&&(i.push([e||0,t||0,s||0]),r.push((e=>[`translate3d(${e.map((e=>qC(e,"px"))).join(",")})`,ZC(e,0)]))),eS(n,((e,t)=>{if("transform"===t)i.push([e||""]),r.push((e=>[e,""===e]));else if(HC.test(t)){if(delete n[t],J_.und(e))return;let s=UC.test(t)?"px":WC.test(t)?"deg":"";i.push(tS(e)),r.push("rotate3d"===t?([e,t,n,i])=>[`rotate3d(${e},${t},${n},${qC(i,s)})`,ZC(i,0)]:e=>[`${t}(${e.map((e=>qC(e,s))).join(",")})`,ZC(e,t.startsWith("scale")?1:0)])}})),i.length&&(n.transform=new YC(i,r)),super(n)}},YC=class extends QS{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return $_(this.inputs,((s,n)=>{let i=YS(s[0]),[r,o]=this.transforms[n](J_.arr(i)?i:s.map(YS));e+=" "+r,t=t&&o})),t?"none":e}observerAdded(e){1==e&&$_(this.inputs,(e=>$_(e,(e=>KS(e)&&ej(e,this)))))}observerRemoved(e){0==e&&$_(this.inputs,(e=>$_(e,(e=>KS(e)&&tj(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),JS(this,e)}};Y_.assign({batchedUpdates:wv.unstable_batchedUpdates,createStringInterpolator:hj,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var XC=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:s=(e=>new Pj(e)),getComponentProps:n=(e=>e)}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:s,getComponentProps:n},r=e=>{let t=Fj(e)||"Anonymous";return(e=J_.str(e)?r[e]||(r[e]=Aj(e,i)):e[Nj]||(e[Nj]=Aj(e,i))).displayName=`Animated(${t})`,e};return eS(e,((t,s)=>{J_.arr(e)&&(s=Fj(t)),r[s]=r(t)})),{animated:r}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let s="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:n,children:i,scrollTop:r,scrollLeft:o,viewBox:a,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>s||e.hasAttribute(t)?t:LC[t]||(LC[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==i&&(e.textContent=i);for(let t in n)if(n.hasOwnProperty(t)){let s=DC(t,n[t]);BC.test(t)?e.style.setProperty(t,s):e.style[t]=s}u.forEach(((t,s)=>{e.setAttribute(t,c[s])})),void 0!==r&&(e.scrollTop=r),void 0!==o&&(e.scrollLeft=o),void 0!==a&&e.setAttribute("viewBox",a)},createAnimatedStyle:e=>new KC(e),getComponentProps:({scrollTop:e,scrollLeft:t,...s})=>s});XC.animated;const JC=function({triggerAnimationOnChange:e}){const t=(0,d.useRef)(),{previous:s,prevRect:n}=(0,d.useMemo)((()=>{return{previous:t.current&&(e=t.current,{top:e.offsetTop,left:e.offsetLeft}),prevRect:t.current&&t.current.getBoundingClientRect()};var e}),[e]);return(0,d.useLayoutEffect)((()=>{if(!s||!t.current)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=new kC({x:0,y:0,width:n.width,height:n.height,config:{duration:400,easing:WS.easeInOutQuint},onChange({value:e}){if(!t.current)return;let{x:s,y:n,width:i,height:r}=e;s=Math.round(s),n=Math.round(n),i=Math.round(i),r=Math.round(r);const o=0===s&&0===n;t.current.style.transformOrigin="center center",t.current.style.transform=o?null:`translate3d(${s}px,${n}px,0)`,t.current.style.width=o?null:`${i}px`,t.current.style.height=o?null:`${r}px`}});t.current.style.transform=void 0;const i=t.current.getBoundingClientRect(),r=Math.round(n.left-i.left),o=Math.round(n.top-i.top),a=i.width,l=i.height;return e.start({x:0,y:0,width:a,height:l,from:{x:r,y:o,width:n.width,height:n.height}}),()=>{e.stop(),e.set({x:0,y:0,width:n.width,height:n.height})}}),[s,n]),t};function QC(){const{isDisabled:e,isSaving:t}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:s}=e(_.store),n=t(),i=n.some((e=>s(e.kind,e.name,e.key)));return{isSaving:i,isDisabled:i||!n.length&&!tn()}}),[]);return(0,me.jsx)(x.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4,children:(0,me.jsx)(wh,{className:"edit-site-save-hub__button",variant:e?null:"primary",showTooltip:!1,icon:e&&!t?Zv:null,showReviewMessage:!0,__next40pxDefaultSize:!0})})}const{useCommands:$C}=se(ts.privateApis),{useCommandContext:ek}=se(es.privateApis),{useGlobalStyle:tk}=se(y.privateApis),{NavigableRegion:sk}=se(h.privateApis),nk=.3;function ik(){ls(),function(){const e=Ms(),{params:t}=As(),s=(0,l.useSelect)((e=>se(e(Kt)).getCanvasMode()),[]),{setCanvasMode:n}=se((0,l.useDispatch)(Kt)),i=(0,d.useRef)(s),{canvas:r}=t,o=(0,d.useRef)(r),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{a.current=t}),[t]),(0,d.useEffect)((()=>{i.current=s,"init"!==s&&("edit"===s&&o.current!==s&&e.push({...a.current,canvas:"edit"}),"view"===s&&void 0!==o.current&&e.push({...a.current,canvas:void 0}))}),[s,e]),(0,d.useEffect)((()=>{o.current=r,"edit"!==r&&"view"!==i.current?n("view"):"edit"===r&&"edit"!==i.current&&n("edit")}),[r,n])}(),$C(),(0,es.useCommandLoader)({name:"core/edit-site/page-content-focus",hook:ln,context:"entity-edit"}),(0,es.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:cn}),function(){const e=(0,l.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return t()?.home}),[]);(0,es.useCommand)({name:"core/edit-site/view-site",label:(0,b.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:Gs}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles",hook:qs}),(0,es.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:Zs}),(0,es.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Ks}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:Ys}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:Xs})}();const e=(0,v.useViewportMatch)("medium","<"),t=(0,d.useRef)(),{isDistractionFree:s,hasFixedToolbar:n,hasBlockSelected:i,canvasMode:r,previousShortcut:o,nextShortcut:a}=(0,l.useSelect)((e=>{const{getAllShortcutKeyCombinations:t}=e($t.store),{getCanvasMode:s}=se(e(Kt));return{canvasMode:s(),previousShortcut:t("core/editor/previous-region"),nextShortcut:t("core/editor/next-region"),hasFixedToolbar:e(f.store).get("core","fixedToolbar"),isDistractionFree:e(f.store).get("core","distractionFree"),hasBlockSelected:e(y.store).getBlockSelectionStart()}}),[]),c=(0,x.__unstableUseNavigateRegions)({previous:o,next:a}),u=(0,v.useReducedMotion)(),[p,m]=(0,v.useResizeObserver)(),[g]=(0,v.useResizeObserver)(),w=dn(),[S,j]=(0,d.useState)(!1),{key:C,areas:k,widths:E}=I_(),P=JC({triggerAnimationOnChange:r+"__"+C});let I="site-editor";"edit"===r&&(I="entity-edit"),i&&(I="block-selection-edit"),ek(I);const[T]=tk("color.background"),[O]=tk("color.gradient"),A=(0,v.usePrevious)(r);return(0,d.useEffect)((()=>{"edit"===A&&t.current?.focus()}),[r]),"init"===r?null:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(es.CommandMenu,{}),(0,me.jsx)(Ns,{}),(0,me.jsx)(Fs,{}),g,(0,me.jsx)("div",{...c,ref:c.ref,className:Qt("edit-site-layout",c.className,{"is-distraction-free":s&&"edit"===r,"is-full-canvas":"edit"===r,"has-fixed-toolbar":n,"is-block-toolbar-visible":i}),children:(0,me.jsxs)("div",{className:"edit-site-layout__content",children:[(!e||!k.mobile)&&(0,me.jsx)(sk,{ariaLabel:(0,b.__)("Navigation"),className:"edit-site-layout__sidebar-region",children:(0,me.jsx)(x.__unstableAnimatePresence,{children:"view"===r&&(0,me.jsxs)(x.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:u||e?0:nk,ease:"easeOut"},className:"edit-site-layout__sidebar",children:[(0,me.jsx)(Ss,{ref:t,isTransparent:S}),(0,me.jsx)(bs,{routeKey:C,children:k.sidebar}),(0,me.jsx)(QC,{}),(0,me.jsx)(Eh,{})]})})}),(0,me.jsx)(h.EditorSnackbars,{}),e&&k.mobile&&(0,me.jsxs)("div",{className:"edit-site-layout__mobile",children:["edit"!==r&&(0,me.jsx)(bs,{routeKey:C,children:(0,me.jsx)(js,{ref:t,isTransparent:S})}),k.mobile]}),!e&&k.content&&"edit"!==r&&(0,me.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:E?.content},children:k.content}),!e&&k.preview&&(0,me.jsxs)("div",{className:"edit-site-layout__canvas-container",children:[p,!!m.width&&(0,me.jsx)("div",{className:Qt("edit-site-layout__canvas",{"is-right-aligned":S}),ref:P,children:(0,me.jsx)(is,{children:(0,me.jsx)(Os,{isReady:!w,isFullWidth:"edit"===r,defaultSize:{width:m.width-24,height:m.height},isOversized:S,setIsOversized:j,innerContentStyle:{background:null!=O?O:T},children:k.preview})})})]})]})})]})}const{RouterProvider:rk}=se(Xt.privateApis),{GlobalStylesProvider:ok}=se(h.privateApis);function ak(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,me.jsx)(x.SlotFillProvider,{children:(0,me.jsxs)(ok,{children:[(0,me.jsx)(h.UnsavedChangesWarning,{}),(0,me.jsxs)(rk,{children:[(0,me.jsx)(ik,{}),(0,me.jsx)(Yt.PluginArea,{onError:function(t){e((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),t))}})]})]})})}const lk=(0,ps.getPath)(window.location.href)?.includes("site-editor.php"),ck=e=>{u()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function uk(e){return lk?(ck("PluginMoreMenuItem"),(0,me.jsx)(h.PluginMoreMenuItem,{...e})):null}function dk(e){return lk?(ck("PluginSidebar"),(0,me.jsx)(h.PluginSidebar,{...e})):null}function hk(e){return lk?(ck("PluginSidebarMoreMenuItem"),(0,me.jsx)(h.PluginSidebarMoreMenuItem,{...e})):null}function pk(e,t){const s=document.getElementById(e),n=(0,d.createRoot)(s);(0,l.dispatch)(o.store).reapplyBlockTypeFilters();const i=(0,a.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,a.registerCoreBlocks)(i),(0,l.dispatch)(o.store).setFreeformFallbackBlockName("core/html"),(0,m.registerLegacyWidgetBlock)({inserter:!1}),(0,m.registerWidgetGroupBlock)({inserter:!1}),(0,l.dispatch)(f.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,l.dispatch)(f.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1}),(0,l.dispatch)(Kt).updateSettings(t),(0,l.dispatch)(h.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas}),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),n.render((0,me.jsx)(ak,{})),n}function fk(){u()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=r})(); \ No newline at end of file + */var s=n(1609);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=s.useState,o=s.useEffect,a=s.useLayoutEffect,l=s.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),i=s[0].inst,u=s[1];return a((function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})}),[e,n,t]),o((function(){return c(i)&&u({inst:i}),e((function(){c(i)&&u({inst:i})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==s.useSyncExternalStore?s.useSyncExternalStore:u},422:(e,t,n)=>{"use strict";e.exports=n(83)},1609:e=>{"use strict";e.exports=window.React},4660:e=>{e.exports=function(){function e(t,n,s){function i(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,s)}return n[o].exports}for(var r=void 0,o=0;o=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new s.Buf8(e.length),n=0,i=t.length;n4)c[s++]=65533,n+=r-1;else{for(i&=2===r?31:3===r?15:7;r>1&&n1?c[s++]=65533:i<65536?c[s++]=i:(i-=65536,c[s++]=55296|i>>10&1023,c[s++]=56320|1023&i)}return l(c,s)},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+o[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function s(e,t,n,s){for(var i=65535&e,r=e>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{r=r+(i=i+t[s++]|0)|0}while(--o);i%=65521,r%=65521}return i|r<<16}t.exports=s},{}],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 s(){for(var e,t=[],n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var i=s();function r(e,t,n,s){var r=i,o=s+n;e^=-1;for(var a=s;a>>8^r[255&(e^t[a])];return~e}t.exports=r},{}],6:[function(e,t,n){"use strict";function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=s},{}],7:[function(e,t,n){"use strict";var s=30,i=12;t.exports=function(e,t){var n,r,o,a,l,c,u,d,h,p,f,m,g,v,x,y,b,w,_,j,S,C,k,E,P;n=e.state,r=e.next_in,E=e.input,o=r+(e.avail_in-5),a=e.next_out,P=e.output,l=a-(t-e.avail_out),c=a+(e.avail_out-257),u=n.dmax,d=n.wsize,h=n.whave,p=n.wnext,f=n.window,m=n.hold,g=n.bits,v=n.lencode,x=n.distcode,y=(1<>>=_=w>>>24,g-=_,0==(_=w>>>16&255))P[a++]=65535&w;else{if(!(16&_)){if(64&_){if(32&_){n.mode=i;break e}e.msg="invalid literal/length code",n.mode=s;break e}w=v[(65535&w)+(m&(1<<_)-1)];continue t}for(j=65535&w,(_&=15)&&(g<_&&(m+=E[r++]<>>=_,g-=_),g<15&&(m+=E[r++]<>>=_=w>>>24,g-=_,16&(_=w>>>16&255)){if(S=65535&w,g<(_&=15)&&(m+=E[r++]<u){e.msg="invalid distance too far back",n.mode=s;break e}if(m>>>=_,g-=_,S>(_=a-l)){if((_=S-_)>h&&n.sane){e.msg="invalid distance too far back",n.mode=s;break e}if(C=0,k=f,0===p){if(C+=d-_,_2;)P[a++]=k[C++],P[a++]=k[C++],P[a++]=k[C++],j-=3;j&&(P[a++]=k[C++],j>1&&(P[a++]=k[C++]))}else{C=a-S;do{P[a++]=P[C++],P[a++]=P[C++],P[a++]=P[C++],j-=3}while(j>2);j&&(P[a++]=P[C++],j>1&&(P[a++]=P[C++]))}break}if(64&_){e.msg="invalid distance code",n.mode=s;break e}w=x[(65535&w)+(m&(1<<_)-1)]}}break}}while(r>3,m&=(1<<(g-=j<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function se(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(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=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32($),t.distcode=t.distdyn=new s.Buf32(ee),t.sane=1,t.back=-1,f):v}function re(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function oe(e,t){var n,s;return e&&e.state?(s=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,re(e))):v}function ae(e,t){var n,s;return e?(s=new se,e.state=s,s.window=null,(n=oe(e,t))!==f&&(e.state=null),n):v}function le(e){return ae(e,te)}var ce,ue,de=!0;function he(e){if(de){var t;for(ce=new s.Buf32(512),ue=new s.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(a(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(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,i){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(s.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),s.arraySet(o.window,t,n-i,r,o.wnext),(i-=r)?(s.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=r(n.check,ke,2,0),oe=0,ae=0,n.mode=j;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&oe)<<8)+(oe>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&oe)!==w){e.msg="unknown compression method",n.mode=J;break}if(ae-=4,we=8+(15&(oe>>>=4)),0===n.wbits)n.wbits=we;else if(we>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0,n.mode=S;case S:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,ke[2]=oe>>>16&255,ke[3]=oe>>>24&255,n.check=r(n.check,ke,4,0)),oe=0,ae=0,n.mode=C;case C:for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>8),512&n.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0,n.mode=k;case k:if(1024&n.flags){for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,n.check=r(n.check,ke,2,0)),oe=0,ae=0}else n.head&&(n.head.extra=null);n.mode=E;case E:if(1024&n.flags&&((ue=n.length)>ie&&(ue=ie),ue&&(n.head&&(we=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),s.arraySet(n.head.extra,$,te,ue,we)),512&n.flags&&(n.check=r(n.check,$,ue,te)),ie-=ue,te+=ue,n.length-=ue),n.length))break e;n.length=0,n.mode=P;case P:if(2048&n.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],n.head&&we&&n.length<65536&&(n.head.name+=String.fromCharCode(we))}while(we&&ue>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=N;break;case O:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>=7&ae,ae-=7&ae,n.mode=K;break}for(;ae<3;){if(0===ie)break e;ie--,oe+=$[te++]<>>=1)){case 0:n.mode=V;break;case 1:if(he(n),n.mode=z,t===p){oe>>>=2,ae-=2;break e}break;case 2:n.mode=B;break;case 3:e.msg="invalid block type",n.mode=J}oe>>>=2,ae-=2;break;case V:for(oe>>>=7&ae,ae-=7&ae;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&oe,oe=0,ae=0,n.mode=F,t===p)break e;case F:n.mode=R;case R:if(ue=n.length){if(ue>ie&&(ue=ie),ue>re&&(ue=re),0===ue)break e;s.arraySet(ee,$,te,ue,se),ie-=ue,te+=ue,re-=ue,se+=ue,n.length-=ue;break}n.mode=N;break;case B:for(;ae<14;){if(0===ie)break e;ie--,oe+=$[te++]<>>=5,ae-=5,n.ndist=1+(31&oe),oe>>>=5,ae-=5,n.ncode=4+(15&oe),oe>>>=4,ae-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=D;case D:for(;n.have>>=3,ae-=3}for(;n.have<19;)n.lens[Ee[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,je={bits:n.lenbits},_e=a(l,n.lens,0,19,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=L;case L:for(;n.have>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=me,ae-=me,n.lens[n.have++]=ve;else{if(16===ve){for(Se=me+2;ae>>=me,ae-=me,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}we=n.lens[n.have-1],ue=3+(3&oe),oe>>>=2,ae-=2}else if(17===ve){for(Se=me+3;ae>>=me)),oe>>>=3,ae-=3}else{for(Se=me+7;ae>>=me)),oe>>>=7,ae-=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++]=we}}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,je={bits:n.lenbits},_e=a(c,n.lens,0,n.nlen,n.lencode,0,n.work,je),n.lenbits=je.bits,_e){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,je={bits:n.distbits},_e=a(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,je),n.distbits=je.bits,_e){e.msg="invalid distances set",n.mode=J;break}if(n.mode=z,t===p)break e;case z:n.mode=G;case G:if(ie>=6&&re>=258){e.next_out=se,e.avail_out=re,e.next_in=te,e.avail_in=ie,n.hold=oe,n.bits=ae,o(e,ce),se=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,oe=n.hold,ae=n.bits,n.mode===N&&(n.back=-1);break}for(n.back=0;ge=(Ce=n.lencode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>xe)])>>>16&255,ve=65535&Ce,!(xe+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=xe,ae-=xe,n.back+=xe}if(oe>>>=me,ae-=me,n.back+=me,n.length=ve,0===ge){n.mode=Z;break}if(32&ge){n.back=-1,n.mode=N;break}if(64&ge){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&ge,n.mode=H;case H:if(n.extra){for(Se=n.extra;ae>>=n.extra,ae-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=U;case U:for(;ge=(Ce=n.distcode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>xe)])>>>16&255,ve=65535&Ce,!(xe+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=xe,ae-=xe,n.back+=xe}if(oe>>>=me,ae-=me,n.back+=me,64&ge){e.msg="invalid distance code",n.mode=J;break}n.offset=ve,n.extra=15&ge,n.mode=W;case W:if(n.extra){for(Se=n.extra;ae>>=n.extra,ae-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=q;case q:if(0===re)break e;if(ue=ce-re,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),fe=n.window}else fe=ee,de=se-n.offset,ue=n.length;ue>re&&(ue=re),re-=ue,n.length-=ue;do{ee[se++]=fe[de++]}while(--ue);0===n.length&&(n.mode=G);break;case Z:if(0===re)break e;ee[se++]=n.length,re--,n.mode=G;break;case K:if(n.wrap){for(;ae<32;){if(0===ie)break e;ie--,oe|=$[te++]<=1&&0===z[A];A--);if(N>A&&(N=A),0===A)return m[g++]=20971520,m[g++]=20971520,x.bits=1,0;for(O=1;O0&&(e===a||1!==A))return-1;for(G[1]=0,I=1;Ir||e===c&&R>o)return 1;for(;;){C=I-V,v[T]S?(k=H[U+v[T]],E=D[L+v[T]]):(k=96,E=0),y=1<>V)+(b-=y)]=C<<24|k<<16|E}while(0!==b);for(y=1<>=1;if(0!==y?(B&=y-1,B+=y):B=0,T++,0==--z[I]){if(I===A)break;I=t[n+v[T]]}if(I>N&&(B&_)!==w){for(0===V&&(V=N),j+=O,F=1<<(M=I-V);M+Vr||e===c&&R>o)return 1;m[w=B&_]=N<<24|M<<16|j-g}}return 0!==B&&(m[j+B]=I-V<<24|64<<16),x.bits=N,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 s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=s},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var s=e("./zlib/inflate"),i=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=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=i.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&&(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=s.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new c,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=s.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function p(e,t){return(t=t||{}).raw=!0,h(e,t)}d.prototype.push=function(e,t){var n,a,l,c,d,h=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(n=s.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=s.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&n!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(h.output,h.next_out),c=h.next_out-l,d=r.buf2string(h.output,l),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,l,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=p,n.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},8572:e=>{e.exports=function(){function e(t,n,s){function i(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,s)}return n[o].exports}for(var r=void 0,o=0;o0},a.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,s);if(t<0)throw new Error("Unexpected end of input");if(t=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&r]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},a.prototype.readBits=function(e){32-this.bit_pos_>>this.bit_pos_&o[e];return this.bit_pos_+=e,t},t.exports=a},{}],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 s=e("./streams").BrotliInput,i=e("./streams").BrotliOutput,r=e("./bit_reader"),o=e("./dictionary"),a=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),h=8,p=16,f=256,m=704,g=26,v=6,x=2,y=8,b=255,w=1080,_=18,j=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]),E=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===r)throw new Error("Invalid size byte");i.meta_block_length|=r<<8*s}}else for(s=0;s4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*s}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function A(e,t,n){var s;return n.fillBitWindow(),(s=e[t+=n.val_>>>n.bit_pos_&b].bits-y)>0&&(n.bit_pos_+=y,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<0;){var m,g=0;if(s.readMoreInput(),s.fillBitWindow(),g+=s.val_>>>s.bit_pos_&31,s.bit_pos_+=d[g].bits,(m=255&d[g].value)>m);else{var v,x,y=m-14,b=0;if(m===p&&(b=r),c!==b&&(o=0,c=b),v=o,o>0&&(o-=2,o<<=y),i+(x=(o+=s.readBits(y)+3)-v)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var w=0;w0;++p){var x,b=j[p],w=0;s.fillBitWindow(),w+=s.val_>>>s.bit_pos_&15,s.bit_pos_+=v[w].bits,x=v[w].value,f[b]=x,0!==x&&(m-=32>>x,++g)}if(1!==g&&0!==m)throw new Error("[ReadHuffmanCode] invalid num_codes or space");N(f,e,o,s)}if(0===(r=l(t,n,y,o,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return r}function V(e,t,n){var s,i;return s=A(e,t,n),i=u.kBlockLengthPrefixCode[s].nbits,u.kBlockLengthPrefixCode[s].offset+n.readBits(i)}function F(e,t,n){var s;return e>>5]),this.htrees=new Uint32Array(t)}function L(e,t){var n,s,i={num_htrees:null,context_map:null},r=0;t.readMoreInput();var o=i.num_htrees=I(t)+1,l=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(r=t.readBits(4)+1),n=[],s=0;s=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[s]=0,++s}else l[s]=c-r,++s}return t.readBits(1)&&B(l,e),i}function z(e,t,n,s,i,r,o){var a,l=2*n,c=n,u=A(t,n*w,o);(a=0===u?i[l+(1&r[c])]:1===u?i[l+(r[c]-1&1)]+1:u-2)>=e&&(a-=e),s[n]=a,i[l+(1&r[c])]=a,++r[c]}function G(e,t,n,s,i,o){var a,l=i+1,c=n&i,u=o.pos_&r.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),s[c++]=o.readBits(8),c===l&&(e.write(s,l),c=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)s[c]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++c,--t;if(u+(a=o.bit_end_pos_-o.bit_pos_>>3)>r.IBUF_MASK){for(var d=r.IBUF_MASK+1-u,h=0;h=l)for(e.write(s,l),c-=l,h=0;h=l;){if(a=l-c,o.input_.read(s,c,a)t.buffer.length){var xe=new Uint8Array(j+ne);xe.set(t.buffer),t.buffer=xe}if(C=ve.input_end,Z=ve.is_uncompressed,ve.is_metadata)for(H(_);ne>0;--ne)_.readMoreInput(),_.readBits(8);else if(0!==ne)if(Z)_.bit_pos_=_.bit_pos_+7&-8,G(t,ne,j,h,l,_),j+=ne;else{for(n=0;n<3;++n)re[n]=I(_)+1,re[n]>=2&&(M(re[n]+2,y,n*w,_),M(g,b,n*w,_),se[n]=V(b,n*w,_),ae[n]=1);for(_.readMoreInput(),X=(1<<(K=_.readBits(2)))-1,J=(Y=S+(_.readBits(4)<0;){var we,_e,je,Se,Ce,ke,Ee,Pe,Ie,Te,Oe,Ae;for(_.readMoreInput(),0===se[1]&&(z(re[1],y,1,ie,oe,ae,_),se[1]=V(b,w,_),te=U[1].htrees[ie[1]]),--se[1],(_e=(we=A(U[1].codes,te,_))>>6)>=2?(_e-=2,Ee=-1):Ee=0,je=u.kInsertRangeLut[_e]+(we>>3&7),Se=u.kCopyRangeLut[_e]+(7&we),Ce=u.kInsertLengthPrefixCode[je].offset+_.readBits(u.kInsertLengthPrefixCode[je].nbits),ke=u.kCopyLengthPrefixCode[Se].offset+_.readBits(u.kCopyLengthPrefixCode[Se].nbits),R=h[j-1&l],B=h[j-2&l],Ie=0;Ie4?3:ke-2))],(Ee=A(U[2].codes,U[2].htrees[fe],_))>=Y&&(Ae=(Ee-=Y)&X,Ee=Y+((Ne=(2+(1&(Ee>>=K))<<(Oe=1+(Ee>>1)))-4)+_.readBits(Oe)<(E=j=o.minDictionaryWordLength&&ke<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Ne=o.offsetsByLength[ke],Me=Pe-E-1,Ve=o.sizeBitsByLength[ke],Fe=Me>>Ve;if(Ne+=(Me&(1<=p){t.write(h,i);for(var Be=0;Be0&&(T[3&N]=Pe,++N),ke>ne)throw new Error("Invalid backward reference. pos: "+j+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);for(Ie=0;Ie>=1;return(e&n-1)+n}function o(e,t,n,i,r){do{e[t+(i-=n)]=new s(r.bits,r.value)}while(i>0)}function a(e,t,n){for(var s=1<0;--w[u])o(e,t+h,p,v,new s(255&u,65535&y[d++])),h=r(h,u);for(m=x-1,f=-1,u=n+1,p=2;u<=i;++u,p<<=1)for(;w[u]>0;--w[u])(h&m)!==f&&(t+=v,x+=v=1<<(g=a(w,u,n)),e[b+(f=h&m)]=new s(g+n&255,t-b-f&65535)),o(e,t+(h>>n),p,v,new s(u-n&255,65535&y[d++])),h=r(h,u);return x}},{}],8:[function(e,t,n){"use strict";n.byteLength=u,n.toByteArray=h,n.fromByteArray=m;for(var s=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)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],s=t[1];return 3*(n+s)/4-s}function d(e,t,n){return 3*(t+n)/4-n}function h(e){for(var t,n=c(e),s=n[0],o=n[1],a=new r(d(e,s,o)),l=0,u=o>0?s-4:s,h=0;h>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function f(e,t,n){for(var s,i=[],r=t;rl?l:a+o));return 1===i?(t=e[n-1],r.push(s[t>>2]+s[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],9:[function(e,t,n){function s(e,t){this.offset=e,this.nbits=t}n.kBlockLengthPrefixCode=[new s(1,2),new s(5,2),new s(9,2),new s(13,2),new s(17,3),new s(25,3),new s(33,3),new s(41,3),new s(49,4),new s(65,4),new s(81,4),new s(97,4),new s(113,5),new s(145,5),new s(177,5),new s(209,5),new s(241,6),new s(305,6),new s(369,7),new s(497,8),new s(753,9),new s(1265,10),new s(2289,11),new s(4337,12),new s(8433,13),new s(16625,24)],n.kInsertLengthPrefixCode=[new s(0,0),new s(1,0),new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,1),new s(8,1),new s(10,2),new s(14,2),new s(18,3),new s(26,3),new s(34,4),new s(50,4),new s(66,5),new s(98,5),new s(130,6),new s(194,7),new s(322,8),new s(578,9),new s(1090,10),new s(2114,12),new s(6210,14),new s(22594,24)],n.kCopyLengthPrefixCode=[new s(2,0),new s(3,0),new s(4,0),new s(5,0),new s(6,0),new s(7,0),new s(8,0),new s(9,0),new s(10,1),new s(12,1),new s(14,2),new s(18,2),new s(22,3),new s(30,3),new s(38,4),new s(54,4),new s(70,5),new s(102,5),new s(134,6),new s(198,7),new s(326,8),new s(582,9),new s(1094,10),new s(2118,24)],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 s(e){this.buffer=e,this.pos=0}function i(e){this.buffer=e,this.pos=0}s.prototype.read=function(e,t,n){this.pos+n>this.buffer.length&&(n=this.buffer.length-this.pos);for(var s=0;sthis.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=i},{}],11:[function(e,t,n){var s=e("./dictionary"),i=0,r=1,o=2,a=3,l=4,c=5,u=6,d=7,h=8,p=9,f=10,m=11,g=12,v=13,x=14,y=15,b=16,w=17,_=18,j=20;function S(e,t,n){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(n.length);for(var s=0;s'),new S("",i,"\n"),new S("",a,""),new S("",i,"]"),new S("",i," for "),new S("",x,""),new S("",o,""),new S("",i," a "),new S("",i," that "),new S(" ",f,""),new S("",i,". "),new S(".",i,""),new S(" ",i,", "),new S("",y,""),new S("",i," with "),new S("",i,"'"),new S("",i," from "),new S("",i," by "),new S("",b,""),new S("",w,""),new S(" the ",i,""),new S("",l,""),new S("",i,". The "),new S("",m,""),new S("",i," on "),new S("",i," as "),new S("",i," is "),new S("",d,""),new S("",r,"ing "),new S("",i,"\n\t"),new S("",i,":"),new S(" ",i,". "),new S("",i,"ed "),new S("",j,""),new S("",_,""),new S("",u,""),new S("",i,"("),new S("",f,", "),new S("",h,""),new S("",i," at "),new S("",i,"ly "),new S(" the ",i," of "),new S("",c,""),new S("",p,""),new S(" ",f,", "),new S("",f,'"'),new S(".",i,"("),new S("",m," "),new S("",f,'">'),new S("",i,'="'),new S(" ",i,"."),new S(".com/",i,""),new S(" the ",i," of the "),new S("",f,"'"),new S("",i,". This "),new S("",i,","),new S(".",i," "),new S("",f,"("),new S("",f,"."),new S("",i," not "),new S(" ",i,'="'),new S("",i,"er "),new S(" ",m," "),new S("",i,"al "),new S(" ",m,""),new S("",i,"='"),new S("",m,'"'),new S("",f,". "),new S(" ",i,"("),new S("",i,"ful "),new S(" ",f,". "),new S("",i,"ive "),new S("",i,"less "),new S("",m,"'"),new S("",i,"est "),new S(" ",f,"."),new S("",m,'">'),new S(" ",i,"='"),new S("",f,","),new S("",i,"ize "),new S("",m,"."),new S(" ",i,""),new S(" ",i,","),new S("",f,'="'),new S("",m,'="'),new S("",i,"ous "),new S("",m,", "),new S("",f,"='"),new S(" ",f,","),new S(" ",m,'="'),new S(" ",m,", "),new S("",m,","),new S("",m,"("),new S("",m,". "),new S(" ",m,"."),new S("",m,"='"),new S(" ",m,". "),new S(" ",f,'="'),new S(" ",m,"='"),new S(" ",f,"='")];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,i,r){var o,a=C[r].prefix,l=C[r].suffix,c=C[r].transform,u=ci&&(u=i);for(var v=0;v0;){var x=k(e,o);o+=x,i-=x}for(var y=0;y{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("|"),s=new RegExp(n,"g"),i=new RegExp(n,"");function r(e){return t[e]}var o=function(e){return e.replace(s,r)};e.exports=o,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=o}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,s){if(1&s&&(n=this(n)),8&s)return n;if("object"==typeof n&&n){if(4&s&&n.__esModule)return n;if(16&s&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&s&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>n[e]));return o.default=()=>n,i.d(r,o),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{PluginMoreMenuItem:()=>HE,PluginSidebar:()=>UE,PluginSidebarMoreMenuItem:()=>WE,PluginTemplateSettingPanel:()=>La,initializeEditor:()=>QE,initializePostsDashboard:()=>XE,reinitializeEditor:()=>$E,store:()=>zt});var e={};i.r(e),i.d(e,{__experimentalSetPreviewDeviceType:()=>He,addTemplate:()=>We,closeGeneralSidebar:()=>lt,openGeneralSidebar:()=>at,openNavigationPanelToMenu:()=>et,removeTemplate:()=>qe,revertTemplate:()=>ot,setEditedEntity:()=>Ye,setEditedPostContext:()=>Je,setHasPageContentFocus:()=>ut,setHomeTemplateId:()=>Xe,setIsInserterOpened:()=>nt,setIsListViewOpened:()=>st,setIsNavigationPanelOpened:()=>tt,setIsSaveViewOpened:()=>rt,setNavigationMenu:()=>Ke,setNavigationPanelActiveMenu:()=>$e,setPage:()=>Qe,setTemplate:()=>Ue,setTemplatePart:()=>Ze,switchEditorMode:()=>ct,toggleDistractionFree:()=>dt,toggleFeature:()=>Ge,updateSettings:()=>it});var t={};i.r(t),i.d(t,{registerRoute:()=>pt,setEditorCanvasContainerView:()=>ht,unregisterRoute:()=>ft});var n={};i.r(n),i.d(n,{__experimentalGetInsertionPoint:()=>Et,__experimentalGetPreviewDeviceType:()=>vt,getCanUserCreateMedia:()=>xt,getCurrentTemplateNavigationPanelSubMenu:()=>Nt,getCurrentTemplateTemplateParts:()=>Ot,getEditedPostContext:()=>St,getEditedPostId:()=>jt,getEditedPostType:()=>_t,getEditorMode:()=>At,getHomeTemplateId:()=>wt,getNavigationPanelActiveMenu:()=>Mt,getPage:()=>Ct,getReusableBlocks:()=>yt,getSettings:()=>bt,hasPageContentFocus:()=>Rt,isFeatureActive:()=>gt,isInserterOpened:()=>kt,isListViewOpened:()=>Pt,isNavigationOpened:()=>Vt,isPage:()=>Ft,isSaveViewOpened:()=>It});var s={};i.r(s),i.d(s,{getEditorCanvasContainerView:()=>Bt,getRoutes:()=>Dt});const o=window.wp.blocks,a=window.wp.blockLibrary,l=window.wp.data,c=window.wp.deprecated;var u=i.n(c);const d=window.wp.element,h=window.wp.editor,f=window.wp.preferences,m=window.wp.widgets,g=window.wp.hooks,v=window.wp.compose,x=window.wp.blockEditor,y=window.wp.components,b=window.wp.i18n,w=window.wp.notices,_=window.wp.coreData;var j={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},C=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},k=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},E=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},P=function(e){return{r:k(e.r,0,255),g:k(e.g,0,255),b:k(e.b,0,255),a:k(e.a)}},I=function(e){return{r:C(e.r),g:C(e.g),b:C(e.b),a:C(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},A=function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=Math.max(t,n,s),o=r-Math.min(t,n,s),a=o?r===t?(n-s)/o:r===n?2+(s-t)/o:4+(t-n)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:i}},N=function(e){var t=e.h,n=e.s,s=e.v,i=e.a;t=t/360*6,n/=100,s/=100;var r=Math.floor(t),o=s*(1-n),a=s*(1-(t-r)*n),l=s*(1-(1-t+r)*n),c=r%6;return{r:255*[s,a,o,o,l,s][c],g:255*[l,s,s,a,o,o][c],b:255*[o,o,l,s,s,a][c],a:i}},M=function(e){return{h:E(e.h),s:k(e.s,0,100),l:k(e.l,0,100),a:k(e.a)}},V=function(e){return{h:C(e.h),s:C(e.s),l:C(e.l),a:C(e.a,3)}},F=function(e){return N((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},R=function(e){return{h:(t=A(e)).h,s:(i=(200-(n=t.s))*(s=t.v)/100)>0&&i<200?n*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,s,i},B=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G={string:[[function(e){var t=T.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?C(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?C(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||z.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:P({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=B.exec(e)||D.exec(e);if(!t)return null;var n,s,i=M({h:(n=t[1],s=t[2],void 0===s&&(s="deg"),Number(n)*(j[s]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return F(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,i=e.a,r=void 0===i?1:i;return S(t)&&S(n)&&S(s)?P({r:Number(t),g:Number(n),b:Number(s),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,i=e.a,r=void 0===i?1:i;if(!S(t)||!S(n)||!S(s))return null;var o=M({h:Number(t),s:Number(n),l:Number(s),a:Number(r)});return F(o)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,i=e.a,r=void 0===i?1:i;if(!S(t)||!S(n)||!S(s))return null;var o=function(e){return{h:E(e.h),s:k(e.s,0,100),v:k(e.v,0,100),a:k(e.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(r)});return N(o)},"hsv"]]},H=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=I(this.rgba)).r,n=e.g,s=e.b,r=(i=e.a)<1?O(C(255*i)):"","#"+O(t)+O(n)+O(s)+r;var e,t,n,s,i,r},e.prototype.toRgb=function(){return I(this.rgba)},e.prototype.toRgbString=function(){return t=(e=I(this.rgba)).r,n=e.g,s=e.b,(i=e.a)<1?"rgba("+t+", "+n+", "+s+", "+i+")":"rgb("+t+", "+n+", "+s+")";var e,t,n,s,i},e.prototype.toHsl=function(){return V(R(this.rgba))},e.prototype.toHslString=function(){return t=(e=V(R(this.rgba))).h,n=e.s,s=e.l,(i=e.a)<1?"hsla("+t+", "+n+"%, "+s+"%, "+i+")":"hsl("+t+", "+n+"%, "+s+"%)";var e,t,n,s,i},e.prototype.toHsv=function(){return e=A(this.rgba),{h:C(e.h),s:C(e.s),v:C(e.v),a:C(e.a,3)};var e},e.prototype.invert=function(){return Y({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),Y(W(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,-e))},e.prototype.grayscale=function(){return Y(W(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Y(Z(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?Y({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):C(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=R(this.rgba);return"number"==typeof e?Y({h:e,s:t.s,l:t.l,a:t.a}):C(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Y(e).toHex()},e}(),Y=function(e){return e instanceof K?e:new K(e)},X=[],J=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Q=function(e){return.2126*J(e.r)+.7152*J(e.g)+.0722*J(e.b)};const $=window.wp.privateApis,{lock:ee,unlock:te}=(0,$.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{useGlobalSetting:ne,useGlobalStyle:se}=te(x.privateApis);function ie(){const[e="black"]=se("color.text"),[t="white"]=se("color.background"),[n=e]=se("elements.h1.color.text"),[s=n]=se("elements.link.color.text"),[i=s]=se("elements.button.color.background"),[r]=ne("color.palette.core"),[o]=ne("color.palette.theme"),[a]=ne("color.palette.custom"),l=(null!=o?o:[]).concat(null!=a?a:[]).concat(null!=r?r:[]),c=l.filter((({color:t})=>t===e)),u=l.filter((({color:e})=>e===i)),d=c.concat(u).concat(l).filter((({color:e})=>e!==t)).slice(0,2);return{paletteColors:l,highlightedColors:d}}function re(e,t,n){return e&&"object"==typeof e?(t.reduce(((e,s,i)=>(void 0===e[s]&&(Number.isInteger(t[i+1])?e[s]=[]:e[s]={}),i===t.length-1&&(e[s]=n),e[s])),e),e):e}!function(e){e.forEach((function(e){X.indexOf(e)<0&&(e(K,G),X.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Q(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,s,i,r,o,a,l,c=t instanceof e?t:new e(t);return r=this.rgba,o=c.toRgb(),n=(a=Q(r))>(l=Q(o))?(a+.05)/(l+.05):(l+.05)/(a+.05),void 0===(s=2)&&(s=0),void 0===i&&(i=Math.pow(10,s)),Math.floor(i*n)/i+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(o=void 0===(r=(n=t).size)?"normal":r,"AAA"===(i=void 0===(s=n.level)?"AA":s)&&"normal"===o?7:"AA"===i&&"large"===o?3:4.5);var n,s,i,r,o}}]);const oe=window.ReactJSXRuntime,{cleanEmptyObject:ae,GlobalStylesContext:le}=te(x.privateApis),ce={...o.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},ue={"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"},de={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},he=["border","color","spacing","typography"],pe=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n},fe=["borderColor","borderWidth","borderStyle"],me=["top","right","bottom","left"];function ge(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:s,style:i,width:r}=t[e];return!(s||r)||i?[]:[{path:["border",e,"style"],value:"solid"}]}function ve(e,t,n){const s=function(e,t){const{supportedPanels:n}=(0,l.useSelect)((n=>({supportedPanels:te(n(o.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),i=n?.styles?.blocks?.[e];return(0,d.useMemo)((()=>{const e=s.flatMap((e=>{if(!ce[e])return[];const{value:n}=ce[e],s=n.join("."),i=t[de[s]],r=i?`var:preset|${ue[s]}|${i}`:pe(t.style,n);if("linkColor"===e){const e=r?[{path:n,value:r}]:[],s=["elements","link",":hover","color","text"],i=pe(t.style,s);return i&&e.push({path:s,value:i}),e}if(fe.includes(e)&&r){const e=[{path:n,value:r}];return me.forEach((t=>{const s=[...n];s.splice(-1,0,t),e.push({path:s,value:r})})),e}return r?[{path:n,value:r}]:[]}));return function(e,t,n){if(!e&&!t)return[];const s=[...ge("top",e,n),...ge("right",e,n),...ge("bottom",e,n),...ge("left",e,n)],{color:i,style:r,width:o}=e||{};return(t||i||o)&&!r&&me.forEach((e=>{n?.[e]?.style||s.push({path:["border",e,"style"],value:"solid"})})),s}(t.style?.border,t.borderColor,i?.border).forEach((t=>e.push(t))),e}),[s,t,i])}function xe({name:e,attributes:t,setAttributes:n}){const{user:s,setUserConfig:i}=(0,d.useContext)(le),r=ve(e,t,s),{__unstableMarkNextChangeAsNotPersistent:a}=(0,l.useDispatch)(x.store),{createSuccessNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useCallback)((()=>{if(0!==r.length&&r.length>0){const{style:l}=t,u=structuredClone(l),d=structuredClone(s);for(const{path:t,value:n}of r)re(u,t,void 0),re(d,["styles","blocks",e,...t],n);const h={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:ae(u)};a(),n(h),i(d,{undoIgnore:!0}),c((0,b.sprintf)((0,b.__)("%s styles applied."),(0,o.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick(){a(),n(t),i(s,{undoIgnore:!0})}}]})}}),[a,t,r,c,e,n,i,s]);return(0,oe.jsxs)(y.BaseControl,{__nextHasNoMarginBottom:!0,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,o.getBlockType)(e).title),children:[(0,oe.jsx)(y.BaseControl.VisualLabel,{children:(0,b.__)("Styles")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",accessibleWhenDisabled:!0,disabled:0===r.length,onClick:u,children:(0,b.__)("Apply globally")})]})}function ye(e){const t=(0,x.useBlockEditingMode)(),n=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),s=he.some((t=>(0,o.hasBlockSupport)(e.name,t)));return"default"===t&&s&&n?(0,oe.jsx)(x.InspectorAdvancedControls,{children:(0,oe.jsx)(xe,{...e})}):null}const be=(0,v.createHigherOrderComponent)((e=>t=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(e,{...t},"edit"),t.isSelected&&(0,oe.jsx)(ye,{...t})]})));(0,g.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",be);const we=(0,l.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){return"SET_IS_SAVE_VIEW_OPENED"===t.type?t.isOpen:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e},routes:function(e=[],t){switch(t.type){case"REGISTER_ROUTE":return[...e,t.route];case"UNREGISTER_ROUTE":return e.filter((e=>e.name!==t.name))}return e}}),_e=window.wp.patterns,je="wp_navigation",Se="wp_template",Ce="wp_template_part",ke="custom",Ee="uncategorized",Pe="all-parts",{PATTERN_TYPES:Ie,PATTERN_DEFAULT_CATEGORY:Te,PATTERN_USER_CATEGORY:Oe,EXCLUDED_PATTERN_SOURCES:Ae,PATTERN_SYNC_TYPES:Ne}=te(_e.privateApis),Me=[Ce,je,Ie.user],Ve={[Se]:(0,b.__)("Template"),[Ce]:(0,b.__)("Template part"),[Ie.user]:(0,b.__)("Pattern"),[je]:(0,b.__)("Navigation")},Fe="grid",Re="table",Be="list",De="isAny",Le="isNone",{interfaceStore:ze}=te(h.privateApis);function Ge(e){return function({registry:t}){u()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(f.store).toggle("core/edit-site",e)}}const He=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(h.store).setDeviceType(e)};function Ue(){return u()("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 We=e=>async({dispatch:t,registry:n})=>{u()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const s=await n.dispatch(_.store).saveEntityRecord("postType",Se,e);e.content&&n.dispatch(_.store).editEntityRecord("postType",Se,s.id,{blocks:(0,o.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Se,id:s.id})},qe=e=>({registry:t})=>te(t.dispatch(h.store)).removeTemplates([e]);function Ze(e){return u()("dispatch( 'core/edit-site' ).setTemplatePart",{since:"6.8"}),{type:"SET_EDITED_POST",postType:Ce,id:e}}function Ke(e){return u()("dispatch( 'core/edit-site' ).setNavigationMenu",{since:"6.8"}),{type:"SET_EDITED_POST",postType:je,id:e}}function Ye(e,t,n){return{type:"SET_EDITED_POST",postType:e,id:t,context:n}}function Xe(){return u()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Je(e){return u()("dispatch( 'core/edit-site' ).setEditedPostContext",{since:"6.8"}),{type:"SET_EDITED_POST_CONTEXT",context:e}}function Qe(){return u()("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 $e(){return u()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function et(){return u()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function tt(){return u()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const nt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(h.store).setIsInserterOpened(e)},st=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(h.store).setIsListViewOpened(e)};function it(e){return{type:"UPDATE_SETTINGS",settings:e}}function rt(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const ot=(e,t)=>({registry:n})=>te(n.dispatch(h.store)).revertTemplate(e,t),at=e=>({registry:t})=>{t.dispatch(ze).enableComplementaryArea("core",e)},lt=()=>({registry:e})=>{e.dispatch(ze).disableComplementaryArea("core")},ct=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(h.store).switchEditorMode(e)},ut=e=>({dispatch:t,registry:n})=>{u()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&n.dispatch(x.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},dt=()=>({registry:e})=>{u()("dispatch( 'core/edit-site' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(h.store).toggleDistractionFree()},ht=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})};function pt(e){return{type:"REGISTER_ROUTE",route:e}}function ft(e){return{type:"UNREGISTER_ROUTE",name:e}}const mt=[];const gt=(0,l.createRegistrySelector)((e=>(t,n)=>(u()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(f.store).get("core/edit-site",n)))),vt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(h.store).getDeviceType()))),xt=(0,l.createRegistrySelector)((e=>()=>(u()("wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()",{since:"6.7",alternative:"wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )"}),e(_.store).canUser("create","media")))),yt=(0,l.createRegistrySelector)((e=>()=>{u()("select( 'core/edit-site' ).getReusableBlocks()",{since:"6.5",version:"6.8",alternative:"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )"});return"web"===d.Platform.OS?e(_.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function bt(e){return e.settings}function wt(){u()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function _t(e){return u()("select( 'core/edit-site' ).getEditedPostType",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),e.editedPost.postType}function jt(e){return u()("select( 'core/edit-site' ).getEditedPostId",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostId"}),e.editedPost.id}function St(e){return u()("select( 'core/edit-site' ).getEditedPostContext",{since:"6.8"}),e.editedPost.context}function Ct(e){return u()("select( 'core/edit-site' ).getPage",{since:"6.8"}),{context:e.editedPost.context}}const kt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(h.store).isInserterOpened()))),Et=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),te(e(h.store)).getInserter()))),Pt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(h.store).isListViewOpened())));function It(e){return e.saveViewPanel}function Tt(e){const t=e(_.store).getEntityRecords("postType",Ce,{per_page:-1}),{getBlocksByName:n,getBlocksByClientId:s}=e(x.store);return[s(n("core/template-part")),t]}const Ot=(0,l.createRegistrySelector)((e=>(0,l.createSelector)((()=>(u()("select( 'core/edit-site' ).getCurrentTemplateTemplateParts()",{since:"6.7",version:"6.9",alternative:"select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )"}),function(e=mt,t){const n=t?t.reduce(((e,t)=>({...e,[t.id]:t})),{}):{},s=[],i=[...e];for(;i.length;){const{innerBlocks:e,...t}=i.shift();if(i.unshift(...e),(0,o.isTemplatePart)(t)){const{attributes:{theme:e,slug:i}}=t,r=n[`${e}//${i}`];r&&s.push({templatePart:r,block:t})}}return s}(...Tt(e)))),(()=>Tt(e))))),At=(0,l.createRegistrySelector)((e=>()=>e(f.store).get("core","editorMode")));function Nt(){u()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Mt(){u()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Vt(){u()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Ft(e){return u()("select( 'core/edit-site' ).isPage",{since:"6.8",alternative:"select( 'core/editor' ).getCurrentPostType"}),!!e.editedPost.context?.postId}function Rt(){return u()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Bt(e){return e.editorCanvasContainerView}function Dt(e){return e.routes}const Lt={reducer:we,actions:e,selectors:n},zt=(0,l.createReduxStore)("core/edit-site",Lt);(0,l.register)(zt),te(zt).registerPrivateSelectors(s),te(zt).registerPrivateActions(t);const Gt=window.wp.router;function Ht(e){var t,n,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t{const{getEntityRecord:t}=e(_.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,oe.jsx)("div",{className:"edit-site-site-icon__image"});const s=n?(0,oe.jsx)("img",{className:"edit-site-site-icon__image",alt:(0,b.__)("Site Icon"),src:n}):(0,oe.jsx)(y.Icon,{className:"edit-site-site-icon__icon",icon:$t,size:48});return(0,oe.jsx)("div",{className:Ut(e,"edit-site-site-icon"),children:s})},tn=window.wp.dom,nn=(0,d.createContext)((()=>{}));function sn(){let e={direction:null,focusSelector:null};return{get:()=>e,navigate(t,n=null){e={direction:t,focusSelector:"forward"===t&&n?n:e.focusSelector}}}}function rn({children:e,shouldAnimate:t}){const n=(0,d.useContext)(nn),s=(0,d.useRef)(),[i,r]=(0,d.useState)(null);(0,d.useLayoutEffect)((()=>{const{direction:e,focusSelector:t}=n.get();!function(e,t,n){let s;if("back"===t&&n&&(s=e.querySelector(n)),null!==t&&!s){const[t]=tn.focus.tabbable.find(e);s=null!=t?t:e}s?.focus()}(s.current,e,t),r(e)}),[n]);const o=Ut("edit-site-sidebar__screen-wrapper",t?{"slide-from-left":"back"===i,"slide-from-right":"forward"===i}:{});return(0,oe.jsx)("div",{ref:s,className:o,children:e})}function on({children:e}){const[t]=(0,d.useState)(sn);return(0,oe.jsx)(nn.Provider,{value:t,children:e})}function an({routeKey:e,shouldAnimate:t,children:n}){return(0,oe.jsx)("div",{className:"edit-site-sidebar__content",children:(0,oe.jsx)(rn,{shouldAnimate:t,children:n},e)})}const{useLocation:ln,useHistory:cn}=te(Gt.privateApis),un=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{dashboardLink:n,homeUrl:s,siteTitle:i}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),{getEntityRecord:n}=e(_.store),s=n("root","site");return{dashboardLink:t().__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!s?.title&&s?.url?(0,Qt.filterURLForDisplay)(s?.url):s?.title}}),[]),{open:r}=(0,l.useDispatch)(Wt.store);return(0,oe.jsx)("div",{className:"edit-site-site-hub",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,oe.jsx)("div",{className:Ut("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,ref:t,href:n,label:(0,b.__)("Go to the Dashboard"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5333) translateX(-4px)",borderRadius:4},children:(0,oe.jsx)(en,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)("div",{className:"edit-site-site-hub__title",children:(0,oe.jsxs)(y.Button,{__next40pxDefaultSize:!0,variant:"link",href:s,target:"_blank",children:[(0,Kt.decodeEntities)(i),(0,oe.jsx)(y.VisuallyHidden,{as:"span",children:(0,b.__)("(opens in a new tab)")})]})}),(0,oe.jsx)(y.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,oe.jsx)(y.Button,{size:"compact",className:"edit-site-site-hub_toggle-command-center",icon:Xt,onClick:()=>r(),label:(0,b.__)("Open command palette"),shortcut:Jt.displayShortcut.primary("k")})})]})]})})}))),dn=un,hn=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{path:n}=ln(),s=cn(),{navigate:i}=(0,d.useContext)(nn),{dashboardLink:r,homeUrl:o,siteTitle:a,isBlockTheme:c,isClassicThemeWithStyleBookSupport:u}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),{getEntityRecord:n,getCurrentTheme:s}=e(_.store),i=n("root","site"),r=s(),o=t(),a=r.theme_supports["editor-styles"],l=o.supportsLayout;return{dashboardLink:o.__experimentalDashboardLink,homeUrl:n("root","__unstableBase")?.home,siteTitle:!i?.title&&i?.url?(0,Qt.filterURLForDisplay)(i?.url):i?.title,isBlockTheme:r?.is_block_theme,isClassicThemeWithStyleBookSupport:!r?.is_block_theme&&(a||l)}}),[]),{open:h}=(0,l.useDispatch)(Wt.store);let p;"/"!==n&&(c||u?p="/":"/pattern"!==n&&(p="/pattern"));const f={href:p?void 0:r,label:p?(0,b.__)("Go to Site Editor"):(0,b.__)("Go to the Dashboard"),onClick:p?()=>{s.navigate(p),i("back")}:void 0};return(0,oe.jsx)("div",{className:"edit-site-site-hub",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,oe.jsx)("div",{className:Ut("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,ref:t,className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},...f,children:(0,oe.jsx)(en,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)("div",{className:"edit-site-site-hub__title",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"link",href:o,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),children:(0,Kt.decodeEntities)(a)})}),(0,oe.jsx)(y.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:"edit-site-site-hub_toggle-command-center",icon:Xt,onClick:()=>h(),label:(0,b.__)("Open command palette"),shortcut:Jt.displayShortcut.primary("k")})})]})]})})}))),{useLocation:pn,useHistory:fn}=te(Gt.privateApis),mn={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},gn=320,vn=9/19.5,xn={width:"100%",height:"100%"};function yn(e,t){const n=1-Math.max(0,Math.min(1,(e-gn)/980)),s=((e,t,n)=>e+(t-e)*n)(t,vn,n);return e/s}const bn=function e({isFullWidth:t,isOversized:n,setIsOversized:s,isReady:i,children:r,defaultSize:o,innerContentStyle:a}){const c=fn(),{path:u,query:h}=pn(),{canvas:p="view"}=h,f=(0,v.useReducedMotion)(),[m,g]=(0,d.useState)(xn),[x,w]=(0,d.useState)(),[j,S]=(0,d.useState)(!1),[C,k]=(0,d.useState)(!1),[E,P]=(0,d.useState)(1),I={type:"tween",duration:j?0:.5},T=(0,d.useRef)(null),O=(0,v.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),A=o.width/o.height,N=(0,l.useSelect)((e=>{const{getCurrentTheme:t}=e(_.store);return t()?.is_block_theme}),[]),M={default:{flexGrow:0,height:m.height},fullWidth:{flexGrow:1,height:m.height}},V={hidden:{opacity:0,...(0,b.isRTL)()?{right:0}:{left:0}},visible:{opacity:1,...(0,b.isRTL)()?{right:-14}:{left:-14}},active:{opacity:1,...(0,b.isRTL)()?{right:-14}:{left:-14},scaleY:1.3}},F=j?"active":C?"visible":"hidden";return(0,oe.jsx)(y.ResizableBox,{as:y.__unstableMotion.div,ref:T,initial:!1,variants:M,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&g({width:"100%",height:"100%"})},whileHover:"view"===p&&N?{scale:1.005,transition:{duration:f?0:.5,ease:"easeOut"}}:{},transition:I,size:m,enable:{top:!1,bottom:!1,...(0,b.isRTL)()?{right:i,left:!1}:{left:i,right:!1},topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:E,handleClasses:void 0,handleStyles:{left:mn,right:mn},minWidth:gn,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>k(!0),onBlur:()=>k(!1),onMouseOver:()=>k(!0),onMouseOut:()=>k(!1),handleComponent:{[(0,b.isRTL)()?"right":"left"]:"view"===p&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Tooltip,{text:(0,b.__)("Drag to resize"),children:(0,oe.jsx)(y.__unstableMotion.button,{role:"separator","aria-orientation":"vertical",className:Ut("edit-site-resizable-frame__handle",{"is-resizing":j}),variants:V,animate:F,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":O,"aria-valuenow":T.current?.resizable?.offsetWidth||void 0,"aria-valuemin":gn,"aria-valuemax":o.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1)*((0,b.isRTL)()?-1:1),n=Math.min(Math.max(gn,T.current.resizable.offsetWidth+t),o.width);g({width:n,height:yn(n,A)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"},"handle")}),(0,oe.jsx)("div",{hidden:!0,id:O,children:(0,b.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")})]})},onResizeStart:(e,t,n)=>{w(n.offsetWidth),S(!0)},onResize:(e,t,i,r)=>{const a=r.width/E,l=Math.abs(a),c=r.width<0?l:(o.width-x)/2,u=Math.min(l,c),d=0===l?0:u/l;P(1-d+2*d);const h=x+r.width;s(h>o.width),g({height:n?"100%":yn(h,A)})},onResizeStop:(e,t,i)=>{if(S(!1),!n)return;s(!1);i.ownerDocument.documentElement.offsetWidth-i.offsetWidth>200||!N?g(xn):c.navigate((0,Qt.addQueryArgs)(u,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"})},className:Ut("edit-site-resizable-frame__inner",{"is-resizing":j}),showHandle:!1,children:(0,oe.jsx)("div",{className:"edit-site-resizable-frame__inner-content",style:a,children:r})})},wn=window.wp.keyboardShortcuts,_n="core/edit-site/save";function jn(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,l.useSelect)(_.store),{hasNonPostEntityChanges:n,isPostSavingLocked:s}=(0,l.useSelect)(h.store),{savePost:i}=(0,l.useDispatch)(h.store),{setIsSaveViewOpened:r}=(0,l.useDispatch)(zt),{registerShortcut:o,unregisterShortcut:a}=(0,l.useDispatch)(wn.store);return(0,d.useEffect)((()=>(o({name:_n,category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{a(_n)})),[o,a]),(0,wn.useShortcut)("core/edit-site/save",(o=>{o.preventDefault();const a=e(),l=!!a.length,c=a.some((e=>t(e.kind,e.name,e.key)));l&&!c&&(n()?r(!0):s()||i())})),null}const Sn=1e4;function Cn(){const[e,t]=(0,d.useState)(!1),n=(0,l.useSelect)((t=>{const n=t(_.store).hasResolvingSelectors();return!e&&!n}),[e]);return(0,d.useEffect)((()=>{let n;return e||(n=setTimeout((()=>{t(!0)}),Sn)),()=>{clearTimeout(n)}}),[e]),(0,d.useEffect)((()=>{if(n){const e=setTimeout((()=>{t(!0)}),100);return()=>{clearTimeout(e)}}}),[n]),!e}var kn=Gn(),En=e=>Bn(e,kn),Pn=Gn();En.write=e=>Bn(e,Pn);var In=Gn();En.onStart=e=>Bn(e,In);var Tn=Gn();En.onFrame=e=>Bn(e,Tn);var On=Gn();En.onFinish=e=>Bn(e,On);var An=[];En.setTimeout=(e,t)=>{let n=En.now()+t,s=()=>{let e=An.findIndex((e=>e.cancel==s));~e&&An.splice(e,1),Fn-=~e?1:0},i={time:n,handler:e,cancel:s};return An.splice(Nn(n),0,i),Fn+=1,Dn(),i};var Nn=e=>~(~An.findIndex((t=>t.time>e))||~An.length);En.cancel=e=>{In.delete(e),Tn.delete(e),On.delete(e),kn.delete(e),Pn.delete(e)},En.sync=e=>{Rn=!0,En.batchedUpdates(e),Rn=!1},En.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function s(...e){t=e,En.onStart(n)}return s.handler=e,s.cancel=()=>{In.delete(n),t=null},s};var Mn=typeof window<"u"?window.requestAnimationFrame:()=>{};En.use=e=>Mn=e,En.now=typeof performance<"u"?()=>performance.now():Date.now,En.batchedUpdates=e=>e(),En.catch=console.error,En.frameLoop="always",En.advance=()=>{"demand"!==En.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):zn()};var Vn=-1,Fn=0,Rn=!1;function Bn(e,t){Rn?(t.delete(e),e(0)):(t.add(e),Dn())}function Dn(){Vn<0&&(Vn=0,"demand"!==En.frameLoop&&Mn(Ln))}function Ln(){~Vn&&(Mn(Ln),En.batchedUpdates(zn))}function zn(){let e=Vn;Vn=En.now();let t=Nn(Vn);t&&(Hn(An.splice(0,t),(e=>e.handler())),Fn-=t),Fn?(In.flush(),kn.flush(e?Math.min(64,Vn-e):16.667),Tn.flush(),Pn.flush(),On.flush()):Vn=-1}function Gn(){let e=new Set,t=e;return{add(n){Fn+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(Fn-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,Fn-=t.size,Hn(t,(t=>t(n)&&e.add(t))),Fn+=e.size,t=e)}}}function Hn(e,t){e.forEach((e=>{try{t(e)}catch(e){En.catch(e)}}))}var Un=i(1609),Wn=i.t(Un,2),qn=Object.defineProperty,Zn={};function Kn(){}((e,t)=>{for(var n in t)qn(e,n,{get:t[n],enumerable:!0})})(Zn,{assign:()=>ls,colors:()=>rs,createStringInterpolator:()=>ts,skipAnimation:()=>os,to:()=>ns,willAdvance:()=>as});var Yn={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function Xn(e,t){if(Yn.arr(e)){if(!Yn.arr(t)||e.length!==t.length)return!1;for(let n=0;ne.forEach(t);function Qn(e,t,n){if(Yn.arr(e))for(let s=0;sYn.und(e)?[]:Yn.arr(e)?e:[e];function es(e,t){if(e.size){let n=Array.from(e);e.clear(),Jn(n,t)}}var ts,ns,ss=(e,...t)=>es(e,(e=>e(...t))),is=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),rs=null,os=!1,as=Kn,ls=e=>{e.to&&(ns=e.to),e.now&&(En.now=e.now),void 0!==e.colors&&(rs=e.colors),null!=e.skipAnimation&&(os=e.skipAnimation),e.createStringInterpolator&&(ts=e.createStringInterpolator),e.requestAnimationFrame&&En.use(e.requestAnimationFrame),e.batchedUpdates&&(En.batchedUpdates=e.batchedUpdates),e.willAdvance&&(as=e.willAdvance),e.frameLoop&&(En.frameLoop=e.frameLoop)},cs=new Set,us=[],ds=[],hs=0,ps={get idle(){return!cs.size&&!us.length},start(e){hs>e.priority?(cs.add(e),En.onStart(fs)):(ms(e),En(vs))},advance:vs,sort(e){if(hs)En.onFrame((()=>ps.sort(e)));else{let t=us.indexOf(e);~t&&(us.splice(t,1),gs(e))}},clear(){us=[],cs.clear()}};function fs(){cs.forEach(ms),cs.clear(),En(vs)}function ms(e){us.includes(e)||gs(e)}function gs(e){us.splice(function(e,t){let n=e.findIndex(t);return n<0?e.length:n}(us,(t=>t.priority>e.priority)),0,e)}function vs(e){let t=ds;for(let n=0;n0}var xs="[-+]?\\d*\\.?\\d+",ys=xs+"%";function bs(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var ws=new RegExp("rgb"+bs(xs,xs,xs)),_s=new RegExp("rgba"+bs(xs,xs,xs,xs)),js=new RegExp("hsl"+bs(xs,ys,ys)),Ss=new RegExp("hsla"+bs(xs,ys,ys,xs)),Cs=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ks=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Es=/^#([0-9a-fA-F]{6})$/,Ps=/^#([0-9a-fA-F]{8})$/;function Is(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ts(e,t,n){let s=n<.5?n*(1+t):n+t-n*t,i=2*n-s,r=Is(i,s,e+1/3),o=Is(i,s,e),a=Is(i,s,e-1/3);return Math.round(255*r)<<24|Math.round(255*o)<<16|Math.round(255*a)<<8}function Os(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function As(e){return(parseFloat(e)%360+360)%360/360}function Ns(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Ms(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function Vs(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Es.exec(e))?parseInt(t[1]+"ff",16)>>>0:rs&&void 0!==rs[e]?rs[e]:(t=ws.exec(e))?(Os(t[1])<<24|Os(t[2])<<16|Os(t[3])<<8|255)>>>0:(t=_s.exec(e))?(Os(t[1])<<24|Os(t[2])<<16|Os(t[3])<<8|Ns(t[4]))>>>0:(t=Cs.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Ps.exec(e))?parseInt(t[1],16)>>>0:(t=ks.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=js.exec(e))?(255|Ts(As(t[1]),Ms(t[2]),Ms(t[3])))>>>0:(t=Ss.exec(e))?(Ts(As(t[1]),Ms(t[2]),Ms(t[3]))|Ns(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var Fs=(e,t,n)=>{if(Yn.fun(e))return e;if(Yn.arr(e))return Fs({range:e,output:t,extrapolate:n});if(Yn.str(e.output[0]))return ts(e);let s=e,i=s.output,r=s.range||[0,1],o=s.extrapolateLeft||s.extrapolate||"extend",a=s.extrapolateRight||s.extrapolate||"extend",l=s.easing||(e=>e);return e=>{let t=function(e,t){for(var n=1;n=e);++n);return n-1}(e,r);return function(e,t,n,s,i,r,o,a,l){let c=l?l(e):e;if(cn){if("identity"===a)return c;"clamp"===a&&(c=n)}return s===i?s:t===n?e<=t?s:i:(t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t),c=r(c),s===-1/0?c=-c:i===1/0?c+=s:c=c*(i-s)+s,c)}(e,r[t],r[t+1],i[t],i[t+1],l,o,a,s.map)}};var Rs=1.70158,Bs=1.525*Rs,Ds=Rs+1,Ls=2*Math.PI/3,zs=2*Math.PI/4.5,Gs=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Hs={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>Ds*e*e*e-Rs*e*e,easeOutBack:e=>1+Ds*Math.pow(e-1,3)+Rs*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(Bs+1)*e-Bs)/2:(Math.pow(2*e-2,2)*((Bs+1)*(2*e-2)+Bs)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*Ls),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*Ls)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*zs)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*zs)/2+1,easeInBounce:e=>1-Gs(1-e),easeOutBounce:Gs,easeInOutBounce:e=>e<.5?(1-Gs(1-2*e))/2:(1+Gs(2*e-1))/2,steps:(e,t="end")=>n=>{let s=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(s):Math.ceil(s))/e)}},Us=Symbol.for("FluidValue.get"),Ws=Symbol.for("FluidValue.observers"),qs=e=>Boolean(e&&e[Us]),Zs=e=>e&&e[Us]?e[Us]():e,Ks=e=>e[Ws]||null;function Ys(e,t){let n=e[Ws];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var Xs=class{[Us];[Ws];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");Js(this,e)}},Js=(e,t)=>ti(e,Us,t);function Qs(e,t){if(e[Us]){let n=e[Ws];n||ti(e,Ws,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function $s(e,t){let n=e[Ws];if(n&&n.has(t)){let s=n.size-1;s?n.delete(t):e[Ws]=null,e.observerRemoved&&e.observerRemoved(s,t)}}var ei,ti=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),ni=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,si=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ii=new RegExp(`(${ni.source})(%|[a-z]+)`,"i"),ri=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,oi=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,ai=e=>{let[t,n]=li(e);if(!t||is())return e;let s=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(s)return s.trim();if(n&&n.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(n)||e}return n&&oi.test(n)?ai(n):n||e},li=e=>{let t=oi.exec(e);if(!t)return[,];let[,n,s]=t;return[n,s]},ci=(e,t,n,s,i)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(s)}, ${i})`,ui=e=>{ei||(ei=rs?new RegExp(`(${Object.keys(rs).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>Zs(e).replace(oi,ai).replace(si,Vs).replace(ei,Vs))),n=t.map((e=>e.match(ni).map(Number))),s=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>Fs({...e,output:t})));return e=>{let n=!ii.test(t[0])&&t.find((e=>ii.test(e)))?.replace(ni,""),i=0;return t[0].replace(ni,(()=>`${s[i++](e)}${n||""}`)).replace(ri,ci)}},di="react-spring: ",hi=e=>{let t=e,n=!1;if("function"!=typeof t)throw new TypeError(`${di}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},pi=hi(console.warn);hi(console.warn);function fi(e){return Yn.str(e)&&("#"==e[0]||/\d/.test(e)||!is()&&oi.test(e)||e in(rs||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var mi=is()?Un.useEffect:Un.useLayoutEffect;function gi(){let e=(0,Un.useState)()[1],t=(()=>{let e=(0,Un.useRef)(!1);return mi((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var vi=[];var xi=Symbol.for("Animated:node"),yi=e=>e&&e[xi],bi=(e,t)=>((e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}))(e,xi,t),wi=e=>e&&e[xi]&&e[xi].getPayload(),_i=class{payload;constructor(){bi(this,this)}getPayload(){return this.payload||[]}},ji=class extends _i{constructor(e){super(),this._value=e,Yn.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new ji(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Yn.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,Yn.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Si=class extends ji{_string=null;_toString;constructor(e){super(0),this._toString=Fs({output:[e,e]})}static create(e){return new Si(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(Yn.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=Fs({output:[this.getValue(),e]})),this._value=0,super.reset()}},Ci={dependencies:null},ki=class extends _i{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return Qn(this.source,((n,s)=>{(e=>!!e&&e[xi]===e)(n)?t[s]=n.getValue(e):qs(n)?t[s]=Zs(n):e||(t[s]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Jn(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return Qn(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ci.dependencies&&qs(e)&&Ci.dependencies.add(e);let t=wi(e);t&&Jn(t,(e=>this.add(e)))}},Ei=class extends ki{constructor(e){super(e)}static create(e){return new Ei(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Pi)),!0)}};function Pi(e){return(fi(e)?Si:ji).create(e)}function Ii(e){let t=yi(e);return t?t.constructor:Yn.arr(e)?Ei:fi(e)?Si:ji}var Ti=(e,t)=>{let n=!Yn.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,Un.forwardRef)(((s,i)=>{let r=(0,Un.useRef)(null),o=n&&(0,Un.useCallback)((e=>{r.current=function(e,t){return e&&(Yn.fun(e)?e(t):e.current=t),t}(i,e)}),[i]),[a,l]=function(e,t){let n=new Set;return Ci.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new ki(e),Ci.dependencies=null,[e,n]}(s,t),c=gi(),u=()=>{let e=r.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&c()},d=new Oi(u,l),h=(0,Un.useRef)();mi((()=>(h.current=d,Jn(l,(e=>Qs(e,d))),()=>{h.current&&(Jn(h.current.deps,(e=>$s(e,h.current))),En.cancel(h.current.update))}))),(0,Un.useEffect)(u,[]),(e=>{(0,Un.useEffect)(e,vi)})((()=>()=>{let e=h.current;Jn(e.deps,(t=>$s(t,e)))}));let p=t.getComponentProps(a.getValue());return Un.createElement(e,{...p,ref:o})}))},Oi=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&En.write(this.update)}};var Ai=Symbol.for("AnimatedComponent"),Ni=e=>Yn.str(e)?e:e&&Yn.str(e.displayName)?e.displayName:Yn.fun(e)&&e.name||null;function Mi(e,...t){return Yn.fun(e)?e(...t):e}var Vi=(e,t)=>!0===e||!!(t&&e&&(Yn.fun(e)?e(t):$n(e).includes(t))),Fi=(e,t)=>Yn.obj(e)?t&&e[t]:e,Ri=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Bi=e=>e,Di=(e,t=Bi)=>{let n=Li;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));let s={};for(let i of n){let n=t(e[i],i);Yn.und(n)||(s[i]=n)}return s},Li=["config","onProps","onStart","onChange","onPause","onResume","onRest"],zi={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Gi(e){let t=function(e){let t={},n=0;if(Qn(e,((e,s)=>{zi[s]||(t[s]=e,n++)})),n)return t}(e);if(t){let n={to:t};return Qn(e,((e,s)=>s in t||(n[s]=e))),n}return{...e}}function Hi(e){return e=Zs(e),Yn.arr(e)?e.map(Hi):fi(e)?Zn.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Ui(e){return Yn.fun(e)||Yn.arr(e)&&Yn.obj(e[0])}var Wi={tension:170,friction:26,mass:1,damping:1,easing:Hs.linear,clamp:!1},qi=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Wi)}};function Zi(e,t){if(Yn.und(t.decay)){let n=!Yn.und(t.tension)||!Yn.und(t.friction);(n||!Yn.und(t.frequency)||!Yn.und(t.damping)||!Yn.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var Ki=[],Yi=class{changed=!1;values=Ki;toValues=null;fromValues=Ki;to;from;config=new qi;immediate=!1};function Xi(e,{key:t,props:n,defaultProps:s,state:i,actions:r}){return new Promise(((o,a)=>{let l,c,u=Vi(n.cancel??s?.cancel,t);if(u)p();else{Yn.und(n.pause)||(i.paused=Vi(n.pause,t));let e=s?.pause;!0!==e&&(e=i.paused||Vi(e,t)),l=Mi(n.delay||0,t),e?(i.resumeQueue.add(h),r.pause()):(r.resume(),h())}function d(){i.resumeQueue.add(h),i.timeouts.delete(c),c.cancel(),l=c.time-En.now()}function h(){l>0&&!Zn.skipAnimation?(i.delayed=!0,c=En.setTimeout(p,l),i.pauseQueue.add(d),i.timeouts.add(c)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(c),e<=(i.cancelId||0)&&(u=!0);try{r.start({...n,callId:e,cancel:u},o)}catch(e){a(e)}}}))}var Ji=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?er(e.get()):t.every((e=>e.noop))?Qi(e.get()):$i(e.get(),t.every((e=>e.finished))),Qi=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),$i=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),er=e=>({value:e,cancelled:!0,finished:!1});function tr(e,t,n,s){let{callId:i,parentId:r,onRest:o}=t,{asyncTo:a,promise:l}=n;return r||e!==a||t.reset?n.promise=(async()=>{n.asyncId=i,n.asyncTo=e;let c,u,d,h=Di(t,((e,t)=>"onRest"===t?void 0:e)),p=new Promise(((e,t)=>(c=e,u=t))),f=e=>{let t=i<=(n.cancelId||0)&&er(s)||i!==n.asyncId&&$i(s,!1);if(t)throw e.result=t,u(e),e},m=(e,t)=>{let r=new sr,o=new ir;return(async()=>{if(Zn.skipAnimation)throw nr(n),o.result=$i(s,!1),u(o),o;f(r);let a=Yn.obj(e)?{...e}:{...t,to:e};a.parentId=i,Qn(h,((e,t)=>{Yn.und(a[t])&&(a[t]=e)}));let l=await s.start(a);return f(r),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),l})()};if(Zn.skipAnimation)return nr(n),$i(s,!1);try{let t;t=Yn.arr(e)?(async e=>{for(let t of e)await m(t)})(e):Promise.resolve(e(m,s.stop.bind(s))),await Promise.all([t.then(c),p]),d=$i(s.get(),!0,!1)}catch(e){if(e instanceof sr)d=e.result;else{if(!(e instanceof ir))throw e;d=e.result}}finally{i==n.asyncId&&(n.asyncId=r,n.asyncTo=r?a:void 0,n.promise=r?l:void 0)}return Yn.fun(o)&&En.batchedUpdates((()=>{o(d,s,s.item)})),d})():l}function nr(e,t){es(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var sr=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},ir=class extends Error{result;constructor(){super("SkipAnimationSignal")}},rr=e=>e instanceof ar,or=1,ar=class extends Xs{id=or++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=yi(this);return e&&e.getValue()}to(...e){return Zn.to(this,e)}interpolate(...e){return pi(`${di}The "interpolate" function is deprecated in v9 (use "to" instead)`),Zn.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Ys(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||ps.sort(this),Ys(this,{type:"priority",parent:this,priority:e})}},lr=Symbol.for("SpringPhase"),cr=e=>(1&e[lr])>0,ur=e=>(2&e[lr])>0,dr=e=>(4&e[lr])>0,hr=(e,t)=>t?e[lr]|=3:e[lr]&=-3,pr=(e,t)=>t?e[lr]|=4:e[lr]&=-5,fr=class extends ar{key;animation=new Yi;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!Yn.und(e)||!Yn.und(t)){let n=Yn.obj(e)?{...e}:{...t,from:e};Yn.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(ur(this)||this._state.asyncTo)||dr(this)}get goal(){return Zs(this.animation.to)}get velocity(){let e=yi(this);return e instanceof ji?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return cr(this)}get isAnimating(){return ur(this)}get isPaused(){return dr(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,s=this.animation,{config:i,toValues:r}=s,o=wi(s.to);!o&&qs(s.to)&&(r=$n(Zs(s.to))),s.values.forEach(((a,l)=>{if(a.done)return;let c=a.constructor==Si?1:o?o[l].lastPosition:r[l],u=s.immediate,d=c;if(!u){if(d=a.lastPosition,i.tension<=0)return void(a.done=!0);let t,n=a.elapsedTime+=e,r=s.fromValues[l],o=null!=a.v0?a.v0:a.v0=Yn.arr(i.velocity)?i.velocity[l]:i.velocity,h=i.precision||(r==c?.005:Math.min(1,.001*Math.abs(c-r)));if(Yn.und(i.duration))if(i.decay){let e=!0===i.decay?.998:i.decay,s=Math.exp(-(1-e)*n);d=r+o/(1-e)*(1-s),u=Math.abs(a.lastPosition-d)<=h,t=o*s}else{t=null==a.lastVelocity?o:a.lastVelocity;let n,s=i.restVelocity||h/10,l=i.clamp?0:i.bounce,p=!Yn.und(l),f=r==c?a.v0>0:rs,n||(u=Math.abs(c-d)<=h,!u));++e){p&&(m=d==c||d>c==f,m&&(t=-t*l,d=c)),t+=(1e-6*-i.tension*(d-c)+.001*-i.friction*t)/i.mass*g,d+=t*g}}else{let s=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,a.durationProgress>0&&(a.elapsedTime=i.duration*a.durationProgress,n=a.elapsedTime+=e)),s=(i.progress||0)+n/this._memoizedDuration,s=s>1?1:s<0?0:s,a.durationProgress=s),d=r+i.easing(s)*(c-r),t=(d-a.lastPosition)/e,u=1==s}a.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}o&&!o[l].done&&(u=!1),u?a.done=!0:t=!1,a.setValue(d,i.round)&&(n=!0)}));let a=yi(this),l=a.getValue();if(t){let e=Zs(s.to);l===e&&!n||i.decay?n&&i.decay&&this._onChange(l):(a.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(l)}set(e){return En.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(ur(this)){let{to:e,config:t}=this.animation;En.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Yn.und(e)?(n=this.queue||[],this.queue=[]):n=[Yn.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>Ji(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),nr(this._state,e&&this._lastCallId),En.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:n,from:s}=e;n=Yn.obj(n)?n[t]:n,(null==n||Ui(n))&&(n=void 0),s=Yn.obj(s)?s[t]:s,null==s&&(s=void 0);let i={to:n,from:s};return cr(this)||(e.reverse&&([n,s]=[s,n]),s=Zs(s),Yn.und(s)?yi(this)||this._set(n):this._set(s)),i}_update({...e},t){let{key:n,defaultProps:s}=this;e.default&&Object.assign(s,Di(e,((e,t)=>/^on/.test(t)?Fi(e,n):e))),br(this,e,"onProps"),wr(this,"onProps",e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let r=this._state;return Xi(++this._lastCallId,{key:n,props:e,defaultProps:s,state:r,actions:{pause:()=>{dr(this)||(pr(this,!0),ss(r.pauseQueue),wr(this,"onPause",$i(this,mr(this,this.animation.to)),this))},resume:()=>{dr(this)&&(pr(this,!1),ur(this)&&this._resume(),ss(r.resumeQueue),wr(this,"onResume",$i(this,mr(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){let t=gr(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(er(this));let s=!Yn.und(e.to),i=!Yn.und(e.from);if(s||i){if(!(t.callId>this._lastToId))return n(er(this));this._lastToId=t.callId}let{key:r,defaultProps:o,animation:a}=this,{to:l,from:c}=a,{to:u=l,from:d=c}=e;i&&!s&&(!t.default||Yn.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let h=!Xn(d,c);h&&(a.from=d),d=Zs(d);let p=!Xn(u,l);p&&this._focus(u);let f=Ui(t.to),{config:m}=a,{decay:g,velocity:v}=m;(s||i)&&(m.velocity=0),t.config&&!f&&function(e,t,n){n&&(Zi(n={...n},t),t={...n,...t}),Zi(e,t),Object.assign(e,t);for(let t in Wi)null==e[t]&&(e[t]=Wi[t]);let{mass:s,frequency:i,damping:r}=e;Yn.und(i)||(i<.01&&(i=.01),r<0&&(r=0),e.tension=Math.pow(2*Math.PI/i,2)*s,e.friction=4*Math.PI*r*s/i)}(m,Mi(t.config,r),t.config!==o.config?Mi(o.config,r):void 0);let x=yi(this);if(!x||Yn.und(u))return n($i(this,!0));let y=Yn.und(t.reset)?i&&!t.default:!Yn.und(d)&&Vi(t.reset,r),b=y?d:this.get(),w=Hi(u),_=Yn.num(w)||Yn.arr(w)||fi(w),j=!f&&(!_||Vi(o.immediate||t.immediate,r));if(p){let e=Ii(u);if(e!==x.constructor){if(!j)throw Error(`Cannot animate between ${x.constructor.name} and ${e.name}, as the "to" prop suggests`);x=this._set(w)}}let S=x.constructor,C=qs(u),k=!1;if(!C){let e=y||!cr(this)&&h;(p||e)&&(k=Xn(Hi(b),w),C=!k),(!Xn(a.immediate,j)&&!j||!Xn(m.decay,g)||!Xn(m.velocity,v))&&(C=!0)}if(k&&ur(this)&&(a.changed&&!y?C=!0:C||this._stop(l)),!f&&((C||qs(l))&&(a.values=x.getPayload(),a.toValues=qs(u)?null:S==Si?[1]:$n(w)),a.immediate!=j&&(a.immediate=j,!j&&!y&&this._set(l)),C)){let{onRest:e}=a;Jn(yr,(e=>br(this,t,e)));let s=$i(this,mr(this,l));ss(this._pendingCalls,s),this._pendingCalls.add(n),a.changed&&En.batchedUpdates((()=>{a.changed=!y,e?.(s,this),y?Mi(o.onRest,s):a.onStart?.(s,this)}))}y&&this._set(b),f?n(tr(t.to,t,this._state,this)):C?this._start():ur(this)&&!p?this._pendingCalls.add(n):n(Qi(b))}_focus(e){let t=this.animation;e!==t.to&&(Ks(this)&&this._detach(),t.to=e,Ks(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;qs(t)&&(Qs(t,this),rr(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;qs(e)&&$s(e,this)}_set(e,t=!0){let n=Zs(e);if(!Yn.und(n)){let e=yi(this);if(!e||!Xn(n,e.getValue())){let s=Ii(n);e&&e.constructor==s?e.setValue(n):bi(this,s.create(n)),e&&En.batchedUpdates((()=>{this._onChange(n,t)}))}}return yi(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,wr(this,"onStart",$i(this,mr(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Mi(this.animation.onChange,e,this)),Mi(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;yi(this).reset(Zs(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),ur(this)||(hr(this,!0),dr(this)||this._resume())}_resume(){Zn.skipAnimation?this.finish():ps.start(this)}_stop(e,t){if(ur(this)){hr(this,!1);let n=this.animation;Jn(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Ys(this,{type:"idle",parent:this});let s=t?er(this.get()):$i(this.get(),mr(this,e??n.to));ss(this._pendingCalls,s),n.changed&&(n.changed=!1,wr(this,"onRest",s,this))}}};function mr(e,t){let n=Hi(t);return Xn(Hi(e.get()),n)}function gr(e,t=e.loop,n=e.to){let s=Mi(t);if(s){let i=!0!==s&&Gi(s),r=(i||e).reverse,o=!i||i.reset;return vr({...e,loop:t,default:!1,pause:void 0,to:!r||Ui(n)?n:void 0,from:o?e.from:void 0,reset:o,...i})}}function vr(e){let{to:t,from:n}=e=Gi(e),s=new Set;return Yn.obj(t)&&xr(t,s),Yn.obj(n)&&xr(n,s),e.keys=s.size?Array.from(s):null,e}function xr(e,t){Qn(e,((e,n)=>null!=e&&t.add(n)))}var yr=["onStart","onRest","onChange","onPause","onResume"];function br(e,t,n){e.animation[n]=t[n]!==Ri(t,n)?Fi(t[n],e.key):void 0}function wr(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var _r=["onStart","onChange","onRest"],jr=1,Sr=class{id=jr++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(let t in e){let n=e[t];Yn.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(vr(e)),this}start(e){let{queue:t}=this;return e?t=$n(e).map(vr):this.queue=[],this._flush?this._flush(this,t):(Ir(this,t),Cr(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;Jn($n(t),(t=>n[t].stop(!!e)))}else nr(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(Yn.und(e))this.start({pause:!0});else{let t=this.springs;Jn($n(e),(e=>t[e].pause()))}return this}resume(e){if(Yn.und(e))this.start({pause:!1});else{let t=this.springs;Jn($n(e),(e=>t[e].resume()))}return this}each(e){Qn(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,s=this._active.size>0,i=this._changed.size>0;(s&&!this._started||i&&!this._started)&&(this._started=!0,es(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let r=!s&&this._started,o=i||r&&n.size?this.get():null;i&&t.size&&es(t,(([e,t])=>{t.value=o,e(t,this,this._item)})),r&&(this._started=!1,es(n,(([e,t])=>{t.value=o,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}En.onFrame(this._onFrame)}};function Cr(e,t){return Promise.all(t.map((t=>kr(e,t)))).then((t=>Ji(e,t)))}async function kr(e,t,n){let{keys:s,to:i,from:r,loop:o,onRest:a,onResolve:l}=t,c=Yn.obj(t.default)&&t.default;o&&(t.loop=!1),!1===i&&(t.to=null),!1===r&&(t.from=null);let u=Yn.arr(i)||Yn.fun(i)?i:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):Jn(_r,(n=>{let s=t[n];if(Yn.fun(s)){let i=e._events[n];t[n]=({finished:e,cancelled:t})=>{let n=i.get(s);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):i.set(s,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,ss(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let h=(s||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),p=!0===t.cancel||!0===Ri(t,"cancel");(u||p&&d.asyncId)&&h.push(Xi(++e._lastAsyncId,{props:t,state:d,actions:{pause:Kn,resume:Kn,start(t,n){p?(nr(d,e._lastAsyncId),n(er(e))):(t.onRest=a,n(tr(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let f=Ji(e,await Promise.all(h));if(o&&f.finished&&(!n||!f.noop)){let n=gr(t,o,i);if(n)return Ir(e,[n]),kr(e,n,!0)}return l&&En.batchedUpdates((()=>l(f,e,e.item))),f}function Er(e,t){let n=new fr;return n.key=e,t&&Qs(n,t),n}function Pr(e,t,n){t.keys&&Jn(t.keys,(s=>{(e[s]||(e[s]=n(s)))._prepareNode(t)}))}function Ir(e,t){Jn(t,(t=>{Pr(e.springs,t,(t=>Er(t,e)))}))}var Tr=({children:e,...t})=>{let n=(0,Un.useContext)(Or),s=t.pause||!!n.pause,i=t.immediate||!!n.immediate;t=function(e,t){let[n]=(0,Un.useState)((()=>({inputs:t,result:e()}))),s=(0,Un.useRef)(),i=s.current,r=i;return r?Boolean(t&&r.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{s.current=r,i==n&&(n.inputs=n.result=void 0)}),[r]),r.result}((()=>({pause:s,immediate:i})),[s,i]);let{Provider:r}=Or;return Un.createElement(r,{value:t},e)},Or=function(e,t){return Object.assign(e,Un.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(Tr,{});Tr.Provider=Or.Provider,Tr.Consumer=Or.Consumer;var Ar=class extends ar{constructor(e,t){super(),this.source=e,this.calc=Fs(...t);let n=this._get(),s=Ii(n);bi(this,s.create(n))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();Xn(t,this.get())||(yi(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Mr(this._active)&&Vr(this)}_get(){let e=Yn.arr(this.source)?this.source.map(Zs):$n(Zs(this.source));return this.calc(...e)}_start(){this.idle&&!Mr(this._active)&&(this.idle=!1,Jn(wi(this),(e=>{e.done=!1})),Zn.skipAnimation?(En.batchedUpdates((()=>this.advance())),Vr(this)):ps.start(this))}_attach(){let e=1;Jn($n(this.source),(t=>{qs(t)&&Qs(t,this),rr(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){Jn($n(this.source),(e=>{qs(e)&&$s(e,this)})),this._active.clear(),Vr(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=$n(this.source).reduce(((e,t)=>Math.max(e,(rr(t)?t.priority:0)+1)),0))}};function Nr(e){return!1!==e.idle}function Mr(e){return!e.size||Array.from(e).every(Nr)}function Vr(e){e.idle||(e.idle=!0,Jn(wi(e),(e=>{e.done=!0})),Ys(e,{type:"idle",parent:e}))}Zn.assign({createStringInterpolator:ui,to:(e,t)=>new Ar(e,t)});ps.advance;const Fr=window.ReactDOM;var Rr=/^--/;function Br(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||Rr.test(e)||Lr.hasOwnProperty(e)&&Lr[e]?(""+t).trim():t+"px"}var Dr={};var Lr={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zr=["Webkit","Ms","Moz","O"];Lr=Object.keys(Lr).reduce(((e,t)=>(zr.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Lr);var Gr=/^(matrix|translate|scale|rotate|skew)/,Hr=/^(translate)/,Ur=/^(rotate|skew)/,Wr=(e,t)=>Yn.num(e)&&0!==e?e+t:e,qr=(e,t)=>Yn.arr(e)?e.every((e=>qr(e,t))):Yn.num(e)?e===t:parseFloat(e)===t,Zr=class extends ki{constructor({x:e,y:t,z:n,...s}){let i=[],r=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),r.push((e=>[`translate3d(${e.map((e=>Wr(e,"px"))).join(",")})`,qr(e,0)]))),Qn(s,((e,t)=>{if("transform"===t)i.push([e||""]),r.push((e=>[e,""===e]));else if(Gr.test(t)){if(delete s[t],Yn.und(e))return;let n=Hr.test(t)?"px":Ur.test(t)?"deg":"";i.push($n(e)),r.push("rotate3d"===t?([e,t,s,i])=>[`rotate3d(${e},${t},${s},${Wr(i,n)})`,qr(i,0)]:e=>[`${t}(${e.map((e=>Wr(e,n))).join(",")})`,qr(e,t.startsWith("scale")?1:0)])}})),i.length&&(s.transform=new Kr(i,r)),super(s)}},Kr=class extends Xs{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return Jn(this.inputs,((n,s)=>{let i=Zs(n[0]),[r,o]=this.transforms[s](Yn.arr(i)?i:n.map(Zs));e+=" "+r,t=t&&o})),t?"none":e}observerAdded(e){1==e&&Jn(this.inputs,(e=>Jn(e,(e=>qs(e)&&Qs(e,this)))))}observerRemoved(e){0==e&&Jn(this.inputs,(e=>Jn(e,(e=>qs(e)&&$s(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),Ys(this,e)}};Zn.assign({batchedUpdates:Fr.unstable_batchedUpdates,createStringInterpolator:ui,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var Yr=((e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=e=>new ki(e),getComponentProps:s=e=>e}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:s},r=e=>{let t=Ni(e)||"Anonymous";return(e=Yn.str(e)?r[e]||(r[e]=Ti(e,i)):e[Ai]||(e[Ai]=Ti(e,i))).displayName=`Animated(${t})`,e};return Qn(e,((t,n)=>{Yn.arr(e)&&(n=Ni(t)),r[n]=r(t)})),{animated:r}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:s,children:i,scrollTop:r,scrollLeft:o,viewBox:a,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>n||e.hasAttribute(t)?t:Dr[t]||(Dr[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==i&&(e.textContent=i);for(let t in s)if(s.hasOwnProperty(t)){let n=Br(t,s[t]);Rr.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==r&&(e.scrollTop=r),void 0!==o&&(e.scrollLeft=o),void 0!==a&&e.setAttribute("viewBox",a)},createAnimatedStyle:e=>new Zr(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n});Yr.animated;const Xr=function({triggerAnimationOnChange:e}){const t=(0,d.useRef)(),{previous:n,prevRect:s}=(0,d.useMemo)((()=>{return{previous:t.current&&(e=t.current,{top:e.offsetTop,left:e.offsetLeft}),prevRect:t.current&&t.current.getBoundingClientRect()};var e}),[e]);return(0,d.useLayoutEffect)((()=>{if(!n||!t.current)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=new Sr({x:0,y:0,width:s.width,height:s.height,config:{duration:400,easing:Hs.easeInOutQuint},onChange({value:e}){if(!t.current)return;let{x:n,y:s,width:i,height:r}=e;n=Math.round(n),s=Math.round(s),i=Math.round(i),r=Math.round(r);const o=0===n&&0===s;t.current.style.transformOrigin="center center",t.current.style.transform=o?null:`translate3d(${n}px,${s}px,0)`,t.current.style.width=o?null:`${i}px`,t.current.style.height=o?null:`${r}px`}});t.current.style.transform=void 0;const i=t.current.getBoundingClientRect(),r=Math.round(s.left-i.left),o=Math.round(s.top-i.top),a=i.width,l=i.height;return e.start({x:0,y:0,width:a,height:l,from:{x:r,y:o,width:s.width,height:s.height}}),()=>{e.stop(),e.set({x:0,y:0,width:s.width,height:s.height})}}),[n,s]),t},Jr=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})});function Qr(){return!!(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview")}function $r(){return Qr()?(0,Qt.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useLocation:eo}=te(Gt.privateApis);function to({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,showReviewMessage:s,icon:i,size:r,__next40pxDefaultSize:o=!1}){const{params:a}=eo(),{setIsSaveViewOpened:c}=(0,l.useDispatch)(zt),{saveDirtyEntities:u}=te((0,l.useDispatch)(h.store)),{dirtyEntityRecords:d}=(0,h.useEntitiesSavedStatesIsDirty)(),{isSaving:p,isSaveViewOpen:f,previewingThemeName:m}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:t,isResolving:n}=e(_.store),{isSaveViewOpened:s}=e(zt),i=n("activateTheme"),r=$r();return{isSaving:d.some((e=>t(e.kind,e.name,e.key)))||i,isSaveViewOpen:s(),previewingThemeName:r?e(_.store).getTheme(r)?.name?.rendered:void 0}}),[d]),g=!!d.length;let v;1===d.length&&(a.postId?v=`${d[0].key}`===a.postId&&d[0].name===a.postType:a.path?.includes("wp_global_styles")&&(v="globalStyles"===d[0].name));const x=p||!g&&!Qr(),w=Qr()?p?(0,b.sprintf)((0,b.__)("Activating %s"),m):x?(0,b.__)("Saved"):g?(0,b.sprintf)((0,b.__)("Activate %s & Save"),m):(0,b.sprintf)((0,b.__)("Activate %s"),m):p?(0,b.__)("Saving"):x?(0,b.__)("Saved"):!v&&s?(0,b.sprintf)((0,b._n)("Review %d change…","Review %d changes…",d.length),d.length):(0,b.__)("Save"),j=v?()=>u({dirtyEntityRecords:d}):()=>c(!0);return(0,oe.jsx)(y.Button,{variant:t,className:e,"aria-disabled":x,"aria-expanded":f,isBusy:p,onClick:x?void 0:j,label:w,shortcut:x?void 0:Jt.displayShortcut.primary("s"),showTooltip:n,icon:i,__next40pxDefaultSize:o,size:r,children:w})}function no(){const{isDisabled:e,isSaving:t}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n}=e(_.store),s=t(),i=s.some((e=>n(e.kind,e.name,e.key)));return{isSaving:i,isDisabled:i||!s.length&&!Qr()}}),[]);return(0,oe.jsx)(y.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4,children:(0,oe.jsx)(to,{className:"edit-site-save-hub__button",variant:e?null:"primary",showTooltip:!1,icon:e&&!t?Jr:null,showReviewMessage:!0,__next40pxDefaultSize:!0})})}const{useHistory:so,useLocation:io}=te(Gt.privateApis);const ro=window.wp.apiFetch;var oo=i.n(ro);const{EntitiesSavedStatesExtensible:ao,NavigableRegion:lo}=te(h.privateApis),{useLocation:co}=te(Gt.privateApis),uo=({onClose:e,renderDialog:t,variant:n})=>{var s,i;const r=(0,h.useEntitiesSavedStatesIsDirty)();let o;o=r.isDirty?(0,b.__)("Activate & Save"):(0,b.__)("Activate");const a=function(){const[e,t]=(0,d.useState)();return(0,d.useEffect)((()=>{const e=(0,Qt.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});oo()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),c=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()),[]),u=(0,oe.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(s=a?.name?.rendered)&&void 0!==s?s:"...",null!==(i=c?.name?.rendered)&&void 0!==i?i:"...")}),p=function(){const e=so(),{path:t}=io(),{startResolution:n,finishResolution:s}=(0,l.useDispatch)(_.store);return async()=>{if(Qr()){const i="themes.php?action=activate&stylesheet="+$r()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;n("activateTheme"),await window.fetch(i),s("activateTheme"),e.navigate((0,Qt.addQueryArgs)(t,{wp_theme_preview:""}))}}}();return(0,oe.jsx)(ao,{...r,additionalPrompt:u,close:e,onSave:async e=>(await p(),e),saveEnabled:!0,saveLabel:o,renderDialog:t,variant:n})},ho=({onClose:e,renderDialog:t,variant:n})=>Qr()?(0,oe.jsx)(uo,{onClose:e,renderDialog:t,variant:n}):(0,oe.jsx)(h.EntitiesSavedStates,{close:e,renderDialog:t,variant:n});function po(){const{query:e}=co(),{canvas:t="view"}=e,{isSaveViewOpen:n,isDirty:s,isSaving:i}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n,isResolving:s}=e(_.store),i=t(),r=s("activateTheme"),{isSaveViewOpened:o}=te(e(zt));return{isSaveViewOpen:o(),isDirty:i.length>0,isSaving:i.some((e=>n(e.kind,e.name,e.key)))||r}}),[]),{setIsSaveViewOpened:r}=(0,l.useDispatch)(zt),o=()=>r(!1);if((0,d.useEffect)((()=>{r(!1)}),[t,r]),"view"===t)return n?(0,oe.jsx)(y.Modal,{className:"edit-site-save-panel__modal",onRequestClose:o,title:(0,b.__)("Review changes"),size:"small",children:(0,oe.jsx)(ho,{onClose:o,variant:"inline"})}):null;const a=Qr()||s,c=i||!a;return(0,oe.jsxs)(lo,{className:Ut("edit-site-layout__actions",{"is-entity-save-view-open":n}),ariaLabel:(0,b.__)("Save panel"),children:[(0,oe.jsx)("div",{className:Ut("edit-site-editor__toggle-save-panel",{"screen-reader-text":n}),children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>r(!0),"aria-haspopup":"dialog",disabled:c,accessibleWhenDisabled:!0,children:(0,b.__)("Open save panel")})}),n&&(0,oe.jsx)(ho,{onClose:o,renderDialog:!0})]})}const{useCommands:fo}=te(qt.privateApis),{useGlobalStyle:mo}=te(x.privateApis),{NavigableRegion:go,GlobalStylesProvider:vo}=te(h.privateApis),{useLocation:xo}=te(Gt.privateApis),yo=.3;function bo(){const{query:e,name:t,areas:n,widths:s}=xo(),{canvas:i="view"}=e;fo();const r=(0,v.useViewportMatch)("medium","<"),o=(0,d.useRef)(),a=(0,y.__unstableUseNavigateRegions)(),c=(0,v.useReducedMotion)(),[u,p]=(0,v.useResizeObserver)(),m=Cn(),[g,x]=(0,d.useState)(!1),w=Xr({triggerAnimationOnChange:t+"-"+i}),{showIconLabels:_}=(0,l.useSelect)((e=>({showIconLabels:e(f.store).get("core","showIconLabels")}))),[j]=mo("color.background"),[S]=mo("color.gradient"),C=(0,v.usePrevious)(i);return(0,d.useEffect)((()=>{"edit"===C&&o.current?.focus()}),[i]),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(h.UnsavedChangesWarning,{}),(0,oe.jsx)(Wt.CommandMenu,{}),"view"===i&&(0,oe.jsx)(jn,{}),(0,oe.jsx)("div",{...a,ref:a.ref,className:Ut("edit-site-layout",a.className,{"is-full-canvas":"edit"===i,"show-icon-labels":_}),children:(0,oe.jsxs)("div",{className:"edit-site-layout__content",children:[(!r||!n.mobile)&&(0,oe.jsx)(go,{ariaLabel:(0,b.__)("Navigation"),className:"edit-site-layout__sidebar-region",children:(0,oe.jsx)(y.__unstableAnimatePresence,{children:"view"===i&&(0,oe.jsxs)(y.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:c||r?0:yo,ease:"easeOut"},className:"edit-site-layout__sidebar",children:[(0,oe.jsx)(dn,{ref:o,isTransparent:g}),(0,oe.jsx)(on,{children:(0,oe.jsx)(an,{shouldAnimate:"styles"!==t,routeKey:t,children:(0,oe.jsx)(h.ErrorBoundary,{children:n.sidebar})})}),(0,oe.jsx)(no,{}),(0,oe.jsx)(po,{})]})})}),(0,oe.jsx)(h.EditorSnackbars,{}),r&&n.mobile&&(0,oe.jsx)("div",{className:"edit-site-layout__mobile",children:(0,oe.jsx)(on,{children:"edit"!==i?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(hn,{ref:o,isTransparent:g}),(0,oe.jsx)(an,{routeKey:t,children:(0,oe.jsx)(h.ErrorBoundary,{children:n.mobile})}),(0,oe.jsx)(no,{}),(0,oe.jsx)(po,{})]}):(0,oe.jsx)(h.ErrorBoundary,{children:n.mobile})})}),!r&&n.content&&"edit"!==i&&(0,oe.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.content},children:(0,oe.jsx)(h.ErrorBoundary,{children:n.content})}),!r&&n.edit&&"edit"!==i&&(0,oe.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:s?.edit},children:(0,oe.jsx)(h.ErrorBoundary,{children:n.edit})}),!r&&n.preview&&(0,oe.jsxs)("div",{className:"edit-site-layout__canvas-container",children:[u,!!p.width&&(0,oe.jsx)("div",{className:Ut("edit-site-layout__canvas",{"is-right-aligned":g}),ref:w,children:(0,oe.jsx)(h.ErrorBoundary,{children:(0,oe.jsx)(bn,{isReady:!m,isFullWidth:"edit"===i,defaultSize:{width:p.width-24,height:p.height},isOversized:g,setIsOversized:x,innerContentStyle:{background:null!=S?S:j},children:n.preview})})})]})]})})]})}function wo(e){const{createErrorNotice:t}=(0,l.useDispatch)(w.store);return(0,oe.jsx)(y.SlotFillProvider,{children:(0,oe.jsxs)(vo,{children:[(0,oe.jsx)(Zt.PluginArea,{onError:function(e){t((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,oe.jsx)(bo,{...e})]})})}const _o=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})}),jo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),So=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Co=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),ko=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Eo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Po=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),{useGlobalStylesReset:Io}=te(x.privateApis),{useHistory:To,useLocation:Oo}=te(Gt.privateApis),Ao=()=>function(){const{openGeneralSidebar:e}=te((0,l.useDispatch)(zt)),{params:t}=Oo(),{canvas:n="view"}=t,s=To(),i=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>i?[{name:"core/edit-site/open-styles",label:(0,b.__)("Open styles"),callback:({close:t})=>{t(),"edit"!==n&&s.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles")},icon:_o}]:[]),[s,e,n,i])}},No=()=>function(){const{openGeneralSidebar:e}=te((0,l.useDispatch)(zt)),{params:t}=Oo(),{canvas:n="view"}=t,{set:s}=(0,l.useDispatch)(f.store),i=To(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,b.__)("Learn about styles"),callback:({close:t})=>{t(),"edit"!==n&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),s("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{s("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:jo}]:[]),[i,e,n,r,s])}},Mo=()=>function(){const[e,t]=Io();return{isLoading:!1,commands:(0,d.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,b.__)("Reset styles"),icon:(0,b.isRTL)()?So:Co,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}},Vo=()=>function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t}=te((0,l.useDispatch)(zt)),{params:n}=Oo(),{canvas:s="view"}=n,i=To(),{canEditCSS:r}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles-css",label:(0,b.__)("Customize CSS"),icon:ko,callback:({close:n})=>{n(),"edit"!==s&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[i,e,t,r,s])}},Fo=()=>function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t}=te((0,l.useDispatch)(zt)),{params:n}=Oo(),{canvas:s="view"}=n,i=To(),r=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return!!i?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-global-styles-revisions",label:(0,b.__)("Style revisions"),icon:Eo,callback:({close:n})=>{n(),"edit"!==s&&i.navigate("/styles?canvas=edit",{transition:"canvas-mode-edit-transition"}),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[r,i,e,t,s])}};const Ro=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),{EditorContentSlotFill:Bo,ResizableEditor:Do}=te(h.privateApis);function Lo(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""}}function zo(){const e=(0,y.__experimentalUseSlotFills)(Bo.name);return!!e?.length}const Go=function({children:e,closeButtonLabel:t,onClose:n,enableResizing:s=!1}){const{editorCanvasContainerView:i,showListViewByDefault:r}=(0,l.useSelect)((e=>({editorCanvasContainerView:te(e(zt)).getEditorCanvasContainerView(),showListViewByDefault:e(f.store).get("core","showListViewByDefault")})),[]),[o,a]=(0,d.useState)(!1),{setEditorCanvasContainerView:c}=te((0,l.useDispatch)(zt)),{setIsListViewOpened:u}=(0,l.useDispatch)(h.store),p=(0,v.useFocusOnMount)("firstElement"),m=(0,v.useFocusReturn)();function g(){u(r),c(void 0),a(!0),"function"==typeof n&&n()}const x=Array.isArray(e)?d.Children.map(e,((e,t)=>0===t?(0,d.cloneElement)(e,{ref:m}):e)):(0,d.cloneElement)(e,{ref:m});if(o)return null;const w=Lo(i),_=n||t;return(0,oe.jsx)(Bo.Fill,{children:(0,oe.jsx)("div",{className:"edit-site-editor-canvas-container",children:(0,oe.jsx)(Do,{enableResizing:s,children:(0,oe.jsxs)("section",{className:"edit-site-editor-canvas-container__section",ref:_?p:null,onKeyDown:function(e){e.keyCode!==Jt.ESCAPE||e.defaultPrevented||(e.preventDefault(),g())},"aria-label":w,children:[_&&(0,oe.jsx)(y.Button,{size:"compact",className:"edit-site-editor-canvas-container__close-button",icon:Ro,label:t||(0,b.__)("Close"),onClick:g}),x]})})})})},{useCommandContext:Ho}=te(Wt.privateApis),{useLocation:Uo}=te(Gt.privateApis);const Wo=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),qo=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,oe.jsx)(Yt.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"})]}),Zo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Ko=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Yo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),Xo=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})});function Jo(e){return(0,oe.jsx)(y.Button,{size:"compact",...e,className:Ut("edit-site-sidebar-button",e.className)})}const{useHistory:Qo,useLocation:$o}=te(Gt.privateApis);function ea({isRoot:e,title:t,actions:n,content:s,footer:i,description:r,backPath:o}){const{dashboardLink:a,dashboardLinkText:c,previewingThemeName:u}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt)),n=$r();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:n?e(_.store).getTheme(n)?.name?.rendered:void 0}}),[]),h=$o(),p=Qo(),{navigate:f}=(0,d.useContext)(nn),m=null!=o?o:h.state?.backPath,g=(0,b.isRTL)()?Yo:Xo;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.__experimentalVStack,{className:Ut("edit-site-sidebar-navigation-screen__main",{"has-footer":!!i}),spacing:0,justify:"flex-start",children:[(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon",children:[!e&&(0,oe.jsx)(Jo,{onClick:()=>{p.navigate(m),f("back")},icon:g,label:(0,b.__)("Back"),showTooltip:!1}),e&&(0,oe.jsx)(Jo,{icon:g,label:c||(0,b.__)("Go to the Dashboard"),href:a}),(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20,children:Qr()?(0,b.sprintf)((0,b.__)("Previewing %1$s: %2$s"),u,t):t}),n&&(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen__actions",children:n})]}),(0,oe.jsxs)("div",{className:"edit-site-sidebar-navigation-screen__content",children:[r&&(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen__description",children:r}),s]})]}),i&&(0,oe.jsx)("footer",{className:"edit-site-sidebar-navigation-screen__footer",children:i})]})}const ta=(0,d.forwardRef)((function({icon:e,size:t=24,...n},s){return(0,d.cloneElement)(e,{width:t,height:t,...n,ref:s})})),na=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),sa=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),{useHistory:ia,useLink:ra}=te(Gt.privateApis);function oa({className:e,icon:t,withChevron:n=!1,suffix:s,uid:i,to:r,onClick:o,children:a,...l}){const c=ia(),{navigate:u}=(0,d.useContext)(nn);const h=ra(r);return(0,oe.jsx)(y.__experimentalItem,{className:Ut("edit-site-sidebar-navigation-item",{"with-suffix":!n&&s},e),id:i,onClick:function(e){o?(o(e),u("forward")):r&&(e.preventDefault(),c.navigate(r),u("forward",`[id="${i}"]`))},href:r?h.href:void 0,...l,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[t&&(0,oe.jsx)(ta,{style:{fill:"currentcolor"},icon:t,size:24}),(0,oe.jsx)(y.FlexBlock,{children:a}),n&&(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?na:sa,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&s]})})}const aa={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},la={per_page:100,page:1},ca=[],{GlobalStylesContext:ua}=te(x.privateApis);function da({query:e}={}){const{user:t}=(0,d.useContext)(ua),n={...la,...e},{authors:s,currentUser:i,isDirty:r,revisions:o,isLoadingGlobalStylesRevisions:a,revisionsCount:c}=(0,l.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:s,getCurrentUser:i,getUsers:r,getRevisions:o,__experimentalGetCurrentGlobalStylesId:a,getEntityRecord:l,isResolving:c}=e(_.store),u=s(),d=i(),h=u.length>0,p=a(),f=p?l("root","globalStyles",p):void 0,m=null!==(t=f?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=o("root","globalStyles",p,n)||ca;return{authors:r(aa)||ca,currentUser:d,isDirty:h,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,n]),revisionsCount:m}}),[e]);return(0,d.useMemo)((()=>{if(!s.length||a)return{revisions:ca,hasUnsavedChanges:r,isLoading:!0,revisionsCount:c};const e=o.map((e=>({...e,author:s.find((t=>t.id===e.author))})));if(o.length){if("unsaved"!==e[0].id&&1===n.page&&(e[0].isLatest=!0),r&&t&&Object.keys(t).length>0&&i&&1===n.page){const n={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:i?.name,avatar_urls:i?.avatar_urls},modified:new Date};e.unshift(n)}n.page===Math.ceil(c/n.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:r,isLoading:!1,revisionsCount:c}}),[r,o,i,s,t,a])}function ha({record:e,revisionsCount:t,...n}){var s;const i={},r=null!==(s=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==s?s:null;return t=t||e?._links?.["version-history"]?.[0]?.count||0,r&&t>1&&(i.href=(0,Qt.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),i.as="a"),(0,oe.jsx)(y.__experimentalItemGroup,{size:"large",className:"edit-site-sidebar-navigation-screen-details-footer",children:(0,oe.jsx)(oa,{icon:Eo,...i,...n,children:(0,b.sprintf)((0,b._n)("%d Revision","%d Revisions",t),t)})})}const{useLocation:pa,useHistory:fa}=te(Gt.privateApis);function ma(e){const{name:t}=pa();return(0,oe.jsx)(oa,{...e,"aria-current":"styles"===t})}function ga(){const e=fa(),{path:t}=pa(),{revisions:n,isLoading:s,revisionsCount:i}=da(),{openGeneralSidebar:r}=(0,l.useDispatch)(zt),{setEditorCanvasContainerView:o}=te((0,l.useDispatch)(zt)),{set:a}=(0,l.useDispatch)(f.store),c=(0,d.useCallback)((async()=>(e.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),Promise.all([a("core","distractionFree",!1),r("edit-site/global-styles")]))),[t,e,r,a]),u=(0,d.useCallback)((async()=>{await c(),o("global-styles-revisions")}),[c,o]),h=!!i&&!s;return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(ea,{title:(0,b.__)("Design"),isRoot:!0,description:(0,b.__)("Customize the appearance of your website using the block editor."),content:(0,oe.jsx)(va,{activeItem:"styles-navigation-item"}),footer:h&&(0,oe.jsx)(ha,{record:n?.[0],revisionsCount:i,onClick:u})})})}function va({isBlockBasedTheme:e=!0}){return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-main",children:[e&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(oa,{uid:"navigation-navigation-item",to:"/navigation",withChevron:!0,icon:Wo,children:(0,b.__)("Navigation")}),(0,oe.jsx)(ma,{to:"/styles",uid:"global-styles-navigation-item",icon:_o,children:(0,b.__)("Styles")}),(0,oe.jsx)(oa,{uid:"page-navigation-item",to:"/page",withChevron:!0,icon:qo,children:(0,b.__)("Pages")}),(0,oe.jsx)(oa,{uid:"template-navigation-item",to:"/template",withChevron:!0,icon:Zo,children:(0,b.__)("Templates")})]}),!e&&(0,oe.jsx)(oa,{uid:"stylebook-navigation-item",to:"/stylebook",withChevron:!0,icon:_o,children:(0,b.__)("Styles")}),(0,oe.jsx)(oa,{uid:"patterns-navigation-item",to:"/pattern",withChevron:!0,icon:Ko,children:(0,b.__)("Patterns")})]})}function xa({customDescription:e}){const t=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),{setEditorCanvasContainerView:n}=te((0,l.useDispatch)(zt));let s;return(0,d.useEffect)((()=>{n(void 0)}),[n]),s=e||(t?(0,b.__)("Customize the appearance of your website using the block editor."):(0,b.__)("Explore block styles and patterns to refine your site.")),(0,oe.jsx)(ea,{isRoot:!0,title:(0,b.__)("Design"),description:s,content:(0,oe.jsx)(va,{isBlockBasedTheme:t})})}function ya(){return(0,oe.jsx)(y.__experimentalSpacer,{padding:3,children:(0,oe.jsx)(y.Notice,{status:"warning",isDismissible:!1,children:(0,b.__)("The theme you are currently using does not support this screen.")})})}const ba=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z"})});function wa({nonAnimatedSrc:e,animatedSrc:t}){return(0,oe.jsxs)("picture",{className:"edit-site-welcome-guide__image",children:[(0,oe.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,oe.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function _a(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isBlockBasedTheme:n}=(0,l.useSelect)((e=>({isActive:!!e(f.store).get("core/edit-site","welcomeGuide"),isBlockBasedTheme:e(_.store).getCurrentTheme()?.is_block_theme})),[]);return t&&n?(0,oe.jsx)(y.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,oe.jsx)(wa,{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,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Edit your site")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Design everything on your site — from the header right down to the footer — using blocks.")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,d.createInterpolateElement)((0,b.__)("Click to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,oe.jsx)("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}const{interfaceStore:ja}=te(h.privateApis);function Sa(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isStylesOpen:n}=(0,l.useSelect)((e=>{const t=e(ja).getActiveComplementaryArea("core");return{isActive:!!e(f.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const s=(0,b.__)("Welcome to Styles");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:s,finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,oe.jsx)(wa,{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,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,oe.jsx)(wa,{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,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Set the design")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,oe.jsx)(wa,{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,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Personalize blocks")}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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,oe.jsx)(wa,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Learn more")}),(0,oe.jsxs)("p",{className:"edit-site-welcome-guide__text",children:[(0,b.__)("New to block themes and styling your site?")," ",(0,oe.jsx)(y.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,b.__)("Here’s a detailed guide to learn how to make the most of it.")})]})]})}]})}function Ca(){const{toggle:e}=(0,l.useDispatch)(f.store);if(!(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuidePage"),n=!!e(f.store).get("core/edit-site","welcomeGuide");return t&&!n}),[]))return null;const t=(0,b.__)("Editing a page");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:t,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,oe.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,oe.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:t}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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 ka(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,hasPreviousEntity:n}=(0,l.useSelect)((e=>{const{getEditorSettings:t}=e(h.store),{get:n}=e(f.store);return{isActive:n("core/edit-site","welcomeGuideTemplate"),hasPreviousEntity:!!t().onNavigateToPreviousEntityRecord}}),[]);if(!(t&&n))return null;const s=(0,b.__)("Editing a template");return(0,oe.jsx)(y.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,oe.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,oe.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})}),content:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,oe.jsx)("p",{className:"edit-site-welcome-guide__text",children:(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 Ea({postType:e}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_a,{}),(0,oe.jsx)(Sa,{}),"page"===e&&(0,oe.jsx)(Ca,{}),"wp_template"===e&&(0,oe.jsx)(ka,{})]})}const{useGlobalStylesOutput:Pa}=te(x.privateApis);function Ia({disableRootPadding:e}){return function(e){const[t,n]=Pa(e),{getSettings:s}=(0,l.useSelect)(zt),{updateSettings:i}=(0,l.useDispatch)(zt);(0,d.useEffect)((()=>{var e;if(!t||!n)return;const r=s(),o=Object.values(null!==(e=r.styles)&&void 0!==e?e:[]).filter((e=>!e.isGlobalStyles));i({...r,styles:[...o,...t],__experimentalFeatures:n})}),[t,n,i,s])}(e),null}const{Theme:Ta}=te(y.privateApis),{useGlobalStyle:Oa}=te(x.privateApis);function Aa({id:e}){var t;const[n]=Oa("color.text"),[s]=Oa("color.background"),{highlightedColors:i}=ie(),r=null!==(t=i[0]?.color)&&void 0!==t?t:n,{elapsed:o,total:a}=(0,l.useSelect)((e=>{var t,n;const s=e(_.store).countSelectorsByStatus(),i=null!==(t=s.resolving)&&void 0!==t?t:0,r=null!==(n=s.finished)&&void 0!==n?n:0;return{elapsed:r,total:r+i}}),[]);return(0,oe.jsx)("div",{className:"edit-site-canvas-loader",children:(0,oe.jsx)(Ta,{accent:r,background:s,children:(0,oe.jsx)(y.ProgressBar,{id:e,max:a,value:o})})})}const{useHistory:Na}=te(Gt.privateApis);const{useLocation:Ma,useHistory:Va}=te(Gt.privateApis);function Fa(){const{query:e}=Ma(),{canvas:t="view"}=e,n=function(){const e=Na();return(0,d.useCallback)((t=>{e.navigate(`/${t.postType}/${t.postId}?canvas=edit&focusMode=true`)}),[e])}(),{settings:s}=(0,l.useSelect)((e=>{const{getSettings:t}=e(zt);return{settings:t()}}),[]),i=function(){const e=Ma(),t=(0,v.usePrevious)(e),n=Va();return(0,d.useMemo)((()=>{const s=e.query.focusMode||e?.params?.postId&&Me.includes(e?.params?.postType),i="edit"===t?.query.canvas;return s&&i?()=>n.back():void 0}),[e,n])}();return(0,d.useMemo)((()=>({...s,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==t,onNavigateToEntityRecord:n,onNavigateToPreviousEntityRecord:i,isPreviewMode:"view"===t})),[s,t,n,i])}const{Fill:Ra,Slot:Ba}=(0,y.createSlotFill)("PluginTemplateSettingPanel"),Da=({children:e})=>{u()("wp.editSite.PluginTemplateSettingPanel",{since:"6.6",version:"6.8",alternative:"wp.editor.PluginDocumentSettingPanel"});return(0,l.useSelect)((e=>"wp_template"===e(h.store).getCurrentPostType()),[])?(0,oe.jsx)(Ra,{children:e}):null};Da.Slot=Ba;const La=Da,za=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),Ga=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});function Ha({className:e,...t}){return(0,oe.jsx)(y.Icon,{className:Ut(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Ua({icon:e,children:t,...n}){return(0,oe.jsxs)(y.__experimentalItem,{...n,children:[e&&(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(Ha,{icon:e,size:24}),(0,oe.jsx)(y.FlexItem,{children:t})]}),!e&&t]})}function Wa(e){return(0,oe.jsx)(y.Navigator.Button,{as:Ua,...e})}const qa=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Za=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),Ka=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z"})}),Ya=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})}),{useHasDimensionsPanel:Xa,useHasTypographyPanel:Ja,useHasColorPanel:Qa,useGlobalSetting:$a,useSettingsForBlockElement:el,useHasBackgroundPanel:tl}=te(x.privateApis);const nl=function(){const[e]=$a(""),t=el(e),n=tl(e),s=Ja(t),i=Qa(t),r=Xa(t);return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(y.__experimentalItemGroup,{children:[s&&(0,oe.jsx)(Wa,{icon:qa,path:"/typography",children:(0,b.__)("Typography")}),i&&(0,oe.jsx)(Wa,{icon:Za,path:"/colors",children:(0,b.__)("Colors")}),n&&(0,oe.jsx)(Wa,{icon:Ka,path:"/background","aria-label":(0,b.__)("Background styles"),children:(0,b.__)("Background")}),(0,oe.jsx)(Wa,{icon:Ya,path:"/shadows",children:(0,b.__)("Shadows")}),r&&(0,oe.jsx)(Wa,{icon:Zo,path:"/layout",children:(0,b.__)("Layout")})]})})};function sl(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,n=e.trim(),s=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return n.includes(",")?n.split(",").map(s).filter((e=>""!==e)).join(", "):s(n)}function il(e){if(!e)return"";let t=e.trim();return t.includes(",")&&(t=t.split(",").find((e=>""!==e.trim())).trim()),t=t.replace(/^["']|["']$/g,""),window.navigator.userAgent.toLowerCase().includes("firefox")&&(t=`"${t}"`),t}function rl(e){const t={fontFamily:sl(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const i=e.fontFace.filter((e=>e?.fontStyle&&"normal"===e.fontStyle.toLowerCase()));if(i.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]),s=parseInt(n[1]);for(let n=e;n<=s;n+=100)t.push(n)}else 1===n.length&&t.push(parseInt(n[0]))})),t}(i),r=(n=400,0===(s=e).length?null:(s.sort(((e,t)=>Math.abs(n-e)-Math.abs(n-t))),s[0]));t.fontWeight=String(r)||"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,s;return t}function ol(e){return e?`is-style-${e}`:""}function al(e,t){const n=new RegExp(`^${t}([\\d]+)$`);return e.reduce(((e,t)=>{if("string"==typeof t?.slug){const s=t?.slug.match(n);if(s){const t=parseInt(s[1],10);if(t>e)return t}}return e}),0)+1}function ll(e,t){if(!Array.isArray(e)||!t)return null;const n=t.replace("var(","").replace(")",""),s=n?.split("--").slice(-1)[0];return e.find((e=>e.slug===s))}const{useGlobalStyle:cl,GlobalStylesContext:ul}=te(x.privateApis),{mergeBaseAndUserConfigs:dl}=te(h.privateApis);function hl({fontSize:e,variation:t}){const{base:n}=(0,d.useContext)(ul);let s=n;t&&(s=dl(n,t));const[i]=cl("color.text"),[r,o]=function(e){const t=e?.settings?.typography?.fontFamilies?.theme,n=e?.settings?.typography?.fontFamilies?.custom;let s=[];t&&n?s=[...t,...n]:t?s=t:n&&(s=n);const i=e?.styles?.typography?.fontFamily,r=ll(s,i),o=e?.styles?.elements?.heading?.typography?.fontFamily;let a;return a=o?ll(s,e?.styles?.elements?.heading?.typography?.fontFamily):r,[r,a]}(s),a=r?rl(r):{},l=o?rl(o):{};return i&&(a.color=i,l.color=i),e&&(a.fontSize=e,l.fontSize=e),(0,oe.jsxs)(y.__unstableMotion.div,{animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},style:{textAlign:"center",lineHeight:1},children:[(0,oe.jsx)("span",{style:l,children:(0,b._x)("A","Uppercase letter A")}),(0,oe.jsx)("span",{style:a,children:(0,b._x)("a","Lowercase letter A")})]})}function pl({normalizedColorSwatchSize:e,ratio:t}){const{highlightedColors:n}=ie(),s=e*t;return n.map((({slug:e,color:t},n)=>(0,oe.jsx)(y.__unstableMotion.div,{style:{height:s,width:s,background:t,borderRadius:s/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}},`${e}-${n}`)))}const{useGlobalStyle:fl}=te(x.privateApis),ml={leading:!0,trailing:!0};function gl({children:e,label:t,isFocused:n,withHoverView:s}){const[i="white"]=fl("color.background"),[r]=fl("color.gradient"),o=(0,v.useReducedMotion)(),[a,l]=(0,d.useState)(!1),[c,{width:u}]=(0,v.useResizeObserver)(),[h,p]=(0,d.useState)(u),[f,m]=(0,d.useState)(),g=(0,v.useThrottle)(p,250,ml);(0,d.useLayoutEffect)((()=>{u&&g(u)}),[u,g]),(0,d.useLayoutEffect)((()=>{const e=h?h/248:1,t=e-(f||0);!(Math.abs(t)>.1)&&f||m(e)}),[h,f]);const x=f||(u?u/248:1),b=!!u;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("div",{style:{position:"relative"},children:c}),b&&(0,oe.jsx)("div",{className:"edit-site-global-styles-preview__wrapper",style:{height:152*x},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),tabIndex:-1,children:(0,oe.jsx)(y.__unstableMotion.div,{style:{height:152*x,width:"100%",background:null!=r?r:i,cursor:s?"pointer":void 0},initial:"start",animate:(a||n)&&!o&&t?"hover":"start",children:[].concat(e).map(((e,t)=>e({ratio:x,key:t})))})})]})}const{useGlobalStyle:vl}=te(x.privateApis),xl={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},yl={hover:{opacity:1},start:{opacity:.5}},bl={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},wl=({label:e,isFocused:t,withHoverView:n,variation:s})=>{const[i]=vl("typography.fontWeight"),[r="serif"]=vl("typography.fontFamily"),[o=r]=vl("elements.h1.typography.fontFamily"),[a=i]=vl("elements.h1.typography.fontWeight"),[l="black"]=vl("color.text"),[c=l]=vl("elements.h1.color.text"),{paletteColors:u}=ie();return(0,oe.jsxs)(gl,{label:e,isFocused:t,withHoverView:n,children:[({ratio:e,key:t})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:xl,style:{height:"100%",overflow:"hidden"},children:(0,oe.jsxs)(y.__experimentalHStack,{spacing:10*e,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,oe.jsx)(hl,{fontSize:65*e,variation:s}),(0,oe.jsx)(y.__experimentalVStack,{spacing:4*e,children:(0,oe.jsx)(pl,{normalizedColorSwatchSize:32,ratio:e})})]})},t),({key:e})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:n&&yl,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,oe.jsx)(y.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:u.slice(0,4).map((({color:e},t)=>(0,oe.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},t)))})},e),({ratio:t,key:n})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:bl,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,oe.jsx)(y.__experimentalVStack,{spacing:3*t,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*t,boxSizing:"border-box"},children:e&&(0,oe.jsx)("div",{style:{fontSize:40*t,fontFamily:o,color:c,fontWeight:a,lineHeight:"1em",textAlign:"center"},children:e})})},n)]})},{useGlobalStyle:_l}=te(x.privateApis);const jl=function(){const[e]=_l("css"),{hasVariations:t,canEditCSS:n}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n,__experimentalGetCurrentThemeGlobalStylesVariations:s}=e(_.store),i=n(),r=i?t("root","globalStyles",i):void 0;return{hasVariations:!!s()?.length,canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]);return(0,oe.jsxs)(y.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-root",isRounded:!1,children:[(0,oe.jsx)(y.CardBody,{children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.Card,{className:"edit-site-global-styles-screen-root__active-style-tile",children:(0,oe.jsx)(y.CardMedia,{className:"edit-site-global-styles-screen-root__active-style-tile-preview",children:(0,oe.jsx)(wl,{})})}),t&&(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/variations",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Browse styles")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})}),(0,oe.jsx)(nl,{})]})}),(0,oe.jsx)(y.CardDivider,{}),(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Customize the appearance of specific blocks for the whole site.")}),(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/blocks",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Blocks")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]}),n&&!!e&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.CardDivider,{}),(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Add your own CSS to customize the appearance and layout of your site.")}),(0,oe.jsx)(y.__experimentalItemGroup,{children:(0,oe.jsx)(Wa,{path:"/css",children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Additional CSS")}),(0,oe.jsx)(Ha,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]})]})]})},Sl=window.wp.a11y,{useGlobalStyle:Cl}=te(x.privateApis);function kl(e){const t=(0,l.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]),[n]=Cl("variations",e);return function(e,t){return e?.filter((e=>"block"===e.source||t.includes(e.name)))}(t,Object.keys(null!=n?n:{}))}function El({name:e}){const t=kl(e);return(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(((t,n)=>t?.isDefault?null:(0,oe.jsx)(Wa,{path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),children:t.label},n)))})}const Pl=function({title:e,description:t,onBack:n}){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",label:(0,b.__)("Back"),onClick:n}),(0,oe.jsx)(y.__experimentalSpacer,{children:(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,oe.jsx)("p",{className:"edit-site-global-styles-header__description",children:t})]})},{useHasDimensionsPanel:Il,useHasTypographyPanel:Tl,useHasBorderPanel:Ol,useGlobalSetting:Al,useSettingsForBlockElement:Nl,useHasColorPanel:Ml}=te(x.privateApis);function Vl(e){const[t]=Al("",e),n=Nl(t,e),s=Tl(n),i=Ml(n),r=Ol(n),o=Il(n),a=r||o,l=!!kl(e)?.length;return s||i||a||l}function Fl({block:e}){return Vl(e.name)?(0,oe.jsx)(Wa,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(x.BlockIcon,{icon:e.icon}),(0,oe.jsx)(y.FlexItem,{children:e.title})]})}):null}const Rl=(0,d.memo)((function({filterValue:e}){const t=function(){const e=(0,l.useSelect)((e=>e(o.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:s}=e;return(t.name.startsWith("core/")?n:s).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),n=(0,v.useDebounce)(Sl.speak,500),{isMatchingSearchTerm:s}=(0,l.useSelect)(o.store),i=e?t.filter((t=>s(t,e))):t,r=(0,d.useRef)();return(0,d.useEffect)((()=>{if(!e)return;const t=r.current.childElementCount,s=(0,b.sprintf)((0,b._n)("%d result found.","%d results found.",t),t);n(s,t)}),[e,n]),(0,oe.jsx)("div",{ref:r,className:"edit-site-block-types-item-list",role:"list",children:0===i.length?(0,oe.jsx)(y.__experimentalText,{align:"center",as:"p",children:(0,b.__)("No blocks found.")}):i.map((e=>(0,oe.jsx)(Fl,{block:e},"menu-itemblock-"+e.name)))})}));const Bl=function(){const[e,t]=(0,d.useState)(""),n=(0,d.useDeferredValue)(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Blocks"),description:(0,b.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,oe.jsx)(y.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,b.__)("Search"),placeholder:(0,b.__)("Search")}),(0,oe.jsx)(Rl,{filterValue:n})]})},Dl=({name:e,variation:t=""})=>{var n;const s=(0,o.getBlockType)(e)?.example,i=(0,d.useMemo)((()=>{if(!s)return null;const n={...s,attributes:{...s.attributes,style:void 0,className:t?ol(t):s.attributes?.className}};return(0,o.getBlockFromExample)(e,n)}),[e,s,t]),r=null!==(n=s?.viewportWidth)&&void 0!==n?n:500,a=144,l=235/r,c=0!==l&&l<1?a/l:a;return s?(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,marginBottom:4,children:(0,oe.jsx)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:a,boxSizing:"initial"},children:(0,oe.jsx)(x.BlockPreview,{blocks:i,viewportWidth:r,minHeight:a,additionalStyles:[{css:`\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${Math.round(c)}px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\t\t\t\t\t\t\t`}]})})}):null};const Ll=function({children:e,level:t}){return(0,oe.jsx)(y.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2,children:e})},zl={backgroundSize:"cover",backgroundPosition:"50% 50%"};function Gl(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:Hl,useHasTypographyPanel:Ul,useHasBorderPanel:Wl,useGlobalSetting:ql,useSettingsForBlockElement:Zl,useHasColorPanel:Kl,useHasFiltersPanel:Yl,useHasImageSettingsPanel:Xl,useGlobalStyle:Jl,useHasBackgroundPanel:Ql,BackgroundPanel:$l,BorderPanel:ec,ColorPanel:tc,TypographyPanel:nc,DimensionsPanel:sc,FiltersPanel:ic,ImageSettingsPanel:rc,AdvancedPanel:oc}=te(x.privateApis);const ac=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const s=n.join("."),[i]=Jl(s,e,"user",{shouldDecodeEncode:!1}),[r,a]=Jl(s,e,"all",{shouldDecodeEncode:!1}),[c]=ql("",e,"user"),[u,h]=ql("",e),p=Zl(u,e),f=(0,o.getBlockType)(e);let m=!1;p?.spacing?.blockGap&&f?.supports?.spacing?.blockGap&&(!0===f?.supports?.spacing?.__experimentalSkipSerialization||f?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(m=!0);let g=!1;p?.dimensions?.aspectRatio&&"core/group"===e&&(g=!0);const v=(0,d.useMemo)((()=>{const e=structuredClone(p);return m&&(e.spacing.blockGap=!1),g&&(e.dimensions.aspectRatio=!1),e}),[p,m,g]),x=kl(e),w=Ql(v),j=Ul(v),S=Kl(v),C=Wl(v),k=Hl(v),E=Yl(v),P=Xl(e,c,v),I=!!x?.length&&!t,{canEditCSS:T}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),O=t?x.find((e=>e.name===t)):null,A=(0,d.useMemo)((()=>({...r,layout:v.layout})),[r,v.layout]),N=(0,d.useMemo)((()=>({...i,layout:c.layout})),[i,c.layout]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:t?O?.label:f.title}),(0,oe.jsx)(Dl,{name:e,variation:t}),I&&(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-variations",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{children:(0,b.__)("Style Variations")}),(0,oe.jsx)(El,{name:e})]})}),S&&(0,oe.jsx)(tc,{inheritedValue:r,value:i,onChange:a,settings:v}),w&&(0,oe.jsx)($l,{inheritedValue:r,value:i,onChange:a,settings:v,defaultValues:zl}),j&&(0,oe.jsx)(nc,{inheritedValue:r,value:i,onChange:a,settings:v}),k&&(0,oe.jsx)(sc,{inheritedValue:A,value:N,onChange:e=>{const t={...e};delete t.layout,a(t),e.layout!==c.layout&&h({...c,layout:e.layout})},settings:v,includeLayoutControls:!0}),C&&(0,oe.jsx)(ec,{inheritedValue:r,value:i,onChange:e=>{if(!e?.border)return void a(e);const{radius:t,...n}=e.border,s=function(e){return e?(0,y.__experimentalHasSplitBorders)(e)?{top:Gl(e.top),right:Gl(e.right),bottom:Gl(e.bottom),left:Gl(e.left)}:Gl(e):e}(n),i=(0,y.__experimentalHasSplitBorders)(s)?{color:null,style:null,width:null,...s}:{top:s,right:s,bottom:s,left:s};a({...e,border:{...i,radius:t}})},settings:v}),E&&(0,oe.jsx)(ic,{inheritedValue:A,value:N,onChange:a,settings:v,includeLayoutControls:!0}),P&&(0,oe.jsx)(rc,{onChange:e=>{h(void 0===e?{...u,lightbox:void 0}:{...u,lightbox:{...u.lightbox,...e}})},value:c,inheritedValue:v}),T&&(0,oe.jsxs)(y.PanelBody,{title:(0,b.__)("Advanced"),initialOpen:!1,children:[(0,oe.jsx)("p",{children:(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."),f?.title)}),(0,oe.jsx)(oc,{value:i,onChange:a,inheritedValue:r})]})]})},{useGlobalStyle:lc}=te(x.privateApis);function cc({parentMenu:e,element:t,label:n}){var s;const i="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[o]=lc(i+"typography.fontFamily"),[a]=lc(i+"typography.fontStyle"),[l]=lc(i+"typography.fontWeight"),[c]=lc(i+"color.background"),[u]=lc("color.background"),[d]=lc(i+"color.gradient"),[h]=lc(i+"color.text");return(0,oe.jsx)(Wa,{path:e+"/typography/"+t,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",children:[(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=o?o:"serif",background:null!==(s=null!=d?d:c)&&void 0!==s?s:u,color:h,fontStyle:a,fontWeight:l,...r},"aria-hidden":"true",children:(0,b.__)("Aa")}),(0,oe.jsx)(y.FlexItem,{children:n})]})})}const uc=function(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Elements")}),(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[(0,oe.jsx)(cc,{parentMenu:"",element:"text",label:(0,b.__)("Text")}),(0,oe.jsx)(cc,{parentMenu:"",element:"link",label:(0,b.__)("Links")}),(0,oe.jsx)(cc,{parentMenu:"",element:"heading",label:(0,b.__)("Headings")}),(0,oe.jsx)(cc,{parentMenu:"",element:"caption",label:(0,b.__)("Captions")}),(0,oe.jsx)(cc,{parentMenu:"",element:"button",label:(0,b.__)("Buttons")})]})]})},dc=({variation:e,isFocused:t,withHoverView:n})=>(0,oe.jsx)(gl,{label:e.title,isFocused:t,withHoverView:n,children:({ratio:t,key:n})=>(0,oe.jsx)(y.__experimentalHStack,{spacing:10*t,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(hl,{variation:e,fontSize:85*t})},n)}),hc=[],{GlobalStylesContext:pc,areGlobalStyleConfigsEqual:fc}=te(x.privateApis),{mergeBaseAndUserConfigs:mc}=te(h.privateApis);function gc(e,t){if(!t?.length)return e;if("object"!=typeof e||!e||!Object.keys(e).length)return e;for(const n in e)t.includes(n)?delete e[n]:"object"==typeof e[n]&&gc(e[n],t);return e}function vc({title:e,settings:t,styles:n}){return e===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(n).length>0}function xc(e=[]){const{variationsFromTheme:t}=(0,l.useSelect)((e=>({variationsFromTheme:e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()||hc})),[]),{user:n}=(0,d.useContext)(pc),s=e.toString();return(0,d.useMemo)((()=>{const s=gc(structuredClone(n),e);s.title=(0,b.__)("Default");const i=t.filter((t=>bc(t,e))).map((e=>mc(s,e))),r=[s,...i];return r?.length?r.filter(vc):[]}),[s,n,t])}const yc=(e,t)=>{if(!e||!t?.length)return{};const n={};return Object.keys(e).forEach((s=>{if(t.includes(s))n[s]=e[s];else if("object"==typeof e[s]){const i=yc(e[s],t);Object.keys(i).length&&(n[s]=i)}})),n};function bc(e,t){const n=yc(structuredClone(e),t);return fc(n,e)}const{mergeBaseAndUserConfigs:wc}=te(h.privateApis),{GlobalStylesContext:_c,areGlobalStyleConfigsEqual:jc}=te(x.privateApis);function Sc({variation:e,children:t,isPill:n,properties:s,showTooltip:i}){const[r,o]=(0,d.useState)(!1),{base:a,user:l,setUserConfig:c}=(0,d.useContext)(_c),u=(0,d.useMemo)((()=>{let t=wc(a,e);return s&&(t=yc(t,s)),{user:e,base:a,merged:t,setUserConfig:()=>{}}}),[e,a,s]),h=()=>c(e),p=(0,d.useMemo)((()=>jc(l,e)),[l,e]);let f=e?.title;e?.description&&(f=(0,b.sprintf)((0,b._x)("%1$s (%2$s)","variation label"),e?.title,e?.description));const m=(0,oe.jsx)("div",{className:Ut("edit-site-global-styles-variations_item",{"is-active":p}),role:"button",onClick:h,onKeyDown:e=>{e.keyCode===Jt.ENTER&&(e.preventDefault(),h())},tabIndex:"0","aria-label":f,"aria-current":p,onFocus:()=>o(!0),onBlur:()=>o(!1),children:(0,oe.jsx)("div",{className:Ut("edit-site-global-styles-variations_item-preview",{"is-pill":n}),children:t(r)})});return(0,oe.jsx)(_c.Provider,{value:u,children:i?(0,oe.jsx)(y.Tooltip,{text:e?.title,children:m}):m})}function Cc({title:e,gap:t=2}){const n=["typography"],s=xc(n);return s?.length<=1?null:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[e&&(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsx)(y.__experimentalGrid,{columns:3,gap:t,className:"edit-site-global-styles-style-variations-container",children:s.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,properties:n,showTooltip:!0,children:()=>(0,oe.jsx)(dc,{variation:e})},t)))})]})}const kc=function(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"space-between",children:(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Font Sizes")})}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,oe.jsx)(Wa,{path:"/typography/font-sizes",children:(0,oe.jsxs)(y.__experimentalHStack,{direction:"row",children:[(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Font size presets")}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})})]})},Ec=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.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,oe.jsx)(Yt.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"})]}),Pc="/wp/v2/font-families",Ic="/wp/v2/font-collections";async function Tc(e){const t={path:Pc,method:"POST",body:e},n=await oo()(t);return{id:n.id,...n.font_family_settings,fontFace:[]}}async function Oc(e,t){const n={path:`${Pc}/${e}/font-faces`,method:"POST",body:t},s=await oo()(n);return{id:s.id,...s.font_face_settings}}async function Ac(e){const t={path:`${Pc}?slug=${e}&_embed=true`,method:"GET"},n=await oo()(t);if(!n||0===n.length)return null;const s=n[0];return{id:s.id,...s.font_family_settings,fontFace:s?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function Nc(e){const t={path:`${Pc}/${e}?force=true`,method:"DELETE"};return await oo()(t)}const Mc=["otf","ttf","woff","woff2"],Vc={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")},Fc={normal:(0,b._x)("Normal","font style"),italic:(0,b._x)("Italic","font style")},{File:Rc}=window,{kebabCase:Bc}=te(y.privateApis);function Dc(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function Lc(e){return`${Vc[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":Fc[e.fontStyle]||e.fontStyle}`}function zc(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())}function Gc(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,...s}=e,i=zc(n.get(e.slug).fontFace,t);n.set(e.slug,{...s,fontFace:i})}else n.set(e.slug,{...e});return Array.from(n.values())}async function Hc(e,t,n="all"){let s;if("string"==typeof t)s=`url(${t})`;else{if(!(t instanceof Rc))return;s=await t.arrayBuffer()}const i=new window.FontFace(il(e.fontFamily),s,{style:e.fontStyle,weight:e.fontWeight}),r=await i.load();if("document"!==n&&"all"!==n||document.fonts.add(r),"iframe"===n||"all"===n){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(r)}}function Uc(e,t="all"){const n=t=>{t.forEach((n=>{n.family===il(e?.fontFamily)&&n.weight===e?.fontWeight&&n.style===e?.fontStyle&&t.delete(n)}))};if("document"!==t&&"all"!==t||n(document.fonts),"iframe"===t||"all"===t){n(document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts)}}function Wc(e){if(!e)return;let t;var n;return t=Array.isArray(e)?e[0]:e,t.startsWith("file:.")?void 0:(("string"!=typeof(n=t)||n===decodeURIComponent(n))&&(t=encodeURI(t)),t)}function qc(e){const t=new FormData,{fontFace:n,category:s,...i}=e,r={...i,slug:Bc(e.slug)};return t.append("font_family_settings",JSON.stringify(r)),t}function Zc(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const n={...e},s=new FormData;if(n.file){const e=Array.isArray(n.file)?n.file:[n.file],i=[];e.forEach(((e,n)=>{const r=`file-${t}-${n}`;s.append(r,e,e.name),i.push(r)})),n.src=1===i.length?i[0]:i,delete n.file,s.append("font_face_settings",JSON.stringify(n))}else s.append("font_face_settings",JSON.stringify(n));return s}));return t}}async function Kc(e,t){const n=[];for(const s of t)try{const t=await Oc(e,s);n.push({status:"fulfilled",value:t})}catch(e){n.push({status:"rejected",reason:e})}const s={errors:[],successes:[]};return n.forEach(((e,n)=>{if("fulfilled"===e.status){const i=e.value;i.id?s.successes.push(i):s.errors.push({data:t[n],message:`Error: ${i.message}`})}else s.errors.push({data:t[n],message:e.reason.message})})),s}function Yc(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function Xc(e,t,n){const s=t=>t.slug===e.slug,i=n.find(s);return t?(i=>{const r=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!i)return[...n,{...e,fontFace:[t]}];let o=i.fontFace||[];return o=o.find(r)?o.filter((e=>!r(e))):[...o,t],0===o.length?n.filter((e=>!s(e))):n.map((e=>s(e)?{...e,fontFace:o}:e))})(i):(t=>t?n.filter((e=>!s(e))):[...n,e])(i)}const{useGlobalSetting:Jc}=te(x.privateApis),Qc=(0,d.createContext)({});const $c=function({children:e}){const{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{globalStylesId:n}=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return{globalStylesId:t()}})),s=(0,_.useEntityRecord)("root","globalStyles",n),[i,r]=(0,d.useState)(!1),[o,a]=(0,d.useState)(0),c=()=>{a(Date.now())},{records:u=[],isResolving:h}=(0,_.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),p=(u||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[f,m]=Jc("typography.fontFamilies"),g=async e=>{const n=s.record;re(n,["settings","typography","fontFamilies"],e),await t("root","globalStyles",n)},[v,x]=(0,d.useState)(!1),[y,w]=(0,d.useState)(null),j=f?.theme?f.theme.map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],S=f?.custom?f.custom.map((e=>Dc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],C=p?p.map((e=>Dc(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,d.useEffect)((()=>{v||w(null)}),[v]);const[k]=(0,d.useState)(new Set),E=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}),{}),P=e=>E("theme"===e?j:S),I=(e,t,n,s)=>t||n?!!P(s)[e]?.includes(t+n):!!P(s)[e],T=e=>{var t;const n=(null!==(t=f?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug)),s={...f,[e.source]:n};return m(s),e.fontFace&&e.fontFace.forEach((e=>{Uc(e,"all")})),s},O=e=>{const t=A(e),n={...f,custom:Gc(f?.custom,t)};return m(n),N(t),n},A=e=>e.map((({id:e,fontFace:t,...n})=>({...n,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}}))),N=e=>{e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{Hc(e,Wc(e.src),"all")}))}))},[M,V]=(0,d.useState)([]),F=async()=>{const e=await async function(){const e={path:`${Ic}?_fields=slug,name,description`,method:"GET"};return await oo()(e)}();V(e)};return(0,d.useEffect)((()=>{F()}),[]),(0,oe.jsx)(Qc.Provider,{value:{libraryFontSelected:y,handleSetLibraryFontSelected:e=>{if(!e)return void w(null);const t=("theme"===e.source?j:C).find((t=>t.slug===e.slug));w({...t||e,source:e.source})},fontFamilies:f,baseCustomFonts:C,isFontActivated:I,getFontFacesActivated:(e,t)=>P(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=Wc(e.src);t&&!k.has(t)&&(Hc(e,t,"document"),k.add(t))},installFonts:async function(e){r(!0);try{const t=[];let n=[];for(const s of e){let e=!1,i=await Ac(s.slug);i||(e=!0,i=await Tc(qc(s)));const r=i.fontFace&&s.fontFace?i.fontFace.filter((e=>Yc(e,s.fontFace))):[];i.fontFace&&s.fontFace&&(s.fontFace=s.fontFace.filter((e=>!Yc(e,i.fontFace))));let o=[],a=[];if(s?.fontFace?.length>0){const e=await Kc(i.id,Zc(s));o=e?.successes,a=e?.errors}(o?.length>0||r?.length>0)&&(i.fontFace=[...o],t.push(i)),i&&!s?.fontFace?.length&&t.push(i),e&&s?.fontFace?.length>0&&0===o?.length&&await Nc(i.id),n=n.concat(a)}if(n=n.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),t.length>0){const e=O(t);await g(e),c()}if(n.length>0){const e=new Error((0,b.__)("There was an error installing fonts."));throw e.installationErrors=n,e}}finally{r(!1)}},uninstallFontFamily:async function(e){try{const t=await Nc(e.id);if(t.deleted){const t=T(e);await g(t)}return c(),t}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var n;const s=Xc(e,t,null!==(n=f?.[e.source])&&void 0!==n?n:[]);m({...f,[e.source]:s});I(e.slug,t?.fontStyle,t?.fontWeight,e.source)?Uc(t,"all"):Hc(t,Wc(t?.src),"all")},getAvailableFontsOutline:E,modalTabOpen:v,setModalTabOpen:x,refreshLibrary:c,saveFontFamilies:g,isResolvingLibrary:h,isInstalling:i,collections:M,getFontCollection:async e=>{try{if(!!M.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${Ic}/${e}`,method:"GET"};return await oo()(t)}(e),n=M.map((n=>n.slug===e?{...n,...t}:n));V(n)}catch(e){throw console.error(e),e}}},children:e})};const eu=function({font:e,text:t}){const n=(0,d.useRef)(null),s=function(e){return e.fontStyle||e.fontWeight?e:e.fontFace&&e.fontFace.length?e.fontFace.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:{fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0}}(e),i=rl(e);t=t||e.name;const r=e.preview,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),{loadFontFaceAsset:u}=(0,d.useContext)(Qc),h=null!=r?r:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(s),p=h&&h.match(/\.(png|jpg|jpeg|gif|svg)$/i);var f;const m={fontSize:"18px",lineHeight:1,opacity:l?"1":"0",...i,...{fontFamily:sl((f=s).fontFamily),fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"400"}};return(0,d.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{a(e.isIntersecting)}),{});return e.observe(n.current),()=>e.disconnect()}),[n]),(0,d.useEffect)((()=>{(async()=>{o&&(!p&&s.src&&await u(s),c(!0))})()}),[s,o,u,p]),(0,oe.jsx)("div",{ref:n,children:p?(0,oe.jsx)("img",{src:h,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,oe.jsx)(y.__experimentalText,{style:m,className:"font-library-modal__font-variant_demo-text",children:t})})};const tu=function({font:e,onClick:t,variantsText:n,navigatorPath:s}){const i=e.fontFace?.length||1,r={cursor:t?"pointer":"default"},o=(0,y.useNavigator)();return(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,onClick:()=>{t(),s&&o.goTo(s)},style:r,className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"space-between",wrap:!1,children:[(0,oe.jsx)(eu,{font:e}),(0,oe.jsxs)(y.Flex,{justify:"flex-end",children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalText,{className:"font-library-modal__font-card__count",children:n||(0,b.sprintf)((0,b._n)("%d variant","%d variants",i),i)})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Icon,{icon:(0,b.isRTL)()?Xo:Yo})})]})]})})};const nu=function({face:e,font:t}){const{isFontActivated:n,toggleActivateFont:s}=(0,d.useContext)(Qc),i=t?.fontFace?.length>0?n(t.slug,e.fontStyle,e.fontWeight,t.source):n(t.slug,null,null,t.source),r=()=>{t?.fontFace?.length>0?s(t,e):s(t)},o=t.name+" "+Lc(e),a=(0,d.useId)();return(0,oe.jsx)("div",{className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,oe.jsx)(y.CheckboxControl,{checked:i,onChange:r,__nextHasNoMarginBottom:!0,id:a}),(0,oe.jsx)("label",{htmlFor:a,children:(0,oe.jsx)(eu,{font:e,text:o,onClick:r})})]})})};function su(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 iu(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?su(e.fontWeight)-su(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{useGlobalSetting:ru}=te(x.privateApis);function ou({font:e,isOpen:t,setIsOpen:n,setNotice:s,uninstallFontFamily:i,handleSetLibraryFontSelected:r}){const o=(0,y.useNavigator)();return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{n(!1)},onConfirm:async()=>{s(null),n(!1);try{await i(e),o.goBack(),r(null),s({type:"success",message:(0,b.__)("Font family uninstalled successfully.")})}catch(e){s({type:"error",message:(0,b.__)("There was an error uninstalling the font family.")+e.message})}},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name)})}const au=function(){var e;const{baseCustomFonts:t,libraryFontSelected:n,handleSetLibraryFontSelected:s,refreshLibrary:i,uninstallFontFamily:r,isResolvingLibrary:o,isInstalling:a,saveFontFamilies:c,getFontFacesActivated:u}=(0,d.useContext)(Qc),[h,p]=ru("typography.fontFamilies"),[f,m]=(0,d.useState)(!1),[g,v]=(0,d.useState)(!1),[x]=ru("typography.fontFamilies",void 0,"base"),w=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return t()})),j=(0,_.useEntityRecord)("root","globalStyles",w),S=!!j?.edits?.settings?.typography?.fontFamilies,C=h?.theme?h.theme.map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=new Set(C.map((e=>e.slug))),E=x?.theme?C.concat(x.theme.filter((e=>!k.has(e.slug))).map((e=>Dc(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],P="custom"===n?.source&&n?.id,I=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return P&&t("delete",{kind:"postType",name:"wp_font_family",id:P})}),[P]),T=!!n&&"theme"!==n?.source&&I,O=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,n=u(e.slug,e.source).length;return(0,b.sprintf)((0,b.__)("%1$s/%2$s variants active"),n,t)};(0,d.useEffect)((()=>{s(n),i()}),[]);const A=n?u(n.slug,n.source).length:0,N=null!==(e=n?.fontFace?.length)&&void 0!==e?e:n?.fontFamily?1:0,M=A>0&&A!==N,V=A===N,F=E.length>0||t.length>0;return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[o&&(0,oe.jsx)("div",{className:"font-library-modal__loading",children:(0,oe.jsx)(y.ProgressBar,{})}),!o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.Navigator,{initialPath:n?"/fontFamily":"/",children:[(0,oe.jsx)(y.Navigator.Screen,{path:"/",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"8",children:[g&&(0,oe.jsx)(y.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),!F&&(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("No fonts installed.")}),E.length>0&&(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b._x)("Theme","font source")}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:E.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),s(e)}})},e.slug)))})]}),t.length>0&&(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b._x)("Custom","font source")}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:t.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e,navigatorPath:"/fontFamily",variantsText:O(e),onClick:()=>{v(null),s(e)}})},e.slug)))})]})]})}),(0,oe.jsxs)(y.Navigator.Screen,{path:"/fontFamily",children:[(0,oe.jsx)(ou,{font:n,isOpen:f,setIsOpen:m,setNotice:v,uninstallFontFamily:r,handleSetLibraryFontSelected:s}),(0,oe.jsxs)(y.Flex,{justify:"flex-start",children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",onClick:()=>{s(null),v(null)},label:(0,b.__)("Back")}),(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:n?.name})]}),g&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalSpacer,{margin:1}),(0,oe.jsx)(y.Notice,{status:g.type,onRemove:()=>v(null),children:g.message}),(0,oe.jsx)(y.__experimentalSpacer,{margin:1})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[(0,oe.jsx)(y.CheckboxControl,{className:"font-library-modal__select-all",label:(0,b.__)("Select all"),checked:V,onChange:()=>{var e;const t=null!==(e=h?.[n.source]?.filter((e=>e.slug!==n.slug)))&&void 0!==e?e:[],s=V?t:[...t,n];p({...h,[n.source]:s}),n.fontFace&&n.fontFace.forEach((e=>{V?Uc(e,"all"):Hc(e,Wc(e?.src),"all")}))},indeterminate:M,__nextHasNoMarginBottom:!0}),(0,oe.jsx)(y.__experimentalSpacer,{margin:8}),(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(e=>e?e.fontFace&&e.fontFace.length?iu(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(n).map(((e,t)=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(nu,{font:n,face:e},`face${t}`)},`face${t}`)))})]})]})]}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__footer",children:[a&&(0,oe.jsx)(y.ProgressBar,{}),T&&(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,isDestructive:!0,variant:"tertiary",onClick:()=>{m(!0)},children:(0,b.__)("Delete")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{v(null);try{await c(h),v({type:"success",message:(0,b.__)("Font family updated successfully.")})}catch(e){v({type:"error",message:(0,b.sprintf)((0,b.__)("There was an error updating the font family. %s"),e.message)})}},disabled:!S,accessibleWhenDisabled:!0,children:(0,b.__)("Update")})]})]})]})},lu=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),cu=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})});function uu(e,t,n){return t?!!n[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!n[e]}const du=function(){return(0,oe.jsx)("div",{className:"font-library__google-fonts-confirm",children:(0,oe.jsx)(y.Card,{children:(0,oe.jsxs)(y.CardBody,{children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,children:(0,b.__)("Connect to Google Fonts")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:6}),(0,oe.jsx)(y.__experimentalText,{as:"p",children:(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,oe.jsx)(y.__experimentalSpacer,{margin:3}),(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("You can alternatively upload files directly on the Upload tab.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:6}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))},children:(0,b.__)("Allow access to Google Fonts")})]})})})};const hu=function({face:e,font:t,handleToggleVariant:n,selected:s}){const i=()=>{t?.fontFace?n(t,e):n(t)},r=t.name+" "+Lc(e),o=(0,d.useId)();return(0,oe.jsx)("div",{className:"font-library-modal__font-card",children:(0,oe.jsxs)(y.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,oe.jsx)(y.CheckboxControl,{checked:s,onChange:i,__nextHasNoMarginBottom:!0,id:o}),(0,oe.jsx)("label",{htmlFor:o,children:(0,oe.jsx)(eu,{font:e,text:r,onClick:i})})]})})},pu={slug:"all",name:(0,b._x)("All","font categories")},fu="wp-font-library-google-fonts-permission";const mu=function({slug:e}){var t;const n="google-fonts"===e,s=()=>"true"===window.localStorage.getItem(fu),[i,r]=(0,d.useState)(null),[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)([]),[u,h]=(0,d.useState)(1),[p,f]=(0,d.useState)({}),[m,g]=(0,d.useState)(n&&!s()),{collections:x,getFontCollection:w,installFonts:_,isInstalling:j}=(0,d.useContext)(Qc),S=x.find((t=>t.slug===e));(0,d.useEffect)((()=>{const e=()=>{g(n&&!s())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,n]);const C=()=>{window.localStorage.setItem(fu,"false"),window.dispatchEvent(new Event("storage"))};(0,d.useEffect)((()=>{(async()=>{try{await w(e),B()}catch(e){o||a({type:"error",message:e?.message})}})()}),[e,w,a,o]),(0,d.useEffect)((()=>{r(null)}),[e]),(0,d.useEffect)((()=>{c([])}),[i]);const k=(0,d.useMemo)((()=>{var e;return null!==(e=S?.font_families)&&void 0!==e?e:[]}),[S]),E=null!==(t=S?.categories)&&void 0!==t?t:[],P=[pu,...E],I=(0,d.useMemo)((()=>function(e,t){const{category:n,search:s}=t;let i=e||[];return n&&"all"!==n&&(i=i.filter((e=>-1!==e.categories.indexOf(n)))),s&&(i=i.filter((e=>e.font_family_settings.name.toLowerCase().includes(s.toLowerCase())))),i}(k,p)),[k,p]),T=!S?.font_families&&!o,O=Math.max(window.innerHeight,500),A=Math.floor((O-417)/61),N=Math.ceil(I.length/A),M=(u-1)*A,V=u*A,F=I.slice(M,V),R=(0,v.debounce)((e=>{f({...p,search:e}),h(1)}),300),B=()=>{f({}),h(1)},D=(e,t)=>{const n=Xc(e,t,l);c(n)},L=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(l),z=l.length>0?l[0]?.fontFace?.length:0,G=z>0&&z!==i?.fontFace?.length,H=z===i?.fontFace?.length;if(m)return(0,oe.jsx)(du,{});const U=()=>"google-fonts"!==e||m||i?null:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,b.__)("Revoke access to Google Fonts"),onClick:C}]});return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[T&&(0,oe.jsx)("div",{className:"font-library-modal__loading",children:(0,oe.jsx)(y.ProgressBar,{})}),!T&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.Navigator,{initialPath:"/",className:"font-library-modal__tabpanel-layout",children:[(0,oe.jsxs)(y.Navigator.Screen,{path:"/",children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsxs)(y.__experimentalVStack,{children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:S.name}),(0,oe.jsx)(y.__experimentalText,{children:S.description})]}),(0,oe.jsx)(U,{})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsxs)(y.Flex,{children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.SearchControl,{className:"font-library-modal__search",value:p.search,placeholder:(0,b.__)("Font name…"),label:(0,b.__)("Search"),onChange:R,__nextHasNoMarginBottom:!0,hideLabelFromVision:!1})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Category"),value:p.category,onChange:e=>{f({...p,category:e}),h(1)},children:P&&P.map((e=>(0,oe.jsx)("option",{value:e.slug,children:e.name},e.slug)))})})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),!!S?.font_families?.length&&!I.length&&(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("No fonts found. Try with a different search term")}),(0,oe.jsx)("div",{className:"font-library-modal__fonts-grid__main",children:(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:F.map((e=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(tu,{font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{r(e.font_family_settings)}})},e.font_family_settings.slug)))})})]}),(0,oe.jsxs)(y.Navigator.Screen,{path:"/fontFamily",children:[(0,oe.jsxs)(y.Flex,{justify:"flex-start",children:[(0,oe.jsx)(y.Navigator.BackButton,{icon:(0,b.isRTL)()?Yo:Xo,size:"small",onClick:()=>{r(null),a(null)},label:(0,b.__)("Back")}),(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:i?.name})]}),o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalSpacer,{margin:1}),(0,oe.jsx)(y.Notice,{status:o.type,onRemove:()=>a(null),children:o.message}),(0,oe.jsx)(y.__experimentalSpacer,{margin:1})]}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Select font variants to install.")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:4}),(0,oe.jsx)(y.CheckboxControl,{className:"font-library-modal__select-all",label:(0,b.__)("Select all"),checked:H,onChange:()=>{c(H?[]:[i])},indeterminate:G,__nextHasNoMarginBottom:!0}),(0,oe.jsx)(y.__experimentalVStack,{spacing:0,children:(0,oe.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:(W=i,W?W.fontFace&&W.fontFace.length?iu(W.fontFace):[{fontFamily:W.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,oe.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,oe.jsx)(hu,{font:i,face:e,handleToggleVariant:D,selected:uu(i.slug,i.fontFace?e:null,L)})},`face${t}`)))})}),(0,oe.jsx)(y.__experimentalSpacer,{margin:16})]})]}),i&&(0,oe.jsx)(y.Flex,{justify:"flex-end",className:"font-library-modal__footer",children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:async()=>{a(null);const e=l[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 Rc([t],n,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void a({type:"error",message:(0,b.__)("Error installing the fonts, could not be downloaded.")})}try{await _([e]),a({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){a({type:"error",message:e.message})}c([])},isBusy:j,disabled:0===l.length||j,accessibleWhenDisabled:!0,children:(0,b.__)("Install")})}),!i&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"font-library-modal__footer",justify:"end",spacing:6,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"font-library-modal__page-selection",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("
Page
%1$s
of %2$s
","paging"),"",N),{div:(0,oe.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,oe.jsx)(y.SelectControl,{"aria-label":(0,b.__)("Current page"),value:u,options:[...Array(N)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>h(parseInt(e)),size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{onClick:()=>h(u-1),disabled:1===u,accessibleWhenDisabled:!0,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?lu:cu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,oe.jsx)(y.Button,{onClick:()=>h(u+1),disabled:u===N,accessibleWhenDisabled:!0,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?cu:lu,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})]})]});var W};var gu=i(8572),vu=i.n(gu),xu=i(4660),yu=i.n(xu);globalThis.fetch;class bu{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 wu{constructor(){this.listeners={}}addEventListener(e,t,n){let s=this.listeners[e]||[];n?s.unshift(t):s.push(t),this.listeners[e]=s}removeEventListener(e,t){let n=this.listeners[e]||[],s=n.findIndex((e=>e===t));s>-1&&(n.splice(s,1),this.listeners[e]=n)}dispatch(e){let t=this.listeners[e.type];if(t)for(let n=0,s=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(_u+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,s=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const i=`${s?"":"u"}int${n}`,r=[];for(;e--;)r.push(this[i]);return r}}class Su{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const n=e.currentPosition,s={enumerable:!1,get:()=>n};Object.defineProperty(this,"start",s)}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 Cu extends Su{constructor(e,t,n){const{parser:s,start:i}=super(new ju(e,t,n)),r={enumerable:!1,get:()=>s};Object.defineProperty(this,"p",r);const o={enumerable:!1,get:()=>i};Object.defineProperty(this,"tableStart",o)}}function ku(e,t,n){let s;Object.defineProperty(e,t,{get:()=>s||(s=n(),s),enumerable:!0})}class Eu extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:12},t,"sfnt");this.version=s.uint32,this.numTables=s.uint16,this.searchRange=s.uint16,this.entrySelector=s.uint16,this.rangeShift=s.uint16,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Pu(s))),this.tables={},this.directory.forEach((e=>{ku(this.tables,e.tag.trim(),(()=>n(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class Pu{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const Iu=yu().inflate||void 0;let Tu;class Ou extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:44},t,"woff");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Au(s))),Nu(this,t,n)}}class Au{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function Nu(e,t,n){e.tables={},e.directory.forEach((s=>{ku(e.tables,s.tag.trim(),(()=>{let i=0,r=t;if(s.compLength!==s.origLength){const e=t.buffer.slice(s.offset,s.offset+s.compLength);let n;if(Iu)n=Iu(new Uint8Array(e));else{if(!Tu){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}n=Tu(new Uint8Array(e))}r=new DataView(n.buffer)}else i=s.offset;return n(e.tables,{tag:s.tag,offset:i,length:s.origLength},r)}))}))}const Mu=vu();let Vu;class Fu extends Cu{constructor(e,t,n){const{p:s}=super({offset:0,length:48},t,"woff2");this.signature=s.tag,this.flavor=s.uint32,this.length=s.uint32,this.numTables=s.uint16,s.uint16,this.totalSfntSize=s.uint32,this.totalCompressedSize=s.uint32,this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.metaOffset=s.uint32,this.metaLength=s.uint32,this.metaOrigLength=s.uint32,this.privOffset=s.uint32,this.privLength=s.uint32,s.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new Ru(s)));let i,r=s.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 o=t.buffer.slice(r);if(Mu)i=Mu(new Uint8Array(o));else{if(!Vu){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}i=new Uint8Array(Vu(o))}!function(e,t,n){e.tables={},e.directory.forEach((s=>{ku(e.tables,s.tag.trim(),(()=>{const i=s.offset,r=i+(s.transformLength?s.transformLength:s.origLength),o=new DataView(t.slice(i,r).buffer);try{return n(e.tables,{tag:s.tag,offset:0,length:s.origLength},o)}catch(e){console.error(e)}}))}))}(this,i,n)}}class Ru{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 Bu={};let Du=!1;function Lu(e,t,n){let s=t.tag.replace(/[^\w\d]/g,""),i=Bu[s];return i?new i(t,n,e):(console.warn(`lib-font has no definition for ${s}. The table was skipped.`),{})}function zu(){let e=0;function t(n,s){if(!Du)return e>10?s(new Error("loading took too long")):(e++,setTimeout((()=>t(n)),250));n(Lu)}return new Promise(((e,n)=>t(e)))}async function Gu(e,t,n={}){if(!globalThis.document)return;let s=function(e,t){let n=e.lastIndexOf("."),s=(e.substring(n+1)||"").toLowerCase(),i={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[s];if(i)return i;let r={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."}[s];if(r||(r=`${e} is not a known webfont format.`),t)throw new Error(r);console.warn(`Could not load font: ${r}`)}(t,n.errorOnStyle);if(!s)return;let i=document.createElement("style");i.className="injected-by-Font-js";let r=[];return n.styleRules&&(r=Object.entries(n.styleRules).map((([e,t])=>`${e}: ${t};`))),i.textContent=`\n@font-face {\n font-family: "${e}";\n ${r.join("\n\t")}\n src: url("${t}") format("${s}");\n}`,globalThis.document.head.appendChild(i),i}Promise.all([Promise.resolve().then((function(){return dd})),Promise.resolve().then((function(){return hd})),Promise.resolve().then((function(){return pd})),Promise.resolve().then((function(){return md})),Promise.resolve().then((function(){return gd})),Promise.resolve().then((function(){return yd})),Promise.resolve().then((function(){return bd})),Promise.resolve().then((function(){return _d})),Promise.resolve().then((function(){return Nd})),Promise.resolve().then((function(){return Wd})),Promise.resolve().then((function(){return Gh})),Promise.resolve().then((function(){return Hh})),Promise.resolve().then((function(){return qh})),Promise.resolve().then((function(){return Yh})),Promise.resolve().then((function(){return Xh})),Promise.resolve().then((function(){return Jh})),Promise.resolve().then((function(){return $h})),Promise.resolve().then((function(){return ep})),Promise.resolve().then((function(){return tp})),Promise.resolve().then((function(){return np})),Promise.resolve().then((function(){return sp})),Promise.resolve().then((function(){return ip})),Promise.resolve().then((function(){return op})),Promise.resolve().then((function(){return dp})),Promise.resolve().then((function(){return pp})),Promise.resolve().then((function(){return fp})),Promise.resolve().then((function(){return mp})),Promise.resolve().then((function(){return gp})),Promise.resolve().then((function(){return vp})),Promise.resolve().then((function(){return bp})),Promise.resolve().then((function(){return Cp})),Promise.resolve().then((function(){return Pp})),Promise.resolve().then((function(){return Tp})),Promise.resolve().then((function(){return Np})),Promise.resolve().then((function(){return Mp})),Promise.resolve().then((function(){return Vp})),Promise.resolve().then((function(){return Rp})),Promise.resolve().then((function(){return Bp})),Promise.resolve().then((function(){return Gp})),Promise.resolve().then((function(){return Hp})),Promise.resolve().then((function(){return Wp}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];Bu[t]=e[t]})),Du=!0}));const Hu=[0,1,0,0],Uu=[79,84,84,79],Wu=[119,79,70,70],qu=[119,79,70,50];function Zu(e,t){if(e.length===t.length){for(let n=0;n{globalThis.document&&!this.options.skipStyleSheet&&await Gu(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 s=new bu("error",n,`Failed to load font at ${t||e}`);this.dispatch(s),this.onerror&&this.onerror(s)}))}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 Zu(t,Hu)||Zu(t,Uu)?"SFNT":Zu(t,Wu)?"WOFF":Zu(t,qu)?"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 s=new bu("load",{font:this});this.dispatch(s),this.onload&&this.onload(s)}async parseBasicData(e){return zu().then((t=>("SFNT"===e&&(this.opentype=new Eu(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new Ou(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new Fu(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 s=n.getBoundingClientRect();document.body.removeChild(n);const i=this.opentype.tables["OS/2"];return s.fontSize=t,s.ascender=i.sTypoAscender,s.descender=i.sTypoDescender,s}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new bu("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 bu("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Ku;class Yu extends Su{constructor(e,t,n){super(e),this.plaformID=t,this.encodingID=n}}class Xu extends Yu{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 Ju extends Yu{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 s=Math.max(...this.subHeaderKeys),i=e.currentPosition;ku(this,"subHeaders",(()=>(e.currentPosition=i,[...new Array(s)].map((t=>new Qu(e))))));const r=i+8*s;ku(this,"glyphIndexArray",(()=>(e.currentPosition=r,[...new Array(s)].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,s=this.subHeaders[n],i=this.subHeaders[s],r=i.firstCode,o=r+i.entryCount;return r<=t&&t<=o}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 Qu{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 $u extends Yu{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 s=e.currentPosition;ku(this,"endCode",(()=>e.readBytes(this.segCount,s,16)));const i=s+2+this.segCountX2;ku(this,"startCode",(()=>e.readBytes(this.segCount,i,16)));const r=i+this.segCountX2;ku(this,"idDelta",(()=>e.readBytes(this.segCount,r,16,!0)));const o=r+this.segCountX2;ku(this,"idRangeOffset",(()=>e.readBytes(this.segCount,o,16)));const a=o+this.segCountX2,l=this.length-(a-this.tableStart);ku(this,"glyphIdArray",(()=>e.readBytes(l,a,16))),ku(this,"segments",(()=>this.buildSegments(o,a,e)))}buildSegments(e,t,n){return[...new Array(this.segCount)].map(((t,s)=>{let i=this.startCode[s],r=this.endCode[s],o=this.idDelta[s],a=this.idRangeOffset[s],l=e+2*s,c=[];if(0===a)for(let e=i+o,t=r+o;e<=t;e++)c.push(e);else for(let e=0,t=r-i;e<=t;e++)n.currentPosition=l+a+2*e,c.push(n.uint16);return{startCode:i,endCode:r,idDelta:o,idRangeOffset:a,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&~e&&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 ed extends Yu{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;ku(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 td extends Yu{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;ku(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new nd(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 nd{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class sd extends Yu{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;ku(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 id extends Yu{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;ku(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new rd(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343?0:65534&~e&&65535&~e?-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode)):0}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 rd{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class od extends Yu{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;ku(this,"groups",[...new Array(this.numGroups)].map((t=>new ad(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 ad{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class ld extends Yu{constructor(e,t,n){super(e,t,n),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,ku(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new cd(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 cd{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class ud{constructor(e,t){const n=this.platformID=e.uint16,s=this.encodingID=e.uint16,i=this.offset=e.Offset32;ku(this,"table",(()=>(e.currentPosition=t+i,function(e,t,n){const s=e.uint16;return 0===s?new Xu(e,t,n):2===s?new Ju(e,t,n):4===s?new $u(e,t,n):6===s?new ed(e,t,n):8===s?new td(e,t,n):10===s?new sd(e,t,n):12===s?new id(e,t,n):13===s?new od(e,t,n):14===s?new ld(e,t,n):{}}(e,n,s))))}}var dd=Object.freeze({__proto__:null,cmap:class extends Cu{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 ud(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 i=this.getSubTable(s);return!!i.getGlyphId&&(t=i.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supports&&!1!==s.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,n)=>{const s=this.getSubTable(n);return s.supportsVariation&&!1!==s.supportsVariation(e)}))}}});var hd=Object.freeze({__proto__:null,head:class extends Cu{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 pd=Object.freeze({__proto__:null,hhea:class extends Cu{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 fd{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var md=Object.freeze({__proto__:null,hmtx:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hhea.numberOfHMetrics,r=n.maxp.numGlyphs,o=s.currentPosition;if(ku(this,"hMetrics",(()=>(s.currentPosition=o,[...new Array(i)].map((e=>new fd(s.uint16,s.int16)))))),i(s.currentPosition=e,[...new Array(r-i)].map((e=>s.int16)))))}}}});var gd=Object.freeze({__proto__:null,maxp:class extends Cu{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 vd{constructor(e,t){this.length=e,this.offset=t}}class xd{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,ku(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:n,length:s}=t;if(0===s)return"";if(0===n||3===n){const t=[];for(let n=0,i=s/2;nnew xd(n,this))),1===this.format&&(this.langTagCount=n.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new vd(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 bd=Object.freeze({__proto__:null,OS2:class extends Cu{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 wd=[".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 _d=Object.freeze({__proto__:null,post:class extends Cu{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 wd[t];let n=this.glyphNameOffsets[e],s=this.glyphNameOffsets[e+1]-n-1;if(0===s)return".notdef.";this.parser.currentPosition=this.namesOffset+n;return this.parser.readBytes(s,this.namesOffset+n,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class jd extends Cu{constructor(e,t){const{p:n}=super(e,t,"AxisTable");this.baseTagListOffset=n.Offset16,this.baseScriptListOffset=n.Offset16,ku(this,"baseTagList",(()=>new Sd({offset:e.offset+this.baseTagListOffset},t))),ku(this,"baseScriptList",(()=>new Cd({offset:e.offset+this.baseScriptListOffset},t)))}}class Sd extends Cu{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 Cd extends Cu{constructor(e,t){const{p:n}=super(e,t,"BaseScriptListTable");this.baseScriptCount=n.uint16;const s=n.currentPosition;ku(this,"baseScriptRecords",(()=>(n.currentPosition=s,[...new Array(this.baseScriptCount)].map((e=>new kd(this.start,n))))))}}class kd{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,ku(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new Ed(t))))}}class Ed{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 Pd(this.start,e))),ku(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new Id(e)))),ku(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new Td(e))))}}class Pd{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,ku(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new Td(t))))}}class Id{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 Ad(this.parser)}}class Td{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;ku(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new Od(e))))))}}class Od{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class Ad{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 Nd=Object.freeze({__proto__:null,BASE:class extends Cu{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,ku(this,"horizAxis",(()=>new jd({offset:e.offset+this.horizAxisOffset},t))),ku(this,"vertAxis",(()=>new jd({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,ku(this,"itemVarStore",(()=>new jd({offset:e.offset+this.itemVarStoreOffset},t))))}}});class Md{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 Vd(e))))}}class Vd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class Fd extends Su{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 Rd(e))))}}class Rd{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class Bd{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 Dd extends Su{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 Ld(this.parser)}}class Ld{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class zd extends Su{constructor(e){super(e),this.coverageOffset=e.Offset16,ku(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new Fd(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 Gd(this.parser)}}class Gd extends Su{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 Hd(this.parser)}}class Hd{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 Ud extends Su{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 Fd(this.parser)}}var Wd=Object.freeze({__proto__:null,GDEF:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.glyphClassDefOffset=n.Offset16,ku(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return n.currentPosition=this.tableStart+this.glyphClassDefOffset,new Md(n)})),this.attachListOffset=n.Offset16,ku(this,"attachList",(()=>{if(0!==this.attachListOffset)return n.currentPosition=this.tableStart+this.attachListOffset,new Dd(n)})),this.ligCaretListOffset=n.Offset16,ku(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return n.currentPosition=this.tableStart+this.ligCaretListOffset,new zd(n)})),this.markAttachClassDefOffset=n.Offset16,ku(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return n.currentPosition=this.tableStart+this.markAttachClassDefOffset,new Md(n)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=n.Offset16,ku(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return n.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new Ud(n)}))),3===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,ku(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return n.currentPosition=this.tableStart+this.itemVarStoreOffset,new Bd(n)})))}}});class qd extends Su{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new Zd(e)))}}class Zd{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Kd extends Su{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new Yd(e)))}}class Yd{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class Xd{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 Jd extends Su{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new Qd(e)))}}class Qd{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class $d extends Su{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 th(e);if(t.startsWith("cc"))return new eh(e);if(t.startsWith("ss"))return new nh(e)}}}class eh{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 th{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class nh{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function sh(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class ih extends Su{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 Fd(e)}}class rh{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class oh extends ih{constructor(e){super(e),this.deltaGlyphID=e.int16}}class ah extends ih{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 lh(t)}}class lh{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class ch extends ih{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 uh(t)}}class uh{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class dh extends ih{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 hh(t)}}class hh extends Su{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 ph(t)}}class ph{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class fh extends ih{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&&(sh(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 rh(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 mh(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 vh(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 Fd(t)}}class mh extends Su{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 gh(t)}}class gh{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 rh(e)))}}class vh extends Su{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 xh(t)}}class xh extends gh{constructor(e){super(e)}}class yh extends ih{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&&(sh(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 Sh(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 bh(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 _h(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 Fd(t)}}class bh extends Su{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 wh(t)}}class wh{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 rh(e)))}}class _h extends Su{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 jh(t)}}class jh{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 Sh(e)))}}class Sh extends Su{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Ch extends Su{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class kh extends ih{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 Eh={buildSubtable:function(e,t){const n=new[void 0,oh,ah,ch,dh,fh,yh,Ch,kh][e](t);return n.type=e,n}};class Ph extends Su{constructor(e){super(e)}}class Ih extends Ph{constructor(e){super(e),console.log("lookup type 1")}}class Th extends Ph{constructor(e){super(e),console.log("lookup type 2")}}class Oh extends Ph{constructor(e){super(e),console.log("lookup type 3")}}class Ah extends Ph{constructor(e){super(e),console.log("lookup type 4")}}class Nh extends Ph{constructor(e){super(e),console.log("lookup type 5")}}class Mh extends Ph{constructor(e){super(e),console.log("lookup type 6")}}class Vh extends Ph{constructor(e){super(e),console.log("lookup type 7")}}class Fh extends Ph{constructor(e){super(e),console.log("lookup type 8")}}class Rh extends Ph{constructor(e){super(e),console.log("lookup type 9")}}var Bh={buildSubtable:function(e,t){const n=new[void 0,Ih,Th,Oh,Ah,Nh,Mh,Vh,Fh,Rh][e](t);return n.type=e,n}};class Dh extends Su{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class Lh extends Su{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?Eh:Bh;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class zh extends Cu{constructor(e,t,n){const{p:s,tableStart:i}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.scriptListOffset=s.Offset16,this.featureListOffset=s.Offset16,this.lookupListOffset=s.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=s.Offset32);const r=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);ku(this,"scriptList",(()=>r?qd.EMPTY:(s.currentPosition=i+this.scriptListOffset,new qd(s)))),ku(this,"featureList",(()=>r?Jd.EMPTY:(s.currentPosition=i+this.featureListOffset,new Jd(s)))),ku(this,"lookupList",(()=>r?Dh.EMPTY:(s.currentPosition=i+this.lookupListOffset,new Dh(s)))),this.featureVariationsOffset&&ku(this,"featureVariations",(()=>r?FeatureVariations.EMPTY:(s.currentPosition=i+this.featureVariationsOffset,new FeatureVariations(s))))}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 Kd(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 Xd(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 s=new Xd(this.parser);return s.langSysTag=t,s}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 $d(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 Lh(this.parser,t)}}var Gh=Object.freeze({__proto__:null,GSUB:class extends zh{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var Hh=Object.freeze({__proto__:null,GPOS:class extends zh{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class Uh extends Su{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Wh(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 Wh{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var qh=Object.freeze({__proto__:null,SVG:class extends Cu{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 Uh(n)}}});class Zh{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 Kh{constructor(e,t,n){let s=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-s(n.currentPosition=s,[...new Array(this.axisCount)].map((e=>new Zh(n))))));const i=s+this.axisCount*this.axisSize;ku(this,"instances",(()=>{let e=[];for(let t=0;te.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var Xh=Object.freeze({__proto__:null,cvt:class extends Cu{constructor(e,t){const{p:n}=super(e,t),s=e.length/2;ku(this,"items",(()=>[...new Array(s)].map((e=>n.fword))))}}});var Jh=Object.freeze({__proto__:null,fpgm:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});class Qh{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var $h=Object.freeze({__proto__:null,gasp:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRanges=n.uint16;ku(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Qh(n)))))}}});var ep=Object.freeze({__proto__:null,glyf:class extends Cu{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var tp=Object.freeze({__proto__:null,loca:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.maxp.numGlyphs+1;0===n.head.indexToLocFormat?(this.x2=!0,ku(this,"offsets",(()=>[...new Array(i)].map((e=>s.Offset16))))):ku(this,"offsets",(()=>[...new Array(i)].map((e=>s.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 np=Object.freeze({__proto__:null,prep:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});var sp=Object.freeze({__proto__:null,CFF:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"data",(()=>n.readBytes()))}}});var ip=Object.freeze({__proto__:null,CFF2:class extends Cu{constructor(e,t){const{p:n}=super(e,t);ku(this,"data",(()=>n.readBytes()))}}});class rp{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var op=Object.freeze({__proto__:null,VORG:class extends Cu{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,ku(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new rp(n)))))}}});class ap{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new cp(e),this.vert=new cp(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 lp{constructor(e){this.hori=new cp(e),this.vert=new cp(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class cp{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 up extends Cu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.numSizes=s.uint32,ku(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new ap(s)))))}}var dp=Object.freeze({__proto__:null,EBLC:up});class hp extends Cu{constructor(e,t,n){const{p:s}=super(e,t,n);this.majorVersion=s.uint16,this.minorVersion=s.uint16}}var pp=Object.freeze({__proto__:null,EBDT:hp});var fp=Object.freeze({__proto__:null,EBSC:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,ku(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new lp(n)))))}}});var mp=Object.freeze({__proto__:null,CBLC:class extends up{constructor(e,t){super(e,t,"CBLC")}}});var gp=Object.freeze({__proto__:null,CBDT:class extends hp{constructor(e,t){super(e,t,"CBDT")}}});var vp=Object.freeze({__proto__:null,sbix:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.flags=n.flags(16),this.numStrikes=n.uint32,ku(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>n.Offset32))))}}});class xp{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class yp{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var bp=Object.freeze({__proto__:null,COLR:class extends Cu{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 xp(this.parser),s=n.gID,i=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=i;let r=new xp(this.parser),o=r.gID;if(s===e)return n;if(o===e)return r;for(;t!==i;){let n=t+(i-t)/12;this.parser.currentPosition=n;let s=new xp(this.parser),r=s.gID;if(r===e)return s;r>e?i=n:rnew yp(p)))}}});class wp{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class _p{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class jp{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class Sp{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var Cp=Object.freeze({__proto__:null,CPAL:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numPaletteEntries=n.uint16;const s=this.numPalettes=n.uint16;this.numColorRecords=n.uint16,this.offsetFirstColorRecord=n.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>n.uint16)),ku(this,"colorRecords",(()=>(n.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new wp(n)))))),1===this.version&&(this.offsetPaletteTypeArray=n.Offset32,this.offsetPaletteLabelArray=n.Offset32,this.offsetPaletteEntryLabelArray=n.Offset32,ku(this,"paletteTypeArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new _p(n,s)))),ku(this,"paletteLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new jp(n,s)))),ku(this,"paletteEntryLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new Sp(n,s)))))}}});class kp{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class Ep{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var Pp=Object.freeze({__proto__:null,DSIG:class extends Cu{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 kp(n)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new Ep(this.parser)}}});class Ip{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var Tp=Object.freeze({__proto__:null,hdmx:class extends Cu{constructor(e,t,n){const{p:s}=super(e,t),i=n.hmtx.numGlyphs;this.version=s.uint16,this.numRecords=s.int16,this.sizeDeviceRecord=s.int32,this.records=[...new Array(numRecords)].map((e=>new Ip(s,i)))}}});class Op{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,ku(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new Ap(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 Ap{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var Np=Object.freeze({__proto__:null,kern:class extends Cu{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.nTables=n.uint16,ku(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let s=0;s[...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 Fp{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 Rp=Object.freeze({__proto__:null,meta:class extends Cu{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 Fp(this.tableStart,n)))}}});var Bp=Object.freeze({__proto__:null,PCLT:class extends Cu{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 Dp{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class Lp{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new zp(e)))}}class zp{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var Gp=Object.freeze({__proto__:null,VDMX:class extends Cu{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 Dp(n))),this.offsets=[...new Array(this.numRatios)].map((e=>n.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new Lp(n)))}}});var Hp=Object.freeze({__proto__:null,vhea:class extends Cu{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 Up{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Wp=Object.freeze({__proto__:null,vmtx:class extends Cu{constructor(e,t,n){super(e,t);const s=n.vhea.numOfLongVerMetrics,i=n.maxp.numGlyphs,r=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=r,[...new Array(s)].map((e=>new Up(p.uint16,p.int16)))))),s(p.currentPosition=e,[...new Array(i-s)].map((e=>p.int16)))))}}}});const{kebabCase:qp}=te(y.privateApis);const Zp=function(){const{installFonts:e}=(0,d.useContext)(Qc),[t,n]=(0,d.useState)(!1),[s,i]=(0,d.useState)(!1),r=async e=>{i(null),n(!0);const t=new Set,s=[...e];let r=!1;const l=s.map((async e=>{const n=await async function(e){const t=new Ku("Uploaded Font");try{const n=await a(e);return await t.fromDataBuffer(n,"font"),!0}catch(e){return!1}}(e);if(!n)return r=!0,null;if(t.has(e.name))return null;const s=e.name.split(".").pop().toLowerCase();return Mc.includes(s)?(t.add(e.name),e):null})),c=(await Promise.all(l)).filter((e=>null!==e));if(c.length>0)o(c);else{const e=r?(0,b.__)("Sorry, you are not allowed to upload this file type."):(0,b.__)("No fonts found to install.");i({type:"error",message:e}),n(!1)}},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await l(e);return await Hc(t,t.file,"all"),t})));c(t)};async function a(e){return new Promise(((t,n)=>{const s=new window.FileReader;s.readAsArrayBuffer(e),s.onload=()=>t(s.result),s.onerror=n}))}const l=async e=>{const t=await a(e),n=new Ku("Uploaded Font");n.fromDataBuffer(t,e.name);const s=(await new Promise((e=>n.onload=e))).detail.font,{name:i}=s.opentype.tables,r=i.get(16)||i.get(1),o=i.get(2).toLowerCase().includes("italic"),l=s.opentype.tables["OS/2"].usWeightClass||"normal",c=!!s.opentype.tables.fvar&&s.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:r,fontStyle:o?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||l}},c=async t=>{const s=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:qp(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(s),i({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){i({type:"error",message:e.message,errors:e?.installationErrors})}n(!1)};return(0,oe.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[(0,oe.jsx)(y.DropZone,{onFilesDrop:e=>{r(e)}}),(0,oe.jsxs)(y.__experimentalVStack,{className:"font-library-modal__local-fonts",children:[s&&(0,oe.jsxs)(y.Notice,{status:s.type,__unstableHTML:!0,onRemove:()=>i(null),children:[s.message,s.errors&&(0,oe.jsx)("ul",{children:s.errors.map(((e,t)=>(0,oe.jsx)("li",{children:e},t)))})]}),t&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)("div",{className:"font-library-modal__upload-area",children:(0,oe.jsx)(y.ProgressBar,{})})}),!t&&(0,oe.jsx)(y.FormFileUpload,{accept:Mc.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{r(e.target.files)},render:({openFileDialog:e})=>(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:"font-library-modal__upload-area",onClick:e,children:(0,b.__)("Upload font")})}),(0,oe.jsx)(y.__experimentalSpacer,{margin:2}),(0,oe.jsx)(y.__experimentalText,{className:"font-library-modal__upload-area__text",children:(0,b.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})},{Tabs:Kp}=te(y.privateApis),Yp={id:"installed-fonts",title:(0,b._x)("Library","Font library")},Xp={id:"upload-fonts",title:(0,b._x)("Upload","noun")};const Jp=function({onRequestClose:e,defaultTabId:t="installed-fonts"}){const{collections:n}=(0,d.useContext)(Qc),s=(0,l.useSelect)((e=>e(_.store).canUser("create",{kind:"postType",name:"wp_font_family"})),[]),i=[Yp];return s&&(i.push(Xp),i.push(...(e=>e.map((({slug:t,name:n})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,b.__)("Install Fonts"):n}))))(n||[]))),(0,oe.jsx)(y.Modal,{title:(0,b.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,oe.jsxs)(Kp,{defaultTabId:t,children:[(0,oe.jsx)("div",{className:"font-library-modal__tablist-container",children:(0,oe.jsx)(Kp.TabList,{children:i.map((({id:e,title:t})=>(0,oe.jsx)(Kp.Tab,{tabId:e,children:t},e)))})}),i.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,oe.jsx)(Zp,{});break;case"installed-fonts":t=(0,oe.jsx)(au,{});break;default:t=(0,oe.jsx)(mu,{slug:e})}return(0,oe.jsx)(Kp.TabPanel,{tabId:e,focusable:!1,children:t},e)}))]})})};const Qp=function({font:e}){const{handleSetLibraryFontSelected:t,setModalTabOpen:n}=(0,d.useContext)(Qc),s=e?.fontFace?.length||1,i=rl(e);return(0,oe.jsx)(y.__experimentalItem,{onClick:()=>{t(e),n("installed-fonts")},children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.FlexItem,{style:i,children:e.name}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count",children:(0,b.sprintf)((0,b._n)("%d variant","%d variants",s),s)})]})})},{useGlobalSetting:$p}=te(x.privateApis);function ef(e,t){return e?e.map((e=>Dc(e,{source:t}))):[]}function tf(){const{baseCustomFonts:e,modalTabOpen:t,setModalTabOpen:n}=(0,d.useContext)(Qc),[s]=$p("typography.fontFamilies"),[i]=$p("typography.fontFamilies",void 0,"base"),r=[...ef(s?.theme,"theme"),...ef(s?.custom,"custom")].sort(((e,t)=>e.name.localeCompare(t.name))),o=00||e?.length>0;return(0,oe.jsxs)(oe.Fragment,{children:[!!t&&(0,oe.jsx)(Jp,{onRequestClose:()=>n(null),defaultTabId:t}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Fonts")}),(0,oe.jsx)(y.Button,{onClick:()=>n("installed-fonts"),label:(0,b.__)("Manage fonts"),icon:Ec,size:"small"})]}),r.length>0&&(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(y.__experimentalItemGroup,{size:"large",isBordered:!0,isSeparated:!0,children:r.map((e=>(0,oe.jsx)(Qp,{font:e},e.slug)))})}),!o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:a?(0,b.__)("No fonts activated."):(0,b.__)("No fonts installed.")}),(0,oe.jsx)(y.Button,{className:"edit-site-global-styles-font-families__manage-fonts",variant:"secondary",__next40pxDefaultSize:!0,onClick:()=>{n(a?"installed-fonts":"upload-fonts")},children:a?(0,b.__)("Manage fonts"):(0,b.__)("Add fonts")})]})]})]})}const nf=({...e})=>(0,oe.jsx)($c,{children:(0,oe.jsx)(tf,{...e})});const sf=function(){const e=(0,l.useSelect)((e=>e(h.store).getEditorSettings().fontLibraryEnabled),[]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Typography"),description:(0,b.__)("Available fonts, typographic styles, and the application of those styles.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:7,children:[(0,oe.jsx)(Cc,{title:(0,b.__)("Typesets")}),e&&(0,oe.jsx)(nf,{}),(0,oe.jsx)(uc,{}),(0,oe.jsx)(kc,{})]})})]})},{useGlobalStyle:rf,useGlobalSetting:of,useSettingsForBlockElement:af,TypographyPanel:lf}=te(x.privateApis);function cf({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const s=n.join("."),[i]=rf(s,void 0,"user",{shouldDecodeEncode:!1}),[r,o]=rf(s,void 0,"all",{shouldDecodeEncode:!1}),[a]=of(""),l=af(a,void 0,"heading"===e?t:e);return(0,oe.jsx)(lf,{inheritedValue:r,value:i,onChange:o,settings:l})}const{useGlobalStyle:uf}=te(x.privateApis);function df({name:e,element:t,headingLevel:n}){var s;let i="";"heading"===t?i=`elements.${n}.`:t&&"text"!==t&&(i=`elements.${t}.`);const[r]=uf(i+"typography.fontFamily",e),[o]=uf(i+"color.gradient",e),[a]=uf(i+"color.background",e),[l]=uf("color.background"),[c]=uf(i+"color.text",e),[u]=uf(i+"typography.fontSize",e),[d]=uf(i+"typography.fontStyle",e),[h]=uf(i+"typography.fontWeight",e),[p]=uf(i+"typography.letterSpacing",e),f="link"===t?{textDecoration:"underline"}:{};return(0,oe.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!==(s=null!=o?o:a)&&void 0!==s?s:l,color:c,fontSize:u,fontStyle:d,fontWeight:h,letterSpacing:p,...f},children:"Aa"})}const hf={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 pf=function({element:e}){const[t,n]=(0,d.useState)("heading");return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:hf[e].title,description:hf[e].description}),(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,children:(0,oe.jsx)(df,{element:e,headingLevel:t})}),"heading"===e&&(0,oe.jsx)(y.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,oe.jsxs)(y.__experimentalToggleGroupControl,{label:(0,b.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"heading",showTooltip:!0,"aria-label":(0,b.__)("All headings"),label:(0,b._x)("All","heading levels")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h1",showTooltip:!0,"aria-label":(0,b.__)("Heading 1"),label:(0,b.__)("H1")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h2",showTooltip:!0,"aria-label":(0,b.__)("Heading 2"),label:(0,b.__)("H2")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h3",showTooltip:!0,"aria-label":(0,b.__)("Heading 3"),label:(0,b.__)("H3")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h4",showTooltip:!0,"aria-label":(0,b.__)("Heading 4"),label:(0,b.__)("H4")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h5",showTooltip:!0,"aria-label":(0,b.__)("Heading 5"),label:(0,b.__)("H5")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"h6",showTooltip:!0,"aria-label":(0,b.__)("Heading 6"),label:(0,b.__)("H6")})]})}),(0,oe.jsx)(cf,{element:e,headingLevel:t})]})},{useGlobalStyle:ff}=te(x.privateApis);const mf=function({fontSize:e}){var t;const[n]=ff("typography"),s=e?.fluid?.min&&e?.fluid?.max?{minimumFontSize:e.fluid.min,maximumFontSize:e.fluid.max}:{fontSize:e.size},i=(0,x.getComputedFluidTypographyValue)(s);return(0,oe.jsx)("div",{className:"edit-site-typography-preview",style:{fontSize:i,fontFamily:null!==(t=n?.fontFamily)&&void 0!==t?t:"serif"},children:(0,b.__)("Aa")})};const gf=function({fontSize:e,isOpen:t,toggleOpen:n,handleRemoveFontSize:s}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{n()},onConfirm:async()=>{n(),s(e)},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font size preset?'),e.name)})};const vf=function({fontSize:e,toggleOpen:t,handleRename:n}){const[s,i]=(0,d.useState)(e.name);return(0,oe.jsx)(y.Modal,{onRequestClose:t,focusOnMount:"firstContentElement",title:(0,b.__)("Rename"),size:"small",children:(0,oe.jsx)("form",{onSubmit:e=>{e.preventDefault(),s.trim()&&n(s),t(),t()},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"3",children:[(0,oe.jsx)(y.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",value:s,onChange:i,label:(0,b.__)("Name"),placeholder:(0,b.__)("Font size preset name")}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,b.__)("Save")})]})]})})})},xf=["px","em","rem","vw","vh"];const yf=function({__nextHasNoMarginBottom:e,...t}){const{baseControlProps:n}=(0,y.useBaseControlProps)(t),{value:s,onChange:i,fallbackValue:r,disabled:o,label:a}=t,l=(0,y.__experimentalUseCustomUnits)({availableUnits:xf}),[c,u="px"]=(0,y.__experimentalParseQuantityAndUnitFromRawValue)(s,l),d=!!u&&["em","rem","vw","vh"].includes(u);return(0,oe.jsx)(y.BaseControl,{...n,__nextHasNoMarginBottom:!0,children:(0,oe.jsxs)(y.Flex,{children:[(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,oe.jsx)(y.__experimentalUnitControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:a,hideLabelFromVision:!0,value:s,onChange:e=>{i(e)},units:l,min:0,disabled:o})}),(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,oe.jsx)(y.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,oe.jsx)(y.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:a,hideLabelFromVision:!0,value:c,initialPosition:r,withInputField:!1,onChange:e=>{i?.(e+u)},min:0,max:d?10:100,step:d?.1:1,disabled:o})})})]})})},{Menu:bf}=te(y.privateApis),{useGlobalSetting:wf}=te(x.privateApis);const _f=function(){var e;const[t,n]=(0,d.useState)(!1),[s,i]=(0,d.useState)(!1),{params:{origin:r,slug:o},goBack:a}=(0,y.useNavigator)(),[l,c]=wf("typography.fontSizes"),[u]=wf("typography.fluid"),h=null!==(e=l[r])&&void 0!==e?e:[],p=h.find((e=>e.slug===o));if((0,d.useEffect)((()=>{o&&!p&&a()}),[o,p,a]),!r||!o||!p)return null;const f=void 0!==p?.fluid?!!p.fluid:!!u,m="object"==typeof p?.fluid,g=(e,t)=>{const n=h.map((n=>n.slug===o?{...n,[e]:t}:n));c({...l,[r]:n})},v=()=>{n(!t)},x=()=>{i(!s)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(gf,{fontSize:p,isOpen:t,toggleOpen:v,handleRemoveFontSize:()=>{const e=h.filter((e=>e.slug!==o));c({...l,[r]:e})}}),s&&(0,oe.jsx)(vf,{fontSize:p,toggleOpen:x,handleRename:e=>{g("name",e)}}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",align:"flex-start",children:[(0,oe.jsx)(Pl,{title:p.name,description:(0,b.sprintf)((0,b.__)("Manage the font size %s."),p.name)}),"custom"===r&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginTop:3,marginBottom:0,paddingX:4,children:(0,oe.jsxs)(bf,{children:[(0,oe.jsx)(bf.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Font size options")})}),(0,oe.jsxs)(bf.Popover,{children:[(0,oe.jsx)(bf.Item,{onClick:x,children:(0,oe.jsx)(bf.ItemLabel,{children:(0,b.__)("Rename")})}),(0,oe.jsx)(bf.Item,{onClick:v,children:(0,oe.jsx)(bf.ItemLabel,{children:(0,b.__)("Delete")})})]})]})})})]}),(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{paddingX:4,marginBottom:0,paddingBottom:6,children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(mf,{fontSize:p})}),(0,oe.jsx)(yf,{label:(0,b.__)("Size"),value:m?"":p.size,onChange:e=>{g("size",e)},disabled:m}),(0,oe.jsx)(y.ToggleControl,{label:(0,b.__)("Fluid typography"),help:(0,b.__)("Scale the font size dynamically to fit the screen or viewport."),checked:f,onChange:e=>{g("fluid",e)},__nextHasNoMarginBottom:!0}),f&&(0,oe.jsx)(y.ToggleControl,{label:(0,b.__)("Custom fluid values"),help:(0,b.__)("Set custom min and max values for the fluid font size."),checked:m,onChange:e=>{g("fluid",!e||{min:p.size,max:p.size})},__nextHasNoMarginBottom:!0}),m&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(yf,{label:(0,b.__)("Minimum"),value:p.fluid?.min,onChange:e=>{g("fluid",{...p.fluid,min:e})}}),(0,oe.jsx)(yf,{label:(0,b.__)("Maximum"),value:p.fluid?.max,onChange:e=>{g("fluid",{...p.fluid,max:e})}})]})]})})})]})]})},jf=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const Sf=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})},{Menu:Cf}=te(y.privateApis),{useGlobalSetting:kf}=te(x.privateApis);function Ef({label:e,origin:t,sizes:n,handleAddFontSize:s,handleResetFontSizes:i}){const[r,o]=(0,d.useState)(!1),a=()=>o(!r),l="custom"===t?(0,b.__)("Are you sure you want to remove all custom font size presets?"):(0,b.__)("Are you sure you want to reset all font size presets to their default values?");return(0,oe.jsxs)(oe.Fragment,{children:[r&&(0,oe.jsx)(Sf,{text:l,confirmButtonText:"custom"===t?(0,b.__)("Remove"):(0,b.__)("Reset"),isOpen:r,toggleOpen:a,onConfirm:i}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",align:"center",children:[(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsxs)(y.FlexItem,{children:["custom"===t&&(0,oe.jsx)(y.Button,{label:(0,b.__)("Add font size"),icon:jf,size:"small",onClick:s}),!!i&&(0,oe.jsxs)(Cf,{children:[(0,oe.jsx)(Cf.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Font size presets options")})}),(0,oe.jsx)(Cf.Popover,{children:(0,oe.jsx)(Cf.Item,{onClick:a,children:(0,oe.jsx)(Cf.ItemLabel,{children:"custom"===t?(0,b.__)("Remove font size presets"):(0,b.__)("Reset font size presets")})})})]})]})]}),!!n.length&&(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:n.map((e=>(0,oe.jsx)(Wa,{path:`/typography/font-sizes/${t}/${e.slug}`,children:(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)(y.FlexItem,{className:"edit-site-font-size__item",children:e.name}),(0,oe.jsx)(y.FlexItem,{display:"flex",children:(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})})]})},e.slug)))})]})]})}const Pf=function(){const[e,t]=kf("typography.fontSizes.theme"),[n]=kf("typography.fontSizes.theme",null,"base"),[s,i]=kf("typography.fontSizes.default"),[r]=kf("typography.fontSizes.default",null,"base"),[o=[],a]=kf("typography.fontSizes.custom"),[l]=kf("typography.defaultFontSizes"),c=()=>{const e=al(o,"custom-"),t={name:(0,b.sprintf)((0,b.__)("New Font Size %d"),e),size:"16px",slug:`custom-${e}`};a([...o,t])},u=(e,t)=>e.map((e=>e.size)).join("")===t.map((e=>e.size)).join("");return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Font size presets"),description:(0,b.__)("Create and edit the presets used for font sizes across the site.")}),(0,oe.jsx)(y.__experimentalView,{children:(0,oe.jsx)(y.__experimentalSpacer,{paddingX:4,children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:8,children:[!!e?.length&&(0,oe.jsx)(Ef,{label:(0,b.__)("Theme"),origin:"theme",sizes:e,baseSizes:n,handleAddFontSize:c,handleResetFontSizes:u(e,n)?null:()=>t(n)}),l&&!!s?.length&&(0,oe.jsx)(Ef,{label:(0,b.__)("Default"),origin:"default",sizes:s,baseSizes:r,handleAddFontSize:c,handleResetFontSizes:u(s,r)?null:()=>i(r)}),(0,oe.jsx)(Ef,{label:(0,b.__)("Custom"),origin:"custom",sizes:o,handleAddFontSize:c,handleResetFontSizes:o.length>0?()=>a([]):null})]})})})]})},If=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG",children:(0,oe.jsx)(Yt.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 Tf=function({className:e,...t}){return(0,oe.jsx)(y.Flex,{className:Ut("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:Of}=te(x.privateApis),Af=[];const Nf=function({name:e}){const[t]=Of("color.palette.custom"),[n]=Of("color.palette.theme"),[s]=Of("color.palette.default"),[i]=Of("color.defaultPalette",e),[r]=function(e){const[t,n]=ne("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),s=t.map((t=>{const{color:n}=t,s=Y(n).rotate(e).toHex();return{...t,color:s}}));n(s)}]:[]}(),o=(0,d.useMemo)((()=>[...t||Af,...n||Af,...s&&i?s:Af]),[t,n,s,i]),a=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette";return(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Palette")}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,oe.jsx)(Wa,{path:a,children:(0,oe.jsxs)(y.__experimentalHStack,{direction:"row",children:[o.length>0?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalZStack,{isLayered:!1,offset:-8,children:o.slice(0,5).map((({color:e},t)=>(0,oe.jsx)(Tf,{children:(0,oe.jsx)(y.ColorIndicator,{colorValue:e})},`${e}-${t}`)))}),(0,oe.jsx)(y.FlexItem,{isBlock:!0,children:(0,b.__)("Edit palette")})]}):(0,oe.jsx)(y.FlexItem,{children:(0,b.__)("Add colors")}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})}),window.__experimentalEnableColorRandomizer&&n?.length>0&&(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"secondary",icon:If,onClick:r,children:(0,b.__)("Randomize colors")})]})},{useGlobalStyle:Mf,useGlobalSetting:Vf,useSettingsForBlockElement:Ff,ColorPanel:Rf}=te(x.privateApis);const Bf=function(){const[e]=Mf("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=Mf("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Vf(""),i=Ff(s);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Colors"),description:(0,b.__)("Palette colors and the application of those colors on site elements.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:7,children:[(0,oe.jsx)(Nf,{}),(0,oe.jsx)(Rf,{inheritedValue:t,value:e,onChange:n,settings:i})]})})]})};function Df(){const{paletteColors:e}=ie();return e.slice(0,4).map((({slug:e,color:t},n)=>(0,oe.jsx)("div",{style:{flexGrow:1,height:"100%",background:t}},`${e}-${n}`)))}const Lf={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},zf=({label:e,isFocused:t,withHoverView:n})=>(0,oe.jsx)(gl,{label:e,isFocused:t,withHoverView:n,children:({key:e})=>(0,oe.jsx)(y.__unstableMotion.div,{variants:Lf,style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(y.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,oe.jsx)(Df,{})})},e)});function Gf({title:e,gap:t=2}){const n=["color"],s=xc(n);return s?.length<=1?null:(0,oe.jsxs)(y.__experimentalVStack,{spacing:3,children:[e&&(0,oe.jsx)(Ll,{level:3,children:e}),(0,oe.jsx)(y.__experimentalGrid,{spacing:t,children:s.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,isPill:!0,properties:n,showTooltip:!0,children:()=>(0,oe.jsx)(zf,{})},t)))})]})}const{useGlobalSetting:Hf}=te(x.privateApis),Uf={placement:"bottom-start",offset:8};function Wf({name:e}){const[t,n]=Hf("color.palette.theme",e),[s]=Hf("color.palette.theme",e,"base"),[i,r]=Hf("color.palette.default",e),[o]=Hf("color.palette.default",e,"base"),[a,l]=Hf("color.palette.custom",e),[c]=Hf("color.defaultPalette",e),u=(0,v.useViewportMatch)("small","<")?Uf:void 0;return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:u}),!!i&&!!i.length&&!!c&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,colors:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:u}),(0,oe.jsx)(y.__experimentalPaletteEdit,{colors:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:u}),(0,oe.jsx)(Gf,{title:(0,b.__)("Palettes")})]})}const{useGlobalSetting:qf}=te(x.privateApis),Zf={placement:"bottom-start",offset:8},Kf=()=>{};function Yf({name:e}){const[t,n]=qf("color.gradients.theme",e),[s]=qf("color.gradients.theme",e,"base"),[i,r]=qf("color.gradients.default",e),[o]=qf("color.gradients.default",e,"base"),[a,l]=qf("color.gradients.custom",e),[c]=qf("color.defaultGradients",e),[u]=qf("color.duotone.custom")||[],[d]=qf("color.duotone.default")||[],[h]=qf("color.duotone.theme")||[],[p]=qf("color.defaultDuotone"),f=[...u||[],...h||[],...d&&p?d:[]],m=(0,v.useViewportMatch)("small","<")?Zf:void 0;return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:t!==s,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:m}),!!i&&!!i.length&&!!c&&(0,oe.jsx)(y.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,gradients:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelLevel:3,popoverProps:m}),(0,oe.jsx)(y.__experimentalPaletteEdit,{gradients:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelLevel:3,slugPrefix:"custom-",popoverProps:m}),!!f&&!!f.length&&(0,oe.jsxs)("div",{children:[(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Duotone")}),(0,oe.jsx)(y.__experimentalSpacer,{margin:3}),(0,oe.jsx)(y.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:Kf})]})]})}const{Tabs:Xf}=te(y.privateApis);const Jf=function({name:e}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Edit palette"),description:(0,b.__)("The combination of colors used across the site and in color pickers.")}),(0,oe.jsxs)(Xf,{children:[(0,oe.jsxs)(Xf.TabList,{children:[(0,oe.jsx)(Xf.Tab,{tabId:"color",children:(0,b.__)("Color")}),(0,oe.jsx)(Xf.Tab,{tabId:"gradient",children:(0,b.__)("Gradient")})]}),(0,oe.jsx)(Xf.TabPanel,{tabId:"color",focusable:!1,children:(0,oe.jsx)(Wf,{name:e})}),(0,oe.jsx)(Xf.TabPanel,{tabId:"gradient",focusable:!1,children:(0,oe.jsx)(Yf,{name:e})})]})]})},Qf={backgroundSize:"auto"},{useGlobalStyle:$f,useGlobalSetting:em,BackgroundPanel:tm}=te(x.privateApis);function nm(){const[e]=$f("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=$f("",void 0,"all",{shouldDecodeEncode:!1}),[s]=em("");return(0,oe.jsx)(tm,{inheritedValue:t,value:e,onChange:n,settings:s,defaultValues:Qf})}const{useHasBackgroundPanel:sm,useGlobalSetting:im}=te(x.privateApis);const rm=function(){const[e]=im(""),t=sm(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Background"),description:(0,oe.jsx)(y.__experimentalText,{children:(0,b.__)("Set styles for the site’s background.")})}),t&&(0,oe.jsx)(nm,{})]})};const om=function({text:e,confirmButtonText:t,isOpen:n,toggleOpen:s,onConfirm:i}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:t,onCancel:()=>{s()},onConfirm:async()=>{s(),i()},size:"medium",children:e})},{useGlobalSetting:am}=te(x.privateApis),{Menu:lm}=te(y.privateApis),cm="6px 6px 9px rgba(0, 0, 0, 0.2)";function um(){const[e]=am("shadow.presets.default"),[t]=am("shadow.defaultPresets"),[n]=am("shadow.presets.theme"),[s,i]=am("shadow.presets.custom"),[r,o]=(0,d.useState)(!1),a=()=>o(!r);return(0,oe.jsxs)(oe.Fragment,{children:[r&&(0,oe.jsx)(om,{text:(0,b.__)("Are you sure you want to remove all custom shadows?"),confirmButtonText:(0,b.__)("Remove"),isOpen:r,toggleOpen:a,onConfirm:()=>{i([])}}),(0,oe.jsx)(Pl,{title:(0,b.__)("Shadows"),description:(0,b.__)("Manage and create shadow styles for use across the site.")}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-global-styles__shadows-panel",spacing:7,children:[t&&(0,oe.jsx)(dm,{label:(0,b.__)("Default"),shadows:e||[],category:"default"}),n&&n.length>0&&(0,oe.jsx)(dm,{label:(0,b.__)("Theme"),shadows:n||[],category:"theme"}),(0,oe.jsx)(dm,{label:(0,b.__)("Custom"),shadows:s||[],category:"custom",canCreate:!0,onCreate:e=>{i([...s||[],e])},onReset:a})]})})]})}function dm({label:e,shadows:t,category:n,canCreate:s,onCreate:i,onReset:r}){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:2,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,oe.jsx)(Ll,{level:3,children:e})}),s&&(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,oe.jsx)(y.Button,{size:"small",icon:jf,label:(0,b.__)("Add shadow"),onClick:()=>{(()=>{const e=al(t,"shadow-");i({name:(0,b.sprintf)((0,b.__)("Shadow %s"),e),shadow:cm,slug:`shadow-${e}`})})()}})}),!!t?.length&&"custom"===n&&(0,oe.jsxs)(lm,{children:[(0,oe.jsx)(lm.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Shadow options")})}),(0,oe.jsx)(lm.Popover,{children:(0,oe.jsx)(lm.Item,{onClick:r,children:(0,oe.jsx)(lm.ItemLabel,{children:(0,b.__)("Remove all custom shadows")})})})]})]}),t.length>0&&(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map((e=>(0,oe.jsx)(hm,{shadow:e,category:n},e.slug)))})]})}function hm({shadow:e,category:t}){return(0,oe.jsx)(Wa,{path:`/shadows/edit/${t}/${e.slug}`,children:(0,oe.jsxs)(y.__experimentalHStack,{children:[(0,oe.jsx)(y.FlexItem,{children:e.name}),(0,oe.jsx)(ta,{icon:(0,b.isRTL)()?Xo:Yo})]})})}const pm=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M7 11.5h10V13H7z"})});const{useGlobalSetting:fm}=te(x.privateApis),{Menu:mm}=te(y.privateApis),gm=[{label:(0,b.__)("Rename"),action:"rename"},{label:(0,b.__)("Delete"),action:"delete"}],vm=[{label:(0,b.__)("Reset"),action:"reset"}];function xm(){const{goBack:e,params:{category:t,slug:n}}=(0,y.useNavigator)(),[s,i]=fm(`shadow.presets.${t}`);(0,d.useEffect)((()=>{const t=s?.some((e=>e.slug===n));n&&!t&&e()}),[s,n,e]);const[r]=fm(`shadow.presets.${t}`,void 0,"base"),[o,a]=(0,d.useState)((()=>(s||[]).find((e=>e.slug===n)))),l=(0,d.useMemo)((()=>(r||[]).find((e=>e.slug===n))),[r,n]),[c,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(!1),[f,m]=(0,d.useState)(o.name);if(!t||!n)return null;return o?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(Pl,{title:o.name}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,oe.jsxs)(mm,{children:[(0,oe.jsx)(mm.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Menu")})}),(0,oe.jsx)(mm.Popover,{children:("custom"===t?gm:vm).map((e=>(0,oe.jsx)(mm.Item,{onClick:()=>(e=>{if("reset"===e){const e=s.map((e=>e.slug===n?l:e));a(l),i(e)}else"delete"===e?u(!0):"rename"===e&&p(!0)})(e.action),disabled:"reset"===e.action&&o.shadow===l.shadow,children:(0,oe.jsx)(mm.ItemLabel,{children:e.label})},e.action)))})]})})})]}),(0,oe.jsxs)("div",{className:"edit-site-global-styles-screen",children:[(0,oe.jsx)(ym,{shadow:o.shadow}),(0,oe.jsx)(bm,{shadow:o.shadow,onChange:e=>{a({...o,shadow:e});const t=s.map((t=>t.slug===n?{...o,shadow:e}:t));i(t)}})]}),c&&(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{i(s.filter((e=>e.slug!==n))),u(!1)},onCancel:()=>{u(!1)},confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" shadow preset?'),o.name)}),h&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>p(!1),size:"small",children:(0,oe.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(e=>{if(!e)return;const t=s.map((t=>t.slug===n?{...o,name:e}:t));a({...o,name:e}),i(t)})(f),p(!1)},children:[(0,oe.jsx)(y.__experimentalInputControl,{__next40pxDefaultSize:!0,autoComplete:"off",label:(0,b.__)("Name"),placeholder:(0,b.__)("Shadow name"),value:f,onChange:e=>m(e)}),(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:6}),(0,oe.jsxs)(y.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>p(!1),children:(0,b.__)("Cancel")})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:(0,b.__)("Save")})})]})]})})]}):(0,oe.jsx)(Pl,{title:""})}function ym({shadow:e}){const t={boxShadow:e};return(0,oe.jsx)(y.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,oe.jsx)(y.__experimentalHStack,{align:"center",justify:"center",className:"edit-site-global-styles__shadow-preview-panel",children:(0,oe.jsx)("div",{className:"edit-site-global-styles__shadow-preview-block",style:t})})})}function bm({shadow:e,onChange:t}){const n=(0,d.useRef)(),s=(0,d.useMemo)((()=>function(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map((e=>e.trim()))}(e)),[e]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalVStack,{spacing:2,children:(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",children:[(0,oe.jsx)(y.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,oe.jsx)(Ll,{level:3,children:(0,b.__)("Shadows")})}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,oe.jsx)(y.Button,{size:"small",icon:jf,label:(0,b.__)("Add shadow"),onClick:()=>{t([...s,cm].join(", "))},ref:n})})]})}),(0,oe.jsx)(y.__experimentalSpacer,{}),(0,oe.jsx)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:s.map(((e,i)=>(0,oe.jsx)(wm,{shadow:e,onChange:e=>((e,n)=>{const i=[...s];i[e]=n,t(i.join(", "))})(i,e),canRemove:s.length>1,onRemove:()=>(e=>{t(s.filter(((t,n)=>n!==e)).join(", ")),n.current.focus()})(i)},i)))})]})}function wm({shadow:e,onChange:t,canRemove:n,onRemove:s}){const i=(0,d.useMemo)((()=>function(e){const t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e)return t;if(e.includes("none"))return t;const n=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,s=e.match(n)||[];if(1!==s.length)return t;const i=s[0].split(" ").map((e=>e.trim())).filter((e=>e));if(i.length<2)return t;const r=e.match(/inset/gi)||[];if(r.length>1)return t;const o=1===r.length;let a=e.replace(n,"").trim();o&&(a=a.replace("inset","").replace("INSET","").trim());let l=(a.match(/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi)||[]).map((e=>e?.trim())).filter((e=>e));if(l.length>1)return t;if(0===l.length&&(l=a.trim().split(" ").filter((e=>e)),l.length>1))return t;const[c,u,d,h]=i;return{x:c,y:u,blur:d||t.blur,spread:h||t.spread,inset:o,color:a||t.color}}(e)),[e]),r=e=>{t(function(e){const t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}(e))};return(0,oe.jsx)(y.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"edit-site-global-styles__shadow-editor__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const r={onClick:e,className:Ut("edit-site-global-styles__shadow-editor__dropdown-toggle",{"is-open":t}),"aria-expanded":t},o={onClick:()=>{t&&e(),s()},className:Ut("edit-site-global-styles__shadow-editor__remove-button",{"is-open":t}),label:(0,b.__)("Remove shadow")};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,icon:Ya,...r,children:i.inset?(0,b.__)("Inner shadow"):(0,b.__)("Drop shadow")}),n&&(0,oe.jsx)(y.Button,{size:"small",icon:pm,...o})]})},renderContent:()=>(0,oe.jsx)(y.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"edit-site-global-styles__shadow-editor__dropdown-content",children:(0,oe.jsx)(_m,{shadowObj:i,onChange:r})})})}function _m({shadowObj:e,onChange:t}){const n=(n,s)=>{const i={...e,[n]:s};t(i)};return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,className:"edit-site-global-styles__shadow-editor-panel",children:[(0,oe.jsx)(y.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:e=>n("color",e)}),(0,oe.jsxs)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,value:e.inset?"inset":"outset",isBlock:!0,onChange:e=>n("inset","inset"===e),hideLabelFromVision:!0,__next40pxDefaultSize:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"outset",label:(0,b.__)("Outset")}),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"inset",label:(0,b.__)("Inset")})]}),(0,oe.jsxs)(y.__experimentalGrid,{columns:2,gap:4,children:[(0,oe.jsx)(jm,{label:(0,b.__)("X Position"),value:e.x,onChange:e=>n("x",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Y Position"),value:e.y,onChange:e=>n("y",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Blur"),value:e.blur,onChange:e=>n("blur",e)}),(0,oe.jsx)(jm,{label:(0,b.__)("Spread"),value:e.spread,onChange:e=>n("spread",e)})]})]})}function jm({label:e,value:t,onChange:n}){return(0,oe.jsx)(y.__experimentalUnitControl,{label:e,__next40pxDefaultSize:!0,value:t,onChange:e=>{const t=void 0!==e&&!isNaN(parseFloat(e));n(t?e:"0px")}})}function Sm(){return(0,oe.jsx)(um,{})}function Cm(){return(0,oe.jsx)(xm,{})}const{useGlobalStyle:km,useGlobalSetting:Em,useSettingsForBlockElement:Pm,DimensionsPanel:Im}=te(x.privateApis),Tm={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function Om(){const[e]=km("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=km("",void 0,"all",{shouldDecodeEncode:!1}),[s]=Em("",void 0,"user"),[i,r]=Em(""),o=Pm(i),a=(0,d.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),l=(0,d.useMemo)((()=>({...e,layout:s.layout})),[e,s.layout]);return(0,oe.jsx)(Im,{inheritedValue:a,value:l,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==s.layout){const t={...s,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:Tm})}const{useHasDimensionsPanel:Am,useGlobalSetting:Nm,useSettingsForBlockElement:Mm}=te(x.privateApis);const Vm=function(){const[e]=Nm(""),t=Mm(e),n=Am(t);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Layout")}),n&&(0,oe.jsx)(Om,{})]})},{GlobalStylesContext:Fm}=te(x.privateApis);function Rm({gap:e=2}){const{user:t}=(0,d.useContext)(Fm),n=t?.styles,s=(0,l.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),i=s?.filter((e=>!bc(e,["color"])&&!bc(e,["typography","spacing"]))),r=(0,d.useMemo)((()=>[...[{title:(0,b.__)("Default"),settings:{},styles:{}},...null!=i?i:[]].map((e=>{var t;const s={...e?.styles?.blocks}||{};n?.blocks&&Object.keys(n.blocks).forEach((e=>{if(n.blocks[e].css){const t=s[e]||{},i={css:`${s[e]?.css||""} ${n.blocks[e].css.trim()||""}`};s[e]={...t,...i}}}));const i=n?.css||e.styles?.css?{css:`${e.styles?.css||""} ${n?.css||""}`}:{},r=Object.keys(s).length>0?{blocks:s}:{},o={...e.styles,...i,...r};return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:o}}))]),[i,n?.blocks,n?.css]);return!i||i?.length<1?null:(0,oe.jsx)(y.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container",gap:e,children:r.map(((e,t)=>(0,oe.jsx)(Sc,{variation:e,children:t=>(0,oe.jsx)(wl,{label:e?.title,withHoverView:!0,isFocused:t,variation:e})},t)))})}function Bm(){return(0,oe.jsxs)(y.__experimentalVStack,{spacing:10,className:"edit-site-global-styles-variation-container",children:[(0,oe.jsx)(Rm,{gap:3}),(0,oe.jsx)(Gf,{title:(0,b.__)("Palettes"),gap:3}),(0,oe.jsx)(Cc,{title:(0,b.__)("Typography"),gap:3})]})}const{useZoomOut:Dm}=te(x.privateApis);const Lm=function(){const e=(0,l.useSelect)((e=>e(x.store).getSettings().isPreviewMode),[]),{setDeviceType:t}=(0,l.useDispatch)(h.store);return Dm(!e),(0,d.useEffect)((()=>{t("desktop")}),[t]),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("Browse styles"),description:(0,b.__)("Choose a variation to change the look of the site.")}),(0,oe.jsx)(y.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations",children:(0,oe.jsx)(y.CardBody,{children:(0,oe.jsx)(Bm,{})})})]})},zm=window.wp.mediaUtils,Gm=[{slug:"theme-colors",title:(0,b.__)("Theme Colors"),origin:"theme",type:"colors"},{slug:"theme-gradients",title:(0,b.__)("Theme Gradients"),origin:"theme",type:"gradients"},{slug:"custom-colors",title:(0,b.__)("Custom Colors"),origin:"custom",type:"colors"},{slug:"custom-gradients",title:(0,b.__)("Custom Gradients"),origin:"custom",type:"gradients"},{slug:"duotones",title:(0,b.__)("Duotones"),origin:"theme",type:"duotones"},{slug:"default-colors",title:(0,b.__)("Default Colors"),origin:"default",type:"colors"},{slug:"default-gradients",title:(0,b.__)("Default Gradients"),origin:"default",type:"gradients"}],Hm=[{slug:"site-identity",title:(0,b.__)("Site Identity"),blocks:["core/site-logo","core/site-title","core/site-tagline"]},{slug:"design",title:(0,b.__)("Design"),blocks:["core/navigation","core/avatar","core/post-time-to-read"],exclude:["core/home-link","core/navigation-link"]},{slug:"posts",title:(0,b.__)("Posts"),blocks:["core/post-title","core/post-excerpt","core/post-author","core/post-author-name","core/post-author-biography","core/post-date","core/post-terms","core/term-description","core/query-title","core/query-no-results","core/query-pagination","core/query-numbers"]},{slug:"comments",title:(0,b.__)("Comments"),blocks:["core/comments-title","core/comments-pagination","core/comments-pagination-numbers","core/comments","core/comments-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link","core/comment-template","core/post-comments-count","core/post-comments-link"]}],Um=[{slug:"overview",title:(0,b.__)("Overview"),blocks:[]},{slug:"text",title:(0,b.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,b.__)("Colors"),blocks:[]},{slug:"theme",title:(0,b.__)("Theme"),subcategories:Hm},{slug:"media",title:(0,b.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,b.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,b.__)("Embeds"),include:[]}],Wm=[...Hm,{slug:"media",title:(0,b.__)("Media"),blocks:["core/post-featured-image"]},{slug:"widgets",title:(0,b.__)("Widgets"),blocks:[]},{slug:"embed",title:(0,b.__)("Embeds"),include:[]}],qm=[{slug:"overview",title:(0,b.__)("Overview"),blocks:[]},{slug:"text",title:(0,b.__)("Text"),blocks:["core/post-content","core/home-link","core/navigation-link"]},{slug:"colors",title:(0,b.__)("Colors"),blocks:[]},{slug:"blocks",title:(0,b.__)("All Blocks"),blocks:[],subcategories:Wm}];function Zm(e,t){var n;if(!e?.slug||!t?.length)return;const s=null!==(n=e?.subcategories)&&void 0!==n?n:[];if(s.length)return s.reduce(((e,n)=>{const s=Zm(n,t);return s&&(e.subcategories||(e.subcategories=[]),e.subcategories=[...e.subcategories,s]),e}),{title:e.title,slug:e.slug});const i=e?.blocks||[],r=e?.exclude||[],o=t.filter((t=>!r.includes(t.name)&&(t.category===e.slug||i.includes(t.name))));return o.length?{title:e.title,slug:e.slug,examples:o}:void 0}function Km(){const e=[...Hm,...Um].map((({slug:e})=>e)),t=(0,o.getCategories)().filter((({slug:t})=>!e.includes(t)));return[...Um,...t]}const Ym=({colors:e,type:t,templateColumns:n="1fr 1fr",itemHeight:s="52px"})=>e?(0,oe.jsx)(y.__experimentalGrid,{templateColumns:n,rowGap:8,columnGap:16,children:e.map((e=>{const n="gradients"===t?(0,x.__experimentalGetGradientClass)(e.slug):(0,x.getColorClassName)("background-color",e.slug),i=Ut("edit-site-style-book__color-example",n);return(0,oe.jsx)(Yt.View,{className:i,style:{height:s}},e.slug)}))}):null,Xm=({duotones:e})=>e?(0,oe.jsx)(y.__experimentalGrid,{columns:2,rowGap:16,columnGap:16,children:e.map((e=>(0,oe.jsxs)(y.__experimentalGrid,{className:"edit-site-style-book__duotone-example",columns:2,rowGap:8,columnGap:8,children:[(0,oe.jsx)(Yt.View,{children:(0,oe.jsx)("img",{alt:`Duotone example: ${e.slug}`,src:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",style:{filter:`url(#wp-duotone-${e.slug})`}})}),e.colors.map((e=>(0,oe.jsx)(Yt.View,{className:"edit-site-style-book__color-example",style:{backgroundColor:e}},e)))]},e.slug)))}):null;function Jm(e){const t=(0,o.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:s}=e;return"core/heading"!==t&&!!n&&!1!==s?.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,o.getBlockFromExample)(e.name,{...e.example,attributes:{...e.example.attributes,style:void 0}})})));if(!!!(0,o.getBlockType)("core/heading"))return t;const n={name:"core/heading",title:(0,b.__)("Headings"),category:"text",blocks:[1,2,3,4,5,6].map((e=>(0,o.createBlock)("core/heading",{content:(0,b.sprintf)((0,b.__)("Heading %d"),e),level:e})))},s=function(e){if(!e)return[];const t=[];return Gm.forEach((n=>{const s=e[n.type],i=Array.isArray(s)?s.find((e=>e.slug===n.origin)):void 0;if(i?.[n.type]){const e={name:n.slug,title:n.title,category:"colors"};"duotones"===n.type?(e.content=(0,oe.jsx)(Xm,{duotones:i[n.type]}),t.push(e)):(e.content=(0,oe.jsx)(Ym,{colors:i[n.type],type:n.type}),t.push(e))}})),t}(e),i=function(e){const t=[],n=Array.isArray(e?.colors)?e.colors.find((e=>"theme"===e.slug)):void 0;if(n){const e={name:"theme-colors",title:(0,b.__)("Colors"),category:"overview",content:(0,oe.jsx)(Ym,{colors:n.colors,type:"colors",templateColumns:"repeat(auto-fill, minmax( 200px, 1fr ))",itemHeight:"32px"})};t.push(e)}const s=[];if((0,o.getBlockType)("core/heading")){const e=(0,o.createBlock)("core/heading",{content:(0,b.__)("AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™"),level:1});s.push(e)}if((0,o.getBlockType)("core/paragraph")){const e=(0,o.createBlock)("core/paragraph",{content:(0,b.__)("A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.")}),t=(0,o.createBlock)("core/paragraph",{content:(0,b.__)("Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.")});if((0,o.getBlockType)("core/group")){const n=(0,o.createBlock)("core/group",{layout:{type:"grid",columnCount:2,minimumColumnWidth:"12rem"},style:{spacing:{blockGap:"1.5rem"}}},[e,t]);s.push(n)}else s.push(e)}return s.length&&t.push({name:"typography",title:(0,b.__)("Typography"),category:"overview",blocks:s}),["core/image","core/separator","core/buttons","core/pullquote","core/search"].forEach((e=>{const n=(0,o.getBlockType)(e);if(n&&n.example){const s={name:e,title:n.title,category:"overview",blocks:(0,o.getBlockFromExample)(e,{...n.example,attributes:{...n.example.attributes,style:void 0}})};t.push(s)}})),t}(e);return[n,...s,...t,...i]}function Qm({title:e,subTitle:t,actions:n}){return(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-page-header",as:"header",spacing:0,children:[(0,oe.jsxs)(y.__experimentalHStack,{className:"edit-site-page-header__page-title",children:[(0,oe.jsx)(y.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title",truncate:!0,children:e}),(0,oe.jsx)(y.FlexItem,{className:"edit-site-page-header__actions",children:n})]}),t&&(0,oe.jsx)(y.__experimentalText,{variant:"muted",as:"p",className:"edit-site-page-header__sub-title",children:t})]})}const{NavigableRegion:$m}=te(h.privateApis);function eg({title:e,subTitle:t,actions:n,children:s,className:i,hideTitleFromUI:r=!1}){const o=Ut("edit-site-page",i);return(0,oe.jsx)($m,{className:o,ariaLabel:e,children:(0,oe.jsxs)("div",{className:"edit-site-page-content",children:[!r&&e&&(0,oe.jsx)(Qm,{title:e,subTitle:t,actions:n}),s]})})}const{useLocation:tg,useHistory:ng}=te(Gt.privateApis),sg=({isStyleBookOpened:e,setIsStyleBookOpened:t,path:n})=>{const s=ng();return(0,oe.jsx)(y.Button,{isPressed:e,icon:za,label:(0,b.__)("Style Book"),onClick:()=>{t(!e);const i=e?(0,Qt.removeQueryArgs)(n,"preview"):(0,Qt.addQueryArgs)(n,{preview:"stylebook"});s.navigate(i)},size:"compact"})},ig=()=>{const{path:e,query:t}=tg(),n=ng();return(0,d.useMemo)((()=>{var s;return[null!==(s=t.section)&&void 0!==s?s:"/",t=>{n.navigate((0,Qt.addQueryArgs)(e,{section:t}))}]}),[e,t.section,n])};function rg(){const{path:e}=tg(),[t,n]=(0,d.useState)(e.includes("preview=stylebook")),s=(0,v.useViewportMatch)("medium","<"),[i,r]=ig();return(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(eg,{actions:s?null:(0,oe.jsx)(sg,{isStyleBookOpened:t,setIsStyleBookOpened:n,path:e}),className:"edit-site-styles",title:(0,b.__)("Styles"),children:(0,oe.jsx)($g,{path:i,onPathChange:r})})})}const{ExperimentalBlockEditorProvider:og,useGlobalStyle:ag,GlobalStylesContext:lg,useGlobalStylesOutputWithConfig:cg}=te(x.privateApis),{mergeBaseAndUserConfigs:ug}=te(h.privateApis),{Tabs:dg}=te(y.privateApis);function hg(e){return!e||0===Object.keys(e).length}const pg=(e,t)=>{if(!e||!t||!t?.contentDocument)return;const n="top"===e?t.contentDocument.body:t.contentDocument.getElementById(e);n&&n.scrollIntoView({behavior:"smooth"})},fg=e=>e&&"string"==typeof e&&("/"===e||e.startsWith("/typography")||e.startsWith("/colors")||e.startsWith("/blocks"))?{top:!0}:null;function mg(){const{colors:e,gradients:t}=(0,x.__experimentalUseMultipleOriginColorsAndGradients)(),[n,s,i,r]=(0,x.useSettings)("color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default");return(0,d.useMemo)((()=>{const o={colors:e,gradients:t,duotones:[]};return i&&i.length&&o.duotones.push({name:(0,b._x)("Theme","Indicates these duotone filters come from the theme."),slug:"theme",duotones:i}),n&&r&&r.length&&o.duotones.push({name:(0,b._x)("Default","Indicates these duotone filters come from WordPress."),slug:"default",duotones:r}),s&&s.length&&o.duotones.push({name:(0,b._x)("Custom","Indicates these doutone filters are created by the user."),slug:"custom",duotones:s}),o}),[e,t,s,i,r,n])}function gg(e){const t=[],n=Zm({slug:"overview"},e);t.push(...n.examples);const s=e.filter((e=>"overview"!==e.category&&!n.examples.find((t=>t.name===e.name))));return t.push(...s),t}const vg=({userConfig:e={},isStatic:t=!1})=>{const n=(0,l.useSelect)((e=>e(zt).getSettings()),[]),s=(0,l.useSelect)((e=>e(_.store).canUser("create",{kind:"root",name:"media"})),[]);(0,d.useEffect)((()=>{(0,l.dispatch)(x.store).updateSettings({...n,mediaUpload:s?zm.uploadMedia:void 0})}),[n,s]);const[i,r]=ig(),o=Jm(mg()),a=gg(o);let c=null;if(i.includes("/colors"))c="colors";else if(i.includes("/typography"))c="text";else if(i.includes("/blocks")){c="blocks";const e=decodeURIComponent(i).split("/blocks/")[1];e&&o.find((t=>t.name===e))&&(c=e)}else t||(c="overview");const u=qm.find((e=>e.slug===c)),h=u?Zm(u,o):{examples:[o.find((e=>e.name===c))]},p=c?h:{examples:a},{base:f}=(0,d.useContext)(lg),m=fg(i),g=(0,d.useMemo)((()=>hg(e)||hg(f)?{}:ug(f,e)),[f,e]),[v]=cg(g),y=(0,d.useMemo)((()=>({...n,styles:hg(v)||hg(e)?n.styles:v,isPreviewMode:!0})),[v,n,e]);return(0,oe.jsx)("div",{className:"edit-site-style-book",children:(0,oe.jsxs)(x.BlockEditorProvider,{settings:y,children:[(0,oe.jsx)(Ia,{disableRootPadding:!0}),(0,oe.jsx)(xg,{examples:p,settings:y,goTo:m,isSelected:t?null:e=>i===`/blocks/${encodeURIComponent(e)}`||i.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t?null:e=>{Gm.find((t=>t.slug===e))?r("/colors/palette"):r("typography"!==e?`/blocks/${encodeURIComponent(e)}`:"/typography")}})]})})},xg=({examples:e,isSelected:t,onClick:n,onSelect:s,settings:i,title:r,goTo:o})=>{const[a,l]=(0,d.useState)(!1),[c,u]=(0,d.useState)(!1),h=(0,d.useRef)(null),p={role:"button",onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!n||t!==Jt.ENTER&&t!==Jt.SPACE||(e.preventDefault(),n(e))},onClick:e=>{e.defaultPrevented||n&&(e.preventDefault(),n(e))},readonly:!0};return(0,d.useLayoutEffect)((()=>{c&&h?.current&&o?.top&&pg("top",h?.current)}),[h?.current,o,pg,c]),(0,oe.jsxs)(x.__unstableIframe,{onLoad:()=>u(!0),ref:h,className:Ut("edit-site-style-book__iframe",{"is-focused":a&&!!n,"is-button":!!n}),name:"style-book-canvas",tabIndex:0,...n?p:{},children:[(0,oe.jsx)(x.__unstableEditorStyles,{styles:i.styles}),(0,oe.jsxs)("style",{children:['\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n\n\n\t.edit-site-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 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\tmargin: 0 auto 40px auto;\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.is-disabled-example {\n\t\tpointer-events: none;\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__duotone-example > div:first-child {\n\t\tdisplay: flex;\n\t\taspect-ratio: 16 / 9;\n\t\tgrid-row: span 1;\n\t\tgrid-column: span 2;\n\t}\n\t.edit-site-style-book__duotone-example img {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tobject-fit: cover;\n\t}\n\t.edit-site-style-book__duotone-example > div:not(:first-child) {\n\t\theight: 20px;\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__color-example {\n\t\tborder: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title,\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: 13px;\n\t\tfont-weight: normal;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tpadding-top: 8px;\n\t\tborder-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );\n\t\tcolor: color-mix( in srgb, currentColor 60%, transparent );\n\t}\n\n\t.edit-site-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tpadding-bottom: 8px;\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\t:where(.is-root-container > .wp-block:first-child) {\n\t\tmargin-top: 0;\n\t}\n\t:where(.is-root-container > .wp-block:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n',!!n&&"body { cursor: pointer; } body * { pointer-events: none; }"]}),(0,oe.jsx)(yg,{className:"edit-site-style-book__examples",filteredExamples:e,label:r?(0,b.sprintf)((0,b.__)("Examples of blocks in the %s category"),r):(0,b.__)("Examples of blocks"),isSelected:t,onSelect:s},r)]})},yg=(0,d.memo)((({className:e,filteredExamples:t,label:n,isSelected:s,onSelect:i})=>(0,oe.jsxs)(y.Composite,{orientation:"vertical",className:e,"aria-label":n,role:"grid",children:[!!t?.examples?.length&&t.examples.map((e=>(0,oe.jsx)(_g,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:s?.(e.name),onClick:i?()=>i(e.name):null},e.name))),!!t?.subcategories?.length&&t.subcategories.map((e=>(0,oe.jsxs)(y.Composite.Group,{className:"edit-site-style-book__subcategory",children:[(0,oe.jsx)(y.Composite.GroupLabel,{children:(0,oe.jsx)("h2",{className:"edit-site-style-book__subcategory-title",children:e.title})}),(0,oe.jsx)(bg,{examples:e.examples,isSelected:s,onSelect:i})]},`subcategory-${e.slug}`)))]}))),bg=({examples:e,isSelected:t,onSelect:n})=>!!e?.length&&e.map((e=>(0,oe.jsx)(_g,{id:`example-${e.name}`,title:e.title,content:e.content,blocks:e.blocks,isSelected:t?.(e.name),onClick:n?()=>n(e.name):null},e.name))),wg=["example-duotones"],_g=({id:e,title:t,blocks:n,isSelected:s,onClick:i,content:r})=>{const o=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),a=(0,d.useMemo)((()=>({...o,focusMode:!1,isPreviewMode:!0})),[o]),c=(0,d.useMemo)((()=>Array.isArray(n)?n:[n]),[n]),u=wg.includes(e)||!i?{disabled:!0,accessibleWhenDisabled:!!i}:{};return(0,oe.jsx)("div",{role:"row",children:(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsxs)(y.Composite.Item,{className:Ut("edit-site-style-book__example",{"is-selected":s,"is-disabled-example":!!u?.disabled}),id:e,"aria-label":i?(0,b.sprintf)((0,b.__)("Open %s styles in Styles panel"),t):void 0,render:(0,oe.jsx)("div",{}),role:i?"button":null,onClick:i,...u,children:[(0,oe.jsx)("span",{className:"edit-site-style-book__example-title",children:t}),(0,oe.jsx)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0,children:(0,oe.jsx)(y.Disabled,{className:"edit-site-style-book__example-preview__content",children:r||(0,oe.jsxs)(og,{value:c,settings:a,children:[(0,oe.jsx)(x.__unstableEditorStyles,{}),(0,oe.jsx)(x.BlockList,{renderAppender:!1})]})})})]})})})},jg=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:s,showCloseButton:i=!0,onClose:r,showTabs:o=!0,userConfig:a={},path:c=""}){const[u]=ag("color.text"),[h]=ag("color.background"),p=mg(),f=(0,d.useMemo)((()=>Jm(p)),[p]),m=(0,d.useMemo)((()=>Km().filter((e=>f.some((t=>t.category===e.slug))))),[f]),g=gg(f),{base:v}=(0,d.useContext)(lg),y=fg(c),w=(0,d.useMemo)((()=>hg(a)||hg(v)?{}:ug(v,a)),[v,a]),_=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),[j]=cg(w),S=(0,d.useMemo)((()=>({..._,styles:hg(j)||hg(a)?_.styles:j,isPreviewMode:!0})),[j,_,a]);return(0,oe.jsx)(Go,{onClose:r,enableResizing:e,closeButtonLabel:i?(0,b.__)("Close"):null,children:(0,oe.jsx)("div",{className:Ut("edit-site-style-book",{"is-button":!!n}),style:{color:u,background:h},children:o?(0,oe.jsxs)(dg,{children:[(0,oe.jsx)("div",{className:"edit-site-style-book__tablist-container",children:(0,oe.jsx)(dg.TabList,{children:m.map((e=>(0,oe.jsx)(dg.Tab,{tabId:e.slug,children:e.title},e.slug)))})}),m.map((e=>{const n=e.slug?Km().find((t=>t.slug===e.slug)):null,i=n?Zm(n,f):{examples:f};return(0,oe.jsx)(dg.TabPanel,{tabId:e.slug,focusable:!1,className:"edit-site-style-book__tabpanel",children:(0,oe.jsx)(xg,{category:e.slug,examples:i,isSelected:t,onSelect:s,settings:S,title:e.title,goTo:y})},e.slug)}))]}):(0,oe.jsx)(xg,{examples:{examples:g},isSelected:t,onClick:n,onSelect:s,settings:S,goTo:y})})})},{useGlobalStyle:Sg,AdvancedPanel:Cg}=te(x.privateApis);const kg=function(){const e=(0,b.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=Sg("",void 0,"user",{shouldDecodeEncode:!1}),[n,s]=Sg("",void 0,"all",{shouldDecodeEncode:!1}),{setEditorCanvasContainerView:i}=te((0,l.useDispatch)(zt));return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:(0,b.__)("CSS"),description:(0,oe.jsxs)(oe.Fragment,{children:[e,(0,oe.jsx)("br",{}),(0,oe.jsx)(y.ExternalLink,{href:(0,b.__)("https://developer.wordpress.org/advanced-administration/wordpress/css/"),className:"edit-site-global-styles-screen-css-help-link",children:(0,b.__)("Learn more about CSS")})]}),onBack:()=>{i(void 0)}}),(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-css",children:(0,oe.jsx)(Cg,{value:t,onChange:s,inheritedValue:n})})]})},{ExperimentalBlockEditorProvider:Eg,GlobalStylesContext:Pg,useGlobalStylesOutputWithConfig:Ig,__unstableBlockStyleVariationOverridesWithConfig:Tg}=te(x.privateApis),{mergeBaseAndUserConfigs:Og}=te(h.privateApis);function Ag(e){return!e||0===Object.keys(e).length}const Ng=function({userConfig:e,blocks:t}){const{base:n}=(0,d.useContext)(Pg),s=(0,d.useMemo)((()=>Ag(e)||Ag(n)?{}:Og(n,e)),[n,e]),i=(0,d.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),r=(0,l.useSelect)((e=>e(x.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,isPreviewMode:!0})),[r]),[a]=Ig(s),c=Ag(a)||Ag(e)?o.styles:a;return(0,oe.jsx)(Go,{title:(0,b.__)("Revisions"),closeButtonLabel:(0,b.__)("Close revisions"),enableResizing:!0,children:(0,oe.jsxs)(x.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,oe.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,oe.jsx)(y.Disabled,{className:"edit-site-revisions__example-preview__content",children:(0,oe.jsxs)(Eg,{value:i,settings:o,children:[(0,oe.jsx)(x.BlockList,{renderAppender:!1}),(0,oe.jsx)(x.__unstableEditorStyles,{styles:c}),(0,oe.jsx)(Tg,{config:s})]})})]})})},Mg=window.wp.date,{getGlobalStylesChanges:Vg}=te(x.privateApis);function Fg({revision:e,previousRevision:t}){const n=Vg(e,t,{maxResults:7});return n.length?(0,oe.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes",children:n.map((e=>(0,oe.jsx)("li",{children:e},e)))}):null}const Rg=function({userRevisions:e,selectedRevisionId:t,onChange:n,canApplyRevision:s,onApplyRevision:i}){const{currentThemeName:r,currentUser:o}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:n}=e(_.store),s=t();return{currentThemeName:s?.name?.rendered||s?.stylesheet,currentUser:n()}}),[]),a=(0,Mg.getDate)().getTime(),{datetimeAbbreviated:c}=(0,Mg.getSettings)().formats;return(0,oe.jsx)(y.Composite,{orientation:"vertical",className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,b.__)("Global styles revisions list"),role:"listbox",children:e.map(((l,u)=>{const{id:d,author:h,modified:p}=l,f="unsaved"===d,m=f?o:h,g=m?.name||(0,b.__)("User"),v=m?.avatar_urls?.[48],x=t?t===d:0===u,w=!s&&x,_="parent"===d,j=(0,Mg.getDate)(p),S=p&&a-j.getTime()>864e5?(0,Mg.dateI18n)(c,j):(0,Mg.humanTimeDiff)(p),C=function(e,t,n,s){return"parent"===e?(0,b.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,b.sprintf)((0,b.__)("Unsaved changes by %s"),t):s?(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)}(d,g,(0,Mg.dateI18n)(c,j),w);return(0,oe.jsxs)(y.Composite.Item,{className:"edit-site-global-styles-screen-revisions__revision-item","aria-current":x,role:"option",onKeyDown:e=>{const{keyCode:t}=e;t!==Jt.ENTER&&t!==Jt.SPACE||n(l)},onClick:e=>{e.preventDefault(),n(l)},"aria-selected":x,"aria-label":C,render:(0,oe.jsx)("div",{}),children:[(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__revision-item-wrapper",children:_?(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[(0,b.__)("Default styles"),(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:r})]}):(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[f?(0,oe.jsx)("span",{className:"edit-site-global-styles-screen-revisions__date",children:(0,b.__)("(Unsaved)")}):(0,oe.jsx)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:p,children:S}),(0,oe.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:[(0,oe.jsx)("img",{alt:g,src:v}),g]}),x&&(0,oe.jsx)(Fg,{revision:l,previousRevision:un(1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,b.__)("First page"),icon:(0,b.isRTL)()?lu:cu,size:"compact"}),(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(e-1),accessibleWhenDisabled:!0,disabled:r||1===e,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?Yo:Xo,size:"compact"})]}),(0,oe.jsx)(y.__experimentalText,{variant:"muted",children:(0,b.sprintf)((0,b._x)("%1$s of %2$s","paging"),e,t)}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(e+1),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?Xo:Yo,size:"compact"}),(0,oe.jsx)(y.Button,{variant:o,onClick:()=>n(t),accessibleWhenDisabled:!0,disabled:r||e===t,label:(0,b.__)("Last page"),icon:(0,b.isRTL)()?cu:lu,size:"compact"})]})]})}const{GlobalStylesContext:Dg,areGlobalStyleConfigsEqual:Lg}=te(x.privateApis);const zg=function(){const{user:e,setUserConfig:t}=(0,d.useContext)(Dg),{blocks:n,editorCanvasContainerView:s}=(0,l.useSelect)((e=>({editorCanvasContainerView:te(e(zt)).getEditorCanvasContainerView(),blocks:e(x.store).getBlocks()})),[]),[i,r]=(0,d.useState)(1),[o,a]=(0,d.useState)([]),{revisions:c,isLoading:u,hasUnsavedChanges:h,revisionsCount:p}=da({query:{per_page:10,page:i}}),f=Math.ceil(p/10),[m,g]=(0,d.useState)(e),[v,w]=(0,d.useState)(!1),{setEditorCanvasContainerView:_}=te((0,l.useDispatch)(zt)),j=Lg(m,e),S=()=>{_("global-styles-revisions:style-book"===s?"style-book":void 0)},C=e=>{t((()=>e)),w(!1),S()};(0,d.useEffect)((()=>{!u&&c.length&&a(c)}),[c,u]);const k=c[0],E=m?.id,P=!!k?.id&&!j&&!E;(0,d.useEffect)((()=>{P&&g(k)}),[P,k]);const I=!!E&&"unsaved"!==E&&!j,T=!!o.length;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pl,{title:p&&(0,b.sprintf)((0,b.__)("Revisions (%s)"),p),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:S}),!T&&(0,oe.jsx)(y.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),T&&("global-styles-revisions:style-book"===s?(0,oe.jsx)(jg,{userConfig:m,isSelected:()=>{},onClose:()=>{_("global-styles-revisions")}}):(0,oe.jsx)(Ng,{blocks:n,userConfig:m,closeButtonLabel:(0,b.__)("Close revisions")})),(0,oe.jsx)(Rg,{onChange:g,selectedRevisionId:E,userRevisions:o,canApplyRevision:I,onApplyRevision:()=>h?w(!0):C(m)}),f>1&&(0,oe.jsx)("div",{className:"edit-site-global-styles-screen-revisions__footer",children:(0,oe.jsx)(Bg,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:i,numPages:f,changePage:r,totalItems:p,disabled:u,label:(0,b.__)("Global Styles pagination")})}),v&&(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:v,confirmButtonText:(0,b.__)("Apply"),onConfirm:()=>C(m),onCancel:()=>w(!1),size:"medium",children:(0,b.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})},{useGlobalStylesReset:Gg}=te(x.privateApis),{Slot:Hg,Fill:Ug}=(0,y.createSlotFill)("GlobalStylesMenu");function Wg(){const[e,t]=Gg(),{toggle:n}=(0,l.useDispatch)(f.store),{canEditCSS:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(_.store),s=n(),i=s?t("root","globalStyles",s):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:i}=te((0,l.useDispatch)(zt)),r=()=>{i("global-styles-css")};return(0,oe.jsx)(Ug,{children:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("More"),toggleProps:{size:"compact"},children:({onClose:i})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.MenuGroup,{children:[s&&(0,oe.jsx)(y.MenuItem,{onClick:r,children:(0,b.__)("Additional CSS")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{n("core/edit-site","welcomeGuideStyles"),i()},children:(0,b.__)("Welcome Guide")})]}),(0,oe.jsx)(y.MenuGroup,{children:(0,oe.jsx)(y.MenuItem,{onClick:()=>{t(),i()},disabled:!e,children:(0,b.__)("Reset styles")})})]})})})}function qg({className:e,...t}){return(0,oe.jsx)(y.Navigator.Screen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Zg({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,s)=>(0,oe.jsx)(qg,{path:e+"/variations/"+t.name,children:(0,oe.jsx)(ac,{name:n,variation:t.name})},s)))}function Kg({name:e,parentMenu:t=""}){const n=(0,l.useSelect)((t=>{const{getBlockStyles:n}=t(o.store);return n(e)}),[e]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(qg,{path:t+"/colors/palette",children:(0,oe.jsx)(Jf,{name:e})}),!!n?.length&&(0,oe.jsx)(Zg,{parentMenu:t,blockStyles:n,blockName:e})]})}function Yg(){const e=(0,y.useNavigator)(),{path:t}=e.location;return(0,oe.jsx)(jg,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{Gm.find((e=>e.slug===t))?e.goTo("/colors/palette"):"typography"!==t?e.goTo("/blocks/"+encodeURIComponent(t)):e.goTo("/typography")}})}function Xg(){const e=(0,y.useNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,l.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(x.store),s=t();return{selectedBlockName:n(s),selectedBlockClientId:s}}),[]),s=Vl(t);(0,d.useEffect)((()=>{if(!n||!s)return;const i=e.location.path;if("/blocks"!==i&&!i.startsWith("/blocks/"))return;const r="/blocks/"+encodeURIComponent(t);r!==i&&e.goTo(r,{skipFocus:!0})}),[n,t,s])}function Jg(){const{goTo:e,location:t}=(0,y.useNavigator)(),n=(0,l.useSelect)((e=>te(e(zt)).getEditorCanvasContainerView()),[]),s=t?.path,i="/revisions"===s;(0,d.useEffect)((()=>{switch(n){case"global-styles-revisions":case"global-styles-revisions:style-book":i||e("/revisions");break;case"global-styles-css":e("/css");break;default:i&&e("/",{isBack:!0})}}),[n,i,e])}function Qg({path:e,onPathChange:t,children:n}){return function(e,t){const n=(0,y.useNavigator)(),{path:s}=n.location,i=(0,v.usePrevious)(e),r=(0,v.usePrevious)(s);(0,d.useEffect)((()=>{e!==s&&(e!==i?n.goTo(e):s!==r&&t(s))}),[t,e,r,i,s,n])}(e,t),n}const $g=function({path:e,onPathChange:t}){const n=(0,o.getBlockTypes)(),s=(0,l.useSelect)((e=>te(e(zt)).getEditorCanvasContainerView()),[]);return(0,oe.jsxs)(y.Navigator,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/",children:[e&&t&&(0,oe.jsx)(Qg,{path:e,onPathChange:t}),(0,oe.jsx)(qg,{path:"/",children:(0,oe.jsx)(jl,{})}),(0,oe.jsx)(qg,{path:"/variations",children:(0,oe.jsx)(Lm,{})}),(0,oe.jsx)(qg,{path:"/blocks",children:(0,oe.jsx)(Bl,{})}),(0,oe.jsx)(qg,{path:"/typography",children:(0,oe.jsx)(sf,{})}),(0,oe.jsx)(qg,{path:"/typography/font-sizes",children:(0,oe.jsx)(Pf,{})}),(0,oe.jsx)(qg,{path:"/typography/font-sizes/:origin/:slug",children:(0,oe.jsx)(_f,{})}),(0,oe.jsx)(qg,{path:"/typography/text",children:(0,oe.jsx)(pf,{element:"text"})}),(0,oe.jsx)(qg,{path:"/typography/link",children:(0,oe.jsx)(pf,{element:"link"})}),(0,oe.jsx)(qg,{path:"/typography/heading",children:(0,oe.jsx)(pf,{element:"heading"})}),(0,oe.jsx)(qg,{path:"/typography/caption",children:(0,oe.jsx)(pf,{element:"caption"})}),(0,oe.jsx)(qg,{path:"/typography/button",children:(0,oe.jsx)(pf,{element:"button"})}),(0,oe.jsx)(qg,{path:"/colors",children:(0,oe.jsx)(Bf,{})}),(0,oe.jsx)(qg,{path:"/shadows",children:(0,oe.jsx)(Sm,{})}),(0,oe.jsx)(qg,{path:"/shadows/edit/:category/:slug",children:(0,oe.jsx)(Cm,{})}),(0,oe.jsx)(qg,{path:"/layout",children:(0,oe.jsx)(Vm,{})}),(0,oe.jsx)(qg,{path:"/css",children:(0,oe.jsx)(kg,{})}),(0,oe.jsx)(qg,{path:"/revisions",children:(0,oe.jsx)(zg,{})}),(0,oe.jsx)(qg,{path:"/background",children:(0,oe.jsx)(rm,{})}),n.map((e=>(0,oe.jsx)(qg,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,oe.jsx)(ac,{name:e.name})},"menu-block-"+e.name))),(0,oe.jsx)(Kg,{}),n.map((e=>(0,oe.jsx)(Kg,{name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)},"screens-block-"+e.name))),"style-book"===s&&(0,oe.jsx)(Yg,{}),(0,oe.jsx)(Wg,{}),(0,oe.jsx)(Xg,{}),(0,oe.jsx)(Jg,{})]})},{ComplementaryArea:ev,ComplementaryAreaMoreMenuItem:tv}=te(h.privateApis);function nv({className:e,identifier:t,title:n,icon:s,children:i,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(ev,{className:e,scope:"core",identifier:t,title:n,icon:s,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c,children:i}),(0,oe.jsx)(tv,{scope:"core",identifier:t,icon:s,children:n})]})}const{interfaceStore:sv}=te(h.privateApis),{useLocation:iv}=te(Gt.privateApis);function rv(){const{query:e}=iv(),{canvas:t="view",name:n}=e,{shouldClearCanvasContainerView:s,isStyleBookOpened:i,showListViewByDefault:r,hasRevisions:o,isRevisionsOpened:a,isRevisionsStyleBookOpened:c}=(0,l.useSelect)((e=>{const{getActiveComplementaryArea:n}=e(sv),{getEditorCanvasContainerView:s}=te(e(zt)),i=s(),r="visual"===e(h.store).getEditorMode(),o="edit"===t,a=e(f.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(_.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===i,shouldClearCanvasContainerView:"edit-site/global-styles"!==n("core")||!r||!o,showListViewByDefault:a,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===i,isRevisionsOpened:"global-styles-revisions"===i}}),[t]),{setEditorCanvasContainerView:u}=te((0,l.useDispatch)(zt)),p=(0,v.useViewportMatch)("medium","<");(0,d.useEffect)((()=>{s&&u(void 0)}),[s,u]);const{setIsListViewOpened:m}=(0,l.useDispatch)(h.store),{getActiveComplementaryArea:g}=(0,l.useSelect)(sv),{enableComplementaryArea:x}=(0,l.useDispatch)(sv),w=(0,d.useRef)(null);return(0,d.useEffect)((()=>{"styles"===n&&"edit"===t?(w.current=g("core"),x("core","edit-site/global-styles")):w.current&&x("core",w.current)}),[n,x,t,g]),(0,oe.jsx)(nv,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,b.__)("Styles"),icon:_o,closeLabel:(0,b.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,oe.jsxs)(y.Flex,{className:"edit-site-global-styles-sidebar__header",gap:1,children:[(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)("h2",{className:"edit-site-global-styles-sidebar__header-title",children:(0,b.__)("Styles")})}),(0,oe.jsxs)(y.Flex,{justify:"flex-end",gap:1,className:"edit-site-global-styles-sidebar__header-actions",children:[!p&&(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{icon:za,label:(0,b.__)("Style Book"),isPressed:i||c,accessibleWhenDisabled:!0,disabled:s,onClick:()=>{a?u("global-styles-revisions:style-book"):c?u("global-styles-revisions"):(m(i&&r),u(i?void 0:"style-book"))},size:"compact"})}),(0,oe.jsx)(y.FlexItem,{children:(0,oe.jsx)(y.Button,{label:(0,b.__)("Revisions"),icon:Eo,onClick:()=>{m(!1),u(c?"style-book":a?void 0:i?"global-styles-revisions:style-book":"global-styles-revisions")},accessibleWhenDisabled:!0,disabled:!o,isPressed:a||c,size:"compact"})}),(0,oe.jsx)(Hg,{})]})]}),children:(0,oe.jsx)($g,{})})}const ov=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),av=window.wp.blob;function lv(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,oe.jsx)(y.MenuItem,{role:"menuitem",icon:ov,onClick:async function(){try{const e=await oo()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),s=n[1]?n[1]:"edit-site-export";(0,av.downloadBlob)(s+".zip",t,"application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const s=n.message&&"unknown_error"!==n.code?n.message:(0,b.__)("An error occurred while creating the site export.");e(s,{type:"snackbar"})}},info:(0,b.__)("Download your theme with updated templates and styles."),children:(0,b._x)("Export","site exporter menu item")})}function cv(){const{toggle:e}=(0,l.useDispatch)(f.store);return(0,oe.jsx)(y.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide"),children:(0,b.__)("Welcome Guide")})}const{ToolsMoreMenuGroup:uv,PreferencesModal:dv}=te(h.privateApis);function hv(){const e=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(uv,{children:[e&&(0,oe.jsx)(lv,{}),(0,oe.jsx)(cv,{})]}),(0,oe.jsx)(dv,{})]})}const{useLocation:pv,useHistory:fv}=te(Gt.privateApis);const{useLocation:mv}=te(Gt.privateApis);const{getTemplateInfo:gv}=te(h.privateApis);const vv=function(e,t){const{title:n,isLoaded:s}=(0,l.useSelect)((n=>{var s;const{getEditedEntityRecord:i,getCurrentTheme:r,hasFinishedResolution:o}=n(_.store);if(!t)return{isLoaded:!1};const a=i("postType",e,t),{default_template_types:l=[]}=null!==(s=r())&&void 0!==s?s:{},c=gv({template:a,templateTypes:l}),u=o("getEditedEntityRecord",["postType",e,t]);return{title:c.title,isLoaded:u}}),[e,t]);let i;var r;s&&(i=(0,b.sprintf)((0,b._x)("%1$s ‹ %2$s","breadcrumb trail"),(0,Kt.decodeEntities)(n),null!==(r=Ve[e])&&void 0!==r?r:Ve[Se])),function(e){const t=mv(),n=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]),s=(0,d.useRef)(!0);(0,d.useEffect)((()=>{s.current=!1}),[t]),(0,d.useEffect)((()=>{if(!s.current&&e&&n){const t=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,Kt.decodeEntities)(e),(0,Kt.decodeEntities)(n));document.title=t,(0,Sl.speak)(e,"assertive")}}),[e,n,t])}(s&&i)};const{useLocation:xv}=te(Gt.privateApis),yv=[Se,Ce,je,Ie.user],bv=["page","post"];function wv(){const e=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","__unstableBase");return n?.home}),[]);return(0,oe.jsx)("iframe",{src:(0,Qt.addQueryArgs)(e,{wp_site_preview:1}),title:(0,b.__)("Site Preview"),style:{display:"block",width:"100%",height:"100%",backgroundColor:"#fff"},onLoad:e=>{const t=e.target.contentDocument;tn.focus.focusable.find(t).forEach((e=>{e.style.pointerEvents="none",e.tabIndex=-1,e.setAttribute("aria-hidden","true")}))}})}const{Editor:_v,BackButton:jv}=te(h.privateApis),{useHistory:Sv,useLocation:Cv}=te(Gt.privateApis),{BlockKeyboardShortcuts:kv}=te(a.privateApis),Ev={edit:{opacity:0,scale:.2},hover:{opacity:1,scale:1,clipPath:"inset( 22% round 2px )"}},Pv={edit:{clipPath:"inset(0% round 0px)"},hover:{clipPath:"inset( 22% round 2px )"},tap:{clipPath:"inset(0% round 0px)"}};function Iv(e){switch(e){case"navigation":return"/navigation";case"wp_block":return"/pattern?postType=wp_block";case"wp_template_part":return"/pattern?postType=wp_template_part";case"wp_template":return"/template";case"page":return"/page";case"post":return"/"}throw"Unknown post type"}function Tv({isHomeRoute:e=!1,isPostsList:t=!1}){const n=(0,v.useReducedMotion)(),s=Cv(),{canvas:i="view"}=s.query,r=Cn();!function(e){const{clearSelectedBlock:t}=(0,l.useDispatch)(x.store),{setDeviceType:n,closePublishSidebar:s,setIsListViewOpened:i,setIsInserterOpened:r}=(0,l.useDispatch)(h.store),{get:o}=(0,l.useSelect)(f.store),a=(0,l.useRegistry)();(0,d.useLayoutEffect)((()=>{const l=window.matchMedia("(min-width: 782px)").matches;a.batch((()=>{t(),n("Desktop"),s(),r(!1),l&&"edit"===e&&o("core","showListViewByDefault")&&!o("core","distractionFree")?i(!0):i(!1)}))}),[e,a,t,n,s,r,i,o])}(i);const o=function(){const{name:e,params:t={},query:n}=xv(),{postId:s=n?.postId}=t;let i;"navigation-item"===e?i=je:"pattern-item"===e?i=Ie.user:"template-part-item"===e?i=Ce:"template-item"===e||"templates"===e?i=Se:"page-item"===e||"pages"===e?i="page":"post-item"!==e&&"posts"!==e||(i="post");const r=(0,l.useSelect)((e=>{const{getHomePage:t}=te(e(_.store));return t()}),[]),o=(0,l.useSelect)((e=>{if(yv.includes(i)&&s)return;if(s&&s.includes(","))return;const{getTemplateId:t}=te(e(_.store));return i&&s&&bv.includes(i)?t(i,s):"page"===r?.postType?t("page",r?.postId):"wp_template"===r?.postType?r?.postId:void 0}),[r,s,i]),a=(0,d.useMemo)((()=>yv.includes(i)&&s?{}:i&&s&&bv.includes(i)?{postType:i,postId:s}:"page"===r?.postType?{postType:"page",postId:r?.postId}:{}),[r,i,s]);return yv.includes(i)&&s?{isReady:!0,postType:i,postId:s,context:a}:r?{isReady:void 0!==o,postType:Se,postId:o,context:a}:{isReady:!1}}();!function({postType:e,postId:t,context:n,isReady:s}){const{setEditedEntity:i}=(0,l.useDispatch)(zt);(0,d.useEffect)((()=>{s&&i(e,t,n)}),[s,e,t,n,i])}(o);const{postType:a,postId:c,context:u}=o,{isBlockBasedTheme:p,editorCanvasView:m,currentPostIsTrashed:g,hasSiteIcon:j}=(0,l.useSelect)((e=>{const{getEditorCanvasContainerView:t}=te(e(zt)),{getCurrentTheme:n,getEntityRecord:s}=e(_.store),i=s("root","__unstableBase",void 0);return{isBlockBasedTheme:n()?.is_block_theme,editorCanvasView:t(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status"),hasSiteIcon:!!i?.site_icon_url}}),[]),S=!!u?.postId;vv(S?u.postType:a,S?u.postId:c);const C=Qr(),k=!zo(),E=function(){const{query:e,path:t}=pv(),n=fv(),{canvas:s="view"}=e,i=(0,l.useSelect)((e=>"trash"===e(h.store).getCurrentPostAttribute("status")),[]),[r,o]=(0,d.useState)(!1);(0,d.useEffect)((()=>{"edit"===s&&o(!1)}),[s]);const a={"aria-label":(0,b.__)("Edit"),"aria-disabled":i,title:null,role:"button",tabIndex:0,onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:e=>{const{keyCode:s}=e;s!==Jt.ENTER&&s!==Jt.SPACE||i||(e.preventDefault(),n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}))},onClick:()=>n.navigate((0,Qt.addQueryArgs)(t,{canvas:"edit"}),{transition:"canvas-mode-edit-transition"}),onClickCapture:e=>{i&&(e.preventDefault(),e.stopPropagation())},readonly:!0};return{className:Ut("edit-site-visual-editor__editor-canvas",{"is-focused":r&&"view"===s}),..."view"===s?a:{}}}(),P="edit"===i,I=(0,v.useInstanceId)(Aa,"edit-site-editor__loading-progress"),T=Fa(),O=(0,d.useMemo)((()=>[...T.styles,{css:"view"===i?`body{min-height: 100vh; ${g?"":"cursor: pointer;"}}`:void 0}]),[T.styles,i,g]),{resetZoomLevel:A}=te((0,l.useDispatch)(x.store)),{createSuccessNotice:N}=(0,l.useDispatch)(w.store),M=Sv(),V=(0,d.useCallback)(((e,t)=>{switch(e){case"move-to-trash":case"delete-post":M.navigate(Iv(S?u.postType:a));break;case"duplicate-post":{const e=t[0],n="string"==typeof e.title?e.title:e.title?.rendered;N((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(n)),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,b.__)("Edit"),onClick:()=>{M.navigate(`/${e.type}/${e.id}?canvas=edit`)}}]})}}}),[a,u?.postType,S,M,N]),F=Lo(m),R=!r,B={duration:n?0:.2};return!p&&e?(0,oe.jsx)(wv,{}):(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Ia,{disableRootPadding:a!==Se}),(0,oe.jsx)(h.EditorKeyboardShortcutsRegister,{}),P&&(0,oe.jsx)(kv,{}),R?null:(0,oe.jsx)(Aa,{id:I}),P&&(0,oe.jsx)(Ea,{postType:S?u.postType:a}),R&&(0,oe.jsxs)(_v,{postType:S?u.postType:a,postId:S?u.postId:c,templateId:S?c:void 0,settings:T,className:"edit-site-editor__editor-interface",styles:O,customSaveButton:C&&(0,oe.jsx)(to,{size:"compact"}),customSavePanel:C&&(0,oe.jsx)(po,{}),forceDisableBlockTools:!k,title:F,iframeProps:E,onActionPerformed:V,extraSidebarPanels:!S&&(0,oe.jsx)(La.Slot,{}),children:[P&&(0,oe.jsx)(jv,{children:({length:e})=>e<=1&&(0,oe.jsxs)(y.__unstableMotion.div,{className:"edit-site-editor__view-mode-toggle",transition:B,animate:"edit",initial:"edit",whileHover:"hover",whileTap:"tap",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,label:(0,b.__)("Open Navigation"),showTooltip:!0,tooltipPosition:"middle right",onClick:()=>{A(),t&&s.query?.focusMode?M.navigate("/",{transition:"canvas-mode-view-transition"}):M.navigate(function(e,t){const{path:n,name:s}=e;return["pattern-item","template-part-item","page-item","template-item","post-item"].includes(s)?Iv(t):(0,Qt.addQueryArgs)(n,{canvas:void 0})}(s,S?u.postType:a),{transition:"canvas-mode-view-transition"})},children:(0,oe.jsx)(y.__unstableMotion.div,{variants:Pv,children:(0,oe.jsx)(en,{className:"edit-site-editor__view-mode-toggle-icon"})})}),(0,oe.jsx)(y.__unstableMotion.div,{className:Ut("edit-site-editor__back-icon",{"has-site-icon":j}),variants:Ev,children:(0,oe.jsx)(ta,{icon:ba})})]})}),(0,oe.jsx)(hv,{}),p&&(0,oe.jsx)(rv,{})]})]})}function Ov(e){const t=e.currentTheme?.is_block_theme,n=e.currentTheme?.theme_supports["editor-styles"],s=e.editorSettings?.supportsLayout;return!t&&(n||s)}const Av={name:"home",path:"/",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(xa,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(Tv,{isHomeRoute:!0}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t||Ov(e)?(0,oe.jsx)(xa,{}):(0,oe.jsx)(ya,{})}}},{useLocation:Nv}=te(Gt.privateApis);function Mv(){const{query:e={}}=Nv(),{canvas:t}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(rg,{})}const Vv={name:"styles",path:"/styles",areas:{content:(0,oe.jsx)(rg,{}),sidebar:(0,oe.jsx)(ga,{backPath:"/"}),preview:({query:e})=>"stylebook"===e.preview?(0,oe.jsx)(vg,{}):(0,oe.jsx)(Tv,{}),mobile:(0,oe.jsx)(Mv,{})},widths:{content:380}},Fv={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"};function Rv({menuTitle:e,onClose:t,onSave:n}){const[s,i]=(0,d.useState)(e),r=s!==e&&(o=s,o?.trim()?.length>0);var o;return(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:t,focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)("form",{className:"sidebar-navigation__rename-modal-form",children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"3",children:[(0,oe.jsx)(y.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:s,placeholder:(0,b.__)("Navigation title"),onChange:i,label:(0,b.__)("Name")}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,accessibleWhenDisabled:!0,disabled:!r,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),r&&(n({title:s}),t())},children:(0,b.__)("Save")})]})]})})})}function Bv({onClose:e,onConfirm:t}){return(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{t(),e()},onCancel:e,confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.__)("Are you sure you want to delete this Navigation Menu?")})}const{useHistory:Dv}=te(Gt.privateApis),Lv={position:"bottom right"};function zv(e){const{onDelete:t,onSave:n,onDuplicate:s,menuTitle:i,menuId:r}=e,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),u=Dv(),h=()=>{a(!1),c(!1)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,b.__)("Actions"),icon:Ga,popoverProps:Lv,children:({onClose:e})=>(0,oe.jsx)("div",{children:(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{u.navigate(`/wp_navigation/${r}?canvas=edit`)},children:(0,b.__)("Edit")}),(0,oe.jsx)(y.MenuItem,{onClick:()=>{s(),e()},children:(0,b.__)("Duplicate")}),(0,oe.jsx)(y.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()},children:(0,b.__)("Delete")})]})})}),l&&(0,oe.jsx)(Bv,{onClose:h,onConfirm:t}),o&&(0,oe.jsx)(Rv,{onClose:h,menuTitle:i,onSave:n})]})}const Gv=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Hv=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Uv={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useHistory:Wv,useLocation:qv}=te(Gt.privateApis);function Zv(e){const t=Wv(),{path:n}=qv(),{block:s}=e,{clientId:i}=s,{moveBlocksDown:r,moveBlocksUp:o,removeBlocks:a}=(0,l.useDispatch)(x.store),c=(0,b.sprintf)((0,b.__)("Remove %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),u=(0,b.sprintf)((0,b.__)("Go to %s"),(0,x.BlockTitle)({clientId:i,maximumLength:25})),h=(0,l.useSelect)((e=>{const{getBlockRootClientId:t}=e(x.store);return t(i)}),[i]),p=(0,d.useCallback)((e=>{const{attributes:s,name:i}=e;"post-type"===s.kind&&s.id&&s.type&&t&&t.navigate(`/${s.type}/${s.id}?canvas=edit`,{state:{backPath:n}}),"core/page-list-item"===i&&s.id&&t&&t.navigate(`/page/${s.id}?canvas=edit`,{state:{backPath:n}})}),[n,t]);return(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Uv,noIcons:!0,...e,children:({onClose:e})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{icon:Gv,onClick:()=>{o([i],h),e()},children:(0,b.__)("Move up")}),(0,oe.jsx)(y.MenuItem,{icon:Hv,onClick:()=>{r([i],h),e()},children:(0,b.__)("Move down")}),"page"===s.attributes?.type&&s.attributes?.id&&(0,oe.jsx)(y.MenuItem,{onClick:()=>{p(s),e()},children:u})]}),(0,oe.jsx)(y.MenuGroup,{children:(0,oe.jsx)(y.MenuItem,{onClick:()=>{a([i],!1),e()},children:c})})]})})}const{PrivateListView:Kv}=te(x.privateApis),Yv=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function Xv({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,l.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:s,getBlockCount:i,getBlockOrder:r}=t(x.store),{isResolving:o}=t(_.store),a=r(e),l=1===a.length&&"core/page-list"===s(a[0])&&i(a[0])>0,c=o("getEntityRecords",Yv);return{listViewRootClientId:l?a[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:s,__unstableMarkNextChangeAsNotPersistent:i}=(0,l.useDispatch)(x.store),r=(0,d.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(i(),s(e.clientId,(0,o.createBlock)("core/navigation-link",e.attributes)))}),[i,s]);return(0,oe.jsxs)(oe.Fragment,{children:[!n&&(0,oe.jsx)(Kv,{rootClientId:t,onSelect:r,blockSettingsMenu:Zv,showAppender:!1}),(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",children:(0,oe.jsx)(x.BlockList,{})})]})}const Jv=()=>{};function Qv({navigationMenuId:e}){const{storedSettings:t}=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt));return{storedSettings:t()}}),[]),n=(0,d.useMemo)((()=>e?[(0,o.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,oe.jsx)(x.BlockEditorProvider,{settings:t,value:n,onChange:Jv,onInput:Jv,children:(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content",children:(0,oe.jsx)(Xv,{rootClientId:n[0].clientId})})}):null}function $v(e,t,n){return e?.rendered?"publish"===n?(0,Kt.decodeEntities)(e?.rendered):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","menu label"),(0,Kt.decodeEntities)(e?.rendered),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function ex({navigationMenu:e,backPath:t,handleDelete:n,handleDuplicate:s,handleSave:i}){const r=e?.title?.rendered;return(0,oe.jsx)(dx,{actions:(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsx)(zv,{menuId:e?.id,menuTitle:(0,Kt.decodeEntities)(r),onDelete:n,onSave:i,onDuplicate:s})}),backPath:t,title:$v(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."),children:(0,oe.jsx)(Qv,{navigationMenuId:e?.id})})}const{useLocation:tx}=te(Gt.privateApis),nx="wp_navigation";function sx({backPath:e}){const{params:{postId:t}}=tx(),{record:n,isResolving:s}=(0,_.useEntityRecord)("postType",nx,t),{isSaving:i,isDeleting:r}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:s}=e(_.store);return{isSaving:n("postType",nx,t),isDeleting:s("postType",nx,t)}}),[t]),o=s||i||r,a=n?.title?.rendered||n?.slug,{handleSave:c,handleDelete:u,handleDuplicate:d}=lx(),h=()=>u(n),p=e=>c(n,e),f=()=>d(n);return o?(0,oe.jsx)(dx,{description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),backPath:e,children:(0,oe.jsx)(y.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):o||n?n?.content?.raw?(0,oe.jsx)(ex,{navigationMenu:n,backPath:e,handleDelete:h,handleSave:p,handleDuplicate:f}):(0,oe.jsx)(dx,{actions:(0,oe.jsx)(zv,{menuId:n?.id,menuTitle:(0,Kt.decodeEntities)(a),onDelete:h,onSave:p,onDuplicate:f}),backPath:e,title:$v(n?.title,n?.id,n?.status),description:(0,b.__)("This Navigation Menu is empty.")}):(0,oe.jsx)(dx,{description:(0,b.__)("Navigation Menu missing."),backPath:e})}const{useHistory:ix}=te(Gt.privateApis);function rx(){const{deleteEntityRecord:e}=(0,l.useDispatch)(_.store),{createSuccessNotice:t,createErrorNotice:n}=(0,l.useDispatch)(w.store),s=ix();return async i=>{const r=i?.id;try{await e("postType",nx,r,{force:!0},{throwOnError:!0}),t((0,b.__)("Navigation Menu successfully deleted."),{type:"snackbar"}),s.navigate("/navigation")}catch(e){n((0,b.sprintf)((0,b.__)("Unable to delete Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function ox(){const{getEditedEntityRecord:e}=(0,l.useSelect)((e=>{const{getEditedEntityRecord:t}=e(_.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:n}=(0,l.useDispatch)(_.store),{createSuccessNotice:s,createErrorNotice:i}=(0,l.useDispatch)(w.store);return async(r,o)=>{if(!o)return;const a=r?.id,l=e("postType",je,a);t("postType",nx,a,o);const c=Object.keys(o);try{await n("postType",nx,a,c,{throwOnError:!0}),s((0,b.__)("Renamed Navigation Menu"),{type:"snackbar"})}catch(e){t("postType",nx,a,l),i((0,b.sprintf)((0,b.__)("Unable to rename Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function ax(){const e=ix(),{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:s}=(0,l.useDispatch)(w.store);return async i=>{const r=i?.title?.rendered||i?.slug;try{const s=await t("postType",nx,{title:(0,b.sprintf)((0,b._x)("%s (Copy)","navigation menu"),r),content:i?.content?.raw,status:"publish"},{throwOnError:!0});s&&(n((0,b.__)("Duplicated Navigation Menu"),{type:"snackbar"}),e.navigate(`/wp_navigation/${s.id}`))}catch(e){s((0,b.sprintf)((0,b.__)("Unable to duplicate Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function lx(){return{handleDelete:rx(),handleSave:ox(),handleDuplicate:ax()}}function cx(e,t,n){return e?"publish"===n?(0,Kt.decodeEntities)(e):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","menu label"),(0,Kt.decodeEntities)(e),n):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function ux({backPath:e}){const{records:t,isResolving:n,hasResolved:s}=(0,_.useEntityRecords)("postType",je,Fv),i=n&&!s,{getNavigationFallbackId:r}=te((0,l.useSelect)(_.store)),o=(0,l.useSelect)((e=>e(_.store).isResolving("getNavigationFallbackId")),[]),a=t?.[0];a||n||!s||o||r();const{handleSave:c,handleDelete:u,handleDuplicate:d}=lx(),h=!!t?.length;return i?(0,oe.jsx)(dx,{backPath:e,children:(0,oe.jsx)(y.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):i||h?1===t?.length?(0,oe.jsx)(ex,{navigationMenu:a,backPath:e,handleDelete:()=>u(a),handleDuplicate:()=>d(a),handleSave:e=>c(a,e)}):(0,oe.jsx)(dx,{backPath:e,children:(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-navigation-menus",children:t?.map((({id:e,title:t,status:n},s)=>(0,oe.jsx)(hx,{postId:e,withChevron:!0,icon:Wo,children:cx(t?.rendered,s+1,n)},e)))})}):(0,oe.jsx)(dx,{description:(0,b.__)("No Navigation Menus found."),backPath:e})}function dx({children:e,actions:t,title:n,description:s,backPath:i}){return(0,oe.jsx)(ea,{title:n||(0,b.__)("Navigation"),actions:t,description:s||(0,b.__)("Manage your Navigation Menus."),backPath:i,content:e})}const hx=({postId:e,...t})=>(0,oe.jsx)(oa,{to:`/wp_navigation/${e}`,...t}),{useLocation:px}=te(Gt.privateApis);function fx(){const{query:e={}}=px(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ux,{backPath:"/"})}const mx={name:"navigation",path:"/navigation",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ux,{backPath:"/"}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(fx,{}):(0,oe.jsx)(ya,{})}}},{useLocation:gx}=te(Gt.privateApis);function vx(){const{query:e={}}=gx(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(sx,{backPath:"/navigation"})}const xx={name:"navigation-item",path:"/wp_navigation/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(sx,{backPath:"/navigation"}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(vx,{}):(0,oe.jsx)(ya,{})}}},yx=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})});function bx({count:e,icon:t,id:n,isActive:s,label:i,type:r}){if(!e)return;const o=[`postType=${r}`];return n&&o.push(`categoryId=${n}`),(0,oe.jsx)(oa,{icon:t,suffix:(0,oe.jsx)("span",{children:e}),"aria-current":s?"true":void 0,to:`/pattern?${o.join("&")}`,children:i})}const wx=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));const{extractWords:_x,getNormalizedSearchTerms:jx,normalizeString:Sx}=te(x.privateApis),Cx=e=>e.type===Ie.user?e.slug:e.type===Ce?"":e.name||"",kx=e=>"string"==typeof e.title?e.title:e.title&&e.title.rendered?e.title.rendered:e.title&&e.title.raw?e.title.raw:"",Ex=e=>e.type===Ie.user?e.excerpt.raw:e.description||"",Px=e=>e.keywords||[],Ix=()=>!1,Tx=(e=[],t="",n={})=>{const s=jx(t),i=n.categoryId!==Te&&!s.length,r={...n,onlyFilterByCategory:i},o=i?0:1,a=e.map((e=>[e,Ox(e,t,r)])).filter((([,e])=>e>o));return 0===s.length||a.sort((([,e],[,t])=>t-e)),a.map((([e])=>e))};function Ox(e,t,n){const{categoryId:s,getName:i=Cx,getTitle:r=kx,getDescription:o=Ex,getKeywords:a=Px,hasCategory:l=Ix,onlyFilterByCategory:c}=n;let u=s===Te||s===Pe||s===Oe&&e.type===Ie.user||l(e,s)?1:0;if(!u||c)return u;const d=i(e),h=r(e),p=o(e),f=a(e),m=Sx(t),g=Sx(h);if(m===g)u+=30;else if(g.startsWith(m))u+=20;else{const e=[d,h,p,...f].join(" ");0===((e,t)=>e.filter((e=>!jx(t).some((t=>t.includes(e))))))(_x(m),e).length&&(u+=10)}return u}const Ax=[],Nx=(0,l.createSelector)(((e,t,n="")=>{var s;const{getEntityRecords:i,getCurrentTheme:r,isResolving:o}=e(_.store),a={per_page:-1},l=null!==(s=i("postType",Ce,a))&&void 0!==s?s:Ax,c=(r()?.default_template_part_areas||[]).map((e=>e.area)),u=o("getEntityRecords",["postType",Ce,a]),d=Tx(l,n,{categoryId:t,hasCategory:(e,t)=>t!==Ee?e.area===t:e.area===t||!c.includes(e.area)});return{patterns:d,isResolving:u}}),(e=>[e(_.store).getEntityRecords("postType",Ce,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ce,{per_page:-1}]),e(_.store).getCurrentTheme()?.default_template_part_areas])),Mx=(0,l.createSelector)((e=>{var t;const{getSettings:n}=te(e(zt)),{isResolving:s}=e(_.store),i=n();return{patterns:[...(null!==(t=i.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:i.__experimentalBlockPatterns)||[],...e(_.store).getBlockPatterns()||[]].filter((e=>!Ae.includes(e.source))).filter(wx).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:Ie.theme,blocks:(0,o.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:s("getBlockPatterns")}}),(e=>[e(_.store).getBlockPatterns(),e(_.store).isResolving("getBlockPatterns"),te(e(zt)).getSettings()])),Vx=(0,l.createSelector)(((e,t,n,s="")=>{const{patterns:i,isResolving:r}=Mx(e),{patterns:o,isResolving:a,categories:l}=Fx(e);let c=[...i||[],...o||[]];return n&&(c=c.filter((e=>e.type===Ie.user?(e.wp_pattern_sync_status||Ne.full)===n:n===Ne.unsynced))),c=Tx(c,s,t?{categoryId:t,hasCategory:(e,t)=>e.type===Ie.user?e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))?.slug===t)):e.categories?.includes(t)}:{hasCategory:e=>e.type===Ie.user?l?.length&&(!e.wp_pattern_category?.length||!e.wp_pattern_category?.some((e=>l.find((t=>t.id===e))))):!e.hasOwnProperty("categories")}),{patterns:c,isResolving:r||a}}),(e=>[Mx(e),Fx(e)])),Fx=(0,l.createSelector)(((e,t,n="")=>{const{getEntityRecords:s,isResolving:i,getUserPatternCategories:r}=e(_.store),o={per_page:-1},a=s("postType",Ie.user,o),l=r(),c=new Map;l.forEach((e=>c.set(e.id,e)));let u=null!=a?a:Ax;const d=i("getEntityRecords",["postType",Ie.user,o]);return t&&(u=u.filter((e=>e.wp_pattern_sync_status||Ne.full===t))),u=Tx(u,n,{hasCategory:()=>!0}),{patterns:u,isResolving:d,categories:l}}),(e=>[e(_.store).getEntityRecords("postType",Ie.user,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ie.user,{per_page:-1}]),e(_.store).getUserPatternCategories()]));const Rx=(e,t,{search:n="",syncStatus:s}={})=>(0,l.useSelect)((i=>{if(e===Ce)return Nx(i,t,n);if(e===Ie.user&&t){return Vx(i,"uncategorized"===t?"":t,s,n)}return e===Ie.user?Fx(i,s,n):{patterns:Ax,isResolving:!1}}),[t,e,n,s]);function Bx(){const e=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:n}=te(e(zt)),s=n();return null!==(t=s.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:s.__experimentalBlockPatternCategories}));return[...e||[],...(0,l.useSelect)((e=>e(_.store).getBlockPatternCategories()))||[]]}();e.push({name:Ee,label:(0,b.__)("Uncategorized")});const t=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:n}=te(e(zt));return null!==(t=n().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:n().__experimentalBlockPatterns})),t=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()));return(0,d.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Ae.includes(e.source))).filter(wx).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:n,categories:s}=Rx(Ie.user),i=(0,d.useMemo)((()=>{const i={},r=[];e.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),s.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),n.forEach((e=>{e.wp_pattern_category?.forEach((e=>{const t=s.find((t=>t.id===e))?.name;i[t]&&(i[t].count+=1)})),e.wp_pattern_category?.length&&e.wp_pattern_category?.some((e=>s.find((t=>t.id===e))))||(i.uncategorized.count+=1)})),[...e,...s].forEach((e=>{i[e.name].count&&!r.find((t=>t.name===e.name))&&r.push(i[e.name])}));const o=r.sort(((e,t)=>e.label.localeCompare(t.label)));return o.unshift({name:Oe,label:(0,b.__)("My patterns"),count:n.length}),o.unshift({name:Te,label:(0,b.__)("All patterns"),description:(0,b.__)("A list of all patterns from all sources."),count:t.length+n.length}),o}),[e,t,s,n]);return{patternCategories:i,hasPatterns:!!i.length}}const Dx=e=>{const t=e||[],n=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_part_areas||[]),[]),s={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>s[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>{const n=e[t.area]?t.area:Ee;return e[n]?.templateParts?.push(t),e}),s)};const{useLocation:Lx}=te(Gt.privateApis);function zx({templatePartAreas:e,patternCategories:t,currentCategory:n,currentType:s}){const[i,...r]=t;return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:[(0,oe.jsx)(bx,{count:Object.values(e).map((({templateParts:e})=>e?.length||0)).reduce(((e,t)=>e+t),0),icon:(0,h.getTemplatePartIcon)(),label:(0,b.__)("All template parts"),id:Pe,type:Ce,isActive:n===Pe&&s===Ce},"all"),Object.entries(e).map((([e,{label:t,templateParts:i}])=>(0,oe.jsx)(bx,{count:i?.length,icon:(0,h.getTemplatePartIcon)(e),label:t,id:e,type:Ce,isActive:n===e&&s===Ce},e))),(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-patterns__divider"}),i&&(0,oe.jsx)(bx,{count:i.count,label:i.label,icon:yx,id:i.name,type:Ie.user,isActive:n===`${i.name}`&&s===Ie.user},i.name),r.map((e=>(0,oe.jsx)(bx,{count:e.count,label:e.label,icon:yx,id:e.name,type:Ie.user,isActive:n===`${e.name}`&&s===Ie.user},e.name)))]})}function Gx({backPath:e}){const{query:{postType:t="wp_block",categoryId:n}}=Lx(),s=n||(t===Ie.user?Te:Pe),{templatePartAreas:i,hasTemplateParts:r,isLoading:o}=function(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType",Ce,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Dx(e)}}(),{patternCategories:a,hasPatterns:l}=Bx();return(0,oe.jsx)(ea,{title:(0,b.__)("Patterns"),description:(0,b.__)("Manage what patterns are available when editing the site."),isRoot:!e,backPath:e,content:(0,oe.jsxs)(oe.Fragment,{children:[o&&(0,b.__)("Loading items…"),!o&&(0,oe.jsxs)(oe.Fragment,{children:[!r&&!l&&(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:(0,oe.jsx)(y.__experimentalItem,{children:(0,b.__)("No items found")})}),(0,oe.jsx)(zx,{templatePartAreas:i,patternCategories:a,currentCategory:s,currentType:t})]})]})})}var Hx=i(9681),Ux=i.n(Hx);const Wx=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),qx=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})}),Zx="is",Kx="isNot",Yx="isAny",Xx="isNone",Jx="isAll",Qx="isNotAll",$x=[Zx,Kx,Yx,Xx,Jx,Qx],ey={[Zx]:{key:"is-filter",label:(0,b.__)("Is")},[Kx]:{key:"is-not-filter",label:(0,b.__)("Is not")},[Yx]:{key:"is-any-filter",label:(0,b.__)("Is any")},[Xx]:{key:"is-none-filter",label:(0,b.__)("Is none")},[Jx]:{key:"is-all-filter",label:(0,b.__)("Is all")},[Qx]:{key:"is-not-all-filter",label:(0,b.__)("Is not all")}},ty=["asc","desc"],ny={asc:"↑",desc:"↓"},sy={asc:"ascending",desc:"descending"},iy={asc:(0,b.__)("Sort ascending"),desc:(0,b.__)("Sort descending")},ry={asc:Wx,desc:qx},oy="table",ay="grid";const ly={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:function(e,t){if(""===e)return!1;if(!Number.isInteger(Number(e)))return!1;if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(Number(e)))return!1}return!0},Edit:"integer"};const cy={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:function(e,t){if(t?.elements){const n=t?.elements?.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"text"};const uy={sort:function(e,t,n){const s=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?s-i:i-s},isValid:function(e,t){if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"datetime"};const dy={datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r}=t,o=t.getValue({item:e}),a=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return(0,oe.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!s&&(0,oe.jsx)(y.BaseControl.VisualLabel,{as:"legend",children:r}),s&&(0,oe.jsx)(y.VisuallyHidden,{as:"legend",children:r}),(0,oe.jsx)(y.TimePicker,{currentTime:o,onChange:a,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i;const{id:r,label:o,description:a}=t,l=null!==(i=t.getValue({item:e}))&&void 0!==i?i:"",c=(0,d.useCallback)((e=>n({[r]:Number(e)})),[r,n]);return(0,oe.jsx)(y.__experimentalNumberControl,{label:o,help:a,value:l,onChange:c,__next40pxDefaultSize:!0,hideLabelFromVision:s})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r}=t,o=t.getValue({item:e}),a=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return t.elements?(0,oe.jsx)(y.RadioControl,{label:r,onChange:a,options:t.elements,selected:o,hideLabelFromVision:s}):null},select:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i,r;const{id:o,label:a}=t,l=null!==(i=t.getValue({item:e}))&&void 0!==i?i:"",c=(0,d.useCallback)((e=>n({[o]:e})),[o,n]),u=[{label:(0,b.__)("Select item"),value:""},...null!==(r=t?.elements)&&void 0!==r?r:[]];return(0,oe.jsx)(y.SelectControl,{label:a,value:l,options:u,onChange:c,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){const{id:i,label:r,placeholder:o}=t,a=t.getValue({item:e}),l=(0,d.useCallback)((e=>n({[i]:e})),[i,n]);return(0,oe.jsx)(y.TextControl,{label:r,placeholder:o,value:null!=a?a:"",onChange:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:s})}};function hy(e){if(Object.keys(dy).includes(e))return dy[e];throw"Control "+e+" not found"}function py(e){return e.map((e=>{var t,n,s,i;const r="integer"===(o=e.type)?ly:"text"===o?cy:"datetime"===o?uy:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:(e,t)=>{if(t?.elements){const n=t?.elements?.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:()=>null};var o;const a=e.getValue||(l=e.id,({item:e})=>{const t=l.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var l;const c=null!==(t=e.sort)&&void 0!==t?t:function(e,t,n){return r.sort(a({item:e}),a({item:t}),n)},u=null!==(n=e.isValid)&&void 0!==n?n:function(e,t){return r.isValid(a({item:e}),t)},d=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?hy(e.Edit):e.elements?hy("select"):"string"==typeof t.Edit?hy(t.Edit):t.Edit}(e,r),h=e.render||(e.elements?({item:t})=>{const n=a({item:t});return e?.elements?.find((e=>e.value===n))?.label||a({item:t})}:a);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:a,render:h,sort:c,isValid:u,Edit:d,enableHiding:null===(s=e.enableHiding)||void 0===s||s,enableSorting:null===(i=e.enableSorting)||void 0===i||i}}))}function fy(e=""){return Ux()(e.trim().toLowerCase())}const my=[];function gy(e,t,n){if(!e)return{data:my,paginationInfo:{totalItems:0,totalPages:0}};const s=py(n);let i=[...e];if(t.search){const e=fy(t.search);i=i.filter((t=>s.filter((e=>e.enableGlobalSearch)).map((e=>fy(e.getValue({item:t})))).some((t=>t.includes(e)))))}if(t.filters&&t.filters?.length>0&&t.filters.forEach((e=>{const t=s.find((t=>t.id===e.field));t&&(e.operator===Yx&&e?.value?.length>0?i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?e.value.some((e=>s.includes(e))):"string"==typeof s&&e.value.includes(s)})):e.operator===Xx&&e?.value?.length>0?i=i.filter((n=>{const s=t.getValue({item:n});return Array.isArray(s)?!e.value.some((e=>s.includes(e))):"string"==typeof s&&!e.value.includes(s)})):e.operator===Jx&&e?.value?.length>0?i=i.filter((n=>e.value.every((e=>t.getValue({item:n})?.includes(e))))):e.operator===Qx&&e?.value?.length>0?i=i.filter((n=>e.value.every((e=>!t.getValue({item:n})?.includes(e))))):e.operator===Zx?i=i.filter((n=>e.value===t.getValue({item:n}))):e.operator===Kx&&(i=i.filter((n=>e.value!==t.getValue({item:n})))))})),t.sort){const e=t.sort.field,n=s.find((t=>t.id===e));n&&i.sort(((e,s)=>{var i;return n.sort(e,s,null!==(i=t.sort?.direction)&&void 0!==i?i:"desc")}))}let r=i.length,o=1;if(void 0!==t.page&&void 0!==t.perPage){const e=(t.page-1)*t.perPage;r=i?.length||0,o=Math.ceil(r/t.perPage),i=i?.slice(e,e+t.perPage)}return{data:i,paginationInfo:{totalItems:r,totalPages:o}}}const vy=(0,d.createContext)({view:{type:oy},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,containerWidth:0}),xy=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})});var yy=Object.defineProperty,by=Object.defineProperties,wy=Object.getOwnPropertyDescriptors,_y=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,Sy=Object.prototype.propertyIsEnumerable,Cy=(e,t,n)=>t in e?yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ky=(e,t)=>{for(var n in t||(t={}))jy.call(t,n)&&Cy(e,n,t[n]);if(_y)for(var n of _y(t))Sy.call(t,n)&&Cy(e,n,t[n]);return e},Ey=(e,t)=>by(e,wy(t)),Py=(e,t)=>{var n={};for(var s in e)jy.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&_y)for(var s of _y(e))t.indexOf(s)<0&&Sy.call(e,s)&&(n[s]=e[s]);return n},Iy=Object.defineProperty,Ty=Object.defineProperties,Oy=Object.getOwnPropertyDescriptors,Ay=Object.getOwnPropertySymbols,Ny=Object.prototype.hasOwnProperty,My=Object.prototype.propertyIsEnumerable,Vy=(e,t,n)=>t in e?Iy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fy=(e,t)=>{for(var n in t||(t={}))Ny.call(t,n)&&Vy(e,n,t[n]);if(Ay)for(var n of Ay(t))My.call(t,n)&&Vy(e,n,t[n]);return e},Ry=(e,t)=>Ty(e,Oy(t)),By=(e,t)=>{var n={};for(var s in e)Ny.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&Ay)for(var s of Ay(e))t.indexOf(s)<0&&My.call(e,s)&&(n[s]=e[s]);return n};function Dy(...e){}function Ly(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function zy(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function Gy(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Hy(e){return e}function Uy(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function Wy(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function qy(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function Zy(...e){for(const t of e)if(void 0!==t)return t}function Ky(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function Yy(e){if(!function(e){return!!e&&!!(0,Un.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e))return null;return ky({},e.props).ref||e.ref}var Xy,Jy="undefined"!=typeof window&&!!(null==(Xy=window.document)?void 0:Xy.createElement);function Qy(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function $y(e,t=!1){const{activeElement:n}=Qy(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return $y(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Qy(n).getElementById(e);if(t)return t}}return n}function eb(e,t){return e===t||e.contains(t)}function tb(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==nb.indexOf(e.type)}var nb=["button","color","file","image","reset","submit"];function sb(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function ib(e){return e.isContentEditable||sb(e)}function rb(e){let t=0,n=0;if(sb(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const s=Qy(e).getSelection();if((null==s?void 0:s.rangeCount)&&s.anchorNode&&eb(e,s.anchorNode)&&s.focusNode&&eb(e,s.focusNode)){const i=s.getRangeAt(0),r=i.cloneRange();r.selectNodeContents(e),r.setEnd(i.startContainer,i.startOffset),t=r.toString().length,r.setEnd(i.endContainer,i.endOffset),n=r.toString().length}}return{start:t,end:n}}function ob(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function ab(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return ab(e.parentElement)||document.scrollingElement||document.body}function lb(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function cb(e,t){const n=e.map(((e,t)=>[t,e]));let s=!1;return n.sort((([e,n],[i,r])=>{const o=t(n),a=t(r);return o===a?0:o&&a?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(o,a)?(e>i&&(s=!0),-1):(et)):e}function ub(){return Jy&&!!navigator.maxTouchPoints}function db(){return!!Jy&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function hb(){return Jy&&db()&&/apple/i.test(navigator.vendor)}function pb(e){return Boolean(e.currentTarget&&!eb(e.currentTarget,e.target))}function fb(e){return e.target===e.currentTarget}function mb(e,t){const n=new FocusEvent("blur",t),s=e.dispatchEvent(n),i=Ry(Fy({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),s}function gb(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function vb(e,t){const n=t||e.currentTarget,s=e.relatedTarget;return!s||!eb(n,s)}function xb(e,t,n,s){const i=(e=>{if(s){const t=setTimeout(e,s);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})((()=>{e.removeEventListener(t,r,!0),n()})),r=()=>{i(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),i}function yb(e,t,n,s=window){const i=[];try{s.document.addEventListener(e,t,n);for(const r of Array.from(s.frames))i.push(yb(e,t,n,r))}catch(e){}return()=>{try{s.document.removeEventListener(e,t,n)}catch(e){}for(const e of i)e()}}var bb=ky({},Wn),wb=bb.useId,_b=(bb.useDeferredValue,bb.useInsertionEffect),jb=Jy?Un.useLayoutEffect:Un.useEffect;function Sb(e){const t=(0,Un.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return _b?_b((()=>{t.current=e})):t.current=e,(0,Un.useCallback)(((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}function Cb(...e){return(0,Un.useMemo)((()=>{if(e.some(Boolean))return t=>{for(const n of e)Ky(n,t)}}),e)}function kb(e){if(wb){const t=wb();return e||t}const[t,n]=(0,Un.useState)(e);return jb((()=>{if(e||t)return;const s=Math.random().toString(36).slice(2,8);n(`id-${s}`)}),[e,t]),e||t}function Eb(e,t,n){const s=function(e){const[t]=(0,Un.useState)(e);return t}(n),[i,r]=(0,Un.useState)(s);return(0,Un.useEffect)((()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const i=()=>{const e=n.getAttribute(t);r(null==e?s:e)},o=new MutationObserver(i);return o.observe(n,{attributeFilter:[t]}),i(),()=>o.disconnect()}),[e,t,s]),i}function Pb(e,t){const n=(0,Un.useRef)(!1);(0,Un.useEffect)((()=>{if(n.current)return e();n.current=!0}),t),(0,Un.useEffect)((()=>()=>{n.current=!1}),[])}function Ib(e){return Sb("function"==typeof e?e:()=>e)}function Tb(e,t,n=[]){const s=(0,Un.useCallback)((n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n))),[...n,e.wrapElement]);return Ey(ky({},e),{wrapElement:s})}var Ob=!1,Ab=0,Nb=0;function Mb(e){(function(e){const t=e.movementX||e.screenX-Ab,n=e.movementY||e.screenY-Nb;return Ab=e.screenX,Nb=e.screenY,t||n||!1})(e)&&(Ob=!0)}function Vb(){Ob=!1}function Fb(e){const t=Un.forwardRef(((t,n)=>e(Ey(ky({},t),{ref:n}))));return t.displayName=e.displayName||e.name,t}function Rb(e,t){return Un.memo(e,t)}function Bb(e,t){const n=t,{wrapElement:s,render:i}=n,r=Py(n,["wrapElement","render"]),o=Cb(t.ref,Yy(i));let a;if(Un.isValidElement(i)){const e=Ey(ky({},i.props),{ref:o});a=Un.cloneElement(i,function(e,t){const n=ky({},e);for(const s in t){if(!Ly(t,s))continue;if("className"===s){const s="className";n[s]=e[s]?`${e[s]} ${t[s]}`:t[s];continue}if("style"===s){const s="style";n[s]=e[s]?ky(ky({},e[s]),t[s]):t[s];continue}const i=t[s];if("function"==typeof i&&s.startsWith("on")){const t=e[s];if("function"==typeof t){n[s]=(...e)=>{i(...e),t(...e)};continue}}n[s]=i}return n}(r,e))}else a=i?i(r):(0,oe.jsx)(e,ky({},r));return s?s(a):a}function Db(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function Lb(e=[],t=[]){const n=Un.createContext(void 0),s=Un.createContext(void 0),i=()=>Un.useContext(n),r=t=>e.reduceRight(((e,n)=>(0,oe.jsx)(n,Ey(ky({},t),{children:e}))),(0,oe.jsx)(n.Provider,ky({},t)));return{context:n,scopedContext:s,useContext:i,useScopedContext:(e=!1)=>{const t=Un.useContext(s),n=i();return e?t:t||n},useProviderContext:()=>{const e=Un.useContext(s),t=i();if(!e||e!==t)return t},ContextProvider:r,ScopedContextProvider:e=>(0,oe.jsx)(r,Ey(ky({},e),{children:t.reduceRight(((t,n)=>(0,oe.jsx)(n,Ey(ky({},e),{children:t}))),(0,oe.jsx)(s.Provider,ky({},e)))}))}}var zb=Lb(),Gb=zb.useContext,Hb=(zb.useScopedContext,zb.useProviderContext,Lb([zb.ContextProvider],[zb.ScopedContextProvider])),Ub=Hb.useContext,Wb=(Hb.useScopedContext,Hb.useProviderContext),qb=Hb.ContextProvider,Zb=Hb.ScopedContextProvider,Kb=(0,Un.createContext)(void 0),Yb=(0,Un.createContext)(void 0),Xb=((0,Un.createContext)(null),(0,Un.createContext)(null),Lb([qb],[Zb])),Jb=Xb.useContext;Xb.useScopedContext,Xb.useProviderContext,Xb.ContextProvider,Xb.ScopedContextProvider;function Qb(e,t){const n=e.__unstableInternals;return Uy(n,"Invalid store"),n[t]}function $b(e,...t){let n=e,s=n,i=Symbol(),r=Dy;const o=new Set,a=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,h=new WeakMap,p=(e,t,n=c)=>(n.add(t),h.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),h.delete(t),n.delete(t)}),f=(e,r,o=!1)=>{var l;if(!Ly(n,e))return;const p=function(e,t){if(function(e){return"function"==typeof e}(e))return e(function(e){return"function"==typeof e}(t)?t():t);return e}(r,n[e]);if(p===n[e])return;if(!o)for(const n of t)null==(l=null==n?void 0:n.setState)||l.call(n,e,p);const f=n;n=Ry(Fy({},n),{[e]:p});const m=Symbol();i=m,a.add(e);const g=(t,s,i)=>{var r;const o=h.get(t);o&&!o.some((t=>i?i.has(t):t===e))||(null==(r=d.get(t))||r(),d.set(t,t(n,s)))};for(const e of c)g(e,f);queueMicrotask((()=>{if(i!==m)return;const e=n;for(const e of u)g(e,s,a);s=e,a.clear()}))},m={getState:()=>n,setState:f,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=o.size,s=Symbol();o.add(s);const i=()=>{o.delete(s),o.size||r()};if(e)return i;const a=(c=n,Object.keys(c)).map((e=>zy(...t.map((t=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(s&&Ly(s,e))return sw(t,[e],(t=>{f(e,t[e],!0)}))})))));var c;const u=[];for(const e of l)u.push(e());const d=t.map(tw);return r=zy(...a,...u,...d),i},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(n,n)),p(e,t)),batch:(e,t)=>(d.set(t,t(n,s)),p(e,t,u)),pick:e=>$b(function(e,t){const n={};for(const s of t)Ly(e,s)&&(n[s]=e[s]);return n}(n,e),m),omit:e=>$b(function(e,t){const n=Fy({},e);for(const e of t)Ly(n,e)&&delete n[e];return n}(n,e),m)}};return m}function ew(e,...t){if(e)return Qb(e,"setup")(...t)}function tw(e,...t){if(e)return Qb(e,"init")(...t)}function nw(e,...t){if(e)return Qb(e,"subscribe")(...t)}function sw(e,...t){if(e)return Qb(e,"sync")(...t)}function iw(e,...t){if(e)return Qb(e,"batch")(...t)}function rw(e,...t){if(e)return Qb(e,"omit")(...t)}function ow(...e){const t=e.reduce(((e,t)=>{var n;const s=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);return s?Object.assign(e,s):e}),{}),n=$b(t,...e);return Object.assign({},...e,n)}var aw=i(422),{useSyncExternalStore:lw}=aw;function cw(e,t=Hy){const n=Un.useCallback((t=>e?nw(e,null,t):()=>{}),[e]),s=()=>{const n="string"==typeof t?t:null,s="function"==typeof t?t:null,i=null==e?void 0:e.getState();return s?s(i):i&&n&&Ly(i,n)?i[n]:void 0};return lw(n,s,s)}function uw(e,t){const n=Un.useRef({}),s=Un.useCallback((t=>e?nw(e,null,t):()=>{}),[e]),i=()=>{const s=null==e?void 0:e.getState();let i=!1;const r=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(s);t!==r[e]&&(r[e]=t,i=!0)}if("string"==typeof n){if(!s)continue;if(!Ly(s,n))continue;const t=s[n];t!==r[e]&&(r[e]=t,i=!0)}}return i&&(n.current=ky({},r)),n.current};return lw(s,i,i)}function dw(e,t,n,s){const i=Ly(t,n)?t[n]:void 0,r=s?t[s]:void 0,o=function(e){const t=(0,Un.useRef)(e);return jb((()=>{t.current=e})),t}({value:i,setValue:r});jb((()=>sw(e,[n],((e,t)=>{const{value:s,setValue:i}=o.current;i&&e[n]!==t[n]&&e[n]!==s&&i(e[n])}))),[e,n]),jb((()=>{if(void 0!==i)return e.setState(n,i),iw(e,[n],(()=>{void 0!==i&&e.setState(n,i)}))}))}function hw(e,t,n){return Pb(t,[n.store]),dw(e,n,"items","setItems"),e}function pw(e){const t=kb(e.id);return ky({id:t},e)}function fw(e,t,n){return dw(e=hw(e,t,n),n,"activeId","setActiveId"),dw(e,n,"includesBaseElement"),dw(e,n,"virtualFocus"),dw(e,n,"orientation"),dw(e,n,"rtl"),dw(e,n,"focusLoop"),dw(e,n,"focusWrap"),dw(e,n,"focusShift"),e}function mw(e,t,n){return Pb(t,[n.store,n.disclosure]),dw(e,n,"open","setOpen"),dw(e,n,"mounted","setMounted"),dw(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}function gw(e,t,n){return mw(e,t,n)}function vw(e,t,n){return Pb(t,[n.popover]),dw(e,n,"placement"),gw(e,t,n)}function xw(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),s=Zy(e.items,null==n?void 0:n.items,e.defaultItems,[]),i=new Map(s.map((e=>[e.id,e]))),r={items:s,renderedItems:Zy(null==n?void 0:n.renderedItems,[])},o=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),a=$b({items:s,renderedItems:r.renderedItems},o),l=$b(r,e.store),c=e=>{const t=cb(e,(e=>e.element));a.setState("renderedItems",t),l.setState("renderedItems",t)};ew(l,(()=>tw(a))),ew(a,(()=>iw(a,["items"],(e=>{l.setState("items",e.items)})))),ew(a,(()=>iw(a,["renderedItems"],(e=>{let t=!0,n=requestAnimationFrame((()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const s=function(e){var t;const n=e.find((e=>!!e.element)),s=[...e].reverse().find((e=>!!e.element));let i=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;i&&(null==s?void 0:s.element);){if(s&&i.contains(s.element))return i;i=i.parentElement}return Qy(i).body}(e.renderedItems),i=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:s});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(n),i.disconnect()}}))));const u=(e,t,n=!1)=>{let s;t((t=>{const n=t.findIndex((({id:t})=>t===e.id)),r=t.slice();if(-1!==n){s=t[n];const o=Fy(Fy({},s),e);r[n]=o,i.set(e.id,o)}else r.push(e),i.set(e.id,e);return r}));return()=>{t((t=>{if(!s)return n&&i.delete(e.id),t.filter((({id:t})=>t!==e.id));const r=t.findIndex((({id:t})=>t===e.id));if(-1===r)return t;const o=t.slice();return o[r]=s,i.set(e.id,s),o}))}},d=e=>u(e,(e=>a.setState("items",e)),!0);return Ry(Fy({},l),{registerItem:d,renderItem:e=>zy(d(e),u(e,(e=>a.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:n}=a.getState();t=n.find((t=>t.id===e)),t&&i.set(e,t)}return t||null},__unstablePrivateStore:a})}function yw(e){const t=[];for(const n of e)t.push(...n);return t}function bw(e){return e.slice().reverse()}var ww={id:null};function _w(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function jw(e,t){return e.filter((e=>e.rowId===t))}function Sw(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}function Cw(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function kw(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),s=xw(e),i=Zy(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),r=$b(Ry(Fy({},s.getState()),{id:Zy(e.id,null==n?void 0:n.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:Zy(null==n?void 0:n.baseElement,null),includesBaseElement:Zy(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===i),moves:Zy(null==n?void 0:n.moves,0),orientation:Zy(e.orientation,null==n?void 0:n.orientation,"both"),rtl:Zy(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:Zy(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:Zy(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:Zy(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:Zy(e.focusShift,null==n?void 0:n.focusShift,!1)}),s,e.store);ew(r,(()=>sw(r,["renderedItems","activeId"],(e=>{r.setState("activeId",(t=>{var n;return void 0!==t?t:null==(n=_w(e.renderedItems))?void 0:n.id}))}))));const o=(e="next",t={})=>{var n,s;const i=r.getState(),{skip:o=0,activeId:a=i.activeId,focusShift:l=i.focusShift,focusLoop:c=i.focusLoop,focusWrap:u=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:h=i.renderedItems,rtl:p=i.rtl}=t,f="up"===e||"down"===e,m="next"===e||"down"===e,g=m?p&&!f:!p||f,v=l&&!o;let x=f?yw(function(e,t,n){const s=Cw(e);for(const i of e)for(let e=0;ee.id===a));if(!y)return null==(s=_w(x))?void 0:s.id;const b=x.some((e=>e.rowId)),w=x.indexOf(y),_=x.slice(w+1),j=jw(_,y.rowId);if(o){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(j,a),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}const S=c&&(f?"horizontal"!==c:"vertical"!==c),C=b&&u&&(f?"horizontal"!==u:"vertical"!==u),k=m?(!b||f)&&S&&d:!!f&&d;if(S){const e=function(e,t,n=!1){const s=e.findIndex((e=>e.id===t));return[...e.slice(s+1),...n?[ww]:[],...e.slice(0,s)]}(C&&!k?x:jw(x,y.rowId),a,k),t=_w(e,a);return null==t?void 0:t.id}if(C){const e=_w(k?j:_,a);return k?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=_w(j,a);return!E&&k?null:null==E?void 0:E.id};return Ry(Fy(Fy({},s),r),{setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=_w(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=_w(bw(r.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))})}function Ew(e={}){return function(e={}){const t=ow(e.store,rw(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),s=Zy(e.open,null==n?void 0:n.open,e.defaultOpen,!1),i=Zy(e.animated,null==n?void 0:n.animated,!1),r=$b({open:s,animated:i,animating:!!i&&s,mounted:s,contentElement:Zy(null==n?void 0:n.contentElement,null),disclosureElement:Zy(null==n?void 0:n.disclosureElement,null)},t);return ew(r,(()=>sw(r,["animated","animating"],(e=>{e.animated||r.setState("animating",!1)})))),ew(r,(()=>nw(r,["open"],(()=>{r.getState().animated&&r.setState("animating",!0)})))),ew(r,(()=>sw(r,["open","animating"],(e=>{r.setState("mounted",e.open||e.animating)})))),Ry(Fy({},r),{disclosure:e.disclosure,setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",(e=>!e)),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)})}(e)}var Pw=hb()&&ub();function Iw(e={}){var t=e,{tag:n}=t,s=By(t,["tag"]);const i=ow(s.store,function(e,...t){if(e)return Qb(e,"pick")(...t)}(n,["value","rtl"])),r=null==n?void 0:n.getState(),o=null==i?void 0:i.getState(),a=Zy(s.activeId,null==o?void 0:o.activeId,s.defaultActiveId,null),l=kw(Ry(Fy({},s),{activeId:a,includesBaseElement:Zy(s.includesBaseElement,null==o?void 0:o.includesBaseElement,!0),orientation:Zy(s.orientation,null==o?void 0:o.orientation,"vertical"),focusLoop:Zy(s.focusLoop,null==o?void 0:o.focusLoop,!0),focusWrap:Zy(s.focusWrap,null==o?void 0:o.focusWrap,!0),virtualFocus:Zy(s.virtualFocus,null==o?void 0:o.virtualFocus,!0)})),c=function(e={}){var t=e,{popover:n}=t,s=By(t,["popover"]);const i=ow(s.store,rw(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),r=null==i?void 0:i.getState(),o=Ew(Ry(Fy({},s),{store:i})),a=Zy(s.placement,null==r?void 0:r.placement,"bottom"),l=$b(Ry(Fy({},o.getState()),{placement:a,currentPlacement:a,anchorElement:Zy(null==r?void 0:r.anchorElement,null),popoverElement:Zy(null==r?void 0:r.popoverElement,null),arrowElement:Zy(null==r?void 0:r.arrowElement,null),rendered:Symbol("rendered")}),o,i);return Ry(Fy(Fy({},o),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(Ry(Fy({},s),{placement:Zy(s.placement,null==o?void 0:o.placement,"bottom-start")})),u=Zy(s.value,null==o?void 0:o.value,s.defaultValue,""),d=Zy(s.selectedValue,null==o?void 0:o.selectedValue,null==r?void 0:r.values,s.defaultSelectedValue,""),h=Array.isArray(d),p=Ry(Fy(Fy({},l.getState()),c.getState()),{value:u,selectedValue:d,resetValueOnSelect:Zy(s.resetValueOnSelect,null==o?void 0:o.resetValueOnSelect,h),resetValueOnHide:Zy(s.resetValueOnHide,null==o?void 0:o.resetValueOnHide,h&&!n),activeValue:null==o?void 0:o.activeValue}),f=$b(p,l,c,i);return Pw&&ew(f,(()=>sw(f,["virtualFocus"],(()=>{f.setState("virtualFocus",!1)})))),ew(f,(()=>{if(n)return zy(sw(f,["selectedValue"],(e=>{Array.isArray(e.selectedValue)&&n.setValues(e.selectedValue)})),sw(n,["values"],(e=>{f.setState("selectedValue",e.values)})))})),ew(f,(()=>sw(f,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||f.setState("value",u))})))),ew(f,(()=>sw(f,["open"],(e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})))),ew(f,(()=>sw(f,["moves","activeId"],((e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})))),ew(f,(()=>iw(f,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=f.getState(),s=l.item(n);f.setState("activeValue",null==s?void 0:s.value)})))),Ry(Fy(Fy(Fy({},c),l),f),{tag:n,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",p.value),setSelectedValue:e=>f.setState("selectedValue",e)})}function Tw(e={}){e=function(e){const t=Jb();return pw(e=Ey(ky({},e),{tag:void 0!==e.tag?e.tag:t}))}(e);const[t,n]=function(e,t){const[n,s]=Un.useState((()=>e(t)));jb((()=>tw(n)),[n]);const i=Un.useCallback((e=>cw(n,e)),[n]);return[Un.useMemo((()=>Ey(ky({},n),{useState:i})),[n,i]),Sb((()=>{s((n=>e(ky(ky({},t),n.getState()))))}))]}(Iw,e);return function(e,t,n){return Pb(t,[n.tag]),dw(e,n,"value","setValue"),dw(e,n,"selectedValue","setSelectedValue"),dw(e,n,"resetValueOnHide"),dw(e,n,"resetValueOnSelect"),Object.assign(fw(vw(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var Ow=Lb(),Aw=(Ow.useContext,Ow.useScopedContext,Ow.useProviderContext),Nw=Lb([Ow.ContextProvider],[Ow.ScopedContextProvider]),Mw=(Nw.useContext,Nw.useScopedContext,Nw.useProviderContext,Nw.ContextProvider),Vw=Nw.ScopedContextProvider,Fw=((0,Un.createContext)(void 0),(0,Un.createContext)(void 0),Lb([Mw],[Vw])),Rw=(Fw.useContext,Fw.useScopedContext,Fw.useProviderContext),Bw=Fw.ContextProvider,Dw=Fw.ScopedContextProvider,Lw=(0,Un.createContext)(void 0),zw=Lb([Bw,qb],[Dw,Zb]),Gw=zw.useContext,Hw=zw.useScopedContext,Uw=zw.useProviderContext,Ww=zw.ContextProvider,qw=zw.ScopedContextProvider,Zw=(0,Un.createContext)(void 0),Kw=(0,Un.createContext)(!1);function Yw(e={}){const t=Tw(e);return(0,oe.jsx)(Ww,{value:t,children:e.children})}var Xw=Db((function(e){var t=e,{store:n}=t,s=Py(t,["store"]);const i=Uw();Uy(n=n||i,!1);const r=n.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return qy(s=ky({htmlFor:r},s))})),Jw=Rb(Fb((function(e){return Bb("label",Xw(e))}))),Qw=Db((function(e){var t=e,{store:n}=t,s=Py(t,["store"]);const i=Rw();return n=n||i,s=Ey(ky({},s),{ref:Cb(null==n?void 0:n.setAnchorElement,s.ref)})}));Fb((function(e){return Bb("div",Qw(e))}));function $w(e,t){return t&&e.item(t)||null}var e_=Symbol("FOCUS_SILENTLY");function t_(e,t,n){if(!t)return!1;if(t===n)return!1;const s=e.item(t.id);return!!s&&(!n||s.element!==n)}var n_=(0,Un.createContext)(!0),s_="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function i_(e){return!!e.matches(s_)&&(!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]"))}function r_(e){const t=$y(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function o_(e){const t=$y(e);if(!t)return!1;if(eb(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&("id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`)))}var a_=hb(),l_=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],c_=Symbol("safariFocusAncestor");function u_(e,t){e&&(e[c_]=t)}function d_(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function h_(e,t,n,s,i){return e?t?n&&!s?-1:void 0:n?i:i||0:i}function p_(e,t){return Sb((n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}))}var f_=!0;function m_(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(f_=!1))}function g_(e){e.metaKey||e.ctrlKey||e.altKey||(f_=!0)}var v_=Db((function(e){var t=e,{focusable:n=!0,accessibleWhenDisabled:s,autoFocus:i,onFocusVisible:r}=t,o=Py(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const a=(0,Un.useRef)(null);(0,Un.useEffect)((()=>{n&&(yb("mousedown",m_,!0),yb("keydown",g_,!0))}),[n]),a_&&(0,Un.useEffect)((()=>{if(!n)return;const e=a.current;if(!e)return;if(!d_(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const s=()=>queueMicrotask((()=>e.focus()));for(const e of t)e.addEventListener("mouseup",s);return()=>{for(const e of t)e.removeEventListener("mouseup",s)}}),[n]);const l=n&&Wy(o),c=!!l&&!s,[u,d]=(0,Un.useState)(!1);(0,Un.useEffect)((()=>{n&&c&&u&&d(!1)}),[n,c,u]),(0,Un.useEffect)((()=>{if(!n)return;if(!u)return;const e=a.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{i_(e)||d(!1)}));return t.observe(e),()=>t.disconnect()}),[n,u]);const h=p_(o.onKeyPressCapture,l),p=p_(o.onMouseDownCapture,l),f=p_(o.onClickCapture,l),m=o.onMouseDown,g=Sb((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!a_)return;if(pb(e))return;if(!tb(t)&&!d_(t))return;let s=!1;const i=()=>{s=!0};t.addEventListener("focusin",i,{capture:!0,once:!0});const r=function(e){for(;e&&!i_(e);)e=e.closest(s_);return e||null}(t.parentElement);u_(r,!0),xb(t,"mouseup",(()=>{t.removeEventListener("focusin",i,!0),u_(r,!1),s||function(e){!o_(e)&&i_(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const s=e.currentTarget;s&&r_(s)&&(null==r||r(e),e.defaultPrevented||(s.dataset.focusVisible="true",d(!0)))},x=o.onKeyDownCapture,y=Sb((e=>{if(null==x||x(e),e.defaultPrevented)return;if(!n)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!fb(e))return;const t=e.currentTarget;xb(t,"focusout",(()=>v(e,t)))})),b=o.onFocusCapture,w=Sb((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return void d(!1);const t=e.currentTarget,s=()=>v(e,t);f_||function(e){const{tagName:t,readOnly:n,type:s}=e;return"TEXTAREA"===t&&!n||("SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):l_.includes(s)))}(e.target)?xb(e.target,"focusout",s):d(!1)})),_=o.onBlur,j=Sb((e=>{null==_||_(e),n&&vb(e)&&d(!1)})),S=(0,Un.useContext)(n_),C=Sb((e=>{n&&i&&e&&S&&queueMicrotask((()=>{r_(e)||i_(e)&&e.focus()}))})),k=function(e,t){const n=e=>{if("string"==typeof e)return e},[s,i]=(0,Un.useState)((()=>n(t)));return jb((()=>{const s=e&&"current"in e?e.current:e;i((null==s?void 0:s.tagName.toLowerCase())||n(t))}),[e,t]),s}(a),E=n&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),P=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),I=o.style,T=(0,Un.useMemo)((()=>c?ky({pointerEvents:"none"},I):I),[c,I]);return qy(o=Ey(ky({"data-focus-visible":n&&u||void 0,"data-autofocus":i||void 0,"aria-disabled":l||void 0},o),{ref:Cb(a,C,o.ref),style:T,tabIndex:h_(n,c,E,P,o.tabIndex),disabled:!(!P||!c)||void 0,contentEditable:l?void 0:o.contentEditable,onKeyPressCapture:h,onClickCapture:f,onMouseDownCapture:p,onMouseDown:g,onKeyDownCapture:y,onFocusCapture:w,onBlur:j}))}));Fb((function(e){return Bb("div",v_(e))}));function x_(e,t,n){return Sb((s=>{var i;if(null==t||t(s),s.defaultPrevented)return;if(s.isPropagationStopped())return;if(!fb(s))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(s))return;if(function(e){const t=e.target;return!(t&&!sb(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(s))return;const r=e.getState(),o=null==(i=$w(e,r.activeId))?void 0:i.element;if(!o)return;const a=s,{view:l}=a,c=Py(a,["view"]);o!==(null==n?void 0:n.current)&&o.focus(),function(e,t,n){const s=new KeyboardEvent(t,n);return e.dispatchEvent(s)}(o,s.type,c)||s.preventDefault(),s.currentTarget.contains(o)&&s.stopPropagation()}))}var y_=Db((function(e){var t=e,{store:n,composite:s=!0,focusOnMove:i=s,moveOnKeyPress:r=!0}=t,o=Py(t,["store","composite","focusOnMove","moveOnKeyPress"]);const a=Wb();Uy(n=n||a,!1);const l=(0,Un.useRef)(null),c=(0,Un.useRef)(null),u=function(e){const[t,n]=(0,Un.useState)(!1),s=(0,Un.useCallback)((()=>n(!0)),[]),i=e.useState((t=>$w(e,t.activeId)));return(0,Un.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))}),[i,t]),s}(n),d=n.useState("moves"),[,h]=function(e){const[t,n]=(0,Un.useState)(null);return jb((()=>{if(null==t)return;if(!e)return;let n=null;return e((e=>(n=e,t))),()=>{e(n)}}),[t,e]),[t,n]}(s?n.setBaseElement:null);(0,Un.useEffect)((()=>{var e;if(!n)return;if(!d)return;if(!s)return;if(!i)return;const{activeId:t}=n.getState(),r=null==(e=$w(n,t))?void 0:e.element;var o,a;r&&("scrollIntoView"in(o=r)?(o.focus({preventScroll:!0}),o.scrollIntoView(Fy({block:"nearest",inline:"nearest"},a))):o.focus())}),[n,d,s,i]),jb((()=>{if(!n)return;if(!d)return;if(!s)return;const{baseElement:e,activeId:t}=n.getState();if(!(null===t))return;if(!e)return;const i=c.current;c.current=null,i&&mb(i,{relatedTarget:e}),r_(e)||e.focus()}),[n,d,s]);const p=n.useState("activeId"),f=n.useState("virtualFocus");jb((()=>{var e;if(!n)return;if(!s)return;if(!f)return;const t=c.current;if(c.current=null,!t)return;const i=(null==(e=$w(n,p))?void 0:e.element)||$y(t);i!==t&&mb(t,{relatedTarget:i})}),[n,p,f,s]);const m=x_(n,o.onKeyDownCapture,c),g=x_(n,o.onKeyUpCapture,c),v=o.onFocusCapture,x=Sb((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const s=e.relatedTarget,i=function(e){const t=e[e_];return delete e[e_],t}(e.currentTarget);fb(e)&&i&&(e.stopPropagation(),c.current=s)})),y=o.onFocus,b=Sb((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!s)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:i}=n.getState();i?fb(e)&&!t_(n,t)&&queueMicrotask(u):fb(e)&&n.setActiveId(null)})),w=o.onBlurCapture,_=Sb((e=>{var t;if(null==w||w(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:s,activeId:i}=n.getState();if(!s)return;const r=null==(t=$w(n,i))?void 0:t.element,o=e.relatedTarget,a=t_(n,o),l=c.current;if(c.current=null,fb(e)&&a)o===r?l&&l!==o&&mb(l,e):r?mb(r,e):l&&mb(l,e),e.stopPropagation();else{!t_(n,e.target)&&r&&mb(r,e)}})),j=o.onKeyDown,S=Ib(r),C=Sb((e=>{var t;if(null==j||j(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return;const{orientation:s,renderedItems:i,activeId:r}=n.getState(),o=$w(n,r);if(null==(t=null==o?void 0:o.element)?void 0:t.isConnected)return;const a="horizontal"!==s,l="vertical"!==s,c=i.some((e=>!!e.rowId));if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&sb(e.currentTarget))return;const u={ArrowUp:(c||a)&&(()=>{if(c){const e=function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(yw(bw(function(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}(e))))}(i);return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(c||l)&&n.first,ArrowDown:(c||a)&&n.first,ArrowLeft:(c||l)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},d=u[e.key];if(d){const t=d();if(void 0!==t){if(!S(e))return;e.preventDefault(),n.move(t)}}}));o=Tb(o,(e=>(0,oe.jsx)(qb,{value:n,children:e})),[n]);const k=n.useState((e=>{var t;if(n&&s&&e.virtualFocus)return null==(t=$w(n,e.activeId))?void 0:t.id}));o=Ey(ky({"aria-activedescendant":k},o),{ref:Cb(l,h,o.ref),onKeyDownCapture:m,onKeyUpCapture:g,onFocusCapture:x,onFocus:b,onBlurCapture:_,onKeyDown:C});const E=n.useState((e=>s&&(e.virtualFocus||null===e.activeId)));return o=v_(ky({focusable:E},o))}));Fb((function(e){return Bb("div",y_(e))}));function b_(e,t,n){if(!n)return!1;const s=e.find((e=>!e.disabled&&e.value));return(null==s?void 0:s.value)===t}function w_(e,t){return!!t&&(null!=e&&(e=Gy(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var __=Db((function(e){var t=e,{store:n,focusable:s=!0,autoSelect:i=!1,getAutoSelectId:r,setValueOnChange:o,showMinLength:a=0,showOnChange:l,showOnMouseDown:c,showOnClick:u=c,showOnKeyDown:d,showOnKeyPress:h=d,blurActiveItemOnClick:p,setValueOnClick:f=!0,moveOnKeyPress:m=!0,autoComplete:g="list"}=t,v=Py(t,["store","focusable","autoSelect","getAutoSelectId","setValueOnChange","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","blurActiveItemOnClick","setValueOnClick","moveOnKeyPress","autoComplete"]);const x=Uw();Uy(n=n||x,!1);const y=(0,Un.useRef)(null),[b,w]=(0,Un.useReducer)((()=>[]),[]),_=(0,Un.useRef)(!1),j=(0,Un.useRef)(!1),S=n.useState((e=>e.virtualFocus&&i)),C="inline"===g||"both"===g,[k,E]=(0,Un.useState)(C);!function(e,t){const n=(0,Un.useRef)(!1);jb((()=>{if(n.current)return e();n.current=!0}),t),jb((()=>()=>{n.current=!1}),[])}((()=>{C&&E(!0)}),[C]);const P=n.useState("value"),I=(0,Un.useRef)();(0,Un.useEffect)((()=>sw(n,["selectedValue","activeId"],((e,t)=>{I.current=t.selectedValue}))),[]);const T=n.useState((e=>{var t;if(C&&k){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=I.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}})),O=n.useState("renderedItems"),A=n.useState("open"),N=n.useState("contentElement"),M=(0,Un.useMemo)((()=>{if(!C)return P;if(!k)return P;if(b_(O,T,S)){if(w_(P,T)){const e=(null==T?void 0:T.slice(P.length))||"";return P+e}return P}return T||P}),[C,k,O,T,S,P]);(0,Un.useEffect)((()=>{const e=y.current;if(!e)return;const t=()=>E(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,Un.useEffect)((()=>{if(!C)return;if(!k)return;if(!T)return;if(!b_(O,T,S))return;if(!w_(P,T))return;let e=Dy;return queueMicrotask((()=>{const t=y.current;if(!t)return;const{start:n,end:s}=rb(t),i=P.length,r=T.length;lb(t,i,r),e=()=>{if(!r_(t))return;const{start:e,end:o}=rb(t);e===i&&o===r&&lb(t,n,s)}})),()=>e()}),[b,C,k,T,O,S,P]);const V=(0,Un.useRef)(null),F=Sb(r),R=(0,Un.useRef)(null);(0,Un.useEffect)((()=>{if(!A)return;if(!N)return;const e=ab(N);if(!e)return;V.current=e;const t=()=>{_.current=!1},s=()=>{if(!n)return;if(!_.current)return;const{activeId:e}=n.getState();null!==e&&e!==R.current&&(_.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("touchmove",t,i),e.addEventListener("scroll",s,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("scroll",s,!0)}}),[A,N,n]),jb((()=>{P&&(j.current||(_.current=!0))}),[P]),jb((()=>{"always"!==S&&A||(_.current=A)}),[S,A]);const B=n.useState("resetValueOnSelect");Pb((()=>{var e,t;const s=_.current;if(!n)return;if(!A)return;if(!s&&!B)return;const{baseElement:i,contentElement:r,activeId:o}=n.getState();if(!i||r_(i)){if(null==r?void 0:r.hasAttribute("data-placing")){const e=new MutationObserver(w);return e.observe(r,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(S&&s){const t=F(O),s=void 0!==t?t:null!=(e=function(e){const t=e.find((e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))}));return null==t?void 0:t.id}(O))?e:n.first();R.current=s,n.move(null!=s?s:null)}else{const e=null==(t=n.item(o||n.first()))?void 0:t.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[n,A,b,P,S,B,F,O]),(0,Un.useEffect)((()=>{if(!C)return;const e=y.current;if(!e)return;const t=[e,N].filter((e=>!!e)),s=e=>{t.every((t=>vb(e,t)))&&(null==n||n.setValue(M))};for(const e of t)e.addEventListener("focusout",s);return()=>{for(const e of t)e.removeEventListener("focusout",s)}}),[C,N,n,M]);const D=e=>e.currentTarget.value.length>=a,L=v.onChange,z=Ib(null!=l?l:D),G=Ib(null!=o?o:!n.tag),H=Sb((e=>{if(null==L||L(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget,{value:s,selectionStart:i,selectionEnd:r}=t,o=e.nativeEvent;if(_.current=!0,function(e){return"input"===e.type}(o)&&(o.isComposing&&(_.current=!1,j.current=!0),C)){const e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===s.length;E(e&&t)}if(G(e)){const e=s===n.getState().value;n.setValue(s),queueMicrotask((()=>{lb(t,i,r)})),C&&S&&e&&w()}z(e)&&n.show(),S&&_.current||n.setActiveId(null)})),U=v.onCompositionEnd,W=Sb((e=>{_.current=!0,j.current=!1,null==U||U(e),e.defaultPrevented||S&&w()})),q=v.onMouseDown,Z=Ib(null!=p?p:()=>!!(null==n?void 0:n.getState().includesBaseElement)),K=Ib(f),Y=Ib(null!=u?u:D),X=Sb((e=>{null==q||q(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(Z(e)&&n.setActiveId(null),K(e)&&n.setValue(M),Y(e)&&xb(e.currentTarget,"mouseup",n.show))})),J=v.onKeyDown,Q=Ib(null!=h?h:D),$=Sb((e=>{if(null==J||J(e),e.repeat||(_.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!n)return;const{open:t}=n.getState();t||"ArrowUp"!==e.key&&"ArrowDown"!==e.key||Q(e)&&(e.preventDefault(),n.show())})),ee=v.onBlur,te=Sb((e=>{_.current=!1,null==ee||ee(e),e.defaultPrevented})),ne=kb(v.id),se=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(g)?g:void 0,ie=n.useState((e=>null===e.activeId));return v=Ey(ky({id:ne,role:"combobox","aria-autocomplete":se,"aria-haspopup":ob(N,"listbox"),"aria-expanded":A,"aria-controls":null==N?void 0:N.id,"data-active-item":ie||void 0,value:M},v),{ref:Cb(y,v.ref),onChange:H,onCompositionEnd:W,onMouseDown:X,onKeyDown:$,onBlur:te}),v=y_(Ey(ky({store:n,focusable:s},v),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(m,e)&&(C&&E(!0),!0)})),v=Qw(ky({store:n},v)),ky({autoComplete:"off"},v)})),j_=Fb((function(e){return Bb("input",__(e))}));function S_(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function C_(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const n=t.endsWith("ms")?1:1e3,s=Number.parseFloat(t||"0s")*n;return s>e?s:e}),0)}function k_(e,t,n){return!(n||!1===t||e&&!t)}var E_=Db((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=Py(t,["store","alwaysVisible"]);const r=Aw();Uy(n=n||r,!1);const o=(0,Un.useRef)(null),a=kb(i.id),[l,c]=(0,Un.useState)(null),u=n.useState("open"),d=n.useState("mounted"),h=n.useState("animated"),p=n.useState("contentElement"),f=cw(n.disclosure,"contentElement");jb((()=>{o.current&&(null==n||n.setContentElement(o.current))}),[n]),jb((()=>{let e;return null==n||n.setState("animated",(t=>(e=t,!0))),()=>{void 0!==e&&(null==n||n.setState("animated",e))}}),[n]),jb((()=>{if(h){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{c(u?"enter":d?"leave":null)}));c(null)}}),[h,p,u,d]),jb((()=>{if(!n)return;if(!h)return;if(!l)return;if(!p)return;const e=()=>null==n?void 0:n.setState("animating",!1),t=()=>(0,Fr.flushSync)(e);if("leave"===l&&u)return;if("enter"===l&&!u)return;if("number"==typeof h){return S_(h,t)}const{transitionDuration:s,animationDuration:i,transitionDelay:r,animationDelay:o}=getComputedStyle(p),{transitionDuration:a="0",animationDuration:c="0",transitionDelay:d="0",animationDelay:m="0"}=f?getComputedStyle(f):{},g=C_(r,o,d,m)+C_(s,i,a,c);if(!g)return"enter"===l&&n.setState("animated",!1),void e();return S_(Math.max(g-1e3/60,0),t)}),[n,h,p,f,u,l]),i=Tb(i,(e=>(0,oe.jsx)(Vw,{value:n,children:e})),[n]);const m=k_(d,i.hidden,s),g=i.style,v=(0,Un.useMemo)((()=>m?Ey(ky({},g),{display:"none"}):g),[m,g]);return qy(i=Ey(ky({id:a,"data-open":u||void 0,"data-enter":"enter"===l||void 0,"data-leave":"leave"===l||void 0,hidden:m},i),{ref:Cb(a?n.setContentElement:null,o,i.ref),style:v}))})),P_=Fb((function(e){return Bb("div",E_(e))})),I_=(Fb((function(e){var t=e,{unmountOnHide:n}=t,s=Py(t,["unmountOnHide"]);const i=Aw();return!1===cw(s.store||i,(e=>!n||(null==e?void 0:e.mounted)))?null:(0,oe.jsx)(P_,ky({},s))})),Db((function(e){var t=e,{store:n,alwaysVisible:s}=t,i=Py(t,["store","alwaysVisible"]);const r=Hw(!0),o=Gw(),a=!!(n=n||o)&&n===r;Uy(n,!1);const l=(0,Un.useRef)(null),c=kb(i.id),u=n.useState("mounted"),d=k_(u,i.hidden,s),h=d?Ey(ky({},i.style),{display:"none"}):i.style,p=n.useState((e=>Array.isArray(e.selectedValue))),f=Eb(l,"role",i.role),m=("listbox"===f||"tree"===f||"grid"===f)&&p||void 0,[g,v]=(0,Un.useState)(!1),x=n.useState("contentElement");jb((()=>{if(!u)return;const e=l.current;if(!e)return;if(x!==e)return;const t=()=>{v(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()}),[u,x]),g||(i=ky({role:"listbox","aria-multiselectable":m},i)),i=Tb(i,(e=>(0,oe.jsx)(qw,{value:n,children:(0,oe.jsx)(Lw.Provider,{value:f,children:e})})),[n,f]);const y=!c||r&&a?null:n.setContentElement;return qy(i=Ey(ky({id:c,hidden:d},i),{ref:Cb(y,l,i.ref),style:h}))}))),T_=Fb((function(e){return Bb("div",I_(e))}));function O_(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var A_=Symbol("composite-hover");var N_=Db((function(e){var t=e,{store:n,focusOnHover:s=!0,blurOnHoverEnd:i=!!s}=t,r=Py(t,["store","focusOnHover","blurOnHoverEnd"]);const o=Ub();Uy(n=n||o,!1);const a=((0,Un.useEffect)((()=>{yb("mousemove",Mb,!0),yb("mousedown",Vb,!0),yb("mouseup",Vb,!0),yb("keydown",Vb,!0),yb("scroll",Vb,!0)}),[]),Sb((()=>Ob))),l=r.onMouseMove,c=Ib(s),u=Sb((e=>{if(null==l||l(e),!e.defaultPrevented&&a()&&c(e)){if(!o_(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!r_(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}})),d=r.onMouseLeave,h=Ib(i),p=Sb((e=>{var t;null==d||d(e),e.defaultPrevented||a()&&(function(e){const t=O_(e);return!!t&&eb(e.currentTarget,t)}(e)||function(e){let t=O_(e);if(!t)return!1;do{if(Ly(t,A_)&&t[A_])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&h(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))})),f=(0,Un.useCallback)((e=>{e&&(e[A_]=!0)}),[]);return qy(r=Ey(ky({},r),{ref:Cb(f,r.ref),onMouseMove:u,onMouseLeave:p}))})),M_=(Rb(Fb((function(e){return Bb("div",N_(e))}))),Db((function(e){var t=e,{store:n,shouldRegisterItem:s=!0,getItem:i=Hy,element:r}=t,o=Py(t,["store","shouldRegisterItem","getItem","element"]);const a=Gb();n=n||a;const l=kb(o.id),c=(0,Un.useRef)(r);return(0,Un.useEffect)((()=>{const e=c.current;if(!l)return;if(!e)return;if(!s)return;const t=i({id:l,element:e});return null==n?void 0:n.renderItem(t)}),[l,s,i,n]),qy(o=Ey(ky({},o),{ref:Cb(c,o.ref)}))})));Fb((function(e){return Bb("div",M_(e))}));function V_(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?tb(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(tb(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var F_=Symbol("command"),R_=Db((function(e){var t=e,{clickOnEnter:n=!0,clickOnSpace:s=!0}=t,i=Py(t,["clickOnEnter","clickOnSpace"]);const r=(0,Un.useRef)(null),[o,a]=(0,Un.useState)(!1);(0,Un.useEffect)((()=>{r.current&&a(tb(r.current))}),[]);const[l,c]=(0,Un.useState)(!1),u=(0,Un.useRef)(!1),d=Wy(i),[h,p]=function(e,t,n){const s=e.onLoadedMetadataCapture,i=(0,Un.useMemo)((()=>Object.assign((()=>{}),Ey(ky({},s),{[t]:n}))),[s,t,n]);return[null==s?void 0:s[t],{onLoadedMetadataCapture:i}]}(i,F_,!0),f=i.onKeyDown,m=Sb((e=>{null==f||f(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(h)return;if(d)return;if(!fb(e))return;if(sb(t))return;if(t.isContentEditable)return;const i=n&&"Enter"===e.key,r=s&&" "===e.key,o="Enter"===e.key&&!n,a=" "===e.key&&!s;if(o||a)e.preventDefault();else if(i||r){const n=V_(e);if(i){if(!n){e.preventDefault();const n=e,{view:s}=n,i=Py(n,["view"]),r=()=>gb(t,i);Jy&&/firefox\//i.test(navigator.userAgent)?xb(t,"keyup",r):queueMicrotask(r)}}else r&&(u.current=!0,n||(e.preventDefault(),c(!0)))}})),g=i.onKeyUp,v=Sb((e=>{if(null==g||g(e),e.defaultPrevented)return;if(h)return;if(d)return;if(e.metaKey)return;const t=s&&" "===e.key;if(u.current&&t&&(u.current=!1,!V_(e))){e.preventDefault(),c(!1);const t=e.currentTarget,n=e,{view:s}=n,i=Py(n,["view"]);queueMicrotask((()=>gb(t,i)))}}));return i=Ey(ky(ky({"data-active":l||void 0,type:o?"button":void 0},p),i),{ref:Cb(r,i.ref),onKeyDown:m,onKeyUp:v}),i=v_(i)}));Fb((function(e){return Bb("button",R_(e))}));function B_(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function D_(e,t,n,s=!1){var i;if(!t)return;if(!n)return;const{renderedItems:r}=t.getState(),o=ab(e);if(!o)return;const a=function(e,t=!1){const n=e.clientHeight,{top:s}=e.getBoundingClientRect(),i=1.5*Math.max(.875*n,n-40),r=t?n-i+s:i+s;return"HTML"===e.tagName?r+e.scrollTop:r}(o,s);let l,c;for(let e=0;e=0){void 0!==c&&cs||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===h,ariaSetSize:e=>null!=l?l:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0,ariaPosInSet(e){if(null!=c)return c;if(!e)return;if(!(null==f?void 0:f.ariaPosInSet))return;if(f.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===g));return f.ariaPosInSet+t.findIndex((e=>e.id===h))},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(o)return!0;if(null===e.activeId)return!1;const t=null==n?void 0:n.item(e.activeId);return!!(null==t?void 0:t.disabled)||(!(null==t?void 0:t.element)||e.activeId===h)}}),_=(0,Un.useCallback)((e=>{var t;const n=Ey(ky({},e),{id:h||e.id,rowId:g,disabled:!!m,children:null==(t=e.element)?void 0:t.textContent});return a?a(n):n}),[h,g,m,a]),j=u.onFocus,S=(0,Un.useRef)(!1),C=Sb((e=>{if(null==j||j(e),e.defaultPrevented)return;if(pb(e))return;if(!h)return;if(!n)return;if(function(e,t){return!fb(e)&&t_(t,e.target)}(e,n))return;const{virtualFocus:t,baseElement:s}=n.getState();if(n.setActiveId(h),ib(e.currentTarget)&&function(e,t=!1){if(sb(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=Qy(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(e.currentTarget),!t)return;if(!fb(e))return;if(ib(i=e.currentTarget)||"INPUT"===i.tagName&&!tb(i))return;var i;if(!(null==s?void 0:s.isConnected))return;hb()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),S.current=!0;e.relatedTarget===s||t_(n,e.relatedTarget)?function(e){e[e_]=!0,e.focus({preventScroll:!0})}(s):s.focus()})),k=u.onBlurCapture,E=Sb((e=>{if(null==k||k(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&S.current&&(S.current=!1,e.preventDefault(),e.stopPropagation())})),P=u.onKeyDown,I=Ib(i),T=Ib(r),O=Sb((e=>{if(null==P||P(e),e.defaultPrevented)return;if(!fb(e))return;if(!n)return;const{currentTarget:t}=e,s=n.getState(),i=n.item(h),r=!!(null==i?void 0:i.rowId),o="horizontal"!==s.orientation,a="vertical"!==s.orientation,l=()=>!!r||(!!a||(!s.baseElement||!sb(s.baseElement))),c={ArrowUp:(r||o)&&n.up,ArrowRight:(r||a)&&n.next,ArrowDown:(r||o)&&n.down,ArrowLeft:(r||a)&&n.previous,Home:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!r||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>D_(t,n,null==n?void 0:n.up,!0),PageDown:()=>D_(t,n,null==n?void 0:n.down)}[e.key];if(c){if(ib(t)){const n=rb(t),s=a&&"ArrowLeft"===e.key,i=a&&"ArrowRight"===e.key,r=o&&"ArrowUp"===e.key,l=o&&"ArrowDown"===e.key;if(i||l){const{length:e}=function(e){if(sb(e))return e.value;if(e.isContentEditable){const t=Qy(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(t);if(n.end!==e)return}else if((s||r)&&0!==n.start)return}const s=c();if(I(e)||void 0!==s){if(!T(e))return;e.preventDefault(),n.move(s)}}})),A=(0,Un.useMemo)((()=>({id:h,baseElement:v})),[h,v]);return u=Tb(u,(e=>(0,oe.jsx)(Kb.Provider,{value:A,children:e})),[A]),u=Ey(ky({id:h,"data-active-item":x||void 0},u),{ref:Cb(p,u.ref),tabIndex:w?u.tabIndex:-1,onFocus:C,onBlurCapture:E,onKeyDown:O}),u=R_(u),u=M_(Ey(ky({store:n},u),{getItem:_,shouldRegisterItem:!!h&&u.shouldRegisterItem})),qy(Ey(ky({},u),{"aria-setsize":y,"aria-posinset":b}))}));Rb(Fb((function(e){return Bb("button",L_(e))})));function z_(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}var G_=Db((function(e){var t,n=e,{store:s,value:i,hideOnClick:r,setValueOnClick:o,selectValueOnClick:a=!0,resetValueOnSelect:l,focusOnHover:c=!1,moveOnKeyPress:u=!0,getItem:d}=n,h=Py(n,["store","value","hideOnClick","setValueOnClick","selectValueOnClick","resetValueOnSelect","focusOnHover","moveOnKeyPress","getItem"]);const p=Hw();Uy(s=s||p,!1);const{resetValueOnSelectState:f,multiSelectable:m,selected:g}=uw(s,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,i)}),v=(0,Un.useCallback)((e=>{const t=Ey(ky({},e),{value:i});return d?d(t):t}),[i,d]);o=null!=o?o:!m,r=null!=r?r:null!=i&&!m;const x=h.onClick,y=Ib(o),b=Ib(a),w=Ib(null!=(t=null!=l?l:f)?t:m),_=Ib(r),j=Sb((e=>{null==x||x(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const n=db();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const s=t.tagName.toLowerCase();return"a"===s||"button"===s&&"submit"===t.type||"input"===s&&"submit"===t.type}(e)||(null!=i&&(b(e)&&(w(e)&&(null==s||s.resetValue()),null==s||s.setSelectedValue((e=>Array.isArray(e)?e.includes(i)?e.filter((e=>e!==i)):[...e,i]:i))),y(e)&&(null==s||s.setValue(i))),_(e)&&(null==s||s.hide()))})),S=h.onKeyDown,C=Sb((e=>{if(null==S||S(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState().baseElement;if(!t)return;if(r_(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),sb(t)&&(null==s||s.setValue(t.value)))}));m&&null!=g&&(h=ky({"aria-selected":g},h)),h=Tb(h,(e=>(0,oe.jsx)(Zw.Provider,{value:i,children:(0,oe.jsx)(Kw.Provider,{value:null!=g&&g,children:e})})),[i,g]);const k=(0,Un.useContext)(Lw);h=Ey(ky({role:z_(k),children:i},h),{onClick:j,onKeyDown:C});const E=Ib(u);return h=L_(Ey(ky({store:s},h),{getItem:v,moveOnKeyPress:e=>{if(!E(e))return!1;const t=new Event("combobox-item-move"),n=null==s?void 0:s.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),h=N_(ky({store:s,focusOnHover:c},h))})),H_=Rb(Fb((function(e){return Bb("div",G_(e))})));function U_(e){return Gy(e).toLowerCase()}function W_(e,t){if(!e)return e;if(!t)return e;const n=(s=t,Array.isArray(s)?s:void 0!==s?[s]:[]).filter(Boolean).map(U_);var s;const i=[],r=(e,t=!1)=>(0,oe.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},i.length),o=function(e){return e.sort((([e],[t])=>e-t))}(function(e){return e.filter((([e,t],n,s)=>!s.some((([s,i],r)=>r!==n&&s<=e&&s+i>=e+t))))}(function(e,t){const n=[];for(const s of t){let t=0;const i=s.length;for(;-1!==e.indexOf(s,t);){const r=e.indexOf(s,t);-1!==r&&n.push([r,i]),t=r+1}}return n}(U_(e),new Set(n))));if(!o.length)return i.push(r(e,!0)),i;const[a]=o[0],l=[e.slice(0,a),...o.flatMap((([t,n],s)=>{var i;const r=e.slice(t,t+n),a=null==(i=o[s+1])?void 0:i[0];return[r,e.slice(t+n,a)]}))];return l.forEach(((e,t)=>{e&&i.push(r(e,t%2==0))})),i}var q_=Db((function(e){var t=e,{store:n,value:s,userValue:i}=t,r=Py(t,["store","value","userValue"]);const o=Hw();n=n||o;const a=(0,Un.useContext)(Zw),l=null!=s?s:a,c=cw(n,(e=>null!=i?i:null==e?void 0:e.value)),u=(0,Un.useMemo)((()=>{if(l)return c?W_(l,c):l}),[l,c]);return qy(r=ky({children:u},r))})),Z_=Fb((function(e){return Bb("span",q_(e))}));const K_=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Circle,{cx:12,cy:12,r:3})});function Y_(e=""){return Ux()(e.trim().toLowerCase())}const X_=[],J_=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:X_,Q_=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter((e=>e!==n)):[...t.value,n]:[n];function $_(e,t){return`${e}-${t}`}function ej({view:e,filter:t,onChangeView:n}){const s=(0,v.useInstanceId)(ej,"dataviews-filter-list-box"),[i,r]=(0,d.useState)(1===t.operators?.length?void 0:null),o=e.filters?.find((e=>e.field===t.field)),a=J_(t,o);return(0,oe.jsx)(y.Composite,{virtualFocus:!0,focusLoop:!0,activeId:i,setActiveId:r,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,b.sprintf)((0,b.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!i&&t.elements.length&&r($_(s,t.elements[0].value))},render:(0,oe.jsx)(y.Composite.Typeahead,{}),children:t.elements.map((i=>(0,oe.jsxs)(y.Composite.Hover,{render:(0,oe.jsx)(y.Composite.Item,{id:$_(s,i.value),render:(0,oe.jsx)("div",{"aria-label":i.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{var s,r;const a=o?[...(null!==(s=e.filters)&&void 0!==s?s:[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:Q_(t,o,i.value)}:e))]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:Q_(t,o,i.value)}];n({...e,page:1,filters:a})}}),children:[(0,oe.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&a===i.value&&(0,oe.jsx)(y.Icon,{icon:K_}),!t.singleSelection&&a.includes(i.value)&&(0,oe.jsx)(y.Icon,{icon:Jr})]}),(0,oe.jsx)("span",{children:i.label})]},i.value)))})}function tj({view:e,filter:t,onChangeView:n}){const[s,i]=(0,d.useState)(""),r=(0,d.useDeferredValue)(s),o=e.filters?.find((e=>e.field===t.field)),a=J_(t,o),l=(0,d.useMemo)((()=>{const e=Y_(r);return t.elements.filter((t=>Y_(t.label).includes(e)))}),[t.elements,r]);return(0,oe.jsxs)(Yw,{selectedValue:a,setSelectedValue:s=>{var i,r;const a=o?[...(null!==(i=e.filters)&&void 0!==i?i:[]).map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:s}:e))]:[...null!==(r=e.filters)&&void 0!==r?r:[],{field:t.field,operator:t.operators[0],value:s}];n({...e,page:1,filters:a})},setValue:i,children:[(0,oe.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,oe.jsx)(Jw,{render:(0,oe.jsx)(y.VisuallyHidden,{children:(0,b.__)("Search items")}),children:(0,b.__)("Search items")}),(0,oe.jsx)(j_,{autoSelect:"always",placeholder:(0,b.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,oe.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,oe.jsx)(y.Icon,{icon:Xt})})]}),(0,oe.jsxs)(T_,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[l.map((e=>(0,oe.jsxs)(H_,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,oe.jsxs)("span",{className:"dataviews-filters__search-widget-listitem-check",children:[t.singleSelection&&a===e.value&&(0,oe.jsx)(y.Icon,{icon:K_}),!t.singleSelection&&a.includes(e.value)&&(0,oe.jsx)(y.Icon,{icon:Jr})]}),(0,oe.jsxs)("span",{children:[(0,oe.jsx)(Z_,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,oe.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value))),!l.length&&(0,oe.jsx)("p",{children:(0,b.__)("No results found")})]})]})}function nj(e){const t=e.filter.elements.length>10?tj:ej;return(0,oe.jsx)(t,{...e})}const sj="Enter",ij=" ",rj=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const s={Name:(0,oe.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,oe.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};return t?.operator===Yx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is any: %2$s"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Xx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is none: %2$s"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Jx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is all: %2$s"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Qx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not all: %2$s"),n.name,e.map((e=>e.label)).join(", ")),s):t?.operator===Zx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is: %2$s"),n.name,e[0].label),s):t?.operator===Kx?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not: %2$s"),n.name,e[0].label),s):(0,b.sprintf)((0,b.__)("Unknown status for %1$s"),n.name)};function oj({filter:e,view:t,onChangeView:n}){const s=e.operators?.map((e=>({value:e,label:ey[e]?.label}))),i=t.filters?.find((t=>t.field===e.field)),r=i?.operator||e.operators[0];return s.length>1&&(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,oe.jsx)(y.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,oe.jsx)(y.SelectControl,{label:(0,b.__)("Conditions"),value:r,options:s,onChange:s=>{var r,o;const a=s,l=i?[...(null!==(r=t.filters)&&void 0!==r?r:[]).map((t=>t.field===e.field?{...t,operator:a}:t))]:[...null!==(o=t.filters)&&void 0!==o?o:[],{field:e.field,operator:a,value:void 0}];n({...t,page:1,filters:l})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function aj({addFilterRef:e,openedFilter:t,...n}){const s=(0,d.useRef)(null),{filter:i,view:r,onChangeView:o}=n,a=r.filters?.find((e=>e.field===i.field)),l=i.elements.filter((e=>i.singleSelection?e.value===a?.value:a?.value?.includes(e.value))),c=i.isPrimary,u=void 0!==a?.value,h=!c||u;return(0,oe.jsx)(y.Dropdown,{defaultOpen:t===i.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{s.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,oe.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,oe.jsx)(y.Tooltip,{text:(0,b.sprintf)((0,b.__)("Filter by: %1$s"),i.name.toLowerCase()),placement:"top",children:(0,oe.jsx)("div",{className:Ut("dataviews-filters__summary-chip",{"has-reset":h,"has-values":u}),role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{[sj,ij].includes(e.key)&&(n(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:s,children:(0,oe.jsx)(rj,{activeElements:l,filterInView:a,filter:i})})}),h&&(0,oe.jsx)(y.Tooltip,{text:c?(0,b.__)("Reset"):(0,b.__)("Remove"),placement:"top",children:(0,oe.jsx)("button",{className:Ut("dataviews-filters__summary-chip-remove",{"has-values":u}),onClick:()=>{o({...r,page:1,filters:r.filters?.filter((e=>e.field!==i.field))}),c?s.current?.focus():e.current?.focus()},children:(0,oe.jsx)(y.Icon,{icon:Ro})})})]}),renderContent:()=>(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,oe.jsx)(oj,{...n}),(0,oe.jsx)(nj,{...n})]})})}const{lock:lj,unlock:cj}=(0,$.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),{Menu:uj}=cj(y.privateApis);function dj({filters:e,view:t,onChangeView:n,setOpenedFilter:s,triggerProps:i}){const r=e.filter((e=>!e.isVisible));return(0,oe.jsxs)(uj,{children:[(0,oe.jsx)(uj.TriggerButton,{...i}),(0,oe.jsx)(uj.Popover,{children:r.map((e=>(0,oe.jsx)(uj.Item,{onClick:()=>{s(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,oe.jsx)(uj.ItemLabel,{children:e.name})},e.field)))})]})}const hj=(0,d.forwardRef)((function({filters:e,view:t,onChangeView:n,setOpenedFilter:s},i){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const r=e.filter((e=>!e.isVisible));return(0,oe.jsx)(dj,{triggerProps:{render:(0,oe.jsx)(y.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:i}),children:(0,b.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:s})}));function pj({filters:e,view:t,onChangeView:n}){const s=!t.search&&!t.filters?.some((t=>{return void 0!==t.value||(n=t.field,!e.some((e=>e.field===n&&e.isPrimary)));var n}));return(0,oe.jsx)(y.Button,{disabled:s,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:[]})},children:(0,b.__)("Reset")})}function fj(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[Yx,Xx]),t=t.filter((e=>$x.includes(e))),(t.includes(Zx)||t.includes(Kx))&&(t=t.filter((e=>[Zx,Kx].includes(e)))),t}function mj(e,t){return(0,d.useMemo)((()=>{const n=[];return e.forEach((e=>{if(!e.elements?.length)return;const s=fj(e);if(0===s.length)return;const i=!!e.filterBy?.isPrimary;n.push({field:e.id,name:e.label,elements:e.elements,singleSelection:s.some((e=>[Zx,Kx].includes(e))),operators:s,isVisible:i||!!t.filters?.some((t=>t.field===e.id&&$x.includes(t.operator))),isPrimary:i})})),n.sort(((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name))),n}),[e,t])}function gj({filters:e,view:t,onChangeView:n,setOpenedFilter:s,isShowingFilter:i,setIsShowingFilter:r}){const o=(0,d.useRef)(null),a=(0,d.useCallback)((e=>{n(e),r(!0)}),[n,r]),l=!!e.filter((e=>e.isVisible)).length;if(0===e.length)return null;const c={label:(0,b.__)("Add filter"),"aria-expanded":!1,isPressed:!1},u={label:(0,b._x)("Filter","verb"),"aria-expanded":i,isPressed:i,onClick:()=>{i||s(null),r(!i)}},h=(0,oe.jsx)(y.Button,{ref:o,className:"dataviews-filters__visibility-toggle",size:"compact",icon:xy,...l?u:c});return(0,oe.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:l?(0,oe.jsx)(vj,{buttonRef:o,filtersCount:t.filters?.length,children:h}):(0,oe.jsx)(dj,{filters:e,view:t,onChangeView:a,setOpenedFilter:s,triggerProps:{render:h}})})}function vj({buttonRef:e,filtersCount:t,children:n}){return(0,d.useEffect)((()=>()=>{e.current?.focus()}),[e]),(0,oe.jsxs)(oe.Fragment,{children:[n,!!t&&(0,oe.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}const xj=(0,d.memo)((function(){const{fields:e,view:t,onChangeView:n,openedFilter:s,setOpenedFilter:i}=(0,d.useContext)(vy),r=(0,d.useRef)(null),o=mj(e,t),a=(0,oe.jsx)(hj,{filters:o,view:t,onChangeView:n,ref:r,setOpenedFilter:i},"add-filter"),l=o.filter((e=>e.isVisible));if(0===l.length)return null;const c=[...l.map((e=>(0,oe.jsx)(aj,{filter:e,view:t,onChangeView:n,addFilterRef:r,openedFilter:s},e.field))),a];return c.push((0,oe.jsx)(pj,{filters:o,view:t,onChangeView:n},"reset-filters")),(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},className:"dataviews-filters__container",wrap:!0,children:c})})),yj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),bj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),wj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),_j=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})});function jj({selection:e,onChangeSelection:t,item:n,getItemId:s,titleField:i,disabled:r}){const o=s(n),a=!r&&e.includes(o),l=i?.getValue?.({item:n})||(0,b.__)("(no title)");return(0,oe.jsx)(y.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":l,"aria-disabled":r,checked:a,onChange:()=>{r||t(e.includes(o)?e.filter((e=>o!==e)):[...e,o])}})}const{Menu:Sj,kebabCase:Cj}=cj(y.privateApis);function kj({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,oe.jsx)(y.Button,{label:s,icon:e.icon,disabled:!!e.disabled,accessibleWhenDisabled:!0,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Ej({action:e,onClick:t,items:n}){const s="string"==typeof e.label?e.label:e.label(n);return(0,oe.jsx)(Sj.Item,{disabled:e.disabled,onClick:t,children:(0,oe.jsx)(Sj.ItemLabel,{children:s})})}function Pj({action:e,items:t,closeModal:n}){const s="string"==typeof e.label?e.label:e.label(t);return(0,oe.jsx)(y.Modal,{title:e.modalHeader||s,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:"firstContentElement",size:"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${Cj(e.id)}`,children:(0,oe.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Ij({actions:e,item:t,registry:n,setActiveModalAction:s}){return(0,oe.jsx)(Sj.Group,{children:e.map((e=>(0,oe.jsx)(Ej,{action:e,onClick:()=>{"RenderModal"in e?s(e):e.callback([t],{registry:n})},items:[t]},e.id)))})}function Tj({item:e,actions:t,isCompact:n}){const s=(0,l.useRegistry)(),{primaryActions:i,eligibleActions:r}=(0,d.useMemo)((()=>{const n=t.filter((t=>!t.isEligible||t.isEligible(e)));return{primaryActions:n.filter((e=>e.isPrimary&&!!e.icon)),eligibleActions:n}}),[t,e]);return n?(0,oe.jsx)(Oj,{item:e,actions:r,isSmall:!0,registry:s}):i.length===r.length?(0,oe.jsx)(Aj,{item:e,actions:i,registry:s}):(0,oe.jsxs)(y.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[(0,oe.jsx)(Aj,{item:e,actions:i,registry:s}),(0,oe.jsx)(Oj,{item:e,actions:r,registry:s})]})}function Oj({item:e,actions:t,isSmall:n,registry:s}){const[i,r]=(0,d.useState)(null);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(Sj,{placement:"bottom-end",children:[(0,oe.jsx)(Sj.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:n?"small":"compact",icon:Ga,label:(0,b.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,className:"dataviews-all-actions-button"})}),(0,oe.jsx)(Sj.Popover,{children:(0,oe.jsx)(Ij,{actions:t,item:e,registry:s,setActiveModalAction:r})})]}),!!i&&(0,oe.jsx)(Pj,{action:i,items:[e],closeModal:()=>r(null)})]})}function Aj({item:e,actions:t,registry:n}){const[s,i]=(0,d.useState)(null);return Array.isArray(t)&&0!==t.length?(0,oe.jsxs)(oe.Fragment,{children:[t.map((t=>(0,oe.jsx)(kj,{action:t,onClick:()=>{"RenderModal"in t?i(t):t.callback([e],{registry:n})},items:[e]},t.id))),!!s&&(0,oe.jsx)(Pj,{action:s,items:[e],closeModal:()=>i(null)})]}):null}function Nj({action:e,items:t,ActionTriggerComponent:n}){const[s,i]=(0,d.useState)(!1),r={action:e,onClick:()=>{i(!0)},items:t};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(n,{...r}),s&&(0,oe.jsx)(Pj,{action:e,items:t,closeModal:()=>i(!1)})]})}function Mj(e,t){return(0,d.useMemo)((()=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))),[e,t])}function Vj(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}function Fj({selection:e,onChangeSelection:t,data:n,actions:s,getItemId:i}){const r=(0,d.useMemo)((()=>n.filter((e=>s.some((t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e))))))),[n,s]),o=n.filter((t=>e.includes(i(t))&&r.includes(t))),a=o.length===r.length;return(0,oe.jsx)(y.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:a,indeterminate:!a&&!!o.length,onChange:()=>{t(a?[]:r.map((e=>i(e))))},"aria-label":a?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function Rj({action:e,onClick:t,isBusy:n,items:s}){const i="string"==typeof e.label?e.label:e.label(s);return(0,oe.jsx)(y.Button,{disabled:n,accessibleWhenDisabled:!0,label:i,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:n,tooltipPosition:"top"})}const Bj=[];function Dj({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:s}){const i=(0,l.useRegistry)(),r=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]);return"RenderModal"in e?(0,oe.jsx)(Nj,{action:e,items:r,ActionTriggerComponent:Rj},e.id):(0,oe.jsx)(Rj,{action:e,onClick:async()=>{s(e.id),await e.callback(t,{registry:i}),s(null)},items:r,isBusy:n===e.id},e.id)}function Lj(e,t,n,s,i,r,o,a,l){const c=r.length>0?(0,b.sprintf)((0,b._n)("%d Item selected","%d Items selected",r.length),r.length):(0,b.sprintf)((0,b._n)("%d Item","%d Items",e.length),e.length);return(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,oe.jsx)(Fj,{selection:s,onChangeSelection:l,data:e,actions:t,getItemId:n}),(0,oe.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:c}),(0,oe.jsxs)(y.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[i.map((e=>(0,oe.jsx)(Dj,{action:e,selectedItems:r,actionInProgress:o,setActionInProgress:a},e.id))),r.length>0&&(0,oe.jsx)(y.Button,{icon:Ro,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,b.__)("Cancel"),disabled:!!o,accessibleWhenDisabled:!1,onClick:()=>{l(Bj)}})]})]})}function zj({selection:e,actions:t,onChangeSelection:n,data:s,getItemId:i}){const[r,o]=(0,d.useState)(null),a=(0,d.useRef)(null),l=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),c=(0,d.useMemo)((()=>s.filter((e=>l.some((t=>!t.isEligible||t.isEligible(e)))))),[s,l]),u=(0,d.useMemo)((()=>s.filter((t=>e.includes(i(t))&&c.includes(t)))),[e,s,i,c]),h=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk&&e.icon&&u.some((t=>!e.isEligible||e.isEligible(t)))))),[t,u]);return r?(a.current||(a.current=Lj(s,t,i,e,h,u,r,o,n)),a.current):(a.current&&(a.current=null),Lj(s,t,i,e,h,u,r,o,n))}function Gj(){const{data:e,selection:t,actions:n=Bj,onChangeSelection:s,getItemId:i}=(0,d.useContext)(vy);return(0,oe.jsx)(zj,{selection:t,onChangeSelection:s,data:e,actions:n,getItemId:i})}const Hj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),Uj=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),Wj=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})}),{Menu:qj}=cj(y.privateApis);function Zj({children:e}){return d.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,oe.jsxs)(d.Fragment,{children:[t>0&&(0,oe.jsx)(qj.Separator,{}),e]},t)))}const Kj=(0,d.forwardRef)((function({fieldId:e,view:t,fields:n,onChangeView:s,onHide:i,setOpenedFilter:r,canMove:o=!0},a){var l;const c=null!==(l=t.fields)&&void 0!==l?l:[],u=c?.indexOf(e),d=t.sort?.field===e;let h=!1,p=!1,f=!1,m=[];const g=n.find((t=>t.id===e));if(!g)return null;h=!1!==g.enableHiding,p=!1!==g.enableSorting;const v=g.header;return m=fj(g),f=!(t.filters?.some((t=>e===t.field))||!g.elements?.length||!m.length||g.filterBy?.isPrimary),(0,oe.jsxs)(qj,{children:[(0,oe.jsxs)(qj.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:a,variant:"tertiary"}),children:[v,t.sort&&d&&(0,oe.jsx)("span",{"aria-hidden":"true",children:ny[t.sort.direction]})]}),(0,oe.jsx)(qj.Popover,{style:{minWidth:"240px"},children:(0,oe.jsxs)(Zj,{children:[p&&(0,oe.jsx)(qj.Group,{children:ty.map((n=>{const i=t.sort&&d&&t.sort.direction===n,r=`${e}-${n}`;return(0,oe.jsx)(qj.RadioItem,{name:"view-table-sorting",value:r,checked:i,onChange:()=>{s({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,oe.jsx)(qj.ItemLabel,{children:iy[n]})},r)}))}),f&&(0,oe.jsx)(qj.Group,{children:(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:xy}),onClick:()=>{r(e),s({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:m[0]}]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Add filter")})})}),(o||h)&&g&&(0,oe.jsxs)(qj.Group,{children:[o&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Hj}),disabled:u<1,onClick:()=>{var n;s({...t,fields:[...null!==(n=c.slice(0,u-1))&&void 0!==n?n:[],e,c[u-1],...c.slice(u+1)]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Move left")})}),o&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Uj}),disabled:u>=c.length-1,onClick:()=>{var n;s({...t,fields:[...null!==(n=c.slice(0,u))&&void 0!==n?n:[],c[u+1],e,...c.slice(u+2)]})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Move right")})}),h&&g&&(0,oe.jsx)(qj.Item,{prefix:(0,oe.jsx)(y.Icon,{icon:Wj}),onClick:()=>{i(g),s({...t,fields:c.filter((t=>t!==e))})},children:(0,oe.jsx)(qj.ItemLabel,{children:(0,b.__)("Hide column")})})]})]})})]})})),Yj=Kj;function Xj({item:e,isItemClickable:t,onClickItem:n,className:s}){return t(e)&&n?{className:s?`${s} ${s}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:s}}const Jj=function({item:e,level:t,titleField:n,mediaField:s,descriptionField:i,onClickItem:r,isItemClickable:o}){const a=Xj({item:e,isItemClickable:o,onClickItem:r,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field"});return(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,justify:"flex-start",children:[s&&(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",children:(0,oe.jsx)(s.render,{item:e})}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,children:[n&&(0,oe.jsxs)("div",{...a,children:[void 0!==t&&(0,oe.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,oe.jsx)(n.render,{item:e})]}),i&&(0,oe.jsx)(i.render,{item:e})]})]})};function Qj({item:e,fields:t,column:n}){const s=t.find((e=>e.id===n));return s?(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,oe.jsx)(s.render,{item:e})}):null}function $j({hasBulkActions:e,item:t,level:n,actions:s,fields:i,id:r,view:o,titleField:a,mediaField:l,descriptionField:c,selection:u,getItemId:h,isItemClickable:p,onClickItem:f,onChangeSelection:m}){var g;const v=Mj(s,t),x=v&&u.includes(r),[y,b]=(0,d.useState)(!1),{showTitle:w=!0,showMedia:_=!0,showDescription:j=!0}=o,S=(0,d.useRef)(!1),C=null!==(g=o.fields)&&void 0!==g?g:[],k=a&&w||l&&_||c&&j;return(0,oe.jsxs)("tr",{className:Ut("dataviews-view-table__row",{"is-selected":v&&x,"is-hovered":y,"has-bulk-actions":v}),onMouseEnter:()=>{b(!0)},onMouseLeave:()=>{b(!1)},onTouchStart:()=>{S.current=!0},onClick:()=>{v&&(S.current||"Range"===document.getSelection()?.type||m(u.includes(r)?u.filter((e=>r!==e)):[r]))},children:[e&&(0,oe.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,oe.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,oe.jsx)(jj,{item:t,selection:u,onChangeSelection:m,getItemId:h,titleField:a,disabled:!v})})}),k&&(0,oe.jsx)("td",{children:(0,oe.jsx)(Jj,{item:t,level:n,titleField:w?a:void 0,mediaField:_?l:void 0,descriptionField:j?c:void 0,isItemClickable:p,onClickItem:f})}),C.map((e=>{var n;const{width:s,maxWidth:r,minWidth:a}=null!==(n=o.layout?.styles?.[e])&&void 0!==n?n:{};return(0,oe.jsx)("td",{style:{width:s,maxWidth:r,minWidth:a},children:(0,oe.jsx)(Qj,{fields:i,item:t,column:e})},e)})),!!s?.length&&(0,oe.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,oe.jsx)(Tj,{item:t,actions:s})})]})}const eS=function({actions:e,data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r=!1,onChangeView:o,onChangeSelection:a,selection:l,setOpenedFilter:c,onClickItem:u,isItemClickable:h,view:p}){var f;const m=(0,d.useRef)(new Map),g=(0,d.useRef)(),[v,x]=(0,d.useState)(),w=Vj(e,t);(0,d.useEffect)((()=>{g.current&&(g.current.focus(),g.current=void 0)}));const _=(0,d.useId)();if(v)return g.current=v,void x(void 0);const j=e=>{const t=m.current.get(e.id),n=t?m.current.get(t.fallback):void 0;x(n?.node)},S=!!t?.length,C=n.find((e=>e.id===p.titleField)),k=n.find((e=>e.id===p.mediaField)),E=n.find((e=>e.id===p.descriptionField)),{showTitle:P=!0,showMedia:I=!0,showDescription:T=!0}=p,O=C&&P||k&&I||E&&T,A=null!==(f=p.fields)&&void 0!==f?f:[],N=(e,t)=>n=>{n?m.current.set(e,{node:n,fallback:A[t>0?t-1:1]}):m.current.delete(e)};return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("table",{className:Ut("dataviews-view-table",{[`has-${p.layout?.density}-density`]:p.layout?.density&&["compact","comfortable"].includes(p.layout.density)}),"aria-busy":r,"aria-describedby":_,children:[(0,oe.jsx)("thead",{children:(0,oe.jsxs)("tr",{className:"dataviews-view-table__row",children:[w&&(0,oe.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,oe.jsx)(Fj,{selection:l,onChangeSelection:a,data:t,actions:e,getItemId:s})}),O&&(0,oe.jsx)("th",{scope:"col",children:C&&(0,oe.jsx)(Yj,{ref:N(C.id,0),fieldId:C.id,view:p,fields:n,onChangeView:o,onHide:j,setOpenedFilter:c,canMove:!1})}),A.map(((e,t)=>{var s;const{width:i,maxWidth:r,minWidth:a}=null!==(s=p.layout?.styles?.[e])&&void 0!==s?s:{};return(0,oe.jsx)("th",{style:{width:i,maxWidth:r,minWidth:a},"aria-sort":p.sort?.direction&&p.sort?.field===e?sy[p.sort.direction]:void 0,scope:"col",children:(0,oe.jsx)(Yj,{ref:N(e,t),fieldId:e,view:p,fields:n,onChangeView:o,onHide:j,setOpenedFilter:c})},e)})),!!e?.length&&(0,oe.jsx)("th",{className:"dataviews-view-table__actions-column",children:(0,oe.jsx)("span",{className:"dataviews-view-table-header",children:(0,b.__)("Actions")})})]})}),(0,oe.jsx)("tbody",{children:S&&t.map(((t,r)=>(0,oe.jsx)($j,{item:t,level:p.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:w,actions:e,fields:n,id:s(t)||r.toString(),view:p,titleField:C,mediaField:k,descriptionField:E,selection:l,getItemId:s,onChangeSelection:a,onClickItem:u,isItemClickable:h},s(t))))})]}),(0,oe.jsx)("div",{className:Ut({"dataviews-loading":r,"dataviews-no-results":!S&&!r}),id:_,children:!S&&(0,oe.jsx)("p",{children:r?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})]})},tS={xhuge:{min:3,max:6,default:5},huge:{min:2,max:4,default:4},xlarge:{min:2,max:3,default:3},large:{min:1,max:2,default:2},mobile:{min:1,max:2,default:2}},nS={xhuge:1520,huge:1140,xlarge:780,large:480,mobile:0};function sS(){const e=(0,d.useContext)(vy).containerWidth;for(const[t,n]of Object.entries(nS))if(e>=n)return t;return"mobile"}const{Badge:iS}=cj(y.privateApis);function rS({view:e,selection:t,onChangeSelection:n,onClickItem:s,isItemClickable:i,getItemId:r,item:o,actions:a,mediaField:l,titleField:c,descriptionField:u,regularFields:d,badgeFields:h,hasBulkActions:p}){const{showTitle:f=!0,showMedia:m=!0,showDescription:g=!0}=e,x=Mj(a,o),w=r(o),_=(0,v.useInstanceId)(rS),j=t.includes(w),S=l?.render?(0,oe.jsx)(l.render,{item:o}):null,C=f&&c?.render?(0,oe.jsx)(c.render,{item:o}):null,k=Xj({item:o,isItemClickable:i,onClickItem:s,className:"dataviews-view-grid__media"}),E=Xj({item:o,isItemClickable:i,onClickItem:s,className:"dataviews-view-grid__title-field dataviews-title-field"});let P,I;return i(o)&&s&&(C?(P={"aria-labelledby":`dataviews-view-grid__title-field-${_}`},I={id:`dataviews-view-grid__title-field-${_}`}):P={"aria-label":(0,b.__)("Navigate to item")}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:0,className:Ut("dataviews-view-grid__card",{"is-selected":x&&j}),onClickCapture:e=>{if(e.ctrlKey||e.metaKey){if(e.stopPropagation(),e.preventDefault(),!x)return;n(t.includes(w)?t.filter((e=>w!==e)):[...t,w])}},children:[m&&S&&(0,oe.jsx)("div",{...k,...P,children:S}),p&&m&&S&&(0,oe.jsx)(jj,{item:o,selection:t,onChangeSelection:n,getItemId:r,titleField:c,disabled:!x}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,oe.jsx)("div",{...E,...I,children:C}),!!a?.length&&(0,oe.jsx)(Tj,{item:o,actions:a,isCompact:!0})]}),(0,oe.jsxs)(y.__experimentalVStack,{spacing:1,children:[g&&u?.render&&(0,oe.jsx)(u.render,{item:o}),!!h?.length&&(0,oe.jsx)(y.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:h.map((e=>(0,oe.jsx)(iS,{className:"dataviews-view-grid__field-value",children:(0,oe.jsx)(e.render,{item:o})},e.id)))}),!!d?.length&&(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:d.map((e=>(0,oe.jsx)(y.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,oe.jsx)(y.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,oe.jsx)(e.render,{item:o})})]})},e.id)))})]})]},w)}const{Menu:oS}=cj(y.privateApis);function aS(e){return`${e}-item-wrapper`}function lS(e){return`${e}-dropdown`}function cS({idPrefix:e,primaryAction:t,item:n}){const s=(0,l.useRegistry)(),[i,r]=(0,d.useState)(!1),o=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),a="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:o,render:(0,oe.jsx)(y.Button,{label:a,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>r(!0)}),children:i&&(0,oe.jsx)(Pj,{action:t,items:[n],closeModal:()=>r(!1)})})},t.id):(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:o,render:(0,oe.jsx)(y.Button,{label:a,disabled:!!t.disabled,accessibleWhenDisabled:!0,icon:t.icon,isDestructive:t.isDestructive,size:"small",onClick:()=>{t.callback([n],{registry:s})}})})},t.id)}function uS({view:e,actions:t,idPrefix:n,isSelected:s,item:i,titleField:r,mediaField:o,descriptionField:a,onSelect:c,otherFields:u,onDropdownTriggerKeyDown:h}){const{showTitle:p=!0,showMedia:f=!0,showDescription:m=!0}=e,g=(0,d.useRef)(null),v=`${n}-label`,x=`${n}-description`,w=(0,l.useRegistry)(),[_,j]=(0,d.useState)(!1),[S,C]=(0,d.useState)(null),k=({type:e})=>{j("mouseenter"===e)};(0,d.useEffect)((()=>{s&&g.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})}),[s]);const{primaryAction:E,eligibleActions:P}=(0,d.useMemo)((()=>{const e=t.filter((e=>!e.isEligible||e.isEligible(i)));return{primaryAction:e.filter((e=>e.isPrimary&&!!e.icon))[0],eligibleActions:e}}),[t,i]),I=E&&1===t.length,T=f&&o?.render?(0,oe.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,oe.jsx)(o.render,{item:i})}):null,O=p&&r?.render?(0,oe.jsx)(r.render,{item:i}):null,A=P?.length>0&&(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[E&&(0,oe.jsx)(cS,{idPrefix:n,primaryAction:E,item:i}),!I&&(0,oe.jsxs)("div",{role:"gridcell",children:[(0,oe.jsxs)(oS,{placement:"bottom-end",children:[(0,oe.jsx)(oS.TriggerButton,{render:(0,oe.jsx)(y.Composite.Item,{id:lS(n),render:(0,oe.jsx)(y.Button,{size:"small",icon:Ga,label:(0,b.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:h})})}),(0,oe.jsx)(oS.Popover,{children:(0,oe.jsx)(Ij,{actions:P,item:i,registry:w,setActiveModalAction:C})})]}),!!S&&(0,oe.jsx)(Pj,{action:S,items:[i],closeModal:()=>C(null)})]})]});return(0,oe.jsx)(y.Composite.Row,{ref:g,render:(0,oe.jsx)("div",{}),role:"row",className:Ut({"is-selected":s,"is-hovered":_}),onMouseEnter:k,onMouseLeave:k,children:(0,oe.jsxs)(y.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,oe.jsx)("div",{role:"gridcell",children:(0,oe.jsx)(y.Composite.Item,{id:aS(n),"aria-pressed":s,"aria-labelledby":v,"aria-describedby":x,className:"dataviews-view-list__item",onClick:()=>c(i)})}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[T,(0,oe.jsxs)(y.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,oe.jsxs)(y.__experimentalHStack,{spacing:0,children:[(0,oe.jsx)("div",{className:"dataviews-title-field",id:v,children:O}),A]}),m&&a?.render&&(0,oe.jsx)("div",{className:"dataviews-view-list__field",children:(0,oe.jsx)(a.render,{item:i})}),(0,oe.jsx)("div",{className:"dataviews-view-list__fields",id:x,children:u.map((e=>(0,oe.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,oe.jsx)(y.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,oe.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,oe.jsx)(e.render,{item:i})})]},e.id)))})]})]})]})})}function dS(e){return!!e}const hS=[{type:oy,label:(0,b.__)("Table"),component:eS,icon:yj,viewConfigOptions:function(){const e=(0,d.useContext)(vy),t=e.view;return(0,oe.jsxs)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,b.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,b._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,b._x)("Balanced","Density option for DataView layout")},"balanced"),(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:"compact",label:(0,b._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:ay,label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:s,isLoading:i,onChangeSelection:r,onClickItem:o,isItemClickable:a,selection:l,view:c}){var u;const h=n.find((e=>e.id===c?.titleField)),p=n.find((e=>e.id===c?.mediaField)),f=n.find((e=>e.id===c?.descriptionField)),m=null!==(u=c.fields)&&void 0!==u?u:[],{regularFields:g,badgeFields:v}=m.reduce(((e,t)=>{const s=n.find((e=>e.id===t));if(!s)return e;return e[c.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(s),e}),{regularFields:[],badgeFields:[]}),x=!!t?.length,w=function(){const e=(0,d.useContext)(vy).view,t=sS();return(0,d.useMemo)((()=>{const n=e.layout?.previewSize;let s;if(!n)return;const i=tS[t];return ni.max&&(s=i.max),s}),[t,e])}(),_=Vj(e,t),j=w||c.layout?.previewSize,S=j?{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`}:{};return(0,oe.jsxs)(oe.Fragment,{children:[x&&(0,oe.jsx)(y.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid",style:S,"aria-busy":i,children:t.map((t=>(0,oe.jsx)(rS,{view:c,selection:l,onChangeSelection:r,onClickItem:o,isItemClickable:a,getItemId:s,item:t,actions:e,mediaField:p,titleField:h,descriptionField:f,regularFields:g,badgeFields:v,hasBulkActions:_},s(t))))}),!x&&(0,oe.jsx)("div",{className:Ut({"dataviews-loading":i,"dataviews-no-results":!i}),children:(0,oe.jsx)("p",{children:i?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})]})},icon:bj,viewConfigOptions:function(){const e=sS(),t=(0,d.useContext)(vy),n=t.view,s=tS[e],i=n.layout?.previewSize||s.default,r=(0,d.useMemo)((()=>Array.from({length:s.max-s.min+1},((e,t)=>({value:s.min+t})))),[s]);return"mobile"===e?null:(0,oe.jsx)(y.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,b.__)("Preview size"),value:s.max+s.min-i,marks:r,min:s.min,max:s.max,withInputField:!1,onChange:(e=0)=>{t.onChangeView({...n,layout:{...n.layout,previewSize:s.max+s.min-e}})},step:1})}},{type:"list",label:(0,b.__)("List"),component:function e(t){var n;const{actions:s,data:i,fields:r,getItemId:o,isLoading:a,onChangeSelection:l,selection:c,view:u}=t,h=(0,v.useInstanceId)(e,"view-list"),p=i?.findLast((e=>c.includes(o(e)))),f=r.find((e=>e.id===u.titleField)),m=r.find((e=>e.id===u.mediaField)),g=r.find((e=>e.id===u.descriptionField)),x=(null!==(n=u?.fields)&&void 0!==n?n:[]).map((e=>r.find((t=>e===t.id)))).filter(dS),w=e=>l([o(e)]),_=(0,d.useCallback)((e=>`${h}-${o(e)}`),[h,o]),j=(0,d.useCallback)(((e,t)=>t.startsWith(_(e))),[_]),[S,C]=(0,d.useState)(void 0);(0,d.useEffect)((()=>{p&&C(aS(_(p)))}),[p,_]);const k=i.findIndex((e=>j(e,null!=S?S:""))),E=(0,v.usePrevious)(k),P=-1!==k,I=(0,d.useCallback)(((e,t)=>{const n=Math.min(i.length-1,Math.max(0,e));if(!i[n])return;const s=t(_(i[n]));C(s),document.getElementById(s)?.focus()}),[i,_]);(0,d.useEffect)((()=>{!P&&(void 0!==E&&-1!==E)&&I(E,aS)}),[P,I,E]);const T=(0,d.useCallback)((e=>{"ArrowDown"===e.key&&(e.preventDefault(),I(k+1,lS)),"ArrowUp"===e.key&&(e.preventDefault(),I(k-1,lS))}),[I,k]),O=i?.length;return O?(0,oe.jsx)(y.Composite,{id:h,render:(0,oe.jsx)("div",{}),className:"dataviews-view-list",role:"grid",activeId:S,setActiveId:C,children:i.map((e=>{const t=_(e);return(0,oe.jsx)(uS,{view:u,idPrefix:t,actions:s,item:e,isSelected:e===p,onSelect:w,mediaField:m,titleField:f,descriptionField:g,otherFields:x,onDropdownTriggerKeyDown:T},t)}))}):(0,oe.jsx)("div",{className:Ut({"dataviews-loading":a,"dataviews-no-results":!O&&!a}),children:!O&&(0,oe.jsx)("p",{children:a?(0,oe.jsx)(y.Spinner,{}):(0,b.__)("No results")})})},icon:(0,b.isRTL)()?wj:_j}];function pS(){const{actions:e=[],data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r,view:o,onChangeView:a,selection:l,onChangeSelection:c,setOpenedFilter:u,onClickItem:h,isItemClickable:p}=(0,d.useContext)(vy),f=hS.find((e=>e.type===o.type))?.component;return(0,oe.jsx)(f,{actions:e,data:t,fields:n,getItemId:s,getItemLevel:i,isLoading:r,onChangeView:a,onChangeSelection:c,selection:l,setOpenedFilter:u,onClickItem:h,isItemClickable:p,view:o})}const fS=(0,d.memo)((function(){var e;const{view:t,onChangeView:n,paginationInfo:{totalItems:s=0,totalPages:i}}=(0,d.useContext)(vy);if(!s||!i)return null;const r=null!==(e=t.page)&&void 0!==e?e:1,o=Array.from(Array(i)).map(((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":r===n?(0,b.sprintf)((0,b.__)("Page %1$s of %2$s"),r,i):n.toString()}}));return!!s&&1!==i&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,oe.jsx)(y.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("
Page
%1$s
of %2$s
","paging"),"",i),{div:(0,oe.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,oe.jsx)(y.SelectControl,{"aria-label":(0,b.__)("Current page"),value:r.toString(),options:o,onChange:e=>{n({...t,page:+e})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,oe.jsx)(y.Button,{onClick:()=>n({...t,page:r-1}),disabled:1===r,accessibleWhenDisabled:!0,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?lu:cu,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,oe.jsx)(y.Button,{onClick:()=>n({...t,page:r+1}),disabled:r>=i,accessibleWhenDisabled:!0,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?cu:lu,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})})),mS=[];function gS(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:s,actions:i=mS}=(0,d.useContext)(vy),r=Vj(i,s)&&[oy,ay].includes(e.type);return!t||!n||n<=1&&!r?null:!!t&&(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[r&&(0,oe.jsx)(Gj,{}),(0,oe.jsx)(fS,{})]})}const vS=(0,d.memo)((function({label:e}){const{view:t,onChangeView:n}=(0,d.useContext)(vy),[s,i,r]=(0,v.useDebouncedInput)(t.search);(0,d.useEffect)((()=>{var e;i(null!==(e=t.search)&&void 0!==e?e:"")}),[t.search,i]);const o=(0,d.useRef)(n),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{o.current=n,a.current=t}),[n,t]),(0,d.useEffect)((()=>{r!==a.current?.search&&o.current({...a.current,page:1,search:r})}),[r]);const l=e||(0,b.__)("Search");return(0,oe.jsx)(y.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:i,value:s,label:l,placeholder:l,size:"compact"})})),xS=vS,yS=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),bS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})}),{Menu:wS}=(window.wp.warning,cj(y.privateApis)),_S={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function jS({defaultLayouts:e={list:{},grid:{},table:{}}}){const{view:t,onChangeView:n}=(0,d.useContext)(vy),s=Object.keys(e);if(s.length<=1)return null;const i=hS.find((e=>t.type===e.type));return(0,oe.jsxs)(wS,{children:[(0,oe.jsx)(wS.TriggerButton,{render:(0,oe.jsx)(y.Button,{size:"compact",icon:i?.icon,label:(0,b.__)("Layout")})}),(0,oe.jsx)(wS.Popover,{children:s.map((s=>{const i=hS.find((e=>e.type===s));return i?(0,oe.jsx)(wS.RadioItem,{value:s,name:"view-actions-available-view",checked:s===t.type,hideOnClick:!0,onChange:s=>{switch(s.target.value){case"list":case"grid":case"table":const i={...t};return"layout"in i&&delete i.layout,n({...i,type:s.target.value,...e[s.target.value]})}},children:(0,oe.jsx)(wS.ItemLabel,{children:i.label})},s):null}))})]})}function SS(){const{view:e,fields:t,onChangeView:n}=(0,d.useContext)(vy),s=(0,d.useMemo)((()=>t.filter((e=>!1!==e.enableSorting)).map((e=>({label:e.label,value:e.id})))),[t]);return(0,oe.jsx)(y.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Sort by"),value:e.sort?.field,options:s,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function CS(){const{view:e,fields:t,onChangeView:n}=(0,d.useContext)(vy);if(0===t.filter((e=>!1!==e.enableSorting)).length)return null;let s=e.sort?.direction;return!s&&e.sort?.field&&(s="desc"),(0,oe.jsx)(y.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Order"),value:s,onChange:s=>{"asc"!==s&&"desc"!==s||n({...e,sort:{direction:s,field:e.sort?.field||t.find((e=>!1!==e.enableSorting))?.id||""},showLevels:!1})},children:ty.map((e=>(0,oe.jsx)(y.__experimentalToggleGroupControlOptionIcon,{value:e,icon:ry[e],label:iy[e]},e)))})}const kS=[10,20,50,100];function ES(){const{view:e,onChangeView:t}=(0,d.useContext)(vy);return(0,oe.jsx)(y.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:n=>{const s="number"==typeof n||void 0===n?n:parseInt(n,10);t({...e,perPage:s,page:1})},children:kS.map((e=>(0,oe.jsx)(y.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e)))})}function PS({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:s}){return(0,oe.jsxs)(wS,{onOpenChange:n,children:[(0,oe.jsx)(wS.TriggerButton,{render:(0,oe.jsx)(y.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Ga,label:(0,b.__)("Preview")})}),(0,oe.jsx)(wS.Popover,{children:e?.map((({id:e,label:n})=>(0,oe.jsx)(wS.RadioItem,{value:e,checked:e===s,onChange:()=>{t?.(e),(e=>{setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()}),50)})(e)},children:(0,oe.jsx)(wS.ItemLabel,{children:n})},e)))})]})}function IS({field:e,label:t,description:n,isVisible:s,isFirst:i,isLast:r,canMove:o=!0,onToggleVisibility:a,onMoveUp:l,onMoveDown:c,previewOptions:u,onChangePreviewOption:h}){const[p,f]=(0,d.useState)(!1);return(0,oe.jsx)(y.__experimentalItem,{children:(0,oe.jsxs)(y.__experimentalHStack,{expanded:!0,className:Ut("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":p}),justify:"flex-start",children:[(0,oe.jsx)("span",{className:"dataviews-field-control__icon",children:!o&&!e.enableHiding&&(0,oe.jsx)(y.Icon,{icon:yS})}),(0,oe.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,oe.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,oe.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[s&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{disabled:i||!o,accessibleWhenDisabled:!0,size:"compact",onClick:l,icon:Gv,label:i||!o?(0,b.__)("This field can't be moved up"):(0,b.sprintf)((0,b.__)("Move %s up"),e.label)}),(0,oe.jsx)(y.Button,{disabled:r||!o,accessibleWhenDisabled:!0,size:"compact",onClick:c,icon:Hv,label:r||!o?(0,b.__)("This field can't be moved down"):(0,b.sprintf)((0,b.__)("Move %s down"),e.label)})]}),a&&(0,oe.jsx)(y.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{a(),setTimeout((()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()}),50)},icon:s?Wj:za,label:s?(0,b.sprintf)((0,b._x)("Hide %s","field"),e.label):(0,b.sprintf)((0,b._x)("Show %s","field"),e.label)}),u&&(0,oe.jsx)(PS,{previewOptions:u,onChangePreviewOption:h,onMenuOpenChange:f,activeOption:e.id})]})]})})}function TS({index:e,field:t,view:n,onChangeView:s}){var i;const r=null!==(i=n.fields)&&void 0!==i?i:[],o=void 0!==e&&r.includes(t.id);return(0,oe.jsx)(IS,{field:t,isVisible:o,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===r.length-1,onToggleVisibility:()=>{s({...n,fields:o?r.filter((e=>e!==t.id)):[...r,t.id]})},onMoveUp:void 0!==e?()=>{var i;s({...n,fields:[...null!==(i=r.slice(0,e-1))&&void 0!==i?i:[],t.id,r[e-1],...r.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{var i;s({...n,fields:[...null!==(i=r.slice(0,e))&&void 0!==i?i:[],r[e+1],t.id,...r.slice(e+2)]})}:void 0})}function OS(e){return!!e}function AS(){var e;const{view:t,fields:n,onChangeView:s}=(0,d.useContext)(vy),i=[t?.titleField,t?.mediaField,t?.descriptionField].filter(Boolean),r=null!==(e=t.fields)&&void 0!==e?e:[],o=n.filter((e=>!r.includes(e.id)&&!i.includes(e.id)&&"media"!==e.type)),a=r.map((e=>n.find((t=>t.id===e)))).filter(OS);if(!a?.length&&!o?.length)return null;const l=n.find((e=>e.id===t.titleField)),c=n.find((e=>e.id===t.mediaField)),u=n.find((e=>e.id===t.descriptionField)),h=n.filter((e=>"media"===e.type));let p;if(h.length>1){var f;const e=OS(c)&&(null===(f=t.showMedia)||void 0===f||f);p=OS(c)&&(0,oe.jsx)(IS,{field:c,label:(0,b.__)("Preview"),description:c.label,isVisible:e,onToggleVisibility:()=>{s({...t,showMedia:!e})},canMove:!1,previewOptions:h.map((e=>({label:e.label,id:e.id}))),onChangePreviewOption:e=>s({...t,mediaField:e})},c.id)}const m=[{field:l,isVisibleFlag:"showTitle"},{field:c,isVisibleFlag:"showMedia",ui:p},{field:u,isVisibleFlag:"showDescription"}].filter((({field:e})=>OS(e))),g=m.filter((({field:e,isVisibleFlag:n})=>{var s;return OS(e)&&(null===(s=t[n])||void 0===s||s)})),v=m.filter((({field:e,isVisibleFlag:n})=>{var s;return OS(e)&&!(null===(s=t[n])||void 0===s||s)}));return(0,oe.jsxs)(y.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(g.length>0||!!a?.length)&&(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[g.map((({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,oe.jsx)(IS,{field:e,isVisible:!0,onToggleVisibility:()=>{s({...t,[n]:!1})},canMove:!1},e.id))),a.map(((e,n)=>(0,oe.jsx)(TS,{field:e,view:t,onChangeView:s,index:n},e.id)))]})}),(!!o?.length||!!v.length)&&(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.BaseControl.VisualLabel,{style:{margin:0},children:(0,b.__)("Hidden")}),(0,oe.jsx)(y.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,oe.jsxs)(y.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[v.length>0&&v.map((({field:e,isVisibleFlag:n,ui:i})=>null!=i?i:(0,oe.jsx)(IS,{field:e,isVisible:!1,onToggleVisibility:()=>{s({...t,[n]:!0})},canMove:!1},e.id))),o.map((e=>(0,oe.jsx)(TS,{field:e,view:t,onChangeView:s},e.id)))]})})]})]})}function NS({title:e,description:t,children:n}){return(0,oe.jsxs)(y.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,oe.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,oe.jsx)(y.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,oe.jsx)(y.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function MS(){const{view:e}=(0,d.useContext)(vy),t=(0,v.useInstanceId)(VS,"dataviews-view-config-dropdown"),n=hS.find((t=>t.type===e.type));return(0,oe.jsx)(y.Dropdown,{expandOnMobile:!0,popoverProps:{..._S,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,oe.jsx)(y.Button,{size:"compact",icon:bS,label:(0,b._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,oe.jsx)(y.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,oe.jsxs)(y.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,oe.jsxs)(NS,{title:(0,b.__)("Appearance"),children:[(0,oe.jsxs)(y.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,oe.jsx)(SS,{}),(0,oe.jsx)(CS,{})]}),!!n?.viewConfigOptions&&(0,oe.jsx)(n.viewConfigOptions,{}),(0,oe.jsx)(ES,{})]}),(0,oe.jsx)(NS,{title:(0,b.__)("Properties"),children:(0,oe.jsx)(AS,{})})]})})})}function VS({defaultLayouts:e={list:{},grid:{},table:{}}}){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(jS,{defaultLayouts:e}),(0,oe.jsx)(MS,{})]})}const FS=(0,d.memo)(VS),RS=e=>e.id,BS=()=>!0,DS=[];function LS({view:e,onChangeView:t,fields:n,search:s=!0,searchLabel:i,actions:r=DS,data:o,getItemId:a=RS,getItemLevel:l,isLoading:c=!1,paginationInfo:u,defaultLayouts:h,selection:p,onChangeSelection:f,onClickItem:m,isItemClickable:g=BS,header:x}){const[b,w]=(0,d.useState)(0),_=(0,v.useResizeObserver)((e=>{w(e[0].borderBoxSize[0].inlineSize)}),{box:"border-box"}),[j,S]=(0,d.useState)([]),C=void 0===p||void 0===f,k=C?j:p,[E,P]=(0,d.useState)(null);const I=(0,d.useMemo)((()=>py(n)),[n]),T=(0,d.useMemo)((()=>k.filter((e=>o.some((t=>a(t)===e))))),[k,o,a]),O=mj(I,e),[A,N]=(0,d.useState)((()=>(O||[]).some((e=>e.isPrimary))));return(0,oe.jsx)(vy.Provider,{value:{view:e,onChangeView:t,fields:I,actions:r,data:o,isLoading:c,paginationInfo:u,selection:T,onChangeSelection:function(e){const t="function"==typeof e?e(k):e;C&&S(t),f&&f(t)},openedFilter:E,setOpenedFilter:P,getItemId:a,getItemLevel:l,isItemClickable:g,onClickItem:m,containerWidth:b},children:(0,oe.jsxs)("div",{className:"dataviews-wrapper",ref:_,children:[(0,oe.jsxs)(y.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[s&&(0,oe.jsx)(xS,{label:i}),(0,oe.jsx)(gj,{filters:O,view:e,onChangeView:t,setOpenedFilter:P,setIsShowingFilter:N,isShowingFilter:A})]}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,oe.jsx)(FS,{defaultLayouts:h}),x]})]}),A&&(0,oe.jsx)(xj,{}),(0,oe.jsx)(pS,{}),(0,oe.jsx)(gS,{})]})})}function zS(){var e;const t=(0,l.useSelect)((e=>{const{getSettings:t}=te(e(zt));return t()}),[]),n=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,s=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()),[]),i=(0,d.useMemo)((()=>[...n||[],...s||[]].filter(wx)),[n,s]);return(0,d.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...n}=t;return{...n,__experimentalBlockPatterns:i,isPreviewMode:!0}}),[t,i])}const GS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),HS=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),{useHistory:US,useLocation:WS}=te(Gt.privateApis),{CreatePatternModal:qS,useAddPatternCategory:ZS}=te(_e.privateApis),{CreateTemplatePartModal:KS}=te(h.privateApis);function YS(){const e=US(),t=WS(),[n,s]=(0,d.useState)(!1),[i,r]=(0,d.useState)(!1),{createPatternFromFile:o}=te((0,l.useDispatch)(_e.store)),{createSuccessNotice:a,createErrorNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useRef)(),{isBlockBasedTheme:h,addNewPatternLabel:p,addNewTemplatePartLabel:f,canCreatePattern:m,canCreateTemplatePart:g}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getPostType:n,canUser:s}=e(_.store);return{isBlockBasedTheme:t()?.is_block_theme,addNewPatternLabel:n(Ie.user)?.labels?.add_new_item,addNewTemplatePartLabel:n(Ce)?.labels?.add_new_item,canCreatePattern:s("create",{kind:"postType",name:Ie.user}),canCreateTemplatePart:s("create",{kind:"postType",name:Ce})}}),[]);function v(){s(!1),r(!1)}const x=[];m&&x.push({icon:Ko,onClick:()=>s(!0),title:p}),h&&g&&x.push({icon:GS,onClick:()=>r(!0),title:f}),m&&x.push({icon:HS,onClick:()=>{u.current.click()},title:(0,b.__)("Import pattern from JSON")});const{categoryMap:j,findOrCreateTerm:S}=ZS();return 0===x.length?null:(0,oe.jsxs)(oe.Fragment,{children:[p&&(0,oe.jsx)(y.DropdownMenu,{controls:x,icon:null,toggleProps:{variant:"primary",showTooltip:!1,__next40pxDefaultSize:!0},text:p,label:p}),n&&(0,oe.jsx)(qS,{onClose:()=>s(!1),onSuccess:function({pattern:t}){s(!1),e.navigate(`/${Ie.user}/${t.id}?canvas=edit`)},onError:v}),i&&(0,oe.jsx)(KS,{closeModal:()=>r(!1),blocks:[],onCreate:function(t){r(!1),e.navigate(`/${Ce}/${t.id}?canvas=edit`)},onError:v}),(0,oe.jsx)("input",{type:"file",accept:".json",hidden:!0,ref:u,onChange:async n=>{const s=n.target.files?.[0];if(s)try{let n;if(t.query.postType!==Ce){const e=Array.from(j.values()).find((e=>e.name===t.query.categoryId));e&&(n=e.id||await S(e.label))}const i=await o(s,n?[n]:void 0);n||"my-patterns"===t.query.categoryId||e.navigate(`/pattern?categoryId=${Te}`),a((0,b.sprintf)((0,b.__)('Imported "%s" from JSON.'),i.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){c(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{n.target.value=""}}})]})}const{RenamePatternCategoryModal:XS}=te(_e.privateApis);function JS({category:e,onClose:t}){const[n,s]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>s(!0),children:(0,b.__)("Rename")}),n&&(0,oe.jsx)(QS,{category:e,onClose:()=>{s(!1),t()}})]})}function QS({category:e,onClose:t}){const n={id:e.id,slug:e.slug,name:e.label},s=Bx();return(0,oe.jsx)(XS,{category:n,existingCategories:s,onClose:t,overlayClassName:"edit-site-list__rename-modal",focusOnMount:"firstContentElement",size:"small"})}const{useHistory:$S}=te(Gt.privateApis);function eC({category:e,onClose:t}){const[n,s]=(0,d.useState)(!1),i=$S(),{createSuccessNotice:r,createErrorNotice:o}=(0,l.useDispatch)(w.store),{deleteEntityRecord:a,invalidateResolution:c}=(0,l.useDispatch)(_.store);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.MenuItem,{isDestructive:!0,onClick:()=>s(!0),children:(0,b.__)("Delete")}),(0,oe.jsx)(y.__experimentalConfirmDialog,{isOpen:n,onConfirm:async()=>{try{await a("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",Ie.user,{per_page:-1}]),r((0,b.sprintf)((0,b._x)('"%s" deleted.',"pattern category"),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),i.navigate(`/pattern?categoryId=${Te}`)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern category.");o(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>s(!1),confirmButtonText:(0,b.__)("Delete"),className:"edit-site-patterns__delete-modal",title:(0,b.sprintf)((0,b._x)('Delete "%s"?',"pattern category"),(0,Kt.decodeEntities)(e.label)),size:"medium",__experimentalHideHeader:!1,children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,Kt.decodeEntities)(e.label))})]})}function tC({categoryId:e,type:t,titleId:n,descriptionId:s}){const{patternCategories:i}=Bx(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_part_areas||[]),[]);let o,a,c;if(t===Ce){const t=r.find((t=>t.area===e));o=t?.label||(0,b.__)("All Template Parts"),a=t?.description||(0,b.__)("Includes every template part defined for any area.")}else t===Ie.user&&e&&(c=i.find((t=>t.name===e)),o=c?.label,a=c?.description);return o?(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-patterns__section-header",spacing:1,children:[(0,oe.jsxs)(y.__experimentalHStack,{justify:"space-between",className:"edit-site-patterns__title",children:[(0,oe.jsx)(y.__experimentalHeading,{as:"h2",level:3,id:n,weight:500,truncate:!0,children:o}),(0,oe.jsxs)(y.__experimentalHStack,{expanded:!1,children:[(0,oe.jsx)(YS,{}),!!c?.id&&(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",description:(0,b.sprintf)((0,b.__)("Action menu for %s pattern category"),o),size:"compact"},children:({onClose:e})=>(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(JS,{category:c,onClose:e}),(0,oe.jsx)(eC,{category:c,onClose:e})]})})]})]}),a?(0,oe.jsx)(y.__experimentalText,{variant:"muted",as:"p",id:s,className:"edit-site-patterns__sub-title",children:a}):null]}):null}const nC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),{useHistory:sC}=te(Gt.privateApis),iC=()=>{const e=sC();return(0,d.useMemo)((()=>({id:"edit-post",label:(0,b.__)("Edit"),isPrimary:!0,icon:nC,isEligible:e=>"trash"!==e.status&&e.type!==Ie.theme,callback(t){const n=t[0];e.navigate(`/${n.type}/${n.id}?canvas=edit`)}})),[e])},rC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),oC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),aC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})});function lC(e,t){return(0,l.useSelect)((n=>{const{getEntityRecord:s,getMedia:i,getUser:r,getEditedEntityRecord:o}=n(_.store),a=o("postType",e,t),l=a?.original_source,c=a?.author_text;switch(l){case"theme":return{type:l,icon:Zo,text:c,isCustomized:a.source===ke};case"plugin":return{type:l,icon:rC,text:c,isCustomized:a.source===ke};case"site":{const e=s("root","__unstableBase");return{type:l,icon:oC,imageUrl:e?.site_logo?i(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=r(a.author);return{type:"user",icon:aC,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}const{useGlobalStyle:cC}=te(x.privateApis);const uC={label:(0,b.__)("Preview"),id:"preview",render:function({item:e}){const t=(0,d.useId)(),n=e.description||e?.excerpt?.raw,s=e.type===Ce,[i]=cC("color.background"),r=(0,d.useMemo)((()=>{var t;return null!==(t=e.blocks)&&void 0!==t?t:(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0})}),[e?.content?.raw,e.blocks]),a=!r?.length;return(0,oe.jsxs)("div",{className:"page-patterns-preview-field",style:{backgroundColor:i},"aria-describedby":n?t:void 0,children:[a&&s&&(0,b.__)("Empty template part"),a&&!s&&(0,b.__)("Empty pattern"),!a&&(0,oe.jsx)(x.BlockPreview.Async,{children:(0,oe.jsx)(x.BlockPreview,{blocks:r,viewportWidth:e.viewportWidth})}),!!n&&(0,oe.jsx)("div",{hidden:!0,id:t,children:n})]})},enableSorting:!1},dC=[{value:Ne.full,label:(0,b._x)("Synced","pattern (singular)"),description:(0,b.__)("Patterns that are kept in sync across the site.")},{value:Ne.unsynced,label:(0,b._x)("Not synced","pattern (singular)"),description:(0,b.__)("Patterns that can be changed freely without affecting the site.")}],hC={label:(0,b.__)("Sync status"),id:"sync-status",render:({item:e})=>{const t="wp_pattern_sync_status"in e?e.wp_pattern_sync_status||Ne.full:Ne.unsynced;return(0,oe.jsx)("span",{className:`edit-site-patterns__field-sync-status-${t}`,children:dC.find((({value:e})=>e===t)).label})},elements:dC,filterBy:{operators:["is"],isPrimary:!0},enableSorting:!1};const pC={label:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,d.useState)(!1),{text:s,icon:i,imageUrl:r}=lC(e.type,e.id);return(0,oe.jsxs)(y.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,oe.jsx)("div",{className:Ut("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,oe.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,oe.jsx)("div",{className:"page-templates-author-field__icon",children:(0,oe.jsx)(ta,{icon:i})}),(0,oe.jsx)("span",{className:"page-templates-author-field__name",children:s})]})},filterBy:{isPrimary:!0}},{ExperimentalBlockEditorProvider:fC}=te(x.privateApis),{usePostActions:mC,patternTitleField:gC}=te(h.privateApis),{useLocation:vC,useHistory:xC}=te(Gt.privateApis),yC=[],bC={[Re]:{layout:{styles:{author:{width:"1%"}}}},[Fe]:{layout:{badgeFields:["sync-status"]}}},wC={type:Fe,search:"",page:1,perPage:20,titleField:"title",mediaField:"preview",fields:["sync-status"],filters:[],...bC[Fe]};function _C(){const{query:{postType:e="wp_block",categoryId:t}}=vC(),n=xC(),s=t||Te,[i,r]=(0,d.useState)(wC),o=(0,v.usePrevious)(s),a=(0,v.usePrevious)(e),c=i.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:u,isResolving:h}=Rx(e,s,{search:i.search,syncStatus:c}),{records:p}=(0,_.useEntityRecords)("postType",Ce,{per_page:-1}),f=(0,d.useMemo)((()=>{if(!p)return yC;const e=new Set;return p.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[p]),m=(0,d.useMemo)((()=>{const t=[uC,gC];return e===Ie.user?t.push(hC):e===Ce&&t.push({...pC,elements:f}),t}),[e,f]);(0,d.useEffect)((()=>{o===s&&a===e||r((e=>({...e,page:1})))}),[s,o,a,e]);const{data:g,paginationInfo:x}=(0,d.useMemo)((()=>{const t={...i};return delete t.search,e!==Ce&&(t.filters=[]),gy(u,t,m)}),[u,i,m,e]),y=function(e){const t=(0,d.useMemo)((()=>{var t;return null!==(t=e?.filter((e=>e.type!==Ie.theme)).map((e=>[e.type,e.id])))&&void 0!==t?t:[]}),[e]),n=(0,l.useSelect)((e=>{const{getEntityRecordPermissions:n}=te(e(_.store));return t.reduce(((e,[t,s])=>(e[s]=n("postType",t,s),e)),{})}),[t]);return(0,d.useMemo)((()=>{var t;return null!==(t=e?.map((e=>{var t;return{...e,permissions:null!==(t=n?.[e.id])&&void 0!==t?t:{}}})))&&void 0!==t?t:[]}),[e,n])}(g),w=mC({postType:Ce,context:"list"}),j=mC({postType:Ie.user,context:"list"}),S=iC(),C=(0,d.useMemo)((()=>e===Ce?[S,...w].filter(Boolean):[S,...j].filter(Boolean)),[S,e,w,j]),k=(0,d.useId)(),E=zS();return(0,oe.jsx)(fC,{settings:E,children:(0,oe.jsxs)(eg,{title:(0,b.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0,children:[(0,oe.jsx)(tC,{categoryId:s,type:e,titleId:`${k}-title`,descriptionId:`${k}-description`}),(0,oe.jsx)(LS,{paginationInfo:x,fields:m,actions:C,data:y||yC,getItemId:e=>{var t;return null!==(t=e.name)&&void 0!==t?t:e.id},isLoading:h,isItemClickable:e=>e.type!==Ie.theme,onClickItem:e=>{n.navigate(`/${e.type}/${[Ie.user,Ce].includes(e.type)?e.id:e.name}?canvas=edit`)},view:i,onChangeView:r,defaultLayouts:bC},s+e)]})})}const jC={name:"patterns",path:"/pattern",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||Ov(e)?"/":void 0;return(0,oe.jsx)(Gx,{backPath:n})},content:(0,oe.jsx)(_C,{}),mobile({siteData:e,query:t}){const{categoryId:n}=t,s=e.currentTheme?.is_block_theme,i=s||Ov(e)?"/":void 0;return n?(0,oe.jsx)(_C,{}):(0,oe.jsx)(Gx,{backPath:i})}}},SC={name:"pattern-item",path:"/wp_block/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme,n=t||Ov(e)?"/":void 0;return(0,oe.jsx)(Gx,{backPath:n})},mobile:(0,oe.jsx)(Tv,{}),preview:(0,oe.jsx)(Tv,{})}},CC={name:"template-part-item",path:"/wp_template_part/*postId",areas:{sidebar:(0,oe.jsx)(Gx,{backPath:"/"}),mobile:(0,oe.jsx)(Tv,{}),preview:(0,oe.jsx)(Tv,{})}},{useLocation:kC}=te(Gt.privateApis),EC=[];function PC({template:e,isActive:t}){const{text:n,icon:s}=lC(e.type,e.id);return(0,oe.jsx)(oa,{to:(0,Qt.addQueryArgs)("/template",{activeView:n}),icon:s,"aria-current":t,children:n})}function IC(){const{query:{activeView:e="all"}}=kC(),{records:t}=(0,_.useEntityRecords)("postType",Se,{per_page:-1}),n=(0,d.useMemo)((()=>{var e;const n=t?.reduce(((e,t)=>{const n=t.author_text;return n&&!e[n]&&(e[n]=t),e}),{});return null!==(e=n&&Object.values(n))&&void 0!==e?e:EC}),[t]);return(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-templates-browse",children:[(0,oe.jsx)(oa,{to:"/template",icon:Zo,"aria-current":"all"===e,children:(0,b.__)("All templates")}),n.map((t=>(0,oe.jsx)(PC,{template:t,isActive:e===t.author_text},t.author_text)))]})}function TC({backPath:e}){return(0,oe.jsx)(ea,{title:(0,b.__)("Templates"),description:(0,b.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),backPath:e,content:(0,oe.jsx)(IC,{})})}const OC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),AC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),NC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),MC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),VC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),FC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),RC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),BC=(0,oe.jsx)(Yt.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,oe.jsx)(Yt.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"})}),DC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),LC=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,oe.jsx)(Yt.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"})]}),zC=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),GC={},HC=(e,t)=>{let n=e;return t.split(".").forEach((e=>{n=n?.[e]})),n},UC=()=>(0,l.useSelect)((e=>e(_.store).getEntityRecords("postType",Se,{per_page:-1})),[]),WC=()=>(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.default_template_types||[]),[]),qC=()=>{const e=(0,l.useSelect)((e=>e(_.store).getPostTypes({per_page:-1})),[]);return(0,d.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n)))}),[e])};function ZC(){const e=qC(),t=(0,d.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=UC(),s=(0,d.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[e]),i=(0,d.useCallback)((({labels:e,slug:t})=>{const n=e.singular_name.toLowerCase();return s[n]>1&&n!==t}),[s]);return(0,d.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=i(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:"string"==typeof e.icon&&e.icon.startsWith("dashicons-")?e.icon.slice(10):MC,templatePrefix:"archive"}}))||[]),[t,n,i])}const KC=e=>{const t=(()=>{const e=(0,l.useSelect)((e=>e(_.store).getTaxonomies({per_page:-1})),[]);return(0,d.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=UC(),s=WC(),i=(0,d.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]),r=t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),o=QC("taxonomy",i),a=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=i[l],d=s?.find((({slug:e})=>e===u)),h=a?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=(e.template_name||e.singular_name).toLowerCase();return r[n]>1&&n!==t})(c,l);let f=c.template_name||c.singular_name;p&&(f=c.template_name?(0,b.sprintf)((0,b._x)("%1$s (%2$s)","taxonomy template menu label"),c.template_name,l):(0,b.sprintf)((0,b._x)("%1$s (%2$s)","taxonomy menu label"),c.singular_name,l));const m=d?{...d,templatePrefix:i[l]}:{slug:u,title:f,description:(0,b.sprintf)((0,b.__)("Displays taxonomy: %s."),c.singular_name),icon:RC,templatePrefix:i[l]},g=o?.[l]?.hasEntities;return g&&(m.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:o[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${i[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:i[l]}}},labels:c,hasGeneralTemplate:h,template:t})}),h&&!g||t.push(m),t}),[]);return(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let s="taxonomiesMenuItems";return["category","tag"].includes(n)&&(s="defaultTaxonomiesMenuItems"),e[s].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[c])},YC={user:"author"},XC={user:{who:"authors"}};const JC=(e,t,n={})=>{const s=(e=>{const t=UC();return(0,d.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,s])=>{const i=(t||[]).reduce(((e,t)=>{const n=`${s}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return i.length&&(e[n]=i),e}),{})),[e,t])})(t);return(0,l.useSelect)((t=>Object.entries(s||{}).reduce(((s,[i,r])=>{const o=t(_.store).getEntityRecords(e,i,{_fields:"id",context:"view",slug:r,...n[i]});return o?.length&&(s[i]=o),s}),{})),[s])},QC=(e,t,n=GC)=>{const s=JC(e,t,n),i=(0,l.useSelect)((i=>Object.keys(t||{}).reduce(((t,r)=>{const o=s?.[r]?.map((({id:e})=>e))||[];return t[r]=!!i(_.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:o,...n[r]})?.length,t}),{})),[t,s,e,n]);return(0,d.useMemo)((()=>Object.keys(t||{}).reduce(((e,t)=>{const n=s?.[t]?.map((({id:e})=>e))||[];return e[t]={hasEntities:i[t],existingEntitiesIds:n},e}),{})),[t,s,i])},$C=[];function ek({suggestion:e,search:t,onSelect:n,entityForSuggestions:s}){const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,oe.jsxs)(y.Composite.Item,{render:(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,role:"option",className:i,onClick:()=>n(s.config.getSpecificTemplate(e))}),children:[(0,oe.jsx)(y.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${i}__title`,children:(0,oe.jsx)(y.TextHighlight,{text:(0,Kt.decodeEntities)(e.name),highlight:t})}),e.link&&(0,oe.jsx)(y.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${i}__info`,children:e.link})]})}function tk(e,t){const{config:n}=e,s=(0,d.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:i,hasResolved:r}=(0,_.useEntityRecords)(e.type,e.slug,s),[o,a]=(0,d.useState)($C);return(0,d.useEffect)((()=>{if(!r)return;let e=$C;var t,s;i?.length&&(e=i,n.recordNamePath&&(t=e,s=n.recordNamePath,e=(t||[]).map((e=>({...e,name:(0,Kt.decodeEntities)(HC(e,s))}))))),a(e)}),[i,r]),o}function nk({entityForSuggestions:e,onSelect:t}){const[n,s,i]=(0,v.useDebouncedInput)(),r=tk(e,i),{labels:o}=e,[a,l]=(0,d.useState)(!1);return!a&&r?.length>9&&l(!0),(0,oe.jsxs)(oe.Fragment,{children:[a&&(0,oe.jsx)(y.SearchControl,{__nextHasNoMarginBottom:!0,onChange:s,value:n,label:o.search_items,placeholder:o.search_items}),!!r?.length&&(0,oe.jsx)(y.Composite,{orientation:"vertical",role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,b.__)("Suggestions list"),children:r.map((n=>(0,oe.jsx)(ek,{suggestion:n,search:i,onSelect:t,entityForSuggestions:e},n.slug)))}),i&&!r?.length&&(0,oe.jsx)(y.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results",children:o.not_found})]})}const sk=function({onSelect:e,entityForSuggestions:t}){const[n,s]=(0,d.useState)(t.hasGeneralTemplate);return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left",children:[!n&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("Select whether to create a single template for all items or a specific one.")}),(0,oe.jsxs)(y.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial",children:[(0,oe.jsxs)(y.FlexItem,{isBlock:!0,as:y.Button,onClick:()=>{const{slug:n,title:s,description:i,templatePrefix:r}=t.template;e({slug:n,title:s,description:i,templatePrefix:r})},children:[(0,oe.jsx)(y.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.all_items}),(0,oe.jsx)(y.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For all items")})]}),(0,oe.jsxs)(y.FlexItem,{isBlock:!0,as:y.Button,onClick:()=>{s(!0)},children:[(0,oe.jsx)(y.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.singular_name}),(0,oe.jsx)(y.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For a specific item")})]})]})]}),n&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalText,{as:"p",children:(0,b.__)("This template will be used only for the specific item chosen.")}),(0,oe.jsx)(nk,{entityForSuggestions:t,onSelect:e})]})]})};var ik=function(){return ik=Object.assign||function(e){for(var t,n=1,s=arguments.length;n{e()},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,b.__)("Create")})]})]})})},{useHistory:dk}=te(Gt.privateApis),hk=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],pk={"front-page":OC,home:AC,single:NC,page:qo,archive:MC,search:Xt,404:VC,index:FC,category:bj,author:aC,taxonomy:RC,date:BC,tag:DC,attachment:LC};function fk({title:e,direction:t,className:n,description:s,icon:i,onClick:r,children:o}){return(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,className:n,onClick:r,label:s,showTooltip:!!s,children:(0,oe.jsxs)(y.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t,children:[(0,oe.jsx)("div",{className:"edit-site-add-new-template__template-icon",children:(0,oe.jsx)(y.Icon,{icon:i})}),(0,oe.jsxs)(y.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0,children:[(0,oe.jsx)(y.__experimentalText,{align:"center",weight:500,lineHeight:1.53846153846,children:e}),o]})]})})}const mk=1,gk=2,vk=3;function xk({onClose:e}){const[t,n]=(0,d.useState)(mk),[s,i]=(0,d.useState)({}),[r,o]=(0,d.useState)(!1),a=function(e,t){const n=UC(),s=WC(),i=(n||[]).map((({slug:e})=>e)),r=(s||[]).filter((e=>hk.includes(e.slug)&&!i.includes(e.slug))),o=n=>{t?.(),e(n)},a=[...r],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=KC(o),{defaultPostTypesMenuItems:u,postTypesMenuItems:h}=(e=>{const t=qC(),n=UC(),s=WC(),i=(0,d.useMemo)((()=>t?.reduce(((e,{labels:t})=>{const n=(t.template_name||t.singular_name).toLowerCase();return e[n]=(e[n]||0)+1,e}),{})),[t]),r=(0,d.useCallback)((({labels:e,slug:t})=>{const n=(e.template_name||e.singular_name).toLowerCase();return i[n]>1&&n!==t}),[i]),o=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),a=QC("postType",o),l=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:i,labels:c,icon:u}=n,d=o[i],h=s?.find((({slug:e})=>e===d)),p=l?.includes(d),f=r(n);let m=c.template_name||(0,b.sprintf)((0,b.__)("Single item: %s"),c.singular_name);f&&(m=c.template_name?(0,b.sprintf)((0,b._x)("%1$s (%2$s)","post type menu label"),c.template_name,i):(0,b.sprintf)((0,b._x)("Single item: %1$s (%2$s)","post type menu label"),c.singular_name,i));const g=h?{...h,templatePrefix:o[i]}:{slug:d,title:m,description:(0,b.sprintf)((0,b.__)("Displays a single item: %s."),c.singular_name),icon:"string"==typeof u&&u.startsWith("dashicons-")?u.slice(10):zC,templatePrefix:o[i]},v=a?.[i]?.hasEntities;return v&&(g.onClick=t=>{e({type:"postType",slug:i,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:a[i].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${o[i]}-${e.slug}`;return{title:t,slug:t,templatePrefix:o[i]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!v||t.push(g),t}),[]),u=(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let s="postTypesMenuItems";return"page"===n&&(s="defaultPostTypesMenuItems"),e[s].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u})(o),p=function(e){const t=UC(),n=WC(),s=QC("root",YC,XC);let i=n?.find((({slug:e})=>"author"===e));i||(i={description:(0,b.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const r=!!t?.find((({slug:e})=>"author"===e));if(s.user?.hasEntities&&(i={...i,templatePrefix:"author"},i.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:s.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:r,template:t})}),!r||s.user?.hasEntities)return i}(o);[...l,...u,p].forEach((e=>{if(!e)return;const t=a.findIndex((t=>t.slug===e.slug));t>-1?a[t]=e:a.push(e)})),a?.sort(((e,t)=>hk.indexOf(e.slug)-hk.indexOf(t.slug)));const f=[...a,...ZC(),...h,...c];return f}(i,(()=>n(gk))),c=dk(),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),f=(0,v.useViewportMatch)("medium","<"),m=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","__unstableBase")?.home),[]),g={"front-page":m,date:(0,b.sprintf)((0,b.__)("E.g. %s"),m+"/"+(new Date).getFullYear())};async function x(e,t=!0){if(!r){o(!0);try{const{title:n,description:s,slug:i}=e,r=await u("postType",Se,{description:s,slug:i.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});c.navigate(`/${Se}/${r.id}?canvas=edit`),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(r.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.");h(t,{type:"snackbar"})}finally{o(!1)}}}const j=()=>{e(),n(mk)};let S=(0,b.__)("Add template");return t===gk?S=(0,b.sprintf)((0,b.__)("Add template: %s"),s.labels.singular_name):t===vk&&(S=(0,b.__)("Create custom template")),(0,oe.jsxs)(y.Modal,{title:S,className:Ut("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":t===mk,"edit-site-custom-template-modal":t===gk}),onRequestClose:j,overlayClassName:t===vk?"edit-site-custom-generic-template__modal":void 0,children:[t===mk&&(0,oe.jsxs)(y.__experimentalGrid,{columns:f?2:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents",children:[(0,oe.jsx)(y.Flex,{className:"edit-site-add-new-template__template-list__prompt",children:(0,b.__)("Select what the new template should apply to:")}),a.map((e=>{const{title:t,slug:n,onClick:s}=e;return(0,oe.jsx)(fk,{title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:g[n],icon:pk[n]||Zo,onClick:()=>s?s(e):x(e)},n)})),(0,oe.jsx)(fk,{title:(0,b.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:nC,onClick:()=>n(vk),children:(0,oe.jsx)(y.__experimentalText,{lineHeight:1.53846153846,children:(0,b.__)("A custom template can be manually applied to any post or page.")})})]}),t===gk&&(0,oe.jsx)(sk,{onSelect:x,entityForSuggestions:s}),t===vk&&(0,oe.jsx)(uk,{onClose:j,createTemplate:x})]})}const yk=(0,d.memo)((function(){const[e,t]=(0,d.useState)(!1),{postType:n}=(0,l.useSelect)((e=>{const{getPostType:t}=e(_.store);return{postType:t(Se)}}),[]);return n?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{variant:"primary",onClick:()=>t(!0),label:n.labels.add_new_item,__next40pxDefaultSize:!0,children:n.labels.add_new_item}),e&&(0,oe.jsx)(xk,{onClose:()=>t(!1)})]}):null})),{useGlobalStyle:bk}=te(x.privateApis);const wk={label:(0,b.__)("Preview"),id:"preview",render:function({item:e}){const t=zS(),[n="white"]=bk("color.background"),s=(0,d.useMemo)((()=>(0,o.parse)(e.content.raw)),[e.content.raw]),i=!s?.length;return(0,oe.jsx)(h.EditorProvider,{post:e,settings:t,children:(0,oe.jsxs)("div",{className:"page-templates-preview-field",style:{backgroundColor:n},children:[i&&(0,b.__)("Empty template"),!i&&(0,oe.jsx)(x.BlockPreview.Async,{children:(0,oe.jsx)(x.BlockPreview,{blocks:s})})]})})},enableSorting:!1},_k={label:(0,b.__)("Description"),id:"description",render:({item:e})=>e.description&&(0,oe.jsx)("span",{className:"page-templates-description",children:(0,Kt.decodeEntities)(e.description)}),enableSorting:!1,enableGlobalSearch:!0};const jk={label:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:function({item:e}){const[t,n]=(0,d.useState)(!1),{text:s,icon:i,imageUrl:r}=lC(e.type,e.id);return(0,oe.jsxs)(y.__experimentalHStack,{alignment:"left",spacing:0,children:[r&&(0,oe.jsx)("div",{className:Ut("page-templates-author-field__avatar",{"is-loaded":t}),children:(0,oe.jsx)("img",{onLoad:()=>n(!0),alt:"",src:r})}),!r&&(0,oe.jsx)("div",{className:"page-templates-author-field__icon",children:(0,oe.jsx)(y.Icon,{icon:i})}),(0,oe.jsx)("span",{className:"page-templates-author-field__name",children:s})]})}},{usePostActions:Sk,templateTitleField:Ck}=te(h.privateApis),{useHistory:kk,useLocation:Ek}=te(Gt.privateApis),{useEntityRecordsWithPermissions:Pk}=te(_.privateApis),Ik=[],Tk={[Re]:{showMedia:!1,layout:{styles:{author:{width:"1%"}}}},[Fe]:{showMedia:!0},[Be]:{showMedia:!1}},Ok={type:Fe,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},titleField:"title",descriptionField:"description",mediaField:"preview",fields:["author"],filters:[],...Tk[Fe]};function Ak(){const{path:e,query:t}=Ek(),{activeView:n="all",layout:s,postId:i}=t,[r,o]=(0,d.useState)([i]),a=(0,d.useMemo)((()=>{const e=null!=s?s:Ok.type;return{...Ok,type:e,filters:"all"!==n?[{field:"author",operator:"isAny",value:[n]}]:[],...Tk[e]}}),[s,n]),[l,c]=(0,d.useState)(a);(0,d.useEffect)((()=>{c((e=>({...e,type:null!=s?s:Ok.type})))}),[c,s]),(0,d.useEffect)((()=>{c((e=>({...e,filters:"all"!==n?[{field:"author",operator:De,value:[n]}]:[]})))}),[c,n]);const{records:u,isResolving:h}=Pk("postType",Se,{per_page:-1}),p=kk(),f=(0,d.useCallback)((t=>{o(t),l?.type===Be&&p.navigate((0,Qt.addQueryArgs)(e,{postId:1===t.length?t[0]:void 0}))}),[p,e,l?.type]),m=(0,d.useMemo)((()=>{if(!u)return Ik;const e=new Set;return u.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[u]),g=(0,d.useMemo)((()=>[wk,Ck,_k,{...jk,elements:m}]),[m]),{data:x,paginationInfo:y}=(0,d.useMemo)((()=>gy(u,l,g)),[u,l,g]),w=Sk({postType:Se,context:"list"}),_=iC(),j=(0,d.useMemo)((()=>[_,...w]),[w,_]),S=(0,v.useEvent)((t=>{c(t),t.type!==s&&p.navigate((0,Qt.addQueryArgs)(e,{layout:t.type}))}));return(0,oe.jsx)(eg,{className:"edit-site-page-templates",title:(0,b.__)("Templates"),actions:(0,oe.jsx)(yk,{}),children:(0,oe.jsx)(LS,{paginationInfo:y,fields:g,actions:j,data:x,isLoading:h,view:l,onChangeView:S,onChangeSelection:f,isItemClickable:()=>!0,onClickItem:({id:e})=>{p.navigate(`/wp_template/${e}?canvas=edit`)},selection:r,defaultLayouts:Tk},n)})}const Nk={name:"templates",path:"/template",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(TC,{backPath:"/"}):(0,oe.jsx)(ya,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Ak,{}):void 0},preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return"list"===e.layout?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Ak,{}):(0,oe.jsx)(ya,{})}},widths:{content:({query:e})=>"list"===e.layout?380:void 0}},Mk={name:"template-item",path:"/wp_template/*postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(TC,{backPath:"/"}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})}}},Vk=(0,oe.jsxs)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,oe.jsx)(Yt.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,oe.jsx)(Yt.Path,{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}),(0,oe.jsx)(Yt.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})]}),Fk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})}),Rk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),Bk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"})}),Dk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"})}),Lk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"})}),zk=(0,oe.jsx)(Yt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})}),Gk={[Re]:{},[Fe]:{},[Be]:{}},Hk={type:Be,search:"",filters:[],page:1,perPage:20,sort:{field:"title",direction:"asc"},showLevels:!0,titleField:"title",mediaField:"featured_media",fields:["author","status"],...Gk[Be]};function Uk({postType:e}){const t=(0,l.useSelect)((t=>{const{getPostType:n}=t(_.store);return n(e)?.labels}),[e]);return(0,d.useMemo)((()=>[{title:t?.all_items||(0,b.__)("All items"),slug:"all",icon:Vk,view:Hk},{title:(0,b.__)("Published"),slug:"published",icon:Fk,view:Hk,filters:[{field:"status",operator:De,value:"publish"}]},{title:(0,b.__)("Scheduled"),slug:"future",icon:Rk,view:Hk,filters:[{field:"status",operator:De,value:"future"}]},{title:(0,b.__)("Drafts"),slug:"drafts",icon:Bk,view:Hk,filters:[{field:"status",operator:De,value:"draft"}]},{title:(0,b.__)("Pending"),slug:"pending",icon:Dk,view:Hk,filters:[{field:"status",operator:De,value:"pending"}]},{title:(0,b.__)("Private"),slug:"private",icon:Lk,view:Hk,filters:[{field:"status",operator:De,value:"private"}]},{title:(0,b.__)("Trash"),slug:"trash",icon:zk,view:{...Hk,type:Re,layout:Gk[Re].layout},filters:[{field:"status",operator:De,value:"trash"}]}]),[t])}const{useLocation:Wk}=te(Gt.privateApis);function qk({title:e,slug:t,customViewId:n,type:s,icon:i,isActive:r,isCustom:o,suffix:a}){const{path:l}=Wk(),c=i||hS.find((e=>e.type===s)).icon;let u=o?n:t;"all"===u&&(u=void 0);const d={layout:s,activeView:u,isCustom:o?"true":void 0};return(0,oe.jsxs)(y.__experimentalHStack,{justify:"flex-start",className:Ut("edit-site-sidebar-dataviews-dataview-item",{"is-selected":r}),children:[(0,oe.jsx)(oa,{icon:c,to:(0,Qt.addQueryArgs)(l,d),"aria-current":r?"true":void 0,children:e}),a]})}const{useLocation:Zk,useHistory:Kk}=te(Gt.privateApis);function Yk({type:e,setIsAdding:t}){const n=Kk(),{path:s}=Zk(),{saveEntityRecord:i}=(0,l.useDispatch)(_.store),[r,o]=(0,d.useState)(""),[a,c]=(0,d.useState)(!1),u=Uk({postType:e});return(0,oe.jsx)("form",{onSubmit:async o=>{o.preventDefault(),c(!0);const{getEntityRecords:a}=(0,l.resolveSelect)(_.store);let d;const h=await a("taxonomy","wp_dataviews_type",{slug:e});if(h&&h.length>0)d=h[0].id;else{const t=await i("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(d=t.id)}const p=await i("postType","wp_dataviews",{title:r,status:"publish",wp_dataviews_type:d,content:JSON.stringify(u[0].view)});n.navigate((0,Qt.addQueryArgs)(s,{activeView:p.id,isCustom:"true"})),c(!1),t(!1)},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"5",children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:r,onChange:o,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t(!1)},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit","aria-disabled":!r||a,isBusy:a,children:(0,b.__)("Create")})]})]})})}function Xk({type:e}){const[t,n]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(oa,{icon:jf,onClick:()=>{n(!0)},className:"dataviews__siderbar-content-add-new-item",children:(0,b.__)("New view")}),t&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Add new view"),onRequestClose:()=>{n(!1)},children:(0,oe.jsx)(Yk,{type:e,setIsAdding:n})})]})}const{useHistory:Jk,useLocation:Qk}=te(Gt.privateApis),$k=[];function eE({dataviewId:e,currentTitle:t,setIsRenaming:n}){const{editEntityRecord:s}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(t);return(0,oe.jsx)("form",{onSubmit:async t=>{t.preventDefault(),await s("postType","wp_dataviews",e,{title:i}),n(!1)},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:"5",children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,oe.jsxs)(y.__experimentalHStack,{justify:"right",children:[(0,oe.jsx)(y.Button,{variant:"tertiary",__next40pxDefaultSize:!0,onClick:()=>{n(!1)},children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{variant:"primary",type:"submit","aria-disabled":!i,__next40pxDefaultSize:!0,children:(0,b.__)("Save")})]})]})})}function tE({dataviewId:e,isActive:t}){const n=Jk(),s=Qk(),{dataview:i}=(0,l.useSelect)((t=>{const{getEditedEntityRecord:n}=t(_.store);return{dataview:n("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:r}=(0,l.useDispatch)(_.store),o=(0,d.useMemo)((()=>JSON.parse(i.content).type),[i.content]),[a,c]=(0,d.useState)(!1);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(qk,{title:i.title,type:o,isActive:t,isCustom:!0,customViewId:e,suffix:(0,oe.jsx)(y.DropdownMenu,{icon:Ga,label:(0,b.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"},children:({onClose:e})=>(0,oe.jsxs)(y.MenuGroup,{children:[(0,oe.jsx)(y.MenuItem,{onClick:()=>{c(!0),e()},children:(0,b.__)("Rename")}),(0,oe.jsx)(y.MenuItem,{onClick:async()=>{await r("postType","wp_dataviews",i.id,{force:!0}),t&&n.replace({postType:s.query.postType}),e()},isDestructive:!0,children:(0,b.__)("Delete")})]})})}),a&&(0,oe.jsx)(y.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>{c(!1)},focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)(eE,{dataviewId:e,setIsRenaming:c,currentTitle:i.title})})]})}function nE({type:e,activeView:t,isCustom:n}){const s=function(e){return(0,l.useSelect)((t=>{const{getEntityRecords:n}=t(_.store),s=n("taxonomy","wp_dataviews_type",{slug:e});if(!s||0===s.length)return $k;return n("postType","wp_dataviews",{wp_dataviews_type:s[0].id,orderby:"date",order:"asc"})||$k}))}(e);return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header",children:(0,oe.jsx)(y.__experimentalHeading,{level:2,children:(0,b.__)("Custom Views")})}),(0,oe.jsxs)(y.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-dataviews__custom-items",children:[s.map((e=>(0,oe.jsx)(tE,{dataviewId:e.id,isActive:n&&Number(t)===e.id},e.id))),(0,oe.jsx)(Xk,{type:e})]})]})}const{useLocation:sE}=te(Gt.privateApis);function iE({postType:e}){const{query:{activeView:t="all",isCustom:n="false"}}=sE(),s=Uk({postType:e});if(!e)return null;const i="true"===n;return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.__experimentalItemGroup,{className:"edit-site-sidebar-dataviews",children:s.map((e=>(0,oe.jsx)(qk,{slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:!i&&e.slug===t,isCustom:!1},e.slug)))}),window?.__experimentalCustomViews&&(0,oe.jsx)(nE,{activeView:t,type:e,isCustom:!0})]})}const rE=(0,oe.jsx)(Yt.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(Yt.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"})});function oE({postType:e,onSave:t,onClose:n}){const s=(0,l.useSelect)((t=>t(_.store).getPostType(e)?.labels),[e]),[i,r]=(0,d.useState)(!1),[a,c]=(0,d.useState)(""),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),{resolveSelect:f}=(0,l.useRegistry)();return(0,oe.jsx)(y.Modal,{title:(0,b.sprintf)((0,b.__)("Draft new: %s"),s?.singular_name),onRequestClose:n,focusOnMount:"firstContentElement",size:"small",children:(0,oe.jsx)("form",{onSubmit:async function(n){if(n.preventDefault(),!i){r(!0);try{const n=await f(_.store).getPostType(e),s=await u("postType",e,{status:"draft",title:a,slug:null!=a?a:void 0,content:n.template&&n.template.length?(0,o.serialize)((0,o.synchronizeBlocksWithTemplate)([],n.template)):void 0},{throwOnError:!0});t(s),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,Kt.decodeEntities)(s.title?.rendered||a)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the item.");h(t,{type:"snackbar"})}finally{r(!1)}}},children:(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(y.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Title"),onChange:c,placeholder:(0,b.__)("No title"),value:a}),(0,oe.jsxs)(y.__experimentalHStack,{spacing:2,justify:"end",children:[(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n,children:(0,b.__)("Cancel")}),(0,oe.jsx)(y.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:i,"aria-disabled":i,children:(0,b.__)("Create draft")})]})]})})})}const{usePostActions:aE,usePostFields:lE}=te(h.privateApis),{useLocation:cE,useHistory:uE}=te(Gt.privateApis),{useEntityRecordsWithPermissions:dE}=te(_.privateApis),hE=[],pE=(e,t)=>e.find((({slug:e})=>e===t))?.view,fE=e=>{if(!e?.content)return;const t=JSON.parse(e.content);return t?{...t,...Gk[t.type]}:void 0};function mE(e){return e.id.toString()}function gE(e){return e.level}function vE({postType:e}){var t,n,s;const[i,r]=function(e){const{path:t,query:{activeView:n="all",isCustom:s="false",layout:i}}=cE(),r=uE(),o=Uk({postType:e}),{editEntityRecord:a}=(0,l.useDispatch)(_.store),c=(0,l.useSelect)((e=>{if("true"!==s)return;const{getEditedEntityRecord:t}=e(_.store);return t("postType","wp_dataviews",Number(n))}),[n,s]),[u,h]=(0,d.useState)((()=>{let e;var t,r;e="true"===s?null!==(t=fE(c))&&void 0!==t?t:{type:null!=i?i:Be}:null!==(r=pE(o,n))&&void 0!==r?r:{type:null!=i?i:Be};const a=null!=i?i:e.type;return{...e,type:a,...Gk[a]}})),p=(0,v.useEvent)((e=>{h(e),"true"===s&&c?.id&&a("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)});const n=null!=i?i:Be;e.type!==n&&r.navigate((0,Qt.addQueryArgs)(t,{layout:e.type}))})),f=(0,v.useEvent)((()=>{h((e=>{const t=null!=i?i:Be;return t===e.type?e:{...e,type:t,...Gk[t]}}))}));(0,d.useEffect)((()=>{f()}),[f,i]);const m=(0,v.useEvent)((()=>{let e;if(e="true"===s?fE(c):pE(o,n),e){const t=null!=i?i:e.type;h({...e,type:t,...Gk[t]})}}));return(0,d.useEffect)((()=>{m()}),[m,n,s,o,c]),[u,p]}(e),o=Uk({postType:e}),a=uE(),c=cE(),{postId:u,quickEdit:h=!1,isCustom:p,activeView:f="all"}=c.query,[m,g]=(0,d.useState)(null!==(t=u?.split(","))&&void 0!==t?t:[]),x=(0,d.useCallback)((e=>{var t;g(e),"false"===(null!==(t=c.query.isCustom)&&void 0!==t?t:"false")&&a.navigate((0,Qt.addQueryArgs)(c.path,{postId:e.join(",")}))}),[c.path,c.query.isCustom,a]),w=(e,t)=>{var n;const s=e.find((({slug:e})=>e===t));return null!==(n=s?.filters)&&void 0!==n?n:[]},{isLoading:j,fields:S}=lE({postType:e}),C=(0,d.useMemo)((()=>{const e=w(o,f).map((({field:e})=>e));return S.map((t=>({...t,elements:e.includes(t.id)?[]:t.elements})))}),[S,o,f]),k=(0,d.useMemo)((()=>{const e={};i.filters?.forEach((t=>{"status"===t.field&&t.operator===De&&(e.status=t.value),"author"===t.field&&t.operator===De?e.author=t.value:"author"===t.field&&t.operator===Le&&(e.author_exclude=t.value)}));return w(o,f).forEach((t=>{"status"===t.field&&t.operator===De&&(e.status=t.value),"author"===t.field&&t.operator===De?e.author=t.value:"author"===t.field&&t.operator===Le&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status="draft,future,pending,private,publish"),{per_page:i.perPage,page:i.page,_embed:"author",order:i.sort?.direction,orderby:i.sort?.field,orderby_hierarchy:!!i.showLevels,search:i.search,...e}}),[i,f,o]),{records:E,isResolving:P,totalItems:I,totalPages:T}=dE("postType",e,k),O=(0,d.useMemo)((()=>j||"author"!==i?.sort?.field?E:gy(E,{sort:{...i.sort}},C).data),[E,C,j,i?.sort]),A=null!==(n=O?.map((e=>mE(e))))&&void 0!==n?n:[],N=(null!==(s=(0,v.usePrevious)(A))&&void 0!==s?s:[]).filter((e=>!A.includes(e))).includes(u);(0,d.useEffect)((()=>{N&&a.navigate((0,Qt.addQueryArgs)(c.path,{postId:void 0}))}),[a,N,c.path]);const M=(0,d.useMemo)((()=>({totalItems:I,totalPages:T})),[I,T]),{labels:V,canCreateRecord:F}=(0,l.useSelect)((t=>{const{getPostType:n,canUser:s}=t(_.store);return{labels:n(e)?.labels,canCreateRecord:s("create",{kind:"postType",name:e})}}),[e]),R=aE({postType:e,context:"list"}),B=iC(),D=(0,d.useMemo)((()=>[B,...R]),[R,B]),[L,z]=(0,d.useState)(!1),G=()=>z(!1);return(0,oe.jsx)(eg,{title:V?.name,actions:V?.add_new_item&&F&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(y.Button,{variant:"primary",onClick:()=>z(!0),__next40pxDefaultSize:!0,children:V.add_new_item}),L&&(0,oe.jsx)(oE,{postType:e,onSave:({type:e,id:t})=>{a.navigate(`/${e}/${t}?canvas=edit`),G()},onClose:G})]}),children:(0,oe.jsx)(LS,{paginationInfo:M,fields:C,actions:D,data:O||hE,isLoading:P||j,view:i,onChangeView:r,selection:m,onChangeSelection:x,isItemClickable:e=>"trash"!==e.status,onClickItem:({id:t})=>{a.navigate(`/${e}/${t}?canvas=edit`)},getItemId:mE,getItemLevel:gE,defaultLayouts:Gk,header:window.__experimentalQuickEditDataViews&&i.type!==Be&&"page"===e&&(0,oe.jsx)(y.Button,{size:"compact",isPressed:h,icon:rE,label:(0,b.__)("Details"),onClick:()=>{a.navigate((0,Qt.addQueryArgs)(c.path,{quickEdit:!h||void 0}))}})},f+p)})}const xE=(0,d.createContext)({fields:[]});function yE({fields:e,children:t}){return(0,oe.jsx)(xE.Provider,{value:{fields:e},children:t})}const bE=xE;function wE(e){return void 0!==e.children}function _E({title:e}){return(0,oe.jsx)(y.__experimentalVStack,{className:"dataforms-layouts-regular__header",spacing:4,children:(0,oe.jsxs)(y.__experimentalHStack,{alignment:"center",children:[(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:e}),(0,oe.jsx)(y.__experimentalSpacer,{})]})})}function jE({title:e,onClose:t}){return(0,oe.jsx)(y.__experimentalVStack,{className:"dataforms-layouts-panel__dropdown-header",spacing:4,children:(0,oe.jsxs)(y.__experimentalHStack,{alignment:"center",children:[e&&(0,oe.jsx)(y.__experimentalHeading,{level:2,size:13,children:e}),(0,oe.jsx)(y.__experimentalSpacer,{}),t&&(0,oe.jsx)(y.Button,{label:(0,b.__)("Close"),icon:Ro,onClick:t,size:"small"})]})})}function SE({fieldDefinition:e,popoverAnchor:t,labelPosition:n="side",data:s,onChange:i,field:r}){const o=wE(r)?r.label:e?.label,a=(0,d.useMemo)((()=>wE(r)?{type:"regular",fields:r.children.map((e=>"string"==typeof e?{id:e}:e))}:{type:"regular",fields:[{id:r.id}]}),[r]),l=(0,d.useMemo)((()=>({anchor:t,placement:"left-start",offset:36,shift:!0})),[t]);return(0,oe.jsx)(y.Dropdown,{contentClassName:"dataforms-layouts-panel__field-dropdown",popoverProps:l,focusOnMount:!0,toggleProps:{size:"compact",variant:"tertiary",tooltipPosition:"middle left"},renderToggle:({isOpen:t,onToggle:i})=>(0,oe.jsx)(y.Button,{className:"dataforms-layouts-panel__field-control",size:"compact",variant:["none","top"].includes(n)?"link":"tertiary","aria-expanded":t,"aria-label":(0,b.sprintf)((0,b._x)("Edit %s","field"),o),onClick:i,children:(0,oe.jsx)(e.render,{item:s})}),renderContent:({onClose:e})=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(jE,{title:o,onClose:e}),(0,oe.jsx)(kE,{data:s,form:a,onChange:i,children:(e,t)=>{var n;return(0,oe.jsx)(e,{data:s,field:t,onChange:i,hideLabelFromVision:(null!==(n=a?.fields)&&void 0!==n?n:[]).length<2},t.id)}})]})})}const CE=[{type:"regular",component:function({data:e,field:t,onChange:n,hideLabelFromVision:s}){var i;const{fields:r}=(0,d.useContext)(bE),o=(0,d.useMemo)((()=>wE(t)?{fields:t.children.map((e=>"string"==typeof e?{id:e}:e)),type:"regular"}:{type:"regular",fields:[]}),[t]);if(wE(t))return(0,oe.jsxs)(oe.Fragment,{children:[!s&&t.label&&(0,oe.jsx)(_E,{title:t.label}),(0,oe.jsx)(kE,{data:e,form:o,onChange:n})]});const a=null!==(i=t.labelPosition)&&void 0!==i?i:"top",l=r.find((e=>e.id===t.id));return l?"side"===a?(0,oe.jsxs)(y.__experimentalHStack,{className:"dataforms-layouts-regular__field",children:[(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field-label",children:l.label}),(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field-control",children:(0,oe.jsx)(l.Edit,{data:e,field:l,onChange:n,hideLabelFromVision:!0},l.id)})]}):(0,oe.jsx)("div",{className:"dataforms-layouts-regular__field",children:(0,oe.jsx)(l.Edit,{data:e,field:l,onChange:n,hideLabelFromVision:"none"===a||s})}):null}},{type:"panel",component:function({data:e,field:t,onChange:n}){var s;const{fields:i}=(0,d.useContext)(bE),r=i.find((e=>{if(wE(t)){const n=t.children.filter((e=>"string"==typeof e||!wE(e))),s="string"==typeof n[0]?n[0]:n[0].id;return e.id===s}return e.id===t.id})),o=null!==(s=t.labelPosition)&&void 0!==s?s:"side",[a,l]=(0,d.useState)(null);if(!r)return null;const c=wE(t)?t.label:r?.label;return"top"===o?(0,oe.jsxs)(y.__experimentalVStack,{className:"dataforms-layouts-panel__field",spacing:0,children:[(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-label",style:{paddingBottom:0},children:c}),(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})})]}):"none"===o?(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})}):(0,oe.jsxs)(y.__experimentalHStack,{ref:l,className:"dataforms-layouts-panel__field",children:[(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-label",children:c}),(0,oe.jsx)("div",{className:"dataforms-layouts-panel__field-control",children:(0,oe.jsx)(SE,{field:t,popoverAnchor:a,fieldDefinition:r,data:e,onChange:n,labelPosition:o})})]})}}];function kE({data:e,form:t,onChange:n,children:s}){const{fields:i}=(0,d.useContext)(bE);const r=(0,d.useMemo)((()=>function(e){var t,n,s;let i="regular";["regular","panel"].includes(null!==(t=e.type)&&void 0!==t?t:"")&&(i=e.type);const r=null!==(n=e.labelPosition)&&void 0!==n?n:"regular"===i?"top":"side";return(null!==(s=e.fields)&&void 0!==s?s:[]).map((e=>{var t,n;if("string"==typeof e)return{id:e,layout:i,labelPosition:r};const s=null!==(t=e.layout)&&void 0!==t?t:i,o=null!==(n=e.labelPosition)&&void 0!==n?n:"regular"===s?"top":"side";return{...e,layout:s,labelPosition:o}}))}(t)),[t]);return(0,oe.jsx)(y.__experimentalVStack,{spacing:2,children:r.map((t=>{const r=(o=t.layout,CE.find((e=>e.type===o)))?.component;var o;if(!r)return null;const a=wE(t)?void 0:function(e){const t="string"==typeof e?e:e.id;return i.find((e=>e.id===t))}(t);return a&&a.isVisible&&!a.isVisible(e)?null:s?s(r,t):(0,oe.jsx)(r,{data:e,field:t,onChange:n},t.id)}))})}function EE({data:e,form:t,fields:n,onChange:s}){const i=(0,d.useMemo)((()=>py(n)),[n]);return t.fields?(0,oe.jsx)(yE,{fields:i,children:(0,oe.jsx)(kE,{data:e,form:t,onChange:s})}):null}const{usePostFields:PE,PostCardPanel:IE}=te(h.privateApis),TE=["title","status","date","author","comment_status"];function OE({postType:e,postId:t}){const n=(0,d.useMemo)((()=>t.split(",")),[t]),{record:s,hasFinishedResolution:i}=(0,l.useSelect)((t=>{const s=["postType",e,n[0]],{getEditedEntityRecord:i,hasFinishedResolution:r}=t(_.store);return{record:1===n.length?i(...s):null,hasFinishedResolution:r("getEditedEntityRecord",s)}}),[e,n]),[r,o]=(0,d.useState)({}),{editEntityRecord:a}=(0,l.useDispatch)(_.store),{fields:c}=PE({postType:e}),u=(0,d.useMemo)((()=>c?.map((e=>"status"===e.id?{...e,elements:e.elements.filter((e=>"trash"!==e.value))}:e))),[c]),h=(0,d.useMemo)((()=>({type:"panel",fields:[{id:"featured_media",layout:"regular"},{id:"status",label:(0,b.__)("Status & Visibility"),children:["status","password"]},"author","date","slug","parent","comment_status",{label:(0,b.__)("Template"),labelPosition:"side",id:"template",layout:"regular"}].filter((e=>1===n.length||TE.includes(e)))})),[n]);(0,d.useEffect)((()=>{o({})}),[n]);const{ExperimentalBlockEditorProvider:p}=te(x.privateApis),f=zS(),m=(0,d.useMemo)((()=>u.map((e=>"template"===e.id?{...e,Edit:t=>(0,oe.jsx)(p,{settings:f,children:(0,oe.jsx)(e.Edit,{...t})})}:e))),[u,f]);return(0,oe.jsxs)(y.__experimentalVStack,{spacing:4,children:[(0,oe.jsx)(IE,{postType:e,postId:n}),i&&(0,oe.jsx)(EE,{data:1===n.length?s:r,fields:m,form:h,onChange:t=>{for(const i of n)t.status&&"future"!==t.status&&"future"===s?.status&&new Date(s.date)>new Date&&(t.date=null),t.status&&"private"===t.status&&s.password&&(t.password=""),a("postType",e,i,t),n.length>1&&o((e=>({...e,...t})))}})]})}function AE({postType:e,postId:t}){return(0,oe.jsxs)(eg,{className:Ut("edit-site-post-edit",{"is-empty":!t}),label:(0,b.__)("Post Edit"),children:[t&&(0,oe.jsx)(OE,{postType:e,postId:t}),!t&&(0,oe.jsx)("p",{children:(0,b.__)("Select a page to edit")})]})}const{useLocation:NE}=te(Gt.privateApis);function ME(){const{query:e={}}=NE(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(vE,{postType:"page"})}const VE={name:"pages",path:"/page",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ea,{title:(0,b.__)("Pages"),backPath:"/",content:(0,oe.jsx)(iE,{postType:"page"})}):(0,oe.jsx)(ya,{})},content({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(vE,{postType:"page"}):void 0},preview({query:e,siteData:t}){const n=t.currentTheme?.is_block_theme;if(!n)return;return("list"===e.layout||!e.layout)&&"true"!==e.isCustom?(0,oe.jsx)(Tv,{}):void 0},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ME,{}):(0,oe.jsx)(ya,{})},edit({query:e}){var t;return"list"!==(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?(0,oe.jsx)(AE,{postType:"page",postId:e.postId}):void 0}},widths:{content:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?380:void 0,edit({query:e}){var t;return"list"!==(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?380:void 0}}};function FE(){return(0,oe.jsx)(y.Notice,{status:"error",isDismissible:!1,children:(0,b.__)("The requested page could not be found. Please check the URL.")})}const RE=[{name:"page-item",path:"/page/:postId",areas:{sidebar({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(ea,{title:(0,b.__)("Pages"),backPath:"/",content:(0,oe.jsx)(iE,{postType:"page"})}):(0,oe.jsx)(ya,{})},mobile({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})},preview({siteData:e}){const t=e.currentTheme?.is_block_theme;return t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(ya,{})}}},VE,Mk,Nk,CC,SC,jC,xx,mx,Vv,Av,{name:"stylebook",path:"/stylebook",areas:{sidebar:({siteData:e})=>Ov(e)?(0,oe.jsx)(ea,{title:(0,b.__)("Styles"),backPath:"/",description:(0,b.__)("Preview your website's visual identity: colors, typography, and blocks.")}):(0,oe.jsx)(ya,{}),preview:({siteData:e})=>Ov(e)?(0,oe.jsx)(vg,{isStatic:!0}):void 0,mobile:({siteData:e})=>Ov(e)?(0,oe.jsx)(vg,{isStatic:!0}):void 0}},{name:"notfound",path:"*",areas:{sidebar:(0,oe.jsx)(xa,{}),mobile:(0,oe.jsx)(xa,{customDescription:(0,oe.jsx)(FE,{})}),content:(0,oe.jsx)(y.__experimentalSpacer,{padding:2,children:(0,oe.jsx)(FE,{})})}}];const{RouterProvider:BE}=te(Gt.privateApis);function DE(){return function(){const e=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","__unstableBase")?.home),[]);(0,Wt.useCommand)({name:"core/edit-site/view-site",label:(0,b.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:Po}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles",hook:Ao()}),(0,Wt.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:No()}),(0,Wt.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Mo()}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:Vo()}),(0,Wt.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:Fo()})}(),function(){const{query:e={}}=Uo(),{canvas:t="view"}=e;let n="site-editor";"edit"===t&&(n="entity-edit"),(0,l.useSelect)((e=>e(x.store).getBlockSelectionStart()),[])&&(n="block-selection-edit"),zo()&&(n=""),Ho(n)}(),(0,oe.jsx)(wo,{})}function LE(){!function(){const e=(0,l.useRegistry)(),{registerRoute:t}=te((0,l.useDispatch)(zt));(0,d.useEffect)((()=>{e.batch((()=>{RE.forEach(t)}))}),[e,t])}();const{routes:e,currentTheme:t,editorSettings:n}=(0,l.useSelect)((e=>({routes:te(e(zt)).getRoutes(),currentTheme:e(_.store).getCurrentTheme(),editorSettings:e(zt).getSettings()})),[]),s=(0,d.useCallback)((({path:e,query:t})=>Qr()?{path:e,query:{...t,wp_theme_preview:"wp_theme_preview"in t?t.wp_theme_preview:$r()}}:{path:e,query:t}),[]),i=(0,d.useMemo)((()=>({siteData:{currentTheme:t,editorSettings:n}})),[t,n]);return(0,oe.jsx)(BE,{routes:e,pathArg:"p",beforeNavigate:s,matchResolverArgs:i,children:(0,oe.jsx)(DE,{})})}const zE=(0,Qt.getPath)(window.location.href)?.includes("site-editor.php"),GE=e=>{u()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function HE(e){return zE?(GE("PluginMoreMenuItem"),(0,oe.jsx)(h.PluginMoreMenuItem,{...e})):null}function UE(e){return zE?(GE("PluginSidebar"),(0,oe.jsx)(h.PluginSidebar,{...e})):null}function WE(e){return zE?(GE("PluginSidebarMoreMenuItem"),(0,oe.jsx)(h.PluginSidebarMoreMenuItem,{...e})):null}const{useLocation:qE}=te(Gt.privateApis);function ZE(){const{query:e={}}=qE(),{canvas:t="view"}=e;return"edit"===t?(0,oe.jsx)(Tv,{}):(0,oe.jsx)(vE,{postType:"post"})}const KE={name:"posts",path:"/",areas:{sidebar:(0,oe.jsx)(ea,{title:(0,b.__)("Posts"),isRoot:!0,content:(0,oe.jsx)(iE,{postType:"post"})}),content:(0,oe.jsx)(vE,{postType:"post"}),preview:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?(0,oe.jsx)(Tv,{isPostsList:!0}):void 0,mobile:(0,oe.jsx)(ZE,{}),edit({query:e}){var t;return"list"===(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?(0,oe.jsx)(AE,{postType:"post",postId:e.postId}):void 0}},widths:{content:({query:e})=>("list"===e.layout||!e.layout)&&"true"!==e.isCustom?380:void 0,edit({query:e}){var t;return"list"===(null!==(t=e.layout)&&void 0!==t?t:"list")&&!!e.quickEdit?380:void 0}}};(0,b.__)("Posts");const{RouterProvider:YE}=te(Gt.privateApis);function XE(e,t){}const{registerCoreBlockBindingsSources:JE}=te(h.privateApis);function QE(e,t){const n=document.getElementById(e),s=(0,d.createRoot)(n);(0,l.dispatch)(o.store).reapplyBlockTypeFilters();const i=(0,a.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,a.registerCoreBlocks)(i),JE(),(0,l.dispatch)(o.store).setFreeformFallbackBlockName("core/html"),(0,m.registerLegacyWidgetBlock)({inserter:!1}),(0,m.registerWidgetGroupBlock)({inserter:!1}),(0,l.dispatch)(f.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,l.dispatch)(f.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",editorTool:"edit",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1,enableChoosePatternModal:!0}),window.__experimentalMediaProcessing&&(0,l.dispatch)(f.store).setDefaults("core/media",{requireApproval:!0,optimizeOnUpload:!0}),(0,l.dispatch)(zt).updateSettings(t),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),s.render((0,oe.jsx)(d.StrictMode,{children:(0,oe.jsx)(LE,{})})),s}function $E(){u()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=r})(); \ No newline at end of file