/*! This file is auto-generated */ (()=>{var e,t,n={4660:e=>{e.exports=function(){function e(t,n,r){function a(i,o){if(!n[i]){if(!t[i]){if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,(function(e){return a(t[i][1][e]||e)}),c,c.exports,e,t,n,r)}return n[i].exports}for(var s=void 0,i=0;i=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&a))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",i=0;i>>6,t[i++]=128|63&n):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|63&n):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,a=t.length;n4)c[r++]=65533,n+=s-1;else{for(a&=2===s?31:3===s?15:7;s>1&&n1?c[r++]=65533:a<65536?c[r++]=a:(a-=65536,c[r++]=55296|a>>10&1023,c[r++]=56320|1023&a)}return l(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+i[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function r(e,t,n,r){for(var a=65535&e|0,s=e>>>16&65535|0,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{s=s+(a=a+t[r++]|0)|0}while(--i);a%=65521,s%=65521}return a|s<<16|0}t.exports=r},{}],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 r(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}var a=r();function s(e,t,n,r){var s=a,i=r+n;e^=-1;for(var o=r;o>>8^s[255&(e^t[o])];return-1^e}t.exports=s},{}],6:[function(e,t,n){"use strict";function r(){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=r},{}],7:[function(e,t,n){"use strict";var r=30,a=12;t.exports=function(e,t){var n,s,i,o,l,c,u,d,m,p,h,f,g,y,v,_,b,E,w,S,x,C,k,T,P;n=e.state,s=e.next_in,T=e.input,i=s+(e.avail_in-5),o=e.next_out,P=e.output,l=o-(t-e.avail_out),c=o+(e.avail_out-257),u=n.dmax,d=n.wsize,m=n.whave,p=n.wnext,h=n.window,f=n.hold,g=n.bits,y=n.lencode,v=n.distcode,_=(1<>>=w=E>>>24,g-=w,0==(w=E>>>16&255))P[o++]=65535&E;else{if(!(16&w)){if(0==(64&w)){E=y[(65535&E)+(f&(1<>>=w,g-=w),g<15&&(f+=T[s++]<>>=w=E>>>24,g-=w,!(16&(w=E>>>16&255))){if(0==(64&w)){E=v[(65535&E)+(f&(1<u){e.msg="invalid distance too far back",n.mode=r;break e}if(f>>>=w,g-=w,x>(w=o-l)){if((w=x-w)>m&&n.sane){e.msg="invalid distance too far back",n.mode=r;break e}if(C=0,k=h,0===p){if(C+=d-w,w2;)P[o++]=k[C++],P[o++]=k[C++],P[o++]=k[C++],S-=3;S&&(P[o++]=k[C++],S>1&&(P[o++]=k[C++]))}else{C=o-x;do{P[o++]=P[C++],P[o++]=P[C++],P[o++]=P[C++],S-=3}while(S>2);S&&(P[o++]=P[C++],S>1&&(P[o++]=P[C++]))}break}}break}}while(s>3,f&=(1<<(g-=S<<3))-1,e.next_in=s,e.next_out=o,e.avail_in=s>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function re(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ae(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=w,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32($),t.distcode=t.distdyn=new r.Buf32(ee),t.sane=1,t.back=-1,h):y}function se(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ae(e)):y}function ie(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?y:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,se(e))):y}function oe(e,t){var n,r;return e?(r=new re,e.state=r,r.window=null,(n=ie(e,t))!==h&&(e.state=null),n):y}function le(e){return oe(e,te)}var ce,ue,de=!0;function me(e){if(de){var t;for(ce=new r.Buf32(512),ue=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(u,e.lens,0,32,ue,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=ue,e.distbits=5}function pe(e,t,n,a){var s,i=e.state;return null===i.window&&(i.wsize=1<=i.wsize?(r.arraySet(i.window,t,n-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):((s=i.wsize-i.wnext)>a&&(s=a),r.arraySet(i.window,t,n-a,s,i.wnext),(a-=s)?(r.arraySet(i.window,t,n-a,a,0),i.wnext=a,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,n.check=s(n.check,ke,2,0),ie=0,oe=0,n.mode=S;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&ie)<<8)+(ie>>8))%31){e.msg="incorrect header check",n.mode=J;break}if((15&ie)!==E){e.msg="unknown compression method",n.mode=J;break}if(oe-=4,Ee=8+(15&(ie>>>=4)),0===n.wbits)n.wbits=Ee;else if(Ee>n.wbits){e.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(ke[0]=255&ie,ke[1]=ie>>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0,n.mode=x;case x:for(;oe<32;){if(0===ae)break e;ae--,ie+=$[te++]<>>8&255,ke[2]=ie>>>16&255,ke[3]=ie>>>24&255,n.check=s(n.check,ke,4,0)),ie=0,oe=0,n.mode=C;case C:for(;oe<16;){if(0===ae)break e;ae--,ie+=$[te++]<>8),512&n.flags&&(ke[0]=255&ie,ke[1]=ie>>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0,n.mode=k;case k:if(1024&n.flags){for(;oe<16;){if(0===ae)break e;ae--,ie+=$[te++]<>>8&255,n.check=s(n.check,ke,2,0)),ie=0,oe=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((ue=n.length)>ae&&(ue=ae),ue&&(n.head&&(Ee=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,$,te,ue,Ee)),512&n.flags&&(n.check=s(n.check,$,ue,te)),ae-=ue,te+=ue,n.length-=ue),n.length))break e;n.length=0,n.mode=P;case P:if(2048&n.flags){if(0===ae)break e;ue=0;do{Ee=$[te+ue++],n.head&&Ee&&n.length<65536&&(n.head.name+=String.fromCharCode(Ee))}while(Ee&&ue>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=N;break;case A:for(;oe<32;){if(0===ae)break e;ae--,ie+=$[te++]<>>=7&oe,oe-=7&oe,n.mode=Y;break}for(;oe<3;){if(0===ae)break e;ae--,ie+=$[te++]<>>=1)){case 0:n.mode=R;break;case 1:if(me(n),n.mode=H,t===p){ie>>>=2,oe-=2;break e}break;case 2:n.mode=L;break;case 3:e.msg="invalid block type",n.mode=J}ie>>>=2,oe-=2;break;case R:for(ie>>>=7&oe,oe-=7&oe;oe<32;){if(0===ae)break e;ae--,ie+=$[te++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&ie,ie=0,oe=0,n.mode=D,t===p)break e;case D:n.mode=V;case V:if(ue=n.length){if(ue>ae&&(ue=ae),ue>se&&(ue=se),0===ue)break e;r.arraySet(ee,$,te,ue,re),ae-=ue,te+=ue,se-=ue,re+=ue,n.length-=ue;break}n.mode=N;break;case L:for(;oe<14;){if(0===ae)break e;ae--,ie+=$[te++]<>>=5,oe-=5,n.ndist=1+(31&ie),ie>>>=5,oe-=5,n.ncode=4+(15&ie),ie>>>=4,oe-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=B;case B:for(;n.have>>=3,oe-=3}for(;n.have<19;)n.lens[Te[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Se={bits:n.lenbits},we=o(l,n.lens,0,19,n.lencode,0,n.work,Se),n.lenbits=Se.bits,we){e.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=z;case z:for(;n.have>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===ae)break e;ae--,ie+=$[te++]<>>=fe,oe-=fe,n.lens[n.have++]=ye;else{if(16===ye){for(xe=fe+2;oe>>=fe,oe-=fe,0===n.have){e.msg="invalid bit length repeat",n.mode=J;break}Ee=n.lens[n.have-1],ue=3+(3&ie),ie>>>=2,oe-=2}else if(17===ye){for(xe=fe+3;oe>>=fe)),ie>>>=3,oe-=3}else{for(xe=fe+7;oe>>=fe)),ie>>>=7,oe-=7}if(n.have+ue>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=J;break}for(;ue--;)n.lens[n.have++]=Ee}}if(n.mode===J)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Se={bits:n.lenbits},we=o(c,n.lens,0,n.nlen,n.lencode,0,n.work,Se),n.lenbits=Se.bits,we){e.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Se={bits:n.distbits},we=o(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Se),n.distbits=Se.bits,we){e.msg="invalid distances set",n.mode=J;break}if(n.mode=H,t===p)break e;case H:n.mode=G;case G:if(ae>=6&&se>=258){e.next_out=re,e.avail_out=se,e.next_in=te,e.avail_in=ae,n.hold=ie,n.bits=oe,i(e,ce),re=e.next_out,ee=e.output,se=e.avail_out,te=e.next_in,$=e.input,ae=e.avail_in,ie=n.hold,oe=n.bits,n.mode===N&&(n.back=-1);break}for(n.back=0;ge=(Ce=n.lencode[ie&(1<>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===ae)break e;ae--,ie+=$[te++]<>ve)])>>>16&255,ye=65535&Ce,!(ve+(fe=Ce>>>24)<=oe);){if(0===ae)break e;ae--,ie+=$[te++]<>>=ve,oe-=ve,n.back+=ve}if(ie>>>=fe,oe-=fe,n.back+=fe,n.length=ye,0===ge){n.mode=q;break}if(32&ge){n.back=-1,n.mode=N;break}if(64&ge){e.msg="invalid literal/length code",n.mode=J;break}n.extra=15&ge,n.mode=U;case U:if(n.extra){for(xe=n.extra;oe>>=n.extra,oe-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;ge=(Ce=n.distcode[ie&(1<>>16&255,ye=65535&Ce,!((fe=Ce>>>24)<=oe);){if(0===ae)break e;ae--,ie+=$[te++]<>ve)])>>>16&255,ye=65535&Ce,!(ve+(fe=Ce>>>24)<=oe);){if(0===ae)break e;ae--,ie+=$[te++]<>>=ve,oe-=ve,n.back+=ve}if(ie>>>=fe,oe-=fe,n.back+=fe,64&ge){e.msg="invalid distance code",n.mode=J;break}n.offset=ye,n.extra=15&ge,n.mode=j;case j:if(n.extra){for(xe=n.extra;oe>>=n.extra,oe-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=J;break}n.mode=Z;case Z:if(0===se)break e;if(ue=ce-se,n.offset>ue){if((ue=n.offset-ue)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=J;break}ue>n.wnext?(ue-=n.wnext,de=n.wsize-ue):de=n.wnext-ue,ue>n.length&&(ue=n.length),he=n.window}else he=ee,de=re-n.offset,ue=n.length;ue>se&&(ue=se),se-=ue,n.length-=ue;do{ee[re++]=he[de++]}while(--ue);0===n.length&&(n.mode=G);break;case q:if(0===se)break e;ee[re++]=n.length,se--,n.mode=G;break;case Y:if(n.wrap){for(;oe<32;){if(0===ae)break e;ae--,ie|=$[te++]<=1&&0===H[O];O--);if(N>O&&(N=O),0===O)return f[g++]=20971520,f[g++]=20971520,v.bits=1,0;for(A=1;A0&&(e===o||1!==O))return-1;for(G[1]=0,I=1;Is||e===c&&V>i)return 1;for(;;){C=I-R,y[M]x?(k=U[W+y[M]],T=B[z+y[M]]):(k=96,T=0),_=1<>R)+(b-=_)]=C<<24|k<<16|T|0}while(0!==b);for(_=1<>=1;if(0!==_?(L&=_-1,L+=_):L=0,M++,0==--H[I]){if(I===O)break;I=t[n+y[M]]}if(I>N&&(L&w)!==E){for(0===R&&(R=N),S+=A,D=1<<(F=I-R);F+Rs||e===c&&V>i)return 1;f[E=L&w]=N<<24|F<<16|S-g|0}}return 0!==L&&(f[S+L]=I-R<<24|64<<16|0),v.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 r(){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=r},{}],"/lib/inflate.js":[function(e,t,n){"use strict";var r=e("./zlib/inflate"),a=e("./utils/common"),s=e("./utils/strings"),i=e("./zlib/constants"),o=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==i.Z_OK)throw new Error(o[n]);if(this.header=new c,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==i.Z_OK))throw new Error(o[n])}function m(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}function p(e,t){return(t=t||{}).raw=!0,m(e,t)}d.prototype.push=function(e,t){var n,o,l,c,d,m=this.strm,p=this.options.chunkSize,h=this.options.dictionary,f=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof e?m.input=s.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?m.input=new Uint8Array(e):m.input=e,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new a.Buf8(p),m.next_out=0,m.avail_out=p),(n=r.inflate(m,i.Z_NO_FLUSH))===i.Z_NEED_DICT&&h&&(n=r.inflateSetDictionary(this.strm,h)),n===i.Z_BUF_ERROR&&!0===f&&(n=i.Z_OK,f=!1),n!==i.Z_STREAM_END&&n!==i.Z_OK)return this.onEnd(n),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&n!==i.Z_STREAM_END&&(0!==m.avail_in||o!==i.Z_FINISH&&o!==i.Z_SYNC_FLUSH)||("string"===this.options.to?(l=s.utf8border(m.output,m.next_out),c=m.next_out-l,d=s.buf2string(m.output,l),m.next_out=c,m.avail_out=p-c,c&&a.arraySet(m.output,m.output,l,c,0),this.onData(d)):this.onData(a.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(f=!0)}while((m.avail_in>0||0===m.avail_out)&&n!==i.Z_STREAM_END);return n===i.Z_STREAM_END&&(o=i.Z_FINISH),o===i.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===i.Z_OK):o!==i.Z_SYNC_FLUSH||(this.onEnd(i.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=m,n.inflateRaw=p,n.ungzip=m},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},8572:e=>{e.exports=function(){function e(t,n,r){function a(i,o){if(!n[i]){if(!t[i]){if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,(function(e){return a(t[i][1][e]||e)}),c,c.exports,e,t,n,r)}return n[i].exports}for(var s=void 0,i=0;i0},o.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var e=this.buf_ptr_,t=this.input_.read(this.buf_,e,r);if(t<0)throw new Error("Unexpected end of input");if(t=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&s]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},o.prototype.readBits=function(e){32-this.bit_pos_>>this.bit_pos_&i[e];return this.bit_pos_+=e,t},t.exports=o},{}],2:[function(e,t,n){n.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,n){var r=e("./streams").BrotliInput,a=e("./streams").BrotliOutput,s=e("./bit_reader"),i=e("./dictionary"),o=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),m=8,p=16,h=256,f=704,g=26,y=6,v=2,_=8,b=255,E=1080,w=18,S=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),x=16,C=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),k=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),T=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function P(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function I(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<1&&0===s)throw new Error("Invalid size byte");a.meta_block_length|=s<<8*r}}else for(r=0;r4&&0===i)throw new Error("Invalid size nibble");a.meta_block_length|=i<<4*r}return++a.meta_block_length,a.input_end||a.is_metadata||(a.is_uncompressed=e.readBits(1)),a}function O(e,t,n){var r;return n.fillBitWindow(),(r=e[t+=n.val_>>>n.bit_pos_&b].bits-_)>0&&(n.bit_pos_+=_,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<0;){var f,g=0;if(r.readMoreInput(),r.fillBitWindow(),g+=r.val_>>>r.bit_pos_&31,r.bit_pos_+=d[g].bits,(f=255&d[g].value)>f);else{var y,v,_=f-14,b=0;if(f===p&&(b=s),c!==b&&(i=0,c=b),y=i,i>0&&(i-=2,i<<=_),a+(v=(i+=r.readBits(_)+3)-y)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var E=0;E0;++p){var v,b=S[p],E=0;r.fillBitWindow(),E+=r.val_>>>r.bit_pos_&15,r.bit_pos_+=y[E].bits,v=y[E].value,h[b]=v,0!==v&&(f-=32>>v,++g)}if(1!==g&&0!==f)throw new Error("[ReadHuffmanCode] invalid num_codes or space");N(h,e,i,r)}if(0===(s=l(t,n,_,i,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return s}function R(e,t,n){var r,a;return r=O(e,t,n),a=u.kBlockLengthPrefixCode[r].nbits,u.kBlockLengthPrefixCode[r].offset+n.readBits(a)}function D(e,t,n){var r;return e>>5]),this.htrees=new Uint32Array(t)}function z(e,t){var n,r,a={num_htrees:null,context_map:null},s=0;t.readMoreInput();var i=a.num_htrees=I(t)+1,l=a.context_map=new Uint8Array(e);if(i<=1)return a;for(t.readBits(1)&&(s=t.readBits(4)+1),n=[],r=0;r=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[r]=0,++r}else l[r]=c-s,++r}return t.readBits(1)&&L(l,e),a}function H(e,t,n,r,a,s,i){var o,l=2*n,c=n,u=O(t,n*E,i);(o=0===u?a[l+(1&s[c])]:1===u?a[l+(s[c]-1&1)]+1:u-2)>=e&&(o-=e),r[n]=o,a[l+(1&s[c])]=o,++s[c]}function G(e,t,n,r,a,i){var o,l=a+1,c=n&a,u=i.pos_&s.IBUF_MASK;if(t<8||i.bit_pos_+(t<<3)0;)i.readMoreInput(),r[c++]=i.readBits(8),c===l&&(e.write(r,l),c=0);else{if(i.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;i.bit_pos_<32;)r[c]=i.val_>>>i.bit_pos_,i.bit_pos_+=8,++c,--t;if(u+(o=i.bit_end_pos_-i.bit_pos_>>3)>s.IBUF_MASK){for(var d=s.IBUF_MASK+1-u,m=0;m=l)for(e.write(r,l),c-=l,m=0;m=l;){if(o=l-c,i.input_.read(r,c,o)t.buffer.length){var ve=new Uint8Array(S+ne);ve.set(t.buffer),t.buffer=ve}if(C=ye.input_end,q=ye.is_uncompressed,ye.is_metadata)for(U(w);ne>0;--ne)w.readMoreInput(),w.readBits(8);else if(0!==ne)if(q)w.bit_pos_=w.bit_pos_+7&-8,G(t,ne,S,m,l,w),S+=ne;else{for(n=0;n<3;++n)se[n]=I(w)+1,se[n]>=2&&(F(se[n]+2,_,n*E,w),F(g,b,n*E,w),re[n]=R(b,n*E,w),oe[n]=1);for(w.readMoreInput(),X=(1<<(Y=w.readBits(2)))-1,J=(K=x+(w.readBits(4)<0;){var Ee,we,Se,xe,Ce,ke,Te,Pe,Ie,Me,Ae,Oe;for(w.readMoreInput(),0===re[1]&&(H(se[1],_,1,ae,ie,oe,w),re[1]=R(b,E,w),te=W[1].htrees[ae[1]]),--re[1],(we=(Ee=O(W[1].codes,te,w))>>6)>=2?(we-=2,Te=-1):Te=0,Se=u.kInsertRangeLut[we]+(Ee>>3&7),xe=u.kCopyRangeLut[we]+(7&Ee),Ce=u.kInsertLengthPrefixCode[Se].offset+w.readBits(u.kInsertLengthPrefixCode[Se].nbits),ke=u.kCopyLengthPrefixCode[xe].offset+w.readBits(u.kCopyLengthPrefixCode[xe].nbits),V=m[S-1&l],L=m[S-2&l],Ie=0;Ie4?3:ke-2))],(Te=O(W[2].codes,W[2].htrees[he],w))>=K&&(Oe=(Te-=K)&X,Te=K+((Ne=(2+(1&(Te>>=Y))<<(Ae=1+(Te>>1)))-4)+w.readBits(Ae)<(T=S=i.minDictionaryWordLength&&ke<=i.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);var Ne=i.offsetsByLength[ke],Fe=Pe-T-1,Re=i.sizeBitsByLength[ke],De=Fe>>Re;if(Ne+=(Fe&(1<=p){t.write(m,a);for(var Le=0;Le0&&(M[3&N]=Pe,++N),ke>ne)throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+ne);for(Ie=0;Ie>=1;return(e&n-1)+n}function i(e,t,n,a,s){do{e[t+(a-=n)]=new r(s.bits,s.value)}while(a>0)}function o(e,t,n){for(var r=1<0;--E[u])i(e,t+m,p,y,new r(255&u,65535&_[d++])),m=s(m,u);for(f=v-1,h=-1,u=n+1,p=2;u<=a;++u,p<<=1)for(;E[u]>0;--E[u])(m&f)!==h&&(t+=y,v+=y=1<<(g=o(E,u,n)),e[b+(h=m&f)]=new r(g+n&255,t-b-h&65535)),i(e,t+(m>>n),p,y,new r(u-n&255,65535&_[d++])),m=s(m,u);return v}},{}],8:[function(e,t,n){"use strict";n.byteLength=u,n.toByteArray=m,n.fromByteArray=f;for(var r=[],a=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=i.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function d(e,t,n){return 3*(t+n)/4-n}function m(e){for(var t,n=c(e),r=n[0],i=n[1],o=new s(d(e,r,i)),l=0,u=i>0?r-4:r,m=0;m>16&255,o[l++]=t>>8&255,o[l++]=255&t;return 2===i&&(t=a[e.charCodeAt(m)]<<2|a[e.charCodeAt(m+1)]>>4,o[l++]=255&t),1===i&&(t=a[e.charCodeAt(m)]<<10|a[e.charCodeAt(m+1)]<<4|a[e.charCodeAt(m+2)]>>2,o[l++]=t>>8&255,o[l++]=255&t),o}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function h(e,t,n){for(var r,a=[],s=t;sl?l:o+i));return 1===a?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===a&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],9:[function(e,t,n){function r(e,t){this.offset=e,this.nbits=t}n.kBlockLengthPrefixCode=[new r(1,2),new r(5,2),new r(9,2),new r(13,2),new r(17,3),new r(25,3),new r(33,3),new r(41,3),new r(49,4),new r(65,4),new r(81,4),new r(97,4),new r(113,5),new r(145,5),new r(177,5),new r(209,5),new r(241,6),new r(305,6),new r(369,7),new r(497,8),new r(753,9),new r(1265,10),new r(2289,11),new r(4337,12),new r(8433,13),new r(16625,24)],n.kInsertLengthPrefixCode=[new r(0,0),new r(1,0),new r(2,0),new r(3,0),new r(4,0),new r(5,0),new r(6,1),new r(8,1),new r(10,2),new r(14,2),new r(18,3),new r(26,3),new r(34,4),new r(50,4),new r(66,5),new r(98,5),new r(130,6),new r(194,7),new r(322,8),new r(578,9),new r(1090,10),new r(2114,12),new r(6210,14),new r(22594,24)],n.kCopyLengthPrefixCode=[new r(2,0),new r(3,0),new r(4,0),new r(5,0),new r(6,0),new r(7,0),new r(8,0),new r(9,0),new r(10,1),new r(12,1),new r(14,2),new r(18,2),new r(22,3),new r(30,3),new r(38,4),new r(54,4),new r(70,5),new r(102,5),new r(134,6),new r(198,7),new r(326,8),new r(582,9),new r(1094,10),new r(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 r(e){this.buffer=e,this.pos=0}function a(e){this.buffer=e,this.pos=0}r.prototype.read=function(e,t,n){this.pos+n>this.buffer.length&&(n=this.buffer.length-this.pos);for(var r=0;rthis.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=a},{}],11:[function(e,t,n){var r=e("./dictionary"),a=0,s=1,i=2,o=3,l=4,c=5,u=6,d=7,m=8,p=9,h=10,f=11,g=12,y=13,v=14,_=15,b=16,E=17,w=18,S=20;function x(e,t,n){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(n.length);for(var r=0;r'),new x("",a,"\n"),new x("",o,""),new x("",a,"]"),new x("",a," for "),new x("",v,""),new x("",i,""),new x("",a," a "),new x("",a," that "),new x(" ",h,""),new x("",a,". "),new x(".",a,""),new x(" ",a,", "),new x("",_,""),new x("",a," with "),new x("",a,"'"),new x("",a," from "),new x("",a," by "),new x("",b,""),new x("",E,""),new x(" the ",a,""),new x("",l,""),new x("",a,". The "),new x("",f,""),new x("",a," on "),new x("",a," as "),new x("",a," is "),new x("",d,""),new x("",s,"ing "),new x("",a,"\n\t"),new x("",a,":"),new x(" ",a,". "),new x("",a,"ed "),new x("",S,""),new x("",w,""),new x("",u,""),new x("",a,"("),new x("",h,", "),new x("",m,""),new x("",a," at "),new x("",a,"ly "),new x(" the ",a," of "),new x("",c,""),new x("",p,""),new x(" ",h,", "),new x("",h,'"'),new x(".",a,"("),new x("",f," "),new x("",h,'">'),new x("",a,'="'),new x(" ",a,"."),new x(".com/",a,""),new x(" the ",a," of the "),new x("",h,"'"),new x("",a,". This "),new x("",a,","),new x(".",a," "),new x("",h,"("),new x("",h,"."),new x("",a," not "),new x(" ",a,'="'),new x("",a,"er "),new x(" ",f," "),new x("",a,"al "),new x(" ",f,""),new x("",a,"='"),new x("",f,'"'),new x("",h,". "),new x(" ",a,"("),new x("",a,"ful "),new x(" ",h,". "),new x("",a,"ive "),new x("",a,"less "),new x("",f,"'"),new x("",a,"est "),new x(" ",h,"."),new x("",f,'">'),new x(" ",a,"='"),new x("",h,","),new x("",a,"ize "),new x("",f,"."),new x(" ",a,""),new x(" ",a,","),new x("",h,'="'),new x("",f,'="'),new x("",a,"ous "),new x("",f,", "),new x("",h,"='"),new x(" ",h,","),new x(" ",f,'="'),new x(" ",f,", "),new x("",f,","),new x("",f,"("),new x("",f,". "),new x(" ",f,"."),new x("",f,"='"),new x(" ",f,". "),new x(" ",h,'="'),new x(" ",f,"='"),new x(" ",h,"='")];function k(e,t){return e[t]<192?(e[t]>=97&&e[t]<=122&&(e[t]^=32),1):e[t]<224?(e[t+1]^=32,2):(e[t+2]^=5,3)}n.kTransforms=C,n.kNumTransforms=C.length,n.transformDictionaryWord=function(e,t,n,a,s){var i,o=C[s].prefix,l=C[s].suffix,c=C[s].transform,u=ca&&(u=a);for(var y=0;y0;){var v=k(e,i);i+=v,a-=v}for(var _=0;_-1},get:function(e){return r[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),r.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),r.splice(t,1))}}),s=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){s=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!a.has(e)){var t=null,n=null,r=null,i=function(){e.clientWidth!==n&&m()},o=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",m,!1),e.removeEventListener("keyup",m,!1),e.removeEventListener("autosize:destroy",o,!1),e.removeEventListener("autosize:update",m,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),a.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",o,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",m,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",m,!1),e.addEventListener("autosize:update",m,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",a.set(e,{destroy:o,update:m}),l()}function l(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),m()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var r=u(e),a=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,r.forEach((function(e){e.node.scrollTop=e.scrollTop})),a&&(document.documentElement.scrollTop=a)}}function m(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),a="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(a{var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t{e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function a(e,t,n){return e.concat(t).map((function(e){return r(e,n)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function o(e,t,n){var a={};return n.isMergeableObject(e)&&s(e).forEach((function(t){a[t]=r(e[t],n)})),s(t).forEach((function(s){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(i(e,s)&&n.isMergeableObject(t[s])?a[s]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(s,n)(e[s],t[s],n):a[s]=r(t[s],n))})),a}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||a,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=r;var i=Array.isArray(n);return i===Array.isArray(e)?i?s.arrayMerge(e,n,s):o(e,n,s):r(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},461:(e,t,n)=>{var r=n(6109);e.exports=function(e){var t=r(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var a=e.style.lineHeight;e.style.lineHeight=t+"em",t=r(e,"line-height"),n=parseFloat(t,10),a?e.style.lineHeight=a:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var s=e.nodeName,i=document.createElement(s);i.innerHTML=" ","TEXTAREA"===s.toUpperCase()&&i.setAttribute("rows","1");var o=r(e,"font-size");i.style.fontSize=o,i.style.padding="0px",i.style.border="0px";var l=document.body;l.appendChild(i),n=i.offsetHeight,l.removeChild(i)}return n}},628:(e,t,n)=>{"use strict";var r=n(4067);function a(){}function s(){}s.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,s,i){if(i!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:a};return n.PropTypes=n,n}},5826:(e,t,n)=>{e.exports=n(628)()},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4462:function(e,t,n){"use strict";var r,a=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n{"use strict";var r=n(4462);t.A=r.TextareaAutosize},3394:(e,t,n)=>{"use strict";var r=n(1609),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function c(e,t,n){var r,s={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,r)&&!l.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:a,type:e,key:c,ref:u,props:s,_owner:o.current}}t.jsx=c},4922:(e,t,n)=>{"use strict";e.exports=n(3394)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),r=new RegExp(n,"g"),a=new RegExp(n,"");function s(e){return t[e]}var i=function(e){return e.replace(r,s)};e.exports=i,e.exports.has=function(e){return!!e.match(a)},e.exports.remove=i},8477:(e,t,n)=>{"use strict"; /** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var r=n(1609);var a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useState,i=r.useEffect,o=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!a(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(),r=s({inst:{value:n,getSnapshot:t}}),a=r[0].inst,u=r[1];return o((function(){a.value=n,a.getSnapshot=t,c(a)&&u({inst:a})}),[e,n,t]),i((function(){return c(a)&&u({inst:a}),e((function(){c(a)&&u({inst:a})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},422:(e,t,n)=>{"use strict";e.exports=n(8477)},1609:e=>{"use strict";e.exports=window.React}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={exports:{}};return n[e].call(s.exports,s,s.exports,a),s.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var s=Object.create(null);a.r(s);var i={};e=e||[null,t({}),t([]),t(t)];for(var o=2&r&&n;"object"==typeof o&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach((e=>i[e]=()=>n[e]));return i.default=()=>n,a.d(s,i),s},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};(()=>{"use strict";a.r(s),a.d(s,{PluginMoreMenuItem:()=>Mx,PluginSidebar:()=>Px,PluginSidebarMoreMenuItem:()=>Ix,PluginTemplateSettingPanel:()=>fv,initializeEditor:()=>Ax,reinitializeEditor:()=>Ox,store:()=>tr});var e={};a.r(e),a.d(e,{closeModal:()=>L,disableComplementaryArea:()=>A,enableComplementaryArea:()=>M,openModal:()=>V,pinItem:()=>O,setDefaultComplementaryArea:()=>I,setFeatureDefaults:()=>D,setFeatureValue:()=>R,toggleFeature:()=>F,unpinItem:()=>N});var t={};a.r(t),a.d(t,{getActiveComplementaryArea:()=>B,isComplementaryAreaLoading:()=>z,isFeatureActive:()=>G,isItemPinned:()=>H,isModalActive:()=>U});var n={};a.r(n),a.d(n,{removeTemplates:()=>rn,setCanvasMode:()=>tn,setEditorCanvasContainerView:()=>nn});var r={};a.r(r),a.d(r,{__experimentalSetPreviewDeviceType:()=>sn,addTemplate:()=>ln,closeGeneralSidebar:()=>Cn,openGeneralSidebar:()=>xn,openNavigationPanelToMenu:()=>yn,removeTemplate:()=>cn,revertTemplate:()=>Sn,setEditedEntity:()=>mn,setEditedPostContext:()=>hn,setHasPageContentFocus:()=>Tn,setHomeTemplateId:()=>pn,setIsInserterOpened:()=>_n,setIsListViewOpened:()=>bn,setIsNavigationPanelOpened:()=>vn,setIsSaveViewOpened:()=>wn,setNavigationMenu:()=>dn,setNavigationPanelActiveMenu:()=>gn,setPage:()=>fn,setTemplate:()=>on,setTemplatePart:()=>un,switchEditorMode:()=>kn,toggleDistractionFree:()=>Pn,toggleFeature:()=>an,updateSettings:()=>En});var i={};a.r(i),a.d(i,{__experimentalGetInsertionPoint:()=>Gn,__experimentalGetPreviewDeviceType:()=>On,getCanUserCreateMedia:()=>Nn,getCurrentTemplateNavigationPanelSubMenu:()=>qn,getCurrentTemplateTemplateParts:()=>jn,getEditedPostContext:()=>Bn,getEditedPostId:()=>Ln,getEditedPostType:()=>Vn,getEditorMode:()=>Zn,getHomeTemplateId:()=>Dn,getNavigationPanelActiveMenu:()=>Yn,getPage:()=>zn,getReusableBlocks:()=>Fn,getSettings:()=>Rn,hasPageContentFocus:()=>Jn,isFeatureActive:()=>An,isInserterOpened:()=>Hn,isListViewOpened:()=>Un,isNavigationOpened:()=>Kn,isPage:()=>Xn,isSaveViewOpened:()=>Wn});var o={};a.r(o),a.d(o,{getCanvasMode:()=>Qn,getEditorCanvasContainerView:()=>$n});var l=a(1609),c=a.t(l,2);const u=window.wp.blocks,d=window.wp.blockLibrary,m=window.wp.data,h=window.wp.deprecated;var f=a.n(h);const g=window.wp.element,y=window.wp.editor;var v=a(5755),_=a.n(v);const b=window.wp.components,E=window.wp.i18n,w=window.wp.primitives,S=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),x=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})),C=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),k=window.wp.viewport,T=window.wp.preferences,P=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),I=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),M=(e,t)=>({registry:n,dispatch:r})=>{if(!t)return;n.select(T.store).get(e,"isComplementaryAreaVisible")||n.dispatch(T.store).set(e,"isComplementaryAreaVisible",!0),r({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},A=e=>({registry:t})=>{t.select(T.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(T.store).set(e,"isComplementaryAreaVisible",!1)},O=(e,t)=>({registry:n})=>{if(!t)return;const r=n.select(T.store).get(e,"pinnedItems");!0!==r?.[t]&&n.dispatch(T.store).set(e,"pinnedItems",{...r,[t]:!0})},N=(e,t)=>({registry:n})=>{if(!t)return;const r=n.select(T.store).get(e,"pinnedItems");n.dispatch(T.store).set(e,"pinnedItems",{...r,[t]:!1})};function F(e,t){return function({registry:n}){f()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(T.store).toggle(e,t)}}function R(e,t,n){return function({registry:r}){f()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),r.dispatch(T.store).set(e,t,!!n)}}function D(e,t){return function({registry:n}){f()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(T.store).setDefaults(e,t)}}function V(e){return{type:"OPEN_MODAL",name:e}}function L(){return{type:"CLOSE_MODAL"}}const B=(0,m.createRegistrySelector)((e=>(t,n)=>{const r=e(T.store).get(n,"isComplementaryAreaVisible");if(void 0!==r)return!1===r?null:t?.complementaryAreas?.[n]})),z=(0,m.createRegistrySelector)((e=>(t,n)=>{const r=e(T.store).get(n,"isComplementaryAreaVisible"),a=t?.complementaryAreas?.[n];return r&&void 0===a})),H=(0,m.createRegistrySelector)((e=>(t,n,r)=>{var a;const s=e(T.store).get(n,"pinnedItems");return null===(a=s?.[r])||void 0===a||a})),G=(0,m.createRegistrySelector)((e=>(t,n,r)=>(f()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(T.store).get(n,r))));function U(e,t){return e.activeModal===t}const W=(0,m.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:r}=t;return e[n]?e:{...e,[n]:r}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:r}=t;return{...e,[n]:r}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),j=(0,m.createReduxStore)("core/interface",{reducer:W,actions:e,selectors:t});(0,m.register)(j);const Z=window.wp.plugins,q=(0,Z.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));const Y=q((function({as:e=b.Button,scope:t,identifier:n,icon:r,selectedIcon:a,name:s,...i}){const o=e,c=(0,m.useSelect)((e=>e(j).getActiveComplementaryArea(t)===n),[n,t]),{enableComplementaryArea:u,disableComplementaryArea:d}=(0,m.useDispatch)(j);return(0,l.createElement)(o,{icon:a&&c?a:r,"aria-controls":n.replace("/",":"),onClick:()=>{c?d(t):u(t,n)},...i})})),K=({smallScreenTitle:e,children:t,className:n,toggleButtonProps:r})=>{const a=(0,l.createElement)(Y,{icon:P,...r});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,l.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),a),(0,l.createElement)("div",{className:_()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},t,a))},X=()=>{};function J({name:e,as:t=b.Button,onClick:n,...r}){return(0,l.createElement)(b.Fill,{name:e},(({onClick:e})=>(0,l.createElement)(t,{onClick:n||e?(...t)=>{(n||X)(...t),(e||X)(...t)}:void 0,...r})))}J.Slot=function({name:e,as:t=b.ButtonGroup,fillProps:n={},bubblesVirtually:r,...a}){return(0,l.createElement)(b.Slot,{name:e,bubblesVirtually:r,fillProps:n},(e=>{if(!g.Children.toArray(e).length)return null;const n=[];g.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&n.push(t)}));const r=g.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&n.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(t,{...a},r)}))};const Q=J,$=({__unstableExplicitMenuItem:e,__unstableTarget:t,...n})=>(0,l.createElement)(b.MenuItem,{...n});function ee({scope:e,target:t,__unstableExplicitMenuItem:n,...r}){return(0,l.createElement)(Y,{as:r=>(0,l.createElement)(Q,{__unstableExplicitMenuItem:n,__unstableTarget:`${e}/${t}`,as:$,name:`${e}/plugin-more-menu`,...r}),role:"menuitemcheckbox",selectedIcon:S,name:t,scope:e,...r})}function te({scope:e,...t}){return(0,l.createElement)(b.Fill,{name:`PinnedItems/${e}`,...t})}te.Slot=function({scope:e,className:t,...n}){return(0,l.createElement)(b.Slot,{name:`PinnedItems/${e}`,...n},(e=>e?.length>0&&(0,l.createElement)("div",{className:_()(t,"interface-pinned-items")},e)))};const ne=te;function re({scope:e,children:t,className:n,id:r}){return(0,l.createElement)(b.Fill,{name:`ComplementaryArea/${e}`},(0,l.createElement)("div",{id:r,className:n},t))}const ae=q((function({children:e,className:t,closeLabel:n=(0,E.__)("Close plugin"),identifier:r,header:a,headerClassName:s,icon:i,isPinnable:o=!0,panelClassName:c,scope:u,name:d,smallScreenTitle:p,title:h,toggleShortcut:f,isActiveByDefault:y}){const{isLoading:v,isActive:w,isPinned:P,activeArea:I,isSmall:M,isLarge:A,showIconLabels:O}=(0,m.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:n,isItemPinned:a}=e(j),{get:s}=e(T.store),i=t(u);return{isLoading:n(u),isActive:i===r,isPinned:a(u,r),activeArea:i,isSmall:e(k.store).isViewportMatch("< medium"),isLarge:e(k.store).isViewportMatch("large"),showIconLabels:s("core","showIconLabels")}}),[r,u]);!function(e,t,n,r,a){const s=(0,g.useRef)(!1),i=(0,g.useRef)(!1),{enableComplementaryArea:o,disableComplementaryArea:l}=(0,m.useDispatch)(j);(0,g.useEffect)((()=>{r&&a&&!s.current?(l(e),i.current=!0):i.current&&!a&&s.current?(i.current=!1,o(e,t)):i.current&&n&&n!==t&&(i.current=!1),a!==s.current&&(s.current=a)}),[r,a,e,t,n,l,o])}(u,r,I,w,M);const{enableComplementaryArea:N,disableComplementaryArea:F,pinItem:R,unpinItem:D}=(0,m.useDispatch)(j);return(0,g.useEffect)((()=>{y&&void 0===I&&!M?N(u,r):void 0===I&&M&&F(u,r)}),[I,y,u,r,M,N,F]),(0,l.createElement)(l.Fragment,null,o&&(0,l.createElement)(ne,{scope:u},P&&(0,l.createElement)(Y,{scope:u,identifier:r,isPressed:w&&(!O||A),"aria-expanded":w,"aria-disabled":v,label:h,icon:O?S:i,showTooltip:!O,variant:O?"tertiary":void 0,size:"compact"})),d&&o&&(0,l.createElement)(ee,{target:d,scope:u,icon:i},h),w&&(0,l.createElement)(re,{className:_()("interface-complementary-area",t),scope:u,id:r.replace("/",":")},(0,l.createElement)(K,{className:s,closeLabel:n,onClose:()=>F(u),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:f,scope:u,identifier:r}},a||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,h),o&&(0,l.createElement)(b.Button,{className:"interface-complementary-area__pin-unpin-item",icon:P?x:C,label:P?(0,E.__)("Unpin from toolbar"):(0,E.__)("Pin to toolbar"),onClick:()=>(P?D:R)(u,r),isPressed:P,"aria-expanded":P}))),(0,l.createElement)(b.Panel,{className:c},e)))}));ae.Slot=function({scope:e,...t}){return(0,l.createElement)(b.Slot,{name:`ComplementaryArea/${e}`,...t})};const se=ae,ie=window.wp.compose;function oe({children:e,className:t,ariaLabel:n,as:r="div",...a}){return(0,l.createElement)(r,{className:_()("interface-navigable-region",t),"aria-label":n,role:"region",tabIndex:"-1",...a},e)}const le={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};const ce=(0,g.forwardRef)((function({isDistractionFree:e,footer:t,header:n,editorNotices:r,sidebar:a,secondarySidebar:s,notices:i,content:o,actions:c,labels:u,className:d,enableRegionNavigation:m=!0,shortcuts:p},h){const f=(0,b.__unstableUseNavigateRegions)(p);!function(e){(0,g.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const y={...{header:(0,E._x)("Header","header landmark area"),body:(0,E.__)("Content"),secondarySidebar:(0,E.__)("Block Library"),sidebar:(0,E.__)("Settings"),actions:(0,E.__)("Publish"),footer:(0,E.__)("Footer")},...u};return(0,l.createElement)("div",{...m?f:{},ref:(0,ie.useMergeRefs)([h,m?f.ref:void 0]),className:_()(d,"interface-interface-skeleton",f.className,!!t&&"has-footer")},(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!n&&(0,l.createElement)(oe,{as:b.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":y.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:le,transition:e?{type:"tween",delay:.8}:void 0},n),e&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},r),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!s&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:y.secondarySidebar},s),!!i&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},i),(0,l.createElement)(oe,{className:"interface-interface-skeleton__content",ariaLabel:y.body},o),!!a&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__sidebar",ariaLabel:y.sidebar},a),!!c&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__actions",ariaLabel:y.actions},c))),!!t&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__footer",ariaLabel:y.footer},t))})),ue=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function de({as:e=b.DropdownMenu,className:t,label:n=(0,E.__)("Options"),popoverProps:r,toggleProps:a,children:s}){return(0,l.createElement)(e,{className:_()("interface-more-menu-dropdown",t),icon:ue,label:n,popoverProps:{placement:"bottom-end",...r,className:_()("interface-more-menu-dropdown__content",r?.className)},toggleProps:{tooltipPosition:"bottom",...a,size:"compact"}},(e=>s(e)))}const me=window.wp.widgets,pe=window.wp.hooks,he=window.wp.mediaUtils;(0,pe.addFilter)("editor.MediaUpload","core/edit-site/components/media-upload",(()=>he.MediaUpload));const fe=window.wp.blockEditor,ge=window.wp.notices,ye=window.wp.coreData;var ve={grad:.9,turn:360,rad:360/(2*Math.PI)},_e=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},be=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Ee=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},we=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Se=function(e){return{r:Ee(e.r,0,255),g:Ee(e.g,0,255),b:Ee(e.b,0,255),a:Ee(e.a)}},xe=function(e){return{r:be(e.r),g:be(e.g),b:be(e.b),a:be(e.a,3)}},Ce=/^#([0-9a-f]{3,8})$/i,ke=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Te=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),o=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:60*(o<0?o+6:o),s:s?i/s*100:0,v:s/255*100,a}},Pe=function(e){var t=e.h,n=e.s,r=e.v,a=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),o=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),c=s%6;return{r:255*[r,o,i,i,l,r][c],g:255*[l,r,r,o,i,i][c],b:255*[i,i,l,r,r,o][c],a}},Ie=function(e){return{h:we(e.h),s:Ee(e.s,0,100),l:Ee(e.l,0,100),a:Ee(e.a)}},Me=function(e){return{h:be(e.h),s:be(e.s),l:be(e.l),a:be(e.a,3)}},Ae=function(e){return Pe((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Oe=function(e){return{h:(t=Te(e)).h,s:(a=(200-(n=t.s))*(r=t.v)/100)>0&&a<200?n*r/100/(a<=100?a:200-a)*100:0,l:a/2,a:t.a};var t,n,r,a},Ne=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Re=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ve={string:[[function(e){var t=Ce.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?be(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?be(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Re.exec(e)||De.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Se({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Ne.exec(e)||Fe.exec(e);if(!t)return null;var n,r,a=Ie({h:(n=t[1],r=t[2],void 0===r&&(r="deg"),Number(n)*(ve[r]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Ae(a)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,a=e.a,s=void 0===a?1:a;return _e(t)&&_e(n)&&_e(r)?Se({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,a=e.a,s=void 0===a?1:a;if(!_e(t)||!_e(n)||!_e(r))return null;var i=Ie({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return Ae(i)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,a=e.a,s=void 0===a?1:a;if(!_e(t)||!_e(n)||!_e(r))return null;var i=function(e){return{h:we(e.h),s:Ee(e.s,0,100),v:Ee(e.v,0,100),a:Ee(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return Pe(i)},"hsv"]]},Le=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=xe(this.rgba)).r,n=e.g,r=e.b,s=(a=e.a)<1?ke(be(255*a)):"","#"+ke(t)+ke(n)+ke(r)+s;var e,t,n,r,a,s},e.prototype.toRgb=function(){return xe(this.rgba)},e.prototype.toRgbString=function(){return t=(e=xe(this.rgba)).r,n=e.g,r=e.b,(a=e.a)<1?"rgba("+t+", "+n+", "+r+", "+a+")":"rgb("+t+", "+n+", "+r+")";var e,t,n,r,a},e.prototype.toHsl=function(){return Me(Oe(this.rgba))},e.prototype.toHslString=function(){return t=(e=Me(Oe(this.rgba))).h,n=e.s,r=e.l,(a=e.a)<1?"hsla("+t+", "+n+"%, "+r+"%, "+a+")":"hsl("+t+", "+n+"%, "+r+"%)";var e,t,n,r,a},e.prototype.toHsv=function(){return e=Te(this.rgba),{h:be(e.h),s:be(e.s),v:be(e.v),a:be(e.a,3)};var e},e.prototype.invert=function(){return We({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),We(ze(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),We(ze(this.rgba,-e))},e.prototype.grayscale=function(){return We(ze(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),We(Ge(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),We(Ge(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?We({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):be(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Oe(this.rgba);return"number"==typeof e?We({h:e,s:t.s,l:t.l,a:t.a}):be(t.h)},e.prototype.isEqual=function(e){return this.toHex()===We(e).toHex()},e}(),We=function(e){return e instanceof Ue?e:new Ue(e)},je=[],Ze=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},qe=function(e){return.2126*Ze(e.r)+.7152*Ze(e.g)+.0722*Ze(e.b)};const Ye=window.wp.privateApis,{lock:Ke,unlock:Xe}=(0,Ye.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/edit-site"),{useGlobalSetting:Je,useGlobalStyle:Qe}=Xe(fe.privateApis);function $e(){const[e="black"]=Qe("color.text"),[t="white"]=Qe("color.background"),[n=e]=Qe("elements.h1.color.text"),[r]=Je("color.palette.core"),[a]=Je("color.palette.theme"),[s]=Je("color.palette.custom"),i=(null!=a?a:[]).concat(null!=s?s:[]).concat(null!=r?r:[]),o=i.filter((({color:e})=>e!==t&&e!==n)).slice(0,2);return{paletteColors:i,highlightedColors:o}}!function(e){e.forEach((function(e){je.indexOf(e)<0&&(e(Ue,Ve),je.push(e))}))}([function(e){e.prototype.luminance=function(){return e=qe(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,r,a,s,i,o,l,c=t instanceof e?t:new e(t);return s=this.rgba,i=c.toRgb(),n=(o=qe(s))>(l=qe(i))?(o+.05)/(l+.05):(l+.05)/(o+.05),void 0===(r=2)&&(r=0),void 0===a&&(a=Math.pow(10,r)),Math.floor(a*n)/a+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(s=(n=t).size)?"normal":s,"AAA"===(a=void 0===(r=n.level)?"AA":r)&&"normal"===i?7:"AA"===a&&"large"===i?3:4.5);var n,r,a,s,i}}]);const{cleanEmptyObject:et,GlobalStylesContext:tt}=Xe(fe.privateApis),nt={...u.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},rt={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},at={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},st=["border","color","spacing","typography"],it=(e,t)=>{let n=e;return t.forEach((e=>{n=n?.[e]})),n},ot=["borderColor","borderWidth","borderStyle"],lt=["top","right","bottom","left"];function ct(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:r,style:a,width:s}=t[e];return!(r||s)||a?[]:[{path:["border",e,"style"],value:"solid"}]}function ut(e,t,n){const r=function(e,t){const{supportedPanels:n}=(0,m.useSelect)((n=>({supportedPanels:Xe(n(u.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),a=n?.styles?.blocks?.[e];return(0,g.useMemo)((()=>{const e=r.flatMap((e=>{if(!nt[e])return[];const{value:n}=nt[e],r=n.join("."),a=t[at[r]],s=a?`var:preset|${rt[r]}|${a}`:it(t.style,n);if("linkColor"===e){const e=s?[{path:n,value:s}]:[],r=["elements","link",":hover","color","text"],a=it(t.style,r);return a&&e.push({path:r,value:a}),e}if(ot.includes(e)&&s){const e=[{path:n,value:s}];return lt.forEach((t=>{const r=[...n];r.splice(-1,0,t),e.push({path:r,value:s})})),e}return s?[{path:n,value:s}]:[]}));return function(e,t,n){if(!e&&!t)return[];const r=[...ct("top",e,n),...ct("right",e,n),...ct("bottom",e,n),...ct("left",e,n)],{color:a,style:s,width:i}=e||{};return(t||a||i)&&!s&<.forEach((e=>{n?.[e]?.style||r.push({path:["border",e,"style"],value:"solid"})})),r}(t.style?.border,t.borderColor,a?.border).forEach((t=>e.push(t))),e}),[r,t,a])}function dt(e,t,n){return e&&"object"==typeof e?(t.reduce(((e,r,a)=>(void 0===e[r]&&(Number.isInteger(t[a+1])?e[r]=[]:e[r]={}),a===t.length-1&&(e[r]=n),e[r])),e),e):e}function mt(e){return e?JSON.parse(JSON.stringify(e)):{}}function pt({name:e,attributes:t,setAttributes:n}){const{user:r,setUserConfig:a}=(0,g.useContext)(tt),s=ut(e,t,r),{__unstableMarkNextChangeAsNotPersistent:i}=(0,m.useDispatch)(fe.store),{createSuccessNotice:o}=(0,m.useDispatch)(ge.store),c=(0,g.useCallback)((()=>{if(0!==s.length&&s.length>0){const{style:l}=t,c=mt(l),d=mt(r);for(const{path:t,value:n}of s)dt(c,t,void 0),dt(d,["styles","blocks",e,...t],n);const m={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:et(c)};i(),n(m),a((()=>d),{undoIgnore:!0}),o((0,E.sprintf)((0,E.__)("%s styles applied."),(0,u.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,E.__)("Undo"),onClick(){i(),n(t),a((()=>r),{undoIgnore:!0})}}]})}}),[i,t,s,o,e,n,a,r]);return(0,l.createElement)(b.BaseControl,{className:"edit-site-push-changes-to-global-styles-control",help:(0,E.sprintf)((0,E.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,u.getBlockType)(e).title)},(0,l.createElement)(b.BaseControl.VisualLabel,null,(0,E.__)("Styles")),(0,l.createElement)(b.Button,{variant:"primary",disabled:0===s.length,onClick:c},(0,E.__)("Apply globally")))}function ht(e){const t=(0,fe.useBlockEditingMode)(),n=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme()?.is_block_theme),[]),r=st.some((t=>(0,u.hasBlockSupport)(e.name,t)));return"default"===t&&r&&n?(0,l.createElement)(fe.InspectorAdvancedControls,null,(0,l.createElement)(pt,{...e})):null}const ft=(0,ie.createHigherOrderComponent)((e=>t=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),t.isSelected&&(0,l.createElement)(ht,{...t}))));(0,pe.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",ft);const gt=window.wp.router,yt=window.wp.url;function vt(){return void 0!==(0,yt.getQueryArg)(window.location.href,"wp_theme_preview")}function _t(){return vt()?(0,yt.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useHistory:bt}=Xe(gt.privateApis);function Et(e,t,n=!1){const r=bt();const a=(0,yt.getQueryArgs)(window.location.href),s=(0,yt.removeQueryArgs)(window.location.href,...Object.keys(a));vt()&&(e={...e,wp_theme_preview:_t()});return{href:(0,yt.addQueryArgs)(s,e),onClick:function(a){a?.preventDefault(),n?r.replace(e,t):r.push(e,t)}}}function wt({params:e={},state:t,replace:n=!1,children:r,...a}){const{href:s,onClick:i}=Et(e,t,n);return(0,l.createElement)("a",{href:s,onClick:i,...a},r)}const St=window.wp.patterns,xt="wp_navigation",Ct="wp_template",kt="wp_template_part",Tt={custom:"custom",theme:"theme",plugin:"plugin"},Pt="uncategorized",{PATTERN_TYPES:It,PATTERN_DEFAULT_CATEGORY:Mt,PATTERN_USER_CATEGORY:At,EXCLUDED_PATTERN_SOURCES:Ot,PATTERN_SYNC_TYPES:Nt}=Xe(St.privateApis),Ft=[kt,xt,It.user],Rt={[Ct]:(0,E.__)("Template"),[kt]:(0,E.__)("Template part"),[It.user]:(0,E.__)("Pattern"),[xt]:(0,E.__)("Navigation")},Dt="grid",Vt="table",Lt="list",Bt="enumeration",zt="in",Ht="notIn",{useLocation:Gt}=Xe(gt.privateApis);function Ut({attributes:e}){const{theme:t,slug:n}=e,{params:r}=Gt(),a=(0,m.useSelect)((e=>{const{getCurrentTheme:r,getEntityRecord:a}=e(ye.store);return a("postType",kt,`${t||r()?.stylesheet}//${n}`)}),[t,n]),s=Et({postId:a?.id,postType:a?.type,canvas:"edit"},{fromTemplateId:r.postId||a?.id});return a?(0,l.createElement)(b.ToolbarButton,{...s,onClick:e=>{s.onClick(e)}},(0,E.__)("Edit")):null}const Wt=(0,ie.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:r}=t,a="core/template-part"===r&&n.slug;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{key:"edit",...t}),a&&(0,l.createElement)(fe.BlockControls,{group:"other"},(0,l.createElement)(Ut,{attributes:n})))}),"withEditBlockControls");(0,pe.addFilter)("editor.BlockEdit","core/edit-site/template-part-edit-button",Wt);const{useLocation:jt}=Xe(gt.privateApis);function Zt({attributes:e}){const{ref:t}=e,{params:n}=jt(),r=(0,fe.useBlockEditingMode)(),a=(0,m.useSelect)((e=>e(ye.store).getEntityRecord("postType",xt,t)),[t]),s=Et({postId:a?.id,postType:a?.type,canvas:"edit"},{fromTemplateId:n.postId||a?.id});return a&&"default"===r?(0,l.createElement)(fe.BlockControls,{group:"other"},(0,l.createElement)(b.ToolbarButton,{...s,onClick:e=>{s.onClick(e)}},(0,E.__)("Edit"))):null}const qt=(0,ie.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:r}=t,a="core/navigation"===r&&n.ref;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),a&&(0,l.createElement)(Zt,{attributes:n}))}),"withEditBlockControls");(0,pe.addFilter)("editor.BlockEdit","core/edit-site/navigation-edit-button",qt);const Yt=(0,m.combineReducers)({settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},saveViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_SAVE_VIEW_OPENED":return t.isOpen;case"SET_CANVAS_MODE":return!1}return e},canvasMode:function(e="init",t){return"SET_CANVAS_MODE"===t.type?t.mode:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e}}),Kt=window.wp.apiFetch;var Xt=a.n(Kt);const Jt=window.wp.a11y,Qt="core/edit-site";function $t(e){return!!e&&(e?.source===Tt.custom&&e?.has_theme_file)}const en=window.wp.htmlEntities,tn=e=>({registry:t,dispatch:n})=>{const r=window.matchMedia("(min-width: 782px)").matches;t.dispatch(fe.store).__unstableSetEditorMode("edit"),n({type:"SET_CANVAS_MODE",mode:e}),r&&"edit"===e&&t.select(T.store).get("core","showListViewByDefault")&&!t.select(T.store).get("core","distractionFree")?t.dispatch(y.store).setIsListViewOpened(!0):t.dispatch(y.store).setIsListViewOpened(!1),t.dispatch(y.store).setIsInserterOpened(!1)},nn=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})},rn=e=>async({registry:t})=>{const n=e[0].type===Ct,r=await Promise.allSettled(e.map((e=>t.dispatch(ye.store).deleteEntityRecord("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(r.every((({status:e})=>"fulfilled"===e))){let r;if(1===e.length){const t="string"==typeof e[0].title?e[0].title:e[0].title?.rendered;r=(0,E.sprintf)((0,E.__)('"%s" deleted.'),(0,en.decodeEntities)(t))}else r=n?(0,E.__)("Templates deleted."):(0,E.__)("Template parts deleted.");t.dispatch(ge.store).createSuccessNotice(r,{type:"snackbar",id:"site-editor-template-deleted-success"})}else{let e;if(1===r.length)e=r[0].reason?.message?r[0].reason.message:n?(0,E.__)("An error occurred while deleting the template."):(0,E.__)("An error occurred while deleting the template part.");else{const t=new Set,a=r.filter((({status:e})=>"rejected"===e));for(const e of a)e.reason?.message&&t.add(e.reason.message);e=0===t.size?n?(0,E.__)("An error occurred while deleting the templates."):(0,E.__)("An error occurred while deleting the template parts."):1===t.size?n?(0,E.sprintf)((0,E.__)("An error occurred while deleting the templates: %s"),[...t][0]):(0,E.sprintf)((0,E.__)("An error occurred while deleting the template parts: %s"),[...t][0]):n?(0,E.sprintf)((0,E.__)("Some errors occurred while deleting the templates: %s"),[...t].join(",")):(0,E.sprintf)((0,E.__)("Some errors occurred while deleting the template parts: %s"),[...t].join(","))}t.dispatch(ge.store).createErrorNotice(e,{type:"snackbar"})}};function an(e){return function({registry:t}){f()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(T.store).toggle("core/edit-site",e)}}const sn=e=>({registry:t})=>{f()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(y.store).setDeviceType(e)};function on(){return f()("dispatch( 'core/edit-site' ).setTemplate",{since:"6.5",version:"6.8",hint:"The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}const ln=e=>async({dispatch:t,registry:n})=>{f()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const r=await n.dispatch(ye.store).saveEntityRecord("postType",Ct,e);e.content&&n.dispatch(ye.store).editEntityRecord("postType",Ct,r.id,{blocks:(0,u.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Ct,id:r.id})},cn=e=>rn([e]);function un(e){return{type:"SET_EDITED_POST",postType:kt,id:e}}function dn(e){return{type:"SET_EDITED_POST",postType:xt,id:e}}function mn(e,t,n){return{type:"SET_EDITED_POST",postType:e,id:t,context:n}}function pn(){return f()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function hn(e){return{type:"SET_EDITED_POST_CONTEXT",context:e}}function fn(){return f()("dispatch( 'core/edit-site' ).setPage",{since:"6.5",version:"6.8",hint:"The setPage is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}function gn(){return f()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function yn(){return f()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function vn(){return f()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const _n=e=>({registry:t})=>{f()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(y.store).setIsInserterOpened(e)},bn=e=>({registry:t})=>{f()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(y.store).setIsListViewOpened(e)};function En(e){return{type:"UPDATE_SETTINGS",settings:e}}function wn(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const Sn=(e,{allowUndo:t=!0}={})=>async({registry:n})=>{const r="edit-site-template-reverted";if(n.dispatch(ge.store).removeNotice(r),$t(e))try{const a=n.select(ye.store).getEntityConfig("postType",e.type);if(!a)return void n.dispatch(ge.store).createErrorNotice((0,E.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const s=(0,yt.addQueryArgs)(`${a.baseURL}/${e.id}`,{context:"edit",source:"theme"}),i=await Xt()({path:s});if(!i)return void n.dispatch(ge.store).createErrorNotice((0,E.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const o=({blocks:e=[]})=>(0,u.__unstableSerializeAndClean)(e),l=n.select(ye.store).getEditedEntityRecord("postType",e.type,e.id);n.dispatch(ye.store).editEntityRecord("postType",e.type,e.id,{content:o,blocks:l.blocks,source:"custom"},{undoIgnore:!0});const c=(0,u.parse)(i?.content?.raw);if(n.dispatch(ye.store).editEntityRecord("postType",e.type,i.id,{content:o,blocks:c,source:"theme"}),t){const t=()=>{n.dispatch(ye.store).editEntityRecord("postType",e.type,l.id,{content:o,blocks:l.blocks,source:"custom"})};n.dispatch(ge.store).createSuccessNotice((0,E.__)("Template reverted."),{type:"snackbar",id:r,actions:[{label:(0,E.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("Template revert failed. Please reload.");n.dispatch(ge.store).createErrorNotice(t,{type:"snackbar"})}else n.dispatch(ge.store).createErrorNotice((0,E.__)("This template is not revertable."),{type:"snackbar"})},xn=e=>({dispatch:t,registry:n})=>{n.select(T.store).get("core","distractionFree")&&t.toggleDistractionFree(),n.dispatch(j).enableComplementaryArea(Qt,e)},Cn=()=>({registry:e})=>{e.dispatch(j).disableComplementaryArea(Qt)},kn=e=>({dispatch:t,registry:n})=>{if(n.dispatch("core/preferences").set("core","editorMode",e),"visual"!==e&&n.dispatch(fe.store).clearSelectedBlock(),"visual"===e)(0,Jt.speak)((0,E.__)("Visual editor selected"),"assertive");else if("text"===e){n.select(T.store).get("core","distractionFree")&&t.toggleDistractionFree(),(0,Jt.speak)((0,E.__)("Code editor selected"),"assertive")}},Tn=e=>({dispatch:t,registry:n})=>{f()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&n.dispatch(fe.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},Pn=()=>({dispatch:e,registry:t})=>{const n=t.select(T.store).get("core","distractionFree");n&&t.dispatch(T.store).set("core","fixedToolbar",!1),n||t.batch((()=>{t.dispatch(T.store).set("core","fixedToolbar",!0),t.dispatch(y.store).setIsInserterOpened(!1),t.dispatch(y.store).setIsListViewOpened(!1),e.closeGeneralSidebar()})),t.batch((()=>{t.dispatch(T.store).set("core","distractionFree",!n),t.dispatch(ge.store).createInfoNotice(n?(0,E.__)("Distraction free off."):(0,E.__)("Distraction free on."),{id:"core/edit-site/distraction-free-mode/notice",type:"snackbar",actions:[{label:(0,E.__)("Undo"),onClick:()=>{t.batch((()=>{t.dispatch(T.store).set("core","fixedToolbar",!!n),t.dispatch(T.store).toggle("core","distractionFree")}))}}]})}))};const In=[];const Mn=function(e,t){var n,r,a=0;function s(){var s,i,o=n,l=arguments.length;e:for(;o;){if(o.args.length===arguments.length){for(i=0;i({...e,[t.id]:t})),{}):{},r=[],a=[...e];for(;a.length;){const{innerBlocks:e,...t}=a.shift();if(a.unshift(...e),(0,u.isTemplatePart)(t)){const{attributes:{theme:e,slug:a}}=t,s=n[`${e}//${a}`];s&&r.push({templatePart:s,block:t})}}return r})),An=(0,m.createRegistrySelector)((e=>(t,n)=>(f()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(T.store).get("core/edit-site",n)))),On=(0,m.createRegistrySelector)((e=>()=>(f()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(y.store).getDeviceType()))),Nn=(0,m.createRegistrySelector)((e=>()=>e(ye.store).canUser("create","media"))),Fn=(0,m.createRegistrySelector)((e=>()=>{f()("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )",{since:"6.5",version:"6.8"});return"web"===g.Platform.OS?e(ye.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function Rn(e){return e.settings}function Dn(){f()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function Vn(e){return e.editedPost.postType}function Ln(e){return e.editedPost.id}function Bn(e){return e.editedPost.context}function zn(e){return{context:e.editedPost.context}}const Hn=(0,m.createRegistrySelector)((e=>()=>(f()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(y.store).isInserterOpened()))),Gn=(0,m.createRegistrySelector)((e=>()=>(f()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),Xe(e(y.store)).getInsertionPoint()))),Un=(0,m.createRegistrySelector)((e=>()=>(f()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(y.store).isListViewOpened())));function Wn(e){return e.saveViewPanel}const jn=(0,m.createRegistrySelector)((e=>()=>{const t=e(ye.store).getEntityRecords("postType",kt,{per_page:-1}),n=e(fe.store).getBlocksByName("core/template-part"),r=e(fe.store).getBlocksByClientId(n);return Mn(r,t)})),Zn=(0,m.createRegistrySelector)((e=>()=>e(T.store).get("core","editorMode")));function qn(){f()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Yn(){f()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Kn(){f()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Xn(e){return!!e.editedPost.context?.postId}function Jn(){return f()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Qn(e){return e.canvasMode}function $n(e){return e.editorCanvasContainerView}const er={reducer:Yt,actions:r,selectors:i},tr=(0,m.createReduxStore)(Qt,er);(0,m.register)(tr),Xe(tr).registerPrivateSelectors(o),Xe(tr).registerPrivateActions(n);const nr=window.wp.keyboardShortcuts,rr=window.wp.commands,ar=window.wp.coreCommands,sr=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),ir=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),or=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,l.createElement)(w.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"})),lr=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),cr=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),ur=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),dr=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));function mr(e){return(0,l.createElement)(b.Button,{...e,className:_()("edit-site-sidebar-button",e.className)})}const{useLocation:pr}=Xe(gt.privateApis);function hr({isRoot:e,title:t,actions:n,meta:r,content:a,footer:s,description:i,backPath:o}){const{dashboardLink:c,dashboardLinkText:u,previewingThemeName:d}=(0,m.useSelect)((e=>{const{getSettings:t}=Xe(e(tr)),n=_t();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:n?e(ye.store).getTheme(n)?.name?.rendered:void 0}}),[]),p=pr(),h=(0,b.__experimentalUseNavigator)(),f=(0,E.isRTL)()?ur:dr;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalVStack,{className:_()("edit-site-sidebar-navigation-screen__main",{"has-footer":!!s}),spacing:0,justify:"flex-start"},(0,l.createElement)(b.__experimentalHStack,{spacing:4,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon"},!e&&(0,l.createElement)(mr,{onClick:()=>{const e=null!=o?o:p.state?.backPath;e?h.goTo(e,{isBack:!0}):h.goToParent()},icon:f,label:(0,E.__)("Back"),showTooltip:!1}),e&&(0,l.createElement)(mr,{icon:f,label:u||(0,E.__)("Go to the Dashboard"),href:c||"index.php"}),(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20},vt()?(0,E.sprintf)("Previewing %1$s: %2$s",d,t):t),n&&(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__actions"},n)),r&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__meta"},r)),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__content"},i&&(0,l.createElement)("p",{className:"edit-site-sidebar-navigation-screen__description"},i),a)),s&&(0,l.createElement)("footer",{className:"edit-site-sidebar-navigation-screen__footer"},s))}const fr=(0,g.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,g.cloneElement)(e,{width:t,height:t,...n,ref:r})})),gr=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})),yr=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));function vr({className:e,icon:t,withChevron:n=!1,suffix:r,children:a,...s}){return(0,l.createElement)(b.__experimentalItem,{className:_()("edit-site-sidebar-navigation-item",{"with-suffix":!n&&r},e),...s},(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start"},t&&(0,l.createElement)(fr,{style:{fill:"currentcolor"},icon:t,size:24}),(0,l.createElement)(b.FlexBlock,null,a),n&&(0,l.createElement)(fr,{icon:(0,E.isRTL)()?gr:yr,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&r))}const _r=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),br=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),Er=br,wr=window.wp.keycodes;var Sr=a(66),xr=a.n(Sr); /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function Cr(e){return"[object Object]"===Object.prototype.toString.call(e)}function kr(e){var t,n;return!1!==Cr(e)&&(void 0===(t=e.constructor)||!1!==Cr(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}const{GlobalStylesContext:Tr,cleanEmptyObject:Pr}=Xe(fe.privateApis);function Ir(e,t){return xr()(e,t,{isMergeableObject:kr})}function Mr(){const[e,t,n]=function(){const{globalStylesId:e,isReady:t,settings:n,styles:r}=(0,m.useSelect)((e=>{const{getEditedEntityRecord:t,hasFinishedResolution:n}=e(ye.store),r=e(ye.store).__experimentalGetCurrentGlobalStylesId(),a=r?t("root","globalStyles",r):void 0;let s=!1;return n("__experimentalGetCurrentGlobalStylesId")&&(s=!r||n("getEditedEntityRecord",["root","globalStyles",r])),{globalStylesId:r,isReady:s,settings:a?.settings,styles:a?.styles}}),[]),{getEditedEntityRecord:a}=(0,m.useSelect)(ye.store),{editEntityRecord:s}=(0,m.useDispatch)(ye.store);return[t,(0,g.useMemo)((()=>({settings:null!=n?n:{},styles:null!=r?r:{}})),[n,r]),(0,g.useCallback)(((t,n={})=>{var r,i;const o=a("root","globalStyles",e),l=t({styles:null!==(r=o?.styles)&&void 0!==r?r:{},settings:null!==(i=o?.settings)&&void 0!==i?i:{}});s("root","globalStyles",e,{styles:Pr(l.styles)||{},settings:Pr(l.settings)||{}},n)}),[e])]}(),[r,a]=function(){const e=(0,m.useSelect)((e=>e(ye.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),s=(0,g.useMemo)((()=>a&&t?Ir(a,t):{}),[t,a]);return(0,g.useMemo)((()=>({isReady:e&&r,user:t,base:a,merged:s,setUserConfig:n})),[s,t,a,n,e,r])}function Ar({children:e}){const t=Mr();return t.isReady?(0,l.createElement)(Tr.Provider,{value:t},e):null}const{useGlobalStyle:Or,useGlobalStylesOutput:Nr}=Xe(fe.privateApis),Fr={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},Rr={hover:{opacity:1},start:{opacity:.5}},Dr={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},Vr={leading:!0,trailing:!0},Lr=({label:e,isFocused:t,withHoverView:n})=>{const[r]=Or("typography.fontWeight"),[a="serif"]=Or("typography.fontFamily"),[s=a]=Or("elements.h1.typography.fontFamily"),[i=r]=Or("elements.h1.typography.fontWeight"),[o="black"]=Or("color.text"),[c=o]=Or("elements.h1.color.text"),[u="white"]=Or("color.background"),[d]=Or("color.gradient"),[m]=Nr(),p=(0,ie.useReducedMotion)(),[h,f]=(0,g.useState)(!1),[y,{width:v}]=(0,ie.useResizeObserver)(),[_,E]=(0,g.useState)(v),[w,S]=(0,g.useState)(),x=(0,ie.useThrottle)(E,250,Vr);(0,g.useLayoutEffect)((()=>{v&&x(v)}),[v,x]),(0,g.useLayoutEffect)((()=>{const e=_?_/248:1,t=e-(w||0);!(Math.abs(t)>.1)&&w||S(e)}),[_,w]);const C=w||(v?v/248:1),{paletteColors:k,highlightedColors:T}=$e(),P=(0,g.useMemo)((()=>m?[...m,{css:"html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}",isGlobalStyles:!0}]:m),[m]),I=!!v;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{style:{position:"relative"}},y),I&&(0,l.createElement)(fe.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",style:{width:"100%",height:152*C},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),tabIndex:-1},(0,l.createElement)(fe.__unstableEditorStyles,{styles:P}),(0,l.createElement)(b.__unstableMotion.div,{style:{height:152*C,width:"100%",background:null!=d?d:u,cursor:n?"pointer":void 0},initial:"start",animate:(h||t)&&!p&&e?"hover":"start"},(0,l.createElement)(b.__unstableMotion.div,{variants:Fr,style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(b.__experimentalHStack,{spacing:10*C,justify:"center",style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(b.__unstableMotion.div,{style:{fontFamily:s,fontSize:65*C,color:c,fontWeight:i},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"}},"Aa"),(0,l.createElement)(b.__experimentalVStack,{spacing:4*C},T.map((({slug:e,color:t},n)=>(0,l.createElement)(b.__unstableMotion.div,{key:e,style:{height:32*C,width:32*C,background:t,borderRadius:32*C/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}})))))),(0,l.createElement)(b.__unstableMotion.div,{variants:n&&Rr,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1}},(0,l.createElement)(b.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"}},k.slice(0,4).map((({color:e},t)=>(0,l.createElement)("div",{key:t,style:{height:"100%",background:e,flexGrow:1}}))))),(0,l.createElement)(b.__unstableMotion.div,{variants:Dr,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0}},(0,l.createElement)(b.__experimentalVStack,{spacing:3*C,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*C,boxSizing:"border-box"}},e&&(0,l.createElement)("div",{style:{fontSize:40*C,fontFamily:s,color:c,fontWeight:i,lineHeight:"1em",textAlign:"center"}},e))))))},{GlobalStylesContext:Br,areGlobalStyleConfigsEqual:zr}=Xe(fe.privateApis);function Hr({variation:e}){const[t,n]=(0,g.useState)(!1),{base:r,user:a,setUserConfig:s}=(0,g.useContext)(Br),i=(0,g.useMemo)((()=>{var t,n;return{user:{settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}},base:r,merged:Ir(r,e),setUserConfig:()=>{}}}),[e,r]),o=()=>{s((()=>({settings:e.settings,styles:e.styles})))},c=(0,g.useMemo)((()=>zr(a,e)),[a,e]);let u=e?.title;return e?.description&&(u=(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),e?.title,e?.description)),(0,l.createElement)(Br.Provider,{value:i},(0,l.createElement)("div",{className:_()("edit-site-global-styles-variations_item",{"is-active":c}),role:"button",onClick:o,onKeyDown:e=>{e.keyCode===wr.ENTER&&(e.preventDefault(),o())},tabIndex:"0","aria-label":u,"aria-current":c,onFocus:()=>n(!0),onBlur:()=>n(!1)},(0,l.createElement)("div",{className:"edit-site-global-styles-variations_item-preview"},(0,l.createElement)(Lr,{label:e?.title,isFocused:t,withHoverView:!0}))))}function Gr(){const e=(0,m.useSelect)((e=>e(ye.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),t=(0,g.useMemo)((()=>[{title:(0,E.__)("Default"),settings:{},styles:{}},...(null!=e?e:[]).map((e=>{var t,n;return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}}}))]),[e]);return(0,l.createElement)(b.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container"},t.map(((e,t)=>(0,l.createElement)(Hr,{key:t,variation:e}))))}const Ur=20;function Wr({variation:e="default",direction:t,resizeWidthBy:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("button",{className:`resizable-editor__drag-handle is-${t} is-variation-${e}`,"aria-label":(0,E.__)("Drag to resize"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:r}=e;"left"===t&&r===wr.LEFT||"right"===t&&r===wr.RIGHT?n(Ur):("left"===t&&r===wr.RIGHT||"right"===t&&r===wr.LEFT)&&n(-Ur)},type:"button"}),(0,l.createElement)(b.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,E.__)("Use left and right arrow keys to resize the canvas.")))}const jr={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};const Zr=function({enableResizing:e,height:t,children:n}){const[r,a]=(0,g.useState)("100%"),s=(0,g.useRef)(),i=(0,g.useCallback)((e=>{s.current&&a(s.current.offsetWidth+e)}),[]);return(0,l.createElement)(b.ResizableBox,{ref:e=>{s.current=e?.resizable},size:{width:e?r:"100%",height:e&&t?t:"100%"},onResizeStop:(e,t,n)=>{a(n.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{left:e,right:e},showHandle:e,resizeRatio:2,handleComponent:{left:(0,l.createElement)(Wr,{direction:"left",resizeWidthBy:i}),right:(0,l.createElement)(Wr,{direction:"right",resizeWidthBy:i})},handleClasses:void 0,handleStyles:{left:jr,right:jr}},n)};function qr(e){switch(e){case"style-book":return(0,E.__)("Style Book");case"global-styles-revisions":case"global-styles-revisions:style-book":return(0,E.__)("Style Revisions");default:return""}}const{createPrivateSlotFill:Yr}=Xe(b.privateApis),{privateKey:Kr,Slot:Xr,Fill:Jr}=Yr("EditSiteEditorCanvasContainerSlot");function Qr({children:e,closeButtonLabel:t,onClose:n,enableResizing:r=!1}){const{editorCanvasContainerView:a,showListViewByDefault:s}=(0,m.useSelect)((e=>({editorCanvasContainerView:Xe(e(tr)).getEditorCanvasContainerView(),showListViewByDefault:e(T.store).get("core","showListViewByDefault")})),[]),[i,o]=(0,g.useState)(!1),{setEditorCanvasContainerView:c}=Xe((0,m.useDispatch)(tr)),{setIsListViewOpened:u}=(0,m.useDispatch)(y.store),d=(0,ie.useFocusOnMount)("firstElement"),p=(0,ie.useFocusReturn)(),h=(0,g.useMemo)((()=>qr(a)),[a]);function f(){u(s),c(void 0),o(!0),"function"==typeof n&&n()}const v=Array.isArray(e)?g.Children.map(e,((e,t)=>0===t?(0,g.cloneElement)(e,{ref:p}):e)):(0,g.cloneElement)(e,{ref:p});if(i)return null;const _=n||t;return(0,l.createElement)(Jr,null,(0,l.createElement)(Zr,{enableResizing:r},(0,l.createElement)("section",{className:"edit-site-editor-canvas-container",ref:_?d:null,onKeyDown:function(e){e.keyCode!==wr.ESCAPE||e.defaultPrevented||(e.preventDefault(),f())},"aria-label":h},_&&(0,l.createElement)(b.Button,{className:"edit-site-editor-canvas-container__close-button",icon:P,label:t||(0,E.__)("Close"),onClick:f,showTooltip:!1}),v)))}Qr.Slot=Xr;const $r=Qr,{ExperimentalBlockEditorProvider:ea,useGlobalStyle:ta,GlobalStylesContext:na,useGlobalStylesOutputWithConfig:ra}=Xe(fe.privateApis),{CompositeV2:aa,CompositeItemV2:sa,useCompositeStoreV2:ia,Tabs:oa}=Xe(b.privateApis);function la(e){return!e||0===Object.keys(e).length}function ca(){return[{name:"core/heading",title:(0,E.__)("Headings"),category:"text",blocks:[(0,u.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:1}),(0,u.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:2}),(0,u.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:3}),(0,u.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:4}),(0,u.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:5})]},...(0,u.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:r}=e;return"core/heading"!==t&&!!n&&!1!==r.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,u.getBlockFromExample)(e.name,e.example)})))]}const ua=({category:e,examples:t,isSelected:n,onClick:r,onSelect:a,settings:s,sizes:i,title:o})=>{const[c,u]=(0,g.useState)(!1),d={role:"button",onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!r||t!==wr.ENTER&&t!==wr.SPACE||(e.preventDefault(),r(e))},onClick:e=>{e.defaultPrevented||r&&(e.preventDefault(),r(e))},readonly:!0},m=r?"body { cursor: pointer; } body * { pointer-events: none; }":"";return(0,l.createElement)(fe.__unstableIframe,{className:_()("edit-site-style-book__iframe",{"is-focused":c&&!!r,"is-button":!!r}),name:"style-book-canvas",tabIndex:0,...r?d:{}},(0,l.createElement)(fe.__unstableEditorStyles,{styles:s.styles}),(0,l.createElement)("style",null,'.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n'+m),(0,l.createElement)(da,{className:_()("edit-site-style-book__examples",{"is-wide":i.width>600}),examples:t,category:e,label:o?(0,E.sprintf)((0,E.__)("Examples of blocks in the %s category"),o):(0,E.__)("Examples of blocks"),isSelected:n,onSelect:a,key:e}))},da=(0,g.memo)((({className:e,examples:t,category:n,label:r,isSelected:a,onSelect:s})=>{const i=ia({orientation:"vertical"});return(0,l.createElement)(aa,{store:i,className:e,"aria-label":r,role:"grid"},t.filter((e=>!n||e.category===n)).map((e=>(0,l.createElement)(ma,{key:e.name,id:`example-${e.name}`,title:e.title,blocks:e.blocks,isSelected:a(e.name),onClick:()=>{s?.(e.name)}}))))})),ma=({id:e,title:t,blocks:n,isSelected:r,onClick:a})=>{const s=(0,m.useSelect)((e=>e(fe.store).getSettings()),[]),i=(0,g.useMemo)((()=>({...s,focusMode:!1,__unstableIsPreviewMode:!0})),[s]),o=(0,g.useMemo)((()=>Array.isArray(n)?n:[n]),[n]);return(0,l.createElement)("div",{role:"row"},(0,l.createElement)("div",{role:"gridcell"},(0,l.createElement)(sa,{className:_()("edit-site-style-book__example",{"is-selected":r}),id:e,"aria-label":(0,E.sprintf)((0,E.__)("Open %s styles in Styles panel"),t),render:(0,l.createElement)("div",null),role:"button",onClick:a},(0,l.createElement)("span",{className:"edit-site-style-book__example-title"},t),(0,l.createElement)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0},(0,l.createElement)(b.Disabled,{className:"edit-site-style-book__example-preview__content"},(0,l.createElement)(ea,{value:o,settings:i},(0,l.createElement)(fe.BlockList,{renderAppender:!1})))))))},pa=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:r,showCloseButton:a=!0,onClose:s,showTabs:i=!0,userConfig:o={}}){const[c,d]=(0,ie.useResizeObserver)(),[p]=ta("color.text"),[h]=ta("color.background"),f=(0,g.useMemo)(ca,[]),y=(0,g.useMemo)((()=>(0,u.getCategories)().filter((e=>f.some((t=>t.category===e.slug)))).map((e=>({name:e.slug,title:e.title,icon:e.icon})))),[f]),{base:v}=(0,g.useContext)(na),b=(0,g.useMemo)((()=>la(o)||la(v)?{}:Ir(v,o)),[v,o]),w=(0,m.useSelect)((e=>e(fe.store).getSettings()),[]),S=(0,g.useMemo)((()=>({...w,__unstableIsPreviewMode:!0})),[w]),[x]=ra(b);return S.styles=la(x)||la(o)?S.styles:x,(0,l.createElement)($r,{onClose:s,enableResizing:e,closeButtonLabel:a?(0,E.__)("Close Style Book"):null},(0,l.createElement)("div",{className:_()("edit-site-style-book",{"is-wide":d.width>600,"is-button":!!n}),style:{color:p,background:h}},c,i?(0,l.createElement)("div",{className:"edit-site-style-book__tabs"},(0,l.createElement)(oa,null,(0,l.createElement)(oa.TabList,null,y.map((e=>(0,l.createElement)(oa.Tab,{tabId:e.name,key:e.name},e.title)))),y.map((e=>(0,l.createElement)(oa.TabPanel,{key:e.name,tabId:e.name,focusable:!1},(0,l.createElement)(ua,{category:e.name,examples:f,isSelected:t,onSelect:r,settings:S,sizes:d,title:e.title})))))):(0,l.createElement)(ua,{examples:f,isSelected:t,onClick:n,onSelect:r,settings:S,sizes:d})))},ha={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},fa={per_page:100,page:1},ga=[],{GlobalStylesContext:ya}=Xe(fe.privateApis);function va({query:e}={}){const{user:t}=(0,g.useContext)(ya),n={...fa,...e},{authors:r,currentUser:a,isDirty:s,revisions:i,isLoadingGlobalStylesRevisions:o,revisionsCount:l}=(0,m.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:r,getCurrentUser:a,getUsers:s,getRevisions:i,__experimentalGetCurrentGlobalStylesId:o,getEntityRecord:l,isResolving:c}=e(ye.store),u=r(),d=a(),m=u.length>0,p=o(),h=p?l("root","globalStyles",p):void 0,f=null!==(t=h?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=i("root","globalStyles",p,n)||ga;return{authors:s(ha)||ga,currentUser:d,isDirty:m,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,n]),revisionsCount:f}}),[e]);return(0,g.useMemo)((()=>{if(!r.length||o)return{revisions:ga,hasUnsavedChanges:s,isLoading:!0,revisionsCount:l};const e=i.map((e=>({...e,author:r.find((t=>t.id===e.author))})));if(i.length){if("unsaved"!==e[0].id&&1===n.page&&(e[0].isLatest=!0),s&&t&&Object.keys(t).length>0&&a&&1===n.page){const n={id:"unsaved",styles:t?.styles,settings:t?.settings,author:{name:a?.name,avatar_urls:a?.avatar_urls},modified:new Date};e.unshift(n)}n.page===Math.ceil(l/n.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:s,isLoading:!1,revisionsCount:l}}),[s,i,a,r,t,o])}const _a=window.wp.date,ba=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"}));function Ea({children:e}){return(0,l.createElement)(b.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__label"},e)}function wa({label:e,children:t,className:n,...r}){return(0,l.createElement)(b.__experimentalHStack,{key:e,spacing:5,alignment:"left",className:_()("edit-site-sidebar-navigation-details-screen-panel__row",n),...r},t)}function Sa({children:e}){return(0,l.createElement)(b.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__value"},e)}function xa({title:e,children:t,spacing:n}){return(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-sidebar-navigation-details-screen-panel",spacing:n},e&&(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-sidebar-navigation-details-screen-panel__heading",level:2},e),t)}function Ca({record:e,...t}){const n={};return e?._links?.["predecessor-version"]?.[0]?.id&&(n.href=(0,yt.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),n.as="a"),(0,l.createElement)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-details-footer"},(0,l.createElement)(vr,{"aria-label":(0,E.__)("Revisions"),...n,...t},(0,l.createElement)(wa,{justify:"space-between"},(0,l.createElement)(Ea,null,(0,E.__)("Last modified")),(0,l.createElement)(Sa,null,(0,g.createInterpolateElement)((0,E.sprintf)((0,E.__)(""),(0,_a.humanTimeDiff)(e.modified)),{time:(0,l.createElement)("time",{dateTime:e.modified})})),(0,l.createElement)(b.Icon,{className:"edit-site-sidebar-navigation-screen-details-footer__icon",icon:ba}))))}const ka=()=>{};function Ta(e){const{openGeneralSidebar:t}=(0,m.useDispatch)(tr),{setCanvasMode:n}=Xe((0,m.useDispatch)(tr));return(0,m.useSelect)((e=>!!e(ye.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length),[])?(0,l.createElement)(b.__experimentalNavigatorButton,{...e,as:vr,path:"/wp_global_styles"}):(0,l.createElement)(vr,{...e,onClick:()=>{n("edit"),t("edit-site/global-styles")}})}function Pa(){const{storedSettings:e}=(0,m.useSelect)((e=>{const{getSettings:t}=Xe(e(tr));return{storedSettings:t()}}),[]);return(0,l.createElement)(fe.BlockEditorProvider,{settings:e,onChange:ka,onInput:ka},(0,l.createElement)(Gr,null))}function Ia(){const{revisions:e,isLoading:t}=va(),{openGeneralSidebar:n}=(0,m.useDispatch)(tr),{setIsListViewOpened:r}=(0,m.useDispatch)(y.store),a=(0,ie.useViewportMatch)("medium","<"),{setCanvasMode:s,setEditorCanvasContainerView:i}=Xe((0,m.useDispatch)(tr)),{isViewMode:o,isStyleBookOpened:c,revisionsCount:u}=(0,m.useSelect)((e=>{var t;const{getCanvasMode:n,getEditorCanvasContainerView:r}=Xe(e(tr)),{getEntityRecord:a,__experimentalGetCurrentGlobalStylesId:s}=e(ye.store),i=s(),o=i?a("root","globalStyles",i):void 0;return{isViewMode:"view"===n(),isStyleBookOpened:"style-book"===r(),revisionsCount:null!==(t=o?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),d=(0,g.useCallback)((async()=>Promise.all([s("edit"),n("edit-site/global-styles")])),[s,n]),p=(0,g.useCallback)((async()=>{await d(),i("style-book"),r(!1)}),[d,i,r]),h=(0,g.useCallback)((async()=>{await d(),i("global-styles-revisions")}),[d,i]),f=u>0,v=e?.[0]?.modified,_=f&&!t&&v;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(hr,{title:(0,E.__)("Styles"),description:(0,E.__)("Choose a different style combination for the theme styles."),content:(0,l.createElement)(Pa,null),footer:_&&(0,l.createElement)(Ca,{record:e?.[0],onClick:h}),actions:(0,l.createElement)(l.Fragment,null,!a&&(0,l.createElement)(mr,{icon:_r,label:(0,E.__)("Style Book"),onClick:()=>i(c?void 0:"style-book"),isPressed:c}),(0,l.createElement)(mr,{icon:Er,label:(0,E.__)("Edit styles"),onClick:async()=>await d()}))}),c&&!a&&o&&(0,l.createElement)(pa,{enableResizing:!1,isSelected:()=>!1,onClick:p,onSelect:p,showCloseButton:!1,showTabs:!1}))}const Ma="isTemplatePartMoveHintVisible";function Aa(){const e=(0,m.useSelect)((e=>{var t;return null===(t=e(T.store).get("core",Ma))||void 0===t||t}),[]),{set:t}=(0,m.useDispatch)(T.store);return e?(0,l.createElement)(b.Notice,{politeness:"polite",className:"edit-site-sidebar__notice",onRemove:()=>{t("core",Ma,!1)}},(0,E.__)('Looking for template parts? Find them in "Patterns".')):null}function Oa(){const{location:e}=(0,b.__experimentalUseNavigator)(),{setEditorCanvasContainerView:t}=Xe((0,m.useDispatch)(tr));return(0,g.useEffect)((()=>{"/"===e?.path&&t(void 0)}),[t,e?.path]),(0,l.createElement)(hr,{isRoot:!0,title:(0,E.__)("Design"),description:(0,E.__)("Customize the appearance of your website using the block editor."),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(b.__experimentalNavigatorButton,{as:vr,path:"/navigation",withChevron:!0,icon:sr},(0,E.__)("Navigation")),(0,l.createElement)(Ta,{withChevron:!0,icon:ir},(0,E.__)("Styles")),(0,l.createElement)(b.__experimentalNavigatorButton,{as:vr,path:"/page",withChevron:!0,icon:or},(0,E.__)("Pages")),(0,l.createElement)(b.__experimentalNavigatorButton,{as:vr,path:"/wp_template",withChevron:!0,icon:lr},(0,E.__)("Templates")),(0,l.createElement)(b.__experimentalNavigatorButton,{as:vr,path:"/patterns",withChevron:!0,icon:cr},(0,E.__)("Patterns"))),(0,l.createElement)(Aa,null))})}const Na=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})),Fa=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),Ra=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Da=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),Va=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),La=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ba=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),za=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),Ha=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ga=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ua=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),Wa=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),ja=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,l.createElement)(w.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"})),Za=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),qa=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ya=(e,t)=>{let n=e;return t.split(".").forEach((e=>{n=n?.[e]})),n},Ka=(e,t)=>(e||[]).map((e=>({...e,name:(0,en.decodeEntities)(Ya(e,t))}))),Xa=()=>(0,m.useSelect)((e=>e(ye.store).getEntityRecords("postType",Ct,{per_page:-1})),[]),Ja=()=>(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplateTypes()),[]),Qa=()=>{const e=(0,m.useSelect)((e=>e(ye.store).getPostTypes({per_page:-1})),[]);return(0,g.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n)))}),[e])};function $a(e){const t=(0,g.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})));return(0,g.useCallback)((({labels:e,slug:n})=>{const r=e.singular_name.toLowerCase();return t[r]>1&&r!==n}),[t])}function es(){const e=Qa(),t=(0,g.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=Xa(),r=$a(t);return(0,g.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=r(e)?(0,E.sprintf)((0,E.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,E.sprintf)((0,E.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,E.sprintf)((0,E.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:e.icon?.startsWith("dashicons-")?e.icon.slice(10):Da,templatePrefix:"archive"}}))||[]),[t,n,r])}const ts=e=>{const t=Qa(),n=Xa(),r=Ja(),a=$a(t),s=(0,g.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),i=is("postType",s),o=(n||[]).map((({slug:e})=>e)),l=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c,icon:u}=n,d=s[l],m=r?.find((({slug:e})=>e===d)),p=o?.includes(d),h=a(n);let f=(0,E.sprintf)((0,E.__)("Single item: %s"),c.singular_name);h&&(f=(0,E.sprintf)((0,E.__)("Single item: %1$s (%2$s)"),c.singular_name,l));const g=m?{...m,templatePrefix:s[l]}:{slug:d,title:f,description:(0,E.sprintf)((0,E.__)("Displays a single item: %s."),c.singular_name),icon:u?.startsWith("dashicons-")?u.slice(10):qa,templatePrefix:s[l]},y=i?.[l]?.hasEntities;return y&&(g.onClick=t=>{e({type:"postType",slug:l,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${s[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:s[l]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!y||t.push(g),t}),[]),c=(0,g.useMemo)((()=>l.reduce(((e,t)=>{const{slug:n}=t;let r="postTypesMenuItems";return"page"===n&&(r="defaultPostTypesMenuItems"),e[r].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[l]);return c},ns=e=>{const t=(()=>{const e=(0,m.useSelect)((e=>e(ye.store).getTaxonomies({per_page:-1})),[]);return(0,g.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=Xa(),r=Ja(),a=(0,g.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return["category","post_tag"].includes(t)||(n=`taxonomy-${n}`),"post_tag"===t&&(n="tag"),e[t]=n,e}),{})),[t]),s=t?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),i=is("taxonomy",a),o=(n||[]).map((({slug:e})=>e)),l=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=a[l],d=r?.find((({slug:e})=>e===u)),m=o?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=e.singular_name.toLowerCase();return s[n]>1&&n!==t})(c,l);let h=c.singular_name;p&&(h=(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),c.singular_name,l));const f=d?{...d,templatePrefix:a[l]}:{slug:u,title:h,description:(0,E.sprintf)((0,E.__)("Displays taxonomy: %s."),c.singular_name),icon:Ga,templatePrefix:a[l]},g=i?.[l]?.hasEntities;return g&&(f.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${a[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:a[l]}}},labels:c,hasGeneralTemplate:m,template:t})}),m&&!g||t.push(f),t}),[]);return(0,g.useMemo)((()=>l.reduce(((e,t)=>{const{slug:n}=t;let r="taxonomiesMenuItems";return["category","tag"].includes(n)&&(r="defaultTaxonomiesMenuItems"),e[r].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[l])},rs={user:"author"},as={user:{who:"authors"}};const ss=(e,t,n={})=>{const r=(e=>{const t=Xa();return(0,g.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,r])=>{const a=(t||[]).reduce(((e,t)=>{const n=`${r}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return a.length&&(e[n]=a),e}),{})),[e,t])})(t);return(0,m.useSelect)((t=>Object.entries(r||{}).reduce(((r,[a,s])=>{const i=t(ye.store).getEntityRecords(e,a,{_fields:"id",context:"view",slug:s,...n[a]});return i?.length&&(r[a]=i),r}),{})),[r])},is=(e,t,n={})=>{const r=ss(e,t,n);return(0,m.useSelect)((a=>Object.keys(t||{}).reduce(((t,s)=>{const i=r?.[s]?.map((({id:e})=>e))||[];return t[s]={hasEntities:!!a(ye.store).getEntityRecords(e,s,{per_page:1,_fields:"id",context:"view",exclude:i,...n[s]})?.length,existingEntitiesIds:i},t}),{})),[t,r])},{CompositeV2:os,CompositeItemV2:ls,useCompositeStoreV2:cs}=Xe(b.privateApis),us=[];function ds({suggestion:e,search:t,onSelect:n,entityForSuggestions:r}){const a="edit-site-custom-template-modal__suggestions_list__list-item";return(0,l.createElement)(ls,{render:(0,l.createElement)(b.Button,{role:"option",className:a,onClick:()=>n(r.config.getSpecificTemplate(e))})},(0,l.createElement)(b.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${a}__title`},(0,l.createElement)(b.TextHighlight,{text:(0,en.decodeEntities)(e.name),highlight:t})),e.link&&(0,l.createElement)(b.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${a}__info`},e.link))}function ms({entityForSuggestions:e,onSelect:t}){const n=cs({orientation:"vertical"}),[r,a,s]=(0,ie.useDebouncedInput)(),i=function(e,t){const{config:n}=e,r=(0,g.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:a,hasResolved:s}=(0,ye.useEntityRecords)(e.type,e.slug,r),[i,o]=(0,g.useState)(us);return(0,g.useEffect)((()=>{if(!s)return;let e=us;a?.length&&(e=a,n.recordNamePath&&(e=Ka(e,n.recordNamePath))),o(e)}),[a,s]),i}(e,s),{labels:o}=e,[c,u]=(0,g.useState)(!1);return!c&&i?.length>9&&u(!0),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(b.SearchControl,{__nextHasNoMarginBottom:!0,onChange:a,value:r,label:o.search_items,placeholder:o.search_items}),!!i?.length&&(0,l.createElement)(os,{store:n,role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,E.__)("Suggestions list")},i.map((n=>(0,l.createElement)(ds,{key:n.slug,suggestion:n,search:s,onSelect:t,entityForSuggestions:e})))),s&&!i?.length&&(0,l.createElement)(b.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results"},o.not_found))}const ps=function({onSelect:e,entityForSuggestions:t}){const[n,r]=(0,g.useState)(t.hasGeneralTemplate);return(0,l.createElement)(b.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left"},!n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalText,{as:"p"},(0,E.__)("Select whether to create a single template for all items or a specific one.")),(0,l.createElement)(b.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial"},(0,l.createElement)(b.FlexItem,{isBlock:!0,as:b.Button,onClick:()=>{const{slug:n,title:r,description:a,templatePrefix:s}=t.template;e({slug:n,title:r,description:a,templatePrefix:s})}},(0,l.createElement)(b.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.all_items),(0,l.createElement)(b.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,E.__)("For all items"))),(0,l.createElement)(b.FlexItem,{isBlock:!0,as:b.Button,onClick:()=>{r(!0)}},(0,l.createElement)(b.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.singular_name),(0,l.createElement)(b.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,E.__)("For a specific item"))))),n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalText,{as:"p"},(0,E.__)("This template will be used only for the specific item chosen.")),(0,l.createElement)(ms,{entityForSuggestions:t,onSelect:e})))};var hs=function(){return hs=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{e()}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit",isBusy:s,"aria-disabled":s},(0,E.__)("Create")))))};function ws(){const e="edit-site-template-actions-loading-screen-modal";return(0,l.createElement)(b.Modal,{isFullScreen:!0,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:()=>{},__experimentalHideHeader:!0,className:e},(0,l.createElement)("div",{className:`${e}__content`},(0,l.createElement)(b.Spinner,null)))}const{useHistory:Ss}=Xe(gt.privateApis),xs=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],Cs={"front-page":Na,home:Fa,single:Ra,page:or,archive:Da,search:Va,404:La,index:Ba,category:za,author:Ha,taxonomy:Ga,date:Ua,tag:Wa,attachment:ja};function ks({title:e,direction:t,className:n,description:r,icon:a,onClick:s,children:i}){return(0,l.createElement)(b.Button,{className:n,onClick:s,label:r,showTooltip:!!r},(0,l.createElement)(b.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t},(0,l.createElement)("div",{className:"edit-site-add-new-template__template-icon"},(0,l.createElement)(b.Icon,{icon:a})),(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0},(0,l.createElement)(b.__experimentalText,{weight:500,lineHeight:1.53846153846},e),i)))}const Ts={templatesList:1,customTemplate:2,customGenericTemplate:3};function Ps({postType:e,toggleProps:t,showIcon:n=!0}){const[r,a]=(0,g.useState)(!1),[s,i]=(0,g.useState)(Ts.templatesList),[o,c]=(0,g.useState)({}),[u,d]=(0,g.useState)(!1),p=Ss(),{saveEntityRecord:h}=(0,m.useDispatch)(ye.store),{createErrorNotice:f,createSuccessNotice:y}=(0,m.useDispatch)(ge.store),{homeUrl:v}=(0,m.useSelect)((e=>{const{getUnstableBase:t}=e(ye.store);return{homeUrl:t()?.home}}),[]),w={"front-page":v,date:(0,E.sprintf)((0,E.__)("E.g. %s"),v+"/"+(new Date).getFullYear())};async function S(e,t=!0){if(!u){d(!0);try{const{title:n,description:r,slug:a}=e,s=await h("postType",Ct,{description:r,slug:a.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});p.push({postId:s.id,postType:s.type,canvas:"edit"}),y((0,E.sprintf)((0,E.__)('"%s" successfully created.'),(0,en.decodeEntities)(s.title?.rendered||n)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the template.");f(t,{type:"snackbar"})}finally{d(!1)}}}const x=()=>{a(!1),i(Ts.templatesList)},C=function(e,t){const n=Xa(),r=Ja(),a=(n||[]).map((({slug:e})=>e)),s=(r||[]).filter((e=>xs.includes(e.slug)&&!a.includes(e.slug))),i=n=>{t?.(),e(n)},o=[...s],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=ns(i),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=ts(i),m=function(e){const t=Xa(),n=Ja(),r=is("root",rs,as);let a=n?.find((({slug:e})=>"author"===e));a||(a={description:(0,E.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const s=!!t?.find((({slug:e})=>"author"===e));if(r.user?.hasEntities&&(a={...a,templatePrefix:"author"},a.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:r.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,E.__)("Author"),search_items:(0,E.__)("Search Authors"),not_found:(0,E.__)("No authors found."),all_items:(0,E.__)("All Authors")},hasGeneralTemplate:s,template:t})}),!s||r.user?.hasEntities)return a}(i);[...l,...u,m].forEach((e=>{if(!e)return;const t=o.findIndex((t=>t.slug===e.slug));t>-1?o[t]=e:o.push(e)})),o?.sort(((e,t)=>xs.indexOf(e.slug)-xs.indexOf(t.slug)));const p=[...o,...es(),...d,...c];return p}(c,(()=>i(Ts.customTemplate)));if(!C.length)return null;const{as:k=b.Button,...T}=null!=t?t:{};let P=(0,E.__)("Add template");return s===Ts.customTemplate?P=(0,E.sprintf)((0,E.__)("Add template: %s"),o.labels.singular_name):s===Ts.customGenericTemplate&&(P=(0,E.__)("Create custom template")),(0,l.createElement)(l.Fragment,null,u&&(0,l.createElement)(ws,null),(0,l.createElement)(k,{...T,onClick:()=>a(!0),icon:n?Za:null,label:e.labels.add_new_item},n?null:e.labels.add_new_item),r&&(0,l.createElement)(b.Modal,{title:P,className:_()("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":s===Ts.templatesList,"edit-site-custom-template-modal":s===Ts.customTemplate}),onRequestClose:x,overlayClassName:s===Ts.customGenericTemplate?"edit-site-custom-generic-template__modal":void 0},s===Ts.templatesList&&(0,l.createElement)(b.__experimentalGrid,{columns:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents"},(0,l.createElement)(b.Flex,{className:"edit-site-add-new-template__template-list__prompt"},(0,E.__)("Select what the new template should apply to:")),C.map((e=>{const{title:t,slug:n,onClick:r}=e;return(0,l.createElement)(ks,{key:n,title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:w[n],icon:Cs[n]||lr,onClick:()=>r?r(e):S(e)})})),(0,l.createElement)(ks,{title:(0,E.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:Er,onClick:()=>i(Ts.customGenericTemplate)},(0,l.createElement)(b.__experimentalText,{lineHeight:1.53846153846},(0,E.__)("A custom template can be manually applied to any post or page.")))),s===Ts.customTemplate&&(0,l.createElement)(ps,{onSelect:S,entityForSuggestions:o}),s===Ts.customGenericTemplate&&(0,l.createElement)(Es,{onClose:x,createTemplate:S})))}function Is({templateType:e=Ct,...t}){const n=(0,m.useSelect)((t=>t(ye.store).getPostType(e)),[e]);return n&&e===Ct?(0,l.createElement)(Ps,{...t,postType:n}):null}const Ms=({postType:e,postId:t,...n})=>{const r=Et({postType:e,postId:t});return(0,l.createElement)(vr,{...r,...n})};function As(){const e=(0,ie.useViewportMatch)("medium","<"),{records:t,isResolving:n}=(0,ye.useEntityRecords)("postType",Ct,{per_page:-1}),r=Et({path:"/wp_template/all"}),a=!e;return(0,l.createElement)(hr,{title:(0,E.__)("Templates"),description:(0,E.__)("Express the layout of your site with templates."),actions:a&&(0,l.createElement)(Is,{templateType:Ct,toggleProps:{as:mr}}),content:(0,l.createElement)(l.Fragment,null,n&&(0,E.__)("Loading templates…"),!n&&(0,l.createElement)(Ns,{templates:t})),footer:!e&&(0,l.createElement)(vr,{withChevron:!0,...r},(0,E.__)("Manage all templates"))})}function Os({title:e,templates:t}){return(0,l.createElement)(b.__experimentalItemGroup,null,!!e&&(0,l.createElement)(b.__experimentalItem,{className:"edit-site-sidebar-navigation-screen-templates__templates-group-title"},e),t.map((e=>(0,l.createElement)(Ms,{postType:Ct,postId:e.id,key:e.id,withChevron:!0},(0,en.decodeEntities)(e.title?.rendered||e.slug)))))}function Ns({templates:e}){if(!e?.length)return(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(b.__experimentalItem,null,(0,E.__)("No templates found")));const t=e?[...e]:[];t.sort(((e,t)=>e.title.rendered.localeCompare(t.title.rendered)));const{hierarchyTemplates:n,customTemplates:r,...a}=t.reduce(((e,t)=>{const{original_source:n,author_text:r}=t;return"plugin"===n?(e[r]||(e[r]=[]),e[r].push(t)):t.is_custom?e.customTemplates.push(t):e.hierarchyTemplates.push(t),e}),{hierarchyTemplates:[],customTemplates:[]});return(0,l.createElement)(b.__experimentalVStack,{spacing:3},!!n.length&&(0,l.createElement)(Os,{templates:n}),!!r.length&&(0,l.createElement)(Os,{title:(0,E.__)("Custom"),templates:r}),Object.entries(a).map((([e,t])=>(0,l.createElement)(Os,{key:e,title:e,templates:t}))))}function Fs({postId:e,area:t,title:n}){const r=(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplatePartAreas().find((e=>e.area===t))),[t]),a=Et({postType:kt,postId:e});return(0,l.createElement)(vr,{className:"edit-site-sidebar-navigation-screen-template__template-area-button",...a,icon:r?.icon,withChevron:!0},(0,l.createElement)(b.__experimentalTruncate,{limit:20,ellipsizeMode:"tail",numberOfLines:1,className:"edit-site-sidebar-navigation-screen-template__template-area-label-text"},(0,en.decodeEntities)(n)))}function Rs(){const{templatePartAreas:e,currentTemplateParts:t}=(0,m.useSelect)((e=>{const{getSettings:t,getCurrentTemplateTemplateParts:n}=Xe(e(tr));return{templatePartAreas:t()?.defaultTemplatePartAreas,currentTemplateParts:n()}}),[]),n=(0,g.useMemo)((()=>{const n=new Set;return t.length&&e?t.filter((e=>{if(!n.has(e.templatePart.id))return n.add(e.templatePart.id),e})).map((({templatePart:t,block:n})=>({...e?.find((({area:e})=>e===t?.area)),...t,clientId:n.clientId}))):[]}),[t,e]);return n.length?(0,l.createElement)(xa,{title:(0,E.__)("Areas"),spacing:3},(0,l.createElement)(b.__experimentalItemGroup,null,n.map((({clientId:e,label:t,area:n,theme:r,slug:a,title:s})=>(0,l.createElement)(wa,{key:e},(0,l.createElement)(Fs,{postId:`${r}//${a}`,title:s?.rendered||t,area:n})))))):null}function Ds(e,t){const{record:n,title:r,description:a,isLoaded:s,icon:i}=(0,m.useSelect)((n=>{const{getEditedPostType:r,getEditedPostId:a}=n(tr),{getEditedEntityRecord:s,hasFinishedResolution:i}=n(ye.store),{__experimentalGetTemplateInfo:o}=n(y.store),l=null!=e?e:r(),c=null!=t?t:a(),u=s("postType",l,c),d=c&&i("getEditedEntityRecord",["postType",l,c]),m=o(u);return{record:u,title:m.title,description:m.description,isLoaded:d,icon:m.icon}}),[e,t]);return{isLoaded:s,icon:i,record:n,getTitle:()=>r?(0,en.decodeEntities)(r):null,getDescription:()=>a?(0,en.decodeEntities)(a):null}}const Vs=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ls=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"}));function Bs(e,t){return(0,m.useSelect)((n=>{const{getEntityRecord:r,getMedia:a,getUser:s,getEditedEntityRecord:i}=n(ye.store),o=i("postType",e,t),l=o?.original_source,c=o?.author_text;switch(l){case"theme":return{type:l,icon:lr,text:c,isCustomized:o.source===Tt.custom};case"plugin":return{type:l,icon:Vs,text:c,isCustomized:o.source===Tt.custom};case"site":{const e=r("root","__unstableBase");return{type:l,icon:Ls,imageUrl:e?.site_logo?a(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=s(o.author);return{type:"user",icon:Ha,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}function zs({imageUrl:e}){const[t,n]=(0,g.useState)(!1);return(0,l.createElement)("div",{className:_()("edit-site-list-added-by__avatar",{"is-loaded":t})},(0,l.createElement)("img",{onLoad:()=>n(!0),alt:"",src:e}))}function Hs(e){return!!e&&(e.source===Tt.custom&&!e.has_theme_file)}function Gs({template:e,onClose:t}){const n=(0,en.decodeEntities)(e.title.rendered),[r,a]=(0,g.useState)(n),[s,i]=(0,g.useState)(!1),{editEntityRecord:o,__experimentalSaveSpecifiedEntityEdits:c}=(0,m.useDispatch)(ye.store),{createSuccessNotice:u,createErrorNotice:d}=(0,m.useDispatch)(ge.store);if(e.type===Ct&&!e.is_custom)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{onClick:()=>{i(!0),a(n)}},(0,E.__)("Rename")),s&&(0,l.createElement)(b.Modal,{title:(0,E.__)("Rename"),onRequestClose:()=>{i(!1)},overlayClassName:"edit-site-list__rename-modal"},(0,l.createElement)("form",{onSubmit:async function(n){n.preventDefault();try{await o("postType",e.type,e.id,{title:r}),a(""),i(!1),t(),await c("postType",e.type,e.id,["title"],{throwOnError:!0}),u(e.type===Ct?(0,E.__)("Template renamed."):(0,E.__)("Template part renamed."),{type:"snackbar"})}catch(t){const n=e.type===Ct?(0,E.__)("An error occurred while renaming the template."):(0,E.__)("An error occurred while renaming the template part."),r=t.message&&"unknown_error"!==t.code?t.message:n;d(r,{type:"snackbar"})}}},(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,E.__)("Name"),value:r,onChange:a,required:!0}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{i(!1)}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,E.__)("Save")))))))}function Us({postType:e,postId:t,className:n,toggleProps:r,onRemove:a}){const s=(0,m.useSelect)((n=>n(ye.store).getEntityRecord("postType",e,t)),[e,t]),{removeTemplate:i,revertTemplate:o}=(0,m.useDispatch)(tr),{saveEditedEntityRecord:c}=(0,m.useDispatch)(ye.store),{createSuccessNotice:u,createErrorNotice:d}=(0,m.useDispatch)(ge.store),p=Hs(s),h=$t(s);if(!p&&!h)return null;return(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),className:n,toggleProps:r},(({onClose:e})=>(0,l.createElement)(b.MenuGroup,null,p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Gs,{template:s,onClose:e}),(0,l.createElement)(Ws,{onRemove:()=>{i(s),a?.(),e()},title:s.title.rendered})),h&&(0,l.createElement)(b.MenuItem,{info:(0,E.__)("Use the template as supplied by the theme."),onClick:()=>{!async function(){try{await o(s,{allowUndo:!1}),await c("postType",s.type,s.id),u((0,E.sprintf)((0,E.__)('"%s" reverted.'),(0,en.decodeEntities)(s.title.rendered)),{type:"snackbar",id:"edit-site-template-reverted"})}catch(e){const t=s.type===Ct?(0,E.__)("An error occurred while reverting the template."):(0,E.__)("An error occurred while reverting the template part."),n=e.message&&"unknown_error"!==e.code?e.message:t;d(n,{type:"snackbar"})}}(),e()}},(0,E.__)("Clear customizations")))))}function Ws({onRemove:e,title:t}){const[n,r]=(0,g.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{isDestructive:!0,onClick:()=>r(!0)},(0,E.__)("Delete")),(0,l.createElement)(b.__experimentalConfirmDialog,{isOpen:n,onConfirm:e,onCancel:()=>r(!1),confirmButtonText:(0,E.__)("Delete")},(0,E.sprintf)((0,E.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(t))))}const js={};function Zs(){const{editEntityRecord:e}=(0,m.useDispatch)(ye.store),{allowCommentsOnNewPosts:t,postsPerPage:n,postsPageTitle:r,postsPageId:a}=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(ye.store),n=t("root","site"),r=n?.page_for_posts?t("postType","page",n?.page_for_posts):js;return{allowCommentsOnNewPosts:"open"===n?.default_comment_status,postsPageTitle:r?.title?.rendered,postsPageId:r?.id,postsPerPage:n?.posts_per_page}}),[]),[s,i]=(0,g.useState)(""),[o,c]=(0,g.useState)(1),[u,d]=(0,g.useState)("");(0,g.useEffect)((()=>{i(t),d(r),c(n)}),[r,t,n]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(xa,{spacing:6},a&&(0,l.createElement)(wa,null,(0,l.createElement)(b.__experimentalInputControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:(0,E.__)("No Title"),size:"__unstable-large",value:u,onChange:(0,ie.debounce)((t=>{d(t),e("postType","page",a,{title:t})}),300),label:(0,E.__)("Blog title"),help:(0,E.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media.")})),(0,l.createElement)(wa,null,(0,l.createElement)(b.__experimentalNumberControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:0,value:o,size:"__unstable-large",spinControls:"custom",step:"1",min:"1",onChange:t=>{c(t),e("root","site",void 0,{posts_per_page:t})},label:(0,E.__)("Posts per page"),help:(0,E.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.")}))),(0,l.createElement)(xa,{title:(0,E.__)("Discussion"),spacing:3},(0,l.createElement)(wa,null,(0,l.createElement)(b.CheckboxControl,{className:"edit-site-sidebar-navigation-screen__input-control",label:(0,E.__)("Allow comments on new posts"),help:(0,E.__)("Changes will apply to new posts only. Individual posts may override these settings."),checked:s,onChange:t=>{i(t),e("root","site",void 0,{default_comment_status:t?"open":null})}}))))}function qs(){const e=(0,b.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{setCanvasMode:r}=Xe((0,m.useDispatch)(tr)),{title:a,content:s,description:i,footer:o}=function(e,t){const{getDescription:n,getTitle:r,record:a}=Ds(e,t),s=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme()),[]),i=Bs(e,t),o="theme"===i.type&&a.theme===s?.stylesheet,c=r();let u=n();!u&&i.text&&(u=(0,E.__)("This is a custom template that can be applied manually to any Post or Page."));const d="home"===a?.slug||"index"===a?.slug?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Zs,null),(0,l.createElement)(Rs,null)):(0,l.createElement)(Rs,null),p=a?.modified?(0,l.createElement)(Ca,{record:a}):null;return{title:c,description:(0,l.createElement)(l.Fragment,null,u,i.text&&!o&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"},i.imageUrl?(0,l.createElement)("img",{src:i.imageUrl,alt:"",width:"24",height:"24"}):(0,l.createElement)(b.Icon,{icon:i.icon})),i.text),i.isCustomized&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-customized"},(0,E._x)("(Customized)","template")))),content:d,footer:p}}(t,n);return(0,l.createElement)(hr,{title:a,actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Us,{postType:t,postId:n,toggleProps:{as:mr},onRemove:()=>{e.goTo(`/${t}/all`)}}),(0,l.createElement)(mr,{onClick:()=>r("edit"),label:(0,E.__)("Edit"),icon:br})),description:i,content:s,footer:o})}const Ys=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})),Ks=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})),Xs=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})),Js=()=>(0,m.useSelect)((e=>e(ye.store).getEntityRecords("postType",kt,{per_page:-1})),[]),Qs=(e,t)=>{const n=e.toLowerCase(),r=t.map((e=>e.title.rendered.toLowerCase()));if(!r.includes(n))return e;let a=2;for(;r.includes(`${n} ${a}`);)a++;return`${e} ${a}`},$s=e=>bs(e).replace(/[^\w-]+/g,"")||"wp-custom-part";function ei({modalTitle:e=(0,E.__)("Create template part"),...t}){return(0,l.createElement)(b.Modal,{title:e,onRequestClose:t.closeModal,overlayClassName:"edit-site-create-template-part-modal"},(0,l.createElement)(ti,{...t}))}function ti({defaultArea:e=Pt,blocks:t=[],confirmLabel:n=(0,E.__)("Create"),closeModal:r,onCreate:a,onError:s,defaultTitle:i=""}){const{createErrorNotice:o}=(0,m.useDispatch)(ge.store),{saveEntityRecord:c}=(0,m.useDispatch)(ye.store),d=Js(),[p,h]=(0,g.useState)(i),[f,v]=(0,g.useState)(e),[_,w]=(0,g.useState)(!1),x=(0,ie.useInstanceId)(ei),C=(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplatePartAreas()),[]);return(0,l.createElement)("form",{onSubmit:async e=>{e.preventDefault(),await async function(){if(p&&!_)try{w(!0);const e=Qs(p,d),n=$s(e),r=await c("postType",kt,{slug:n,title:e,content:(0,u.serialize)(t),area:f},{throwOnError:!0});await a(r)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the template part.");o(t,{type:"snackbar"}),s?.()}finally{w(!1)}}()}},(0,l.createElement)(b.__experimentalVStack,{spacing:"4"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:p,onChange:h,required:!0}),(0,l.createElement)(b.BaseControl,{label:(0,E.__)("Area"),id:`edit-site-create-template-part-modal__area-selection-${x}`,className:"edit-site-create-template-part-modal__area-base-control"},(0,l.createElement)(b.__experimentalRadioGroup,{label:(0,E.__)("Area"),className:"edit-site-create-template-part-modal__area-radio-group",id:`edit-site-create-template-part-modal__area-selection-${x}`,onChange:v,checked:f},C.map((({icon:e,label:t,area:n,description:r})=>(0,l.createElement)(b.__experimentalRadio,{key:t,value:n,className:"edit-site-create-template-part-modal__area-radio"},(0,l.createElement)(b.Flex,{align:"start",justify:"start"},(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.Icon,{icon:e})),(0,l.createElement)(b.FlexBlock,{className:"edit-site-create-template-part-modal__option-label"},t,(0,l.createElement)("div",null,r)),(0,l.createElement)(b.FlexItem,{className:"edit-site-create-template-part-modal__checkbox"},f===n&&(0,l.createElement)(b.Icon,{icon:S})))))))),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:()=>{r()}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit","aria-disabled":!p||_,isBusy:_},n))))}const{useHistory:ni,useLocation:ri}=Xe(gt.privateApis),{CreatePatternModal:ai,useAddPatternCategory:si}=Xe(St.privateApis);function ii(){const e=ni(),{params:t}=ri(),[n,r]=(0,g.useState)(!1),[a,s]=(0,g.useState)(!1),i=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme()?.is_block_theme),[]),{createPatternFromFile:o}=Xe((0,m.useDispatch)(St.store)),{createSuccessNotice:c,createErrorNotice:u}=(0,m.useDispatch)(ge.store),d=(0,g.useRef)();function p(){r(!1),s(!1)}const h=[{icon:cr,onClick:()=>r(!0),title:(0,E.__)("Create pattern")}];i&&h.push({icon:Ks,onClick:()=>s(!0),title:(0,E.__)("Create template part")}),h.push({icon:Xs,onClick:()=>{d.current.click()},title:(0,E.__)("Import pattern from JSON")});const{categoryMap:f,findOrCreateTerm:y}=si();return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.DropdownMenu,{controls:h,toggleProps:{as:mr},icon:Za,label:(0,E.__)("Create pattern")}),n&&(0,l.createElement)(ai,{onClose:()=>r(!1),onSuccess:function({pattern:t,categoryId:n}){r(!1),e.push({postId:t.id,postType:It.user,categoryType:It.theme,categoryId:n,canvas:"edit"})},onError:p}),a&&(0,l.createElement)(ei,{closeModal:()=>s(!1),blocks:[],onCreate:function(t){s(!1),e.push({postId:t.id,postType:kt,canvas:"edit"})},onError:p}),(0,l.createElement)("input",{type:"file",accept:".json",hidden:!0,ref:d,onChange:async n=>{const r=n.target.files?.[0];if(r)try{let n;if(t.categoryType!==kt){const e=f.values().find((e=>e.name===t.categoryId));e&&(n=e.id||await y(e.label))}const a=await o(r,n?[n]:void 0);n||"my-patterns"===t.categoryId||e.push({path:"/patterns",categoryType:It.theme,categoryId:Mt}),c((0,E.sprintf)((0,E.__)('Imported "%s" from JSON.'),a.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){u(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{n.target.value=""}}}))}function oi({count:e,icon:t,id:n,isActive:r,label:a,type:s}){const i=Et({path:"/patterns",categoryType:s,categoryId:n});if(e)return(0,l.createElement)(vr,{...i,icon:t,suffix:(0,l.createElement)("span",null,e),"aria-current":r?"true":void 0},a)}const li=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));var ci={};function ui(e){return[e]}function di(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;re.name||"",gi=e=>e.title,yi=e=>e.description||"",vi=e=>e.keywords||[],_i=()=>!1;function bi(e=""){return vs(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function Ei(e=""){return e=(e=(e=hi()(e)).replace(/^\//,"")).toLowerCase()}const wi=(e="")=>bi(Ei(e)),Si=(e=[],t="",n={})=>{const r=wi(t),a=n.categoryId!==Mt&&!r.length,s={...n,onlyFilterByCategory:a},i=a?0:1,o=e.map((e=>[e,xi(e,t,s)])).filter((([,e])=>e>i));return 0===r.length||o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function xi(e,t,n){const{categoryId:r,getName:a=fi,getTitle:s=gi,getDescription:i=yi,getKeywords:o=vi,hasCategory:l=_i,onlyFilterByCategory:c}=n;let u=r===Mt||r===At&&e.type===It.user||l(e,r)?1:0;if(!u||c)return u;const d=a(e),m=s(e),p=i(e),h=o(e),f=Ei(t),g=Ei(m);if(f===g)u+=30;else if(g.startsWith(f))u+=20;else{const e=[d,m,p,...h].join(" ");0===((e,t)=>e.filter((e=>!wi(t).some((t=>t.includes(e))))))(bi(f),e).length&&(u+=10)}return u}const Ci=[],ki=(e,t)=>e&&t?e+"//"+t:null,Ti=mi(((e,t,n="")=>{var r;const{getEntityRecords:a,getIsResolving:s}=e(ye.store),{__experimentalGetDefaultTemplatePartAreas:i}=e(y.store),o={per_page:-1},l=(null!==(r=a("postType",kt,o))&&void 0!==r?r:Ci).map((e=>(e=>({blocks:(0,u.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),categories:[e.area],description:e.description||"",isCustom:e.source===Tt.custom,keywords:e.keywords||[],id:ki(e.theme,e.slug),name:ki(e.theme,e.slug),title:(0,en.decodeEntities)(e.title.rendered),type:e.type,templatePart:e}))(e))),c=(i()||[]).map((e=>e.area)),d=s("getEntityRecords",["postType",kt,o]),m=Si(l,n,{categoryId:t,hasCategory:(e,t)=>t!==Pt?e.templatePart.area===t:e.templatePart.area===t||!c.includes(e.templatePart.area)});return{patterns:m,isResolving:d}}),(e=>[e(ye.store).getEntityRecords("postType",kt,{per_page:-1}),e(ye.store).getIsResolving("getEntityRecords",["postType",kt,{per_page:-1}]),e(y.store).__experimentalGetDefaultTemplatePartAreas()])),Pi=mi((e=>{var t;const{getSettings:n}=Xe(e(tr)),{getIsResolving:r}=e(ye.store),a=n();return{patterns:[...(null!==(t=a.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:a.__experimentalBlockPatterns)||[],...e(ye.store).getBlockPatterns()||[]].filter((e=>!Ot.includes(e.source))).filter(li).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:It.theme,blocks:(0,u.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:r("getBlockPatterns")}}),(e=>[e(ye.store).getBlockPatterns(),e(ye.store).getIsResolving("getBlockPatterns"),Xe(e(tr)).getSettings()])),Ii=mi(((e,t,n,r="")=>{const{patterns:a,isResolving:s}=Pi(e),{patterns:i,isResolving:o}=Mi(e);let l=[...a||[],...i||[]];return n&&(l=l.filter((e=>e.type===It.user?e.syncStatus===n:n===Nt.unsynced))),l=Si(l,r,t?{categoryId:t,hasCategory:(e,t)=>e.categories?.includes(t)}:{hasCategory:e=>!e.hasOwnProperty("categories")}),{patterns:l,isResolving:s||o}}),(e=>[Pi(e),Mi(e)])),Mi=mi(((e,t,n="")=>{const{getEntityRecords:r,getIsResolving:a,getUserPatternCategories:s}=e(ye.store),i={per_page:-1},o=r("postType",It.user,i),l=s(),c=new Map;l.forEach((e=>c.set(e.id,e)));let d=o?o.map((e=>((e,t)=>({blocks:(0,u.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||Nt.full,title:e.title.raw,type:e.type,patternPost:e}))(e,c))):Ci;const m=a("getEntityRecords",["postType",It.user,i]);return t&&(d=d.filter((e=>e.syncStatus===t))),d=Si(d,n,{hasCategory:()=>!0}),{patterns:d,isResolving:m,categories:l}}),(e=>[e(ye.store).getEntityRecords("postType",It.user,{per_page:-1}),e(ye.store).getIsResolving("getEntityRecords",["postType",It.user,{per_page:-1}]),e(ye.store).getUserPatternCategories()])),Ai=(e,t,{search:n="",syncStatus:r}={})=>(0,m.useSelect)((a=>e===kt?Ti(a,t,n):e===It.theme?Ii(a,t,r,n):e===It.user?Mi(a,r,n):{patterns:Ci,isResolving:!1}),[t,e,n,r]);function Oi(){const e=function(){const e=(0,m.useSelect)((e=>{var t;const{getSettings:n}=Xe(e(tr)),r=n();return null!==(t=r.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:r.__experimentalBlockPatternCategories}));return[...e||[],...(0,m.useSelect)((e=>e(ye.store).getBlockPatternCategories()))||[]]}();e.push({name:Pt,label:(0,E.__)("Uncategorized")});const t=function(){const e=(0,m.useSelect)((e=>{var t;const{getSettings:n}=Xe(e(tr));return null!==(t=n().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:n().__experimentalBlockPatterns})),t=(0,m.useSelect)((e=>e(ye.store).getBlockPatterns()));return(0,g.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Ot.includes(e.source))).filter(li).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:n,categories:r}=Ai(It.user),a=(0,g.useMemo)((()=>{const a={},s=[];e.forEach((e=>{a[e.name]||(a[e.name]={...e,count:0})})),r.forEach((e=>{a[e.name]||(a[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{a[e]&&(a[e].count+=1)})),e.categories?.length||(a.uncategorized.count+=1)})),n.forEach((e=>{e.categories?.forEach((e=>{a[e]&&(a[e].count+=1)})),e.categories?.length||(a.uncategorized.count+=1)})),[...e,...r].forEach((e=>{a[e.name].count&&!s.find((t=>t.name===e.name))&&s.push(a[e.name])}));const i=s.sort(((e,t)=>e.label.localeCompare(t.label)));return i.unshift({name:At,label:(0,E.__)("My patterns"),count:n.length}),i.unshift({name:Mt,label:(0,E.__)("All patterns"),description:(0,E.__)("A list of all patterns from all sources."),count:t.length+n.length}),i}),[e,t,r,n]);return{patternCategories:a,hasPatterns:!!a.length}}const Ni=e=>{const t=e||[],n=(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplatePartAreas()),[]),r={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>r[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>(e[e[t.area]?t.area:Pt].templateParts.push(t),e)),r)};function Fi({areas:e,currentArea:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-patterns__group-header"},(0,l.createElement)(b.__experimentalHeading,{level:2},(0,E.__)("Template parts"))),(0,l.createElement)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},Object.entries(e).map((([e,{label:r,templateParts:a}])=>(0,l.createElement)(oi,{key:e,count:a?.length,icon:(0,y.getTemplatePartIcon)(e),label:r,id:e,type:kt,isActive:t===e&&n===kt})))))}function Ri({categories:e,currentCategory:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},e.map((e=>(0,l.createElement)(oi,{key:e.name,count:e.count,label:e.label,icon:Ys,id:e.name,type:"pattern",isActive:t===`${e.name}`&&(n===It.theme||n===It.user)})))))}function Di(){const e=(0,ie.useViewportMatch)("medium","<"),{categoryType:t,categoryId:n}=(0,yt.getQueryArgs)(window.location.href),r=n||Mt,a=t||It.theme,{templatePartAreas:s,hasTemplateParts:i,isLoading:o}=function(){const{records:e,isResolving:t}=(0,ye.useEntityRecords)("postType",kt,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Ni(e)}}(),{patternCategories:c,hasPatterns:u}=Oi(),d=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme()?.is_block_theme),[]),p=(0,m.useSelect)((e=>!!e(tr).getSettings().supportsTemplatePartsMode),[]),h=Et({path:"/wp_template_part/all",didAccessPatternsPage:!d&&p?1:void 0}),f=e?void 0:(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(vr,{as:"a",href:"edit.php?post_type=wp_block",withChevron:!0},(0,E.__)("Manage all of my patterns")),(d||p)&&(0,l.createElement)(vr,{withChevron:!0,...h},(0,E.__)("Manage all template parts")));return(0,l.createElement)(hr,{isRoot:!d,title:(0,E.__)("Patterns"),description:(0,E.__)("Manage what patterns are available when editing the site."),actions:(0,l.createElement)(ii,null),footer:f,content:(0,l.createElement)(l.Fragment,null,o&&(0,E.__)("Loading patterns…"),!o&&(0,l.createElement)(l.Fragment,null,!i&&!u&&(0,l.createElement)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},(0,l.createElement)(b.__experimentalItem,null,(0,E.__)("No template parts or patterns found"))),u&&(0,l.createElement)(Ri,{categories:c,currentCategory:r,currentType:a}),i&&(0,l.createElement)(Fi,{areas:s,currentArea:r,currentType:a})))})}const{useLocation:Vi}=Xe(gt.privateApis),Li=[Ct,kt,xt,It.user];function Bi(){const{params:e={}}=Vi(),{postType:t,postId:n,context:r,isReady:a}=function({path:e,postId:t,postType:n}){const{hasLoadedAllDependencies:r,homepageId:a,url:s,frontPageTemplateId:i}=(0,m.useSelect)((e=>{const{getSite:t,getUnstableBase:n,getEntityRecords:r}=e(ye.store),a=t(),s=n(),i=r("postType",Ct,{per_page:-1});let o;if(i){const e=i.find((e=>"front-page"===e.slug));o=!!e&&e.id}return{hasLoadedAllDependencies:!!s&&!!a,homepageId:"page"===a?.show_on_front&&["number","string"].includes(typeof a.page_on_front)?a.page_on_front.toString():null,url:s?.home,frontPageTemplateId:o}}),[]),o=(0,m.useSelect)((o=>{if(Li.includes(n))return;const{getEditedEntityRecord:l,getEntityRecords:c,getDefaultTemplateId:u,__experimentalGetTemplateForLink:d}=o(ye.store);function m(e,t){if("page"===e&&a===t){if(void 0===i)return;if(i)return i}const n=l("postType",e,t);if(!n)return;const r=n.template;if(r){const e=c("postType",Ct,{per_page:-1})?.find((({slug:e})=>e===r));if(e)return e.id}let s;return s=n.slug?"page"===e?`${e}-${n.slug}`:`single-${e}-${n.slug}`:"page"===e?"page":`single-${e}`,u({slug:s})}if(r){if(n&&t)return m(n,t);if("/pages"===e&&t)return m("page",t);if(a)return m("page",a);if(s){const e=d(s);return e?.id}}}),[a,r,s,t,n,e,i]),l=(0,g.useMemo)((()=>Li.includes(n)?{}:n&&t?{postType:n,postId:t}:"/pages"===e&&t?{postType:"page",postId:t}:a?{postType:"page",postId:a}:{}),[a,n,t,e]);return"/wp_template/all"===e&&t?{isReady:!0,postType:"wp_template",postId:t,context:l}:"/wp_template_part/all"===e&&t?{isReady:!0,postType:"wp_template_part",postId:t,context:l}:Li.includes(n)?{isReady:!0,postType:n,postId:t,context:l}:r?{isReady:void 0!==o,postType:Ct,postId:o,context:l}:{isReady:!1}}(e),{setEditedEntity:s}=(0,m.useDispatch)(tr);(0,g.useEffect)((()=>{a&&s(t,n,r)}),[a,t,n,r,s])}function zi(e,t){var n=e.toLowerCase();return 0===t?function(e){return e.charAt(0).toUpperCase()+e.substr(1)}(n):n}const Hi=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),Gi=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),{useLocation:Ui,useHistory:Wi}=Xe(gt.privateApis);function ji(e){var t;let n=null!==(t=e?.path)&&void 0!==t?t:"/";if(e?.postType&&e?.postId)switch(e.postType){case It.user:case Ct:case kt:case"page":n=`/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`;break;default:n=`/navigation/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`}return n}function Zi(){const e=Wi(),{params:t}=Ui(),{location:n,params:r,goTo:a}=(0,b.__experimentalUseNavigator)(),s=(0,g.useRef)(!0);(0,g.useEffect)((()=>{function a(n){if(r=n,a=t,Object.entries(r).every((([e,t])=>a[e]===t)))return;var r,a;const s={...t,...n};e.push(s)}s.current?s.current=!1:r?.postType&&r?.postId?a({postType:r?.postType,postId:r?.postId,path:void 0,layout:void 0}):n.path.startsWith("/page/")&&r?.postId?a({postType:"page",postId:r?.postId,path:void 0,layout:void 0}):"/patterns"===n.path?a({postType:void 0,postId:void 0,canvas:void 0,path:n.path}):"/wp_template/all"!==n.path||window?.__experimentalAdminViews?"/pages"===n.path&&window?.__experimentalAdminViews||"/wp_template/all"===n.path&&window?.__experimentalAdminViews||"/wp_template_part/all"===n.path&&window?.__experimentalAdminViews?a({postType:void 0,categoryType:void 0,categoryId:void 0,path:n.path}):a({postType:void 0,postId:void 0,categoryType:void 0,categoryId:void 0,layout:void 0,path:"/"===n.path?void 0:n.path}):a({postType:void 0,categoryType:void 0,categoryId:void 0,path:n.path,layout:void 0})}),[n?.path,r]),(0,g.useEffect)((()=>{const e=ji(t);n.path!==e&&a(e)}),[t])}const qi={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useLocation:Yi,useHistory:Ki}=Xe(gt.privateApis);function Xi(e){const t=Yi(),n=Ki(),{block:r}=e,{clientId:a}=r,{moveBlocksDown:s,moveBlocksUp:i,removeBlocks:o}=(0,m.useDispatch)(fe.store),c=(0,E.sprintf)((0,E.__)("Remove %s"),(0,fe.BlockTitle)({clientId:a,maximumLength:25})),u=(0,E.sprintf)((0,E.__)("Go to %s"),(0,fe.BlockTitle)({clientId:a,maximumLength:25})),d=(0,m.useSelect)((e=>{const{getBlockRootClientId:t}=e(fe.store);return t(a)}),[a]),p=(0,g.useCallback)((e=>{const{attributes:r,name:a}=e;"post-type"===r.kind&&r.id&&r.type&&n&&n.push({postType:r.type,postId:r.id,...vt()&&{wp_theme_preview:_t()}},{backPath:ji(t.params)}),"core/page-list-item"===a&&r.id&&n&&n.push({postType:"page",postId:r.id,...vt()&&{wp_theme_preview:_t()}},{backPath:ji(t.params)})}),[n]);return(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:qi,noIcons:!0,...e},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{icon:Hi,onClick:()=>{i([a],d),e()}},(0,E.__)("Move up")),(0,l.createElement)(b.MenuItem,{icon:Gi,onClick:()=>{s([a],d),e()}},(0,E.__)("Move down")),"page"===r.attributes?.type&&r.attributes?.id&&(0,l.createElement)(b.MenuItem,{onClick:()=>{p(r),e()}},u)),(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{onClick:()=>{o([a],!1),e()}},c)))))}const{PrivateListView:Ji}=Xe(fe.privateApis),Qi=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function $i({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,m.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:r,getBlockCount:a,getBlockOrder:s}=t(fe.store),{isResolving:i}=t(ye.store),o=s(e),l=1===o.length&&"core/page-list"===r(o[0])&&a(o[0])>0,c=i("getEntityRecords",Qi);return{listViewRootClientId:l?o[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:r,__unstableMarkNextChangeAsNotPersistent:a}=(0,m.useDispatch)(fe.store),s=(0,g.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(a(),r(e.clientId,(0,u.createBlock)("core/navigation-link",e.attributes)))}),[a,r]);return(0,l.createElement)(l.Fragment,null,!n&&(0,l.createElement)(Ji,{rootClientId:t,onSelect:s,blockSettingsMenu:Xi,showAppender:!1}),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor"},(0,l.createElement)(fe.BlockList,null)))}const eo=()=>{};function to({navigationMenuId:e}){const{storedSettings:t}=(0,m.useSelect)((e=>{const{getSettings:t}=Xe(e(tr));return{storedSettings:t()}}),[]),n=(0,g.useMemo)((()=>e?[(0,u.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,l.createElement)(fe.BlockEditorProvider,{settings:t,value:n,onChange:eo,onInput:eo},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content"},(0,l.createElement)($i,{rootClientId:n[0].clientId}))):null}function no(e){return(0,m.useSelect)((t=>{if(!e)return;const n=t(ye.store).getEditedEntityRecord("postType",xt,e);return"trash"===n.status?void 0:n.title}),[e])}function ro({id:e}){const t=no(e);return e&&void 0!==t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},t||(0,E.__)("Navigation")),(0,l.createElement)(to,{navigationMenuId:e})):null}function ao({id:e}){const t=no(e),n=Et({postId:e,postType:xt});return e&&void 0!==t?(0,l.createElement)(vr,{withChevron:!0,...n},t||(0,E.__)("(no title)")):null}function so({menus:e}){return(0,l.createElement)(b.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu-list"},e.map((e=>(0,l.createElement)(ao,{key:e,id:e}))))}function io({menus:e}){return e.length?1===e.length?(0,l.createElement)(ro,{id:e[0]}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},(0,E.__)("Navigation")),(0,l.createElement)(so,{menus:e})):null}function oo(e,t){const{record:n}=Ds(e,t);if(e!==kt)return;const r=function(e){return e?.blocks?e?.blocks:e?.content&&"function"!=typeof e.content?(0,u.parse)(e.content):[]}(n),a=function(e,t){if(!e||!t?.length)return[];const n=t=>{if(!t)return[];const r=[];for(const a of t)if(a.name===e&&r.push(a),a?.innerBlocks){const e=n(a.innerBlocks);e.length&&r.push(...e)}return r};return n(t)}("core/navigation",r);if(!a.length)return;const s=a?.map((e=>e.attributes.ref)),i=[...new Set(s)].filter((e=>e));return i?.length?(0,l.createElement)(io,{menus:i}):void 0}function lo(e,t){const{getDescription:n,getTitle:r,record:a}=Ds(e,t),s=(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplatePartAreas()),[]),{currentTheme:i,userPatternCategories:o}=(0,m.useSelect)((e=>{const{getCurrentTheme:t,getUserPatternCategories:n}=e(ye.store);return{currentTheme:t(),userPatternCategories:n()}}),[]),c=Bs(e,t),u="theme"===c.type&&a.theme===i?.stylesheet,d=r();let p=n();!p&&c.text&&(p=e===It.user?(0,E.sprintf)((0,E.__)("This is the %s pattern."),r()):(0,E.sprintf)((0,E.__)("This is the %s template part."),r())),!p&&e===It.user&&a?.title&&(p=(0,E.sprintf)((0,E.__)("This is the %s pattern."),a.title));const h=a?.modified?(0,l.createElement)(Ca,{record:a}):null,f=[];if((e===It.user||e===kt)&&(f.push({label:(0,E.__)("Syncing"),value:a.wp_pattern_sync_status===Nt.unsynced?(0,E._x)("Not synced","Text that indicates that the pattern is not synchronized"):(0,E._x)("Synced","Text that indicates that the pattern is synchronized")}),0===a.wp_pattern_category?.length&&f.push({label:(0,E.__)("Categories"),value:(0,E.__)("Uncategorized")}),a.wp_pattern_category?.length>0)){const e=new Map;o.forEach((t=>e.set(t.id,t)));const t=a.wp_pattern_category.filter((t=>e.get(t))).map((t=>e.get(t).label));f.push({label:(0,E.__)("Categories"),value:t.length>0?t.join(", "):""})}if(e===kt){const e=s.find((e=>e.area===a.area));let t=e?.label;t||(t=a.area?(0,E.sprintf)((0,E.__)("%s (removed)"),(g=a.area,void 0===v&&(v={}),vs(g,hs({delimiter:" ",transform:zi},v)))):(0,E.__)("None")),f.push({label:(0,E.__)("Area"),value:t})}var g,v;e===kt&&c.text&&!u&&f.push({label:(0,E.__)("Added by"),value:(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-author"},c.text)}),e!==kt||!c.text||a.origin!==Tt.plugin&&!0!==a.has_theme_file||f.push({label:(0,E.__)("Customized"),value:(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"},c.isCustomized?(0,E.__)("Yes"):(0,E.__)("No"))});return{title:d,description:p,content:(0,l.createElement)(l.Fragment,null,oo(e,t),!!f.length&&(0,l.createElement)(xa,{spacing:5,title:(0,E.__)("Details")},f.map((({label:e,value:t})=>(0,l.createElement)(wa,{key:e},(0,l.createElement)(Ea,null,e),(0,l.createElement)(Sa,null,t)))))),footer:h}}function co(){const e=(0,b.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{categoryType:r}=(0,yt.getQueryArgs)(window.location.href),{setCanvasMode:a}=Xe((0,m.useDispatch)(tr));Bi();const s=lo(t,n),i=r||t!==kt?"/patterns":"/wp_template_part/all";return(0,l.createElement)(hr,{actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Us,{postType:t,postId:n,toggleProps:{as:mr},onRemove:()=>{e.goTo(i)}}),(0,l.createElement)(mr,{onClick:()=>a("edit"),label:(0,E.__)("Edit"),icon:br})),backPath:i,...s})}const uo={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},mo=e=>e?.trim()?.length>0;function po({menuTitle:e,onClose:t,onSave:n}){const[r,a]=(0,g.useState)(e),s=r!==e&&mo(r);return(0,l.createElement)(b.Modal,{title:(0,E.__)("Rename"),onRequestClose:t},(0,l.createElement)("form",{className:"sidebar-navigation__rename-modal-form"},(0,l.createElement)(b.__experimentalVStack,{spacing:"3"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:r,placeholder:(0,E.__)("Navigation title"),onChange:a}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,disabled:!s,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),s&&(n({title:r}),t())}},(0,E.__)("Save"))))))}function ho({onClose:e,onConfirm:t}){return(0,l.createElement)(b.__experimentalConfirmDialog,{isOpen:!0,onConfirm:n=>{n.preventDefault(),t(),e()},onCancel:e,confirmButtonText:(0,E.__)("Delete")},(0,E.__)("Are you sure you want to delete this Navigation menu?"))}const fo={position:"bottom right"};function go(e){const{onDelete:t,onSave:n,onDuplicate:r,menuTitle:a}=e,[s,i]=(0,g.useState)(!1),[o,c]=(0,g.useState)(!1),u=()=>{i(!1),c(!1)};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,E.__)("Actions"),icon:ue,popoverProps:fo},(({onClose:e})=>(0,l.createElement)("div",null,(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{onClick:()=>{i(!0),e()}},(0,E.__)("Rename")),(0,l.createElement)(b.MenuItem,{onClick:()=>{r(),e()}},(0,E.__)("Duplicate")),(0,l.createElement)(b.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()}},(0,E.__)("Delete")))))),o&&(0,l.createElement)(ho,{onClose:u,onConfirm:t}),s&&(0,l.createElement)(po,{onClose:u,menuTitle:a,onSave:n}))}function yo(e,t,n){return e?.rendered?"publish"===n?(0,en.decodeEntities)(e?.rendered):(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),(0,en.decodeEntities)(e?.rendered),n):(0,E.sprintf)((0,E.__)("(no title %s)"),t)}function vo({postId:e}){const t=Et({postId:e,postType:xt,canvas:"edit"});return(0,l.createElement)(mr,{...t,label:(0,E.__)("Edit"),icon:br})}function _o({navigationMenu:e,handleDelete:t,handleDuplicate:n,handleSave:r}){const a=e?.title?.rendered;return(0,l.createElement)(Po,{actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(go,{menuTitle:(0,en.decodeEntities)(a),onDelete:t,onSave:r,onDuplicate:n}),(0,l.createElement)(vo,{postId:e?.id})),title:yo(e?.title,e?.id,e?.status),description:(0,E.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(to,{navigationMenuId:e?.id}))}const bo="wp_navigation";function Eo(){const{params:{postId:e}}=(0,b.__experimentalUseNavigator)(),{record:t,isResolving:n}=(0,ye.useEntityRecord)("postType",bo,e),{isSaving:r,isDeleting:a}=(0,m.useSelect)((t=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:r}=t(ye.store);return{isSaving:n("postType",bo,e),isDeleting:r("postType",bo,e)}}),[e]),s=n||r||a,i=t?.title?.rendered||t?.slug,{handleSave:o,handleDelete:c,handleDuplicate:u}=Co(),d=()=>c(t),p=e=>o(t,e),h=()=>u(t);return s?(0,l.createElement)(Po,{description:(0,E.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(b.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):s||t?t?.content?.raw?(0,l.createElement)(_o,{navigationMenu:t,handleDelete:d,handleSave:p,handleDuplicate:h}):(0,l.createElement)(Po,{actions:(0,l.createElement)(go,{menuTitle:(0,en.decodeEntities)(i),onDelete:d,onSave:p,onDuplicate:h}),title:yo(t?.title,t?.id,t?.status),description:(0,E.__)("This Navigation Menu is empty.")}):(0,l.createElement)(Po,{description:(0,E.__)("Navigation Menu missing.")})}function wo(){const{goTo:e}=(0,b.__experimentalUseNavigator)(),{deleteEntityRecord:t}=(0,m.useDispatch)(ye.store),{createSuccessNotice:n,createErrorNotice:r}=(0,m.useDispatch)(ge.store);return async a=>{const s=a?.id;try{await t("postType",bo,s,{force:!0},{throwOnError:!0}),n((0,E.__)("Deleted Navigation menu"),{type:"snackbar"}),e("/navigation")}catch(e){r((0,E.sprintf)((0,E.__)("Unable to delete Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function So(){const{getEditedEntityRecord:e}=(0,m.useSelect)((e=>{const{getEditedEntityRecord:t}=e(ye.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:n}=(0,m.useDispatch)(ye.store),{createSuccessNotice:r,createErrorNotice:a}=(0,m.useDispatch)(ge.store);return async(s,i)=>{if(!i)return;const o=s?.id,l=e("postType",xt,o);t("postType",bo,o,i);const c=Object.keys(i);try{await n("postType",bo,o,c,{throwOnError:!0}),r((0,E.__)("Renamed Navigation menu"),{type:"snackbar"})}catch(e){t("postType",bo,o,l),a((0,E.sprintf)((0,E.__)("Unable to rename Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function xo(){const{goTo:e}=(0,b.__experimentalUseNavigator)(),{saveEntityRecord:t}=(0,m.useDispatch)(ye.store),{createSuccessNotice:n,createErrorNotice:r}=(0,m.useDispatch)(ge.store);return async a=>{const s=a?.title?.rendered||a?.slug;try{const r=await t("postType",bo,{title:(0,E.sprintf)((0,E.__)("%s (Copy)"),s),content:a?.content?.raw,status:"publish"},{throwOnError:!0});r&&(n((0,E.__)("Duplicated Navigation menu"),{type:"snackbar"}),e(`/navigation/${bo}/${r.id}`))}catch(e){r((0,E.sprintf)((0,E.__)("Unable to duplicate Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function Co(){return{handleDelete:wo(),handleSave:So(),handleDuplicate:xo()}}let ko=!1;function To(){const{records:e,isResolving:t,hasResolved:n}=(0,ye.useEntityRecords)("postType",xt,uo),r=t&&!n,{getNavigationFallbackId:a}=Xe((0,m.useSelect)(ye.store)),s=e?.[0];s&&(ko=!0),s||t||!n||ko||a();const{handleSave:i,handleDelete:o,handleDuplicate:c}=Co(),u=!!e?.length;return r?(0,l.createElement)(Po,null,(0,l.createElement)(b.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):r||u?1===e?.length?(0,l.createElement)(_o,{navigationMenu:s,handleDelete:()=>o(s),handleDuplicate:()=>c(s),handleSave:e=>i(s,e)}):(0,l.createElement)(Po,null,(0,l.createElement)(b.__experimentalItemGroup,null,e?.map((({id:e,title:t,status:n},r)=>(0,l.createElement)(Io,{postId:e,key:e,withChevron:!0,icon:sr},function(e,t,n){return e?"publish"===n?(0,en.decodeEntities)(e):(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),(0,en.decodeEntities)(e),n):(0,E.sprintf)((0,E.__)("(no title %s)"),t)}(t?.rendered,r+1,n)))))):(0,l.createElement)(Po,{description:(0,E.__)("No Navigation Menus found.")})}function Po({children:e,actions:t,title:n,description:r}){return(0,l.createElement)(hr,{title:n||(0,E.__)("Navigation"),actions:t,description:r||(0,E.__)("Manage your Navigation menus."),content:e})}const Io=({postId:e,...t})=>{const n=Et({postId:e,postType:xt});return(0,l.createElement)(vr,{...n,...t})},Mo=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),Ao=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Oo=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),No=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})),Fo=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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 Ro({selection:e,onSelectionChange:t,item:n,data:r,getItemId:a,primaryField:s,disabled:i}){const o=a(n),c=e.includes(o);let u;return u=s?.getValue&&n?(0,E.sprintf)(c?(0,E.__)("Deselect item: %s"):(0,E.__)("Select item: %s"),s.getValue({item:n})):c?(0,E.__)("Select a new item"):(0,E.__)("Deselect item"),(0,l.createElement)(b.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,label:u,"aria-disabled":i,checked:c,onChange:()=>{i||t(c?r.filter((t=>{const n=a?.(t);return n!==o&&e.includes(n)})):r.filter((t=>{const n=a?.(t);return n===o||e.includes(n)})))}})}const{lock:Do,unlock:Vo}=(0,Ye.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/dataviews"),{DropdownMenuV2:Lo,DropdownMenuGroupV2:Bo,DropdownMenuItemV2:zo,DropdownMenuItemLabelV2:Ho,kebabCase:Go}=Vo(b.privateApis);function Uo({action:e,onClick:t}){return(0,l.createElement)(b.Button,{label:e.label,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t})}function Wo({action:e,onClick:t}){return(0,l.createElement)(zo,{onClick:t,hideOnClick:!e.RenderModal},(0,l.createElement)(Ho,null,e.label))}function jo({action:e,item:t,ActionTrigger:n}){const[r,a]=(0,g.useState)(!1),s={action:e,onClick:()=>a(!0)},{RenderModal:i,hideModalHeader:o}=e;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(n,{...s}),r&&(0,l.createElement)(b.Modal,{title:e.modalHeader||e.label,__experimentalHideHeader:!!o,onRequestClose:()=>{a(!1)},overlayClassName:`dataviews-action-modal dataviews-action-modal__${Go(e.id)}`},(0,l.createElement)(i,{items:[t],closeModal:()=>a(!1)})))}function Zo({actions:e,item:t}){return(0,l.createElement)(Bo,null,e.map((e=>e.RenderModal?(0,l.createElement)(jo,{key:e.id,action:e,item:t,ActionTrigger:Wo}):(0,l.createElement)(Wo,{key:e.id,action:e,onClick:()=>e.callback([t])}))))}function qo({item:e,actions:t,isCompact:n}){const{primaryActions:r,secondaryActions:a}=(0,g.useMemo)((()=>t.reduce(((t,n)=>(n.isEligible&&!n.isEligible(e)||(n.isPrimary&&n.icon?t.primaryActions.push(n):t.secondaryActions.push(n)),t)),{primaryActions:[],secondaryActions:[]})),[t,e]);return n?(0,l.createElement)(Yo,{item:e,primaryActions:r,secondaryActions:a}):(0,l.createElement)(b.__experimentalHStack,{spacing:1,justify:"flex-end",style:{flexShrink:"0",width:"auto"}},!!r.length&&r.map((t=>t.RenderModal?(0,l.createElement)(jo,{key:t.id,action:t,item:e,ActionTrigger:Uo}):(0,l.createElement)(Uo,{key:t.id,action:t,onClick:()=>t.callback([e])}))),(0,l.createElement)(Lo,{trigger:(0,l.createElement)(b.Button,{size:"compact",icon:ue,label:(0,E.__)("Actions"),disabled:!a.length}),placement:"bottom-end"},(0,l.createElement)(Zo,{actions:a,item:e})))}function Yo({item:e,primaryActions:t,secondaryActions:n}){return(0,l.createElement)(Lo,{trigger:(0,l.createElement)(b.Button,{size:"compact",icon:ue,label:(0,E.__)("Actions"),disabled:!t.length&&!n.length}),placement:"bottom-end"},!!t.length&&(0,l.createElement)(Zo,{actions:t,item:e}),!!n.length&&(0,l.createElement)(Zo,{actions:n,item:e}))}const Ko=({data:e,view:t,fields:n,textFields:r})=>{const a=[...e],s=t.sort.field;if(r.includes(s)){const e=n.find((e=>e.id===s));a.sort(((n,r)=>{var a,s;const i=null!==(a=e.getValue({item:n}))&&void 0!==a?a:"",o=null!==(s=e.getValue({item:r}))&&void 0!==s?s:"";return"asc"===t.sort.direction?i.localeCompare(o):o.localeCompare(i)}))}return a};function Xo({data:e,view:t}){const n=(t.page-1)*t.perPage,r=e?.length||0;return e=e?.slice(n,n+t.perPage),{data:e,paginationInfo:{totalItems:r,totalPages:Math.ceil(r/t.perPage)}}}const Jo=e=>{let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=Object.keys(xl)),t.filter((e=>Object.keys(xl).includes(e)))},{DropdownMenuV2:Qo,DropdownMenuGroupV2:$o,DropdownMenuItemV2:el,DropdownMenuSeparatorV2:tl}=Vo(b.privateApis);function nl(e,t){return(0,g.useMemo)((()=>e.some((e=>e.supportsBulk&&e.isEligible(t)))),[e,t])}function rl({action:e,selectedItems:t,setActionWithModal:n,onMenuOpenChange:r}){const a=(0,g.useMemo)((()=>t.filter((t=>e.isEligible(t)))),[e,t]),{RenderModal:s,hideModalHeader:i}=e,o=(0,g.useCallback)((()=>{n(void 0)}),[n]);return(0,l.createElement)(b.Modal,{title:!i&&e.label,__experimentalHideHeader:!!i,onRequestClose:o,overlayClassName:"dataviews-action-modal"},(0,l.createElement)(s,{items:a,closeModal:o,onPerform:()=>r(!1)}))}function al({action:e,selectedItems:t,setActionWithModal:n}){const r=(0,g.useMemo)((()=>t.filter((t=>e.isEligible(t)))),[e,t]),a=!!e.RenderModal;return(0,l.createElement)(el,{key:e.id,disabled:0===r.length,hideOnClick:!a,onClick:async()=>{a?n(e):await e.callback(r)},suffix:r.length>0?r.length:void 0},e.label)}function sl({actions:e,selectedItems:t,setActionWithModal:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)($o,null,e.map((e=>(0,l.createElement)(al,{key:e.id,action:e,selectedItems:t,setActionWithModal:n})))),(0,l.createElement)(tl,null))}function il({data:e,actions:t,selection:n,onSelectionChange:r,getItemId:a}){const s=(0,g.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),[i,o]=(0,g.useState)(!1),[c,u]=(0,g.useState)(),d=(0,g.useMemo)((()=>e.filter((e=>s.some((t=>t.isEligible(e)))))),[e,s]),m=d.length,p=n&&n.length===m,h=(0,g.useMemo)((()=>e.filter((e=>n.includes(a(e))))),[n,e,a]),f=(0,g.useMemo)((()=>h.some((e=>!d.includes(e)))),[h,d]);return(0,g.useEffect)((()=>{f&&r(h.filter((e=>d.some((t=>a(e)===a(t))))))}),[f,h,d,a,r]),0===s.length?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Qo,{open:i,onOpenChange:o,label:(0,E.__)("Bulk actions"),style:{minWidth:"240px"},trigger:(0,l.createElement)(b.Button,{className:"dataviews-bulk-edit-button",__next40pxDefaultSize:!0,variant:"tertiary",size:"compact"},n.length?(0,E.sprintf)((0,E._n)("Edit %d item","Edit %d items",n.length),n.length):(0,E.__)("Bulk edit"))},(0,l.createElement)(sl,{actions:s,setActionWithModal:u,selectedItems:h}),(0,l.createElement)($o,null,(0,l.createElement)(el,{disabled:p,hideOnClick:!1,onClick:()=>{r(d)},suffix:m},(0,E.__)("Select all")),(0,l.createElement)(el,{disabled:0===n.length,hideOnClick:!1,onClick:()=>{r([])}},(0,E.__)("Deselect")))),c&&(0,l.createElement)(rl,{action:c,selectedItems:h,setActionWithModal:u,onMenuOpenChange:o}))}const{DropdownMenuV2:ol,DropdownMenuGroupV2:ll,DropdownMenuItemV2:cl,DropdownMenuRadioItemV2:ul,DropdownMenuItemLabelV2:dl,DropdownMenuSeparatorV2:ml}=Vo(b.privateApis);function pl({children:e}){return g.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,l.createElement)(g.Fragment,{key:t},t>0&&(0,l.createElement)(ml,null),e)))}const hl={asc:"↑",desc:"↓"},fl=(0,g.forwardRef)((function({field:e,view:t,onChangeView:n,onHide:r,setOpenedFilter:a},s){const i=!1!==e.enableHiding,o=!1!==e.enableSorting,c=t.sort?.field===e.id,u=Jo(e),d=!t.filters?.some((t=>e.id===t.field))&&e.type===El&&!!u.length&&!e.filterBy?.isPrimary;return o||i||d?(0,l.createElement)(ol,{align:"start",trigger:(0,l.createElement)(b.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:s,variant:"tertiary"},e.header,c&&(0,l.createElement)("span",{"aria-hidden":"true"},c&&hl[t.sort.direction])),style:{minWidth:"240px"}},(0,l.createElement)(pl,null,o&&(0,l.createElement)(ll,null,Object.entries(Cl).map((([r,a])=>{const s=c&&t.sort.direction===r,i=`${e.id}-${r}`;return(0,l.createElement)(ul,{key:i,name:"view-table-sorting",value:i,checked:s,onChange:()=>{n({...t,sort:{field:e.id,direction:r}})}},(0,l.createElement)(dl,null,a.label))}))),d&&(0,l.createElement)(ll,null,(0,l.createElement)(cl,{prefix:(0,l.createElement)(b.Icon,{icon:No}),onClick:()=>{a(e.id),n({...t,page:1,filters:[...t.filters||[],{field:e.id,value:void 0,operator:u[0]}]})}},(0,l.createElement)(dl,null,(0,E.__)("Add filter")))),i&&(0,l.createElement)(cl,{prefix:(0,l.createElement)(b.Icon,{icon:Fo}),onClick:()=>{r(e),n({...t,hiddenFields:t.hiddenFields.concat(e.id)})}},(0,l.createElement)(dl,null,(0,E.__)("Hide"))))):e.header}));function gl({selection:e,onSelectionChange:t,data:n,actions:r}){const a=(0,g.useMemo)((()=>n.filter((e=>r.some((t=>t.supportsBulk&&t.isEligible(e)))))),[n,r]),s=e.length===a.length;return(0,l.createElement)(b.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:s,indeterminate:!s&&e.length,onChange:()=>{t(s?[]:a)},label:s?(0,E.__)("Deselect all"):(0,E.__)("Select all")})}function yl({hasBulkActions:e,item:t,actions:n,id:r,visibleFields:a,primaryField:s,selection:i,getItemId:o,onSelectionChange:c,data:u}){const d=nl(n,t);return(0,l.createElement)("tr",{className:_()("dataviews-view-table__row",{"is-selected":d&&i.includes(r)})},e&&(0,l.createElement)("td",{className:"dataviews-view-table__checkbox-column",style:{width:20,minWidth:20}},(0,l.createElement)("div",{className:"dataviews-view-table__cell-content-wrapper"},(0,l.createElement)(Ro,{id:r,item:t,selection:i,onSelectionChange:c,getItemId:o,data:u,primaryField:s,disabled:!d}))),a.map((e=>(0,l.createElement)("td",{key:e.id,style:{width:e.width||void 0,minWidth:e.minWidth||void 0,maxWidth:e.maxWidth||void 0}},(0,l.createElement)("div",{className:_()("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__primary-field":s?.id===e.id})},e.render({item:t}))))),!!n?.length&&(0,l.createElement)("td",{className:"dataviews-view-table__actions-column"},(0,l.createElement)(qo,{item:t,actions:n})))}const vl=function({view:e,onChangeView:t,fields:n,actions:r,data:a,getItemId:s,isLoading:i=!1,deferredRendering:o,selection:c,onSelectionChange:u,setOpenedFilter:d}){const m=(0,g.useRef)(new Map),p=(0,g.useRef)(),[h,f]=(0,g.useState)(),y=function(e,t){return(0,g.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&e.isEligible(t)))))),[e,t])}(r,a);(0,g.useEffect)((()=>{p.current&&(p.current.focus(),p.current=void 0)}));const v=(0,ie.useAsyncList)(a),b=(0,g.useId)();if(h)return p.current=h,void f();const w=e=>{const t=m.current.get(e.id),n=m.current.get(t.fallback);f(n?.node)},S=n.filter((t=>!e.hiddenFields.includes(t.id)&&![e.layout.mediaField].includes(t.id))),x=o?v:a,C=!!x?.length,k={asc:"ascending",desc:"descending"},T=n.find((t=>t.id===e.layout.primaryField));return(0,l.createElement)(g.Fragment,null,(0,l.createElement)("table",{className:"dataviews-view-table","aria-busy":i,"aria-describedby":b},(0,l.createElement)("thead",null,(0,l.createElement)("tr",{className:"dataviews-view-table__row"},y&&(0,l.createElement)("th",{className:"dataviews-view-table__checkbox-column",style:{width:20,minWidth:20},"data-field-id":"selection",scope:"col"},(0,l.createElement)(gl,{selection:c,onSelectionChange:u,data:a,actions:r})),S.map(((n,r)=>(0,l.createElement)("th",{key:n.id,style:{width:n.width||void 0,minWidth:n.minWidth||void 0,maxWidth:n.maxWidth||void 0},"data-field-id":n.id,"aria-sort":e.sort?.field===n.id&&k[e.sort.direction],scope:"col"},(0,l.createElement)(fl,{ref:e=>{e?m.current.set(n.id,{node:e,fallback:S[r>0?r-1:1]?.id}):m.current.delete(n.id)},field:n,view:e,onChangeView:t,onHide:w,setOpenedFilter:d})))),!!r?.length&&(0,l.createElement)("th",{"data-field-id":"actions",className:"dataviews-view-table__actions-column"},(0,l.createElement)("span",{className:"dataviews-view-table-header"},(0,E.__)("Actions"))))),(0,l.createElement)("tbody",null,C&&x.map(((e,t)=>(0,l.createElement)(yl,{key:s(e),item:e,hasBulkActions:y,actions:r,id:s(e)||t,visibleFields:S,primaryField:T,selection:c,getItemId:s,onSelectionChange:u,data:a}))))),(0,l.createElement)("div",{className:_()({"dataviews-loading":i,"dataviews-no-results":!C&&!i}),id:b},!C&&(0,l.createElement)("p",null,i?(0,E.__)("Loading…"):(0,E.__)("No results"))))};function _l({selection:e,data:t,onSelectionChange:n,getItemId:r,item:a,actions:s,mediaField:i,primaryField:o,visibleFields:c}){const[u,d]=(0,g.useState)(!1),m=nl(s,a),p=r(a),h=e.includes(p);return(0,l.createElement)(b.__experimentalVStack,{spacing:0,key:p,className:_()("dataviews-view-grid__card",{"is-selected":m&&h,"has-no-pointer-events":u}),onMouseDown:a=>{m&&(a.ctrlKey||a.metaKey)&&(d(!0),n(h?t.filter((t=>{const n=r?.(t);return n!==p&&e.includes(n)})):t.filter((t=>{const n=r?.(t);return n===p||e.includes(n)}))))},onClick:()=>{u&&d(!1)}},(0,l.createElement)("div",{className:"dataviews-view-grid__media"},i?.render({item:a})),(0,l.createElement)(b.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions"},(0,l.createElement)(Ro,{id:p,item:a,selection:e,onSelectionChange:n,getItemId:r,data:t,primaryField:o,disabled:!m}),(0,l.createElement)(b.__experimentalHStack,{className:"dataviews-view-grid__primary-field"},o?.render({item:a})),(0,l.createElement)(qo,{item:a,actions:s,isCompact:!0})),(0,l.createElement)(b.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:3},c.map((e=>{const t=e.render({item:a});return t?(0,l.createElement)(b.__experimentalVStack,{className:"dataviews-view-grid__field",key:e.id,spacing:1},(0,l.createElement)(b.Tooltip,{text:e.header,placement:"left"},(0,l.createElement)("div",{className:"dataviews-view-grid__field-value"},t))):null}))))}const bl=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}));const El="enumeration",wl="in",Sl="notIn",xl={[wl]:{key:"in-filter",label:(0,E.__)("Is")},[Sl]:{key:"not-in-filter",label:(0,E.__)("Is not")}},Cl={asc:{label:(0,E.__)("Sort ascending")},desc:{label:(0,E.__)("Sort descending")}},kl="table",Tl="grid",Pl=[{type:kl,label:(0,E.__)("Table"),component:vl,icon:Mo},{type:Tl,label:(0,E.__)("Grid"),component:function({data:e,fields:t,view:n,actions:r,isLoading:a,getItemId:s,deferredRendering:i,selection:o,onSelectionChange:c}){const u=t.find((e=>e.id===n.layout.mediaField)),d=t.find((e=>e.id===n.layout.primaryField)),m=t.filter((e=>!n.hiddenFields.includes(e.id)&&![n.layout.mediaField,n.layout.primaryField].includes(e.id))),p=(0,ie.useAsyncList)(e,{step:3}),h=i?p:e,f=!!h?.length;return(0,l.createElement)(l.Fragment,null,f&&(0,l.createElement)(b.__experimentalGrid,{gap:6,columns:2,alignment:"top",className:"dataviews-view-grid","aria-busy":a},h.map((t=>(0,l.createElement)(_l,{key:s(t),selection:o,data:e,onSelectionChange:c,getItemId:s,item:t,actions:r,mediaField:u,primaryField:d,visibleFields:m})))),!f&&(0,l.createElement)("div",{className:_()({"dataviews-loading":a,"dataviews-no-results":!a})},(0,l.createElement)("p",null,a?(0,E.__)("Loading…"):(0,E.__)("No results"))))},icon:za},{type:"list",label:(0,E.__)("List"),component:function({view:e,fields:t,data:n,isLoading:r,getItemId:a,onSelectionChange:s,onDetailsChange:i,selection:o,deferredRendering:c}){const u=(0,ie.useAsyncList)(n,{step:3}),d=c?u:n,m=t.find((t=>t.id===e.layout.mediaField)),p=t.find((t=>t.id===e.layout.primaryField)),h=t.filter((t=>!e.hiddenFields.includes(t.id)&&![e.layout.primaryField,e.layout.mediaField].includes(t.id))),f=e=>t=>{const{keyCode:n}=t;[wr.ENTER,wr.SPACE].includes(n)&&s([e])},g=d?.length;return g?(0,l.createElement)("ul",{className:"dataviews-view-list"},d.map((e=>(0,l.createElement)("li",{key:a(e),className:_()({"is-selected":o.includes(e.id)})},(0,l.createElement)(b.__experimentalHStack,{className:"dataviews-view-list__item-wrapper"},(0,l.createElement)("div",{role:"button",tabIndex:0,"aria-pressed":o.includes(e.id),onKeyDown:f(e),className:"dataviews-view-list__item",onClick:()=>s([e])},(0,l.createElement)(b.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start"},(0,l.createElement)("div",{className:"dataviews-view-list__media-wrapper"},m?.render({item:e})||(0,l.createElement)("div",{className:"dataviews-view-list__media-placeholder"})),(0,l.createElement)(b.__experimentalVStack,{spacing:1},(0,l.createElement)("span",{className:"dataviews-view-list__primary-field"},p?.render({item:e})),(0,l.createElement)("div",{className:"dataviews-view-list__fields"},h.map((t=>(0,l.createElement)("span",{key:t.id,className:"dataviews-view-list__field"},t.render({item:e})))))))),i&&(0,l.createElement)(b.Button,{className:"dataviews-view-list__details-button",onClick:()=>i([e]),icon:bl,label:(0,E.__)("View details"),size:"compact"})))))):(0,l.createElement)("div",{className:_()({"dataviews-loading":r,"dataviews-no-results":!g&&!r})},!g&&(0,l.createElement)("p",null,r?(0,E.__)("Loading…"):(0,E.__)("No results")))},icon:(0,E.isRTL)()?Ao:Oo}],{useLocation:Il}=Xe(gt.privateApis);function Ml({title:e,slug:t,customViewId:n,type:r,icon:a,isActive:s,isCustom:i,suffix:o}){const{params:{path:c,layout:u}}=Il(),d=a||Pl.find((e=>e.type===r)).icon,m=Et({path:c,layout:u,activeView:"true"===i?n:t,isCustom:i});return(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start",className:_()("edit-site-sidebar-dataviews-dataview-item",{"is-selected":s})},(0,l.createElement)(vr,{icon:d,...m,"aria-current":s?"true":void 0},e),o)}const Al=[];function Ol({template:e,isActive:t}){const{text:n,icon:r}=Bs(e.type,e.id);return(0,l.createElement)(Ml,{key:n,slug:n,title:n,icon:r,isActive:t,isCustom:"false"})}function Nl({activeView:e,postType:t,title:n}){const{records:r}=(0,ye.useEntityRecords)("postType",t,{per_page:-1}),a=(0,g.useMemo)((()=>{var e;const t=r?.reduce(((e,t)=>{const n=t.author_text;return n&&!e[n]&&(e[n]=t),e}),{});return null!==(e=t&&Object.values(t))&&void 0!==e?e:Al}),[r]);return(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(Ml,{slug:"all",title:n,icon:lr,isActive:"all"===e,isCustom:"false"}),a.map((t=>(0,l.createElement)(Ol,{key:t.author_text,template:t,isActive:e===t.author_text}))))}const Fl={[Ct]:{title:(0,E.__)("Manage templates"),description:(0,E.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),contentTitle:(0,E.__)("All templates")},[kt]:{title:(0,E.__)("Manage template parts"),description:(0,E.__)("Create new template parts, or reset any customizations made to the template parts supplied by your theme."),backPath:"/patterns",contentTitle:(0,E.__)("All template parts")}},{useLocation:Rl}=Xe(gt.privateApis);function Dl(){const{params:{postType:e}}=(0,b.__experimentalUseNavigator)(),{params:{didAccessPatternsPage:t,activeView:n="all"}}=Rl(),r=(0,m.useSelect)((e=>!!e(tr).getSettings().supportsTemplatePartsMode),[]);return(0,l.createElement)(hr,{isRoot:r&&!t,title:Fl[e].title,description:Fl[e].description,backPath:Fl[e].backPath,content:(0,l.createElement)(Nl,{activeView:n,postType:e,title:Fl[e].contentTitle})})}function Vl({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,defaultLabel:r,icon:a,__next40pxDefaultSize:s=!1}){const{isDirty:i,isSaving:o,isSaveViewOpen:c,previewingThemeName:u}=(0,m.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n,isResolving:r}=e(ye.store),a=t(),{isSaveViewOpened:s}=e(tr),i=r("activateTheme"),o=_t();return{isDirty:a.length>0,isSaving:a.some((e=>n(e.kind,e.name,e.key)))||i,isSaveViewOpen:s(),previewingThemeName:o?e(ye.store).getTheme(o)?.name?.rendered:void 0}}),[]),{setIsSaveViewOpened:d}=(0,m.useDispatch)(tr),p=vt()||i,h=o||!p,f=vt()?o?(0,E.sprintf)((0,E.__)("Activating %s"),u):h?(0,E.__)("Saved"):i?(0,E.sprintf)((0,E.__)("Activate %s & Save"),u):(0,E.sprintf)((0,E.__)("Activate %s"),u):o?(0,E.__)("Saving"):h?(0,E.__)("Saved"):r||(0,E.__)("Save");return(0,l.createElement)(b.Button,{variant:t,className:e,"aria-disabled":h,"aria-expanded":c,isBusy:o,onClick:h?void 0:()=>d(!0),label:f,shortcut:h?void 0:wr.displayShortcut.primary("s"),showTooltip:n,icon:a,__next40pxDefaultSize:s,size:"compact"},f)}const{useLocation:Ll}=Xe(gt.privateApis),Bl=[{kind:"postType",name:xt}];function zl(){const e="site-edit-save-notice",{params:t}=Ll(),{__unstableMarkLastChangeAsPersistent:n}=(0,m.useDispatch)(fe.store),{createSuccessNotice:r,createErrorNotice:a,removeNotice:s}=(0,m.useDispatch)(ge.store),{dirtyCurrentEntity:i,countUnsavedChanges:o,isDirty:c,isSaving:u}=(0,m.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:n,isSavingEntityRecord:r}=e(ye.store),a=n();let s=null;return 1===a.length&&(t.path?.includes("wp_global_styles")?s=a.find((e=>"globalStyles"===e.name)):t.postId&&(s=a.find((e=>e.name===t.postType&&String(e.key)===t.postId)))),{dirtyCurrentEntity:s,isDirty:a.length>0,isSaving:a.some((e=>r(e.kind,e.name,e.key))),countUnsavedChanges:a.length}}),[t.path,t.postType,t.postId]),{editEntityRecord:d,saveEditedEntityRecord:p,__experimentalSaveSpecifiedEntityEdits:h}=(0,m.useDispatch)(ye.store),f=u||!c&&!vt();let g=i?(0,E.__)("Save"):(0,E.sprintf)((0,E._n)("Review %d change…","Review %d changes…",o),o);u&&(g=(0,E.__)("Saving"));const{homeUrl:y}=(0,m.useSelect)((e=>{const{getUnstableBase:t}=e(ye.store);return{homeUrl:t()?.home}}),[]);return(0,l.createElement)(b.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4},i?(0,l.createElement)(b.Button,{variant:"primary",onClick:async()=>{if(!i)return;s(e);const{kind:t,name:o,key:l,property:c}=i;try{"root"===i.kind&&"site"===o?await h("root","site",void 0,[c]):(Bl.some((e=>e.kind===t&&e.name===o))&&d(t,o,l,{status:"publish"}),await p(t,o,l)),n(),r((0,E.__)("Site updated."),{type:"snackbar",actions:[{label:(0,E.__)("View site"),url:y}],id:e})}catch(e){a(`${(0,E.__)("Saving failed.")} ${e}`)}},isBusy:u,disabled:u,"aria-disabled":u,className:"edit-site-save-hub__button",__next40pxDefaultSize:!0},g):(0,l.createElement)(Vl,{className:"edit-site-save-hub__button",variant:f?null:"primary",showTooltip:!1,icon:f&&!u?S:null,defaultLabel:g,__next40pxDefaultSize:!0}))}function Hl({onSave:e,onClose:t}){const[n,r]=(0,g.useState)(!1),[a,s]=(0,g.useState)(""),{saveEntityRecord:i}=(0,m.useDispatch)(ye.store),{createErrorNotice:o,createSuccessNotice:c}=(0,m.useDispatch)(ge.store);return(0,l.createElement)(b.Modal,{title:(0,E.__)("Draft a new page"),onRequestClose:t},(0,l.createElement)("form",{onSubmit:async function(t){if(t.preventDefault(),!n){r(!0);try{const t=await i("postType","page",{status:"draft",title:a,slug:a||(0,E.__)("No title")},{throwOnError:!0});e(t),c((0,E.sprintf)((0,E.__)('"%s" successfully created.'),t.title?.rendered||a),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the page.");o(t,{type:"snackbar"})}finally{r(!1)}}}},(0,l.createElement)(b.__experimentalVStack,{spacing:3},(0,l.createElement)(b.TextControl,{label:(0,E.__)("Page title"),onChange:s,placeholder:(0,E.__)("No title"),value:a}),(0,l.createElement)(b.__experimentalHStack,{spacing:2,justify:"end"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit",isBusy:n,"aria-disabled":n},(0,E.__)("Create draft"))))))}const{useHistory:Gl}=Xe(gt.privateApis),Ul=({postType:e="page",postId:t,...n})=>{const r=Et({postType:e,postId:t},{backPath:"/page"});return(0,l.createElement)(vr,{...r,...n})};function Wl(){const e=(0,ie.useViewportMatch)("medium","<"),{records:t,isResolving:n}=(0,ye.useEntityRecords)("postType","page",{status:"any",per_page:-1}),{records:r,isResolving:a}=(0,ye.useEntityRecords)("postType",Ct,{per_page:-1}),s=r?.filter((({slug:e})=>["404","search"].includes(e))),i=r?.find((e=>"front-page"===e.slug))||r?.find((e=>"home"===e.slug))||r?.find((e=>"index"===e.slug)),o=t?.concat(s,[i]),{frontPage:c,postsPage:u}=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(ye.store),n=t("root","site");return{frontPage:n?.page_on_front,postsPage:n?.page_for_posts}}),[]),d=c===u,p=t&&[...t];if(!d&&p?.length){const e=p.findIndex((e=>e.id===c)),t=p.splice(e,1);p?.splice(0,0,...t);const n=p.findIndex((e=>e.id===u)),r=p.splice(n,1);p.splice(1,0,...r)}const[h,f]=(0,g.useState)(!1),y=Gl(),v=e=>{let t=or;const n=u&&u===e?(r?.find((e=>"home"===e.slug))||r?.find((e=>"index"===e.slug)))?.id:null;switch(e){case c:t=Na;break;case u:t=Fa}return{icon:t,postType:n?Ct:"page",postId:n||e}},_=Et({path:"/pages"});return(0,l.createElement)(l.Fragment,null,h&&(0,l.createElement)(Hl,{onSave:({type:e,id:t})=>{y.push({postId:t,postType:e,canvas:"edit"}),f(!1)},onClose:()=>f(!1)}),(0,l.createElement)(hr,{title:(0,E.__)("Pages"),description:(0,E.__)("Browse and manage pages."),actions:(0,l.createElement)(mr,{icon:Za,label:(0,E.__)("Draft a new page"),onClick:()=>f(!0)}),content:(0,l.createElement)(l.Fragment,null,(n||a)&&(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(b.__experimentalItem,null,(0,E.__)("Loading pages…"))),!(n||a)&&(0,l.createElement)(b.__experimentalItemGroup,null,!o?.length&&(0,l.createElement)(b.__experimentalItem,null,(0,E.__)("No page found")),d&&i&&(0,l.createElement)(Ul,{postType:Ct,postId:i.id,key:i.id,icon:Na,withChevron:!0},(0,l.createElement)(b.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(i.title?.rendered||(0,E.__)("(no title)")))),p?.map((({id:e,title:t})=>(0,l.createElement)(Ul,{...v(e),key:e,withChevron:!0},(0,l.createElement)(b.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(t?.rendered||(0,E.__)("(no title)")))))))),footer:(0,l.createElement)(b.__experimentalVStack,{spacing:0},s?.map((e=>(0,l.createElement)(Ul,{postType:Ct,postId:e.id,key:e.id,icon:lr,withChevron:!0},(0,l.createElement)(b.__experimentalTruncate,{numberOfLines:1},(0,en.decodeEntities)(e.title?.rendered||(0,E.__)("(no title)")))))),!e&&(0,l.createElement)(vr,{className:"edit-site-sidebar-navigation-screen-pages__see-all",..._},(0,E.__)("Manage all pages")))}))}const jl=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,l.createElement)(w.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,l.createElement)(w.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})),Zl=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2H6a2 2 0 0 0-2 2v2.4h1.5V4a.5.5 0 0 1 .5-.5h2V2ZM4 13.6V16a2 2 0 0 0 2 2h2v-1.5H6a.5.5 0 0 1-.5-.5v-2.4H4Zm0-1.2h1.5V7.6H4v4.8ZM9 2v1.5h4V2H9Zm5 0v1.5h2a.5.5 0 0 1 .5.5v2.4H18V4a2 2 0 0 0-2-2h-2Zm4 5.6h-1.5v4.8H18V7.6Zm0 6h-1.5V16a.5.5 0 0 1-.5.5h-2V18h2a2 2 0 0 0 2-2v-2.4ZM13 18v-1.5H9V18h4ZM7 7.25h8v-1.5H7v1.5Zm0 3.25h6V9H7v1.5ZM21.75 19V6h-1.5v13c0 .69-.56 1.25-1.25 1.25H8v1.5h11A2.75 2.75 0 0 0 21.75 19Z"})),ql=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Yl={[Vt]:{primaryField:"title"},[Dt]:{mediaField:"featured-image",primaryField:"title"},[Lt]:{primaryField:"title",mediaField:"featured-image"}},Kl={type:Vt,search:"",filters:[],page:1,perPage:20,sort:{field:"date",direction:"desc"},hiddenFields:["date","featured-image"],layout:{...Yl[Vt]}},Xl={page:[{title:(0,E.__)("All pages"),slug:"all",icon:jl,view:Kl},{title:(0,E.__)("Drafts"),slug:"drafts",icon:Zl,view:{...Kl,filters:[{field:"status",operator:zt,value:"draft"}]}},{title:(0,E.__)("Trash"),slug:"trash",icon:ql,view:{...Kl,filters:[{field:"status",operator:zt,value:"trash"}]}}]},{useHistory:Jl,useLocation:Ql}=Xe(gt.privateApis);function $l({type:e,setIsAdding:t}){const{params:{path:n}}=Ql(),r=Jl(),{saveEntityRecord:a}=(0,m.useDispatch)(ye.store),[s,i]=(0,g.useState)(""),[o,c]=(0,g.useState)(!1);return(0,l.createElement)("form",{onSubmit:async i=>{i.preventDefault(),c(!0);const{getEntityRecords:o}=(0,m.resolveSelect)(ye.store);let l;const u=await o("taxonomy","wp_dataviews_type",{slug:e});if(u&&u.length>0)l=u[0].id;else{const t=await a("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(l=t.id)}const d=await a("postType","wp_dataviews",{title:s,status:"publish",wp_dataviews_type:l,content:JSON.stringify(Xl[e][0].view)});r.push({path:n,activeView:d.id,isCustom:"true"}),c(!1),t(!1)}},(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:s,onChange:i,placeholder:(0,E.__)("My view"),className:"patterns-create-modal__name-input"}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:()=>{t(!1)}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit","aria-disabled":!s||o,isBusy:o},(0,E.__)("Create")))))}function ec({type:e}){const[t,n]=(0,g.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(vr,{icon:Za,onClick:()=>{n(!0)},className:"dataviews__siderbar-content-add-new-item"},(0,E.__)("New view")),t&&(0,l.createElement)(b.Modal,{title:(0,E.__)("Add new view"),onRequestClose:()=>{n(!1)}},(0,l.createElement)($l,{type:e,setIsAdding:n})))}const{useHistory:tc,useLocation:nc}=Xe(gt.privateApis),rc=[];function ac({dataviewId:e,currentTitle:t,setIsRenaming:n}){const{editEntityRecord:r}=(0,m.useDispatch)(ye.store),[a,s]=(0,g.useState)(t);return(0,l.createElement)("form",{onSubmit:async t=>{t.preventDefault(),await r("postType","wp_dataviews",e,{title:a}),n(!1)}},(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:a,onChange:s,placeholder:(0,E.__)("My view"),className:"patterns-create-modal__name-input"}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:()=>{n(!1)}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit","aria-disabled":!a},(0,E.__)("Rename")))))}function sc({dataviewId:e,isActive:t}){const{params:{path:n}}=nc(),r=tc(),{dataview:a}=(0,m.useSelect)((t=>{const{getEditedEntityRecord:n}=t(ye.store);return{dataview:n("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:s}=(0,m.useDispatch)(ye.store),i=(0,g.useMemo)((()=>JSON.parse(a.content).type),[a.content]),[o,c]=(0,g.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Ml,{title:a.title,type:i,isActive:t,isCustom:"true",customViewId:e,suffix:(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"}},(({onClose:e})=>(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{onClick:()=>{c(!0),e()}},(0,E.__)("Rename")),(0,l.createElement)(b.MenuItem,{onClick:async()=>{await s("postType","wp_dataviews",a.id,{force:!0}),t&&r.replace({path:n}),e()},isDestructive:!0},(0,E.__)("Delete")))))}),o&&(0,l.createElement)(b.Modal,{title:(0,E.__)("Rename view"),onRequestClose:()=>{c(!1)}},(0,l.createElement)(ac,{dataviewId:e,setIsRenaming:c,currentTitle:a.title})))}function ic({type:e,activeView:t,isCustom:n}){const r=function(e){return(0,m.useSelect)((t=>{const{getEntityRecords:n}=t(ye.store),r=n("taxonomy","wp_dataviews_type",{slug:e});if(!r||0===r.length)return rc;return n("postType","wp_dataviews",{wp_dataviews_type:r[0].id,orderby:"date",order:"asc"})||rc}))}(e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header"},(0,l.createElement)(b.__experimentalHeading,{level:2},(0,E.__)("Custom Views"))),(0,l.createElement)(b.__experimentalItemGroup,null,r.map((e=>(0,l.createElement)(sc,{key:e.id,dataviewId:e.id,isActive:"true"===n&&Number(t)===e.id}))),(0,l.createElement)(ec,{type:e})))}const{useLocation:oc}=Xe(gt.privateApis),lc={"/pages":"page"};function cc(){const{params:{path:e,activeView:t="all",isCustom:n="false"}}=oc();if(!e||!lc[e])return null;const r=lc[e];return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalItemGroup,null,Xl[r].map((e=>(0,l.createElement)(Ml,{key:e.slug,slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:"false"===n&&e.slug===t,isCustom:"false"})))),window?.__experimentalAdminViews&&(0,l.createElement)(ic,{activeView:t,type:r,isCustom:"true"}))}const uc=window.wp.dom,dc=window.wp.escapeHtml,mc=window.wp.wordcount;function pc({status:e,date:t,short:n}){const r=(0,_a.humanTimeDiff)(t);let a=e;switch(e){case"publish":a=t?(0,g.createInterpolateElement)((0,E.sprintf)((0,E.__)("Published "),r),{time:(0,l.createElement)("time",{dateTime:t})}):(0,E.__)("Published");break;case"future":const e=(0,_a.dateI18n)(n?"M j":"F j",(0,_a.getDate)(t));a=t?(0,g.createInterpolateElement)((0,E.sprintf)((0,E.__)("Scheduled: "),e),{time:(0,l.createElement)("time",{dateTime:t})}):(0,E.__)("Scheduled");break;case"draft":a=(0,E.__)("Draft");break;case"pending":a=(0,E.__)("Pending");break;case"private":a=(0,E.__)("Private");break;case"protected":a=(0,E.__)("Password protected")}return(0,l.createElement)("div",{className:_()("edit-site-sidebar-navigation-screen-page__status",{[`has-status has-${e}-status`]:!!e})},a)}const hc=189;function fc({id:e}){const{record:t}=(0,ye.useEntityRecord)("postType","page",e),{parentTitle:n,templateTitle:r,isPostsPage:a}=(0,m.useSelect)((e=>{const{getEditedPostId:n}=Xe(e(tr)),r=e(ye.store).getEntityRecord("postType",Ct,n()),a=r?.title?.rendered,s=t?.parent?e(ye.store).getEntityRecord("postType","page",t.parent,{_fields:["title"]})?.title?.rendered:null,{getEntityRecord:i}=e(ye.store),o=i("root","site");return{parentTitle:s,templateTitle:a,isPostsPage:t?.id===o?.page_for_posts}}),[t?.parent,t?.id]);return(0,l.createElement)(xa,{spacing:5,title:(0,E.__)("Details")},function(e){if(!e)return[];const t=[{label:(0,E.__)("Status"),value:(0,l.createElement)(pc,{status:e?.password?"protected":e.status,date:e?.date,short:!0})},{label:(0,E.__)("Slug"),value:(0,l.createElement)(b.__experimentalTruncate,{numberOfLines:1},(0,yt.safeDecodeURIComponent)(e.slug||e.generated_slug))}];e?.templateTitle&&t.push({label:(0,E.__)("Template"),value:(0,en.decodeEntities)(e.templateTitle)}),e?.parentTitle&&t.push({label:(0,E.__)("Parent"),value:(0,en.decodeEntities)(e.parentTitle||(0,E.__)("(no title)"))});const n=(0,E._x)("words","Word count type. Do not translate!"),r=e?.content?.rendered?(0,mc.count)(e.content.rendered,n):0,a=Math.round(r/hc);return r&&!e?.isPostsPage&&t.push({label:(0,E.__)("Words"),value:r.toLocaleString()||(0,E.__)("Unknown")},{label:(0,E.__)("Time to read"),value:a>1?(0,E.sprintf)((0,E.__)("%s mins"),a.toLocaleString()):(0,E.__)("< 1 min")}),t}({parentTitle:n,templateTitle:r,isPostsPage:a,...t}).map((({label:e,value:t})=>(0,l.createElement)(wa,{key:e},(0,l.createElement)(Ea,null,e),(0,l.createElement)(Sa,null,t)))))}function gc({postId:e,onRemove:t}){const{createSuccessNotice:n,createErrorNotice:r}=(0,m.useDispatch)(ge.store),{deleteEntityRecord:a}=(0,m.useDispatch)(ye.store),s=(0,m.useSelect)((t=>t(ye.store).getEntityRecord("postType","page",e)),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{onClick:()=>async function(){try{await a("postType","page",e,{},{throwOnError:!0}),n((0,E.sprintf)((0,E.__)('"%s" moved to the Trash.'),(0,en.decodeEntities)(s.title.rendered)),{type:"snackbar",id:"edit-site-page-trashed"}),t?.()}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while moving the page to the trash.");r(t,{type:"snackbar"})}}(),isDestructive:!0,variant:"secondary"},(0,E.__)("Move to Trash")))}function yc({postId:e,toggleProps:t,onRemove:n}){return(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),toggleProps:t},(()=>(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(gc,{postId:e,onRemove:n}))))}const{useHistory:vc}=Xe(gt.privateApis);function _c({backPath:e}){const{setCanvasMode:t}=Xe((0,m.useDispatch)(tr)),n=vc(),{params:{postId:r},goTo:a}=(0,b.__experimentalUseNavigator)(),{record:s,hasResolved:i}=(0,ye.useEntityRecord)("postType","page",r),{featuredMediaAltText:o,featuredMediaSourceUrl:c}=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(ye.store),n=s?.featured_media?t("postType","attachment",s?.featured_media):null;return{featuredMediaSourceUrl:n?.media_details.sizes?.medium?.source_url||n?.source_url,featuredMediaAltText:(0,dc.escapeAttribute)(n?.alt_text||n?.description?.raw||"")}}),[s]);(0,g.useEffect)((()=>{i&&!s&&n.push({path:"/page",postId:void 0,postType:void 0,canvas:"view"})}),[i,n]);const u=o?(0,en.decodeEntities)(o):(0,en.decodeEntities)(s?.title?.rendered||(0,E.__)("Featured image"));return s?(0,l.createElement)(hr,{backPath:e,title:(0,en.decodeEntities)(s?.title?.rendered||(0,E.__)("(no title)")),actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(yc,{postId:r,toggleProps:{as:mr},onRemove:()=>{a("/page")}}),(0,l.createElement)(mr,{onClick:()=>t("edit"),label:(0,E.__)("Edit"),icon:br})),meta:(0,l.createElement)(b.ExternalLink,{className:"edit-site-sidebar-navigation-screen__page-link",href:s.link},(0,yt.filterURLForDisplay)((0,yt.safeDecodeURIComponent)(s.link))),content:(0,l.createElement)(l.Fragment,null,!!c&&(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-sidebar-navigation-screen-page__featured-image-wrapper",alignment:"left",spacing:2},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-page__featured-image has-image"},(0,l.createElement)("img",{alt:u,src:c}))),!!s?.excerpt?.rendered&&(0,l.createElement)(b.__experimentalTruncate,{className:"edit-site-sidebar-navigation-screen-page__excerpt",numberOfLines:3},(0,uc.__unstableStripHTML)(s.excerpt.rendered)),(0,l.createElement)(fc,{id:r})),footer:s?.modified?(0,l.createElement)(Ca,{record:s}):null}):null}const{useLocation:bc}=Xe(gt.privateApis);function Ec({className:e,...t}){return(0,l.createElement)(b.__experimentalNavigatorScreen,{className:_()("edit-site-sidebar__screen-wrapper",e),...t})}function wc(){Zi();const e=(0,ie.useViewportMatch)("medium","<");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Ec,{path:"/"},(0,l.createElement)(Oa,null)),(0,l.createElement)(Ec,{path:"/navigation"},(0,l.createElement)(To,null)),(0,l.createElement)(Ec,{path:"/navigation/:postType/:postId"},(0,l.createElement)(Eo,null)),(0,l.createElement)(Ec,{path:"/wp_global_styles"},(0,l.createElement)(Ia,null)),(0,l.createElement)(Ec,{path:"/page"},(0,l.createElement)(Wl,null)),(0,l.createElement)(Ec,{path:"/pages"},(0,l.createElement)(hr,{title:(0,E.__)("Manage pages"),content:(0,l.createElement)(cc,null),backPath:"/page"})),(0,l.createElement)(Ec,{path:"/page/:postId"},(0,l.createElement)(_c,null)),(0,l.createElement)(Ec,{path:"/:postType(wp_template)"},(0,l.createElement)(As,null)),!e&&(0,l.createElement)(Ec,{path:"/patterns"},(0,l.createElement)(Di,null)),(0,l.createElement)(Ec,{path:"/:postType(wp_template|wp_template_part)/all"},(0,l.createElement)(Dl,null)),(0,l.createElement)(Ec,{path:"/:postType(wp_template_part|wp_block)/:postId"},(0,l.createElement)(co,null)),(0,l.createElement)(Ec,{path:"/:postType(wp_template)/:postId"},(0,l.createElement)(qs,null)))}const Sc=(0,g.memo)((function(){const{params:e}=bc(),t=(0,g.useRef)(ji(e));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalNavigatorProvider,{className:"edit-site-sidebar__content",initialPath:t.current},(0,l.createElement)(wc,null)),(0,l.createElement)(zl,null))}));function xc({text:e,children:t}){const n=(0,ie.useCopyToClipboard)(e);return(0,l.createElement)(b.Button,{variant:"secondary",ref:n},t)}function Cc({message:e,error:t}){const n=[(0,l.createElement)(xc,{key:"copy-error",text:t.stack},(0,E.__)("Copy Error"))];return(0,l.createElement)(fe.Warning,{className:"editor-error-boundary",actions:n},e)}class kc extends g.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,pe.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(Cc,{message:(0,E.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}const Tc=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Pc=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Ic=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Mc=[{keyCombination:{modifier:"primary",character:"b"},description:(0,E.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,E.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,E.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,E.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,E.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,E.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,E.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,E.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,E.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,E.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function Ac({keyCombination:e,forceAriaLabel:t}){const n=e.modifier?wr.displayShortcutList[e.modifier](e.character):e.character,r=e.modifier?wr.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,l.createElement)("kbd",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||r},(Array.isArray(n)?n:[n]).map(((e,t)=>"+"===e?(0,l.createElement)(g.Fragment,{key:t},e):(0,l.createElement)("kbd",{key:t,className:"edit-site-keyboard-shortcut-help-modal__shortcut-key"},e))))}function Oc({description:e,keyCombination:t,aliases:n=[],ariaLabel:r}){return(0,l.createElement)(g.Fragment,null,(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-description"},e),(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-term"},(0,l.createElement)(Ac,{keyCombination:t,forceAriaLabel:r}),n.map(((e,t)=>(0,l.createElement)(Ac,{keyCombination:e,forceAriaLabel:r,key:t})))))}function Nc({name:e}){const{keyCombination:t,description:n,aliases:r}=(0,m.useSelect)((t=>{const{getShortcutKeyCombination:n,getShortcutDescription:r,getShortcutAliases:a}=t(nr.store);return{keyCombination:n(e),aliases:a(e),description:r(e)}}),[e]);return t?(0,l.createElement)(Oc,{keyCombination:t,description:n,aliases:r}):null}const Fc="edit-site/keyboard-shortcut-help",Rc=({shortcuts:e})=>(0,l.createElement)("ul",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,l.createElement)("li",{className:"edit-site-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,l.createElement)(Nc,{name:e}):(0,l.createElement)(Oc,{...e}))))),Dc=({title:e,shortcuts:t,className:n})=>(0,l.createElement)("section",{className:_()("edit-site-keyboard-shortcut-help-modal__section",n)},!!e&&(0,l.createElement)("h2",{className:"edit-site-keyboard-shortcut-help-modal__section-title"},e),(0,l.createElement)(Rc,{shortcuts:t})),Vc=({title:e,categoryName:t,additionalShortcuts:n=[]})=>{const r=(0,m.useSelect)((e=>e(nr.store).getCategoryShortcuts(t)),[t]);return(0,l.createElement)(Dc,{title:e,shortcuts:r.concat(n)})};function Lc(){const e=(0,m.useSelect)((e=>e(j).isModalActive(Fc))),{closeModal:t,openModal:n}=(0,m.useDispatch)(j),r=()=>e?t():n(Fc);return(0,nr.useShortcut)("core/edit-site/keyboard-shortcuts",r),e?(0,l.createElement)(b.Modal,{className:"edit-site-keyboard-shortcut-help-modal",title:(0,E.__)("Keyboard shortcuts"),onRequestClose:r},(0,l.createElement)(Dc,{className:"edit-site-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-site/keyboard-shortcuts"]}),(0,l.createElement)(Vc,{title:(0,E.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(Vc,{title:(0,E.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(Vc,{title:(0,E.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,E.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,E.__)("Forward-slash")}]}),(0,l.createElement)(Dc,{title:(0,E.__)("Text formatting"),shortcuts:Mc})):null}const{PreferencesModal:Bc}=Xe(y.privateApis),zc="edit-site/preferences";function Hc(){const e=(0,m.useSelect)((e=>e(j).isModalActive(zc))),{closeModal:t}=(0,m.useDispatch)(j);return e?(0,l.createElement)(Bc,{isActive:e,onClose:t}):null}const{Fill:Gc,Slot:Uc}=(0,b.createSlotFill)("EditSiteToolsMoreMenuGroup");Gc.Slot=({fillProps:e})=>(0,l.createElement)(Uc,{fillProps:e},(e=>e&&e.length>0));const Wc=Gc,jc=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Zc=window.wp.blob;function qc(){const{createErrorNotice:e}=(0,m.useDispatch)(ge.store);return(0,l.createElement)(b.MenuItem,{role:"menuitem",icon:jc,onClick:async function(){try{const e=await Xt()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),r=n[1]?n[1]:"edit-site-export";(0,Zc.downloadBlob)(r+".zip",t,"application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const r=n.message&&"unknown_error"!==n.code?n.message:(0,E.__)("An error occurred while creating the site export.");e(r,{type:"snackbar"})}},info:(0,E.__)("Download your theme with updated templates and styles.")},(0,E._x)("Export","site exporter menu item"))}function Yc(){const{toggle:e}=(0,m.useDispatch)(T.store);return(0,l.createElement)(b.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide")},(0,E.__)("Welcome Guide"))}function Kc(){const{createNotice:e}=(0,m.useDispatch)(ge.store),{getEditedPostId:t,getEditedPostType:n}=(0,m.useSelect)(tr),{getEditedEntityRecord:r}=(0,m.useSelect)(ye.store);const a=(0,ie.useCopyToClipboard)((function(){const e=r("postType",n(),t());return e?"function"==typeof e.content?e.content(e):e.blocks?(0,u.__unstableSerializeAndClean)(e.blocks):e.content?e.content:void 0:""}),(function(){e("info",(0,E.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,l.createElement)(b.MenuItem,{ref:a},(0,E.__)("Copy all blocks"))}const Xc=[{value:"visual",label:(0,E.__)("Visual editor")},{value:"text",label:(0,E.__)("Code editor")}];const Jc=function(){const{shortcut:e,mode:t}=(0,m.useSelect)((e=>({shortcut:e(nr.store).getShortcutRepresentation("core/edit-site/toggle-mode"),mode:e(tr).getEditorMode()})),[]),{switchEditorMode:n}=(0,m.useDispatch)(tr),r=Xc.map((n=>n.value!==t?{...n,shortcut:e}:n));return(0,l.createElement)(b.MenuGroup,{label:(0,E.__)("Editor")},(0,l.createElement)(b.MenuItemsChoice,{choices:r,value:t,onSelect:n}))};function Qc({showIconLabels:e}){const{openModal:t}=(0,m.useDispatch)(j),{set:n}=(0,m.useDispatch)(T.store),r=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme().is_block_theme),[]),{toggleDistractionFree:a}=(0,m.useDispatch)(tr),s=()=>{n("core","distractionFree",!1)};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(de,{toggleProps:{showTooltip:!e,...e&&{variant:"tertiary"}}},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuGroup,{label:(0,E._x)("View","noun")},(0,l.createElement)(T.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:s,label:(0,E.__)("Top toolbar"),info:(0,E.__)("Access all block and document tools in a single place"),messageActivated:(0,E.__)("Top toolbar activated"),messageDeactivated:(0,E.__)("Top toolbar deactivated")}),(0,l.createElement)(T.PreferenceToggleMenuItem,{scope:"core",name:"distractionFree",label:(0,E.__)("Distraction free"),info:(0,E.__)("Write with calmness"),handleToggling:!1,onToggle:a,messageActivated:(0,E.__)("Distraction free mode activated"),messageDeactivated:(0,E.__)("Distraction free mode deactivated"),shortcut:wr.displayShortcut.primaryShift("\\")}),(0,l.createElement)(T.PreferenceToggleMenuItem,{scope:"core",name:"focusMode",label:(0,E.__)("Spotlight mode"),info:(0,E.__)("Focus on one block at a time"),messageActivated:(0,E.__)("Spotlight mode activated"),messageDeactivated:(0,E.__)("Spotlight mode deactivated")})),(0,l.createElement)(Jc,null),(0,l.createElement)(Q.Slot,{name:"core/edit-site/plugin-more-menu",label:(0,E.__)("Plugins"),as:b.MenuGroup,fillProps:{onClick:e}}),(0,l.createElement)(b.MenuGroup,{label:(0,E.__)("Tools")},r&&(0,l.createElement)(qc,null),(0,l.createElement)(b.MenuItem,{onClick:()=>t(Fc),shortcut:wr.displayShortcut.access("h")},(0,E.__)("Keyboard shortcuts")),(0,l.createElement)(Yc,null),(0,l.createElement)(Kc,null),(0,l.createElement)(b.MenuItem,{icon:Ic,role:"menuitem",href:(0,E.__)("https://wordpress.org/documentation/article/site-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,E.__)("Help"),(0,l.createElement)(b.VisuallyHidden,{as:"span"},(0,E.__)("(opens in a new tab)"))),(0,l.createElement)(Wc.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{onClick:()=>t(zc)},(0,E.__)("Preferences")))))),(0,l.createElement)(Lc,null),(0,l.createElement)(Hc,null))}const $c=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"})),{DocumentTools:eu}=Xe(y.privateApis);function tu({blockEditorMode:e,hasFixedToolbar:t,isDistractionFree:n}){const{isVisualMode:r}=(0,m.useSelect)((e=>{const{getEditorMode:t}=e(tr);return{isVisualMode:"visual"===t()}}),[]),{__unstableSetEditorMode:a}=(0,m.useDispatch)(fe.store),{setDeviceType:s}=(0,m.useDispatch)(y.store),i=(0,ie.useViewportMatch)("medium"),o=window?.__experimentalEnableZoomedOutView&&r,c="zoom-out"===e;return(0,l.createElement)(eu,{disableBlockTools:!r,listViewLabel:(0,E.__)("List View")},o&&i&&!n&&!t&&(0,l.createElement)(b.ToolbarItem,{as:b.Button,className:"edit-site-header-edit-mode__zoom-out-view-toggle",icon:$c,isPressed:c,label:(0,E.__)("Zoom-out View"),onClick:()=>{s("Desktop"),a(c?"edit":"zoom-out")},size:"compact"}))}const{PostViewLink:nu,PreviewDropdown:ru}=Xe(y.privateApis);function au(){const{templateType:e,isDistractionFree:t,blockEditorMode:n,blockSelectionStart:r,showIconLabels:a,editorCanvasView:s,hasFixedToolbar:i,isZoomOutMode:o}=(0,m.useSelect)((e=>{const{getEditedPostType:t}=e(tr),{getBlockSelectionStart:n,__unstableGetEditorMode:r}=e(fe.store),{get:a}=e(T.store),{getDeviceType:s}=e(y.store);return{deviceType:s(),templateType:t(),blockEditorMode:r(),blockSelectionStart:n(),showIconLabels:a("core","showIconLabels"),editorCanvasView:Xe(e(tr)).getEditorCanvasContainerView(),hasFixedToolbar:a("core","fixedToolbar"),isDistractionFree:a("core","distractionFree"),isZoomOutMode:"zoom-out"===r()}}),[]),c=(0,ie.useViewportMatch)("medium"),u=!o&&i&&c,d=(0,g.useRef)(),p=(0,ie.useReducedMotion)(),h=!function(){const e=(0,b.__experimentalUseSlotFills)(Kr);return!!e?.length}(),f=Ft.includes(e),v="zoom-out"===n,[w,S]=(0,g.useState)(!0),x=!!r;(0,g.useEffect)((()=>{r&&S(!1)}),[r]);const C={isDistractionFree:{y:"-50px"},isDistractionFreeHovering:{y:0},view:{y:0},edit:{y:0}},k={type:"tween",duration:p?0:.2,ease:"easeOut"};return(0,l.createElement)("div",{className:_()("edit-site-header-edit-mode",{"show-icon-labels":a})},h&&(0,l.createElement)(b.__unstableMotion.div,{className:"edit-site-header-edit-mode__start",variants:C,transition:k},(0,l.createElement)(tu,{blockEditorMode:n,isDistractionFree:t}),u&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:_()("selected-block-tools-wrapper",{"is-collapsed":w||!x})},(0,l.createElement)(fe.BlockToolbar,{hideDragHandle:!0})),(0,l.createElement)(b.Popover.Slot,{ref:d,name:"block-toolbar"}),x&&(0,l.createElement)(b.Button,{className:"edit-site-header-edit-mode__block-tools-toggle",icon:w?Tc:Pc,onClick:()=>{S((e=>!e))},label:w?(0,E.__)("Show block tools"):(0,E.__)("Hide block tools")}))),!t&&(0,l.createElement)("div",{className:_()("edit-site-header-edit-mode__center",{"is-collapsed":!w&&c})},h?(0,l.createElement)(y.DocumentBar,null):qr(s)),(0,l.createElement)("div",{className:"edit-site-header-edit-mode__end"},(0,l.createElement)(b.__unstableMotion.div,{className:"edit-site-header-edit-mode__actions",variants:C,transition:k},c&&(0,l.createElement)("div",{className:_()("edit-site-header-edit-mode__preview-options",{"is-zoomed-out":v})},(0,l.createElement)(ru,{disabled:f||!h})),(0,l.createElement)(nu,null),(0,l.createElement)(Vl,null),!t&&(0,l.createElement)(ne.Slot,{scope:"core/edit-site"}),(0,l.createElement)(Qc,{showIconLabels:a}))))}const su=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,l.createElement)(w.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 iu=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,m.useSelect)((e=>{const{getEntityRecord:t}=e(ye.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,l.createElement)("div",{className:"edit-site-site-icon__image"});const r=n?(0,l.createElement)("img",{className:"edit-site-site-icon__image",alt:(0,E.__)("Site Icon"),src:n}):(0,l.createElement)(b.Icon,{className:"edit-site-site-icon__icon",icon:su,size:48});return(0,l.createElement)("div",{className:_()(e,"edit-site-site-icon")},r)},ou=(0,g.memo)((({isTransparent:e,className:t})=>{const{canvasMode:n,dashboardLink:r,homeUrl:a,siteTitle:s}=(0,m.useSelect)((e=>{const{getCanvasMode:t,getSettings:n}=Xe(e(tr)),{getSite:r,getUnstableBase:a}=e(ye.store);return{canvasMode:t(),dashboardLink:n().__experimentalDashboardLink||"index.php",homeUrl:a()?.home,siteTitle:r()?.title}}),[]),{open:i}=(0,m.useDispatch)(rr.store),o=(0,ie.useReducedMotion)(),{setCanvasMode:c}=Xe((0,m.useDispatch)(tr)),{clearSelectedBlock:u}=(0,m.useDispatch)(fe.store),{setDeviceType:d}=(0,m.useDispatch)(y.store),p="view"===n?{href:r,label:(0,E.__)("Go to the Dashboard")}:{href:r,role:"button",label:(0,E.__)("Open Navigation"),onClick:e=>{e.preventDefault(),"edit"===n&&(u(),d("Desktop"),c("view"))}};return(0,l.createElement)(b.__unstableMotion.div,{className:_()("edit-site-site-hub",t),variants:{isDistractionFree:{x:"-100%"},isDistractionFreeHovering:{x:0},view:{x:0},edit:{x:0}},initial:!1,transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between",alignment:"center",className:"edit-site-site-hub__container"},(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start",className:"edit-site-site-hub__text-content",spacing:"0"},(0,l.createElement)(b.__unstableMotion.div,{className:_()("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),layout:!0,transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(b.Button,{...p,className:"edit-site-layout__view-mode-toggle"},(0,l.createElement)(b.__unstableMotion.div,{initial:!1,animate:{scale:"view"===n?.5:1},whileHover:{scale:"view"===n?.5:.96},transition:{type:"tween",duration:o?0:.3,ease:"easeOut"}},(0,l.createElement)(iu,{className:"edit-site-layout__view-mode-toggle-icon"})))),(0,l.createElement)(b.__unstableAnimatePresence,null,(0,l.createElement)(b.__unstableMotion.div,{layout:"edit"===n,animate:{opacity:"view"===n?1:0},exit:{opacity:0},className:_()("edit-site-site-hub__site-title",{"is-transparent":e}),transition:{type:"tween",duration:o?0:.2,ease:"easeOut",delay:"view"===n?.1:0}},(0,en.decodeEntities)(s))),"view"===n&&(0,l.createElement)(b.Button,{href:a,target:"_blank",label:(0,E.__)("View site (opens in a new tab)"),"aria-label":(0,E.__)("View site (opens in a new tab)"),icon:Ic,className:_()("edit-site-site-hub__site-view-link",{"is-transparent":e})})),"view"===n&&(0,l.createElement)(b.Button,{className:_()("edit-site-site-hub_toggle-command-center",{"is-transparent":e}),icon:Va,onClick:()=>i(),label:(0,E.__)("Open command palette"),shortcut:wr.displayShortcut.primary("k")})))})),lu=ou,cu={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},uu=320,du=1300,mu=9/19.5,pu={width:"100%",height:"100%"};function hu(e,t){const n=1-Math.max(0,Math.min(1,(e-uu)/(du-uu))),r=((e,t,n)=>e+(t-e)*n)(t,mu,n);return e/r}const fu=function e({isFullWidth:t,isOversized:n,setIsOversized:r,isReady:a,children:s,defaultSize:i,innerContentStyle:o}){const[c,u]=(0,g.useState)(pu),[d,p]=(0,g.useState)(),[h,f]=(0,g.useState)(!1),[y,v]=(0,g.useState)(!1),[w,S]=(0,g.useState)(1),x=(0,m.useSelect)((e=>Xe(e(tr)).getCanvasMode()),[]),{setCanvasMode:C}=Xe((0,m.useDispatch)(tr)),k={type:"tween",duration:h?0:.5},T=(0,g.useRef)(null),P=(0,ie.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),I=i.width/i.height,M={default:{flexGrow:0,height:c.height},fullWidth:{flexGrow:1,height:c.height}},A=h?"active":y?"visible":"hidden";return(0,l.createElement)(b.ResizableBox,{as:b.__unstableMotion.div,ref:T,initial:!1,variants:M,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&u({width:"100%",height:"100%"})},transition:k,size:c,enable:{top:!1,right:!1,bottom:!1,left:a,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:w,handleClasses:void 0,handleStyles:{left:cu,right:cu},minWidth:uu,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>v(!0),onBlur:()=>v(!1),onMouseOver:()=>v(!0),onMouseOut:()=>v(!1),handleComponent:{left:"view"===x&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.Tooltip,{text:(0,E.__)("Drag to resize")},(0,l.createElement)(b.__unstableMotion.button,{key:"handle",role:"separator","aria-orientation":"vertical",className:_()("edit-site-resizable-frame__handle",{"is-resizing":h}),variants:{hidden:{opacity:0,left:0},visible:{opacity:1,left:-16},active:{opacity:1,left:-16,scaleY:1.3}},animate:A,"aria-label":(0,E.__)("Drag to resize"),"aria-describedby":P,"aria-valuenow":T.current?.resizable?.offsetWidth||void 0,"aria-valuemin":uu,"aria-valuemax":i.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1),n=Math.min(Math.max(uu,T.current.resizable.offsetWidth+t),i.width);u({width:n,height:hu(n,I)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"})),(0,l.createElement)("div",{hidden:!0,id:P},(0,E.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")))},onResizeStart:(e,t,n)=>{p(n.offsetWidth),f(!0)},onResize:(e,t,a,s)=>{const o=s.width/w,l=Math.abs(o),c=s.width<0?l:(i.width-d)/2,m=Math.min(l,c),p=0===l?0:m/l;S(1-p+2*p);const h=d+s.width;r(h>i.width),u({height:n?"100%":hu(h,I)})},onResizeStop:(e,t,a)=>{if(f(!1),!n)return;r(!1);a.ownerDocument.documentElement.offsetWidth-a.offsetWidth>200?u(pu):C("edit")},className:_()("edit-site-resizable-frame__inner",{"is-resizing":h}),showHandle:!1},(0,l.createElement)(b.__unstableMotion.div,{className:"edit-site-resizable-frame__inner-content",animate:{borderRadius:t?0:8},transition:k,style:o},s))},{useLocation:gu,useHistory:yu}=Xe(gt.privateApis);const{useHistory:vu,useLocation:_u}=Xe(gt.privateApis);const{EntitiesSavedStatesExtensible:bu}=Xe(y.privateApis),Eu=({onClose:e})=>{var t,n;const r=(0,y.useEntitiesSavedStatesIsDirty)();let a;a=r.isDirty?(0,E.__)("Activate & Save"):(0,E.__)("Activate");const s=function(){const[e,t]=(0,g.useState)();return(0,g.useEffect)((()=>{const e=(0,yt.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});Xt()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),i=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme()),[]),o=(0,l.createElement)("p",null,(0,E.sprintf)((0,E.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(t=s?.name?.rendered)&&void 0!==t?t:"...",null!==(n=i?.name?.rendered)&&void 0!==n?n:"...")),c=function(){const e=vu(),t=_u(),{startResolution:n,finishResolution:r}=(0,m.useDispatch)(ye.store);return async()=>{if(vt()){const a="themes.php?action=activate&stylesheet="+_t()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;n("activateTheme"),await window.fetch(a),r("activateTheme");const{wp_theme_preview:s,...i}=t.params;e.replace(i)}}}();return(0,l.createElement)(bu,{...r,additionalPrompt:o,close:e,onSave:async e=>(await c(),e),saveEnabled:!0,saveLabel:a})},wu=({onClose:e})=>vt()?(0,l.createElement)(Eu,{onClose:e}):(0,l.createElement)(y.EntitiesSavedStates,{close:e});function Su(){const{isSaveViewOpen:e,canvasMode:t}=(0,m.useSelect)((e=>{const{isSaveViewOpened:t,getCanvasMode:n}=Xe(e(tr));return{isSaveViewOpen:t(),canvasMode:n()}}),[]),{setIsSaveViewOpened:n}=(0,m.useDispatch)(tr),r=()=>n(!1);return"view"===t?e?(0,l.createElement)(b.Modal,{className:"edit-site-save-panel__modal",onRequestClose:r,__experimentalHideHeader:!0,contentLabel:(0,E.__)("Save site, content, and template changes")},(0,l.createElement)(wu,{onClose:r})):null:(0,l.createElement)(oe,{className:_()("edit-site-layout__actions",{"is-entity-save-view-open":e}),ariaLabel:(0,E.__)("Save panel")},e?(0,l.createElement)(wu,{onClose:r}):(0,l.createElement)("div",{className:"edit-site-editor__toggle-save-panel"},(0,l.createElement)(b.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>n(!0),"aria-expanded":!1},(0,E.__)("Open save panel"))))}const xu=function(){const{registerShortcut:e}=(0,m.useDispatch)(nr.store);return(0,g.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,E.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-site/toggle-block-settings-sidebar",category:"global",description:(0,E.__)("Show or hide the Settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/edit-site/keyboard-shortcuts",category:"main",description:(0,E.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-site/next-region",category:"global",description:(0,E.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-site/previous-region",category:"global",description:(0,E.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-site/toggle-mode",category:"global",description:(0,E.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/edit-site/transform-heading-to-paragraph",category:"block-library",description:(0,E.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-site/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,E.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})})),e({name:"core/edit-site/toggle-distraction-free",category:"global",description:(0,E.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}})}),[e]),null};const Cu=function(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,m.useSelect)(ye.store),{hasNonPostEntityChanges:n}=(0,m.useSelect)(y.store),{getCanvasMode:r}=Xe((0,m.useSelect)(tr)),{setIsSaveViewOpened:a}=(0,m.useDispatch)(tr);return(0,nr.useShortcut)("core/edit-site/save",(s=>{s.preventDefault();const i=e(),o=!!i.length,l=i.some((e=>t(e.kind,e.name,e.key))),c=n(),u="view"===r();(o&&c&&!l||u)&&a(!0)})),null},ku=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Tu=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Pu=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Iu=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"}));function Mu({path:e,categoryType:t,categoryId:n},r){return["/wp_template/all","/wp_template_part/all","/pages"].includes(e)||"/patterns"===e&&(!r||!!t&&!!n)}const{useGlobalStylesReset:Au}=Xe(fe.privateApis),{useHistory:Ou,useLocation:Nu}=Xe(gt.privateApis);function Fu(){const{openGeneralSidebar:e,setCanvasMode:t}=Xe((0,m.useDispatch)(tr)),{params:n}=Nu(),r=!Mu(n,(0,ie.useViewportMatch)("medium","<")),{getCanvasMode:a}=Xe((0,m.useSelect)(tr)),s=Ou(),i=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,g.useMemo)((()=>i?[{name:"core/edit-site/open-styles",label:(0,E.__)("Open styles"),callback:({close:n})=>{n(),r||s.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==a()&&t("edit"),e("edit-site/global-styles")},icon:ir}]:[]),[s,e,t,r,a,i])}}function Ru(){const{openGeneralSidebar:e,setCanvasMode:t}=Xe((0,m.useDispatch)(tr)),{params:n}=Nu(),r=!Mu(n,(0,ie.useViewportMatch)("medium","<")),{getCanvasMode:a}=Xe((0,m.useSelect)(tr)),{set:s}=(0,m.useDispatch)(T.store),i=Ou(),o=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,g.useMemo)((()=>o?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,E.__)("Learn about styles"),callback:({close:n})=>{n(),r||i.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==a()&&t("edit"),e("edit-site/global-styles"),s("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{s("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:ku}]:[]),[i,e,t,r,a,o,s])}}function Du(){const[e,t]=Au();return{isLoading:!1,commands:(0,g.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,E.__)("Reset styles"),icon:(0,E.isRTL)()?Tu:Pu,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}}function Vu(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=Xe((0,m.useDispatch)(tr)),{params:r}=Nu(),a=!Mu(r,(0,ie.useViewportMatch)("medium","<")),s=Ou(),{canEditCSS:i}=(0,m.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ye.store),r=n(),a=r?t("root","globalStyles",r):void 0;return{canEditCSS:!!a?._links?.["wp:action-edit-css"]}}),[]),{getCanvasMode:o}=Xe((0,m.useSelect)(tr));return{isLoading:!1,commands:(0,g.useMemo)((()=>i?[{name:"core/edit-site/open-styles-css",label:(0,E.__)("Customize CSS"),icon:Iu,callback:({close:r})=>{r(),a||s.push({path:"/wp_global_styles",canvas:"edit"}),a&&"edit"!==o()&&n("edit"),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[s,e,t,i,a,o,n])}}function Lu(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=Xe((0,m.useDispatch)(tr)),{getCanvasMode:r}=Xe((0,m.useSelect)(tr)),{params:a}=Nu(),s=!Mu(a,(0,ie.useViewportMatch)("medium","<")),i=Ou(),o=(0,m.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ye.store),r=n(),a=r?t("root","globalStyles",r):void 0;return!!a?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,g.useMemo)((()=>o?[{name:"core/edit-site/open-global-styles-revisions",label:(0,E.__)("Style revisions"),icon:ba,callback:({close:a})=>{a(),s||i.push({path:"/wp_global_styles",canvas:"edit"}),s&&"edit"!==r()&&n("edit"),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[o,i,e,t,s,r,n])}}const Bu=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})),zu=(0,l.createElement)(w.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})),Hu=(0,l.createElement)(w.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),Gu=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),Uu=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z"}),(0,l.createElement)(w.Path,{d:"m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z"})),Wu=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})),{RenamePatternModal:ju}=Xe(St.privateApis);function Zu(){const{record:e}=Ds(),{closeModal:t}=(0,m.useDispatch)(j);return(0,m.useSelect)((e=>e(j).isModalActive(Xu.rename)))?(0,l.createElement)(ju,{onClose:t,pattern:e}):null}const{DuplicatePatternModal:qu}=Xe(St.privateApis),{useHistory:Yu}=Xe(gt.privateApis);function Ku(){const{record:e}=Ds(),{categoryType:t,categoryId:n}=(0,yt.getQueryArgs)(window.location.href),{closeModal:r}=(0,m.useDispatch)(j),a=Yu();if(!(0,m.useSelect)((e=>e(j).isModalActive(Xu.duplicate))))return null;return(0,l.createElement)(qu,{onClose:r,onSuccess:function({pattern:e}){a.push({categoryType:t,categoryId:n,postType:It.user,postId:e.id}),r()},pattern:e})}const Xu={rename:"edit-site/pattern-rename",duplicate:"edit-site/pattern-duplicate"};function Ju(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Ku,null),(0,l.createElement)(Zu,null))}const{useHistory:Qu}=Xe(gt.privateApis);function $u(){const{record:e}=Ds(),{isPage:t,canvasMode:n,templateId:r,currentPostType:a}=(0,m.useSelect)((e=>{const{isPage:t,getCanvasMode:n}=Xe(e(tr)),{getCurrentPostType:r,getCurrentTemplateId:a}=e(y.store);return{isPage:t(),canvasMode:n(),templateId:a(),currentPostType:r()}}),[]),{onClick:s}=Et({postType:"wp_template",postId:r}),{setRenderingMode:i}=(0,m.useDispatch)(y.store);if(!t||"edit"!==n)return{isLoading:!1,commands:[]};const o=[];return"wp_template"!==a?o.push({name:"core/switch-to-template-focus",label:(0,E.sprintf)((0,E.__)("Edit template: %s"),(0,en.decodeEntities)(e.title)),icon:lr,callback:({close:e})=>{s(),e()}}):o.push({name:"core/switch-to-page-focus",label:(0,E.__)("Back to page"),icon:or,callback:({close:e})=>{i("template-locked"),e()}}),{isLoading:!1,commands:o}}function ed(){const{switchEditorMode:e}=(0,m.useDispatch)(tr),{canvasMode:t,editorMode:n}=(0,m.useSelect)((e=>({canvasMode:Xe(e(tr)).getCanvasMode(),editorMode:e(tr).getEditorMode()})),[]);if("edit"!==t||"text"!==n)return{isLoading:!1,commands:[]};const r=[];return"text"===n&&r.push({name:"core/exit-code-editor",label:(0,E.__)("Exit code editor"),icon:Bu,callback:({close:t})=>{e("visual"),t()}}),{isLoading:!1,commands:r}}function td(){const{isLoaded:e,record:t}=Ds(),{removeTemplate:n,revertTemplate:r}=(0,m.useDispatch)(tr),a=Qu(),s=(0,m.useSelect)((e=>e(tr).isPage()&&"wp_template"!==e(y.store).getCurrentPostType()),[]);if(!e)return{isLoading:!0,commands:[]};const i=[];if($t(t)&&!s){const e=t.type===Ct?(0,E.sprintf)((0,E.__)("Reset template: %s"),(0,en.decodeEntities)(t.title)):(0,E.sprintf)((0,E.__)("Reset template part: %s"),(0,en.decodeEntities)(t.title));i.push({name:"core/reset-template",label:e,icon:(0,E.isRTL)()?Tu:Pu,callback:({close:e})=>{r(t),e()}})}if(Hs(t)&&!s){const e=t.type===Ct?(0,E.sprintf)((0,E.__)("Delete template: %s"),(0,en.decodeEntities)(t.title)):(0,E.sprintf)((0,E.__)("Delete template part: %s"),(0,en.decodeEntities)(t.title)),r=t.type===Ct?"/wp_template":"/wp_template_part/all";i.push({name:"core/remove-template",label:e,icon:ql,callback:({close:e})=>{n(t),a.push({path:r}),e()}})}return{isLoading:!e,commands:i}}function nd(){const{openGeneralSidebar:e,closeGeneralSidebar:t,toggleDistractionFree:n,setIsListViewOpened:r,switchEditorMode:a}=(0,m.useDispatch)(tr),{canvasMode:s,editorMode:i,activeSidebar:o,showBlockBreadcrumbs:l,isListViewOpen:c,isDistractionFree:u,isTopToolbar:d,isFocusMode:p}=(0,m.useSelect)((e=>{const{get:t}=e(T.store),{getEditorMode:n}=e(tr),{isListViewOpened:r}=e(y.store);return{canvasMode:Xe(e(tr)).getCanvasMode(),editorMode:n(),activeSidebar:e(j).getActiveComplementaryArea(tr.name),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),isListViewOpen:r(),isDistractionFree:t("core","distractionFree"),isFocusMode:t("core","focusMode"),isTopToolbar:t("core","fixedToolbar")}}),[]),{openModal:h}=(0,m.useDispatch)(j),{toggle:f}=(0,m.useDispatch)(T.store),{createInfoNotice:g}=(0,m.useDispatch)(ge.store);if("edit"!==s)return{isLoading:!1,commands:[]};const v=[];return v.push({name:"core/open-settings-sidebar",label:(0,E.__)("Toggle settings sidebar"),icon:(0,E.isRTL)()?zu:Hu,callback:({close:n})=>{n(),"edit-site/template"===o?t():e("edit-site/template")}}),v.push({name:"core/open-block-inspector",label:(0,E.__)("Toggle block inspector"),icon:Gu,callback:({close:n})=>{n(),"edit-site/block-inspector"===o?t():e("edit-site/block-inspector")}}),v.push({name:"core/toggle-spotlight-mode",label:(0,E.__)("Toggle spotlight"),callback:({close:e})=>{f("core","focusMode"),e(),g(p?(0,E.__)("Spotlight off."):(0,E.__)("Spotlight on."),{id:"core/edit-site/toggle-spotlight-mode/notice",type:"snackbar",actions:[{label:(0,E.__)("Undo"),onClick:()=>{f("core","focusMode")}}]})}}),v.push({name:"core/toggle-distraction-free",label:u?(0,E.__)("Exit Distraction Free"):(0,E.__)("Enter Distraction Free "),callback:({close:e})=>{n(),e()}}),v.push({name:"core/toggle-top-toolbar",label:(0,E.__)("Toggle top toolbar"),callback:({close:e})=>{f("core","fixedToolbar"),u&&n(),e(),g(d?(0,E.__)("Top toolbar off."):(0,E.__)("Top toolbar on."),{id:"core/edit-site/toggle-top-toolbar/notice",type:"snackbar",actions:[{label:(0,E.__)("Undo"),onClick:()=>{f("core","fixedToolbar")}}]})}}),"visual"===i&&v.push({name:"core/toggle-code-editor",label:(0,E.__)("Open code editor"),icon:Bu,callback:({close:e})=>{a("text"),e()}}),v.push({name:"core/open-preferences",label:(0,E.__)("Editor preferences"),callback:()=>{h(zc)}}),v.push({name:"core/open-shortcut-help",label:(0,E.__)("Keyboard shortcuts"),icon:Uu,callback:()=>{h(Fc)}}),v.push({name:"core/toggle-breadcrumbs",label:l?(0,E.__)("Hide block breadcrumbs"):(0,E.__)("Show block breadcrumbs"),callback:({close:e})=>{f("core","showBlockBreadcrumbs"),e(),g(l?(0,E.__)("Breadcrumbs hidden."):(0,E.__)("Breadcrumbs visible."),{id:"core/edit-site/toggle-breadcrumbs/notice",type:"snackbar"})}}),v.push({name:"core/toggle-list-view",label:c?(0,E.__)("Close List View"):(0,E.__)("Open List View"),icon:Wu,callback:({close:e})=>{r(!c),e(),g(c?(0,E.__)("List View off."):(0,E.__)("List View on."),{id:"core/edit-site/toggle-list-view/notice",type:"snackbar"})}}),{isLoading:!1,commands:v}}function rd(){const{isLoaded:e,record:t}=Ds(),{openModal:n}=(0,m.useDispatch)(j);if(!e)return{isLoading:!0,commands:[]};const r=[];return"wp_block"===t?.type&&(r.push({name:"core/rename-pattern",label:(0,E.__)("Rename pattern"),icon:Er,callback:({close:e})=>{n(Xu.rename),e()}}),r.push({name:"core/duplicate-pattern",label:(0,E.__)("Duplicate pattern"),icon:cr,callback:({close:e})=>{n(Xu.duplicate),e()}})),{isLoading:!1,commands:r}}const ad=1e4;function sd(){const{isLoaded:e}=Ds(),[t,n]=(0,g.useState)(!1),r=(0,m.useSelect)((e=>{const n=e(ye.store).hasResolvingSelectors();return!t&&!n}),[t]);return(0,g.useEffect)((()=>{let e;return t||(e=setTimeout((()=>{n(!0)}),ad)),()=>{clearTimeout(e)}}),[t]),(0,g.useEffect)((()=>{if(r){const e=setTimeout((()=>{n(!0)}),100);return()=>{clearTimeout(e)}}}),[r]),!t||!e}function id({className:e,identifier:t,title:n,icon:r,children:a,closeLabel:s,header:i,headerClassName:o,panelClassName:c}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(se,{className:e,scope:"core/edit-site",identifier:t,title:n,smallScreenTitle:n,icon:r,closeLabel:s,header:i,headerClassName:o,panelClassName:c},a),(0,l.createElement)(ee,{scope:"core/edit-site",identifier:t,icon:r},n))}function od({className:e,...t}){return(0,l.createElement)(b.Icon,{className:_()(e,"edit-site-global-styles-icon-with-current-color"),...t})}function ld({icon:e,children:t,...n}){return(0,l.createElement)(b.__experimentalItem,{...n},e&&(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(od,{icon:e,size:24}),(0,l.createElement)(b.FlexItem,null,t)),!e&&t)}function cd(e){return(0,l.createElement)(b.__experimentalNavigatorButton,{as:ld,...e})}const ud=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.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"})),dd=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})),{useHasDimensionsPanel:md,useHasTypographyPanel:pd,useHasColorPanel:hd,useGlobalSetting:fd,useSettingsForBlockElement:gd}=Xe(fe.privateApis);const yd=function(){const[e]=fd(""),t=gd(e),n=pd(t),r=hd(t),a=md(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalItemGroup,null,n&&(0,l.createElement)(cd,{icon:ud,path:"/typography","aria-label":(0,E.__)("Typography styles")},(0,E.__)("Typography")),r&&(0,l.createElement)(cd,{icon:dd,path:"/colors","aria-label":(0,E.__)("Colors styles")},(0,E.__)("Colors")),a&&(0,l.createElement)(cd,{icon:lr,path:"/layout","aria-label":(0,E.__)("Layout styles")},(0,E.__)("Layout"))))},{useGlobalStyle:vd}=Xe(fe.privateApis);const _d=function(){const[e]=vd("css"),{hasVariations:t,canEditCSS:n}=(0,m.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n,__experimentalGetCurrentThemeGlobalStylesVariations:r}=e(ye.store),a=n(),s=a?t("root","globalStyles",a):void 0;return{hasVariations:!!r()?.length,canEditCSS:!!s?._links?.["wp:action-edit-css"]}}),[]);return(0,l.createElement)(b.Card,{size:"small",className:"edit-site-global-styles-screen-root"},(0,l.createElement)(b.CardBody,null,(0,l.createElement)(b.__experimentalVStack,{spacing:4},(0,l.createElement)(b.Card,null,(0,l.createElement)(b.CardMedia,null,(0,l.createElement)(Lr,null))),t&&(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(cd,{path:"/variations","aria-label":(0,E.__)("Browse styles")},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.FlexItem,null,(0,E.__)("Browse styles")),(0,l.createElement)(od,{icon:(0,E.isRTL)()?dr:ur})))),(0,l.createElement)(yd,null))),(0,l.createElement)(b.CardDivider,null),(0,l.createElement)(b.CardBody,null,(0,l.createElement)(b.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,E.__)("Customize the appearance of specific blocks for the whole site.")),(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(cd,{path:"/blocks","aria-label":(0,E.__)("Blocks styles")},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.FlexItem,null,(0,E.__)("Blocks")),(0,l.createElement)(od,{icon:(0,E.isRTL)()?dr:ur}))))),n&&!!e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.CardDivider,null),(0,l.createElement)(b.CardBody,null,(0,l.createElement)(b.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,E.__)("Add your own CSS to customize the appearance and layout of your site.")),(0,l.createElement)(b.__experimentalItemGroup,null,(0,l.createElement)(cd,{path:"/css","aria-label":(0,E.__)("Additional CSS")},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.FlexItem,null,(0,E.__)("Additional CSS")),(0,l.createElement)(od,{icon:(0,E.isRTL)()?dr:ur})))))))};function bd(e){const t=function(e){return e?.filter((e=>"block"===e.source))}((0,m.useSelect)((t=>{const{getBlockStyles:n}=t(u.store);return n(e)}),[e]));return t}function Ed({name:e}){const t=bd(e);return(0,l.createElement)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},t.map(((t,n)=>t?.isDefault?null:(0,l.createElement)(cd,{key:n,path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),"aria-label":t.label},t.label))))}const wd=function({title:e,description:t,onBack:n}){return(0,l.createElement)(b.__experimentalVStack,{spacing:0},(0,l.createElement)(b.__experimentalView,null,(0,l.createElement)(b.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3},(0,l.createElement)(b.__experimentalHStack,{spacing:2},(0,l.createElement)(b.__experimentalNavigatorToParentButton,{style:{minWidth:24,padding:0},icon:(0,E.isRTL)()?ur:dr,isSmall:!0,"aria-label":(0,E.__)("Navigate to the previous view"),onClick:n}),(0,l.createElement)(b.__experimentalSpacer,null,(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13},e))))),t&&(0,l.createElement)("p",{className:"edit-site-global-styles-header__description"},t))},{useHasDimensionsPanel:Sd,useHasTypographyPanel:xd,useHasBorderPanel:Cd,useGlobalSetting:kd,useSettingsForBlockElement:Td,useHasColorPanel:Pd}=Xe(fe.privateApis);function Id(e){const[t]=kd("",e),n=Td(t,e),r=xd(n),a=Pd(n),s=Cd(n),i=Sd(n),o=s||i,l=!!bd(e)?.length;return r||a||o||l}function Md({block:e}){if(!Id(e.name))return null;const t=(0,E.sprintf)((0,E.__)("%s block styles"),e.title);return(0,l.createElement)(cd,{path:"/blocks/"+encodeURIComponent(e.name),"aria-label":t},(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(fe.BlockIcon,{icon:e.icon}),(0,l.createElement)(b.FlexItem,null,e.title)))}const Ad=(0,g.memo)((function({filterValue:e}){const t=function(){const e=(0,m.useSelect)((e=>e(u.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:r}=e;return(t.name.startsWith("core/")?n:r).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),n=(0,ie.useDebounce)(Jt.speak,500),{isMatchingSearchTerm:r}=(0,m.useSelect)(u.store),a=e?t.filter((t=>r(t,e))):t,s=(0,g.useRef)();return(0,g.useEffect)((()=>{if(!e)return;const t=s.current.childElementCount,r=(0,E.sprintf)((0,E._n)("%d result found.","%d results found.",t),t);n(r,t)}),[e,n]),(0,l.createElement)("div",{ref:s,className:"edit-site-block-types-item-list"},a.map((e=>(0,l.createElement)(Md,{block:e,key:"menu-itemblock-"+e.name}))))}));const Od=function(){const[e,t]=(0,g.useState)(""),n=(0,g.useDeferredValue)(e);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("Blocks"),description:(0,E.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,l.createElement)(b.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,E.__)("Search for blocks"),placeholder:(0,E.__)("Search")}),(0,l.createElement)(Ad,{filterValue:n}))},Nd=({name:e,variation:t=""})=>{var n;const r=(0,u.getBlockType)(e)?.example,a=(0,g.useMemo)((()=>{if(!r)return null;let n=r;return t&&(n={...n,attributes:{...n.attributes,className:"is-style-"+t}}),(0,u.getBlockFromExample)(e,n)}),[e,r,t]),s=null!==(n=r?.viewportWidth)&&void 0!==n?n:null;return r?(0,l.createElement)(b.__experimentalSpacer,{marginX:4,marginBottom:4},(0,l.createElement)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:150,boxSizing:"initial"}},(0,l.createElement)(fe.BlockPreview,{blocks:a,viewportWidth:s,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 Fd=function({children:e,level:t}){return(0,l.createElement)(b.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2},e)};function Rd(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:Dd,useHasTypographyPanel:Vd,useHasBorderPanel:Ld,useGlobalSetting:Bd,useSettingsForBlockElement:zd,useHasColorPanel:Hd,useHasFiltersPanel:Gd,useHasImageSettingsPanel:Ud,useGlobalStyle:Wd,BorderPanel:jd,ColorPanel:Zd,TypographyPanel:qd,DimensionsPanel:Yd,FiltersPanel:Kd,ImageSettingsPanel:Xd,AdvancedPanel:Jd}=Xe(fe.privateApis);const Qd=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const r=n.join("."),[a]=Wd(r,e,"user",{shouldDecodeEncode:!1}),[s,i]=Wd(r,e,"all",{shouldDecodeEncode:!1}),[o]=Bd("",e,"user"),[c,d]=Bd("",e),p=zd(c,e),h=(0,u.getBlockType)(e);p?.spacing?.blockGap&&h?.supports?.spacing?.blockGap&&(!0===h?.supports?.spacing?.__experimentalSkipSerialization||h?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(p.spacing.blockGap=!1),p?.dimensions?.aspectRatio&&"core/group"===e&&(p.dimensions.aspectRatio=!1);const f=bd(e),y=Vd(p),v=Hd(p),_=Ld(p),w=Dd(p),S=Gd(p),x=Ud(e,o,p),C=!!f?.length&&!t,{canEditCSS:k}=(0,m.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ye.store),r=n(),a=r?t("root","globalStyles",r):void 0;return{canEditCSS:!!a?._links?.["wp:action-edit-css"]}}),[]),T=t?f.find((e=>e.name===t)):null,P=(0,g.useMemo)((()=>({...s,layout:p.layout})),[s,p.layout]),I=(0,g.useMemo)((()=>({...a,layout:o.layout})),[a,o.layout]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:t?T.label:h.title}),(0,l.createElement)(Nd,{name:e,variation:t}),C&&(0,l.createElement)("div",{className:"edit-site-global-styles-screen-variations"},(0,l.createElement)(b.__experimentalVStack,{spacing:3},(0,l.createElement)(Fd,null,(0,E.__)("Style Variations")),(0,l.createElement)(Ed,{name:e}))),v&&(0,l.createElement)(Zd,{inheritedValue:s,value:a,onChange:i,settings:p}),y&&(0,l.createElement)(qd,{inheritedValue:s,value:a,onChange:i,settings:p}),w&&(0,l.createElement)(Yd,{inheritedValue:P,value:I,onChange:e=>{const t={...e};delete t.layout,i(t),e.layout!==o.layout&&d({...o,layout:e.layout})},settings:p,includeLayoutControls:!0}),_&&(0,l.createElement)(jd,{inheritedValue:s,value:a,onChange:e=>{if(!e?.border)return void i(e);const{radius:t,...n}=e.border,r=function(e){return e?(0,b.__experimentalHasSplitBorders)(e)?{top:Rd(e.top),right:Rd(e.right),bottom:Rd(e.bottom),left:Rd(e.left)}:Rd(e):e}(n),a=(0,b.__experimentalHasSplitBorders)(r)?{color:null,style:null,width:null,...r}:{top:r,right:r,bottom:r,left:r};i({...e,border:{...a,radius:t}})},settings:p}),S&&(0,l.createElement)(Kd,{inheritedValue:P,value:I,onChange:i,settings:p,includeLayoutControls:!0}),x&&(0,l.createElement)(Xd,{onChange:e=>{d(void 0===e?{...c,lightbox:void 0}:{...c,lightbox:{...c.lightbox,...e}})},value:o,inheritedValue:p}),k&&(0,l.createElement)(b.PanelBody,{title:(0,E.__)("Advanced"),initialOpen:!1},(0,l.createElement)("p",null,(0,E.sprintf)((0,E.__)("Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."),h?.title)),(0,l.createElement)(Jd,{value:a,onChange:i,inheritedValue:s})))},{useGlobalStyle:$d}=Xe(fe.privateApis);function em({parentMenu:e,element:t,label:n}){const r="text"!==t&&t?`elements.${t}.`:"",a="link"===t?{textDecoration:"underline"}:{},[s]=$d(r+"typography.fontFamily"),[i]=$d(r+"typography.fontStyle"),[o]=$d(r+"typography.fontWeight"),[c]=$d(r+"typography.letterSpacing"),[u]=$d(r+"color.background"),[d]=$d(r+"color.gradient"),[m]=$d(r+"color.text"),p=(0,E.sprintf)((0,E.__)("Typography %s styles"),n);return(0,l.createElement)(cd,{path:e+"/typography/"+t,"aria-label":p},(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(b.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=s?s:"serif",background:null!=d?d:u,color:m,fontStyle:i,fontWeight:o,letterSpacing:c,...a}},(0,E.__)("Aa")),(0,l.createElement)(b.FlexItem,null,n)))}const tm=function(){return(0,l.createElement)(b.__experimentalVStack,{spacing:3},(0,l.createElement)(Fd,{level:3},(0,E.__)("Elements")),(0,l.createElement)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)(em,{parentMenu:"",element:"text",label:(0,E.__)("Text")}),(0,l.createElement)(em,{parentMenu:"",element:"link",label:(0,E.__)("Links")}),(0,l.createElement)(em,{parentMenu:"",element:"heading",label:(0,E.__)("Headings")}),(0,l.createElement)(em,{parentMenu:"",element:"caption",label:(0,E.__)("Captions")}),(0,l.createElement)(em,{parentMenu:"",element:"button",label:(0,E.__)("Buttons")})))},nm=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,l.createElement)(w.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"})),rm="/wp/v2/font-families",am="/wp/v2/font-collections";async function sm(e){const t={path:rm,method:"POST",body:e},n=await Xt()(t);return{id:n.id,...n.font_family_settings,fontFace:[]}}async function im(e,t){const n={path:`${rm}/${e}/font-faces`,method:"POST",body:t},r=await Xt()(n);return{id:r.id,...r.font_face_settings}}async function om(e){const t={path:`${rm}?slug=${e}&_embed=true`,method:"GET"},n=await Xt()(t);if(!n||0===n.length)return null;const r=n[0];return{id:r.id,...r.font_family_settings,fontFace:r?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function lm(e){const t={path:`${rm}/${e}?force=true`,method:"DELETE"};return await Xt()(t)}const cm=["otf","ttf","woff","woff2"],um={100:(0,E._x)("Thin","font weight"),200:(0,E._x)("Extra-light","font weight"),300:(0,E._x)("Light","font weight"),400:(0,E._x)("Normal","font weight"),500:(0,E._x)("Medium","font weight"),600:(0,E._x)("Semi-bold","font weight"),700:(0,E._x)("Bold","font weight"),800:(0,E._x)("Extra-bold","font weight"),900:(0,E._x)("Black","font weight")},dm={normal:(0,E._x)("Normal","font style"),italic:(0,E._x)("Italic","font style")};function mm(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,n=e.trim(),r=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return n.includes(",")?n.split(",").map(r).filter((e=>""!==e)).join(", "):r(n)}function pm(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 hm(e){const t={fontFamily:mm(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const a=e.fontFace.filter((e=>"normal"===e.fontStyle.toLowerCase()));if(a.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]),r=parseInt(n[1]);for(let n=e;n<=r;n+=100)t.push(n)}else 1===n.length&&t.push(parseInt(n[0]))})),t}(a),s=(n=400,0===(r=e).length?null:(r.sort(((e,t)=>Math.abs(n-e)-Math.abs(n-t))),r[0]));t.fontWeight=String(s)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var n,r;return t}const{File:fm}=window;function gm(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function ym(e){return`${um[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":dm[e.fontStyle]||e.fontStyle}`}function vm(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 _m(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,...r}=e,a=vm(n.get(e.slug).fontFace,t);n.set(e.slug,{...r,fontFace:a})}else n.set(e.slug,{...e});return Array.from(n.values())}async function bm(e,t,n="all"){let r;if("string"==typeof t)r=`url(${t})`;else{if(!(t instanceof fm))return;r=await t.arrayBuffer()}const a=new window.FontFace(pm(e.fontFamily),r,{style:e.fontStyle,weight:e.fontWeight}),s=await a.load();if("document"!==n&&"all"!==n||document.fonts.add(s),"iframe"===n||"all"===n){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(s)}}function Em(e,t="all"){const n=t=>{t.forEach((n=>{n.family===pm(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 wm(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 Sm(e){const t=new FormData,{kebabCase:n}=Xe(b.privateApis),{fontFace:r,category:a,...s}=e,i={...s,slug:n(e.slug)};return t.append("font_family_settings",JSON.stringify(i)),t}function xm(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const n={...e},r=new FormData;if(n.file){const e=Array.isArray(n.file)?n.file:[n.file],a=[];e.forEach(((e,n)=>{const s=`file-${t}-${n}`;r.append(s,e,e.name),a.push(s)})),n.src=1===a.length?a[0]:a,delete n.file,r.append("font_face_settings",JSON.stringify(n))}else r.append("font_face_settings",JSON.stringify(n));return r}));return t}}async function Cm(e,t){const n=[];for(const r of t)try{const t=await im(e,r);n.push({status:"fulfilled",value:t})}catch(e){n.push({status:"rejected",reason:e})}const r={errors:[],successes:[]};return n.forEach(((e,n)=>{if("fulfilled"===e.status){const a=e.value;a.id?r.successes.push(a):r.errors.push({data:t[n],message:`Error: ${a.message}`})}else r.errors.push({data:t[n],message:e.reason.message})})),r}function km(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function Tm(e,t,n){const r=t=>t.slug===e.slug,a=n.find(r);return t?(a=>{const s=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!a)return[...n,{...e,fontFace:[t]}];let i=a.fontFace||[];return i=i.find(s)?i.filter((e=>!s(e))):[...i,t],0===i.length?n.filter((e=>!r(e))):n.map((e=>r(e)?{...e,fontFace:i}:e))})(a):(t=>t?n.filter((e=>!r(e))):[...n,e])(a)}const{useGlobalSetting:Pm}=Xe(fe.privateApis),Im=(0,g.createContext)({});const Mm=function({children:e}){const{__experimentalSaveSpecifiedEntityEdits:t}=(0,m.useDispatch)(ye.store),{globalStylesId:n}=(0,m.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(ye.store);return{globalStylesId:t()}})),r=(0,ye.useEntityRecord)("root","globalStyles",n),a=!!r?.edits?.settings?.typography?.fontFamilies,[s,i]=(0,g.useState)(!1),[o,c]=(0,g.useState)(0),[u,d]=(0,g.useState)(null),p=()=>{c(Date.now())},{records:h=[],isResolving:f,hasResolved:y}=(0,ye.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),v=(h||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[_,b]=Pm("typography.fontFamilies"),[w]=Pm("typography.fontFamilies",void 0,"base"),[S,x]=(0,g.useState)(!1),[C,k]=(0,g.useState)(null),T=_?.theme?_.theme.map((e=>gm(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],P=new Set(T.map((e=>e.slug))),I=w?.theme?T.concat(w.theme.filter((e=>!P.has(e.slug))).map((e=>gm(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],M=_?.custom?_.custom.map((e=>gm(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],A=v?v.map((e=>gm(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,g.useEffect)((()=>{S||k(null)}),[S]);const[O]=(0,g.useState)(new Set),N=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}),{}),F=e=>N("theme"===e?T:M),R=(e,t,n,r)=>t||n?!!F(r)[e]?.includes(t+n):!!F(r)[e],D=e=>{var t;const n=(null!==(t=_?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug));b({..._,[e.source]:n}),e.fontFace&&e.fontFace.forEach((e=>{Em(e,"all")}))},V=e=>{const t=e.map((({id:e,fontFace:t,...n})=>({...n,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}})));b({..._,custom:_m(_?.custom,t)}),t.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{bm(e,wm(e.src),"all")}))}))},[L,B]=(0,g.useState)([]),z=async()=>{const e=await async function(){const e={path:`${am}?_fields=slug,name,description`,method:"GET"};return await Xt()(e)}();B(e)};return(0,g.useEffect)((()=>{z()}),[]),(0,l.createElement)(Im.Provider,{value:{libraryFontSelected:C,handleSetLibraryFontSelected:e=>{if(d(null),!e)return void k(null);const t=("theme"===e.source?T:A).find((t=>t.slug===e.slug));k({...t||e,source:e.source})},themeFonts:T,baseThemeFonts:I,customFonts:M,baseCustomFonts:A,isFontActivated:R,getFontFacesActivated:(e,t)=>F(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=wm(e.src);t&&!O.has(t)&&(bm(e,t,"document"),O.add(t))},installFonts:async function(e){i(!0);try{const r=[];let a=[];for(const t of e){let e=!1,n=await om(t.slug);n||(e=!0,n=await sm(Sm(t)));const s=n.fontFace&&t.fontFace?n.fontFace.filter((e=>km(e,t.fontFace))):[];n.fontFace&&t.fontFace&&(t.fontFace=t.fontFace.filter((e=>!km(e,n.fontFace))));let i=[],o=[];if(t?.fontFace?.length>0){const e=await Cm(n.id,xm(t));i=e?.successes,o=e?.errors}(i?.length>0||s?.length>0)&&(n.fontFace=[...i],r.push(n)),n&&!t?.fontFace?.length&&r.push(n),e&&t?.fontFace?.length>0&&0===i?.length&&await lm(n.id),a=a.concat(o)}if(a=a.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),r.length>0&&(V(r),await t("root","globalStyles",n,["settings.typography.fontFamilies"]),p()),a.length>0){const e=new Error((0,E.__)("There was an error installing fonts."));throw e.installationErrors=a,e}}finally{i(!1)}},uninstallFontFamily:async function(e){try{const r=await lm(e.id);return r.deleted&&(D(e),await t("root","globalStyles",n,["settings.typography.fontFamilies"])),p(),r}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var n;const r=Tm(e,t,null!==(n=_?.[e.source])&&void 0!==n?n:[]);b({..._,[e.source]:r});R(e.slug,t?.fontStyle,t?.fontWeight,e.source)?bm(t,wm(t?.src),"all"):Em(t,"all")},getAvailableFontsOutline:N,modalTabOpen:S,toggleModal:e=>{x(e||null)},refreshLibrary:p,notice:u,setNotice:d,saveFontFamilies:()=>{t("root","globalStyles",n,["settings.typography.fontFamilies"])},fontFamiliesHasChanges:a,isResolvingLibrary:f,hasResolvedLibrary:y,isInstalling:s,collections:L,getFontCollection:async e=>{try{if(!!L.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${am}/${e}`,method:"GET"};return await Xt()(t)}(e),n=L.map((n=>n.slug===e?{...n,...t}:n));B(n)}catch(e){throw console.error(e),e}}}},e)};const Am=function({font:e,text:t}){const n=(0,g.useRef)(null),r=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),a=hm(e);t=t||e.name;const s=e.preview,[i,o]=(0,g.useState)(!1),[c,u]=(0,g.useState)(!1),{loadFontFaceAsset:d}=(0,g.useContext)(Im),m=null!=s?s:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(r),p=m&&m.match(/\.(png|jpg|jpeg|gif|svg)$/i);var h;const f={fontSize:"18px",lineHeight:1,opacity:c?"1":"0",...a,...{fontFamily:mm((h=r).fontFamily),fontStyle:h.fontStyle||"normal",fontWeight:h.fontWeight||"400"}};return(0,g.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{o(e.isIntersecting)}),{});return e.observe(n.current),()=>e.disconnect()}),[n]),(0,g.useEffect)((()=>{(async()=>{i&&(!p&&r.src&&await d(r),u(!0))})()}),[r,i,d,p]),(0,l.createElement)("div",{ref:n},p?(0,l.createElement)("img",{src:m,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,l.createElement)(b.__experimentalText,{style:f,className:"font-library-modal__font-variant_demo-text"},t))};const Om=function({font:e,onClick:t,variantsText:n,navigatorPath:r}){const a=e.fontFace?.length||1,s={cursor:t?"pointer":"default"},i=(0,b.__experimentalUseNavigator)();return(0,l.createElement)(b.Button,{onClick:()=>{t(),r&&i.goTo(r)},style:s,className:"font-library-modal__font-card"},(0,l.createElement)(b.Flex,{justify:"space-between",wrap:!1},(0,l.createElement)(Am,{font:e}),(0,l.createElement)(b.Flex,{justify:"flex-end"},(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.__experimentalText,{className:"font-library-modal__font-card__count"},n||(0,E.sprintf)((0,E._n)("%d variant","%d variants",a),a))),(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.Icon,{icon:ur})))))};const Nm=function({face:e,font:t}){const{isFontActivated:n,toggleActivateFont:r}=(0,g.useContext)(Im),a=t?.fontFace?.length>0?n(t.slug,e.fontStyle,e.fontWeight,t.source):n(t.slug,null,null,t.source),s=()=>{t?.fontFace?.length>0?r(t,e):r(t)},i=t.name+" "+ym(e),{kebabCase:o}=Xe(b.privateApis),c=o(`${t.slug}-${ym(e)}`);return(0,l.createElement)("div",{className:"font-library-modal__font-card"},(0,l.createElement)(b.Flex,{justify:"flex-start",align:"center",gap:"1rem"},(0,l.createElement)(b.CheckboxControl,{checked:a,onChange:s,__nextHasNoMarginBottom:!0,id:c}),(0,l.createElement)("label",{htmlFor:c},(0,l.createElement)(Am,{font:e,text:i,onClick:s}))))};function Fm(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 Rm(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?Fm(e.fontWeight)-Fm(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{ProgressBar:Dm}=Xe(b.privateApis);function Vm({font:e,isOpen:t,setIsOpen:n,setNotice:r,uninstallFontFamily:a,handleSetLibraryFontSelected:s}){const i=(0,b.__experimentalUseNavigator)();return(0,l.createElement)(b.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,E.__)("Cancel"),confirmButtonText:(0,E.__)("Delete"),onCancel:()=>{n(!1)},onConfirm:async()=>{r(null),n(!1);try{await a(e),i.goBack(),s(null),r({type:"success",message:(0,E.__)("Font family uninstalled successfully.")})}catch(e){r({type:"error",message:(0,E.__)("There was an error uninstalling the font family. ")+e.message})}}},e&&(0,E.sprintf)((0,E.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name))}const Lm=function(){const{baseCustomFonts:e,libraryFontSelected:t,baseThemeFonts:n,handleSetLibraryFontSelected:r,refreshLibrary:a,uninstallFontFamily:s,isResolvingLibrary:i,isInstalling:o,saveFontFamilies:c,getFontFacesActivated:u,fontFamiliesHasChanges:d,notice:p,setNotice:h}=(0,g.useContext)(Im),[f,y]=(0,g.useState)(!1),v="custom"===t?.source&&t?.id,_=(0,m.useSelect)((e=>{const{canUser:t}=e(ye.store);return v&&t("delete","font-families",v)}),[v]),w=!!t&&"theme"!==t?.source&&_,S=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,n=u(e.slug,e.source).length;return(0,E.sprintf)((0,E.__)("%1$s/%2$s variants active"),n,t)};return(0,g.useEffect)((()=>{r(t),a()}),[]),(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout"},i&&(0,l.createElement)(b.__experimentalHStack,{align:"center"},(0,l.createElement)(b.__experimentalSpacer,null),(0,l.createElement)(b.Spinner,null),(0,l.createElement)(b.__experimentalSpacer,null)),(0,l.createElement)(b.__experimentalNavigatorProvider,{initialPath:t?"/fontFamily":"/"},(0,l.createElement)(b.__experimentalNavigatorScreen,{path:"/"},p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalSpacer,{margin:1}),(0,l.createElement)(b.Notice,{status:p.type,onRemove:()=>h(null)},p.message),(0,l.createElement)(b.__experimentalSpacer,{margin:1})),e.length>0&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalText,{className:"font-library-modal__subtitle"},(0,E.__)("Installed Fonts")),(0,l.createElement)(b.__experimentalSpacer,{margin:2}),e.map((e=>(0,l.createElement)(Om,{font:e,key:e.slug,navigatorPath:"/fontFamily",variantsText:S(e),onClick:()=>{r(e)}}))),(0,l.createElement)(b.__experimentalSpacer,{margin:8})),n.length>0&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalText,{className:"font-library-modal__subtitle"},(0,E.__)("Theme Fonts")),(0,l.createElement)(b.__experimentalSpacer,{margin:2}),n.map((e=>(0,l.createElement)(Om,{font:e,key:e.slug,navigatorPath:"/fontFamily",variantsText:S(e),onClick:()=>{r(e)}})))),(0,l.createElement)(b.__experimentalSpacer,{margin:16})),(0,l.createElement)(b.__experimentalNavigatorScreen,{path:"/fontFamily"},(0,l.createElement)(Vm,{font:t,isOpen:f,setIsOpen:y,setNotice:h,uninstallFontFamily:s,handleSetLibraryFontSelected:r}),(0,l.createElement)(b.Flex,{justify:"flex-start"},(0,l.createElement)(b.__experimentalNavigatorToParentButton,{icon:dr,isSmall:!0,onClick:()=>{r(null)},"aria-label":(0,E.__)("Navigate to the previous view")}),(0,l.createElement)(b.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header"},t?.name)),p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalSpacer,{margin:1}),(0,l.createElement)(b.Notice,{status:p.type,onRemove:()=>h(null)},p.message),(0,l.createElement)(b.__experimentalSpacer,{margin:1})),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),(0,l.createElement)(b.__experimentalText,null,(0,E.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),(0,l.createElement)(b.__experimentalVStack,{spacing:0},(0,l.createElement)(b.__experimentalSpacer,{margin:8}),(e=>e?e.fontFace&&e.fontFace.length?Rm(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(t).map(((e,n)=>(0,l.createElement)(Nm,{font:t,face:e,key:`face${n}`})))))),(0,l.createElement)(b.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer"},o&&(0,l.createElement)(Dm,null),w&&(0,l.createElement)(b.Button,{isDestructive:!0,variant:"tertiary",onClick:()=>{y(!0)}},(0,E.__)("Delete")),(0,l.createElement)(b.Button,{variant:"primary",onClick:c,disabled:!d,__experimentalIsFocusable:!0},(0,E.__)("Update"))))};function Bm(e,t,n){return t?!!n[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!n[e]}const zm=function(){return(0,l.createElement)("div",{className:"font-library__google-fonts-confirm"},(0,l.createElement)(b.Card,null,(0,l.createElement)(b.CardBody,null,(0,l.createElement)(b.__experimentalText,{as:"h3"},(0,E.__)("Connect to Google Fonts")),(0,l.createElement)(b.__experimentalSpacer,{margin:6}),(0,l.createElement)(b.__experimentalText,{as:"p"},(0,E.__)("To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.")),(0,l.createElement)(b.__experimentalSpacer,{margin:3}),(0,l.createElement)(b.__experimentalText,{as:"p"},(0,E.__)("You can alternatively upload files directly on the Upload tab.")),(0,l.createElement)(b.__experimentalSpacer,{margin:6}),(0,l.createElement)(b.Button,{variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))}},(0,E.__)("Allow access to Google Fonts")))))};const Hm=function({face:e,font:t,handleToggleVariant:n,selected:r}){const a=()=>{t?.fontFace?n(t,e):n(t)},s=t.name+" "+ym(e),{kebabCase:i}=Xe(b.privateApis),o=i(`${t.slug}-${ym(e)}`);return(0,l.createElement)("div",{className:"font-library-modal__font-card"},(0,l.createElement)(b.Flex,{justify:"flex-start",align:"center",gap:"1rem"},(0,l.createElement)(b.CheckboxControl,{checked:r,onChange:a,__nextHasNoMarginBottom:!0,id:o}),(0,l.createElement)("label",{htmlFor:o},(0,l.createElement)(Am,{font:e,text:s,onClick:a}))))},Gm={slug:"all",name:(0,E._x)("All","font categories")},Um="wp-font-library-google-fonts-permission";const Wm=function({slug:e}){var t;const n="google-fonts"===e,r=()=>"true"===window.localStorage.getItem(Um),[a,s]=(0,g.useState)(null),[i,o]=(0,g.useState)([]),[c,u]=(0,g.useState)(1),[d,m]=(0,g.useState)({}),[p,h]=(0,g.useState)(n&&!r()),{collections:f,getFontCollection:y,installFonts:v,isInstalling:_,notice:w,setNotice:S}=(0,g.useContext)(Im),x=f.find((t=>t.slug===e));(0,g.useEffect)((()=>{const e=()=>{h(n&&!r())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,n]);const C=()=>{window.localStorage.setItem(Um,"false"),window.dispatchEvent(new Event("storage"))};(0,g.useEffect)((()=>{(async()=>{try{await y(e),L()}catch(e){w||S({type:"error",message:e?.message})}})()}),[e,y,S,w]),(0,g.useEffect)((()=>{s(null),S(null)}),[e,S]),(0,g.useEffect)((()=>{o([])}),[a]);const k=(0,g.useMemo)((()=>{var e;return null!==(e=x?.font_families)&&void 0!==e?e:[]}),[x]),T=null!==(t=x?.categories)&&void 0!==t?t:[],I=[Gm,...T],M=(0,g.useMemo)((()=>function(e,t){const{category:n,search:r}=t;let a=e||[];return n&&"all"!==n&&(a=a.filter((e=>-1!==e.categories.indexOf(n)))),r&&(a=a.filter((e=>e.font_family_settings.name.toLowerCase().includes(r.toLowerCase())))),a}(k,d)),[k,d]),A=Math.max(window.innerHeight,500),O=Math.floor((A-417)/61),N=Math.ceil(M.length/O),F=(c-1)*O,R=c*O,D=M.slice(F,R),V=(0,ie.debounce)((e=>{m({...d,search:e}),u(1)}),300),L=()=>{m({}),u(1)},B=(e,t)=>{const n=Tm(e,t,i);o(n)},z=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(i);return p?(0,l.createElement)(zm,null):(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout"},(0,l.createElement)(b.__experimentalNavigatorProvider,{initialPath:"/",className:"font-library-modal__tabpanel-layout"},(0,l.createElement)(b.__experimentalNavigatorScreen,{path:"/"},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.__experimentalVStack,null,(0,l.createElement)(b.__experimentalHeading,{level:2,size:13},x.name),(0,l.createElement)(b.__experimentalText,null,x.description)),(0,l.createElement)((()=>"google-fonts"!==e||p||a?null:(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,E.__)("Revoke access to Google Fonts"),onClick:C}]})),null)),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),(0,l.createElement)(b.Flex,null,(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.__experimentalInputControl,{value:d.search,placeholder:(0,E.__)("Font name…"),label:(0,E.__)("Search"),onChange:V,prefix:(0,l.createElement)(b.Icon,{icon:Va}),suffix:d?.search?(0,l.createElement)(b.Icon,{icon:P,onClick:()=>{m({...d,search:""}),u(1)}}):null})),(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.SelectControl,{label:(0,E.__)("Category"),value:d.category,onChange:e=>{m({...d,category:e}),u(1)}},I&&I.map((e=>(0,l.createElement)("option",{value:e.slug,key:e.slug},e.name)))))),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),!x?.font_families&&!w&&(0,l.createElement)(b.Spinner,null),!!x?.font_families?.length&&!M.length&&(0,l.createElement)(b.__experimentalText,null,(0,E.__)("No fonts found. Try with a different search term")),(0,l.createElement)("div",{className:"font-library-modal__fonts-grid__main"},D.map((e=>(0,l.createElement)(Om,{key:e.font_family_settings.slug,font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{s(e.font_family_settings)}}))))),(0,l.createElement)(b.__experimentalNavigatorScreen,{path:"/fontFamily"},(0,l.createElement)(b.Flex,{justify:"flex-start"},(0,l.createElement)(b.__experimentalNavigatorToParentButton,{icon:dr,isSmall:!0,onClick:()=>{s(null)},"aria-label":(0,E.__)("Navigate to the previous view")}),(0,l.createElement)(b.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header"},a?.name)),w&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalSpacer,{margin:1}),(0,l.createElement)(b.Notice,{status:w.type,onRemove:()=>S(null)},w.message),(0,l.createElement)(b.__experimentalSpacer,{margin:1})),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),(0,l.createElement)(b.__experimentalText,null," ",(0,E.__)("Select font variants to install.")," "),(0,l.createElement)(b.__experimentalSpacer,{margin:4}),(0,l.createElement)(b.__experimentalVStack,{spacing:0},(0,l.createElement)(b.__experimentalSpacer,{margin:8}),(H=a,H?H.fontFace&&H.fontFace.length?Rm(H.fontFace):[{fontFamily:H.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,l.createElement)(Hm,{font:a,face:e,key:`face${t}`,handleToggleVariant:B,selected:Bm(a.slug,a.fontFace?e:null,z)})))),(0,l.createElement)(b.__experimentalSpacer,{margin:16}))),a&&(0,l.createElement)(b.Flex,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer"},(0,l.createElement)(b.Button,{variant:"primary",onClick:async()=>{S(null);const e=i[0];try{e?.fontFace&&await Promise.all(e.fontFace.map((async e=>{e.src&&(e.file=await async function(e){e=Array.isArray(e)?e:[e];const t=await Promise.all(e.map((async e=>fetch(new Request(e)).then((t=>{if(!t.ok)throw new Error(`Error downloading font face asset from ${e}. Server responded with status: ${t.status}`);return t.blob()})).then((t=>{const n=e.split("/").pop();return new fm([t],n,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void S({type:"error",message:(0,E.__)("Error installing the fonts, could not be downloaded.")})}try{await v([e]),S({type:"success",message:(0,E.__)("Fonts were installed successfully.")})}catch(e){S({type:"error",message:e.message})}o([])},isBusy:_,disabled:0===i.length||_,__experimentalIsFocusable:!0},(0,E.__)("Install"))),!a&&(0,l.createElement)(b.Flex,{justify:"center",className:"font-library-modal__tabpanel-layout__footer"},(0,l.createElement)(b.Button,{label:(0,E.__)("First page"),size:"compact",onClick:()=>u(1),disabled:1===c,__experimentalIsFocusable:!0},(0,l.createElement)("span",null,"«")),(0,l.createElement)(b.Button,{label:(0,E.__)("Previous page"),size:"compact",onClick:()=>u(c-1),disabled:1===c,__experimentalIsFocusable:!0},(0,l.createElement)("span",null,"‹")),(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2},(0,g.createInterpolateElement)((0,E.sprintf)((0,E._x)("Page of %s","paging"),N),{CurrentPageControl:(0,l.createElement)(b.SelectControl,{"aria-label":(0,E.__)("Current page"),value:c,options:[...Array(N)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>u(parseInt(e)),size:"compact",__nextHasNoMarginBottom:!0})})),(0,l.createElement)(b.Button,{label:(0,E.__)("Next page"),size:"compact",onClick:()=>u(c+1),disabled:c===N,__experimentalIsFocusable:!0},(0,l.createElement)("span",null,"›")),(0,l.createElement)(b.Button,{label:(0,E.__)("Last page"),size:"compact",onClick:()=>u(N),disabled:c===N,__experimentalIsFocusable:!0},(0,l.createElement)("span",null,"»"))));var H};var jm=a(8572),Zm=a.n(jm),qm=a(4660),Ym=a.n(qm);globalThis.fetch;class Km{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 Xm{constructor(){this.listeners={}}addEventListener(e,t,n){let r=this.listeners[e]||[];n?r.unshift(t):r.push(t),this.listeners[e]=r}removeEventListener(e,t){let n=this.listeners[e]||[],r=n.findIndex((e=>e===t));r>-1&&(n.splice(r,1),this.listeners[e]=n)}dispatch(e){let t=this.listeners[e.type];if(t)for(let n=0,r=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(Jm+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,r=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const a=`${r?"":"u"}int${n}`,s=[];for(;e--;)s.push(this[a]);return s}}class $m{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const n=e.currentPosition,r={enumerable:!1,get:()=>n};Object.defineProperty(this,"start",r)}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 ep extends $m{constructor(e,t,n){const{parser:r,start:a}=super(new Qm(e,t,n)),s={enumerable:!1,get:()=>r};Object.defineProperty(this,"p",s);const i={enumerable:!1,get:()=>a};Object.defineProperty(this,"tableStart",i)}}function tp(e,t,n){let r;Object.defineProperty(e,t,{get:()=>r||(r=n(),r),enumerable:!0})}class np extends ep{constructor(e,t,n){const{p:r}=super({offset:0,length:12},t,"sfnt");this.version=r.uint32,this.numTables=r.uint16,this.searchRange=r.uint16,this.entrySelector=r.uint16,this.rangeShift=r.uint16,r.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new rp(r))),this.tables={},this.directory.forEach((e=>{tp(this.tables,e.tag.trim(),(()=>n(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class rp{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const ap=Ym().inflate||void 0;let sp;class ip extends ep{constructor(e,t,n){const{p:r}=super({offset:0,length:44},t,"woff");this.signature=r.tag,this.flavor=r.uint32,this.length=r.uint32,this.numTables=r.uint16,r.uint16,this.totalSfntSize=r.uint32,this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.metaOffset=r.uint32,this.metaLength=r.uint32,this.metaOrigLength=r.uint32,this.privOffset=r.uint32,this.privLength=r.uint32,r.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new op(r))),lp(this,t,n)}}class op{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function lp(e,t,n){e.tables={},e.directory.forEach((r=>{tp(e.tables,r.tag.trim(),(()=>{let a=0,s=t;if(r.compLength!==r.origLength){const e=t.buffer.slice(r.offset,r.offset+r.compLength);let n;if(ap)n=ap(new Uint8Array(e));else{if(!sp){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}n=sp(new Uint8Array(e))}s=new DataView(n.buffer)}else a=r.offset;return n(e.tables,{tag:r.tag,offset:a,length:r.origLength},s)}))}))}const cp=Zm();let up;class dp extends ep{constructor(e,t,n){const{p:r}=super({offset:0,length:48},t,"woff2");this.signature=r.tag,this.flavor=r.uint32,this.length=r.uint32,this.numTables=r.uint16,r.uint16,this.totalSfntSize=r.uint32,this.totalCompressedSize=r.uint32,this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.metaOffset=r.uint32,this.metaLength=r.uint32,this.metaOrigLength=r.uint32,this.privOffset=r.uint32,this.privLength=r.uint32,r.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new mp(r)));let a,s=r.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let n=this.directory[t+1];n&&(n.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let i=t.buffer.slice(s);if(cp)a=cp(new Uint8Array(i));else{if(!up){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}a=new Uint8Array(up(i))}!function(e,t,n){e.tables={},e.directory.forEach((r=>{tp(e.tables,r.tag.trim(),(()=>{const a=r.offset,s=a+(r.transformLength?r.transformLength:r.origLength),i=new DataView(t.slice(a,s).buffer);try{return n(e.tables,{tag:r.tag,offset:0,length:r.origLength},i)}catch(e){console.error(e)}}))}))}(this,a,n)}}class mp{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 pp={};let hp=!1;function fp(e,t,n){let r=t.tag.replace(/[^\w\d]/g,""),a=pp[r];return a?new a(t,n,e):(console.warn(`lib-font has no definition for ${r}. The table was skipped.`),{})}function gp(){let e=0;function t(n,r){if(!hp)return e>10?r(new Error("loading took too long")):(e++,setTimeout((()=>t(n)),250));n(fp)}return new Promise(((e,n)=>t(e)))}async function yp(e,t,n={}){if(!globalThis.document)return;let r=function(e,t){let n=e.lastIndexOf("."),r=(e.substring(n+1)||"").toLowerCase(),a={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[r];if(a)return a;let s={eot:"The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.",svg:"The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.",fon:"The .fon format is not supported: this is an ancient Windows bitmap font format.",ttc:"Based on the current CSS specification, font collections are not (yet?) supported."}[r];if(s||(s=`${e} is not a known webfont format.`),t)throw new Error(s);console.warn(`Could not load font: ${s}`)}(t,n.errorOnStyle);if(!r)return;let a=document.createElement("style");a.className="injected-by-Font-js";let s=[];return n.styleRules&&(s=Object.entries(n.styleRules).map((([e,t])=>`${e}: ${t};`))),a.textContent=`\n@font-face {\n font-family: "${e}";\n ${s.join("\n\t")}\n src: url("${t}") format("${r}");\n}`,globalThis.document.head.appendChild(a),a}Promise.all([Promise.resolve().then((function(){return zp})),Promise.resolve().then((function(){return Hp})),Promise.resolve().then((function(){return Gp})),Promise.resolve().then((function(){return Wp})),Promise.resolve().then((function(){return jp})),Promise.resolve().then((function(){return Yp})),Promise.resolve().then((function(){return Kp})),Promise.resolve().then((function(){return Jp})),Promise.resolve().then((function(){return lh})),Promise.resolve().then((function(){return bh})),Promise.resolve().then((function(){return vf})),Promise.resolve().then((function(){return _f})),Promise.resolve().then((function(){return wf})),Promise.resolve().then((function(){return Cf})),Promise.resolve().then((function(){return kf})),Promise.resolve().then((function(){return Tf})),Promise.resolve().then((function(){return If})),Promise.resolve().then((function(){return Mf})),Promise.resolve().then((function(){return Af})),Promise.resolve().then((function(){return Of})),Promise.resolve().then((function(){return Nf})),Promise.resolve().then((function(){return Ff})),Promise.resolve().then((function(){return Df})),Promise.resolve().then((function(){return Hf})),Promise.resolve().then((function(){return Uf})),Promise.resolve().then((function(){return Wf})),Promise.resolve().then((function(){return jf})),Promise.resolve().then((function(){return Zf})),Promise.resolve().then((function(){return qf})),Promise.resolve().then((function(){return Xf})),Promise.resolve().then((function(){return tg})),Promise.resolve().then((function(){return ag})),Promise.resolve().then((function(){return ig})),Promise.resolve().then((function(){return cg})),Promise.resolve().then((function(){return ug})),Promise.resolve().then((function(){return dg})),Promise.resolve().then((function(){return pg})),Promise.resolve().then((function(){return hg})),Promise.resolve().then((function(){return vg})),Promise.resolve().then((function(){return _g})),Promise.resolve().then((function(){return Eg}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];pp[t]=e[t]})),hp=!0}));const vp=[0,1,0,0],_p=[79,84,84,79],bp=[119,79,70,70],Ep=[119,79,70,50];function wp(e,t){if(e.length===t.length){for(let n=0;n{globalThis.document&&!this.options.skipStyleSheet&&await yp(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 r=new Km("error",n,`Failed to load font at ${t||e}`);this.dispatch(r),this.onerror&&this.onerror(r)}))}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 wp(t,vp)||wp(t,_p)?"SFNT":wp(t,bp)?"WOFF":wp(t,Ep)?"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 r=new Km("load",{font:this});this.dispatch(r),this.onload&&this.onload(r)}async parseBasicData(e){return gp().then((t=>("SFNT"===e&&(this.opentype=new np(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new ip(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new dp(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 r=n.getBoundingClientRect();document.body.removeChild(n);const a=this.opentype.tables["OS/2"];return r.fontSize=t,r.ascender=a.sTypoAscender,r.descender=a.sTypoDescender,r}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new Km("unload",{font:this});this.dispatch(e),this.onunload&&this.onunload(e)}this._unloaded=!0}load(){if(this.__unloaded){delete this.__unloaded,document.head.appendChild(this.styleElement);const e=new Km("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Sp;class xp extends $m{constructor(e,t,n){super(e),this.plaformID=t,this.encodingID=n}}class Cp extends xp{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 kp extends xp{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 r=Math.max(...this.subHeaderKeys),a=e.currentPosition;tp(this,"subHeaders",(()=>(e.currentPosition=a,[...new Array(r)].map((t=>new Tp(e))))));const s=a+8*r;tp(this,"glyphIndexArray",(()=>(e.currentPosition=s,[...new Array(r)].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,r=this.subHeaders[n],a=this.subHeaders[r],s=a.firstCode,i=s+a.entryCount;return s<=t&&t<=i}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map((e=>({firstCode:e.firstCode,lastCode:e.lastCode}))):this.subHeaders.map((e=>({start:e.firstCode,end:e.lastCode})))}}class Tp{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 Pp extends xp{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 r=e.currentPosition;tp(this,"endCode",(()=>e.readBytes(this.segCount,r,16)));const a=r+2+this.segCountX2;tp(this,"startCode",(()=>e.readBytes(this.segCount,a,16)));const s=a+this.segCountX2;tp(this,"idDelta",(()=>e.readBytes(this.segCount,s,16,!0)));const i=s+this.segCountX2;tp(this,"idRangeOffset",(()=>e.readBytes(this.segCount,i,16)));const o=i+this.segCountX2,l=this.length-(o-this.tableStart);tp(this,"glyphIdArray",(()=>e.readBytes(l,o,16))),tp(this,"segments",(()=>this.buildSegments(i,o,e)))}buildSegments(e,t,n){return[...new Array(this.segCount)].map(((t,r)=>{let a=this.startCode[r],s=this.endCode[r],i=this.idDelta[r],o=this.idRangeOffset[r],l=e+2*r,c=[];if(0===o)for(let e=a+i,t=s+i;e<=t;e++)c.push(e);else for(let e=0,t=s-a;e<=t;e++)n.currentPosition=l+o+2*e,c.push(n.uint16);return{startCode:a,endCode:s,idDelta:i,idRangeOffset:o,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const n=t.startCode+t.glyphIDs.indexOf(e);return{code:n,unicode:String.fromCodePoint(n)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343)return 0;if(65534==(65534&e)||65535==(65535&e))return 0;let t=this.segments.find((t=>t.startCode<=e&&e<=t.endCode));return t?t.glyphIDs[e-t.startCode]:0}supports(e){return 0!==this.getGlyphId(e)}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map((e=>({start:e.startCode,end:e.endCode})))}}class Ip extends xp{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;tp(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 Mp extends xp{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;tp(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Ap(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 Ap{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class Op extends xp{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;tp(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 Np extends xp{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;tp(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Fp(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343||65534==(65534&e)||65535==(65535&e)?0:-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){for(let t of this.groups){let n=t.startGlyphID;if(n>e)continue;if(n===e)return t.startCharCode;if(n+(t.endCharCode-t.startCharCode)({start:e.startCharCode,end:e.endCharCode})))}}class Fp{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class Rp extends xp{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;tp(this,"groups",[...new Array(this.numGroups)].map((t=>new Dp(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 Dp{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class Vp extends xp{constructor(e,t,n){super(e,t,n),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,tp(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new Lp(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 Lp{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class Bp{constructor(e,t){const n=this.platformID=e.uint16,r=this.encodingID=e.uint16,a=this.offset=e.Offset32;tp(this,"table",(()=>(e.currentPosition=t+a,function(e,t,n){const r=e.uint16;return 0===r?new Cp(e,t,n):2===r?new kp(e,t,n):4===r?new Pp(e,t,n):6===r?new Ip(e,t,n):8===r?new Mp(e,t,n):10===r?new Op(e,t,n):12===r?new Np(e,t,n):13===r?new Rp(e,t,n):14===r?new Vp(e,t,n):{}}(e,n,r))))}}var zp=Object.freeze({__proto__:null,cmap:class extends ep{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 Bp(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 a=this.getSubTable(r);return!!a.getGlyphId&&(t=a.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,n)=>{const r=this.getSubTable(n);return r.supports&&!1!==r.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,n)=>{const r=this.getSubTable(n);return r.supportsVariation&&!1!==r.supportsVariation(e)}))}}});var Hp=Object.freeze({__proto__:null,head:class extends ep{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 Gp=Object.freeze({__proto__:null,hhea:class extends ep{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 Up{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var Wp=Object.freeze({__proto__:null,hmtx:class extends ep{constructor(e,t,n){const{p:r}=super(e,t),a=n.hhea.numberOfHMetrics,s=n.maxp.numGlyphs,i=r.currentPosition;if(tp(this,"hMetrics",(()=>(r.currentPosition=i,[...new Array(a)].map((e=>new Up(r.uint16,r.int16)))))),a(r.currentPosition=e,[...new Array(s-a)].map((e=>r.int16)))))}}}});var jp=Object.freeze({__proto__:null,maxp:class extends ep{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 Zp{constructor(e,t){this.length=e,this.offset=t}}class qp{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,tp(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:n,length:r}=t;if(0===r)return"";if(0===n||3===n){const t=[];for(let n=0,a=r/2;nnew qp(n,this))),1===this.format&&(this.langTagCount=n.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new Zp(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 Kp=Object.freeze({__proto__:null,OS2:class extends ep{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 Xp=[".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 Jp=Object.freeze({__proto__:null,post:class extends ep{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 Xp[t];let n=this.glyphNameOffsets[e],r=this.glyphNameOffsets[e+1]-n-1;if(0===r)return".notdef.";this.parser.currentPosition=this.namesOffset+n;return this.parser.readBytes(r,this.namesOffset+n,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class Qp extends ep{constructor(e,t){const{p:n}=super(e,t,"AxisTable");this.baseTagListOffset=n.Offset16,this.baseScriptListOffset=n.Offset16,tp(this,"baseTagList",(()=>new $p({offset:e.offset+this.baseTagListOffset},t))),tp(this,"baseScriptList",(()=>new eh({offset:e.offset+this.baseScriptListOffset},t)))}}class $p extends ep{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 eh extends ep{constructor(e,t){const{p:n}=super(e,t,"BaseScriptListTable");this.baseScriptCount=n.uint16;const r=n.currentPosition;tp(this,"baseScriptRecords",(()=>(n.currentPosition=r,[...new Array(this.baseScriptCount)].map((e=>new th(this.start,n))))))}}class th{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,tp(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new nh(t))))}}class nh{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 rh(this.start,e))),tp(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new ah(e)))),tp(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new sh(e))))}}class rh{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,tp(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new sh(t))))}}class ah{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 oh(this.parser)}}class sh{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;tp(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new ih(e))))))}}class ih{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class oh{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 lh=Object.freeze({__proto__:null,BASE:class extends ep{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,tp(this,"horizAxis",(()=>new Qp({offset:e.offset+this.horizAxisOffset},t))),tp(this,"vertAxis",(()=>new Qp({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,tp(this,"itemVarStore",(()=>new Qp({offset:e.offset+this.itemVarStoreOffset},t))))}}});class ch{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 uh(e))))}}class uh{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class dh extends $m{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 mh(e))))}}class mh{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class ph{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 hh extends $m{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 fh(this.parser)}}class fh{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class gh extends $m{constructor(e){super(e),this.coverageOffset=e.Offset16,tp(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new dh(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 yh(this.parser)}}class yh extends $m{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 vh(this.parser)}}class vh{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 _h extends $m{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 dh(this.parser)}}var bh=Object.freeze({__proto__:null,GDEF:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.glyphClassDefOffset=n.Offset16,tp(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return n.currentPosition=this.tableStart+this.glyphClassDefOffset,new ch(n)})),this.attachListOffset=n.Offset16,tp(this,"attachList",(()=>{if(0!==this.attachListOffset)return n.currentPosition=this.tableStart+this.attachListOffset,new hh(n)})),this.ligCaretListOffset=n.Offset16,tp(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return n.currentPosition=this.tableStart+this.ligCaretListOffset,new gh(n)})),this.markAttachClassDefOffset=n.Offset16,tp(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return n.currentPosition=this.tableStart+this.markAttachClassDefOffset,new ch(n)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=n.Offset16,tp(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return n.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new _h(n)}))),3===this.minorVersion&&(this.itemVarStoreOffset=n.Offset32,tp(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return n.currentPosition=this.tableStart+this.itemVarStoreOffset,new ph(n)})))}}});class Eh extends $m{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new wh(e)))}}class wh{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Sh extends $m{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new xh(e)))}}class xh{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class Ch{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 kh extends $m{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new Th(e)))}}class Th{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class Ph extends $m{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 Mh(e);if(t.startsWith("cc"))return new Ih(e);if(t.startsWith("ss"))return new Ah(e)}}}class Ih{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 Mh{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class Ah{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function Oh(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class Nh extends $m{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 dh(e)}}class Fh{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Rh extends Nh{constructor(e){super(e),this.deltaGlyphID=e.int16}}class Dh extends Nh{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 Vh(t)}}class Vh{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Lh extends Nh{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 Bh(t)}}class Bh{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class zh extends Nh{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 $m{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 Gh(t)}}class Gh{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class Uh extends Nh{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&&(Oh(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 Fh(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 Wh(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 Zh(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 dh(t)}}class Wh extends $m{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 jh(t)}}class jh{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 Fh(e)))}}class Zh extends $m{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 qh(t)}}class qh extends jh{constructor(e){super(e)}}class Yh extends Nh{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&&(Oh(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 $h(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 Kh(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 Jh(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 dh(t)}}class Kh extends $m{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 Xh(t)}}class Xh{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 Fh(e)))}}class Jh extends $m{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 Qh(t)}}class Qh{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 $h(e)))}}class $h extends $m{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class ef extends $m{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class tf extends Nh{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 nf={buildSubtable:function(e,t){const n=new[void 0,Rh,Dh,Lh,zh,Uh,Yh,ef,tf][e](t);return n.type=e,n}};class rf extends $m{constructor(e){super(e)}}class af extends rf{constructor(e){super(e),console.log("lookup type 1")}}class sf extends rf{constructor(e){super(e),console.log("lookup type 2")}}class of extends rf{constructor(e){super(e),console.log("lookup type 3")}}class lf extends rf{constructor(e){super(e),console.log("lookup type 4")}}class cf extends rf{constructor(e){super(e),console.log("lookup type 5")}}class uf extends rf{constructor(e){super(e),console.log("lookup type 6")}}class df extends rf{constructor(e){super(e),console.log("lookup type 7")}}class mf extends rf{constructor(e){super(e),console.log("lookup type 8")}}class pf extends rf{constructor(e){super(e),console.log("lookup type 9")}}var hf={buildSubtable:function(e,t){const n=new[void 0,af,sf,of,lf,cf,uf,df,mf,pf][e](t);return n.type=e,n}};class ff extends $m{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class gf extends $m{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?nf:hf;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class yf extends ep{constructor(e,t,n){const{p:r,tableStart:a}=super(e,t,n);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.scriptListOffset=r.Offset16,this.featureListOffset=r.Offset16,this.lookupListOffset=r.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=r.Offset32);const s=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);tp(this,"scriptList",(()=>s?Eh.EMPTY:(r.currentPosition=a+this.scriptListOffset,new Eh(r)))),tp(this,"featureList",(()=>s?kh.EMPTY:(r.currentPosition=a+this.featureListOffset,new kh(r)))),tp(this,"lookupList",(()=>s?ff.EMPTY:(r.currentPosition=a+this.lookupListOffset,new ff(r)))),this.featureVariationsOffset&&tp(this,"featureVariations",(()=>s?FeatureVariations.EMPTY:(r.currentPosition=a+this.featureVariationsOffset,new FeatureVariations(r))))}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 Sh(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 Ch(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 r=new Ch(this.parser);return r.langSysTag=t,r}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 Ph(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 gf(this.parser,t)}}var vf=Object.freeze({__proto__:null,GSUB:class extends yf{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var _f=Object.freeze({__proto__:null,GPOS:class extends yf{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class bf extends $m{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Ef(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 Ef{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var wf=Object.freeze({__proto__:null,SVG:class extends ep{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 bf(n)}}});class Sf{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 xf{constructor(e,t,n){let r=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-r(n.currentPosition=r,[...new Array(this.axisCount)].map((e=>new Sf(n))))));const a=r+this.axisCount*this.axisSize;tp(this,"instances",(()=>{let e=[];for(let t=0;te.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var kf=Object.freeze({__proto__:null,cvt:class extends ep{constructor(e,t){const{p:n}=super(e,t),r=e.length/2;tp(this,"items",(()=>[...new Array(r)].map((e=>n.fword))))}}});var Tf=Object.freeze({__proto__:null,fpgm:class extends ep{constructor(e,t){const{p:n}=super(e,t);tp(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});class Pf{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var If=Object.freeze({__proto__:null,gasp:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numRanges=n.uint16;tp(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Pf(n)))))}}});var Mf=Object.freeze({__proto__:null,glyf:class extends ep{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var Af=Object.freeze({__proto__:null,loca:class extends ep{constructor(e,t,n){const{p:r}=super(e,t),a=n.maxp.numGlyphs+1;0===n.head.indexToLocFormat?(this.x2=!0,tp(this,"offsets",(()=>[...new Array(a)].map((e=>r.Offset16))))):tp(this,"offsets",(()=>[...new Array(a)].map((e=>r.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 Of=Object.freeze({__proto__:null,prep:class extends ep{constructor(e,t){const{p:n}=super(e,t);tp(this,"instructions",(()=>[...new Array(e.length)].map((e=>n.uint8))))}}});var Nf=Object.freeze({__proto__:null,CFF:class extends ep{constructor(e,t){const{p:n}=super(e,t);tp(this,"data",(()=>n.readBytes()))}}});var Ff=Object.freeze({__proto__:null,CFF2:class extends ep{constructor(e,t){const{p:n}=super(e,t);tp(this,"data",(()=>n.readBytes()))}}});class Rf{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var Df=Object.freeze({__proto__:null,VORG:class extends ep{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,tp(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new Rf(n)))))}}});class Vf{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new Bf(e),this.vert=new Bf(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 Lf{constructor(e){this.hori=new Bf(e),this.vert=new Bf(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class Bf{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 zf extends ep{constructor(e,t,n){const{p:r}=super(e,t,n);this.majorVersion=r.uint16,this.minorVersion=r.uint16,this.numSizes=r.uint32,tp(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new Vf(r)))))}}var Hf=Object.freeze({__proto__:null,EBLC:zf});class Gf extends ep{constructor(e,t,n){const{p:r}=super(e,t,n);this.majorVersion=r.uint16,this.minorVersion=r.uint16}}var Uf=Object.freeze({__proto__:null,EBDT:Gf});var Wf=Object.freeze({__proto__:null,EBSC:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,tp(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new Lf(n)))))}}});var jf=Object.freeze({__proto__:null,CBLC:class extends zf{constructor(e,t){super(e,t,"CBLC")}}});var Zf=Object.freeze({__proto__:null,CBDT:class extends Gf{constructor(e,t){super(e,t,"CBDT")}}});var qf=Object.freeze({__proto__:null,sbix:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.flags=n.flags(16),this.numStrikes=n.uint32,tp(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>n.Offset32))))}}});class Yf{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class Kf{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var Xf=Object.freeze({__proto__:null,COLR:class extends ep{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 Yf(this.parser),r=n.gID,a=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=a;let s=new Yf(this.parser),i=s.gID;if(r===e)return n;if(i===e)return s;for(;t!==a;){let n=t+(a-t)/12;this.parser.currentPosition=n;let r=new Yf(this.parser),s=r.gID;if(s===e)return r;s>e?a=n:snew Kf(p)))}}});class Jf{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class Qf{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class $f{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class eg{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var tg=Object.freeze({__proto__:null,CPAL:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.numPaletteEntries=n.uint16;const r=this.numPalettes=n.uint16;this.numColorRecords=n.uint16,this.offsetFirstColorRecord=n.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>n.uint16)),tp(this,"colorRecords",(()=>(n.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new Jf(n)))))),1===this.version&&(this.offsetPaletteTypeArray=n.Offset32,this.offsetPaletteLabelArray=n.Offset32,this.offsetPaletteEntryLabelArray=n.Offset32,tp(this,"paletteTypeArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new Qf(n,r)))),tp(this,"paletteLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new $f(n,r)))),tp(this,"paletteEntryLabelArray",(()=>(n.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new eg(n,r)))))}}});class ng{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class rg{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var ag=Object.freeze({__proto__:null,DSIG:class extends ep{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 ng(n)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new rg(this.parser)}}});class sg{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var ig=Object.freeze({__proto__:null,hdmx:class extends ep{constructor(e,t,n){const{p:r}=super(e,t),a=n.hmtx.numGlyphs;this.version=r.uint16,this.numRecords=r.int16,this.sizeDeviceRecord=r.int32,this.records=[...new Array(numRecords)].map((e=>new sg(r,a)))}}});class og{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,tp(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new lg(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 lg{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var cg=Object.freeze({__proto__:null,kern:class extends ep{constructor(e,t){const{p:n}=super(e,t);this.version=n.uint16,this.nTables=n.uint16,tp(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let r=0;r[...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 mg{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 pg=Object.freeze({__proto__:null,meta:class extends ep{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 mg(this.tableStart,n)))}}});var hg=Object.freeze({__proto__:null,PCLT:class extends ep{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 fg{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class gg{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new yg(e)))}}class yg{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var vg=Object.freeze({__proto__:null,VDMX:class extends ep{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 fg(n))),this.offsets=[...new Array(this.numRatios)].map((e=>n.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new gg(n)))}}});var _g=Object.freeze({__proto__:null,vhea:class extends ep{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 bg{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Eg=Object.freeze({__proto__:null,vmtx:class extends ep{constructor(e,t,n){super(e,t);const r=n.vhea.numOfLongVerMetrics,a=n.maxp.numGlyphs,s=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=s,[...new Array(r)].map((e=>new bg(p.uint16,p.int16)))))),r(p.currentPosition=e,[...new Array(a-r)].map((e=>p.int16)))))}}}});const{kebabCase:wg}=Xe(b.privateApis);const{ProgressBar:Sg}=Xe(b.privateApis);const xg=function(){const{installFonts:e,notice:t,setNotice:n}=(0,g.useContext)(Im),[r,a]=(0,g.useState)(!1),s=async e=>{n(null),a(!0);const t=new Set,r=[...e];let s=!1;const l=r.map((async e=>{const n=await async function(e){const t=new Sp("Uploaded Font");try{const n=await o(e);return await t.fromDataBuffer(n,"font"),!0}catch(e){return!1}}(e);if(!n)return s=!0,null;if(t.has(e.name))return null;const r=e.name.split(".").pop().toLowerCase();return cm.includes(r)?(t.add(e.name),e):null})),c=(await Promise.all(l)).filter((e=>null!==e));if(c.length>0)i(c);else{const e=s?(0,E.__)("Sorry, you are not allowed to upload this file type."):(0,E.__)("No fonts found to install.");n({type:"error",message:e}),a(!1)}},i=async e=>{const t=await Promise.all(e.map((async e=>{const t=await c(e);return await bm(t,t.file,"all"),t})));u(t)};async function o(e){return new Promise(((t,n)=>{const r=new window.FileReader;r.readAsArrayBuffer(e),r.onload=()=>t(r.result),r.onerror=n}))}const c=async e=>{const t=await o(e),n=new Sp("Uploaded Font");n.fromDataBuffer(t,e.name);const r=(await new Promise((e=>n.onload=e))).detail.font,{name:a}=r.opentype.tables,s=a.get(16)||a.get(1),i=a.get(2).toLowerCase().includes("italic"),l=r.opentype.tables["OS/2"].usWeightClass||"normal",c=!!r.opentype.tables.fvar&&r.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:s,fontStyle:i?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||l}},u=async t=>{const r=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:wg(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(r),n({type:"success",message:(0,E.__)("Fonts were installed successfully.")})}catch(e){n({type:"error",message:e.message,errors:e?.installationErrors})}a(!1)};return(0,l.createElement)("div",{className:"font-library-modal__tabpanel-layout"},(0,l.createElement)(b.DropZone,{onFilesDrop:e=>{s(e)}}),(0,l.createElement)(b.__experimentalVStack,{className:"font-library-modal__local-fonts"},t&&(0,l.createElement)(b.Notice,{status:t.type,__unstableHTML:!0,onRemove:()=>n(null)},t.message,t.errors&&(0,l.createElement)("ul",null,t.errors.map(((e,t)=>(0,l.createElement)("li",{key:t},e))))),r&&(0,l.createElement)(b.FlexItem,null,(0,l.createElement)("div",{className:"font-library-modal__upload-area"},(0,l.createElement)(Sg,null))),!r&&(0,l.createElement)(b.FormFileUpload,{accept:cm.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{s(e.target.files)},render:({openFileDialog:e})=>(0,l.createElement)(b.Button,{className:"font-library-modal__upload-area",onClick:e},(0,E.__)("Upload font"))}),(0,l.createElement)(b.__experimentalSpacer,{margin:2}),(0,l.createElement)(b.__experimentalText,{className:"font-library-modal__upload-area__text"},(0,E.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2."))))},{Tabs:Cg}=Xe(b.privateApis),kg={id:"installed-fonts",title:(0,E.__)("Library")},Tg={id:"upload-fonts",title:(0,E.__)("Upload")};const Pg=function({onRequestClose:e,initialTabId:t="installed-fonts"}){const{collections:n,setNotice:r}=(0,g.useContext)(Im),a=(0,m.useSelect)((e=>{const{canUser:t}=e(ye.store);return t("create","font-families")}),[]),s=[kg];return a&&(s.push(Tg),s.push(...(e=>e.map((({slug:t,name:n})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,E.__)("Install Fonts"):n}))))(n||[]))),(0,l.createElement)(b.Modal,{title:(0,E.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal"},(0,l.createElement)("div",{className:"font-library-modal__tabs"},(0,l.createElement)(Cg,{initialTabId:t,onSelect:()=>{r(null)}},(0,l.createElement)(Cg.TabList,null,s.map((({id:e,title:t})=>(0,l.createElement)(Cg.Tab,{key:e,tabId:e},t)))),s.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,l.createElement)(xg,null);break;case"installed-fonts":t=(0,l.createElement)(Lm,null);break;default:t=(0,l.createElement)(Wm,{slug:e})}return(0,l.createElement)(Cg.TabPanel,{key:e,tabId:e,focusable:!1},t)})))))};const Ig=function({font:e}){const{handleSetLibraryFontSelected:t,toggleModal:n}=(0,g.useContext)(Im),r=e?.fontFace?.length||1,a=hm(e);return(0,l.createElement)(b.__experimentalItem,{onClick:()=>{t(e),n("installed-fonts")}},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.FlexItem,{style:a},e.name),(0,l.createElement)(b.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count"},(0,E.sprintf)((0,E._n)("%d variant","%d variants",r),r))))};function Mg(){const{modalTabOpen:e,toggleModal:t,themeFonts:n,customFonts:r}=(0,g.useContext)(Im),a=0t(),initialTabId:e}),(0,l.createElement)(b.__experimentalVStack,{spacing:3},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(Fd,{level:3},(0,E.__)("Fonts")),(0,l.createElement)(b.__experimentalHStack,{justify:"flex-end"},(0,l.createElement)(b.Tooltip,{text:(0,E.__)("Manage fonts")},(0,l.createElement)(b.Button,{onClick:()=>t("installed-fonts"),"aria-label":(0,E.__)("Manage fonts"),icon:nm,size:"small"})))),a?(0,l.createElement)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},r.map((e=>(0,l.createElement)(Ig,{key:e.slug,font:e}))),n.map((e=>(0,l.createElement)(Ig,{key:e.slug,font:e})))):(0,l.createElement)(l.Fragment,null,(0,E.__)("No fonts installed."),(0,l.createElement)(b.Button,{className:"edit-site-global-styles-font-families__add-fonts",variant:"secondary",onClick:()=>t("upload-fonts")},(0,E.__)("Add fonts")))))}const Ag=({...e})=>(0,l.createElement)(Mm,null,(0,l.createElement)(Mg,{...e}));const Og=function(){const e=(0,m.useSelect)((e=>e(y.store).getEditorSettings().fontLibraryEnabled),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("Typography"),description:(0,E.__)("Manage the typography settings for different elements.")}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-typography"},(0,l.createElement)(b.__experimentalVStack,{spacing:6},e&&(0,l.createElement)(Ag,null),(0,l.createElement)(tm,null))))},{useGlobalStyle:Ng,useGlobalSetting:Fg,useSettingsForBlockElement:Rg,TypographyPanel:Dg}=Xe(fe.privateApis);function Vg({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const r=n.join("."),[a]=Ng(r,void 0,"user",{shouldDecodeEncode:!1}),[s,i]=Ng(r,void 0,"all",{shouldDecodeEncode:!1}),[o]=Fg(""),c=Rg(o,void 0,"heading"===e?t:e);return(0,l.createElement)(Dg,{inheritedValue:s,value:a,onChange:i,settings:c})}const{useGlobalStyle:Lg}=Xe(fe.privateApis);function Bg({name:e,element:t,headingLevel:n}){let r="";"heading"===t?r=`elements.${n}.`:t&&"text"!==t&&(r=`elements.${t}.`);const[a]=Lg(r+"typography.fontFamily",e),[s]=Lg(r+"color.gradient",e),[i]=Lg(r+"color.background",e),[o]=Lg(r+"color.text",e),[c]=Lg(r+"typography.fontSize",e),[u]=Lg(r+"typography.fontStyle",e),[d]=Lg(r+"typography.fontWeight",e),[m]=Lg(r+"typography.letterSpacing",e),p="link"===t?{textDecoration:"underline"}:{};return(0,l.createElement)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=a?a:"serif",background:null!=s?s:i,color:o,fontSize:c,fontStyle:u,fontWeight:d,letterSpacing:m,...p}},"Aa")}const zg={text:{description:(0,E.__)("Manage the fonts used on the site."),title:(0,E.__)("Text")},link:{description:(0,E.__)("Manage the fonts and typography used on the links."),title:(0,E.__)("Links")},heading:{description:(0,E.__)("Manage the fonts and typography used on headings."),title:(0,E.__)("Headings")},caption:{description:(0,E.__)("Manage the fonts and typography used on captions."),title:(0,E.__)("Captions")},button:{description:(0,E.__)("Manage the fonts and typography used on buttons."),title:(0,E.__)("Buttons")}};const Hg=function({element:e}){const[t,n]=(0,g.useState)("heading");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:zg[e].title,description:zg[e].description}),(0,l.createElement)(b.__experimentalSpacer,{marginX:4},(0,l.createElement)(Bg,{element:e,headingLevel:t})),"heading"===e&&(0,l.createElement)(b.__experimentalSpacer,{marginX:4,marginBottom:"1em"},(0,l.createElement)(b.__experimentalToggleGroupControl,{label:(0,E.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0},(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"heading",label:(0,E._x)("All","heading levels")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h1",label:(0,E.__)("H1")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h2",label:(0,E.__)("H2")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h3",label:(0,E.__)("H3")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h4",label:(0,E.__)("H4")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h5",label:(0,E.__)("H5")}),(0,l.createElement)(b.__experimentalToggleGroupControlOption,{value:"h6",label:(0,E.__)("H6")}))),(0,l.createElement)(Vg,{element:e,headingLevel:t}))},Gg=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG"},(0,l.createElement)(w.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 Ug=function({className:e,...t}){return(0,l.createElement)(b.Flex,{className:_()("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:Wg}=Xe(fe.privateApis),jg=[];const Zg=function({name:e}){const[t]=Wg("color.palette.custom"),[n]=Wg("color.palette.theme"),[r]=Wg("color.palette.default"),[a]=Wg("color.defaultPalette",e),[s]=function(e){const[t,n]=Je("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),r=t.map((t=>{const{color:n}=t,r=We(n).rotate(e).toHex();return{...t,color:r}}));n(r)}]:[]}(),i=(0,g.useMemo)((()=>[...t||jg,...n||jg,...r&&a?r:jg]),[t,n,r,a]),o=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette",c=i.length>0?(0,E.sprintf)((0,E._n)("%d color","%d colors",i.length),i.length):(0,E.__)("Add custom colors");return(0,l.createElement)(b.__experimentalVStack,{spacing:3},(0,l.createElement)(Fd,{level:3},(0,E.__)("Palette")),(0,l.createElement)(b.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)(cd,{path:o,"aria-label":(0,E.__)("Color palettes")},(0,l.createElement)(b.__experimentalHStack,{direction:0===i.length?"row-reverse":"row"},(0,l.createElement)(b.__experimentalZStack,{isLayered:!1,offset:-8},i.slice(0,5).map((({color:e},t)=>(0,l.createElement)(Ug,{key:`${e}-${t}`},(0,l.createElement)(b.ColorIndicator,{colorValue:e}))))),(0,l.createElement)(b.FlexItem,null,c)))),window.__experimentalEnableColorRandomizer&&n?.length>0&&(0,l.createElement)(b.Button,{variant:"secondary",icon:Gg,onClick:s},(0,E.__)("Randomize colors")))},{useGlobalStyle:qg,useGlobalSetting:Yg,useSettingsForBlockElement:Kg,ColorPanel:Xg}=Xe(fe.privateApis);const Jg=function(){const[e]=qg("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=qg("",void 0,"all",{shouldDecodeEncode:!1}),[r]=Yg(""),a=Kg(r);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("Colors"),description:(0,E.__)("Manage palettes and the default color of different global elements on the site.")}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-colors"},(0,l.createElement)(b.__experimentalVStack,{spacing:10},(0,l.createElement)(Zg,null),(0,l.createElement)(Xg,{inheritedValue:t,value:e,onChange:n,settings:a}))))},{useGlobalSetting:Qg}=Xe(fe.privateApis),$g={placement:"bottom-start",offset:8};function ey({name:e}){const[t,n]=Qg("color.palette.theme",e),[r]=Qg("color.palette.theme",e,"base"),[a,s]=Qg("color.palette.default",e),[i]=Qg("color.palette.default",e,"base"),[o,c]=Qg("color.palette.custom",e),[u]=Qg("color.defaultPalette",e),d=(0,ie.useViewportMatch)("small","<")?$g:void 0;return(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(b.__experimentalPaletteEdit,{canReset:t!==r,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,E.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:d}),!!a&&!!a.length&&!!u&&(0,l.createElement)(b.__experimentalPaletteEdit,{canReset:a!==i,canOnlyChangeValues:!0,colors:a,onChange:s,paletteLabel:(0,E.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:d}),(0,l.createElement)(b.__experimentalPaletteEdit,{colors:o,onChange:c,paletteLabel:(0,E.__)("Custom"),paletteLabelHeadingLevel:3,emptyMessage:(0,E.__)("Custom colors are empty! Add some colors to create your own color palette."),slugPrefix:"custom-",popoverProps:d}))}const{useGlobalSetting:ty}=Xe(fe.privateApis),ny={placement:"bottom-start",offset:8},ry=()=>{};function ay({name:e}){const[t,n]=ty("color.gradients.theme",e),[r]=ty("color.gradients.theme",e,"base"),[a,s]=ty("color.gradients.default",e),[i]=ty("color.gradients.default",e,"base"),[o,c]=ty("color.gradients.custom",e),[u]=ty("color.defaultGradients",e),[d]=ty("color.duotone.custom")||[],[m]=ty("color.duotone.default")||[],[p]=ty("color.duotone.theme")||[],[h]=ty("color.defaultDuotone"),f=[...d||[],...p||[],...m&&h?m:[]],g=(0,ie.useViewportMatch)("small","<")?ny:void 0;return(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(b.__experimentalPaletteEdit,{canReset:t!==r,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,E.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:g}),!!a&&!!a.length&&!!u&&(0,l.createElement)(b.__experimentalPaletteEdit,{canReset:a!==i,canOnlyChangeValues:!0,gradients:a,onChange:s,paletteLabel:(0,E.__)("Default"),paletteLabelLevel:3,popoverProps:g}),(0,l.createElement)(b.__experimentalPaletteEdit,{gradients:o,onChange:c,paletteLabel:(0,E.__)("Custom"),paletteLabelLevel:3,emptyMessage:(0,E.__)("Custom gradients are empty! Add some gradients to create your own palette."),slugPrefix:"custom-",popoverProps:g}),!!f&&!!f.length&&(0,l.createElement)("div",null,(0,l.createElement)(Fd,{level:3},(0,E.__)("Duotone")),(0,l.createElement)(b.__experimentalSpacer,{margin:3}),(0,l.createElement)(b.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:ry})))}const{Tabs:sy}=Xe(b.privateApis);const iy=function({name:e}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("Palette"),description:(0,E.__)("Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.")}),(0,l.createElement)(sy,null,(0,l.createElement)(sy.TabList,null,(0,l.createElement)(sy.Tab,{tabId:"solid"},"Solid"),(0,l.createElement)(sy.Tab,{tabId:"gradient"},"Gradient")),(0,l.createElement)(sy.TabPanel,{tabId:"solid",focusable:!1},(0,l.createElement)(ey,{name:e})),(0,l.createElement)(sy.TabPanel,{tabId:"gradient",focusable:!1},(0,l.createElement)(ay,{name:e}))))},{useGlobalStyle:oy,useGlobalSetting:ly,useSettingsForBlockElement:cy,DimensionsPanel:uy}=Xe(fe.privateApis),dy={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function my(){const[e]=oy("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=oy("",void 0,"all",{shouldDecodeEncode:!1}),[r]=ly("",void 0,"user"),[a,s]=ly(""),i=cy(a),o=(0,g.useMemo)((()=>({...t,layout:i.layout})),[t,i.layout]),c=(0,g.useMemo)((()=>({...e,layout:r.layout})),[e,r.layout]);return(0,l.createElement)(uy,{inheritedValue:o,value:c,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==r.layout){const t={...r,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,s(t)}},settings:i,includeLayoutControls:!0,defaultControls:dy})}const{useHasDimensionsPanel:py,useGlobalSetting:hy,useSettingsForBlockElement:fy}=Xe(fe.privateApis);const gy=function(){const[e]=hy(""),t=fy(e),n=py(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("Layout")}),n&&(0,l.createElement)(my,null))};const yy=function(){const{mode:e}=(0,m.useSelect)((e=>({mode:e(fe.store).__unstableGetEditorMode()})),[]),t=(0,g.useRef)(null);(0,g.useEffect)((()=>{"zoom-out"!==e&&(t.current=!1)}),[e]),(0,g.useEffect)((()=>{if("zoom-out"!==e)return n("zoom-out"),t.current=!0,()=>{t.current&&n(e)}}),[]);const{__unstableSetEditorMode:n}=(0,m.useDispatch)(fe.store);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{back:"/",title:(0,E.__)("Browse styles"),description:(0,E.__)("Choose a variation to change the look of the site.")}),(0,l.createElement)(b.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations"},(0,l.createElement)(b.CardBody,null,(0,l.createElement)(Gr,null))))},{useGlobalStyle:vy,AdvancedPanel:_y}=Xe(fe.privateApis);const by=function(){const e=(0,E.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=vy("",void 0,"user",{shouldDecodeEncode:!1}),[n,r]=vy("",void 0,"all",{shouldDecodeEncode:!1});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:(0,E.__)("CSS"),description:(0,l.createElement)(l.Fragment,null,e,(0,l.createElement)(b.ExternalLink,{href:"https://wordpress.org/documentation/article/css/",className:"edit-site-global-styles-screen-css-help-link"},(0,E.__)("Learn more about CSS")))}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-css"},(0,l.createElement)(_y,{value:t,onChange:r,inheritedValue:n})))},{ExperimentalBlockEditorProvider:Ey,GlobalStylesContext:wy,useGlobalStylesOutputWithConfig:Sy}=Xe(fe.privateApis);function xy(e){return!e||0===Object.keys(e).length}const Cy=function({userConfig:e,blocks:t}){const{base:n}=(0,g.useContext)(wy),r=(0,g.useMemo)((()=>xy(e)||xy(n)?{}:Ir(n,e)),[n,e]),a=(0,g.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),s=(0,m.useSelect)((e=>e(fe.store).getSettings()),[]),i=(0,g.useMemo)((()=>({...s,__unstableIsPreviewMode:!0})),[s]),[o]=Sy(r),c=xy(o)||xy(e)?i.styles:o;return(0,l.createElement)($r,{title:(0,E.__)("Revisions"),closeButtonLabel:(0,E.__)("Close revisions"),enableResizing:!0},(0,l.createElement)(fe.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0},(0,l.createElement)(fe.__unstableEditorStyles,{styles:c}),(0,l.createElement)("style",null,".is-root-container { display: flow-root; }"),(0,l.createElement)(b.Disabled,{className:"edit-site-revisions__example-preview__content"},(0,l.createElement)(Ey,{value:a,settings:i},(0,l.createElement)(fe.BlockList,{renderAppender:!1})))))},{getGlobalStylesChanges:ky}=Xe(fe.privateApis);function Ty({revision:e,previousRevision:t}){const n=ky(e,t,{maxResults:7});return n.length?(0,l.createElement)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes"},n.map((e=>(0,l.createElement)("li",{key:e},e)))):null}const Py=function({userRevisions:e,selectedRevisionId:t,onChange:n,canApplyRevision:r,onApplyRevision:a}){const{currentThemeName:s,currentUser:i}=(0,m.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:n}=e(ye.store),r=t();return{currentThemeName:r?.name?.rendered||r?.stylesheet,currentUser:n()}}),[]),o=(0,_a.getDate)().getTime(),{datetimeAbbreviated:c}=(0,_a.getSettings)().formats;return(0,l.createElement)("ol",{className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,E.__)("Global styles revisions list"),role:"group"},e.map(((u,d)=>{const{id:m,author:p,modified:h}=u,f="unsaved"===m,g=f?i:p,y=g?.name||(0,E.__)("User"),v=g?.avatar_urls?.[48],w=t?t===m:0===d,S=!r&&w,x="parent"===m,C=(0,_a.getDate)(h),k=h&&o-C.getTime()>864e5?(0,_a.dateI18n)(c,C):(0,_a.humanTimeDiff)(h),T=function(e,t,n,r){return"parent"===e?(0,E.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,E.sprintf)((0,E.__)("Unsaved changes by %s"),t):r?(0,E.sprintf)((0,E.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,n):(0,E.sprintf)((0,E.__)("Changes saved by %1$s on %2$s"),t,n)}(m,y,(0,_a.dateI18n)(c,C),S);return(0,l.createElement)("li",{className:_()("edit-site-global-styles-screen-revisions__revision-item",{"is-selected":w,"is-active":S,"is-reset":x}),key:m,"aria-current":w},(0,l.createElement)(b.Button,{className:"edit-site-global-styles-screen-revisions__revision-button",disabled:w,onClick:()=>{n(u)},"aria-label":T},x?(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__description"},(0,E.__)("Default styles"),(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__meta"},s)):(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__description"},f?(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__date"},(0,E.__)("(Unsaved)")):(0,l.createElement)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:h},k),(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__meta"},(0,l.createElement)("img",{alt:y,src:v}),y),w&&(0,l.createElement)(Ty,{revision:u,previousRevision:dn(1),disabled:s||1===e,"aria-label":(0,E.__)("First page")},"«"),(0,l.createElement)(b.Button,{variant:i,onClick:()=>n(e-1),disabled:s||1===e,"aria-label":(0,E.__)("Previous page")},"‹")),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.sprintf)((0,E._x)("%1$s of %2$s","paging"),e,t)),(0,l.createElement)(b.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(b.Button,{variant:i,onClick:()=>n(e+1),disabled:s||e===t,"aria-label":(0,E.__)("Next page")},"›"),(0,l.createElement)(b.Button,{variant:i,onClick:()=>n(t),disabled:s||e===t,"aria-label":(0,E.__)("Last page")},"»")))}const{GlobalStylesContext:My,areGlobalStyleConfigsEqual:Ay}=Xe(fe.privateApis);const Oy=function(){const{goTo:e}=(0,b.__experimentalUseNavigator)(),{user:t,setUserConfig:n}=(0,g.useContext)(My),{blocks:r,editorCanvasContainerView:a}=(0,m.useSelect)((e=>({editorCanvasContainerView:Xe(e(tr)).getEditorCanvasContainerView(),blocks:e(fe.store).getBlocks()})),[]),[s,i]=(0,g.useState)(1),[o,c]=(0,g.useState)([]),{revisions:u,isLoading:d,hasUnsavedChanges:p,revisionsCount:h}=va({query:{per_page:10,page:s}}),f=Math.ceil(h/10),[y,v]=(0,g.useState)(t),[_,w]=(0,g.useState)(!1),{setEditorCanvasContainerView:S}=Xe((0,m.useDispatch)(tr)),x=Ay(y,t),C=()=>{e("/");S("global-styles-revisions:style-book"===a?"style-book":void 0)},k=e=>{n((()=>({styles:e?.styles,settings:e?.settings}))),w(!1),C()};(0,g.useEffect)((()=>{a&&a.startsWith("global-styles-revisions")||e("/")}),[a]),(0,g.useEffect)((()=>{!d&&u.length&&c(u)}),[u,d]);const T=u[0],P=y?.id,I=!!T?.id&&!x&&!P;(0,g.useEffect)((()=>{I&&v({styles:T?.styles||{},settings:T?.settings||{},id:T?.id})}),[I,T]);const M=!!P&&"unsaved"!==P&&!x,A=!!o.length;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wd,{title:h&&(0,E.sprintf)((0,E.__)("Revisions (%s)"),h),description:(0,E.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),onBack:C}),!A&&(0,l.createElement)(b.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),A&&("global-styles-revisions:style-book"===a?(0,l.createElement)(pa,{userConfig:y,isSelected:()=>{},onClose:()=>{S("global-styles-revisions")}}):(0,l.createElement)(Cy,{blocks:r,userConfig:y,closeButtonLabel:(0,E.__)("Close revisions")})),(0,l.createElement)(Py,{onChange:e=>{v({styles:e?.styles||{},settings:e?.settings||{},id:e?.id})},selectedRevisionId:P,userRevisions:o,canApplyRevision:M,onApplyRevision:()=>p?w(!0):k(y)}),f>1&&(0,l.createElement)("div",{className:"edit-site-global-styles-screen-revisions__footer"},(0,l.createElement)(Iy,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:s,numPages:f,changePage:i,totalItems:h,disabled:d,label:(0,E.__)("Global Styles pagination navigation")})),_&&(0,l.createElement)(b.__experimentalConfirmDialog,{isOpen:_,confirmButtonText:(0,E.__)("Apply"),onConfirm:()=>k(y),onCancel:()=>w(!1)},(0,E.__)("Any unsaved changes will be lost when you apply this revision.")))},{useGlobalStylesReset:Ny}=Xe(fe.privateApis),{Slot:Fy,Fill:Ry}=(0,b.createSlotFill)("GlobalStylesMenu");function Dy(){const[e,t]=Ny(),{toggle:n}=(0,m.useDispatch)(T.store),{canEditCSS:r}=(0,m.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:n}=e(ye.store),r=n(),a=r?t("root","globalStyles",r):void 0;return{canEditCSS:!!a?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:a}=Xe((0,m.useDispatch)(tr)),{goTo:s}=(0,b.__experimentalUseNavigator)(),i=()=>{a("global-styles-css"),s("/css")};return(0,l.createElement)(Ry,null,(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("More")},(({onClose:a})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuGroup,null,r&&(0,l.createElement)(b.MenuItem,{onClick:i},(0,E.__)("Additional CSS")),(0,l.createElement)(b.MenuItem,{onClick:()=>{n("core/edit-site","welcomeGuideStyles"),a()}},(0,E.__)("Welcome Guide"))),(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(b.MenuItem,{onClick:()=>{t(),a()},disabled:!e},(0,E.__)("Reset styles")))))))}function Vy({className:e,...t}){return(0,l.createElement)(b.__experimentalNavigatorScreen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Ly({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,r)=>(0,l.createElement)(Vy,{key:r,path:e+"/variations/"+t.name},(0,l.createElement)(Qd,{name:n,variation:t.name}))))}function By({name:e,parentMenu:t=""}){const n=(0,m.useSelect)((t=>{const{getBlockStyles:n}=t(u.store);return n(e)}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Vy,{path:t+"/colors/palette"},(0,l.createElement)(iy,{name:e})),!!n?.length&&(0,l.createElement)(Ly,{parentMenu:t,blockStyles:n,blockName:e}))}function zy(){const e=(0,b.__experimentalUseNavigator)(),{path:t}=e.location;return(0,l.createElement)(pa,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{e.goTo("/blocks/"+encodeURIComponent(t))}})}function Hy(){const e=(0,b.__experimentalUseNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,m.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(fe.store),r=t();return{selectedBlockName:n(r),selectedBlockClientId:r}}),[]),r=Id(t);(0,g.useEffect)((()=>{if(!n||!r)return;const a=e.location.path;if("/blocks"!==a&&!a.startsWith("/blocks/"))return;const s="/blocks/"+encodeURIComponent(t);s!==a&&e.goTo(s,{skipFocus:!0})}),[n,t,r])}function Gy(){const{goTo:e,location:t}=(0,b.__experimentalUseNavigator)(),n=(0,m.useSelect)((e=>Xe(e(tr)).getEditorCanvasContainerView()),[]),r=t?.path,a="/revisions"===r;(0,g.useEffect)((()=>{switch(n){case"global-styles-revisions":case"global-styles-revisions:style-book":e("/revisions");break;case"global-styles-css":e("/css");break;case"style-book":a&&e("/");break;default:if("/"!==r&&!a)return;e("/")}}),[n,a,e])}const Uy=function(){const e=(0,u.getBlockTypes)(),t=(0,m.useSelect)((e=>Xe(e(tr)).getEditorCanvasContainerView()),[]);return(0,l.createElement)(b.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/"},(0,l.createElement)(Vy,{path:"/"},(0,l.createElement)(_d,null)),(0,l.createElement)(Vy,{path:"/variations"},(0,l.createElement)(yy,null)),(0,l.createElement)(Vy,{path:"/blocks"},(0,l.createElement)(Od,null)),(0,l.createElement)(Vy,{path:"/typography"},(0,l.createElement)(Og,null)),(0,l.createElement)(Vy,{path:"/typography/text"},(0,l.createElement)(Hg,{element:"text"})),(0,l.createElement)(Vy,{path:"/typography/link"},(0,l.createElement)(Hg,{element:"link"})),(0,l.createElement)(Vy,{path:"/typography/heading"},(0,l.createElement)(Hg,{element:"heading"})),(0,l.createElement)(Vy,{path:"/typography/caption"},(0,l.createElement)(Hg,{element:"caption"})),(0,l.createElement)(Vy,{path:"/typography/button"},(0,l.createElement)(Hg,{element:"button"})),(0,l.createElement)(Vy,{path:"/colors"},(0,l.createElement)(Jg,null)),(0,l.createElement)(Vy,{path:"/layout"},(0,l.createElement)(gy,null)),(0,l.createElement)(Vy,{path:"/css"},(0,l.createElement)(by,null)),(0,l.createElement)(Vy,{path:"/revisions"},(0,l.createElement)(Oy,null)),e.map((e=>(0,l.createElement)(Vy,{key:"menu-block-"+e.name,path:"/blocks/"+encodeURIComponent(e.name)},(0,l.createElement)(Qd,{name:e.name})))),(0,l.createElement)(By,null),e.map((e=>(0,l.createElement)(By,{key:"screens-block-"+e.name,name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)}))),"style-book"===t&&(0,l.createElement)(zy,null),(0,l.createElement)(Dy,null),(0,l.createElement)(Hy,null),(0,l.createElement)(Gy,null))};function Wy(){const{shouldClearCanvasContainerView:e,isStyleBookOpened:t,showListViewByDefault:n,hasRevisions:r,isRevisionsOpened:a,isRevisionsStyleBookOpened:s}=(0,m.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(j),{getEditorCanvasContainerView:n,getCanvasMode:r}=Xe(e(tr)),a=n(),s="visual"===e(tr).getEditorMode(),i="edit"===r(),o=e(T.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(ye.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===a,shouldClearCanvasContainerView:"edit-site/global-styles"!==t("core/edit-site")||!s||!i,showListViewByDefault:o,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===a,isRevisionsOpened:"global-styles-revisions"===a}}),[]),{setEditorCanvasContainerView:i}=Xe((0,m.useDispatch)(tr));(0,g.useEffect)((()=>{e&&i(void 0)}),[e]);const{setIsListViewOpened:o}=(0,m.useDispatch)(y.store),{goTo:c}=(0,b.__experimentalUseNavigator)();return(0,l.createElement)(id,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,E.__)("Styles"),icon:ir,closeLabel:(0,E.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,l.createElement)(b.Flex,{className:"edit-site-global-styles-sidebar__header",role:"menubar","aria-label":(0,E.__)("Styles actions")},(0,l.createElement)(b.FlexBlock,{style:{minWidth:"min-content"}},(0,l.createElement)("strong",null,(0,E.__)("Styles"))),(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.Button,{icon:_r,label:(0,E.__)("Style Book"),isPressed:t||s,disabled:e,onClick:()=>{a?i("global-styles-revisions:style-book"):s?i("global-styles-revisions"):(o(t&&n),i(t?void 0:"style-book"))}})),(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.Button,{label:(0,E.__)("Revisions"),icon:ba,onClick:()=>(o(!1),s?(c("/"),void i("style-book")):a?(c("/"),void i(void 0)):(c("/revisions"),void i(t?"global-styles-revisions:style-book":"global-styles-revisions"))),disabled:!r,isPressed:a||s})),(0,l.createElement)(Fy,null))},(0,l.createElement)(Uy,null))}const jy="edit-site/template",Zy="edit-site/block-inspector",{Tabs:qy}=Xe(b.privateApis),Yy=(0,g.forwardRef)(((e,t)=>{const n=(0,m.useSelect)((e=>e(y.store).getPostTypeLabel()),[]);return(0,l.createElement)(qy.TabList,{ref:t},(0,l.createElement)(qy.Tab,{tabId:jy,"data-tab-id":jy},n),(0,l.createElement)(qy.Tab,{tabId:Zy,"data-tab-id":Zy},(0,E.__)("Block")))}));function Ky({className:e,title:t,icon:n,description:r,actions:a,children:s}){return(0,l.createElement)("div",{className:_()("edit-site-sidebar-card",e)},(0,l.createElement)(b.Icon,{className:"edit-site-sidebar-card__icon",icon:n}),(0,l.createElement)("div",{className:"edit-site-sidebar-card__content"},(0,l.createElement)("div",{className:"edit-site-sidebar-card__header"},(0,l.createElement)("h2",{className:"edit-site-sidebar-card__title"},t),a),(0,l.createElement)("div",{className:"edit-site-sidebar-card__description"},r),s))}const{BlockQuickNavigation:Xy}=Xe(fe.privateApis);function Jy(){const e=(0,m.useSelect)((e=>Xe(e(fe.store)).getEnabledClientIdsTree()),[]),t=(0,g.useMemo)((()=>e.map((({clientId:e})=>e))),[e]);return(0,l.createElement)(Xy,{clientIds:t})}const{PostPanelRow:Qy}=Xe(y.privateApis),$y=[{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Draft"),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.__)("Not ready to publish."))),value:"draft"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Pending"),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.__)("Waiting for review before publishing."))),value:"pending"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Private"),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.__)("Only visible to site admins and editors."))),value:"private"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Scheduled"),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.__)("Publish automatically on a chosen date."))),value:"future"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Published"),(0,l.createElement)(b.__experimentalText,{variant:"muted"},(0,E.__)("Visible to everyone."))),value:"publish"}];function ev({postType:e,postId:t,status:n,password:r,date:a}){const[s,i]=(0,g.useState)(!!r),o=(0,ie.useInstanceId)(ev),{editEntityRecord:c}=(0,m.useDispatch)(ye.store),{createErrorNotice:u}=(0,m.useDispatch)(ge.store),[d,p]=(0,g.useState)(null),h=(0,g.useMemo)((()=>({anchor:d,"aria-label":(0,E.__)("Change status"),placement:"bottom-end"})),[d]),f=async({status:s=n,password:i=r,date:o=a})=>{try{await c("postType",e,t,{status:s,date:o,password:i})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while updating the status");u(t,{type:"snackbar"})}},y=e=>{i(e),e||f({password:""})},v=e=>{let t=a,n=r;"publish"===e?new Date(a)>new Date&&(t=null):"future"===e?(!a||new Date(a)(0,l.createElement)(b.Button,{className:"edit-site-summary-field__trigger",variant:"tertiary",onClick:e},(0,l.createElement)(pc,{status:r?"protected":n})),renderContent:({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(fe.__experimentalInspectorPopoverHeader,{title:(0,E.__)("Status"),onClose:e}),(0,l.createElement)("form",null,(0,l.createElement)(b.__experimentalVStack,{spacing:5},(0,l.createElement)(b.RadioControl,{className:"edit-site-change-status__options",hideLabelFromVision:!0,label:(0,E.__)("Status"),options:$y,onChange:v,selected:n}),"private"!==n&&(0,l.createElement)("fieldset",{className:"edit-site-change-status__password-fieldset"},(0,l.createElement)(b.__experimentalText,{as:"legend",className:"edit-site-change-status__password-legend",size:"11",lineHeight:1.4,weight:500,upperCase:!0},(0,E.__)("Password")),(0,l.createElement)(b.ToggleControl,{label:(0,E.__)("Hide this page behind a password"),checked:s,onChange:y}),s&&(0,l.createElement)("div",{className:"edit-site-change-status__password-input"},(0,l.createElement)(b.VisuallyHidden,{as:"label",htmlFor:`edit-site-change-status__password-input-${o}`},(0,E.__)("Create password")),(0,l.createElement)(b.TextControl,{onChange:e=>f({password:e}),value:r,placeholder:(0,E.__)("Use a secure password"),type:"text",id:`edit-site-change-status__password-input-${o}`}))))))}))}function tv({status:e,date:t,password:n,postId:r,postType:a}){return(0,l.createElement)(b.__experimentalVStack,{spacing:0},(0,l.createElement)(ev,{status:e,date:t,password:n,postId:r,postType:a}),(0,l.createElement)(y.PostSchedulePanel,null),(0,l.createElement)(y.PostTemplatePanel,null),(0,l.createElement)(y.PostURLPanel,null),(0,l.createElement)(y.PostAuthorPanel,null))}function nv(){const{id:e,type:t,hasResolved:n,status:r,date:a,password:s,title:i,modified:o,renderingMode:c}=(0,m.useSelect)((e=>{const{getEditedPostContext:t}=e(tr),{getEditedEntityRecord:n,hasFinishedResolution:r}=e(ye.store),{getRenderingMode:a}=e(y.store),s=t(),i=["postType",s.postType,s.postId],o=n(...i);return{hasResolved:r("getEditedEntityRecord",i),title:o?.title,id:o?.id,type:o?.type,status:o?.status,date:o?.date,password:o?.password,modified:o?.modified,renderingMode:a()}}),[]);return n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.PanelBody,null,(0,l.createElement)(Ky,{title:(0,en.decodeEntities)(i),icon:or,description:(0,l.createElement)(b.__experimentalVStack,null,(0,l.createElement)(b.__experimentalText,null,(0,E.sprintf)((0,E.__)("Last edited %s"),(0,_a.humanTimeDiff)(o))))})),(0,l.createElement)(b.PanelBody,{title:(0,E.__)("Summary")},(0,l.createElement)(tv,{status:r,date:a,password:s,postId:e,postType:t})),"post-only"!==c&&(0,l.createElement)(b.PanelBody,{title:(0,E.__)("Content")},(0,l.createElement)(Jy,null)),(0,l.createElement)(y.PostLastRevisionPanel,null),(0,l.createElement)(y.PostTaxonomiesPanel,null),(0,l.createElement)(y.PostFeaturedImagePanel,null),(0,l.createElement)(y.PostExcerptPanel,null),(0,l.createElement)(y.PostDiscussionPanel,null),(0,l.createElement)(y.PageAttributesPanel,null)):null}function rv({onClick:e,availableTemplates:t}){const{editEntityRecord:n}=(0,m.useDispatch)(ye.store),[r,a]=(0,g.useState)(!1),s=()=>{a(!1)},{postId:i,postType:o}=(0,m.useSelect)((e=>({postId:e(tr).getEditedPostId(),postType:e(tr).getEditedPostType()})),[]);return!t.length||t.length<1?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{info:(0,E.__)("Replace the contents of this template with another."),onClick:()=>a(!0)},(0,E.__)("Replace template")),r&&(0,l.createElement)(b.Modal,{title:(0,E.__)("Choose a template"),onRequestClose:s,overlayClassName:"edit-site-template-panel__replace-template-modal",isFullScreen:!0},(0,l.createElement)("div",{className:"edit-site-template-panel__replace-template-modal__content"},(0,l.createElement)(av,{availableTemplates:t,onSelect:async t=>{s(),e(),await n("postType",o,i,{blocks:t.blocks,content:(0,u.serialize)(t.blocks)})}}))))}function av({availableTemplates:e,onSelect:t}){const n=(0,ie.useAsyncList)(e);return(0,l.createElement)(fe.__experimentalBlockPatternsList,{label:(0,E.__)("Templates"),blockPatterns:e,shownPatterns:n,onClickPattern:t})}function sv(e,t){return e.innerBlocks=e.innerBlocks.map((e=>sv(e,t))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=t),e}function iv(e,t,n){return e.filter(((e,n,r)=>(e=>!Ot.includes(e.source))(e)&&((e,t,n)=>t===n.findIndex((t=>e.name===t.name)))(e,n,r)&&(e=>e.templateTypes?.includes(t.slug))(e))).map((e=>({...e,keywords:e.keywords||[],type:It.theme,blocks:(0,u.parse)(e.content,{__unstableSkipMigrationLogs:!0}).map((e=>sv(e,n)))})))}function ov({template:e}){const t=function(e){const{blockPatterns:t,restBlockPatterns:n,currentThemeStylesheet:r}=(0,m.useSelect)((e=>{var t;const{getSettings:n}=Xe(e(tr)),r=n();return{blockPatterns:null!==(t=r.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:r.__experimentalBlockPatterns,restBlockPatterns:e(ye.store).getBlockPatterns(),currentThemeStylesheet:e(ye.store).getCurrentTheme().stylesheet}}),[]);return(0,g.useMemo)((()=>iv([...t||[],...n||[]],e,r)),[t,n,e,r])}(e),{revertTemplate:n}=(0,m.useDispatch)(tr),r=$t(e);return r||t.length&&!(t.length<1)?(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),className:"edit-site-template-card__actions",toggleProps:{isSmall:!0}},(({onClose:a})=>(0,l.createElement)(b.MenuGroup,null,r&&(0,l.createElement)(b.MenuItem,{info:(0,E.__)("Use the template as supplied by the theme."),onClick:()=>{n(e),a()}},(0,E.__)("Clear customizations")),(0,l.createElement)(rv,{availableTemplates:t,template:e,onClick:a})))):null}function lv({area:e,clientId:t}){const{selectBlock:n,toggleBlockHighlight:r}=(0,m.useDispatch)(fe.store),a=(0,m.useSelect)((t=>t(y.store).__experimentalGetDefaultTemplatePartAreas().find((t=>t.area===e))),[e]),s=()=>r(t,!0),i=()=>r(t,!1);return(0,l.createElement)(b.Button,{className:"edit-site-template-card__template-areas-item",icon:a?.icon,onMouseOver:s,onMouseLeave:i,onFocus:s,onBlur:i,onClick:()=>{n(t)}},a?.label)}function cv(){const e=(0,m.useSelect)((e=>e(tr).getCurrentTemplateTemplateParts()),[]);return e.length?(0,l.createElement)("section",{className:"edit-site-template-card__template-areas"},(0,l.createElement)(b.__experimentalHeading,{level:3,className:"edit-site-template-card__template-areas-title"},(0,E.__)("Areas")),(0,l.createElement)("ul",{className:"edit-site-template-card__template-areas-list"},e.map((({templatePart:e,block:t})=>(0,l.createElement)("li",{key:t.clientId},(0,l.createElement)(lv,{area:e.area,clientId:t.clientId})))))):null}const uv={wp_block:cr,wp_navigation:sr};function dv(){var e;const{title:t,description:n,icon:r,record:a}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(tr),{getEditedEntityRecord:r}=e(ye.store),{__experimentalGetTemplateInfo:a}=e(y.store),s=r("postType",t(),n()),i=a(s);return{title:i.title,description:i.description,icon:i.icon,record:s}}),[]);return t||n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.PanelBody,null,(0,l.createElement)(Ky,{className:"edit-site-template-card",title:(0,en.decodeEntities)(t),icon:null!==(e=uv[a?.type])&&void 0!==e?e:r,description:(0,en.decodeEntities)(n),actions:(0,l.createElement)(ov,{template:a})},(0,l.createElement)(cv,null))),(0,l.createElement)(y.PostLastRevisionPanel,null),(0,l.createElement)(y.PostTaxonomiesPanel,null),(0,l.createElement)(y.PostFeaturedImagePanel,null),(0,l.createElement)(y.PostExcerptPanel,null),(0,l.createElement)(y.PostDiscussionPanel,null),(0,l.createElement)(y.PageAttributesPanel,null)):null}const{Fill:mv,Slot:pv}=(0,b.createSlotFill)("PluginTemplateSettingPanel"),hv=mv;hv.Slot=pv;const fv=hv,{Tabs:gv}=Xe(b.privateApis),{Slot:yv,Fill:vv}=(0,b.createSlotFill)("EditSiteSidebarInspector"),_v=vv,bv=({sidebarName:e,isEditingPage:t,supportsGlobalStyles:n})=>{const r=(0,g.useRef)(null),a=(0,g.useContext)(gv.Context);return(0,g.useEffect)((()=>{const t=Array.from(r.current?.querySelectorAll('[role="tab"]')||[]),n=t.find((t=>t.getAttribute("data-tab-id")===e)),a=n?.ownerDocument.activeElement;t.some((e=>a&&a.id===e.id))&&n&&n.id!==a?.id&&n?.focus()}),[e]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(id,{identifier:e,title:(0,E.__)("Settings"),icon:(0,E.isRTL)()?zu:Hu,closeLabel:(0,E.__)("Close Settings"),header:(0,l.createElement)(gv.Context.Provider,{value:a},(0,l.createElement)(Yy,{ref:r})),headerClassName:"edit-site-sidebar-edit-mode__panel-tabs",className:"edit-site-sidebar__panel"},(0,l.createElement)(gv.Context.Provider,{value:a},(0,l.createElement)(gv.TabPanel,{tabId:jy,focusable:!1},t?(0,l.createElement)(nv,null):(0,l.createElement)(dv,null),(0,l.createElement)(fv.Slot,null)),(0,l.createElement)(gv.TabPanel,{tabId:Zy,focusable:!1},(0,l.createElement)(yv,{bubblesVirtually:!0})))),n&&(0,l.createElement)(Wy,null))};function Ev(){const{sidebar:e,isEditorSidebarOpened:t,hasBlockSelection:n,supportsGlobalStyles:r,isEditingPage:a,isEditorOpen:s}=(0,m.useSelect)((e=>{const t=e(j).getActiveComplementaryArea(Qt),n=[Zy,jy].includes(t),{getCanvasMode:r}=Xe(e(tr));return{sidebar:t,isEditorSidebarOpened:n,hasBlockSelection:!!e(fe.store).getBlockSelectionStart(),supportsGlobalStyles:e(ye.store).getCurrentTheme()?.is_block_theme,isEditingPage:e(tr).isPage(),isEditorOpen:"edit"===r()}}),[]),{enableComplementaryArea:i}=(0,m.useDispatch)(j);(0,g.useEffect)((()=>{t&&(n?a||i(Qt,Zy):i(Qt,jy))}),[n,t,a,i]);let o=e;t||(o=n?Zy:jy);const c=(0,g.useCallback)((e=>{e&&i(Qt,e)}),[i]);return(0,l.createElement)(gv,{selectedTabId:s&&t?o:null,onSelect:c,selectOnMove:!1},(0,l.createElement)(bv,{sidebarName:o,isEditingPage:a,supportsGlobalStyles:r}))}var wv=a(4132);function Sv(){const e=(0,ie.useInstanceId)(Sv),{shortcut:t,content:n,blocks:r,type:a,id:s}=(0,m.useSelect)((e=>{const{getEditedEntityRecord:t}=e(ye.store),{getEditedPostType:n,getEditedPostId:r}=e(tr),{getShortcutRepresentation:a}=e(nr.store),s=n(),i=r(),o=t("postType",s,i);return{shortcut:a("core/edit-site/toggle-mode"),content:o?.content,blocks:o?.blocks,type:s,id:i}}),[]),{editEntityRecord:i}=(0,m.useDispatch)(ye.store),o=(0,g.useMemo)((()=>n instanceof Function?n({blocks:r}):r?(0,u.__unstableSerializeAndClean)(r):n),[n,r]),{switchEditorMode:c}=(0,m.useDispatch)(tr);return(0,l.createElement)("div",{className:"edit-site-code-editor"},(0,l.createElement)("div",{className:"edit-site-code-editor__toolbar"},(0,l.createElement)("h2",null,(0,E.__)("Editing code")),(0,l.createElement)(b.Button,{variant:"tertiary",onClick:()=>c("visual"),shortcut:t},(0,E.__)("Exit code editor"))),(0,l.createElement)("div",{className:"edit-site-code-editor__body"},(0,l.createElement)(b.VisuallyHidden,{as:"label",htmlFor:`code-editor-text-area-${e}`},(0,E.__)("Type text or HTML")),(0,l.createElement)(wv.A,{autoComplete:"off",dir:"auto",value:o,onChange:e=>{i("postType",a,s,{content:e.target.value,blocks:void 0,selection:void 0})},className:"edit-site-code-editor-text-area",id:`code-editor-text-area-${e}`,placeholder:(0,E.__)("Start writing with text or HTML")})))}const xv=function(){const{getEditorMode:e}=(0,m.useSelect)(tr),t=(0,m.useSelect)((e=>e(j).getActiveComplementaryArea(tr.name)===Zy),[]),{switchEditorMode:n,toggleDistractionFree:r}=(0,m.useDispatch)(tr),{enableComplementaryArea:a,disableComplementaryArea:s}=(0,m.useDispatch)(j),{replaceBlocks:i}=(0,m.useDispatch)(fe.store),{getBlockName:o,getSelectedBlockClientId:l,getBlockAttributes:c}=(0,m.useSelect)(fe.store),d=(e,t)=>{e.preventDefault();const n=0===t?"core/paragraph":"core/heading",r=l();if(null===r)return;const a=o(r);if("core/paragraph"!==a&&"core/heading"!==a)return;const s=c(r),d="core/paragraph"===a?"align":"textAlign",m="core/paragraph"===n?"align":"textAlign";i(r,(0,u.createBlock)(n,{level:t,content:s.content,[m]:s[d]}))};return(0,nr.useShortcut)("core/edit-site/toggle-block-settings-sidebar",(e=>{e.preventDefault(),t?s(Qt):a(Qt,Zy)})),(0,nr.useShortcut)("core/edit-site/toggle-mode",(()=>{n("visual"===e()?"text":"visual")})),(0,nr.useShortcut)("core/edit-site/transform-heading-to-paragraph",(e=>d(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,nr.useShortcut)(`core/edit-site/transform-paragraph-to-heading-${e}`,(t=>d(t,e)))})),(0,nr.useShortcut)("core/edit-site/toggle-distraction-free",(()=>{r()})),null};function Cv({nonAnimatedSrc:e,animatedSrc:t}){return(0,l.createElement)("picture",{className:"edit-site-welcome-guide__image"},(0,l.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,l.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}function kv(){const{toggle:e}=(0,m.useDispatch)(T.store);return(0,m.useSelect)((e=>!!e(T.store).get("core/edit-site","welcomeGuide")),[])?(0,l.createElement)(b.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,E.__)("Welcome to the site editor"),finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,l.createElement)(Cv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Edit your site")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("Design everything on your site — from the header right down to the footer — using blocks.")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,g.createInterpolateElement)((0,E.__)("Click to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,l.createElement)("img",{alt:(0,E.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})))}]}):null}function Tv(){const{toggle:e}=(0,m.useDispatch)(T.store),{isActive:t,isStylesOpen:n}=(0,m.useSelect)((e=>{const t=e(j).getActiveComplementaryArea(tr.name);return{isActive:!!e(T.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const r=(0,E.__)("Welcome to Styles");return(0,l.createElement)(b.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:r,finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,l.createElement)(Cv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},r),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")))},{image:(0,l.createElement)(Cv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Set the design")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!")))},{image:(0,l.createElement)(Cv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Personalize blocks")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")))},{image:(0,l.createElement)(Cv,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Learn more")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("New to block themes and styling your site?")," ",(0,l.createElement)(b.ExternalLink,{href:(0,E.__)("https://wordpress.org/documentation/article/styles-overview/")},(0,E.__)("Here’s a detailed guide to learn how to make the most of it."))))}]})}function Pv(){const{toggle:e}=(0,m.useDispatch)(T.store),t=(0,m.useSelect)((e=>{const t=!!e(T.store).get("core/edit-site","welcomeGuidePage"),n=!!e(T.store).get("core/edit-site","welcomeGuide"),{isPage:r}=e(tr);return t&&!n&&r()}),[]);if(!t)return null;const n=(0,E.__)("Editing a page");return(0,l.createElement)(b.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:n,finishButtonText:(0,E.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("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 Iv(){const{toggle:e}=(0,m.useDispatch)(T.store),t=(0,m.useSelect)((e=>{const t=!!e(T.store).get("core/edit-site","welcomeGuideTemplate"),n=!!e(T.store).get("core/edit-site","welcomeGuide"),{isPage:r}=e(tr),{getCurrentPostType:a}=e(y.store);return t&&!n&&r()&&"wp_template"===a()}),[]);if(!t)return null;const n=(0,E.__)("Editing a template");return(0,l.createElement)(b.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:n,finishButtonText:(0,E.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("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 Mv(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(kv,null),(0,l.createElement)(Tv,null),(0,l.createElement)(Pv,null),(0,l.createElement)(Iv,null))}function Av(e){const{slug:t,patterns:n}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(tr),{getEntityRecord:r,getBlockPatterns:a}=e(ye.store),s=n();return{slug:r("postType",t(),s).slug,patterns:a()}}),[]),r=(0,m.useSelect)((e=>e(ye.store).getCurrentTheme().stylesheet));return(0,g.useMemo)((()=>[{name:"fallback",blocks:(0,u.parse)(e),title:(0,E.__)("Fallback content")},...n.filter((e=>Array.isArray(e.templateTypes)&&e.templateTypes.some((e=>t.startsWith(e))))).map((e=>({...e,blocks:(0,u.parse)(e.content).map((e=>function(e){return e.innerBlocks.find((e=>"core/template-part"===e.name))&&(e.innerBlocks=e.innerBlocks.map((e=>("core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=r),e)))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=r),e}(e)))})))]),[e,t,n])}function Ov({fallbackContent:e,onChoosePattern:t,postType:n}){const[,,r]=(0,ye.useEntityBlockEditor)("postType",n),a=Av(e),s=(0,ie.useAsyncList)(a);return(0,l.createElement)(fe.__experimentalBlockPatternsList,{blockPatterns:a,shownPatterns:s,onClickPattern:(e,n)=>{r(n,{selection:void 0}),t()}})}function Nv({slug:e,isCustom:t,onClose:n,postType:r}){const a=function(e,t=!1){return(0,m.useSelect)((n=>{const{getEntityRecord:r,getDefaultTemplateId:a}=n(ye.store),s=a({slug:e,is_custom:t,ignore_empty:!0});return s?r("postType",Ct,s)?.content?.raw:void 0}),[e,t])}(e,t);return a?(0,l.createElement)(b.Modal,{className:"edit-site-start-template-options__modal",title:(0,E.__)("Choose a pattern"),closeLabel:(0,E.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:n,isFullScreen:!0},(0,l.createElement)("div",{className:"edit-site-start-template-options__modal-content"},(0,l.createElement)(Ov,{fallbackContent:a,slug:e,isCustom:t,postType:r,onChoosePattern:()=>{n()}})),(0,l.createElement)(b.Flex,{className:"edit-site-start-template-options__modal__actions",justify:"flex-end",expanded:!1},(0,l.createElement)(b.FlexItem,null,(0,l.createElement)(b.Button,{variant:"tertiary",onClick:n},(0,E.__)("Skip"))))):null}const Fv={INITIAL:"INITIAL",CLOSED:"CLOSED"};function Rv(){const[e,t]=(0,g.useState)(Fv.INITIAL),{shouldOpenModal:n,slug:r,isCustom:a,postType:s}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(tr),r=t(),a=n(),{getEditedEntityRecord:s,hasEditsForEntityRecord:i}=e(ye.store),o=s("postType",r,a);return{shouldOpenModal:!i("postType",r,a)&&""===o.content&&Ct===r&&!e(T.store).get("core/edit-site","welcomeGuide"),slug:o.slug,isCustom:o.is_custom,postType:r}}),[]);return e===Fv.INITIAL&&!n||e===Fv.CLOSED?null:(0,l.createElement)(Nv,{slug:r,isCustom:a,postType:s,onClose:()=>t(Fv.CLOSED)})}const{useGlobalStylesOutput:Dv}=Xe(fe.privateApis);function Vv(){return function(){const[e,t]=Dv(),{getSettings:n}=(0,m.useSelect)(tr),{updateSettings:r}=(0,m.useDispatch)(tr);(0,g.useEffect)((()=>{var a;if(!e||!t)return;const s=n(),i=Object.values(null!==(a=s.styles)&&void 0!==a?a:[]).filter((e=>!e.isGlobalStyles));r({...s,styles:[...i,...e],__experimentalFeatures:t})}),[e,t,r,n])}(),null}const{useLocation:Lv}=Xe(gt.privateApis);const{ProgressBar:Bv,Theme:zv}=Xe(b.privateApis),{useGlobalStyle:Hv}=Xe(fe.privateApis);function Gv({id:e}){var t;const[n]=Hv("color.text"),[r]=Hv("color.background"),{highlightedColors:a}=$e(),s=null!==(t=a[0]?.color)&&void 0!==t?t:n,{elapsed:i,total:o}=(0,m.useSelect)((e=>{var t,n;const r=e(ye.store).countSelectorsByStatus(),a=null!==(t=r.resolving)&&void 0!==t?t:0,s=null!==(n=r.finished)&&void 0!==n?n:0;return{elapsed:s,total:s+a}}),[]);return(0,l.createElement)("div",{className:"edit-site-canvas-loader"},(0,l.createElement)(zv,{accent:s,background:r},(0,l.createElement)(Bv,{id:e,max:o,value:i})))}const{EditorCanvas:Uv}=Xe(y.privateApis);const Wv=function({enableResizing:e,settings:t,children:n,...r}){const{hasBlocks:a,isFocusMode:s,templateType:i,canvasMode:o,isZoomOutMode:c}=(0,m.useSelect)((e=>{const{getBlockCount:t,__unstableGetEditorMode:n}=e(fe.store),{getEditedPostType:r,getCanvasMode:a}=Xe(e(tr)),s=r();return{templateType:s,isFocusMode:Ft.includes(s),isZoomOutMode:"zoom-out"===n(),canvasMode:a(),hasBlocks:!!t()}}),[]),{setCanvasMode:u}=Xe((0,m.useDispatch)(tr)),[d,p]=(0,g.useState)(!1);(0,g.useEffect)((()=>{"edit"===o&&p(!1)}),[o]);const h={"aria-label":(0,E.__)("Editor Canvas"),role:"button",tabIndex:0,onFocus:()=>p(!0),onBlur:()=>p(!1),onKeyDown:e=>{const{keyCode:t}=e;t!==wr.ENTER&&t!==wr.SPACE||(e.preventDefault(),u("edit"))},onClick:()=>u("edit"),readonly:!0},f=i===xt,y=!(f&&s&&a||"view"===o)&&void 0,v=(0,g.useMemo)((()=>[...t.styles,{css:`.is-root-container{display:flow-root;${e?"min-height:0!important;":""}}body{position:relative; ${"view"===o?"cursor: pointer; min-height: 100vh;":""}}}`}]),[t.styles,e,o]);return(0,l.createElement)(Uv,{className:_()("edit-site-editor-canvas__block-list",{"is-navigation-block":f}),renderAppender:y,styles:v,iframeProps:{expand:c,scale:c?.45:void 0,frameSize:c?100:void 0,className:_()("edit-site-visual-editor__editor-canvas",{"is-focused":d&&"view"===o}),...r,..."view"===o?h:{}}},n)},{useHistory:jv}=Xe(gt.privateApis);const{useBlockEditorSettings:Zv}=Xe(y.privateApis),{useLocation:qv,useHistory:Yv}=Xe(gt.privateApis);function Kv(){const e=function(){const e=jv();return(0,g.useCallback)((t=>{e.push({...t,focusMode:!0,canvas:"edit"})}),[e])}(),{templateSlug:t,canvasMode:n,settings:r,postWithTemplate:a}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n,getEditedPostContext:r,getCanvasMode:a,getSettings:s}=Xe(e(tr)),{getEditedEntityRecord:i}=e(ye.store),o=i("postType",t(),n()),l=r();return{templateSlug:o.slug,canvasMode:a(),settings:s(),postWithTemplate:l?.postId}}),[]),s=function(e){const t=e?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);let n,r,a,s=!1;if(t)t[1]?n=t[2]?t[2]:t[1]:t[3]&&(n=t[6]?t[6]:t[4],r=t[7]),n="tag"===n?"post_tag":n;else{const t=e?.match(/^(author)$|^author-(.+)$/);t&&(s=!0,t[2]&&(a=t[2]))}return(0,m.useSelect)((e=>{const{getEntityRecords:t,getTaxonomy:i,getAuthors:o}=e(ye.store);let l,c;if(n&&(l=i(n)?.labels?.singular_name),r){const e=t("taxonomy",n,{slug:r,per_page:1});e&&e[0]&&(c=e[0].name)}if(s&&(l="Author",a)){const e=o({slug:a});e&&e[0]&&(c=e[0].name)}return{archiveTypeLabel:l,archiveNameLabel:c}}),[a,s,n,r])}(t),i=a?"template-locked":"post-only",o=function(){const e=qv(),t=(0,ie.usePrevious)(e),n=Yv();return(0,g.useMemo)((()=>{const r=e.params.focusMode||e.params.postId&&Ft.includes(e.params.postType),a="edit"===t?.params.canvas;return r&&a?()=>n.back():void 0}),[e,n])}();return(0,g.useMemo)((()=>({...r,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==n,defaultRenderingMode:i,onNavigateToEntityRecord:e,onNavigateToPreviousEntityRecord:o,__experimentalArchiveTitleTypeLabel:s.archiveTypeLabel,__experimentalArchiveTitleNameLabel:s.archiveNameLabel})),[r,n,i,e,o,s.archiveTypeLabel,s.archiveNameLabel])}const{useLocation:Xv}=Xe(gt.privateApis);function Jv(){const e=Xv(),{templateType:t,isFocusableEntity:n,isViewMode:r}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getCanvasMode:n}=Xe(e(tr)),r=t();return{templateType:r,isFocusableEntity:Ft.includes(r),isViewMode:"view"===n()}}),[]),a=e.params.focusMode||n,[s,i]=(0,ie.useResizeObserver)(),o=function(){const e=Kv(),{postType:t,postId:n}=(0,m.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=Xe(e(tr));return{postType:t(),postId:n()}}),[]);return Zv(e,t,n)}(),c=(0,ie.useViewportMatch)("small","<"),u=a&&!r&&!c&&t!==Ct,d=t===xt&&a;return(0,l.createElement)($r.Slot,null,(([e])=>e?(0,l.createElement)("div",{className:"edit-site-visual-editor is-focus-mode"},e):(0,l.createElement)("div",{className:_()("edit-site-visual-editor",{"is-focus-mode":a||!!e,"is-view-mode":r})},(0,l.createElement)(Zr,{enableResizing:u,height:i.height&&!d?i.height:"100%"},(0,l.createElement)(Wv,{enableResizing:u,settings:o},s)))))}function Qv({clientId:e,onClose:t}){const{getBlocks:n}=(0,m.useSelect)(fe.store),{replaceBlocks:r}=(0,m.useDispatch)(fe.store);return(0,m.useSelect)((t=>t(fe.store).canRemoveBlock(e)),[e])?(0,l.createElement)(b.MenuItem,{onClick:()=>{r(e,n(e)),t()}},(0,E.__)("Detach")):null}function $v({clientIds:e,blocks:t}){const[n,r]=(0,g.useState)(!1),{replaceBlocks:a}=(0,m.useDispatch)(fe.store),{createSuccessNotice:s}=(0,m.useDispatch)(ge.store),{canCreate:i}=(0,m.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(tr).getSettings();return{canCreate:!t}}),[]);if(!i)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{icon:Ks,onClick:()=>{r(!0)},"aria-expanded":n,"aria-haspopup":"dialog"},(0,E.__)("Create template part")),n&&(0,l.createElement)(ei,{closeModal:()=>{r(!1)},blocks:t,onCreate:async t=>{a(e,(0,u.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),s((0,E.__)("Template part created."),{type:"snackbar"})}}))}function e_(){return(0,l.createElement)(fe.BlockSettingsMenuControls,null,(({selectedClientIds:e,onClose:t})=>(0,l.createElement)(t_,{clientIds:e,onClose:t})))}function t_({clientIds:e,onClose:t}){const n=(0,m.useSelect)((t=>t(fe.store).getBlocksByClientId(e)),[e]);return 1===n.length&&"core/template-part"===n[0]?.name?(0,l.createElement)(Qv,{clientId:e[0],onClose:t}):(0,l.createElement)($v,{clientIds:e,blocks:n})}const{BlockRemovalWarningModal:n_}=Xe(fe.privateApis),{ExperimentalEditorProvider:r_,InserterSidebar:a_,ListViewSidebar:s_}=Xe(y.privateApis),i_={body:(0,E.__)("Editor content"),sidebar:(0,E.__)("Editor settings"),actions:(0,E.__)("Editor publish"),footer:(0,E.__)("Editor footer")},o_={"core/query":(0,E.__)("Query Loop displays a list of posts or pages."),"core/post-content":(0,E.__)("Post Content displays the content of a post or page."),"core/post-template":(0,E.__)("Post Template displays each post or page in a Query Loop."),"bindings/core/pattern-overrides":(0,E.__)("Blocks from synced patterns that can have overriden content.")};function l_({isLoading:e}){const{record:t,getTitle:n,isLoaded:r}=Ds(),{type:a}=t,s=(0,ie.useViewportMatch)("medium"),{context:i,contextPost:o,editorMode:c,canvasMode:u,blockEditorMode:d,isRightSidebarOpen:p,isInserterOpen:h,isListViewOpen:f,isDistractionFree:v,showIconLabels:w,showBlockBreadcrumbs:S,postTypeLabel:x}=(0,m.useSelect)((e=>{const{get:t}=e(T.store),{getEditedPostContext:n,getEditorMode:r,getCanvasMode:a}=Xe(e(tr)),{__unstableGetEditorMode:s}=e(fe.store),{getActiveComplementaryArea:i}=e(j),{getEntityRecord:o}=e(ye.store),{isInserterOpened:l,isListViewOpened:c,getPostTypeLabel:u}=e(y.store),d=n();return{context:d,contextPost:d?.postId?o("postType",d.postType,d.postId):void 0,editorMode:r(),canvasMode:a(),blockEditorMode:s(),isInserterOpen:l(),isListViewOpen:c(),isRightSidebarOpen:i(tr.name),isDistractionFree:t("core","distractionFree"),showBlockBreadcrumbs:t("core","showBlockBreadcrumbs"),showIconLabels:t("core","showIconLabels"),postTypeLabel:u()}}),[]),C="edit"===u,k="view"===u||"visual"===c,P=!v&&S&&C&&k&&"zoom-out"!==d,I=C&&k&&h,M=C&&k&&f,A=f?(0,E.__)("List View"):(0,E.__)("Block Library"),O=!!i?.postId;let N;var F;r&&(N=(0,E.sprintf)((0,E.__)("%1$s ‹ %2$s"),n(),null!==(F=Rt[a])&&void 0!==F?F:Rt[Ct]));!function(e){const t=Lv(),n=(0,m.useSelect)((e=>e(ye.store).getEntityRecord("root","site")?.title),[]),r=(0,g.useRef)(!0);(0,g.useEffect)((()=>{r.current=!1}),[t]),(0,g.useEffect)((()=>{if(!r.current&&e&&n){const t=(0,E.sprintf)((0,E.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,en.decodeEntities)(e),(0,en.decodeEntities)(n));document.title=t,(0,Jt.speak)(e,"assertive")}}),[e,n,t])}(r&&N);const R=(0,ie.useInstanceId)(Gv,"edit-site-editor__loading-progress"),D=Kv(),V=!e&&(O&&!!o&&!!t||!O&&!!t);return(0,l.createElement)(l.Fragment,null,V?null:(0,l.createElement)(Gv,{id:R}),C&&(0,l.createElement)(Mv,null),r&&!t&&(0,l.createElement)(b.Notice,{status:"warning",isDismissible:!1},(0,E.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")),V&&(0,l.createElement)(r_,{post:O?o:t,__unstableTemplate:O?t:void 0,settings:D,useSubRegistry:!1},(0,l.createElement)(Ev,null),C&&(0,l.createElement)(Rv,null),(0,l.createElement)(ce,{isDistractionFree:v,enableRegionNavigation:!1,className:_()("edit-site-editor__interface-skeleton",{"show-icon-labels":w}),notices:(0,l.createElement)(y.EditorSnackbars,null),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Vv,null),C&&(0,l.createElement)(y.EditorNotices,null),k&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e_,null),(0,l.createElement)(_v,null,(0,l.createElement)(fe.BlockInspector,null)),!s&&(0,l.createElement)(fe.BlockToolbar,{hideDragHandle:!0}),(0,l.createElement)(Jv,null),(0,l.createElement)(n_,{rules:o_}),(0,l.createElement)(Ju,null)),"text"===c&&C&&(0,l.createElement)(Sv,null),C&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(xv,null),(0,l.createElement)(y.EditorKeyboardShortcutsRegister,null),(0,l.createElement)(y.EditorKeyboardShortcuts,null))),secondarySidebar:C&&(I&&(0,l.createElement)(a_,null)||M&&(0,l.createElement)(s_,null)),sidebar:!v&&C&&p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(se.Slot,{scope:"core/edit-site"})),footer:P&&(0,l.createElement)(fe.BlockBreadcrumb,{rootLabelText:x}),labels:{...i_,secondarySidebar:A}})))}const c_=(0,g.memo)((function({view:e,onChangeView:t,paginationInfo:{totalItems:n=0,totalPages:r}}){return n&&r?!!n&&1!==r&&(0,l.createElement)(b.__experimentalHStack,{expanded:!1,spacing:6,justify:"end",className:"dataviews-pagination"},(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2,className:"dataviews-pagination__page-selection"},(0,g.createInterpolateElement)((0,E.sprintf)((0,E._x)("Page of %s","paging"),r),{CurrentPageControl:(0,l.createElement)(b.SelectControl,{"aria-label":(0,E.__)("Current page"),value:e.page,options:Array.from(Array(r)).map(((e,t)=>{const n=t+1;return{value:n,label:n}})),onChange:n=>{t({...e,page:+n})},size:"compact",__nextHasNoMarginBottom:!0})})),(0,l.createElement)(b.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(b.Button,{onClick:()=>t({...e,page:e.page-1}),disabled:1===e.page,__experimentalIsFocusable:!0,label:(0,E.__)("Previous page"),icon:dr,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,l.createElement)(b.Button,{onClick:()=>t({...e,page:e.page+1}),disabled:e.page>=r,__experimentalIsFocusable:!0,label:(0,E.__)("Next page"),icon:ur,showTooltip:!0,size:"compact",tooltipPosition:"top"}))):null})),u_=c_,{DropdownMenuV2:d_,DropdownMenuGroupV2:m_,DropdownMenuItemV2:p_,DropdownMenuRadioItemV2:h_,DropdownMenuCheckboxItemV2:f_,DropdownMenuItemLabelV2:g_}=Vo(b.privateApis);function y_({view:e,onChangeView:t,supportedLayouts:n}){let r=Pl;if(n&&(r=r.filter((e=>n.includes(e.type)))),1===r.length)return null;const a=r.find((t=>e.type===t.type));return(0,l.createElement)(d_,{trigger:(0,l.createElement)(p_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},a.label)},(0,l.createElement)(g_,null,(0,E.__)("Layout")))},r.map((n=>(0,l.createElement)(h_,{key:n.type,value:n.type,name:"view-actions-available-view",checked:n.type===e.type,hideOnClick:!0,onChange:n=>{t({...e,type:n.target.value})}},(0,l.createElement)(g_,null,n.label)))))}const v_=[10,20,50,100];function __({view:e,onChangeView:t}){return(0,l.createElement)(d_,{trigger:(0,l.createElement)(p_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},e.perPage)},(0,l.createElement)(g_,null,(0,E.__)("Items per page")))},v_.map((n=>(0,l.createElement)(h_,{key:n,value:n,name:"view-actions-page-size",checked:e.perPage===n,onChange:()=>{t({...e,perPage:n,page:1})}},(0,l.createElement)(g_,null,n)))))}function b_({view:e,onChangeView:t,fields:n}){const r=n.filter((t=>!1!==t.enableHiding&&t.id!==e.layout.mediaField));return r?.length?(0,l.createElement)(d_,{trigger:(0,l.createElement)(p_,null,(0,l.createElement)(g_,null,(0,E.__)("Fields")))},r?.map((n=>(0,l.createElement)(f_,{key:n.id,value:n.id,checked:!e.hiddenFields?.includes(n.id),onChange:()=>{t({...e,hiddenFields:e.hiddenFields?.includes(n.id)?e.hiddenFields.filter((e=>e!==n.id)):[...e.hiddenFields||[],n.id]})}},(0,l.createElement)(g_,null,n.header))))):null}function E_({fields:e,view:t,onChangeView:n}){const r=e.filter((e=>!1!==e.enableSorting));if(!r?.length)return null;const a=e.find((e=>e.id===t.sort?.field));return(0,l.createElement)(d_,{trigger:(0,l.createElement)(p_,{suffix:(0,l.createElement)("span",{"aria-hidden":"true"},a?.header)},(0,l.createElement)(g_,null,(0,E.__)("Sort by")))},r?.map((e=>{const r=t.sort?.direction;return(0,l.createElement)(d_,{key:e.id,trigger:(0,l.createElement)(p_,null,(0,l.createElement)(g_,null,e.header)),style:{minWidth:"220px"}},Object.entries(Cl).map((([s,i])=>{const o=void 0!==a&&r===s&&e.id===a.id,c=`${e.id}-${s}`;return(0,l.createElement)(h_,{key:c,name:"view-actions-sorting",value:c,checked:o,onChange:()=>{n({...t,sort:{field:e.id,direction:s}})}},(0,l.createElement)(g_,null,i.label))})))})))}const w_=(0,g.memo)((function({fields:e,view:t,onChangeView:n,supportedLayouts:r}){return(0,l.createElement)(d_,{trigger:(0,l.createElement)(b.Button,{size:"compact",icon:nm,label:(0,E.__)("View options")})},(0,l.createElement)(m_,null,(0,l.createElement)(y_,{view:t,onChangeView:n,supportedLayouts:r}),(0,l.createElement)(E_,{fields:e,view:t,onChangeView:n}),(0,l.createElement)(b_,{fields:e,view:t,onChangeView:n}),(0,l.createElement)(__,{view:t,onChangeView:n})))}));var S_=Object.defineProperty,x_=Object.defineProperties,C_=Object.getOwnPropertyDescriptors,k_=Object.getOwnPropertySymbols,T_=Object.prototype.hasOwnProperty,P_=Object.prototype.propertyIsEnumerable,I_=(e,t,n)=>t in e?S_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M_=(e,t)=>{for(var n in t||(t={}))T_.call(t,n)&&I_(e,n,t[n]);if(k_)for(var n of k_(t))P_.call(t,n)&&I_(e,n,t[n]);return e},A_=(e,t)=>x_(e,C_(t)),O_=(e,t)=>{var n={};for(var r in e)T_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&k_)for(var r of k_(e))t.indexOf(r)<0&&P_.call(e,r)&&(n[r]=e[r]);return n},N_=Object.defineProperty,F_=Object.defineProperties,R_=Object.getOwnPropertyDescriptors,D_=Object.getOwnPropertySymbols,V_=Object.prototype.hasOwnProperty,L_=Object.prototype.propertyIsEnumerable,B_=(e,t,n)=>t in e?N_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z_=(e,t)=>{for(var n in t||(t={}))V_.call(t,n)&&B_(e,n,t[n]);if(D_)for(var n of D_(t))L_.call(t,n)&&B_(e,n,t[n]);return e},H_=(e,t)=>F_(e,R_(t)),G_=(e,t)=>{var n={};for(var r in e)V_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&D_)for(var r of D_(e))t.indexOf(r)<0&&L_.call(e,r)&&(n[r]=e[r]);return n};function U_(...e){}function W_(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function j_(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function Z_(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function q_(e){return e}function Y_(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function K_(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function X_(...e){for(const t of e)if(void 0!==t)return t}function J_(e){return function(e){return!!e&&!!(0,l.isValidElement)(e)&&"ref"in e}(e)?e.ref:null}var Q_,$_="undefined"!=typeof window&&!!(null==(Q_=window.document)?void 0:Q_.createElement);function eb(e){return e?e.ownerDocument||e:document}function tb(e,t=!1){const{activeElement:n}=eb(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return tb(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=eb(n).getElementById(e);if(t)return t}}return n}function nb(e,t){return e===t||e.contains(t)}function rb(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==ab.indexOf(e.type)}var ab=["button","color","file","image","reset","submit"];function sb(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function ib(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}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 lb(e,t){var n;const r=ob(e);if(!r)return t;return null!=(n={menu:"menuitem",listbox:"option",tree:"treeitem",grid:"gridcell"}[r])?n:t}function cb(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 cb(e.parentElement)||document.scrollingElement||document.body}function ub(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function db(){return $_&&!!navigator.maxTouchPoints}function mb(){return!!$_&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function pb(){return $_&&mb()&&/apple/i.test(navigator.vendor)}function hb(e){return Boolean(e.currentTarget&&!nb(e.currentTarget,e.target))}function fb(e){return e.target===e.currentTarget}function gb(e,t){const n=new FocusEvent("blur",t),r=e.dispatchEvent(n),a=H_(z_({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",a)),r}function yb(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function vb(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!nb(n,r)}function _b(e,t,n){const r=requestAnimationFrame((()=>{e.removeEventListener(t,a,!0),n()})),a=()=>{cancelAnimationFrame(r),n()};return e.addEventListener(t,a,{once:!0,capture:!0}),r}function bb(e,t,n,r=window){const a=[];try{r.document.addEventListener(e,t,n);for(const s of Array.from(r.frames))a.push(bb(e,t,n,s))}catch(e){}return()=>{try{r.document.removeEventListener(e,t,n)}catch(e){}a.forEach((e=>e()))}}var Eb=M_({},c),wb=Eb.useId,Sb=(Eb.useDeferredValue,Eb.useInsertionEffect),xb=$_?l.useLayoutEffect:l.useEffect;function Cb(e){const t=(0,l.useRef)(e);return xb((()=>{t.current=e})),t}function kb(e){const t=(0,l.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return Sb?Sb((()=>{t.current=e})):t.current=e,(0,l.useCallback)(((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}function Tb(...e){return(0,l.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 Pb(e){if(wb){const t=wb();return e||t}const[t,n]=(0,l.useState)(e);return xb((()=>{if(e||t)return;const r=Math.random().toString(36).substr(2,6);n(`id-${r}`)}),[e,t]),e||t}function Ib(e,t){const n=e=>{if("string"==typeof e)return e},[r,a]=(0,l.useState)((()=>n(t)));return xb((()=>{const r=e&&"current"in e?e.current:e;a((null==r?void 0:r.tagName.toLowerCase())||n(t))}),[e,t]),r}function Mb(e,t){const n=(0,l.useRef)(!1);(0,l.useEffect)((()=>{if(n.current)return e();n.current=!0}),t),(0,l.useEffect)((()=>()=>{n.current=!1}),[])}Symbol("setNextState");function Ab(e){return kb("function"==typeof e?e:()=>e)}function Ob(e,t,n=[]){const r=(0,l.useCallback)((n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n))),[...n,e.wrapElement]);return A_(M_({},e),{wrapElement:r})}var Nb=!1,Fb=0,Rb=0;function Db(e){(function(e){const t=e.movementX||e.screenX-Fb,n=e.movementY||e.screenY-Rb;return Fb=e.screenX,Rb=e.screenY,t||n||!1})(e)&&(Nb=!0)}function Vb(){Nb=!1}function Lb(e,t){const n=e.__unstableInternals;return Y_(n,"Invalid store"),n[t]}function Bb(e,...t){let n=e,r=n,a=Symbol(),s=U_;const i=new Set,o=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,m=new WeakMap,p=(e,t,n=c)=>(n.add(t),m.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),m.delete(t),n.delete(t)}),h=(e,s,i=!1)=>{if(!W_(n,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}(s,n[e]);if(l===n[e])return;i||t.forEach((t=>{var n;null==(n=null==t?void 0:t.setState)||n.call(t,e,l)}));const p=n;n=H_(z_({},n),{[e]:l});const h=Symbol();a=h,o.add(e);const f=(t,r,a)=>{var s;const i=m.get(t);i&&!i.some((t=>a?a.has(t):t===e))||(null==(s=d.get(t))||s(),d.set(t,t(n,r)))};c.forEach((e=>{f(e,p)})),queueMicrotask((()=>{if(a!==h)return;const e=n;u.forEach((e=>{f(e,r,o)})),r=e,o.clear()}))},f={getState:()=>n,setState:h,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=i.size,r=Symbol();i.add(r);const a=()=>{i.delete(r),i.size||s()};if(e)return a;const o=(c=n,Object.keys(c)).map((e=>j_(...t.map((t=>{var n;const r=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(r&&W_(r,e))return Ub(t,[e],(t=>{h(e,t[e],!0)}))})))));var c;const u=[];l.forEach((e=>u.push(e())));const d=t.map(Hb);return s=j_(...o,...u,...d),a},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,r)),p(e,t,u)),pick:e=>Bb(function(e,t){const n={};for(const r of t)W_(e,r)&&(n[r]=e[r]);return n}(n,e),f),omit:e=>Bb(function(e,t){const n=z_({},e);for(const e of t)W_(n,e)&&delete n[e];return n}(n,e),f)}};return f}function zb(e,...t){if(e)return Lb(e,"setup")(...t)}function Hb(e,...t){if(e)return Lb(e,"init")(...t)}function Gb(e,...t){if(e)return Lb(e,"subscribe")(...t)}function Ub(e,...t){if(e)return Lb(e,"sync")(...t)}function Wb(e,...t){if(e)return Lb(e,"batch")(...t)}function jb(e,...t){if(e)return Lb(e,"omit")(...t)}function Zb(...e){const t=e.reduce(((e,t)=>{var n;const r=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);return r?z_(z_({},e),r):e}),{});return Bb(t,...e)}var qb=a(422),{useSyncExternalStore:Yb}=qb,Kb=()=>()=>{};function Xb(e,t=q_){const n=l.useCallback((t=>e?Gb(e,null,t):Kb()),[e]),r=()=>{const n="string"==typeof t?t:null,r="function"==typeof t?t:null,a=null==e?void 0:e.getState();return r?r(a):a&&n&&W_(a,n)?a[n]:void 0};return Yb(n,r,r)}function Jb(e,t,n,r){const a=W_(t,n)?t[n]:void 0,s=r?t[r]:void 0,i=Cb({value:a,setValue:s});xb((()=>Ub(e,[n],((e,t)=>{const{value:r,setValue:a}=i.current;a&&e[n]!==t[n]&&e[n]!==r&&a(e[n])}))),[e,n]),xb((()=>{if(void 0!==a)return e.setState(n,a),Wb(e,[n],(()=>{void 0!==a&&e.setState(n,a)}))}))}function Qb(e,t,n){return Mb(t,[n.store]),Jb(e,n,"items","setItems"),e}function $b(e,t,n){return Jb(e=Qb(e,t,n),n,"activeId","setActiveId"),Jb(e,n,"includesBaseElement"),Jb(e,n,"virtualFocus"),Jb(e,n,"orientation"),Jb(e,n,"rtl"),Jb(e,n,"focusLoop"),Jb(e,n,"focusWrap"),Jb(e,n,"focusShift"),e}function eE(e,t,n){return Mb(t,[n.store,n.disclosure]),Jb(e,n,"open","setOpen"),Jb(e,n,"mounted","setMounted"),Jb(e,n,"animated"),e}function tE(e,t,n){return eE(e,t,n)}function nE(e,t,n){return Mb(t,[n.popover]),Jb(e=tE(e,t,n),n,"placement"),e}function rE(e={}){return function(e={}){const t=Zb(e.store,jb(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),r=X_(e.open,null==n?void 0:n.open,e.defaultOpen,!1),a=X_(e.animated,null==n?void 0:n.animated,!1),s=Bb({open:r,animated:a,animating:!!a&&r,mounted:r,contentElement:X_(null==n?void 0:n.contentElement,null),disclosureElement:X_(null==n?void 0:n.disclosureElement,null)},t);return zb(s,(()=>Ub(s,["animated","animating"],(e=>{e.animated||s.setState("animating",!1)})))),zb(s,(()=>Gb(s,["open"],(()=>{s.getState().animated&&s.setState("animating",!0)})))),zb(s,(()=>Ub(s,["open","animating"],(e=>{s.setState("mounted",e.open||e.animating)})))),H_(z_({},s),{setOpen:e=>s.setState("open",e),show:()=>s.setState("open",!0),hide:()=>s.setState("open",!1),toggle:()=>s.setState("open",(e=>!e)),stopAnimation:()=>s.setState("animating",!1),setContentElement:e=>s.setState("contentElement",e),setDisclosureElement:e=>s.setState("disclosureElement",e)})}(e)}function aE(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,a])=>{const s=t.element,i=a.element;return s===i?0:s&&i?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(s,i)?(e>r&&(n=!0),-1):(et)):e}function sE(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),r=X_(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(r.map((e=>[e.id,e]))),s={items:r,renderedItems:X_(null==n?void 0:n.renderedItems,[])},i=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),o=Bb({items:r,renderedItems:s.renderedItems},i),l=Bb(s,e.store),c=e=>{const t=aE(e);o.setState("renderedItems",t),l.setState("renderedItems",t)};zb(l,(()=>Hb(o))),zb(o,(()=>Wb(o,["items"],(e=>{l.setState("items",e.items)})))),zb(o,(()=>Wb(o,["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 r=function(e){var t;const n=e.find((e=>!!e.element)),r=[...e].reverse().find((e=>!!e.element));let a=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;a&&(null==r?void 0:r.element);){if(r&&a.contains(r.element))return a;a=a.parentElement}return eb(a).body}(e.renderedItems),a=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:r});for(const t of e.renderedItems)t.element&&a.observe(t.element);return()=>{cancelAnimationFrame(n),a.disconnect()}}))));const u=(e,t,n=!1)=>{let r;t((t=>{const n=t.findIndex((({id:t})=>t===e.id)),s=t.slice();if(-1!==n){r=t[n];const i=z_(z_({},r),e);s[n]=i,a.set(e.id,i)}else s.push(e),a.set(e.id,e);return s}));return()=>{t((t=>{if(!r)return n&&a.delete(e.id),t.filter((({id:t})=>t!==e.id));const s=t.findIndex((({id:t})=>t===e.id));if(-1===s)return t;const i=t.slice();return i[s]=r,a.set(e.id,r),i}))}},d=e=>u(e,(e=>o.setState("items",e)),!0);return H_(z_({},l),{registerItem:d,renderItem:e=>j_(d(e),u(e,(e=>o.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){const{items:n}=l.getState();t=n.find((t=>t.id===e)),t&&a.set(e,t)}return t||null},__unstablePrivateStore:o})}function iE(e){const t=[];for(const n of e)t.push(...n);return t}function oE(e){return e.slice().reverse()}var lE={id:null};function cE(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function uE(e,t){return e.filter((e=>e.rowId===t))}function dE(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 mE(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function pE(e,t,n){const r=mE(e);for(const a of e)for(let e=0;eUb(s,["renderedItems","activeId"],(e=>{s.setState("activeId",(t=>{var n;return void 0!==t?t:null==(n=cE(e.renderedItems))?void 0:n.id}))}))));const i=(e,t,n,r)=>{var a,i;const{activeId:o,rtl:l,focusLoop:c,focusWrap:u,includesBaseElement:d}=s.getState(),m=l&&"vertical"!==t?oE(e):e;if(null==o)return null==(a=cE(m))?void 0:a.id;const p=m.find((e=>e.id===o));if(!p)return null==(i=cE(m))?void 0:i.id;const h=!!p.rowId,f=m.indexOf(p),g=m.slice(f+1),y=uE(g,p.rowId);if(void 0!==r){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(y,o),t=e.slice(r)[0]||e[e.length-1];return null==t?void 0:t.id}const v=function(e){return"vertical"===e?"horizontal":"horizontal"===e?"vertical":void 0}(h?t||"horizontal":t),_=c&&c!==v,b=h&&u&&u!==v;if(n=n||!h&&_&&d,_){const e=function(e,t,n=!1){const r=e.findIndex((e=>e.id===t));return[...e.slice(r+1),...n?[lE]:[],...e.slice(0,r)]}(b&&!n?m:uE(m,p.rowId),o,n),t=cE(e,o);return null==t?void 0:t.id}if(b){const e=cE(n?y:g,o);return n?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const E=cE(y,o);return!E&&n?null:null==E?void 0:E.id};return H_(z_(z_({},r),s),{setBaseElement:e=>s.setState("baseElement",e),setActiveId:e=>s.setState("activeId",e),move:e=>{void 0!==e&&(s.setState("activeId",e),s.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=cE(s.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=cE(oE(s.getState().renderedItems)))?void 0:e.id},next:e=>{const{renderedItems:t,orientation:n}=s.getState();return i(t,n,!1,e)},previous:e=>{var t;const{renderedItems:n,orientation:r,includesBaseElement:a}=s.getState(),o=!!!(null==(t=cE(n))?void 0:t.rowId)&&a;return i(oE(n),r,o,e)},down:e=>{const{activeId:t,renderedItems:n,focusShift:r,focusLoop:a,includesBaseElement:o}=s.getState(),l=r&&!e,c=hE(iE(pE(dE(n),t,l)));return i(c,"vertical",a&&"horizontal"!==a&&o,e)},up:e=>{const{activeId:t,renderedItems:n,focusShift:r,includesBaseElement:a}=s.getState(),o=r&&!e,l=hE(oE(iE(pE(dE(n),t,o))));return i(l,"vertical",a,e)}})}var gE=pb()&&db();function yE(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),r=X_(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId,null),a=fE(H_(z_({},e),{activeId:r,includesBaseElement:X_(e.includesBaseElement,null==n?void 0:n.includesBaseElement,!0),orientation:X_(e.orientation,null==n?void 0:n.orientation,"vertical"),focusLoop:X_(e.focusLoop,null==n?void 0:n.focusLoop,!0),focusWrap:X_(e.focusWrap,null==n?void 0:n.focusWrap,!0),virtualFocus:X_(e.virtualFocus,null==n?void 0:n.virtualFocus,!gE)})),s=function(e={}){var t=e,{popover:n}=t,r=G_(t,["popover"]);const a=Zb(r.store,jb(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),s=null==a?void 0:a.getState(),i=rE(H_(z_({},r),{store:a})),o=X_(r.placement,null==s?void 0:s.placement,"bottom"),l=Bb(H_(z_({},i.getState()),{placement:o,currentPlacement:o,anchorElement:X_(null==s?void 0:s.anchorElement,null),popoverElement:X_(null==s?void 0:s.popoverElement,null),arrowElement:X_(null==s?void 0:s.arrowElement,null),rendered:Symbol("rendered")}),i,a);return H_(z_(z_({},i),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"))})}(H_(z_({},e),{placement:X_(e.placement,null==n?void 0:n.placement,"bottom-start")})),i=X_(e.value,null==n?void 0:n.value,e.defaultValue,""),o=X_(e.selectedValue,null==n?void 0:n.selectedValue,e.defaultSelectedValue,""),l=Array.isArray(o),c=Bb(H_(z_(z_({},a.getState()),s.getState()),{value:i,selectedValue:o,resetValueOnSelect:X_(e.resetValueOnSelect,null==n?void 0:n.resetValueOnSelect,l),resetValueOnHide:X_(e.resetValueOnHide,null==n?void 0:n.resetValueOnHide,l),activeValue:null==n?void 0:n.activeValue}),a,s,e.store);return zb(c,(()=>Ub(c,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||c.setState("value",i))})))),zb(c,(()=>Ub(c,["resetValueOnSelect","selectedValue"],(e=>{e.resetValueOnSelect&&c.setState("value",i)})))),zb(c,(()=>Wb(c,["mounted"],(e=>{e.mounted||(c.setState("activeId",r),c.setState("moves",0))})))),zb(c,(()=>Ub(c,["moves","activeId"],((e,t)=>{e.moves===t.moves&&c.setState("activeValue",void 0)})))),zb(c,(()=>Wb(c,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=c.getState(),r=a.item(n);c.setState("activeValue",null==r?void 0:r.value)})))),H_(z_(z_(z_({},s),a),c),{setValue:e=>c.setState("value",e),setSelectedValue:e=>c.setState("selectedValue",e)})}function vE(e={}){const[t,n]=function(e,t){const[n,r]=l.useState((()=>e(t)));xb((()=>Hb(n)),[n]);const a=l.useCallback((e=>Xb(n,e)),[n]);return[l.useMemo((()=>A_(M_({},n),{useState:a})),[n,a]),kb((()=>{r((n=>e(M_(M_({},t),n.getState()))))}))]}(yE,e);return function(e,t,n){return Jb(e=$b(e=nE(e,t,n),t,n),n,"value","setValue"),Jb(e,n,"selectedValue","setSelectedValue"),Jb(e,n,"resetValueOnHide"),Jb(e,n,"resetValueOnSelect"),e}(t,n,e)}var _E=a(4922);function bE(e){return l.forwardRef(((t,n)=>e(M_({ref:n},t))))}function EE(e){const t=bE(e);return l.memo(t)}function wE(e,t){const n=t,{as:r,wrapElement:a,render:s}=n,i=O_(n,["as","wrapElement","render"]);let o;const c=Tb(t.ref,J_(s));if(r&&"string"!=typeof r)o=(0,_E.jsx)(r,A_(M_({},i),{render:s}));else if(l.isValidElement(s)){const e=A_(M_({},s.props),{ref:c});o=l.cloneElement(s,function(e,t){const n=M_({},e);for(const r in t){if(!W_(t,r))continue;if("className"===r){const r="className";n[r]=e[r]?`${e[r]} ${t[r]}`:t[r];continue}if("style"===r){const r="style";n[r]=e[r]?M_(M_({},e[r]),t[r]):t[r];continue}const a=t[r];if("function"==typeof a&&r.startsWith("on")){const t=e[r];if("function"==typeof t){n[r]=(...e)=>{a(...e),t(...e)};continue}}n[r]=a}return n}(i,e))}else if(s)o=s(i);else if("function"==typeof t.children){0;const e=i,{children:n}=e,r=O_(e,["children"]);o=t.children(r)}else o=r?(0,_E.jsx)(r,M_({},i)):(0,_E.jsx)(e,M_({},i));return a?a(o):o}function SE(e){return(t={})=>{const n=e(t),r={};for(const e in n)W_(n,e)&&void 0!==n[e]&&(r[e]=n[e]);return r}}function xE(e=[],t=[]){const n=l.createContext(void 0),r=l.createContext(void 0),a=()=>l.useContext(n),s=t=>e.reduceRight(((e,n)=>(0,_E.jsx)(n,A_(M_({},t),{children:e}))),(0,_E.jsx)(n.Provider,M_({},t)));return{context:n,scopedContext:r,useContext:a,useScopedContext:(e=!1)=>{const t=l.useContext(r),n=a();return e?t:t||n},useProviderContext:()=>{const e=l.useContext(r),t=a();if(!e||e!==t)return t},ContextProvider:s,ScopedContextProvider:e=>(0,_E.jsx)(s,A_(M_({},e),{children:t.reduceRight(((t,n)=>(0,_E.jsx)(n,A_(M_({},e),{children:t}))),(0,_E.jsx)(r.Provider,M_({},e)))}))}}var CE=xE(),kE=CE.useContext,TE=(CE.useScopedContext,CE.useProviderContext,xE([CE.ContextProvider],[CE.ScopedContextProvider])),PE=TE.useContext,IE=(TE.useScopedContext,TE.useProviderContext),ME=TE.ContextProvider,AE=TE.ScopedContextProvider,OE=(0,l.createContext)(void 0),NE=(0,l.createContext)(void 0),FE=xE(),RE=(FE.useContext,FE.useScopedContext,FE.useProviderContext),DE=xE([FE.ContextProvider],[FE.ScopedContextProvider]),VE=(DE.useContext,DE.useScopedContext,DE.useProviderContext,DE.ContextProvider),LE=DE.ScopedContextProvider,BE=((0,l.createContext)(void 0),(0,l.createContext)(void 0),xE([VE],[LE])),zE=(BE.useContext,BE.useScopedContext,BE.useProviderContext),HE=BE.ContextProvider,GE=BE.ScopedContextProvider,UE=xE([HE,ME],[GE,AE]),WE=(UE.useContext,UE.useScopedContext),jE=UE.useProviderContext,ZE=UE.ContextProvider,qE=UE.ScopedContextProvider,YE=(0,l.createContext)(void 0),KE=(0,l.createContext)(!1);function XE(e={}){const t=vE(e);return(0,_E.jsx)(ZE,{value:t,children:e.children})}var JE=SE((e=>{var t=e,{store:n}=t,r=O_(t,["store"]);const a=jE();Y_(n=n||a,!1);const s=n.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return r=M_({htmlFor:s},r)})),QE=EE((e=>wE("label",JE(e))));var $E=SE((e=>{var t=e,{store:n}=t,r=O_(t,["store"]);const a=zE();return n=n||a,r=A_(M_({},r),{ref:Tb(null==n?void 0:n.setAnchorElement,r.ref)})}));bE((e=>wE("div",$E(e))));function ew(e,t){return t&&e.item(t)||null}var tw=Symbol("FOCUS_SILENTLY");function nw(e,t,n){if(!t)return!1;if(t===n)return!1;const r=e.item(t.id);return!!r&&(!n||r.element!==n)}var rw=(0,l.createContext)(!0),aw="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 sw(e){return!!sb(e,aw)&&(!!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(sb(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}(e,"[inert]"))}function iw(e){const t=tb(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function ow(e){const t=tb(e);if(!t)return!1;if(nb(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&("id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`)))}var lw=pb(),cw=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"];function uw(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function dw(e,t,n,r,a){return e?t?n&&!r?-1:void 0:n?a:a||0:a}function mw(e,t){return kb((n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}))}var pw=!0;function hw(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(pw=!1))}function fw(e){e.metaKey||e.ctrlKey||e.altKey||(pw=!0)}var gw=SE((e=>{var t=e,{focusable:n=!0,accessibleWhenDisabled:r,autoFocus:a,onFocusVisible:s}=t,i=O_(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const o=(0,l.useRef)(null);(0,l.useEffect)((()=>{n&&(bb("mousedown",hw,!0),bb("keydown",fw,!0))}),[n]),lw&&(0,l.useEffect)((()=>{if(!n)return;const e=o.current;if(!e)return;if(!uw(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const r=()=>queueMicrotask((()=>e.focus()));return t.forEach((e=>e.addEventListener("mouseup",r))),()=>{t.forEach((e=>e.removeEventListener("mouseup",r)))}}),[n]);const c=n&&K_(i),u=!!c&&!r,[d,m]=(0,l.useState)(!1);(0,l.useEffect)((()=>{n&&u&&d&&m(!1)}),[n,u,d]),(0,l.useEffect)((()=>{if(!n)return;if(!d)return;const e=o.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{sw(e)||m(!1)}));return t.observe(e),()=>t.disconnect()}),[n,d]);const p=mw(i.onKeyPressCapture,c),h=mw(i.onMouseDownCapture,c),f=mw(i.onClickCapture,c),g=i.onMouseDown,y=kb((e=>{if(null==g||g(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!lw)return;if(hb(e))return;if(!rb(t)&&!uw(t))return;let r=!1;const a=()=>{r=!0};t.addEventListener("focusin",a,{capture:!0,once:!0}),_b(t,"mouseup",(()=>{t.removeEventListener("focusin",a,!0),r||function(e){!ow(e)&&sw(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const r=e.currentTarget;r&&iw(r)&&(null==s||s(e),e.defaultPrevented||m(!0))},_=i.onKeyDownCapture,b=kb((e=>{if(null==_||_(e),e.defaultPrevented)return;if(!n)return;if(d)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!fb(e))return;const t=e.currentTarget;queueMicrotask((()=>v(e,t)))})),E=i.onFocusCapture,w=kb((e=>{if(null==E||E(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return void m(!1);const t=e.currentTarget,r=()=>v(e,t);pw||function(e){const{tagName:t,readOnly:n,type:r}=e;return"TEXTAREA"===t&&!n||"SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable:cw.includes(r))}(e.target)?queueMicrotask(r):!function(e){return"combobox"===e.getAttribute("role")&&!!e.dataset.name}(e.target)?m(!1):_b(e.target,"focusout",r)})),S=i.onBlur,x=kb((e=>{null==S||S(e),n&&vb(e)&&m(!1)})),C=(0,l.useContext)(rw),k=kb((e=>{n&&a&&e&&C&&queueMicrotask((()=>{iw(e)||sw(e)&&e.focus()}))})),T=Ib(o,i.as),P=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(T),I=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(T),M=u?M_({pointerEvents:"none"},i.style):i.style;return i=A_(M_({"data-focus-visible":n&&d?"":void 0,"data-autofocus":!!a||void 0,"aria-disabled":!!c||void 0},i),{ref:Tb(o,k,i.ref),style:M,tabIndex:dw(n,u,P,I,i.tabIndex),disabled:!(!I||!u)||void 0,contentEditable:c?void 0:i.contentEditable,onKeyPressCapture:p,onClickCapture:f,onMouseDownCapture:h,onMouseDown:y,onKeyDownCapture:b,onFocusCapture:w,onBlur:x})}));bE((e=>wE("div",e=gw(e))));function yw(e,t,n){return kb((r=>{var a;if(null==t||t(r),r.defaultPrevented)return;if(r.isPropagationStopped())return;if(!fb(r))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(r))return;if(function(e){const t=e.target;return!(t&&!ib(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(r))return;const s=e.getState(),i=null==(a=ew(e,s.activeId))?void 0:a.element;if(!i)return;const o=r,{view:l}=o,c=O_(o,["view"]);i!==(null==n?void 0:n.current)&&i.focus(),function(e,t,n){const r=new KeyboardEvent(t,n);return e.dispatchEvent(r)}(i,r.type,c)||r.preventDefault(),r.currentTarget.contains(i)&&r.stopPropagation()}))}var vw=SE((e=>{var t=e,{store:n,composite:r=!0,focusOnMove:a=r,moveOnKeyPress:s=!0}=t,i=O_(t,["store","composite","focusOnMove","moveOnKeyPress"]);const o=IE();Y_(n=n||o,!1);const c=(0,l.useRef)(null),u=function(e){const[t,n]=(0,l.useState)(!1),r=(0,l.useCallback)((()=>n(!0)),[]),a=e.useState((t=>ew(e,t.activeId)));return(0,l.useEffect)((()=>{const e=null==a?void 0:a.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))}),[a,t]),r}(n),d=n.useState("moves");(0,l.useEffect)((()=>{var e;if(!n)return;if(!d)return;if(!r)return;if(!a)return;const{activeId:t}=n.getState(),s=null==(e=ew(n,t))?void 0:e.element;var i,o;s&&("scrollIntoView"in(i=s)?(i.focus({preventScroll:!0}),i.scrollIntoView(z_({block:"nearest",inline:"nearest"},o))):i.focus())}),[n,d,r,a]),xb((()=>{if(!n)return;if(!d)return;if(!r)return;const{baseElement:e,activeId:t}=n.getState();if(!(null===t))return;if(!e)return;const a=c.current;c.current=null,a&&gb(a,{relatedTarget:e}),iw(e)||e.focus()}),[n,d,r]);const m=n.useState("activeId"),p=n.useState("virtualFocus");xb((()=>{var e;if(!n)return;if(!r)return;if(!p)return;const t=c.current;if(c.current=null,!t)return;const a=(null==(e=ew(n,m))?void 0:e.element)||tb(t);a!==t&&gb(t,{relatedTarget:a})}),[n,m,p,r]);const h=yw(n,i.onKeyDownCapture,c),f=yw(n,i.onKeyUpCapture,c),g=i.onFocusCapture,y=kb((e=>{if(null==g||g(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const r=e.relatedTarget,a=function(e){const t=e[tw];return delete e[tw],t}(e.currentTarget);fb(e)&&a&&(e.stopPropagation(),c.current=r)})),v=i.onFocus,_=kb((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!r)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:a}=n.getState();a?fb(e)&&!nw(n,t)&&queueMicrotask(u):fb(e)&&n.setActiveId(null)})),b=i.onBlurCapture,E=kb((e=>{var t;if(null==b||b(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:r,activeId:a}=n.getState();if(!r)return;const s=null==(t=ew(n,a))?void 0:t.element,i=e.relatedTarget,o=nw(n,i),l=c.current;if(c.current=null,fb(e)&&o)i===s?l&&l!==i&&gb(l,e):s?gb(s,e):l&&gb(l,e),e.stopPropagation();else{!nw(n,e.target)&&s&&gb(s,e)}})),w=i.onKeyDown,S=Ab(s),x=kb((e=>{var t;if(null==w||w(e),e.defaultPrevented)return;if(!n)return;if(!fb(e))return;const{orientation:r,items:a,renderedItems:s,activeId:i}=n.getState(),o=ew(n,i);if(null==(t=null==o?void 0:o.element)?void 0:t.isConnected)return;const l="horizontal"!==r,c="vertical"!==r,u=function(e){return e.some((e=>!!e.rowId))}(s);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&ib(e.currentTarget))return;const d={ArrowUp:(u||l)&&(()=>{if(u){const e=a&&function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(iE(oE(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))))}(a);return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(u||c)&&n.first,ArrowDown:(u||l)&&n.first,ArrowLeft:(u||c)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},m=d[e.key];if(m){const t=m();if(void 0!==t){if(!S(e))return;e.preventDefault(),n.move(t)}}}));i=Ob(i,(e=>(0,_E.jsx)(ME,{value:n,children:e})),[n]);const C=n.useState((e=>{var t;if(n&&r&&e.virtualFocus)return null==(t=ew(n,e.activeId))?void 0:t.id}));i=A_(M_({"aria-activedescendant":C},i),{ref:Tb(r?n.setBaseElement:null,i.ref),onKeyDownCapture:h,onKeyUpCapture:f,onFocusCapture:y,onFocus:_,onBlurCapture:E,onKeyDown:x});const k=n.useState((e=>r&&(e.virtualFocus||null===e.activeId)));return i=gw(M_({focusable:k},i))}));bE((e=>wE("div",vw(e))));const _w=window.ReactDOM;function bw(e,t,n){if(!n)return!1;const r=e.find((e=>!e.disabled&&e.value));return(null==r?void 0:r.value)===t}function Ew(e,t){return!!t&&(null!=e&&(e=Z_(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var ww=SE((e=>{var t=e,{store:n,focusable:r=!0,autoSelect:a=!1,getAutoSelectId:s,showOnChange:i=!0,setValueOnChange:o=!0,showOnMouseDown:c=!0,setValueOnClick:u=!0,showOnKeyDown:d=!0,moveOnKeyPress:m=!0,autoComplete:p="list"}=t,h=O_(t,["store","focusable","autoSelect","getAutoSelectId","showOnChange","setValueOnChange","showOnMouseDown","setValueOnClick","showOnKeyDown","moveOnKeyPress","autoComplete"]);const f=jE();Y_(n=n||f,!1);const g=(0,l.useRef)(null),[y,v]=(0,l.useReducer)((()=>[]),[]),_=(0,l.useRef)(!1),b=(0,l.useRef)(!1),E=n.useState((e=>!!a&&e.virtualFocus)),w="inline"===p||"both"===p,[S,x]=(0,l.useState)(w);!function(e,t){const n=(0,l.useRef)(!1);xb((()=>{if(n.current)return e();n.current=!0}),t),xb((()=>()=>{n.current=!1}),[])}((()=>{w&&x(!0)}),[w]);const C=n.useState("value"),k=n.useState((e=>w&&S?e.activeValue:void 0)),T=n.useState("renderedItems"),P=n.useState("open"),I=n.useState("contentElement"),M=(0,l.useMemo)((()=>{if(!w)return C;if(!S)return C;if(bw(T,k,E)){if(Ew(C,k)){const e=(null==k?void 0:k.slice(C.length))||"";return C+e}return C}return k||C}),[w,S,T,k,E,C]);(0,l.useEffect)((()=>{const e=g.current;if(!e)return;const t=()=>x(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,l.useEffect)((()=>{if(!w)return;if(!S)return;if(!k)return;bw(T,k,E)&&Ew(C,k)&&queueMicrotask((()=>{const e=g.current;e&&ub(e,C.length,k.length)}))}),[y,w,S,k,T,E,C]);const A=(0,l.useRef)(null),O=kb(s),N=(0,l.useRef)(null);(0,l.useEffect)((()=>{if(!P)return;if(!I)return;const e=cb(I);if(!e)return;A.current=e;const t=()=>{_.current=!1},r=()=>{if(!n)return;if(!_.current)return;const{activeId:e}=n.getState();null!==e&&e!==N.current&&(_.current=!1)},a={passive:!0,capture:!0};return e.addEventListener("wheel",t,a),e.addEventListener("scroll",r,a),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("scroll",r,!0)}}),[P,I,n]),xb((()=>{C&&(b.current||(_.current=!0))}),[C]),xb((()=>{P||(_.current=!1)}),[P]);const F=n.useState("resetValueOnSelect");Mb((()=>{var e;const t=_.current;if(!n)return;if(!(E&&t||F))return;const{baseElement:r,contentElement:a,activeId:s}=n.getState();if(!r||iw(r)){if(null==a?void 0:a.hasAttribute("data-placing")){const e=new MutationObserver(v);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(E&&t){const e=O(T),t=void 0!==e?e:n.first();N.current=t,n.move(null!=t?t:null)}else{const t=null==(e=n.item(s))?void 0:e.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[n,y,C,E,F,O,T]),(0,l.useEffect)((()=>{if(!w)return;const e=g.current;if(!e)return;const t=[e,I].filter((e=>!!e)),r=e=>{t.every((t=>vb(e,t)))&&(null==n||n.setValue(M))};return t.forEach((e=>e.addEventListener("focusout",r))),()=>{t.forEach((e=>e.removeEventListener("focusout",r)))}}),[w,I,n,M]);const R=h.onChange,D=Ab(i),V=Ab(o),L=kb((e=>{if(null==R||R(e),e.defaultPrevented)return;if(!n)return;const{value:t,selectionStart:r,selectionEnd:a}=e.target,s=e.nativeEvent;if(_.current=!0,function(e){return"input"===e.type}(s)&&(s.isComposing&&(_.current=!1,b.current=!0),w)){const e="insertText"===s.inputType||"insertCompositionText"===s.inputType,n=r===t.length;x(e&&n)}if(V(e)){const s=t===n.getState().value;(0,_w.flushSync)((()=>null==n?void 0:n.setValue(t))),ub(e.currentTarget,r,a),w&&E&&s&&v()}D(e)&&n.show(),E&&_.current||n.setActiveId(null)})),B=h.onCompositionEnd,z=kb((e=>{_.current=!0,b.current=!1,null==B||B(e),e.defaultPrevented||E&&v()})),H=h.onMouseDown,G=Ab(u),U=Ab(c),W=kb((e=>{null==H||H(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(n.setActiveId(null),G(e)&&n.setValue(M),U(e)&&_b(e.currentTarget,"mouseup",n.show))})),j=h.onKeyDown,Z=Ab(d),q=kb((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,activeId:r}=n.getState();t||null===r&&("ArrowUp"!==e.key&&"ArrowDown"!==e.key||Z(e)&&(e.preventDefault(),n.show()))})),Y=h.onBlur,K=kb((e=>{_.current=!1,null==Y||Y(e),e.defaultPrevented})),X=Pb(h.id),J=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(p)?p:void 0,Q=n.useState((e=>null===e.activeId));return h=A_(M_({id:X,role:"combobox","aria-autocomplete":J,"aria-haspopup":ob(I,"listbox"),"aria-expanded":P,"aria-controls":null==I?void 0:I.id,"data-active-item":Q||void 0,value:M},h),{ref:Tb(g,h.ref),onChange:L,onCompositionEnd:z,onMouseDown:W,onKeyDown:q,onBlur:K}),h=vw(A_(M_({store:n,focusable:r},h),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(m,e)&&(w&&x(!0),!0)})),h=$E(M_({store:n},h)),M_({autoComplete:"off"},h)})),Sw=bE((e=>wE("input",ww(e))));function xw(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function Cw(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const n=1e3*parseFloat(t||"0s");return n>e?n:e}),0)}function kw(e,t,n){return!(n||!1===t||e&&!t)}var Tw=SE((e=>{var t=e,{store:n,alwaysVisible:r}=t,a=O_(t,["store","alwaysVisible"]);const s=RE();Y_(n=n||s,!1);const i=Pb(a.id),[o,c]=(0,l.useState)(null),u=n.useState("open"),d=n.useState("mounted"),m=n.useState("animated"),p=n.useState("contentElement");xb((()=>{if(m){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{c(u?"enter":"leave")}));c(null)}}),[m,p,u]),xb((()=>{if(!n)return;if(!m)return;if(!p)return;if(!o)return;if("enter"===o&&!u)return;if("leave"===o&&u)return;if("number"==typeof m){return xw(m,n.stopAnimation)}const{transitionDuration:e,animationDuration:t,transitionDelay:r,animationDelay:a}=getComputedStyle(p),s=Cw(r,a)+Cw(e,t);return s?xw(s,n.stopAnimation):void 0}),[n,m,p,u,o]);const h=kw(d,(a=Ob(a,(e=>(0,_E.jsx)(LE,{value:n,children:e})),[n])).hidden,r),f=h?A_(M_({},a.style),{display:"none"}):a.style;return a=A_(M_({id:i,"data-enter":"enter"===o?"":void 0,"data-leave":"leave"===o?"":void 0,hidden:h},a),{ref:Tb(i?n.setContentElement:null,a.ref),style:f})})),Pw=bE((e=>wE("div",Tw(e))));bE((e=>{var t=e,{unmountOnHide:n}=t,r=O_(t,["unmountOnHide"]);const a=RE();return!1===Xb(r.store||a,(e=>!n||(null==e?void 0:e.mounted)))?null:(0,_E.jsx)(Pw,M_({},r))}));var Iw=SE((e=>{var t=e,{store:n,focusable:r=!0,alwaysVisible:a}=t,s=O_(t,["store","focusable","alwaysVisible"]);const i=jE();Y_(n=n||i,!1);const o=(0,l.useRef)(null),c=Pb(s.id),u=s.onKeyDown,d=kb((e=>{null==u||u(e),e.defaultPrevented||"Escape"===e.key&&(null==n||n.move(null))})),m=(0,l.useRef)(!1),p=s.onFocusVisible,h=kb((e=>{if(null==p||p(e),e.defaultPrevented)return;if("focus"!==e.type)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const{relatedTarget:r,currentTarget:a}=e;r&&a.contains(r)||(m.current=!0,n.setState("virtualFocus",!1))})),f=s.onBlur,g=kb((e=>{null==f||f(e),e.defaultPrevented||m.current&&vb(e)&&(m.current=!1,null==n||n.setState("virtualFocus",!0))}));s=Ob(s,(e=>(0,_E.jsx)(qE,{value:n,children:e})),[n]);const y=kw(n.useState("mounted"),s.hidden,a),v=y?A_(M_({},s.style),{display:"none"}):s.style,_=n.useState((e=>Array.isArray(e.selectedValue))),b=function(e,t,n){const[r,a]=(0,l.useState)(n);return xb((()=>{const n=e&&"current"in e?e.current:e,r=null==n?void 0:n.getAttribute(t);null!=r&&a(r)}),[e,t]),r}(o,"role",s.role);return s=A_(M_({id:c,hidden:y,role:"listbox",tabIndex:r?-1:void 0,"aria-multiselectable":("listbox"===b||"tree"===b||"grid"===b)&&_||void 0},s),{ref:Tb(c?n.setContentElement:null,o,s.ref),style:v,onKeyDown:d,onFocusVisible:h,onBlur:g}),s=gw(M_({focusable:r},s))})),Mw=bE((e=>wE("div",Iw(e))));function Aw(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var Ow=Symbol("composite-hover");var Nw=SE((e=>{var t=e,{store:n,focusOnHover:r=!0,blurOnHoverEnd:a=!!r}=t,s=O_(t,["store","focusOnHover","blurOnHoverEnd"]);const i=PE();Y_(n=n||i,!1);const o=((0,l.useEffect)((()=>{bb("mousemove",Db,!0),bb("mousedown",Vb,!0),bb("mouseup",Vb,!0),bb("keydown",Vb,!0),bb("scroll",Vb,!0)}),[]),kb((()=>Nb))),c=s.onMouseMove,u=Ab(r),d=kb((e=>{if(null==c||c(e),!e.defaultPrevented&&o()&&u(e)){if(!ow(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!iw(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}})),m=s.onMouseLeave,p=Ab(a),h=kb((e=>{var t;null==m||m(e),e.defaultPrevented||o()&&(function(e){const t=Aw(e);return!!t&&nb(e.currentTarget,t)}(e)||function(e){let t=Aw(e);if(!t)return!1;do{if(W_(t,Ow)&&t[Ow])return!0;t=t.parentElement}while(t);return!1}(e)||u(e)&&p(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))})),f=(0,l.useCallback)((e=>{e&&(e[Ow]=!0)}),[]);return s=A_(M_({},s),{ref:Tb(f,s.ref),onMouseMove:d,onMouseLeave:h})}));EE((e=>wE("div",Nw(e))));function Fw(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?rb(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(rb(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var Rw=Symbol("command"),Dw=SE((e=>{var t=e,{clickOnEnter:n=!0,clickOnSpace:r=!0}=t,a=O_(t,["clickOnEnter","clickOnSpace"]);const s=(0,l.useRef)(null),i=Ib(s,a.as),o=a.type,[c,u]=(0,l.useState)((()=>!!i&&rb({tagName:i,type:o})));(0,l.useEffect)((()=>{s.current&&u(rb(s.current))}),[]);const[d,m]=(0,l.useState)(!1),p=(0,l.useRef)(!1),h=K_(a),[f,g]=function(e,t,n){const r=e.onLoadedMetadataCapture,a=(0,l.useMemo)((()=>Object.assign((()=>{}),A_(M_({},r),{[t]:n}))),[r,t,n]);return[null==r?void 0:r[t],{onLoadedMetadataCapture:a}]}(a,Rw,!0),y=a.onKeyDown,v=kb((e=>{null==y||y(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(f)return;if(h)return;if(!fb(e))return;if(ib(t))return;if(t.isContentEditable)return;const a=n&&"Enter"===e.key,s=r&&" "===e.key,i="Enter"===e.key&&!n,o=" "===e.key&&!r;if(i||o)e.preventDefault();else if(a||s){const n=Fw(e);if(a){if(!n){e.preventDefault();const n=e,{view:r}=n,a=O_(n,["view"]),s=()=>yb(t,a);$_&&/firefox\//i.test(navigator.userAgent)?_b(t,"keyup",s):queueMicrotask(s)}}else s&&(p.current=!0,n||(e.preventDefault(),m(!0)))}})),_=a.onKeyUp,b=kb((e=>{if(null==_||_(e),e.defaultPrevented)return;if(f)return;if(h)return;if(e.metaKey)return;const t=r&&" "===e.key;if(p.current&&t&&(p.current=!1,!Fw(e))){e.preventDefault(),m(!1);const t=e.currentTarget,n=e,{view:r}=n,a=O_(n,["view"]);queueMicrotask((()=>yb(t,a)))}}));return a=A_(M_(M_({"data-active":d?"":void 0,type:c?"button":void 0},g),a),{ref:Tb(s,a.ref),onKeyDown:v,onKeyUp:b}),a=gw(a)}));bE((e=>wE("button",e=Dw(e))));var Vw=SE((e=>{var t=e,{store:n,shouldRegisterItem:r=!0,getItem:a=q_,element:s}=t,i=O_(t,["store","shouldRegisterItem","getItem","element"]);const o=kE();n=n||o;const c=Pb(i.id),u=(0,l.useRef)(s);return(0,l.useEffect)((()=>{const e=u.current;if(!c)return;if(!e)return;if(!r)return;const t=a({id:c,element:e});return null==n?void 0:n.renderItem(t)}),[c,r,a,n]),i=A_(M_({},i),{ref:Tb(u,i.ref)})}));bE((e=>wE("div",Vw(e))));function Lw(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Bw(e,t,n,r=!1){var a;if(!t)return;if(!n)return;const{renderedItems:s}=t.getState(),i=cb(e);if(!i)return;const o=function(e,t=!1){const n=e.clientHeight,{top:r}=e.getBoundingClientRect(),a=1.5*Math.max(.875*n,n-40),s=t?n-a+r:a+r;return"HTML"===e.tagName?s+e.scrollTop:s}(i,r);let l,c;for(let e=0;e=0){void 0!==c&&c{var t=e,{store:n,rowId:r,preventScrollOnKeyDown:a=!1,moveOnKeyPress:s=!0,tabbable:i=!1,getItem:o,"aria-setsize":c,"aria-posinset":u}=t,d=O_(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const m=PE();n=n||m;const p=Pb(d.id),h=(0,l.useRef)(null),f=(0,l.useContext)(NE),g=Xb(n,(e=>r||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0))),y=K_(d)&&!d.accessibleWhenDisabled,v=(0,l.useCallback)((e=>{const t=A_(M_({},e),{id:p||e.id,rowId:g,disabled:!!y});return o?o(t):t}),[p,g,y,o]),_=d.onFocus,b=(0,l.useRef)(!1),E=kb((e=>{if(null==_||_(e),e.defaultPrevented)return;if(hb(e))return;if(!p)return;if(!n)return;const{activeId:t,virtualFocus:r,baseElement:a}=n.getState();if(function(e,t){return!fb(e)&&nw(t,e.target)}(e,n))return;if(t!==p&&n.setActiveId(p),!r)return;if(!fb(e))return;if((s=e.currentTarget).isContentEditable||ib(s)||"INPUT"===s.tagName&&!rb(s))return;var s;if(!(null==a?void 0:a.isConnected))return;b.current=!0;e.relatedTarget===a||nw(n,e.relatedTarget)?function(e){e[tw]=!0,e.focus({preventScroll:!0})}(a):a.focus()})),w=d.onBlurCapture,S=kb((e=>{if(null==w||w(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&b.current&&(b.current=!1,e.preventDefault(),e.stopPropagation())})),x=d.onKeyDown,C=Ab(a),k=Ab(s),T=kb((e=>{if(null==x||x(e),e.defaultPrevented)return;if(!fb(e))return;if(!n)return;const{currentTarget:t}=e,r=n.getState(),a=n.item(p),s=!!(null==a?void 0:a.rowId),i="horizontal"!==r.orientation,o="vertical"!==r.orientation,l=()=>!!s||(!!o||(!r.baseElement||!ib(r.baseElement))),c={ArrowUp:(s||i)&&n.up,ArrowRight:(s||o)&&n.next,ArrowDown:(s||i)&&n.down,ArrowLeft:(s||o)&&n.previous,Home:()=>{if(l())return!s||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!s||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>Bw(t,n,null==n?void 0:n.up,!0),PageDown:()=>Bw(t,n,null==n?void 0:n.down)}[e.key];if(c){const t=c();if(C(e)||void 0!==t){if(!k(e))return;e.preventDefault(),n.move(t)}}})),P=Xb(n,(e=>(null==e?void 0:e.baseElement)||void 0)),I=(0,l.useMemo)((()=>({id:p,baseElement:P})),[p,P]);d=Ob(d,(e=>(0,_E.jsx)(OE.Provider,{value:I,children:e})),[I]);const M=Xb(n,(e=>!!e&&e.activeId===p)),A=Xb(n,"virtualFocus"),O=function(e,t){const n=t.role,[r,a]=(0,l.useState)(n);return xb((()=>{const t=e.current;t&&a(t.getAttribute("role")||n)}),[n]),r}(h,d);let N;M&&(!function(e){return"option"===e||"treeitem"===e}(O)?A&&function(e){return"option"===e||"tab"===e||"treeitem"===e||"gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e}(O)&&(N=!0):N=!0);const F=Xb(n,(e=>null!=c?c:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0)),R=Xb(n,(e=>{if(null!=u)return u;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===p))})),D=Xb(n,(e=>!(null==e?void 0:e.renderedItems.length)||!e.virtualFocus&&(!!i||e.activeId===p)));return d=A_(M_({id:p,"aria-selected":N,"data-active-item":M?"":void 0},d),{ref:Tb(h,d.ref),tabIndex:D?d.tabIndex:-1,onFocus:E,onBlurCapture:S,onKeyDown:T}),d=Dw(d),d=Vw(A_(M_({store:n},d),{getItem:v,shouldRegisterItem:!!p&&d.shouldRegisterItem})),A_(M_({},d),{"aria-setsize":F,"aria-posinset":R})}));EE((e=>wE("button",zw(e))));var Hw=SE((e=>{var t=e,{store:n,value:r,hideOnClick:a,selectValueOnClick:s=!0,setValueOnClick:i,focusOnHover:o=!1,moveOnKeyPress:c=!0,getItem:u}=t,d=O_(t,["store","value","hideOnClick","selectValueOnClick","setValueOnClick","focusOnHover","moveOnKeyPress","getItem"]);const m=WE();Y_(n=n||m,!1);const p=(0,l.useCallback)((e=>{const t=A_(M_({},e),{value:r});return u?u(t):t}),[r,u]),h=n.useState((e=>Array.isArray(e.selectedValue)));i=null!=i?i:!h,a=null!=a?a:null!=r&&!h;const f=d.onClick,g=Ab(i),y=Ab(s),v=Ab(a),_=kb((e=>{null==f||f(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=mb();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const r=t.tagName.toLowerCase();return"a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type}(e)||(null!=r&&(y(e)&&(null==n||n.setSelectedValue((e=>Array.isArray(e)?e.includes(r)?e.filter((e=>e!==r)):[...e,r]:r))),g(e)&&(null==n||n.setValue(r))),v(e)&&(null==n||n.move(null),null==n||n.hide()))})),b=d.onKeyDown,E=kb((e=>{if(null==b||b(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState().baseElement;if(!t)return;if(iw(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),ib(t)&&(null==n||n.setValue(t.value)))})),w=n.useState((e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,r)));h&&null!=w&&(d=M_({"aria-selected":w},d)),d=Ob(d,(e=>(0,_E.jsx)(YE.Provider,{value:r,children:(0,_E.jsx)(KE.Provider,{value:null!=w&&w,children:e})})),[r,w]);const S=n.useState("contentElement");d=A_(M_({role:lb(S),children:r},d),{onClick:_,onKeyDown:E});const x=Ab(c);return d=zw(A_(M_({store:n},d),{getItem:p,moveOnKeyPress:e=>{if(!x(e))return!1;const t=new Event("combobox-item-move"),r=null==n?void 0:n.getState().baseElement;return null==r||r.dispatchEvent(t),!0}})),d=Nw(M_({store:n,focusOnHover:o},d))})),Gw=EE((e=>wE("div",Hw(e))));function Uw(e){return Z_(e).toLowerCase()}var Ww=SE((e=>{var t=e,{store:n,value:r}=t,a=O_(t,["store","value"]);const s=WE();n=n||s;const i=(0,l.useContext)(YE),o=null!=r?r:i;Y_(n,!1);const c=n.useState((e=>o&&e.value?e.value:void 0)),u=(0,l.useMemo)((()=>o&&c?function(e,t){t=Uw(t);let n=Uw(e).indexOf(t);const r=[];for(;-1!==n;)0!==n&&r.push((0,_E.jsx)("span",{"data-autocomplete-value":"",children:e.substr(0,n)},r.length)),r.push((0,_E.jsx)("span",{"data-user-value":"",children:e.substr(n,t.length)},r.length)),n=Uw(e=e.substr(n+t.length)).indexOf(t);return e&&r.push((0,_E.jsx)("span",{"data-autocomplete-value":"",children:e},r.length)),r}(o,c):o),[o,c]);return a=M_({children:u},a)})),jw=bE((e=>wE("span",Ww(e))));const Zw=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Circle,{cx:12,cy:12,r:3}));function qw(e=""){return hi()(e.trim().toLowerCase())}function Yw({filter:e,view:t,onChangeView:n}){const[r,a]=(0,g.useState)(""),s=(0,g.useDeferredValue)(r),i=t.filters.find((t=>t.field===e.field)),o=i?.value,c=(0,g.useMemo)((()=>{const t=qw(s);return e.elements.filter((e=>qw(e.label).includes(t)))}),[e.elements,s]);return(0,l.createElement)(XE,{value:r,setSelectedValue:r=>{const a=t.filters.find((t=>t.field===e.field)),s=a?[...t.filters.map((t=>t.field===e.field?{...t,operator:a.operator||e.operators[0],value:r}:t))]:[...t.filters,{field:e.field,operator:e.operators[0],value:r}];n({...t,page:1,filters:s})},setValue:a},(0,l.createElement)("div",{className:"dataviews-search-widget-filter-combobox__wrapper"},(0,l.createElement)(QE,{render:(0,l.createElement)(b.VisuallyHidden,null)},(0,E.__)("Search items")),(0,l.createElement)(Sw,{autoSelect:"always",placeholder:(0,E.__)("Search"),className:"dataviews-search-widget-filter-combobox__input"}),(0,l.createElement)("div",{className:"dataviews-search-widget-filter-combobox__icon"},(0,l.createElement)(b.Icon,{icon:Va}))),(0,l.createElement)(Mw,{className:"dataviews-search-widget-filter-combobox-list",alwaysVisible:!0},c.map((e=>(0,l.createElement)(Gw,{key:e.value,value:e.value,className:"dataviews-search-widget-filter-combobox-item",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0},(0,l.createElement)("span",{className:"dataviews-search-widget-filter-combobox-item-check"},o===e.value&&(0,l.createElement)(b.Icon,{icon:Zw})),(0,l.createElement)("span",null,(0,l.createElement)(jw,{className:"dataviews-search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,l.createElement)("span",{className:"dataviews-search-widget-filter-combobox-item-description"},e.description))))),!c.length&&(0,l.createElement)("p",null,(0,E.__)("No results found"))))}const Kw=({activeElement:e,filterInView:t,filter:n})=>{if(void 0===e)return n.name;const r={Span1:(0,l.createElement)("span",{className:"dataviews-filter-summary__filter-text-name"}),Span2:(0,l.createElement)("span",{className:"dataviews-filter-summary__filter-text-value"})};return void 0!==e&&t?.operator===wl?(0,g.createInterpolateElement)((0,E.sprintf)((0,E.__)("%1$s is %2$s"),n.name,e.label),r):void 0!==e&&t?.operator===Sl?(0,g.createInterpolateElement)((0,E.sprintf)((0,E.__)("%1$s is not %2$s"),n.name,e.label),r):(0,E.sprintf)((0,E.__)("Unknown status for %1$s"),n.name)};function Xw({filter:e,view:t,onChangeView:n}){const r=e.operators?.map((e=>({value:e,label:xl[e]?.label}))),a=t.filters.find((t=>t.field===e.field)),s=a?.operator||e.operators[0];return r.length>1&&(0,l.createElement)(b.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filter-summary__operators-container"},(0,l.createElement)(b.FlexItem,{className:"dataviews-filter-summary__operators-filter-name"},e.name),(0,l.createElement)(b.SelectControl,{label:(0,E.__)("Conditions"),value:s,options:r,onChange:r=>{const s=a?[...t.filters.map((t=>t.field===e.field?{...t,operator:r}:t))]:[...t.filters,{field:e.field,operator:r}];n({...t,page:1,filters:s})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0}))}function Jw({addFilterRef:e,openedFilter:t,...n}){const r=(0,g.useRef)(),{filter:a,view:s,onChangeView:i}=n,o=s.filters.find((e=>e.field===a.field)),c=a.elements.find((e=>e.value===o?.value)),u=a.isPrimary,d=void 0!==o?.value,m=!u||d;return(0,l.createElement)(b.Dropdown,{defaultOpen:t===a.field,contentClassName:"dataviews-filter-summary__popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{r.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,l.createElement)("div",{className:"dataviews-filter-summary__chip-container"},(0,l.createElement)(b.Tooltip,{text:(0,E.sprintf)((0,E.__)("Filter by: %1$s"),a.name.toLowerCase()),placement:"top"},(0,l.createElement)("div",{className:_()("dataviews-filter-summary__chip",{"has-reset":m,"has-values":d}),role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{[wr.ENTER,wr.SPACE].includes(e.keyCode)&&(n(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:r},(0,l.createElement)(Kw,{activeElement:c,filterInView:o,filter:a}))),m&&(0,l.createElement)(b.Tooltip,{text:u?(0,E.__)("Reset"):(0,E.__)("Remove"),placement:"top"},(0,l.createElement)("button",{className:_()("dataviews-filter-summary__chip-remove",{"has-values":d}),onClick:()=>{i({...s,page:1,filters:s.filters.filter((e=>e.field!==a.field))}),u?r.current?.focus():e.current?.focus()}},(0,l.createElement)(b.Icon,{icon:P})))),renderContent:()=>(0,l.createElement)(b.__experimentalVStack,{spacing:0,justify:"flex-start"},(0,l.createElement)(Xw,{...n}),(0,l.createElement)(Yw,{...n}))})}const{DropdownMenuV2:Qw,DropdownMenuItemV2:$w,DropdownMenuItemLabelV2:eS}=Vo(b.privateApis);const tS=(0,g.forwardRef)((function({filters:e,view:t,onChangeView:n,setOpenedFilter:r},a){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const s=e.filter((e=>!e.isVisible));return(0,l.createElement)(Qw,{trigger:(0,l.createElement)(b.Button,{__experimentalIsFocusable:!0,size:"compact",icon:Za,className:"dataviews-filters-button",variant:"tertiary",disabled:!s.length,ref:a},(0,E.__)("Add filter"))},s.map((e=>(0,l.createElement)($w,{key:e.field,onClick:()=>{r(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})}},(0,l.createElement)(eS,null,e.name)))))}));function nS({filters:e,view:t,onChangeView:n}){const r=!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,l.createElement)(b.Button,{disabled:r,__experimentalIsFocusable:!0,size:"compact",variant:"tertiary",onClick:()=>{n({...t,page:1,search:"",filters:[]})}},(0,E.__)("Reset filters"))}const rS=(0,g.memo)((function({fields:e,view:t,onChangeView:n,openedFilter:r,setOpenedFilter:a}){const s=(0,g.useRef)(),i=[];e.forEach((e=>{if(!e.type)return;const n=Jo(e);if(0!==n.length&&e.type===El){if(!e.elements?.length)return;const r=!!e.filterBy?.isPrimary;i.push({field:e.id,name:e.header,elements:e.elements,operators:n,isVisible:r||t.filters.some((t=>t.field===e.id&&[wl,Sl].includes(t.operator))),isPrimary:r})}})),i.sort(((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)));const o=(0,l.createElement)(tS,{key:"add-filter",filters:i,view:t,onChangeView:n,ref:s,setOpenedFilter:a}),c=[...i.map((e=>e.isVisible?(0,l.createElement)(Jw,{key:e.field,filter:e,view:t,onChangeView:n,addFilterRef:s,openedFilter:r}):null)),o];return c.length>1&&c.push((0,l.createElement)(nS,{key:"reset-filters",filters:i,view:t,onChangeView:n})),(0,l.createElement)(b.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0},c)})),aS=rS,sS=(0,g.memo)((function({label:e,view:t,onChangeView:n}){const[r,a,s]=(0,ie.useDebouncedInput)(t.search);(0,g.useEffect)((()=>{a(t.search)}),[t]);const i=(0,g.useRef)(n);(0,g.useEffect)((()=>{i.current=n}),[n]),(0,g.useEffect)((()=>{i.current({...t,page:1,search:s})}),[s]);const o=e||(0,E.__)("Search");return(0,l.createElement)(b.SearchControl,{__nextHasNoMarginBottom:!0,onChange:a,value:r,label:o,placeholder:o,size:"compact"})})),iS=sS,oS=e=>e.id,lS=()=>{};function cS({view:e,onChangeView:t,fields:n,search:r=!0,searchLabel:a,actions:s,data:i,getItemId:o=oS,isLoading:c=!1,paginationInfo:u,supportedLayouts:d,onSelectionChange:m=lS,onDetailsChange:p=null,deferredRendering:h=!1}){const[f,y]=(0,g.useState)([]),[v,_]=(0,g.useState)(null);(0,g.useEffect)((()=>{if(f.length>0&&f.some((e=>!i.some((t=>o(t)===e))))){const e=f.filter((e=>i.some((t=>o(t)===e))));y(e),m(i.filter((t=>e.includes(o(t)))))}}),[f,i,o,m]);const E=(0,g.useCallback)((e=>{y(e.map((e=>o(e)))),m(e)}),[y,o,m]),w=Pl.find((t=>t.type===e.type)).component,S=(0,g.useMemo)((()=>n.map((e=>({...e,render:e.render||e.getValue})))),[n]),x=function(e,t){return(0,g.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&e.isEligible(t)))))),[e,t])}(s,i);return(0,l.createElement)("div",{className:"dataviews-wrapper"},(0,l.createElement)(b.__experimentalHStack,{alignment:"top",justify:"start",className:"dataviews-filters__view-actions"},(0,l.createElement)(b.__experimentalHStack,{justify:"start",className:"dataviews-filters__container",wrap:!0},r&&(0,l.createElement)(iS,{label:a,view:e,onChangeView:t}),(0,l.createElement)(aS,{fields:S,view:e,onChangeView:t,openedFilter:v,setOpenedFilter:_})),[kl,Tl].includes(e.type)&&x&&(0,l.createElement)(il,{actions:s,data:i,onSelectionChange:E,selection:f,getItemId:o}),(0,l.createElement)(w_,{fields:S,view:e,onChangeView:t,supportedLayouts:d})),(0,l.createElement)(w,{fields:S,view:e,onChangeView:t,actions:s,data:i,getItemId:o,isLoading:c,onSelectionChange:E,onDetailsChange:p,selection:f,deferredRendering:h,setOpenedFilter:_}),(0,l.createElement)(u_,{view:e,onChangeView:t,paginationInfo:u}))}function uS({title:e,subTitle:t,actions:n}){return(0,l.createElement)(b.__experimentalHStack,{as:"header",alignment:"left",className:"edit-site-page-header"},(0,l.createElement)(b.FlexBlock,{className:"edit-site-page-header__page-title"},(0,l.createElement)(b.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title"},e),t&&(0,l.createElement)(b.__experimentalText,{as:"p",className:"edit-site-page-header__sub-title"},t)),(0,l.createElement)(b.FlexItem,{className:"edit-site-page-header__actions"},n))}function dS({title:e,subTitle:t,actions:n,children:r,className:a,hideTitleFromUI:s=!1}){const i=_()("edit-site-page",a);return(0,l.createElement)(oe,{className:i,ariaLabel:e},(0,l.createElement)("div",{className:"edit-site-page-content"},!s&&e&&(0,l.createElement)(uS,{title:e,subTitle:t,actions:n}),r),(0,l.createElement)(y.EditorSnackbars,null))}const{useHistory:mS}=Xe(gt.privateApis),pS={id:"move-to-trash",label:(0,E.__)("Move to Trash"),isPrimary:!0,icon:ql,isEligible:({status:e})=>"trash"!==e,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onPerform:n})=>{const{createSuccessNotice:r,createErrorNotice:a}=(0,m.useDispatch)(ge.store),{deleteEntityRecord:s}=(0,m.useDispatch)(ye.store);return(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.__experimentalText,null,1===e.length?(0,E.sprintf)((0,E.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(e[0].title.rendered)):(0,E.sprintf)((0,E.__)("Are you sure you want to delete %d pages?"),e.length)),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",onClick:async()=>{const i=await Promise.allSettled(e.map((e=>s("postType",e.type,e.id,{},{throwOnError:!0}))));if(i.every((({status:e})=>"fulfilled"===e))){let t;t=1===i.length?(0,E.sprintf)((0,E.__)('"%s" moved to the Trash.'),(0,en.decodeEntities)(e[0].title.rendered)):(0,E.__)("Pages moved to the Trash."),r(t,{type:"snackbar",id:"edit-site-page-trashed"})}else{let e;if(1===i.length)e=i[0].reason?.message?i[0].reason.message:(0,E.__)("An error occurred while moving the post to the trash.");else{const t=new Set,n=i.filter((({status:e})=>"rejected"===e));for(const e of n)e.reason?.message&&t.add(e.reason.message);e=0===t.size?(0,E.__)("An error occurred while moving the posts to the trash."):1===t.size?(0,E.sprintf)((0,E.__)("An error occurred while moving the posts to the trash: %s"),[...t][0]):(0,E.sprintf)((0,E.__)("Some errors occurred while moving the pages to the trash: %s"),[...t].join(",")),a(e,{type:"snackbar"})}}n&&n(),t()}},(0,E.__)("Delete"))))}};const hS={id:"view-post",label:(0,E.__)("View"),isPrimary:!0,icon:Ic,isEligible:e=>"trash"!==e.status,callback(e){const t=e[0];document.location.href=t.link}};const fS={id:"view-post-revisions",label:(0,E.__)("View revisions"),isPrimary:!1,isEligible:e=>{var t,n;if("trash"===e.status)return!1;const r=null!==(t=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==t?t:null,a=null!==(n=e?._links?.["version-history"]?.[0]?.count)&&void 0!==n?n:0;return r&&a>1},callback(e){const t=e[0],n=(0,yt.addQueryArgs)("revision.php",{revision:t?._links?.["predecessor-version"]?.[0]?.id});document.location.href=n}};const gS=function({id:e,size:t=["large","medium","thumbnail"],...n}){const{record:r}=(0,ye.useEntityRecord)("root","media",e),a=t.find((e=>!!r?.media_details?.sizes[e])),s=r?.media_details?.sizes[a]?.source_url||r?.source_url;return s?(0,l.createElement)("img",{...n,src:s,alt:r.alt_text}):null},{useLocation:yS,useHistory:vS}=Xe(gt.privateApis),_S=[],bS=window?.__experimentalAdminViews?[Dt,Vt,Lt]:[Dt,Vt];const ES=[{value:"draft",label:(0,E.__)("Draft")},{value:"future",label:(0,E.__)("Scheduled")},{value:"pending",label:(0,E.__)("Pending Review")},{value:"private",label:(0,E.__)("Private")},{value:"publish",label:(0,E.__)("Published")},{value:"trash",label:(0,E.__)("Trash")}],wS="draft,future,pending,private,publish";function SS({item:e,viewType:t}){const{onClick:n}=Et({postId:e.id,postType:e.type,canvas:"edit"}),r=!!e.featured_media,a=t===Dt?["large","full","medium","thumbnail"]:["thumbnail","medium","large","full"],s=r?(0,l.createElement)(gS,{className:"edit-site-page-pages__featured-image",id:e.featured_media,size:a}):null;return t===Lt?s:(0,l.createElement)("button",{className:_()("page-pages-preview-field__button",{"edit-site-page-pages__media-wrapper":t===Vt}),type:"button",onClick:n,"aria-label":e.title?.rendered||(0,E.__)("(no title)")},s)}function xS(){const e="page",[t,n]=function(e){const{params:t}=yS(),{activeView:n="all",isCustom:r="false",layout:a}=t,s=vS(),i=(0,g.useMemo)((()=>{const t="false"===r&&Xl[e].find((({slug:e})=>e===n))?.view;return"false"===r&&a?{...t,type:a,layout:{...Yl[a]||{}}}:t}),[r,n,a,e]),[o,l]=(0,g.useState)(i);(0,g.useEffect)((()=>{i&&l(i)}),[i]);const c=(0,m.useSelect)((e=>{if("true"!==r)return;const{getEditedEntityRecord:t}=e(ye.store);return t("postType","wp_dataviews",Number(n))}),[n,r]),{editEntityRecord:u}=(0,m.useDispatch)(ye.store),d=(0,g.useMemo)((()=>{const e=c?.content&&JSON.parse(c?.content);return e?{...e,layout:{...Yl[e?.type]||{}}}:e}),[c?.content]),p=(0,g.useCallback)((e=>{u("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)})}),[u,c?.id]),h=(0,g.useCallback)((e=>{e.type!==o?.type&&s.push({...t,layout:e.type}),l(e)}),[t,o?.type,s]);return"false"===r?[o,h]:"true"===r&&d?[d,p]:[Xl[e][0].view,h]}(e),r=vS(),{params:a}=yS(),{isCustom:s="false"}=a,i=(0,g.useCallback)((e=>{"false"===s&&t?.type===Lt&&r.push({...a,postId:1===e.length?e[0].id:void 0})}),[r,a,t?.type,s]),o=(0,g.useMemo)((()=>{const e={};return t.filters.forEach((t=>{"status"===t.field&&t.operator===zt&&(e.status=t.value),"author"===t.field&&t.operator===zt?e.author=t.value:"author"===t.field&&t.operator===Ht&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status=wS),{per_page:t.perPage,page:t.page,_embed:"author",order:t.sort?.direction,orderby:t.sort?.field,search:t.search,...e}}),[t]),{records:c,isResolving:u,totalItems:d,totalPages:p}=(0,ye.useEntityRecords)("postType",e,o),{records:h,isResolving:f}=(0,ye.useEntityRecords)("root","user"),y=(0,g.useMemo)((()=>({totalItems:d,totalPages:p})),[d,p]),v=(0,g.useMemo)((()=>[{id:"featured-image",header:(0,E.__)("Featured Image"),getValue:({item:e})=>e.featured_media,render:({item:e})=>(0,l.createElement)(SS,{item:e,viewType:t.type}),enableSorting:!1,width:"1%"},{header:(0,E.__)("Title"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>[Vt,Dt].includes(t.type)?(0,l.createElement)(wt,{params:{postId:e.id,postType:e.type,canvas:"edit"}},(0,en.decodeEntities)(e.title?.rendered)||(0,E.__)("(no title)")):(0,en.decodeEntities)(e.title?.rendered)||(0,E.__)("(no title)"),maxWidth:300,enableHiding:!1},{header:(0,E.__)("Author"),id:"author",getValue:({item:e})=>e._embedded?.author[0]?.name,type:Bt,elements:h?.map((({id:e,name:t})=>({value:e,label:t})))||[]},{header:(0,E.__)("Status"),id:"status",getValue:({item:e})=>{var t;return null!==(t=ES.find((({value:t})=>t===e.status))?.label)&&void 0!==t?t:e.status},type:Bt,elements:ES,enableSorting:!1,filterBy:{operators:[zt]}},{header:(0,E.__)("Date"),id:"date",getValue:({item:e})=>e.date,render:({item:e})=>{const t=(0,_a.dateI18n)((0,_a.getSettings)().formats.datetimeAbbreviated,(0,_a.getDate)(e.date));return(0,l.createElement)("time",null,t)}}]),[h,t.type]),_=function(){const{createSuccessNotice:e,createErrorNotice:t}=(0,m.useDispatch)(ge.store),{deleteEntityRecord:n}=(0,m.useDispatch)(ye.store);return(0,g.useMemo)((()=>({id:"permanently-delete",label:(0,E.__)("Permanently delete"),isPrimary:!0,icon:ql,supportsBulk:!0,isEligible:({status:e})=>"trash"===e,async callback(r){const a=await Promise.allSettled(r.map((e=>n("postType",e.type,e.id,{force:!0},{throwOnError:!0}))));if(a.every((({status:e})=>"fulfilled"===e))){let t;t=1===a.length?(0,E.sprintf)((0,E.__)('"%s" permanently deleted.'),(0,en.decodeEntities)(r[0].title.rendered)):(0,E.__)("The posts were permanently deleted."),e(t,{type:"snackbar",id:"edit-site-post-permanently-deleted"})}else{let e;if(1===a.length)e=a[0].reason?.message?a[0].reason.message:(0,E.__)("An error occurred while permanently deleting the post.");else{const n=new Set,r=a.filter((({status:e})=>"rejected"===e));for(const e of r)e.reason?.message&&n.add(e.reason.message);e=0===n.size?(0,E.__)("An error occurred while permanently deleting the posts."):1===n.size?(0,E.sprintf)((0,E.__)("An error occurred while permanently deleting the posts: %s"),[...n][0]):(0,E.sprintf)((0,E.__)("Some errors occurred while permanently deleting the posts: %s"),[...n].join(",")),t(e,{type:"snackbar"})}}}})),[e,t,n])}(),w=function(){const{createSuccessNotice:e,createErrorNotice:t}=(0,m.useDispatch)(ge.store),{editEntityRecord:n,saveEditedEntityRecord:r}=(0,m.useDispatch)(ye.store);return(0,g.useMemo)((()=>({id:"restore",label:(0,E.__)("Restore"),isPrimary:!0,icon:ba,supportsBulk:!0,isEligible:({status:e})=>"trash"===e,async callback(a){try{for(const e of a)await n("postType",e.type,e.id,{status:"draft"}),await r("postType",e.type,e.id,{throwOnError:!0});e(a.length>1?(0,E.sprintf)((0,E.__)("%d posts have been restored."),a.length):(0,E.sprintf)((0,E.__)('"%s" has been restored.'),(0,en.decodeEntities)(a[0].title.rendered)),{type:"snackbar",id:"edit-site-post-restored"})}catch(e){let n;n=e.message&&"unknown_error"!==e.code&&e.message?e.message:a.length>1?(0,E.__)("An error occurred while restoring the posts."):(0,E.__)("An error occurred while restoring the post."),t(n,{type:"snackbar"})}}})),[e,t,n,r])}(),S=function(){const e=mS();return(0,g.useMemo)((()=>({id:"edit-post",label:(0,E.__)("Edit"),isEligible:({status:e})=>"trash"!==e,callback(t){const n=t[0];e.push({postId:n.id,postType:n.type,canvas:"edit"})}})),[e])}(),x=(0,g.useMemo)((()=>[hS,pS,w,_,S,fS]),[_,w,S]),C=(0,g.useCallback)((e=>{e.type!==t.type&&(e={...e,layout:{...Yl[e.type]}}),n(e)}),[t.type,n]),[k,T]=(0,g.useState)(!1),P=(0,g.useCallback)((()=>{k||T(!0)}),[k]),I=(0,g.useCallback)((()=>{k&&T(!1)}),[k]),M=(0,g.useCallback)((({type:e,id:t})=>{r.push({postId:t,postType:e,canvas:"edit"}),I()}),[r]);return(0,l.createElement)(dS,{title:(0,E.__)("Pages"),actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.Button,{variant:"primary",onClick:P},(0,E.__)("Add new page")),k&&(0,l.createElement)(Hl,{onSave:M,onClose:I}))},(0,l.createElement)(cS,{paginationInfo:y,fields:v,actions:x,data:c||_S,isLoading:u||f,view:t,onChangeView:C,onSelectionChange:i,supportedLayouts:bS}))}const CS=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{d:"M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),kS=(0,l.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(w.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),TS=(0,l.createElement)(w.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(w.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"})),PS=window.wp.reusableBlocks,{useHistory:IS}=Xe(gt.privateApis),{CreatePatternModalContents:MS,useDuplicatePatternProps:AS}=Xe(St.privateApis),OS={id:"export-pattern",label:(0,E.__)("Export as JSON"),isEligible:e=>e.type===It.user,callback:([e])=>{const t={__file:e.type,title:e.title||e.name,content:e.patternPost.content.raw,syncStatus:e.patternPost.wp_pattern_sync_status};return(0,Zc.downloadBlob)(`${bs(e.title||e.name)}.json`,JSON.stringify(t,null,2),"application/json")}},NS={id:"rename-pattern",label:(0,E.__)("Rename"),isEligible:e=>{const t=e.type===kt,n=e.type===It.user||t&&e.isCustom,r=t&&e.templatePart.has_theme_file;return n&&!r},RenderModal:({items:e,closeModal:t})=>{const[n]=e,[r,a]=(0,g.useState)((()=>n.title)),{editEntityRecord:s,saveEditedEntityRecord:i}=(0,m.useDispatch)(ye.store),{createSuccessNotice:o,createErrorNotice:c}=(0,m.useDispatch)(ge.store);return(0,l.createElement)("form",{onSubmit:async function(e){e.preventDefault();try{await s("postType",n.type,n.id,{title:r}),a(""),t(),await i("postType",n.type,n.id,{throwOnError:!0}),o(n.type===kt?(0,E.__)("Template part renamed."):(0,E.__)("Pattern renamed."),{type:"snackbar"})}catch(e){const t=n.type===kt?(0,E.__)("An error occurred while renaming the template part."):(0,E.__)("An error occurred while renaming the pattern."),r=e.message&&"unknown_error"!==e.code?e.message:t;c(r,{type:"snackbar"})}}},(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,E.__)("Name"),value:r,onChange:a,required:!0}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:()=>{t()}},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,E.__)("Save")))))}},FS=e=>{const t=e.type===kt;return e.type===It.user||t&&e.isCustom},RS={id:"delete-pattern",label:(0,E.__)("Delete"),isEligible:e=>{const t=e.type===kt&&e.templatePart.has_theme_file;return FS(e)&&!t},hideModalHeader:!0,supportsBulk:!0,RenderModal:({items:e,closeModal:t,onPerform:n})=>{const{__experimentalDeleteReusableBlock:r}=(0,m.useDispatch)(PS.store),{createErrorNotice:a,createSuccessNotice:s}=(0,m.useDispatch)(ge.store),{removeTemplates:i}=Xe((0,m.useDispatch)(tr));let o;return o=1===e.length?(0,E.sprintf)((0,E.__)('Are you sure you want to delete "%s"?'),(0,en.decodeEntities)(e[0].title||e[0].name)):e.length>1&&e[0].type===kt?(0,E.sprintf)((0,E.__)("Are you sure you want to delete %d template parts?"),e.length):(0,E.sprintf)((0,E.__)("Are you sure you want to delete %d patterns?"),e.length),(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.__experimentalText,null,o),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",onClick:()=>{e[0].type===kt?i(e):(async()=>{const t=await Promise.allSettled(e.map((e=>r(e.id))));if(t.every((({status:e})=>"fulfilled"===e))){let n;n=1===t.length?(0,E.sprintf)((0,E.__)('"%s" deleted.'),e[0].title):(0,E.__)("The patterns were deleted."),s(n,{type:"snackbar",id:"edit-site-page-trashed"})}else{let e;if(1===t.length)e=t[0].reason?.message?t[0].reason.message:(0,E.__)("An error occurred while deleting the pattern.");else{const n=new Set,r=t.filter((({status:e})=>"rejected"===e));for(const e of r)e.reason?.message&&n.add(e.reason.message);e=0===n.size?(0,E.__)("An error occurred while deleting the patterns."):1===n.size?(0,E.sprintf)((0,E.__)("An error occurred while deleting the patterns: %s"),[...n][0]):(0,E.sprintf)((0,E.__)("Some errors occurred while deleting the patterns: %s"),[...n].join(",")),a(e,{type:"snackbar"})}}})(),n&&n(),t()}},(0,E.__)("Delete"))))}},DS={id:"reset-action",label:(0,E.__)("Clear customizations"),isEligible:e=>{const t=e.type===kt&&e.templatePart.has_theme_file;return FS(e)&&t},hideModalHeader:!0,RenderModal:({items:e,closeModal:t})=>{const[n]=e,{removeTemplate:r}=(0,m.useDispatch)(tr);return(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.__experimentalText,null,(0,E.__)("Are you sure you want to clear these customizations?")),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",onClick:()=>r(n)},(0,E.__)("Clear"))))}},VS={id:"duplicate-pattern",label:(0,E._x)("Duplicate","action label"),isEligible:e=>e.type!==kt,modalHeader:(0,E._x)("Duplicate pattern","action label"),RenderModal:({items:e,closeModal:t})=>{const[n]=e,{categoryId:r=Mt}=(0,yt.getQueryArgs)(window.location.href),a=n.type===It.theme,s=IS();const i=AS({pattern:a?n:n.patternPost,onSuccess:function({pattern:e}){s.push({categoryType:It.theme,categoryId:r,postType:It.user,postId:e.id}),t()}});return(0,l.createElement)(MS,{onClose:t,confirmLabel:(0,E._x)("Duplicate","action label"),...i})}},LS={id:"duplicate-template-part",label:(0,E._x)("Duplicate","action label"),isEligible:e=>e.type===kt,modalHeader:(0,E._x)("Duplicate template part","action label"),RenderModal:({items:e,closeModal:t})=>{const[n]=e,{createSuccessNotice:r}=(0,m.useDispatch)(ge.store),{categoryId:a=Mt}=(0,yt.getQueryArgs)(window.location.href),s=IS();return(0,l.createElement)(ti,{blocks:n.blocks,defaultArea:n.templatePart.area,defaultTitle:(0,E.sprintf)((0,E.__)("%s (Copy)"),n.title),onCreate:async function(e){r((0,E.sprintf)((0,E.__)('"%s" duplicated.'),n.title),{type:"snackbar",id:"edit-site-patterns-success"}),s.push({postType:kt,postId:e?.id,categoryType:kt,categoryId:a}),t()},onError:t,confirmLabel:(0,E._x)("Duplicate","action label")})}};function BS(){var e;const t=(0,m.useSelect)((e=>{const{getSettings:t}=Xe(e(tr));return t()}),[]),n=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,r=(0,m.useSelect)((e=>e(ye.store).getBlockPatterns()),[]),a=(0,g.useMemo)((()=>[...n||[],...r||[]].filter(li)),[n,r]);return(0,g.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...n}=t;return{...n,__experimentalBlockPatterns:a,__unstableIsPreviewMode:!0}}),[t,a])}const{RenamePatternCategoryModal:zS}=Xe(St.privateApis);function HS({category:e,onClose:t}){const[n,r]=(0,g.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{onClick:()=>r(!0)},(0,E.__)("Rename")),n&&(0,l.createElement)(GS,{category:e,onClose:()=>{r(!1),t()}}))}function GS({category:e,onClose:t}){const n={id:e.id,slug:e.slug,name:e.label},r=Oi();return(0,l.createElement)(zS,{category:n,existingCategories:r,onClose:t,overlayClassName:"edit-site-list__rename-modal"})}const{useHistory:US}=Xe(gt.privateApis);function WS({category:e,onClose:t}){const[n,r]=(0,g.useState)(!1),a=US(),{createSuccessNotice:s,createErrorNotice:i}=(0,m.useDispatch)(ge.store),{deleteEntityRecord:o,invalidateResolution:c}=(0,m.useDispatch)(ye.store);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.MenuItem,{isDestructive:!0,onClick:()=>r(!0)},(0,E.__)("Delete")),(0,l.createElement)(b.__experimentalConfirmDialog,{isOpen:n,onConfirm:async()=>{try{await o("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",It.user,{per_page:-1}]),s((0,E.sprintf)((0,E.__)('"%s" deleted.'),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),a.push({path:"/patterns",categoryType:It.theme,categoryId:Mt})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while deleting the pattern category.");i(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>r(!1),confirmButtonText:(0,E.__)("Delete"),className:"edit-site-patterns__delete-modal"},(0,E.sprintf)((0,E.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,en.decodeEntities)(e.label))))}function jS({categoryId:e,type:t,titleId:n,descriptionId:r}){const{patternCategories:a}=Oi(),s=(0,m.useSelect)((e=>e(y.store).__experimentalGetDefaultTemplatePartAreas()),[]);let i,o,c;if(t===kt){const t=s.find((t=>t.area===e));i=t?.label,o=t?.description}else t===It.theme&&(c=a.find((t=>t.name===e)),i=c?.label,o=c?.description);return i?(0,l.createElement)(b.__experimentalVStack,{className:"edit-site-patterns__section-header"},(0,l.createElement)(b.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(b.__experimentalHeading,{as:"h2",level:4,id:n},i),!!c?.id&&(0,l.createElement)(b.DropdownMenu,{icon:ue,label:(0,E.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",describedBy:(0,E.sprintf)((0,E.__)("Action menu for %s pattern category"),i)}},(({onClose:e})=>(0,l.createElement)(b.MenuGroup,null,(0,l.createElement)(HS,{category:c,onClose:e}),(0,l.createElement)(WS,{category:c,onClose:e}))))),o?(0,l.createElement)(b.__experimentalText,{variant:"muted",as:"p",id:r},o):null):null}const{ExperimentalBlockEditorProvider:ZS,useGlobalStyle:qS}=Xe(fe.privateApis),YS={header:CS,footer:kS,uncategorized:Ks},KS=[],XS={[Dt]:{mediaField:"preview",primaryField:"title"}},JS={type:Dt,search:"",page:1,perPage:20,hiddenFields:["sync-status"],layout:{...XS[Dt]},filters:[]},QS=[{value:Nt.full,label:(0,E._x)("Synced","Option that shows all synchronized patterns"),description:(0,E.__)("Patterns that are kept in sync across the site.")},{value:Nt.unsynced,label:(0,E._x)("Not synced","Option that shows all patterns that are not synchronized"),description:(0,E.__)("Patterns that can be changed freely without affecting the site.")}];function $S({item:e,onClick:t,ariaDescribedBy:n,children:r}){return e.type===It.theme?r:(0,l.createElement)("button",{className:"page-patterns-preview-field__button",type:"button",onClick:t,"aria-label":e.title,"aria-describedby":n},r)}function ex({item:e,categoryId:t,viewType:n}){const r=(0,g.useId)(),a=e.type===It.user,s=e.type===It.theme,i=e.type===kt,o=!e.blocks?.length,c=[];a||i&&e.isCustom?c.push((0,E.__)("Press Enter to edit, or Delete to delete the pattern.")):e.description&&c.push(e.description),s&&c.push((0,E.__)("Theme & plugin patterns cannot be edited."));const[u]=qS("color.background"),{onClick:d}=Et({postType:e.type,postId:a?e.id:e.name,categoryId:t,categoryType:i?e.type:It.theme});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:`page-patterns-preview-field is-viewtype-${n}`,style:{backgroundColor:u}},(0,l.createElement)($S,{item:e,onClick:d,ariaDescribedBy:c.length?c.map(((e,t)=>`${r}-${t}`)).join(" "):void 0},o&&i&&(0,E.__)("Empty template part"),o&&!i&&(0,E.__)("Empty pattern"),!o&&(0,l.createElement)(fe.BlockPreview,{blocks:e.blocks}))),c.map(((e,t)=>(0,l.createElement)("div",{key:t,hidden:!0,id:`${r}-${t}`},e))))}function tx({item:e,categoryId:t}){const n=e.type===It.user,r=e.type===It.theme,a=e.type===kt;let s;const{onClick:i}=Et({postType:e.type,postId:n?e.id:e.name,categoryId:t,categoryType:a?e.type:It.theme});return s=!n&&YS[t]?YS[t]:e.syncStatus===Nt.full?cr:void 0,(0,l.createElement)(b.__experimentalHStack,{alignment:"center",justify:"flex-start",spacing:2},(0,l.createElement)(b.Flex,{as:"div",gap:0,justify:"left",className:"edit-site-patterns__pattern-title"},e.type===It.theme?e.title:(0,l.createElement)(b.Button,{variant:"link",onClick:i,tabIndex:"-1"},e.title||e.name)),s&&!r&&(0,l.createElement)(b.Tooltip,{placement:"top",text:(0,E.__)("Editing this pattern will also update anywhere it is used")},(0,l.createElement)(fr,{className:"edit-site-patterns__pattern-icon",icon:s})),e.type===It.theme&&(0,l.createElement)(b.Tooltip,{placement:"top",text:(0,E.__)("This pattern cannot be edited.")},(0,l.createElement)(fr,{className:"edit-site-patterns__pattern-lock-icon",icon:TS,size:24})))}function nx(){const{categoryType:e,categoryId:t=Mt}=(0,yt.getQueryArgs)(window.location.href),n=e||It.theme,[r,a]=(0,g.useState)(JS),s=n===It.theme&&"uncategorized"===t,i=(0,ie.usePrevious)(t),o=r.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:c,isResolving:u}=Ai(n,s?"":t,{search:r.search,syncStatus:o}),d=(0,g.useMemo)((()=>{const e=[{header:(0,E.__)("Preview"),id:"preview",render:({item:e})=>(0,l.createElement)(ex,{item:e,categoryId:t,viewType:r.type}),enableSorting:!1,enableHiding:!1},{header:(0,E.__)("Title"),id:"title",getValue:({item:e})=>e.title,render:({item:e})=>(0,l.createElement)(tx,{item:e,categoryId:t}),enableHiding:!1}];return n===It.theme&&e.push({header:(0,E.__)("Sync Status"),id:"sync-status",render:({item:e})=>QS.find((({value:t})=>t===e.syncStatus))?.label||QS.find((({value:e})=>e===Nt.unsynced)).label,type:Bt,elements:QS,filterBy:{operators:[zt],isPrimary:!0},enableSorting:!1}),e}),[r.type,t,n]);(0,g.useEffect)((()=>{i!==t&&a(JS)}),[t,i]);const{data:m,paginationInfo:p}=(0,g.useMemo)((()=>{if(!c)return{data:KS,paginationInfo:{totalItems:0,totalPages:0}};let e=[...c];return r.sort&&(e=Ko({data:e,view:r,fields:d,textFields:["title","author"]})),Xo({data:e,view:r})}),[c,r,d]),h=(0,g.useMemo)((()=>[NS,VS,LS,OS,DS,RS]),[]),f=(0,g.useCallback)((e=>{e.type!==r.type&&(e={...e,layout:{...XS[e.type]}}),a(e)}),[r.type,a]),y=(0,g.useId)(),v=BS();return(0,l.createElement)(ZS,{settings:v},(0,l.createElement)(dS,{title:(0,E.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0},(0,l.createElement)(jS,{categoryId:t,type:n,titleId:`${y}-title`,descriptionId:`${y}-description`}),(0,l.createElement)(cS,{paginationInfo:p,fields:d,actions:h,data:m||KS,getItemId:e=>e.name,isLoading:u,view:r,onChangeView:f,deferredRendering:!0,supportedLayouts:[Dt]})))}const rx={id:"delete-template",label:(0,E.__)("Delete"),isPrimary:!0,icon:ql,isEligible:Hs,supportsBulk:!0,hideModalHeader:!0,RenderModal:({items:e,closeModal:t,onPerform:n})=>{const{removeTemplates:r}=Xe((0,m.useDispatch)(tr));return(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.__experimentalText,null,e.length>1?(0,E.sprintf)((0,E._n)("Delete %d item?","Delete %d items?",e.length),e.length):(0,E.sprintf)((0,E.__)('Delete "%s"?'),(0,en.decodeEntities)(e?.[0]?.title?.rendered))),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",onClick:async()=>{await r(e,{allowUndo:!1}),n&&n(),t()}},(0,E.__)("Delete"))))}},ax={id:"rename-template",label:(0,E.__)("Rename"),isEligible:e=>!(!Hs(e)||e.type===Ct&&!e.is_custom),RenderModal:({items:e,closeModal:t})=>{const n=e[0],r=(0,en.decodeEntities)(n.title.rendered),[a,s]=(0,g.useState)(r),{editEntityRecord:i,__experimentalSaveSpecifiedEntityEdits:o}=(0,m.useDispatch)(ye.store),{createSuccessNotice:c,createErrorNotice:u}=(0,m.useDispatch)(ge.store);return(0,l.createElement)("form",{onSubmit:async function(e){e.preventDefault();try{await i("postType",n.type,n.id,{title:a}),s(""),t(),await o("postType",n.type,n.id,["title"],{throwOnError:!0}),c(n.type===Ct?(0,E.__)("Template renamed."):(0,E.__)("Template part renamed."),{type:"snackbar"})}catch(e){const t=n.type===Ct?(0,E.__)("An error occurred while renaming the template."):(0,E.__)("An error occurred while renaming the template part."),r=e.message&&"unknown_error"!==e.code?e.message:t;u(r,{type:"snackbar"})}}},(0,l.createElement)(b.__experimentalVStack,{spacing:"5"},(0,l.createElement)(b.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:a,onChange:s,required:!0}),(0,l.createElement)(b.__experimentalHStack,{justify:"right"},(0,l.createElement)(b.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(b.Button,{variant:"primary",type:"submit"},(0,E.__)("Save")))))}},{useHistory:sx}=Xe(gt.privateApis);function ix(){const{canCreate:e,postType:t}=(0,m.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(tr).getSettings();return{canCreate:!t,postType:e(ye.store).getPostType(kt)}}),[]),[n,r]=(0,g.useState)(!1),a=sx();return e&&t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.Button,{variant:"primary",onClick:()=>r(!0)},t.labels.add_new_item),n&&(0,l.createElement)(ei,{closeModal:()=>r(!1),blocks:[],onCreate:e=>{r(!1),a.push({postId:e.id,postType:kt,canvas:"edit"})},onError:()=>r(!1)})):null}const{ExperimentalBlockEditorProvider:ox,useGlobalStyle:lx}=Xe(fe.privateApis),{useHistory:cx,useLocation:ux}=Xe(gt.privateApis),dx=[],mx=window?.__experimentalAdminViews?[Vt,Dt,Lt]:[Vt,Dt],px={[Vt]:{primaryField:"title"},[Dt]:{mediaField:"preview",primaryField:"title"},[Lt]:{primaryField:"title",mediaField:"preview"}},hx={type:Vt,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},hiddenFields:["preview"],layout:px[Vt],filters:[]};function fx(e=""){return hi()(e.trim().toLowerCase())}function gx({item:e,viewType:t}){if(t===Lt)return(0,en.decodeEntities)(e.title?.rendered)||(0,E.__)("(no title)");const n={params:{postId:e.id,postType:e.type,canvas:"edit"}};return e.type===kt&&(n.state={backPath:"/wp_template_part/all"}),(0,l.createElement)(wt,{...n},(0,en.decodeEntities)(e.title?.rendered)||(0,E.__)("(no title)"))}function yx({item:e,viewType:t}){const{text:n,icon:r,imageUrl:a}=Bs(e.type,e.id),s=t!==Lt;return(0,l.createElement)(b.__experimentalHStack,{alignment:"left",spacing:1},s&&a&&(0,l.createElement)(zs,{imageUrl:a}),s&&!a&&(0,l.createElement)("div",{className:"edit-site-list-added-by__icon"},(0,l.createElement)(b.Icon,{icon:r})),(0,l.createElement)("span",null,n))}function vx({item:e,viewType:t}){const n=BS(),[r="white"]=lx("color.background"),a=(0,g.useMemo)((()=>(0,u.parse)(e.content.raw)),[e.content.raw]),{onClick:s}=Et({postId:e.id,postType:e.type,canvas:"edit"}),i=!a?.length;return(0,l.createElement)(ox,{settings:n},(0,l.createElement)("div",{className:`page-templates-preview-field is-viewtype-${t}`,style:{backgroundColor:r}},t===Lt&&!i&&(0,l.createElement)(fe.BlockPreview,{blocks:a}),t!==Lt&&(0,l.createElement)("button",{className:"page-templates-preview-field__button",type:"button",onClick:s,"aria-label":e.title?.rendered||e.title},i&&(e.type===Ct?(0,E.__)("Empty template"):(0,E.__)("Empty template part")),!i&&(0,l.createElement)(fe.BlockPreview,{blocks:a}))))}function _x({postType:e}){const{params:t}=ux(),{activeView:n="all",layout:r}=t,a=(0,g.useMemo)((()=>{const e=window?.__experimentalAdminViews&&null!=r?r:hx.type;return{...hx,type:e,layout:px[e],filters:"all"!==n?[{field:"author",operator:"in",value:n}]:[]}}),[r,n]),[s,i]=(0,g.useState)(a);(0,g.useEffect)((()=>{i((e=>({...e,filters:"all"!==n?[{field:"author",operator:"in",value:n}]:[]})))}),[n]);const{records:o,isResolving:c}=(0,ye.useEntityRecords)("postType",e,{per_page:-1}),u=cx(),d=(0,g.useCallback)((e=>{s?.type===Lt&&u.push({...t,postId:1===e.length?e[0].id:void 0})}),[u,t,s?.type]),p=(0,g.useMemo)((()=>{if(!o)return dx;const e=new Set;return o.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[o]),h=(0,g.useMemo)((()=>{const t=[{header:(0,E.__)("Preview"),id:"preview",render:({item:e})=>(0,l.createElement)(vx,{item:e,viewType:s.type}),minWidth:120,maxWidth:120,enableSorting:!1},{header:e===Ct?(0,E.__)("Template"):(0,E.__)("Template Part"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>(0,l.createElement)(gx,{item:e,viewType:s.type}),maxWidth:400,enableHiding:!1}];return e===Ct&&t.push({header:(0,E.__)("Description"),id:"description",getValue:({item:e})=>e.description,render:({item:e})=>e.description?(0,l.createElement)("span",{className:"page-templates-description"},(0,en.decodeEntities)(e.description)):s.type===Vt&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.__experimentalText,{variant:"muted","aria-hidden":"true"},"—"),(0,l.createElement)(b.VisuallyHidden,null,(0,E.__)("No description."))),maxWidth:400,minWidth:320,enableSorting:!1}),t.push({header:(0,E.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:({item:e})=>(0,l.createElement)(yx,{viewType:s.type,item:e}),type:Bt,elements:p,width:"1%"}),t}),[e,p,s.type]),{data:f,paginationInfo:y}=(0,g.useMemo)((()=>{if(!o)return{data:dx,paginationInfo:{totalItems:0,totalPages:0}};let e=[...o];if(s.search){const t=fx(s.search);e=e.filter((e=>fx(e.title?.rendered||e.slug).includes(t)||fx(e.description).includes(t)))}return s.filters.length>0&&s.filters.forEach((t=>{"author"===t.field&&t.operator===zt&&t.value?e=e.filter((e=>e.author_text===t.value)):"author"===t.field&&t.operator===Ht&&t.value&&(e=e.filter((e=>e.author_text!==t.value)))})),s.sort&&(e=Ko({data:e,view:s,fields:h,textFields:["title","author"]})),Xo({data:e,view:s})}),[o,s,h]),v=function(){const{revertTemplate:e}=(0,m.useDispatch)(tr),{saveEditedEntityRecord:t}=(0,m.useDispatch)(ye.store),{createSuccessNotice:n,createErrorNotice:r}=(0,m.useDispatch)(ge.store);return(0,g.useMemo)((()=>({id:"reset-template",label:(0,E.__)("Reset"),isPrimary:!0,icon:ba,isEligible:$t,supportsBulk:!0,async callback(a){try{for(const n of a)await e(n,{allowUndo:!1}),await t("postType",n.type,n.id);n(a.length>1?(0,E.sprintf)((0,E.__)("%s items reverted."),a.length):(0,E.sprintf)((0,E.__)('"%s" reverted.'),(0,en.decodeEntities)(a[0].title.rendered)),{type:"snackbar",id:"edit-site-template-reverted"})}catch(e){let t;t=a[0].type===Ct?1===a.length?(0,E.__)("An error occurred while reverting the template."):(0,E.__)("An error occurred while reverting the templates."):1===a.length?(0,E.__)("An error occurred while reverting the template part."):(0,E.__)("An error occurred while reverting the template parts.");const n=e.message&&"unknown_error"!==e.code?e.message:t;r(n,{type:"snackbar"})}}})),[r,n,e,t])}(),_=(0,g.useMemo)((()=>[v,rx,ax,fS]),[v]),w=(0,g.useCallback)((e=>{e.type!==s.type&&(e={...e,layout:{...px[e.type]}},u.push({...t,layout:e.type})),i(e)}),[s.type,i,u,t]);return(0,l.createElement)(dS,{className:"edit-site-page-template-template-parts-dataviews",title:e===Ct?(0,E.__)("Templates"):(0,E.__)("Template Parts"),actions:e===Ct?(0,l.createElement)(Is,{templateType:e,showIcon:!1,toggleProps:{variant:"primary"}}):(0,l.createElement)(ix,null)},(0,l.createElement)(cS,{paginationInfo:y,fields:h,actions:_,data:f,isLoading:c,view:s,onChangeView:w,onSelectionChange:d,deferredRendering:!s.hiddenFields?.includes("preview"),supportedLayouts:mx}))}const{useLocation:bx}=Xe(gt.privateApis);const{useCommands:Ex}=Xe(ar.privateApis),{useCommandContext:wx}=Xe(rr.privateApis),{useGlobalStyle:Sx}=Xe(fe.privateApis),xx=.5;function Cx(){Bi(),function(){const e=yu(),{params:t}=gu(),n=(0,m.useSelect)((e=>Xe(e(tr)).getCanvasMode()),[]),{setCanvasMode:r}=Xe((0,m.useDispatch)(tr)),a=(0,g.useRef)(n),{canvas:s}=t,i=(0,g.useRef)(s),o=(0,g.useRef)(t);(0,g.useEffect)((()=>{o.current=t}),[t]),(0,g.useEffect)((()=>{a.current=n,"init"!==n&&("edit"===n&&i.current!==n&&e.push({...o.current,canvas:"edit"}),"view"===n&&void 0!==i.current&&e.push({...o.current,canvas:void 0}))}),[n,e]),(0,g.useEffect)((()=>{i.current=s,"edit"!==s&&"view"!==a.current?r("view"):"edit"===s&&"edit"!==a.current&&r("edit")}),[s,r])}(),Ex(),(0,rr.useCommandLoader)({name:"core/exit-code-editor",hook:ed,context:"site-editor-edit"}),(0,rr.useCommandLoader)({name:"core/edit-site/page-content-focus",hook:$u,context:"site-editor-edit"}),(0,rr.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:td}),(0,rr.useCommandLoader)({name:"core/edit-site/patterns",hook:rd,context:"site-editor-edit"}),(0,rr.useCommandLoader)({name:"core/edit-site/edit-ui",hook:nd}),function(){const e=(0,m.useSelect)((e=>{const{getUnstableBase:t}=e(ye.store);return t()?.home}),[]);(0,rr.useCommand)({name:"core/edit-site/view-site",label:(0,E.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:Ic}),(0,rr.useCommandLoader)({name:"core/edit-site/open-styles",hook:Fu}),(0,rr.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:Ru}),(0,rr.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Du}),(0,rr.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:Vu}),(0,rr.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:Lu})}(),(0,fe.useBlockCommands)();const e=(0,ie.useViewportMatch)("medium","<"),{isDistractionFree:t,hasFixedToolbar:n,hasBlockSelected:r,canvasMode:a,previousShortcut:s,nextShortcut:i}=(0,m.useSelect)((e=>{const{getAllShortcutKeyCombinations:t}=e(nr.store),{getCanvasMode:n}=Xe(e(tr));return{canvasMode:n(),previousShortcut:t("core/edit-site/previous-region"),nextShortcut:t("core/edit-site/next-region"),hasFixedToolbar:e(T.store).get("core","fixedToolbar"),isDistractionFree:e(T.store).get("core","distractionFree"),hasBlockSelected:e(fe.store).getBlockSelectionStart()}}),[]),o=(0,b.__unstableUseNavigateRegions)({previous:s,next:i}),c=(0,ie.useReducedMotion)(),[u,d]=(0,ie.useResizeObserver)(),[p]=(0,ie.useResizeObserver)(),h=sd(),[f,y]=(0,g.useState)(!1),{areas:v,widths:w}=function(){const e=sd(),{params:t}=bx(),{postType:n,postId:r,path:a,layout:s,isCustom:i,canvas:o}=null!=t?t:{};if("/page"===a)return{areas:{content:void 0,preview:(0,l.createElement)(l_,{isLoading:e}),mobile:"edit"===o?(0,l.createElement)(l_,{isLoading:e}):void 0},widths:{content:void 0}};const c="true"!==i&&"list"===s&&window?.__experimentalAdminViews;return"/pages"===a?{areas:{content:(0,l.createElement)(xS,null),preview:c&&(0,l.createElement)(l_,{isLoading:e})},widths:{content:c?380:void 0}}:n&&r?{areas:{preview:(0,l.createElement)(l_,{isLoading:e}),mobile:"edit"===o?(0,l.createElement)(l_,{isLoading:e}):void 0}}:"/wp_template/all"===a?{areas:{content:(0,l.createElement)(_x,{postType:Ct}),preview:c&&(0,l.createElement)(l_,{isLoading:e}),mobile:(0,l.createElement)(_x,{postType:Ct})},widths:{content:c?380:void 0}}:"/wp_template_part/all"===a?{areas:{content:(0,l.createElement)(_x,{postType:kt}),preview:c&&(0,l.createElement)(l_,{isLoading:e}),mobile:(0,l.createElement)(_x,{postType:kt})},widths:{content:c?380:void 0}}:"/patterns"===a?{areas:{content:(0,l.createElement)(nx,null),mobile:(0,l.createElement)(nx,null)}}:{areas:{preview:(0,l.createElement)(l_,{isLoading:e}),mobile:"edit"===o?(0,l.createElement)(l_,{isLoading:e}):void 0}}}();let S;S="view"===a?"view":t?"isDistractionFree":a;let x="site-editor";"edit"===a&&(x="site-editor-edit"),r&&(x="block-selection-edit"),wx(x);const[C]=Sx("color.background"),[k]=Sx("color.gradient");return"init"===a?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(rr.CommandMenu,null),(0,l.createElement)(xu,null),(0,l.createElement)(Cu,null),p,(0,l.createElement)("div",{...o,ref:o.ref,className:_()("edit-site-layout",o.className,{"is-distraction-free":t&&"edit"===a,"is-full-canvas":"edit"===a,"has-fixed-toolbar":n,"is-block-toolbar-visible":r})},(0,l.createElement)(b.__unstableMotion.div,{className:"edit-site-layout__header-container",variants:{isDistractionFree:{opacity:0,transition:{type:"tween",delay:.8,delayChildren:.8}},isDistractionFreeHovering:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},view:{opacity:1},edit:{opacity:1}},whileHover:t?"isDistractionFreeHovering":void 0,animate:S},(0,l.createElement)(lu,{isTransparent:f,className:"edit-site-layout__hub"}),(0,l.createElement)(b.__unstableAnimatePresence,{initial:!1},"edit"===a&&(0,l.createElement)(oe,{key:"header",className:"edit-site-layout__header",ariaLabel:(0,E.__)("Editor top bar"),as:b.__unstableMotion.div,variants:{isDistractionFree:{opacity:0,y:0},isDistractionFreeHovering:{opacity:1,y:0},view:{opacity:1,y:"-100%"},edit:{opacity:1,y:0}},exit:{y:"-100%"},initial:{opacity:t?1:0,y:t?0:"-100%"},transition:{type:"tween",duration:c?0:.2,ease:"easeOut"}},(0,l.createElement)(au,null)))),(0,l.createElement)("div",{className:"edit-site-layout__content"},(!e||e&&!v.mobile)&&(0,l.createElement)(oe,{ariaLabel:(0,E.__)("Navigation"),className:"edit-site-layout__sidebar-region"},(0,l.createElement)(b.__unstableAnimatePresence,null,"view"===a&&(0,l.createElement)(b.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:c||e?0:xx,ease:"easeOut"},className:"edit-site-layout__sidebar"},(0,l.createElement)(Sc,null)))),(0,l.createElement)(Su,null),e&&v.mobile&&(0,l.createElement)("div",{className:"edit-site-layout__mobile",style:{maxWidth:w?.content}},v.mobile),!e&&v.content&&"edit"!==a&&(0,l.createElement)("div",{className:"edit-site-layout__area",style:{maxWidth:w?.content}},v.content),!e&&v.preview&&(0,l.createElement)("div",{className:"edit-site-layout__canvas-container"},u,!!d.width&&(0,l.createElement)(b.__unstableMotion.div,{whileHover:"view"===a?{scale:1.005,transition:{duration:c?0:.5,ease:"easeOut"}}:{},initial:!1,layout:"position",className:_()("edit-site-layout__canvas",{"is-right-aligned":f}),transition:{type:"tween",duration:c?0:xx,ease:"easeOut"}},(0,l.createElement)(kc,null,(0,l.createElement)(fu,{isReady:!h,isFullWidth:"edit"===a,defaultSize:{width:d.width-24,height:d.height},isOversized:f,setIsOversized:y,innerContentStyle:{background:null!=k?k:C}},v.preview)))))))}const{RouterProvider:kx}=Xe(gt.privateApis);function Tx(){const{createErrorNotice:e}=(0,m.useDispatch)(ge.store);return(0,l.createElement)(b.SlotFillProvider,null,(0,l.createElement)(Ar,null,(0,l.createElement)(y.UnsavedChangesWarning,null),(0,l.createElement)(kx,null,(0,l.createElement)(Cx,null),(0,l.createElement)(Z.PluginArea,{onError:function(t){e((0,E.sprintf)((0,E.__)('The "%s" plugin has encountered an error and cannot be rendered.'),t))}}))))}function Px({className:e,...t}){return(0,l.createElement)(se,{panelClassName:e,className:"edit-site-sidebar-edit-mode",scope:"core/edit-site",...t})}function Ix(e){return(0,l.createElement)(ee,{__unstableExplicitMenuItem:!0,scope:"core/edit-site",...e})}const Mx=(0,ie.compose)((0,Z.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:b.MenuItem,icon:t.icon||e.icon,name:"core/edit-site/plugin-more-menu"}})))(Q);function Ax(e,t){const n=document.getElementById(e),r=(0,g.createRoot)(n);(0,m.dispatch)(u.store).reapplyBlockTypeFilters();const a=(0,d.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,d.registerCoreBlocks)(a),(0,m.dispatch)(u.store).setFreeformFallbackBlockName("core/html"),(0,me.registerLegacyWidgetBlock)({inserter:!1}),(0,me.registerWidgetGroupBlock)({inserter:!1}),(0,m.dispatch)(T.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,m.dispatch)(T.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1}),(0,m.dispatch)(j).setDefaultComplementaryArea("core/edit-site","edit-site/template"),(0,m.dispatch)(tr).updateSettings(t),(0,m.dispatch)(y.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas}),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),r.render((0,l.createElement)(Tx,null)),r}function Ox(){f()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=s})();