modern-text 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(k,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(k=typeof globalThis<"u"?globalThis:k||self,lt(k.modernText={}))})(this,function(k){"use strict";var wa=Object.defineProperty;var xa=(k,lt,$t)=>lt in k?wa(k,lt,{enumerable:!0,configurable:!0,writable:!0,value:$t}):k[lt]=$t;var $=(k,lt,$t)=>xa(k,typeof lt!="symbol"?lt+"":lt,$t);function lt(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=ps(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,i,o);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function $t(s,t,e){s!=null&&s.color&&(s.color=lt(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=lt(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=lt(e,s.textStrokeColor,t))}function ps(s,t,e,r,n){var p;const i=((p=s.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/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(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style,o={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}function Nr(s,t,e){const{left:r,top:n,width:i,height:o}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${i} ${o}`,a.dataset.pixelRatio=String(t);const l=i,h=o;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`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function qr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;$t(r,n,s),e.forEach(i=>{$t(i.computedStyle,i.lineBox,s),i.fragments.forEach(o=>{$t(o.computedStyle,o.inlineBox,s)})})}var ht=Uint8Array,Ct=Uint16Array,er=Int32Array,Oe=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]),rr=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rr=function(s,t){for(var e=new Ct(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new er(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},Gr=Rr(Oe,2),Wr=Gr.b,nr=Gr.r;Wr[28]=258,nr[258]=28;for(var Vr=Rr(Ie,0),ds=Vr.b,Xr=Vr.r,sr=new Ct(32768),X=0;X<32768;++X){var Rt=(X&43690)>>1|(X&21845)<<1;Rt=(Rt&52428)>>2|(Rt&13107)<<2,Rt=(Rt&61680)>>4|(Rt&3855)<<4,sr[X]=((Rt&65280)>>8|(Rt&255)<<8)>>1}for(var Bt=function(s,t,e){for(var r=s.length,n=0,i=new Ct(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new Ct(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new Ct(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=o[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[sr[u]>>l]=h}else for(a=new Ct(r),n=0;n<r;++n)s[n]&&(a[n]=sr[o[s[n]-1]++]>>15-s[n]);return a},Gt=new ht(288),X=0;X<144;++X)Gt[X]=8;for(var X=144;X<256;++X)Gt[X]=9;for(var X=256;X<280;++X)Gt[X]=7;for(var X=280;X<288;++X)Gt[X]=8;for(var ce=new ht(32),X=0;X<32;++X)ce[X]=5;var gs=Bt(Gt,9,0),ys=Bt(Gt,9,1),ms=Bt(ce,5,0),ws=Bt(ce,5,1),ir=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Tt=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},or=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},ar=function(s){return(s+7)/8|0},jr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ht(s.subarray(t,e))},xs=["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"],At=function(s,t,e){var r=new Error(t||xs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,At),!e)throw r;return r},vs=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ht(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new ht(n*3));var h=function(Dt){var Lt=e.length;if(Dt>Lt){var qt=new ht(Math.max(Lt*2,Dt));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,M=n*8;do{if(!p){c=Tt(s,u,1);var b=Tt(s,u+1,3);if(u+=3,b)if(b==1)p=ys,g=ws,m=9,d=5;else if(b==2){var x=Tt(s,u,31)+257,A=Tt(s,u+10,15)+4,C=x+Tt(s,u+5,31)+1;u+=14;for(var _=new ht(C),V=new ht(19),H=0;H<A;++H)V[rr[H]]=Tt(s,u+H*3,7);u+=A*3;for(var E=ir(V),et=(1<<E)-1,P=Bt(V,E,1),H=0;H<C;){var F=P[Tt(s,u,et)];u+=F&15;var S=F>>4;if(S<16)_[H++]=S;else{var q=0,z=0;for(S==16?(z=3+Tt(s,u,3),u+=2,q=_[H-1]):S==17?(z=3+Tt(s,u,7),u+=3):S==18&&(z=11+Tt(s,u,127),u+=7);z--;)_[H++]=q}}var U=_.subarray(0,x),L=_.subarray(x);m=ir(U),d=ir(L),p=Bt(U,m,1),g=Bt(L,d,1)}else At(1);else{var S=ar(u)+4,T=s[S-4]|s[S-3]<<8,w=S+T;if(w>n){l&&At(0);break}a&&h(f+T),e.set(s.subarray(S,w),f),t.b=f+=T,t.p=u=w*8,t.f=c;continue}if(u>M){l&&At(0);break}}a&&h(f+131072);for(var nt=(1<<m)-1,O=(1<<d)-1,Z=u;;Z=u){var q=p[or(s,u)&nt],G=q>>4;if(u+=q&15,u>M){l&&At(0);break}if(q||At(2),G<256)e[f++]=G;else if(G==256){Z=u,p=null;break}else{var R=G-254;if(G>264){var H=G-257,D=Oe[H];R=Tt(s,u,(1<<D)-1)+Wr[H],u+=D}var Q=g[or(s,u)&O],Y=Q>>4;Q||At(3),u+=Q&15;var L=ds[Y];if(Y>3){var D=Ie[Y];L+=or(s,u)&(1<<D)-1,u+=D}if(u>M){l&&At(0);break}a&&h(f+131072);var st=f+R;if(f<L){var Qt=i-L,Jt=Math.min(L,st);for(Qt+f<0&&At(3);f<Jt;++f)e[f]=r[Qt+f]}for(;f<st;++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&&o?jr(e,0,f):e.subarray(0,f)},zt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ue=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},lr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Kr,l:0};if(n==1){var o=new ht(e[0].s+1);return o[e[0].s]=1,{t:o,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!=n-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=i[0].s,r=1;r<n;++r)i[r].s>f&&(f=i[r].s);var p=new Ct(f+1),g=hr(e[c-1],p,0);if(g>t){var r=0,m=0,d=g-t,M=1<<d;for(i.sort(function(x,A){return p[A.s]-p[x.s]||x.f-A.f});r<n;++r){var b=i[r].s;if(p[b]>t)m+=M-(1<<g-p[b]),p[b]=t;else break}for(m>>=d;m>0;){var S=i[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var T=i[r].s;p[T]==t&&(--p[T],++m)}g=t}return{t:new ht(p),l:g}},hr=function(s,t,e){return s.s==-1?Math.max(hr(s.l,t,e+1),hr(s.r,t,e+1)):t[s.s]=e},Hr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Ct(++t),r=0,n=s[0],i=1,o=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},fe=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Yr=function(s,t,e){var r=e.length,n=ar(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Zr=function(s,t,e,r,n,i,o,a,l,h,c){zt(t,c++,e),++n[256];for(var u=lr(n,15),f=u.t,p=u.l,g=lr(i,15),m=g.t,d=g.l,M=Hr(f),b=M.c,S=M.n,T=Hr(m),w=T.c,x=T.n,A=new Ct(19),C=0;C<b.length;++C)++A[b[C]&31];for(var C=0;C<w.length;++C)++A[w[C]&31];for(var _=lr(A,7),V=_.t,H=_.l,E=19;E>4&&!V[rr[E-1]];--E);var et=h+5<<3,P=fe(n,Gt)+fe(i,ce)+o,F=fe(n,f)+fe(i,m)+o+14+3*E+fe(A,V)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&et<=P&&et<=F)return Yr(t,c,s.subarray(l,l+h));var q,z,U,L;if(zt(t,c,1+(F<P)),c+=2,F<P){q=Bt(f,p,0),z=f,U=Bt(m,d,0),L=m;var nt=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 C=0;C<E;++C)zt(t,c+3*C,V[rr[C]]);c+=3*E;for(var O=[b,w],Z=0;Z<2;++Z)for(var G=O[Z],C=0;C<G.length;++C){var R=G[C]&31;zt(t,c,nt[R]),c+=V[R],R>15&&(zt(t,c,G[C]>>5&127),c+=G[C]>>12)}}else q=gs,z=Gt,U=ms,L=ce;for(var C=0;C<a;++C){var D=r[C];if(D>255){var R=D>>18&31;ue(t,c,q[R+257]),c+=z[R+257],R>7&&(zt(t,c,D>>23&31),c+=Oe[R]);var Q=D&31;ue(t,c,U[Q]),c+=L[Q],Q>3&&(ue(t,c,D>>5&8191),c+=Ie[Q])}else ue(t,c,q[D]),c+=z[D]}return ue(t,c,q[256]),c+z[256]},bs=new er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kr=new ht(0),Ss=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ht(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),h=i.l,c=(i.r||0)&7;if(t){c&&(l[0]=i.r>>3);for(var u=bs[t-1],f=u>>13,p=u&8191,g=(1<<e)-1,m=i.p||new Ct(32768),d=i.h||new Ct(g+1),M=Math.ceil(e/3),b=2*M,S=function(he){return(s[he]^s[he+1]<<M^s[he+2]<<b)&g},T=new er(25e3),w=new Ct(288),x=new Ct(32),A=0,C=0,_=i.i||0,V=0,H=i.w||0,E=0;_+2<o;++_){var et=S(_),P=_&32767,F=d[et];if(m[P]=F,d[et]=P,H<=_){var q=o-_;if((A>7e3||V>24576)&&(q>423||!h)){c=Zr(s,l,0,T,w,x,C,V,E,_-E,c),V=A=C=0,E=_;for(var z=0;z<286;++z)w[z]=0;for(var z=0;z<30;++z)x[z]=0}var U=2,L=0,nt=p,O=P-F&32767;if(q>2&&et==S(_-O))for(var Z=Math.min(f,q)-1,G=Math.min(32767,_),R=Math.min(258,q);O<=G&&--nt&&P!=F;){if(s[_+U]==s[_+U-O]){for(var D=0;D<R&&s[_+D]==s[_+D-O];++D);if(D>U){if(U=D,L=O,D>Z)break;for(var Q=Math.min(O,D-2),Y=0,z=0;z<Q;++z){var st=_-O+z&32767,Qt=m[st],Jt=st-Qt&32767;Jt>Y&&(Y=Jt,F=st)}}}P=F,F=m[P],O+=P-F&32767}if(L){T[V++]=268435456|nr[U]<<18|Xr[L];var Dt=nr[U]&31,Lt=Xr[L]&31;C+=Oe[Dt]+Ie[Lt],++w[257+Dt],++x[Lt],H=_+U,++A}else T[V++]=s[_],++w[s[_]]}}for(_=Math.max(_,H);_<o;++_)T[V++]=s[_],++w[s[_]];c=Zr(s,l,h,T,w,x,C,V,E,_-E,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=d,i.p=m,i.i=_,i.w=H)}else{for(var _=i.w||0;_<o+h;_+=65535){var qt=_+65535;qt>=o&&(l[c/8|0]=h,qt=o),c=Yr(l,c+1,s.subarray(_,qt))}i.i=o}return jr(a,0,r+ar(c)+n)},Qr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},Ps=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ht(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return Ss(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Jr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},Cs=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Qr();n.p(t.dictionary),Jr(s,2,n.d())}},_s=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&At(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&At(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Ms(s,t){t||(t={});var e=Qr();e.p(s);var r=Ps(s,t,t.dictionary?6:2,4);return Cs(r,t),Jr(r,r.length-4,e.d()),r}function Ts(s,t){return vs(s.subarray(_s(s,t),-4),{i:2},t,t)}var As=typeof TextDecoder<"u"&&new TextDecoder,Os=0;try{As.decode(Kr,{stream:!0}),Os=1}catch{}const Is="modern-font";function pe(s,t){if(!s)throw new Error(`[${Is}] ${t}`)}function $s(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function ee(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var tn=Object.defineProperty,Bs=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ct=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&tn(t,e,n),n},Es=(s,t,e)=>(Bs(s,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(s,t){Object.defineProperty(s.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,n){super($s(t),e,r),this.littleEndian=n,Es(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));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,n)=>{this.write(t.type,e[n],t.offset+n)}):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 n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=$e[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}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),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=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 i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=$e[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);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 n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=ee(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}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 ks=Object.defineProperty,Us=(s,t,e)=>t in s?ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ds=(s,t,e)=>(Us(s,t+"",e),e);const en=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=en.get(n);o||(o={columns:[],byteLength:0},en.set(n,o));const a={...t,name:i,byteLength:e*$e[r],offset:t.offset??o.columns.reduce((l,h)=>l+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((l,h)=>l+$e[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Ds(this,"view"),this.view=new ot(t,e,r,n)}}function Ls(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Be(s){s=Ls(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Fs(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function zs(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class cr 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 rn=Object.defineProperty,Ns=(s,t,e)=>t in s?rn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&rn(t,e,n),n},nn=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);const wt=class ls extends cr{constructor(){super(...arguments),nn(this,"format","EmbeddedOpenType"),nn(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Be(n.fontFamily||""),o=i.length,a=Be(n.fontStyle||""),l=a.length,h=Be(n.version||""),c=h.length,u=Be(n.fullName||""),f=u.length,p=86+o+4+l+4+c+4+f+2+t.view.byteLength,g=new ls(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(o),g.view.writeBytes(i),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 qs=Object.defineProperty,Ee=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&qs(t,e,n),n};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 ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Rs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Gs=Object.defineProperty,Ws=(s,t,e)=>t in s?Gs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e)=>(Ws(s,typeof t!="symbol"?t+"":t,e),e);class sn{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,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:l=o}=n,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 Vs extends sn{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,p,g;const m=[],d=[];let M=0,b=!1,S=!1,T=o,w=0,x=0;function A(P,F){m.push({type:"L",x:P,y:F})}function C(P,F,q,z,U,L){m.push({type:"C",x1:P,y1:F,x2:q,y2:z,x:U,y:L})}function _(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&&!b&&(T=d.shift()+i),M+=d.length>>1,d.length=0,b=!0}function et(P){let F,q,z,U,L,nt,O,Z,G,R,D,Q,Y=0;for(;Y<P.length;){let st=P[Y++];switch(st){case 1:E();break;case 3:E();break;case 4:d.length>1&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),_(w,x);break;case 5:for(;d.length>0;)w+=d.shift(),x+=d.shift(),A(w,x);break;case 6:for(;d.length>0&&(w+=d.shift(),A(w,x),d.length!==0);)x+=d.shift(),A(w,x);break;case 7:for(;d.length>0&&(x+=d.shift(),A(w,x),d.length!==0);)w+=d.shift(),A(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(),C(u,f,p,g,w,x);break;case 10:L=d.pop()+l,nt=t.subrs[L],nt&&et(nt);break;case 11:return;case 12:switch(st=P[Y],Y+=1,st){case 35:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),R=Z+d.shift(),D=G+d.shift(),Q=R+d.shift(),w=D+d.shift(),x=Q+d.shift(),d.shift(),C(u,f,p,g,O,Z),C(G,R,D,Q,w,x);break;case 34:u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),R=g,D=G+d.shift(),Q=x,w=D+d.shift(),C(u,f,p,g,O,Z),C(G,R,D,Q,w,x);break;case 36:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),R=g,D=G+d.shift(),Q=R+d.shift(),w=D+d.shift(),C(u,f,p,g,O,Z),C(G,R,D,Q,w,x);break;case 37:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),R=Z+d.shift(),D=G+d.shift(),Q=R+d.shift(),Math.abs(D-w)>Math.abs(Q-x)?w=D+d.shift():x=Q+d.shift(),C(u,f,p,g,O,Z),C(G,R,D,Q,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),d.length=0}break;case 14:if(d.length>=4){const Qt=ur[d.pop()],Jt=ur[d.pop()],Dt=d.pop(),Lt=d.pop();if(Qt&&Jt){n.isComposite=!0,n.components=[];const qt=t.charset.indexOf(Qt),he=t.charset.indexOf(Jt);n.components.push({glyphIndex:he,dx:0,dy:0}),n.components.push({glyphIndex:qt,dx:Lt,dy:Dt}),H(r.get(he).pathCommands);const Lr=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let Fr=0;Fr<Lr.length;Fr+=1){const Ft=Lr[Fr];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=Dt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=Dt),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=Dt)}H(Lr)}}else d.length>0&&!b&&(T=d.shift()+i,b=!0);S&&h!==2&&(V(),S=!1);break;case 18:E();break;case 19:case 20:E(),Y+=M+7>>3;break;case 21:d.length>2&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),w+=d.pop(),_(w,x);break;case 22:d.length>1&&!b&&(T=d.shift()+i,b=!0),w+=d.pop(),_(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(),C(u,f,p,g,w,x);w+=d.shift(),x+=d.shift(),A(w,x);break;case 25:for(;d.length>6;)w+=d.shift(),x+=d.shift(),A(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(),C(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(),C(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,C(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,nt=t.gsubrs[L],nt&&et(nt);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),C(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),C(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),C(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),C(u,f,p,g,w,x);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?d.push(st-139):st<251?(F=P[Y],Y+=1,d.push((st-247)*256+F+108)):st<255?(F=P[Y],Y+=1,d.push(-(st-251)*256-F-108)):(F=P[Y],q=P[Y+1],z=P[Y+2],U=P[Y+3],Y+=4,d.push((F<<24|q<<16|z<<8|U)/65536))}}}et(e),this.pathCommands=m,b&&(this.advanceWidth=T)}}var Xs=Object.defineProperty,js=(s,t,e)=>t in s?Xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Hs=(s,t,e)=>(js(s,t+"",e),e);class on{constructor(t){this._sfnt=t,Hs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Ys extends on{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Vs({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var an=Object.defineProperty,Zs=(s,t,e)=>t in s?an(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ln=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&an(t,e,n),n},ke=(s,t,e)=>(Zs(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends Mt{constructor(t,e,r,n){super(t,e,r,n),ke(this,"_offsets"),ke(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 n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}return n}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,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}ln([y("uint16")],Ue.prototype,"count"),ln([y("uint8")],Ue.prototype,"offsetSize");class De extends Ue{constructor(){super(...arguments),ke(this,"_isString",!1)}}class hn extends Ue{constructor(){super(...arguments),ke(this,"_isString",!0)}}const Ks=[".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"],Qs=[".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"],Js=[".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"],ti=[".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(s,t){return t<=390?Ks[t]:s[t-391]}var ei=Object.defineProperty,ri=(s,t,e)=>t in s?ei(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,cn=(s,t,e)=>(ri(s,typeof t!="symbol"?t+"":t,e),e);function j(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class un extends Mt{constructor(){super(...arguments),cn(this,"_dict"),cn(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,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;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,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_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 ni=Object.defineProperty,fr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ni(t,e,n),n};class Fe extends un{}fr([j(19)],Fe.prototype,"subrs"),fr([j(20)],Fe.prototype,"defaultWidthX"),fr([j(21)],Fe.prototype,"nominalWidthX");var si=Object.defineProperty,J=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&si(t,e,n),n};class K extends un{}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 ii=Object.defineProperty,oi=(s,t,e)=>t in s?ii(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pr=(s,t,e)=>(oi(s,typeof t!="symbol"?t+"":t,e),e);function ft(s,t=s){return e=>{ze.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ze.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const fn=class Ae{constructor(t){pr(this,"tables",new Map),pr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,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:n}=this.cff;e=n.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),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){const o=[];return this.forEachGlyph(t,e,r,n,i,(a,l,h,c,u)=>{o.push(...a.getPathCommands(l,h,c,u,this))}),o}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];o.call(this,c,e,r,n,i),c.advanceWidth&&(e+=c.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new Ae(this.tableViews)}delete(t){const e=Ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Ae.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Ae.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};pr(fn,"tableDefinitions",new Map);let ze=fn;class pt extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var pn=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,li=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ye=(s,t,e,r)=>{for(var n=r>1?void 0:r?ai(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&pn(t,e,n),n},dr=(s,t,e)=>(li(s,typeof t!="symbol"?t+"":t,e),e);let re=class extends pt{constructor(s,t,e,r){super(s,t,e,r),dr(this,"_glyphs"),dr(this,"privateDict"),dr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ys(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new hn(t,r),this.topDictIndex=new De(t,this.nameIndex.endOffset),this.stringIndex=new hn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new De(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],i=this.topDict.private[1];n&&(this.privateDict=new Fe(t,e+i,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(t,e+i+this.privateDict.subrs))),this.charStringsIndex=new De(t,e+this.topDict.charStrings);const o=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Qs:this.topDict.charset===1?this.charset=Js:this.topDict.charset===2?this.charset=ti:this.charset=this._readCharset(e+this.topDict.charset,o,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ur:this.topDict.encoding===1?this.encoding=Rs:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,i,o;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)i=r.readUint16(),a.push(Le(e,i));else if(l===1)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint8(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else if(l===2)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint16(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},i=t.readUint8();if(i===0){const o=t.readUint8();for(e=0;e<o;e+=1)r=t.readUint8(),n[r]=e}else if(i===1){const o=t.readUint8();for(r=1,e=0;e<o;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${i}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.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 hi=Object.defineProperty,Ne=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&hi(t,e,n),n};const me=class hs extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new hs;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),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 dn=me;var ci=Object.defineProperty,gr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ci(t,e,n),n};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,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=o.length?l=0:(l=o[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=i[c].entryCount;u<f;u++)if(i[c].idRangeOffset+u>=o.length?l=0:(l=o[i[c].idRangeOffset+u],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<t){const p=(h<<8|u+i[c].firstCode)%65535;e.set(p,l)}}return e}}gr([y("uint16")],qe.prototype,"format"),gr([y("uint16")],qe.prototype,"length"),gr([y("uint16")],qe.prototype,"language");function gn(s){return s>32767?s-65536:s<-32767?s+65536:s}function yn(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:gn(i-o)}):(n.start=Number(o),n.startId=i,n.delta=gn(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var ui=Object.defineProperty,Ht=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ui(t,e,n),n};const Wt=class cs 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=yn(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new cs(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=i[h];c<=u;++c)if(o[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+o[h]/2+(c-n[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 mn=Wt;var fi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&fi(t,e,n),n};class ne 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,n)=>{e.set(n,r)}),e}}we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"length"),we([y("uint16")],ne.prototype,"language"),we([y("uint16")],ne.prototype,"firstCode"),we([y("uint16")],ne.prototype,"entryCount");var pi=Object.defineProperty,xe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&pi(t,e,n),n};const se=class us 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=yn(t),r=new us(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(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)t.set(a++,o++)}return t}};xe([y("uint16")],se.prototype,"format"),xe([y("uint16")],se.prototype,"reserved"),xe([y("uint32")],se.prototype,"length"),xe([y("uint32")],se.prototype,"language"),xe([y("uint32")],se.prototype,"nGroups");let wn=se;var di=Object.defineProperty,yr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&di(t,e,n),n};class Re 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,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}yr([y("uint16")],Re.prototype,"format"),yr([y("uint32")],Re.prototype,"length"),yr([y("uint32")],Re.prototype,"numVarSelectorRecords");var xn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(s,t,e)=>t in s?xn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mr=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xn(t,e,n),n},vn=(s,t,e)=>(yi(s,typeof t!="symbol"?t+"":t,e),e);let ve=class extends pt{constructor(){super(...arguments),vn(this,"_unicodeToGlyphIndexMap"),vn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=mn.from(s),r=dn.from(s),n=t?wn.from(s):void 0,i=4+(n?32:24),o=i+e.view.byteLength,a=o+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:i},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:i},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.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,i),h.view.writeBytes(r.view,o),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const i=e[r],o=t.get(i);s.has(o)?s.get(o).push(i):s.set(o,[i])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({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 dn(this.view.buffer,t.offset);break;case 2:r=new qe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new mn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ne(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new wn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Re(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:e,view:r}})}readunicodeToGlyphIndexMap(){var o,a,l,h,c;const s=this.readSubtables(),t=(o=s.find(u=>u.format===0))==null?void 0:o.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,i=(c=s.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())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[]])}};mr([y("uint16")],ve.prototype,"version",2),mr([y("uint16")],ve.prototype,"numberSubtables",2),ve=mr([ft("cmap")],ve);class mi extends sn{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.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 n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=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(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;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 M=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.x=this._parseGlyphCoordinate(t,p,M,2,16),M=d.x;let b=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.y=this._parseGlyphCoordinate(t,p,b,4,32),b=d.y}this.points=m}else this.points=[]}else if(n===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 i=[],o=this._parseContours(this.points);for(let a=0,l=o.length;a<l;++a){const h=o[a];let c=h[h.length-1],u=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):u.onCurve?i.push({type:"M",x:u.x,y:u.y}):i.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)i.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}),i.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class wi extends on{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new mi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var bn=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,vi=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,bi=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bn(t,e,n),n},Si=(s,t,e)=>(vi(s,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),Si(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new wr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new wi(this._sfnt))}};wr=bi([ft("glyf")],wr);var Pi=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,_i=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Pi(t,e,n),n};let Sn=class extends pt{};Sn=_i([ft("GPOS","gpos")],Sn);var Mi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Yt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mi(t,e,n),n};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 Ai=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,it=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ai(t,e,n),n};let rt=class extends pt{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.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 Ii=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ii(t,e,n),n};let dt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.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 Pn=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ei=(s,t,e)=>t in s?Pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ki=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Pn(t,e,n),n},Ui=(s,t,e)=>(Ei(s,t+"",e),e);let xr=class extends pt{constructor(){super(...arguments),Ui(this,"_metrics")}static from(s){const t=s.length*4,e=new xr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,i)=>(i<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};xr=ki([ft("hmtx")],xr);var Di=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Fi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Li(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Di(t,e,n),n};let Cn=class extends pt{};Cn=Fi([ft("kern","kern")],Cn);var _n=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Ni=(s,t,e)=>t in s?_n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,qi=(s,t,e,r)=>{for(var n=r>1?void 0:r?zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&_n(t,e,n),n},Ri=(s,t,e)=>(Ni(s,t+"",e),e);let vr=class extends pt{constructor(){super(...arguments),Ri(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new vr(new ArrayBuffer(e));return s.forEach(n=>{t?r.view.writeUint32(n):r.view.writeUint16(n/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:s}).map(()=>t?e.readUint32():e.readUint16()*2)}};vr=qi([ft("loca")],vr);var Gi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,gt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Gi(t,e,n),n};let at=class extends pt{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.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 Mn=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,Xi=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ge=(s,t,e,r)=>{for(var n=r>1?void 0:r?Vi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mn(t,e,n),n},ji=(s,t,e)=>(Xi(s,t+"",e),e);const Tn={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"},br={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Hi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},An={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let be=class extends pt{constructor(){super(...arguments),ji(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++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<s;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=br.Macintosh,n=Hi.Default,i=0;t.some(a=>a.platform===br.Microsoft&&a.encoding===An.UCS2&&a.language===1033)&&(r=br.Microsoft,n=An.UCS2,i=1033);const o={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===i&&Tn[l.nameId]&&(o[Tn[l.nameId]]=i===0?Fs(l.name):zs(l.name))}return o}};Ge([y("uint16")],be.prototype,"format",2),Ge([y("uint16")],be.prototype,"count",2),Ge([y("uint16")],be.prototype,"stringOffset",2),be=Ge([ft("name")],be);var Yi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,B=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yi(t,e,n),n};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]}};B([y("uint16")],I.prototype,"version",2),B([y("int16")],I.prototype,"xAvgCharWidth",2),B([y("uint16")],I.prototype,"usWeightClass",2),B([y("uint16")],I.prototype,"usWidthClass",2),B([y("uint16")],I.prototype,"fsType",2),B([y("uint16")],I.prototype,"ySubscriptXSize",2),B([y("uint16")],I.prototype,"ySubscriptYSize",2),B([y("uint16")],I.prototype,"ySubscriptXOffset",2),B([y("uint16")],I.prototype,"ySubscriptYOffset",2),B([y("uint16")],I.prototype,"ySuperscriptXSize",2),B([y("uint16")],I.prototype,"ySuperscriptYSize",2),B([y("uint16")],I.prototype,"ySuperscriptXOffset",2),B([y("uint16")],I.prototype,"ySuperscriptYOffset",2),B([y("uint16")],I.prototype,"yStrikeoutSize",2),B([y("uint16")],I.prototype,"yStrikeoutPosition",2),B([y("uint16")],I.prototype,"sFamilyClass",2),B([y({type:"uint8"})],I.prototype,"bFamilyType",2),B([y({type:"uint8"})],I.prototype,"bSerifStyle",2),B([y({type:"uint8"})],I.prototype,"bWeight",2),B([y({type:"uint8"})],I.prototype,"bProportion",2),B([y({type:"uint8"})],I.prototype,"bContrast",2),B([y({type:"uint8"})],I.prototype,"bStrokeVariation",2),B([y({type:"uint8"})],I.prototype,"bArmStyle",2),B([y({type:"uint8"})],I.prototype,"bLetterform",2),B([y({type:"uint8"})],I.prototype,"bMidline",2),B([y({type:"uint8"})],I.prototype,"bXHeight",2),B([y({type:"uint8",size:16})],I.prototype,"ulUnicodeRange",2),B([y({type:"char",size:4})],I.prototype,"achVendID",2),B([y("uint16")],I.prototype,"fsSelection",2),B([y("uint16")],I.prototype,"usFirstCharIndex",2),B([y("uint16")],I.prototype,"usLastCharIndex",2),B([y("int16")],I.prototype,"sTypoAscender",2),B([y("int16")],I.prototype,"sTypoDescender",2),B([y("int16")],I.prototype,"sTypoLineGap",2),B([y("uint16")],I.prototype,"usWinAscent",2),B([y("uint16")],I.prototype,"usWinDescent",2),B([y({offset:72,type:"uint8",size:8})],I.prototype,"ulCodePageRange",2),B([y({offset:72,type:"int16"})],I.prototype,"sxHeight",2),B([y("int16")],I.prototype,"sCapHeight",2),B([y("uint16")],I.prototype,"usDefaultChar",2),B([y("uint16")],I.prototype,"usBreakChar",2),B([y("uint16")],I.prototype,"usMaxContext",2),I=B([ft("OS/2","os2")],I);var Ki=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Et=(s,t,e,r)=>{for(var n=r>1?void 0:r?Qi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ki(t,e,n),n};let Ot=class extends pt{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};Et([y("fixed")],Ot.prototype,"format",2),Et([y("fixed")],Ot.prototype,"italicAngle",2),Et([y("int16")],Ot.prototype,"underlinePosition",2),Et([y("int16")],Ot.prototype,"underlineThickness",2),Et([y("uint32")],Ot.prototype,"isFixedPitch",2),Et([y("uint32")],Ot.prototype,"minMemType42",2),Et([y("uint32")],Ot.prototype,"maxMemType42",2),Et([y("uint32")],Ot.prototype,"minMemType1",2),Et([y("uint32")],Ot.prototype,"maxMemType1",2),Ot=Et([ft("post")],Ot);var Ji=Object.defineProperty,to=Object.getOwnPropertyDescriptor,vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?to(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ji(t,e,n),n};let yt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.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 On=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,ro=(s,t,e)=>t in s?On(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,no=(s,t,e,r)=>{for(var n=r>1?void 0:r?eo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&On(t,e,n),n},so=(s,t,e)=>(ro(s,t+"",e),e);let Sr=class extends pt{constructor(){super(...arguments),so(this,"_metrics")}static from(s){const t=s.length*4,e=new Sr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((i,o)=>(o<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};Sr=no([ft("vmtx")],Sr);var In=Object.defineProperty,io=(s,t,e)=>t in s?In(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&In(t,e,n),n},We=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);class It extends cr{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 n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,f)=>u+e(f.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,l=0;const h=i.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,i.view.writeBytes(u,a),a+=e(p.length)});const c=i.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(i.view),i}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 oo=Object.defineProperty,ao=(s,t,e)=>t in s?oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Pr=(s,t,e)=>(ao(s,typeof t!="symbol"?t+"":t,e),e);class Ve extends It{constructor(){super(...arguments),Pr(this,"format","OpenType"),Pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}Pr(Ve,"signature",new Set([1330926671]));var lo=Object.defineProperty,Pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&lo(t,e,n),n};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 $n=Object.defineProperty,ho=(s,t,e)=>t in s?$n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_t=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&$n(t,e,n),n},Xe=(s,t,e)=>(ho(s,typeof t!="symbol"?t+"":t,e),e);const bt=class zr extends cr{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,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)i+=e.getUint8(l)<<a*8,l++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const p=ee(Ms(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:p.byteLength<u.byteLength?p:u,rawView:u})});const i=n.length,o=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new zr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+i*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=zr.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,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(Ts(new Uint8Array(this.view.buffer.slice(n,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 Cr=bt;function co(s,t=!0){if(It.is(s))return new It(s);if(Ve.is(s))return new Ve(s);if(Cr.is(s))return new Cr(s);if(t)throw new Error("Failed to parseFont")}var uo=Object.defineProperty,fo=(s,t,e)=>t in s?uo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(fo(s,typeof t!="symbol"?t+"":t,e),e);const Bn=class fs{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,{...fs.defaultRequestInit,...e,signal:r.signal}).then(n=>n.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 {
|
|
1
|
+
(function(k,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(k=typeof globalThis<"u"?globalThis:k||self,lt(k.modernText={}))})(this,function(k){"use strict";var wa=Object.defineProperty;var xa=(k,lt,$t)=>lt in k?wa(k,lt,{enumerable:!0,configurable:!0,writable:!0,value:$t}):k[lt]=$t;var $=(k,lt,$t)=>xa(k,typeof lt!="symbol"?lt+"":lt,$t);function lt(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=ps(t,e.left,e.top,e.width,e.height),l=s.createLinearGradient(r,n,i,o);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return t}function $t(s,t,e){s!=null&&s.color&&(s.color=lt(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=lt(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=lt(e,s.textStrokeColor,t))}function ps(s,t,e,r,n){var p;const i=((p=s.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),f=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+f,x1:t+r/2+u,y1:e+n/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(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style,o={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}function Nr(s,t,e){const{left:r,top:n,width:i,height:o}=e,a=s.canvas;a.dataset.viewBox=`${r} ${n} ${i} ${o}`,a.dataset.pixelRatio=String(t);const l=i,h=o;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`,s.clearRect(0,0,a.width,a.height),s.scale(t,t),s.translate(-r,-n)}function qr(s,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;$t(r,n,s),e.forEach(i=>{$t(i.computedStyle,i.lineBox,s),i.fragments.forEach(o=>{$t(o.computedStyle,o.inlineBox,s)})})}var ht=Uint8Array,Ct=Uint16Array,er=Int32Array,Oe=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]),rr=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Gr=function(s,t){for(var e=new Ct(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new er(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},Rr=Gr(Oe,2),Wr=Rr.b,nr=Rr.r;Wr[28]=258,nr[258]=28;for(var Vr=Gr(Ie,0),ds=Vr.b,jr=Vr.r,sr=new Ct(32768),j=0;j<32768;++j){var Gt=(j&43690)>>1|(j&21845)<<1;Gt=(Gt&52428)>>2|(Gt&13107)<<2,Gt=(Gt&61680)>>4|(Gt&3855)<<4,sr[j]=((Gt&65280)>>8|(Gt&255)<<8)>>1}for(var Bt=function(s,t,e){for(var r=s.length,n=0,i=new Ct(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new Ct(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new Ct(1<<t);var l=15-t;for(n=0;n<r;++n)if(s[n])for(var h=n<<4|s[n],c=t-s[n],u=o[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[sr[u]>>l]=h}else for(a=new Ct(r),n=0;n<r;++n)s[n]&&(a[n]=sr[o[s[n]-1]++]>>15-s[n]);return a},Rt=new ht(288),j=0;j<144;++j)Rt[j]=8;for(var j=144;j<256;++j)Rt[j]=9;for(var j=256;j<280;++j)Rt[j]=7;for(var j=280;j<288;++j)Rt[j]=8;for(var ce=new ht(32),j=0;j<32;++j)ce[j]=5;var gs=Bt(Rt,9,0),ys=Bt(Rt,9,1),ms=Bt(ce,5,0),ws=Bt(ce,5,1),ir=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Tt=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},or=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},ar=function(s){return(s+7)/8|0},Xr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ht(s.subarray(t,e))},xs=["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"],At=function(s,t,e){var r=new Error(t||xs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,At),!e)throw r;return r},vs=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ht(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new ht(n*3));var h=function(Dt){var Lt=e.length;if(Dt>Lt){var qt=new ht(Math.max(Lt*2,Dt));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,M=n*8;do{if(!p){c=Tt(s,u,1);var b=Tt(s,u+1,3);if(u+=3,b)if(b==1)p=ys,g=ws,m=9,d=5;else if(b==2){var x=Tt(s,u,31)+257,A=Tt(s,u+10,15)+4,C=x+Tt(s,u+5,31)+1;u+=14;for(var _=new ht(C),V=new ht(19),H=0;H<A;++H)V[rr[H]]=Tt(s,u+H*3,7);u+=A*3;for(var E=ir(V),et=(1<<E)-1,P=Bt(V,E,1),H=0;H<C;){var F=P[Tt(s,u,et)];u+=F&15;var S=F>>4;if(S<16)_[H++]=S;else{var q=0,z=0;for(S==16?(z=3+Tt(s,u,3),u+=2,q=_[H-1]):S==17?(z=3+Tt(s,u,7),u+=3):S==18&&(z=11+Tt(s,u,127),u+=7);z--;)_[H++]=q}}var U=_.subarray(0,x),L=_.subarray(x);m=ir(U),d=ir(L),p=Bt(U,m,1),g=Bt(L,d,1)}else At(1);else{var S=ar(u)+4,T=s[S-4]|s[S-3]<<8,w=S+T;if(w>n){l&&At(0);break}a&&h(f+T),e.set(s.subarray(S,w),f),t.b=f+=T,t.p=u=w*8,t.f=c;continue}if(u>M){l&&At(0);break}}a&&h(f+131072);for(var nt=(1<<m)-1,O=(1<<d)-1,Z=u;;Z=u){var q=p[or(s,u)&nt],R=q>>4;if(u+=q&15,u>M){l&&At(0);break}if(q||At(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,D=Oe[H];G=Tt(s,u,(1<<D)-1)+Wr[H],u+=D}var Q=g[or(s,u)&O],Y=Q>>4;Q||At(3),u+=Q&15;var L=ds[Y];if(Y>3){var D=Ie[Y];L+=or(s,u)&(1<<D)-1,u+=D}if(u>M){l&&At(0);break}a&&h(f+131072);var st=f+G;if(f<L){var Qt=i-L,Jt=Math.min(L,st);for(Qt+f<0&&At(3);f<Jt;++f)e[f]=r[Qt+f]}for(;f<st;++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&&o?Xr(e,0,f):e.subarray(0,f)},zt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ue=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},lr=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Kr,l:0};if(n==1){var o=new ht(e[0].s+1);return o[e[0].s]=1,{t:o,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!=n-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=i[0].s,r=1;r<n;++r)i[r].s>f&&(f=i[r].s);var p=new Ct(f+1),g=hr(e[c-1],p,0);if(g>t){var r=0,m=0,d=g-t,M=1<<d;for(i.sort(function(x,A){return p[A.s]-p[x.s]||x.f-A.f});r<n;++r){var b=i[r].s;if(p[b]>t)m+=M-(1<<g-p[b]),p[b]=t;else break}for(m>>=d;m>0;){var S=i[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var T=i[r].s;p[T]==t&&(--p[T],++m)}g=t}return{t:new ht(p),l:g}},hr=function(s,t,e){return s.s==-1?Math.max(hr(s.l,t,e+1),hr(s.r,t,e+1)):t[s.s]=e},Hr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new Ct(++t),r=0,n=s[0],i=1,o=function(l){e[r++]=l},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},fe=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Yr=function(s,t,e){var r=e.length,n=ar(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Zr=function(s,t,e,r,n,i,o,a,l,h,c){zt(t,c++,e),++n[256];for(var u=lr(n,15),f=u.t,p=u.l,g=lr(i,15),m=g.t,d=g.l,M=Hr(f),b=M.c,S=M.n,T=Hr(m),w=T.c,x=T.n,A=new Ct(19),C=0;C<b.length;++C)++A[b[C]&31];for(var C=0;C<w.length;++C)++A[w[C]&31];for(var _=lr(A,7),V=_.t,H=_.l,E=19;E>4&&!V[rr[E-1]];--E);var et=h+5<<3,P=fe(n,Rt)+fe(i,ce)+o,F=fe(n,f)+fe(i,m)+o+14+3*E+fe(A,V)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&et<=P&&et<=F)return Yr(t,c,s.subarray(l,l+h));var q,z,U,L;if(zt(t,c,1+(F<P)),c+=2,F<P){q=Bt(f,p,0),z=f,U=Bt(m,d,0),L=m;var nt=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 C=0;C<E;++C)zt(t,c+3*C,V[rr[C]]);c+=3*E;for(var O=[b,w],Z=0;Z<2;++Z)for(var R=O[Z],C=0;C<R.length;++C){var G=R[C]&31;zt(t,c,nt[G]),c+=V[G],G>15&&(zt(t,c,R[C]>>5&127),c+=R[C]>>12)}}else q=gs,z=Rt,U=ms,L=ce;for(var C=0;C<a;++C){var D=r[C];if(D>255){var G=D>>18&31;ue(t,c,q[G+257]),c+=z[G+257],G>7&&(zt(t,c,D>>23&31),c+=Oe[G]);var Q=D&31;ue(t,c,U[Q]),c+=L[Q],Q>3&&(ue(t,c,D>>5&8191),c+=Ie[Q])}else ue(t,c,q[D]),c+=z[D]}return ue(t,c,q[256]),c+z[256]},bs=new er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kr=new ht(0),Ss=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ht(r+o+5*(1+Math.ceil(o/7e3))+n),l=a.subarray(r,a.length-n),h=i.l,c=(i.r||0)&7;if(t){c&&(l[0]=i.r>>3);for(var u=bs[t-1],f=u>>13,p=u&8191,g=(1<<e)-1,m=i.p||new Ct(32768),d=i.h||new Ct(g+1),M=Math.ceil(e/3),b=2*M,S=function(he){return(s[he]^s[he+1]<<M^s[he+2]<<b)&g},T=new er(25e3),w=new Ct(288),x=new Ct(32),A=0,C=0,_=i.i||0,V=0,H=i.w||0,E=0;_+2<o;++_){var et=S(_),P=_&32767,F=d[et];if(m[P]=F,d[et]=P,H<=_){var q=o-_;if((A>7e3||V>24576)&&(q>423||!h)){c=Zr(s,l,0,T,w,x,C,V,E,_-E,c),V=A=C=0,E=_;for(var z=0;z<286;++z)w[z]=0;for(var z=0;z<30;++z)x[z]=0}var U=2,L=0,nt=p,O=P-F&32767;if(q>2&&et==S(_-O))for(var Z=Math.min(f,q)-1,R=Math.min(32767,_),G=Math.min(258,q);O<=R&&--nt&&P!=F;){if(s[_+U]==s[_+U-O]){for(var D=0;D<G&&s[_+D]==s[_+D-O];++D);if(D>U){if(U=D,L=O,D>Z)break;for(var Q=Math.min(O,D-2),Y=0,z=0;z<Q;++z){var st=_-O+z&32767,Qt=m[st],Jt=st-Qt&32767;Jt>Y&&(Y=Jt,F=st)}}}P=F,F=m[P],O+=P-F&32767}if(L){T[V++]=268435456|nr[U]<<18|jr[L];var Dt=nr[U]&31,Lt=jr[L]&31;C+=Oe[Dt]+Ie[Lt],++w[257+Dt],++x[Lt],H=_+U,++A}else T[V++]=s[_],++w[s[_]]}}for(_=Math.max(_,H);_<o;++_)T[V++]=s[_],++w[s[_]];c=Zr(s,l,h,T,w,x,C,V,E,_-E,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=d,i.p=m,i.i=_,i.w=H)}else{for(var _=i.w||0;_<o+h;_+=65535){var qt=_+65535;qt>=o&&(l[c/8|0]=h,qt=o),c=Yr(l,c+1,s.subarray(_,qt))}i.i=o}return Xr(a,0,r+ar(c)+n)},Qr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},Ps=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ht(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return Ss(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Jr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},Cs=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Qr();n.p(t.dictionary),Jr(s,2,n.d())}},_s=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&At(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&At(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Ms(s,t){t||(t={});var e=Qr();e.p(s);var r=Ps(s,t,t.dictionary?6:2,4);return Cs(r,t),Jr(r,r.length-4,e.d()),r}function Ts(s,t){return vs(s.subarray(_s(s,t),-4),{i:2},t,t)}var As=typeof TextDecoder<"u"&&new TextDecoder,Os=0;try{As.decode(Kr,{stream:!0}),Os=1}catch{}const Is="modern-font";function pe(s,t){if(!s)throw new Error(`[${Is}] ${t}`)}function $s(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function ee(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}function Bs(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function $e(s){s=Bs(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Es(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function ks(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}var tn=Object.defineProperty,Us=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ct=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&tn(t,e,n),n},Ds=(s,t,e)=>(Us(s,t+"",e),e);const Be={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(s,t){Object.defineProperty(s.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,n){super($s(t),e,r),this.littleEndian=n,Ds(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));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,n)=>{this.write(t.type,e[n],t.offset+n)}):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 n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=Be[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}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),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=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 i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=Be[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);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 n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=ee(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}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 Ls=Object.defineProperty,Fs=(s,t,e)=>t in s?Ls(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,zs=(s,t,e)=>(Fs(s,t+"",e),e);const en=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=en.get(n);o||(o={columns:[],byteLength:0},en.set(n,o));const a={...t,name:i,byteLength:e*Be[r],offset:t.offset??o.columns.reduce((l,h)=>l+h.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((l,h)=>l+Be[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){zs(this,"view"),this.view=new ot(t,e,r,n)}}class cr 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 rn=Object.defineProperty,Ns=(s,t,e)=>t in s?rn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&rn(t,e,n),n},nn=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);const wt=class ls extends cr{constructor(){super(...arguments),nn(this,"format","EmbeddedOpenType"),nn(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=$e(n.fontFamily||""),o=i.length,a=$e(n.fontStyle||""),l=a.length,h=$e(n.version||""),c=h.length,u=$e(n.fullName||""),f=u.length,p=86+o+4+l+4+c+4+f+2+t.view.byteLength,g=new ls(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(o),g.view.writeBytes(i),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 qs=Object.defineProperty,Ee=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&qs(t,e,n),n};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 ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Gs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Rs=Object.defineProperty,Ws=(s,t,e)=>t in s?Rs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e)=>(Ws(s,typeof t!="symbol"?t+"":t,e),e);class sn{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,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:l=o}=n,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 Vs extends sn{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:l}=t,h=t.topDict.paintType,c=this.index;let u,f,p,g;const m=[],d=[];let M=0,b=!1,S=!1,T=o,w=0,x=0;function A(P,F){m.push({type:"L",x:P,y:F})}function C(P,F,q,z,U,L){m.push({type:"C",x1:P,y1:F,x2:q,y2:z,x:U,y:L})}function _(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&&!b&&(T=d.shift()+i),M+=d.length>>1,d.length=0,b=!0}function et(P){let F,q,z,U,L,nt,O,Z,R,G,D,Q,Y=0;for(;Y<P.length;){let st=P[Y++];switch(st){case 1:E();break;case 3:E();break;case 4:d.length>1&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),_(w,x);break;case 5:for(;d.length>0;)w+=d.shift(),x+=d.shift(),A(w,x);break;case 6:for(;d.length>0&&(w+=d.shift(),A(w,x),d.length!==0);)x+=d.shift(),A(w,x);break;case 7:for(;d.length>0&&(x+=d.shift(),A(w,x),d.length!==0);)w+=d.shift(),A(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(),C(u,f,p,g,w,x);break;case 10:L=d.pop()+l,nt=t.subrs[L],nt&&et(nt);break;case 11:return;case 12:switch(st=P[Y],Y+=1,st){case 35:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g+d.shift(),R=O+d.shift(),G=Z+d.shift(),D=R+d.shift(),Q=G+d.shift(),w=D+d.shift(),x=Q+d.shift(),d.shift(),C(u,f,p,g,O,Z),C(R,G,D,Q,w,x);break;case 34:u=w+d.shift(),f=x,p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g,R=O+d.shift(),G=g,D=R+d.shift(),Q=x,w=D+d.shift(),C(u,f,p,g,O,Z),C(R,G,D,Q,w,x);break;case 36:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g,R=O+d.shift(),G=g,D=R+d.shift(),Q=G+d.shift(),w=D+d.shift(),C(u,f,p,g,O,Z),C(R,G,D,Q,w,x);break;case 37:u=w+d.shift(),f=x+d.shift(),p=u+d.shift(),g=f+d.shift(),O=p+d.shift(),Z=g+d.shift(),R=O+d.shift(),G=Z+d.shift(),D=R+d.shift(),Q=G+d.shift(),Math.abs(D-w)>Math.abs(Q-x)?w=D+d.shift():x=Q+d.shift(),C(u,f,p,g,O,Z),C(R,G,D,Q,w,x);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),d.length=0}break;case 14:if(d.length>=4){const Qt=ur[d.pop()],Jt=ur[d.pop()],Dt=d.pop(),Lt=d.pop();if(Qt&&Jt){n.isComposite=!0,n.components=[];const qt=t.charset.indexOf(Qt),he=t.charset.indexOf(Jt);n.components.push({glyphIndex:he,dx:0,dy:0}),n.components.push({glyphIndex:qt,dx:Lt,dy:Dt}),H(r.get(he).pathCommands);const Lr=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let Fr=0;Fr<Lr.length;Fr+=1){const Ft=Lr[Fr];Ft.type!=="Z"&&(Ft.x+=Lt,Ft.y+=Dt),(Ft.type==="Q"||Ft.type==="C")&&(Ft.x1+=Lt,Ft.y1+=Dt),Ft.type==="C"&&(Ft.x2+=Lt,Ft.y2+=Dt)}H(Lr)}}else d.length>0&&!b&&(T=d.shift()+i,b=!0);S&&h!==2&&(V(),S=!1);break;case 18:E();break;case 19:case 20:E(),Y+=M+7>>3;break;case 21:d.length>2&&!b&&(T=d.shift()+i,b=!0),x+=d.pop(),w+=d.pop(),_(w,x);break;case 22:d.length>1&&!b&&(T=d.shift()+i,b=!0),w+=d.pop(),_(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(),C(u,f,p,g,w,x);w+=d.shift(),x+=d.shift(),A(w,x);break;case 25:for(;d.length>6;)w+=d.shift(),x+=d.shift(),A(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(),C(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(),C(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,C(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,nt=t.gsubrs[L],nt&&et(nt);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),C(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),C(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),C(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),C(u,f,p,g,w,x);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?d.push(st-139):st<251?(F=P[Y],Y+=1,d.push((st-247)*256+F+108)):st<255?(F=P[Y],Y+=1,d.push(-(st-251)*256-F-108)):(F=P[Y],q=P[Y+1],z=P[Y+2],U=P[Y+3],Y+=4,d.push((F<<24|q<<16|z<<8|U)/65536))}}}et(e),this.pathCommands=m,b&&(this.advanceWidth=T)}}var js=Object.defineProperty,Xs=(s,t,e)=>t in s?js(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Hs=(s,t,e)=>(Xs(s,t+"",e),e);class on{constructor(t){this._sfnt=t,Hs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Ys extends on{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Vs({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var an=Object.defineProperty,Zs=(s,t,e)=>t in s?an(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ln=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&an(t,e,n),n},ke=(s,t,e)=>(Zs(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends Mt{constructor(t,e,r,n){super(t,e,r,n),ke(this,"_offsets"),ke(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 n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let l=0;for(let h=0;h<r;h++)l<<=8,l+=a.readUint8();n.push(l)}return n}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,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}ln([y("uint16")],Ue.prototype,"count"),ln([y("uint8")],Ue.prototype,"offsetSize");class De extends Ue{constructor(){super(...arguments),ke(this,"_isString",!1)}}class hn extends Ue{constructor(){super(...arguments),ke(this,"_isString",!0)}}const Ks=[".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"],Qs=[".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"],Js=[".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"],ti=[".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(s,t){return t<=390?Ks[t]:s[t-391]}var ei=Object.defineProperty,ri=(s,t,e)=>t in s?ei(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,cn=(s,t,e)=>(ri(s,typeof t!="symbol"?t+"":t,e),e);function X(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class un extends Mt{constructor(){super(...arguments),cn(this,"_dict"),cn(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,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;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,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_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 ni=Object.defineProperty,fr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ni(t,e,n),n};class Fe extends un{}fr([X(19)],Fe.prototype,"subrs"),fr([X(20)],Fe.prototype,"defaultWidthX"),fr([X(21)],Fe.prototype,"nominalWidthX");var si=Object.defineProperty,J=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&si(t,e,n),n};class K extends un{}J([X(0,"string")],K.prototype,"version"),J([X(1,"string")],K.prototype,"notice"),J([X(1200,"string")],K.prototype,"copyright"),J([X(2,"string")],K.prototype,"fullName"),J([X(3,"string")],K.prototype,"familyName"),J([X(4,"string")],K.prototype,"weight"),J([X(1201)],K.prototype,"isFixedPitch"),J([X(1202)],K.prototype,"italicAngle"),J([X(1203,"number",-100)],K.prototype,"underlinePosition"),J([X(1204,"number",50)],K.prototype,"underlineThickness"),J([X(1205)],K.prototype,"paintType"),J([X(1206,"number",2)],K.prototype,"charstringType"),J([X(1207,"number[]",[.001,0,0,.001,0,0])],K.prototype,"fontMatrix"),J([X(13)],K.prototype,"uniqueId"),J([X(5,"number[]",[0,0,0,0])],K.prototype,"fontBBox"),J([X(1208)],K.prototype,"strokeWidth"),J([X(14)],K.prototype,"xuid"),J([X(15)],K.prototype,"charset"),J([X(16)],K.prototype,"encoding"),J([X(17)],K.prototype,"charStrings"),J([X(18,"number[]",[0,0])],K.prototype,"private");var ii=Object.defineProperty,oi=(s,t,e)=>t in s?ii(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,pr=(s,t,e)=>(oi(s,typeof t!="symbol"?t+"":t,e),e);function ft(s,t=s){return e=>{ze.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ze.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const fn=class Ae{constructor(t){pr(this,"tables",new Map),pr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,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:n}=this.cff;e=n.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),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){const o=[];return this.forEachGlyph(t,e,r,n,i,(a,l,h,c,u)=>{o.push(...a.getPathCommands(l,h,c,u,this))}),o}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(t);for(let h=0;h<l.length;h+=1){const c=l[h];o.call(this,c,e,r,n,i),c.advanceWidth&&(e+=c.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new Ae(this.tableViews)}delete(t){const e=Ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Ae.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Ae.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};pr(fn,"tableDefinitions",new Map);let ze=fn;class pt extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var pn=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,li=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ye=(s,t,e,r)=>{for(var n=r>1?void 0:r?ai(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&pn(t,e,n),n},dr=(s,t,e)=>(li(s,typeof t!="symbol"?t+"":t,e),e);let re=class extends pt{constructor(s,t,e,r){super(s,t,e,r),dr(this,"_glyphs"),dr(this,"privateDict"),dr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ys(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var s;return((s=this.privateDict)==null?void 0:s.defaultWidthX)??0}get nominalWidthX(){var s;return((s=this.privateDict)==null?void 0:s.nominalWidthX)??0}get subrs(){var s;return((s=this.subrsIndex)==null?void 0:s.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const s=this.view,{buffer:t,byteOffset:e}=s,r=e+4;this.nameIndex=new hn(t,r),this.topDictIndex=new De(t,this.nameIndex.endOffset),this.stringIndex=new hn(t,this.topDictIndex.endOffset),this.globalSubrIndex=new De(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const n=this.topDict.private[0],i=this.topDict.private[1];n&&(this.privateDict=new Fe(t,e+i,n).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(t,e+i+this.privateDict.subrs))),this.charStringsIndex=new De(t,e+this.topDict.charStrings);const o=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Qs:this.topDict.charset===1?this.charset=Js:this.topDict.charset===2?this.charset=ti:this.charset=this._readCharset(e+this.topDict.charset,o,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ur:this.topDict.encoding===1?this.encoding=Gs:this.encoding=this._readEncoding(e+this.topDict.encoding)}_readCharset(s,t,e){const r=this.view;r.seek(s);let n,i,o;t-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(n=0;n<t;n+=1)i=r.readUint16(),a.push(Le(e,i));else if(l===1)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint8(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else if(l===2)for(;a.length<=t;)for(i=r.readUint16(),o=r.readUint16(),n=0;n<=o;n+=1)a.push(Le(e,i)),i+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const t=this.view;t.seek(s);let e,r;const n={},i=t.readUint8();if(i===0){const o=t.readUint8();for(e=0;e<o;e+=1)r=t.readUint8(),n[r]=e}else if(i===1){const o=t.readUint8();for(r=1,e=0;e<o;e+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)n[h]=r,r+=1}}else console.warn(`unknown encoding format:${i}`);return n}_calcSubroutineBias(s){let t;return s.length<1240?t=107:s.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 hi=Object.defineProperty,Ne=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&hi(t,e,n),n};const me=class hs extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new hs;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),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 dn=me;var ci=Object.defineProperty,gr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ci(t,e,n),n};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,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=o.length?l=0:(l=o[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<t&&e.set(h,l);else{const c=r[h];for(let u=0,f=i[c].entryCount;u<f;u++)if(i[c].idRangeOffset+u>=o.length?l=0:(l=o[i[c].idRangeOffset+u],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<t){const p=(h<<8|u+i[c].firstCode)%65535;e.set(p,l)}}return e}}gr([y("uint16")],qe.prototype,"format"),gr([y("uint16")],qe.prototype,"length"),gr([y("uint16")],qe.prototype,"language");function gn(s){return s>32767?s-65536:s<-32767?s+65536:s}function yn(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:gn(i-o)}):(n.start=Number(o),n.startId=i,n.delta=gn(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var ui=Object.defineProperty,Ht=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ui(t,e,n),n};const Wt=class cs 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=yn(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new cs(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<e;++h)for(let c=n[h],u=i[h];c<=u;++c)if(o[h]===0)t.set(c,(c+a[h])%65536);else{const f=h+o[h]/2+(c-n[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 mn=Wt;var fi=Object.defineProperty,we=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&fi(t,e,n),n};class ne 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,n)=>{e.set(n,r)}),e}}we([y("uint16")],ne.prototype,"format"),we([y("uint16")],ne.prototype,"length"),we([y("uint16")],ne.prototype,"language"),we([y("uint16")],ne.prototype,"firstCode"),we([y("uint16")],ne.prototype,"entryCount");var pi=Object.defineProperty,xe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&pi(t,e,n),n};const se=class us 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=yn(t),r=new us(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(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)t.set(a++,o++)}return t}};xe([y("uint16")],se.prototype,"format"),xe([y("uint16")],se.prototype,"reserved"),xe([y("uint32")],se.prototype,"length"),xe([y("uint32")],se.prototype,"language"),xe([y("uint32")],se.prototype,"nGroups");let wn=se;var di=Object.defineProperty,yr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&di(t,e,n),n};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,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}yr([y("uint16")],Ge.prototype,"format"),yr([y("uint32")],Ge.prototype,"length"),yr([y("uint32")],Ge.prototype,"numVarSelectorRecords");var xn=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,yi=(s,t,e)=>t in s?xn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mr=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xn(t,e,n),n},vn=(s,t,e)=>(yi(s,typeof t!="symbol"?t+"":t,e),e);let ve=class extends pt{constructor(){super(...arguments),vn(this,"_unicodeToGlyphIndexMap"),vn(this,"_glyphIndexToUnicodesMap")}static from(s){const t=Array.from(s.keys()).some(c=>c>65535),e=mn.from(s),r=dn.from(s),n=t?wn.from(s):void 0,i=4+(n?32:24),o=i+e.view.byteLength,a=o+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:i},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:i},n&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new ve(new ArrayBuffer(4+8*l.length+e.view.byteLength+r.view.byteLength+((n==null?void 0:n.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,i),h.view.writeBytes(r.view,o),n&&h.view.writeBytes(n.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,t=this.unicodeToGlyphIndexMap,e=Array.from(t.keys());for(let r=0,n=e.length;r<n;r++){const i=e[r],o=t.get(i);s.has(o)?s.get(o).push(i):s.set(o,[i])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({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 dn(this.view.buffer,t.offset);break;case 2:r=new qe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new mn(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ne(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new wn(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 o,a,l,h,c;const s=this.readSubtables(),t=(o=s.find(u=>u.format===0))==null?void 0:o.view,e=(a=s.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:a.view,r=(l=s.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:l.view,n=(h=s.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:h.view,i=(c=s.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())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[]])}};mr([y("uint16")],ve.prototype,"version",2),mr([y("uint16")],ve.prototype,"numberSubtables",2),ve=mr([ft("cmap")],ve);class mi extends sn{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.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 n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=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(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;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 M=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.x=this._parseGlyphCoordinate(t,p,M,2,16),M=d.x;let b=0;for(let S=0;S<u;S+=1)p=f[S],d=m[S],d.y=this._parseGlyphCoordinate(t,p,b,4,32),b=d.y}this.points=m}else this.points=[]}else if(n===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 i=[],o=this._parseContours(this.points);for(let a=0,l=o.length;a<l;++a){const h=o[a];let c=h[h.length-1],u=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):u.onCurve?i.push({type:"M",x:u.x,y:u.y}):i.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)i.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}),i.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class wi extends on{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new mi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var bn=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,vi=(s,t,e)=>t in s?bn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,bi=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bn(t,e,n),n},Si=(s,t,e)=>(vi(s,t+"",e),e);let wr=class extends pt{constructor(){super(...arguments),Si(this,"_glyphs")}static from(s){const t=s.reduce((r,n)=>r+n.byteLength,0),e=new wr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeBytes(r)}),e}get glyphs(){return this._glyphs??(this._glyphs=new wi(this._sfnt))}};wr=bi([ft("glyf")],wr);var Pi=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,_i=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Pi(t,e,n),n};let Sn=class extends pt{};Sn=_i([ft("GPOS","gpos")],Sn);var Mi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Yt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mi(t,e,n),n};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 Ai=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,it=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ai(t,e,n),n};let rt=class extends pt{constructor(s=new ArrayBuffer(54),t){super(s,t,Math.min(54,s.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 Ii=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,xt=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ii(t,e,n),n};let dt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.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 Pn=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ei=(s,t,e)=>t in s?Pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ki=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Pn(t,e,n),n},Ui=(s,t,e)=>(Ei(s,t+"",e),e);let xr=class extends pt{constructor(){super(...arguments),Ui(this,"_metrics")}static from(s){const t=s.length*4,e=new xr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceWidth),e.view.writeUint16(r.leftSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let e=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((n,i)=>(i<t&&(e=r.readUint16()),{advanceWidth:e,leftSideBearing:r.readUint16()}))}};xr=ki([ft("hmtx")],xr);var Di=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Fi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Li(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Di(t,e,n),n};let Cn=class extends pt{};Cn=Fi([ft("kern","kern")],Cn);var _n=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Ni=(s,t,e)=>t in s?_n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,qi=(s,t,e,r)=>{for(var n=r>1?void 0:r?zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&_n(t,e,n),n},Gi=(s,t,e)=>(Ni(s,t+"",e),e);let vr=class extends pt{constructor(){super(...arguments),Gi(this,"_locations")}static from(s,t=1){const e=s.length*(t?4:2),r=new vr(new ArrayBuffer(e));return s.forEach(n=>{t?r.view.writeUint32(n):r.view.writeUint16(n/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const s=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,e=this.view;return e.seek(0),Array.from({length:s}).map(()=>t?e.readUint32():e.readUint16()*2)}};vr=qi([ft("loca")],vr);var Ri=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,gt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ri(t,e,n),n};let at=class extends pt{constructor(s=new ArrayBuffer(32),t){super(s,t,Math.min(32,s.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 Mn=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,ji=(s,t,e)=>t in s?Mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Re=(s,t,e,r)=>{for(var n=r>1?void 0:r?Vi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mn(t,e,n),n},Xi=(s,t,e)=>(ji(s,t+"",e),e);const Tn={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"},br={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Hi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},An={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 s=this.count;this.view.seek(6);const t=[];for(let a=0;a<s;++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<s;++a){const l=t[a];l.name=this.view.readBytes(e+l.offset,l.length)}let r=br.Macintosh,n=Hi.Default,i=0;t.some(a=>a.platform===br.Microsoft&&a.encoding===An.UCS2&&a.language===1033)&&(r=br.Microsoft,n=An.UCS2,i=1033);const o={};for(let a=0;a<s;++a){const l=t[a];l.platform===r&&l.encoding===n&&l.language===i&&Tn[l.nameId]&&(o[Tn[l.nameId]]=i===0?Es(l.name):ks(l.name))}return o}};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 Yi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,B=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yi(t,e,n),n};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]}};B([y("uint16")],I.prototype,"version",2),B([y("int16")],I.prototype,"xAvgCharWidth",2),B([y("uint16")],I.prototype,"usWeightClass",2),B([y("uint16")],I.prototype,"usWidthClass",2),B([y("uint16")],I.prototype,"fsType",2),B([y("uint16")],I.prototype,"ySubscriptXSize",2),B([y("uint16")],I.prototype,"ySubscriptYSize",2),B([y("uint16")],I.prototype,"ySubscriptXOffset",2),B([y("uint16")],I.prototype,"ySubscriptYOffset",2),B([y("uint16")],I.prototype,"ySuperscriptXSize",2),B([y("uint16")],I.prototype,"ySuperscriptYSize",2),B([y("uint16")],I.prototype,"ySuperscriptXOffset",2),B([y("uint16")],I.prototype,"ySuperscriptYOffset",2),B([y("uint16")],I.prototype,"yStrikeoutSize",2),B([y("uint16")],I.prototype,"yStrikeoutPosition",2),B([y("uint16")],I.prototype,"sFamilyClass",2),B([y({type:"uint8"})],I.prototype,"bFamilyType",2),B([y({type:"uint8"})],I.prototype,"bSerifStyle",2),B([y({type:"uint8"})],I.prototype,"bWeight",2),B([y({type:"uint8"})],I.prototype,"bProportion",2),B([y({type:"uint8"})],I.prototype,"bContrast",2),B([y({type:"uint8"})],I.prototype,"bStrokeVariation",2),B([y({type:"uint8"})],I.prototype,"bArmStyle",2),B([y({type:"uint8"})],I.prototype,"bLetterform",2),B([y({type:"uint8"})],I.prototype,"bMidline",2),B([y({type:"uint8"})],I.prototype,"bXHeight",2),B([y({type:"uint8",size:16})],I.prototype,"ulUnicodeRange",2),B([y({type:"char",size:4})],I.prototype,"achVendID",2),B([y("uint16")],I.prototype,"fsSelection",2),B([y("uint16")],I.prototype,"usFirstCharIndex",2),B([y("uint16")],I.prototype,"usLastCharIndex",2),B([y("int16")],I.prototype,"sTypoAscender",2),B([y("int16")],I.prototype,"sTypoDescender",2),B([y("int16")],I.prototype,"sTypoLineGap",2),B([y("uint16")],I.prototype,"usWinAscent",2),B([y("uint16")],I.prototype,"usWinDescent",2),B([y({offset:72,type:"uint8",size:8})],I.prototype,"ulCodePageRange",2),B([y({offset:72,type:"int16"})],I.prototype,"sxHeight",2),B([y("int16")],I.prototype,"sCapHeight",2),B([y("uint16")],I.prototype,"usDefaultChar",2),B([y("uint16")],I.prototype,"usBreakChar",2),B([y("uint16")],I.prototype,"usMaxContext",2),I=B([ft("OS/2","os2")],I);var Ki=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Et=(s,t,e,r)=>{for(var n=r>1?void 0:r?Qi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ki(t,e,n),n};let Ot=class extends pt{constructor(s=new ArrayBuffer(32),t,e){super(s,t,e)}};Et([y("fixed")],Ot.prototype,"format",2),Et([y("fixed")],Ot.prototype,"italicAngle",2),Et([y("int16")],Ot.prototype,"underlinePosition",2),Et([y("int16")],Ot.prototype,"underlineThickness",2),Et([y("uint32")],Ot.prototype,"isFixedPitch",2),Et([y("uint32")],Ot.prototype,"minMemType42",2),Et([y("uint32")],Ot.prototype,"maxMemType42",2),Et([y("uint32")],Ot.prototype,"minMemType1",2),Et([y("uint32")],Ot.prototype,"maxMemType1",2),Ot=Et([ft("post")],Ot);var Ji=Object.defineProperty,to=Object.getOwnPropertyDescriptor,vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?to(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ji(t,e,n),n};let yt=class extends pt{constructor(s=new ArrayBuffer(36),t){super(s,t,Math.min(36,s.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 On=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,ro=(s,t,e)=>t in s?On(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,no=(s,t,e,r)=>{for(var n=r>1?void 0:r?eo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&On(t,e,n),n},so=(s,t,e)=>(ro(s,t+"",e),e);let Sr=class extends pt{constructor(){super(...arguments),so(this,"_metrics")}static from(s){const t=s.length*4,e=new Sr(new ArrayBuffer(t));return s.forEach(r=>{e.view.writeUint16(r.advanceHeight),e.view.writeInt16(r.topSideBearing)}),e}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var n;const s=this._sfnt.maxp.numGlyphs,t=((n=this._sfnt.vhea)==null?void 0:n.numOfLongVerMetrics)??0,e=this.view;e.seek(0);let r=0;return Array.from({length:s}).map((i,o)=>(o<t&&(r=e.readUint16()),{advanceHeight:r,topSideBearing:e.readUint8()}))}};Sr=no([ft("vmtx")],Sr);var In=Object.defineProperty,io=(s,t,e)=>t in s?In(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Se=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&In(t,e,n),n},We=(s,t,e)=>(io(s,typeof t!="symbol"?t+"":t,e),e);class It extends cr{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 n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=Array.from(t.tableViews.values()).reduce((u,f)=>u+e(f.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,l=0;const h=i.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,i.view.writeBytes(u,a),a+=e(p.length)});const c=i.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(i.view),i}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 oo=Object.defineProperty,ao=(s,t,e)=>t in s?oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Pr=(s,t,e)=>(ao(s,typeof t!="symbol"?t+"":t,e),e);class Ve extends It{constructor(){super(...arguments),Pr(this,"format","OpenType"),Pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}Pr(Ve,"signature",new Set([1330926671]));var lo=Object.defineProperty,Pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&lo(t,e,n),n};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 $n=Object.defineProperty,ho=(s,t,e)=>t in s?$n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_t=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&$n(t,e,n),n},je=(s,t,e)=>(ho(s,typeof t!="symbol"?t+"":t,e),e);const bt=class zr extends cr{constructor(){super(...arguments),je(this,"format","WOFF"),je(this,"mimeType","font/woff"),je(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,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let l=n*4;for(;a>0;)i+=e.getUint8(l)<<a*8,l++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const p=ee(Ms(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:p.byteLength<u.byteLength?p:u,rawView:u})});const i=n.length,o=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new zr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((u,f)=>u+r(f.rawView.byteLength),0);let l=44+i*20,h=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[h++];f.tag=u.tag,f.offset=l,f.compLength=u.view.byteLength,f.origChecksum=zr.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,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(Ts(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};je(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 Cr=bt;function co(s,t=!0){if(It.is(s))return new It(s);if(Ve.is(s))return new Ve(s);if(Cr.is(s))return new Cr(s);if(t)throw new Error("Failed to parseFont")}var uo=Object.defineProperty,fo=(s,t,e)=>t in s?uo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ce=(s,t,e)=>(fo(s,typeof t!="symbol"?t+"":t,e),e);const Bn=class fs{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,{...fs.defaultRequestInit,...e,signal:r.signal}).then(n=>n.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:n=!0,injectStyleTag:i=!0,...o}=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,o),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"&&(n&&this.injectFontFace(g,f),i&&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?co(f,!1):void 0),p}function m(){const d=g();if(d instanceof It||d instanceof Cr)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(Bn,"defaultRequestInit",{cache:"force-cache"});let po=Bn;const go=new po,yo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function _r(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="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;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=yo[o],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.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,n=this.x-e.x,i=-(this.y-e.y),o=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-i*o),e.y-(n*o+i*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 n=t<0?r.x-this.x+r.x:this.x,i=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=i*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,i=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*i),this.y=r.y+(i+Math.tan(e)*n),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,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[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,n=0){this.left=t,this.top=e,this.width=r,this.height=n}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((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{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 mo=Object.defineProperty,wo=(s,t,e)=>t in s?mo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,xo=(s,t,e)=>(wo(s,t+"",e),e);class St{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,l=0,h=1){xo(this,"elements",[]),this.set(t,e,r,n,i,o,a,l,h)}set(t,e,r,n,i,o,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=l,c[6]=r,c[7]=o,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,n=e.elements,i=this.elements,o=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=n[0],d=n[3],M=n[6],b=n[1],S=n[4],T=n[7],w=n[2],x=n[5],A=n[8];return i[0]=o*m+a*b+l*w,i[3]=o*d+a*S+l*x,i[6]=o*M+a*T+l*A,i[1]=h*m+c*b+u*w,i[4]=h*d+c*S+u*x,i[7]=h*M+c*T+u*A,i[2]=f*m+p*b+g*w,i[5]=f*d+p*S+g*x,i[8]=f*M+p*T+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*o-a*h,f=a*l-c*i,p=h*i-o*l,g=e*u+r*f+n*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]=(n*h-c*r)*m,t[2]=(a*r-n*o)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*i-a*e)*m,t[6]=p*m,t[7]=(r*l-h*e)*m,t[8]=(o*e-r*i)*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(Mr.makeScale(t,e)),this}rotate(t){return this.premultiply(Mr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Mr.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 Mr=new St;function En(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function vo(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(o.x-a.x)/2,h=(o.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 M=f*m+p*g,b=(f*p-M)/M;let S=Math.sqrt(Math.max(0,b));n===i&&(S=-S);const T=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*T-Math.sin(r)*w+(o.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*w+(o.y+a.y)/2,C=En(1,0,(c-T)/t,(u-w)/e),_=En((c-T)/t,(u-w)/e,(-c-T)/t,(-u-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,C,C+_,i===1)}function oe(s,t){return s-(t-s)}function kn(s,t){const e=new v,r=new v;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=oe(e.x,r.x),l=oe(e.y,r.y);r.x=a,r.y=l,o.type==="t"?(t.quadraticCurveTo(a,l,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,l,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),vo(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function kt(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(d,M,b){const S=new SyntaxError(`Unexpected character "${d}" at index ${M}.`);throw S.partial=b,S}function p(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=s.length;for(let d=0;d<m;d++){if(g=s[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 bo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,i=s.length;n<i;n++){const o=s[n];switch(o.type){case"m":case"M":if(o.x===e.x&&o.y===e.y)continue;r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y,t.x=o.x,t.y=o.y;break;case"h":case"H":r+=`${o.type} ${o.x}`,e.x=o.x;break;case"v":case"V":r+=`${o.type} ${o.y}`,e.y=o.y;break;case"l":case"L":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"c":case"C":r+=`${o.type} ${o.x1} ${o.y1} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"s":case"S":r+=`${o.type} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"q":case"Q":r+=`${o.type} ${o.x1} ${o.y1} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"t":case"T":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"a":case"A":r+=`${o.type} ${o.rx} ${o.ry} ${o.angle} ${o.largeArcFlag} ${o.sweepFlag} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"z":case"Z":r+=o.type,e.x=t.x,e.y=t.y;break}}return r}const So=/[a-df-z][^a-df-z]*/gi;function Un(s){const t=[],e=s.match(So);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let l;switch(o){case"m":case"M":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:o,x:l[h],y:l[h+1]}):t.push({type:o==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=kt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,x:l[h]});break;case"v":case"V":l=kt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,y:l[h]});break;case"l":case"L":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"c":case"C":l=kt(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:o,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=kt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=kt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"a":case"A":l=kt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:o,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:o});break;default:console.warn(i)}}return t}var Po=Object.defineProperty,Co=(s,t,e)=>t in s?Po(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Tr=(s,t,e)=>(Co(s,typeof t!="symbol"?t+"":t,e),e);class Zt{constructor(){Tr(this,"arcLengthDivisions",200),Tr(this,"_cacheArcLengths"),Tr(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,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,l=i-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-o,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(i-1);const c=r[n],f=r[n+1]-c,p=(o-c)/f;return(n+p)/(i-1)}getTangent(t,e=new v){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).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,n=1,i=(r+n)/2;for(;n-r>e;){i=(r+n)/2;const o=this.getPoint(i);if(o.distanceTo(t)<e)return i;o.x<t.x?r=i:n=i}return i}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 bo(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 Dn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+i+o)*l+(-3*e+3*r-2*i-o)*a+i*s+e}function _o(s,t){const e=1-s;return e*e*t}function Mo(s,t){return 2*(1-s)*s*t}function To(s,t){return s*s*t}function Ln(s,t,e,r){return _o(s,t)+Mo(s,e)+To(s,r)}function Ao(s,t){const e=1-s;return e*e*e*t}function Oo(s,t){const e=1-s;return 3*e*e*s*t}function Io(s,t){return 3*(1-s)*s*s*t}function $o(s,t){return s*s*s*t}function Fn(s,t,e,r,n){return Ao(s,t)+Oo(s,e)+Io(s,r)+$o(s,n)}class Bo extends Zt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(Fn(t,r.x,n.x,i.x,o.x),Fn(t,r.y,n.y,i.y,o.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.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)),M=this.getPoint(d);t.x=Math.min(t.x,M.x),t.y=Math.min(t.y,M.y),e.x=Math.max(e.x,M.x),e.y=Math.max(e.y,M.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=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:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:i}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.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 Eo=new St,zn=new St,Nn=new St,je=new v;class ko extends Zt{constructor(t=new v,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),l=this.center.y+this.radiusY*Math.sin(o);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:n,endAngle:i,clockwise:o,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-i),p=f>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const d=n+Math.PI,M=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),b=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:M,y:b},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const d=l+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),M=h+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*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:M}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,i,o,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,Lo(t)?Uo(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:l}=r,h=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*h*h+i*i*c*c),f=Math.sqrt(n*n*c*c+i*i*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(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new v(e*n,e*i),a=new v(-r*i,r*n),l=o.applyMatrix3(t),h=a.applyMatrix3(t),c=Eo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=zn.copy(c).invert(),g=Nn.copy(u).transpose().multiply(u).elements,m=Fo(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),M=Math.sqrt(m.rt2);if(s.radiusX=1/d,s.radiusY=1/M,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=zn.set(d,0,0,0,M,0,0,0,1),T=Nn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(T).multiply(c),x=A=>{const{x:C,y:_}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(_,C)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),qn(t)&&(s.clockwise=!s.clockwise)}}function Do(s,t){const e=Rn(t),r=Gn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,qn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function qn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Lo(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Rn(s),n=Gn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Rn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Gn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Fo(s,t,e){let r,n,i,o,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),h>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Ar 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:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.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 zo 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:n,end:i}=this;return e.set(Ln(t,r.x,n.x,i.x),Ln(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+i.x),h=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,l),t.y=Math.min(t.y,r.y,i.y,a,h),e.x=Math.max(e.x,r.x,i.x,o,l),e.y=Math.max(e.y,r.y,i.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:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.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 No=Object.defineProperty,qo=(s,t,e)=>t in s?No(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Wn=(s,t,e)=>(qo(s,typeof t!="symbol"?t+"":t,e),e);class Ro extends Zt{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,Wn(this,"curves",[]),Wn(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,n=this.rx/this.aspectRatio,i=[new v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new Ar(i[o].clone(),i[(o+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,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],l=r[i],h=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Dn(o,a.x,l.x,h.x,c.x),Dn(o,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 Wo=Object.defineProperty,Vo=(s,t,e)=>t in s?Wo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_e=(s,t,e)=>(Vo(s,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:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return kn(t,this),this}addData(t){return this.addCommands(Un(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],l=a.getLength();return a.getPointAt(l===0?0:1-o/l,e)}i++}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,n=this.curves.length;r<n;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 n;for(let i=0,o=r.length;i<o;i++){const l=r[i].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=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 Ar(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 Ar(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new Bo(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new zo(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,l=!0){const h=new ko(new v(t,e),r,n,i,o,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,n,i,o,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,i,o,a,l),this}rect(t,e,r,n){return this.curves.push(new Ro(new v(t+r/2,e+n/2),r/2,r/n)),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(n=>n.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 Xo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(s,t,e,r){const n=t.clone().sub(s),i=r.clone().sub(e),o=e.clone().sub(s),a=n.cross(i);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const l=o.cross(i)/a;return Math.abs(l)>1?new v((s.x+e.x)/2,(s.y+e.y)/2):new v(s.x+l*n.x,s.y+l*n.y)}var Ho=Object.defineProperty,Yo=(s,t,e)=>t in s?Ho(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Or=(s,t,e)=>(Yo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Or(this,"currentPath",new Me),Or(this,"paths",[this.currentPath]),Or(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:n}=this.currentPath;return r.equals({x:t,y:e})||(n.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,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,l){return this.currentPath.ellipse(t,e,r,n,i,o,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return kn(t,this),this}addData(t){return this.addCommands(Un(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(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.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=[],n=[],i=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();i[l]=h,n[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 o=[];return r.forEach((a,l)=>{o[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&o[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];i[l].forEach(u=>{const f=a.getTForPoint(u),p=a.getNormal(f).scale(h?t:-t);u.add(p)})}),o.forEach((a,l)=>{const h=i[l];a.forEach(c=>{const u=i[c],f=jo(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 n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(t,e),r&&n>1){const o=n/2,a=i.isClockwise(),l=[];for(let h=0;h<=1;h+=1/i.arcLengthDivisions){const c=i.getPoint(h),u=i.getNormal(h),f=u.clone().scale(a?o:-o),p=u.clone().scale(a?-o:o);l.push(c.clone().add(f),c.clone().add(p),c.clone().add({x:o,y:0}),c.clone().add({x:-o,y:0}),c.clone().add({x:0,y:o}),c.clone().add({x:0,y:-o}),c.clone().add({x:o,y:o}),c.clone().add({x:-o,y:-o}))}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:n="none"}=e;return t.beginPath(),t.save(),_r(t,e),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),_r(t,e),this.getControlPoints().forEach(i=>{t.moveTo(i.x,i.y),t.arc(i.x,i.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="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 n in t)t[n]!==void 0&&(e[Xo(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</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:n,top:i,width:o,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=o*e,l.height=a*e,l.style.width=`${o}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-i),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 Ir="px",Vn=90,Xn=["mm","cm","in","pt","pc","px"],$r={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(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Xn.length;r<n;r++){const i=Xn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&Ir!=="px"?e=$r.in[Ir]/Vn:(e=$r[t][Ir],e<0&&(e=$r[t].in*Vn)),e*Number.parseFloat(s)}const Zo=new St,He=new St,jn=new St,Hn=new St;function Ko(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Qo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Qo(s){const t=new St,e=Zo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(W(s.getAttribute("x")),W(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const l=i.slice(0,o),h=kt(i.slice(o+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),jn.makeRotation(c),Hn.multiplyMatrices(jn,He),He.makeTranslation(u,f),e.multiplyMatrices(He,Hn)}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 Jo(s){return new Pt().addPath(new Me().arc(W(s.getAttribute("cx")||0),W(s.getAttribute("cy")||0),W(s.getAttribute("r")||0),0,Math.PI*2))}function ta(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(o=>o.trim()),i={};for(let o=r.style.length,a=0;a<o;a++){const l=r.style.item(a);i[l]=r.style.getPropertyValue(l)}for(let o=0;o<n.length;o++)t[n[o]]=Object.assign(t[n[o]]||{},{...i})}}function ea(s){return new Pt().addPath(new Me().ellipse(W(s.getAttribute("cx")||0),W(s.getAttribute("cy")||0),W(s.getAttribute("rx")||0),W(s.getAttribute("ry")||0),0,0,Math.PI*2))}function ra(s){return new Pt().moveTo(W(s.getAttribute("x1")||0),W(s.getAttribute("y1")||0)).lineTo(W(s.getAttribute("x2")||0),W(s.getAttribute("y2")||0))}function na(s){const t=new Pt,e=s.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 ia(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(sa,(n,i,o)=>{const a=W(i),l=W(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const oa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function aa(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(oa,(n,i,o)=>{const a=W(i),l=W(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function la(s){const t=W(s.getAttribute("x")||0),e=W(s.getAttribute("y")||0),r=W(s.getAttribute("rx")||s.getAttribute("ry")||0),n=W(s.getAttribute("ry")||s.getAttribute("rx")||0),i=W(s.getAttribute("width")),o=W(s.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+i-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),l.lineTo(t+i,e+o-n),(r!==0||n!==0)&&l.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),l.lineTo(t+r,e+o),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Ut(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.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]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=i){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function o(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 n("fill","fill"),n("fill-opacity","fillOpacity",o),n("fill-rule","fillRule"),n("opacity","opacity",o),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",o),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",W),n("visibility","visibility"),t}function Br(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,i=null,o={...t};switch(s.nodeName){case"svg":o=Ut(s,o,r);break;case"style":ta(s,r);break;case"g":o=Ut(s,o,r);break;case"path":o=Ut(s,o,r),s.hasAttribute("d")&&(i=na(s));break;case"rect":o=Ut(s,o,r),i=la(s);break;case"polygon":o=Ut(s,o,r),i=ia(s);break;case"polyline":o=Ut(s,o,r),i=aa(s);break;case"circle":o=Ut(s,o,r),i=Jo(s);break;case"ellipse":o=Ut(s,o,r),i=ea(s);break;case"line":o=Ut(s,o,r),i=ra(s);break;case"defs":n=!0;break;case"use":{o=Ut(s,o,r);const p=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(p);g?Br(g,o,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(s);break}if(o.display==="none")return e;Object.assign(t,o);const a=new St,l=[],h=Ko(s,a,l);i&&(i.matrix(a),e.push(i),i.style=t);const c=s.childNodes;for(let f=0,p=c.length;f<p;f++){const g=c[f];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Br(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Yn="data:image/svg+xml;",Zn=`${Yn}base64,`,Kn=`${Yn}charset=utf8,`;function Qn(s){if(typeof s=="string"){let t;return s.startsWith(Zn)?(s=s.substring(Zn.length,s.length),t=atob(s)):s.startsWith(Kn)?(s=s.substring(Kn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Jn(s){return Br(Qn(s),{})}function Te(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new N(e.x,e.y,r.x-e.x,r.y-e.y)}const ha=new Set(["©","®","÷"]),ca=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ua={1:"italic",32:"bold"},fa={1:"italic",2:"bold"},ts={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class es{constructor(t,e,r){$(this,"path",new Pt);$(this,"lineBox",new N);$(this,"inlineBox",new N);$(this,"glyphBox");$(this,"advanceWidth",0);$(this,"advanceHeight",0);$(this,"underlinePosition",0);$(this,"underlineThickness",0);$(this,"strikeoutPosition",0);$(this,"strikeoutSize",0);$(this,"ascender",0);$(this,"descender",0);$(this,"typoAscender",0);$(this,"typoDescender",0);$(this,"typoLineGap",0);$(this,"winAscent",0);$(this,"winDescent",0);$(this,"xHeight",0);$(this,"capHeight",0);$(this,"baseline",0);$(this,"centerDiviation",0);$(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??go,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:i}=t,o=i.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,p=o/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-n.underlinePosition)/p,this.underlineThickness=n.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=ua[r.fsSelection]??fa[i.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:i,baseline:o,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:p}=this,{left:g,top:m}=a,d=i.fontStyle==="italic"&&u!=="italic";let M=g,b=m+o,S;const T=new Pt;if(r&&(M+=(p-f)/2,Math.abs(f-p)>.1&&(b-=(l-c)/(l+Math.abs(h))*p),S=void 0),r&&!ha.has(n)&&(n.codePointAt(0)<=256||ca.has(n))){T.addCommands(e.getPathCommands(n,M,m+o-(p-f)/2,i.fontSize));const x={y:m-(p-f)/2+p/2,x:M+f/2};d&&this._italic(T,r?{x:x.x,y:m-(p-f)/2+o}:void 0),T.rotate(90,x)}else S!==void 0?(T.addCommands(e.glyphs.get(S).getPathCommands(M,b,i.fontSize)),d&&this._italic(T,r?{x:M+f/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(T.addCommands(e.getPathCommands(n,M,b,i.fontSize)),d&&this._italic(T,r?{x:M+p/2,y:b}:void 0));const w=i.fontWeight??400;return w in ts&&(w===700||w==="bold")&&u!=="bold"&&T.bold(ts[w]*i.fontSize*.05),T.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=T,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 n;if((n=this.path.paths[0])!=null&&n.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:n}=e;return new N(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,n={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)te(n);else{t.save(),t.beginPath();const i=this.path.style,o={...i,fill:n.color??i.fill,stroke:n.textStrokeColor??i.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize:i.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*n.fontSize,shadowOffsetY:(n.shadowOffsetY??0)*n.fontSize,shadowBlur:(n.shadowBlur??0)*n.fontSize,shadowColor:n.shadowColor};_r(t,o),t.font=`${n.fontSize}px ${n.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(s,t){return typeof s=="number"?s:s.endsWith("%")?(s=s.substring(0,s.length-1),Math.ceil(Number(s)/100*t.total)):s.endsWith("rem")?(s=s.substring(0,s.length-3),Number(s)*t.fontSize):s.endsWith("em")?(s=s.substring(0,s.length-2),Number(s)*t.fontSize):Number(s)}function Er(s){const t=Nt(s)?{}:s;return Object.keys(t).reduce((e,r)=>{let n=t[r];const i=kr(r),o=kr(n);return i&&(r=i),o&&(n=o),e[r]=n,e},{})}function Nt(s){return!s||s==="none"}function rs(s,t){const e=Object.keys(s),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(i=>Kt(s[i],t[i]))}function Kt(s,t){const e=typeof s;return e===typeof t?e==="object"?rs(s,t):s===t:!1}function kr(s){const t=s.startsWith("#")?s.slice(1):s;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,n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${i}, ${o})`}function Ze(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Ke(s){return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("blob://")}class ns{constructor(t,e={},r){$(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 es(r,e++,this));return this.characters=t,this}}class ae{constructor(t,e){$(this,"lineBox",new N);$(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 ns(t,e,this);return this.fragments.push(r),r}}function pa(s){return s}const tr=class tr{_styleToDomStyle(t){const e={...t};for(const r in t)tr.pxStyles.has(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createParagraphDom(t,e){const r=document.createDocumentFragment(),n=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(e.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&o?"100%":void 0,height:a&&!o?"100%":void 0}),t.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(u=>{const f=document.createElement("span");Object.assign(f.style,{verticalAlign:"inherit",...this._styleToDomStyle(u.style)}),f.appendChild(document.createTextNode(u.content)),c.appendChild(f)}),l.appendChild(c)}),n.appendChild(l),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var h;return(h=n.parentNode)==null?void 0:h.removeChild(n)}}}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let n=0;return Array.from(r).map(i=>{var u;const o=n+=r.substring(n).indexOf(i),a=o+i.length;n+=i.length,e.setStart(t,Math.max(o,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=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:o,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=>{n.push({...f,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(p=>{n.push({...p,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:n}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),n=this.measureDom(e);n.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}),n.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 i=[];let o=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.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=i[o];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),o++}),{paragraphs:t,boundingBox:new N(0,0,r.width,r.height)}}measure(t,e,r){let n;r||({dom:r,destory:n}=this.createParagraphDom(t,e));const i=this.measureParagraphDom(t,r);return n==null||n(),i}};$(tr,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let Qe=tr;class da{constructor(){$(this,"eventListeners",new Map)}addEventListener(t,e,r){const n={value:e,options:r},i=this.eventListeners.get(t);return i?Array.isArray(i)?i.push(n):this.eventListeners.set(t,[i,n]):this.eventListeners.set(t,n),this}removeEventListener(t,e,r){var i,o;if(!e)return this.eventListeners.delete(t),this;const n=this.eventListeners.get(t);if(!n)return this;if(Array.isArray(n)){const a=[];for(let l=0,h=n.length;l<h;l++){const c=n[l];(c.value!==e||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(t,a.length===1?a[0]:a):this.eventListeners.delete(t)}else n.value===e&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof n.options=="boolean"||(o=n.options)!=null&&o.once)&&this.eventListeners.delete(t);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(t){return this.eventListeners.has(t)}dispatchEvent(t,e){var n,i;const r=this.eventListeners.get(t);if(r){if(Array.isArray(r))for(let o=r.length,a=0;a<o;a++){const l=r[a];typeof l.options=="object"&&((n=l.options)!=null&&n.once)&&this.off(t,l.value,l.options),l.value.apply(this,[e])}else typeof r.options=="object"&&((i=r.options)!=null&&i.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 ss(){const s=[],t=[],e=new Map,r=new Map;async function n(o){if(!e.has(o)){e.set(o,o);try{e.set(o,await fetch(o).then(a=>a.text()))}catch(a){console.warn(a),e.delete(o)}}}function i(o){let a=r.get(o);if(!a){const l=Qn(Ke(o)?e.get(o)??o:o),h=Jn(l);a={dom:l,paths:h},r.set(o,a)}return a}return{name:"highlight",paths:s,load:async o=>{const a=[];o.forEachCharacter(l=>{const{computedStyle:h}=l,{highlightImage:c,highlightReferImage:u}=h;Ke(c)&&a.push(n(c)),Ke(u)&&a.push(n(u))}),await Promise.all(a)},update:o=>{t.length=0,s.length=0;let a=[],l,h;o.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:M,highlightSize:b,highlightThickness:S}=u;(!h||Kt(h.highlightImage,f)&&Kt(h.highlightColormap,d)&&Kt(h.highlightLine,M)&&Kt(h.highlightSize,b)&&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(U=>U.glyphBox).map(U=>U.glyphBox)),{computedStyle:g}=f,{fontSize:m,writingMode:d,highlightImage:M,highlightReferImage:b,highlightColormap:S,highlightLine:T,highlightSize:w,highlightThickness:x}=g,A=d.includes("vertical"),C=Ye(x,{fontSize:m,total:p.width})/p.width,_=Er(S),{paths:V,dom:H}=i(M),E=Te(V,!0),et=m/E.width*2,P=new N().copy(p);A&&(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(b)&&Nt(T)){const U=Te(i(b).paths,!0);E.copy(U)}else{let U;if(Nt(T))if(E.width/E.height>4){U="underline";const L=H.getAttribute("viewBox");if(L){const[nt,O,Z,G]=L.split(" ").map(D=>Number(D)),R=O+G/2;E.y<R&&E.y+E.height>R?U="line-through":E.y+E.height<R?U="overline":U="underline"}}else U="outline";else U=T;switch(U){case"outline":{const L=P.width*.2,nt=P.height*.2;P.width+=L,P.height+=nt,A?(P.x-=nt/2,P.y-=L/2,P.x+=P.height):(P.x-=L/2,P.y-=nt/2);break}case"overline":P.height=E.height*et,A?P.x=f.inlineBox.left+f.inlineBox.width:P.y=f.inlineBox.top;break;case"line-through":P.height=E.height*et,A?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,A?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);A&&z.rotate(-Math.PI/2),z.translate(P.x,P.y);for(let U=0;U<Math.ceil(F/q);U++){const L=z.clone();A?L.translate(0,U*P.width):L.translate(U*P.width,0),V.forEach(nt=>{const O=nt.clone().matrix(L);O.style.strokeWidth&&(O.style.strokeWidth*=et*C),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=et),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=et),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(Z=>Z*et)),O.style.fill&&O.style.fill in _&&(O.style.fill=_[O.style.fill]),O.style.stroke&&O.style.stroke in _&&(O.style.stroke=_[O.style.stroke]),s.push(O),F!==q&&(A?t[s.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):t[s.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(o,a)=>{s.forEach((l,h)=>{if(te({ctx:o,path:l,fontSize:a.computedStyle.fontSize,clipRect:t[h]}),a.debug){const c=Te([l]);c&&o.strokeRect(c.x,c.y,c.width,c.height)}})}}}function ga(s,t){return`<svg width="${s*2}" height="${s*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:n=!0,injectStyleTag:i=!0,...o}=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,o),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"&&(n&&this.injectFontFace(g,f),i&&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?co(f,!1):void 0),p}function m(){const d=g();if(d instanceof It||d instanceof Cr)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(Bn,"defaultRequestInit",{cache:"force-cache"});let po=Bn;const go=new po,yo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function _r(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="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;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=yo[o],s.miterLimit=a,s.setLineDash(l),s.lineDashOffset=h,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.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,n=this.x-e.x,i=-(this.y-e.y),o=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-i*o),e.y-(n*o+i*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 n=t<0?r.x-this.x+r.x:this.x,i=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=i*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,i=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*i),this.y=r.y+(i+Math.tan(e)*n),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,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[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,n=0){this.left=t,this.top=e,this.width=r,this.height=n}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((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{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 mo=Object.defineProperty,wo=(s,t,e)=>t in s?mo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,xo=(s,t,e)=>(wo(s,t+"",e),e);class St{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,l=0,h=1){xo(this,"elements",[]),this.set(t,e,r,n,i,o,a,l,h)}set(t,e,r,n,i,o,a,l,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=l,c[6]=r,c[7]=o,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,n=e.elements,i=this.elements,o=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=n[0],d=n[3],M=n[6],b=n[1],S=n[4],T=n[7],w=n[2],x=n[5],A=n[8];return i[0]=o*m+a*b+l*w,i[3]=o*d+a*S+l*x,i[6]=o*M+a*T+l*A,i[1]=h*m+c*b+u*w,i[4]=h*d+c*S+u*x,i[7]=h*M+c*T+u*A,i[2]=f*m+p*b+g*w,i[5]=f*d+p*S+g*x,i[8]=f*M+p*T+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*o-a*h,f=a*l-c*i,p=h*i-o*l,g=e*u+r*f+n*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]=(n*h-c*r)*m,t[2]=(a*r-n*o)*m,t[3]=f*m,t[4]=(c*e-n*l)*m,t[5]=(n*i-a*e)*m,t[6]=p*m,t[7]=(r*l-h*e)*m,t[8]=(o*e-r*i)*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(Mr.makeScale(t,e)),this}rotate(t){return this.premultiply(Mr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Mr.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 Mr=new St;function En(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function vo(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const l=(o.x-a.x)/2,h=(o.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 M=f*m+p*g,b=(f*p-M)/M;let S=Math.sqrt(Math.max(0,b));n===i&&(S=-S);const T=S*t*u/e,w=-S*e*c/t,x=Math.cos(r)*T-Math.sin(r)*w+(o.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*w+(o.y+a.y)/2,C=En(1,0,(c-T)/t,(u-w)/e),_=En((c-T)/t,(u-w)/e,(-c-T)/t,(-u-w)/e)%(Math.PI*2);s.ellipse(x,A,t,e,r,C,C+_,i===1)}function oe(s,t){return s-(t-s)}function kn(s,t){const e=new v,r=new v;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(oe(e.x,r.x),oe(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=oe(e.x,r.x),l=oe(e.y,r.y);r.x=a,r.y=l,o.type==="t"?(t.quadraticCurveTo(a,l,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,l,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),vo(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function kt(s,t,e=0){let a=0,l=!0,h="",c="";const u=[];function f(d,M,b){const S=new SyntaxError(`Unexpected character "${d}" at index ${M}.`);throw S.partial=b,S}function p(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=s.length;for(let d=0;d<m;d++){if(g=s[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 bo(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,i=s.length;n<i;n++){const o=s[n];switch(o.type){case"m":case"M":if(o.x===e.x&&o.y===e.y)continue;r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y,t.x=o.x,t.y=o.y;break;case"h":case"H":r+=`${o.type} ${o.x}`,e.x=o.x;break;case"v":case"V":r+=`${o.type} ${o.y}`,e.y=o.y;break;case"l":case"L":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"c":case"C":r+=`${o.type} ${o.x1} ${o.y1} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"s":case"S":r+=`${o.type} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"q":case"Q":r+=`${o.type} ${o.x1} ${o.y1} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"t":case"T":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"a":case"A":r+=`${o.type} ${o.rx} ${o.ry} ${o.angle} ${o.largeArcFlag} ${o.sweepFlag} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"z":case"Z":r+=o.type,e.x=t.x,e.y=t.y;break}}return r}const So=/[a-df-z][^a-df-z]*/gi;function Un(s){const t=[],e=s.match(So);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let l;switch(o){case"m":case"M":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?t.push({type:o,x:l[h],y:l[h+1]}):t.push({type:o==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=kt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,x:l[h]});break;case"v":case"V":l=kt(a);for(let h=0,c=l.length;h<c;h++)t.push({type:o,y:l[h]});break;case"l":case"L":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"c":case"C":l=kt(a);for(let h=0,c=l.length;h<c;h+=6)t.push({type:o,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=kt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=kt(a);for(let h=0,c=l.length;h<c;h+=4)t.push({type:o,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=kt(a);for(let h=0,c=l.length;h<c;h+=2)t.push({type:o,x:l[h],y:l[h+1]});break;case"a":case"A":l=kt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)t.push({type:o,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:o});break;default:console.warn(i)}}return t}var Po=Object.defineProperty,Co=(s,t,e)=>t in s?Po(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Tr=(s,t,e)=>(Co(s,typeof t!="symbol"?t+"":t,e),e);class Zt{constructor(){Tr(this,"arcLengthDivisions",200),Tr(this,"_cacheArcLengths"),Tr(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,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,l=i-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-o,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(i-1);const c=r[n],f=r[n+1]-c,p=(o-c)/f;return(n+p)/(i-1)}getTangent(t,e=new v){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).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,n=1,i=(r+n)/2;for(;n-r>e;){i=(r+n)/2;const o=this.getPoint(i);if(o.distanceTo(t)<e)return i;o.x<t.x?r=i:n=i}return i}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 bo(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 Dn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,l=s*a;return(2*e-2*r+i+o)*l+(-3*e+3*r-2*i-o)*a+i*s+e}function _o(s,t){const e=1-s;return e*e*t}function Mo(s,t){return 2*(1-s)*s*t}function To(s,t){return s*s*t}function Ln(s,t,e,r){return _o(s,t)+Mo(s,e)+To(s,r)}function Ao(s,t){const e=1-s;return e*e*e*t}function Oo(s,t){const e=1-s;return 3*e*e*s*t}function Io(s,t){return 3*(1-s)*s*s*t}function $o(s,t){return s*s*s*t}function Fn(s,t,e,r,n){return Ao(s,t)+Oo(s,e)+Io(s,r)+$o(s,n)}class Bo extends Zt{constructor(t=new v,e=new v,r=new v,n=new v){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new v){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(Fn(t,r.x,n.x,i.x,o.x),Fn(t,r.y,n.y,i.y,o.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(l=>l>=0&&l<=1)}getMinMax(t=v.MAX,e=v.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.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)),M=this.getPoint(d);t.x=Math.min(t.x,M.x),t.y=Math.min(t.y,M.y),e.x=Math.max(e.x,M.x),e.y=Math.max(e.y,M.y)}})(h,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=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:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:i}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.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 Eo=new St,zn=new St,Nn=new St,Xe=new v;class ko extends Zt{constructor(t=new v,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new v){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),l=this.center.y+this.radiusY*Math.sin(o);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:n,endAngle:i,clockwise:o,rotation:a}=this,{x:l,y:h}=t,c=l+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=h+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-i),p=f>Math.PI?1:0,g=o?1:0,m=a*180/Math.PI;if(f>=2*Math.PI){const d=n+Math.PI,M=l+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),b=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:M,y:b},{type:"A",rx:e,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const d=l+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),M=h+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*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:M}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:l}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!l),this}matrix(t){return Xe.set(this.center.x,this.center.y),Xe.applyMatrix3(t),this.center.x=Xe.x,this.center.y=Xe.y,Lo(t)?Uo(this,t):Do(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=v.MAX,e=v.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:l}=r,h=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*h*h+i*i*c*c),f=Math.sqrt(n*n*c*c+i*i*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(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new v(e*n,e*i),a=new v(-r*i,r*n),l=o.applyMatrix3(t),h=a.applyMatrix3(t),c=Eo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=zn.copy(c).invert(),g=Nn.copy(u).transpose().multiply(u).elements,m=Fo(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),M=Math.sqrt(m.rt2);if(s.radiusX=1/d,s.radiusY=1/M,s.rotation=Math.atan2(m.sn,m.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const S=zn.set(d,0,0,0,M,0,0,0,1),T=Nn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=S.multiply(T).multiply(c),x=A=>{const{x:C,y:_}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(w);return Math.atan2(_,C)};s.startAngle=x(s.startAngle),s.endAngle=x(s.endAngle),qn(t)&&(s.clockwise=!s.clockwise)}}function Do(s,t){const e=Gn(t),r=Rn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,qn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function qn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Lo(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Gn(s),n=Rn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Gn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Rn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Fo(s,t,e){let r,n,i,o,a;const l=s+e,h=s-e,c=Math.sqrt(h*h+4*t*t);return l>0?(r=.5*(l+c),a=1/r,n=s*a*e-t*a*t):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),h>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Ar 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:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.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 zo 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:n,end:i}=this;return e.set(Ln(t,r.x,n.x,i.x),Ln(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=v.MAX,e=v.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+i.x),h=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,l),t.y=Math.min(t.y,r.y,i.y,a,h),e.x=Math.max(e.x,r.x,i.x,o,l),e.y=Math.max(e.y,r.y,i.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:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.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 No=Object.defineProperty,qo=(s,t,e)=>t in s?No(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Wn=(s,t,e)=>(qo(s,typeof t!="symbol"?t+"":t,e),e);class Go extends Zt{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,Wn(this,"curves",[]),Wn(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,n=this.rx/this.aspectRatio,i=[new v(t-r,e-n),new v(t+r,e-n),new v(t+r,e+n),new v(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new Ar(i[o].clone(),i[(o+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 Ro extends Zt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new v){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],l=r[i],h=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Dn(o,a.x,l.x,h.x,c.x),Dn(o,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 Wo=Object.defineProperty,Vo=(s,t,e)=>t in s?Wo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_e=(s,t,e)=>(Vo(s,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:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return kn(t,this),this}addData(t){return this.addCommands(Un(t)),this}getPoint(t,e=new v){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],l=a.getLength();return a.getPointAt(l===0?0:1-o/l,e)}i++}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,n=this.curves.length;r<n;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 n;for(let i=0,o=r.length;i<o;i++){const l=r[i].getPoints(t);for(let h=0;h<l.length;h++){const c=l[h];n!=null&&n.equals(c)||(e.push(c),n=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 Ar(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 Ar(this.currentPoint.clone(),new v(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new Bo(this.currentPoint.clone(),new v(t,e),new v(r,n),new v(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new zo(this.currentPoint.clone(),new v(t,e),new v(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,l=!0){const h=new ko(new v(t,e),r,n,i,o,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,n,i,o,a,l){const h=this.currentPoint;return this.ellipse(t+h.x,e+h.y,r,n,i,o,a,l),this}rect(t,e,r,n){return this.curves.push(new Go(new v(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Ro([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(n=>n.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 jo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Xo(s,t,e,r){const n=t.clone().sub(s),i=r.clone().sub(e),o=e.clone().sub(s),a=n.cross(i);if(a===0)return new v((s.x+e.x)/2,(s.y+e.y)/2);const l=o.cross(i)/a;return Math.abs(l)>1?new v((s.x+e.x)/2,(s.y+e.y)/2):new v(s.x+l*n.x,s.y+l*n.y)}var Ho=Object.defineProperty,Yo=(s,t,e)=>t in s?Ho(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Or=(s,t,e)=>(Yo(s,typeof t!="symbol"?t+"":t,e),e);class Pt{constructor(t,e={}){Or(this,"currentPath",new Me),Or(this,"paths",[this.currentPath]),Or(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:n}=this.currentPath;return r.equals({x:t,y:e})||(n.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,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,l){return this.currentPath.ellipse(t,e,r,n,i,o,a,l),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return kn(t,this),this}addData(t){return this.addCommands(Un(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(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.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=[],n=[],i=[];e.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();i[l]=h,n[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 o=[];return r.forEach((a,l)=>{o[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&o[l].push(h.index)})}),e.forEach((a,l)=>{const h=n[l];i[l].forEach(u=>{const f=a.getTForPoint(u),p=a.getNormal(f).scale(h?t:-t);u.add(p)})}),o.forEach((a,l)=>{const h=i[l];a.forEach(c=>{const u=i[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 n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(t,e),r&&n>1){const o=n/2,a=i.isClockwise(),l=[];for(let h=0;h<=1;h+=1/i.arcLengthDivisions){const c=i.getPoint(h),u=i.getNormal(h),f=u.clone().scale(a?o:-o),p=u.clone().scale(a?-o:o);l.push(c.clone().add(f),c.clone().add(p),c.clone().add({x:o,y:0}),c.clone().add({x:-o,y:0}),c.clone().add({x:0,y:o}),c.clone().add({x:0,y:-o}),c.clone().add({x:o,y:o}),c.clone().add({x:-o,y:-o}))}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:n="none"}=e;return t.beginPath(),t.save(),_r(t,e),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),_r(t,e),this.getControlPoints().forEach(i=>{t.moveTo(i.x,i.y),t.arc(i.x,i.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="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 n in t)t[n]!==void 0&&(e[jo(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</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:n,top:i,width:o,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=o*e,l.height=a*e,l.style.width=`${o}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(e,e),h.translate(-n,-i),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 Ir="px",Vn=90,jn=["mm","cm","in","pt","pc","px"],$r={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(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=jn.length;r<n;r++){const i=jn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&Ir!=="px"?e=$r.in[Ir]/Vn:(e=$r[t][Ir],e<0&&(e=$r[t].in*Vn)),e*Number.parseFloat(s)}const Zo=new St,He=new St,Xn=new St,Hn=new St;function Ko(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Qo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Qo(s){const t=new St,e=Zo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(W(s.getAttribute("x")),W(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const l=i.slice(0,o),h=kt(i.slice(o+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),Xn.makeRotation(c),Hn.multiplyMatrices(Xn,He),He.makeTranslation(u,f),e.multiplyMatrices(He,Hn)}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 Jo(s){return new Pt().addPath(new Me().arc(W(s.getAttribute("cx")||0),W(s.getAttribute("cy")||0),W(s.getAttribute("r")||0),0,Math.PI*2))}function ta(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(o=>o.trim()),i={};for(let o=r.style.length,a=0;a<o;a++){const l=r.style.item(a);i[l]=r.style.getPropertyValue(l)}for(let o=0;o<n.length;o++)t[n[o]]=Object.assign(t[n[o]]||{},{...i})}}function ea(s){return new Pt().addPath(new Me().ellipse(W(s.getAttribute("cx")||0),W(s.getAttribute("cy")||0),W(s.getAttribute("rx")||0),W(s.getAttribute("ry")||0),0,0,Math.PI*2))}function ra(s){return new Pt().moveTo(W(s.getAttribute("x1")||0),W(s.getAttribute("y1")||0)).lineTo(W(s.getAttribute("x2")||0),W(s.getAttribute("y2")||0))}function na(s){const t=new Pt,e=s.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 ia(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(sa,(n,i,o)=>{const a=W(i),l=W(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!0,t}const oa=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function aa(s){var r;const t=new Pt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(oa,(n,i,o)=>{const a=W(i),l=W(o);return e===0?t.moveTo(a,l):t.lineTo(a,l),e++,n}),t.currentPath.autoClose=!1,t}function la(s){const t=W(s.getAttribute("x")||0),e=W(s.getAttribute("y")||0),r=W(s.getAttribute("rx")||s.getAttribute("ry")||0),n=W(s.getAttribute("ry")||s.getAttribute("rx")||0),i=W(s.getAttribute("width")),o=W(s.getAttribute("height")),a=1-.551915024494,l=new Pt;return l.moveTo(t+r,e),l.lineTo(t+i-r,e),(r!==0||n!==0)&&l.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),l.lineTo(t+i,e+o-n),(r!==0||n!==0)&&l.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),l.lineTo(t+r,e+o),(r!==0||n!==0)&&l.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),l.lineTo(t,e+n),(r!==0||n!==0)&&l.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),l}function Ut(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.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]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let h=s.style.length,c=0;c<h;c++){const u=s.style.item(c),f=s.style.getPropertyValue(u);t[u]=f,r[u]=f}function n(h,c,u=i){s.hasAttribute(h)&&(t[c]=u(s.getAttribute(h))),r[h]&&(t[c]=u(r[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function o(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 n("fill","fill"),n("fill-opacity","fillOpacity",o),n("fill-rule","fillRule"),n("opacity","opacity",o),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",o),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",l),n("stroke-dashoffset","strokeDashoffset",W),n("visibility","visibility"),t}function Br(s,t,e=[],r={}){var u;if(s.nodeType!==1)return e;let n=!1,i=null,o={...t};switch(s.nodeName){case"svg":o=Ut(s,o,r);break;case"style":ta(s,r);break;case"g":o=Ut(s,o,r);break;case"path":o=Ut(s,o,r),s.hasAttribute("d")&&(i=na(s));break;case"rect":o=Ut(s,o,r),i=la(s);break;case"polygon":o=Ut(s,o,r),i=ia(s);break;case"polyline":o=Ut(s,o,r),i=aa(s);break;case"circle":o=Ut(s,o,r),i=Jo(s);break;case"ellipse":o=Ut(s,o,r),i=ea(s);break;case"line":o=Ut(s,o,r),i=ra(s);break;case"defs":n=!0;break;case"use":{o=Ut(s,o,r);const p=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(p);g?Br(g,o,e,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(s);break}if(o.display==="none")return e;Object.assign(t,o);const a=new St,l=[],h=Ko(s,a,l);i&&(i.matrix(a),e.push(i),i.style=t);const c=s.childNodes;for(let f=0,p=c.length;f<p;f++){const g=c[f];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Br(g,t,e,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),e}const Yn="data:image/svg+xml;",Zn=`${Yn}base64,`,Kn=`${Yn}charset=utf8,`;function Qn(s){if(typeof s=="string"){let t;return s.startsWith(Zn)?(s=s.substring(Zn.length,s.length),t=atob(s)):s.startsWith(Kn)?(s=s.substring(Kn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Jn(s){return Br(Qn(s),{})}function Te(s,t=!0){if(!s.length)return;const e=v.MAX,r=v.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new N(e.x,e.y,r.x-e.x,r.y-e.y)}const ha=new Set(["©","®","÷"]),ca=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ua={1:"italic",32:"bold"},fa={1:"italic",2:"bold"},ts={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class es{constructor(t,e,r){$(this,"path",new Pt);$(this,"lineBox",new N);$(this,"inlineBox",new N);$(this,"glyphBox");$(this,"advanceWidth",0);$(this,"advanceHeight",0);$(this,"underlinePosition",0);$(this,"underlineThickness",0);$(this,"strikeoutPosition",0);$(this,"strikeoutSize",0);$(this,"ascender",0);$(this,"descender",0);$(this,"typoAscender",0);$(this,"typoDescender",0);$(this,"typoLineGap",0);$(this,"winAscent",0);$(this,"winDescent",0);$(this,"xHeight",0);$(this,"capHeight",0);$(this,"baseline",0);$(this,"centerDiviation",0);$(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??go,n=e?r.get(e):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(t=this._getFontSfnt()){if(!t)return this;const{hhea:e,os2:r,post:n,head:i}=t,o=i.unitsPerEm,a=e.ascent,l=e.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,p=o/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-n.underlinePosition)/p,this.underlineThickness=n.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=ua[r.fsSelection]??fa[i.macStyle],this}update(t){const e=this._getFontSfnt(t);if(!e)return this;this.updateGlyph(e);const{isVertical:r,content:n,computedStyle:i,baseline:o,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:p}=this,{left:g,top:m}=a,d=i.fontStyle==="italic"&&u!=="italic";let M=g,b=m+o,S;const T=new Pt;if(r&&(M+=(p-f)/2,Math.abs(f-p)>.1&&(b-=(l-c)/(l+Math.abs(h))*p),S=void 0),r&&!ha.has(n)&&(n.codePointAt(0)<=256||ca.has(n))){T.addCommands(e.getPathCommands(n,M,m+o-(p-f)/2,i.fontSize));const x={y:m-(p-f)/2+p/2,x:M+f/2};d&&this._italic(T,r?{x:x.x,y:m-(p-f)/2+o}:void 0),T.rotate(90,x)}else S!==void 0?(T.addCommands(e.glyphs.get(S).getPathCommands(M,b,i.fontSize)),d&&this._italic(T,r?{x:M+f/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(T.addCommands(e.getPathCommands(n,M,b,i.fontSize)),d&&this._italic(T,r?{x:M+p/2,y:b}:void 0));const w=i.fontWeight??400;return w in ts&&(w===700||w==="bold")&&u!=="bold"&&T.bold(ts[w]*i.fontSize*.05),T.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=T,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 n;if((n=this.path.paths[0])!=null&&n.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:n}=e;return new N(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){const r=this.computedStyle,n={ctx:t,path:this.path,fontSize:r.fontSize,color:r.color,...e};if(this.glyphBox)te(n);else{t.save(),t.beginPath();const i=this.path.style,o={...i,fill:n.color??i.fill,stroke:n.textStrokeColor??i.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize:i.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*n.fontSize,shadowOffsetY:(n.shadowOffsetY??0)*n.fontSize,shadowBlur:(n.shadowBlur??0)*n.fontSize,shadowColor:n.shadowColor};_r(t,o),t.font=`${n.fontSize}px ${n.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(s,t){return typeof s=="number"?s:s.endsWith("%")?(s=s.substring(0,s.length-1),Math.ceil(Number(s)/100*t.total)):s.endsWith("rem")?(s=s.substring(0,s.length-3),Number(s)*t.fontSize):s.endsWith("em")?(s=s.substring(0,s.length-2),Number(s)*t.fontSize):Number(s)}function Er(s){const t=Nt(s)?{}:s;return Object.keys(t).reduce((e,r)=>{let n=t[r];const i=kr(r),o=kr(n);return i&&(r=i),o&&(n=o),e[r]=n,e},{})}function Nt(s){return!s||s==="none"}function rs(s,t){const e=Object.keys(s),r=Object.keys(t);return Array.from(new Set([...e,...r])).every(i=>Kt(s[i],t[i]))}function Kt(s,t){const e=typeof s;return e===typeof t?e==="object"?rs(s,t):s===t:!1}function kr(s){const t=s.startsWith("#")?s.slice(1):s;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,n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${i}, ${o})`}function Ze(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Ke(s){return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("blob://")}class ns{constructor(t,e={},r){$(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 es(r,e++,this));return this.characters=t,this}}class ae{constructor(t,e){$(this,"lineBox",new N);$(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 ns(t,e,this);return this.fragments.push(r),r}}function pa(s){return s}const tr=class tr{_styleToDomStyle(t){const e={...t};for(const r in t)tr.pxStyles.has(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createParagraphDom(t,e){const r=document.createDocumentFragment(),n=document.createElement("section"),i={...e},o=e.writingMode.includes("horizontal");switch(e.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(e.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&o?"100%":void 0,height:a&&!o?"100%":void 0}),t.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(u=>{const f=document.createElement("span");Object.assign(f.style,{verticalAlign:"inherit",...this._styleToDomStyle(u.style)}),f.appendChild(document.createTextNode(u.content)),c.appendChild(f)}),l.appendChild(c)}),n.appendChild(l),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var h;return(h=n.parentNode)==null?void 0:h.removeChild(n)}}}measureDomText(t){const e=document.createRange();e.selectNodeContents(t);const r=t.data??"";let n=0;return Array.from(r).map(i=>{var u;const o=n+=r.substring(n).indexOf(i),a=o+i.length;n+=i.length,e.setStart(t,Math.max(o,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=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:o,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=>{n.push({...f,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(p=>{n.push({...p,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:e,fragments:r,characters:n}}measureParagraphDom(t,e){const r=e.getBoundingClientRect(),n=this.measureDom(e);n.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}),n.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 i=[];let o=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.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=i[o];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),o++}),{paragraphs:t,boundingBox:new N(0,0,r.width,r.height)}}measure(t,e,r){let n;r||({dom:r,destory:n}=this.createParagraphDom(t,e));const i=this.measureParagraphDom(t,r);return n==null||n(),i}};$(tr,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let Qe=tr;class da{constructor(){$(this,"eventListeners",new Map)}addEventListener(t,e,r){const n={value:e,options:r},i=this.eventListeners.get(t);return i?Array.isArray(i)?i.push(n):this.eventListeners.set(t,[i,n]):this.eventListeners.set(t,n),this}removeEventListener(t,e,r){var i,o;if(!e)return this.eventListeners.delete(t),this;const n=this.eventListeners.get(t);if(!n)return this;if(Array.isArray(n)){const a=[];for(let l=0,h=n.length;l<h;l++){const c=n[l];(c.value!==e||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(t,a.length===1?a[0]:a):this.eventListeners.delete(t)}else n.value===e&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof n.options=="boolean"||(o=n.options)!=null&&o.once)&&this.eventListeners.delete(t);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(t){return this.eventListeners.has(t)}dispatchEvent(t,e){var n,i;const r=this.eventListeners.get(t);if(r){if(Array.isArray(r))for(let o=r.length,a=0;a<o;a++){const l=r[a];typeof l.options=="object"&&((n=l.options)!=null&&n.once)&&this.off(t,l.value,l.options),l.value.apply(this,[e])}else typeof r.options=="object"&&((i=r.options)!=null&&i.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 ss(){const s=[],t=[],e=new Map,r=new Map;async function n(o){if(!e.has(o)){e.set(o,o);try{e.set(o,await fetch(o).then(a=>a.text()))}catch(a){console.warn(a),e.delete(o)}}}function i(o){let a=r.get(o);if(!a){const l=Qn(Ke(o)?e.get(o)??o:o),h=Jn(l);a={dom:l,paths:h},r.set(o,a)}return a}return{name:"highlight",paths:s,load:async o=>{const a=[];o.forEachCharacter(l=>{const{computedStyle:h}=l,{highlightImage:c,highlightReferImage:u}=h;Ke(c)&&a.push(n(c)),Ke(u)&&a.push(n(u))}),await Promise.all(a)},update:o=>{t.length=0,s.length=0;let a=[],l,h;o.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:M,highlightSize:b,highlightThickness:S}=u;(!h||Kt(h.highlightImage,f)&&Kt(h.highlightColormap,d)&&Kt(h.highlightLine,M)&&Kt(h.highlightSize,b)&&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(U=>U.glyphBox).map(U=>U.glyphBox)),{computedStyle:g}=f,{fontSize:m,writingMode:d,highlightImage:M,highlightReferImage:b,highlightColormap:S,highlightLine:T,highlightSize:w,highlightThickness:x}=g,A=d.includes("vertical"),C=Ye(x,{fontSize:m,total:p.width})/p.width,_=Er(S),{paths:V,dom:H}=i(M),E=Te(V,!0),et=m/E.width*2,P=new N().copy(p);A&&(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(b)&&Nt(T)){const U=Te(i(b).paths,!0);E.copy(U)}else{let U;if(Nt(T))if(E.width/E.height>4){U="underline";const L=H.getAttribute("viewBox");if(L){const[nt,O,Z,R]=L.split(" ").map(D=>Number(D)),G=O+R/2;E.y<G&&E.y+E.height>G?U="line-through":E.y+E.height<G?U="overline":U="underline"}}else U="outline";else U=T;switch(U){case"outline":{const L=P.width*.2,nt=P.height*.2;P.width+=L,P.height+=nt,A?(P.x-=nt/2,P.y-=L/2,P.x+=P.height):(P.x-=L/2,P.y-=nt/2);break}case"overline":P.height=E.height*et,A?P.x=f.inlineBox.left+f.inlineBox.width:P.y=f.inlineBox.top;break;case"line-through":P.height=E.height*et,A?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,A?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);A&&z.rotate(-Math.PI/2),z.translate(P.x,P.y);for(let U=0;U<Math.ceil(F/q);U++){const L=z.clone();A?L.translate(0,U*P.width):L.translate(U*P.width,0),V.forEach(nt=>{const O=nt.clone().matrix(L);O.style.strokeWidth&&(O.style.strokeWidth*=et*C),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=et),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=et),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(Z=>Z*et)),O.style.fill&&O.style.fill in _&&(O.style.fill=_[O.style.fill]),O.style.stroke&&O.style.stroke in _&&(O.style.stroke=_[O.style.stroke]),s.push(O),F!==q&&(A?t[s.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):t[s.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(o,a)=>{s.forEach((l,h)=>{if(te({ctx:o,path:l,fontSize:a.computedStyle.fontSize,clipRect:t[h]}),a.debug){const c=Te([l]);c&&o.strokeRect(c.x,c.y,c.width,c.height)}})}}}function ga(s,t){return`<svg width="${s*2}" height="${s*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${s}" cy="${s}" r="${s}" fill="${t}" />
|
|
6
|
-
</svg>`}function is(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,i=n*.45;e.forEach(o=>{const{computedStyle:a}=o,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,p=Er(c);let g=u,m;if(!Nt(h))m=h;else if(!Nt(f)){const S=n*.38/2;switch(g=g==="cover"?S*2:g,f){case"disc":m=ga(S,String(l));break}}if(!m)return;const d=Jn(m),M=Te(d);let b;o.fragments.forEach(S=>{S.characters.forEach(T=>{const{inlineBox:w}=T;if(r?(b==null?void 0:b.inlineBox.left)!==w.left:(b==null?void 0:b.inlineBox.top)!==w.top){b=T;const x=g==="cover"?1:Ye(g,{total:n,fontSize:n})/n,A=new St;if(r){const C=n/M.height*x;A.translate(-M.left,-M.top).rotate(Math.PI/2).scale(C,C).translate(w.left+(w.width-M.height*C)/2,w.top-i)}else{const C=n/M.height*x;A.translate(-M.left,-M.top).scale(C,C).translate(w.left-M.width*C-i,w.top+(w.height-M.height*C)/2)}s.push(...d.map(C=>{const _=C.clone();return _.matrix(A),_.style.fill&&_.style.fill in p&&(_.style.fill=p[_.style.fill]),_.style.stroke&&_.style.stroke in p&&(_.style.stroke=p[_.style.stroke]),_}))}})})})}}}const
|
|
6
|
+
</svg>`}function is(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,i=n*.45;e.forEach(o=>{const{computedStyle:a}=o,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,p=Er(c);let g=u,m;if(!Nt(h))m=h;else if(!Nt(f)){const S=n*.38/2;switch(g=g==="cover"?S*2:g,f){case"disc":m=ga(S,String(l));break}}if(!m)return;const d=Jn(m),M=Te(d);let b;o.fragments.forEach(S=>{S.characters.forEach(T=>{const{inlineBox:w}=T;if(r?(b==null?void 0:b.inlineBox.left)!==w.left:(b==null?void 0:b.inlineBox.top)!==w.top){b=T;const x=g==="cover"?1:Ye(g,{total:n,fontSize:n})/n,A=new St;if(r){const C=n/M.height*x;A.translate(-M.left,-M.top).rotate(Math.PI/2).scale(C,C).translate(w.left+(w.width-M.height*C)/2,w.top-i)}else{const C=n/M.height*x;A.translate(-M.left,-M.top).scale(C,C).translate(w.left-M.width*C-i,w.top+(w.height-M.height*C)/2)}s.push(...d.map(C=>{const _=C.clone();return _.matrix(A),_.style.fill&&_.style.fill in p&&(_.style.fill=p[_.style.fill]),_.style.stroke&&_.style.stroke in p&&(_.style.stroke=p[_.style.stroke]),_}))}})})})}}}const jt=new v,le=new St,Xt=new St;function os(){return{name:"render",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(i=>{r==null||r.forEach(o=>{if(!i.glyphBox)return;const a=i.glyphBox.clone(),l=Je(s,o);jt.set(a.left,a.top),jt.applyMatrix3(l),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(l),a.width=jt.x-a.left,a.height=jt.y-a.top;const h=(o.shadowOffsetX??0)*e,c=(o.shadowOffsetY??0)*e,u=Math.max(.1,o.textStrokeWidth??0)*e;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?N.from(...n):void 0},render:(s,t)=>{const{paragraphs:e,glyphBox:r,effects:n,style:i}=t;function o(a,l){s.fillStyle=a,s.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&o(i.backgroundColor,new N(0,0,s.canvas.width,s.canvas.height)),e.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&o(a.style.backgroundColor,a.lineBox)}),n?n.forEach(a=>{$t(a,r,s),s.save();const[l,h,c,u,f,p]=Je(t,a).transpose().elements;s.transform(l,u,h,f,c,p),t.forEachCharacter(g=>{var m;(m=g.parent.style)!=null&&m.backgroundColor&&o(g.parent.style.backgroundColor,g.inlineBox),g.drawTo(s,a)}),s.restore()}):e.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&o(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(s)})})}),t.debug&&e.forEach(a=>{s.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function Je(s,t){const{fontSize:e,glyphBox:r}=s,n=(t.translateX??0)*e,i=(t.translateY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,l=(t.skewY??0)/360*o,{left:h,top:c,width:u,height:f}=r,p=h+u/2,g=c+f/2;return le.identity(),Xt.makeTranslation(n,i),le.multiply(Xt),Xt.makeTranslation(p,g),le.multiply(Xt),Xt.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),le.multiply(Xt),Xt.makeTranslation(-p,-g),le.multiply(Xt),le.clone()}function as(){const s=[];return{name:"textDecoration",paths:s,update:t=>{s.length=0;const e=[];let r,n;t.forEachCharacter(i=>{const{computedStyle:o,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=i,{color:p,textDecoration:g,writingMode:m}=o;if(Nt(g))n=void 0;else{let d=!1;if((n==null?void 0:n.textDecoration)===g&&(n==null?void 0:n.writingMode)===m&&(n==null?void 0:n.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(i):(r=[],r.push(i),e.push(r)),n=o}}),e.forEach(i=>{const{computedStyle:o,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=i[0],{color:f,textDecoration:p}=o,{left:g,top:m,width:d,height:M}=N.from(...i.map(x=>x.inlineBox));let b=a?g+d:m;const S=a?-1:1;let T=0;switch(p){case"overline":T=h*2;break;case"underline":b+=S*l,T=h*2;break;case"line-through":b+=S*c,T=u*2;break}b-=T;let w;a?w=new Pt([{type:"M",x:b,y:m},{type:"L",x:b,y:m+M},{type:"L",x:b+T,y:m+M},{type:"L",x:b+T,y:m},{type:"Z"}],{fill:f}):w=new Pt([{type:"M",x:g,y:b},{type:"L",x:g+d,y:b},{type:"L",x:g+d,y:b+T},{type:"L",x:g,y:b+T},{type:"Z"}],{fill:f}),s.push(w)})},render:(t,e)=>{const{effects:r,computedStyle:n}=e;r?r.forEach(i=>{t.save();const[o,a,l,h,c,u]=Je(e,i).transpose().elements;t.transform(o,h,a,c,l,u),s.forEach(f=>{te({ctx:t,path:f,fontSize:n.fontSize,...i})}),t.restore()}):s.forEach(i=>{te({ctx:t,path:i,fontSize:n.fontSize})})}}}const Ur={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 Dr extends da{constructor(e={}){super();$(this,"debug");$(this,"content");$(this,"style");$(this,"effects");$(this,"measureDom");$(this,"needsUpdate",!0);$(this,"computedStyle",{...Ur});$(this,"paragraphs",[]);$(this,"lineBox",new N);$(this,"rawGlyphBox",new N);$(this,"glyphBox",new N);$(this,"pathBox",new N);$(this,"boundingBox",new N);$(this,"measurer",new Qe);$(this,"plugins",new Map);$(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(is()).use(as()).use(ss()).use(os())}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,n)=>{r.fragments.forEach((i,o)=>{i.characters.forEach((a,l)=>{e(a,{paragraphIndex:n,fragmentIndex:o,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={...Ur,...this.style};let{content:e,computedStyle:r}=this;const n=[];if(typeof e=="string"){const i=new ae({},r);i.addFragment(e),n.push(i)}else{e=Array.isArray(e)?e:[e];for(const i of e)if(typeof i=="string"){const o=new ae({},r);o.addFragment(i),n.push(o)}else if(Array.isArray(i)){const o=new ae({},r);i.forEach(a=>{if(typeof a=="string")o.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&o.addFragment(l,h)}}),n.push(o)}else if("fragments"in i){const{fragments:o,...a}=i,l=new ae(a,r);o.forEach(h=>{const{content:c,...u}=h;c!==void 0&&l.addFragment(c,u)}),n.push(l)}else if("content"in i){const{content:o,...a}=i;if(o!==void 0){const l=new ae(a,r);l.addFragment(o),n.push(l)}}}return this.paragraphs=n,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 n=this.measurer.measure(this.paragraphs,this.computedStyle,e);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,o)=>(i.updateOrder??0)-(o.updateOrder??0)).forEach(i=>{var o;(o=i.update)==null||o.call(i,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in r)n[i]=this[i],this[i]=r[i];return this.emit("measure",{text:this,result:n}),n}getGlyphBox(){const e=v.MAX,r=v.MIN;return this.characters.forEach(n=>{if(!n.getGlyphMinMax(e,r)){const{inlineBox:i}=n,o=new v(i.left,i.top),a=new v(i.left+i.width,i.top+i.height);e.min(o,a),r.max(o,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:n}=this,i=Math.min(n.left,n.left+e.left-r.left),o=Math.min(n.top,n.top+e.top-r.top),a=Math.max(n.right,n.right+e.right-r.right),l=Math.max(n.bottom,n.bottom+e.bottom-r.bottom);return this.boundingBox=new N(i,o,a-i,l-o),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:n=2}=e,i=r.getContext("2d");i&&(this.needsUpdate&&this.update(),Nr(i,n,this.boundingBox),qr(i,this),Array.from(this.plugins.values()).sort((o,a)=>(o.renderOrder??0)-(a.renderOrder??0)).forEach(o=>{var a;if(o.render)(a=o.render)==null||a.call(o,i,this);else if(o.paths){const l=this.computedStyle;o.paths.forEach(h=>{te({ctx:i,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:r,pixelRatio:n}))}}function ya(s){return new Dr(s).measure()}function ma(s){new Dr(s).render(s)}k.Character=es,k.Fragment=ns,k.Measurer=Qe,k.Paragraph=ae,k.Text=Dr,k.defaultTextStyles=Ur,k.definePlugin=pa,k.drawPath=te,k.filterEmpty=Ze,k.getTransform2D=Je,k.hexToRgb=kr,k.highlight=ss,k.isEqualObject=rs,k.isEqualValue=Kt,k.isNone=Nt,k.listStyle=is,k.measureText=ya,k.needsFetch=Ke,k.parseColor=lt,k.parseColormap=Er,k.parseValueNumber=Ye,k.render=os,k.renderText=ma,k.setupView=Nr,k.textDecoration=as,k.uploadColor=$t,k.uploadColors=qr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.3",
|
|
5
5
|
"packageManager": "pnpm@9.9.0",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prepare": "simple-git-hooks"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"modern-font": "^0.3.
|
|
60
|
+
"modern-font": "^0.3.4",
|
|
61
61
|
"modern-path2d": "^0.2.6"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|