modern-text 1.9.2 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
- (function(H,te){typeof exports=="object"&&typeof module<"u"?te(exports):typeof define=="function"&&define.amd?define(["exports"],te):(H=typeof globalThis<"u"?globalThis:H||self,te(H.modernText={}))})(this,(function(H){"use strict";function te(r,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:i,x1:o,y1:s,stops:a}=ns(t,e.left,e.top,e.width,e.height),l=r.createLinearGradient(n,i,o,s);return a.forEach(c=>l.addColorStop(c.offset,c.color)),l}return t}function _e(r,t,e){r?.color&&(r.color=te(e,r.color,t)),r?.backgroundColor&&(r.backgroundColor=te(e,r.backgroundColor,t)),r?.textStrokeColor&&(r.textStrokeColor=te(e,r.textStrokeColor,t))}function ns(r,t,e,n,i){const o=r.match(/linear-gradient\((.+)\)$/)?.[1]??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),h=(Number(a.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(h),p=i*Math.cos(h);return{x0:t+n/2-u,y0:e+i/2+p,x1:t+n/2+u,y1:e+i/2-p,stops:Array.from(l).map(g=>{let f=g[2];return f.startsWith("(")?f=f.split(",").length>3?`rgba${f}`:`rgb${f}`:f=`#${f}`,{offset:Number(g[3].replace("%",""))/100,color:f}})}}function he(r){const{ctx:t,path:e,fontSize:n,clipRect:i}=r;t.save(),t.beginPath();const o=e.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*n:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(r.shadowOffsetX??0)*n,shadowOffsetY:(r.shadowOffsetY??0)*n,shadowBlur:(r.shadowBlur??0)*n,shadowColor:r.shadowColor};i&&(t.rect(i.left,i.top,i.width,i.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function mn(r,t,e){const{left:n,top:i,width:o,height:s}=e,a=r.canvas;a.dataset.viewBox=`${n} ${i} ${o} ${s}`,a.dataset.pixelRatio=String(t);const l=o,c=s;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(c*t)),a.style.width=`${l}px`,a.style.height=`${c}px`,r.clearRect(0,0,a.width,a.height),r.scale(t,t),r.translate(-n,-i)}function xn(r,t){const{paragraphs:e,computedStyle:n,glyphBox:i}=t;_e(n,i,r),e.forEach(o=>{_e(o.computedStyle,o.lineBox,r),o.fragments.forEach(s=>{_e(s.computedStyle,s.inlineBox,r)})})}var ut=Uint8Array,At=Uint16Array,_r=Int32Array,Xe=new ut([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ze=new ut([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tr=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vn=function(r,t){for(var e=new At(31),n=0;n<31;++n)e[n]=t+=1<<r[n-1];for(var i=new _r(e[30]),n=1;n<30;++n)for(var o=e[n];o<e[n+1];++o)i[o]=o-e[n]<<5|n;return{b:e,r:i}},wn=vn(Xe,2),bn=wn.b,kr=wn.r;bn[28]=258,kr[258]=28;for(var Sn=vn(Ze,0),is=Sn.b,Cn=Sn.r,Ar=new At(32768),K=0;K<32768;++K){var ee=(K&43690)>>1|(K&21845)<<1;ee=(ee&52428)>>2|(ee&13107)<<2,ee=(ee&61680)>>4|(ee&3855)<<4,Ar[K]=((ee&65280)>>8|(ee&255)<<8)>>1}for(var Rt=(function(r,t,e){for(var n=r.length,i=0,o=new At(t);i<n;++i)r[i]&&++o[r[i]-1];var s=new At(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(e){a=new At(1<<t);var l=15-t;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],h=t-r[i],u=s[r[i]-1]++<<h,p=u|(1<<h)-1;u<=p;++u)a[Ar[u]>>l]=c}else for(a=new At(n),i=0;i<n;++i)r[i]&&(a[i]=Ar[s[r[i]-1]++]>>15-r[i]);return a}),re=new ut(288),K=0;K<144;++K)re[K]=8;for(var K=144;K<256;++K)re[K]=9;for(var K=256;K<280;++K)re[K]=7;for(var K=280;K<288;++K)re[K]=8;for(var Te=new ut(32),K=0;K<32;++K)Te[K]=5;var ss=Rt(re,9,0),os=Rt(re,9,1),as=Rt(Te,5,0),ls=Rt(Te,5,1),Or=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},Ut=function(r,t,e){var n=t/8|0;return(r[n]|r[n+1]<<8)>>(t&7)&e},Ir=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},Er=function(r){return(r+7)/8|0},Pn=function(r,t,e){return(e==null||e>r.length)&&(e=r.length),new ut(r.subarray(t,e))},cs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Lt=function(r,t,e){var n=new Error(t||cs[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Lt),!e)throw n;return n},hs=function(r,t,e,n){var i=r.length,o=0;if(!i||t.f&&!t.l)return e||new ut(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ut(i*3));var c=function(Pt){var Tt=e.length;if(Pt>Tt){var ht=new ut(Math.max(Tt*2,Pt));ht.set(e),e=ht}},h=t.f||0,u=t.p||0,p=t.b||0,g=t.l,f=t.d,y=t.m,d=t.n,P=i*8;do{if(!g){h=Ut(r,u,1);var M=Ut(r,u+1,3);if(u+=3,M)if(M==1)g=os,f=ls,y=9,d=5;else if(M==2){var x=Ut(r,u,31)+257,S=Ut(r,u+10,15)+4,b=x+Ut(r,u+5,31)+1;u+=14;for(var D=new ut(b),N=new ut(19),E=0;E<S;++E)N[Tr[E]]=Ut(r,u+E*3,7);u+=S*3;for(var F=Or(N),z=(1<<F)-1,B=Rt(N,F,1),E=0;E<b;){var A=B[Ut(r,u,z)];u+=A&15;var w=A>>4;if(w<16)D[E++]=w;else{var W=0,O=0;for(w==16?(O=3+Ut(r,u,3),u+=2,W=D[E-1]):w==17?(O=3+Ut(r,u,7),u+=3):w==18&&(O=11+Ut(r,u,127),u+=7);O--;)D[E++]=W}}var L=D.subarray(0,x),j=D.subarray(x);y=Or(L),d=Or(j),g=Rt(L,y,1),f=Rt(j,d,1)}else Lt(1);else{var w=Er(u)+4,C=r[w-4]|r[w-3]<<8,v=w+C;if(v>i){l&&Lt(0);break}a&&c(p+C),e.set(r.subarray(w,v),p),t.b=p+=C,t.p=u=v*8,t.f=h;continue}if(u>P){l&&Lt(0);break}}a&&c(p+131072);for(var I=(1<<y)-1,V=(1<<d)-1,T=u;;T=u){var W=g[Ir(r,u)&I],_=W>>4;if(u+=W&15,u>P){l&&Lt(0);break}if(W||Lt(2),_<256)e[p++]=_;else if(_==256){T=u,g=null;break}else{var U=_-254;if(_>264){var E=_-257,$=Xe[E];U=Ut(r,u,(1<<$)-1)+bn[E],u+=$}var q=f[Ir(r,u)&V],Z=q>>4;q||Lt(3),u+=q&15;var j=is[Z];if(Z>3){var $=Ze[Z];j+=Ir(r,u)&(1<<$)-1,u+=$}if(u>P){l&&Lt(0);break}a&&c(p+131072);var rt=p+U;if(p<j){var Zt=o-j,Dt=Math.min(j,rt);for(Zt+p<0&&Lt(3);p<Dt;++p)e[p]=n[Zt+p]}for(;p<rt;++p)e[p]=e[p-j]}}t.l=g,t.p=T,t.b=p,t.f=h,g&&(h=1,t.m=y,t.d=f,t.n=d)}while(!h);return p!=e.length&&s?Pn(e,0,p):e.subarray(0,p)},Yt=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8},ke=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8,r[n+2]|=e>>16},Br=function(r,t){for(var e=[],n=0;n<r.length;++n)r[n]&&e.push({s:n,f:r[n]});var i=e.length,o=e.slice();if(!i)return{t:kn,l:0};if(i==1){var s=new ut(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,x){return v.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var p=o[0].s,n=1;n<i;++n)o[n].s>p&&(p=o[n].s);var g=new At(p+1),f=Dr(e[h-1],g,0);if(f>t){var n=0,y=0,d=f-t,P=1<<d;for(o.sort(function(x,S){return g[S.s]-g[x.s]||x.f-S.f});n<i;++n){var M=o[n].s;if(g[M]>t)y+=P-(1<<f-g[M]),g[M]=t;else break}for(y>>=d;y>0;){var w=o[n].s;g[w]<t?y-=1<<t-g[w]++-1:++n}for(;n>=0&&y;--n){var C=o[n].s;g[C]==t&&(--g[C],++y)}f=t}return{t:new ut(g),l:f}},Dr=function(r,t,e){return r.s==-1?Math.max(Dr(r.l,t,e+1),Dr(r.r,t,e+1)):t[r.s]=e},Mn=function(r){for(var t=r.length;t&&!r[--t];);for(var e=new At(++t),n=0,i=r[0],o=1,s=function(l){e[n++]=l},a=1;a<=t;++a)if(r[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=r[a]}return{c:e.subarray(0,n),n:t}},Ae=function(r,t){for(var e=0,n=0;n<t.length;++n)e+=r[n]*t[n];return e},_n=function(r,t,e){var n=e.length,i=Er(t+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var o=0;o<n;++o)r[i+o+4]=e[o];return(i+4+n)*8},Tn=function(r,t,e,n,i,o,s,a,l,c,h){Yt(t,h++,e),++i[256];for(var u=Br(i,15),p=u.t,g=u.l,f=Br(o,15),y=f.t,d=f.l,P=Mn(p),M=P.c,w=P.n,C=Mn(y),v=C.c,x=C.n,S=new At(19),b=0;b<M.length;++b)++S[M[b]&31];for(var b=0;b<v.length;++b)++S[v[b]&31];for(var D=Br(S,7),N=D.t,E=D.l,F=19;F>4&&!N[Tr[F-1]];--F);var z=c+5<<3,B=Ae(i,re)+Ae(o,Te)+s,A=Ae(i,p)+Ae(o,y)+s+14+3*F+Ae(S,N)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&z<=B&&z<=A)return _n(t,h,r.subarray(l,l+c));var W,O,L,j;if(Yt(t,h,1+(A<B)),h+=2,A<B){W=Rt(p,g,0),O=p,L=Rt(y,d,0),j=y;var I=Rt(N,E,0);Yt(t,h,w-257),Yt(t,h+5,x-1),Yt(t,h+10,F-4),h+=14;for(var b=0;b<F;++b)Yt(t,h+3*b,N[Tr[b]]);h+=3*F;for(var V=[M,v],T=0;T<2;++T)for(var _=V[T],b=0;b<_.length;++b){var U=_[b]&31;Yt(t,h,I[U]),h+=N[U],U>15&&(Yt(t,h,_[b]>>5&127),h+=_[b]>>12)}}else W=ss,O=re,L=as,j=Te;for(var b=0;b<a;++b){var $=n[b];if($>255){var U=$>>18&31;ke(t,h,W[U+257]),h+=O[U+257],U>7&&(Yt(t,h,$>>23&31),h+=Xe[U]);var q=$&31;ke(t,h,L[q]),h+=j[q],q>3&&(ke(t,h,$>>5&8191),h+=Ze[q])}else ke(t,h,W[$]),h+=O[$]}return ke(t,h,W[256]),h+O[256]},us=new _r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),kn=new ut(0),fs=function(r,t,e,n,i,o){var s=o.z||r.length,a=new ut(n+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(n,a.length-i),c=o.l,h=(o.r||0)&7;if(t){h&&(l[0]=o.r>>3);for(var u=us[t-1],p=u>>13,g=u&8191,f=(1<<e)-1,y=o.p||new At(32768),d=o.h||new At(f+1),P=Math.ceil(e/3),M=2*P,w=function(kt){return(r[kt]^r[kt+1]<<P^r[kt+2]<<M)&f},C=new _r(25e3),v=new At(288),x=new At(32),S=0,b=0,D=o.i||0,N=0,E=o.w||0,F=0;D+2<s;++D){var z=w(D),B=D&32767,A=d[z];if(y[B]=A,d[z]=B,E<=D){var W=s-D;if((S>7e3||N>24576)&&(W>423||!c)){h=Tn(r,l,0,C,v,x,b,N,F,D-F,h),N=S=b=0,F=D;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)x[O]=0}var L=2,j=0,I=g,V=B-A&32767;if(W>2&&z==w(D-V))for(var T=Math.min(p,W)-1,_=Math.min(32767,D),U=Math.min(258,W);V<=_&&--I&&B!=A;){if(r[D+L]==r[D+L-V]){for(var $=0;$<U&&r[D+$]==r[D+$-V];++$);if($>L){if(L=$,j=V,$>T)break;for(var q=Math.min(V,$-2),Z=0,O=0;O<q;++O){var rt=D-V+O&32767,Zt=y[rt],Dt=rt-Zt&32767;Dt>Z&&(Z=Dt,A=rt)}}}B=A,A=y[B],V+=B-A&32767}if(j){C[N++]=268435456|kr[L]<<18|Cn[j];var Pt=kr[L]&31,Tt=Cn[j]&31;b+=Xe[Pt]+Ze[Tt],++v[257+Pt],++x[Tt],E=D+L,++S}else C[N++]=r[D],++v[r[D]]}}for(D=Math.max(D,E);D<s;++D)C[N++]=r[D],++v[r[D]];h=Tn(r,l,c,C,v,x,b,N,F,D-F,h),c||(o.r=h&7|l[h/8|0]<<3,h-=7,o.h=d,o.p=y,o.i=D,o.w=E)}else{for(var D=o.w||0;D<s+c;D+=65535){var ht=D+65535;ht>=s&&(l[h/8|0]=c,ht=s),h=_n(l,h+1,r.subarray(D,ht))}o.i=s}return Pn(a,0,n+Er(h)+i)},An=function(){var r=1,t=0;return{p:function(e){for(var n=r,i=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=n+=e[s];n=(n&65535)+15*(n>>16),i=(i&65535)+15*(i>>16)}r=n,t=i},d:function(){return r%=65521,t%=65521,(r&255)<<24|(r&65280)<<8|(t&255)<<8|t>>8}}},ps=function(r,t,e,n,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ut(o.length+r.length);s.set(o),s.set(r,o.length),r=s,i.w=o.length}return fs(r,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+t.mem,e,n,i)},On=function(r,t,e){for(;e;++t)r[t]=e,e>>>=8},ds=function(r,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(r[0]=120,r[1]=n<<6|(t.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,t.dictionary){var i=An();i.p(t.dictionary),On(r,2,i.d())}},gs=function(r,t){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&Lt(6,"invalid zlib data"),(r[1]>>5&1)==1&&Lt(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function ys(r,t){t||(t={});var e=An();e.p(r);var n=ps(r,t,t.dictionary?6:2,4);return ds(n,t),On(n,n.length-4,e.d()),n}function ms(r,t){return hs(r.subarray(gs(r),-4),{i:2},t,t)}var xs=typeof TextDecoder<"u"&&new TextDecoder,vs=0;try{xs.decode(kn,{stream:!0}),vs=1}catch{}const ws="modern-font";function Oe(r,t){if(!r)throw new Error(`[${ws}] ${t}`)}function bs(r){if("buffer"in r){const t=r.buffer;return r.byteOffset>0||r.byteLength<r.buffer.byteLength?t.slice(r.byteOffset,r.byteOffset+r.byteLength):t}else return r}function ye(r){return"buffer"in r?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(r)}function Ss(r){let t="";for(let e=0,n=r.length,i;e<n;e++)i=r.charCodeAt(e),i!==0&&(t+=String.fromCharCode(i));return t}function Ye(r){r=Ss(r);const t=[];for(let e=0,n=r.length,i;e<n;e++)i=r.charCodeAt(e),t.push(i>>8),t.push(i&255);return t}function Cs(r){let t="";for(let e=0,n=r.length;e<n;e++)r[e]<127?t+=String.fromCharCode(r[e]):t+=`%${(256+r[e]).toString(16).slice(1)}`;return unescape(t)}function Ps(r){let t="";for(let e=0,n=r.length;e<n;e+=2)t+=String.fromCharCode((r[e]<<8)+r[e+1]);return t}var Ms=Object.defineProperty,ft=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ms(t,e,i),i};const Ke={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(r,t){Object.defineProperty(r.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class lt extends DataView{constructor(t,e,n,i){super(bs(t),e,n),this.littleEndian=i}cursor=0;readColumn(t){if(t.size){const e=Array.from({length:t.size},(n,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(n,i)=>{this.write(t.type,e[i],t.offset+i)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const i=`get${t.replace(/^\S/,l=>l.toUpperCase())}`,o=this,a=o[i]?.bind(o)?.(e,n);return this.cursor+=Ke[t],a}readUint24(t=this.cursor){const[e,n,i]=this.readBytes(t,3);return(e<<16)+(n<<8)+i}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let i=0;i<e;++i)n.push(this.getUint8(t+i));return this.cursor=t+e,n}readString(t,e){const n=this.readBytes(t,e);let i="";for(let o=0,s=n.length;o<s;o++)i+=String.fromCharCode(n[o]);return i}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),i=new Date;return i.setTime(n*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,i=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const o=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,l=s[o]?.bind(s)?.(n,e,i);return this.cursor+=Ke[t.toLowerCase()],l}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let i=0,o=t.length,s;i<o;++i)s=t.charCodeAt(i)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=n,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(i,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let i=0;i<n;++i)this.setUint8(e+i,t[i])}else{const i=ye(t);n=i.byteLength;for(let o=0;o<n;++o)this.setUint8(e+o,i.getUint8(o))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}ft([pt()],lt.prototype,"readInt8"),ft([pt()],lt.prototype,"readInt16"),ft([pt()],lt.prototype,"readInt32"),ft([pt()],lt.prototype,"readUint8"),ft([pt()],lt.prototype,"readUint16"),ft([pt()],lt.prototype,"readUint32"),ft([pt()],lt.prototype,"readFloat32"),ft([pt()],lt.prototype,"readFloat64"),ft([pt()],lt.prototype,"writeInt8"),ft([pt()],lt.prototype,"writeInt16"),ft([pt()],lt.prototype,"writeInt32"),ft([pt()],lt.prototype,"writeUint8"),ft([pt()],lt.prototype,"writeUint16"),ft([pt()],lt.prototype,"writeUint32"),ft([pt()],lt.prototype,"writeFloat32"),ft([pt()],lt.prototype,"writeFloat64");const In=new WeakMap;function m(r){const t=typeof r=="object"?r:{type:r},{size:e=1,type:n}=t;return(i,o)=>{if(typeof o!="string")return;let s=In.get(i);s||(s={columns:[],byteLength:0},In.set(i,s));const a={...t,name:o,byteLength:e*Ke[n],offset:t.offset??s.columns.reduce((l,c)=>l+c.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,c)=>l+Ke[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class It{view;constructor(t,e,n,i){this.view=new lt(t,e,n,i)}}class Fr extends It{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var _s=Object.defineProperty,vt=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&_s(t,e,i),i};const wt=class Ji extends Fr{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(t){const e=t.sfnt,i=e.name.names,o=Ye(i.fontFamily||""),s=o.length,a=Ye(i.fontStyle||""),l=a.length,c=Ye(i.version||""),h=c.length,u=Ye(i.fullName||""),p=u.length,g=86+s+4+l+4+h+4+p+2+t.view.byteLength,f=new Ji(new ArrayBuffer(g),0,g,!0);f.EOTSize=f.view.byteLength,f.FontDataSize=t.view.byteLength,f.Version=131073,f.Flags=0,f.Charset=1,f.MagicNumber=20556,f.Padding1=0,f.CheckSumAdjustment=e.head.checkSumAdjustment;const y=e.os2;return y&&(f.FontPANOSE=y.fontPANOSE,f.Italic=y.fsSelection,f.Weight=y.usWeightClass,f.fsType=y.fsType,f.UnicodeRange=y.ulUnicodeRange,f.CodePageRange=y.ulCodePageRange),f.view.writeUint16(s),f.view.writeBytes(o),f.view.writeUint16(0),f.view.writeUint16(l),f.view.writeBytes(a),f.view.writeUint16(0),f.view.writeUint16(h),f.view.writeBytes(c),f.view.writeUint16(0),f.view.writeUint16(p),f.view.writeBytes(u),f.view.writeUint16(0),f.view.writeUint16(0),f.view.writeBytes(t.view),f}};vt([m("uint32")],wt.prototype,"EOTSize"),vt([m("uint32")],wt.prototype,"FontDataSize"),vt([m("uint32")],wt.prototype,"Version"),vt([m("uint32")],wt.prototype,"Flags"),vt([m({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),vt([m("uint8")],wt.prototype,"Charset"),vt([m("uint8")],wt.prototype,"Italic"),vt([m("uint32")],wt.prototype,"Weight"),vt([m("uint16")],wt.prototype,"fsType"),vt([m("uint16")],wt.prototype,"MagicNumber"),vt([m({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),vt([m({type:"uint8",size:8})],wt.prototype,"CodePageRange"),vt([m("uint32")],wt.prototype,"CheckSumAdjustment"),vt([m({type:"uint8",size:16})],wt.prototype,"Reserved"),vt([m("uint16")],wt.prototype,"Padding1");var Ts=Object.defineProperty,Qe=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ts(t,e,i),i};class Ie extends It{constructor(t,e){super(t,e,16)}}Qe([m({type:"char",size:4})],Ie.prototype,"tag"),Qe([m("uint32")],Ie.prototype,"checkSum"),Qe([m("uint32")],Ie.prototype,"offset"),Qe([m("uint32")],Ie.prototype,"length");const Ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],ks=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class En{index;name;isComposite=!1;components=[];pathCommands=[];constructor(t){const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,n=72,i={},o){const s=1/(o?.unitsPerEm??1e3)*n,{xScale:a=s,yScale:l=s}=i,c=this.pathCommands,h=[];for(let u=0,p=c.length;u<p;u+=1){const g=c[u];g.type==="M"?h.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?h.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?h.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?h.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&h.push({type:"Z"})}return h}}class As extends En{parse(t,e,n){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,c=t.topDict.paintType,h=this.index;let u,p,g,f;const y=[],d=[];let P=0,M=!1,w=!1,C=s,v=0,x=0;function S(B,A){y.push({type:"L",x:B,y:A})}function b(B,A,W,O,L,j){y.push({type:"C",x1:B,y1:A,x2:W,y2:O,x:L,y:j})}function D(B,A){w&&c!==2&&N(),w=!0,y.push({type:"M",x:B,y:A})}function N(){y.push({type:"Z"})}function E(B){y.push(...B)}function F(){d.length%2!==0&&!M&&(C=d.shift()+o),P+=d.length>>1,d.length=0,M=!0}function z(B){let A,W,O,L,j,I,V,T,_,U,$,q,Z=0;for(;Z<B.length;){let rt=B[Z++];switch(rt){case 1:F();break;case 3:F();break;case 4:d.length>1&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),D(v,x);break;case 5:for(;d.length>0;)v+=d.shift(),x+=d.shift(),S(v,x);break;case 6:for(;d.length>0&&(v+=d.shift(),S(v,x),d.length!==0);)x+=d.shift(),S(v,x);break;case 7:for(;d.length>0&&(x+=d.shift(),S(v,x),d.length!==0);)v+=d.shift(),S(v,x);break;case 8:for(;d.length>0;)u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(u,p,g,f,v,x);break;case 10:j=d.pop()+l,I=t.subrs[j],I&&z(I);break;case 11:return;case 12:switch(rt=B[Z],Z+=1,rt){case 35:u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),x=q+d.shift(),d.shift(),b(u,p,g,f,V,T),b(_,U,$,q,v,x);break;case 34:u=v+d.shift(),p=x,g=u+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f,_=V+d.shift(),U=f,$=_+d.shift(),q=x,v=$+d.shift(),b(u,p,g,f,V,T),b(_,U,$,q,v,x);break;case 36:u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f,_=V+d.shift(),U=f,$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),b(u,p,g,f,V,T),b(_,U,$,q,v,x);break;case 37:u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),V=g+d.shift(),T=f+d.shift(),_=V+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),Math.abs($-v)>Math.abs(q-x)?v=$+d.shift():x=q+d.shift(),b(u,p,g,f,V,T),b(_,U,$,q,v,x);break;default:console.warn(`Glyph ${h}: unknown operator ${1200+rt}`),d.length=0}break;case 14:if(d.length>=4){const Zt=Ur[d.pop()],Dt=Ur[d.pop()],Pt=d.pop(),Tt=d.pop();if(Zt&&Dt){i.isComposite=!0,i.components=[];const ht=t.charset.indexOf(Zt),kt=t.charset.indexOf(Dt);i.components.push({glyphIndex:kt,dx:0,dy:0}),i.components.push({glyphIndex:ht,dx:Tt,dy:Pt}),E(n.get(kt).pathCommands);const Vt=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let jt=0;jt<Vt.length;jt+=1){const Ft=Vt[jt];Ft.type!=="Z"&&(Ft.x+=Tt,Ft.y+=Pt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Tt,Ft.y1+=Pt),Ft.type==="C"&&(Ft.x2+=Tt,Ft.y2+=Pt)}E(Vt)}}else d.length>0&&!M&&(C=d.shift()+o,M=!0);w&&c!==2&&(N(),w=!1);break;case 18:F();break;case 19:case 20:F(),Z+=P+7>>3;break;case 21:d.length>2&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),v+=d.pop(),D(v,x);break;case 22:d.length>1&&!M&&(C=d.shift()+o,M=!0),v+=d.pop(),D(v,x);break;case 23:F();break;case 24:for(;d.length>2;)u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(u,p,g,f,v,x);v+=d.shift(),x+=d.shift(),S(v,x);break;case 25:for(;d.length>6;)v+=d.shift(),x+=d.shift(),S(v,x);u=v+d.shift(),p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(u,p,g,f,v,x);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)u=v,p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g,x=f+d.shift(),b(u,p,g,f,v,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)u=v+d.shift(),p=x,g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f,b(u,p,g,f,v,x);break;case 28:A=B[Z],W=B[Z+1],d.push((A<<24|W<<16)>>16),Z+=2;break;case 29:j=d.pop()+a,I=t.gsubrs[j],I&&z(I);break;case 30:for(;d.length>0&&(u=v,p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(u,p,g,f,v,x),d.length!==0);)u=v+d.shift(),p=x,g=u+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(u,p,g,f,v,x);break;case 31:for(;d.length>0&&(u=v+d.shift(),p=x,g=u+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(u,p,g,f,v,x),d.length!==0);)u=v,p=x+d.shift(),g=u+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(u,p,g,f,v,x);break;default:rt<32?console.warn(`Glyph ${h}: unknown operator ${rt}`):rt<247?d.push(rt-139):rt<251?(A=B[Z],Z+=1,d.push((rt-247)*256+A+108)):rt<255?(A=B[Z],Z+=1,d.push(-(rt-251)*256-A-108)):(A=B[Z],W=B[Z+1],O=B[Z+2],L=B[Z+3],Z+=4,d.push((A<<24|W<<16|O<<8|L)/65536))}}}z(e),this.pathCommands=y,M&&(this.advanceWidth=C)}}class Bn{constructor(t){this._sfnt=t}_items=[];get(t){const e=this._items[t];let n;if(e)n=e;else{n=this._get(t);const i=this._sfnt.hmtx.metrics[t];i&&(n.advanceWidth=n.advanceWidth||i.advanceWidth,n.leftSideBearing=n.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(n.unicode??=o[0],n.unicodes??=o),this._items[t]=n}return n}}class Os extends Bn{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,n=new As({index:t});return n.parse(e,e.charStringsIndex.get(t),this),n.name=e.charset[t],n}}var Is=Object.defineProperty,Dn=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Is(t,e,i),i};class Je extends It{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(t,e,n,i){super(t,e,n,i),this._init()}_init(){const t=this.view,e=this.count,n=this.offsetSize;this.objectOffset=(e+1)*n+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,n=this.offsetSize;t.seek(3);const i=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let l=0;for(let c=0;c<n;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const t=[];for(let e=0,n=this.count;e<n;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,n=this.objectOffset,i=n+e[t],s=n+e[t+1]-i;return this._isString?this.view.readString(i,s):this.view.readBytes(i,s)}}Dn([m("uint16")],Je.prototype,"count"),Dn([m("uint8")],Je.prototype,"offsetSize");class tr extends Je{_isString=!1}class Fn extends Je{_isString=!0}const Es=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Bs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Ds=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Fs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function er(r,t){return t<=390?Es[t]:r[t-391]}function Q(r,t="number",e){return(n,i)=>{if(typeof i!="string")return;const o={type:t,operator:r,default:e??t==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Un extends It{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const n=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===n||(e+=i[s],a===n))break;e+=i[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let n,i,o,s;if(t===28)return n=e.readUint8(),i=e.readUint8(),n<<8|i;if(t===29)return n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),s=e.readUint8(),n<<24|i<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=e.readUint8(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=e.readUint8(),-(t-251)*256-n-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const n=t.cursor+t.byteLength,i={};for(;t.cursor<n;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),i[o]=e,e=[]):e.push(this._readOperand(o))}return i}_getProp(t){const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return er(this._stringIndex?.objects??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Us=Object.defineProperty,Lr=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Us(t,e,i),i};class rr extends Un{}Lr([Q(19)],rr.prototype,"subrs"),Lr([Q(20)],rr.prototype,"defaultWidthX"),Lr([Q(21)],rr.prototype,"nominalWidthX");var Ls=Object.defineProperty,nt=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ls(t,e,i),i};class et extends Un{}nt([Q(0,"string")],et.prototype,"version"),nt([Q(1,"string")],et.prototype,"notice"),nt([Q(1200,"string")],et.prototype,"copyright"),nt([Q(2,"string")],et.prototype,"fullName"),nt([Q(3,"string")],et.prototype,"familyName"),nt([Q(4,"string")],et.prototype,"weight"),nt([Q(1201)],et.prototype,"isFixedPitch"),nt([Q(1202)],et.prototype,"italicAngle"),nt([Q(1203,"number",-100)],et.prototype,"underlinePosition"),nt([Q(1204,"number",50)],et.prototype,"underlineThickness"),nt([Q(1205)],et.prototype,"paintType"),nt([Q(1206,"number",2)],et.prototype,"charstringType"),nt([Q(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),nt([Q(13)],et.prototype,"uniqueId"),nt([Q(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),nt([Q(1208)],et.prototype,"strokeWidth"),nt([Q(14)],et.prototype,"xuid"),nt([Q(15)],et.prototype,"charset"),nt([Q(16)],et.prototype,"encoding"),nt([Q(17)],et.prototype,"charStrings"),nt([Q(18,"number[]",[0,0])],et.prototype,"private");function dt(r,t=r){return e=>{Kt.tableDefinitions.set(r,{tag:r,prop:t,class:e}),Object.defineProperty(Kt.prototype,t,{get(){return this.get(r)},set(n){return this.set(r,n)},configurable:!0,enumerable:!0})}}class Kt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:n,charset:i}=this.cff;e=i.indexOf(n[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const n of t)e.push(this.charToGlyphIndex(n));return e}textToGlyphs(t){const e=this.glyphs,n=this.textToGlyphIndexes(t),i=n.length,o=Array.from({length:i}),s=e.get(0);for(let a=0;a<i;a+=1)o[a]=e.get(n[a])||s;return o}getPathCommands(t,e,n,i,o){const s=[];return this.forEachGlyph(t,e,n,i,o,(a,l,c,h,u)=>{s.push(...a.getPathCommands(l,c,h,u,this))}),s}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,i=72,o={},s){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(t);for(let c=0;c<l.length;c+=1){const h=l[c];s.call(this,h,e,n,i,o),h.advanceWidth&&(e+=h.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*i:o.tracking&&(e+=o.tracking/1e3*i)}return e}constructor(t){(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,i)=>{this.tableViews.set(i,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}clone(){return new Kt(this.tableViews)}delete(t){const e=Kt.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=Kt.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Kt.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const i=e.class;if(i){const o=this.tableViews.get(t);if(!o)return;n=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(e.prop,n)}}return n}}class gt extends It{setSFNT(t){return this._sfnt=t,this}getSFNT(){return this._sfnt}}var $s=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Ee=(r,t,e,n)=>{for(var i=n>1?void 0:n?zs(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&$s(t,e,i),i};let me=class extends gt{_glyphs;get glyphs(){return this._glyphs??=new Os(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(r,t,e,n){super(r,t,e,n),this._init()}_init(){const r=this.view,{buffer:t,byteOffset:e}=r,n=e+4;this.nameIndex=new Fn(t,n),this.topDictIndex=new tr(t,this.nameIndex.endOffset),this.stringIndex=new Fn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new tr(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new rr(t,e+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new tr(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new tr(t,e+this.topDict.charStrings);const s=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Bs:this.topDict.charset===1?this.charset=Ds:this.topDict.charset===2?this.charset=Fs:this.charset=this._readCharset(e+this.topDict.charset,s,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Ur:this.topDict.encoding===1?this.encoding=ks:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(r,t,e){const n=this.view;n.seek(r);let i,o,s;t-=1;const a=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<t;i+=1)o=n.readUint16(),a.push(er(e,o));else if(l===1)for(;a.length<=t;)for(o=n.readUint16(),s=n.readUint8(),i=0;i<=s;i+=1)a.push(er(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=n.readUint16(),s=n.readUint16(),i=0;i<=s;i+=1)a.push(er(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(r){const t=this.view;t.seek(r);let e,n;const i={},o=t.readUint8();if(o===0){const s=t.readUint8();for(e=0;e<s;e+=1)n=t.readUint8(),i[n]=e}else if(o===1){const s=t.readUint8();for(n=1,e=0;e<s;e+=1){const a=t.readUint8(),l=t.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(r){let t;return r.length<1240?t=107:r.length<33900?t=1131:t=32768,t}};Ee([m("uint8")],me.prototype,"majorVersion",2),Ee([m("uint8")],me.prototype,"minorVersion",2),Ee([m("uint8")],me.prototype,"headerSize",2),Ee([m("uint8")],me.prototype,"offsetSize",2),me=Ee([dt("CFF ","cff")],me);var Ns=Object.defineProperty,nr=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ns(t,e,i),i};const Be=class ts extends It{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ts;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,i)=>{i<256&&n<256&&e.view.writeUint8(n,6+i)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};nr([m("uint16")],Be.prototype,"format"),nr([m("uint16")],Be.prototype,"length"),nr([m("uint16")],Be.prototype,"language"),nr([m({type:"uint8",size:256})],Be.prototype,"glyphIndexArray");let Ln=Be;var Vs=Object.defineProperty,$r=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Vs(t,e,i),i};class ir extends It{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(n[c]===0)c>=a||c<o[0].firstCode||c>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(c-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(c-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(c,l);else{const h=n[c];for(let u=0,p=o[h].entryCount;u<p;u++)if(o[h].idRangeOffset+u>=s.length?l=0:(l=s[o[h].idRangeOffset+u],l!==0&&(l=l+o[h].idDelta)),l!==0&&l<t){const g=(c<<8|u+o[h].firstCode)%65535;e.set(g,l)}}return e}}$r([m("uint16")],ir.prototype,"format"),$r([m("uint16")],ir.prototype,"length"),$r([m("uint16")],ir.prototype,"language");function $n(r){return r>32767?r-65536:r<-32767?r+65536:r}function zn(r,t){let e;const n=[];let i={};return r.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(i.end=e.unicode,n.push(i),i={start:s,startId:o,delta:$n(o-s)}):(i.start=Number(s),i.startId=o,i.delta=$n(o-s))),e={unicode:s,glyphIndex:o})}),e&&(i.end=e.unicode,n.push(i)),n}var js=Object.defineProperty,ue=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&js(t,e,i),i};const ne=class es extends It{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=zn(t,65535),n=e.length+1,i=Math.floor(Math.log(n)/Math.LN2),o=2*2**i,s=new es(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=i,s.rangeShift=2*n-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<e;++c)for(let h=i[c],u=o[c];h<=u;++h)if(s[c]===0)t.set(h,(h+a[c])%65536);else{const p=c+s[c]/2+(h-i[c])-n,g=l[p];g!==0?t.set(h,(g+a[c])%65536):t.set(h,0)}return t.delete(65535),t}};ue([m("uint16")],ne.prototype,"format"),ue([m("uint16")],ne.prototype,"length"),ue([m("uint16")],ne.prototype,"language"),ue([m("uint16")],ne.prototype,"segCountX2"),ue([m("uint16")],ne.prototype,"searchRange"),ue([m("uint16")],ne.prototype,"entrySelector"),ue([m("uint16")],ne.prototype,"rangeShift");let Nn=ne;var Rs=Object.defineProperty,De=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Rs(t,e,i),i};class xe extends It{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,i)=>{e.set(i,n)}),e}}De([m("uint16")],xe.prototype,"format"),De([m("uint16")],xe.prototype,"length"),De([m("uint16")],xe.prototype,"language"),De([m("uint16")],xe.prototype,"firstCode"),De([m("uint16")],xe.prototype,"entryCount");var Gs=Object.defineProperty,Fe=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Gs(t,e,i),i};const ve=class rs extends It{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=zn(t),n=new rs(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(i=>{n.view.writeUint32(i.start),n.view.writeUint32(i.end),n.view.writeUint32(i.startId)}),n}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,i=e.length;n<i;n++){const o=e[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};Fe([m("uint16")],ve.prototype,"format"),Fe([m("uint16")],ve.prototype,"reserved"),Fe([m("uint32")],ve.prototype,"length"),Fe([m("uint32")],ve.prototype,"language"),Fe([m("uint32")],ve.prototype,"nGroups");let Vn=ve;var qs=Object.defineProperty,zr=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&qs(t,e,i),i};class sr extends It{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,i=e.length;n<i;n++){const{uVSMappings:o}=e[n];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}zr([m("uint16")],sr.prototype,"format"),zr([m("uint32")],sr.prototype,"length"),zr([m("uint32")],sr.prototype,"numVarSelectorRecords");var Ws=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Nr=(r,t,e,n)=>{for(var i=n>1?void 0:n?Hs(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Ws(t,e,i),i};let Ue=class extends gt{static from(r){const t=Array.from(r.keys()).some(h=>h>65535),e=Nn.from(r),n=Ln.from(r),i=t?Vn.from(r):void 0,o=4+(i?32:24),s=o+e.view.byteLength,a=s+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:s},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new Ue(new ArrayBuffer(4+8*l.length+e.view.byteLength+n.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(h=>{c.view.writeUint16(h.platformID),c.view.writeUint16(h.platformSpecificID),c.view.writeUint32(h.offset)}),c.view.writeBytes(e.view,o),c.view.writeBytes(n.view,s),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const r=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let n=0,i=e.length;n<i;n++){const o=e[n],s=t.get(o);r.has(s)?r.get(s).push(o):r.set(s,[o])}this._glyphIndexToUnicodesMap=r}return this._glyphIndexToUnicodesMap}readSubtables(){const r=this.numberSubtables;return this.view.seek(4),Array.from({length:r},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let n;switch(e){case 0:n=new Ln(this.view.buffer,t.offset);break;case 2:n=new ir(this.view.buffer,t.offset,this.view.readUint16());break;case 4:n=new Nn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:n=new xe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:n=new Vn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:n=new sr(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:n}})}readunicodeToGlyphIndexMap(){const r=this.readSubtables(),t=r.find(s=>s.format===0)?.view,e=r.find(s=>s.platformID===3&&s.platformSpecificID===3&&s.format===2)?.view,n=r.find(s=>s.platformID===3&&s.platformSpecificID===1&&s.format===4)?.view,i=r.find(s=>s.platformID===3&&s.platformSpecificID===10&&s.format===12)?.view,o=r.find(s=>s.platformID===0&&s.platformSpecificID===5&&s.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...e?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...n?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...o?.getUnicodeToGlyphIndexMap()??[]])}};Nr([m("uint16")],Ue.prototype,"version",2),Nr([m("uint16")],Ue.prototype,"numberSubtables",2),Ue=Nr([dt("cmap")],Ue);class Xs extends En{_parseContours(t){const e=[];let n=[];for(let i=0;i<t.length;i+=1){const o=t[i];n.push(o),o.lastPointOfContour&&(e.push(n),n=[])}return Oe(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let i=0;i<t.length;i+=1){const o=t[i],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(t,e,n,i,o){let s;return(e&i)>0?(s=t.view.readUint8(),(e&o)===0&&(s=-s),s=n+s):(e&o)>0?s=n:s=n+t.view.readInt16(),s}parse(t,e,n){t.view.seek(e);const i=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();Oe(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(t.view.readUint8());const h=t.view.byteOffset,u=a[a.length-1]+1;Oe(u<2e4,`Bad numberOfCoordinates:${h}`);const p=[];let g,f=0;for(;f<u;)if(g=t.view.readUint8(),p.push(g),f++,g&8&&f<u){const y=t.view.readUint8();for(let d=0;d<y;d++)p.push(g),f++}if(Oe(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),a.length>0){const y=[];let d;if(u>0){for(let w=0;w<u;w+=1)g=p[w],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(w),y.push(d);let P=0;for(let w=0;w<u;w+=1)g=p[w],d=y[w],d.x=this._parseGlyphCoordinate(t,g,P,2,16),P=d.x;let M=0;for(let w=0;w<u;w+=1)g=p[w],d=y[w],d.y=this._parseGlyphCoordinate(t,g,M,4,32),M=d.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const c={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=t.view.readInt16(),c.dy=t.view.readInt16()):c.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(c.dx=t.view.readInt8(),c.dy=t.view.readInt8()):c.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?c.xScale=c.yScale=t.view.readInt16()/16384:(a&64)>0?(c.xScale=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384):(a&128)>0&&(c.xScale=t.view.readInt16()/16384,c.scale01=t.view.readInt16()/16384,c.scale10=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=n.get(l.glyphIndex);if(c.getPathCommands(),c.points){let h;if(l.matchedPoints===void 0)h=this._transformPoints(c.points,l);else{Oe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let p=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=u.x-p.x,g.dy=u.y-p.y,h=this._transformPoints(c.points,g)}this.points=this.points.concat(h)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const c=s[a];let h=c[c.length-1],u=c[0];h.onCurve?o.push({type:"M",x:h.x,y:h.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(h.x+u.x)*.5,y:(h.y+u.y)*.5});for(let p=0,g=c.length;p<g;++p)if(h=u,u=c[(p+1)%g],h.onCurve)o.push({type:"L",x:h.x,y:h.y});else{let f=u;u.onCurve||(f={x:(h.x+u.x)*.5,y:(h.y+u.y)*.5}),o.push({type:"Q",x1:h.x,y1:h.y,x:f.x,y:f.y})}o.push({type:"Z"})}this.pathCommands=o}}class Zs extends Bn{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,n=e[t],i=new Xs({index:t});return n!==e[t+1]&&i.parse(this._sfnt.glyf,n,this),i}}var Ys=Object.getOwnPropertyDescriptor,Ks=(r,t,e,n)=>{for(var i=n>1?void 0:n?Ys(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Vr=class extends gt{static from(r){const t=r.reduce((n,i)=>n+i.byteLength,0),e=new Vr(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeBytes(n)}),e}_glyphs;get glyphs(){return this._glyphs??=new Zs(this._sfnt)}};Vr=Ks([dt("glyf")],Vr);var Qs=Object.getOwnPropertyDescriptor,Js=(r,t,e,n)=>{for(var i=n>1?void 0:n?Qs(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let jn=class extends gt{};jn=Js([dt("GPOS","gpos")],jn);var to=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,fe=(r,t,e,n)=>{for(var i=n>1?void 0:n?eo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&to(t,e,i),i};let ie=class extends gt{};fe([m("uint16")],ie.prototype,"majorVersion",2),fe([m("uint16")],ie.prototype,"minorVersion",2),fe([m("uint16")],ie.prototype,"scriptListOffset",2),fe([m("uint16")],ie.prototype,"featureListOffset",2),fe([m("uint16")],ie.prototype,"lookupListOffset",2),fe([m("uint16")],ie.prototype,"featureVariationsOffset",2),ie=fe([dt("GSUB","gsub")],ie);var ro=Object.defineProperty,no=Object.getOwnPropertyDescriptor,ot=(r,t,e,n)=>{for(var i=n>1?void 0:n?no(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&ro(t,e,i),i};let st=class extends gt{constructor(r=new ArrayBuffer(54),t){super(r,t,Math.min(54,r.byteLength-(t??0)))}};ot([m("fixed")],st.prototype,"version",2),ot([m("fixed")],st.prototype,"fontRevision",2),ot([m("uint32")],st.prototype,"checkSumAdjustment",2),ot([m("uint32")],st.prototype,"magickNumber",2),ot([m("uint16")],st.prototype,"flags",2),ot([m("uint16")],st.prototype,"unitsPerEm",2),ot([m({type:"longDateTime"})],st.prototype,"created",2),ot([m({type:"longDateTime"})],st.prototype,"modified",2),ot([m("int16")],st.prototype,"xMin",2),ot([m("int16")],st.prototype,"yMin",2),ot([m("int16")],st.prototype,"xMax",2),ot([m("int16")],st.prototype,"yMax",2),ot([m("uint16")],st.prototype,"macStyle",2),ot([m("uint16")],st.prototype,"lowestRecPPEM",2),ot([m("int16")],st.prototype,"fontDirectionHint",2),ot([m("int16")],st.prototype,"indexToLocFormat",2),ot([m("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var io=Object.defineProperty,so=Object.getOwnPropertyDescriptor,bt=(r,t,e,n)=>{for(var i=n>1?void 0:n?so(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&io(t,e,i),i};let yt=class extends gt{constructor(r=new ArrayBuffer(36),t){super(r,t,Math.min(36,r.byteLength-(t??0)))}};bt([m("fixed")],yt.prototype,"version",2),bt([m("int16")],yt.prototype,"ascent",2),bt([m("int16")],yt.prototype,"descent",2),bt([m("int16")],yt.prototype,"lineGap",2),bt([m("uint16")],yt.prototype,"advanceWidthMax",2),bt([m("int16")],yt.prototype,"minLeftSideBearing",2),bt([m("int16")],yt.prototype,"minRightSideBearing",2),bt([m("int16")],yt.prototype,"xMaxExtent",2),bt([m("int16")],yt.prototype,"caretSlopeRise",2),bt([m("int16")],yt.prototype,"caretSlopeRun",2),bt([m("int16")],yt.prototype,"caretOffset",2),bt([m({type:"int16",size:4})],yt.prototype,"reserved",2),bt([m("int16")],yt.prototype,"metricDataFormat",2),bt([m("uint16")],yt.prototype,"numOfLongHorMetrics",2),yt=bt([dt("hhea")],yt);var oo=Object.getOwnPropertyDescriptor,ao=(r,t,e,n)=>{for(var i=n>1?void 0:n?oo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let jr=class extends gt{static from(r){const t=r.length*4,e=new jr(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeUint16(n.advanceWidth),e.view.writeUint16(n.leftSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const n=this.view;return n.seek(0),Array.from({length:r}).map((i,o)=>(o<t&&(e=n.readUint16()),{advanceWidth:e,leftSideBearing:n.readUint16()}))}};jr=ao([dt("hmtx")],jr);var lo=Object.getOwnPropertyDescriptor,co=(r,t,e,n)=>{for(var i=n>1?void 0:n?lo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Rn=class extends gt{};Rn=co([dt("kern","kern")],Rn);var ho=Object.getOwnPropertyDescriptor,uo=(r,t,e,n)=>{for(var i=n>1?void 0:n?ho(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Rr=class extends gt{static from(r,t=1){const e=r.length*(t?4:2),n=new Rr(new ArrayBuffer(e));return r.forEach(i=>{t?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:r}).map(()=>t?e.readUint32():e.readUint16()*2)}};Rr=uo([dt("loca")],Rr);var fo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,mt=(r,t,e,n)=>{for(var i=n>1?void 0:n?po(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&fo(t,e,i),i};let ct=class extends gt{constructor(r=new ArrayBuffer(32),t){super(r,t,Math.min(32,r.byteLength-(t??0)))}};mt([m("fixed")],ct.prototype,"version",2),mt([m("uint16")],ct.prototype,"numGlyphs",2),mt([m("uint16")],ct.prototype,"maxPoints",2),mt([m("uint16")],ct.prototype,"maxContours",2),mt([m("uint16")],ct.prototype,"maxComponentPoints",2),mt([m("uint16")],ct.prototype,"maxComponentContours",2),mt([m("uint16")],ct.prototype,"maxZones",2),mt([m("uint16")],ct.prototype,"maxTwilightPoints",2),mt([m("uint16")],ct.prototype,"maxStorage",2),mt([m("uint16")],ct.prototype,"maxFunctionDefs",2),mt([m("uint16")],ct.prototype,"maxInstructionDefs",2),mt([m("uint16")],ct.prototype,"maxStackElements",2),mt([m("uint16")],ct.prototype,"maxSizeOfInstructions",2),mt([m("uint16")],ct.prototype,"maxComponentElements",2),mt([m("uint16")],ct.prototype,"maxComponentDepth",2),ct=mt([dt("maxp")],ct);var go=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,or=(r,t,e,n)=>{for(var i=n>1?void 0:n?yo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&go(t,e,i),i};const Gn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},Gr={Macintosh:1,Microsoft:3},mo={Default:0},qn={UCS2:1};let Le=class extends gt{_names;get names(){return this._names??=this.readNames()}readNames(){const r=this.count;this.view.seek(6);const t=[];for(let a=0;a<r;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<r;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let n=Gr.Macintosh,i=mo.Default,o=0;t.some(a=>a.platform===Gr.Microsoft&&a.encoding===qn.UCS2&&a.language===1033)&&(n=Gr.Microsoft,i=qn.UCS2,o=1033);const s={};for(let a=0;a<r;++a){const l=t[a];l.platform===n&&l.encoding===i&&l.language===o&&Gn[l.nameId]&&(s[Gn[l.nameId]]=o===0?Cs(l.name):Ps(l.name))}return s}};or([m("uint16")],Le.prototype,"format",2),or([m("uint16")],Le.prototype,"count",2),or([m("uint16")],Le.prototype,"stringOffset",2),Le=or([dt("name")],Le);var xo=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,G=(r,t,e,n)=>{for(var i=n>1?void 0:n?vo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&xo(t,e,i),i};let R=class extends gt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};G([m("uint16")],R.prototype,"version",2),G([m("int16")],R.prototype,"xAvgCharWidth",2),G([m("uint16")],R.prototype,"usWeightClass",2),G([m("uint16")],R.prototype,"usWidthClass",2),G([m("uint16")],R.prototype,"fsType",2),G([m("uint16")],R.prototype,"ySubscriptXSize",2),G([m("uint16")],R.prototype,"ySubscriptYSize",2),G([m("uint16")],R.prototype,"ySubscriptXOffset",2),G([m("uint16")],R.prototype,"ySubscriptYOffset",2),G([m("uint16")],R.prototype,"ySuperscriptXSize",2),G([m("uint16")],R.prototype,"ySuperscriptYSize",2),G([m("uint16")],R.prototype,"ySuperscriptXOffset",2),G([m("uint16")],R.prototype,"ySuperscriptYOffset",2),G([m("uint16")],R.prototype,"yStrikeoutSize",2),G([m("uint16")],R.prototype,"yStrikeoutPosition",2),G([m("uint16")],R.prototype,"sFamilyClass",2),G([m({type:"uint8"})],R.prototype,"bFamilyType",2),G([m({type:"uint8"})],R.prototype,"bSerifStyle",2),G([m({type:"uint8"})],R.prototype,"bWeight",2),G([m({type:"uint8"})],R.prototype,"bProportion",2),G([m({type:"uint8"})],R.prototype,"bContrast",2),G([m({type:"uint8"})],R.prototype,"bStrokeVariation",2),G([m({type:"uint8"})],R.prototype,"bArmStyle",2),G([m({type:"uint8"})],R.prototype,"bLetterform",2),G([m({type:"uint8"})],R.prototype,"bMidline",2),G([m({type:"uint8"})],R.prototype,"bXHeight",2),G([m({type:"uint8",size:16})],R.prototype,"ulUnicodeRange",2),G([m({type:"char",size:4})],R.prototype,"achVendID",2),G([m("uint16")],R.prototype,"fsSelection",2),G([m("uint16")],R.prototype,"usFirstCharIndex",2),G([m("uint16")],R.prototype,"usLastCharIndex",2),G([m("int16")],R.prototype,"sTypoAscender",2),G([m("int16")],R.prototype,"sTypoDescender",2),G([m("int16")],R.prototype,"sTypoLineGap",2),G([m("uint16")],R.prototype,"usWinAscent",2),G([m("uint16")],R.prototype,"usWinDescent",2),G([m({offset:72,type:"uint8",size:8})],R.prototype,"ulCodePageRange",2),G([m({offset:72,type:"int16"})],R.prototype,"sxHeight",2),G([m("int16")],R.prototype,"sCapHeight",2),G([m("uint16")],R.prototype,"usDefaultChar",2),G([m("uint16")],R.prototype,"usBreakChar",2),G([m("uint16")],R.prototype,"usMaxContext",2),R=G([dt("OS/2","os2")],R);var wo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,Gt=(r,t,e,n)=>{for(var i=n>1?void 0:n?bo(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&wo(t,e,i),i};let $t=class extends gt{constructor(r=new ArrayBuffer(32),t,e){super(r,t,e)}};Gt([m("fixed")],$t.prototype,"format",2),Gt([m("fixed")],$t.prototype,"italicAngle",2),Gt([m("int16")],$t.prototype,"underlinePosition",2),Gt([m("int16")],$t.prototype,"underlineThickness",2),Gt([m("uint32")],$t.prototype,"isFixedPitch",2),Gt([m("uint32")],$t.prototype,"minMemType42",2),Gt([m("uint32")],$t.prototype,"maxMemType42",2),Gt([m("uint32")],$t.prototype,"minMemType1",2),Gt([m("uint32")],$t.prototype,"maxMemType1",2),$t=Gt([dt("post")],$t);var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,St=(r,t,e,n)=>{for(var i=n>1?void 0:n?Co(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&So(t,e,i),i};let xt=class extends gt{constructor(r=new ArrayBuffer(36),t){super(r,t,Math.min(36,r.byteLength-(t??0)))}};St([m("fixed")],xt.prototype,"version",2),St([m("int16")],xt.prototype,"vertTypoAscender",2),St([m("int16")],xt.prototype,"vertTypoDescender",2),St([m("int16")],xt.prototype,"vertTypoLineGap",2),St([m("int16")],xt.prototype,"advanceHeightMax",2),St([m("int16")],xt.prototype,"minTopSideBearing",2),St([m("int16")],xt.prototype,"minBottomSideBearing",2),St([m("int16")],xt.prototype,"yMaxExtent",2),St([m("int16")],xt.prototype,"caretSlopeRise",2),St([m("int16")],xt.prototype,"caretSlopeRun",2),St([m("int16")],xt.prototype,"caretOffset",2),St([m({type:"int16",size:4})],xt.prototype,"reserved",2),St([m("int16")],xt.prototype,"metricDataFormat",2),St([m("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Po=Object.getOwnPropertyDescriptor,Mo=(r,t,e,n)=>{for(var i=n>1?void 0:n?Po(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let qr=class extends gt{static from(r){const t=r.length*4,e=new qr(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeUint16(n.advanceHeight),e.view.writeInt16(n.topSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,e=this.view;e.seek(0);let n=0;return Array.from({length:r}).map((i,o)=>(o<t&&(n=e.readUint16()),{advanceHeight:n,topSideBearing:e.readUint8()}))}};qr=Mo([dt("vmtx")],qr);var _o=Object.defineProperty,$e=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&_o(t,e,i),i};class qt extends Fr{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checksum(t){const e=ye(t);let n=e.byteLength;for(;n%4;)n++;let i=0;for(let o=0,s=n/4;o<s;o+=4)o*4<n-4&&(i+=e.getUint32(o*4,!1));return i&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((u,p)=>u+e(p.byteLength),0),o=new this(new ArrayBuffer(12+n*16+i));o.scalerType=65536,o.numTables=n;const s=Math.log(2);o.searchRange=Math.floor(Math.log(n)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=n*16-o.searchRange;let a=12+n*16,l=0;const c=o.getDirectories();t.tableViews.forEach((u,p)=>{const g=c[l++];g.tag=p,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.length)});const h=o.createSFNT().head;return h.checkSumAdjustment=0,h.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Ie(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e([m("uint32")],qt.prototype,"scalerType"),$e([m("uint16")],qt.prototype,"numTables"),$e([m("uint16")],qt.prototype,"searchRange"),$e([m("uint16")],qt.prototype,"entrySelector"),$e([m("uint16")],qt.prototype,"rangeShift");class Wr extends qt{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(t){return super.from(t)}}var To=Object.defineProperty,ze=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&To(t,e,i),i};class we extends It{constructor(t,e){super(t,e,20)}}ze([m({type:"char",size:4})],we.prototype,"tag"),ze([m("uint32")],we.prototype,"offset"),ze([m("uint32")],we.prototype,"compLength"),ze([m("uint32")],we.prototype,"origLength"),ze([m("uint32")],we.prototype,"origChecksum");var ko=Object.defineProperty,Ot=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&ko(t,e,i),i};const Mt=class yn extends Fr{format="WOFF";mimeType="font/woff";get subfontFormat(){return qt.is(this.flavor)?"TrueType":Wr.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ye(t).getUint32(0))}static checkSum(t){const e=ye(t),n=e.byteLength,i=Math.floor(n/4);let o=0,s=0;for(;s<i;)o+=e.getUint32(4*s++,!1);let a=n-i*4;if(a){let l=i*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,i=[];t.tableViews.forEach((u,p)=>{const g=ye(ys(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:p,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=i.length,s=i.reduce((u,p)=>u+n(p.view.byteLength),0),a=new yn(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSFNTSize=12+16*o+i.reduce((u,p)=>u+n(p.rawView.byteLength),0);let l=44+o*20,c=0;const h=a.getDirectories();return i.forEach(u=>{const p=h[c++];p.tag=u.tag,p.offset=l,p.compLength=u.view.byteLength,p.origChecksum=yn.checkSum(u.rawView),p.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=n(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new we(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Kt(this.getDirectories().reduce((t,e)=>{const n=e.tag,i=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=i+o;return t[n]=o>=s?new DataView(this.view.buffer,i,o):new DataView(ms(new Uint8Array(this.view.buffer.slice(i,a))).buffer),t},{}))}};Ot([m("uint32")],Mt.prototype,"signature"),Ot([m("uint32")],Mt.prototype,"flavor"),Ot([m("uint32")],Mt.prototype,"length"),Ot([m("uint16")],Mt.prototype,"numTables"),Ot([m("uint16")],Mt.prototype,"reserved"),Ot([m("uint32")],Mt.prototype,"totalSFNTSize"),Ot([m("uint16")],Mt.prototype,"majorVersion"),Ot([m("uint16")],Mt.prototype,"minorVersion"),Ot([m("uint32")],Mt.prototype,"metaOffset"),Ot([m("uint32")],Mt.prototype,"metaLength"),Ot([m("uint32")],Mt.prototype,"metaOrigLength"),Ot([m("uint32")],Mt.prototype,"privOffset"),Ot([m("uint32")],Mt.prototype,"privLength");let Hr=Mt;function Ao(r,t=!0){if(qt.is(r))return new qt(r);if(Wr.is(r))return new Wr(r);if(Hr.is(r))return new Hr(r);if(t)throw new Error("Failed to parseFont")}function Oo(r,t=!0){const e=Ao(r,!1);if(e)return e;if(t)throw new Error("Failed to parseFont")}class Xr{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(t){this.fallbackFont=t}async loadFallbackFont(t,e={}){this.fallbackFont=await this.load(t,e)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...Xr.defaultRequestInit,...e,signal:n.signal}).then(i=>i.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.check(`14px ${t}`)||document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=CSS.escape(t);if(!document.querySelector(`style[data-family="${n}"]`)){const i=document.createElement("style");i.type="text/css",i.dataset.family=t,i.appendChild(document.createTextNode(`@font-face {
2
- font-family: "${t}";
3
- src: url(${e});
4
- }`)),document.head.appendChild(i)}return this}_parseUrls(t){const e=Array.from(new Set([...t.split(","),t]));return Array.from(new Set(e.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(t){let e;return t&&(e=this._parseUrls(t).reduce((i,o)=>i||this.loaded.get(o),void 0)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){return this._parseUrls(t).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(t){return t?(Array.isArray(t)?t:[t]).flatMap(e=>e.split(",").map(n=>n.trim())):[]}async load(t,e={}){const{cancelOther:n,injectFontFace:i=!0,injectStyleTag:o=!0,...s}=e;let a,l;typeof t=="string"?a=t:{src:a,family:l}=t;const c=this._parseFamilies(l);if(this.loaded.has(a))return n&&(this.loading.forEach(g=>g.cancel()),this.loading.clear()),u(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,s),this.loading.set(a,h)),n&&this.loading.forEach((g,f)=>{g!==h&&(g.cancel(),this.loading.delete(f))}),h.when.then(g=>{let f;return this.loaded.has(a)?f=u(this.loaded.get(a)):(f=p(g),e.noAdd||this.loaded.set(a,f)),Promise.all(Array.from(f.familySet).map(y=>(this.familyToUrl.set(y,a),typeof document<"u"&&(i&&this.injectFontFace(y,g),o&&this.injectStyleTag(y,a),i||o)?document.fonts.load(`14px ${y}`):Promise.resolve()))).then(()=>f)}).catch(g=>{if(g instanceof DOMException&&g.message==="The user aborted a request.")return p();throw g}).finally(()=>{this.loading.delete(a)});function u(g){return c.forEach(f=>{g.familySet.add(f)}),g}function p(g=new ArrayBuffer(0)){let f;function y(){return f||(f=g.byteLength?Oo(g,!1):void 0),f}function d(){const P=y();if(P instanceof qt||P instanceof Hr)return P.sfnt}return{src:a,family:l,buffer:g,familySet:new Set(c),getFont:y,getSFNT:d}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}}const Io=new Xr;function Eo(r,t,e=2){const n=t&&t.length,i=n?t[0]*e:r.length;let o=Wn(r,0,i,e,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(n&&(o=Lo(r,t,o,e)),r.length>80*e){a=r[0],l=r[1];let h=a,u=l;for(let p=e;p<i;p+=e){const g=r[p],f=r[p+1];g<a&&(a=g),f<l&&(l=f),g>h&&(h=g),f>u&&(u=f)}c=Math.max(h-a,u-l),c=c!==0?32767/c:0}return Ne(o,s,e,a,l,c,0),s}function Wn(r,t,e,n,i){let o;if(i===Xo(r,t,e,n)>0)for(let s=t;s<e;s+=n)o=Yn(s/n|0,r[s],r[s+1],o);else for(let s=e-n;s>=t;s-=n)o=Yn(s/n|0,r[s],r[s+1],o);return o&&be(o,o.next)&&(Re(o),o=o.next),o}function pe(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(be(e,e.next)||J(e.prev,e,e.next)===0)){if(Re(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Ne(r,t,e,n,i,o,s){if(!r)return;!s&&o&&jo(r,n,i,o);let a=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(o?Do(r,n,i,o):Bo(r)){t.push(l.i,r.i,c.i),Re(r),r=c.next,a=c.next;continue}if(r=c,r===a){s?s===1?(r=Fo(pe(r),t),Ne(r,t,e,n,i,o,2)):s===2&&Uo(r,t,e,n,i,o):Ne(pe(r),t,e,n,i,o,1);break}}}function Bo(r){const t=r.prev,e=r,n=r.next;if(J(t,e,n)>=0)return!1;const i=t.x,o=e.x,s=n.x,a=t.y,l=e.y,c=n.y,h=Math.min(i,o,s),u=Math.min(a,l,c),p=Math.max(i,o,s),g=Math.max(a,l,c);let f=n.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=u&&f.y<=g&&Ve(i,a,o,l,s,c,f.x,f.y)&&J(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Do(r,t,e,n){const i=r.prev,o=r,s=r.next;if(J(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,h=i.y,u=o.y,p=s.y,g=Math.min(a,l,c),f=Math.min(h,u,p),y=Math.max(a,l,c),d=Math.max(h,u,p),P=Zr(g,f,t,e,n),M=Zr(y,d,t,e,n);let w=r.prevZ,C=r.nextZ;for(;w&&w.z>=P&&C&&C.z<=M;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ve(a,h,l,u,c,p,w.x,w.y)&&J(w.prev,w,w.next)>=0||(w=w.prevZ,C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ve(a,h,l,u,c,p,C.x,C.y)&&J(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;w&&w.z>=P;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ve(a,h,l,u,c,p,w.x,w.y)&&J(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;C&&C.z<=M;){if(C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ve(a,h,l,u,c,p,C.x,C.y)&&J(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Fo(r,t){let e=r;do{const n=e.prev,i=e.next.next;!be(n,i)&&Xn(n,e,e.next,i)&&je(n,i)&&je(i,n)&&(t.push(n.i,e.i,i.i),Re(e),Re(e.next),e=r=i),e=e.next}while(e!==r);return pe(e)}function Uo(r,t,e,n,i,o){let s=r;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&qo(s,a)){let l=Zn(s,a);s=pe(s,s.next),l=pe(l,l.next),Ne(s,t,e,n,i,o,0),Ne(l,t,e,n,i,o,0);return}a=a.next}s=s.next}while(s!==r)}function Lo(r,t,e,n){const i=[];for(let o=0,s=t.length;o<s;o++){const a=t[o]*n,l=o<s-1?t[o+1]*n:r.length,c=Wn(r,a,l,n,!1);c===c.next&&(c.steiner=!0),i.push(Go(c))}i.sort($o);for(let o=0;o<i.length;o++)e=zo(i[o],e);return e}function $o(r,t){let e=r.x-t.x;if(e===0&&(e=r.y-t.y,e===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=n-i}return e}function zo(r,t){const e=No(r,t);if(!e)return t;const n=Zn(e,r);return pe(n,n.next),pe(e,e.next)}function No(r,t){let e=t;const n=r.x,i=r.y;let o=-1/0,s;if(be(r,e))return e;do{if(be(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const u=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=n&&u>o&&(o=u,s=e.x<e.next.x?e:e.next,u===n))return s}e=e.next}while(e!==t);if(!s)return null;const a=s,l=s.x,c=s.y;let h=1/0;e=s;do{if(n>=e.x&&e.x>=l&&n!==e.x&&Hn(i<c?n:o,i,l,c,i<c?o:n,i,e.x,e.y)){const u=Math.abs(i-e.y)/(n-e.x);je(e,r)&&(u<h||u===h&&(e.x>s.x||e.x===s.x&&Vo(s,e)))&&(s=e,h=u)}e=e.next}while(e!==a);return s}function Vo(r,t){return J(r.prev,r,t.prev)<0&&J(t.next,r,r.next)<0}function jo(r,t,e,n){let i=r;do i.z===0&&(i.z=Zr(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Ro(i)}function Ro(r){let t,e=1;do{let n=r,i;r=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let c=0;c<e&&(a++,s=s.nextZ,!!s);c++);let l=e;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(i=n,n=n.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=s}o.nextZ=null,e*=2}while(t>1);return r}function Zr(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Go(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Hn(r,t,e,n,i,o,s,a){return(i-s)*(t-a)>=(r-s)*(o-a)&&(r-s)*(n-a)>=(e-s)*(t-a)&&(e-s)*(o-a)>=(i-s)*(n-a)}function Ve(r,t,e,n,i,o,s,a){return!(r===s&&t===a)&&Hn(r,t,e,n,i,o,s,a)}function qo(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Wo(r,t)&&(je(r,t)&&je(t,r)&&Ho(r,t)&&(J(r.prev,r,t.prev)||J(r,t.prev,t))||be(r,t)&&J(r.prev,r,r.next)>0&&J(t.prev,t,t.next)>0)}function J(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function be(r,t){return r.x===t.x&&r.y===t.y}function Xn(r,t,e,n){const i=lr(J(r,t,e)),o=lr(J(r,t,n)),s=lr(J(e,n,r)),a=lr(J(e,n,t));return!!(i!==o&&s!==a||i===0&&ar(r,e,t)||o===0&&ar(r,n,t)||s===0&&ar(e,r,n)||a===0&&ar(e,t,n))}function ar(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function lr(r){return r>0?1:r<0?-1:0}function Wo(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Xn(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function je(r,t){return J(r.prev,r,r.next)<0?J(r,t,r.next)>=0&&J(r,r.prev,t)>=0:J(r,t,r.prev)<0||J(r,r.next,t)<0}function Ho(r,t){let e=r,n=!1;const i=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Zn(r,t){const e=Yr(r.i,r.x,r.y),n=Yr(t.i,t.x,t.y),i=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,o.next=n,n.prev=o,n}function Yn(r,t,e,n){const i=Yr(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Re(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Yr(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Xo(r,t,e,n){let i=0;for(let o=t,s=e-n;o<e;o+=n)i+=(r[s]-r[o])*(r[o+1]+r[s+1]),s=o;return i}function Zo(r,t,e,n={}){const{radius:i=1}=n;r.moveTo(t,e),r.arc(t,e,i,0,Math.PI*2)}const Yo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Kr(r,t){const{fill:e="#000",stroke:n="none",strokeWidth:i=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:c=0,shadowOffsetX:h=0,shadowOffsetY:u=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;r.fillStyle=e,r.strokeStyle=n,r.lineWidth=i,r.lineCap=o,r.lineJoin=Yo[s],r.miterLimit=a,r.setLineDash(l),r.lineDashOffset=c,r.shadowOffsetX=h,r.shadowOffsetY=u,r.shadowBlur=p,r.shadowColor=g}class k{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new k(1/0,1/0)}static get MIN(){return new k(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const n=-t/180*Math.PI,i=this.x-e.x,o=-(this.y-e.y),s=Math.sin(n),a=Math.cos(n);return this.set(e.x+(i*a-o*s),e.y-(i*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,n={x:0,y:0}){const i=t<0?n.x-this.x+n.x:this.x,o=e<0?n.y-this.y+n.y:this.y;return this.x=i*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,n={x:0,y:0}){const i=this.x-n.x,o=this.y-n.y;return this.x=n.x+(i+Math.tan(t)*o),this.y=n.y+(o+Math.tan(e)*i),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new k(this.x,this.y)}}class X{constructor(t=0,e=0,n=0,i=0){this.left=t,this.top=e,this.width=n,this.height=i}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new k((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new X;if(t.length===1)return t[0].clone();const e=t[0],n=t.slice(1).reduce((i,o)=>(i.left=Math.min(i.left,o.left),i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i),{left:e?.left??0,top:e?.top??0,right:e?.right??0,bottom:e?.bottom??0});return new X(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new X(this.left,this.top,this.width,this.height)}}class Ct{elements=[];constructor(t=1,e=0,n=0,i=0,o=1,s=0,a=0,l=0,c=1){this.set(t,e,n,i,o,s,a,l,c)}set(t,e,n,i,o,s,a,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=o,h[5]=l,h[6]=n,h[7]=s,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,o=this.elements,s=n[0],a=n[3],l=n[6],c=n[1],h=n[4],u=n[7],p=n[2],g=n[5],f=n[8],y=i[0],d=i[3],P=i[6],M=i[1],w=i[4],C=i[7],v=i[2],x=i[5],S=i[8];return o[0]=s*y+a*M+l*v,o[3]=s*d+a*w+l*x,o[6]=s*P+a*C+l*S,o[1]=c*y+h*M+u*v,o[4]=c*d+h*w+u*x,o[7]=c*P+h*C+u*S,o[2]=p*y+g*M+f*v,o[5]=p*d+g*w+f*x,o[8]=p*P+g*C+f*S,this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=h*s-a*c,p=a*l-h*o,g=c*o-s*l,f=e*u+n*p+i*g;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/f;return t[0]=u*y,t[1]=(i*c-h*n)*y,t[2]=(a*n-i*s)*y,t[3]=p*y,t[4]=(h*e-i*l)*y,t[5]=(i*o-a*e)*y,t[6]=g*y,t[7]=(n*l-c*e)*y,t[8]=(s*e-n*o)*y,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(Qr.makeScale(t,e)),this}rotate(t){return this.premultiply(Qr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Qr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Qr=new Ct;function Kn(r,t,e,n){const i=r*e+t*n,o=Math.sqrt(r*r+t*t)*Math.sqrt(e*e+n*n);let s=Math.acos(Math.max(-1,Math.min(1,i/o)));return r*n-t*e<0&&(s=-s),s}function Ko(r,t,e,n,i,o,s,a){if(t===0||e===0){r.lineTo(a.x,a.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,c=(s.y-a.y)/2,h=Math.cos(n)*l+Math.sin(n)*c,u=-Math.sin(n)*l+Math.cos(n)*c;let p=t*t,g=e*e;const f=h*h,y=u*u,d=f/p+y/g;if(d>1){const N=Math.sqrt(d);t=N*t,e=N*e,p=t*t,g=e*e}const P=p*y+g*f,M=(p*g-P)/P;let w=Math.sqrt(Math.max(0,M));i===o&&(w=-w);const C=w*t*u/e,v=-w*e*h/t,x=Math.cos(n)*C-Math.sin(n)*v+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*v+(s.y+a.y)/2,b=Kn(1,0,(h-C)/t,(u-v)/e),D=Kn((h-C)/t,(u-v)/e,(-h-C)/t,(-u-v)/e)%(Math.PI*2);r.ellipse(x,S,t,e,n,b,b+D,o===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Wt(r,t,e=0){let a=0,l=!0,c="",h="";const u=[];function p(d,P,M){const w=new SyntaxError(`Unexpected character "${d}" at index ${P}.`);throw w.partial=M,w}function g(){c!==""&&(h===""?u.push(Number(c)):u.push(Number(c)*10**Number(h))),c="",h=""}let f;const y=r.length;for(let d=0;d<y;d++){if(f=r[d],Array.isArray(t)&&t.includes(u.length%e)&&it.FLAGS.test(f)){a=1,c=f,g();continue}if(a===0){if(it.WHITESPACE.test(f))continue;if(it.DIGIT.test(f)||it.SIGN.test(f)){a=1,c=f;continue}if(it.POINT.test(f)){a=2,c=f;continue}it.COMMA.test(f)&&(l&&p(f,d,u),l=!0)}if(a===1){if(it.DIGIT.test(f)){c+=f;continue}if(it.POINT.test(f)){c+=f,a=2;continue}if(it.EXP.test(f)){a=3;continue}it.SIGN.test(f)&&c.length===1&&it.SIGN.test(c[0])&&p(f,d,u)}if(a===2){if(it.DIGIT.test(f)){c+=f;continue}if(it.EXP.test(f)){a=3;continue}it.POINT.test(f)&&c[c.length-1]==="."&&p(f,d,u)}if(a===3){if(it.DIGIT.test(f)){h+=f;continue}if(it.SIGN.test(f)){if(h===""){h+=f;continue}h.length===1&&it.SIGN.test(h)&&p(f,d,u)}}it.WHITESPACE.test(f)?(g(),a=0,l=!1):it.COMMA.test(f)?(g(),a=0,l=!0):it.SIGN.test(f)?(g(),a=1,c=f):it.POINT.test(f)?(g(),a=2,c=f):p(f,d,u)}return g(),u}function Se(r,t){return r-(t-r)}function Qn(r,t){const e=new k,n=new k;for(let i=0,o=r.length;i<o;i++){const s=r[i];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),n.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),n.x=e.x+s.x2,n.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(Se(e.x,n.x),Se(e.y,n.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),n.x=e.x+s.x2,n.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(Se(e.x,n.x),Se(e.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),n.x=e.x+s.x1,n.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=Se(e.x,n.x),l=Se(e.y,n.y);n.x=a,n.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}n.copy(e),Ko(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}function Qo(r){let t,e;const n=[];for(let i=0,o=r.length;i<o;i++){const s=r[i];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===e?.x.toFixed(4)&&s.y.toFixed(4)===e?.y.toFixed(4))continue;n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y},t={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),e={x:s.x,y:e?.y??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),e={x:e?.x??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),t&&(e={x:t.x,y:t.y});break}}return n.join(" ")}const Jo=/[a-df-z][^a-df-z]*/gi;function Jn(r){const t=[],e=r.match(Jo);if(!e)return t;for(let n=0,i=e.length;n<i;n++){const o=e[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Wt(a);for(let c=0,h=l.length;c<h;c+=2)c===0?t.push({type:s,x:l[c],y:l[c+1]}):t.push({type:s==="m"?"l":"L",x:l[c],y:l[c+1]});break;case"h":case"H":l=Wt(a);for(let c=0,h=l.length;c<h;c++)t.push({type:s,x:l[c]});break;case"v":case"V":l=Wt(a);for(let c=0,h=l.length;c<h;c++)t.push({type:s,y:l[c]});break;case"l":case"L":l=Wt(a);for(let c=0,h=l.length;c<h;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"c":case"C":l=Wt(a);for(let c=0,h=l.length;c<h;c+=6)t.push({type:s,x1:l[c],y1:l[c+1],x2:l[c+2],y2:l[c+3],x:l[c+4],y:l[c+5]});break;case"s":case"S":l=Wt(a);for(let c=0,h=l.length;c<h;c+=4)t.push({type:s,x2:l[c],y2:l[c+1],x:l[c+2],y:l[c+3]});break;case"q":case"Q":l=Wt(a);for(let c=0,h=l.length;c<h;c+=4)t.push({type:s,x1:l[c],y1:l[c+1],x:l[c+2],y:l[c+3]});break;case"t":case"T":l=Wt(a);for(let c=0,h=l.length;c<h;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"a":case"A":l=Wt(a,[3,4],7);for(let c=0,h=l.length;c<h;c+=7)t.push({type:s,rx:l[c],ry:l[c+1],angle:l[c+2],largeArcFlag:l[c+3],sweepFlag:l[c+4],x:l[c+5],y:l[c+6]});break;case"z":case"Z":t.push({type:s});break;default:console.warn(o)}}return t}const ti="data:image/svg+xml;",ei=`${ti}base64,`,ri=`${ti}charset=utf8,`;function ni(r){if(typeof r=="string"){let t;r.startsWith(ei)?(r=r.substring(ei.length,r.length),t=atob(r)):r.startsWith(ri)?(r=r.substring(ri.length,r.length),t=decodeURIComponent(r)):t=r;const e=new DOMParser().parseFromString(t,"text/xml"),n=e.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
5
- ${t}`);return e.documentElement}else return r}const ta="px",ea=90,ii=["mm","cm","in","pt","pc","px"],si={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function Y(r){let t="px";if(typeof r=="string")for(let n=0,i=ii.length;n<i;n++){const o=ii[n];if(r.endsWith(o)){t=o,r=r.substring(0,r.length-o.length);break}}let e;return e=si[t][ta],e<0&&(e=si[t].in*ea),e*Number.parseFloat(r)}const ra=new Ct,cr=new Ct,oi=new Ct,ai=new Ct;function na(r,t,e){if(!(r.hasAttribute("transform")||r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))))return null;const n=ia(r);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function ia(r){const t=new Ct,e=ra;if(r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))&&t.translate(Y(r.getAttribute("x")),Y(r.getAttribute("y"))),r.hasAttribute("transform")){const n=r.getAttribute("transform").split(")");for(let i=n.length-1;i>=0;i--){const o=n[i].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),c=Wt(o.slice(s+1));switch(e.identity(),l){case"translate":if(c.length>=1){const h=c[0];let u=0;c.length>=2&&(u=c[1]),e.translate(h,u)}break;case"rotate":if(c.length>=1){let h=0,u=0,p=0;h=c[0]*Math.PI/180,c.length>=3&&(u=c[1],p=c[2]),cr.makeTranslation(-u,-p),oi.makeRotation(h),ai.multiplyMatrices(oi,cr),cr.makeTranslation(u,p),e.multiplyMatrices(cr,ai)}break;case"scale":c.length>=1&&e.scale(c[0],c[1]??c[0]);break;case"skewX":c.length===1&&e.set(1,Math.tan(c[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":c.length===1&&e.set(1,0,0,Math.tan(c[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":c.length===6&&e.set(c[0],c[2],c[4],c[1],c[3],c[5],0,0,1);break}}t.premultiply(e)}}return t}function sa(r){return new _t().arc(Y(r.getAttribute("cx")||0),Y(r.getAttribute("cy")||0),Y(r.getAttribute("r")||0),0,Math.PI*2)}function oa(r,t){if(!(!r.sheet||!r.sheet.cssRules||!r.sheet.cssRules.length))for(let e=0;e<r.sheet.cssRules.length;e++){const n=r.sheet.cssRules[e];if(n.type!==1)continue;const i=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<i.length;s++)t[i[s]]=Object.assign(t[i[s]]||{},{...o})}}function aa(r){return new _t().ellipse(Y(r.getAttribute("cx")||0),Y(r.getAttribute("cy")||0),Y(r.getAttribute("rx")||0),Y(r.getAttribute("ry")||0),0,0,Math.PI*2)}function la(r){return new _t().moveTo(Y(r.getAttribute("x1")||0),Y(r.getAttribute("y1")||0)).lineTo(Y(r.getAttribute("x2")||0),Y(r.getAttribute("y2")||0))}function ca(r){const t=new _t,e=r.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const ha=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ua(r){const t=new _t;let e=0;return r.getAttribute("points")?.replace(ha,(n,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,n}),t.currentCurve.autoClose=!0,t}const fa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function pa(r){const t=new _t;let e=0;return r.getAttribute("points")?.replace(fa,(n,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,n}),t.currentCurve.autoClose=!1,t}function da(r){const t=Y(r.getAttribute("x")||0),e=Y(r.getAttribute("y")||0),n=Y(r.getAttribute("rx")||r.getAttribute("ry")||0),i=Y(r.getAttribute("ry")||r.getAttribute("rx")||0),o=Y(r.getAttribute("width")),s=Y(r.getAttribute("height")),a=1-.551915024494,l=new _t;return l.moveTo(t+n,e),l.lineTo(t+o-n,e),(n!==0||i!==0)&&l.bezierCurveTo(t+o-n*a,e,t+o,e+i*a,t+o,e+i),l.lineTo(t+o,e+s-i),(n!==0||i!==0)&&l.bezierCurveTo(t+o,e+s-i*a,t+o-n*a,e+s,t+o-n,e+s),l.lineTo(t+n,e+s),(n!==0||i!==0)&&l.bezierCurveTo(t+n*a,e+s,t,e+s-i*a,t,e+s-i),l.lineTo(t,e+i),(n!==0||i!==0)&&l.bezierCurveTo(t,e+i*a,t+n*a,e,t+n,e),l}function Ht(r,t,e){t=Object.assign({},t);let n={};if(r.hasAttribute("class")){const c=r.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}r.hasAttribute("id")&&(n=Object.assign(n,e[`#${r.getAttribute("id")}`]));for(let c=r.style.length,h=0;h<c;h++){const u=r.style.item(h),p=r.style.getPropertyValue(u);t[u]=p,n[u]=p}function i(c,h,u=o){r.hasAttribute(c)&&(t[h]=u(r.getAttribute(c))),n[c]&&(t[h]=u(n[c]))}function o(c){return c.startsWith("url")&&console.warn("url access in attributes is not implemented."),c}function s(c){return Math.max(0,Math.min(1,Y(c)))}function a(c){return Math.max(0,Y(c))}function l(c){return c.split(" ").filter(h=>h!=="").map(h=>Y(h))}return i("fill","fill"),i("fill-opacity","fillOpacity",s),i("fill-rule","fillRule"),i("opacity","opacity",s),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",s),i("stroke-width","strokeWidth",a),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",a),i("stroke-dasharray","strokeDasharray",l),i("stroke-dashoffset","strokeDashoffset",Y),i("visibility","visibility"),t}function Jr(r,t,e=[],n={}){if(r.nodeType!==1)return e;let i=!1,o=null,s={...t};switch(r.nodeName){case"svg":s=Ht(r,s,n);break;case"style":oa(r,n);break;case"g":s=Ht(r,s,n);break;case"path":s=Ht(r,s,n),r.hasAttribute("d")&&(o=ca(r));break;case"rect":s=Ht(r,s,n),o=da(r);break;case"polygon":s=Ht(r,s,n),o=ua(r);break;case"polyline":s=Ht(r,s,n),o=pa(r);break;case"circle":s=Ht(r,s,n),o=sa(r);break;case"ellipse":s=Ht(r,s,n),o=aa(r);break;case"line":s=Ht(r,s,n),o=la(r);break;case"defs":i=!0;break;case"use":{s=Ht(r,s,n);const p=(r.getAttributeNS("http://www.w3.org/1999/xlink","href")||r.getAttribute("href")||"").substring(1),g=r.viewportElement?.getElementById(p);g?Jr(g,s,e,n):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(r);break}if(s.display==="none")return e;const a=new Ct,l=[],c=na(r,a,l);o&&(o.applyTransform(a),e.push(o),o.style={...s});const h=r.childNodes;for(let u=0,p=h.length;u<p;u++){const g=h[u];i&&g.nodeName!=="style"&&g.nodeName!=="defs"||Jr(g,s,e,n)}return c&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}function li(r){const t=ni(r);return new se(Jr(t,{}),t.getAttribute("viewBox")?.trim().split(" ").map(e=>Number(e)))}function ci(r,t,e,n,i){const o=(n-t)*.5,s=(i-e)*.5,a=r*r,l=r*a;return(2*e-2*n+o+s)*l+(-3*e+3*n-2*o-s)*a+o*r+e}function ga(r,t){const e=1-r;return e*e*e*t}function ya(r,t){const e=1-r;return 3*e*e*r*t}function ma(r,t){return 3*(1-r)*r*r*t}function xa(r,t){return r*r*r*t}function hi(r,t,e,n,i){return ga(r,t)+ya(r,e)+ma(r,n)+xa(r,i)}function ui(r,t={}){let{vertices:e=[],indices:n=[],holes:i=[],verticesStride:o=2,verticesOffset:s=e.length/o,indicesOffset:a=n.length}=t;const l=Eo(r,i,2);if(l.length){for(let h=0;h<l.length;h+=3)n[a++]=l[h]+s,n[a++]=l[h+1]+s,n[a++]=l[h+2]+s;let c=s*o;for(let h=0;h<r.length;h+=2)e[c]=r[h],e[c+1]=r[h+1],c+=o}return{vertices:e,indices:n}}const va=8,hr=11920929e-14,wa=1;function ba(r,t,e,n,i,o,s,a,l=.5,c=[]){const u=Math.min(.99,Math.max(0,l));let p=(wa-u)/1;return p*=p,tn(r,t,e,n,i,o,s,a,c,p,0),c.push(s,a),c}function tn(r,t,e,n,i,o,s,a,l,c,h){if(h>va)return;const u=(r+e)/2,p=(t+n)/2,g=(e+i)/2,f=(n+o)/2,y=(i+s)/2,d=(o+a)/2,P=(u+g)/2,M=(p+f)/2,w=(g+y)/2,C=(f+d)/2,v=(P+w)/2,x=(M+C)/2;if(h>0){let S=s-r,b=a-t;const D=Math.abs((e-s)*b-(n-a)*S),N=Math.abs((i-s)*b-(o-a)*S);if(D>hr&&N>hr){if((D+N)*(D+N)<=c*(S*S+b*b)){l.push(v,x);return}}else if(D>hr){if(D*D<=c*(S*S+b*b)){l.push(v,x);return}}else if(N>hr){if(N*N<=c*(S*S+b*b)){l.push(v,x);return}}else if(S=v-(r+s)/2,b=x-(t+a)/2,S*S+b*b<=c){l.push(v,x);return}}tn(r,t,u,p,P,M,v,x,l,c,h+1),tn(v,x,w,C,y,d,s,a,l,c,h+1)}const Sa=8,Ca=11920929e-14,Pa=1;function Ma(r,t,e,n,i,o,s=.5,a=[]){const c=Math.min(.99,Math.max(0,s));let h=(Pa-c)/1;return h*=h,en(a,r,t,e,n,i,o,h,0),a.push(i,o),a}function en(r,t,e,n,i,o,s,a,l){if(l>Sa)return;const c=(t+n)/2,h=(e+i)/2,u=(n+o)/2,p=(i+s)/2,g=(c+u)/2,f=(h+p)/2;let y=o-t,d=s-e;const P=Math.abs((n-o)*d-(i-s)*y);if(P>Ca){if(P*P<=a*(y*y+d*d)){r.push(g,f);return}}else if(y=g-(t+o)/2,d=f-(e+s)/2,y*y+d*d<=a){r.push(g,f);return}en(r,t,e,c,h,g,f,a,l+1),en(r,g,f,u,p,o,s,a,l+1)}function _a(r){return r.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Ta(r,t,e,n){const i=t.clone().sub(r),o=n.clone().sub(e),s=e.clone().sub(r),a=i.cross(o);if(a===0)return new k((r.x+e.x)/2,(r.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new k((r.x+e.x)/2,(r.y+e.y)/2):new k(r.x+l*i.x,r.y+l*i.y)}function ka(r){let t=0;const e=r.length/2;for(let n=0;n<e;n++){const i=r[2*n],o=r[2*n+1],s=(n+1)%e,a=r[2*s],l=r[2*s+1];t+=(a-i)*(l+o)}return t}function fi(r,t,e,n,i,o){return(e-r)*(o-t)-(i-r)*(n-t)}function Aa(r,t,e){const n=e.length;let i=0;for(let o=0,s=n-2;o<n;s=o,o+=2){const a=e[o],l=e[o+1],c=e[s],h=e[s+1];l<=t?h>t&&fi(c,h,a,l,r,t)>0&&i++:h<=t&&fi(c,h,a,l,r,t)<0&&i--}return i}function Oa(r,t){const e=t[0]-r[0],n=t[1]-r[1];return Math.sqrt(e*e+n*n)}function Ia(r){const t=r.length,e=r.map((n,i)=>({index:i,dist:0,wn:0,parentIndex:void 0}));for(let n=0;n<t;n++){if(ka(r[n])<0)continue;const i=r[n],o=[...i];let s;for(let a=0;a<t;a++){if(n===a)continue;let l=0;for(let c=0;c<o.length&&(l=l||Aa(o[c],o[c+1],r[a]),!l);c+=2);if(Math.abs(l)>0){const c=Oa(i,r[a]);(!s||c<s.dist)&&(s={index:a,dist:c,wn:l})}}s&&(e[n].dist=s.dist,e[n].wn=s.wn,e[n].parentIndex=s.index)}return e}function Ea(r,t){const e=1-r;return e*e*t}function Ba(r,t){return 2*(1-r)*r*t}function Da(r,t){return r*r*t}function pi(r,t,e,n){return Ea(r,t)+Ba(r,e)+Da(r,n)}const Fa=1e-4,di=1e-4;function Ua(r,t={}){const{vertices:e=[],indices:n=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=t,a=Fa;if(r.length===0)return{vertices:e,indices:n};const l=i;let c=l.alignment;if(i.alignment!==.5){let I=La(r);o&&(I*=-1),c=(c-.5)*I+.5}const h={x:r[0],y:r[1]},u={x:r[r.length-2],y:r[r.length-1]},p=s,g=Math.abs(h.x-u.x)<a&&Math.abs(h.y-u.y)<a;if(p){r=r.slice(),g&&(r.pop(),r.pop(),u.x=r[r.length-2],u.y=r[r.length-1]);const I=(h.x+u.x)*.5,V=(u.y+h.y)*.5;r.unshift(I,V),r.push(I,V)}const f=e,y=r.length/2;let d=r.length;const P=f.length/2,M=l.width/2,w=M*M,C=l.miterLimit*l.miterLimit;let v=r[0],x=r[1],S=r[2],b=r[3],D=0,N=0,E=-(x-b),F=v-S,z=0,B=0,A=Math.sqrt(E*E+F*F);E/=A,F/=A,E*=M,F*=M;const W=c,O=(1-W)*2,L=W*2;p||(l.cap==="round"?d+=de(v-E*(O-L)*.5,x-F*(O-L)*.5,v-E*O,x-F*O,v+E*L,x+F*L,f,!0)+2:l.cap==="square"&&(d+=gi(v,x,E,F,O,L,!0,f))),f.push(v-E*O,x-F*O),f.push(v+E*L,x+F*L);for(let I=1;I<y-1;++I){v=r[(I-1)*2],x=r[(I-1)*2+1],S=r[I*2],b=r[I*2+1],D=r[(I+1)*2],N=r[(I+1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,z=-(b-N),B=S-D,A=Math.sqrt(z*z+B*B),z/=A,B/=A,z*=M,B*=M;const V=S-v,T=x-b,_=S-D,U=N-b,$=V*_+T*U,q=T*_-U*V,Z=q<0;if(Math.abs(q)<.001*Math.abs($)){f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),$>=0&&(l.join==="round"?d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+4:d+=2,f.push(S-z*L,b-B*L),f.push(S+z*O,b+B*O));continue}const rt=(-E+v)*(-F+b)-(-E+S)*(-F+x),Zt=(-z+D)*(-B+b)-(-z+S)*(-B+N),Dt=(V*Zt-_*rt)/q,Pt=(U*rt-T*Zt)/q,Tt=(Dt-S)*(Dt-S)+(Pt-b)*(Pt-b),ht=S+(Dt-S)*O,kt=b+(Pt-b)*O,Vt=S-(Dt-S)*L,jt=b-(Pt-b)*L,Ft=Math.min(V*V+T*T,_*_+U*U),Qi=Z?O:L,Jl=Ft+Qi*Qi*w;Tt<=Jl?l.join==="bevel"||Tt/w>C?(Z?(f.push(ht,kt),f.push(S+E*L,b+F*L),f.push(ht,kt),f.push(S+z*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Vt,jt),f.push(S-z*O,b-B*O),f.push(Vt,jt)),d+=2):l.join==="round"?Z?(f.push(ht,kt),f.push(S+E*L,b+F*L),d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,f,!0)+4,f.push(ht,kt),f.push(S+z*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Vt,jt),d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+4,f.push(S-z*O,b-B*O),f.push(Vt,jt)):(f.push(ht,kt),f.push(Vt,jt)):(f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),l.join==="round"?Z?d+=de(S,b,S+E*L,b+F*L,S+z*L,b+B*L,f,!0)+2:d+=de(S,b,S-E*O,b-F*O,S-z*O,b-B*O,f,!1)+2:l.join==="miter"&&Tt/w<=C&&(Z?(f.push(Vt,jt),f.push(Vt,jt)):(f.push(ht,kt),f.push(ht,kt)),d+=2),f.push(S-z*O,b-B*O),f.push(S+z*L,b+B*L),d+=2)}v=r[(y-2)*2],x=r[(y-2)*2+1],S=r[(y-1)*2],b=r[(y-1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),p||(l.cap==="round"?d+=de(S-E*(O-L)*.5,b-F*(O-L)*.5,S-E*O,b-F*O,S+E*L,b+F*L,f,!1)+2:l.cap==="square"&&(d+=gi(S,b,E,F,O,L,!1,f)));const j=di*di;for(let I=P;I<d+P-2;++I)v=f[I*2],x=f[I*2+1],S=f[(I+1)*2],b=f[(I+1)*2+1],D=f[(I+2)*2],N=f[(I+2)*2+1],!(Math.abs(v*(b-N)+S*(N-x)+D*(x-b))<j)&&n.push(I,I+1,I+2);return{vertices:e,indices:n}}function La(r){const t=r.length;if(t<6)return 1;let e=0;for(let n=0,i=r[t-2],o=r[t-1];n<t;n+=2){const s=r[n],a=r[n+1];e+=(s-i)*(a+o),i=s,o=a}return e<0?-1:1}function gi(r,t,e,n,i,o,s,a){const l=r-e*i,c=t-n*i,h=r+e*o,u=t+n*o;let p,g;s?(p=n,g=-e):(p=-n,g=e);const f=l+p,y=c+g,d=h+p,P=u+g;return a.push(f,y),a.push(d,P),2}function de(r,t,e,n,i,o,s,a){const l=e-r,c=n-t;let h=Math.atan2(l,c),u=Math.atan2(i-r,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let p=h;const g=u-h,f=Math.abs(g),y=Math.sqrt(l*l+c*c),d=(15*f*Math.sqrt(y)/Math.PI>>0)+1,P=g/d;if(p+=P,a){s.push(r,t),s.push(e,n);for(let M=1,w=p;M<d;M++,w+=P)s.push(r,t),s.push(r+Math.sin(w)*y,t+Math.cos(w)*y);s.push(r,t),s.push(i,o)}else{s.push(e,n),s.push(r,t);for(let M=1,w=p;M<d;M++,w+=P)s.push(r+Math.sin(w)*y,t+Math.cos(w)*y),s.push(r,t);s.push(i,o),s.push(r,t)}return d*2}class Ce{arcLengthDivision=200;_arcLengths;getPointAt(t,e=new k){return this.getPoint(this.getUToTMapping(t),e)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(t){const e=typeof t=="function";return this.getControlPointRefs().forEach(n=>{e?t(n):n.applyMatrix3(t)}),this}getUnevenVertices(t=5,e=[]){const n=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPoint(i/o,n),e.push(n.x,n.y);return e}getSpacedVertices(t=5,e=[]){const n=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPointAt(i/o,n),e.push(n.x,n.y);return e}getAdaptiveVertices(t=[]){return this.getUnevenVertices(5,t)}_verticesToPoints(t,e=[]){for(let n=0,i=t.length;n<i;n+=2){const o=t[n],s=t[n+1];e.push(new k(o,s))}return e}getSpacedPoints(t,e=[]){const n=this.getSpacedVertices(t);return this._verticesToPoints(n,e),e}getUnevenPoints(t,e=[]){const n=this.getUnevenVertices(t);return this._verticesToPoints(n,e),e}getAdaptivePoints(t=[]){const e=this.getAdaptiveVertices();return this._verticesToPoints(e,t),t}getPoints(t,e=[]){let n;return t?n=this.getUnevenVertices(t):n=this.getAdaptiveVertices(),this._verticesToPoints(n,e),e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const t=this.arcLengthDivision,e=[0];for(let n=0,i=this.getPoint(0),o=1;o<=t;o++){const s=this.getPoint(o/t);n+=s.distanceTo(i),e.push(n),i=s}this._arcLengths=e}getUToTMapping(t,e){const n=this.getLengths(),i=n.length,o=e??t*n[i-1];if(i<2)return o/n[0];let s=0,a=0,l=i-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=n[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(i-1);const h=n[s],p=n[s+1]-h,g=(o-h)/p;return(s+g)/(i-1)}getTangent(t,e=new k){const i=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(i)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new k){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let n=0,i=1,o=(n+i)/2;for(;i-n>e;){o=(n+i)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?n=o:i=o}return o}getMinMax(t=k.MAX,e=k.MIN){const n=this.getPoints();for(let i=0,o=n.length;i<o;i++){const s=n[i];t.min(s),e.max(s)}return{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}getFillVertices(t){return this.getAdaptiveVertices()}fillTriangulate(t){return ui(this.getFillVertices(t),t)}strokeTriangulate(t){return Ua(this.getAdaptiveVertices(),t)}toCommands(){const t=[],e=this.getPoints();for(let n=0,i=e.length;n<i;n++){const o=e[n];n===0?t.push({type:"M",x:o.x,y:o.y}):t.push({type:"L",x:o.x,y:o.y})}return t}toData(){return Qo(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivision=t.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const $a=new Ct,yi=new Ct,mi=new Ct,ur=new k;class rn extends Ce{constructor(t=new k,e=new k,n=new k,i=0,o=0,s=Math.PI*2,a=!1){super(),this._center=t,this._radius=e,this._diff=n,this.rotate=i,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(t){this._center.x=t}get cy(){return this._center.y}set cy(t){this._center.y=t}get rx(){return this._radius.x}set rx(t){this._radius.x=t}get ry(){return this._radius.y}set ry(t){this._radius.y=t}get dx(){return this._diff.x}set dx(t){this._diff.x=t}get dy(){return this._diff.y}set dy(t){this._diff.y=t}isClockwise(){return this.clockwise}_getDeltaAngle(){const t=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;return e=(e%t+t)%t,n?e=0:this.clockwise||(e=e===0?-t:e-t),e}getPoint(t,e=new k){const n=this._getDeltaAngle(),i=this.startAngle+t*n;let o=this.cx+this.rx*Math.cos(i),s=this.cy+this.ry*Math.sin(i);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),c=o-this.cx,h=s-this.cy;o=c*a-h*l+this.cx,s=c*l+h*a+this.cy}return e.set(o,s)}toCommands(){const{cx:t,cy:e,rx:n,ry:i,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,c=t+n*Math.cos(o)*Math.cos(l)-i*Math.sin(o)*Math.sin(l),h=e+n*Math.cos(o)*Math.sin(l)+i*Math.sin(o)*Math.cos(l),u=Math.abs(o-s),p=u>Math.PI?1:0,g=a?1:0,f=l*180/Math.PI;if(u>=2*Math.PI){const y=o+Math.PI,d=t+n*Math.cos(y)*Math.cos(l)-i*Math.sin(y)*Math.sin(l),P=e+n*Math.cos(y)*Math.sin(l)+i*Math.sin(y)*Math.cos(l);return[{type:"M",x:c,y:h},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:d,y:P},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:c,y:h}]}else{const y=t+n*Math.cos(s)*Math.cos(l)-i*Math.sin(s)*Math.sin(l),d=e+n*Math.cos(s)*Math.sin(l)+i*Math.sin(s)*Math.cos(l);return[{type:"M",x:c,y:h},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:p,sweepFlag:g,x:y,y:d}]}}drawTo(t){const{cx:e,cy:n,rx:i,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:c}=this;return t.ellipse(e,n,i,o,s,a,l,!c),this}applyTransform(t){return ur.set(this.cx,this.cy),ur.applyMatrix3(t),this.cx=ur.x,this.cy=ur.y,Va(t)?za(this,t):Na(this,t),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(t=[]){const{cx:e,cy:n,rx:i,ry:o,dx:s,dy:a,startAngle:l,endAngle:c,clockwise:h,rotate:u}=this,p=!h;let g=Math.abs(l-c);(!p&&l>c||p&&c>l)&&(g=2*Math.PI-g);const f=Math.max(12,Math.floor(12*i**(1/3)*(g/Math.PI)));let y=g/f,d=l;y*=p?-1:1;const P=Math.cos(p?u:-u),M=Math.sin(p?u:-u);for(let w=0;w<f+1;w++){const C=s+Math.cos(d)*i,v=a+Math.sin(d)*o,x=C*P-v*M,S=C*M+v*P;t.push(e+x,n+S),d+=y}return t}_getAdaptiveVerticesByCircle(t=[]){const{cx:e,cy:n,rx:i,ry:o,dx:s,dy:a,rotate:l,clockwise:c}=this;if(!(i>=0&&o>=0&&s>=0&&a>=0))return t;const h=Math.ceil(2.3*Math.sqrt(i+o)),u=h*8+(s?4:0)+(a?4:0),p=[];if(u===0)return t;{const y=p.length;if(h===0)p[y]=p[y+6]=e+s,p[y+1]=p[y+3]=n+a,p[y+2]=p[y+4]=e-s,p[y+5]=p[y+7]=n-a;else{let d=y,P=y+h*4+(s?2:0)+2,M=P,w=u,C=s+i,v=a,x=e+C,S=e-C,b=n+v;if(p[d++]=x,p[d++]=b,p[--P]=b,p[--P]=S,a){const N=n-v;p[M++]=S,p[M++]=N,p[--w]=N,p[--w]=x}for(let N=1;N<h;N++){const E=Math.PI/2*(N/h),F=s+Math.cos(E)*i,z=a+Math.sin(E)*o,B=e+F,A=e-F,W=n+z,O=n-z;p[d++]=B,p[d++]=W,p[--P]=W,p[--P]=A,p[M++]=A,p[M++]=O,p[--w]=O,p[--w]=B}C=s,v=a+o,x=e+C,S=e-C,b=n+v;const D=n-v;p[d++]=x,p[d++]=b,p[--w]=D,p[--w]=x,s&&(p[d++]=S,p[d++]=b,p[--w]=D,p[--w]=S)}}const g=Math.cos(c?-l:l),f=Math.sin(c?-l:l);for(let y=0;y<p.length;y+=2){const d=p[y],P=p[y+1],M=d-e,w=P-n,C=M*g-w*f,v=M*f+w*g;t.push(e+C,n+v)}return t}getAdaptiveVertices(t=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(t):this._getAdaptiveVerticesByArc(t)}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.dx=t.dx,this.dy=t.dy,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotate=t.rotate,this}}function za(r,t){const e=r.rx,n=r.ry,i=Math.cos(r.rotate),o=Math.sin(r.rotate),s=new k(e*i,e*o),a=new k(-n*o,n*i),l=s.applyMatrix3(t),c=a.applyMatrix3(t),h=$a.set(l.x,c.x,0,l.y,c.y,0,0,0,1),u=yi.copy(h).invert(),f=mi.copy(u).transpose().multiply(u).elements,y=ja(f[0],f[1],f[4]),d=Math.sqrt(y.rt1),P=Math.sqrt(y.rt2);if(r.rx=1/d,r.ry=1/P,r.rotate=Math.atan2(y.sn,y.cs),!((r.endAngle-r.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=yi.set(d,0,0,0,P,0,0,0,1),C=mi.set(y.cs,y.sn,0,-y.sn,y.cs,0,0,0,1),v=w.multiply(C).multiply(h),x=S=>{const{x:b,y:D}=new k(Math.cos(S),Math.sin(S)).applyMatrix3(v);return Math.atan2(D,b)};r.startAngle=x(r.startAngle),r.endAngle=x(r.endAngle),xi(t)&&(r.clockwise=!r.clockwise)}}function Na(r,t){const e=vi(t),n=wi(t);r.rx*=e,r.ry*=n;const i=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);r.rotate+=i,xi(t)&&(r.startAngle*=-1,r.endAngle*=-1,r.clockwise=!r.clockwise)}function xi(r){const t=r.elements;return t[0]*t[4]-t[1]*t[3]<0}function Va(r){const t=r.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=vi(r),i=wi(r);return Math.abs(e/(n*i))>Number.EPSILON}function vi(r){const t=r.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function wi(r){const t=r.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function ja(r,t,e){let n,i,o,s,a;const l=r+e,c=r-e,h=Math.sqrt(c*c+4*t*t);return l>0?(n=.5*(l+h),a=1/n,i=r*a*e-t*a*t):l<0?i=.5*(l-h):(n=.5*h,i=-.5*h),c>0?o=c+h:o=c-h,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),c>0&&(a=o,o=-s,s=a),{rt1:n,rt2:i,cs:o,sn:s}}class Ra extends rn{constructor(t=0,e=0,n=1,i=0,o=Math.PI*2,s=!1){super(new k(t,e),new k(n,n),new k,0,i,o,s)}drawTo(t){const{cx:e,cy:n,rx:i,startAngle:o,endAngle:s,clockwise:a}=this;return t.arc(e,n,i,o,s,!a),this}}class Qt extends Ce{constructor(t=new k,e=new k){super(),this.p1=t,this.p2=e}static from(t,e,n,i){return new Qt(new k(t,e),new k(n,i))}getPoint(t,e=new k){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new k){return this.getPoint(t,e)}getTangent(t,e=new k){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new k){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,p2:i}=this;return t.x=Math.min(t.x,n.x,i.x),t.y=Math.min(t.y,n.y,i.y),e.x=Math.max(e.x,n.x,i.x),e.y=Math.max(e.y,n.y,i.y),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}getFillVertices(t={}){const e=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),i=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),s=e,a=i,l=n-e||t.style?.strokeWidth||0,c=o-i||t.style?.strokeWidth||0;return[s,a,s+l,a,s+l,a+c,s,a+c]}drawTo(t){const{p1:e,p2:n}=this;return t.lineTo(e.x,e.y),t.lineTo(n.x,n.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class Ge extends Ce{constructor(t=[]){super(),this.curves=t}getFlatCurves(){return this.curves.flatMap(t=>t instanceof Ge?t.getFlatCurves():t)}addCurve(t){return this.curves.push(t),this}getPoint(t,e=new k){const n=t*this.getLength(),i=this.getLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const s=i[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,e)}o++}return e}updateLengths(){const t=[];for(let e=0,n=0,i=this.curves.length;e<i;e++)n+=this.curves[e].getLength(),t.push(n);this._arcLengths=t}getControlPointRefs(){return this.curves.flatMap(t=>t.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(t,e){const n=[t[e-1],t[e]],i=[t[e+1],t[e+2]];return n[0]===i[0]&&n[1]===i[1]&&t.splice(e+1,2),t}getSpacedVertices(t=5,e=[]){let n;return this.curves.forEach(i=>{i.getSpacedVertices(t,e),n&&this._removeNextPointIfEqualPrevPoint(e,n),n=e.length-1}),e}getAdaptiveVertices(t=[]){let e;return this.curves.forEach(n=>{n.getAdaptiveVertices(t),e&&this._removeNextPointIfEqualPrevPoint(t,e),e=t.length-1}),t}strokeTriangulate(t){return this.curves.length===1?this.curves[0].strokeTriangulate(t):super.strokeTriangulate(t)}getFillVertices(t){if(this.curves.length===1)return this.curves[0].getFillVertices(t);{const e=[];let n;return this.curves.forEach(i=>{let o;i instanceof Qt?o=i.getAdaptiveVertices():o=i.getFillVertices(t),e.push(...o),n&&this._removeNextPointIfEqualPrevPoint(e,n),n=e.length-1}),e}}applyTransform(t){return this.curves.forEach(e=>e.applyTransform(t)),this}getMinMax(t=k.MAX,e=k.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this}copy(t){return super.copy(t),this.curves=t.curves.map(e=>e.clone()),this}}class nn extends Ce{constructor(t=new k,e=new k,n=new k,i=new k){super(),this.p1=t,this.cp1=e,this.cp2=n,this.p2=i}static from(t,e,n,i,o,s,a,l){return new nn(new k(t,e),new k(n,i),new k(o,s),new k(a,l))}getPoint(t,e=new k){const{p1:n,cp1:i,cp2:o,p2:s}=this;return e.set(hi(t,n.x,i.x,o.x,s.x),hi(t,n.y,i.y,o.y,s.y))}getAdaptiveVertices(t=[]){return ba(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,e,n){const i=e*e-4*t*n;if(i<0)return[];const o=Math.sqrt(i),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,cp1:i,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(i.x-n.x),6*(o.x-i.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(i.y-n.y),6*(o.y-i.y),3*(s.y-o.y)),c=[0,1,...a,...l];return((u,p)=>{for(const g of u)for(let f=0;f<=p;f++){const y=f/p-.5,d=Math.min(1,Math.max(0,g+y)),P=this.getPoint(d);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(c,10),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp1:e,cp2:n,p2:i}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:i.x,y:i.y}]}drawTo(t){const{p1:e,cp1:n,cp2:i,p2:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(n.x,n.y,i.x,i.y,o.x,o.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class Ga extends rn{constructor(t=0,e=0,n=1,i=1,o=0,s=0,a=Math.PI*2,l=!1){super(new k(t,e),new k(n,i),new k,o,s,a,l)}drawTo(t){return t.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class qa extends Ge{}class sn extends Ce{constructor(t=new k,e=new k,n=new k){super(),this.p1=t,this.cp=e,this.p2=n}static from(t,e,n,i,o,s){return new sn(new k(t,e),new k(n,i),new k(o,s))}getPoint(t,e=new k){const{p1:n,cp:i,p2:o}=this;return e.set(pi(t,n.x,i.x,o.x),pi(t,n.y,i.y,o.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(t=[]){return Ma(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,cp:i,p2:o}=this,s=.5*(n.x+i.x),a=.5*(n.y+i.y),l=.5*(n.x+o.x),c=.5*(n.y+o.y);return t.x=Math.min(t.x,n.x,o.x,s,l),t.y=Math.min(t.y,n.y,o.y,a,c),e.x=Math.max(e.x,n.x,o.x,s,l),e.y=Math.max(e.y,n.y,o.y,a,c),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp:e,p2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{p1:e,cp:n,p2:i}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(n.x,n.y,i.x,i.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class Wa extends qa{constructor(t=0,e=0,n=0,i=0){super(),this.x=t,this.y=e,this.width=n,this.height=i,this.update()}update(){const{x:t,y:e,width:n,height:i}=this,o=[new k(t,e),new k(t+n,e),new k(t+n,e+i),new k(t,e+i)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(t){return t.rect(this.x,this.y,this.width,this.height),this}getFillVertices(t={}){const{x:e,y:n,width:i,height:o}=this;return[e,n,e+i,n,e+i,n+o,e,n+o]}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update(),this}}class Ha extends rn{constructor(t=0,e=0,n=1,i=1,o=1){super(),this.x=t,this.y=e,this.width=n,this.height=i,this.radius=o,this.update()}update(){const{x:t,y:e,width:n,height:i,radius:o}=this,s=n/2,a=i/2,l=t+s,c=e+a,h=Math.max(0,Math.min(o,Math.min(s,a))),u=h;return this._center=new k(l,c),this._radius=new k(h,u),this._diff=new k(s-h,a-u),this}drawTo(t){const{x:e,y:n,width:i,height:o,radius:s}=this;return t.roundRect(e,n,i,o,s),this}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this.update(),this}}class Xa extends Ce{constructor(t=[]){super(),this.points=t}getPoint(t,e=new k){const{points:n}=this,i=(n.length-1)*t,o=Math.floor(i),s=i-o,a=n[o===0?o:o-1],l=n[o],c=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return e.set(ci(s,a.x,l.x,c.x,h.x),ci(s,a.y,l.y,c.y,h.y)),e}getControlPointRefs(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}class fr extends Ge{startPoint;currentPoint;autoClose=!1;constructor(t){super(),t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++){const{x:i,y:o}=t[e];this.lineTo(i,o)}return this}addCommands(t){return Qn(t,this),this}addData(t){return this.addCommands(Jn(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,e=[]){return this._closeVertices(super.getUnevenVertices(t,e))}getSpacedVertices(t=40,e=[]){return this._closeVertices(super.getSpacedVertices(t,e))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new k(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const e=t.getPoint(0);(!this.currentPoint||!e.equals(this.currentPoint))&&this.lineTo(e.x,e.y)}return this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;e&&!t.equals(e)&&(this.curves.push(new Qt(e.clone(),t.clone())),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new k(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const n=this.currentPoint;return n?.equals({x:t,y:e})||this.curves.push(Qt.from(n?.x??0,n?.y??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,n,i,o,s){const a=this.currentPoint;return a?.equals({x:o,y:s})||this.curves.push(nn.from(a?.x??0,a?.y??0,t,e,n,i,o,s)),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,n,i){const o=this.currentPoint;return o?.equals({x:n,y:i})||this.curves.push(sn.from(o?.x??0,o?.y??0,t,e,n,i)),this._setCurrentPoint({x:n,y:i}),this}arc(t,e,n,i,o,s){const a=new Ra(t,e,n,i,o,!s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(t,e,n,i,o,s){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.arc(t,e,n,i,o,s),this}arcTo(t,e,n,i,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,i,o,s,a,l=!0){const c=new Ga(t,e,n,i,o,s,a,!l);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,e,n,i,o,s,a,l){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.ellipse(t,e,n,i,o,s,a,l),this}rect(t,e,n,i){const o=new Wa(t,e,n,i);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:t,y:e}),this}roundRect(t,e,n,i,o){const s=new Ha(t,e,n,i,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new k;return this.curves.push(new Xa([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=t.currentPoint?.clone(),this}}class _t extends Ge{_meta;currentCurve=new fr;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}constructor(t,e={}){super(),this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof _t?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(t){return this._meta=t,this}addPath(t){const e=this.curves.findIndex(n=>n===this.currentCurve);return e>-1&&this.curves.splice(e,1),t instanceof _t?this.curves.push(...t.curves.filter(n=>n.curves.length).map(n=>n.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new fr().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,e){return this.currentCurve.currentPoint?.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new fr,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,n,i,o,s){return this.currentCurve.bezierCurveTo(t,e,n,i,o,s),this}quadraticCurveTo(t,e,n,i){return this.currentCurve.quadraticCurveTo(t,e,n,i),this}arc(t,e,n,i,o,s){return this.currentCurve.arc(t,e,n,i,o,s),this}arcTo(t,e,n,i,o){return this.currentCurve.arcTo(t,e,n,i,o),this}ellipse(t,e,n,i,o,s,a,l){return this.currentCurve.ellipse(t,e,n,i,o,s,a,l),this}rect(t,e,n,i){return this.currentCurve.rect(t,e,n,i),this}roundRect(t,e,n,i,o){return this.currentCurve.roundRect(t,e,n,i,o),this}reset(){return this.currentCurve=new fr,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Qn(t,this),this}addData(t){return this.addCommands(Jn(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,n={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.scale(t,e,n)}),this}skew(t,e=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.skew(t,e,n)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getFlatCurves(),n=[],i=[],o=[];e.forEach((a,l)=>{const c=a.getControlPointRefs(),h=a.isClockwise();o[l]=c,i[l]=h;const u=c[0],p=c[c.length-1]??u;n.push({start:h?p:u,end:h?u:p,index:l})});const s=[];return n.forEach((a,l)=>{s[l]=[],n.forEach((c,h)=>{c.start&&a.end&&h!==l&&c.start?.equals(a.end)&&s[l].push(c.index)})}),e.forEach((a,l)=>{const c=i[l];o[l].forEach(h=>{h.add(a.getNormal(a.getTForPoint(h)).scale(c?t:-t))})}),s.forEach((a,l)=>{const c=o[l];a.forEach(h=>{const u=o[h],p=Ta(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);p&&(c[c.length-1].copy(p),u[0].copy(p))})}),this}getMinMax(t=k.MAX,e=k.MIN,n=!0){const i=this.strokeWidth;return this.curves.forEach(o=>{if(o.getMinMax(t,e),n&&i>1){const s=i/2,a=o.isClockwise(),l=[];for(let c=0;c<=1;c+=1/o.arcLengthDivision){const h=o.getPoint(c),u=o.getNormal(c),p=u.clone().scale(a?s:-s),g=u.clone().scale(a?-s:s);l.push(h.clone().add(p),h.clone().add(g),h.clone().add({x:s,y:0}),h.clone().add({x:-s,y:0}),h.clone().add({x:0,y:s}),h.clone().add({x:0,y:-s}),h.clone().add({x:s,y:s}),h.clone().add({x:-s,y:-s}))}t.min(...l),e.max(...l)}}),{min:t.finite(),max:e.finite()}}strokeTriangulate(t){const e=t?.indices??[],n=t?.vertices??[];return this.curves.forEach(i=>{i.strokeTriangulate({...t,indices:e,vertices:n,style:{...this.style}})}),{indices:e,vertices:n}}fillTriangulate(t){const e={...t,style:{...this.style,...t?.style}},n=e.indices??[],i=e.vertices??[];if((e.style.fillRule??"nonzero")==="nonzero"){const s=this.curves.map(c=>c.getFillVertices(e)),a=Ia(s),l=a.length;for(let c=0;c<l;c++){const h=a[c],u=s[c];if(h.wn||!u.length)continue;const p=u.slice(),g=[];for(let f=0;f<l;f++){const y=a[f];y.parentIndex===c&&(g.push(p.length/2),p.push(...s[y.index]))}ui(p,{...t,indices:n,vertices:i,holes:g,style:{...this.style}})}}else this.curves.forEach(s=>{s.fillTriangulate({...t,indices:n,vertices:i,style:{...this.style}})});return{indices:n,vertices:i}}getBoundingBox(t=!0){const{min:e,max:n}=this.getMinMax(void 0,void 0,t);return new X(e.x,e.y,n.x-e.x,n.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:n="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Kr(t,e),this.curves.forEach(o=>{o.drawTo(t)}),n!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:n="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Kr(t,e),this.getControlPointRefs().forEach(o=>{Zo(t,o.x,o.y,{radius:4})}),n!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const i in t)t[i]!==void 0&&(e[_a(i)]=t[i]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let n="";for(const i in e)e[i]!==void 0&&(n+=`${i}:${e[i]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class se{constructor(t=[],e){this.paths=t,this.viewBox=e}getBoundingBox(t=!0){if(!this.paths.length)return;const e=k.MAX,n=k.MIN;return this.paths.forEach(i=>i.getMinMax(e,n,t)),new X(e.x,e.y,n.x-e.x,n.y-e.y)}toTriangulatedSvgString(t=this.paths.map(n=>n.fillTriangulate()),e=0){let n="",i="";const o={x:-e,y:-e},s={x:e,y:e};(Array.isArray(t)?t:[t]).forEach(({vertices:h,indices:u,points:p=[]})=>{const g=f=>{const y=h[f*2],d=h[f*2+1];return o.x=Math.min(o.x,y+e),s.x=Math.max(s.x,y+e),o.y=Math.min(o.y,d+e),s.y=Math.max(s.y,d+e),[y,d]};for(let f=0,y=u.length;f<y;f+=3){const d=g(u[f]),P=g(u[f+1]),M=g(u[f+2]);n+=`<polygon
1
+ (function(Z,Pe){typeof exports=="object"&&typeof module<"u"?Pe(exports):typeof define=="function"&&define.amd?define(["exports"],Pe):(Z=typeof globalThis<"u"?globalThis:Z||self,Pe(Z.modernText={}))})(this,(function(Z){"use strict";var Pe={grad:.9,turn:360,rad:360/(2*Math.PI)},Yt=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ot=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},It=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},gr=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},yr=function(r){return{r:It(r.r,0,255),g:It(r.g,0,255),b:It(r.b,0,255),a:It(r.a)}},Mn=function(r){return{r:ot(r.r),g:ot(r.g),b:ot(r.b),a:ot(r.a,3)}},es=/^#([0-9a-f]{3,8})$/i,He=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},mr=function(r){var t=r.r,e=r.g,n=r.b,i=r.a,o=Math.max(t,e,n),s=o-Math.min(t,e,n),a=s?o===t?(e-n)/s:o===e?2+(n-t)/s:4+(t-e)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},xr=function(r){var t=r.h,e=r.s,n=r.v,i=r.a;t=t/360*6,e/=100,n/=100;var o=Math.floor(t),s=n*(1-e),a=n*(1-(t-o)*e),l=n*(1-(1-t+o)*e),c=o%6;return{r:255*[n,a,s,s,l,n][c],g:255*[l,n,n,a,s,s][c],b:255*[s,s,l,n,n,a][c],a:i}},vr=function(r){return{h:gr(r.h),s:It(r.s,0,100),l:It(r.l,0,100),a:It(r.a)}},wr=function(r){return{h:ot(r.h),s:ot(r.s),l:ot(r.l),a:ot(r.a,3)}},br=function(r){return xr((e=(t=r).s,{h:t.h,s:(e*=((n=t.l)<50?n:100-n)/100)>0?2*e/(n+e)*100:0,v:n+e,a:t.a}));var t,e,n},Me=function(r){return{h:(t=mr(r)).h,s:(i=(200-(e=t.s))*(n=t.v)/100)>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,n,i},ns=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rs=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,is=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ss=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Sr={string:[[function(r){var t=es.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ot(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ot(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=is.exec(r)||ss.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:yr({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:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=ns.exec(r)||rs.exec(r);if(!t)return null;var e,n,i=vr({h:(e=t[1],n=t[2],n===void 0&&(n="deg"),Number(e)*(Pe[n]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return br(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,n=r.b,i=r.a,o=i===void 0?1:i;return Yt(t)&&Yt(e)&&Yt(n)?yr({r:Number(t),g:Number(e),b:Number(n),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,n=r.l,i=r.a,o=i===void 0?1:i;if(!Yt(t)||!Yt(e)||!Yt(n))return null;var s=vr({h:Number(t),s:Number(e),l:Number(n),a:Number(o)});return br(s)},"hsl"],[function(r){var t=r.h,e=r.s,n=r.v,i=r.a,o=i===void 0?1:i;if(!Yt(t)||!Yt(e)||!Yt(n))return null;var s=(function(a){return{h:gr(a.h),s:It(a.s,0,100),v:It(a.v,0,100),a:It(a.a)}})({h:Number(t),s:Number(e),v:Number(n),a:Number(o)});return xr(s)},"hsv"]]},Cr=function(r,t){for(var e=0;e<t.length;e++){var n=t[e][0](r);if(n)return[n,t[e][1]]}return[null,void 0]},os=function(r){return typeof r=="string"?Cr(r.trim(),Sr.string):typeof r=="object"&&r!==null?Cr(r,Sr.object):[null,void 0]},_n=function(r,t){var e=Me(r);return{h:e.h,s:It(e.s+100*t,0,100),l:e.l,a:e.a}},Tn=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Pr=function(r,t){var e=Me(r);return{h:e.h,s:e.s,l:It(e.l+100*t,0,100),a:e.a}},Mr=(function(){function r(t){this.parsed=os(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ot(Tn(this.rgba),2)},r.prototype.isDark=function(){return Tn(this.rgba)<.5},r.prototype.isLight=function(){return Tn(this.rgba)>=.5},r.prototype.toHex=function(){return t=Mn(this.rgba),e=t.r,n=t.g,i=t.b,s=(o=t.a)<1?He(ot(255*o)):"","#"+He(e)+He(n)+He(i)+s;var t,e,n,i,o,s},r.prototype.toRgb=function(){return Mn(this.rgba)},r.prototype.toRgbString=function(){return t=Mn(this.rgba),e=t.r,n=t.g,i=t.b,(o=t.a)<1?"rgba("+e+", "+n+", "+i+", "+o+")":"rgb("+e+", "+n+", "+i+")";var t,e,n,i,o},r.prototype.toHsl=function(){return wr(Me(this.rgba))},r.prototype.toHslString=function(){return t=wr(Me(this.rgba)),e=t.h,n=t.s,i=t.l,(o=t.a)<1?"hsla("+e+", "+n+"%, "+i+"%, "+o+")":"hsl("+e+", "+n+"%, "+i+"%)";var t,e,n,i,o},r.prototype.toHsv=function(){return t=mr(this.rgba),{h:ot(t.h),s:ot(t.s),v:ot(t.v),a:ot(t.a,3)};var t},r.prototype.invert=function(){return jt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),jt(_n(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),jt(_n(this.rgba,-t))},r.prototype.grayscale=function(){return jt(_n(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),jt(Pr(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),jt(Pr(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?jt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ot(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Me(this.rgba);return typeof t=="number"?jt({h:t,s:e.s,l:e.l,a:e.a}):ot(e.h)},r.prototype.isEqual=function(t){return this.toHex()===jt(t).toHex()},r})(),jt=function(r){return r instanceof Mr?r:new Mr(r)};function J(r){return r==null||r===""||r==="none"}function de(r,t=0,e=10**t){return Math.round(e*r)/e+0}function Ut(r,t=!1){if(typeof r!="object"||!r)return r;if(Array.isArray(r))return t?r.map(n=>Ut(n,t)):r;const e={};for(const n in r){const i=r[n];i!=null&&(t?e[n]=Ut(i,t):e[n]=i)}return e}function Xe(r,t){const e={};return t.forEach(n=>{n in r&&(e[n]=r[n])}),e}function kn(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){const e=Array.from(new Set([...Object.keys(r),...Object.keys(t)]));return!e.length||e.every(n=>r[n]===t[n])}return!1}function as(r,t,e){const n=t.length-1;if(n<0)return r===void 0?e:r;for(let i=0;i<n;i++){if(r==null)return e;r=r[t[i]]}return r==null||r[t[n]]===void 0?e:r[t[n]]}function ls(r,t,e){const n=t.length-1;for(let i=0;i<n;i++)typeof r[t[i]]!="object"&&(r[t[i]]={}),r=r[t[i]];r[t[n]]=e}function cs(r,t,e){return r==null||!t||typeof t!="string"?e:r[t]!==void 0?r[t]:(t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),as(r,t.split("."),e))}function hs(r,t,e){if(!(typeof r!="object"||!t))return t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),ls(r,t.split("."),e)}class us{_observers=new Map;on(t,e){let n=this._observers.get(t);return n===void 0&&this._observers.set(t,n=new Set),n.add(e),this}once(t,e){const n=(...i)=>{this.off(t,n),e(...i)};return this.on(t,n),this}off(t,e){const n=this._observers.get(t);return n!==void 0&&(n.delete(e),n.size===0&&this._observers.delete(t)),this}emit(t,...e){return Array.from((this._observers.get(t)||new Map).values()).forEach(n=>n(...e)),this}destroy(){this._observers=new Map}}const An=Symbol("properties"),_r=Symbol("inited");function On(r){let t;if(Object.hasOwn(r,An))t=r[An];else{const e=Object.getPrototypeOf(r);t=new Map(e?On(e):void 0),r[An]=t}return t}function Tr(r,t,e,n){const{alias:i,internalKey:o}=n,s=r[t];i?hs(r,i,e):r[o]=e,r.onUpdateProperty?.(t,e??Ze(r,t,n),s)}function kr(r,t,e){const{alias:n,internalKey:i}=e;let o;return n?o=cs(r,n):o=r[i],o=o??Ze(r,t,e),o}function Ze(r,t,e){const{default:n,fallback:i}=e;let o;if(n!==void 0&&!r[_r]){r[_r]=!0;const s=typeof n=="function"?n():n;s!==void 0&&(r[t]=s,o=s)}return o===void 0&&i!==void 0&&(o=typeof i=="function"?i():i),o}function fs(r,t){function e(){return typeof this.getProperty<"u"?this.getProperty(r):kr(this,r,t)}function n(i){typeof this.setProperty<"u"?this.setProperty(r,i):Tr(this,r,i,t)}return{get:e,set:n}}function ps(r,t,e={}){const n={...e,internalKey:Symbol(t)};On(r).set(t,n);const i=fs(t,n);Object.defineProperty(r.prototype,t,{get(){return i.get.call(this)},set(o){i.set.call(this,o)},configurable:!0,enumerable:!0})}function te(r){return function(t,e){if(typeof e!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");ps(t.constructor,e,r)}}class ds extends us{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(t){super(),this.setProperties(t)}isDirty(t){return t?this._updatedProperties.has(t):this._updatedProperties.size>0}getProperty(t){const e=this.getPropertyDeclaration(t);if(e){if(e.internal||e.alias)return kr(this,t,e);{let n;return this._propertyAccessor?.getProperty?n=this._propertyAccessor.getProperty(t):n=this._properties.get(t),n??Ze(this,t,e)}}}setProperty(t,e){const n=this.getPropertyDeclaration(t);if(n)if(n.internal||n.alias)Tr(this,t,e,n);else{const i=this.getProperty(t);this._propertyAccessor?.setProperty?.(t,e),this._properties.set(t,e),this.onUpdateProperty?.(t,e??Ze(this,t,n),i)}}getProperties(t){const e={};for(const[n,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!t||t.includes(n))&&(e[n]=this.getProperty(n));return e}setProperties(t){if(t&&typeof t=="object")for(const e in t)this.setProperty(e,t[e]);return this}resetProperties(){for(const[t,e]of this.getPropertyDeclarations())this.setProperty(t,typeof e.default=="function"?e.default():e.default);return this}getPropertyDeclarations(){return On(this.constructor)}getPropertyDeclaration(t){return this.getPropertyDeclarations().get(t)}setPropertyAccessor(t){const e=this.getPropertyDeclarations();this._propertyAccessor=void 0;const n={};return e.forEach((i,o)=>{n[o]=this.getProperty(o)}),this._propertyAccessor=t,e.forEach((i,o)=>{const s=this.getProperty(o),a=n[o];s!==void 0&&!Object.is(s,a)&&(this.setProperty(o,s),!i.internal&&!i.alias&&this.requestUpdate(o,s,a))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(t=>globalThis.requestAnimationFrame(t)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(t){Promise.reject(t)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(t,e,n){Object.is(e,n)||this.requestUpdate(t,e,n)}requestUpdate(t,e,n){t!==void 0&&(this._updatedProperties.set(t,n),this._changedProperties.add(t),this._updateProperty(t,e,n),this.emit("updateProperty",t,e,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(t){}_updateProperty(t,e,n){}toJSON(){const t={};return this._properties.forEach((e,n)=>{e!==void 0&&(e&&typeof e=="object"?"toJSON"in e&&typeof e.toJSON=="function"?t[n]=e.toJSON():Array.isArray(e)?t[n]=[...e]:t[n]={...e}:t[n]=e)}),t}clone(){return new this.constructor(this.toJSON())}}function Ar(r){let t;return typeof r=="number"?t={r:r>>24&255,g:r>>16&255,b:r>>8&255,a:(r&255)/255}:t=r,jt(t)}function gs(r){return{r:de(r.r),g:de(r.g),b:de(r.b),a:de(r.a,3)}}function Ye(r){const t=r.toString(16);return t.length<2?`0${t}`:t}const ys="#000000FF";function ms(r){return Ar(r).isValid()}function Et(r,t=!1){const e=Ar(r);if(!e.isValid()){if(typeof r=="string")return r;const a=`Failed to normalizeColor ${r}`;if(t)throw new Error(a);return console.warn(a),ys}const{r:n,g:i,b:o,a:s}=gs(e.rgba);return`#${Ye(n)}${Ye(i)}${Ye(o)}${Ye(de(s*255))}`}var Ke=Ke||{};Ke.parse=(function(){const r={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let t="";function e(T){const _=new Error(`${t}: ${T}`);throw _.source=t,_}function n(){const T=i();return t.length>0&&e("Invalid input not EOF"),T}function i(){return w(o)}function o(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)}function s(T,_,U){return a(_,$=>{const q=U();return q&&(I(r.comma)||e("Missing comma before color stops")),{type:T,orientation:q,colorStops:w(C)}})}function a(T,_){const U=I(T);if(U){I(r.startCall)||e("Missing (");const $=_(U);return I(r.endCall)||e("Missing )"),$}}function l(){const T=c();if(T)return T;const _=V("position-keyword",r.positionKeywords,1);return _?{type:"directional",value:_.value}:u()}function c(){return V("directional",r.sideOrCorner,1)}function u(){return V("angular",r.angleValue,1)||V("angular",r.radianValue,1)}function h(){let T,_=p(),U;return _&&(T=[],T.push(_),U=t,I(r.comma)&&(_=p(),_?T.push(_):t=U)),T}function p(){let T=g()||f();if(T)T.at=d();else{const _=y();if(_){T=_;const U=d();U&&(T.at=U)}else{const U=d();if(U)T={type:"default-radial",at:U};else{const $=P();$&&(T={type:"default-radial",at:$})}}}return T}function g(){const T=V("shape",/^(circle)/i,0);return T&&(T.style=L()||y()),T}function f(){const T=V("shape",/^(ellipse)/i,0);return T&&(T.style=P()||A()||y()),T}function y(){return V("extent-keyword",r.extentKeywords,1)}function d(){if(V("position",/^at/,0)){const T=P();return T||e("Missing positioning value"),T}}function P(){const T=M();if(T.x||T.y)return{type:"position",value:T}}function M(){return{x:A(),y:A()}}function w(T){let _=T();const U=[];if(_)for(U.push(_);I(r.comma);)_=T(),_?U.push(_):e("One extra comma");return U}function C(){const T=v();return T||e("Expected color definition"),T.length=A(),T}function v(){return S()||F()||E()||D()||b()||z()||x()}function x(){return V("literal",r.literalColor,0)}function S(){return V("hex",r.hexColor,1)}function b(){return a(r.rgbColor,()=>({type:"rgb",value:w(B)}))}function D(){return a(r.rgbaColor,()=>({type:"rgba",value:w(B)}))}function z(){return a(r.varColor,()=>({type:"var",value:N()}))}function E(){return a(r.hslColor,()=>{I(r.percentageValue)&&e("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const _=B();I(r.comma);let U=I(r.percentageValue);const $=U?U[1]:null;I(r.comma),U=I(r.percentageValue);const q=U?U[1]:null;return(!$||!q)&&e("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[_,$,q]}})}function F(){return a(r.hslaColor,()=>{const T=B();I(r.comma);let _=I(r.percentageValue);const U=_?_[1]:null;I(r.comma),_=I(r.percentageValue);const $=_?_[1]:null;I(r.comma);const q=B();return(!U||!$)&&e("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[T,U,$,q]}})}function N(){return I(r.variableName)[1]}function B(){return I(r.number)[1]}function A(){return V("%",r.percentageValue,1)||W()||O()||L()}function W(){return V("position-keyword",r.positionKeywords,1)}function O(){return a(r.calcValue,()=>{let T=1,_=0;for(;T>0&&_<t.length;){const $=t.charAt(_);$==="("?T++:$===")"&&T--,_++}T>0&&e("Missing closing parenthesis in calc() expression");const U=t.substring(0,_-1);return R(_-1),{type:"calc",value:U}})}function L(){return V("px",r.pixelValue,1)||V("em",r.emValue,1)}function V(T,_,U){const $=I(_);if($)return{type:T,value:$[U]}}function I(T){let _,U;return U=/^\s+/.exec(t),U&&R(U[0].length),_=T.exec(t),_&&R(_[0].length),_}function R(T){t=t.substr(T)}return function(T){return t=T.toString().trim(),t.endsWith(";")&&(t=t.slice(0,-1)),n()}})();const Or=Ke.parse.bind(Ke);var Qe=Qe||{};Qe.stringify=(function(){var r={"visit_linear-gradient":function(t){return r.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return r.visit_gradient(t)},"visit_radial-gradient":function(t){return r.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return r.visit_gradient(t)},visit_gradient:function(t){var e=r.visit(t.orientation);return e&&(e+=", "),t.type+"("+e+r.visit(t.colorStops)+")"},visit_shape:function(t){var e=t.value,n=r.visit(t.at),i=r.visit(t.style);return i&&(e+=" "+i),n&&(e+=" at "+n),e},"visit_default-radial":function(t){var e="",n=r.visit(t.at);return n&&(e+=n),e},"visit_extent-keyword":function(t){var e=t.value,n=r.visit(t.at);return n&&(e+=" at "+n),e},"visit_position-keyword":function(t){return t.value},visit_position:function(t){return r.visit(t.value.x)+" "+r.visit(t.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_calc:function(t){return"calc("+t.value+")"},visit_literal:function(t){return r.visit_color(t.value,t)},visit_hex:function(t){return r.visit_color("#"+t.value,t)},visit_rgb:function(t){return r.visit_color("rgb("+t.value.join(", ")+")",t)},visit_rgba:function(t){return r.visit_color("rgba("+t.value.join(", ")+")",t)},visit_hsl:function(t){return r.visit_color("hsl("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%)",t)},visit_hsla:function(t){return r.visit_color("hsla("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%, "+t.value[3]+")",t)},visit_var:function(t){return r.visit_color("var("+t.value+")",t)},visit_color:function(t,e){var n=t,i=r.visit(e.length);return i&&(n+=" "+i),n},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(t){var e="",n=t.length;return t.forEach(function(i,o){e+=r.visit(i),o<n-1&&(e+=", ")}),e},visit_object:function(t){return t.width&&t.height?r.visit(t.width)+" "+r.visit(t.height):""},visit:function(t){if(!t)return"";if(t instanceof Array)return r.visit_array(t);if(typeof t=="object"&&!t.type)return r.visit_object(t);if(t.type){var e=r["visit_"+t.type];if(e)return e(t);throw Error("Missing visitor visit_"+t.type)}else throw Error("Invalid node.")}};return function(t){return r.visit(t)}})(),Qe.stringify.bind(Qe);function Ir(r){const t=r.length-1;return r.map((e,n)=>{const i=e.value;let o=de(n/t,3),s="#00000000";switch(e.type){case"rgb":s=Et({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=Et({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=Et(e.value);break;case"hex":s=Et(`#${e.value}`);break}switch(e.length?.type){case"%":o=Number(e.length.value)/100;break}return{offset:o,color:s}})}function Er(r){let t=0;switch(r.orientation?.type){case"angular":t=Number(r.orientation.value);break}return{type:"linear-gradient",angle:t,stops:Ir(r.colorStops)}}function Br(r){return r.orientation?.map(t=>{switch(t?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Ir(r.colorStops)}}function _e(r){return r.startsWith("linear-gradient(")||r.startsWith("radial-gradient(")}function xs(r){return Or(r).map(t=>{switch(t?.type){case"linear-gradient":return Er(t);case"repeating-linear-gradient":return{...Er(t),repeat:!0};case"radial-gradient":return Br(t);case"repeating-radial-gradient":return{...Br(t),repeat:!0};default:return}}).filter(Boolean)}function vs(r){let t;return typeof r=="string"?t={color:r}:t={...r},{color:Et(t.color)}}function ws(r){let t;if(typeof r=="string"?t={image:r}:t={...r},t.image){const{type:e,...n}=xs(t.image)[0]??{};switch(e){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}}return Xe(t,["linearGradient","radialGradient","rotateWithShape"])}function bs(r){let t;return typeof r=="string"?t={image:r}:t={...r},Xe(t,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function Ss(r){let t;return typeof r=="string"?t={preset:r}:t={...r},J(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=Et(t.foregroundColor),J(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=Et(t.backgroundColor),Xe(t,["preset","foregroundColor","backgroundColor"])}function Cs(r){return!J(r.color)}function Ps(r){return typeof r=="string"?ms(r):Cs(r)}function Ms(r){return!J(r.image)&&_e(r.image)||!!r.linearGradient||!!r.radialGradient}function _s(r){return typeof r=="string"?_e(r):Ms(r)}function Ts(r){return!J(r.image)&&!_e(r.image)}function ks(r){return typeof r=="string"?!_e(r):Ts(r)}function As(r){return!J(r.preset)}function Os(r){return typeof r=="string"?!1:As(r)}function Te(r){const t=r&&typeof r=="object"?r.enabled:void 0;return Ps(r)?Ut({enabled:t,...vs(r)}):_s(r)?Ut({enabled:t,...ws(r)}):ks(r)?Ut({enabled:t,...bs(r)}):Os(r)?Ut({enabled:t,...Ss(r)}):{}}function In(r){return typeof r=="string"?{...Te(r)}:{...Te(r),...Xe(r,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function Is(){return{boxShadow:"none"}}function Es(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Bs(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Ds(){return{...Es(),...Bs(),...Is(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Fs(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Us(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Ls(){return{...Fs(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function $s(){return{...Us(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Ns(){return{...$s(),...Ls(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function Je(r){return Ut({...r,color:J(r.color)?void 0:Et(r.color),backgroundColor:J(r.backgroundColor)?void 0:Et(r.backgroundColor),borderColor:J(r.borderColor)?void 0:Et(r.borderColor),outlineColor:J(r.outlineColor)?void 0:Et(r.outlineColor),shadowColor:J(r.shadowColor)?void 0:Et(r.shadowColor)})}function zs(){return{...Ds(),...Ns()}}const Rs=/\r\n|\n\r|\n|\r/,Vs=new RegExp(`^(${Rs.source})$`),js=`
2
+ `;function Gs(r){return Vs.test(r)}function Dr(r){const t=[];function e(){return t[t.length-1]}function n(a,l,c){const u=a?Je(a):{},h=l?Te(l):void 0,p=c?In(c):void 0,g=Ut({...u,fill:h,outline:p,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=g:t.push(g),g}function i(a="",l,c,u){const h=l?Je(l):{},p=c?Te(c):void 0,g=u?In(u):void 0;Array.from(a).forEach(f=>{if(Gs(f)){const{fragments:y,fill:d,outline:P,...M}=e()||n();y.length||y.push(Ut({...h,fill:p,outline:g,content:js})),n(M,d,P)}else{const y=e()||n(),d=y.fragments[y.fragments.length-1];if(d){const{content:P,fill:M,outline:w,...C}=d;if(kn(p,M)&&kn(g,w)&&kn(h,C)){d.content=`${P}${f}`;return}}y.fragments.push(Ut({...h,fill:p,outline:g,content:f}))}})}(Array.isArray(r)?r:[r]).forEach(a=>{if(typeof a=="string")n(),i(a);else if(Fr(a)){const{content:l,fill:c,outline:u,...h}=a;n(h,c,u),i(l)}else if(qs(a)){const{fragments:l,fill:c,outline:u,...h}=a;n(h,c,u),l.forEach(p=>{const{content:g,fill:f,outline:y,...d}=p;i(g,d,f,y)})}else Array.isArray(a)?(n(),a.forEach(l=>{if(typeof l=="string")i(l);else if(Fr(l)){const{content:c,fill:u,outline:h,...p}=l;i(c,p,u,h)}})):console.warn("Failed to parse text content",a)});const s=e();return s&&!s.fragments.length&&s.fragments.push({content:""}),t}function qs(r){return r&&typeof r=="object"&&"fragments"in r&&Array.isArray(r.fragments)}function Fr(r){return r&&typeof r=="object"&&"content"in r&&typeof r.content=="string"}function Ws(r){return typeof r=="string"||Array.isArray(r)?{content:Dr(r)}:Ut({...r,content:Dr(r.content??""),style:r.style?Je(r.style):void 0,effects:r.effects?r.effects.map(t=>Je(t)):void 0,measureDom:r.measureDom,fonts:r.fonts,fill:r.fill?Te(r.fill):void 0,outline:r.outline?In(r.outline):void 0})}function Hs(r,t,e=2){const n=t&&t.length,i=n?t[0]*e:r.length;let o=Ur(r,0,i,e,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(n&&(o=Qs(r,t,o,e)),r.length>80*e){a=r[0],l=r[1];let u=a,h=l;for(let p=e;p<i;p+=e){const g=r[p],f=r[p+1];g<a&&(a=g),f<l&&(l=f),g>u&&(u=g),f>h&&(h=f)}c=Math.max(u-a,h-l),c=c!==0?32767/c:0}return ke(o,s,e,a,l,c,0),s}function Ur(r,t,e,n,i){let o;if(i===co(r,t,e,n)>0)for(let s=t;s<e;s+=n)o=zr(s/n|0,r[s],r[s+1],o);else for(let s=e-n;s>=t;s-=n)o=zr(s/n|0,r[s],r[s+1],o);return o&&ge(o,o.next)&&(Ie(o),o=o.next),o}function ce(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(ge(e,e.next)||tt(e.prev,e,e.next)===0)){if(Ie(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function ke(r,t,e,n,i,o,s){if(!r)return;!s&&o&&ro(r,n,i,o);let a=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(o?Zs(r,n,i,o):Xs(r)){t.push(l.i,r.i,c.i),Ie(r),r=c.next,a=c.next;continue}if(r=c,r===a){s?s===1?(r=Ys(ce(r),t),ke(r,t,e,n,i,o,2)):s===2&&Ks(r,t,e,n,i,o):ke(ce(r),t,e,n,i,o,1);break}}}function Xs(r){const t=r.prev,e=r,n=r.next;if(tt(t,e,n)>=0)return!1;const i=t.x,o=e.x,s=n.x,a=t.y,l=e.y,c=n.y,u=Math.min(i,o,s),h=Math.min(a,l,c),p=Math.max(i,o,s),g=Math.max(a,l,c);let f=n.next;for(;f!==t;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=g&&Ae(i,a,o,l,s,c,f.x,f.y)&&tt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Zs(r,t,e,n){const i=r.prev,o=r,s=r.next;if(tt(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,u=i.y,h=o.y,p=s.y,g=Math.min(a,l,c),f=Math.min(u,h,p),y=Math.max(a,l,c),d=Math.max(u,h,p),P=En(g,f,t,e,n),M=En(y,d,t,e,n);let w=r.prevZ,C=r.nextZ;for(;w&&w.z>=P&&C&&C.z<=M;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ae(a,u,l,h,c,p,w.x,w.y)&&tt(w.prev,w,w.next)>=0||(w=w.prevZ,C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ae(a,u,l,h,c,p,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;w&&w.z>=P;){if(w.x>=g&&w.x<=y&&w.y>=f&&w.y<=d&&w!==i&&w!==s&&Ae(a,u,l,h,c,p,w.x,w.y)&&tt(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;C&&C.z<=M;){if(C.x>=g&&C.x<=y&&C.y>=f&&C.y<=d&&C!==i&&C!==s&&Ae(a,u,l,h,c,p,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Ys(r,t){let e=r;do{const n=e.prev,i=e.next.next;!ge(n,i)&&$r(n,e,e.next,i)&&Oe(n,i)&&Oe(i,n)&&(t.push(n.i,e.i,i.i),Ie(e),Ie(e.next),e=r=i),e=e.next}while(e!==r);return ce(e)}function Ks(r,t,e,n,i,o){let s=r;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&oo(s,a)){let l=Nr(s,a);s=ce(s,s.next),l=ce(l,l.next),ke(s,t,e,n,i,o,0),ke(l,t,e,n,i,o,0);return}a=a.next}s=s.next}while(s!==r)}function Qs(r,t,e,n){const i=[];for(let o=0,s=t.length;o<s;o++){const a=t[o]*n,l=o<s-1?t[o+1]*n:r.length,c=Ur(r,a,l,n,!1);c===c.next&&(c.steiner=!0),i.push(so(c))}i.sort(Js);for(let o=0;o<i.length;o++)e=to(i[o],e);return e}function Js(r,t){let e=r.x-t.x;if(e===0&&(e=r.y-t.y,e===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=n-i}return e}function to(r,t){const e=eo(r,t);if(!e)return t;const n=Nr(e,r);return ce(n,n.next),ce(e,e.next)}function eo(r,t){let e=t;const n=r.x,i=r.y;let o=-1/0,s;if(ge(r,e))return e;do{if(ge(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=n&&h>o&&(o=h,s=e.x<e.next.x?e:e.next,h===n))return s}e=e.next}while(e!==t);if(!s)return null;const a=s,l=s.x,c=s.y;let u=1/0;e=s;do{if(n>=e.x&&e.x>=l&&n!==e.x&&Lr(i<c?n:o,i,l,c,i<c?o:n,i,e.x,e.y)){const h=Math.abs(i-e.y)/(n-e.x);Oe(e,r)&&(h<u||h===u&&(e.x>s.x||e.x===s.x&&no(s,e)))&&(s=e,u=h)}e=e.next}while(e!==a);return s}function no(r,t){return tt(r.prev,r,t.prev)<0&&tt(t.next,r,r.next)<0}function ro(r,t,e,n){let i=r;do i.z===0&&(i.z=En(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,io(i)}function io(r){let t,e=1;do{let n=r,i;r=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let c=0;c<e&&(a++,s=s.nextZ,!!s);c++);let l=e;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(i=n,n=n.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=s}o.nextZ=null,e*=2}while(t>1);return r}function En(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function so(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Lr(r,t,e,n,i,o,s,a){return(i-s)*(t-a)>=(r-s)*(o-a)&&(r-s)*(n-a)>=(e-s)*(t-a)&&(e-s)*(o-a)>=(i-s)*(n-a)}function Ae(r,t,e,n,i,o,s,a){return!(r===s&&t===a)&&Lr(r,t,e,n,i,o,s,a)}function oo(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!ao(r,t)&&(Oe(r,t)&&Oe(t,r)&&lo(r,t)&&(tt(r.prev,r,t.prev)||tt(r,t.prev,t))||ge(r,t)&&tt(r.prev,r,r.next)>0&&tt(t.prev,t,t.next)>0)}function tt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ge(r,t){return r.x===t.x&&r.y===t.y}function $r(r,t,e,n){const i=en(tt(r,t,e)),o=en(tt(r,t,n)),s=en(tt(e,n,r)),a=en(tt(e,n,t));return!!(i!==o&&s!==a||i===0&&tn(r,e,t)||o===0&&tn(r,n,t)||s===0&&tn(e,r,n)||a===0&&tn(e,t,n))}function tn(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function en(r){return r>0?1:r<0?-1:0}function ao(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&$r(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Oe(r,t){return tt(r.prev,r,r.next)<0?tt(r,t,r.next)>=0&&tt(r,r.prev,t)>=0:tt(r,t,r.prev)<0||tt(r,r.next,t)<0}function lo(r,t){let e=r,n=!1;const i=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Nr(r,t){const e=Bn(r.i,r.x,r.y),n=Bn(t.i,t.x,t.y),i=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,o.next=n,n.prev=o,n}function zr(r,t,e,n){const i=Bn(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ie(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Bn(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function co(r,t,e,n){let i=0;for(let o=t,s=e-n;o<e;o+=n)i+=(r[s]-r[o])*(r[o+1]+r[s+1]),s=o;return i}function ho(r,t,e,n={}){const{radius:i=1}=n;r.moveTo(t,e),r.arc(t,e,i,0,Math.PI*2)}const uo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Dn(r,t){const{fill:e="#000",stroke:n="none",strokeWidth:i=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:c=0,shadowOffsetX:u=0,shadowOffsetY:h=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;r.fillStyle=e,r.strokeStyle=n,r.lineWidth=i,r.lineCap=o,r.lineJoin=uo[s],r.miterLimit=a,r.setLineDash(l),r.lineDashOffset=c,r.shadowOffsetX=u,r.shadowOffsetY=h,r.shadowBlur=p,r.shadowColor=g}class k{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new k(1/0,1/0)}static get MIN(){return new k(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const n=-t/180*Math.PI,i=this.x-e.x,o=-(this.y-e.y),s=Math.sin(n),a=Math.cos(n);return this.set(e.x+(i*a-o*s),e.y-(i*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,n={x:0,y:0}){const i=t<0?n.x-this.x+n.x:this.x,o=e<0?n.y-this.y+n.y:this.y;return this.x=i*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,n={x:0,y:0}){const i=this.x-n.x,o=this.y-n.y;return this.x=n.x+(i+Math.tan(t)*o),this.y=n.y+(o+Math.tan(e)*i),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new k(this.x,this.y)}}class H{constructor(t=0,e=0,n=0,i=0){this.left=t,this.top=e,this.width=n,this.height=i}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new k((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new H;if(t.length===1)return t[0].clone();const e=t[0],n=t.slice(1).reduce((i,o)=>(i.left=Math.min(i.left,o.left),i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i),{left:e?.left??0,top:e?.top??0,right:e?.right??0,bottom:e?.bottom??0});return new H(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new H(this.left,this.top,this.width,this.height)}}class vt{elements=[];constructor(t=1,e=0,n=0,i=0,o=1,s=0,a=0,l=0,c=1){this.set(t,e,n,i,o,s,a,l,c)}set(t,e,n,i,o,s,a,l,c){const u=this.elements;return u[0]=t,u[1]=i,u[2]=a,u[3]=e,u[4]=o,u[5]=l,u[6]=n,u[7]=s,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,o=this.elements,s=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],p=n[2],g=n[5],f=n[8],y=i[0],d=i[3],P=i[6],M=i[1],w=i[4],C=i[7],v=i[2],x=i[5],S=i[8];return o[0]=s*y+a*M+l*v,o[3]=s*d+a*w+l*x,o[6]=s*P+a*C+l*S,o[1]=c*y+u*M+h*v,o[4]=c*d+u*w+h*x,o[7]=c*P+u*C+h*S,o[2]=p*y+g*M+f*v,o[5]=p*d+g*w+f*x,o[8]=p*P+g*C+f*S,this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,p=a*l-u*o,g=c*o-s*l,f=e*h+n*p+i*g;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/f;return t[0]=h*y,t[1]=(i*c-u*n)*y,t[2]=(a*n-i*s)*y,t[3]=p*y,t[4]=(u*e-i*l)*y,t[5]=(i*o-a*e)*y,t[6]=g*y,t[7]=(n*l-c*e)*y,t[8]=(s*e-n*o)*y,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(Fn.makeScale(t,e)),this}rotate(t){return this.premultiply(Fn.makeRotation(-t)),this}translate(t,e){return this.premultiply(Fn.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Fn=new vt;function Rr(r,t,e,n){const i=r*e+t*n,o=Math.sqrt(r*r+t*t)*Math.sqrt(e*e+n*n);let s=Math.acos(Math.max(-1,Math.min(1,i/o)));return r*n-t*e<0&&(s=-s),s}function fo(r,t,e,n,i,o,s,a){if(t===0||e===0){r.lineTo(a.x,a.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(s.x-a.x)/2,c=(s.y-a.y)/2,u=Math.cos(n)*l+Math.sin(n)*c,h=-Math.sin(n)*l+Math.cos(n)*c;let p=t*t,g=e*e;const f=u*u,y=h*h,d=f/p+y/g;if(d>1){const z=Math.sqrt(d);t=z*t,e=z*e,p=t*t,g=e*e}const P=p*y+g*f,M=(p*g-P)/P;let w=Math.sqrt(Math.max(0,M));i===o&&(w=-w);const C=w*t*h/e,v=-w*e*u/t,x=Math.cos(n)*C-Math.sin(n)*v+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*v+(s.y+a.y)/2,b=Rr(1,0,(u-C)/t,(h-v)/e),D=Rr((u-C)/t,(h-v)/e,(-u-C)/t,(-h-v)/e)%(Math.PI*2);r.ellipse(x,S,t,e,n,b,b+D,o===0)}const rt={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Gt(r,t,e=0){let a=0,l=!0,c="",u="";const h=[];function p(d,P,M){const w=new SyntaxError(`Unexpected character "${d}" at index ${P}.`);throw w.partial=M,w}function g(){c!==""&&(u===""?h.push(Number(c)):h.push(Number(c)*10**Number(u))),c="",u=""}let f;const y=r.length;for(let d=0;d<y;d++){if(f=r[d],Array.isArray(t)&&t.includes(h.length%e)&&rt.FLAGS.test(f)){a=1,c=f,g();continue}if(a===0){if(rt.WHITESPACE.test(f))continue;if(rt.DIGIT.test(f)||rt.SIGN.test(f)){a=1,c=f;continue}if(rt.POINT.test(f)){a=2,c=f;continue}rt.COMMA.test(f)&&(l&&p(f,d,h),l=!0)}if(a===1){if(rt.DIGIT.test(f)){c+=f;continue}if(rt.POINT.test(f)){c+=f,a=2;continue}if(rt.EXP.test(f)){a=3;continue}rt.SIGN.test(f)&&c.length===1&&rt.SIGN.test(c[0])&&p(f,d,h)}if(a===2){if(rt.DIGIT.test(f)){c+=f;continue}if(rt.EXP.test(f)){a=3;continue}rt.POINT.test(f)&&c[c.length-1]==="."&&p(f,d,h)}if(a===3){if(rt.DIGIT.test(f)){u+=f;continue}if(rt.SIGN.test(f)){if(u===""){u+=f;continue}u.length===1&&rt.SIGN.test(u)&&p(f,d,h)}}rt.WHITESPACE.test(f)?(g(),a=0,l=!1):rt.COMMA.test(f)?(g(),a=0,l=!0):rt.SIGN.test(f)?(g(),a=1,c=f):rt.POINT.test(f)?(g(),a=2,c=f):p(f,d,h)}return g(),h}function ye(r,t){return r-(t-r)}function Vr(r,t){const e=new k,n=new k;for(let i=0,o=r.length;i<o;i++){const s=r[i];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),n.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),n.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),n.x=e.x+s.x2,n.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(ye(e.x,n.x),ye(e.y,n.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),n.x=e.x+s.x2,n.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(ye(e.x,n.x),ye(e.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),n.x=e.x+s.x1,n.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=ye(e.x,n.x),l=ye(e.y,n.y);n.x=a,n.y=l,s.type==="t"?(t.quadraticCurveTo(a,l,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,l,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}n.copy(e),fo(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}function po(r){let t,e;const n=[];for(let i=0,o=r.length;i<o;i++){const s=r[i];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===e?.x.toFixed(4)&&s.y.toFixed(4)===e?.y.toFixed(4))continue;n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y},t={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),e={x:s.x,y:e?.y??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),e={x:e?.x??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),e={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),t&&(e={x:t.x,y:t.y});break}}return n.join(" ")}const go=/[a-df-z][^a-df-z]*/gi;function jr(r){const t=[],e=r.match(go);if(!e)return t;for(let n=0,i=e.length;n<i;n++){const o=e[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Gt(a);for(let c=0,u=l.length;c<u;c+=2)c===0?t.push({type:s,x:l[c],y:l[c+1]}):t.push({type:s==="m"?"l":"L",x:l[c],y:l[c+1]});break;case"h":case"H":l=Gt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,x:l[c]});break;case"v":case"V":l=Gt(a);for(let c=0,u=l.length;c<u;c++)t.push({type:s,y:l[c]});break;case"l":case"L":l=Gt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"c":case"C":l=Gt(a);for(let c=0,u=l.length;c<u;c+=6)t.push({type:s,x1:l[c],y1:l[c+1],x2:l[c+2],y2:l[c+3],x:l[c+4],y:l[c+5]});break;case"s":case"S":l=Gt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x2:l[c],y2:l[c+1],x:l[c+2],y:l[c+3]});break;case"q":case"Q":l=Gt(a);for(let c=0,u=l.length;c<u;c+=4)t.push({type:s,x1:l[c],y1:l[c+1],x:l[c+2],y:l[c+3]});break;case"t":case"T":l=Gt(a);for(let c=0,u=l.length;c<u;c+=2)t.push({type:s,x:l[c],y:l[c+1]});break;case"a":case"A":l=Gt(a,[3,4],7);for(let c=0,u=l.length;c<u;c+=7)t.push({type:s,rx:l[c],ry:l[c+1],angle:l[c+2],largeArcFlag:l[c+3],sweepFlag:l[c+4],x:l[c+5],y:l[c+6]});break;case"z":case"Z":t.push({type:s});break;default:console.warn(o)}}return t}const Gr="data:image/svg+xml;",qr=`${Gr}base64,`,Wr=`${Gr}charset=utf8,`;function Hr(r){if(typeof r=="string"){let t;r.startsWith(qr)?(r=r.substring(qr.length,r.length),t=atob(r)):r.startsWith(Wr)?(r=r.substring(Wr.length,r.length),t=decodeURIComponent(r)):t=r;const e=new DOMParser().parseFromString(t,"text/xml"),n=e.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
3
+ ${t}`);return e.documentElement}else return r}const yo="px",mo=90,Xr=["mm","cm","in","pt","pc","px"],Zr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function Y(r){let t="px";if(typeof r=="string")for(let n=0,i=Xr.length;n<i;n++){const o=Xr[n];if(r.endsWith(o)){t=o,r=r.substring(0,r.length-o.length);break}}let e;return e=Zr[t][yo],e<0&&(e=Zr[t].in*mo),e*Number.parseFloat(r)}const xo=new vt,nn=new vt,Yr=new vt,Kr=new vt;function vo(r,t,e){if(!(r.hasAttribute("transform")||r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))))return null;const n=wo(r);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function wo(r){const t=new vt,e=xo;if(r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))&&t.translate(Y(r.getAttribute("x")),Y(r.getAttribute("y"))),r.hasAttribute("transform")){const n=r.getAttribute("transform").split(")");for(let i=n.length-1;i>=0;i--){const o=n[i].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),c=Gt(o.slice(s+1));switch(e.identity(),l){case"translate":if(c.length>=1){const u=c[0];let h=0;c.length>=2&&(h=c[1]),e.translate(u,h)}break;case"rotate":if(c.length>=1){let u=0,h=0,p=0;u=c[0]*Math.PI/180,c.length>=3&&(h=c[1],p=c[2]),nn.makeTranslation(-h,-p),Yr.makeRotation(u),Kr.multiplyMatrices(Yr,nn),nn.makeTranslation(h,p),e.multiplyMatrices(nn,Kr)}break;case"scale":c.length>=1&&e.scale(c[0],c[1]??c[0]);break;case"skewX":c.length===1&&e.set(1,Math.tan(c[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":c.length===1&&e.set(1,0,0,Math.tan(c[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":c.length===6&&e.set(c[0],c[2],c[4],c[1],c[3],c[5],0,0,1);break}}t.premultiply(e)}}return t}function bo(r){return new Mt().arc(Y(r.getAttribute("cx")||0),Y(r.getAttribute("cy")||0),Y(r.getAttribute("r")||0),0,Math.PI*2)}function So(r,t){if(!(!r.sheet||!r.sheet.cssRules||!r.sheet.cssRules.length))for(let e=0;e<r.sheet.cssRules.length;e++){const n=r.sheet.cssRules[e];if(n.type!==1)continue;const i=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<i.length;s++)t[i[s]]=Object.assign(t[i[s]]||{},{...o})}}function Co(r){return new Mt().ellipse(Y(r.getAttribute("cx")||0),Y(r.getAttribute("cy")||0),Y(r.getAttribute("rx")||0),Y(r.getAttribute("ry")||0),0,0,Math.PI*2)}function Po(r){return new Mt().moveTo(Y(r.getAttribute("x1")||0),Y(r.getAttribute("y1")||0)).lineTo(Y(r.getAttribute("x2")||0),Y(r.getAttribute("y2")||0))}function Mo(r){const t=new Mt,e=r.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const _o=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function To(r){const t=new Mt;let e=0;return r.getAttribute("points")?.replace(_o,(n,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,n}),t.currentCurve.autoClose=!0,t}const ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ao(r){const t=new Mt;let e=0;return r.getAttribute("points")?.replace(ko,(n,i,o)=>{const s=Y(i),a=Y(o);return e===0?t.moveTo(s,a):t.lineTo(s,a),e++,n}),t.currentCurve.autoClose=!1,t}function Oo(r){const t=Y(r.getAttribute("x")||0),e=Y(r.getAttribute("y")||0),n=Y(r.getAttribute("rx")||r.getAttribute("ry")||0),i=Y(r.getAttribute("ry")||r.getAttribute("rx")||0),o=Y(r.getAttribute("width")),s=Y(r.getAttribute("height")),a=1-.551915024494,l=new Mt;return l.moveTo(t+n,e),l.lineTo(t+o-n,e),(n!==0||i!==0)&&l.bezierCurveTo(t+o-n*a,e,t+o,e+i*a,t+o,e+i),l.lineTo(t+o,e+s-i),(n!==0||i!==0)&&l.bezierCurveTo(t+o,e+s-i*a,t+o-n*a,e+s,t+o-n,e+s),l.lineTo(t+n,e+s),(n!==0||i!==0)&&l.bezierCurveTo(t+n*a,e+s,t,e+s-i*a,t,e+s-i),l.lineTo(t,e+i),(n!==0||i!==0)&&l.bezierCurveTo(t,e+i*a,t+n*a,e,t+n,e),l}function qt(r,t,e){t=Object.assign({},t);let n={};if(r.hasAttribute("class")){const c=r.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<c.length;u++)n=Object.assign(n,e[`.${c[u]}`])}r.hasAttribute("id")&&(n=Object.assign(n,e[`#${r.getAttribute("id")}`]));for(let c=r.style.length,u=0;u<c;u++){const h=r.style.item(u),p=r.style.getPropertyValue(h);t[h]=p,n[h]=p}function i(c,u,h=o){r.hasAttribute(c)&&(t[u]=h(r.getAttribute(c))),n[c]&&(t[u]=h(n[c]))}function o(c){return c.startsWith("url")&&console.warn("url access in attributes is not implemented."),c}function s(c){return Math.max(0,Math.min(1,Y(c)))}function a(c){return Math.max(0,Y(c))}function l(c){return c.split(" ").filter(u=>u!=="").map(u=>Y(u))}return i("fill","fill"),i("fill-opacity","fillOpacity",s),i("fill-rule","fillRule"),i("opacity","opacity",s),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",s),i("stroke-width","strokeWidth",a),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",a),i("stroke-dasharray","strokeDasharray",l),i("stroke-dashoffset","strokeDashoffset",Y),i("visibility","visibility"),t}function Un(r,t,e=[],n={}){if(r.nodeType!==1)return e;let i=!1,o=null,s={...t};switch(r.nodeName){case"svg":s=qt(r,s,n);break;case"style":So(r,n);break;case"g":s=qt(r,s,n);break;case"path":s=qt(r,s,n),r.hasAttribute("d")&&(o=Mo(r));break;case"rect":s=qt(r,s,n),o=Oo(r);break;case"polygon":s=qt(r,s,n),o=To(r);break;case"polyline":s=qt(r,s,n),o=Ao(r);break;case"circle":s=qt(r,s,n),o=bo(r);break;case"ellipse":s=qt(r,s,n),o=Co(r);break;case"line":s=qt(r,s,n),o=Po(r);break;case"defs":i=!0;break;case"use":{s=qt(r,s,n);const p=(r.getAttributeNS("http://www.w3.org/1999/xlink","href")||r.getAttribute("href")||"").substring(1),g=r.viewportElement?.getElementById(p);g?Un(g,s,e,n):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(r);break}if(s.display==="none")return e;const a=new vt,l=[],c=vo(r,a,l);o&&(o.applyTransform(a),e.push(o),o.style={...s});const u=r.childNodes;for(let h=0,p=u.length;h<p;h++){const g=u[h];i&&g.nodeName!=="style"&&g.nodeName!=="defs"||Un(g,s,e,n)}return c&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}function Qr(r){const t=Hr(r);return new ee(Un(t,{}),t.getAttribute("viewBox")?.trim().split(" ").map(e=>Number(e)))}function Jr(r,t,e,n,i){const o=(n-t)*.5,s=(i-e)*.5,a=r*r,l=r*a;return(2*e-2*n+o+s)*l+(-3*e+3*n-2*o-s)*a+o*r+e}function Io(r,t){const e=1-r;return e*e*e*t}function Eo(r,t){const e=1-r;return 3*e*e*r*t}function Bo(r,t){return 3*(1-r)*r*r*t}function Do(r,t){return r*r*r*t}function ti(r,t,e,n,i){return Io(r,t)+Eo(r,e)+Bo(r,n)+Do(r,i)}function ei(r,t={}){let{vertices:e=[],indices:n=[],holes:i=[],verticesStride:o=2,verticesOffset:s=e.length/o,indicesOffset:a=n.length}=t;const l=Hs(r,i,2);if(l.length){for(let u=0;u<l.length;u+=3)n[a++]=l[u]+s,n[a++]=l[u+1]+s,n[a++]=l[u+2]+s;let c=s*o;for(let u=0;u<r.length;u+=2)e[c]=r[u],e[c+1]=r[u+1],c+=o}return{vertices:e,indices:n}}const Fo=8,rn=11920929e-14,Uo=1;function Lo(r,t,e,n,i,o,s,a,l=.5,c=[]){const h=Math.min(.99,Math.max(0,l));let p=(Uo-h)/1;return p*=p,Ln(r,t,e,n,i,o,s,a,c,p,0),c.push(s,a),c}function Ln(r,t,e,n,i,o,s,a,l,c,u){if(u>Fo)return;const h=(r+e)/2,p=(t+n)/2,g=(e+i)/2,f=(n+o)/2,y=(i+s)/2,d=(o+a)/2,P=(h+g)/2,M=(p+f)/2,w=(g+y)/2,C=(f+d)/2,v=(P+w)/2,x=(M+C)/2;if(u>0){let S=s-r,b=a-t;const D=Math.abs((e-s)*b-(n-a)*S),z=Math.abs((i-s)*b-(o-a)*S);if(D>rn&&z>rn){if((D+z)*(D+z)<=c*(S*S+b*b)){l.push(v,x);return}}else if(D>rn){if(D*D<=c*(S*S+b*b)){l.push(v,x);return}}else if(z>rn){if(z*z<=c*(S*S+b*b)){l.push(v,x);return}}else if(S=v-(r+s)/2,b=x-(t+a)/2,S*S+b*b<=c){l.push(v,x);return}}Ln(r,t,h,p,P,M,v,x,l,c,u+1),Ln(v,x,w,C,y,d,s,a,l,c,u+1)}const $o=8,No=11920929e-14,zo=1;function Ro(r,t,e,n,i,o,s=.5,a=[]){const c=Math.min(.99,Math.max(0,s));let u=(zo-c)/1;return u*=u,$n(a,r,t,e,n,i,o,u,0),a.push(i,o),a}function $n(r,t,e,n,i,o,s,a,l){if(l>$o)return;const c=(t+n)/2,u=(e+i)/2,h=(n+o)/2,p=(i+s)/2,g=(c+h)/2,f=(u+p)/2;let y=o-t,d=s-e;const P=Math.abs((n-o)*d-(i-s)*y);if(P>No){if(P*P<=a*(y*y+d*d)){r.push(g,f);return}}else if(y=g-(t+o)/2,d=f-(e+s)/2,y*y+d*d<=a){r.push(g,f);return}$n(r,t,e,c,u,g,f,a,l+1),$n(r,g,f,h,p,o,s,a,l+1)}function Vo(r){return r.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(r,t,e,n){const i=t.clone().sub(r),o=n.clone().sub(e),s=e.clone().sub(r),a=i.cross(o);if(a===0)return new k((r.x+e.x)/2,(r.y+e.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new k((r.x+e.x)/2,(r.y+e.y)/2):new k(r.x+l*i.x,r.y+l*i.y)}function Go(r){let t=0;const e=r.length/2;for(let n=0;n<e;n++){const i=r[2*n],o=r[2*n+1],s=(n+1)%e,a=r[2*s],l=r[2*s+1];t+=(a-i)*(l+o)}return t}function ni(r,t,e,n,i,o){return(e-r)*(o-t)-(i-r)*(n-t)}function qo(r,t,e){const n=e.length;let i=0;for(let o=0,s=n-2;o<n;s=o,o+=2){const a=e[o],l=e[o+1],c=e[s],u=e[s+1];l<=t?u>t&&ni(c,u,a,l,r,t)>0&&i++:u<=t&&ni(c,u,a,l,r,t)<0&&i--}return i}function Wo(r,t){const e=t[0]-r[0],n=t[1]-r[1];return Math.sqrt(e*e+n*n)}function Ho(r){const t=r.length,e=r.map((n,i)=>({index:i,dist:0,wn:0,parentIndex:void 0}));for(let n=0;n<t;n++){if(Go(r[n])<0)continue;const i=r[n],o=[...i];let s;for(let a=0;a<t;a++){if(n===a)continue;let l=0;for(let c=0;c<o.length&&(l=l||qo(o[c],o[c+1],r[a]),!l);c+=2);if(Math.abs(l)>0){const c=Wo(i,r[a]);(!s||c<s.dist)&&(s={index:a,dist:c,wn:l})}}s&&(e[n].dist=s.dist,e[n].wn=s.wn,e[n].parentIndex=s.index)}return e}function Xo(r,t){const e=1-r;return e*e*t}function Zo(r,t){return 2*(1-r)*r*t}function Yo(r,t){return r*r*t}function ri(r,t,e,n){return Xo(r,t)+Zo(r,e)+Yo(r,n)}const Ko=1e-4,ii=1e-4;function Qo(r,t={}){const{vertices:e=[],indices:n=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=t,a=Ko;if(r.length===0)return{vertices:e,indices:n};const l=i;let c=l.alignment;if(i.alignment!==.5){let I=Jo(r);o&&(I*=-1),c=(c-.5)*I+.5}const u={x:r[0],y:r[1]},h={x:r[r.length-2],y:r[r.length-1]},p=s,g=Math.abs(u.x-h.x)<a&&Math.abs(u.y-h.y)<a;if(p){r=r.slice(),g&&(r.pop(),r.pop(),h.x=r[r.length-2],h.y=r[r.length-1]);const I=(u.x+h.x)*.5,R=(h.y+u.y)*.5;r.unshift(I,R),r.push(I,R)}const f=e,y=r.length/2;let d=r.length;const P=f.length/2,M=l.width/2,w=M*M,C=l.miterLimit*l.miterLimit;let v=r[0],x=r[1],S=r[2],b=r[3],D=0,z=0,E=-(x-b),F=v-S,N=0,B=0,A=Math.sqrt(E*E+F*F);E/=A,F/=A,E*=M,F*=M;const W=c,O=(1-W)*2,L=W*2;p||(l.cap==="round"?d+=he(v-E*(O-L)*.5,x-F*(O-L)*.5,v-E*O,x-F*O,v+E*L,x+F*L,f,!0)+2:l.cap==="square"&&(d+=si(v,x,E,F,O,L,!0,f))),f.push(v-E*O,x-F*O),f.push(v+E*L,x+F*L);for(let I=1;I<y-1;++I){v=r[(I-1)*2],x=r[(I-1)*2+1],S=r[I*2],b=r[I*2+1],D=r[(I+1)*2],z=r[(I+1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,N=-(b-z),B=S-D,A=Math.sqrt(N*N+B*B),N/=A,B/=A,N*=M,B*=M;const R=S-v,T=x-b,_=S-D,U=z-b,$=R*_+T*U,q=T*_-U*R,X=q<0;if(Math.abs(q)<.001*Math.abs($)){f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),$>=0&&(l.join==="round"?d+=he(S,b,S-E*O,b-F*O,S-N*O,b-B*O,f,!1)+4:d+=2,f.push(S-N*L,b-B*L),f.push(S+N*O,b+B*O));continue}const nt=(-E+v)*(-F+b)-(-E+S)*(-F+x),Zt=(-N+D)*(-B+b)-(-N+S)*(-B+z),Dt=(R*Zt-_*nt)/q,Pt=(U*nt-T*Zt)/q,Tt=(Dt-S)*(Dt-S)+(Pt-b)*(Pt-b),ht=S+(Dt-S)*O,kt=b+(Pt-b)*O,Rt=S-(Dt-S)*L,Vt=b-(Pt-b)*L,Ft=Math.min(R*R+T*T,_*_+U*U),Yi=X?O:L,Xl=Ft+Yi*Yi*w;Tt<=Xl?l.join==="bevel"||Tt/w>C?(X?(f.push(ht,kt),f.push(S+E*L,b+F*L),f.push(ht,kt),f.push(S+N*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Rt,Vt),f.push(S-N*O,b-B*O),f.push(Rt,Vt)),d+=2):l.join==="round"?X?(f.push(ht,kt),f.push(S+E*L,b+F*L),d+=he(S,b,S+E*L,b+F*L,S+N*L,b+B*L,f,!0)+4,f.push(ht,kt),f.push(S+N*L,b+B*L)):(f.push(S-E*O,b-F*O),f.push(Rt,Vt),d+=he(S,b,S-E*O,b-F*O,S-N*O,b-B*O,f,!1)+4,f.push(S-N*O,b-B*O),f.push(Rt,Vt)):(f.push(ht,kt),f.push(Rt,Vt)):(f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),l.join==="round"?X?d+=he(S,b,S+E*L,b+F*L,S+N*L,b+B*L,f,!0)+2:d+=he(S,b,S-E*O,b-F*O,S-N*O,b-B*O,f,!1)+2:l.join==="miter"&&Tt/w<=C&&(X?(f.push(Rt,Vt),f.push(Rt,Vt)):(f.push(ht,kt),f.push(ht,kt)),d+=2),f.push(S-N*O,b-B*O),f.push(S+N*L,b+B*L),d+=2)}v=r[(y-2)*2],x=r[(y-2)*2+1],S=r[(y-1)*2],b=r[(y-1)*2+1],E=-(x-b),F=v-S,A=Math.sqrt(E*E+F*F),E/=A,F/=A,E*=M,F*=M,f.push(S-E*O,b-F*O),f.push(S+E*L,b+F*L),p||(l.cap==="round"?d+=he(S-E*(O-L)*.5,b-F*(O-L)*.5,S-E*O,b-F*O,S+E*L,b+F*L,f,!1)+2:l.cap==="square"&&(d+=si(S,b,E,F,O,L,!1,f)));const V=ii*ii;for(let I=P;I<d+P-2;++I)v=f[I*2],x=f[I*2+1],S=f[(I+1)*2],b=f[(I+1)*2+1],D=f[(I+2)*2],z=f[(I+2)*2+1],!(Math.abs(v*(b-z)+S*(z-x)+D*(x-b))<V)&&n.push(I,I+1,I+2);return{vertices:e,indices:n}}function Jo(r){const t=r.length;if(t<6)return 1;let e=0;for(let n=0,i=r[t-2],o=r[t-1];n<t;n+=2){const s=r[n],a=r[n+1];e+=(s-i)*(a+o),i=s,o=a}return e<0?-1:1}function si(r,t,e,n,i,o,s,a){const l=r-e*i,c=t-n*i,u=r+e*o,h=t+n*o;let p,g;s?(p=n,g=-e):(p=-n,g=e);const f=l+p,y=c+g,d=u+p,P=h+g;return a.push(f,y),a.push(d,P),2}function he(r,t,e,n,i,o,s,a){const l=e-r,c=n-t;let u=Math.atan2(l,c),h=Math.atan2(i-r,o-t);a&&u<h?u+=Math.PI*2:!a&&u>h&&(h+=Math.PI*2);let p=u;const g=h-u,f=Math.abs(g),y=Math.sqrt(l*l+c*c),d=(15*f*Math.sqrt(y)/Math.PI>>0)+1,P=g/d;if(p+=P,a){s.push(r,t),s.push(e,n);for(let M=1,w=p;M<d;M++,w+=P)s.push(r,t),s.push(r+Math.sin(w)*y,t+Math.cos(w)*y);s.push(r,t),s.push(i,o)}else{s.push(e,n),s.push(r,t);for(let M=1,w=p;M<d;M++,w+=P)s.push(r+Math.sin(w)*y,t+Math.cos(w)*y),s.push(r,t);s.push(i,o),s.push(r,t)}return d*2}class me{arcLengthDivision=200;_arcLengths;getPointAt(t,e=new k){return this.getPoint(this.getUToTMapping(t),e)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(t){const e=typeof t=="function";return this.getControlPointRefs().forEach(n=>{e?t(n):n.applyMatrix3(t)}),this}getUnevenVertices(t=5,e=[]){const n=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPoint(i/o,n),e.push(n.x,n.y);return e}getSpacedVertices(t=5,e=[]){const n=new k;for(let i=0,o=Math.max(1,t)-1;i<=o;i++)this.getPointAt(i/o,n),e.push(n.x,n.y);return e}getAdaptiveVertices(t=[]){return this.getUnevenVertices(5,t)}_verticesToPoints(t,e=[]){for(let n=0,i=t.length;n<i;n+=2){const o=t[n],s=t[n+1];e.push(new k(o,s))}return e}getSpacedPoints(t,e=[]){const n=this.getSpacedVertices(t);return this._verticesToPoints(n,e),e}getUnevenPoints(t,e=[]){const n=this.getUnevenVertices(t);return this._verticesToPoints(n,e),e}getAdaptivePoints(t=[]){const e=this.getAdaptiveVertices();return this._verticesToPoints(e,t),t}getPoints(t,e=[]){let n;return t?n=this.getUnevenVertices(t):n=this.getAdaptiveVertices(),this._verticesToPoints(n,e),e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const t=this.arcLengthDivision,e=[0];for(let n=0,i=this.getPoint(0),o=1;o<=t;o++){const s=this.getPoint(o/t);n+=s.distanceTo(i),e.push(n),i=s}this._arcLengths=e}getUToTMapping(t,e){const n=this.getLengths(),i=n.length,o=e??t*n[i-1];if(i<2)return o/n[0];let s=0,a=0,l=i-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=n[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(i-1);const u=n[s],p=n[s+1]-u,g=(o-u)/p;return(s+g)/(i-1)}getTangent(t,e=new k){const i=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(i)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new k){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let n=0,i=1,o=(n+i)/2;for(;i-n>e;){o=(n+i)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?n=o:i=o}return o}getMinMax(t=k.MAX,e=k.MIN){const n=this.getPoints();for(let i=0,o=n.length;i<o;i++){const s=n[i];t.min(s),e.max(s)}return{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new H(t.x,t.y,e.x-t.x,e.y-t.y)}getFillVertices(t){return this.getAdaptiveVertices()}fillTriangulate(t){return ei(this.getFillVertices(t),t)}strokeTriangulate(t){return Qo(this.getAdaptiveVertices(),t)}toCommands(){const t=[],e=this.getPoints();for(let n=0,i=e.length;n<i;n++){const o=e[n];n===0?t.push({type:"M",x:o.x,y:o.y}):t.push({type:"L",x:o.x,y:o.y})}return t}toData(){return po(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivision=t.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const ta=new vt,oi=new vt,ai=new vt,sn=new k;class Nn extends me{constructor(t=new k,e=new k,n=new k,i=0,o=0,s=Math.PI*2,a=!1){super(),this._center=t,this._radius=e,this._diff=n,this.rotate=i,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(t){this._center.x=t}get cy(){return this._center.y}set cy(t){this._center.y=t}get rx(){return this._radius.x}set rx(t){this._radius.x=t}get ry(){return this._radius.y}set ry(t){this._radius.y=t}get dx(){return this._diff.x}set dx(t){this._diff.x=t}get dy(){return this._diff.y}set dy(t){this._diff.y=t}isClockwise(){return this.clockwise}_getDeltaAngle(){const t=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;return e=(e%t+t)%t,n?e=0:this.clockwise||(e=e===0?-t:e-t),e}getPoint(t,e=new k){const n=this._getDeltaAngle(),i=this.startAngle+t*n;let o=this.cx+this.rx*Math.cos(i),s=this.cy+this.ry*Math.sin(i);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),c=o-this.cx,u=s-this.cy;o=c*a-u*l+this.cx,s=c*l+u*a+this.cy}return e.set(o,s)}toCommands(){const{cx:t,cy:e,rx:n,ry:i,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,c=t+n*Math.cos(o)*Math.cos(l)-i*Math.sin(o)*Math.sin(l),u=e+n*Math.cos(o)*Math.sin(l)+i*Math.sin(o)*Math.cos(l),h=Math.abs(o-s),p=h>Math.PI?1:0,g=a?1:0,f=l*180/Math.PI;if(h>=2*Math.PI){const y=o+Math.PI,d=t+n*Math.cos(y)*Math.cos(l)-i*Math.sin(y)*Math.sin(l),P=e+n*Math.cos(y)*Math.sin(l)+i*Math.sin(y)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:d,y:P},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const y=t+n*Math.cos(s)*Math.cos(l)-i*Math.sin(s)*Math.sin(l),d=e+n*Math.cos(s)*Math.sin(l)+i*Math.sin(s)*Math.cos(l);return[{type:"M",x:c,y:u},{type:"A",rx:n,ry:i,angle:f,largeArcFlag:p,sweepFlag:g,x:y,y:d}]}}drawTo(t){const{cx:e,cy:n,rx:i,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:c}=this;return t.ellipse(e,n,i,o,s,a,l,!c),this}applyTransform(t){return sn.set(this.cx,this.cy),sn.applyMatrix3(t),this.cx=sn.x,this.cy=sn.y,ra(t)?ea(this,t):na(this,t),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(t=[]){const{cx:e,cy:n,rx:i,ry:o,dx:s,dy:a,startAngle:l,endAngle:c,clockwise:u,rotate:h}=this,p=!u;let g=Math.abs(l-c);(!p&&l>c||p&&c>l)&&(g=2*Math.PI-g);const f=Math.max(12,Math.floor(12*i**(1/3)*(g/Math.PI)));let y=g/f,d=l;y*=p?-1:1;const P=Math.cos(p?h:-h),M=Math.sin(p?h:-h);for(let w=0;w<f+1;w++){const C=s+Math.cos(d)*i,v=a+Math.sin(d)*o,x=C*P-v*M,S=C*M+v*P;t.push(e+x,n+S),d+=y}return t}_getAdaptiveVerticesByCircle(t=[]){const{cx:e,cy:n,rx:i,ry:o,dx:s,dy:a,rotate:l,clockwise:c}=this;if(!(i>=0&&o>=0&&s>=0&&a>=0))return t;const u=Math.ceil(2.3*Math.sqrt(i+o)),h=u*8+(s?4:0)+(a?4:0),p=[];if(h===0)return t;{const y=p.length;if(u===0)p[y]=p[y+6]=e+s,p[y+1]=p[y+3]=n+a,p[y+2]=p[y+4]=e-s,p[y+5]=p[y+7]=n-a;else{let d=y,P=y+u*4+(s?2:0)+2,M=P,w=h,C=s+i,v=a,x=e+C,S=e-C,b=n+v;if(p[d++]=x,p[d++]=b,p[--P]=b,p[--P]=S,a){const z=n-v;p[M++]=S,p[M++]=z,p[--w]=z,p[--w]=x}for(let z=1;z<u;z++){const E=Math.PI/2*(z/u),F=s+Math.cos(E)*i,N=a+Math.sin(E)*o,B=e+F,A=e-F,W=n+N,O=n-N;p[d++]=B,p[d++]=W,p[--P]=W,p[--P]=A,p[M++]=A,p[M++]=O,p[--w]=O,p[--w]=B}C=s,v=a+o,x=e+C,S=e-C,b=n+v;const D=n-v;p[d++]=x,p[d++]=b,p[--w]=D,p[--w]=x,s&&(p[d++]=S,p[d++]=b,p[--w]=D,p[--w]=S)}}const g=Math.cos(c?-l:l),f=Math.sin(c?-l:l);for(let y=0;y<p.length;y+=2){const d=p[y],P=p[y+1],M=d-e,w=P-n,C=M*g-w*f,v=M*f+w*g;t.push(e+C,n+v)}return t}getAdaptiveVertices(t=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(t):this._getAdaptiveVerticesByArc(t)}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.dx=t.dx,this.dy=t.dy,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotate=t.rotate,this}}function ea(r,t){const e=r.rx,n=r.ry,i=Math.cos(r.rotate),o=Math.sin(r.rotate),s=new k(e*i,e*o),a=new k(-n*o,n*i),l=s.applyMatrix3(t),c=a.applyMatrix3(t),u=ta.set(l.x,c.x,0,l.y,c.y,0,0,0,1),h=oi.copy(u).invert(),f=ai.copy(h).transpose().multiply(h).elements,y=ia(f[0],f[1],f[4]),d=Math.sqrt(y.rt1),P=Math.sqrt(y.rt2);if(r.rx=1/d,r.ry=1/P,r.rotate=Math.atan2(y.sn,y.cs),!((r.endAngle-r.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=oi.set(d,0,0,0,P,0,0,0,1),C=ai.set(y.cs,y.sn,0,-y.sn,y.cs,0,0,0,1),v=w.multiply(C).multiply(u),x=S=>{const{x:b,y:D}=new k(Math.cos(S),Math.sin(S)).applyMatrix3(v);return Math.atan2(D,b)};r.startAngle=x(r.startAngle),r.endAngle=x(r.endAngle),li(t)&&(r.clockwise=!r.clockwise)}}function na(r,t){const e=ci(t),n=hi(t);r.rx*=e,r.ry*=n;const i=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);r.rotate+=i,li(t)&&(r.startAngle*=-1,r.endAngle*=-1,r.clockwise=!r.clockwise)}function li(r){const t=r.elements;return t[0]*t[4]-t[1]*t[3]<0}function ra(r){const t=r.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=ci(r),i=hi(r);return Math.abs(e/(n*i))>Number.EPSILON}function ci(r){const t=r.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function hi(r){const t=r.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function ia(r,t,e){let n,i,o,s,a;const l=r+e,c=r-e,u=Math.sqrt(c*c+4*t*t);return l>0?(n=.5*(l+u),a=1/n,i=r*a*e-t*a*t):l<0?i=.5*(l-u):(n=.5*u,i=-.5*u),c>0?o=c+u:o=c-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),c>0&&(a=o,o=-s,s=a),{rt1:n,rt2:i,cs:o,sn:s}}class sa extends Nn{constructor(t=0,e=0,n=1,i=0,o=Math.PI*2,s=!1){super(new k(t,e),new k(n,n),new k,0,i,o,s)}drawTo(t){const{cx:e,cy:n,rx:i,startAngle:o,endAngle:s,clockwise:a}=this;return t.arc(e,n,i,o,s,!a),this}}class Kt extends me{constructor(t=new k,e=new k){super(),this.p1=t,this.p2=e}static from(t,e,n,i){return new Kt(new k(t,e),new k(n,i))}getPoint(t,e=new k){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new k){return this.getPoint(t,e)}getTangent(t,e=new k){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new k){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,p2:i}=this;return t.x=Math.min(t.x,n.x,i.x),t.y=Math.min(t.y,n.y,i.y),e.x=Math.max(e.x,n.x,i.x),e.y=Math.max(e.y,n.y,i.y),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}getFillVertices(t={}){const e=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),i=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),s=e,a=i,l=n-e||t.style?.strokeWidth||0,c=o-i||t.style?.strokeWidth||0;return[s,a,s+l,a,s+l,a+c,s,a+c]}drawTo(t){const{p1:e,p2:n}=this;return t.lineTo(e.x,e.y),t.lineTo(n.x,n.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class Ee extends me{constructor(t=[]){super(),this.curves=t}getFlatCurves(){return this.curves.flatMap(t=>t instanceof Ee?t.getFlatCurves():t)}addCurve(t){return this.curves.push(t),this}getPoint(t,e=new k){const n=t*this.getLength(),i=this.getLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const s=i[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,e)}o++}return e}updateLengths(){const t=[];for(let e=0,n=0,i=this.curves.length;e<i;e++)n+=this.curves[e].getLength(),t.push(n);this._arcLengths=t}getControlPointRefs(){return this.curves.flatMap(t=>t.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(t,e){const n=[t[e-1],t[e]],i=[t[e+1],t[e+2]];return n[0]===i[0]&&n[1]===i[1]&&t.splice(e+1,2),t}getSpacedVertices(t=5,e=[]){let n;return this.curves.forEach(i=>{i.getSpacedVertices(t,e),n&&this._removeNextPointIfEqualPrevPoint(e,n),n=e.length-1}),e}getAdaptiveVertices(t=[]){let e;return this.curves.forEach(n=>{n.getAdaptiveVertices(t),e&&this._removeNextPointIfEqualPrevPoint(t,e),e=t.length-1}),t}strokeTriangulate(t){return this.curves.length===1?this.curves[0].strokeTriangulate(t):super.strokeTriangulate(t)}getFillVertices(t){if(this.curves.length===1)return this.curves[0].getFillVertices(t);{const e=[];let n;return this.curves.forEach(i=>{let o;i instanceof Kt?o=i.getAdaptiveVertices():o=i.getFillVertices(t),e.push(...o),n&&this._removeNextPointIfEqualPrevPoint(e,n),n=e.length-1}),e}}applyTransform(t){return this.curves.forEach(e=>e.applyTransform(t)),this}getMinMax(t=k.MAX,e=k.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new H(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this}copy(t){return super.copy(t),this.curves=t.curves.map(e=>e.clone()),this}}class zn extends me{constructor(t=new k,e=new k,n=new k,i=new k){super(),this.p1=t,this.cp1=e,this.cp2=n,this.p2=i}static from(t,e,n,i,o,s,a,l){return new zn(new k(t,e),new k(n,i),new k(o,s),new k(a,l))}getPoint(t,e=new k){const{p1:n,cp1:i,cp2:o,p2:s}=this;return e.set(ti(t,n.x,i.x,o.x,s.x),ti(t,n.y,i.y,o.y,s.y))}getAdaptiveVertices(t=[]){return Lo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,e,n){const i=e*e-4*t*n;if(i<0)return[];const o=Math.sqrt(i),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,cp1:i,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(i.x-n.x),6*(o.x-i.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(i.y-n.y),6*(o.y-i.y),3*(s.y-o.y)),c=[0,1,...a,...l];return((h,p)=>{for(const g of h)for(let f=0;f<=p;f++){const y=f/p-.5,d=Math.min(1,Math.max(0,g+y)),P=this.getPoint(d);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(c,10),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp1:e,cp2:n,p2:i}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:i.x,y:i.y}]}drawTo(t){const{p1:e,cp1:n,cp2:i,p2:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(n.x,n.y,i.x,i.y,o.x,o.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class oa extends Nn{constructor(t=0,e=0,n=1,i=1,o=0,s=0,a=Math.PI*2,l=!1){super(new k(t,e),new k(n,i),new k,o,s,a,l)}drawTo(t){return t.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class aa extends Ee{}class Rn extends me{constructor(t=new k,e=new k,n=new k){super(),this.p1=t,this.cp=e,this.p2=n}static from(t,e,n,i,o,s){return new Rn(new k(t,e),new k(n,i),new k(o,s))}getPoint(t,e=new k){const{p1:n,cp:i,p2:o}=this;return e.set(ri(t,n.x,i.x,o.x),ri(t,n.y,i.y,o.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(t=[]){return Ro(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=k.MAX,e=k.MIN){const{p1:n,cp:i,p2:o}=this,s=.5*(n.x+i.x),a=.5*(n.y+i.y),l=.5*(n.x+o.x),c=.5*(n.y+o.y);return t.x=Math.min(t.x,n.x,o.x,s,l),t.y=Math.min(t.y,n.y,o.y,a,c),e.x=Math.max(e.x,n.x,o.x,s,l),e.y=Math.max(e.y,n.y,o.y,a,c),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp:e,p2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{p1:e,cp:n,p2:i}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(n.x,n.y,i.x,i.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class la extends aa{constructor(t=0,e=0,n=0,i=0){super(),this.x=t,this.y=e,this.width=n,this.height=i,this.update()}update(){const{x:t,y:e,width:n,height:i}=this,o=[new k(t,e),new k(t+n,e),new k(t+n,e+i),new k(t,e+i)];return this.curves=[new Kt(o[0],o[1]),new Kt(o[1],o[2]),new Kt(o[2],o[3]),new Kt(o[3],o[0])],this}drawTo(t){return t.rect(this.x,this.y,this.width,this.height),this}getFillVertices(t={}){const{x:e,y:n,width:i,height:o}=this;return[e,n,e+i,n,e+i,n+o,e,n+o]}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update(),this}}class ca extends Nn{constructor(t=0,e=0,n=1,i=1,o=1){super(),this.x=t,this.y=e,this.width=n,this.height=i,this.radius=o,this.update()}update(){const{x:t,y:e,width:n,height:i,radius:o}=this,s=n/2,a=i/2,l=t+s,c=e+a,u=Math.max(0,Math.min(o,Math.min(s,a))),h=u;return this._center=new k(l,c),this._radius=new k(u,h),this._diff=new k(s-u,a-h),this}drawTo(t){const{x:e,y:n,width:i,height:o,radius:s}=this;return t.roundRect(e,n,i,o,s),this}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this.update(),this}}class ha extends me{constructor(t=[]){super(),this.points=t}getPoint(t,e=new k){const{points:n}=this,i=(n.length-1)*t,o=Math.floor(i),s=i-o,a=n[o===0?o:o-1],l=n[o],c=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return e.set(Jr(s,a.x,l.x,c.x,u.x),Jr(s,a.y,l.y,c.y,u.y)),e}getControlPointRefs(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}class on extends Ee{startPoint;currentPoint;autoClose=!1;constructor(t){super(),t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++){const{x:i,y:o}=t[e];this.lineTo(i,o)}return this}addCommands(t){return Vr(t,this),this}addData(t){return this.addCommands(jr(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,e=[]){return this._closeVertices(super.getUnevenVertices(t,e))}getSpacedVertices(t=40,e=[]){return this._closeVertices(super.getSpacedVertices(t,e))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new k(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const e=t.getPoint(0);(!this.currentPoint||!e.equals(this.currentPoint))&&this.lineTo(e.x,e.y)}return this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;e&&!t.equals(e)&&(this.curves.push(new Kt(e.clone(),t.clone())),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new k(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const n=this.currentPoint;return n?.equals({x:t,y:e})||this.curves.push(Kt.from(n?.x??0,n?.y??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,n,i,o,s){const a=this.currentPoint;return a?.equals({x:o,y:s})||this.curves.push(zn.from(a?.x??0,a?.y??0,t,e,n,i,o,s)),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,n,i){const o=this.currentPoint;return o?.equals({x:n,y:i})||this.curves.push(Rn.from(o?.x??0,o?.y??0,t,e,n,i)),this._setCurrentPoint({x:n,y:i}),this}arc(t,e,n,i,o,s){const a=new sa(t,e,n,i,o,!s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(t,e,n,i,o,s){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.arc(t,e,n,i,o,s),this}arcTo(t,e,n,i,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,i,o,s,a,l=!0){const c=new oa(t,e,n,i,o,s,a,!l);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,e,n,i,o,s,a,l){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.ellipse(t,e,n,i,o,s,a,l),this}rect(t,e,n,i){const o=new la(t,e,n,i);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:t,y:e}),this}roundRect(t,e,n,i,o){const s=new ca(t,e,n,i,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new k;return this.curves.push(new ha([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=t.currentPoint?.clone(),this}}class Mt extends Ee{_meta;currentCurve=new on;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}constructor(t,e={}){super(),this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof Mt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(t){return this._meta=t,this}addPath(t){const e=this.curves.findIndex(n=>n===this.currentCurve);return e>-1&&this.curves.splice(e,1),t instanceof Mt?this.curves.push(...t.curves.filter(n=>n.curves.length).map(n=>n.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new on().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,e){return this.currentCurve.currentPoint?.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new on,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,n,i,o,s){return this.currentCurve.bezierCurveTo(t,e,n,i,o,s),this}quadraticCurveTo(t,e,n,i){return this.currentCurve.quadraticCurveTo(t,e,n,i),this}arc(t,e,n,i,o,s){return this.currentCurve.arc(t,e,n,i,o,s),this}arcTo(t,e,n,i,o){return this.currentCurve.arcTo(t,e,n,i,o),this}ellipse(t,e,n,i,o,s,a,l){return this.currentCurve.ellipse(t,e,n,i,o,s,a,l),this}rect(t,e,n,i){return this.currentCurve.rect(t,e,n,i),this}roundRect(t,e,n,i,o){return this.currentCurve.roundRect(t,e,n,i,o),this}reset(){return this.currentCurve=new on,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Vr(t,this),this}addData(t){return this.addCommands(jr(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,n={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.scale(t,e,n)}),this}skew(t,e=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.skew(t,e,n)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getFlatCurves(),n=[],i=[],o=[];e.forEach((a,l)=>{const c=a.getControlPointRefs(),u=a.isClockwise();o[l]=c,i[l]=u;const h=c[0],p=c[c.length-1]??h;n.push({start:u?p:h,end:u?h:p,index:l})});const s=[];return n.forEach((a,l)=>{s[l]=[],n.forEach((c,u)=>{c.start&&a.end&&u!==l&&c.start?.equals(a.end)&&s[l].push(c.index)})}),e.forEach((a,l)=>{const c=i[l];o[l].forEach(u=>{u.add(a.getNormal(a.getTForPoint(u)).scale(c?t:-t))})}),s.forEach((a,l)=>{const c=o[l];a.forEach(u=>{const h=o[u],p=jo(c[c.length-1],c[c.length-2]??c[c.length-1],h[0],h[1]??h[0]);p&&(c[c.length-1].copy(p),h[0].copy(p))})}),this}getMinMax(t=k.MAX,e=k.MIN,n=!0){const i=this.strokeWidth;return this.curves.forEach(o=>{if(o.getMinMax(t,e),n&&i>1){const s=i/2,a=o.isClockwise(),l=[];for(let c=0;c<=1;c+=1/o.arcLengthDivision){const u=o.getPoint(c),h=o.getNormal(c),p=h.clone().scale(a?s:-s),g=h.clone().scale(a?-s:s);l.push(u.clone().add(p),u.clone().add(g),u.clone().add({x:s,y:0}),u.clone().add({x:-s,y:0}),u.clone().add({x:0,y:s}),u.clone().add({x:0,y:-s}),u.clone().add({x:s,y:s}),u.clone().add({x:-s,y:-s}))}t.min(...l),e.max(...l)}}),{min:t.finite(),max:e.finite()}}strokeTriangulate(t){const e=t?.indices??[],n=t?.vertices??[];return this.curves.forEach(i=>{i.strokeTriangulate({...t,indices:e,vertices:n,style:{...this.style}})}),{indices:e,vertices:n}}fillTriangulate(t){const e={...t,style:{...this.style,...t?.style}},n=e.indices??[],i=e.vertices??[];if((e.style.fillRule??"nonzero")==="nonzero"){const s=this.curves.map(c=>c.getFillVertices(e)),a=Ho(s),l=a.length;for(let c=0;c<l;c++){const u=a[c],h=s[c];if(u.wn||!h.length)continue;const p=h.slice(),g=[];for(let f=0;f<l;f++){const y=a[f];y.parentIndex===c&&(g.push(p.length/2),p.push(...s[y.index]))}ei(p,{...t,indices:n,vertices:i,holes:g,style:{...this.style}})}}else this.curves.forEach(s=>{s.fillTriangulate({...t,indices:n,vertices:i,style:{...this.style}})});return{indices:n,vertices:i}}getBoundingBox(t=!0){const{min:e,max:n}=this.getMinMax(void 0,void 0,t);return new H(e.x,e.y,n.x-e.x,n.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:n="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Dn(t,e),this.curves.forEach(o=>{o.drawTo(t)}),n!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:n="#000",stroke:i="none"}=e;return t.beginPath(),t.save(),Dn(t,e),this.getControlPointRefs().forEach(o=>{ho(t,o.x,o.y,{radius:4})}),n!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const i in t)t[i]!==void 0&&(e[Vo(i)]=t[i]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let n="";for(const i in e)e[i]!==void 0&&(n+=`${i}:${e[i]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ee{constructor(t=[],e){this.paths=t,this.viewBox=e}getBoundingBox(t=!0){if(!this.paths.length)return;const e=k.MAX,n=k.MIN;return this.paths.forEach(i=>i.getMinMax(e,n,t)),new H(e.x,e.y,n.x-e.x,n.y-e.y)}toTriangulatedSvgString(t=this.paths.map(n=>n.fillTriangulate()),e=0){let n="",i="";const o={x:-e,y:-e},s={x:e,y:e};(Array.isArray(t)?t:[t]).forEach(({vertices:u,indices:h,points:p=[]})=>{const g=f=>{const y=u[f*2],d=u[f*2+1];return o.x=Math.min(o.x,y+e),s.x=Math.max(s.x,y+e),o.y=Math.min(o.y,d+e),s.y=Math.max(s.y,d+e),[y,d]};for(let f=0,y=h.length;f<y;f+=3){const d=g(h[f]),P=g(h[f+1]),M=g(h[f+2]);n+=`<polygon
6
4
  points="${d.join(",")} ${P.join(",")} ${M.join(",")}"
7
5
  stroke="#28a745"
8
6
  stroke-width="#stroke-width"
@@ -29,7 +27,9 @@ ${t}`);return e.documentElement}else return r}const ta="px",ea=90,ii=["mm","cm",
29
27
  xmlns="http://www.w3.org/2000/svg"
30
28
  >
31
29
  ${o}
32
- </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...n}=t,{left:i,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const c=l.getContext("2d");return c&&(c.scale(e,e),c.translate(-i,-o),this.paths.forEach(h=>{h.drawTo(c,n)})),l}}const Za=new Set(["©","®","÷"]),Ya=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Ka={1:"italic",32:"bold"},Qa={1:"italic",2:"bold"},bi={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Si{constructor(t,e,n){this.content=t,this.index=e,this.parent=n}path=new _t().setMeta(this);lineBox=new X;inlineBox=new X;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){const t=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new X(this.lineBox.left+this.lineBox.width/2-t/2,this.lineBox.top,t,this.lineBox.height):new X(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-t/2,this.lineBox.width,t))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(t){const e=this.computedStyle.fontFamily,n=t??Io;let o=(e?n.get(e):n.fallbackFont)?.getSFNT();return o?.textToGlyphIndexes(this.content).includes(0)&&(o=n.fallbackFont?.getSFNT()),o}updateGlyph(t=this._getFontSFNT()){if(!t)return this;const{hhea:e,os2:n,post:i,head:o}=t,s=o.unitsPerEm,a=e.ascent,l=e.descent,{content:c,computedStyle:h,isVertical:u}=this,{fontSize:p}=h,g=s/p,f=t.getAdvanceWidth(c,p),y=(a+Math.abs(l))/g,d=a/g;return this.advanceWidth=f,this.advanceHeight=y,this.inlineBox.width=u?y:f,this.inlineBox.height=u?f:y,this.underlinePosition=(a-i.underlinePosition)/g,this.underlineThickness=i.underlineThickness/g,this.strikeoutPosition=(a-n.yStrikeoutPosition)/g,this.strikeoutSize=n.yStrikeoutSize/g,this.ascender=a/g,this.descender=l/g,this.typoAscender=n.sTypoAscender/g,this.typoDescender=n.sTypoDescender/g,this.typoLineGap=n.sTypoLineGap/g,this.winAscent=n.usWinAscent/g,this.winDescent=n.usWinDescent/g,this.xHeight=n.sxHeight/g,this.capHeight=n.sCapHeight/g,this.baseline=d,this.centerDiviation=y/2-d,this.fontStyle=Ka[n.fsSelection]??Qa[o.macStyle],this}update(t){const e=this._getFontSFNT(t);if(!e)return this;this.updateGlyph(e);const{isVertical:n,content:i,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:c,typoAscender:h,fontStyle:u,advanceWidth:p,advanceHeight:g}=this,{left:f,top:y}=a,d=o.fontStyle==="italic"&&u!=="italic";let P=f,M=y+s,w;const C=new _t().setMeta(this);if(n&&(P+=(g-p)/2,Math.abs(p-g)>.1&&(M-=(l-h)/(l+Math.abs(c))*g),w=void 0),n&&!Za.has(i)&&(i.codePointAt(0)<=256||Ya.has(i))){C.addCommands(e.getPathCommands(i,P,y+s-(g-p)/2,o.fontSize));const x={y:y-(g-p)/2+g/2,x:P+p/2};d&&this._italic(C,n?{x:x.x,y:y-(g-p)/2+s}:void 0),C.rotate(90,x)}else w!==void 0?(C.addCommands(e.glyphs.get(w).getPathCommands(P,M,o.fontSize)),d&&this._italic(C,n?{x:P+p/2,y:y+h/(l+Math.abs(c))*g}:void 0)):(C.addCommands(e.getPathCommands(i,P,M,o.fontSize)),d&&this._italic(C,n?{x:P+g/2,y:M}:void 0));const v=o.fontWeight??400;return v in bi&&(v===700||v==="bold")&&u!=="bold"&&C.bold(bi[v]*o.fontSize*.05),C.style={fill:this.computedFill??o.color,fillRule:"nonzero",stroke:this.computedOutline??(o.textStrokeWidth?o.textStrokeColor:"none"),strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,n){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(t,e,n)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:n,max:i}=e;return new X(n.x,n.y,i.x-n.x,i.y-n.y)}drawTo(t,e={}){const n=this.computedStyle,i={ctx:t,path:this.path,fontSize:n.fontSize,color:n.color,...e};if(this.glyphBox)he(i);else{t.save(),t.beginPath();const o=this.path.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*i.fontSize,shadowOffsetY:(i.shadowOffsetY??0)*i.fontSize,shadowBlur:(i.shadowBlur??0)*i.fontSize,shadowColor:i.shadowColor};Kr(t,s),t.font=`${i.fontSize}px ${i.fontFamily}`,this.isVertical?(t.textBaseline="middle",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(t.textBaseline="alphabetic",t.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),t.restore()}}}function on(){const r=new Map;async function t(n){if(!r.has(n)){r.set(n,n);try{r.set(n,await fetch(n).then(i=>i.text()))}catch(i){console.warn(i),r.delete(n)}}}function e(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:r,needsLoad:e,load:t}}function an(r){const t=new Map;function e(n){let i=t.get(n);if(!i){const o=ni(r.needsLoad(n)?r.loaded.get(n)??n:n),s=li(o);i={dom:o,pathSet:s},t.set(n,i)}return i}return{parsed:t,parse:e}}var Ja={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},at=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Et=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ci=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Pi=function(r){return{r:Et(r.r,0,255),g:Et(r.g,0,255),b:Et(r.b,0,255),a:Et(r.a)}},ln=function(r){return{r:at(r.r),g:at(r.g),b:at(r.b),a:at(r.a,3)}},tl=/^#([0-9a-f]{3,8})$/i,pr=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Mi=function(r){var t=r.r,e=r.g,n=r.b,i=r.a,o=Math.max(t,e,n),s=o-Math.min(t,e,n),a=s?o===t?(e-n)/s:o===e?2+(n-t)/s:4+(t-e)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},_i=function(r){var t=r.h,e=r.s,n=r.v,i=r.a;t=t/360*6,e/=100,n/=100;var o=Math.floor(t),s=n*(1-e),a=n*(1-(t-o)*e),l=n*(1-(1-t+o)*e),c=o%6;return{r:255*[n,a,s,s,l,n][c],g:255*[l,n,n,a,s,s][c],b:255*[s,s,l,n,n,a][c],a:i}},Ti=function(r){return{h:Ci(r.h),s:Et(r.s,0,100),l:Et(r.l,0,100),a:Et(r.a)}},ki=function(r){return{h:at(r.h),s:at(r.s),l:at(r.l),a:at(r.a,3)}},Ai=function(r){return _i((e=(t=r).s,{h:t.h,s:(e*=((n=t.l)<50?n:100-n)/100)>0?2*e/(n+e)*100:0,v:n+e,a:t.a}));var t,e,n},qe=function(r){return{h:(t=Mi(r)).h,s:(i=(200-(e=t.s))*(n=t.v)/100)>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,n,i},el=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,il=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oi={string:[[function(r){var t=tl.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?at(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?at(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=nl.exec(r)||il.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Pi({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:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=el.exec(r)||rl.exec(r);if(!t)return null;var e,n,i=Ti({h:(e=t[1],n=t[2],n===void 0&&(n="deg"),Number(e)*(Ja[n]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ai(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,n=r.b,i=r.a,o=i===void 0?1:i;return Jt(t)&&Jt(e)&&Jt(n)?Pi({r:Number(t),g:Number(e),b:Number(n),a:Number(o)}):null},"rgb"],[function(r){var t=r.h,e=r.s,n=r.l,i=r.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(n))return null;var s=Ti({h:Number(t),s:Number(e),l:Number(n),a:Number(o)});return Ai(s)},"hsl"],[function(r){var t=r.h,e=r.s,n=r.v,i=r.a,o=i===void 0?1:i;if(!Jt(t)||!Jt(e)||!Jt(n))return null;var s=(function(a){return{h:Ci(a.h),s:Et(a.s,0,100),v:Et(a.v,0,100),a:Et(a.a)}})({h:Number(t),s:Number(e),v:Number(n),a:Number(o)});return _i(s)},"hsv"]]},Ii=function(r,t){for(var e=0;e<t.length;e++){var n=t[e][0](r);if(n)return[n,t[e][1]]}return[null,void 0]},sl=function(r){return typeof r=="string"?Ii(r.trim(),Oi.string):typeof r=="object"&&r!==null?Ii(r,Oi.object):[null,void 0]},cn=function(r,t){var e=qe(r);return{h:e.h,s:Et(e.s+100*t,0,100),l:e.l,a:e.a}},hn=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ei=function(r,t){var e=qe(r);return{h:e.h,s:e.s,l:Et(e.l+100*t,0,100),a:e.a}},Bi=(function(){function r(t){this.parsed=sl(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return at(hn(this.rgba),2)},r.prototype.isDark=function(){return hn(this.rgba)<.5},r.prototype.isLight=function(){return hn(this.rgba)>=.5},r.prototype.toHex=function(){return t=ln(this.rgba),e=t.r,n=t.g,i=t.b,s=(o=t.a)<1?pr(at(255*o)):"","#"+pr(e)+pr(n)+pr(i)+s;var t,e,n,i,o,s},r.prototype.toRgb=function(){return ln(this.rgba)},r.prototype.toRgbString=function(){return t=ln(this.rgba),e=t.r,n=t.g,i=t.b,(o=t.a)<1?"rgba("+e+", "+n+", "+i+", "+o+")":"rgb("+e+", "+n+", "+i+")";var t,e,n,i,o},r.prototype.toHsl=function(){return ki(qe(this.rgba))},r.prototype.toHslString=function(){return t=ki(qe(this.rgba)),e=t.h,n=t.s,i=t.l,(o=t.a)<1?"hsla("+e+", "+n+"%, "+i+"%, "+o+")":"hsl("+e+", "+n+"%, "+i+"%)";var t,e,n,i,o},r.prototype.toHsv=function(){return t=Mi(this.rgba),{h:at(t.h),s:at(t.s),v:at(t.v),a:at(t.a,3)};var t},r.prototype.invert=function(){return Xt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Xt(cn(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Xt(cn(this.rgba,-t))},r.prototype.grayscale=function(){return Xt(cn(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Xt(Ei(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Xt(Ei(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Xt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):at(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=qe(this.rgba);return typeof t=="number"?Xt({h:t,s:e.s,l:e.l,a:e.a}):at(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Xt(t).toHex()},r})(),Xt=function(r){return r instanceof Bi?r:new Bi(r)};function tt(r){return r==null||r===""||r==="none"}function Pe(r,t=0,e=10**t){return Math.round(e*r)/e+0}function zt(r,t=!1){if(typeof r!="object"||!r)return r;if(Array.isArray(r))return t?r.map(n=>zt(n,t)):r;const e={};for(const n in r){const i=r[n];i!=null&&(t?e[n]=zt(i,t):e[n]=i)}return e}function dr(r,t){const e={};return t.forEach(n=>{n in r&&(e[n]=r[n])}),e}function un(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){const e=Array.from(new Set([...Object.keys(r),...Object.keys(t)]));return!e.length||e.every(n=>r[n]===t[n])}return!1}function ol(r,t,e){const n=t.length-1;if(n<0)return r===void 0?e:r;for(let i=0;i<n;i++){if(r==null)return e;r=r[t[i]]}return r==null||r[t[n]]===void 0?e:r[t[n]]}function al(r,t,e){const n=t.length-1;for(let i=0;i<n;i++)typeof r[t[i]]!="object"&&(r[t[i]]={}),r=r[t[i]];r[t[n]]=e}function ll(r,t,e){return r==null||!t||typeof t!="string"?e:r[t]!==void 0?r[t]:(t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),ol(r,t.split("."),e))}function cl(r,t,e){if(!(typeof r!="object"||!t))return t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),al(r,t.split("."),e)}class hl{_observers=new Map;on(t,e){let n=this._observers.get(t);return n===void 0&&this._observers.set(t,n=new Set),n.add(e),this}once(t,e){const n=(...i)=>{this.off(t,n),e(...i)};return this.on(t,n),this}off(t,e){const n=this._observers.get(t);return n!==void 0&&(n.delete(e),n.size===0&&this._observers.delete(t)),this}emit(t,...e){return Array.from((this._observers.get(t)||new Map).values()).forEach(n=>n(...e)),this}destroy(){this._observers=new Map}}const fn=Symbol("properties"),Di=Symbol("inited");function pn(r){let t;if(Object.hasOwn(r,fn))t=r[fn];else{const e=Object.getPrototypeOf(r);t=new Map(e?pn(e):void 0),r[fn]=t}return t}function Fi(r,t,e,n){const{alias:i,internalKey:o}=n,s=r[t];i?cl(r,i,e):r[o]=e,r.onUpdateProperty?.(t,e??gr(r,t,n),s)}function Ui(r,t,e){const{alias:n,internalKey:i}=e;let o;return n?o=ll(r,n):o=r[i],o=o??gr(r,t,e),o}function gr(r,t,e){const{default:n,fallback:i}=e;let o;if(n!==void 0&&!r[Di]){r[Di]=!0;const s=typeof n=="function"?n():n;s!==void 0&&(r[t]=s,o=s)}return o===void 0&&i!==void 0&&(o=typeof i=="function"?i():i),o}function ul(r,t){function e(){return typeof this.getProperty<"u"?this.getProperty(r):Ui(this,r,t)}function n(i){typeof this.setProperty<"u"?this.setProperty(r,i):Fi(this,r,i,t)}return{get:e,set:n}}function fl(r,t,e={}){const n={...e,internalKey:Symbol(t)};pn(r).set(t,n);const i=ul(t,n);Object.defineProperty(r.prototype,t,{get(){return i.get.call(this)},set(o){i.set.call(this,o)},configurable:!0,enumerable:!0})}function oe(r){return function(t,e){if(typeof e!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");fl(t.constructor,e,r)}}class pl extends hl{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(t){super(),this.setProperties(t)}isDirty(t){return t?this._updatedProperties.has(t):this._updatedProperties.size>0}getProperty(t){const e=this.getPropertyDeclaration(t);if(e){if(e.internal||e.alias)return Ui(this,t,e);{let n;return this._propertyAccessor?.getProperty?n=this._propertyAccessor.getProperty(t):n=this._properties.get(t),n??gr(this,t,e)}}}setProperty(t,e){const n=this.getPropertyDeclaration(t);if(n)if(n.internal||n.alias)Fi(this,t,e,n);else{const i=this.getProperty(t);this._propertyAccessor?.setProperty?.(t,e),this._properties.set(t,e),this.onUpdateProperty?.(t,e??gr(this,t,n),i)}}getProperties(t){const e={};for(const[n,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!t||t.includes(n))&&(e[n]=this.getProperty(n));return e}setProperties(t){if(t&&typeof t=="object")for(const e in t)this.setProperty(e,t[e]);return this}resetProperties(){for(const[t,e]of this.getPropertyDeclarations())this.setProperty(t,typeof e.default=="function"?e.default():e.default);return this}getPropertyDeclarations(){return pn(this.constructor)}getPropertyDeclaration(t){return this.getPropertyDeclarations().get(t)}setPropertyAccessor(t){const e=this.getPropertyDeclarations();this._propertyAccessor=void 0;const n={};return e.forEach((i,o)=>{n[o]=this.getProperty(o)}),this._propertyAccessor=t,e.forEach((i,o)=>{const s=this.getProperty(o),a=n[o];s!==void 0&&!Object.is(s,a)&&(this.setProperty(o,s),!i.internal&&!i.alias&&this.requestUpdate(o,s,a))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(t=>globalThis.requestAnimationFrame(t)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(t){Promise.reject(t)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(t,e,n){Object.is(e,n)||this.requestUpdate(t,e,n)}requestUpdate(t,e,n){t!==void 0&&(this._updatedProperties.set(t,n),this._changedProperties.add(t),this._updateProperty(t,e,n),this.emit("updateProperty",t,e,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(t){}_updateProperty(t,e,n){}toJSON(){const t={};return this._properties.forEach((e,n)=>{e!==void 0&&(e&&typeof e=="object"?"toJSON"in e&&typeof e.toJSON=="function"?t[n]=e.toJSON():Array.isArray(e)?t[n]=[...e]:t[n]={...e}:t[n]=e)}),t}clone(){return new this.constructor(this.toJSON())}}function Li(r){let t;return typeof r=="number"?t={r:r>>24&255,g:r>>16&255,b:r>>8&255,a:(r&255)/255}:t=r,Xt(t)}function dl(r){return{r:Pe(r.r),g:Pe(r.g),b:Pe(r.b),a:Pe(r.a,3)}}function yr(r){const t=r.toString(16);return t.length<2?`0${t}`:t}const gl="#000000FF";function yl(r){return Li(r).isValid()}function Bt(r,t=!1){const e=Li(r);if(!e.isValid()){if(typeof r=="string")return r;const a=`Failed to normalizeColor ${r}`;if(t)throw new Error(a);return console.warn(a),gl}const{r:n,g:i,b:o,a:s}=dl(e.rgba);return`#${yr(n)}${yr(i)}${yr(o)}${yr(Pe(s*255))}`}var mr=mr||{};mr.parse=(function(){const r={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let t="";function e(T){const _=new Error(`${t}: ${T}`);throw _.source=t,_}function n(){const T=i();return t.length>0&&e("Invalid input not EOF"),T}function i(){return w(o)}function o(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,u)||s("repeating-radial-gradient",r.repeatingRadialGradient,u)}function s(T,_,U){return a(_,$=>{const q=U();return q&&(I(r.comma)||e("Missing comma before color stops")),{type:T,orientation:q,colorStops:w(C)}})}function a(T,_){const U=I(T);if(U){I(r.startCall)||e("Missing (");const $=_(U);return I(r.endCall)||e("Missing )"),$}}function l(){const T=c();if(T)return T;const _=j("position-keyword",r.positionKeywords,1);return _?{type:"directional",value:_.value}:h()}function c(){return j("directional",r.sideOrCorner,1)}function h(){return j("angular",r.angleValue,1)||j("angular",r.radianValue,1)}function u(){let T,_=p(),U;return _&&(T=[],T.push(_),U=t,I(r.comma)&&(_=p(),_?T.push(_):t=U)),T}function p(){let T=g()||f();if(T)T.at=d();else{const _=y();if(_){T=_;const U=d();U&&(T.at=U)}else{const U=d();if(U)T={type:"default-radial",at:U};else{const $=P();$&&(T={type:"default-radial",at:$})}}}return T}function g(){const T=j("shape",/^(circle)/i,0);return T&&(T.style=L()||y()),T}function f(){const T=j("shape",/^(ellipse)/i,0);return T&&(T.style=P()||A()||y()),T}function y(){return j("extent-keyword",r.extentKeywords,1)}function d(){if(j("position",/^at/,0)){const T=P();return T||e("Missing positioning value"),T}}function P(){const T=M();if(T.x||T.y)return{type:"position",value:T}}function M(){return{x:A(),y:A()}}function w(T){let _=T();const U=[];if(_)for(U.push(_);I(r.comma);)_=T(),_?U.push(_):e("One extra comma");return U}function C(){const T=v();return T||e("Expected color definition"),T.length=A(),T}function v(){return S()||F()||E()||D()||b()||N()||x()}function x(){return j("literal",r.literalColor,0)}function S(){return j("hex",r.hexColor,1)}function b(){return a(r.rgbColor,()=>({type:"rgb",value:w(B)}))}function D(){return a(r.rgbaColor,()=>({type:"rgba",value:w(B)}))}function N(){return a(r.varColor,()=>({type:"var",value:z()}))}function E(){return a(r.hslColor,()=>{I(r.percentageValue)&&e("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const _=B();I(r.comma);let U=I(r.percentageValue);const $=U?U[1]:null;I(r.comma),U=I(r.percentageValue);const q=U?U[1]:null;return(!$||!q)&&e("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[_,$,q]}})}function F(){return a(r.hslaColor,()=>{const T=B();I(r.comma);let _=I(r.percentageValue);const U=_?_[1]:null;I(r.comma),_=I(r.percentageValue);const $=_?_[1]:null;I(r.comma);const q=B();return(!U||!$)&&e("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[T,U,$,q]}})}function z(){return I(r.variableName)[1]}function B(){return I(r.number)[1]}function A(){return j("%",r.percentageValue,1)||W()||O()||L()}function W(){return j("position-keyword",r.positionKeywords,1)}function O(){return a(r.calcValue,()=>{let T=1,_=0;for(;T>0&&_<t.length;){const $=t.charAt(_);$==="("?T++:$===")"&&T--,_++}T>0&&e("Missing closing parenthesis in calc() expression");const U=t.substring(0,_-1);return V(_-1),{type:"calc",value:U}})}function L(){return j("px",r.pixelValue,1)||j("em",r.emValue,1)}function j(T,_,U){const $=I(_);if($)return{type:T,value:$[U]}}function I(T){let _,U;return U=/^\s+/.exec(t),U&&V(U[0].length),_=T.exec(t),_&&V(_[0].length),_}function V(T){t=t.substr(T)}return function(T){return t=T.toString().trim(),t.endsWith(";")&&(t=t.slice(0,-1)),n()}})();const ml=mr.parse.bind(mr);var xr=xr||{};xr.stringify=(function(){var r={"visit_linear-gradient":function(t){return r.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return r.visit_gradient(t)},"visit_radial-gradient":function(t){return r.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return r.visit_gradient(t)},visit_gradient:function(t){var e=r.visit(t.orientation);return e&&(e+=", "),t.type+"("+e+r.visit(t.colorStops)+")"},visit_shape:function(t){var e=t.value,n=r.visit(t.at),i=r.visit(t.style);return i&&(e+=" "+i),n&&(e+=" at "+n),e},"visit_default-radial":function(t){var e="",n=r.visit(t.at);return n&&(e+=n),e},"visit_extent-keyword":function(t){var e=t.value,n=r.visit(t.at);return n&&(e+=" at "+n),e},"visit_position-keyword":function(t){return t.value},visit_position:function(t){return r.visit(t.value.x)+" "+r.visit(t.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_calc:function(t){return"calc("+t.value+")"},visit_literal:function(t){return r.visit_color(t.value,t)},visit_hex:function(t){return r.visit_color("#"+t.value,t)},visit_rgb:function(t){return r.visit_color("rgb("+t.value.join(", ")+")",t)},visit_rgba:function(t){return r.visit_color("rgba("+t.value.join(", ")+")",t)},visit_hsl:function(t){return r.visit_color("hsl("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%)",t)},visit_hsla:function(t){return r.visit_color("hsla("+t.value[0]+", "+t.value[1]+"%, "+t.value[2]+"%, "+t.value[3]+")",t)},visit_var:function(t){return r.visit_color("var("+t.value+")",t)},visit_color:function(t,e){var n=t,i=r.visit(e.length);return i&&(n+=" "+i),n},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(t){var e="",n=t.length;return t.forEach(function(i,o){e+=r.visit(i),o<n-1&&(e+=", ")}),e},visit_object:function(t){return t.width&&t.height?r.visit(t.width)+" "+r.visit(t.height):""},visit:function(t){if(!t)return"";if(t instanceof Array)return r.visit_array(t);if(typeof t=="object"&&!t.type)return r.visit_object(t);if(t.type){var e=r["visit_"+t.type];if(e)return e(t);throw Error("Missing visitor visit_"+t.type)}else throw Error("Invalid node.")}};return function(t){return r.visit(t)}})(),xr.stringify.bind(xr);function $i(r){const t=r.length-1;return r.map((e,n)=>{const i=e.value;let o=Pe(n/t,3),s="#00000000";switch(e.type){case"rgb":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=Bt({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=Bt(e.value);break;case"hex":s=Bt(`#${e.value}`);break}switch(e.length?.type){case"%":o=Number(e.length.value)/100;break}return{offset:o,color:s}})}function zi(r){let t=0;switch(r.orientation?.type){case"angular":t=Number(r.orientation.value);break}return{type:"linear-gradient",angle:t,stops:$i(r.colorStops)}}function Ni(r){return r.orientation?.map(t=>{switch(t?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:$i(r.colorStops)}}function vr(r){return r.startsWith("linear-gradient(")||r.startsWith("radial-gradient(")}function xl(r){return ml(r).map(t=>{switch(t?.type){case"linear-gradient":return zi(t);case"repeating-linear-gradient":return{...zi(t),repeat:!0};case"radial-gradient":return Ni(t);case"repeating-radial-gradient":return{...Ni(t),repeat:!0};default:return}}).filter(Boolean)}function vl(r){let t;return typeof r=="string"?t={color:r}:t={...r},{color:Bt(t.color)}}function wl(r){let t;if(typeof r=="string"?t={image:r}:t={...r},t.image){const{type:e,...n}=xl(t.image)[0]??{};switch(e){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}}return dr(t,["linearGradient","radialGradient","rotateWithShape"])}function bl(r){let t;return typeof r=="string"?t={image:r}:t={...r},dr(t,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function Sl(r){let t;return typeof r=="string"?t={preset:r}:t={...r},tt(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=Bt(t.foregroundColor),tt(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=Bt(t.backgroundColor),dr(t,["preset","foregroundColor","backgroundColor"])}function Cl(r){return!tt(r.color)}function Pl(r){return typeof r=="string"?yl(r):Cl(r)}function Ml(r){return!tt(r.image)&&vr(r.image)||!!r.linearGradient||!!r.radialGradient}function _l(r){return typeof r=="string"?vr(r):Ml(r)}function Tl(r){return!tt(r.image)&&!vr(r.image)}function kl(r){return typeof r=="string"?!vr(r):Tl(r)}function Al(r){return!tt(r.preset)}function Ol(r){return typeof r=="string"?!1:Al(r)}function We(r){const t=r&&typeof r=="object"?r.enabled:void 0;return Pl(r)?zt({enabled:t,...vl(r)}):_l(r)?zt({enabled:t,...wl(r)}):kl(r)?zt({enabled:t,...bl(r)}):Ol(r)?zt({enabled:t,...Sl(r)}):{}}function dn(r){return typeof r=="string"?{...We(r)}:{...We(r),...dr(r,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function Il(){return{boxShadow:"none"}}function El(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Bl(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Dl(){return{...El(),...Bl(),...Il(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Fl(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Ul(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Ll(){return{...Fl(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function $l(){return{...Ul(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function zl(){return{...$l(),...Ll(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function wr(r){return zt({...r,color:tt(r.color)?void 0:Bt(r.color),backgroundColor:tt(r.backgroundColor)?void 0:Bt(r.backgroundColor),borderColor:tt(r.borderColor)?void 0:Bt(r.borderColor),outlineColor:tt(r.outlineColor)?void 0:Bt(r.outlineColor),shadowColor:tt(r.shadowColor)?void 0:Bt(r.shadowColor)})}function Nl(){return{...Dl(),...zl()}}const Vl=/\r\n|\n\r|\n|\r/,jl=new RegExp(`^(${Vl.source})$`),Rl=`
33
- `;function Gl(r){return jl.test(r)}function Vi(r){const t=[];function e(){return t[t.length-1]}function n(a,l,c){const h=a?wr(a):{},u=l?We(l):void 0,p=c?dn(c):void 0,g=zt({...h,fill:u,outline:p,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=g:t.push(g),g}function i(a="",l,c,h){const u=l?wr(l):{},p=c?We(c):void 0,g=h?dn(h):void 0;Array.from(a).forEach(f=>{if(Gl(f)){const{fragments:y,fill:d,outline:P,...M}=e()||n();y.length||y.push(zt({...u,fill:p,outline:g,content:Rl})),n(M,d,P)}else{const y=e()||n(),d=y.fragments[y.fragments.length-1];if(d){const{content:P,fill:M,outline:w,...C}=d;if(un(p,M)&&un(g,w)&&un(u,C)){d.content=`${P}${f}`;return}}y.fragments.push(zt({...u,fill:p,outline:g,content:f}))}})}(Array.isArray(r)?r:[r]).forEach(a=>{if(typeof a=="string")n(),i(a);else if(ji(a)){const{content:l,fill:c,outline:h,...u}=a;n(u,c,h),i(l)}else if(ql(a)){const{fragments:l,fill:c,outline:h,...u}=a;n(u,c,h),l.forEach(p=>{const{content:g,fill:f,outline:y,...d}=p;i(g,d,f,y)})}else Array.isArray(a)?(n(),a.forEach(l=>{if(typeof l=="string")i(l);else if(ji(l)){const{content:c,fill:h,outline:u,...p}=l;i(c,p,h,u)}})):console.warn("Failed to parse text content",a)});const s=e();return s&&!s.fragments.length&&s.fragments.push({content:""}),t}function ql(r){return r&&typeof r=="object"&&"fragments"in r&&Array.isArray(r.fragments)}function ji(r){return r&&typeof r=="object"&&"content"in r&&typeof r.content=="string"}function Wl(r){return typeof r=="string"||Array.isArray(r)?{content:Vi(r)}:zt({...r,content:Vi(r.content??""),style:r.style?wr(r.style):void 0,effects:r.effects?r.effects.map(t=>wr(t)):void 0,measureDom:r.measureDom,fonts:r.fonts,fill:r.fill?We(r.fill):void 0,outline:r.outline?dn(r.outline):void 0})}function br(r,t){return typeof r=="number"?r:r.endsWith("%")?(r=r.substring(0,r.length-1),Math.ceil(Number(r)/100*t.total)):r.endsWith("rem")?(r=r.substring(0,r.length-3),Number(r)*t.fontSize):r.endsWith("em")?(r=r.substring(0,r.length-2),Number(r)*t.fontSize):Number(r)}function Sr(r){return tt(r)?{}:r}function Ri(r,t){const e=Object.keys(r),n=Object.keys(t);return Array.from(new Set([...e,...n])).every(o=>ge(r[o],t[o]))}function ge(r,t){const e=typeof r;return e===typeof t?e==="object"?Ri(r,t):r===t:!1}function Hl(r){const t=r.startsWith("#")?r.slice(1):r;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const n=t.length===3?t.split("").map(a=>a+a).join(""):t,i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i}, ${o}, ${s})`}function Cr(r){if(!r)return r;const t={};for(const e in r)r[e]!==""&&r[e]!==void 0&&(t[e]=r[e]);return t}class Gi{constructor(t,e={},n,i){this.content=t,this.style=e,this.index=n,this.parent=i,this.updateComputedStyle().initCharacters()}inlineBox=new X;fill;outline;get computedFill(){return this.fill??this.parent.computedFill}get computedOutline(){return this.outline??this.parent.computedOutline}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Cr(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new Si(n,e++,this));return this.characters=t,this}}class qi{constructor(t,e,n){this.style=t,this.index=e,this.parent=n,this.updateComputedStyle()}lineBox=new X;fragments=[];fill;outline;get computedFill(){return this.fill??this.parent.fill}get computedOutline(){return this.outline??this.parent.outline}updateComputedStyle(){return this.computedStyle={...Cr(this.parent.computedStyle),...Cr(this.style)},this}}function Xl(r){return r}class He{static notZeroStyles=new Set(["width","height"]);static pxStyles=new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]);_toDomStyle(t){const e={};for(const n in t){const i=t[n];He.notZeroStyles.has(n)&&i===0||(typeof i=="number"&&He.pxStyles.has(n)?e[n]=`${i}px`:e[n]=i)}return e}createDom(t,e){const n=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="flex-start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="flex-end";break}switch(e.verticalAlign){case"top":i.alignItems="flex-start";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="flex-end";break}const s=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{...this._toDomStyle({...i,boxSizing:i.boxSizing??"border-box",display:i.display??(s?"inline-flex":void 0),width:i.width??"max-content",height:i.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all"});const a=document.createElement("ul");return Object.assign(a.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:s&&o?"100%":void 0,height:s&&!o?"100%":void 0}),t.forEach(l=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._toDomStyle(l.style)}),l.fragments.forEach(h=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._toDomStyle(h.style)}),u.appendChild(document.createTextNode(h.content)),c.appendChild(u)}),a.appendChild(c)}),n.appendChild(a),n}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const n=t.data??"";let i=0;return Array.from(n).map(o=>{const s=i+=n.substring(i).indexOf(o),a=s+o.length;i+=o.length,e.setStart(t,Math.max(s,0)),e.setEnd(t,a);const l=e.getClientRects?.()??[e.getBoundingClientRect()];let c=l[l.length-1];l.length>1&&c.width<2&&(c=l[l.length-2]);const h=e.toString();if(h!==""&&c&&c.width+c.height!==0)return{content:h,top:c.top,left:c.left,height:c.height,width:c.width}}).filter(Boolean)}measureDom(t){const e=[],n=[],i=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,c)=>{const h=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:c,left:h.left,top:h.top,width:h.width,height:h.height});let u=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(p=>{i.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(p=>{p.firstChild instanceof window.Text&&this.measureDomText(p.firstChild).forEach(g=>{i.push({...g,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:n,characters:i}}measureParagraphDom(t,e){const n=e.getBoundingClientRect(),i=this.measureDom(e);i.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),i.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return i.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:c,characterIndex:h}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const u=t[l].fragments[c].characters[h],{fontHeight:p,isVertical:g}=u,f=o[s];u.inlineBox.left=f.left,u.inlineBox.top=f.top,u.inlineBox.width=f.width,u.inlineBox.height=f.height,g?(u.lineBox.left=f.left+(f.width-p)/2,u.lineBox.top=f.top,u.lineBox.width=p,u.lineBox.height=f.height):(u.lineBox.left=f.left,u.lineBox.top=f.top+(f.height-p)/2,u.lineBox.width=f.width,u.lineBox.height=p),s++}),{paragraphs:t,boundingBox:new X(0,0,n.width,n.height)}}measure(t,e,n){let i;n||(n=this.createDom(t,e),Object.assign(n.style,{position:"fixed",visibility:"hidden"}),document.body.appendChild(n),i=()=>n?.parentNode?.removeChild(n));const o=this.measureParagraphDom(t,n);return i?.(),o}}function Wi(){const r=new se,t=on(),e=an(t);return{name:"background",pathSet:r,load:async n=>{const{backgroundImage:i}=n.computedStyle;i&&t.needsLoad(i)&&await t.load(i)},update:n=>{r.paths.length=0;const{computedStyle:i,lineBox:o,isVertical:s}=n,{backgroundImage:a,backgroundSize:l,backgroundColormap:c}=i;if(tt(a))return;const{pathSet:h}=e.parse(a),u=h.getBoundingBox(!0);let p,g,f,y;s?{x:g,y:p,width:y,height:f}=o:{x:p,y:g,width:f,height:y}=o;const d=Sr(c??"none"),P=h.paths.map(v=>{const x=v.clone();return x.style.fill&&x.style.fill in d&&(x.style.fill=d[x.style.fill]),x.style.stroke&&x.style.stroke in d&&(x.style.stroke=d[x.style.stroke]),x});let M,w;if(l==="rigid"){M=Math.max(n.fontSize*5/u.width),w=M;const v=new k;v.x=u.width-f/M,v.y=u.height-y/w,P.forEach(x=>{x.applyTransform(S=>{const b=S.x>u.left+u.width/2,D=S.y>u.top+u.height/2;b&&(S.x-=v.x),D&&(S.y-=v.y)})})}else M=f/u.width,w=y/u.height;const C=new Ct;C.translate(-u.x,-u.y),C.scale(M,w),s&&(C.translate(-f/2,-y/2),C.rotate(-Math.PI/2),C.translate(y/2,f/2)),C.translate(p,g),P.forEach(v=>{v.applyTransform(x=>{x.applyMatrix3(C)})}),r.paths.push(...P)},renderOrder:-2,render:(n,i)=>{const{boundingBox:o,computedStyle:s}=i;tt(s.backgroundColor)||(n.fillStyle=s.backgroundColor,n.fillRect(...o.array)),r.paths.forEach(a=>{if(he({ctx:n,path:a,fontSize:s.fontSize}),i.debug){const l=new se([a]).getBoundingBox();l&&n.strokeRect(l.x,l.y,l.width,l.height)}}),i.paragraphs.forEach(a=>{const{lineBox:l,style:c}=a;tt(c.backgroundColor)||(n.fillStyle=c.backgroundColor,n.fillRect(...l.array)),a.fragments.forEach(h=>{const{inlineBox:u,style:p}=h;tt(p.backgroundColor)||(n.fillStyle=p.backgroundColor,n.fillRect(...u.array))})})}}}function Pr(r){const{highlight:t,highlightImage:e,highlightReferImage:n,highlightColormap:i,highlightLine:o,highlightSize:s,highlightThickness:a}=r;return{image:t?.image??e??"none",referImage:t?.referImage??n??"none",colormap:t?.colormap??i??"none",line:t?.line??o??"none",size:t?.size??s??"cover",thickness:t?.thickness??a??"100%"}}function Hi(){const r=new se,t=[],e=on(),n=an(e);return{name:"highlight",pathSet:r,load:async i=>{const o=new Set;i.forEachCharacter(s=>{const{computedStyle:a}=s,{image:l,referImage:c}=Pr(a);l&&e.needsLoad(l)&&o.add(l),c&&e.needsLoad(c)&&o.add(c)}),await Promise.all(Array.from(o).map(s=>e.load(s)))},update:i=>{t.length=0,r.paths.length=0;let o=[],s,a;i.forEachCharacter(l=>{const{computedStyle:c}=l,h=Pr(c),{image:u,colormap:p,line:g,size:f,thickness:y}=h;if(tt(u))s?.length&&(s=[],o.push(s));else{const{inlineBox:d,isVertical:P}=l,{fontSize:M}=c;(!a||ge(a.image,u)&&ge(a.colormap,p)&&ge(a.line,g)&&ge(a.size,f)&&ge(a.thickness,y))&&s?.length&&(P?s[0].inlineBox.left===d.left:s[0].inlineBox.top===d.top)&&s[0].fontSize===M?s.push(l):(s=[],s.push(l),o.push(s))}a=h}),o=o.filter(l=>l.length);for(let l=0;l<o.length;l++){const c=o[l],h=c[0],u=X.from(...c.map(I=>I.compatibleGlyphBox));if(!u.height||!u.width)continue;const{computedStyle:p,isVertical:g,inlineBox:f,compatibleGlyphBox:y,strikeoutPosition:d,underlinePosition:P}=h,{fontSize:M}=p,{image:w,referImage:C,colormap:v,line:x,size:S,thickness:b}=Pr(p),D=br(b,{fontSize:M,total:u.width})/u.width,N=Sr(v),{pathSet:E,dom:F}=n.parse(w),z=E.getBoundingBox(!0),B=M/z.width*2,A=new X().copy(u);g&&(A.width=u.height,A.height=u.width,A.left=u.left+u.width);const W=Math.floor(A.width);let O=W;S!=="cover"&&(O=br(S,{fontSize:M,total:u.width})||W,A.width=O);const L=!tt(C)&&tt(x);if(L)z.copy(n.parse(C).pathSet.getBoundingBox(!0));else{let I;if(tt(x))if(z.width/z.height>4){I="underline";const V=F.getAttribute("viewBox");if(V){const[T,_,U,$]=V.split(" ").map(Z=>Number(Z)),q=_+$/2;z.y<q&&z.y+z.height>q?I="line-through":z.y+z.height<q?I="overline":I="underline"}}else I="outline";else I=x;switch(I){case"outline":{const V=A.width*.2,T=A.height*.2;g?(A.x-=T/2,A.y-=V/2,A.x-=A.height):(A.x-=V/2,A.y-=T/2),A.width+=V,A.height+=T;break}case"overline":A.height=z.height*B,g?A.x=f.left+f.width:A.y=f.top;break;case"line-through":A.height=z.height*B,g?A.x=f.left+f.width-d+A.height/2:A.y=f.top+d-A.height/2;break;case"underline":A.height=z.height*B,g?A.x=y.left+y.width-P:A.y=f.top+P;break}}const j=new Ct;if(j.translate(-z.x,-z.y),j.scale(A.width/z.width,A.height/z.height),g){const I=A.width/2,V=A.height/2;L||j.translate(-I,-V),j.rotate(-Math.PI/2),L||j.translate(V,I)}j.translate(A.x,A.y);for(let I=0;I<Math.ceil(W/O);I++){const V=j.clone();g?V.translate(0,I*A.width):V.translate(I*A.width,0),E.paths.forEach(T=>{const _=T.clone().applyTransform(V);_.style.strokeWidth&&(_.style.strokeWidth*=B*D),_.style.strokeMiterlimit&&(_.style.strokeMiterlimit*=B),_.style.strokeDashoffset&&(_.style.strokeDashoffset*=B),_.style.strokeDasharray&&(_.style.strokeDasharray=_.style.strokeDasharray.map(U=>U*B)),_.style.fill&&_.style.fill in N&&(_.style.fill=N[_.style.fill]),_.style.stroke&&_.style.stroke in N&&(_.style.stroke=N[_.style.stroke]),r.paths.push(_),W!==O&&(g?t[r.paths.length-1]=new X(u.left-u.width*2,u.top,u.width*4,u.height):t[r.paths.length-1]=new X(u.left,u.top-u.height*2,u.width,u.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const i=[];return r.paths.forEach((o,s)=>{const a=t[s];let l=o.getBoundingBox();if(a){const c=Math.max(l.x,a.x),h=Math.max(l.y,a.y),u=Math.min(l.right,a.right),p=Math.min(l.bottom,a.bottom);l=new X(c,h,u-c,p-h)}i.push(l)}),X.from(...i)},render:(i,o)=>{r.paths.forEach((s,a)=>{if(he({ctx:i,path:s,fontSize:o.computedStyle.fontSize,clipRect:t[a]}),o.debug){const l=new se([s]).getBoundingBox();l&&i.strokeRect(l.x,l.y,l.width,l.height)}})}}}function Zl(r,t){return`<svg width="${r*2}" height="${r*2}" xmlns="http://www.w3.org/2000/svg">
30
+ </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...n}=t,{left:i,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*e,l.height=a*e,l.style.width=`${s}px`,l.style.height=`${a}px`;const c=l.getContext("2d");return c&&(c.scale(e,e),c.translate(-i,-o),this.paths.forEach(u=>{u.drawTo(c,n)})),l}}class ui{constructor(t,e){this.text=t,this.context=e}pixelRatio=window?.devicePixelRatio||1;_setupView=()=>{const t=this.pixelRatio,e=this.context,{left:n,top:i,width:o,height:s}=this.text.boundingBox,a=e.canvas;a.dataset.viewBox=`${n} ${i} ${o} ${s}`,a.dataset.pixelRatio=String(t);const l=o,c=s;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(c*t)),a.style.width=`${l}px`,a.style.height=`${c}px`,e.clearRect(0,0,a.width,a.height),e.scale(t,t),e.translate(-n,-i)};_setupColors=()=>{const{paragraphs:t,computedStyle:e,glyphBox:n}=this.text;this.uploadColor(e,n),t.forEach(i=>{this.uploadColor(i.computedStyle,i.lineBox),i.fragments.forEach(o=>{this.uploadColor(o.computedStyle,o.inlineBox)})})};setup=()=>(this._setupView(),this._setupColors(),this);_parseColor=(t,e)=>{if(typeof t=="string"&&_e(t)){const n=Or(t)[0];if(n)switch(n.type){case"linear-gradient":{let i=0;if(n.orientation)switch(n.orientation.type){case"angular":i=Number(n.orientation.value);break}const{left:o,top:s,width:a,height:l}=e,c=i*Math.PI/180,u=a*Math.sin(c),h=l*Math.cos(c),p=this.context.createLinearGradient(o+a/2-u,s+l/2+h,o+a/2+u,s+l/2-h);return n.colorStops.forEach(g=>{let f=0;if(g.length)switch(g.length.type){case"%":f=Number(g.length.value)/100;break}switch(g.type){case"rgb":p.addColorStop(f,`rgb(${g.value.join(", ")})`);break;case"rgba":p.addColorStop(f,`rgba(${g.value.join(", ")})`);break;case"hex":p.addColorStop(f,`#${g.value}`);break}}),p}}}return t};_uploadedStyles=["color","backgroundColor","textStrokeColor"];uploadColor=(t,e)=>{this._uploadedStyles.forEach(n=>{t[n]=this._parseColor(t[n],e)})};drawPath=(t,e={})=>{const n=this.context,{fontSize:i=this.text.computedStyle.fontSize,clipRect:o}=e;n.save(),n.beginPath(),o&&(n.rect(o.left,o.top,o.width,o.height),n.clip(),n.beginPath());const s=t.style,a=e.textStrokeColor??s.stroke,l=e.textStrokeWidth?e.textStrokeWidth*i:s.strokeWidth;t.drawTo(n,{...s,fill:e.color??s.fill,stroke:l===void 0||l>0?a:void 0,strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(e.shadowOffsetX??0)*i,shadowOffsetY:(e.shadowOffsetY??0)*i,shadowBlur:(e.shadowBlur??0)*i,shadowColor:e.shadowColor}),n.restore()};drawCharacter=(t,e={})=>{const n=this.context,{computedStyle:i,path:o,glyphBox:s,isVertical:a,content:l,inlineBox:c,baseline:u}=t,h={...i,...e};if(s)this.drawPath(o,h);else{n.save(),n.beginPath();const p=o.style;Dn(n,{...p,fill:h.color??p.fill,stroke:h.textStrokeColor??p.stroke,strokeWidth:h.textStrokeWidth?h.textStrokeWidth*h.fontSize:p.strokeWidth,shadowOffsetX:(h.shadowOffsetX??0)*h.fontSize,shadowOffsetY:(h.shadowOffsetY??0)*h.fontSize,shadowBlur:(h.shadowBlur??0)*h.fontSize,shadowColor:h.shadowColor}),n.font=`${h.fontSize}px ${h.fontFamily}`,a?(n.textBaseline="middle",n.fillText(l,c.left,c.top+c.height/2)):(n.textBaseline="alphabetic",n.fillText(l,c.left,c.top+u)),n.restore()}}}var ut=Uint8Array,At=Uint16Array,Vn=Int32Array,an=new ut([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ln=new ut([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jn=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fi=function(r,t){for(var e=new At(31),n=0;n<31;++n)e[n]=t+=1<<r[n-1];for(var i=new Vn(e[30]),n=1;n<30;++n)for(var o=e[n];o<e[n+1];++o)i[o]=o-e[n]<<5|n;return{b:e,r:i}},pi=fi(an,2),di=pi.b,Gn=pi.r;di[28]=258,Gn[258]=28;for(var gi=fi(ln,0),ua=gi.b,yi=gi.r,qn=new At(32768),K=0;K<32768;++K){var ne=(K&43690)>>1|(K&21845)<<1;ne=(ne&52428)>>2|(ne&13107)<<2,ne=(ne&61680)>>4|(ne&3855)<<4,qn[K]=((ne&65280)>>8|(ne&255)<<8)>>1}for(var Wt=(function(r,t,e){for(var n=r.length,i=0,o=new At(t);i<n;++i)r[i]&&++o[r[i]-1];var s=new At(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(e){a=new At(1<<t);var l=15-t;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],u=t-r[i],h=s[r[i]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)a[qn[h]>>l]=c}else for(a=new At(n),i=0;i<n;++i)r[i]&&(a[i]=qn[s[r[i]-1]++]>>15-r[i]);return a}),re=new ut(288),K=0;K<144;++K)re[K]=8;for(var K=144;K<256;++K)re[K]=9;for(var K=256;K<280;++K)re[K]=7;for(var K=280;K<288;++K)re[K]=8;for(var Be=new ut(32),K=0;K<32;++K)Be[K]=5;var fa=Wt(re,9,0),pa=Wt(re,9,1),da=Wt(Be,5,0),ga=Wt(Be,5,1),Wn=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},Lt=function(r,t,e){var n=t/8|0;return(r[n]|r[n+1]<<8)>>(t&7)&e},Hn=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},Xn=function(r){return(r+7)/8|0},mi=function(r,t,e){return(e==null||e>r.length)&&(e=r.length),new ut(r.subarray(t,e))},ya=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$t=function(r,t,e){var n=new Error(t||ya[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,$t),!e)throw n;return n},ma=function(r,t,e,n){var i=r.length,o=0;if(!i||t.f&&!t.l)return e||new ut(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new ut(i*3));var c=function(Pt){var Tt=e.length;if(Pt>Tt){var ht=new ut(Math.max(Tt*2,Pt));ht.set(e),e=ht}},u=t.f||0,h=t.p||0,p=t.b||0,g=t.l,f=t.d,y=t.m,d=t.n,P=i*8;do{if(!g){u=Lt(r,h,1);var M=Lt(r,h+1,3);if(h+=3,M)if(M==1)g=pa,f=ga,y=9,d=5;else if(M==2){var x=Lt(r,h,31)+257,S=Lt(r,h+10,15)+4,b=x+Lt(r,h+5,31)+1;h+=14;for(var D=new ut(b),z=new ut(19),E=0;E<S;++E)z[jn[E]]=Lt(r,h+E*3,7);h+=S*3;for(var F=Wn(z),N=(1<<F)-1,B=Wt(z,F,1),E=0;E<b;){var A=B[Lt(r,h,N)];h+=A&15;var w=A>>4;if(w<16)D[E++]=w;else{var W=0,O=0;for(w==16?(O=3+Lt(r,h,3),h+=2,W=D[E-1]):w==17?(O=3+Lt(r,h,7),h+=3):w==18&&(O=11+Lt(r,h,127),h+=7);O--;)D[E++]=W}}var L=D.subarray(0,x),V=D.subarray(x);y=Wn(L),d=Wn(V),g=Wt(L,y,1),f=Wt(V,d,1)}else $t(1);else{var w=Xn(h)+4,C=r[w-4]|r[w-3]<<8,v=w+C;if(v>i){l&&$t(0);break}a&&c(p+C),e.set(r.subarray(w,v),p),t.b=p+=C,t.p=h=v*8,t.f=u;continue}if(h>P){l&&$t(0);break}}a&&c(p+131072);for(var I=(1<<y)-1,R=(1<<d)-1,T=h;;T=h){var W=g[Hn(r,h)&I],_=W>>4;if(h+=W&15,h>P){l&&$t(0);break}if(W||$t(2),_<256)e[p++]=_;else if(_==256){T=h,g=null;break}else{var U=_-254;if(_>264){var E=_-257,$=an[E];U=Lt(r,h,(1<<$)-1)+di[E],h+=$}var q=f[Hn(r,h)&R],X=q>>4;q||$t(3),h+=q&15;var V=ua[X];if(X>3){var $=ln[X];V+=Hn(r,h)&(1<<$)-1,h+=$}if(h>P){l&&$t(0);break}a&&c(p+131072);var nt=p+U;if(p<V){var Zt=o-V,Dt=Math.min(V,nt);for(Zt+p<0&&$t(3);p<Dt;++p)e[p]=n[Zt+p]}for(;p<nt;++p)e[p]=e[p-V]}}t.l=g,t.p=T,t.b=p,t.f=u,g&&(u=1,t.m=y,t.d=f,t.n=d)}while(!u);return p!=e.length&&s?mi(e,0,p):e.subarray(0,p)},Qt=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8},De=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8,r[n+2]|=e>>16},Zn=function(r,t){for(var e=[],n=0;n<r.length;++n)r[n]&&e.push({s:n,f:r[n]});var i=e.length,o=e.slice();if(!i)return{t:bi,l:0};if(i==1){var s=new ut(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,x){return v.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,u=1,h=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=e[e[c].f<e[h].f?c++:h++],l=e[c!=u&&e[c].f<e[h].f?c++:h++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var p=o[0].s,n=1;n<i;++n)o[n].s>p&&(p=o[n].s);var g=new At(p+1),f=Yn(e[u-1],g,0);if(f>t){var n=0,y=0,d=f-t,P=1<<d;for(o.sort(function(x,S){return g[S.s]-g[x.s]||x.f-S.f});n<i;++n){var M=o[n].s;if(g[M]>t)y+=P-(1<<f-g[M]),g[M]=t;else break}for(y>>=d;y>0;){var w=o[n].s;g[w]<t?y-=1<<t-g[w]++-1:++n}for(;n>=0&&y;--n){var C=o[n].s;g[C]==t&&(--g[C],++y)}f=t}return{t:new ut(g),l:f}},Yn=function(r,t,e){return r.s==-1?Math.max(Yn(r.l,t,e+1),Yn(r.r,t,e+1)):t[r.s]=e},xi=function(r){for(var t=r.length;t&&!r[--t];);for(var e=new At(++t),n=0,i=r[0],o=1,s=function(l){e[n++]=l},a=1;a<=t;++a)if(r[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=r[a]}return{c:e.subarray(0,n),n:t}},Fe=function(r,t){for(var e=0,n=0;n<t.length;++n)e+=r[n]*t[n];return e},vi=function(r,t,e){var n=e.length,i=Xn(t+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var o=0;o<n;++o)r[i+o+4]=e[o];return(i+4+n)*8},wi=function(r,t,e,n,i,o,s,a,l,c,u){Qt(t,u++,e),++i[256];for(var h=Zn(i,15),p=h.t,g=h.l,f=Zn(o,15),y=f.t,d=f.l,P=xi(p),M=P.c,w=P.n,C=xi(y),v=C.c,x=C.n,S=new At(19),b=0;b<M.length;++b)++S[M[b]&31];for(var b=0;b<v.length;++b)++S[v[b]&31];for(var D=Zn(S,7),z=D.t,E=D.l,F=19;F>4&&!z[jn[F-1]];--F);var N=c+5<<3,B=Fe(i,re)+Fe(o,Be)+s,A=Fe(i,p)+Fe(o,y)+s+14+3*F+Fe(S,z)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&N<=B&&N<=A)return vi(t,u,r.subarray(l,l+c));var W,O,L,V;if(Qt(t,u,1+(A<B)),u+=2,A<B){W=Wt(p,g,0),O=p,L=Wt(y,d,0),V=y;var I=Wt(z,E,0);Qt(t,u,w-257),Qt(t,u+5,x-1),Qt(t,u+10,F-4),u+=14;for(var b=0;b<F;++b)Qt(t,u+3*b,z[jn[b]]);u+=3*F;for(var R=[M,v],T=0;T<2;++T)for(var _=R[T],b=0;b<_.length;++b){var U=_[b]&31;Qt(t,u,I[U]),u+=z[U],U>15&&(Qt(t,u,_[b]>>5&127),u+=_[b]>>12)}}else W=fa,O=re,L=da,V=Be;for(var b=0;b<a;++b){var $=n[b];if($>255){var U=$>>18&31;De(t,u,W[U+257]),u+=O[U+257],U>7&&(Qt(t,u,$>>23&31),u+=an[U]);var q=$&31;De(t,u,L[q]),u+=V[q],q>3&&(De(t,u,$>>5&8191),u+=ln[q])}else De(t,u,W[$]),u+=O[$]}return De(t,u,W[256]),u+O[256]},xa=new Vn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bi=new ut(0),va=function(r,t,e,n,i,o){var s=o.z||r.length,a=new ut(n+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(n,a.length-i),c=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var h=xa[t-1],p=h>>13,g=h&8191,f=(1<<e)-1,y=o.p||new At(32768),d=o.h||new At(f+1),P=Math.ceil(e/3),M=2*P,w=function(kt){return(r[kt]^r[kt+1]<<P^r[kt+2]<<M)&f},C=new Vn(25e3),v=new At(288),x=new At(32),S=0,b=0,D=o.i||0,z=0,E=o.w||0,F=0;D+2<s;++D){var N=w(D),B=D&32767,A=d[N];if(y[B]=A,d[N]=B,E<=D){var W=s-D;if((S>7e3||z>24576)&&(W>423||!c)){u=wi(r,l,0,C,v,x,b,z,F,D-F,u),z=S=b=0,F=D;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)x[O]=0}var L=2,V=0,I=g,R=B-A&32767;if(W>2&&N==w(D-R))for(var T=Math.min(p,W)-1,_=Math.min(32767,D),U=Math.min(258,W);R<=_&&--I&&B!=A;){if(r[D+L]==r[D+L-R]){for(var $=0;$<U&&r[D+$]==r[D+$-R];++$);if($>L){if(L=$,V=R,$>T)break;for(var q=Math.min(R,$-2),X=0,O=0;O<q;++O){var nt=D-R+O&32767,Zt=y[nt],Dt=nt-Zt&32767;Dt>X&&(X=Dt,A=nt)}}}B=A,A=y[B],R+=B-A&32767}if(V){C[z++]=268435456|Gn[L]<<18|yi[V];var Pt=Gn[L]&31,Tt=yi[V]&31;b+=an[Pt]+ln[Tt],++v[257+Pt],++x[Tt],E=D+L,++S}else C[z++]=r[D],++v[r[D]]}}for(D=Math.max(D,E);D<s;++D)C[z++]=r[D],++v[r[D]];u=wi(r,l,c,C,v,x,b,z,F,D-F,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=d,o.p=y,o.i=D,o.w=E)}else{for(var D=o.w||0;D<s+c;D+=65535){var ht=D+65535;ht>=s&&(l[u/8|0]=c,ht=s),u=vi(l,u+1,r.subarray(D,ht))}o.i=s}return mi(a,0,n+Xn(u)+i)},Si=function(){var r=1,t=0;return{p:function(e){for(var n=r,i=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=n+=e[s];n=(n&65535)+15*(n>>16),i=(i&65535)+15*(i>>16)}r=n,t=i},d:function(){return r%=65521,t%=65521,(r&255)<<24|(r&65280)<<8|(t&255)<<8|t>>8}}},wa=function(r,t,e,n,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ut(o.length+r.length);s.set(o),s.set(r,o.length),r=s,i.w=o.length}return va(r,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+t.mem,e,n,i)},Ci=function(r,t,e){for(;e;++t)r[t]=e,e>>>=8},ba=function(r,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(r[0]=120,r[1]=n<<6|(t.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,t.dictionary){var i=Si();i.p(t.dictionary),Ci(r,2,i.d())}},Sa=function(r,t){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&$t(6,"invalid zlib data"),(r[1]>>5&1)==1&&$t(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function Ca(r,t){t||(t={});var e=Si();e.p(r);var n=wa(r,t,t.dictionary?6:2,4);return ba(n,t),Ci(n,n.length-4,e.d()),n}function Pa(r,t){return ma(r.subarray(Sa(r),-4),{i:2},t,t)}var Ma=typeof TextDecoder<"u"&&new TextDecoder,_a=0;try{Ma.decode(bi,{stream:!0}),_a=1}catch{}const Ta="modern-font";function Ue(r,t){if(!r)throw new Error(`[${Ta}] ${t}`)}function ka(r){if("buffer"in r){const t=r.buffer;return r.byteOffset>0||r.byteLength<r.buffer.byteLength?t.slice(r.byteOffset,r.byteOffset+r.byteLength):t}else return r}function xe(r){return"buffer"in r?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(r)}function Aa(r){let t="";for(let e=0,n=r.length,i;e<n;e++)i=r.charCodeAt(e),i!==0&&(t+=String.fromCharCode(i));return t}function cn(r){r=Aa(r);const t=[];for(let e=0,n=r.length,i;e<n;e++)i=r.charCodeAt(e),t.push(i>>8),t.push(i&255);return t}function Oa(r){let t="";for(let e=0,n=r.length;e<n;e++)r[e]<127?t+=String.fromCharCode(r[e]):t+=`%${(256+r[e]).toString(16).slice(1)}`;return unescape(t)}function Ia(r){let t="";for(let e=0,n=r.length;e<n;e+=2)t+=String.fromCharCode((r[e]<<8)+r[e+1]);return t}var Ea=Object.defineProperty,ft=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ea(t,e,i),i};const hn={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(r,t){Object.defineProperty(r.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class lt extends DataView{constructor(t,e,n,i){super(ka(t),e,n),this.littleEndian=i}cursor=0;readColumn(t){if(t.size){const e=Array.from({length:t.size},(n,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(n,i)=>{this.write(t.type,e[i],t.offset+i)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const i=`get${t.replace(/^\S/,l=>l.toUpperCase())}`,o=this,a=o[i]?.bind(o)?.(e,n);return this.cursor+=hn[t],a}readUint24(t=this.cursor){const[e,n,i]=this.readBytes(t,3);return(e<<16)+(n<<8)+i}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let i=0;i<e;++i)n.push(this.getUint8(t+i));return this.cursor=t+e,n}readString(t,e){const n=this.readBytes(t,e);let i="";for(let o=0,s=n.length;o<s;o++)i+=String.fromCharCode(n[o]);return i}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),i=new Date;return i.setTime(n*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,i=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const o=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,l=s[o]?.bind(s)?.(n,e,i);return this.cursor+=hn[t.toLowerCase()],l}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let i=0,o=t.length,s;i<o;++i)s=t.charCodeAt(i)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=n,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(i,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let i=0;i<n;++i)this.setUint8(e+i,t[i])}else{const i=xe(t);n=i.byteLength;for(let o=0;o<n;++o)this.setUint8(e+o,i.getUint8(o))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}ft([pt()],lt.prototype,"readInt8"),ft([pt()],lt.prototype,"readInt16"),ft([pt()],lt.prototype,"readInt32"),ft([pt()],lt.prototype,"readUint8"),ft([pt()],lt.prototype,"readUint16"),ft([pt()],lt.prototype,"readUint32"),ft([pt()],lt.prototype,"readFloat32"),ft([pt()],lt.prototype,"readFloat64"),ft([pt()],lt.prototype,"writeInt8"),ft([pt()],lt.prototype,"writeInt16"),ft([pt()],lt.prototype,"writeInt32"),ft([pt()],lt.prototype,"writeUint8"),ft([pt()],lt.prototype,"writeUint16"),ft([pt()],lt.prototype,"writeUint32"),ft([pt()],lt.prototype,"writeFloat32"),ft([pt()],lt.prototype,"writeFloat64");const Pi=new WeakMap;function m(r){const t=typeof r=="object"?r:{type:r},{size:e=1,type:n}=t;return(i,o)=>{if(typeof o!="string")return;let s=Pi.get(i);s||(s={columns:[],byteLength:0},Pi.set(i,s));const a={...t,name:o,byteLength:e*hn[n],offset:t.offset??s.columns.reduce((l,c)=>l+c.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,c)=>l+hn[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Bt{view;constructor(t,e,n,i){this.view=new lt(t,e,n,i)}}class Kn extends Bt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Ba=Object.defineProperty,wt=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ba(t,e,i),i};const bt=class Ki extends Kn{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(t){const e=t.sfnt,i=e.name.names,o=cn(i.fontFamily||""),s=o.length,a=cn(i.fontStyle||""),l=a.length,c=cn(i.version||""),u=c.length,h=cn(i.fullName||""),p=h.length,g=86+s+4+l+4+u+4+p+2+t.view.byteLength,f=new Ki(new ArrayBuffer(g),0,g,!0);f.EOTSize=f.view.byteLength,f.FontDataSize=t.view.byteLength,f.Version=131073,f.Flags=0,f.Charset=1,f.MagicNumber=20556,f.Padding1=0,f.CheckSumAdjustment=e.head.checkSumAdjustment;const y=e.os2;return y&&(f.FontPANOSE=y.fontPANOSE,f.Italic=y.fsSelection,f.Weight=y.usWeightClass,f.fsType=y.fsType,f.UnicodeRange=y.ulUnicodeRange,f.CodePageRange=y.ulCodePageRange),f.view.writeUint16(s),f.view.writeBytes(o),f.view.writeUint16(0),f.view.writeUint16(l),f.view.writeBytes(a),f.view.writeUint16(0),f.view.writeUint16(u),f.view.writeBytes(c),f.view.writeUint16(0),f.view.writeUint16(p),f.view.writeBytes(h),f.view.writeUint16(0),f.view.writeUint16(0),f.view.writeBytes(t.view),f}};wt([m("uint32")],bt.prototype,"EOTSize"),wt([m("uint32")],bt.prototype,"FontDataSize"),wt([m("uint32")],bt.prototype,"Version"),wt([m("uint32")],bt.prototype,"Flags"),wt([m({type:"uint8",size:10})],bt.prototype,"FontPANOSE"),wt([m("uint8")],bt.prototype,"Charset"),wt([m("uint8")],bt.prototype,"Italic"),wt([m("uint32")],bt.prototype,"Weight"),wt([m("uint16")],bt.prototype,"fsType"),wt([m("uint16")],bt.prototype,"MagicNumber"),wt([m({type:"uint8",size:16})],bt.prototype,"UnicodeRange"),wt([m({type:"uint8",size:8})],bt.prototype,"CodePageRange"),wt([m("uint32")],bt.prototype,"CheckSumAdjustment"),wt([m({type:"uint8",size:16})],bt.prototype,"Reserved"),wt([m("uint16")],bt.prototype,"Padding1");var Da=Object.defineProperty,un=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Da(t,e,i),i};class Le extends Bt{constructor(t,e){super(t,e,16)}}un([m({type:"char",size:4})],Le.prototype,"tag"),un([m("uint32")],Le.prototype,"checkSum"),un([m("uint32")],Le.prototype,"offset"),un([m("uint32")],Le.prototype,"length");const Qn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Fa=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Mi{index;name;isComposite=!1;components=[];pathCommands=[];constructor(t){const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,n=72,i={},o){const s=1/(o?.unitsPerEm??1e3)*n,{xScale:a=s,yScale:l=s}=i,c=this.pathCommands,u=[];for(let h=0,p=c.length;h<p;h+=1){const g=c[h];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*l}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*l}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*l,x2:t+g.x2*a,y2:e+-g.y2*l,x:t+g.x*a,y:e+-g.y*l}):g.type==="Z"&&u.push({type:"Z"})}return u}}class Ua extends Mi{parse(t,e,n){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=t,c=t.topDict.paintType,u=this.index;let h,p,g,f;const y=[],d=[];let P=0,M=!1,w=!1,C=s,v=0,x=0;function S(B,A){y.push({type:"L",x:B,y:A})}function b(B,A,W,O,L,V){y.push({type:"C",x1:B,y1:A,x2:W,y2:O,x:L,y:V})}function D(B,A){w&&c!==2&&z(),w=!0,y.push({type:"M",x:B,y:A})}function z(){y.push({type:"Z"})}function E(B){y.push(...B)}function F(){d.length%2!==0&&!M&&(C=d.shift()+o),P+=d.length>>1,d.length=0,M=!0}function N(B){let A,W,O,L,V,I,R,T,_,U,$,q,X=0;for(;X<B.length;){let nt=B[X++];switch(nt){case 1:F();break;case 3:F();break;case 4:d.length>1&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),D(v,x);break;case 5:for(;d.length>0;)v+=d.shift(),x+=d.shift(),S(v,x);break;case 6:for(;d.length>0&&(v+=d.shift(),S(v,x),d.length!==0);)x+=d.shift(),S(v,x);break;case 7:for(;d.length>0&&(x+=d.shift(),S(v,x),d.length!==0);)v+=d.shift(),S(v,x);break;case 8:for(;d.length>0;)h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);break;case 10:V=d.pop()+l,I=t.subrs[V],I&&N(I);break;case 11:return;case 12:switch(nt=B[X],X+=1,nt){case 35:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),R=g+d.shift(),T=f+d.shift(),_=R+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),x=q+d.shift(),d.shift(),b(h,p,g,f,R,T),b(_,U,$,q,v,x);break;case 34:h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),R=g+d.shift(),T=f,_=R+d.shift(),U=f,$=_+d.shift(),q=x,v=$+d.shift(),b(h,p,g,f,R,T),b(_,U,$,q,v,x);break;case 36:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),R=g+d.shift(),T=f,_=R+d.shift(),U=f,$=_+d.shift(),q=U+d.shift(),v=$+d.shift(),b(h,p,g,f,R,T),b(_,U,$,q,v,x);break;case 37:h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),R=g+d.shift(),T=f+d.shift(),_=R+d.shift(),U=T+d.shift(),$=_+d.shift(),q=U+d.shift(),Math.abs($-v)>Math.abs(q-x)?v=$+d.shift():x=q+d.shift(),b(h,p,g,f,R,T),b(_,U,$,q,v,x);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+nt}`),d.length=0}break;case 14:if(d.length>=4){const Zt=Qn[d.pop()],Dt=Qn[d.pop()],Pt=d.pop(),Tt=d.pop();if(Zt&&Dt){i.isComposite=!0,i.components=[];const ht=t.charset.indexOf(Zt),kt=t.charset.indexOf(Dt);i.components.push({glyphIndex:kt,dx:0,dy:0}),i.components.push({glyphIndex:ht,dx:Tt,dy:Pt}),E(n.get(kt).pathCommands);const Rt=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let Vt=0;Vt<Rt.length;Vt+=1){const Ft=Rt[Vt];Ft.type!=="Z"&&(Ft.x+=Tt,Ft.y+=Pt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Tt,Ft.y1+=Pt),Ft.type==="C"&&(Ft.x2+=Tt,Ft.y2+=Pt)}E(Rt)}}else d.length>0&&!M&&(C=d.shift()+o,M=!0);w&&c!==2&&(z(),w=!1);break;case 18:F();break;case 19:case 20:F(),X+=P+7>>3;break;case 21:d.length>2&&!M&&(C=d.shift()+o,M=!0),x+=d.pop(),v+=d.pop(),D(v,x);break;case 22:d.length>1&&!M&&(C=d.shift()+o,M=!0),v+=d.pop(),D(v,x);break;case 23:F();break;case 24:for(;d.length>2;)h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);v+=d.shift(),x+=d.shift(),S(v,x);break;case 25:for(;d.length>6;)v+=d.shift(),x+=d.shift(),S(v,x);h=v+d.shift(),p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+d.shift(),b(h,p,g,f,v,x);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g,x=f+d.shift(),b(h,p,g,f,v,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f,b(h,p,g,f,v,x);break;case 28:A=B[X],W=B[X+1],d.push((A<<24|W<<16)>>16),X+=2;break;case 29:V=d.pop()+a,I=t.gsubrs[V],I&&N(I);break;case 30:for(;d.length>0&&(h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(h,p,g,f,v,x),d.length!==0);)h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(h,p,g,f,v,x);break;case 31:for(;d.length>0&&(h=v+d.shift(),p=x,g=h+d.shift(),f=p+d.shift(),x=f+d.shift(),v=g+(d.length===1?d.shift():0),b(h,p,g,f,v,x),d.length!==0);)h=v,p=x+d.shift(),g=h+d.shift(),f=p+d.shift(),v=g+d.shift(),x=f+(d.length===1?d.shift():0),b(h,p,g,f,v,x);break;default:nt<32?console.warn(`Glyph ${u}: unknown operator ${nt}`):nt<247?d.push(nt-139):nt<251?(A=B[X],X+=1,d.push((nt-247)*256+A+108)):nt<255?(A=B[X],X+=1,d.push(-(nt-251)*256-A-108)):(A=B[X],W=B[X+1],O=B[X+2],L=B[X+3],X+=4,d.push((A<<24|W<<16|O<<8|L)/65536))}}}N(e),this.pathCommands=y,M&&(this.advanceWidth=C)}}class _i{constructor(t){this._sfnt=t}_items=[];get(t){const e=this._items[t];let n;if(e)n=e;else{n=this._get(t);const i=this._sfnt.hmtx.metrics[t];i&&(n.advanceWidth=n.advanceWidth||i.advanceWidth,n.leftSideBearing=n.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(n.unicode??=o[0],n.unicodes??=o),this._items[t]=n}return n}}class La extends _i{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,n=new Ua({index:t});return n.parse(e,e.charStringsIndex.get(t),this),n.name=e.charset[t],n}}var $a=Object.defineProperty,Ti=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&$a(t,e,i),i};class fn extends Bt{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(t,e,n,i){super(t,e,n,i),this._init()}_init(){const t=this.view,e=this.count,n=this.offsetSize;this.objectOffset=(e+1)*n+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,n=this.offsetSize;t.seek(3);const i=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let l=0;for(let c=0;c<n;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const t=[];for(let e=0,n=this.count;e<n;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,n=this.objectOffset,i=n+e[t],s=n+e[t+1]-i;return this._isString?this.view.readString(i,s):this.view.readBytes(i,s)}}Ti([m("uint16")],fn.prototype,"count"),Ti([m("uint8")],fn.prototype,"offsetSize");class pn extends fn{_isString=!1}class ki extends fn{_isString=!0}const Na=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],za=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","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","quoteleft","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","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Ra=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Va=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function dn(r,t){return t<=390?Na[t]:r[t-391]}function Q(r,t="number",e){return(n,i)=>{if(typeof i!="string")return;const o={type:t,operator:r,default:e??t==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Ai extends Bt{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const n=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===n||(e+=i[s],a===n))break;e+=i[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let n,i,o,s;if(t===28)return n=e.readUint8(),i=e.readUint8(),n<<8|i;if(t===29)return n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),s=e.readUint8(),n<<24|i<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=e.readUint8(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=e.readUint8(),-(t-251)*256-n-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const n=t.cursor+t.byteLength,i={};for(;t.cursor<n;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),i[o]=e,e=[]):e.push(this._readOperand(o))}return i}_getProp(t){const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return dn(this._stringIndex?.objects??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var ja=Object.defineProperty,Jn=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&ja(t,e,i),i};class gn extends Ai{}Jn([Q(19)],gn.prototype,"subrs"),Jn([Q(20)],gn.prototype,"defaultWidthX"),Jn([Q(21)],gn.prototype,"nominalWidthX");var Ga=Object.defineProperty,it=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ga(t,e,i),i};class et extends Ai{}it([Q(0,"string")],et.prototype,"version"),it([Q(1,"string")],et.prototype,"notice"),it([Q(1200,"string")],et.prototype,"copyright"),it([Q(2,"string")],et.prototype,"fullName"),it([Q(3,"string")],et.prototype,"familyName"),it([Q(4,"string")],et.prototype,"weight"),it([Q(1201)],et.prototype,"isFixedPitch"),it([Q(1202)],et.prototype,"italicAngle"),it([Q(1203,"number",-100)],et.prototype,"underlinePosition"),it([Q(1204,"number",50)],et.prototype,"underlineThickness"),it([Q(1205)],et.prototype,"paintType"),it([Q(1206,"number",2)],et.prototype,"charstringType"),it([Q(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),it([Q(13)],et.prototype,"uniqueId"),it([Q(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),it([Q(1208)],et.prototype,"strokeWidth"),it([Q(14)],et.prototype,"xuid"),it([Q(15)],et.prototype,"charset"),it([Q(16)],et.prototype,"encoding"),it([Q(17)],et.prototype,"charStrings"),it([Q(18,"number[]",[0,0])],et.prototype,"private");function dt(r,t=r){return e=>{Jt.tableDefinitions.set(r,{tag:r,prop:t,class:e}),Object.defineProperty(Jt.prototype,t,{get(){return this.get(r)},set(n){return this.set(r,n)},configurable:!0,enumerable:!0})}}class Jt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:n,charset:i}=this.cff;e=i.indexOf(n[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const n of t)e.push(this.charToGlyphIndex(n));return e}textToGlyphs(t){const e=this.glyphs,n=this.textToGlyphIndexes(t),i=n.length,o=Array.from({length:i}),s=e.get(0);for(let a=0;a<i;a+=1)o[a]=e.get(n[a])||s;return o}getPathCommands(t,e,n,i,o){const s=[];return this.forEachGlyph(t,e,n,i,o,(a,l,c,u,h)=>{s.push(...a.getPathCommands(l,c,u,h,this))}),s}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,i=72,o={},s){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(t);for(let c=0;c<l.length;c+=1){const u=l[c];s.call(this,u,e,n,i,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*i:o.tracking&&(e+=o.tracking/1e3*i)}return e}constructor(t){(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,i)=>{this.tableViews.set(i,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}clone(){return new Jt(this.tableViews)}delete(t){const e=Jt.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=Jt.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Jt.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const i=e.class;if(i){const o=this.tableViews.get(t);if(!o)return;n=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(e.prop,n)}}return n}}class gt extends Bt{setSFNT(t){return this._sfnt=t,this}getSFNT(){return this._sfnt}}var qa=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,$e=(r,t,e,n)=>{for(var i=n>1?void 0:n?Wa(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&qa(t,e,i),i};let ve=class extends gt{_glyphs;get glyphs(){return this._glyphs??=new La(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(r,t,e,n){super(r,t,e,n),this._init()}_init(){const r=this.view,{buffer:t,byteOffset:e}=r,n=e+4;this.nameIndex=new ki(t,n),this.topDictIndex=new pn(t,this.nameIndex.endOffset),this.stringIndex=new ki(t,this.topDictIndex.endOffset),this.globalSubrIndex=new pn(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new gn(t,e+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new pn(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new pn(t,e+this.topDict.charStrings);const s=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=za:this.topDict.charset===1?this.charset=Ra:this.topDict.charset===2?this.charset=Va:this.charset=this._readCharset(e+this.topDict.charset,s,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Qn:this.topDict.encoding===1?this.encoding=Fa:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(r,t,e){const n=this.view;n.seek(r);let i,o,s;t-=1;const a=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<t;i+=1)o=n.readUint16(),a.push(dn(e,o));else if(l===1)for(;a.length<=t;)for(o=n.readUint16(),s=n.readUint8(),i=0;i<=s;i+=1)a.push(dn(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=n.readUint16(),s=n.readUint16(),i=0;i<=s;i+=1)a.push(dn(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(r){const t=this.view;t.seek(r);let e,n;const i={},o=t.readUint8();if(o===0){const s=t.readUint8();for(e=0;e<s;e+=1)n=t.readUint8(),i[n]=e}else if(o===1){const s=t.readUint8();for(n=1,e=0;e<s;e+=1){const a=t.readUint8(),l=t.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(r){let t;return r.length<1240?t=107:r.length<33900?t=1131:t=32768,t}};$e([m("uint8")],ve.prototype,"majorVersion",2),$e([m("uint8")],ve.prototype,"minorVersion",2),$e([m("uint8")],ve.prototype,"headerSize",2),$e([m("uint8")],ve.prototype,"offsetSize",2),ve=$e([dt("CFF ","cff")],ve);var Ha=Object.defineProperty,yn=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ha(t,e,i),i};const Ne=class Qi extends Bt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Qi;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,i)=>{i<256&&n<256&&e.view.writeUint8(n,6+i)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};yn([m("uint16")],Ne.prototype,"format"),yn([m("uint16")],Ne.prototype,"length"),yn([m("uint16")],Ne.prototype,"language"),yn([m({type:"uint8",size:256})],Ne.prototype,"glyphIndexArray");let Oi=Ne;var Xa=Object.defineProperty,tr=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Xa(t,e,i),i};class mn extends Bt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(n[c]===0)c>=a||c<o[0].firstCode||c>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(c-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(c-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(c,l);else{const u=n[c];for(let h=0,p=o[u].entryCount;h<p;h++)if(o[u].idRangeOffset+h>=s.length?l=0:(l=s[o[u].idRangeOffset+h],l!==0&&(l=l+o[u].idDelta)),l!==0&&l<t){const g=(c<<8|h+o[u].firstCode)%65535;e.set(g,l)}}return e}}tr([m("uint16")],mn.prototype,"format"),tr([m("uint16")],mn.prototype,"length"),tr([m("uint16")],mn.prototype,"language");function Ii(r){return r>32767?r-65536:r<-32767?r+65536:r}function Ei(r,t){let e;const n=[];let i={};return r.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(i.end=e.unicode,n.push(i),i={start:s,startId:o,delta:Ii(o-s)}):(i.start=Number(s),i.startId=o,i.delta=Ii(o-s))),e={unicode:s,glyphIndex:o})}),e&&(i.end=e.unicode,n.push(i)),n}var Za=Object.defineProperty,ue=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Za(t,e,i),i};const ie=class Ji extends Bt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=Ei(t,65535),n=e.length+1,i=Math.floor(Math.log(n)/Math.LN2),o=2*2**i,s=new Ji(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=i,s.rangeShift=2*n-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<e;++c)for(let u=i[c],h=o[c];u<=h;++u)if(s[c]===0)t.set(u,(u+a[c])%65536);else{const p=c+s[c]/2+(u-i[c])-n,g=l[p];g!==0?t.set(u,(g+a[c])%65536):t.set(u,0)}return t.delete(65535),t}};ue([m("uint16")],ie.prototype,"format"),ue([m("uint16")],ie.prototype,"length"),ue([m("uint16")],ie.prototype,"language"),ue([m("uint16")],ie.prototype,"segCountX2"),ue([m("uint16")],ie.prototype,"searchRange"),ue([m("uint16")],ie.prototype,"entrySelector"),ue([m("uint16")],ie.prototype,"rangeShift");let Bi=ie;var Ya=Object.defineProperty,ze=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ya(t,e,i),i};class we extends Bt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,i)=>{e.set(i,n)}),e}}ze([m("uint16")],we.prototype,"format"),ze([m("uint16")],we.prototype,"length"),ze([m("uint16")],we.prototype,"language"),ze([m("uint16")],we.prototype,"firstCode"),ze([m("uint16")],we.prototype,"entryCount");var Ka=Object.defineProperty,Re=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Ka(t,e,i),i};const be=class ts extends Bt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Ei(t),n=new ts(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(i=>{n.view.writeUint32(i.start),n.view.writeUint32(i.end),n.view.writeUint32(i.startId)}),n}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,i=e.length;n<i;n++){const o=e[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,s++)}return t}};Re([m("uint16")],be.prototype,"format"),Re([m("uint16")],be.prototype,"reserved"),Re([m("uint32")],be.prototype,"length"),Re([m("uint32")],be.prototype,"language"),Re([m("uint32")],be.prototype,"nGroups");let Di=be;var Qa=Object.defineProperty,er=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Qa(t,e,i),i};class xn extends Bt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,i=e.length;n<i;n++){const{uVSMappings:o}=e[n];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}er([m("uint16")],xn.prototype,"format"),er([m("uint32")],xn.prototype,"length"),er([m("uint32")],xn.prototype,"numVarSelectorRecords");var Ja=Object.defineProperty,tl=Object.getOwnPropertyDescriptor,nr=(r,t,e,n)=>{for(var i=n>1?void 0:n?tl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Ja(t,e,i),i};let Ve=class extends gt{static from(r){const t=Array.from(r.keys()).some(u=>u>65535),e=Bi.from(r),n=Oi.from(r),i=t?Di.from(r):void 0,o=4+(i?32:24),s=o+e.view.byteLength,a=s+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:s},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new Ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+n.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(e.view,o),c.view.writeBytes(n.view,s),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const r=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let n=0,i=e.length;n<i;n++){const o=e[n],s=t.get(o);r.has(s)?r.get(s).push(o):r.set(s,[o])}this._glyphIndexToUnicodesMap=r}return this._glyphIndexToUnicodesMap}readSubtables(){const r=this.numberSubtables;return this.view.seek(4),Array.from({length:r},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const e=this.view.readUint16();let n;switch(e){case 0:n=new Oi(this.view.buffer,t.offset);break;case 2:n=new mn(this.view.buffer,t.offset,this.view.readUint16());break;case 4:n=new Bi(this.view.buffer,t.offset,this.view.readUint16());break;case 6:n=new we(this.view.buffer,t.offset,this.view.readUint16());break;case 12:n=new Di(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:n=new xn(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:n}})}readunicodeToGlyphIndexMap(){const r=this.readSubtables(),t=r.find(s=>s.format===0)?.view,e=r.find(s=>s.platformID===3&&s.platformSpecificID===3&&s.format===2)?.view,n=r.find(s=>s.platformID===3&&s.platformSpecificID===1&&s.format===4)?.view,i=r.find(s=>s.platformID===3&&s.platformSpecificID===10&&s.format===12)?.view,o=r.find(s=>s.platformID===0&&s.platformSpecificID===5&&s.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...e?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...n?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...o?.getUnicodeToGlyphIndexMap()??[]])}};nr([m("uint16")],Ve.prototype,"version",2),nr([m("uint16")],Ve.prototype,"numberSubtables",2),Ve=nr([dt("cmap")],Ve);class el extends Mi{_parseContours(t){const e=[];let n=[];for(let i=0;i<t.length;i+=1){const o=t[i];n.push(o),o.lastPointOfContour&&(e.push(n),n=[])}return Ue(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let i=0;i<t.length;i+=1){const o=t[i],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(t,e,n,i,o){let s;return(e&i)>0?(s=t.view.readUint8(),(e&o)===0&&(s=-s),s=n+s):(e&o)>0?s=n:s=n+t.view.readInt16(),s}parse(t,e,n){t.view.seek(e);const i=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();Ue(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(t.view.readUint8());const u=t.view.byteOffset,h=a[a.length-1]+1;Ue(h<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let g,f=0;for(;f<h;)if(g=t.view.readUint8(),p.push(g),f++,g&8&&f<h){const y=t.view.readUint8();for(let d=0;d<y;d++)p.push(g),f++}if(Ue(p.length===h,`Bad flags length: ${p.length}, numberOfCoordinates: ${h}`),a.length>0){const y=[];let d;if(h>0){for(let w=0;w<h;w+=1)g=p[w],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(w),y.push(d);let P=0;for(let w=0;w<h;w+=1)g=p[w],d=y[w],d.x=this._parseGlyphCoordinate(t,g,P,2,16),P=d.x;let M=0;for(let w=0;w<h;w+=1)g=p[w],d=y[w],d.y=this._parseGlyphCoordinate(t,g,M,4,32),M=d.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const c={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=t.view.readInt16(),c.dy=t.view.readInt16()):c.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(c.dx=t.view.readInt8(),c.dy=t.view.readInt8()):c.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?c.xScale=c.yScale=t.view.readInt16()/16384:(a&64)>0?(c.xScale=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384):(a&128)>0&&(c.xScale=t.view.readInt16()/16384,c.scale01=t.view.readInt16()/16384,c.scale10=t.view.readInt16()/16384,c.yScale=t.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=n.get(l.glyphIndex);if(c.getPathCommands(),c.points){let u;if(l.matchedPoints===void 0)u=this._transformPoints(c.points,l);else{Ue(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const h=this.points[l.matchedPoints[0]];let p=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=h.x-p.x,g.dy=h.y-p.y,u=this._transformPoints(c.points,g)}this.points=this.points.concat(u)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const c=s[a];let u=c[c.length-1],h=c[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):h.onCurve?o.push({type:"M",x:h.x,y:h.y}):o.push({type:"M",x:(u.x+h.x)*.5,y:(u.y+h.y)*.5});for(let p=0,g=c.length;p<g;++p)if(u=h,h=c[(p+1)%g],u.onCurve)o.push({type:"L",x:u.x,y:u.y});else{let f=h;h.onCurve||(f={x:(u.x+h.x)*.5,y:(u.y+h.y)*.5}),o.push({type:"Q",x1:u.x,y1:u.y,x:f.x,y:f.y})}o.push({type:"Z"})}this.pathCommands=o}}class nl extends _i{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,n=e[t],i=new el({index:t});return n!==e[t+1]&&i.parse(this._sfnt.glyf,n,this),i}}var rl=Object.getOwnPropertyDescriptor,il=(r,t,e,n)=>{for(var i=n>1?void 0:n?rl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let rr=class extends gt{static from(r){const t=r.reduce((n,i)=>n+i.byteLength,0),e=new rr(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeBytes(n)}),e}_glyphs;get glyphs(){return this._glyphs??=new nl(this._sfnt)}};rr=il([dt("glyf")],rr);var sl=Object.getOwnPropertyDescriptor,ol=(r,t,e,n)=>{for(var i=n>1?void 0:n?sl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Fi=class extends gt{};Fi=ol([dt("GPOS","gpos")],Fi);var al=Object.defineProperty,ll=Object.getOwnPropertyDescriptor,fe=(r,t,e,n)=>{for(var i=n>1?void 0:n?ll(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&al(t,e,i),i};let se=class extends gt{};fe([m("uint16")],se.prototype,"majorVersion",2),fe([m("uint16")],se.prototype,"minorVersion",2),fe([m("uint16")],se.prototype,"scriptListOffset",2),fe([m("uint16")],se.prototype,"featureListOffset",2),fe([m("uint16")],se.prototype,"lookupListOffset",2),fe([m("uint16")],se.prototype,"featureVariationsOffset",2),se=fe([dt("GSUB","gsub")],se);var cl=Object.defineProperty,hl=Object.getOwnPropertyDescriptor,at=(r,t,e,n)=>{for(var i=n>1?void 0:n?hl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&cl(t,e,i),i};let st=class extends gt{constructor(r=new ArrayBuffer(54),t){super(r,t,Math.min(54,r.byteLength-(t??0)))}};at([m("fixed")],st.prototype,"version",2),at([m("fixed")],st.prototype,"fontRevision",2),at([m("uint32")],st.prototype,"checkSumAdjustment",2),at([m("uint32")],st.prototype,"magickNumber",2),at([m("uint16")],st.prototype,"flags",2),at([m("uint16")],st.prototype,"unitsPerEm",2),at([m({type:"longDateTime"})],st.prototype,"created",2),at([m({type:"longDateTime"})],st.prototype,"modified",2),at([m("int16")],st.prototype,"xMin",2),at([m("int16")],st.prototype,"yMin",2),at([m("int16")],st.prototype,"xMax",2),at([m("int16")],st.prototype,"yMax",2),at([m("uint16")],st.prototype,"macStyle",2),at([m("uint16")],st.prototype,"lowestRecPPEM",2),at([m("int16")],st.prototype,"fontDirectionHint",2),at([m("int16")],st.prototype,"indexToLocFormat",2),at([m("int16")],st.prototype,"glyphDataFormat",2),st=at([dt("head")],st);var ul=Object.defineProperty,fl=Object.getOwnPropertyDescriptor,St=(r,t,e,n)=>{for(var i=n>1?void 0:n?fl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&ul(t,e,i),i};let yt=class extends gt{constructor(r=new ArrayBuffer(36),t){super(r,t,Math.min(36,r.byteLength-(t??0)))}};St([m("fixed")],yt.prototype,"version",2),St([m("int16")],yt.prototype,"ascent",2),St([m("int16")],yt.prototype,"descent",2),St([m("int16")],yt.prototype,"lineGap",2),St([m("uint16")],yt.prototype,"advanceWidthMax",2),St([m("int16")],yt.prototype,"minLeftSideBearing",2),St([m("int16")],yt.prototype,"minRightSideBearing",2),St([m("int16")],yt.prototype,"xMaxExtent",2),St([m("int16")],yt.prototype,"caretSlopeRise",2),St([m("int16")],yt.prototype,"caretSlopeRun",2),St([m("int16")],yt.prototype,"caretOffset",2),St([m({type:"int16",size:4})],yt.prototype,"reserved",2),St([m("int16")],yt.prototype,"metricDataFormat",2),St([m("uint16")],yt.prototype,"numOfLongHorMetrics",2),yt=St([dt("hhea")],yt);var pl=Object.getOwnPropertyDescriptor,dl=(r,t,e,n)=>{for(var i=n>1?void 0:n?pl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let ir=class extends gt{static from(r){const t=r.length*4,e=new ir(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeUint16(n.advanceWidth),e.view.writeUint16(n.leftSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const n=this.view;return n.seek(0),Array.from({length:r}).map((i,o)=>(o<t&&(e=n.readUint16()),{advanceWidth:e,leftSideBearing:n.readUint16()}))}};ir=dl([dt("hmtx")],ir);var gl=Object.getOwnPropertyDescriptor,yl=(r,t,e,n)=>{for(var i=n>1?void 0:n?gl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Ui=class extends gt{};Ui=yl([dt("kern","kern")],Ui);var ml=Object.getOwnPropertyDescriptor,xl=(r,t,e,n)=>{for(var i=n>1?void 0:n?ml(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let sr=class extends gt{static from(r,t=1){const e=r.length*(t?4:2),n=new sr(new ArrayBuffer(e));return r.forEach(i=>{t?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:r}).map(()=>t?e.readUint32():e.readUint16()*2)}};sr=xl([dt("loca")],sr);var vl=Object.defineProperty,wl=Object.getOwnPropertyDescriptor,mt=(r,t,e,n)=>{for(var i=n>1?void 0:n?wl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&vl(t,e,i),i};let ct=class extends gt{constructor(r=new ArrayBuffer(32),t){super(r,t,Math.min(32,r.byteLength-(t??0)))}};mt([m("fixed")],ct.prototype,"version",2),mt([m("uint16")],ct.prototype,"numGlyphs",2),mt([m("uint16")],ct.prototype,"maxPoints",2),mt([m("uint16")],ct.prototype,"maxContours",2),mt([m("uint16")],ct.prototype,"maxComponentPoints",2),mt([m("uint16")],ct.prototype,"maxComponentContours",2),mt([m("uint16")],ct.prototype,"maxZones",2),mt([m("uint16")],ct.prototype,"maxTwilightPoints",2),mt([m("uint16")],ct.prototype,"maxStorage",2),mt([m("uint16")],ct.prototype,"maxFunctionDefs",2),mt([m("uint16")],ct.prototype,"maxInstructionDefs",2),mt([m("uint16")],ct.prototype,"maxStackElements",2),mt([m("uint16")],ct.prototype,"maxSizeOfInstructions",2),mt([m("uint16")],ct.prototype,"maxComponentElements",2),mt([m("uint16")],ct.prototype,"maxComponentDepth",2),ct=mt([dt("maxp")],ct);var bl=Object.defineProperty,Sl=Object.getOwnPropertyDescriptor,vn=(r,t,e,n)=>{for(var i=n>1?void 0:n?Sl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&bl(t,e,i),i};const Li={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},or={Macintosh:1,Microsoft:3},Cl={Default:0},$i={UCS2:1};let je=class extends gt{_names;get names(){return this._names??=this.readNames()}readNames(){const r=this.count;this.view.seek(6);const t=[];for(let a=0;a<r;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const e=this.stringOffset;for(let a=0;a<r;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let n=or.Macintosh,i=Cl.Default,o=0;t.some(a=>a.platform===or.Microsoft&&a.encoding===$i.UCS2&&a.language===1033)&&(n=or.Microsoft,i=$i.UCS2,o=1033);const s={};for(let a=0;a<r;++a){const l=t[a];l.platform===n&&l.encoding===i&&l.language===o&&Li[l.nameId]&&(s[Li[l.nameId]]=o===0?Oa(l.name):Ia(l.name))}return s}};vn([m("uint16")],je.prototype,"format",2),vn([m("uint16")],je.prototype,"count",2),vn([m("uint16")],je.prototype,"stringOffset",2),je=vn([dt("name")],je);var Pl=Object.defineProperty,Ml=Object.getOwnPropertyDescriptor,G=(r,t,e,n)=>{for(var i=n>1?void 0:n?Ml(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Pl(t,e,i),i};let j=class extends gt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};G([m("uint16")],j.prototype,"version",2),G([m("int16")],j.prototype,"xAvgCharWidth",2),G([m("uint16")],j.prototype,"usWeightClass",2),G([m("uint16")],j.prototype,"usWidthClass",2),G([m("uint16")],j.prototype,"fsType",2),G([m("uint16")],j.prototype,"ySubscriptXSize",2),G([m("uint16")],j.prototype,"ySubscriptYSize",2),G([m("uint16")],j.prototype,"ySubscriptXOffset",2),G([m("uint16")],j.prototype,"ySubscriptYOffset",2),G([m("uint16")],j.prototype,"ySuperscriptXSize",2),G([m("uint16")],j.prototype,"ySuperscriptYSize",2),G([m("uint16")],j.prototype,"ySuperscriptXOffset",2),G([m("uint16")],j.prototype,"ySuperscriptYOffset",2),G([m("uint16")],j.prototype,"yStrikeoutSize",2),G([m("uint16")],j.prototype,"yStrikeoutPosition",2),G([m("uint16")],j.prototype,"sFamilyClass",2),G([m({type:"uint8"})],j.prototype,"bFamilyType",2),G([m({type:"uint8"})],j.prototype,"bSerifStyle",2),G([m({type:"uint8"})],j.prototype,"bWeight",2),G([m({type:"uint8"})],j.prototype,"bProportion",2),G([m({type:"uint8"})],j.prototype,"bContrast",2),G([m({type:"uint8"})],j.prototype,"bStrokeVariation",2),G([m({type:"uint8"})],j.prototype,"bArmStyle",2),G([m({type:"uint8"})],j.prototype,"bLetterform",2),G([m({type:"uint8"})],j.prototype,"bMidline",2),G([m({type:"uint8"})],j.prototype,"bXHeight",2),G([m({type:"uint8",size:16})],j.prototype,"ulUnicodeRange",2),G([m({type:"char",size:4})],j.prototype,"achVendID",2),G([m("uint16")],j.prototype,"fsSelection",2),G([m("uint16")],j.prototype,"usFirstCharIndex",2),G([m("uint16")],j.prototype,"usLastCharIndex",2),G([m("int16")],j.prototype,"sTypoAscender",2),G([m("int16")],j.prototype,"sTypoDescender",2),G([m("int16")],j.prototype,"sTypoLineGap",2),G([m("uint16")],j.prototype,"usWinAscent",2),G([m("uint16")],j.prototype,"usWinDescent",2),G([m({offset:72,type:"uint8",size:8})],j.prototype,"ulCodePageRange",2),G([m({offset:72,type:"int16"})],j.prototype,"sxHeight",2),G([m("int16")],j.prototype,"sCapHeight",2),G([m("uint16")],j.prototype,"usDefaultChar",2),G([m("uint16")],j.prototype,"usBreakChar",2),G([m("uint16")],j.prototype,"usMaxContext",2),j=G([dt("OS/2","os2")],j);var _l=Object.defineProperty,Tl=Object.getOwnPropertyDescriptor,Ht=(r,t,e,n)=>{for(var i=n>1?void 0:n?Tl(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&_l(t,e,i),i};let Nt=class extends gt{constructor(r=new ArrayBuffer(32),t,e){super(r,t,e)}};Ht([m("fixed")],Nt.prototype,"format",2),Ht([m("fixed")],Nt.prototype,"italicAngle",2),Ht([m("int16")],Nt.prototype,"underlinePosition",2),Ht([m("int16")],Nt.prototype,"underlineThickness",2),Ht([m("uint32")],Nt.prototype,"isFixedPitch",2),Ht([m("uint32")],Nt.prototype,"minMemType42",2),Ht([m("uint32")],Nt.prototype,"maxMemType42",2),Ht([m("uint32")],Nt.prototype,"minMemType1",2),Ht([m("uint32")],Nt.prototype,"maxMemType1",2),Nt=Ht([dt("post")],Nt);var kl=Object.defineProperty,Al=Object.getOwnPropertyDescriptor,Ct=(r,t,e,n)=>{for(var i=n>1?void 0:n?Al(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&kl(t,e,i),i};let xt=class extends gt{constructor(r=new ArrayBuffer(36),t){super(r,t,Math.min(36,r.byteLength-(t??0)))}};Ct([m("fixed")],xt.prototype,"version",2),Ct([m("int16")],xt.prototype,"vertTypoAscender",2),Ct([m("int16")],xt.prototype,"vertTypoDescender",2),Ct([m("int16")],xt.prototype,"vertTypoLineGap",2),Ct([m("int16")],xt.prototype,"advanceHeightMax",2),Ct([m("int16")],xt.prototype,"minTopSideBearing",2),Ct([m("int16")],xt.prototype,"minBottomSideBearing",2),Ct([m("int16")],xt.prototype,"yMaxExtent",2),Ct([m("int16")],xt.prototype,"caretSlopeRise",2),Ct([m("int16")],xt.prototype,"caretSlopeRun",2),Ct([m("int16")],xt.prototype,"caretOffset",2),Ct([m({type:"int16",size:4})],xt.prototype,"reserved",2),Ct([m("int16")],xt.prototype,"metricDataFormat",2),Ct([m("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=Ct([dt("vhea")],xt);var Ol=Object.getOwnPropertyDescriptor,Il=(r,t,e,n)=>{for(var i=n>1?void 0:n?Ol(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let ar=class extends gt{static from(r){const t=r.length*4,e=new ar(new ArrayBuffer(t));return r.forEach(n=>{e.view.writeUint16(n.advanceHeight),e.view.writeInt16(n.topSideBearing)}),e}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const r=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,e=this.view;e.seek(0);let n=0;return Array.from({length:r}).map((i,o)=>(o<t&&(n=e.readUint16()),{advanceHeight:n,topSideBearing:e.readUint8()}))}};ar=Il([dt("vmtx")],ar);var El=Object.defineProperty,Ge=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&El(t,e,i),i};class Xt extends Kn{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(xe(t).getUint32(0))}static checksum(t){const e=xe(t);let n=e.byteLength;for(;n%4;)n++;let i=0;for(let o=0,s=n/4;o<s;o+=4)o*4<n-4&&(i+=e.getUint32(o*4,!1));return i&4294967295}static from(t){const e=h=>h+3&-4,n=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((h,p)=>h+e(p.byteLength),0),o=new this(new ArrayBuffer(12+n*16+i));o.scalerType=65536,o.numTables=n;const s=Math.log(2);o.searchRange=Math.floor(Math.log(n)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=n*16-o.searchRange;let a=12+n*16,l=0;const c=o.getDirectories();t.tableViews.forEach((h,p)=>{const g=c[l++];g.tag=p,g.checkSum=this.checksum(h),g.offset=a,g.length=h.byteLength,o.view.writeBytes(h,a),a+=e(g.length)});const u=o.createSFNT().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Le(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Jt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ge([m("uint32")],Xt.prototype,"scalerType"),Ge([m("uint16")],Xt.prototype,"numTables"),Ge([m("uint16")],Xt.prototype,"searchRange"),Ge([m("uint16")],Xt.prototype,"entrySelector"),Ge([m("uint16")],Xt.prototype,"rangeShift");class lr extends Xt{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(t){return super.from(t)}}var Bl=Object.defineProperty,qe=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Bl(t,e,i),i};class Se extends Bt{constructor(t,e){super(t,e,20)}}qe([m({type:"char",size:4})],Se.prototype,"tag"),qe([m("uint32")],Se.prototype,"offset"),qe([m("uint32")],Se.prototype,"compLength"),qe([m("uint32")],Se.prototype,"origLength"),qe([m("uint32")],Se.prototype,"origChecksum");var Dl=Object.defineProperty,Ot=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Dl(t,e,i),i};const _t=class dr extends Kn{format="WOFF";mimeType="font/woff";get subfontFormat(){return Xt.is(this.flavor)?"TrueType":lr.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(xe(t).getUint32(0))}static checkSum(t){const e=xe(t),n=e.byteLength,i=Math.floor(n/4);let o=0,s=0;for(;s<i;)o+=e.getUint32(4*s++,!1);let a=n-i*4;if(a){let l=i*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const n=h=>h+3&-4,i=[];t.tableViews.forEach((h,p)=>{const g=xe(Ca(new Uint8Array(h.buffer,h.byteOffset,h.byteLength)));i.push({tag:p,view:g.byteLength<h.byteLength?g:h,rawView:h})});const o=i.length,s=i.reduce((h,p)=>h+n(p.view.byteLength),0),a=new dr(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSFNTSize=12+16*o+i.reduce((h,p)=>h+n(p.rawView.byteLength),0);let l=44+o*20,c=0;const u=a.getDirectories();return i.forEach(h=>{const p=u[c++];p.tag=h.tag,p.offset=l,p.compLength=h.view.byteLength,p.origChecksum=dr.checkSum(h.rawView),p.origLength=h.rawView.byteLength,a.view.writeBytes(h.view,l),l+=n(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Se(this.view.buffer,t);return t+=e.view.byteLength,e})}createSFNT(){return new Jt(this.getDirectories().reduce((t,e)=>{const n=e.tag,i=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=i+o;return t[n]=o>=s?new DataView(this.view.buffer,i,o):new DataView(Pa(new Uint8Array(this.view.buffer.slice(i,a))).buffer),t},{}))}};Ot([m("uint32")],_t.prototype,"signature"),Ot([m("uint32")],_t.prototype,"flavor"),Ot([m("uint32")],_t.prototype,"length"),Ot([m("uint16")],_t.prototype,"numTables"),Ot([m("uint16")],_t.prototype,"reserved"),Ot([m("uint32")],_t.prototype,"totalSFNTSize"),Ot([m("uint16")],_t.prototype,"majorVersion"),Ot([m("uint16")],_t.prototype,"minorVersion"),Ot([m("uint32")],_t.prototype,"metaOffset"),Ot([m("uint32")],_t.prototype,"metaLength"),Ot([m("uint32")],_t.prototype,"metaOrigLength"),Ot([m("uint32")],_t.prototype,"privOffset"),Ot([m("uint32")],_t.prototype,"privLength");let cr=_t;function Fl(r,t=!0){if(Xt.is(r))return new Xt(r);if(lr.is(r))return new lr(r);if(cr.is(r))return new cr(r);if(t)throw new Error("Failed to parseFont")}function Ul(r,t=!0){const e=Fl(r,!1);if(e)return e;if(t)throw new Error("Failed to parseFont")}class hr{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(t){this.fallbackFont=t}async loadFallbackFont(t,e={}){this.fallbackFont=await this.load(t,e)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...hr.defaultRequestInit,...e,signal:n.signal}).then(i=>i.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.check(`14px ${t}`)||document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=CSS.escape(t);if(!document.querySelector(`style[data-family="${n}"]`)){const i=document.createElement("style");i.type="text/css",i.dataset.family=t,i.appendChild(document.createTextNode(`@font-face {
31
+ font-family: "${t}";
32
+ src: url(${e});
33
+ }`)),document.head.appendChild(i)}return this}_parseUrls(t){const e=Array.from(new Set([...t.split(","),t]));return Array.from(new Set(e.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(t){let e;return t&&(e=this._parseUrls(t).reduce((i,o)=>i||this.loaded.get(o),void 0)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){return this._parseUrls(t).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(t){return t?(Array.isArray(t)?t:[t]).flatMap(e=>e.split(",").map(n=>n.trim())):[]}async load(t,e={}){const{cancelOther:n,injectFontFace:i=!0,injectStyleTag:o=!0,...s}=e;let a,l;typeof t=="string"?a=t:{src:a,family:l}=t;const c=this._parseFamilies(l);if(this.loaded.has(a))return n&&(this.loading.forEach(g=>g.cancel()),this.loading.clear()),h(this.loaded.get(a));let u=this.loading.get(a);return u||(u=this._createRequest(a,s),this.loading.set(a,u)),n&&this.loading.forEach((g,f)=>{g!==u&&(g.cancel(),this.loading.delete(f))}),u.when.then(g=>{let f;return this.loaded.has(a)?f=h(this.loaded.get(a)):(f=p(g),e.noAdd||this.loaded.set(a,f)),Promise.all(Array.from(f.familySet).map(y=>(this.familyToUrl.set(y,a),typeof document<"u"&&(i&&this.injectFontFace(y,g),o&&this.injectStyleTag(y,a),i||o)?document.fonts.load(`14px ${y}`):Promise.resolve()))).then(()=>f)}).catch(g=>{if(g instanceof DOMException&&g.message==="The user aborted a request.")return p();throw g}).finally(()=>{this.loading.delete(a)});function h(g){return c.forEach(f=>{g.familySet.add(f)}),g}function p(g=new ArrayBuffer(0)){let f;function y(){return f||(f=g.byteLength?Ul(g,!1):void 0),f}function d(){const P=y();if(P instanceof Xt||P instanceof cr)return P.sfnt}return{src:a,family:l,buffer:g,familySet:new Set(c),getFont:y,getSFNT:d}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}}const Ll=new hr,$l=new Set(["©","®","÷"]),Nl=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),zl={1:"italic",32:"bold"},Rl={1:"italic",2:"bold"},Ni={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class zi{constructor(t,e,n){this.content=t,this.index=e,this.parent=n}path=new Mt().setMeta(this);lineBox=new H;inlineBox=new H;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){const t=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new H(this.lineBox.left+this.lineBox.width/2-t/2,this.lineBox.top,t,this.lineBox.height):new H(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-t/2,this.lineBox.width,t))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(t){const e=this.computedStyle.fontFamily,n=t??Ll;let o=(e?n.get(e):n.fallbackFont)?.getSFNT();return o?.textToGlyphIndexes(this.content).includes(0)&&(o=n.fallbackFont?.getSFNT()),o}updateGlyph(t=this._getFontSFNT()){if(!t)return this;const{hhea:e,os2:n,post:i,head:o}=t,s=o.unitsPerEm,a=e.ascent,l=e.descent,{content:c,computedStyle:u,isVertical:h}=this,{fontSize:p}=u,g=s/p,f=t.getAdvanceWidth(c,p),y=(a+Math.abs(l))/g,d=a/g;return this.advanceWidth=f,this.advanceHeight=y,this.inlineBox.width=h?y:f,this.inlineBox.height=h?f:y,this.underlinePosition=(a-i.underlinePosition)/g,this.underlineThickness=i.underlineThickness/g,this.strikeoutPosition=(a-n.yStrikeoutPosition)/g,this.strikeoutSize=n.yStrikeoutSize/g,this.ascender=a/g,this.descender=l/g,this.typoAscender=n.sTypoAscender/g,this.typoDescender=n.sTypoDescender/g,this.typoLineGap=n.sTypoLineGap/g,this.winAscent=n.usWinAscent/g,this.winDescent=n.usWinDescent/g,this.xHeight=n.sxHeight/g,this.capHeight=n.sCapHeight/g,this.baseline=d,this.centerDiviation=y/2-d,this.fontStyle=zl[n.fsSelection]??Rl[o.macStyle],this}update(t){const e=this._getFontSFNT(t);if(!e)return this;this.updateGlyph(e);const{isVertical:n,content:i,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:c,typoAscender:u,fontStyle:h,advanceWidth:p,advanceHeight:g}=this,{left:f,top:y}=a,d=o.fontStyle==="italic"&&h!=="italic";let P=f,M=y+s,w;const C=new Mt().setMeta(this);if(n&&(P+=(g-p)/2,Math.abs(p-g)>.1&&(M-=(l-u)/(l+Math.abs(c))*g),w=void 0),n&&!$l.has(i)&&(i.codePointAt(0)<=256||Nl.has(i))){C.addCommands(e.getPathCommands(i,P,y+s-(g-p)/2,o.fontSize));const x={y:y-(g-p)/2+g/2,x:P+p/2};d&&this._italic(C,n?{x:x.x,y:y-(g-p)/2+s}:void 0),C.rotate(90,x)}else w!==void 0?(C.addCommands(e.glyphs.get(w).getPathCommands(P,M,o.fontSize)),d&&this._italic(C,n?{x:P+p/2,y:y+u/(l+Math.abs(c))*g}:void 0)):(C.addCommands(e.getPathCommands(i,P,M,o.fontSize)),d&&this._italic(C,n?{x:P+g/2,y:M}:void 0));const v=o.fontWeight??400;return v in Ni&&(v===700||v==="bold")&&h!=="bold"&&C.bold(Ni[v]*o.fontSize*.05),C.style={fill:this.computedFill??o.color,fillRule:"nonzero",stroke:this.computedOutline??(o.textStrokeWidth?o.textStrokeColor:"none"),strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,n){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(t,e,n)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:n,max:i}=e;return new H(n.x,n.y,i.x-n.x,i.y-n.y)}}function ur(){const r=new Map;async function t(n){if(!r.has(n)){r.set(n,n);try{r.set(n,await fetch(n).then(i=>i.text()))}catch(i){console.warn(i),r.delete(n)}}}function e(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:r,needsLoad:e,load:t}}function fr(r){const t=new Map;function e(n){let i=t.get(n);if(!i){const o=Hr(r.needsLoad(n)?r.loaded.get(n)??n:n),s=Qr(o);i={dom:o,pathSet:s},t.set(n,i)}return i}return{parsed:t,parse:e}}function wn(r,t){return typeof r=="number"?r:r.endsWith("%")?(r=r.substring(0,r.length-1),Math.ceil(Number(r)/100*t.total)):r.endsWith("rem")?(r=r.substring(0,r.length-3),Number(r)*t.fontSize):r.endsWith("em")?(r=r.substring(0,r.length-2),Number(r)*t.fontSize):Number(r)}function bn(r){return J(r)?{}:r}function Ri(r,t){const e=Object.keys(r),n=Object.keys(t);return Array.from(new Set([...e,...n])).every(o=>pe(r[o],t[o]))}function pe(r,t){const e=typeof r;return e===typeof t?e==="object"?Ri(r,t):r===t:!1}function Vl(r){const t=r.startsWith("#")?r.slice(1):r;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const n=t.length===3?t.split("").map(a=>a+a).join(""):t,i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i}, ${o}, ${s})`}function Sn(r){if(!r)return r;const t={};for(const e in r)r[e]!==""&&r[e]!==void 0&&(t[e]=r[e]);return t}class Vi{constructor(t,e={},n,i){this.content=t,this.style=e,this.index=n,this.parent=i,this.updateComputedStyle().initCharacters()}inlineBox=new H;fill;outline;get computedFill(){return this.fill??this.parent.computedFill}get computedOutline(){return this.outline??this.parent.computedOutline}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Sn(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new zi(n,e++,this));return this.characters=t,this}}class ji{constructor(t,e,n){this.style=t,this.index=e,this.parent=n,this.updateComputedStyle()}lineBox=new H;fragments=[];fill;outline;get computedFill(){return this.fill??this.parent.fill}get computedOutline(){return this.outline??this.parent.outline}updateComputedStyle(){return this.computedStyle={...Sn(this.parent.computedStyle),...Sn(this.style)},this}}function jl(r){return r}class We{static notZeroStyles=new Set(["width","height"]);static pxStyles=new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]);_toDomStyle(t){const e={};for(const n in t){const i=t[n];We.notZeroStyles.has(n)&&i===0||(typeof i=="number"&&We.pxStyles.has(n)?e[n]=`${i}px`:e[n]=i)}return e}createDom(t,e){const n=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="flex-start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="flex-end";break}switch(e.verticalAlign){case"top":i.alignItems="flex-start";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="flex-end";break}const s=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{...this._toDomStyle({...i,boxSizing:i.boxSizing??"border-box",display:i.display??(s?"inline-flex":void 0),width:i.width??"max-content",height:i.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all"});const a=document.createElement("ul");return Object.assign(a.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:s&&o?"100%":void 0,height:s&&!o?"100%":void 0}),t.forEach(l=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._toDomStyle(l.style)}),l.fragments.forEach(u=>{const h=document.createElement("span");Object.assign(h.style,{verticalAlign:"inherit",...this._toDomStyle(u.style)}),h.appendChild(document.createTextNode(u.content)),c.appendChild(h)}),a.appendChild(c)}),n.appendChild(a),n}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const n=t.data??"";let i=0;return Array.from(n).map(o=>{const s=i+=n.substring(i).indexOf(o),a=s+o.length;i+=o.length,e.setStart(t,Math.max(s,0)),e.setEnd(t,a);const l=e.getClientRects?.()??[e.getBoundingClientRect()];let c=l[l.length-1];l.length>1&&c.width<2&&(c=l[l.length-2]);const u=e.toString();if(u!==""&&c&&c.width+c.height!==0)return{content:u,top:c.top,left:c.left,height:c.height,width:c.width}}).filter(Boolean)}measureDom(t){const e=[],n=[],i=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,c)=>{const u=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:c,left:u.left,top:u.top,width:u.width,height:u.height});let h=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(p=>{i.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(p=>{p.firstChild instanceof window.Text&&this.measureDomText(p.firstChild).forEach(g=>{i.push({...g,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:c,characterIndex:h++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:n,characters:i}}measureParagraphDom(t,e){const n=e.getBoundingClientRect(),i=this.measureDom(e);i.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),i.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return i.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:c,characterIndex:u}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const h=t[l].fragments[c].characters[u],{fontHeight:p,isVertical:g}=h,f=o[s];h.inlineBox.left=f.left,h.inlineBox.top=f.top,h.inlineBox.width=f.width,h.inlineBox.height=f.height,g?(h.lineBox.left=f.left+(f.width-p)/2,h.lineBox.top=f.top,h.lineBox.width=p,h.lineBox.height=f.height):(h.lineBox.left=f.left,h.lineBox.top=f.top+(f.height-p)/2,h.lineBox.width=f.width,h.lineBox.height=p),s++}),{paragraphs:t,boundingBox:new H(0,0,n.width,n.height)}}measure(t,e,n){let i;n||(n=this.createDom(t,e),Object.assign(n.style,{position:"fixed",visibility:"hidden"}),document.body.appendChild(n),i=()=>n?.parentNode?.removeChild(n));const o=this.measureParagraphDom(t,n);return i?.(),o}}function Gi(){const r=new ee,t=ur(),e=fr(t);return{name:"background",pathSet:r,load:async n=>{const{backgroundImage:i}=n.computedStyle;i&&t.needsLoad(i)&&await t.load(i)},update:n=>{r.paths.length=0;const{computedStyle:i,lineBox:o,isVertical:s}=n,{backgroundImage:a,backgroundSize:l,backgroundColormap:c}=i;if(J(a))return;const{pathSet:u}=e.parse(a),h=u.getBoundingBox(!0);let p,g,f,y;s?{x:g,y:p,width:y,height:f}=o:{x:p,y:g,width:f,height:y}=o;const d=bn(c??"none"),P=u.paths.map(v=>{const x=v.clone();return x.style.fill&&x.style.fill in d&&(x.style.fill=d[x.style.fill]),x.style.stroke&&x.style.stroke in d&&(x.style.stroke=d[x.style.stroke]),x});let M,w;if(l==="rigid"){M=Math.max(n.fontSize*5/h.width),w=M;const v=new k;v.x=h.width-f/M,v.y=h.height-y/w,P.forEach(x=>{x.applyTransform(S=>{const b=S.x>h.left+h.width/2,D=S.y>h.top+h.height/2;b&&(S.x-=v.x),D&&(S.y-=v.y)})})}else M=f/h.width,w=y/h.height;const C=new vt;C.translate(-h.x,-h.y),C.scale(M,w),s&&(C.translate(-f/2,-y/2),C.rotate(-Math.PI/2),C.translate(y/2,f/2)),C.translate(p,g),P.forEach(v=>{v.applyTransform(x=>{x.applyMatrix3(C)})}),r.paths.push(...P)},renderOrder:-2,render:n=>{const{text:i,context:o}=n,{boundingBox:s,computedStyle:a}=i;J(a.backgroundColor)||(o.fillStyle=a.backgroundColor,o.fillRect(...s.array)),r.paths.forEach(l=>{if(n.drawPath(l),i.debug){const c=new ee([l]).getBoundingBox();c&&o.strokeRect(c.x,c.y,c.width,c.height)}}),i.paragraphs.forEach(l=>{const{lineBox:c,style:u}=l;J(u.backgroundColor)||(o.fillStyle=u.backgroundColor,o.fillRect(...c.array)),l.fragments.forEach(h=>{const{inlineBox:p,style:g}=h;J(g.backgroundColor)||(o.fillStyle=g.backgroundColor,o.fillRect(...p.array))})})}}}function Cn(r){const{highlight:t,highlightImage:e,highlightReferImage:n,highlightColormap:i,highlightLine:o,highlightSize:s,highlightThickness:a}=r;return{image:t?.image??e??"none",referImage:t?.referImage??n??"none",colormap:t?.colormap??i??"none",line:t?.line??o??"none",size:t?.size??s??"cover",thickness:t?.thickness??a??"100%"}}function qi(){const r=new ee,t=[],e=ur(),n=fr(e);return{name:"highlight",pathSet:r,load:async i=>{const o=new Set;i.forEachCharacter(s=>{const{computedStyle:a}=s,{image:l,referImage:c}=Cn(a);l&&e.needsLoad(l)&&o.add(l),c&&e.needsLoad(c)&&o.add(c)}),await Promise.all(Array.from(o).map(s=>e.load(s)))},update:i=>{t.length=0,r.paths.length=0;let o=[],s,a;i.forEachCharacter(l=>{const{computedStyle:c}=l,u=Cn(c),{image:h,colormap:p,line:g,size:f,thickness:y}=u;if(J(h))s?.length&&(s=[],o.push(s));else{const{inlineBox:d,isVertical:P}=l,{fontSize:M}=c;(!a||pe(a.image,h)&&pe(a.colormap,p)&&pe(a.line,g)&&pe(a.size,f)&&pe(a.thickness,y))&&s?.length&&(P?s[0].inlineBox.left===d.left:s[0].inlineBox.top===d.top)&&s[0].fontSize===M?s.push(l):(s=[],s.push(l),o.push(s))}a=u}),o=o.filter(l=>l.length);for(let l=0;l<o.length;l++){const c=o[l],u=c[0],h=H.from(...c.map(I=>I.compatibleGlyphBox));if(!h.height||!h.width)continue;const{computedStyle:p,isVertical:g,inlineBox:f,compatibleGlyphBox:y,strikeoutPosition:d,underlinePosition:P}=u,{fontSize:M}=p,{image:w,referImage:C,colormap:v,line:x,size:S,thickness:b}=Cn(p),D=wn(b,{fontSize:M,total:h.width})/h.width,z=bn(v),{pathSet:E,dom:F}=n.parse(w),N=E.getBoundingBox(!0),B=M/N.width*2,A=new H().copy(h);g&&(A.width=h.height,A.height=h.width,A.left=h.left+h.width);const W=Math.floor(A.width);let O=W;S!=="cover"&&(O=wn(S,{fontSize:M,total:h.width})||W,A.width=O);const L=!J(C)&&J(x);if(L)N.copy(n.parse(C).pathSet.getBoundingBox(!0));else{let I;if(J(x))if(N.width/N.height>4){I="underline";const R=F.getAttribute("viewBox");if(R){const[T,_,U,$]=R.split(" ").map(X=>Number(X)),q=_+$/2;N.y<q&&N.y+N.height>q?I="line-through":N.y+N.height<q?I="overline":I="underline"}}else I="outline";else I=x;switch(I){case"outline":{const R=A.width*.2,T=A.height*.2;g?(A.x-=T/2,A.y-=R/2,A.x-=A.height):(A.x-=R/2,A.y-=T/2),A.width+=R,A.height+=T;break}case"overline":A.height=N.height*B,g?A.x=f.left+f.width:A.y=f.top;break;case"line-through":A.height=N.height*B,g?A.x=f.left+f.width-d+A.height/2:A.y=f.top+d-A.height/2;break;case"underline":A.height=N.height*B,g?A.x=y.left+y.width-P:A.y=f.top+P;break}}const V=new vt;if(V.translate(-N.x,-N.y),V.scale(A.width/N.width,A.height/N.height),g){const I=A.width/2,R=A.height/2;L||V.translate(-I,-R),V.rotate(-Math.PI/2),L||V.translate(R,I)}V.translate(A.x,A.y);for(let I=0;I<Math.ceil(W/O);I++){const R=V.clone();g?R.translate(0,I*A.width):R.translate(I*A.width,0),E.paths.forEach(T=>{const _=T.clone().applyTransform(R);_.style.strokeWidth&&(_.style.strokeWidth*=B*D),_.style.strokeMiterlimit&&(_.style.strokeMiterlimit*=B),_.style.strokeDashoffset&&(_.style.strokeDashoffset*=B),_.style.strokeDasharray&&(_.style.strokeDasharray=_.style.strokeDasharray.map(U=>U*B)),_.style.fill&&_.style.fill in z&&(_.style.fill=z[_.style.fill]),_.style.stroke&&_.style.stroke in z&&(_.style.stroke=z[_.style.stroke]),r.paths.push(_),W!==O&&(g?t[r.paths.length-1]=new H(h.left-h.width*2,h.top,h.width*4,h.height):t[r.paths.length-1]=new H(h.left,h.top-h.height*2,h.width,h.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const i=[];return r.paths.forEach((o,s)=>{const a=t[s];let l=o.getBoundingBox();if(a){const c=Math.max(l.x,a.x),u=Math.max(l.y,a.y),h=Math.min(l.right,a.right),p=Math.min(l.bottom,a.bottom);l=new H(c,u,h-c,p-u)}i.push(l)}),H.from(...i)},render:i=>{const{text:o,context:s}=i;r.paths.forEach((a,l)=>{if(i.drawPath(a,{clipRect:t[l]}),o.debug){const c=new ee([a]).getBoundingBox();c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function Gl(r,t){return`<svg width="${r*2}" height="${r*2}" xmlns="http://www.w3.org/2000/svg">
34
34
  <circle cx="${r}" cy="${r}" r="${r}" fill="${t}" />
35
- </svg>`}function Xi(){const r=new se;return{name:"listStyle",pathSet:r,update:t=>{r.paths.length=0;const{paragraphs:e,isVertical:n,fontSize:i}=t,o=i*.45;e.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:c,listStyleColormap:h,listStyleSize:u,listStyleType:p}=a,g=Sr(h);let f=u,y;if(!tt(c))y=c;else if(!tt(p)){const x=i*.38/2;switch(f=f==="cover"?x*2:f,p){case"disc":y=Zl(x,String(l));break}}if(!y)return;const d=li(y),P=d.getBoundingBox(),M=s.fragments[0]?.characters[0];if(!M)return;const{inlineBox:w}=M,C=f==="cover"?1:br(f,{total:i,fontSize:i})/i,v=new Ct;if(n){const x=i/P.height*C;v.translate(-P.left,-P.top).rotate(Math.PI/2).scale(x,x).translate(w.left+(w.width-P.height*x)/2,w.top-o)}else{const x=i/P.height*C;v.translate(-P.left,-P.top).scale(x,x).translate(w.left-P.width*x-o,w.top+(w.height-P.height*x)/2)}r.paths.push(...d.paths.map(x=>{const S=x.clone();return S.applyTransform(v),S.style.fill&&S.style.fill in g&&(S.style.fill=g[S.style.fill]),S.style.stroke&&S.style.stroke in g&&(S.style.stroke=g[S.style.stroke]),S}))})}}}function Zi(){return{name:"outline"}}const ae=new k,Me=new Ct,le=new Ct;function Yi(){const r=new se;return{name:"render",pathSet:r,update:t=>{r.paths.length=0;const{paragraphs:e}=t;e.forEach(n=>{n.fragments.forEach(i=>{i.characters.forEach(o=>{r.paths.push(o.path)})})})},getBoundingBox:t=>{const{characters:e,fontSize:n,effects:i}=t,o=[];return e.forEach(s=>{i?.forEach(a=>{if(!s.glyphBox)return;const l=s.glyphBox.clone(),c=Mr(t,a);ae.set(l.left,l.top),ae.applyMatrix3(c),l.left=ae.x,l.top=ae.y,ae.set(l.right,l.bottom),ae.applyMatrix3(c),l.width=ae.x-l.left,l.height=ae.y-l.top;const h=(a.shadowOffsetX??0)*n,u=(a.shadowOffsetY??0)*n,p=Math.max(.1,a.textStrokeWidth??0)*n;l.left+=h-p,l.top+=u-p,l.width+=p*2,l.height+=p*2,o.push(l)})}),o.length?X.from(...o):void 0},render:(t,e)=>{const{paragraphs:n,glyphBox:i,effects:o}=e;o?o.forEach(s=>{_e(s,i,t),t.save();const[a,l,c,h,u,p]=Mr(e,s).transpose().elements;t.transform(a,h,l,u,c,p),e.forEachCharacter(g=>{g.drawTo(t,s)}),t.restore()}):n.forEach(s=>{s.fragments.forEach(a=>{a.characters.forEach(l=>{l.drawTo(t)})})}),e.debug&&n.forEach(s=>{t.strokeRect(s.lineBox.x,s.lineBox.y,s.lineBox.width,s.lineBox.height)})}}}function Mr(r,t){const{fontSize:e,glyphBox:n}=r,i=(t.translateX??0)*e,o=(t.translateY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,l=(t.skewY??0)/360*s,{left:c,top:h,width:u,height:p}=n,g=c+u/2,f=h+p/2;return Me.identity(),le.makeTranslation(i,o),Me.multiply(le),le.makeTranslation(g,f),Me.multiply(le),le.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),Me.multiply(le),le.makeTranslation(-g,-f),Me.multiply(le),Me.clone()}function Ki(){const r=new se;return{name:"textDecoration",pathSet:r,update:t=>{r.paths.length=0;const e=[];let n,i;t.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:c,underlineThickness:h,strikeoutPosition:u,strikeoutSize:p}=o,{color:g,textDecoration:f,writingMode:y}=s;if(tt(f))i=void 0;else{let d=!1;if(i?.textDecoration===f&&i?.writingMode===y&&i?.color===g&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(f){case"underline":n[0].underlinePosition===c&&n[0].underlineThickness===h&&(d=!0);break;case"line-through":n[0].strikeoutPosition===u&&n[0].strikeoutSize===p&&(d=!0);break}d?n.push(o):(n=[],n.push(o),e.push(n)),i=s}}),e.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:c,strikeoutPosition:h,strikeoutSize:u}=o[0],{color:p,textDecoration:g}=s,f=X.from(...o.map(S=>S.inlineBox)),{left:y,top:d,width:P,height:M}=f;let w=a?y+P:d;const C=a?-1:1;let v=0;switch(g){case"overline":v=c*2;break;case"underline":w+=C*l,v=c*2;break;case"line-through":w+=C*h,v=u*2;break}w-=v;let x;a?x=new _t([{type:"M",x:w,y:d},{type:"L",x:w,y:d+M},{type:"L",x:w+v,y:d+M},{type:"L",x:w+v,y:d},{type:"Z"}],{fill:p}):x=new _t([{type:"M",x:y,y:w},{type:"L",x:y+P,y:w},{type:"L",x:y+P,y:w+v},{type:"L",x:y,y:w+v},{type:"Z"}],{fill:p}),r.paths.push(x)})},render:(t,e)=>{const{effects:n,computedStyle:i}=e;n?n.forEach(o=>{t.save();const[s,a,l,c,h,u]=Mr(e,o).transpose().elements;t.transform(s,c,a,h,l,u),r.paths.forEach(p=>{he({ctx:t,path:p,fontSize:i.fontSize,...o})}),t.restore()}):r.paths.forEach(o=>{he({ctx:t,path:o,fontSize:i.fontSize})})}}}var Yl=Object.defineProperty,ce=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&Yl(t,e,i),i};const gn=Nl();class Nt extends pl{needsUpdate=!0;computedStyle={...gn};paragraphs=[];lineBox=new X;rawGlyphBox=new X;glyphBox=new X;pathBox=new X;boundingBox=new X;measurer=new He;plugins=new Map;pathSets=[];get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}constructor(t={}){super(),this.set(t)}set(t={}){const{content:e,effects:n,style:i,measureDom:o,fonts:s,fill:a,outline:l}=Wl(t);this.debug=t.debug??!1,this.content=e,this.effects=n,this.style=i,this.measureDom=o,this.fonts=s,this.fill=a,this.outline=l,this.use(Wi()).use(Zi()).use(Xi()).use(Ki()).use(Hi()).use(Yi()),(t.plugins??[]).forEach(c=>{this.use(c)}),this.updateParagraphs()}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,n)=>{e.fragments.forEach((i,o)=>{i.characters.forEach((s,a)=>{t(s,{paragraphIndex:n,fragmentIndex:o,characterIndex:a})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>t.load?.(this)))}updateParagraphs(){this.computedStyle={...gn,...this.style};const{content:t}=this,e=[];return t.forEach((n,i)=>{const{fragments:o,fill:s,outline:a,...l}=n,c=new qi(l,i,this);c.fill=s,c.outline=a,o.forEach((h,u)=>{const{content:p,fill:g,outline:f,...y}=h;if(p!==void 0){const d=new Gi(p,y,u,c);c.fragments.push(d),d.fill=g,d.outline=f}}),e.push(c)}),this.paragraphs=e,this}createDom(){return this.updateParagraphs(),this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const n=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,o)=>(i.updateOrder??0)-(o.updateOrder??0)).forEach(i=>{i.update?.(this)}),this.pathSets.length=0,Array.from(this.plugins.values()).sort((i,o)=>(i.renderOrder??0)-(o.renderOrder??0)).forEach(i=>{i.pathSet?.paths.length&&this.pathSets.push(i.pathSet)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in e)n[i]=this[i],this[i]=e[i];return this.emit("measure",{text:this,result:n}),n}getGlyphBox(){const t=k.MAX,e=k.MIN;return this.characters.forEach(n=>{if(!n.getGlyphMinMax(t,e)){const{inlineBox:i}=n,{left:o,top:s,width:a,height:l}=i,c=new k(o,s),h=new k(o+a,s+l);t.min(c,h),e.max(c,h)}}),new X(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){return this.pathBox=X.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox()).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=X.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(t=this.measureDom){this.needsUpdate=!1;const e=this.measure(t);for(const n in e)this[n]=e[n];return this.emit("update",{text:this}),this}render(t){const{view:e,pixelRatio:n=2}=t,i=e.getContext("2d");i&&(this.needsUpdate&&this.update(),mn(i,n,this.boundingBox),xn(i,this),Array.from(this.plugins.values()).sort((o,s)=>(o.renderOrder??0)-(s.renderOrder??0)).forEach(o=>{if(o.render)o.render?.(i,this);else if(o.pathSet){const s=this.computedStyle;o.pathSet.paths.forEach(a=>{he({ctx:i,path:a,fontSize:s.fontSize})})}}),this.emit("render",{text:this,view:e,pixelRatio:n}),t.onContext?.(i))}toString(){return this.content.flatMap(t=>t.fragments.map(e=>e.content)).join("")}}ce([oe({internal:!0})],Nt.prototype,"debug"),ce([oe()],Nt.prototype,"content"),ce([oe()],Nt.prototype,"style"),ce([oe()],Nt.prototype,"effects"),ce([oe()],Nt.prototype,"fill"),ce([oe()],Nt.prototype,"outline"),ce([oe({internal:!0})],Nt.prototype,"measureDom"),ce([oe({internal:!0})],Nt.prototype,"fonts");function Kl(r,t){const e=new Nt(r);return t?e.load().then(()=>e.measure()):e.measure()}function Ql(r,t){const e=new Nt(r);return t?e.load().then(()=>e.render(r)):e.render(r)}H.Character=Si,H.Fragment=Gi,H.Measurer=He,H.Paragraph=qi,H.Text=Nt,H.backgroundPlugin=Wi,H.createSVGLoader=on,H.createSVGParser=an,H.definePlugin=Xl,H.drawPath=he,H.filterEmpty=Cr,H.getHighlightStyle=Pr,H.getTransform2D=Mr,H.hexToRgb=Hl,H.highlightPlugin=Hi,H.isEqualObject=Ri,H.isEqualValue=ge,H.listStylePlugin=Xi,H.measureText=Kl,H.outlinePlugin=Zi,H.parseColor=te,H.parseColormap=Sr,H.parseValueNumber=br,H.renderPlugin=Yi,H.renderText=Ql,H.setupView=mn,H.textDecorationPlugin=Ki,H.textDefaultStyle=gn,H.uploadColor=_e,H.uploadColors=xn,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
35
+ </svg>`}function Wi(){const r=new ee;return{name:"listStyle",pathSet:r,update:t=>{r.paths.length=0;const{paragraphs:e,isVertical:n,fontSize:i}=t,o=i*.45;e.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:c,listStyleColormap:u,listStyleSize:h,listStyleType:p}=a,g=bn(u);let f=h,y;if(!J(c))y=c;else if(!J(p)){const x=i*.38/2;switch(f=f==="cover"?x*2:f,p){case"disc":y=Gl(x,String(l));break}}if(!y)return;const d=Qr(y),P=d.getBoundingBox(),M=s.fragments[0]?.characters[0];if(!M)return;const{inlineBox:w}=M,C=f==="cover"?1:wn(f,{total:i,fontSize:i})/i,v=new vt;if(n){const x=i/P.height*C;v.translate(-P.left,-P.top).rotate(Math.PI/2).scale(x,x).translate(w.left+(w.width-P.height*x)/2,w.top-o)}else{const x=i/P.height*C;v.translate(-P.left,-P.top).scale(x,x).translate(w.left-P.width*x-o,w.top+(w.height-P.height*x)/2)}r.paths.push(...d.paths.map(x=>{const S=x.clone();return S.applyTransform(v),S.style.fill&&S.style.fill in g&&(S.style.fill=g[S.style.fill]),S.style.stroke&&S.style.stroke in g&&(S.style.stroke=g[S.style.stroke]),S}))})}}}function Hi(){return{name:"outline"}}const oe=new k,Ce=new vt,ae=new vt;function Xi(){const r=new ee;return{name:"render",pathSet:r,update:t=>{r.paths.length=0;const{paragraphs:e}=t;e.forEach(n=>{n.fragments.forEach(i=>{i.characters.forEach(o=>{r.paths.push(o.path)})})})},getBoundingBox:t=>{const{characters:e,fontSize:n,computedEffects:i}=t,o=[];return e.forEach(s=>{i.forEach(a=>{if(!s.glyphBox)return;const l=s.glyphBox.clone(),c=Pn(t,a);oe.set(l.left,l.top),oe.applyMatrix3(c),l.left=oe.x,l.top=oe.y,oe.set(l.right,l.bottom),oe.applyMatrix3(c),l.width=oe.x-l.left,l.height=oe.y-l.top;const u=(a.shadowOffsetX??0)*n,h=(a.shadowOffsetY??0)*n,p=Math.max(.1,a.textStrokeWidth??0)*n;l.left+=u-p,l.top+=h-p,l.width+=p*2,l.height+=p*2,o.push(l)})}),o.length?H.from(...o):void 0},render:t=>{const{text:e,context:n}=t,{paragraphs:i,glyphBox:o,computedEffects:s}=e;s.length?s.forEach(a=>{t.uploadColor(a,o),n.save();const[l,c,u,h,p,g]=Pn(e,a).transpose().elements;n.transform(l,h,c,p,u,g),e.forEachCharacter(f=>{t.drawCharacter(f,a)}),n.restore()}):i.forEach(a=>{a.fragments.forEach(l=>{l.characters.forEach(c=>{t.drawCharacter(c)})})}),e.debug&&i.forEach(a=>{n.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function Pn(r,t){const{fontSize:e,glyphBox:n}=r,i=(t.translateX??0)*e,o=(t.translateY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,l=(t.skewY??0)/360*s,{left:c,top:u,width:h,height:p}=n,g=c+h/2,f=u+p/2;return Ce.identity(),ae.makeTranslation(i,o),Ce.multiply(ae),ae.makeTranslation(g,f),Ce.multiply(ae),ae.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),Ce.multiply(ae),ae.makeTranslation(-g,-f),Ce.multiply(ae),Ce.clone()}function Zi(){const r=new ee;return{name:"textDecoration",pathSet:r,update:t=>{r.paths.length=0;const e=[];let n,i;t.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:c,underlineThickness:u,strikeoutPosition:h,strikeoutSize:p}=o,{color:g,textDecoration:f,writingMode:y}=s;if(J(f))i=void 0;else{let d=!1;if(i?.textDecoration===f&&i?.writingMode===y&&i?.color===g&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(f){case"underline":n[0].underlinePosition===c&&n[0].underlineThickness===u&&(d=!0);break;case"line-through":n[0].strikeoutPosition===h&&n[0].strikeoutSize===p&&(d=!0);break}d?n.push(o):(n=[],n.push(o),e.push(n)),i=s}}),e.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:c,strikeoutPosition:u,strikeoutSize:h}=o[0],{color:p,textDecoration:g}=s,f=H.from(...o.map(S=>S.inlineBox)),{left:y,top:d,width:P,height:M}=f;let w=a?y+P:d;const C=a?-1:1;let v=0;switch(g){case"overline":v=c*2;break;case"underline":w+=C*l,v=c*2;break;case"line-through":w+=C*u,v=h*2;break}w-=v;let x;a?x=new Mt([{type:"M",x:w,y:d},{type:"L",x:w,y:d+M},{type:"L",x:w+v,y:d+M},{type:"L",x:w+v,y:d},{type:"Z"}],{fill:p}):x=new Mt([{type:"M",x:y,y:w},{type:"L",x:y+P,y:w},{type:"L",x:y+P,y:w+v},{type:"L",x:y,y:w+v},{type:"Z"}],{fill:p}),r.paths.push(x)})},render:t=>{const{text:e,context:n}=t,{computedEffects:i}=e;i.length?i.forEach(o=>{n.save();const[s,a,l,c,u,h]=Pn(e,o).transpose().elements;n.transform(s,c,a,u,l,h),r.paths.forEach(p=>{t.drawPath(p,o)}),n.restore()}):r.paths.forEach(o=>{t.drawPath(o)})}}}var ql=Object.defineProperty,le=(r,t,e,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(t,e,i)||i);return i&&ql(t,e,i),i};const pr=zs();class zt extends ds{needsUpdate=!0;computedStyle={...pr};computedEffects=[];paragraphs=[];lineBox=new H;rawGlyphBox=new H;glyphBox=new H;pathBox=new H;boundingBox=new H;measurer=new We;plugins=new Map;pathSets=[];get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}constructor(t={}){super(),this.set(t)}set(t={}){const{content:e,effects:n,style:i,measureDom:o,fonts:s,fill:a,outline:l}=Ws(t);this.debug=t.debug??!1,this.content=e,this.effects=n,this.style=i,this.measureDom=o,this.fonts=s,this.fill=a,this.outline=l,this.use(Gi()).use(Hi()).use(Wi()).use(Zi()).use(qi()).use(Xi()),(t.plugins??[]).forEach(c=>{this.use(c)}),this._update()}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((e,n)=>{e.fragments.forEach((i,o)=>{i.characters.forEach((s,a)=>{t(s,{paragraphIndex:n,fragmentIndex:o,characterIndex:a})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>t.load?.(this)))}_update(){this.computedStyle={...pr,...this.style},this.computedEffects=this.effects?.map(n=>({...n}))??[];const{content:t}=this,e=[];return t.forEach((n,i)=>{const{fragments:o,fill:s,outline:a,...l}=n,c=new ji(l,i,this);c.fill=s,c.outline=a,o.forEach((u,h)=>{const{content:p,fill:g,outline:f,...y}=u;if(p!==void 0){const d=new Vi(p,y,h,c);c.fragments.push(d),d.fill=g,d.outline=f}}),e.push(c)}),this.paragraphs=e,this}createDom(){return this._update(),this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(t=this.measureDom){const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();const n=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,o)=>(i.updateOrder??0)-(o.updateOrder??0)).forEach(i=>{i.update?.(this)}),this.pathSets.length=0,Array.from(this.plugins.values()).sort((i,o)=>(i.renderOrder??0)-(o.renderOrder??0)).forEach(i=>{i.pathSet?.paths.length&&this.pathSets.push(i.pathSet)}),this.glyphBox=this.getGlyphBox(),this._updatePathBox()._updateBoundingBox();for(const i in e)n[i]=this[i],this[i]=e[i];return this.emit("measure",{text:this,result:n}),n}getGlyphBox(){const t=k.MAX,e=k.MIN;return this.characters.forEach(n=>{if(!n.getGlyphMinMax(t,e)){const{inlineBox:i}=n,{left:o,top:s,width:a,height:l}=i,c=new k(o,s),u=new k(o+a,s+l);t.min(c,u),e.max(c,u)}}),new H(t.x,t.y,e.x-t.x,e.y-t.y)}_updatePathBox(){return this.pathBox=H.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox()).filter(Boolean)),this}_updateBoundingBox(){return this.boundingBox=H.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(t=this.measureDom){this.needsUpdate=!1;const e=this.measure(t);for(const n in e)this[n]=e[n];return this.emit("update",{text:this}),this}render(t){const{view:e,pixelRatio:n=2}=t,i=e.getContext("2d");if(!i)return;this.needsUpdate&&this.update();const o=new ui(this,i);o.pixelRatio=n,o.setup(),Array.from(this.plugins.values()).sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{s.render?s.render?.(o):s.pathSet&&s.pathSet.paths.forEach(a=>{o.drawPath(a)})}),this.emit("render",{text:this,view:e,pixelRatio:n}),t.onContext?.(i)}toString(){return this.content.flatMap(t=>t.fragments.map(e=>e.content)).join("")}}le([te({internal:!0})],zt.prototype,"debug"),le([te()],zt.prototype,"content"),le([te()],zt.prototype,"style"),le([te()],zt.prototype,"effects"),le([te()],zt.prototype,"fill"),le([te()],zt.prototype,"outline"),le([te({internal:!0})],zt.prototype,"measureDom"),le([te({internal:!0})],zt.prototype,"fonts");function Wl(r,t){const e=new zt(r);return t?e.load().then(()=>e.measure()):e.measure()}function Hl(r,t){const e=new zt(r);return t?e.load().then(()=>e.render(r)):e.render(r)}Z.Canvas2DRenderer=ui,Z.Character=zi,Z.Fragment=Vi,Z.Measurer=We,Z.Paragraph=ji,Z.Text=zt,Z.backgroundPlugin=Gi,Z.createSvgLoader=ur,Z.createSvgParser=fr,Z.definePlugin=jl,Z.filterEmpty=Sn,Z.getHighlightStyle=Cn,Z.getTransform2D=Pn,Z.hexToRgb=Vl,Z.highlightPlugin=qi,Z.isEqualObject=Ri,Z.isEqualValue=pe,Z.listStylePlugin=Wi,Z.measureText=Wl,Z.outlinePlugin=Hi,Z.parseColormap=bn,Z.parseValueNumber=wn,Z.renderPlugin=Xi,Z.renderText=Hl,Z.textDecorationPlugin=Zi,Z.textDefaultStyle=pr,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));