modern-text 0.6.1 → 0.6.2
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -650,7 +650,7 @@ class Measurer {
|
|
|
650
650
|
height: fBox.height
|
|
651
651
|
});
|
|
652
652
|
let characterIndex = 0;
|
|
653
|
-
if (fDom.firstChild instanceof window.Text) {
|
|
653
|
+
if (!fDom.children.length && fDom.firstChild instanceof window.Text) {
|
|
654
654
|
this.measureDomText(fDom.firstChild).forEach((char) => {
|
|
655
655
|
characters.push({
|
|
656
656
|
...char,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(U,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(U=typeof globalThis<"u"?globalThis:U||self,lt(U.modernText={}))})(this,function(U){"use strict";var ya=Object.defineProperty;var ma=(U,lt,$t)=>lt in U?ya(U,lt,{enumerable:!0,configurable:!0,writable:!0,value:$t}):U[lt]=$t;var B=(U,lt,$t)=>ma(U,typeof lt!="symbol"?lt+"":lt,$t);function lt(n,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:s,x1:o,y1:i,stops:a}=fn(t,e.left,e.top,e.width,e.height),l=n.createLinearGradient(r,s,o,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function $t(n,t,e){n!=null&&n.color&&(n.color=lt(e,n.color,t)),n!=null&&n.backgroundColor&&(n.backgroundColor=lt(e,n.backgroundColor,t)),n!=null&&n.textStrokeColor&&(n.textStrokeColor=lt(e,n.textStrokeColor,t))}function fn(n,t,e,r,s){var p;const o=((p=n.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",i=o.split(",")[0],a=i.includes("deg")?i:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=s*Math.cos(c);return{x0:t+r/2-u,y0:e+s/2+f,x1:t+r/2+u,y1:e+s/2-f,stops:Array.from(l).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function te(n){const{ctx:t,path:e,fontSize:r,clipRect:s}=n;t.save(),t.beginPath();const o=e.style,i={...o,fill:n.color??o.fill,stroke:n.textStrokeColor??o.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*r,shadowOffsetY:(n.shadowOffsetY??0)*r,shadowBlur:(n.shadowBlur??0)*r,shadowColor:n.shadowColor};s&&(t.rect(s.left,s.top,s.width,s.height),t.clip(),t.beginPath()),e.drawTo(t,i),t.restore()}function Fr(n,t,e){const{left:r,top:s,width:o,height:i}=e,a=n.canvas;a.dataset.viewBox=`${r} ${s} ${o} ${i}`,a.dataset.pixelRatio=String(t);const l=o,h=i;a.width=Math.max(1,Math.ceil(l*t)),a.height=Math.max(1,Math.ceil(h*t)),a.style.width=`${l}px`,a.style.height=`${h}px`,n.clearRect(0,0,a.width,a.height),n.scale(t,t),n.translate(-r,-s)}function zr(n,t){const{paragraphs:e,computedStyle:r,glyphBox:s}=t;$t(r,s,n),e.forEach(o=>{$t(o.computedStyle,o.lineBox,n),o.fragments.forEach(i=>{$t(i.computedStyle,i.inlineBox,n)})})}var ht=Uint8Array,Ct=Uint16Array,Je=Int32Array,Ae=new ht([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]),Ie=new ht([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 ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nr=function(n,t){for(var e=new Ct(31),r=0;r<31;++r)e[r]=t+=1<<n[r-1];for(var s=new Je(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)s[o]=o-e[r]<<5|r;return{b:e,r:s}},qr=Nr(Ae,2),Gr=qr.b,er=qr.r;Gr[28]=258,er[258]=28;for(var Rr=Nr(Ie,0),pn=Rr.b,Wr=Rr.r,rr=new Ct(32768),X=0;X<32768;++X){var Gt=(X&43690)>>1|(X&21845)<<1;Gt=(Gt&52428)>>2|(Gt&13107)<<2,Gt=(Gt&61680)>>4|(Gt&3855)<<4,rr[X]=((Gt&65280)>>8|(Gt&255)<<8)>>1}for(var Bt=function(n,t,e){for(var r=n.length,s=0,o=new Ct(t);s<r;++s)n[s]&&++o[n[s]-1];var i=new Ct(t);for(s=1;s<t;++s)i[s]=i[s-1]+o[s-1]<<1;var a;if(e){a=new Ct(1<<t);var l=15-t;for(s=0;s<r;++s)if(n[s])for(var h=s<<4|n[s],c=t-n[s],u=i[n[s]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[rr[u]>>l]=h}else for(a=new Ct(r),s=0;s<r;++s)n[s]&&(a[s]=rr[i[n[s]-1]++]>>15-n[s]);return a},Rt=new ht(288),X=0;X<144;++X)Rt[X]=8;for(var X=144;X<256;++X)Rt[X]=9;for(var X=256;X<280;++X)Rt[X]=7;for(var X=280;X<288;++X)Rt[X]=8;for(var ce=new ht(32),X=0;X<32;++X)ce[X]=5;var dn=Bt(Rt,9,0),gn=Bt(Rt,9,1),yn=Bt(ce,5,0),mn=Bt(ce,5,1),sr=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Tt=function(n,t,e){var r=t/8|0;return(n[r]|n[r+1]<<8)>>(t&7)&e},nr=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},ir=function(n){return(n+7)/8|0},Vr=function(n,t,e){return(e==null||e>n.length)&&(e=n.length),new ht(n.subarray(t,e))},wn=["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"],Ot=function(n,t,e){var r=new Error(t||wn[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ot),!e)throw r;return r},xn=function(n,t,e,r){var s=n.length,o=0;if(!s||t.f&&!t.l)return e||new ht(0);var i=!e,a=i||t.i!=2,l=t.i;i&&(e=new ht(s*3));var h=function(kt){var Lt=e.length;if(kt>Lt){var qt=new ht(Math.max(Lt*2,kt));qt.set(e),e=qt}},c=t.f||0,u=t.p||0,f=t.b||0,p=t.l,g=t.d,m=t.m,d=t.n,_=s*8;do{if(!p){c=Tt(n,u,1);var C=Tt(n,u+1,3);if(u+=3,C)if(C==1)p=gn,g=mn,m=9,d=5;else if(C==2){var x=Tt(n,u,31)+257,T=Tt(n,u+10,15)+4,M=x+Tt(n,u+5,31)+1;u+=14;for(var O=new ht(M),V=new ht(19),H=0;H<T;++H)V[tr[H]]=Tt(n,u+H*3,7);u+=T*3;for(var E=sr(V),et=(1<<E)-1,P=Bt(V,E,1),H=0;H<M;){var F=P[Tt(n,u,et)];u+=F&15;var S=F>>4;if(S<16)O[H++]=S;else{var q=0,z=0;for(S==16?(z=3+Tt(n,u,3),u+=2,q=O[H-1]):S==17?(z=3+Tt(n,u,7),u+=3):S==18&&(z=11+Tt(n,u,127),u+=7);z--;)O[H++]=q}}var D=O.subarray(0,x),L=O.subarray(x);m=sr(D),d=sr(L),p=Bt(D,m,1),g=Bt(L,d,1)}else Ot(1);else{var S=ir(u)+4,b=n[S-4]|n[S-3]<<8,w=S+b;if(w>s){l&&Ot(0);break}a&&h(f+b),e.set(n.subarray(S,w),f),t.b=f+=b,t.p=u=w*8,t.f=c;continue}if(u>_){l&&Ot(0);break}}a&&h(f+131072);for(var st=(1<<m)-1,A=(1<<d)-1,Z=u;;Z=u){var q=p[nr(n,u)&st],R=q>>4;if(u+=q&15,u>_){l&&Ot(0);break}if(q||Ot(2),R<256)e[f++]=R;else if(R==256){Z=u,p=null;break}else{var G=R-254;if(R>264){var H=R-257,k=Ae[H];G=Tt(n,u,(1<<k)-1)+Gr[H],u+=k}var Q=g[nr(n,u)&A],Y=Q>>4;Q||Ot(3),u+=Q&15;var L=pn[Y];if(Y>3){var k=Ie[Y];L+=nr(n,u)&(1<<k)-1,u+=k}if(u>_){l&&Ot(0);break}a&&h(f+131072);var nt=f+G;if(f<L){var Qt=o-L,Jt=Math.min(L,nt);for(Qt+f<0&&Ot(3);f<Jt;++f)e[f]=r[Qt+f]}for(;f<nt;++f)e[f]=e[f-L]}}t.l=p,t.p=Z,t.b=f,t.f=c,p&&(c=1,t.m=m,t.d=g,t.n=d)}while(!c);return f!=e.length&&i?Vr(e,0,f):e.subarray(0,f)},zt=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8},ue=function(n,t,e){e<<=t&7;var r=t/8|0;n[r]|=e,n[r+1]|=e>>8,n[r+2]|=e>>16},or=function(n,t){for(var e=[],r=0;r<n.length;++r)n[r]&&e.push({s:r,f:n[r]});var s=e.length,o=e.slice();if(!s)return{t:Yr,l:0};if(s==1){var i=new ht(e[0].s+1);return i[e[0].s]=1,{t:i,l:1}}e.sort(function(w,x){return w.f-x.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,c=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=e[e[h].f<e[u].f?h++:u++],l=e[h!=c&&e[h].f<e[u].f?h++:u++],e[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,r=1;r<s;++r)o[r].s>f&&(f=o[r].s);var p=new Ct(f+1),g=ar(e[c-1],p,0);if(g>t){var r=0,m=0,d=g-t,_=1<<d;for(o.sort(function(x,T){return p[T.s]-p[x.s]||x.f-T.f});r<s;++r){var C=o[r].s;if(p[C]>t)m+=_-(1<<g-p[C]),p[C]=t;else break}for(m>>=d;m>0;){var S=o[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var b=o[r].s;p[b]==t&&(--p[b],++m)}g=t}return{t:new ht(p),l:g}},ar=function(n,t,e){return n.s==-1?Math.max(ar(n.l,t,e+1),ar(n.r,t,e+1)):t[n.s]=e},Xr=function(n){for(var t=n.length;t&&!n[--t];);for(var e=new Ct(++t),r=0,s=n[0],o=1,i=function(l){e[r++]=l},a=1;a<=t;++a)if(n[a]==s&&a!=t)++o;else{if(!s&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(s),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(s);o=1,s=n[a]}return{c:e.subarray(0,r),n:t}},fe=function(n,t){for(var e=0,r=0;r<t.length;++r)e+=n[r]*t[r];return e},jr=function(n,t,e){var r=e.length,s=ir(t+2);n[s]=r&255,n[s+1]=r>>8,n[s+2]=n[s]^255,n[s+3]=n[s+1]^255;for(var o=0;o<r;++o)n[s+o+4]=e[o];return(s+4+r)*8},Hr=function(n,t,e,r,s,o,i,a,l,h,c){zt(t,c++,e),++s[256];for(var u=or(s,15),f=u.t,p=u.l,g=or(o,15),m=g.t,d=g.l,_=Xr(f),C=_.c,S=_.n,b=Xr(m),w=b.c,x=b.n,T=new Ct(19),M=0;M<C.length;++M)++T[C[M]&31];for(var M=0;M<w.length;++M)++T[w[M]&31];for(var O=or(T,7),V=O.t,H=O.l,E=19;E>4&&!V[tr[E-1]];--E);var et=h+5<<3,P=fe(s,Rt)+fe(o,ce)+i,F=fe(s,f)+fe(o,m)+i+14+3*E+fe(T,V)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&et<=P&&et<=F)return jr(t,c,n.subarray(l,l+h));var q,z,D,L;if(zt(t,c,1+(F<P)),c+=2,F<P){q=Bt(f,p,0),z=f,D=Bt(m,d,0),L=m;var st=Bt(V,H,0);zt(t,c,S-257),zt(t,c+5,x-1),zt(t,c+10,E-4),c+=14;for(var M=0;M<E;++M)zt(t,c+3*M,V[tr[M]]);c+=3*E;for(var A=[C,w],Z=0;Z<2;++Z)for(var R=A[Z],M=0;M<R.length;++M){var G=R[M]&31;zt(t,c,st[G]),c+=V[G],G>15&&(zt(t,c,R[M]>>5&127),c+=R[M]>>12)}}else q=dn,z=Rt,D=yn,L=ce;for(var M=0;M<a;++M){var k=r[M];if(k>255){var G=k>>18&31;ue(t,c,q[G+257]),c+=z[G+257],G>7&&(zt(t,c,k>>23&31),c+=Ae[G]);var Q=k&31;ue(t,c,D[Q]),c+=L[Q],Q>3&&(ue(t,c,k>>5&8191),c+=Ie[Q])}else ue(t,c,q[k]),c+=z[k]}return ue(t,c,q[256]),c+z[256]},vn=new Je([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yr=new ht(0),bn=function(n,t,e,r,s,o){var i=o.z||n.length,a=new ht(r+i+5*(1+Math.ceil(i/7e3))+s),l=a.subarray(r,a.length-s),h=o.l,c=(o.r||0)&7;if(t){c&&(l[0]=o.r>>3);for(var u=vn[t-1],f=u>>13,p=u&8191,g=(1<<e)-1,m=o.p||new Ct(32768),d=o.h||new Ct(g+1),_=Math.ceil(e/3),C=2*_,S=function(he){return(n[he]^n[he+1]<<_^n[he+2]<<C)&g},b=new Je(25e3),w=new Ct(288),x=new Ct(32),T=0,M=0,O=o.i||0,V=0,H=o.w||0,E=0;O+2<i;++O){var et=S(O),P=O&32767,F=d[et];if(m[P]=F,d[et]=P,H<=O){var q=i-O;if((T>7e3||V>24576)&&(q>423||!h)){c=Hr(n,l,0,b,w,x,M,V,E,O-E,c),V=T=M=0,E=O;for(var z=0;z<286;++z)w[z]=0;for(var z=0;z<30;++z)x[z]=0}var D=2,L=0,st=p,A=P-F&32767;if(q>2&&et==S(O-A))for(var Z=Math.min(f,q)-1,R=Math.min(32767,O),G=Math.min(258,q);A<=R&&--st&&P!=F;){if(n[O+D]==n[O+D-A]){for(var k=0;k<G&&n[O+k]==n[O+k-A];++k);if(k>D){if(D=k,L=A,k>Z)break;for(var Q=Math.min(A,k-2),Y=0,z=0;z<Q;++z){var nt=O-A+z&32767,Qt=m[nt],Jt=nt-Qt&32767;Jt>Y&&(Y=Jt,F=nt)}}}P=F,F=m[P],A+=P-F&32767}if(L){b[V++]=268435456|er[D]<<18|Wr[L];var kt=er[D]&31,Lt=Wr[L]&31;M+=Ae[kt]+Ie[Lt],++w[257+kt],++x[Lt],H=O+D,++T}else b[V++]=n[O],++w[n[O]]}}for(O=Math.max(O,H);O<i;++O)b[V++]=n[O],++w[n[O]];c=Hr(n,l,h,b,w,x,M,V,E,O-E,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=d,o.p=m,o.i=O,o.w=H)}else{for(var O=o.w||0;O<i+h;O+=65535){var qt=O+65535;qt>=i&&(l[c/8|0]=h,qt=i),c=jr(l,c+1,n.subarray(O,qt))}o.i=i}return Vr(a,0,r+ir(c)+s)},Zr=function(){var n=1,t=0;return{p:function(e){for(var r=n,s=t,o=e.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)s+=r+=e[i];r=(r&65535)+15*(r>>16),s=(s&65535)+15*(s>>16)}n=r,t=s},d:function(){return n%=65521,t%=65521,(n&255)<<24|(n&65280)<<8|(t&255)<<8|t>>8}}},Sn=function(n,t,e,r,s){if(!s&&(s={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),i=new ht(o.length+n.length);i.set(o),i.set(n,o.length),n=i,s.w=o.length}return bn(n,t.level==null?6:t.level,t.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+t.mem,e,r,s)},Kr=function(n,t,e){for(;e;++t)n[t]=e,e>>>=8},Pn=function(n,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(n[0]=120,n[1]=r<<6|(t.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,t.dictionary){var s=Zr();s.p(t.dictionary),Kr(n,2,s.d())}},Cn=function(n,t){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Ot(6,"invalid zlib data"),(n[1]>>5&1)==+!t&&Ot(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function _n(n,t){t||(t={});var e=Zr();e.p(n);var r=Sn(n,t,t.dictionary?6:2,4);return Pn(r,t),Kr(r,r.length-4,e.d()),r}function Mn(n,t){return xn(n.subarray(Cn(n,t),-4),{i:2},t,t)}var Tn=typeof TextDecoder<"u"&&new TextDecoder,On=0;try{Tn.decode(Yr,{stream:!0}),On=1}catch{}const An="modern-font";function pe(n,t){if(!n)throw new Error(`[${An}] ${t}`)}function In(n){return ArrayBuffer.isView(n)?n.byteOffset>0||n.byteLength<n.buffer.byteLength?n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength):n.buffer:n}function ee(n){return ArrayBuffer.isView(n)?new DataView(n.buffer,n.byteOffset,n.byteLength):new DataView(n)}var Qr=Object.defineProperty,$n=(n,t,e)=>t in n?Qr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ct=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&Qr(t,e,s),s},Bn=(n,t,e)=>($n(n,t+"",e),e);const $e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ut(){return function(n,t){Object.defineProperty(n.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 ot extends DataView{constructor(t,e,r,s){super(In(t),e,r),this.littleEndian=s,Bn(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,s)=>this.read(t.type,t.offset+s));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},(r,s)=>{this.write(t.type,e[s],t.offset+s)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const s=`get${t.replace(/^\S/,i=>i.toUpperCase())}`,o=this[s](e,r);return this.cursor+=$e[t],o}readUint24(t=this.cursor){const[e,r,s]=this.readBytes(t,3);return(e<<16)+(r<<8)+s}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let s=0;s<e;++s)r.push(this.getUint8(t+s));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let s="";for(let o=0,i=r.length;o<i;o++)s+=String.fromCharCode(r[o]);return s}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),s=new Date;return s.setTime(r*1e3+-20775456e5),s}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,s=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,i=this[o](r,e,s);return this.cursor+=$e[t.toLowerCase()],i}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let s=0,o=t.length,i;s<o;++s)i=t.charCodeAt(s)||0,i>127?this.writeUint16(i):this.writeUint8(i);return this.cursor+=r,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 s=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(s,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let s=0;s<r;++s)this.setUint8(e+s,t[s])}else{const s=ee(t);r=s.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,s.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}ct([ut()],ot.prototype,"readInt8"),ct([ut()],ot.prototype,"readInt16"),ct([ut()],ot.prototype,"readInt32"),ct([ut()],ot.prototype,"readUint8"),ct([ut()],ot.prototype,"readUint16"),ct([ut()],ot.prototype,"readUint32"),ct([ut()],ot.prototype,"readFloat32"),ct([ut()],ot.prototype,"readFloat64"),ct([ut()],ot.prototype,"writeInt8"),ct([ut()],ot.prototype,"writeInt16"),ct([ut()],ot.prototype,"writeInt32"),ct([ut()],ot.prototype,"writeUint8"),ct([ut()],ot.prototype,"writeUint16"),ct([ut()],ot.prototype,"writeUint32"),ct([ut()],ot.prototype,"writeFloat32"),ct([ut()],ot.prototype,"writeFloat64");var En=Object.defineProperty,Un=(n,t,e)=>t in n?En(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Dn=(n,t,e)=>(Un(n,t+"",e),e);const Jr=new WeakMap;function y(n){const t=typeof n=="object"?n:{type:n},{size:e=1,type:r}=t;return(s,o)=>{if(typeof o!="string")return;let i=Jr.get(s);i||(i={columns:[],byteLength:0},Jr.set(s,i));const a={...t,name:o,byteLength:e*$e[r],offset:t.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+$e[h.type]*(h.size??1),0),Object.defineProperty(s.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,s){Dn(this,"view"),this.view=new ot(t,e,r,s)}}function kn(n){let t="";for(let e=0,r=n.length,s;e<r;e++)s=n.charCodeAt(e),s!==0&&(t+=String.fromCharCode(s));return t}function Be(n){n=kn(n);const t=[];for(let e=0,r=n.length,s;e<r;e++)s=n.charCodeAt(e),t.push(s>>8),t.push(s&255);return t}function Ln(n){let t="";for(let e=0,r=n.length;e<r;e++)n[e]<127?t+=String.fromCharCode(n[e]):t+=`%${(256+n[e]).toString(16).slice(1)}`;return unescape(t)}function Fn(n){let t="";for(let e=0,r=n.length;e<r;e+=2)t+=String.fromCharCode((n[e]<<8)+n[e+1]);return t}class lr extends Mt{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 ts=Object.defineProperty,zn=(n,t,e)=>t in n?ts(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,mt=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ts(t,e,s),s},es=(n,t,e)=>(zn(n,typeof t!="symbol"?t+"":t,e),e);const wt=class an extends lr{constructor(){super(...arguments),es(this,"format","EmbeddedOpenType"),es(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,s=e.name.names,o=Be(s.fontFamily||""),i=o.length,a=Be(s.fontStyle||""),l=a.length,h=Be(s.version||""),c=h.length,u=Be(s.fullName||""),f=u.length,p=86+i+4+l+4+c+4+f+2+t.view.byteLength,g=new an(new ArrayBuffer(p),0,p,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(i),g.view.writeBytes(o),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(f),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var Nn=Object.defineProperty,Ee=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&Nn(t,e,s),s};class de extends Mt{constructor(t,e){super(t,e,16)}}Ee([y({type:"char",size:4})],de.prototype,"tag"),Ee([y("uint32")],de.prototype,"checkSum"),Ee([y("uint32")],de.prototype,"offset"),Ee([y("uint32")],de.prototype,"length");const hr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],qn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"];var Gn=Object.defineProperty,Rn=(n,t,e)=>t in n?Gn(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ge=(n,t,e)=>(Rn(n,typeof t!="symbol"?t+"":t,e),e);class rs{constructor(t){ge(this,"index"),ge(this,"name"),ge(this,"isComposite",!1),ge(this,"components",[]),ge(this,"pathCommands",[]);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,r=72,s={},o){const i=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=i,yScale:l=i}=s,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const p=h[u];p.type==="M"?c.push({type:"M",x:t+p.x*a,y:e+-p.y*l}):p.type==="L"?c.push({type:"L",x:t+p.x*a,y:e+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:t+p.x1*a,y1:e+-p.y1*l,x:t+p.x*a,y:e+-p.y*l}):p.type==="C"?c.push({type:"C",x1:t+p.x1*a,y1:e+-p.y1*l,x2:t+p.x2*a,y2:e+-p.y2*l,x:t+p.x*a,y:e+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class Wn extends rs{parse(t,e,r){const s=this,{nominalWidthX:o,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,p,g;const m=[],d=[];let _=0,C=!1,S=!1,b=i,w=0,x=0;function T(P,F){m.push({type:"L",x:P,y:F})}function M(P,F,q,z,D,L){m.push({type:"C",x1:P,y1:F,x2:q,y2:z,x:D,y:L})}function O(P,F){S&&h!==2&&V(),S=!0,m.push({type:"M",x:P,y:F})}function V(){m.push({type:"Z"})}function H(P){m.push(...P)}function E(){d.length%2!==0&&!C&&(b=d.shift()+o),_+=d.length>>1,d.length=0,C=!0}function et(P){let F,q,z,D,L,st,A,Z,R,G,k,Q,Y=0;for(;Y<P.length;){let nt=P[Y++];switch(nt){case 1:E();break;case 3:E();break;case 4:d.length>1&&!C&&(b=d.shift()+o,C=!0),x+=d.pop(),O(w,x);break;case 5:for(;d.length>0;)w+=d.shift(),x+=d.shift(),T(w,x);break;case 6:for(;d.length>0&&(w+=d.shift(),T(w,x),d.length!==0);)x+=d.shift(),T(w,x);break;case 7:for(;d.length>0&&(x+=d.shift(),T(w,x),d.length!==0);)w+=d.shift(),T(w,x);break;case 8:for(;d.length>0;)u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),M(u,f,p,g,w,x);break;case 10:L=d.pop()+l,st=t.subrs[L],st&&et(st);break;case 11:return;case 12:switch(nt=P[Y],Y+=1,nt){case 35:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),A=p+d.shift(),Z=g+d.shift(),R=A+d.shift(),G=Z+d.shift(),k=R+d.shift(),Q=G+d.shift(),w=k+d.shift(),x=Q+d.shift(),d.shift(),M(u,f,p,g,A,Z),M(R,G,k,Q,w,x);break;case 34:u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),A=p+d.shift(),Z=g,R=A+d.shift(),G=g,k=R+d.shift(),Q=x,w=k+d.shift(),M(u,f,p,g,A,Z),M(R,G,k,Q,w,x);break;case 36:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),A=p+d.shift(),Z=g,R=A+d.shift(),G=g,k=R+d.shift(),Q=G+d.shift(),w=k+d.shift(),M(u,f,p,g,A,Z),M(R,G,k,Q,w,x);break;case 37:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),A=p+d.shift(),Z=g+d.shift(),R=A+d.shift(),G=Z+d.shift(),k=R+d.shift(),Q=G+d.shift(),Math.abs(k-w)>Math.abs(Q-x)?w=k+d.shift():x=Q+d.shift(),M(u,f,p,g,A,Z),M(R,G,k,Q,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),d.length=0}break;case 14:if(d.length>=4){const Qt=hr[d.pop()],Jt=hr[d.pop()],kt=d.pop(),Lt=d.pop();if(Qt&&Jt){s.isComposite=!0,s.components=[];const qt=t.charset.indexOf(Qt),he=t.charset.indexOf(Jt);s.components.push({glyphIndex:he,dx:0,dy:0}),s.components.push({glyphIndex:qt,dx:Lt,dy:kt}),H(r.get(he).pathCommands);const Dr=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let kr=0;kr<Dr.length;kr+=1){const Ft=Dr[kr];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=kt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=kt),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=kt)}H(Dr)}}else d.length>0&&!C&&(b=d.shift()+o,C=!0);S&&h!==2&&(V(),S=!1);break;case 18:E();break;case 19:case 20:E(),Y+=_+7>>3;break;case 21:d.length>2&&!C&&(b=d.shift()+o,C=!0),x+=d.pop(),w+=d.pop(),O(w,x);break;case 22:d.length>1&&!C&&(b=d.shift()+o,C=!0),w+=d.pop(),O(w,x);break;case 23:E();break;case 24:for(;d.length>2;)u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),M(u,f,p,g,w,x);w+=d.shift(),x+=d.shift(),T(w,x);break;case 25:for(;d.length>6;)w+=d.shift(),x+=d.shift(),T(w,x);u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+d.shift(),M(u,f,p,g,w,x);break;case 26:for(d.length%2&&(w+=d.shift());d.length>0;)u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p,x=g+d.shift(),M(u,f,p,g,w,x);break;case 27:for(d.length%2&&(x+=d.shift());d.length>0;)u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g,M(u,f,p,g,w,x);break;case 28:F=P[Y],q=P[Y+1],d.push((F<<24|q<<16)>>16),Y+=2;break;case 29:L=d.pop()+a,st=t.gsubrs[L],st&&et(st);break;case 30:for(;d.length>0&&(u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+(d.length===1?d.shift():0),M(u,f,p,g,w,x),d.length!==0);)u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),x=g+d.shift(),w=p+(d.length===1?d.shift():0),M(u,f,p,g,w,x);break;case 31:for(;d.length>0&&(u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),x=g+d.shift(),w=p+(d.length===1?d.shift():0),M(u,f,p,g,w,x),d.length!==0);)u=w,f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),w=p+d.shift(),x=g+(d.length===1?d.shift():0),M(u,f,p,g,w,x);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?d.push(nt-139):nt<251?(F=P[Y],Y+=1,d.push((nt-247)*256+F+108)):nt<255?(F=P[Y],Y+=1,d.push(-(nt-251)*256-F-108)):(F=P[Y],q=P[Y+1],z=P[Y+2],D=P[Y+3],Y+=4,d.push((F<<24|q<<16|z<<8|D)/65536))}}}et(e),this.pathCommands=m,C&&(this.advanceWidth=b)}}var Vn=Object.defineProperty,Xn=(n,t,e)=>t in n?Vn(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,jn=(n,t,e)=>(Xn(n,t+"",e),e);class ss{constructor(t){this._sfnt=t,jn(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const s=this._sfnt.hmtx.metrics[t];s&&(r.advanceWidth=r.advanceWidth||s.advanceWidth,r.leftSideBearing=r.leftSideBearing||s.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Hn extends ss{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Wn({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var ns=Object.defineProperty,Yn=(n,t,e)=>t in n?ns(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,is=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ns(t,e,s),s},Ue=(n,t,e)=>(Yn(n,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,s){super(t,e,r,s),Ue(this,"_offsets"),Ue(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const s=[];for(let o=0,i=e+1;o<i;o++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();s.push(l)}return s}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,s=r+e[t],i=r+e[t+1]-s;return this._isString?this.view.readString(s,i):this.view.readBytes(s,i)}}is([y("uint16")],De.prototype,"count"),is([y("uint8")],De.prototype,"offsetSize");class ke extends De{constructor(){super(...arguments),Ue(this,"_isString",!1)}}class os extends De{constructor(){super(...arguments),Ue(this,"_isString",!0)}}const Zn=[".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"],Kn=[".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"],Qn=[".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"],Jn=[".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 Le(n,t){return t<=390?Zn[t]:n[t-391]}var ti=Object.defineProperty,ei=(n,t,e)=>t in n?ti(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,as=(n,t,e)=>(ei(n,typeof t!="symbol"?t+"":t,e),e);function j(n,t="number",e){return(r,s)=>{if(typeof s!="string")return;const o={type:t,operator:n,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,s,{get(){return this._getProp(o)},set(i){this._setProp(o,i)},configurable:!0,enumerable:!0})}}class ls extends Mt{constructor(){super(...arguments),as(this,"_dict"),as(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),i=o>>4,a=o&15;if(i===r||(e+=s[i],a===r))break;e+=s[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,s,o,i;if(t===28)return r=e.readUint8(),s=e.readUint8(),r<<8|s;if(t===29)return r=e.readUint8(),s=e.readUint8(),o=e.readUint8(),i=e.readUint8(),r<<24|s<<16|o<<8|i;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,s={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),s[o]=e,e=[]):e.push(this._readOperand(o))}return s}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Le(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var ri=Object.defineProperty,cr=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ri(t,e,s),s};class Fe extends ls{}cr([j(19)],Fe.prototype,"subrs"),cr([j(20)],Fe.prototype,"defaultWidthX"),cr([j(21)],Fe.prototype,"nominalWidthX");var si=Object.defineProperty,J=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&si(t,e,s),s};class K extends ls{}J([j(0,"string")],K.prototype,"version"),J([j(1,"string")],K.prototype,"notice"),J([j(1200,"string")],K.prototype,"copyright"),J([j(2,"string")],K.prototype,"fullName"),J([j(3,"string")],K.prototype,"familyName"),J([j(4,"string")],K.prototype,"weight"),J([j(1201)],K.prototype,"isFixedPitch"),J([j(1202)],K.prototype,"italicAngle"),J([j(1203,"number",-100)],K.prototype,"underlinePosition"),J([j(1204,"number",50)],K.prototype,"underlineThickness"),J([j(1205)],K.prototype,"paintType"),J([j(1206,"number",2)],K.prototype,"charstringType"),J([j(1207,"number[]",[.001,0,0,.001,0,0])],K.prototype,"fontMatrix"),J([j(13)],K.prototype,"uniqueId"),J([j(5,"number[]",[0,0,0,0])],K.prototype,"fontBBox"),J([j(1208)],K.prototype,"strokeWidth"),J([j(14)],K.prototype,"xuid"),J([j(15)],K.prototype,"charset"),J([j(16)],K.prototype,"encoding"),J([j(17)],K.prototype,"charStrings"),J([j(18,"number[]",[0,0])],K.prototype,"private");var ni=Object.defineProperty,ii=(n,t,e)=>t in n?ni(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ur=(n,t,e)=>(ii(n,typeof t!="symbol"?t+"":t,e),e);function ft(n,t=n){return e=>{ze.tableDefinitions.set(n,{tag:n,prop:t,class:e}),Object.defineProperty(ze.prototype,t,{get(){return this.get(n)},set(r){return this.set(n,r)},configurable:!0,enumerable:!0})}}const hs=class Oe{constructor(t){ur(this,"tables",new Map),ur(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,s)=>{this.tableViews.set(s,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}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 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:r,charset:s}=this.cff;e=s.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),s=r.length,o=Array.from({length:s}),i=e.get(0);for(let a=0;a<s;a+=1)o[a]=e.get(r[a])||i;return o}getPathCommands(t,e,r,s,o){const i=[];return this.forEachGlyph(t,e,r,s,o,(a,l,h,c,u)=>{i.push(...a.getPathCommands(l,h,c,u,this))}),i}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,s=72,o={},i){const a=1/this.unitsPerEm*s,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,e,r,s,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*s:o.tracking&&(e+=o.tracking/1e3*s)}return e}clone(){return new Oe(this.tableViews)}delete(t){const e=Oe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Oe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Oe.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const s=e.class;if(s){const o=this.tableViews.get(t);if(!o)return;r=new s(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};ur(hs,"tableDefinitions",new Map);let ze=hs;class pt extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var cs=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ai=(n,t,e)=>t in n?cs(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ye=(n,t,e,r)=>{for(var s=r>1?void 0:r?oi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&cs(t,e,s),s},fr=(n,t,e)=>(ai(n,typeof t!="symbol"?t+"":t,e),e);let re=class extends pt{constructor(n,t,e,r){super(n,t,e,r),fr(this,"_glyphs"),fr(this,"privateDict"),fr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Hn(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var n;return((n=this.privateDict)==null?void 0:n.defaultWidthX)??0}get nominalWidthX(){var n;return((n=this.privateDict)==null?void 0:n.nominalWidthX)??0}get subrs(){var n;return((n=this.subrsIndex)==null?void 0:n.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const n=this.view,{buffer:t,byteOffset:e}=n,r=e+4;this.nameIndex=new os(t,r),this.topDictIndex=new ke(t,this.nameIndex.endOffset),this.stringIndex=new os(t,this.topDictIndex.endOffset),this.globalSubrIndex=new ke(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const s=this.topDict.private[0],o=this.topDict.private[1];s&&(this.privateDict=new Fe(t,e+o,s).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new ke(t,e+o+this.privateDict.subrs))),this.charStringsIndex=new ke(t,e+this.topDict.charStrings);const i=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Kn:this.topDict.charset===1?this.charset=Qn:this.topDict.charset===2?this.charset=Jn:this.charset=this._readCharset(e+this.topDict.charset,i,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=hr:this.topDict.encoding===1?this.encoding=qn:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(n,t,e){const r=this.view;r.seek(n);let s,o,i;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(s=0;s<t;s+=1)o=r.readUint16(),a.push(Le(e,o));else if(l===1)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint8(),s=0;s<=i;s+=1)a.push(Le(e,o)),o+=1;else if(l===2)for(;a.length<=t;)for(o=r.readUint16(),i=r.readUint16(),s=0;s<=i;s+=1)a.push(Le(e,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(n){const t=this.view;t.seek(n);let e,r;const s={},o=t.readUint8();if(o===0){const i=t.readUint8();for(e=0;e<i;e+=1)r=t.readUint8(),s[r]=e}else if(o===1){const i=t.readUint8();for(r=1,e=0;e<i;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)s[h]=r,r+=1}}else console.warn(`unknown encoding format:${o}`);return s}_calcSubroutineBias(n){let t;return n.length<1240?t=107:n.length<33900?t=1131:t=32768,t}};ye([y("uint8")],re.prototype,"majorVersion",2),ye([y("uint8")],re.prototype,"minorVersion",2),ye([y("uint8")],re.prototype,"headerSize",2),ye([y("uint8")],re.prototype,"offsetSize",2),re=ye([ft("CFF ","cff")],re);var li=Object.defineProperty,Ne=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&li(t,e,s),s};const me=class ln extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ln;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,s)=>{s<256&&r<256&&e.view.writeUint8(r,6+s)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ne([y("uint16")],me.prototype,"format"),Ne([y("uint16")],me.prototype,"length"),Ne([y("uint16")],me.prototype,"language"),Ne([y({type:"uint8",size:256})],me.prototype,"glyphIndexArray");let us=me;var hi=Object.defineProperty,pr=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&hi(t,e,s),s};class qe extends Mt{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,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,s=this.maxSubHeaderKey,o=this.subHeaders,i=this.glyphIndexArray,a=r.findIndex(h=>h===s);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=i.length?l=0:(l=i[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=i.length?l=0:(l=i[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<t){const p=(h<<8|u+o[c].firstCode)%65535;e.set(p,l)}}return e}}pr([y("uint16")],qe.prototype,"format"),pr([y("uint16")],qe.prototype,"length"),pr([y("uint16")],qe.prototype,"language");function fs(n){return n>32767?n-65536:n<-32767?n+65536:n}function ps(n,t){let e;const r=[];let s={};return n.forEach((o,i)=>{t&&i>t||((!e||i!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(s.end=e.unicode,r.push(s),s={start:i,startId:o,delta:fs(o-i)}):(s.start=Number(i),s.startId=o,s.delta=fs(o-i))),e={unicode:i,glyphIndex:o})}),e&&(s.end=e.unicode,r.push(s)),r}var ci=Object.defineProperty,Ht=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ci(t,e,s),s};const Wt=class hn extends Mt{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(r=>this.view.writeUint16(r))}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=ps(t,65535),r=e.length+1,s=Math.floor(Math.log(r)/Math.LN2),o=2*2**s,i=new hn(new ArrayBuffer(24+e.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=r*2,i.searchRange=o,i.entrySelector=s,i.rangeShift=2*r-o,i.endCode=[...e.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...e.map(a=>a.start),65535],i.idDelta=[...e.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:r},()=>0),i}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,s=this.startCode,o=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=s[h],u=o[h];c<=u;++c)if(i[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+i[h]/2+(c-s[h])-r,p=l[f];p!==0?t.set(c,(p+a[h])%65536):t.set(c,0)}return t.delete(65535),t}};Ht([y("uint16")],Wt.prototype,"format"),Ht([y("uint16")],Wt.prototype,"length"),Ht([y("uint16")],Wt.prototype,"language"),Ht([y("uint16")],Wt.prototype,"segCountX2"),Ht([y("uint16")],Wt.prototype,"searchRange"),Ht([y("uint16")],Wt.prototype,"entrySelector"),Ht([y("uint16")],Wt.prototype,"rangeShift");let ds=Wt;var ui=Object.defineProperty,we=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ui(t,e,s),s};class se extends Mt{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((r,s)=>{e.set(s,r)}),e}}we([y("uint16")],se.prototype,"format"),we([y("uint16")],se.prototype,"length"),we([y("uint16")],se.prototype,"language"),we([y("uint16")],se.prototype,"firstCode"),we([y("uint16")],se.prototype,"entryCount");var fi=Object.defineProperty,xe=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&fi(t,e,s),s};const ne=class cn extends Mt{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=ps(t),r=new cn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(s=>{r.view.writeUint32(s.start),r.view.writeUint32(s.end),r.view.writeUint32(s.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,s=e.length;r<s;r++){const o=e[r];let i=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)t.set(a++,i++)}return t}};xe([y("uint16")],ne.prototype,"format"),xe([y("uint16")],ne.prototype,"reserved"),xe([y("uint32")],ne.prototype,"length"),xe([y("uint32")],ne.prototype,"language"),xe([y("uint32")],ne.prototype,"nGroups");let gs=ne;var pi=Object.defineProperty,dr=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&pi(t,e,s),s};class Ge extends Mt{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 r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,s=e.length;r<s;r++){const{uVSMappings:o}=e[r];o.forEach(i=>{t.set(i.unicodeValue,i.glyphID)})}return t}}dr([y("uint16")],Ge.prototype,"format"),dr([y("uint32")],Ge.prototype,"length"),dr([y("uint32")],Ge.prototype,"numVarSelectorRecords");var ys=Object.defineProperty,di=Object.getOwnPropertyDescriptor,gi=(n,t,e)=>t in n?ys(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,gr=(n,t,e,r)=>{for(var s=r>1?void 0:r?di(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&ys(t,e,s),s},ms=(n,t,e)=>(gi(n,typeof t!="symbol"?t+"":t,e),e);let ve=class extends pt{constructor(){super(...arguments),ms(this,"_unicodeToGlyphIndexMap"),ms(this,"_glyphIndexToUnicodesMap")}static from(n){const t=Array.from(n.keys()).some(c=>c>65535),e=ds.from(n),r=us.from(n),s=t?gs.from(n):void 0,o=4+(s?32:24),i=o+e.view.byteLength,a=i+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:i},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(e.view,o),h.view.writeBytes(r.view,i),s&&h.view.writeBytes(s.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const n=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,s=e.length;r<s;r++){const o=e[r],i=t.get(o);n.has(i)?n.get(i).push(o):n.set(i,[o])}this._glyphIndexToUnicodesMap=n}return this._glyphIndexToUnicodesMap}readSubtables(){const n=this.numberSubtables;return this.view.seek(4),Array.from({length:n},()=>({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 r;switch(e){case 0:r=new us(this.view.buffer,t.offset);break;case 2:r=new qe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new ds(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new se(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new gs(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ge(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var i,a,l,h,c;const n=this.readSubtables(),t=(i=n.find(u=>u.format===0))==null?void 0:i.view,e=(a=n.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=n.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,s=(h=n.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,o=(c=n.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(e==null?void 0:e.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}};gr([y("uint16")],ve.prototype,"version",2),gr([y("uint16")],ve.prototype,"numberSubtables",2),ve=gr([ft("cmap")],ve);class yi extends rs{_parseContours(t){const e=[];let r=[];for(let s=0;s<t.length;s+=1){const o=t[s];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return pe(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let s=0;s<t.length;s+=1){const o=t[s],i={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};r.push(i)}return r}_parseGlyphCoordinate(t,e,r,s,o){let i;return(e&s)>0?(i=t.view.readUint8(),e&o||(i=-i),i=r+i):(e&o)>0?i=r:i=r+t.view.readInt16(),i}parse(t,e,r){t.view.seek(e);const s=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(),s>0){const a=this.endPointIndices=[];for(let m=0;m<s;m++)a.push(t.view.readUint16());const l=this.instructionLength=t.view.readUint16();pe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;pe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let p,g=0;for(;g<u;)if(p=t.view.readUint8(),f.push(p),g++,p&8&&g<u){const m=t.view.readUint8();for(let d=0;d<m;d++)f.push(p),g++}if(pe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const m=[];let d;if(u>0){for(let S=0;S<u;S+=1)p=f[S],d={},d.onCurve=!!(p&1),d.lastPointOfContour=a.includes(S),m.push(d);let _=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.x=this._parseGlyphCoordinate(t,p,_,2,16),_=d.x;let C=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.y=this._parseGlyphCoordinate(t,p,C,4,32),C=d.y}this.points=m}else this.points=[]}else if(s===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=t.view.readUint16();const h={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=t.view.readInt16(),h.dy=t.view.readInt16()):h.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(h.dx=t.view.readInt8(),h.dy=t.view.readInt8()):h.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?h.xScale=h.yScale=t.view.readInt16()/16384:(a&64)>0?(h.xScale=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384):(a&128)>0&&(h.xScale=t.view.readInt16()/16384,h.scale01=t.view.readInt16()/16384,h.scale10=t.view.readInt16()/16384,h.yScale=t.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=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],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{pe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],p)[0],p.dx=u.x-f.x,p.dy=u.y-f.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const o=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,p=h.length;f<p;++f)if(c=u,u=h[(f+1)%p],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let g=u;u.onCurve||(g={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}o.push({type:"Z"})}this.pathCommands=o}}class mi extends ss{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],s=new yi({index:t});return r!==e[t+1]&&s.parse(this._sfnt.glyf,r,this),s}}var ws=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,xi=(n,t,e)=>t in n?ws(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,vi=(n,t,e,r)=>{for(var s=r>1?void 0:r?wi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&ws(t,e,s),s},bi=(n,t,e)=>(xi(n,t+"",e),e);let yr=class extends pt{constructor(){super(...arguments),bi(this,"_glyphs")}static from(n){const t=n.reduce((r,s)=>r+s.byteLength,0),e=new yr(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new mi(this._sfnt))}};yr=vi([ft("glyf")],yr);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Ci=(n,t,e,r)=>{for(var s=r>1?void 0:r?Pi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Si(t,e,s),s};let xs=class extends pt{};xs=Ci([ft("GPOS","gpos")],xs);var _i=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,Yt=(n,t,e,r)=>{for(var s=r>1?void 0:r?Mi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&_i(t,e,s),s};let Vt=class extends pt{};Yt([y("uint16")],Vt.prototype,"majorVersion",2),Yt([y("uint16")],Vt.prototype,"minorVersion",2),Yt([y("uint16")],Vt.prototype,"scriptListOffset",2),Yt([y("uint16")],Vt.prototype,"featureListOffset",2),Yt([y("uint16")],Vt.prototype,"lookupListOffset",2),Yt([y("uint16")],Vt.prototype,"featureVariationsOffset",2),Vt=Yt([ft("GSUB","gsub")],Vt);var Ti=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,it=(n,t,e,r)=>{for(var s=r>1?void 0:r?Oi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Ti(t,e,s),s};let rt=class extends pt{constructor(n=new ArrayBuffer(54),t){super(n,t,Math.min(54,n.byteLength-(t??0)))}};it([y("fixed")],rt.prototype,"version",2),it([y("fixed")],rt.prototype,"fontRevision",2),it([y("uint32")],rt.prototype,"checkSumAdjustment",2),it([y("uint32")],rt.prototype,"magickNumber",2),it([y("uint16")],rt.prototype,"flags",2),it([y("uint16")],rt.prototype,"unitsPerEm",2),it([y({type:"longDateTime"})],rt.prototype,"created",2),it([y({type:"longDateTime"})],rt.prototype,"modified",2),it([y("int16")],rt.prototype,"xMin",2),it([y("int16")],rt.prototype,"yMin",2),it([y("int16")],rt.prototype,"xMax",2),it([y("int16")],rt.prototype,"yMax",2),it([y("uint16")],rt.prototype,"macStyle",2),it([y("uint16")],rt.prototype,"lowestRecPPEM",2),it([y("int16")],rt.prototype,"fontDirectionHint",2),it([y("int16")],rt.prototype,"indexToLocFormat",2),it([y("int16")],rt.prototype,"glyphDataFormat",2),rt=it([ft("head")],rt);var Ai=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,xt=(n,t,e,r)=>{for(var s=r>1?void 0:r?Ii(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Ai(t,e,s),s};let dt=class extends pt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};xt([y("fixed")],dt.prototype,"version",2),xt([y("int16")],dt.prototype,"ascent",2),xt([y("int16")],dt.prototype,"descent",2),xt([y("int16")],dt.prototype,"lineGap",2),xt([y("uint16")],dt.prototype,"advanceWidthMax",2),xt([y("int16")],dt.prototype,"minLeftSideBearing",2),xt([y("int16")],dt.prototype,"minRightSideBearing",2),xt([y("int16")],dt.prototype,"xMaxExtent",2),xt([y("int16")],dt.prototype,"caretSlopeRise",2),xt([y("int16")],dt.prototype,"caretSlopeRun",2),xt([y("int16")],dt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],dt.prototype,"reserved",2),xt([y("int16")],dt.prototype,"metricDataFormat",2),xt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=xt([ft("hhea")],dt);var vs=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Bi=(n,t,e)=>t in n?vs(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ei=(n,t,e,r)=>{for(var s=r>1?void 0:r?$i(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&vs(t,e,s),s},Ui=(n,t,e)=>(Bi(n,t+"",e),e);let mr=class extends pt{constructor(){super(...arguments),Ui(this,"_metrics")}static from(n){const t=n.length*4,e=new mr(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:n}).map((s,o)=>(o<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};mr=Ei([ft("hmtx")],mr);var Di=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Li=(n,t,e,r)=>{for(var s=r>1?void 0:r?ki(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Di(t,e,s),s};let bs=class extends pt{};bs=Li([ft("kern","kern")],bs);var Ss=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,zi=(n,t,e)=>t in n?Ss(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ni=(n,t,e,r)=>{for(var s=r>1?void 0:r?Fi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Ss(t,e,s),s},qi=(n,t,e)=>(zi(n,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),qi(this,"_locations")}static from(n,t=1){const e=n.length*(t?4:2),r=new wr(new ArrayBuffer(e));return n.forEach(s=>{t?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const n=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:n}).map(()=>t?e.readUint32():e.readUint16()*2)}};wr=Ni([ft("loca")],wr);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,gt=(n,t,e,r)=>{for(var s=r>1?void 0:r?Ri(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Gi(t,e,s),s};let at=class extends pt{constructor(n=new ArrayBuffer(32),t){super(n,t,Math.min(32,n.byteLength-(t??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ft("maxp")],at);var Ps=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Vi=(n,t,e)=>t in n?Ps(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Re=(n,t,e,r)=>{for(var s=r>1?void 0:r?Wi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Ps(t,e,s),s},Xi=(n,t,e)=>(Vi(n,t+"",e),e);const Cs={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"},xr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},ji={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},_s={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let be=class extends pt{constructor(){super(...arguments),Xi(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const n=this.count;this.view.seek(6);const t=[];for(let a=0;a<n;++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<n;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=xr.Macintosh,s=ji.Default,o=0;t.some(a=>a.platform===xr.Microsoft&&a.encoding===_s.UCS2&&a.language===1033)&&(r=xr.Microsoft,s=_s.UCS2,o=1033);const i={};for(let a=0;a<n;++a){const l=t[a];l.platform===r&&l.encoding===s&&l.language===o&&Cs[l.nameId]&&(i[Cs[l.nameId]]=o===0?Ln(l.name):Fn(l.name))}return i}};Re([y("uint16")],be.prototype,"format",2),Re([y("uint16")],be.prototype,"count",2),Re([y("uint16")],be.prototype,"stringOffset",2),be=Re([ft("name")],be);var Hi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,$=(n,t,e,r)=>{for(var s=r>1?void 0:r?Yi(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Hi(t,e,s),s};let I=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};$([y("uint16")],I.prototype,"version",2),$([y("int16")],I.prototype,"xAvgCharWidth",2),$([y("uint16")],I.prototype,"usWeightClass",2),$([y("uint16")],I.prototype,"usWidthClass",2),$([y("uint16")],I.prototype,"fsType",2),$([y("uint16")],I.prototype,"ySubscriptXSize",2),$([y("uint16")],I.prototype,"ySubscriptYSize",2),$([y("uint16")],I.prototype,"ySubscriptXOffset",2),$([y("uint16")],I.prototype,"ySubscriptYOffset",2),$([y("uint16")],I.prototype,"ySuperscriptXSize",2),$([y("uint16")],I.prototype,"ySuperscriptYSize",2),$([y("uint16")],I.prototype,"ySuperscriptXOffset",2),$([y("uint16")],I.prototype,"ySuperscriptYOffset",2),$([y("uint16")],I.prototype,"yStrikeoutSize",2),$([y("uint16")],I.prototype,"yStrikeoutPosition",2),$([y("uint16")],I.prototype,"sFamilyClass",2),$([y({type:"uint8"})],I.prototype,"bFamilyType",2),$([y({type:"uint8"})],I.prototype,"bSerifStyle",2),$([y({type:"uint8"})],I.prototype,"bWeight",2),$([y({type:"uint8"})],I.prototype,"bProportion",2),$([y({type:"uint8"})],I.prototype,"bContrast",2),$([y({type:"uint8"})],I.prototype,"bStrokeVariation",2),$([y({type:"uint8"})],I.prototype,"bArmStyle",2),$([y({type:"uint8"})],I.prototype,"bLetterform",2),$([y({type:"uint8"})],I.prototype,"bMidline",2),$([y({type:"uint8"})],I.prototype,"bXHeight",2),$([y({type:"uint8",size:16})],I.prototype,"ulUnicodeRange",2),$([y({type:"char",size:4})],I.prototype,"achVendID",2),$([y("uint16")],I.prototype,"fsSelection",2),$([y("uint16")],I.prototype,"usFirstCharIndex",2),$([y("uint16")],I.prototype,"usLastCharIndex",2),$([y("int16")],I.prototype,"sTypoAscender",2),$([y("int16")],I.prototype,"sTypoDescender",2),$([y("int16")],I.prototype,"sTypoLineGap",2),$([y("uint16")],I.prototype,"usWinAscent",2),$([y("uint16")],I.prototype,"usWinDescent",2),$([y({offset:72,type:"uint8",size:8})],I.prototype,"ulCodePageRange",2),$([y({offset:72,type:"int16"})],I.prototype,"sxHeight",2),$([y("int16")],I.prototype,"sCapHeight",2),$([y("uint16")],I.prototype,"usDefaultChar",2),$([y("uint16")],I.prototype,"usBreakChar",2),$([y("uint16")],I.prototype,"usMaxContext",2),I=$([ft("OS/2","os2")],I);var Zi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Et=(n,t,e,r)=>{for(var s=r>1?void 0:r?Ki(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Zi(t,e,s),s};let At=class extends pt{constructor(n=new ArrayBuffer(32),t,e){super(n,t,e)}};Et([y("fixed")],At.prototype,"format",2),Et([y("fixed")],At.prototype,"italicAngle",2),Et([y("int16")],At.prototype,"underlinePosition",2),Et([y("int16")],At.prototype,"underlineThickness",2),Et([y("uint32")],At.prototype,"isFixedPitch",2),Et([y("uint32")],At.prototype,"minMemType42",2),Et([y("uint32")],At.prototype,"maxMemType42",2),Et([y("uint32")],At.prototype,"minMemType1",2),Et([y("uint32")],At.prototype,"maxMemType1",2),At=Et([ft("post")],At);var Qi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,vt=(n,t,e,r)=>{for(var s=r>1?void 0:r?Ji(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Qi(t,e,s),s};let yt=class extends pt{constructor(n=new ArrayBuffer(36),t){super(n,t,Math.min(36,n.byteLength-(t??0)))}};vt([y("fixed")],yt.prototype,"version",2),vt([y("int16")],yt.prototype,"vertTypoAscender",2),vt([y("int16")],yt.prototype,"vertTypoDescender",2),vt([y("int16")],yt.prototype,"vertTypoLineGap",2),vt([y("int16")],yt.prototype,"advanceHeightMax",2),vt([y("int16")],yt.prototype,"minTopSideBearing",2),vt([y("int16")],yt.prototype,"minBottomSideBearing",2),vt([y("int16")],yt.prototype,"yMaxExtent",2),vt([y("int16")],yt.prototype,"caretSlopeRise",2),vt([y("int16")],yt.prototype,"caretSlopeRun",2),vt([y("int16")],yt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],yt.prototype,"reserved",2),vt([y("int16")],yt.prototype,"metricDataFormat",2),vt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=vt([ft("vhea")],yt);var Ms=Object.defineProperty,to=Object.getOwnPropertyDescriptor,eo=(n,t,e)=>t in n?Ms(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ro=(n,t,e,r)=>{for(var s=r>1?void 0:r?to(t,e):t,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=(r?i(t,e,s):i(s))||s);return r&&s&&Ms(t,e,s),s},so=(n,t,e)=>(eo(n,t+"",e),e);let vr=class extends pt{constructor(){super(...arguments),so(this,"_metrics")}static from(n){const t=n.length*4,e=new vr(new ArrayBuffer(t));return n.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var s;const n=this._sfnt.maxp.numGlyphs,t=((s=this._sfnt.vhea)==null?void 0:s.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:n}).map((o,i)=>(i<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};vr=ro([ft("vmtx")],vr);var Ts=Object.defineProperty,no=(n,t,e)=>t in n?Ts(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Se=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&Ts(t,e,s),s},We=(n,t,e)=>(no(n,typeof t!="symbol"?t+"":t,e),e);class It extends lr{constructor(){super(...arguments),We(this,"format","TrueType"),We(this,"mimeType","font/ttf"),We(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ee(t).getUint32(0))}static checksum(t){const e=ee(t);let r=e.byteLength;for(;r%4;)r++;let s=0;for(let o=0,i=r/4;o<i;o+=4)o*4<r-4&&(s+=e.getUint32(o*4,!1));return s&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,s=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),o=new this(new ArrayBuffer(12+r*16+s));o.scalerType=65536,o.numTables=r;const i=Math.log(2);o.searchRange=Math.floor(Math.log(r)/i)*16,o.entrySelector=Math.floor(o.searchRange/i),o.rangeShift=r*16-o.searchRange;let a=12+r*16,l=0;const h=o.getDirectories();t.tableViews.forEach((u,f)=>{const p=h[l++];p.tag=f,p.checkSum=this.checksum(u),p.offset=a,p.length=u.byteLength,o.view.writeBytes(u,a),a+=e(p.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new de(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ze(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}We(It,"signature",new Set([65536,1953658213,1954115633])),Se([y("uint32")],It.prototype,"scalerType"),Se([y("uint16")],It.prototype,"numTables"),Se([y("uint16")],It.prototype,"searchRange"),Se([y("uint16")],It.prototype,"entrySelector"),Se([y("uint16")],It.prototype,"rangeShift");var io=Object.defineProperty,oo=(n,t,e)=>t in n?io(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,br=(n,t,e)=>(oo(n,typeof t!="symbol"?t+"":t,e),e);class Ve extends It{constructor(){super(...arguments),br(this,"format","OpenType"),br(this,"mimeType","font/otf")}static from(t){return super.from(t)}}br(Ve,"signature",new Set([1330926671]));var ao=Object.defineProperty,Pe=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&ao(t,e,s),s};class ie extends Mt{constructor(t,e){super(t,e,20)}}Pe([y({type:"char",size:4})],ie.prototype,"tag"),Pe([y("uint32")],ie.prototype,"offset"),Pe([y("uint32")],ie.prototype,"compLength"),Pe([y("uint32")],ie.prototype,"origLength"),Pe([y("uint32")],ie.prototype,"origChecksum");var Os=Object.defineProperty,lo=(n,t,e)=>t in n?Os(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_t=(n,t,e,r)=>{for(var s=void 0,o=n.length-1,i;o>=0;o--)(i=n[o])&&(s=i(t,e,s)||s);return s&&Os(t,e,s),s},Xe=(n,t,e)=>(lo(n,typeof t!="symbol"?t+"":t,e),e);const bt=class Lr extends lr{constructor(){super(...arguments),Xe(this,"format","WOFF"),Xe(this,"mimeType","font/woff"),Xe(this,"_sfnt")}get subfontFormat(){return It.is(this.flavor)?"TrueType":Ve.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ee(t).getUint32(0))}static checkSum(t){const e=ee(t),r=e.byteLength,s=Math.floor(r/4);let o=0,i=0;for(;i<s;)o+=e.getUint32(4*i++,!1);let a=r-s*4;if(a){let l=s*4;for(;a>0;)o+=e.getUint8(l)<<a*8,l++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,s=[];t.tableViews.forEach((u,f)=>{const p=ee(_n(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));s.push({tag:f,view:p.byteLength<u.byteLength?p:u,rawView:u})});const o=s.length,i=s.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Lr(new ArrayBuffer(44+20*o+i+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+s.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+o*20,h=0;const c=a.getDirectories();return s.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=Lr.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new ie(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ze(this.getDirectories().reduce((t,e)=>{const r=e.tag,s=this.view.byteOffset+e.offset,o=e.compLength,i=e.origLength,a=s+o;return t[r]=o>=i?new DataView(this.view.buffer,s,o):new DataView(Mn(new Uint8Array(this.view.buffer.slice(s,a))).buffer),t},{}))}};Xe(bt,"signature",new Set([2001684038])),_t([y("uint32")],bt.prototype,"signature"),_t([y("uint32")],bt.prototype,"flavor"),_t([y("uint32")],bt.prototype,"length"),_t([y("uint16")],bt.prototype,"numTables"),_t([y("uint16")],bt.prototype,"reserved"),_t([y("uint32")],bt.prototype,"totalSfntSize"),_t([y("uint16")],bt.prototype,"majorVersion"),_t([y("uint16")],bt.prototype,"minorVersion"),_t([y("uint32")],bt.prototype,"metaOffset"),_t([y("uint32")],bt.prototype,"metaLength"),_t([y("uint32")],bt.prototype,"metaOrigLength"),_t([y("uint32")],bt.prototype,"privOffset"),_t([y("uint32")],bt.prototype,"privLength");let Sr=bt;function ho(n,t=!0){if(It.is(n))return new It(n);if(Ve.is(n))return new Ve(n);if(Sr.is(n))return new Sr(n);if(t)throw new Error("Failed to parseFont")}var co=Object.defineProperty,uo=(n,t,e)=>t in n?co(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ce=(n,t,e)=>(uo(n,typeof t!="symbol"?t+"":t,e),e);const As=class un{constructor(){Ce(this,"fallbackFont"),Ce(this,"loading",new Map),Ce(this,"loaded",new Map),Ce(this,"familyToUrl",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...un.defaultRequestInit,...e,signal:r.signal}).then(s=>s.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${t}";
|
|
3
3
|
src: url(${e});
|
|
4
|
-
}`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:s=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,p)=>{f!==l&&(f.cancel(),this.loading.delete(p))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=u(f);return e.noAdd||this.loaded.set(t.src,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(s&&this.injectFontFace(g,f),o&&this.injectStyleTag(g,a))}),p}}).catch(f=>{if(f instanceof DOMException&&f.message==="The user aborted a request.")return u();throw f}).finally(()=>{this.loading.delete(a)});function h(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function c(f){return h().forEach(p=>{f.familySet.add(p)}),f}function u(f=new ArrayBuffer(0)){let p;function g(){return p||(p=f.byteLength?ho(f,!1):void 0),p}function m(){const d=g();if(d instanceof It||d instanceof Sr)return d.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Ce(As,"defaultRequestInit",{cache:"force-cache"});let fo=As;const po=new fo,go={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pr(n,t){const{fill:e="#000",stroke:r="none",strokeWidth:s=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:p="rgba(0, 0, 0, 0)"}=t;n.fillStyle=e,n.strokeStyle=r,n.lineWidth=s,n.lineCap=o,n.lineJoin=go[i],n.miterLimit=a,n.setLineDash(l),n.lineDashOffset=h,n.shadowOffsetX=c,n.shadowOffsetY=u,n.shadowBlur=f,n.shadowColor=p}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}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 r=-t/180*Math.PI,s=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(s*a-o*i),e.y-(s*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const s=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=s*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const s=this.x-r.x,o=this.y-r.y;return this.x=r.x+(s+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*s),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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,s=t.elements;return this.x=s[0]*e+s[3]*r+s[6],this.y=s[1]*e+s[4]*r+s[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class N{constructor(t=0,e=0,r=0,s=0){this.left=t,this.top=e,this.width=r,this.height=s}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 v((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 N;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((s,o)=>(s.left=Math.min(s.left,o.left),s.top=Math.min(s.top,o.top),s.right=Math.max(s.right,o.right),s.bottom=Math.max(s.bottom,o.bottom),s),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new N(r.left,r.top,r.right-r.left,r.bottom-r.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 N(this.left,this.top,this.width,this.height)}}var yo=Object.defineProperty,mo=(n,t,e)=>t in n?yo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,wo=(n,t,e)=>(mo(n,t+"",e),e);class St{constructor(t=1,e=0,r=0,s=0,o=1,i=0,a=0,l=0,h=1){wo(this,"elements",[]),this.set(t,e,r,s,o,i,a,l,h)}set(t,e,r,s,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=s,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,s=e.elements,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],p=r[5],g=r[8],m=s[0],d=s[3],_=s[6],C=s[1],S=s[4],b=s[7],w=s[2],x=s[5],T=s[8];return o[0]=i*m+a*C+l*w,o[3]=i*d+a*S+l*x,o[6]=i*_+a*b+l*T,o[1]=h*m+c*C+u*w,o[4]=h*d+c*S+u*x,o[7]=h*_+c*b+u*T,o[2]=f*m+p*C+g*w,o[5]=f*d+p*S+g*x,o[8]=f*_+p*b+g*T,this}invert(){const t=this.elements,e=t[0],r=t[1],s=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,p=h*o-i*l,g=e*u+r*f+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(s*h-c*r)*m,t[2]=(a*r-s*i)*m,t[3]=f*m,t[4]=(c*e-s*l)*m,t[5]=(s*o-a*e)*m,t[6]=p*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*m,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(Cr.makeScale(t,e)),this}rotate(t){return this.premultiply(Cr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Cr.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),r=Math.sin(t);return this.set(e,-r,0,r,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 r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Cr=new St;function Is(n,t,e,r){const s=n*e+t*r,o=Math.sqrt(n*n+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,s/o)));return n*r-t*e<0&&(i=-i),i}function xo(n,t,e,r,s,o,i,a){if(t===0||e===0){n.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,p=e*e;const g=c*c,m=u*u,d=g/f+m/p;if(d>1){const V=Math.sqrt(d);t=V*t,e=V*e,f=t*t,p=e*e}const _=f*m+p*g,C=(f*p-_)/_;let S=Math.sqrt(Math.max(0,C));s===o&&(S=-S);const b=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*b-Math.sin(r)*w+(i.x+a.x)/2,T=Math.sin(r)*b+Math.cos(r)*w+(i.y+a.y)/2,M=Is(1,0,(c-b)/t,(u-w)/e),O=Is((c-b)/t,(u-w)/e,(-c-b)/t,(-u-w)/e)%(Math.PI*2);n.ellipse(x,T,t,e,r,M,M+O,o===1)}function oe(n,t){return n-(t-n)}function $s(n,t){const e=new v,r=new v;for(let s=0,o=n.length;s<o;s++){const i=n[s];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=oe(e.x,r.x),l=oe(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),xo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(n,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(d,_,C){const S=new SyntaxError(`Unexpected character "${d}" at index ${_}.`);throw S.partial=C,S}function p(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=n.length;for(let d=0;d<m;d++){if(g=n[d],Array.isArray(t)&&t.includes(u.length%e)&&tt.FLAGS.test(g)){a=1,h=g,p();continue}if(a===0){if(tt.WHITESPACE.test(g))continue;if(tt.DIGIT.test(g)||tt.SIGN.test(g)){a=1,h=g;continue}if(tt.POINT.test(g)){a=2,h=g;continue}tt.COMMA.test(g)&&(l&&f(g,d,u),l=!0)}if(a===1){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.POINT.test(g)){h+=g,a=2;continue}if(tt.EXP.test(g)){a=3;continue}tt.SIGN.test(g)&&h.length===1&&tt.SIGN.test(h[0])&&f(g,d,u)}if(a===2){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.EXP.test(g)){a=3;continue}tt.POINT.test(g)&&h[h.length-1]==="."&&f(g,d,u)}if(a===3){if(tt.DIGIT.test(g)){c+=g;continue}if(tt.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&tt.SIGN.test(c)&&f(g,d,u)}}tt.WHITESPACE.test(g)?(p(),a=0,l=!1):tt.COMMA.test(g)?(p(),a=0,l=!0):tt.SIGN.test(g)?(p(),a=1,h=g):tt.POINT.test(g)?(p(),a=2,h=g):f(g,d,u)}return p(),u}function vo(n){const t={x:0,y:0},e={x:0,y:0};let r="";for(let s=0,o=n.length;s<o;s++){const i=n[s];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const bo=/[a-df-z][^a-df-z]*/gi;function Bs(n){const t=[],e=n.match(bo);if(!e)return t;for(let r=0,s=e.length;r<s;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var So=Object.defineProperty,Po=(n,t,e)=>t in n?So(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_r=(n,t,e)=>(Po(n,typeof t!="symbol"?t+"":t,e),e);class Zt{constructor(){_r(this,"arcLengthDivisions",200),_r(this,"_cacheArcLengths"),_r(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,s=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(s),e.push(o),s=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let s=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=r[s]-i,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,r[s]===i)return s/(o-1);const c=r[s],f=r[s+1]-c,p=(i-c)/f;return(s+p)/(o-1)}getTangent(t,e=new v){const s=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(s)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new v){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 r=0,s=1,o=(r+s)/2;for(;s-r>e;){o=(r+s)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:s=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new N(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return vo(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.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Es(n,t,e,r,s){const o=(r-t)*.5,i=(s-e)*.5,a=n*n,l=n*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*n+e}function Co(n,t){const e=1-n;return e*e*t}function _o(n,t){return 2*(1-n)*n*t}function Mo(n,t){return n*n*t}function Us(n,t,e,r){return Co(n,t)+_o(n,e)+Mo(n,r)}function To(n,t){const e=1-n;return e*e*e*t}function Oo(n,t){const e=1-n;return 3*e*e*n*t}function Ao(n,t){return 3*(1-n)*n*n*t}function Io(n,t){return n*n*n*t}function Ds(n,t,e,r,s){return To(n,t)+Oo(n,e)+Ao(n,r)+Io(n,s)}class $o extends Zt{constructor(t=new v,e=new v,r=new v,s=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=s}getPoint(t,e=new v){const{start:r,startControl:s,endControl:o,end:i}=this;return e.set(Ds(t,r.x,s.x,o.x,i.x),Ds(t,r.y,s.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const s=e*e-4*t*r;if(s<0)return[];const o=Math.sqrt(s),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,s=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(s.x-r.x),6*(o.x-s.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(s.y-r.y),6*(o.y-s.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const p of u)for(let g=0;g<=f;g++){const m=g/f-.5,d=Math.min(1,Math.max(0,p+m)),_=this.getPoint(d);t.x=Math.min(t.x,_.x),t.y=Math.min(t.y,_.y),e.x=Math.max(e.x,_.x),e.y=Math.max(e.y,_.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:s}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:s.x,y:s.y}]}drawTo(t){const{start:e,startControl:r,endControl:s,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,s.x,s.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Bo=new St,ks=new St,Ls=new St,je=new v;class Eo extends Zt{constructor(t=new v,e=1,r=1,s=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=s,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let s=this.endAngle-this.startAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.clockwise&&!o&&(s===r?s=-r:s=s-r);const i=this.startAngle+t*s;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:s,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(s)*Math.cos(a)-r*Math.sin(s)*Math.sin(a),u=h+e*Math.cos(s)*Math.sin(a)+r*Math.sin(s)*Math.cos(a),f=Math.abs(s-o),p=f>Math.PI?1:0,g=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const d=s+Math.PI,_=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),C=h+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:_,y:C},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const d=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),_=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:p,sweepFlag:g,x:d,y:_}]}}drawTo(t){const{center:e,radiusX:r,radiusY:s,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,s,o,i,a,!l),this}matrix(t){return je.set(this.center.x,this.center.y),je.applyMatrix3(t),this.center.x=je.x,this.center.y=je.y,ko(t)?Uo(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:s,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(s*s*h*h+o*o*c*c),f=Math.sqrt(s*s*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Uo(n,t){const e=n.radiusX,r=n.radiusY,s=Math.cos(n.rotation),o=Math.sin(n.rotation),i=new v(e*s,e*o),a=new v(-r*o,r*s),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=Bo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=ks.copy(c).invert(),g=Ls.copy(u).transpose().multiply(u).elements,m=Lo(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(n.radiusX=1/d,n.radiusY=1/_,n.rotation=Math.atan2(m.sn,m.cs),!((n.endAngle-n.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=ks.set(d,0,0,0,_,0,0,0,1),b=Ls.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(b).multiply(c),x=T=>{const{x:M,y:O}=new v(Math.cos(T),Math.sin(T)).applyMatrix3(w);return Math.atan2(O,M)};n.startAngle=x(n.startAngle),n.endAngle=x(n.endAngle),Fs(t)&&(n.clockwise=!n.clockwise)}}function Do(n,t){const e=zs(t),r=Ns(t);n.radiusX*=e,n.radiusY*=r;const s=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);n.rotation+=s,Fs(t)&&(n.startAngle*=-1,n.endAngle*=-1,n.clockwise=!n.clockwise)}function Fs(n){const t=n.elements;return t[0]*t[4]-t[1]*t[3]<0}function ko(n){const t=n.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=zs(n),s=Ns(n);return Math.abs(e/(r*s))>Number.EPSILON}function zs(n){const t=n.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ns(n){const t=n.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Lo(n,t,e){let r,s,o,i,a;const l=n+e,h=n-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,s=n*a*e-t*a*t):l<0?s=.5*(l-c):(r=.5*c,s=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:s,cs:o,sn:i}}class Mr extends Zt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:s}=this;return t.x=Math.min(t.x,r.x,s.x),t.y=Math.min(t.y,r.y,s.y),e.x=Math.max(e.x,r.x,s.x),e.y=Math.max(e.y,r.y,s.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Fo extends Zt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:s,end:o}=this;return e.set(Us(t,r.x,s.x,o.x),Us(t,r.y,s.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:s,end:o}=this,i=.5*(r.x+s.x),a=.5*(r.y+s.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:s}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,s.x,s.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var zo=Object.defineProperty,No=(n,t,e)=>t in n?zo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,qs=(n,t,e)=>(No(n,typeof t!="symbol"?t+"":t,e),e);class qo extends Zt{constructor(t,e,r=1,s=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=s,this.end=o,qs(this,"curves",[]),qs(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,s=this.rx/this.aspectRatio,o=[new v(t-r,e-s),new v(t+r,e-s),new v(t+r,e+s),new v(t-r,e+s)];for(let i=0;i<4;i++)this.curves.push(new Mr(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Go extends Zt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,s=(r.length-1)*t,o=Math.floor(s),i=s-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(Es(i,a.x,l.x,h.x,c.x),Es(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var Ro=Object.defineProperty,Wo=(n,t,e)=>t in n?Ro(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_e=(n,t,e)=>(Wo(n,typeof t!="symbol"?t+"":t,e),e);class Me extends Zt{constructor(t){super(),_e(this,"curves",[]),_e(this,"startPoint"),_e(this,"currentPoint",new v),_e(this,"autoClose",!1),_e(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:s,y:o}=t[e];this.lineTo(s,o)}return this}addCommands(t){return $s(t,this),this}addData(t){return this.addCommands(Bs(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),s=this.getCurveLengths();let o=0;for(;o<s.length;){if(s[o]>=r){const i=s[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,s=this.curves.length;r<s;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let s;for(let o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];s!=null&&s.equals(c)||(e.push(c),s=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Mr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Mr(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,s,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new $o(this.currentPoint.clone(),new v(t,e),new v(r,s),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,s){return this.currentPoint.equals({x:r,y:s})||this.curves.push(new Fo(this.currentPoint.clone(),new v(t,e),new v(r,s))),this._setCurrentPoint({x:r,y:s}),this}arc(t,e,r,s,o,i){return this.ellipse(t,e,r,r,0,s,o,i),this}relativeArc(t,e,r,s,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,s,o,i),this}arcTo(t,e,r,s,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,s,o,i,a,l=!0){const h=new Eo(new v(t,e),r,s,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,s,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,s,o,i,a,l),this}rect(t,e,r,s){return this.curves.push(new qo(new v(t+r/2,e+s/2),r/2,r/s)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Go([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new N(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(s=>s.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Vo(n){return n.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Xo(n,t,e,r){const s=t.clone().sub(n),o=r.clone().sub(e),i=e.clone().sub(n),a=s.cross(o);if(a===0)return new v((n.x+e.x)/2,(n.y+e.y)/2);const l=i.cross(o)/a;return Math.abs(l)>1?new v((n.x+e.x)/2,(n.y+e.y)/2):new v(n.x+l*s.x,n.y+l*s.y)}var jo=Object.defineProperty,Ho=(n,t,e)=>t in n?jo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Tr=(n,t,e)=>(Ho(n,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Tr(this,"currentPath",new Me),Tr(this,"paths",[this.currentPath]),Tr(this,"style"),t&&(t instanceof Pt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t)),this.style=e}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Pt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new Me().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:s}=this.currentPath;return r.equals({x:t,y:e})||(s.length?(this.currentPath=new Me().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,s,o,i){return this.currentPath.bezierCurveTo(t,e,r,s,o,i),this}quadraticCurveTo(t,e,r,s){return this.currentPath.quadraticCurveTo(t,e,r,s),this}arc(t,e,r,s,o,i){return this.currentPath.arc(t,e,r,s,o,i),this}arcTo(t,e,r,s,o){return this.currentPath.arcTo(t,e,r,s,o),this}ellipse(t,e,r,s,o,i,a,l){return this.currentPath.ellipse(t,e,r,s,o,i,a,l),this}rect(t,e,r,s){return this.currentPath.rect(t,e,r,s),this}addCommands(t){return $s(t,this),this}addData(t){return this.addCommands(Bs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(s=>{s.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(s=>{s.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],s=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,s[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=s[l];o[l].forEach(u=>{const f=a.getTForPoint(u),p=a.getNormal(f).scale(h?t:-t);u.add(p)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=Xo(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);f&&(h[h.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=v.MAX,e=v.MIN,r=!0){const s=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&s>1){const i=s/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),p=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(p),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new N(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:s="none"}=e;return t.beginPath(),t.save(),Pr(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:s="none"}=e;return t.beginPath(),t.save(),Pr(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const s in t)t[s]!==void 0&&(e[Vo(s)]=t[s]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const s in e)e[s]!==void 0&&(r+=`${s}:${e[s]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:s}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${s}" width="${r}px" height="${s}px" xmlns="http://www.w3.org/2000/svg">${o}</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,...r}=t,{left:s,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-s,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Or="px",Gs=90,Rs=["mm","cm","in","pt","pc","px"],Ar={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 W(n){let t="px";if(typeof n=="string"||n instanceof String)for(let r=0,s=Rs.length;r<s;r++){const o=Rs[r];if(n.endsWith(o)){t=o,n=n.substring(0,n.length-o.length);break}}let e;return t==="px"&&Or!=="px"?e=Ar.in[Or]/Gs:(e=Ar[t][Or],e<0&&(e=Ar[t].in*Gs)),e*Number.parseFloat(n)}const Yo=new St,He=new St,Ws=new St,Vs=new St;function Zo(n,t,e){if(!(n.hasAttribute("transform")||n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))))return null;const r=Ko(n);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ko(n){const t=new St,e=Yo;if(n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))&&t.translate(W(n.getAttribute("x")),W(n.getAttribute("y"))),n.hasAttribute("transform")){const r=n.getAttribute("transform").split(")");for(let s=r.length-1;s>=0;s--){const o=r[s].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),He.makeTranslation(-u,-f),Ws.makeRotation(c),Vs.multiplyMatrices(Ws,He),He.makeTranslation(u,f),e.multiplyMatrices(He,Vs)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function Qo(n){return new Pt().addPath(new Me().arc(W(n.getAttribute("cx")||0),W(n.getAttribute("cy")||0),W(n.getAttribute("r")||0),0,Math.PI*2))}function Jo(n,t){if(!(!n.sheet||!n.sheet.cssRules||!n.sheet.cssRules.length))for(let e=0;e<n.sheet.cssRules.length;e++){const r=n.sheet.cssRules[e];if(r.type!==1)continue;const s=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<s.length;i++)t[s[i]]=Object.assign(t[s[i]]||{},{...o})}}function ta(n){return new Pt().addPath(new Me().ellipse(W(n.getAttribute("cx")||0),W(n.getAttribute("cy")||0),W(n.getAttribute("rx")||0),W(n.getAttribute("ry")||0),0,0,Math.PI*2))}function ea(n){return new Pt().moveTo(W(n.getAttribute("x1")||0),W(n.getAttribute("y1")||0)).lineTo(W(n.getAttribute("x2")||0),W(n.getAttribute("y2")||0))}function ra(n){const t=new Pt,e=n.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const sa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(n){var r;const t=new Pt;let e=0;return(r=n.getAttribute("points"))==null||r.replace(sa,(s,o,i)=>{const a=W(o),l=W(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,s}),t.currentPath.autoClose=!0,t}const ia=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function oa(n){var r;const t=new Pt;let e=0;return(r=n.getAttribute("points"))==null||r.replace(ia,(s,o,i)=>{const a=W(o),l=W(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,s}),t.currentPath.autoClose=!1,t}function aa(n){const t=W(n.getAttribute("x")||0),e=W(n.getAttribute("y")||0),r=W(n.getAttribute("rx")||n.getAttribute("ry")||0),s=W(n.getAttribute("ry")||n.getAttribute("rx")||0),o=W(n.getAttribute("width")),i=W(n.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||s!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+s*a,t+o,e+s),l.lineTo(t+o,e+i-s),(r!==0||s!==0)&&l.bezierCurveTo(t+o,e+i-s*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||s!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-s*a,t,e+i-s),l.lineTo(t,e+s),(r!==0||s!==0)&&l.bezierCurveTo(t,e+s*a,t+r*a,e,t+r,e),l}function Dt(n,t,e){t=Object.assign({},t);let r={};if(n.hasAttribute("class")){const h=n.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}n.hasAttribute("id")&&(r=Object.assign(r,e[`#${n.getAttribute("id")}`]));for(let h=n.style.length,c=0;c<h;c++){const u=n.style.item(c),f=n.style.getPropertyValue(u);t[u]=f,r[u]=f}function s(h,c,u=o){n.hasAttribute(h)&&(t[c]=u(n.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,W(h)))}function a(h){return Math.max(0,W(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>W(c))}return s("fill","fill"),s("fill-opacity","fillOpacity",i),s("fill-rule","fillRule"),s("opacity","opacity",i),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",i),s("stroke-width","strokeWidth",a),s("stroke-linecap","strokeLinecap"),s("stroke-linejoin","strokeLinejoin"),s("stroke-miterlimit","strokeMiterlimit",a),s("stroke-dasharray","strokeDasharray",l),s("stroke-dashoffset","strokeDashoffset",W),s("visibility","visibility"),t}function Ir(n,t,e=[],r={}){var u;if(n.nodeType!==1)return e;let s=!1,o=null,i={...t};switch(n.nodeName){case"svg":i=Dt(n,i,r);break;case"style":Jo(n,r);break;case"g":i=Dt(n,i,r);break;case"path":i=Dt(n,i,r),n.hasAttribute("d")&&(o=ra(n));break;case"rect":i=Dt(n,i,r),o=aa(n);break;case"polygon":i=Dt(n,i,r),o=na(n);break;case"polyline":i=Dt(n,i,r),o=oa(n);break;case"circle":i=Dt(n,i,r),o=Qo(n);break;case"ellipse":i=Dt(n,i,r),o=ta(n);break;case"line":i=Dt(n,i,r),o=ea(n);break;case"defs":s=!0;break;case"use":{i=Dt(n,i,r);const p=(n.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=n.viewportElement)==null?void 0:u.getElementById(p);g?Ir(g,i,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(n);break}if(i.display==="none")return e;Object.assign(t,i);const a=new St,l=[],h=Zo(n,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=n.childNodes;for(let f=0,p=c.length;f<p;f++){const g=c[f];s&&g.nodeName!=="style"&&g.nodeName!=="defs"||Ir(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Xs="data:image/svg+xml;",js=`${Xs}base64,`,Hs=`${Xs}charset=utf8,`;function Ys(n){if(typeof n=="string"){let t;return n.startsWith(js)?(n=n.substring(js.length,n.length),t=atob(n)):n.startsWith(Hs)?(n=n.substring(Hs.length,n.length),t=decodeURIComponent(n)):t=n,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return n}function Zs(n){return Ir(Ys(n),{})}function Te(n,t=!0){if(!n.length)return;const e=v.MAX,r=v.MIN;return n.forEach(s=>s.getMinMax(e,r,t)),new N(e.x,e.y,r.x-e.x,r.y-e.y)}const la=new Set(["©","®","÷"]),ha=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ca={1:"italic",32:"bold"},ua={1:"italic",2:"bold"},Ks={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qs{constructor(t,e,r){B(this,"path",new Pt);B(this,"lineBox",new N);B(this,"inlineBox",new N);B(this,"glyphBox");B(this,"advanceWidth",0);B(this,"advanceHeight",0);B(this,"underlinePosition",0);B(this,"underlineThickness",0);B(this,"strikeoutPosition",0);B(this,"strikeoutSize",0);B(this,"ascender",0);B(this,"descender",0);B(this,"typoAscender",0);B(this,"typoDescender",0);B(this,"typoLineGap",0);B(this,"winAscent",0);B(this,"winDescent",0);B(this,"xHeight",0);B(this,"capHeight",0);B(this,"baseline",0);B(this,"centerDiviation",0);B(this,"fontStyle");this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}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,r=t??po,s=e?r.get(e):r.fallbackFont;return s==null?void 0:s.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:s,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,p=i/f,g=t.getAdvanceWidth(h,f),m=(a+Math.abs(l))/p,d=a/p;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=u?m:g,this.inlineBox.height=u?g:m,this.underlinePosition=(a-s.underlinePosition)/p,this.underlineThickness=s.underlineThickness/p,this.strikeoutPosition=(a-r.yStrikeoutPosition)/p,this.strikeoutSize=r.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=r.sTypoAscender/p,this.typoDescender=r.sTypoDescender/p,this.typoLineGap=r.sTypoLineGap/p,this.winAscent=r.usWinAscent/p,this.winDescent=r.usWinDescent/p,this.xHeight=r.sxHeight/p,this.capHeight=r.sCapHeight/p,this.baseline=d,this.centerDiviation=m/2-d,this.fontStyle=ca[r.fsSelection]??ua[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:s,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:p}=this,{left:g,top:m}=a,d=o.fontStyle==="italic"&&u!=="italic";let _=g,C=m+i,S;const b=new Pt;if(r&&(_+=(p-f)/2,Math.abs(f-p)>.1&&(C-=(l-c)/(l+Math.abs(h))*p),S=void 0),r&&!la.has(s)&&(s.codePointAt(0)<=256||ha.has(s))){b.addCommands(e.getPathCommands(s,_,m+i-(p-f)/2,o.fontSize));const x={y:m-(p-f)/2+p/2,x:_+f/2};d&&this._italic(b,r?{x:x.x,y:m-(p-f)/2+i}:void 0),b.rotate(90,x)}else S!==void 0?(b.addCommands(e.glyphs.get(S).getPathCommands(_,C,o.fontSize)),d&&this._italic(b,r?{x:_+f/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(b.addCommands(e.getPathCommands(s,_,C,o.fontSize)),d&&this._italic(b,r?{x:_+p/2,y:C}:void 0));const w=o.fontWeight??400;return w in Ks&&(w===700||w==="bold")&&u!=="bold"&&b.bold(Ks[w]*o.fontSize*.05),b.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=b,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,r){var s;if((s=this.path.paths[0])!=null&&s.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:s}=e;return new N(r.x,r.y,s.x-r.x,s.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,s={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)te(s);else{t.save(),t.beginPath();const o=this.path.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*s.fontSize:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*s.fontSize,shadowOffsetY:(s.shadowOffsetY??0)*s.fontSize,shadowBlur:(s.shadowBlur??0)*s.fontSize,shadowColor:s.shadowColor};Pr(t,i),t.font=`${s.fontSize}px ${s.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 Ye(n,t){return typeof n=="number"?n:n.endsWith("%")?(n=n.substring(0,n.length-1),Math.ceil(Number(n)/100*t.total)):n.endsWith("rem")?(n=n.substring(0,n.length-3),Number(n)*t.fontSize):n.endsWith("em")?(n=n.substring(0,n.length-2),Number(n)*t.fontSize):Number(n)}function $r(n){const t=Nt(n)?{}:n;return Object.keys(t).reduce((e,r)=>{let s=t[r];const o=Br(r),i=Br(s);return o&&(r=o),i&&(s=i),e[r]=s,e},{})}function Nt(n){return!n||n==="none"}function Js(n,t){const e=Object.keys(n),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>Kt(n[o],t[o]))}function Kt(n,t){const e=typeof n;return e===typeof t?e==="object"?Js(n,t):n===t:!1}function Br(n){const t=n.startsWith("#")?n.slice(1):n;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,s=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),i=Number.parseInt(r.slice(4,6),16);return`rgb(${s}, ${o}, ${i})`}function Ze(n){if(!n)return n;const t={};for(const e in n)n[e]!==""&&n[e]!==void 0&&(t[e]=n[e]);return t}function Ke(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}class tn{constructor(t,e={},r){B(this,"inlineBox",new N);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}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,...Ze(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qs(r,e++,this));return this.characters=t,this}}class ae{constructor(t,e){B(this,"lineBox",new N);B(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ze(this.parentStyle),...Ze(this.style)},this}addFragment(t,e){const r=new tn(t,e,this);return this.fragments.push(r),r}}function fa(n){return n}class en{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createParagraphDom(t,e){const r=document.createDocumentFragment(),s=document.createElement("section");Object.assign(s.style,{width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(e),position:"fixed",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),a.appendChild(h)}),o.appendChild(a)}),s.appendChild(o),r.appendChild(s),document.body.appendChild(r),{dom:s,destory:()=>{var i;return(i=s.parentNode)==null?void 0:i.removeChild(s)}}}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let s=0;return Array.from(r).map(o=>{var u;const i=s+=r.substring(s).indexOf(o),a=i+o.length;s+=o.length,e.setStart(t,Math.max(i,0)),e.setEnd(t,a);const l=((u=e.getClientRects)==null?void 0:u.call(e))??[e.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=e.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(t){const e=[],r=[],s=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let u=0;l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(f=>{s.push({...f,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(p=>{s.push({...p,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:s}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),s=this.measureDom(e);s.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),s.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return s.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=t[l].fragments[h].characters[c],{fontHeight:f,isVertical:p}=u,g=o[i];u.inlineBox.left=g.left,u.inlineBox.top=g.top,u.inlineBox.width=g.width,u.inlineBox.height=g.height,p?(u.lineBox.left=g.left+(g.width-f)/2,u.lineBox.top=g.top,u.lineBox.width=f,u.lineBox.height=g.height):(u.lineBox.left=g.left,u.lineBox.top=g.top+(g.height-f)/2,u.lineBox.width=g.width,u.lineBox.height=f),i++}),{paragraphs:t,boundingBox:new N(0,0,r.width,r.height)}}measure(t,e,r){let s;r||({dom:r,destory:s}=this.createParagraphDom(t,e));const o=this.measureParagraphDom(t,r);return s==null||s(),o}}class pa{constructor(){B(this,"eventListeners",new Map)}addEventListener(t,e,r){const s={value:e,options:r},o=this.eventListeners.get(t);return o?Array.isArray(o)?o.push(s):this.eventListeners.set(t,[o,s]):this.eventListeners.set(t,s),this}removeEventListener(t,e,r){var o,i;if(!e)return this.eventListeners.delete(t),this;const s=this.eventListeners.get(t);if(!s)return this;if(Array.isArray(s)){const a=[];for(let l=0,h=s.length;l<h;l++){const c=s[l];(c.value!==e||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((o=c.options)!=null&&o.once)))&&a.push(c)}a.length?this.eventListeners.set(t,a.length===1?a[0]:a):this.eventListeners.delete(t)}else s.value===e&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof s.options=="boolean"||(i=s.options)!=null&&i.once)&&this.eventListeners.delete(t);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(t){return this.eventListeners.has(t)}dispatchEvent(t,e){var s,o;const r=this.eventListeners.get(t);if(r){if(Array.isArray(r))for(let i=r.length,a=0;a<i;a++){const l=r[a];typeof l.options=="object"&&((s=l.options)!=null&&s.once)&&this.off(t,l.value,l.options),l.value.apply(this,[e])}else typeof r.options=="object"&&((o=r.options)!=null&&o.once)&&this.off(t,r.value,r.options),r.value.apply(this,[e]);return!0}else return!1}on(t,e,r){return this.addEventListener(t,e,r)}once(t,e){return this.addEventListener(t,e,{once:!0})}off(t,e,r){return this.removeEventListener(t,e,r)}emit(t,e){this.dispatchEvent(t,e)}}function rn(){const n=[],t=[],e=new Map,r=new Map;async function s(i){if(!e.has(i)){e.set(i,i);try{e.set(i,await fetch(i).then(a=>a.text()))}catch(a){console.warn(a),e.delete(i)}}}function o(i){let a=r.get(i);if(!a){const l=Ys(Ke(i)?e.get(i)??i:i),h=Zs(l);a={dom:l,paths:h},r.set(i,a)}return a}return{name:"highlight",paths:n,load:async i=>{const a=[];i.forEachCharacter(l=>{const{computedStyle:h}=l,{highlightImage:c,highlightReferImage:u}=h;Ke(c)&&a.push(s(c)),Ke(u)&&a.push(s(u))}),await Promise.all(a)},update:i=>{t.length=0,n.length=0;let a=[],l,h;i.forEachCharacter(c=>{const{computedStyle:u}=c,{highlightImage:f}=u;if(Nt(f))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:p,isVertical:g}=c,{fontSize:m,highlightColormap:d,highlightLine:_,highlightSize:C,highlightThickness:S}=u;(!h||Kt(h.highlightImage,f)&&Kt(h.highlightColormap,d)&&Kt(h.highlightLine,_)&&Kt(h.highlightSize,C)&&Kt(h.highlightThickness,S))&&(l!=null&&l.length)&&(g?l[0].inlineBox.left===p.left:l[0].inlineBox.top===p.top)&&l[0].fontSize===m?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const u=a[c],f=u[0],p=N.from(...u.filter(D=>D.glyphBox).map(D=>D.glyphBox)),{computedStyle:g}=f,{fontSize:m,writingMode:d,highlightImage:_,highlightReferImage:C,highlightColormap:S,highlightLine:b,highlightSize:w,highlightThickness:x}=g,T=d.includes("vertical"),M=Ye(x,{fontSize:m,total:p.width})/p.width,O=$r(S),{paths:V,dom:H}=o(_),E=Te(V,!0),et=m/E.width*2,P=new N().copy(p);T&&(P.width=p.height,P.height=p.width,P.left=p.left+p.width);const F=Math.floor(P.width);let q=F;if(w!=="cover"&&(q=Ye(w,{fontSize:m,total:p.width}),P.width=q),!Nt(C)&&Nt(b)){const D=Te(o(C).paths,!0);E.copy(D)}else{let D;if(Nt(b))if(E.width/E.height>4){D="underline";const L=H.getAttribute("viewBox");if(L){const[st,A,Z,R]=L.split(" ").map(k=>Number(k)),G=A+R/2;E.y<G&&E.y+E.height>G?D="line-through":E.y+E.height<G?D="overline":D="underline"}}else D="outline";else D=b;switch(D){case"outline":{const L=P.width*.2,st=P.height*.2;P.width+=L,P.height+=st,T?(P.x-=st/2,P.y-=L/2,P.x+=P.height):(P.x-=L/2,P.y-=st/2);break}case"overline":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width:P.y=f.inlineBox.top;break;case"line-through":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width-f.strikeoutPosition+P.height/2:P.y=f.inlineBox.top+f.strikeoutPosition-P.height/2;break;case"underline":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width-f.underlinePosition:P.y=f.inlineBox.top+f.underlinePosition;break}}const z=new St().translate(-E.x,-E.y).scale(P.width/E.width,P.height/E.height);T&&z.rotate(-Math.PI/2),z.translate(P.x,P.y);for(let D=0;D<Math.ceil(F/q);D++){const L=z.clone();T?L.translate(0,D*P.width):L.translate(D*P.width,0),V.forEach(st=>{const A=st.clone().matrix(L);A.style.strokeWidth&&(A.style.strokeWidth*=et*M),A.style.strokeMiterlimit&&(A.style.strokeMiterlimit*=et),A.style.strokeDashoffset&&(A.style.strokeDashoffset*=et),A.style.strokeDasharray&&(A.style.strokeDasharray=A.style.strokeDasharray.map(Z=>Z*et)),A.style.fill&&A.style.fill in O&&(A.style.fill=O[A.style.fill]),A.style.stroke&&A.style.stroke in O&&(A.style.stroke=O[A.style.stroke]),n.push(A),F!==q&&(T?t[n.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):t[n.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(i,a)=>{n.forEach((l,h)=>{if(te({ctx:i,path:l,fontSize:a.computedStyle.fontSize,clipRect:t[h]}),a.debug){const c=Te([l]);c&&i.strokeRect(c.x,c.y,c.width,c.height)}})}}}function sn(){const n=[];return{name:"listStyle",paths:n,update:t=>{n.length=0;const{paragraphs:e,isVertical:r,fontSize:s}=t,o=s*.45;e.forEach(i=>{const{computedStyle:a}=i,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,p=$r(c);let g=u,m;if(!Nt(h))m=h;else if(!Nt(f)){const b=s*.38/2;switch(g=g==="cover"?b*2:g,f){case"disc":m=`<svg width="${b*2}" height="${b*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;return t&&(e=this.loaded.get(this.familyToUrl.get(t)??t)),e??this.fallbackFont}set(t,e){return this.familyToUrl.set(t,e.src),this.loaded.set(e.src,e),this}delete(t){const e=this.familyToUrl.get(t)??t;return this.familyToUrl.delete(e),this.loaded.delete(e),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(t,e={}){const{cancelOther:r,injectFontFace:s=!0,injectStyleTag:o=!0,...i}=e,{src:a}=t;if(this.loaded.has(a))return r&&(this.loading.forEach(f=>f.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,i),this.loading.set(a,l)),r&&this.loading.forEach((f,p)=>{f!==l&&(f.cancel(),this.loading.delete(p))}),l.when.then(f=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=u(f);return e.noAdd||this.loaded.set(t.src,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(s&&this.injectFontFace(g,f),o&&this.injectStyleTag(g,a))}),p}}).catch(f=>{if(f instanceof DOMException&&f.message==="The user aborted a request.")return u();throw f}).finally(()=>{this.loading.delete(a)});function h(){return t.family?Array.isArray(t.family)?t.family:[t.family]:[]}function c(f){return h().forEach(p=>{f.familySet.add(p)}),f}function u(f=new ArrayBuffer(0)){let p;function g(){return p||(p=f.byteLength?ho(f,!1):void 0),p}function m(){const d=g();if(d instanceof It||d instanceof Sr)return d.sfnt}return{...t,buffer:f,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(t=>t.when))}};Ce(As,"defaultRequestInit",{cache:"force-cache"});let fo=As;const po=new fo,go={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Pr(n,t){const{fill:e="#000",stroke:r="none",strokeWidth:s=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:p="rgba(0, 0, 0, 0)"}=t;n.fillStyle=e,n.strokeStyle=r,n.lineWidth=s,n.lineCap=o,n.lineJoin=go[i],n.miterLimit=a,n.setLineDash(l),n.lineDashOffset=h,n.shadowOffsetX=c,n.shadowOffsetY=u,n.shadowBlur=f,n.shadowColor=p}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-1/0,-1/0)}get array(){return[this.x,this.y]}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 r=-t/180*Math.PI,s=this.x-e.x,o=-(this.y-e.y),i=Math.sin(r),a=Math.cos(r);return this.set(e.x+(s*a-o*i),e.y-(s*i+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const s=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=s*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const s=this.x-r.x,o=this.y-r.y;return this.x=r.x+(s+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*s),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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,s=t.elements;return this.x=s[0]*e+s[3]*r+s[6],this.y=s[1]*e+s[4]*r+s[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class N{constructor(t=0,e=0,r=0,s=0){this.left=t,this.top=e,this.width=r,this.height=s}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 v((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 N;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((s,o)=>(s.left=Math.min(s.left,o.left),s.top=Math.min(s.top,o.top),s.right=Math.max(s.right,o.right),s.bottom=Math.max(s.bottom,o.bottom),s),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new N(r.left,r.top,r.right-r.left,r.bottom-r.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 N(this.left,this.top,this.width,this.height)}}var yo=Object.defineProperty,mo=(n,t,e)=>t in n?yo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,wo=(n,t,e)=>(mo(n,t+"",e),e);class St{constructor(t=1,e=0,r=0,s=0,o=1,i=0,a=0,l=0,h=1){wo(this,"elements",[]),this.set(t,e,r,s,o,i,a,l,h)}set(t,e,r,s,o,i,a,l,h){const c=this.elements;return c[0]=t,c[1]=s,c[2]=a,c[3]=e,c[4]=o,c[5]=l,c[6]=r,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,s=e.elements,o=this.elements,i=r[0],a=r[3],l=r[6],h=r[1],c=r[4],u=r[7],f=r[2],p=r[5],g=r[8],m=s[0],d=s[3],_=s[6],C=s[1],S=s[4],b=s[7],w=s[2],x=s[5],T=s[8];return o[0]=i*m+a*C+l*w,o[3]=i*d+a*S+l*x,o[6]=i*_+a*b+l*T,o[1]=h*m+c*C+u*w,o[4]=h*d+c*S+u*x,o[7]=h*_+c*b+u*T,o[2]=f*m+p*C+g*w,o[5]=f*d+p*S+g*x,o[8]=f*_+p*b+g*T,this}invert(){const t=this.elements,e=t[0],r=t[1],s=t[2],o=t[3],i=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*i-a*h,f=a*l-c*o,p=h*o-i*l,g=e*u+r*f+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(s*h-c*r)*m,t[2]=(a*r-s*i)*m,t[3]=f*m,t[4]=(c*e-s*l)*m,t[5]=(s*o-a*e)*m,t[6]=p*m,t[7]=(r*l-h*e)*m,t[8]=(i*e-r*o)*m,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(Cr.makeScale(t,e)),this}rotate(t){return this.premultiply(Cr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Cr.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),r=Math.sin(t);return this.set(e,-r,0,r,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 r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Cr=new St;function Is(n,t,e,r){const s=n*e+t*r,o=Math.sqrt(n*n+t*t)*Math.sqrt(e*e+r*r);let i=Math.acos(Math.max(-1,Math.min(1,s/o)));return n*r-t*e<0&&(i=-i),i}function xo(n,t,e,r,s,o,i,a){if(t===0||e===0){n.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,u=-Math.sin(r)*l+Math.cos(r)*h;let f=t*t,p=e*e;const g=c*c,m=u*u,d=g/f+m/p;if(d>1){const V=Math.sqrt(d);t=V*t,e=V*e,f=t*t,p=e*e}const _=f*m+p*g,C=(f*p-_)/_;let S=Math.sqrt(Math.max(0,C));s===o&&(S=-S);const b=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*b-Math.sin(r)*w+(i.x+a.x)/2,T=Math.sin(r)*b+Math.cos(r)*w+(i.y+a.y)/2,M=Is(1,0,(c-b)/t,(u-w)/e),O=Is((c-b)/t,(u-w)/e,(-c-b)/t,(-u-w)/e)%(Math.PI*2);n.ellipse(x,T,t,e,r,M,M+O,o===1)}function oe(n,t){return n-(t-n)}function $s(n,t){const e=new v,r=new v;for(let s=0,o=n.length;s<o;s++){const i=n[s];if(i.type==="m"||i.type==="M")i.type==="m"?e.add(i):e.copy(i),t.moveTo(e.x,e.y),r.copy(e);else if(i.type==="h"||i.type==="H")i.type==="h"?e.x+=i.x:e.x=i.x,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="v"||i.type==="V")i.type==="v"?e.y+=i.y:e.y=i.y,t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="l"||i.type==="L")i.type==="l"?e.add(i):e.copy(i),t.lineTo(e.x,e.y),r.copy(e);else if(i.type==="c"||i.type==="C")i.type==="c"?(t.bezierCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),e.x+i.x2,e.y+i.y2,e.x+i.x,e.y+i.y),r.x=e.x+i.x2,r.y=e.y+i.y2,e.add(i)):(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),i.x2,i.y2,i.x,i.y),r.x=i.x2,r.y=i.y2,e.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(t.quadraticCurveTo(e.x+i.x1,e.y+i.y1,e.x+i.x,e.y+i.y),r.x=e.x+i.x1,r.y=e.y+i.y1,e.add(i)):(t.quadraticCurveTo(i.x1,i.y1,i.x,i.y),r.x=i.x1,r.y=i.y1,e.copy(i));else if(i.type==="t"||i.type==="T"){const a=oe(e.x,r.x),l=oe(e.y,r.y);r.x=a,r.y=l,i.type==="t"?(t.quadraticCurveTo(a,l,e.x+i.x,e.y+i.y),e.add(i)):(t.quadraticCurveTo(a,l,i.x,i.y),e.copy(i))}else if(i.type==="a"||i.type==="A"){const a=e.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;e.add(i)}else{if(e.equals(i))continue;e.copy(i)}r.copy(e),xo(t,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,e)}else i.type==="z"||i.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",i)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(n,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(d,_,C){const S=new SyntaxError(`Unexpected character "${d}" at index ${_}.`);throw S.partial=C,S}function p(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=n.length;for(let d=0;d<m;d++){if(g=n[d],Array.isArray(t)&&t.includes(u.length%e)&&tt.FLAGS.test(g)){a=1,h=g,p();continue}if(a===0){if(tt.WHITESPACE.test(g))continue;if(tt.DIGIT.test(g)||tt.SIGN.test(g)){a=1,h=g;continue}if(tt.POINT.test(g)){a=2,h=g;continue}tt.COMMA.test(g)&&(l&&f(g,d,u),l=!0)}if(a===1){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.POINT.test(g)){h+=g,a=2;continue}if(tt.EXP.test(g)){a=3;continue}tt.SIGN.test(g)&&h.length===1&&tt.SIGN.test(h[0])&&f(g,d,u)}if(a===2){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.EXP.test(g)){a=3;continue}tt.POINT.test(g)&&h[h.length-1]==="."&&f(g,d,u)}if(a===3){if(tt.DIGIT.test(g)){c+=g;continue}if(tt.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&tt.SIGN.test(c)&&f(g,d,u)}}tt.WHITESPACE.test(g)?(p(),a=0,l=!1):tt.COMMA.test(g)?(p(),a=0,l=!0):tt.SIGN.test(g)?(p(),a=1,h=g):tt.POINT.test(g)?(p(),a=2,h=g):f(g,d,u)}return p(),u}function vo(n){const t={x:0,y:0},e={x:0,y:0};let r="";for(let s=0,o=n.length;s<o;s++){const i=n[s];switch(i.type){case"m":case"M":if(i.x===e.x&&i.y===e.y)continue;r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y,t.x=i.x,t.y=i.y;break;case"h":case"H":r+=`${i.type} ${i.x}`,e.x=i.x;break;case"v":case"V":r+=`${i.type} ${i.y}`,e.y=i.y;break;case"l":case"L":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"c":case"C":r+=`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"s":case"S":r+=`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"q":case"Q":r+=`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"t":case"T":r+=`${i.type} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"a":case"A":r+=`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`,e.x=i.x,e.y=i.y;break;case"z":case"Z":r+=i.type,e.x=t.x,e.y=t.y;break}}return r}const bo=/[a-df-z][^a-df-z]*/gi;function Bs(n){const t=[],e=n.match(bo);if(!e)return t;for(let r=0,s=e.length;r<s;r++){const o=e[r],i=o.charAt(0),a=o.slice(1).trim();let l;switch(i){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:i,x:l[h],y:l[h+1]}):t.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)t.push({type:i,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":t.push({type:i});break;default:console.warn(o)}}return t}var So=Object.defineProperty,Po=(n,t,e)=>t in n?So(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_r=(n,t,e)=>(Po(n,typeof t!="symbol"?t+"":t,e),e);class Zt{constructor(){_r(this,"arcLengthDivisions",200),_r(this,"_cacheArcLengths"),_r(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new v){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,s=this.getPoint(0),o=0;e.push(0);for(let i=1;i<=t;i++)r=this.getPoint(i/t),o+=r.distanceTo(s),e.push(o),s=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let s=0;const o=r.length;let i;e?i=e:i=t*r[o-1];let a=0,l=o-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=r[s]-i,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,r[s]===i)return s/(o-1);const c=r[s],f=r[s+1]-c,p=(i-c)/f;return(s+p)/(o-1)}getTangent(t,e=new v){const s=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(s)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new v){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 r=0,s=1,o=(r+s)/2;for(;s-r>e;){o=(r+s)/2;const i=this.getPoint(o);if(i.distanceTo(t)<e)return o;i.x<t.x?r=o:s=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new N(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return vo(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.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Es(n,t,e,r,s){const o=(r-t)*.5,i=(s-e)*.5,a=n*n,l=n*a;return(2*e-2*r+o+i)*l+(-3*e+3*r-2*o-i)*a+o*n+e}function Co(n,t){const e=1-n;return e*e*t}function _o(n,t){return 2*(1-n)*n*t}function Mo(n,t){return n*n*t}function Us(n,t,e,r){return Co(n,t)+_o(n,e)+Mo(n,r)}function To(n,t){const e=1-n;return e*e*e*t}function Oo(n,t){const e=1-n;return 3*e*e*n*t}function Ao(n,t){return 3*(1-n)*n*n*t}function Io(n,t){return n*n*n*t}function Ds(n,t,e,r,s){return To(n,t)+Oo(n,e)+Ao(n,r)+Io(n,s)}class $o extends Zt{constructor(t=new v,e=new v,r=new v,s=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=s}getPoint(t,e=new v){const{start:r,startControl:s,endControl:o,end:i}=this;return e.set(Ds(t,r.x,s.x,o.x,i.x),Ds(t,r.y,s.y,o.y,i.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const s=e*e-4*t*r;if(s<0)return[];const o=Math.sqrt(s),i=(-e+o)/(2*t),a=(-e-o)/(2*t);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,s=this.startControl,o=this.endControl,i=this.end,a=this._solveQuadratic(3*(s.x-r.x),6*(o.x-s.x),3*(i.x-o.x)),l=this._solveQuadratic(3*(s.y-r.y),6*(o.y-s.y),3*(i.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const p of u)for(let g=0;g<=f;g++){const m=g/f-.5,d=Math.min(1,Math.max(0,p+m)),_=this.getPoint(d);t.x=Math.min(t.x,_.x),t.y=Math.min(t.y,_.y),e.x=Math.max(e.x,_.x),e.y=Math.max(e.y,_.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:s}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:s.x,y:s.y}]}drawTo(t){const{start:e,startControl:r,endControl:s,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,s.x,s.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Bo=new St,ks=new St,Ls=new St,je=new v;class Eo extends Zt{constructor(t=new v,e=1,r=1,s=0,o=0,i=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=s,this.startAngle=o,this.endAngle=i,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let s=this.endAngle-this.startAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.clockwise&&!o&&(s===r?s=-r:s=s-r);const i=this.startAngle+t*s;let a=this.center.x+this.radiusX*Math.cos(i),l=this.center.y+this.radiusY*Math.sin(i);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=l-this.center.y;a=u*h-f*c+this.center.x,l=u*c+f*h+this.center.y}return e.set(a,l)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:s,endAngle:o,clockwise:i,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(s)*Math.cos(a)-r*Math.sin(s)*Math.sin(a),u=h+e*Math.cos(s)*Math.sin(a)+r*Math.sin(s)*Math.cos(a),f=Math.abs(s-o),p=f>Math.PI?1:0,g=i?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const d=s+Math.PI,_=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),C=h+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:_,y:C},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const d=l+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),_=h+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:p,sweepFlag:g,x:d,y:_}]}}drawTo(t){const{center:e,radiusX:r,radiusY:s,rotation:o,startAngle:i,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,s,o,i,a,!l),this}matrix(t){return je.set(this.center.x,this.center.y),je.applyMatrix3(t),this.center.x=je.x,this.center.y=je.y,ko(t)?Uo(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:s,radiusY:o,rotation:i}=this,{x:a,y:l}=r,h=Math.cos(i),c=Math.sin(i),u=Math.sqrt(s*s*h*h+o*o*c*c),f=Math.sqrt(s*s*c*c+o*o*h*h);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,l-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,l+f),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Uo(n,t){const e=n.radiusX,r=n.radiusY,s=Math.cos(n.rotation),o=Math.sin(n.rotation),i=new v(e*s,e*o),a=new v(-r*o,r*s),l=i.applyMatrix3(t),h=a.applyMatrix3(t),c=Bo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=ks.copy(c).invert(),g=Ls.copy(u).transpose().multiply(u).elements,m=Lo(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(n.radiusX=1/d,n.radiusY=1/_,n.rotation=Math.atan2(m.sn,m.cs),!((n.endAngle-n.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=ks.set(d,0,0,0,_,0,0,0,1),b=Ls.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(b).multiply(c),x=T=>{const{x:M,y:O}=new v(Math.cos(T),Math.sin(T)).applyMatrix3(w);return Math.atan2(O,M)};n.startAngle=x(n.startAngle),n.endAngle=x(n.endAngle),Fs(t)&&(n.clockwise=!n.clockwise)}}function Do(n,t){const e=zs(t),r=Ns(t);n.radiusX*=e,n.radiusY*=r;const s=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);n.rotation+=s,Fs(t)&&(n.startAngle*=-1,n.endAngle*=-1,n.clockwise=!n.clockwise)}function Fs(n){const t=n.elements;return t[0]*t[4]-t[1]*t[3]<0}function ko(n){const t=n.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=zs(n),s=Ns(n);return Math.abs(e/(r*s))>Number.EPSILON}function zs(n){const t=n.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ns(n){const t=n.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Lo(n,t,e){let r,s,o,i,a;const l=n+e,h=n-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,s=n*a*e-t*a*t):l<0?s=.5*(l-c):(r=.5*c,s=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,i=1/Math.sqrt(1+a*a),o=a*i):Math.abs(t)===0?(o=1,i=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),i=a*o),h>0&&(a=o,o=-i,i=a),{rt1:r,rt2:s,cs:o,sn:i}}class Mr extends Zt{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,end:s}=this;return t.x=Math.min(t.x,r.x,s.x),t.y=Math.min(t.y,r.y,s.y),e.x=Math.max(e.x,r.x,s.x),e.y=Math.max(e.y,r.y,s.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class Fo extends Zt{constructor(t=new v,e=new v,r=new v){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new v){const{start:r,control:s,end:o}=this;return e.set(Us(t,r.x,s.x,o.x),Us(t,r.y,s.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:s,end:o}=this,i=.5*(r.x+s.x),a=.5*(r.y+s.y),l=.5*(r.x+o.x),h=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,i,l),t.y=Math.min(t.y,r.y,o.y,a,h),e.x=Math.max(e.x,r.x,o.x,i,l),e.y=Math.max(e.y,r.y,o.y,a,h),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:s}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,s.x,s.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var zo=Object.defineProperty,No=(n,t,e)=>t in n?zo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,qs=(n,t,e)=>(No(n,typeof t!="symbol"?t+"":t,e),e);class qo extends Zt{constructor(t,e,r=1,s=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=s,this.end=o,qs(this,"curves",[]),qs(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,s=this.rx/this.aspectRatio,o=[new v(t-r,e-s),new v(t+r,e-s),new v(t+r,e+s),new v(t-r,e+s)];for(let i=0;i<4;i++)this.curves.push(new Mr(o[i].clone(),o[(i+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Go extends Zt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,s=(r.length-1)*t,o=Math.floor(s),i=s-o,a=r[o===0?o:o-1],l=r[o],h=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(Es(i,a.x,l.x,h.x,c.x),Es(i,a.y,l.y,h.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var Ro=Object.defineProperty,Wo=(n,t,e)=>t in n?Ro(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_e=(n,t,e)=>(Wo(n,typeof t!="symbol"?t+"":t,e),e);class Me extends Zt{constructor(t){super(),_e(this,"curves",[]),_e(this,"startPoint"),_e(this,"currentPoint",new v),_e(this,"autoClose",!1),_e(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:s,y:o}=t[e];this.lineTo(s,o)}return this}addCommands(t){return $s(t,this),this}addData(t){return this.addCommands(Bs(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),s=this.getCurveLengths();let o=0;for(;o<s.length;){if(s[o]>=r){const i=s[o]-r,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,s=this.curves.length;r<s;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let s;for(let o=0,i=r.length;o<i;o++){const l=r[o].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];s!=null&&s.equals(c)||(e.push(c),s=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Mr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Mr(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,s,o,i){return this.currentPoint.equals({x:o,y:i})||this.curves.push(new $o(this.currentPoint.clone(),new v(t,e),new v(r,s),new v(o,i))),this._setCurrentPoint({x:o,y:i}),this}quadraticCurveTo(t,e,r,s){return this.currentPoint.equals({x:r,y:s})||this.curves.push(new Fo(this.currentPoint.clone(),new v(t,e),new v(r,s))),this._setCurrentPoint({x:r,y:s}),this}arc(t,e,r,s,o,i){return this.ellipse(t,e,r,r,0,s,o,i),this}relativeArc(t,e,r,s,o,i){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,s,o,i),this}arcTo(t,e,r,s,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,s,o,i,a,l=!0){const h=new Eo(new v(t,e),r,s,o,i,a,!l);if(this.curves.length>0){const c=h.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,e,r,s,o,i,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,s,o,i,a,l),this}rect(t,e,r,s){return this.curves.push(new qo(new v(t+r/2,e+s/2),r/2,r/s)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Go([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new N(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(s=>s.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Vo(n){return n.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Xo(n,t,e,r){const s=t.clone().sub(n),o=r.clone().sub(e),i=e.clone().sub(n),a=s.cross(o);if(a===0)return new v((n.x+e.x)/2,(n.y+e.y)/2);const l=i.cross(o)/a;return Math.abs(l)>1?new v((n.x+e.x)/2,(n.y+e.y)/2):new v(n.x+l*s.x,n.y+l*s.y)}var jo=Object.defineProperty,Ho=(n,t,e)=>t in n?jo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Tr=(n,t,e)=>(Ho(n,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Tr(this,"currentPath",new Me),Tr(this,"paths",[this.currentPath]),Tr(this,"style"),t&&(t instanceof Pt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t)),this.style=e}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Pt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new Me().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:s}=this.currentPath;return r.equals({x:t,y:e})||(s.length?(this.currentPath=new Me().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,s,o,i){return this.currentPath.bezierCurveTo(t,e,r,s,o,i),this}quadraticCurveTo(t,e,r,s){return this.currentPath.quadraticCurveTo(t,e,r,s),this}arc(t,e,r,s,o,i){return this.currentPath.arc(t,e,r,s,o,i),this}arcTo(t,e,r,s,o){return this.currentPath.arcTo(t,e,r,s,o),this}ellipse(t,e,r,s,o,i,a,l){return this.currentPath.ellipse(t,e,r,s,o,i,a,l),this}rect(t,e,r,s){return this.currentPath.rect(t,e,r,s),this}addCommands(t){return $s(t,this),this}addData(t){return this.addCommands(Bs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(s=>{s.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(s=>{s.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],s=[],o=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();o[l]=h,s[l]=c;const u=h[0],f=h[h.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:l})});const i=[];return r.forEach((a,l)=>{i[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&i[l].push(h.index)})}),e.forEach((a,l)=>{const h=s[l];o[l].forEach(u=>{const f=a.getTForPoint(u),p=a.getNormal(f).scale(h?t:-t);u.add(p)})}),i.forEach((a,l)=>{const h=o[l];a.forEach(c=>{const u=o[c],f=Xo(h[h.length-1],h[h.length-2]??h[h.length-1],u[0],u[1]??u[0]);f&&(h[h.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=v.MAX,e=v.MIN,r=!0){const s=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&s>1){const i=s/2,a=o.isClockwise(),l=[];for(let h=0;h<=1;h+=1/o.arcLengthDivisions){const c=o.getPoint(h),u=o.getNormal(h),f=u.clone().scale(a?i:-i),p=u.clone().scale(a?-i:i);l.push(c.clone().add(f),c.clone().add(p),c.clone().add({x:i,y:0}),c.clone().add({x:-i,y:0}),c.clone().add({x:0,y:i}),c.clone().add({x:0,y:-i}),c.clone().add({x:i,y:i}),c.clone().add({x:-i,y:-i}))}t.min(...l),e.max(...l)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new N(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:s="none"}=e;return t.beginPath(),t.save(),Pr(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:s="none"}=e;return t.beginPath(),t.save(),Pr(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const s in t)t[s]!==void 0&&(e[Vo(s)]=t[s]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const s in e)e[s]!==void 0&&(r+=`${s}:${e[s]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:s}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${s}" width="${r}px" height="${s}px" xmlns="http://www.w3.org/2000/svg">${o}</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,...r}=t,{left:s,top:o,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*e,l.height=a*e,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-s,-o),this.drawTo(h,r)),l}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Or="px",Gs=90,Rs=["mm","cm","in","pt","pc","px"],Ar={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 W(n){let t="px";if(typeof n=="string"||n instanceof String)for(let r=0,s=Rs.length;r<s;r++){const o=Rs[r];if(n.endsWith(o)){t=o,n=n.substring(0,n.length-o.length);break}}let e;return t==="px"&&Or!=="px"?e=Ar.in[Or]/Gs:(e=Ar[t][Or],e<0&&(e=Ar[t].in*Gs)),e*Number.parseFloat(n)}const Yo=new St,He=new St,Ws=new St,Vs=new St;function Zo(n,t,e){if(!(n.hasAttribute("transform")||n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))))return null;const r=Ko(n);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ko(n){const t=new St,e=Yo;if(n.nodeName==="use"&&(n.hasAttribute("x")||n.hasAttribute("y"))&&t.translate(W(n.getAttribute("x")),W(n.getAttribute("y"))),n.hasAttribute("transform")){const r=n.getAttribute("transform").split(")");for(let s=r.length-1;s>=0;s--){const o=r[s].trim();if(o==="")continue;const i=o.indexOf("("),a=o.length;if(i>0&&i<a){const l=o.slice(0,i),h=Ut(o.slice(i+1));switch(e.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),e.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),He.makeTranslation(-u,-f),Ws.makeRotation(c),Vs.multiplyMatrices(Ws,He),He.makeTranslation(u,f),e.multiplyMatrices(He,Vs)}break;case"scale":h.length>=1&&e.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&e.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&e.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&e.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}t.premultiply(e)}}return t}function Qo(n){return new Pt().addPath(new Me().arc(W(n.getAttribute("cx")||0),W(n.getAttribute("cy")||0),W(n.getAttribute("r")||0),0,Math.PI*2))}function Jo(n,t){if(!(!n.sheet||!n.sheet.cssRules||!n.sheet.cssRules.length))for(let e=0;e<n.sheet.cssRules.length;e++){const r=n.sheet.cssRules[e];if(r.type!==1)continue;const s=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),o={};for(let i=r.style.length,a=0;a<i;a++){const l=r.style.item(a);o[l]=r.style.getPropertyValue(l)}for(let i=0;i<s.length;i++)t[s[i]]=Object.assign(t[s[i]]||{},{...o})}}function ta(n){return new Pt().addPath(new Me().ellipse(W(n.getAttribute("cx")||0),W(n.getAttribute("cy")||0),W(n.getAttribute("rx")||0),W(n.getAttribute("ry")||0),0,0,Math.PI*2))}function ea(n){return new Pt().moveTo(W(n.getAttribute("x1")||0),W(n.getAttribute("y1")||0)).lineTo(W(n.getAttribute("x2")||0),W(n.getAttribute("y2")||0))}function ra(n){const t=new Pt,e=n.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const sa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(n){var r;const t=new Pt;let e=0;return(r=n.getAttribute("points"))==null||r.replace(sa,(s,o,i)=>{const a=W(o),l=W(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,s}),t.currentPath.autoClose=!0,t}const ia=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function oa(n){var r;const t=new Pt;let e=0;return(r=n.getAttribute("points"))==null||r.replace(ia,(s,o,i)=>{const a=W(o),l=W(i);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,s}),t.currentPath.autoClose=!1,t}function aa(n){const t=W(n.getAttribute("x")||0),e=W(n.getAttribute("y")||0),r=W(n.getAttribute("rx")||n.getAttribute("ry")||0),s=W(n.getAttribute("ry")||n.getAttribute("rx")||0),o=W(n.getAttribute("width")),i=W(n.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+o-r,e),(r!==0||s!==0)&&l.bezierCurveTo(t+o-r*a,e,t+o,e+s*a,t+o,e+s),l.lineTo(t+o,e+i-s),(r!==0||s!==0)&&l.bezierCurveTo(t+o,e+i-s*a,t+o-r*a,e+i,t+o-r,e+i),l.lineTo(t+r,e+i),(r!==0||s!==0)&&l.bezierCurveTo(t+r*a,e+i,t,e+i-s*a,t,e+i-s),l.lineTo(t,e+s),(r!==0||s!==0)&&l.bezierCurveTo(t,e+s*a,t+r*a,e,t+r,e),l}function Dt(n,t,e){t=Object.assign({},t);let r={};if(n.hasAttribute("class")){const h=n.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,e[`.${h[c]}`])}n.hasAttribute("id")&&(r=Object.assign(r,e[`#${n.getAttribute("id")}`]));for(let h=n.style.length,c=0;c<h;c++){const u=n.style.item(c),f=n.style.getPropertyValue(u);t[u]=f,r[u]=f}function s(h,c,u=o){n.hasAttribute(h)&&(t[c]=u(n.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,W(h)))}function a(h){return Math.max(0,W(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>W(c))}return s("fill","fill"),s("fill-opacity","fillOpacity",i),s("fill-rule","fillRule"),s("opacity","opacity",i),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",i),s("stroke-width","strokeWidth",a),s("stroke-linecap","strokeLinecap"),s("stroke-linejoin","strokeLinejoin"),s("stroke-miterlimit","strokeMiterlimit",a),s("stroke-dasharray","strokeDasharray",l),s("stroke-dashoffset","strokeDashoffset",W),s("visibility","visibility"),t}function Ir(n,t,e=[],r={}){var u;if(n.nodeType!==1)return e;let s=!1,o=null,i={...t};switch(n.nodeName){case"svg":i=Dt(n,i,r);break;case"style":Jo(n,r);break;case"g":i=Dt(n,i,r);break;case"path":i=Dt(n,i,r),n.hasAttribute("d")&&(o=ra(n));break;case"rect":i=Dt(n,i,r),o=aa(n);break;case"polygon":i=Dt(n,i,r),o=na(n);break;case"polyline":i=Dt(n,i,r),o=oa(n);break;case"circle":i=Dt(n,i,r),o=Qo(n);break;case"ellipse":i=Dt(n,i,r),o=ta(n);break;case"line":i=Dt(n,i,r),o=ea(n);break;case"defs":s=!0;break;case"use":{i=Dt(n,i,r);const p=(n.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=n.viewportElement)==null?void 0:u.getElementById(p);g?Ir(g,i,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(n);break}if(i.display==="none")return e;Object.assign(t,i);const a=new St,l=[],h=Zo(n,a,l);o&&(o.matrix(a),e.push(o),o.style=t);const c=n.childNodes;for(let f=0,p=c.length;f<p;f++){const g=c[f];s&&g.nodeName!=="style"&&g.nodeName!=="defs"||Ir(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Xs="data:image/svg+xml;",js=`${Xs}base64,`,Hs=`${Xs}charset=utf8,`;function Ys(n){if(typeof n=="string"){let t;return n.startsWith(js)?(n=n.substring(js.length,n.length),t=atob(n)):n.startsWith(Hs)?(n=n.substring(Hs.length,n.length),t=decodeURIComponent(n)):t=n,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return n}function Zs(n){return Ir(Ys(n),{})}function Te(n,t=!0){if(!n.length)return;const e=v.MAX,r=v.MIN;return n.forEach(s=>s.getMinMax(e,r,t)),new N(e.x,e.y,r.x-e.x,r.y-e.y)}const la=new Set(["©","®","÷"]),ha=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ca={1:"italic",32:"bold"},ua={1:"italic",2:"bold"},Ks={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qs{constructor(t,e,r){B(this,"path",new Pt);B(this,"lineBox",new N);B(this,"inlineBox",new N);B(this,"glyphBox");B(this,"advanceWidth",0);B(this,"advanceHeight",0);B(this,"underlinePosition",0);B(this,"underlineThickness",0);B(this,"strikeoutPosition",0);B(this,"strikeoutSize",0);B(this,"ascender",0);B(this,"descender",0);B(this,"typoAscender",0);B(this,"typoDescender",0);B(this,"typoLineGap",0);B(this,"winAscent",0);B(this,"winDescent",0);B(this,"xHeight",0);B(this,"capHeight",0);B(this,"baseline",0);B(this,"centerDiviation",0);B(this,"fontStyle");this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}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,r=t??po,s=e?r.get(e):r.fallbackFont;return s==null?void 0:s.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:s,head:o}=t,i=o.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,p=i/f,g=t.getAdvanceWidth(h,f),m=(a+Math.abs(l))/p,d=a/p;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=u?m:g,this.inlineBox.height=u?g:m,this.underlinePosition=(a-s.underlinePosition)/p,this.underlineThickness=s.underlineThickness/p,this.strikeoutPosition=(a-r.yStrikeoutPosition)/p,this.strikeoutSize=r.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=r.sTypoAscender/p,this.typoDescender=r.sTypoDescender/p,this.typoLineGap=r.sTypoLineGap/p,this.winAscent=r.usWinAscent/p,this.winDescent=r.usWinDescent/p,this.xHeight=r.sxHeight/p,this.capHeight=r.sCapHeight/p,this.baseline=d,this.centerDiviation=m/2-d,this.fontStyle=ca[r.fsSelection]??ua[o.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:s,computedStyle:o,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:p}=this,{left:g,top:m}=a,d=o.fontStyle==="italic"&&u!=="italic";let _=g,C=m+i,S;const b=new Pt;if(r&&(_+=(p-f)/2,Math.abs(f-p)>.1&&(C-=(l-c)/(l+Math.abs(h))*p),S=void 0),r&&!la.has(s)&&(s.codePointAt(0)<=256||ha.has(s))){b.addCommands(e.getPathCommands(s,_,m+i-(p-f)/2,o.fontSize));const x={y:m-(p-f)/2+p/2,x:_+f/2};d&&this._italic(b,r?{x:x.x,y:m-(p-f)/2+i}:void 0),b.rotate(90,x)}else S!==void 0?(b.addCommands(e.glyphs.get(S).getPathCommands(_,C,o.fontSize)),d&&this._italic(b,r?{x:_+f/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(b.addCommands(e.getPathCommands(s,_,C,o.fontSize)),d&&this._italic(b,r?{x:_+p/2,y:C}:void 0));const w=o.fontWeight??400;return w in Ks&&(w===700||w==="bold")&&u!=="bold"&&b.bold(Ks[w]*o.fontSize*.05),b.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=b,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,r){var s;if((s=this.path.paths[0])!=null&&s.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:s}=e;return new N(r.x,r.y,s.x-r.x,s.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,s={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)te(s);else{t.save(),t.beginPath();const o=this.path.style,i={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*s.fontSize:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*s.fontSize,shadowOffsetY:(s.shadowOffsetY??0)*s.fontSize,shadowBlur:(s.shadowBlur??0)*s.fontSize,shadowColor:s.shadowColor};Pr(t,i),t.font=`${s.fontSize}px ${s.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 Ye(n,t){return typeof n=="number"?n:n.endsWith("%")?(n=n.substring(0,n.length-1),Math.ceil(Number(n)/100*t.total)):n.endsWith("rem")?(n=n.substring(0,n.length-3),Number(n)*t.fontSize):n.endsWith("em")?(n=n.substring(0,n.length-2),Number(n)*t.fontSize):Number(n)}function $r(n){const t=Nt(n)?{}:n;return Object.keys(t).reduce((e,r)=>{let s=t[r];const o=Br(r),i=Br(s);return o&&(r=o),i&&(s=i),e[r]=s,e},{})}function Nt(n){return!n||n==="none"}function Js(n,t){const e=Object.keys(n),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(o=>Kt(n[o],t[o]))}function Kt(n,t){const e=typeof n;return e===typeof t?e==="object"?Js(n,t):n===t:!1}function Br(n){const t=n.startsWith("#")?n.slice(1):n;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(a=>a+a).join(""):t,s=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),i=Number.parseInt(r.slice(4,6),16);return`rgb(${s}, ${o}, ${i})`}function Ze(n){if(!n)return n;const t={};for(const e in n)n[e]!==""&&n[e]!==void 0&&(t[e]=n[e]);return t}function Ke(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}class tn{constructor(t,e={},r){B(this,"inlineBox",new N);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}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,...Ze(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qs(r,e++,this));return this.characters=t,this}}class ae{constructor(t,e){B(this,"lineBox",new N);B(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ze(this.parentStyle),...Ze(this.style)},this}addFragment(t,e){const r=new tn(t,e,this);return this.fragments.push(r),r}}function fa(n){return n}class en{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createParagraphDom(t,e){const r=document.createDocumentFragment(),s=document.createElement("section");Object.assign(s.style,{width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(e),position:"fixed",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(i=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(i.style)),i.fragments.forEach(l=>{const h=document.createElement("span");Object.assign(h.style,this._styleToDomStyle(l.style)),h.appendChild(document.createTextNode(l.content)),a.appendChild(h)}),o.appendChild(a)}),s.appendChild(o),r.appendChild(s),document.body.appendChild(r),{dom:s,destory:()=>{var i;return(i=s.parentNode)==null?void 0:i.removeChild(s)}}}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let s=0;return Array.from(r).map(o=>{var u;const i=s+=r.substring(s).indexOf(o),a=i+o.length;s+=o.length,e.setStart(t,Math.max(i,0)),e.setEnd(t,a);const l=((u=e.getClientRects)==null?void 0:u.call(e))??[e.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=e.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(t){const e=[],r=[],s=[];return t.querySelectorAll("li").forEach((o,i)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let u=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(f=>{s.push({...f,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(p=>{s.push({...p,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:s}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),s=this.measureDom(e);s.paragraphs.forEach(a=>{const l=t[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),s.fragments.forEach(a=>{const l=t[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let i=0;return s.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const u=t[l].fragments[h].characters[c],{fontHeight:f,isVertical:p}=u,g=o[i];u.inlineBox.left=g.left,u.inlineBox.top=g.top,u.inlineBox.width=g.width,u.inlineBox.height=g.height,p?(u.lineBox.left=g.left+(g.width-f)/2,u.lineBox.top=g.top,u.lineBox.width=f,u.lineBox.height=g.height):(u.lineBox.left=g.left,u.lineBox.top=g.top+(g.height-f)/2,u.lineBox.width=g.width,u.lineBox.height=f),i++}),{paragraphs:t,boundingBox:new N(0,0,r.width,r.height)}}measure(t,e,r){let s;r||({dom:r,destory:s}=this.createParagraphDom(t,e));const o=this.measureParagraphDom(t,r);return s==null||s(),o}}class pa{constructor(){B(this,"eventListeners",new Map)}addEventListener(t,e,r){const s={value:e,options:r},o=this.eventListeners.get(t);return o?Array.isArray(o)?o.push(s):this.eventListeners.set(t,[o,s]):this.eventListeners.set(t,s),this}removeEventListener(t,e,r){var o,i;if(!e)return this.eventListeners.delete(t),this;const s=this.eventListeners.get(t);if(!s)return this;if(Array.isArray(s)){const a=[];for(let l=0,h=s.length;l<h;l++){const c=s[l];(c.value!==e||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((o=c.options)!=null&&o.once)))&&a.push(c)}a.length?this.eventListeners.set(t,a.length===1?a[0]:a):this.eventListeners.delete(t)}else s.value===e&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof s.options=="boolean"||(i=s.options)!=null&&i.once)&&this.eventListeners.delete(t);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(t){return this.eventListeners.has(t)}dispatchEvent(t,e){var s,o;const r=this.eventListeners.get(t);if(r){if(Array.isArray(r))for(let i=r.length,a=0;a<i;a++){const l=r[a];typeof l.options=="object"&&((s=l.options)!=null&&s.once)&&this.off(t,l.value,l.options),l.value.apply(this,[e])}else typeof r.options=="object"&&((o=r.options)!=null&&o.once)&&this.off(t,r.value,r.options),r.value.apply(this,[e]);return!0}else return!1}on(t,e,r){return this.addEventListener(t,e,r)}once(t,e){return this.addEventListener(t,e,{once:!0})}off(t,e,r){return this.removeEventListener(t,e,r)}emit(t,e){this.dispatchEvent(t,e)}}function rn(){const n=[],t=[],e=new Map,r=new Map;async function s(i){if(!e.has(i)){e.set(i,i);try{e.set(i,await fetch(i).then(a=>a.text()))}catch(a){console.warn(a),e.delete(i)}}}function o(i){let a=r.get(i);if(!a){const l=Ys(Ke(i)?e.get(i)??i:i),h=Zs(l);a={dom:l,paths:h},r.set(i,a)}return a}return{name:"highlight",paths:n,load:async i=>{const a=[];i.forEachCharacter(l=>{const{computedStyle:h}=l,{highlightImage:c,highlightReferImage:u}=h;Ke(c)&&a.push(s(c)),Ke(u)&&a.push(s(u))}),await Promise.all(a)},update:i=>{t.length=0,n.length=0;let a=[],l,h;i.forEachCharacter(c=>{const{computedStyle:u}=c,{highlightImage:f}=u;if(Nt(f))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:p,isVertical:g}=c,{fontSize:m,highlightColormap:d,highlightLine:_,highlightSize:C,highlightThickness:S}=u;(!h||Kt(h.highlightImage,f)&&Kt(h.highlightColormap,d)&&Kt(h.highlightLine,_)&&Kt(h.highlightSize,C)&&Kt(h.highlightThickness,S))&&(l!=null&&l.length)&&(g?l[0].inlineBox.left===p.left:l[0].inlineBox.top===p.top)&&l[0].fontSize===m?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const u=a[c],f=u[0],p=N.from(...u.filter(D=>D.glyphBox).map(D=>D.glyphBox)),{computedStyle:g}=f,{fontSize:m,writingMode:d,highlightImage:_,highlightReferImage:C,highlightColormap:S,highlightLine:b,highlightSize:w,highlightThickness:x}=g,T=d.includes("vertical"),M=Ye(x,{fontSize:m,total:p.width})/p.width,O=$r(S),{paths:V,dom:H}=o(_),E=Te(V,!0),et=m/E.width*2,P=new N().copy(p);T&&(P.width=p.height,P.height=p.width,P.left=p.left+p.width);const F=Math.floor(P.width);let q=F;if(w!=="cover"&&(q=Ye(w,{fontSize:m,total:p.width}),P.width=q),!Nt(C)&&Nt(b)){const D=Te(o(C).paths,!0);E.copy(D)}else{let D;if(Nt(b))if(E.width/E.height>4){D="underline";const L=H.getAttribute("viewBox");if(L){const[st,A,Z,R]=L.split(" ").map(k=>Number(k)),G=A+R/2;E.y<G&&E.y+E.height>G?D="line-through":E.y+E.height<G?D="overline":D="underline"}}else D="outline";else D=b;switch(D){case"outline":{const L=P.width*.2,st=P.height*.2;P.width+=L,P.height+=st,T?(P.x-=st/2,P.y-=L/2,P.x+=P.height):(P.x-=L/2,P.y-=st/2);break}case"overline":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width:P.y=f.inlineBox.top;break;case"line-through":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width-f.strikeoutPosition+P.height/2:P.y=f.inlineBox.top+f.strikeoutPosition-P.height/2;break;case"underline":P.height=E.height*et,T?P.x=f.inlineBox.left+f.inlineBox.width-f.underlinePosition:P.y=f.inlineBox.top+f.underlinePosition;break}}const z=new St().translate(-E.x,-E.y).scale(P.width/E.width,P.height/E.height);T&&z.rotate(-Math.PI/2),z.translate(P.x,P.y);for(let D=0;D<Math.ceil(F/q);D++){const L=z.clone();T?L.translate(0,D*P.width):L.translate(D*P.width,0),V.forEach(st=>{const A=st.clone().matrix(L);A.style.strokeWidth&&(A.style.strokeWidth*=et*M),A.style.strokeMiterlimit&&(A.style.strokeMiterlimit*=et),A.style.strokeDashoffset&&(A.style.strokeDashoffset*=et),A.style.strokeDasharray&&(A.style.strokeDasharray=A.style.strokeDasharray.map(Z=>Z*et)),A.style.fill&&A.style.fill in O&&(A.style.fill=O[A.style.fill]),A.style.stroke&&A.style.stroke in O&&(A.style.stroke=O[A.style.stroke]),n.push(A),F!==q&&(T?t[n.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):t[n.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(i,a)=>{n.forEach((l,h)=>{if(te({ctx:i,path:l,fontSize:a.computedStyle.fontSize,clipRect:t[h]}),a.debug){const c=Te([l]);c&&i.strokeRect(c.x,c.y,c.width,c.height)}})}}}function sn(){const n=[];return{name:"listStyle",paths:n,update:t=>{n.length=0;const{paragraphs:e,isVertical:r,fontSize:s}=t,o=s*.45;e.forEach(i=>{const{computedStyle:a}=i,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,p=$r(c);let g=u,m;if(!Nt(h))m=h;else if(!Nt(f)){const b=s*.38/2;switch(g=g==="cover"?b*2:g,f){case"disc":m=`<svg width="${b*2}" height="${b*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${b}" cy="${b}" r="${b}" fill="${l}" />
|
|
6
6
|
</svg>`;break}}if(!m)return;const d=Zs(m),_=Te(d),C=i.lineBox,S=i.fragments[0].inlineBox;if(S){const b=g==="cover"?1:Ye(g,{total:s,fontSize:s})/s,w=new St;if(r){const x=s/_.height*b;w.translate(-_.left,-_.top).rotate(Math.PI/2).scale(x,x).translate(s/2-_.height*x/2,0).translate(C.left+(C.width-s)/2,S.top-o)}else{const x=s/_.height*b;w.translate(-_.left,-_.top).translate(-_.width,0).scale(x,x).translate(0,s/2-_.height*x/2).translate(S.left-o,C.top+(C.height-s)/2)}n.push(...d.map(x=>{const T=x.clone();return T.matrix(w),T.style.fill&&T.style.fill in p&&(T.style.fill=p[T.style.fill]),T.style.stroke&&T.style.stroke in p&&(T.style.stroke=p[T.style.stroke]),T}))}})}}}const Xt=new v,le=new St,jt=new St;function nn(){return{name:"render",getBoundingBox:n=>{const{characters:t,fontSize:e,effects:r}=n,s=[];return t.forEach(o=>{r==null||r.forEach(i=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=Qe(n,i);Xt.set(a.left,a.top),Xt.applyMatrix3(l),a.left=Xt.x,a.top=Xt.y,Xt.set(a.right,a.bottom),Xt.applyMatrix3(l),a.width=Xt.x-a.left,a.height=Xt.y-a.top;const h=(i.shadowOffsetX??0)*e,c=(i.shadowOffsetY??0)*e,u=Math.max(.1,i.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,s.push(a)})}),s.length?N.from(...s):void 0},render:(n,t)=>{const{paragraphs:e,glyphBox:r,effects:s,style:o}=t;function i(a,l){n.fillStyle=a,n.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&i(o.backgroundColor,new N(0,0,n.canvas.width,n.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&i(a.style.backgroundColor,a.lineBox)}),s?s.forEach(a=>{$t(a,r,n),n.save();const[l,h,c,u,f,p]=Qe(t,a).transpose().elements;n.transform(l,u,h,f,c,p),t.forEachCharacter(g=>{var m;(m=g.parent.style)!=null&&m.backgroundColor&&i(g.parent.style.backgroundColor,g.inlineBox),g.drawTo(n,a)}),n.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&i(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(n)})})}),t.debug&&e.forEach(a=>{n.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function Qe(n,t){const{fontSize:e,glyphBox:r}=n,s=(t.translateX??0)*e,o=(t.translateY??0)*e,i=Math.PI*2,a=(t.skewX??0)/360*i,l=(t.skewY??0)/360*i,{left:h,top:c,width:u,height:f}=r,p=h+u/2,g=c+f/2;return le.identity(),jt.makeTranslation(s,o),le.multiply(jt),jt.makeTranslation(p,g),le.multiply(jt),jt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),le.multiply(jt),jt.makeTranslation(-p,-g),le.multiply(jt),le.clone()}function on(){const n=[];return{name:"textDecoration",paths:n,update:t=>{n.length=0;const e=[];let r,s;t.forEachCharacter(o=>{const{computedStyle:i,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=o,{color:p,textDecoration:g,writingMode:m}=i;if(Nt(g))s=void 0;else{let d=!1;if((s==null?void 0:s.textDecoration)===g&&(s==null?void 0:s.writingMode)===m&&(s==null?void 0:s.color)===p&&(a?r[0].inlineBox.left===l.left:r[0].inlineBox.top===l.top))switch(g){case"underline":r[0].underlinePosition===h&&r[0].underlineThickness===c&&(d=!0);break;case"line-through":r[0].strikeoutPosition===u&&r[0].strikeoutSize===f&&(d=!0);break}d?r.push(o):(r=[],r.push(o),e.push(r)),s=i}}),e.forEach(o=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=o[0],{color:f,textDecoration:p}=i,{left:g,top:m,width:d,height:_}=N.from(...o.map(x=>x.inlineBox));let C=a?g+d:m;const S=a?-1:1;let b=0;switch(p){case"overline":b=h*2;break;case"underline":C+=S*l,b=h*2;break;case"line-through":C+=S*c,b=u*2;break}C-=b;let w;a?w=new Pt([{type:"M",x:C,y:m},{type:"L",x:C,y:m+_},{type:"L",x:C+b,y:m+_},{type:"L",x:C+b,y:m},{type:"Z"}],{fill:f}):w=new Pt([{type:"M",x:g,y:C},{type:"L",x:g+d,y:C},{type:"L",x:g+d,y:C+b},{type:"L",x:g,y:C+b},{type:"Z"}],{fill:f}),n.push(w)})},render:(t,e)=>{const{effects:r,computedStyle:s}=e;r?r.forEach(o=>{t.save();const[i,a,l,h,c,u]=Qe(e,o).transpose().elements;t.transform(i,h,a,c,l,u),n.forEach(f=>{te({ctx:t,path:f,fontSize:s.fontSize,...o})}),t.restore()}):n.forEach(o=>{te({ctx:t,path:o,fontSize:s.fontSize})})}}}const Er={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ur extends pa{constructor(e={}){super();B(this,"debug");B(this,"content");B(this,"style");B(this,"effects");B(this,"measureDom");B(this,"needsUpdate",!0);B(this,"computedStyle",{...Er});B(this,"paragraphs",[]);B(this,"lineBox",new N);B(this,"rawGlyphBox",new N);B(this,"glyphBox",new N);B(this,"pathBox",new N);B(this,"boundingBox",new N);B(this,"measurer",new en);B(this,"plugins",new Map);B(this,"fonts");this.debug=e.debug??!1,this.content=e.content??"",this.style=e.style??{},this.measureDom=e.measureDom,this.effects=e.effects,this.fonts=e.fonts,this.use(sn()).use(on()).use(rn()).use(nn())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(r=>r.characters))}use(e){return this.plugins.set(e.name,e),this}forEachCharacter(e){return this.paragraphs.forEach((r,s)=>{r.fragments.forEach((o,i)=>{o.characters.forEach((a,l)=>{e(a,{paragraphIndex:s,fragmentIndex:i,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(e=>{var r;return(r=e.load)==null?void 0:r.call(e,this)}))}updateParagraphs(){this.computedStyle={...Er,...this.style};let{content:e,computedStyle:r}=this;const s=[];if(typeof e=="string"){const o=new ae({},r);o.addFragment(e),s.push(o)}else{e=Array.isArray(e)?e:[e];for(const o of e)if(typeof o=="string"){const i=new ae({},r);i.addFragment(o),s.push(i)}else if(Array.isArray(o)){const i=new ae({},r);o.forEach(a=>{if(typeof a=="string")i.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&i.addFragment(l,h)}}),s.push(i)}else if("fragments"in o){const{fragments:i,...a}=o,l=new ae(a,r);i.forEach(h=>{const{content:c,...u}=h;c!==void 0&&l.addFragment(c,u)}),s.push(l)}else if("content"in o){const{content:i,...a}=o;if(i!==void 0){const l=new ae(a,r);l.addFragment(i),s.push(l)}}}return this.paragraphs=s,this}measure(e=this.measureDom){const r={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const s=this.measurer.measure(this.paragraphs,this.computedStyle,e);this.paragraphs=s.paragraphs,this.lineBox=s.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((o,i)=>(o.updateOrder??0)-(i.updateOrder??0)).forEach(o=>{var i;(i=o.update)==null||i.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in r)s[o]=this[o],this[o]=r[o];return this.emit("measure",{text:this,result:s}),s}getGlyphBox(){const e=v.MAX,r=v.MIN;return this.characters.forEach(s=>{if(!s.getGlyphMinMax(e,r)){const{inlineBox:o}=s,i=new v(o.left,o.top),a=new v(o.left+o.width,o.top+o.height);e.min(i,a),r.max(i,a)}}),new N(e.x,e.y,r.x-e.x,r.y-e.y)}updatePathBox(){return this.pathBox=N.from(this.glyphBox,...Array.from(this.plugins.values()).map(e=>e.getBoundingBox?e.getBoundingBox(this):Te(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:e,rawGlyphBox:r,pathBox:s}=this,o=Math.min(s.left,s.left+e.left-r.left),i=Math.min(s.top,s.top+e.top-r.top),a=Math.max(s.right,s.right+e.right-r.right),l=Math.max(s.bottom,s.bottom+e.bottom-r.bottom);return this.boundingBox=new N(o,i,a-o,l-i),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const e=this.measure();for(const r in e)this[r]=e[r];return this.emit("update",{text:this}),this}render(e){const{view:r,pixelRatio:s=2}=e,o=r.getContext("2d");o&&(this.needsUpdate&&this.update(),Fr(o,s,this.boundingBox),zr(o,this),Array.from(this.plugins.values()).sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;if(i.render)(a=i.render)==null||a.call(i,o,this);else if(i.paths){const l=this.computedStyle;i.paths.forEach(h=>{te({ctx:o,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:r,pixelRatio:s}))}}async function da(n){const t=new Ur(n);return await t.load(),t.measure()}async function ga(n){const t=new Ur(n);await t.load(),t.render(n)}U.Character=Qs,U.Fragment=tn,U.Measurer=en,U.Paragraph=ae,U.Text=Ur,U.defaultTextStyles=Er,U.definePlugin=fa,U.drawPath=te,U.filterEmpty=Ze,U.getTransform2D=Qe,U.hexToRgb=Br,U.highlight=rn,U.isEqualObject=Js,U.isEqualValue=Kt,U.isNone=Nt,U.listStyle=sn,U.measureText=da,U.needsFetch=Ke,U.parseColor=lt,U.parseColormap=$r,U.parseValueNumber=Ye,U.render=nn,U.renderText=ga,U.setupView=Fr,U.textDecoration=on,U.uploadColor=$t,U.uploadColors=zr,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -648,7 +648,7 @@ class Measurer {
|
|
|
648
648
|
height: fBox.height
|
|
649
649
|
});
|
|
650
650
|
let characterIndex = 0;
|
|
651
|
-
if (fDom.firstChild instanceof window.Text) {
|
|
651
|
+
if (!fDom.children.length && fDom.firstChild instanceof window.Text) {
|
|
652
652
|
this.measureDomText(fDom.firstChild).forEach((char) => {
|
|
653
653
|
characters.push({
|
|
654
654
|
...char,
|