modern-text 0.2.34 → 0.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -898,7 +898,7 @@ function highlight(options = {}) {
|
|
|
898
898
|
const scaleX = scaleWidth / refBox.width;
|
|
899
899
|
const scaleY = groupBox.height / refBox.height;
|
|
900
900
|
const styleScale = fontSize / box.width * 2;
|
|
901
|
-
const unitWidth =
|
|
901
|
+
const unitWidth = box.width * scaleX;
|
|
902
902
|
const total = Math.ceil(groupBox.width / unitWidth);
|
|
903
903
|
const transform = new modernPath2d.Matrix3().translate(-box.left, -box.top).scale(scaleX, scaleY).translate(groupBox.left, groupBox.top).translate(
|
|
904
904
|
(box.left - refBox.left) * scaleX,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(p,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(p=typeof globalThis<"u"?globalThis:p||self,it(p.modernText={}))})(this,function(p){"use strict";var ha=Object.defineProperty;var ca=(p,it,Tt)=>it in p?ha(p,it,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):p[it]=Tt;var z=(p,it,Tt)=>ca(p,typeof it!="symbol"?it+"":it,Tt);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=ss(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Tt(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function ss(s,t,e,r,n){var g;const i=((g=s.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=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(h).map(y=>{let w=y[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(y[3].replace("%",""))/100,color:w}})}}function Ce(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 is(s,t){const{computedStyle:e,paragraphs:r}=t;function n(i,o,a,h,l){s.fillStyle=i,s.fillRect(o,a,h,l)}e!=null&&e.backgroundColor&&n(e.backgroundColor,0,0,s.canvas.width,s.canvas.height),r.forEach(i=>{var o;(o=i.style)!=null&&o.backgroundColor&&n(i.computedStyle.backgroundColor,...i.boundingBox.toArray()),i.fragments.forEach(a=>{var h;(h=a.style)!=null&&h.backgroundColor&&n(a.computedStyle.backgroundColor,...a.boundingBox.toArray())})})}function Dr(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),a.width=Math.max(1,Math.ceil(i*t)),a.height=Math.max(1,Math.ceil(o*t)),a.style.marginTop=`${n}px`,a.style.marginLeft=`${r}px`,a.style.width=`${i}px`,a.style.height=`${o}px`,s.clearRect(0,0,s.canvas.width,s.canvas.height),s.scale(t,t),s.translate(-r,-n)}function Nr(s,t){const{paragraphs:e,computedStyle:r,renderBoundingBox:n}=t;Tt(r,n,s),e.forEach(i=>{Tt(i.computedStyle,i.boundingBox,s),i.fragments.forEach(o=>{Tt(o.computedStyle,o.boundingBox,s)})})}var ot=Uint8Array,wt=Uint16Array,We=Int32Array,Se=new ot([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]),Pe=new ot([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]),qe=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(s,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new We(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}},Er=zr(Se,2),Ur=Er.b,He=Er.r;Ur[28]=258,He[258]=28;for(var Lr=zr(Pe,0),os=Lr.b,$r=Lr.r,Qe=new wt(32768),B=0;B<32768;++B){var $t=(B&43690)>>1|(B&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,Qe[B]=(($t&65280)>>8|($t&255)<<8)>>1}for(var Ot=function(s,t,e){for(var r=s.length,n=0,i=new wt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new wt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new wt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],c=t-s[n],u=o[s[n]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[Qe[u]>>h]=l}else for(a=new wt(r),n=0;n<r;++n)s[n]&&(a[n]=Qe[o[s[n]-1]++]>>15-s[n]);return a},kt=new ot(288),B=0;B<144;++B)kt[B]=8;for(var B=144;B<256;++B)kt[B]=9;for(var B=256;B<280;++B)kt[B]=7;for(var B=280;B<288;++B)kt[B]=8;for(var se=new ot(32),B=0;B<32;++B)se[B]=5;var as=Ot(kt,9,0),ls=Ot(kt,9,1),hs=Ot(se,5,0),cs=Ot(se,5,1),Xe=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Ct=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},Ye=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ze=function(s){return(s+7)/8|0},kr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},us=["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"],St=function(s,t,e){var r=new Error(t||us[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},fs=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},c=t.f||0,u=t.p||0,f=t.b||0,g=t.l,y=t.d,w=t.m,d=t.n,C=n*8;do{if(!g){c=Ct(s,u,1);var P=Ct(s,u+1,3);if(u+=3,P)if(P==1)g=ls,y=cs,w=9,d=5;else if(P==2){var b=Ct(s,u,31)+257,I=Ct(s,u+10,15)+4,S=b+Ct(s,u+5,31)+1;u+=14;for(var _=new ot(S),j=new ot(19),R=0;R<I;++R)j[qe[R]]=Ct(s,u+R*3,7);u+=I*3;for(var L=Xe(j),mt=(1<<L)-1,D=Ot(j,L,1),R=0;R<S;){var A=D[Ct(s,u,mt)];u+=A&15;var x=A>>4;if(x<16)_[R++]=x;else{var $=0,U=0;for(x==16?(U=3+Ct(s,u,3),u+=2,$=_[R-1]):x==17?(U=3+Ct(s,u,7),u+=3):x==18&&(U=11+Ct(s,u,127),u+=7);U--;)_[R++]=$}}var J=_.subarray(0,b),W=_.subarray(b);w=Xe(J),d=Xe(W),g=Ot(J,w,1),y=Ot(W,d,1)}else St(1);else{var x=Ze(u)+4,T=s[x-4]|s[x-3]<<8,v=x+T;if(v>n){h&&St(0);break}a&&l(f+T),e.set(s.subarray(x,v),f),t.b=f+=T,t.p=u=v*8,t.f=c;continue}if(u>C){h&&St(0);break}}a&&l(f+131072);for(var xt=(1<<w)-1,F=(1<<d)-1,K=u;;K=u){var $=g[Ye(s,u)&xt],k=$>>4;if(u+=$&15,u>C){h&&St(0);break}if($||St(2),k<256)e[f++]=k;else if(k==256){K=u,g=null;break}else{var G=k-254;if(k>264){var R=k-257,N=Se[R];G=Ct(s,u,(1<<N)-1)+Ur[R],u+=N}var X=y[Ye(s,u)&F],q=X>>4;X||St(3),u+=X&15;var W=os[q];if(q>3){var N=Pe[q];W+=Ye(s,u)&(1<<N)-1,u+=N}if(u>C){h&&St(0);break}a&&l(f+131072);var tt=f+G;if(f<W){var Qt=i-W,Xt=Math.min(W,tt);for(Qt+f<0&&St(3);f<Xt;++f)e[f]=r[Qt+f]}for(;f<tt;++f)e[f]=e[f-W]}}t.l=g,t.p=K,t.b=f,t.f=c,g&&(c=1,t.m=w,t.d=y,t.n=d)}while(!c);return f!=e.length&&o?kr(e,0,f):e.subarray(0,f)},Et=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ie=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},Ke=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:Gr,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(v,b){return v.f-b.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,c=1,u=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};c!=n-1;)a=e[e[l].f<e[u].f?l++:u++],h=e[l!=c&&e[l].f<e[u].f?l++:u++],e[c++]={s:-1,f:a.f+h.f,l:a,r:h};for(var f=i[0].s,r=1;r<n;++r)i[r].s>f&&(f=i[r].s);var g=new wt(f+1),y=Je(e[c-1],g,0);if(y>t){var r=0,w=0,d=y-t,C=1<<d;for(i.sort(function(b,I){return g[I.s]-g[b.s]||b.f-I.f});r<n;++r){var P=i[r].s;if(g[P]>t)w+=C-(1<<y-g[P]),g[P]=t;else break}for(w>>=d;w>0;){var x=i[r].s;g[x]<t?w-=1<<t-g[x]++-1:++r}for(;r>=0&&w;--r){var T=i[r].s;g[T]==t&&(--g[T],++w)}y=t}return{t:new ot(g),l:y}},Je=function(s,t,e){return s.s==-1?Math.max(Je(s.l,t,e+1),Je(s.r,t,e+1)):t[s.s]=e},Br=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new wt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},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}},oe=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},jr=function(s,t,e){var r=e.length,n=Ze(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},Fr=function(s,t,e,r,n,i,o,a,h,l,c){Et(t,c++,e),++n[256];for(var u=Ke(n,15),f=u.t,g=u.l,y=Ke(i,15),w=y.t,d=y.l,C=Br(f),P=C.c,x=C.n,T=Br(w),v=T.c,b=T.n,I=new wt(19),S=0;S<P.length;++S)++I[P[S]&31];for(var S=0;S<v.length;++S)++I[v[S]&31];for(var _=Ke(I,7),j=_.t,R=_.l,L=19;L>4&&!j[qe[L-1]];--L);var mt=l+5<<3,D=oe(n,kt)+oe(i,se)+o,A=oe(n,f)+oe(i,w)+o+14+3*L+oe(I,j)+2*I[16]+3*I[17]+7*I[18];if(h>=0&&mt<=D&&mt<=A)return jr(t,c,s.subarray(h,h+l));var $,U,J,W;if(Et(t,c,1+(A<D)),c+=2,A<D){$=Ot(f,g,0),U=f,J=Ot(w,d,0),W=w;var xt=Ot(j,R,0);Et(t,c,x-257),Et(t,c+5,b-1),Et(t,c+10,L-4),c+=14;for(var S=0;S<L;++S)Et(t,c+3*S,j[qe[S]]);c+=3*L;for(var F=[P,v],K=0;K<2;++K)for(var k=F[K],S=0;S<k.length;++S){var G=k[S]&31;Et(t,c,xt[G]),c+=j[G],G>15&&(Et(t,c,k[S]>>5&127),c+=k[S]>>12)}}else $=as,U=kt,J=hs,W=se;for(var S=0;S<a;++S){var N=r[S];if(N>255){var G=N>>18&31;ie(t,c,$[G+257]),c+=U[G+257],G>7&&(Et(t,c,N>>23&31),c+=Se[G]);var X=N&31;ie(t,c,J[X]),c+=W[X],X>3&&(ie(t,c,N>>5&8191),c+=Pe[X])}else ie(t,c,$[N]),c+=U[N]}return ie(t,c,$[256]),c+U[256]},ps=new We([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gr=new ot(0),ds=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,c=(i.r||0)&7;if(t){c&&(h[0]=i.r>>3);for(var u=ps[t-1],f=u>>13,g=u&8191,y=(1<<e)-1,w=i.p||new wt(32768),d=i.h||new wt(y+1),C=Math.ceil(e/3),P=2*C,x=function(ne){return(s[ne]^s[ne+1]<<C^s[ne+2]<<P)&y},T=new We(25e3),v=new wt(288),b=new wt(32),I=0,S=0,_=i.i||0,j=0,R=i.w||0,L=0;_+2<o;++_){var mt=x(_),D=_&32767,A=d[mt];if(w[D]=A,d[mt]=D,R<=_){var $=o-_;if((I>7e3||j>24576)&&($>423||!l)){c=Fr(s,h,0,T,v,b,S,j,L,_-L,c),j=I=S=0,L=_;for(var U=0;U<286;++U)v[U]=0;for(var U=0;U<30;++U)b[U]=0}var J=2,W=0,xt=g,F=D-A&32767;if($>2&&mt==x(_-F))for(var K=Math.min(f,$)-1,k=Math.min(32767,_),G=Math.min(258,$);F<=k&&--xt&&D!=A;){if(s[_+J]==s[_+J-F]){for(var N=0;N<G&&s[_+N]==s[_+N-F];++N);if(N>J){if(J=N,W=F,N>K)break;for(var X=Math.min(F,N-2),q=0,U=0;U<X;++U){var tt=_-F+U&32767,Qt=w[tt],Xt=tt-Qt&32767;Xt>q&&(q=Xt,A=tt)}}}D=A,A=w[D],F+=D-A&32767}if(W){T[j++]=268435456|He[J]<<18|$r[W];var Dt=He[J]&31,Nt=$r[W]&31;S+=Se[Dt]+Pe[Nt],++v[257+Dt],++b[Nt],R=_+J,++I}else T[j++]=s[_],++v[s[_]]}}for(_=Math.max(_,R);_<o;++_)T[j++]=s[_],++v[s[_]];c=Fr(s,h,l,T,v,b,S,j,L,_-L,c),l||(i.r=c&7|h[c/8|0]<<3,c-=7,i.h=d,i.p=w,i.i=_,i.w=R)}else{for(var _=i.w||0;_<o+l;_+=65535){var Lt=_+65535;Lt>=o&&(h[c/8|0]=l,Lt=o),c=jr(h,c+1,s.subarray(_,Lt))}i.i=o}return kr(a,0,r+Ze(c)+n)},Vr=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}}},gs=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return ds(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)},Rr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},ys=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=Vr();n.p(t.dictionary),Rr(s,2,n.d())}},ms=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&St(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ws(s,t){t||(t={});var e=Vr();e.p(s);var r=gs(s,t,t.dictionary?6:2,4);return ys(r,t),Rr(r,r.length-4,e.d()),r}function vs(s,t){return fs(s.subarray(ms(s,t),-4),{i:2},t,t)}var bs=typeof TextDecoder<"u"&&new TextDecoder,Ms=0;try{bs.decode(Gr,{stream:!0}),Ms=1}catch{}const xs="modern-font";function ae(s,t){if(!s)throw new Error(`[${xs}] ${t}`)}function Cs(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 Gt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Wr=Object.defineProperty,Ss=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(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&&Wr(t,e,n),n},Ps=(s,t,e)=>(Ss(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 lt(){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 rt extends DataView{constructor(t,e,r,n){super(Cs(t),e,r),this.littleEndian=n,Ps(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=Gt(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}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var _s=Object.defineProperty,Ts=(s,t,e)=>t in s?_s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Os=(s,t,e)=>(Ts(s,t+"",e),e);const qr=new WeakMap;function m(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=qr.get(n);o||(o={columns:[],byteLength:0},qr.set(n,o));const a={...t,name:i,byteLength:e*_e[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Os(this,"view"),this.view=new rt(t,e,r,n)}}function Is(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 Te(s){s=Is(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 As(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 Ds(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 Oe 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 Hr=Object.defineProperty,Ns=(s,t,e)=>t in s?Hr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(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&&Hr(t,e,n),n},Qr=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);const ht=class Jn extends Oe{constructor(){super(...arguments),Qr(this,"format","EmbeddedOpenType"),Qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Te(n.fontFamily||""),o=i.length,a=Te(n.fontStyle||""),h=a.length,l=Te(n.version||""),c=l.length,u=Te(n.fullName||""),f=u.length,g=86+o+4+h+4+c+4+f+2+t.view.byteLength,y=new Jn(new ArrayBuffer(g),0,g,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(y.FontPANOSE=w.fontPANOSE,y.Italic=w.fsSelection,y.Weight=w.usWeightClass,y.fsType=w.fsType,y.UnicodeRange=w.ulUnicodeRange,y.CodePageRange=w.ulCodePageRange),y.view.writeUint16(o),y.view.writeBytes(i),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(a),y.view.writeUint16(0),y.view.writeUint16(c),y.view.writeBytes(l),y.view.writeUint16(0),y.view.writeUint16(f),y.view.writeBytes(u),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};ft([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let zs=ht;var Es=Object.defineProperty,Ie=(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&&Es(t,e,n),n};class Yt extends Mt{constructor(t,e){super(t,e,16)}}Ie([m({type:"char",size:4})],Yt.prototype,"tag"),Ie([m("uint32")],Yt.prototype,"checkSum"),Ie([m("uint32")],Yt.prototype,"offset"),Ie([m("uint32")],Yt.prototype,"length");const tr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Us=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Ls=Object.defineProperty,$s=(s,t,e)=>t in s?Ls(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,le=(s,t,e)=>($s(s,typeof t!="symbol"?t+"":t,e),e);class er{constructor(t){le(this,"index"),le(this,"name"),le(this,"isComposite",!1),le(this,"components",[]),le(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:h=o}=n,l=this.pathCommands,c=[];for(let u=0,f=l.length;u<f;u+=1){const g=l[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*h}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*h}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*h,x2:t+g.x2*a,y2:e+-g.y2*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="Z"&&c.push({type:"Z"})}return c}}class ks extends er{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,c=this.index;let u,f,g,y;const w=[],d=[];let C=0,P=!1,x=!1,T=o,v=0,b=0;function I(D,A){w.push({type:"L",x:D,y:A})}function S(D,A,$,U,J,W){w.push({type:"C",x1:D,y1:A,x2:$,y2:U,x:J,y:W})}function _(D,A){x&&l!==2&&j(),x=!0,w.push({type:"M",x:D,y:A})}function j(){w.push({type:"Z"})}function R(D){w.push(...D)}function L(){d.length%2!==0&&!P&&(T=d.shift()+i),C+=d.length>>1,d.length=0,P=!0}function mt(D){let A,$,U,J,W,xt,F,K,k,G,N,X,q=0;for(;q<D.length;){let tt=D[q++];switch(tt){case 1:L();break;case 3:L();break;case 4:d.length>1&&!P&&(T=d.shift()+i,P=!0),b+=d.pop(),_(v,b);break;case 5:for(;d.length>0;)v+=d.shift(),b+=d.shift(),I(v,b);break;case 6:for(;d.length>0&&(v+=d.shift(),I(v,b),d.length!==0);)b+=d.shift(),I(v,b);break;case 7:for(;d.length>0&&(b+=d.shift(),I(v,b),d.length!==0);)v+=d.shift(),I(v,b);break;case 8:for(;d.length>0;)u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y+d.shift(),S(u,f,g,y,v,b);break;case 10:W=d.pop()+h,xt=t.subrs[W],xt&&mt(xt);break;case 11:return;case 12:switch(tt=D[q],q+=1,tt){case 35:u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),F=g+d.shift(),K=y+d.shift(),k=F+d.shift(),G=K+d.shift(),N=k+d.shift(),X=G+d.shift(),v=N+d.shift(),b=X+d.shift(),d.shift(),S(u,f,g,y,F,K),S(k,G,N,X,v,b);break;case 34:u=v+d.shift(),f=b,g=u+d.shift(),y=f+d.shift(),F=g+d.shift(),K=y,k=F+d.shift(),G=y,N=k+d.shift(),X=b,v=N+d.shift(),S(u,f,g,y,F,K),S(k,G,N,X,v,b);break;case 36:u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),F=g+d.shift(),K=y,k=F+d.shift(),G=y,N=k+d.shift(),X=G+d.shift(),v=N+d.shift(),S(u,f,g,y,F,K),S(k,G,N,X,v,b);break;case 37:u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),F=g+d.shift(),K=y+d.shift(),k=F+d.shift(),G=K+d.shift(),N=k+d.shift(),X=G+d.shift(),Math.abs(N-v)>Math.abs(X-b)?v=N+d.shift():b=X+d.shift(),S(u,f,g,y,F,K),S(k,G,N,X,v,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Qt=tr[d.pop()],Xt=tr[d.pop()],Dt=d.pop(),Nt=d.pop();if(Qt&&Xt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Qt),ne=t.charset.indexOf(Xt);n.components.push({glyphIndex:ne,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),R(r.get(ne).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ir=0;Ir<Or.length;Ir+=1){const zt=Or[Ir];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}R(Or)}}else d.length>0&&!P&&(T=d.shift()+i,P=!0);x&&l!==2&&(j(),x=!1);break;case 18:L();break;case 19:case 20:L(),q+=C+7>>3;break;case 21:d.length>2&&!P&&(T=d.shift()+i,P=!0),b+=d.pop(),v+=d.pop(),_(v,b);break;case 22:d.length>1&&!P&&(T=d.shift()+i,P=!0),v+=d.pop(),_(v,b);break;case 23:L();break;case 24:for(;d.length>2;)u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y+d.shift(),S(u,f,g,y,v,b);v+=d.shift(),b+=d.shift(),I(v,b);break;case 25:for(;d.length>6;)v+=d.shift(),b+=d.shift(),I(v,b);u=v+d.shift(),f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y+d.shift(),S(u,f,g,y,v,b);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)u=v,f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g,b=y+d.shift(),S(u,f,g,y,v,b);break;case 27:for(d.length%2&&(b+=d.shift());d.length>0;)u=v+d.shift(),f=b,g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y,S(u,f,g,y,v,b);break;case 28:A=D[q],$=D[q+1],d.push((A<<24|$<<16)>>16),q+=2;break;case 29:W=d.pop()+a,xt=t.gsubrs[W],xt&&mt(xt);break;case 30:for(;d.length>0&&(u=v,f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y+(d.length===1?d.shift():0),S(u,f,g,y,v,b),d.length!==0);)u=v+d.shift(),f=b,g=u+d.shift(),y=f+d.shift(),b=y+d.shift(),v=g+(d.length===1?d.shift():0),S(u,f,g,y,v,b);break;case 31:for(;d.length>0&&(u=v+d.shift(),f=b,g=u+d.shift(),y=f+d.shift(),b=y+d.shift(),v=g+(d.length===1?d.shift():0),S(u,f,g,y,v,b),d.length!==0);)u=v,f=b+d.shift(),g=u+d.shift(),y=f+d.shift(),v=g+d.shift(),b=y+(d.length===1?d.shift():0),S(u,f,g,y,v,b);break;default:tt<32?console.warn(`Glyph ${c}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(A=D[q],q+=1,d.push((tt-247)*256+A+108)):tt<255?(A=D[q],q+=1,d.push(-(tt-251)*256-A-108)):(A=D[q],$=D[q+1],U=D[q+2],J=D[q+3],q+=4,d.push((A<<24|$<<16|U<<8|J)/65536))}}}mt(e),this.pathCommands=w,P&&(this.advanceWidth=T)}}var Bs=Object.defineProperty,js=(s,t,e)=>t in s?Bs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fs=(s,t,e)=>(js(s,t+"",e),e);class rr{constructor(t){this._sfnt=t,Fs(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 Gs extends rr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new ks({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Xr=Object.defineProperty,Vs=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,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&&Xr(t,e,n),n},Ae=(s,t,e)=>(Vs(s,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(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 h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}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)}}Yr([m("uint16")],De.prototype,"count"),Yr([m("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Zr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const Rs=[".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"],Ws=[".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"],qs=[".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"],Hs=[".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 ze(s,t){return t<=390?Rs[t]:s[t-391]}var Qs=Object.defineProperty,Xs=(s,t,e)=>t in s?Qs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Kr=(s,t,e)=>(Xs(s,typeof t!="symbol"?t+"":t,e),e);function V(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 Jr extends Mt{constructor(){super(...arguments),Kr(this,"_dict"),Kr(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 ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ys=Object.defineProperty,nr=(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&&Ys(t,e,n),n};class Ee extends Jr{}nr([V(19)],Ee.prototype,"subrs"),nr([V(20)],Ee.prototype,"defaultWidthX"),nr([V(21)],Ee.prototype,"nominalWidthX");var Zs=Object.defineProperty,Y=(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&&Zs(t,e,n),n};class H extends Jr{}Y([V(0,"string")],H.prototype,"version"),Y([V(1,"string")],H.prototype,"notice"),Y([V(1200,"string")],H.prototype,"copyright"),Y([V(2,"string")],H.prototype,"fullName"),Y([V(3,"string")],H.prototype,"familyName"),Y([V(4,"string")],H.prototype,"weight"),Y([V(1201)],H.prototype,"isFixedPitch"),Y([V(1202)],H.prototype,"italicAngle"),Y([V(1203,"number",-100)],H.prototype,"underlinePosition"),Y([V(1204,"number",50)],H.prototype,"underlineThickness"),Y([V(1205)],H.prototype,"paintType"),Y([V(1206,"number",2)],H.prototype,"charstringType"),Y([V(1207,"number[]",[.001,0,0,.001,0,0])],H.prototype,"fontMatrix"),Y([V(13)],H.prototype,"uniqueId"),Y([V(5,"number[]",[0,0,0,0])],H.prototype,"fontBBox"),Y([V(1208)],H.prototype,"strokeWidth"),Y([V(14)],H.prototype,"xuid"),Y([V(15)],H.prototype,"charset"),Y([V(16)],H.prototype,"encoding"),Y([V(17)],H.prototype,"charStrings"),Y([V(18,"number[]",[0,0])],H.prototype,"private");var Ks=Object.defineProperty,Js=(s,t,e)=>t in s?Ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,sr=(s,t,e)=>(Js(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{he.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(he.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const tn=class xe{constructor(t){sr(this,"tables",new Map),sr(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){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}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,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const c=h[l];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 xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.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}};sr(tn,"tableDefinitions",new Map);let he=tn;class ct extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var en=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ei=(s,t,e)=>t in s?en(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ce=(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&&en(t,e,n),n},ir=(s,t,e)=>(ei(s,typeof t!="symbol"?t+"":t,e),e);p.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),ir(this,"_glyphs"),ir(this,"privateDict"),ir(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Gs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Zr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new H(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new Ee(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ws:this.topDict.charset===1?this.charset=qs:this.topDict.charset===2?this.charset=Hs:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=tr:this.topDict.encoding===1?this.encoding=Us:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(ze(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(ze(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(ze(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let c=h;c<=h+l;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},ce([m("uint8")],p.Cff.prototype,"majorVersion",2),ce([m("uint8")],p.Cff.prototype,"minorVersion",2),ce([m("uint8")],p.Cff.prototype,"headerSize",2),ce([m("uint8")],p.Cff.prototype,"offsetSize",2),p.Cff=ce([nt("CFF ","cff")],p.Cff);var ri=Object.defineProperty,Ue=(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&&ri(t,e,n),n};const ue=class ts extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ts;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((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}};Ue([m("uint16")],ue.prototype,"format"),Ue([m("uint16")],ue.prototype,"length"),Ue([m("uint16")],ue.prototype,"language"),Ue([m({type:"uint8",size:256})],ue.prototype,"glyphIndexArray");let or=ue;var ni=Object.defineProperty,ar=(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 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(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const c=r[l];for(let u=0,f=i[c].entryCount;u<f;u++)if(i[c].idRangeOffset+u>=o.length?h=0:(h=o[i[c].idRangeOffset+u],h!==0&&(h=h+i[c].idDelta)),h!==0&&h<t){const g=(l<<8|u+i[c].firstCode)%65535;e.set(g,h)}}return e}}ar([m("uint16")],fe.prototype,"format"),ar([m("uint16")],fe.prototype,"length"),ar([m("uint16")],fe.prototype,"language");function rn(s){return s>32767?s-65536:s<-32767?s+65536:s}function lr(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:rn(i-o)}):(n.start=Number(o),n.startId=i,n.delta=rn(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var si=Object.defineProperty,Vt=(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};const Bt=class es 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=lr(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new es(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,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let c=n[l],u=i[l];c<=u;++c)if(o[l]===0)t.set(c,(c+a[l])%65536);else{const f=l+o[l]/2+(c-n[l])-r,g=h[f];g!==0?t.set(c,(g+a[l])%65536):t.set(c,0)}return t.delete(65535),t}};Vt([m("uint16")],Bt.prototype,"format"),Vt([m("uint16")],Bt.prototype,"length"),Vt([m("uint16")],Bt.prototype,"language"),Vt([m("uint16")],Bt.prototype,"segCountX2"),Vt([m("uint16")],Bt.prototype,"searchRange"),Vt([m("uint16")],Bt.prototype,"entrySelector"),Vt([m("uint16")],Bt.prototype,"rangeShift");let hr=Bt;var ii=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&&ii(t,e,n),n};class Rt 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}}pe([m("uint16")],Rt.prototype,"format"),pe([m("uint16")],Rt.prototype,"length"),pe([m("uint16")],Rt.prototype,"language"),pe([m("uint16")],Rt.prototype,"firstCode"),pe([m("uint16")],Rt.prototype,"entryCount");var oi=Object.defineProperty,de=(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&&oi(t,e,n),n};const Zt=class rs 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=lr(t),r=new rs(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 h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};de([m("uint16")],Zt.prototype,"format"),de([m("uint16")],Zt.prototype,"reserved"),de([m("uint32")],Zt.prototype,"length"),de([m("uint32")],Zt.prototype,"language"),de([m("uint32")],Zt.prototype,"nGroups");let cr=Zt;var ai=Object.defineProperty,ur=(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&&ai(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}}ur([m("uint16")],ge.prototype,"format"),ur([m("uint32")],ge.prototype,"length"),ur([m("uint32")],ge.prototype,"numVarSelectorRecords");var nn=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(s,t,e)=>t in s?nn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(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&&nn(t,e,n),n},sn=(s,t,e)=>(hi(s,typeof t!="symbol"?t+"":t,e),e);p.Cmap=class extends ct{constructor(){super(...arguments),sn(this,"_unicodeToGlyphIndexMap"),sn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),r=hr.from(t),n=or.from(t),i=e?cr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),c=new p.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(r.view,o),c.view.writeBytes(n.view,a),i&&c.view.writeBytes(i.view,h),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new or(this.view.buffer,e.offset);break;case 2:n=new fe(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new hr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Rt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new cr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ge(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,c,u;const t=this.readSubtables(),e=(a=t.find(f=>f.format===0))==null?void 0:a.view,r=(h=t.find(f=>f.platformID===3&&f.platformSpecificID===3&&f.format===2))==null?void 0:h.view,n=(l=t.find(f=>f.platformID===3&&f.platformSpecificID===1&&f.format===4))==null?void 0:l.view,i=(c=t.find(f=>f.platformID===3&&f.platformSpecificID===10&&f.format===12))==null?void 0:c.view,o=(u=t.find(f=>f.platformID===0&&f.platformSpecificID===5&&f.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},fr([m("uint16")],p.Cmap.prototype,"version",2),fr([m("uint16")],p.Cmap.prototype,"numberSubtables",2),p.Cmap=fr([nt("cmap")],p.Cmap);class ci extends er{_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 ae(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 w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ae(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;ae(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let g,y=0;for(;y<u;)if(g=t.view.readUint8(),f.push(g),y++,g&8&&y<u){const w=t.view.readUint8();for(let d=0;d<w;d++)f.push(g),y++}if(ae(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const w=[];let d;if(u>0){for(let x=0;x<u;x+=1)g=f[x],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(x),w.push(d);let C=0;for(let x=0;x<u;x+=1)g=f[x],d=w[x],d.x=this._parseGlyphCoordinate(t,g,C,2,16),C=d.x;let P=0;for(let x=0;x<u;x+=1)g=f[x],d=w[x],d.y=this._parseGlyphCoordinate(t,g,P,4,32),P=d.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let c;if(h.matchedPoints===void 0)c=this._transformPoints(l.points,h);else{ae(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let f=l.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};f=this._transformPoints([f],g)[0],g.dx=u.x-f.x,g.dy=u.y-f.y,c=this._transformPoints(l.points,g)}this.points=this.points.concat(c)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let c=l[l.length-1],u=l[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,g=l.length;f<g;++f)if(c=u,u=l[(f+1)%g],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let y=u;u.onCurve||(y={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),i.push({type:"Q",x1:c.x,y1:c.y,x:y.x,y:y.y})}i.push({type:"Z"})}this.pathCommands=i}}class ui extends rr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new ci({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var on=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,pi=(s,t,e)=>t in s?on(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,di=(s,t,e,r)=>{for(var n=r>1?void 0:r?fi(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},gi=(s,t,e)=>(pi(s,t+"",e),e);const Kt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};p.Glyf=class extends ct{constructor(){super(...arguments),gi(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new p.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new ui(this._sfnt))}},p.Glyf=di([nt("glyf")],p.Glyf);var yi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,wi=(s,t,e,r)=>{for(var n=r>1?void 0:r?mi(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};p.Gpos=class extends ct{},p.Gpos=wi([nt("GPOS","gpos")],p.Gpos);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,Wt=(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&&vi(t,e,n),n};p.Gsub=class extends ct{},Wt([m("uint16")],p.Gsub.prototype,"majorVersion",2),Wt([m("uint16")],p.Gsub.prototype,"minorVersion",2),Wt([m("uint16")],p.Gsub.prototype,"scriptListOffset",2),Wt([m("uint16")],p.Gsub.prototype,"featureListOffset",2),Wt([m("uint16")],p.Gsub.prototype,"lookupListOffset",2),Wt([m("uint16")],p.Gsub.prototype,"featureVariationsOffset",2),p.Gsub=Wt([nt("GSUB","gsub")],p.Gsub);var Mi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,et=(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&&Mi(t,e,n),n};p.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],p.Head.prototype,"version",2),et([m("fixed")],p.Head.prototype,"fontRevision",2),et([m("uint32")],p.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],p.Head.prototype,"magickNumber",2),et([m("uint16")],p.Head.prototype,"flags",2),et([m("uint16")],p.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],p.Head.prototype,"created",2),et([m({type:"longDateTime"})],p.Head.prototype,"modified",2),et([m("int16")],p.Head.prototype,"xMin",2),et([m("int16")],p.Head.prototype,"yMin",2),et([m("int16")],p.Head.prototype,"xMax",2),et([m("int16")],p.Head.prototype,"yMax",2),et([m("uint16")],p.Head.prototype,"macStyle",2),et([m("uint16")],p.Head.prototype,"lowestRecPPEM",2),et([m("int16")],p.Head.prototype,"fontDirectionHint",2),et([m("int16")],p.Head.prototype,"indexToLocFormat",2),et([m("int16")],p.Head.prototype,"glyphDataFormat",2),p.Head=et([nt("head")],p.Head);var Ci=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(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&&Ci(t,e,n),n};p.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],p.Hhea.prototype,"version",2),pt([m("int16")],p.Hhea.prototype,"ascent",2),pt([m("int16")],p.Hhea.prototype,"descent",2),pt([m("int16")],p.Hhea.prototype,"lineGap",2),pt([m("uint16")],p.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],p.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],p.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],p.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],p.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],p.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],p.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],p.Hhea.prototype,"reserved",2),pt([m("int16")],p.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],p.Hhea.prototype,"numOfLongHorMetrics",2),p.Hhea=pt([nt("hhea")],p.Hhea);var an=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,_i=(s,t,e)=>t in s?an(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ti=(s,t,e,r)=>{for(var n=r>1?void 0:r?Pi(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&&an(t,e,n),n},Oi=(s,t,e)=>(_i(s,t+"",e),e);p.Hmtx=class extends ct{constructor(){super(...arguments),Oi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},p.Hmtx=Ti([nt("hmtx")],p.Hmtx);var Ii=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Di=(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&&Ii(t,e,n),n};p.Kern=class extends ct{},p.Kern=Di([nt("kern","kern")],p.Kern);var ln=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,zi=(s,t,e)=>t in s?ln(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ei=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ni(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&&ln(t,e,n),n},Ui=(s,t,e)=>(zi(s,t+"",e),e);p.Loca=class extends ct{constructor(){super(...arguments),Ui(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new p.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},p.Loca=Ei([nt("loca")],p.Loca);var Li=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,ut=(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&&Li(t,e,n),n};p.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],p.Maxp.prototype,"version",2),ut([m("uint16")],p.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],p.Maxp.prototype,"maxPoints",2),ut([m("uint16")],p.Maxp.prototype,"maxContours",2),ut([m("uint16")],p.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],p.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],p.Maxp.prototype,"maxZones",2),ut([m("uint16")],p.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],p.Maxp.prototype,"maxStorage",2),ut([m("uint16")],p.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],p.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],p.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],p.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],p.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],p.Maxp.prototype,"maxComponentDepth",2),p.Maxp=ut([nt("maxp")],p.Maxp);var hn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Bi=(s,t,e)=>t in s?hn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Le=(s,t,e,r)=>{for(var n=r>1?void 0:r?ki(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&&hn(t,e,n),n},ji=(s,t,e)=>(Bi(s,t+"",e),e);const cn={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"},pr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Fi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},un={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};p.Name=class extends ct{constructor(){super(...arguments),ji(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.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 r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=pr.Macintosh,i=Fi.Default,o=0;e.some(h=>h.platform===pr.Microsoft&&h.encoding===un.UCS2&&h.language===1033)&&(n=pr.Microsoft,i=un.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&cn[l.nameId]&&(a[cn[l.nameId]]=o===0?As(l.name):Ds(l.name))}return a}},Le([m("uint16")],p.Name.prototype,"format",2),Le([m("uint16")],p.Name.prototype,"count",2),Le([m("uint16")],p.Name.prototype,"stringOffset",2),p.Name=Le([nt("name")],p.Name);var Gi=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,O=(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&&Gi(t,e,n),n};p.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([m("uint16")],p.Os2.prototype,"version",2),O([m("int16")],p.Os2.prototype,"xAvgCharWidth",2),O([m("uint16")],p.Os2.prototype,"usWeightClass",2),O([m("uint16")],p.Os2.prototype,"usWidthClass",2),O([m("uint16")],p.Os2.prototype,"fsType",2),O([m("uint16")],p.Os2.prototype,"ySubscriptXSize",2),O([m("uint16")],p.Os2.prototype,"ySubscriptYSize",2),O([m("uint16")],p.Os2.prototype,"ySubscriptXOffset",2),O([m("uint16")],p.Os2.prototype,"ySubscriptYOffset",2),O([m("uint16")],p.Os2.prototype,"ySuperscriptXSize",2),O([m("uint16")],p.Os2.prototype,"ySuperscriptYSize",2),O([m("uint16")],p.Os2.prototype,"ySuperscriptXOffset",2),O([m("uint16")],p.Os2.prototype,"ySuperscriptYOffset",2),O([m("uint16")],p.Os2.prototype,"yStrikeoutSize",2),O([m("uint16")],p.Os2.prototype,"yStrikeoutPosition",2),O([m("uint16")],p.Os2.prototype,"sFamilyClass",2),O([m({type:"uint8"})],p.Os2.prototype,"bFamilyType",2),O([m({type:"uint8"})],p.Os2.prototype,"bSerifStyle",2),O([m({type:"uint8"})],p.Os2.prototype,"bWeight",2),O([m({type:"uint8"})],p.Os2.prototype,"bProportion",2),O([m({type:"uint8"})],p.Os2.prototype,"bContrast",2),O([m({type:"uint8"})],p.Os2.prototype,"bStrokeVariation",2),O([m({type:"uint8"})],p.Os2.prototype,"bArmStyle",2),O([m({type:"uint8"})],p.Os2.prototype,"bLetterform",2),O([m({type:"uint8"})],p.Os2.prototype,"bMidline",2),O([m({type:"uint8"})],p.Os2.prototype,"bXHeight",2),O([m({type:"uint8",size:16})],p.Os2.prototype,"ulUnicodeRange",2),O([m({type:"char",size:4})],p.Os2.prototype,"achVendID",2),O([m("uint16")],p.Os2.prototype,"fsSelection",2),O([m("uint16")],p.Os2.prototype,"usFirstCharIndex",2),O([m("uint16")],p.Os2.prototype,"usLastCharIndex",2),O([m("int16")],p.Os2.prototype,"sTypoAscender",2),O([m("int16")],p.Os2.prototype,"sTypoDescender",2),O([m("int16")],p.Os2.prototype,"sTypoLineGap",2),O([m("uint16")],p.Os2.prototype,"usWinAscent",2),O([m("uint16")],p.Os2.prototype,"usWinDescent",2),O([m({offset:72,type:"uint8",size:8})],p.Os2.prototype,"ulCodePageRange",2),O([m({offset:72,type:"int16"})],p.Os2.prototype,"sxHeight",2),O([m("int16")],p.Os2.prototype,"sCapHeight",2),O([m("uint16")],p.Os2.prototype,"usDefaultChar",2),O([m("uint16")],p.Os2.prototype,"usBreakChar",2),O([m("uint16")],p.Os2.prototype,"usMaxContext",2),p.Os2=O([nt("OS/2","os2")],p.Os2);var Ri=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,It=(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};p.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},It([m("fixed")],p.Post.prototype,"format",2),It([m("fixed")],p.Post.prototype,"italicAngle",2),It([m("int16")],p.Post.prototype,"underlinePosition",2),It([m("int16")],p.Post.prototype,"underlineThickness",2),It([m("uint32")],p.Post.prototype,"isFixedPitch",2),It([m("uint32")],p.Post.prototype,"minMemType42",2),It([m("uint32")],p.Post.prototype,"maxMemType42",2),It([m("uint32")],p.Post.prototype,"minMemType1",2),It([m("uint32")],p.Post.prototype,"maxMemType1",2),p.Post=It([nt("post")],p.Post);var qi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Hi(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&&qi(t,e,n),n};p.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],p.Vhea.prototype,"version",2),dt([m("int16")],p.Vhea.prototype,"vertTypoAscender",2),dt([m("int16")],p.Vhea.prototype,"vertTypoDescender",2),dt([m("int16")],p.Vhea.prototype,"vertTypoLineGap",2),dt([m("int16")],p.Vhea.prototype,"advanceHeightMax",2),dt([m("int16")],p.Vhea.prototype,"minTopSideBearing",2),dt([m("int16")],p.Vhea.prototype,"minBottomSideBearing",2),dt([m("int16")],p.Vhea.prototype,"yMaxExtent",2),dt([m("int16")],p.Vhea.prototype,"caretSlopeRise",2),dt([m("int16")],p.Vhea.prototype,"caretSlopeRun",2),dt([m("int16")],p.Vhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],p.Vhea.prototype,"reserved",2),dt([m("int16")],p.Vhea.prototype,"metricDataFormat",2),dt([m("int16")],p.Vhea.prototype,"numOfLongVerMetrics",2),p.Vhea=dt([nt("vhea")],p.Vhea);var fn=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Xi=(s,t,e)=>t in s?fn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yi=(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&&fn(t,e,n),n},Zi=(s,t,e)=>(Xi(s,t+"",e),e);p.Vmtx=class extends ct{constructor(){super(...arguments),Zi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},p.Vmtx=Yi([nt("vmtx")],p.Vmtx);var pn=Object.defineProperty,Ki=(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=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&pn(t,e,n),n},$e=(s,t,e)=>(Ki(s,typeof t!="symbol"?t+"":t,e),e);class st extends Oe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(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(Gt(t).getUint32(0))}static checksum(t){const e=Gt(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,h=0;const l=i.getDirectories();t.tableViews.forEach((u,f)=>{const g=l[h++];g.tag=f,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,i.view.writeBytes(u,a),a+=e(g.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 Yt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(st,"signature",new Set([65536,1953658213,1954115633])),ye([m("uint32")],st.prototype,"scalerType"),ye([m("uint16")],st.prototype,"numTables"),ye([m("uint16")],st.prototype,"searchRange"),ye([m("uint16")],st.prototype,"entrySelector"),ye([m("uint16")],st.prototype,"rangeShift");var Ji=Object.defineProperty,to=(s,t,e)=>t in s?Ji(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,dr=(s,t,e)=>(to(s,typeof t!="symbol"?t+"":t,e),e);class ke extends st{constructor(){super(...arguments),dr(this,"format","OpenType"),dr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}dr(ke,"signature",new Set([1330926671]));var eo=Object.defineProperty,me=(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&&eo(t,e,n),n};class qt extends Mt{constructor(t,e){super(t,e,20)}}me([m({type:"char",size:4})],qt.prototype,"tag"),me([m("uint32")],qt.prototype,"offset"),me([m("uint32")],qt.prototype,"compLength"),me([m("uint32")],qt.prototype,"origLength"),me([m("uint32")],qt.prototype,"origChecksum");var dn=Object.defineProperty,ro=(s,t,e)=>t in s?dn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vt=(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&&dn(t,e,n),n},Be=(s,t,e)=>(ro(s,typeof t!="symbol"?t+"":t,e),e);const gt=class Ar extends Oe{constructor(){super(...arguments),Be(this,"format","WOFF"),Be(this,"mimeType","font/woff"),Be(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":ke.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(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(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 h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,f)=>{const g=Gt(ws(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:f,view:g.byteLength<u.byteLength?g:u,rawView:u})});const i=n.length,o=n.reduce((u,f)=>u+r(f.view.byteLength),0),a=new Ar(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 h=44+i*20,l=0;const c=a.getDirectories();return n.forEach(u=>{const f=c[l++];f.tag=u.tag,f.offset=h,f.compLength=u.view.byteLength,f.origChecksum=Ar.checkSum(u.rawView),f.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,h),h+=r(f.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new qt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(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(vs(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Be(gt,"signature",new Set([2001684038])),vt([m("uint32")],gt.prototype,"signature"),vt([m("uint32")],gt.prototype,"flavor"),vt([m("uint32")],gt.prototype,"length"),vt([m("uint16")],gt.prototype,"numTables"),vt([m("uint16")],gt.prototype,"reserved"),vt([m("uint32")],gt.prototype,"totalSfntSize"),vt([m("uint16")],gt.prototype,"majorVersion"),vt([m("uint16")],gt.prototype,"minorVersion"),vt([m("uint32")],gt.prototype,"metaOffset"),vt([m("uint32")],gt.prototype,"metaLength"),vt([m("uint32")],gt.prototype,"metaOrigLength"),vt([m("uint32")],gt.prototype,"privOffset"),vt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function gn(s){if(st.is(s))return new st(s);if(ke.is(s))return new ke(s);if(Ut.is(s))return new Ut(s)}var no=Object.defineProperty,so=(s,t,e)=>t in s?no(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t,e)=>(so(s,typeof t!="symbol"?t+"":t,e),e);const yn=class ns{constructor(){we(this,"fallbackFont"),we(this,"_loading",new Map),we(this,"_loaded",new Map),we(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...ns.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;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((c,u)=>{c!==l&&(c.cancel(),this._loading.delete(u))}),l.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(a)?a:[a]).forEach(f=>{this._namesUrls.set(f,h),typeof document<"u"&&(n&&this.injectFontFace(f,c),i&&this.injectStyleTag(f,h))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(h)})}};we(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,c=i==null?void 0:i.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),f=new Map;u.forEach(w=>{const d=a.get(w)??0;let C=f.get(d);C||f.set(d,C=new Set),C.add(w)});const g=[],y=w=>{const d=l[w],C=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},P=h[w],x=h[w+1]??P,T={...d,...C,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(f.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+P,x-P)};return g.push(T),T};return y(0),u.forEach(w=>y(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let P=10,x;do{x=d.getUint16(P);const T=P+2,v=d.getUint16(T);P+=4,Kt.ARG_1_AND_2_ARE_WORDS&x?P+=4:P+=2,Kt.WE_HAVE_A_SCALE&x?P+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&x?P+=4:Kt.WE_HAVE_A_TWO_BY_TWO&x&&(P+=8);const b=y(v);d.setUint16(T,b.glyphIndex)}while(Kt.MORE_COMPONENTS&x)}),g}function bn(s,t){const e=vn(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=p.Loca.from([...e.map(f=>{const g=h;return h+=f.view.byteLength,g}),h],n.indexToLocFormat);const l=e.reduce((f,g,y)=>(g.unicodes.forEach(w=>f.set(w,y)),f),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(f=>f.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(f=>({advanceWidth:f.advanceWidth,leftSideBearing:f.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(f=>({advanceHeight:f.advanceHeight,topSideBearing:f.topSideBearing}))));const u=new p.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,s.post=u,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function io(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Ut)e=s.sfnt.clone(),r="woff";else{const i=Gt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Ut.is(i))e=new Ut(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const oo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function gr(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:h=[],strokeDashoffset:l=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=oo[o],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=g}class M{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new M(1/0,1/0)}static get MIN(){return new M(-1/0,-1/0)}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 M(this.x,this.y)}}class Q{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}static from(...t){if(t.length===0)return new Q;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 Q(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new M((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new Q(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var ao=Object.defineProperty,lo=(s,t,e)=>t in s?ao(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ho=(s,t,e)=>(lo(s,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){ho(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=h,c[6]=r,c[7]=o,c[8]=l,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],h=r[6],l=r[1],c=r[4],u=r[7],f=r[2],g=r[5],y=r[8],w=n[0],d=n[3],C=n[6],P=n[1],x=n[4],T=n[7],v=n[2],b=n[5],I=n[8];return i[0]=o*w+a*P+h*v,i[3]=o*d+a*x+h*b,i[6]=o*C+a*T+h*I,i[1]=l*w+c*P+u*v,i[4]=l*d+c*x+u*b,i[7]=l*C+c*T+u*I,i[2]=f*w+g*P+y*v,i[5]=f*d+g*x+y*b,i[8]=f*C+g*T+y*I,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*o-a*l,f=a*h-c*i,g=l*i-o*h,y=e*u+r*f+n*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return t[0]=u*w,t[1]=(n*l-c*r)*w,t[2]=(a*r-n*o)*w,t[3]=f*w,t[4]=(c*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=g*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,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(yr.makeScale(t,e)),this}rotate(t){return this.premultiply(yr.makeRotation(-t)),this}translate(t,e){return this.premultiply(yr.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 yr=new yt;function Mn(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 xn(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 h=(o.x-a.x)/2,l=(o.y-a.y)/2,c=Math.cos(r)*h+Math.sin(r)*l,u=-Math.sin(r)*h+Math.cos(r)*l;let f=t*t,g=e*e;const y=c*c,w=u*u,d=y/f+w/g;if(d>1){const j=Math.sqrt(d);t=j*t,e=j*e,f=t*t,g=e*e}const C=f*w+g*y,P=(f*g-C)/C;let x=Math.sqrt(Math.max(0,P));n===i&&(x=-x);const T=x*t*u/e,v=-x*e*c/t,b=Math.cos(r)*T-Math.sin(r)*v+(o.x+a.x)/2,I=Math.sin(r)*T+Math.cos(r)*v+(o.y+a.y)/2,S=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);s.ellipse(b,I,t,e,r,S,S+_,i===1)}function Jt(s,t){return s-(t-s)}function mr(s,t){const e=new M,r=new M;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(Jt(e.x,r.x),Jt(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(Jt(e.x,r.x),Jt(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=Jt(e.x,r.x),h=Jt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,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),xn(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 Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(s,t,e=0){let a=0,h=!0,l="",c="";const u=[];function f(d,C,P){const x=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw x.partial=P,x}function g(){l!==""&&(c===""?u.push(Number(l)):u.push(Number(l)*10**Number(c))),l="",c=""}let y;const w=s.length;for(let d=0;d<w;d++){if(y=s[d],Array.isArray(t)&&t.includes(u.length%e)&&Z.FLAGS.test(y)){a=1,l=y,g();continue}if(a===0){if(Z.WHITESPACE.test(y))continue;if(Z.DIGIT.test(y)||Z.SIGN.test(y)){a=1,l=y;continue}if(Z.POINT.test(y)){a=2,l=y;continue}Z.COMMA.test(y)&&(h&&f(y,d,u),h=!0)}if(a===1){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.POINT.test(y)){l+=y,a=2;continue}if(Z.EXP.test(y)){a=3;continue}Z.SIGN.test(y)&&l.length===1&&Z.SIGN.test(l[0])&&f(y,d,u)}if(a===2){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.EXP.test(y)){a=3;continue}Z.POINT.test(y)&&l[l.length-1]==="."&&f(y,d,u)}if(a===3){if(Z.DIGIT.test(y)){c+=y;continue}if(Z.SIGN.test(y)){if(c===""){c+=y;continue}c.length===1&&Z.SIGN.test(c)&&f(y,d,u)}}Z.WHITESPACE.test(y)?(g(),a=0,h=!1):Z.COMMA.test(y)?(g(),a=0,h=!0):Z.SIGN.test(y)?(g(),a=1,l=y):Z.POINT.test(y)?(g(),a=2,l=y):f(y,d,u)}return g(),u}function co(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function Cn(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${co(s[e])} `;return t}const uo=/[a-df-z][^a-df-z]*/gi;function wr(s){const t=[],e=s.match(uo);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 h;switch(o){case"m":case"M":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,c=h.length;l<c;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,c=h.length;l<c;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var fo=Object.defineProperty,po=(s,t,e)=>t in s?fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(po(s,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){vr(this,"arcLengthDivisions",200),vr(this,"_cacheArcLengths"),vr(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 M){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,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const c=r[n],f=r[n+1]-c,g=(o-c)/f;return(n+g)/(i-1)}getTangent(t,e=new M){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 M){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=M.MAX,e=M.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(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 Cn(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)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new M){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new M){const{start:r,end:n}=this,i=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(i),Math.sin(i))}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function go(s,t){const e=1-s;return e*e*t}function yo(s,t){return 2*(1-s)*s*t}function mo(s,t){return s*s*t}function Pn(s,t,e,r){return go(s,t)+yo(s,e)+mo(s,r)}function wo(s,t){const e=1-s;return e*e*e*t}function vo(s,t){const e=1-s;return 3*e*e*s*t}function bo(s,t){return 3*(1-s)*s*s*t}function Mo(s,t){return s*s*s*t}function _n(s,t,e,r,n){return wo(s,t)+vo(s,e)+bo(s,r)+Mo(s,n)}class Tn extends _t{constructor(t=new M,e=new M,r=new M,n=new M){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new M){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(_n(t,r.x,n.x,i.x,o.x),_n(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(h=>h>=0&&h<=1)}getMinMax(t=M.MAX,e=M.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)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((u,f)=>{for(const g of u)for(let y=0;y<=f;y++){const w=y/f-.5,d=Math.min(1,Math.max(0,g+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,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 xo=new yt,On=new yt,In=new yt,Fe=new M;class An extends _t{constructor(t=new M,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 M){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),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=h-this.center.y;a=u*l-f*c+this.center.x,h=u*c+f*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,c=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-i),g=f>Math.PI?1:0,y=o?1:0,w=a*180/Math.PI;if(f>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),P=l+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:w,largeArcFlag:0,sweepFlag:y,x:C,y:P},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:c,y:u}]}else{const d=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),C=l+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:w,largeArcFlag:g,sweepFlag:y,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,Po(t)?Co(this,t):So(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*l*l+i*i*c*c),f=Math.sqrt(n*n*c*c+i*i*l*l);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,h-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,h+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 Co(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new M(e*n,e*i),a=new M(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),c=xo.set(h.x,l.x,0,h.y,l.y,0,0,0,1),u=On.copy(c).invert(),y=In.copy(u).transpose().multiply(u).elements,w=_o(y[0],y[1],y[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(s.radiusX=1/d,s.radiusY=1/C,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(d,0,0,0,C,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(c),b=I=>{const{x:S,y:_}=new M(Math.cos(I),Math.sin(I)).applyMatrix3(v);return Math.atan2(_,S)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),Dn(t)&&(s.clockwise=!s.clockwise)}}function So(s,t){const e=Nn(t),r=zn(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,Dn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Dn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Po(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(s),n=zn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function _o(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,c=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+c),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-c):(r=.5*c,n=-.5*c),l>0?i=l+c:i=l-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),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Ht extends _t{constructor(t=new M,e=new M){super(),this.start=t,this.end=e}getPoint(t,e=new M){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new M){return this.getPoint(t,e)}getTangent(t,e=new M){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new M){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=M.MAX,e=M.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}}var To=Object.defineProperty,Oo=(s,t,e)=>t in s?To(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Io=(s,t,e)=>(Oo(s,t+"",e),e);class Ao extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Io(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new M(t+.5*this.size,e-.5*this.size),n=new M(t-.5*this.size,e-.5*this.size),i=new M(t,e+.5*this.size),o=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new je(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new M(t,e+this.size),c=new M(t+this.size,e),u=new M().lerpVectors(c,l,.75),f=new M(t-this.size,e),g=new M().lerpVectors(f,l,.75),y=new Ht(c,u),w=new Ht(g,f);return this.curves=[o,y,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}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=M.MAX,e=M.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}}var Do=Object.defineProperty,No=(s,t,e)=>t in s?Do(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,br=(s,t,e)=>(No(s,typeof t!="symbol"?t+"":t,e),e);class zo extends _t{constructor(t,e=0,r=0,n=0,i=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=i,br(this,"curves",[]),br(this,"curveT",0),br(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new M(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}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=M.MAX,e=M.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 En extends _t{constructor(t=new M,e=new M,r=new M){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new M){const{start:r,control:n,end:i}=this;return e.set(Pn(t,r.x,n.x,i.x),Pn(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=M.MAX,e=M.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{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 Eo=Object.defineProperty,Uo=(s,t,e)=>t in s?Eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Un=(s,t,e)=>(Uo(s,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{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,Un(this,"curves",[]),Un(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 M(t-r,e-n),new M(t+r,e-n),new M(t+r,e+n),new M(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new Ht(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=M.MAX,e=M.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 $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new M){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Sn(o,a.x,h.x,l.x,c.x),Sn(o,a.y,h.y,l.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 Lo=Object.defineProperty,$o=(s,t,e)=>t in s?Lo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ve=(s,t,e)=>($o(s,typeof t!="symbol"?t+"":t,e),e);class te extends _t{constructor(t){super(),ve(this,"curves",[]),ve(this,"startPoint"),ve(this,"currentPoint",new M),ve(this,"autoClose",!1),ve(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 mr(t,this),this}addData(t){return this.addCommands(wr(t)),this}getPoint(t,e=new M){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],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,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 h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const c=h[l];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 Ht(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 Ht(this.currentPoint.clone(),new M(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 Tn(this.currentPoint.clone(),new M(t,e),new M(r,n),new M(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 En(this.currentPoint.clone(),new M(t,e),new M(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,h=!0){const l=new An(new M(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new Ln(new M(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new $n([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(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 ko(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(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 M((s.x+e.x)/2,(s.y+e.y)/2);const h=o.cross(i)/a;return Math.abs(h)>1?new M((s.x+e.x)/2,(s.y+e.y)/2):new M(s.x+h*n.x,s.y+h*n.y)}var jo=Object.defineProperty,Fo=(s,t,e)=>t in s?jo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Mr=(s,t,e)=>(Fo(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){Mr(this,"currentPath",new te),Mr(this,"paths",[this.currentPath]),Mr(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}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 bt?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 te().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 te().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,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return mr(t,this),this}addData(t){return this.addCommands(wr(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,h)=>{const l=a.getControlPoints(),c=a.isClockwise();i[h]=l,n[h]=c;const u=l[0],f=l[l.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:h})});const o=[];return r.forEach((a,h)=>{o[h]=[],r.forEach((l,c)=>{c!==h&&l.start.equals(a.end)&&o[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];i[h].forEach(u=>{const f=a.getTForPoint(u),g=a.getNormal(f).scale(l?t:-t);u.add(g)})}),o.forEach((a,h)=>{const l=i[h];a.forEach(c=>{const u=i[c],f=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],u[0],u[1]??u[0]);f&&(l[l.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=M.MAX,e=M.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(),h=[];for(let l=0;l<=1;l+=1/i.arcLengthDivisions){const c=i.getPoint(l),u=i.getNormal(l),f=u.clone().scale(a?o:-o),g=u.clone().scale(a?-o:o);h.push(c.clone().add(f),c.clone().add(g),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(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new Q(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(),gr(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(),gr(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[ko(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(),h=document.createElement("canvas");h.width=o*e,h.height=a*e,h.style.width=`${o}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-i),this.drawTo(l,r)),h}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 xr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Cr={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 E(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const i=Bn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&xr!=="px"?e=Cr.in[xr]/kn:(e=Cr[t][xr],e<0&&(e=Cr[t].in*kn)),e*Number.parseFloat(s)}const Go=new yt,Ge=new yt,jn=new yt,Fn=new yt;function Vo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ro(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ro(s){const t=new yt,e=Go;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(E(s.getAttribute("x")),E(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 h=i.slice(0,o),l=Pt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const c=l[0];let u=0;l.length>=2&&(u=l[1]),e.translate(c,u)}break;case"rotate":if(l.length>=1){let c=0,u=0,f=0;c=l[0]*Math.PI/180,l.length>=3&&(u=l[1],f=l[2]),Ge.makeTranslation(-u,-f),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ge),Ge.makeTranslation(u,f),e.multiplyMatrices(Ge,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Wo(s){return new bt().addPath(new te().arc(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("r")||0),0,Math.PI*2))}function qo(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(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Ho(s){return new bt().addPath(new te().ellipse(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("rx")||0),E(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(s){return new bt().moveTo(E(s.getAttribute("x1")||0),E(s.getAttribute("y1")||0)).lineTo(E(s.getAttribute("x2")||0),E(s.getAttribute("y2")||0))}function Xo(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Yo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Yo,(n,i,o)=>{const a=E(i),h=E(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ko,(n,i,o)=>{const a=E(i),h=E(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ta(s){const t=E(s.getAttribute("x")||0),e=E(s.getAttribute("y")||0),r=E(s.getAttribute("rx")||s.getAttribute("ry")||0),n=E(s.getAttribute("ry")||s.getAttribute("rx")||0),i=E(s.getAttribute("width")),o=E(s.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,c){c===void 0&&(c=function(f){return f.startsWith("url")&&console.warn("url access in attributes is not implemented."),f}),s.hasAttribute(h)&&(t[l]=c(s.getAttribute(h))),r[h]&&(t[l]=c(r[h])),s.style&&s.style[h]!==""&&(t[l]=c(s.style[h]))}function i(h){return Math.max(0,Math.min(1,E(h)))}function o(h){return Math.max(0,E(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>E(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",E),n("visibility","visibility"),t}function Sr(s,t,e=[]){var c;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=At(s,t,i);break;case"style":qo(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=Xo(s));break;case"rect":t=At(s,t,i),n=ta(s);break;case"polygon":t=At(s,t,i),n=Zo(s);break;case"polyline":t=At(s,t,i),n=Jo(s);break;case"circle":t=At(s,t,i),n=Wo(s);break;case"ellipse":t=At(s,t,i),n=Ho(s);break;case"line":t=At(s,t,i),n=Qo(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const f=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(c=s.viewportElement)==null?void 0:c.getElementById(f);g?Sr(g,t,e):console.warn(`'use node' references non-existent node id: ${f}`);break}default:console.warn(s);break}const o=new yt,a=[],h=Vo(s,o,a);n&&(n.matrix(o),e.push(n),n.style=t);const l=s.childNodes;for(let u=0,f=l.length;u<f;u++){const g=l[u];r&&g.nodeName!=="style"&&g.nodeName!=="defs"||Sr(g,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Gn="data:image/svg+xml;",Vn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function Pr(s){if(typeof s=="string"){let t;return s.startsWith(Vn)?(s=s.substring(Vn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Ve(s){return Sr(Pr(s),{})}function be(s,t=!0){if(!s.length)return;const e=M.MAX,r=M.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new Q(e.x,e.y,r.x-e.x,r.y-e.y)}const ea=new Set(["©","®","÷"]),ra=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),na={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Wn{constructor(t,e,r){z(this,"boundingBox",new Q);z(this,"textWidth",0);z(this,"textHeight",0);z(this,"glyphHeight",0);z(this,"glyphWidth",0);z(this,"underlinePosition",0);z(this,"underlineThickness",0);z(this,"yStrikeoutPosition",0);z(this,"yStrikeoutSize",0);z(this,"baseline",0);z(this,"centerDiviation",0);z(this,"path",new bt);z(this,"glyphBox",new Q);z(this,"center",new M);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:c}=l,{fontSize:u}=h,f=e/u,g=t.getAdvanceWidth(a,u),y=(r+Math.abs(n))/f,w=r/f,d=(r-i.yStrikeoutPosition)/f,C=i.yStrikeoutSize/f,P=(r-o.underlinePosition)/f,x=o.underlineThickness/f;return this.glyphWidth=g,this.glyphHeight=y,this.underlinePosition=P,this.underlineThickness=x,this.yStrikeoutPosition=d,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*c-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:c}=this.updateGlyph(t),{os2:u,ascender:f,descender:g}=t,y=f,w=g,d=u.sTypoAscender,{left:C,top:P}=o,{fontSize:x,fontStyle:T}=a;let v=C,b=P+h,I;const S=new bt;if(e&&(v+=(l-c)/2,Math.abs(n-i)>.1&&(b-=(y-d)/(y+Math.abs(w))*l),I=void 0),e&&!ea.has(r)&&(r.codePointAt(0)<=256||ra.has(r))){S.addCommands(t.getPathCommands(r,v,P+h-(l-c)/2,x)??[]);const _={y:P-(l-c)/2+l/2,x:v+c/2};T==="italic"&&this._italic(S,e?{x:_.x,y:P-(l-c)/2+h}:void 0),S.rotate(90,_)}else I!==void 0?(S.addCommands(t.glyphs.get(I).getPathCommands(v,b,x)),T==="italic"&&this._italic(S,e?{x:v+c/2,y:P+d/(y+Math.abs(w))*l}:void 0)):(S.addCommands(t.getPathCommands(r,v,b,x)??[]),T==="italic"&&this._italic(S,e?{x:v+l/2,y:b}:void 0));return S.addCommands(this._decoration()),S.bold(na[a.fontWeight??400]*x*.05),S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=S,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,c=.1*i;let u;switch(n){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+h/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+l},{type:"L",x:u+c,y:a+l},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+h,y:u},{type:"L",x:o+h,y:u+c},{type:"L",x:o,y:u+c},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.boundingBox.top+this.baseline,x:this.boundingBox.left+this.glyphWidth/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r);{t??(t=M.MAX),e??(e=M.MIN);const{left:i,top:o}=this.boundingBox,a=i+this.glyphWidth,h=o+this.glyphHeight;return t.x=Math.min(t.x,i),t.y=Math.min(t.y,o),e.x=Math.max(e.x,a),e.y=Math.max(e.y,h),{min:t,max:e}}}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new Q(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function Me(s){return!s||s==="none"}function Re(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class qn{constructor(t,e={},r){z(this,"boundingBox",new Q);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,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Wn(r,e++,this));return this.characters=t,this}}class ee{constructor(t,e){z(this,"boundingBox",new Q);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new qn(t,e,this);return this.fragments.push(r),r}}class Hn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_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("span").forEach((h,l)=>{var f;const c=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:c.left,top:c.top,width:c.width,height:c.height});const u=h.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const y=u.data?u.data.length:0;let w=0;for(;w<=y;){g.setStart(u,Math.max(w-1,0)),g.setEnd(u,w);const d=((f=g.getClientRects)==null?void 0:f.call(g))??[g.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const P=g.toString();P!==""&&C&&C.width+C.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((g,y)=>{const w=i?"left":"top";return Math.abs(y[w]-g[w])>4e3/2&&(h=[],a.push(h)),h.push(y),y})),n.style.lineHeight=o;const c=this._measureDom(t);c.paragraphs.forEach(g=>{const y=e[g.paragraphIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height}),c.fragments.forEach(g=>{const y=e[g.paragraphIndex].fragments[g.fragmentIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height});const u=[];let f=0;return a.forEach(g=>{g.forEach(y=>{const w=c.characters[f],{paragraphIndex:d,fragmentIndex:C,characterIndex:P}=w;u.push({...w,newParagraphIndex:d,textWidth:y.width,textHeight:y.height,left:w.left-r.left,top:w.top-r.top});const x=e[d].fragments[C].characters[P];x.boundingBox.left=u[f].left,x.boundingBox.top=u[f].top,x.boundingBox.width=u[f].width,x.boundingBox.height=u[f].height,x.textWidth=u[f].textWidth,x.textHeight=u[f].textHeight,f++})}),{paragraphs:e,boundingBox:new Q(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Qn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ee({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new ee({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new ee({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,...h}=o;a!==void 0&&i.addFragment(a,h)}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new ee(o,e);i.forEach(h=>{const{content:l,...c}=h;l!==void 0&&a.addFragment(l,c)}),r.push(a)}else if("content"in n){const{content:i,...o}=n;if(i!==void 0){const a=new ee(o,e);a.addFragment(i),r.push(a)}}}return r}}function sa(s){return s}const jt=new M,re=new yt,Ft=new yt;function Xn(){return{name:"effect",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(i=>{r==null||r.forEach(o=>{const a=i.glyphBox.clone(),h=_r(s,o);jt.set(a.left,a.top),jt.applyMatrix3(h),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(h),a.width=jt.x-a.left,a.height=jt.y-a.top;const l=(o.shadowOffsetX??0)*e,c=(o.shadowOffsetY??0)*e,u=Math.max(.1,o.textStrokeWidth??0)*e;a.left+=l-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?Q.from(...n):void 0},render:(s,t)=>{const{characters:e,renderBoundingBox:r,effects:n}=t;n?n.forEach(i=>{Tt(i,r,s),s.save();const[o,a,h,l,c,u]=_r(t,i).transpose().elements;s.transform(o,l,a,c,h,u),e.forEach(f=>{f.drawTo(s,i)}),s.restore()}):e.forEach(i=>{i.drawTo(s)})}}}function _r(s,t){const{fontSize:e,renderBoundingBox:r}=s,n=(t.offsetX??0)*e,i=(t.offsetY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,h=(t.skewY??0)/360*o,{left:l,top:c,width:u,height:f}=r,g=l+u/2,y=c+f/2;return re.identity(),Ft.makeTranslation(n,i),re.multiply(Ft),Ft.makeTranslation(g,y),re.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),re.multiply(Ft),Ft.makeTranslation(-g,-y),re.multiply(Ft),re.clone()}const ia={referImage:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4="};function oa(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function aa(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Yn(s={}){const t={...ia,...s},e=Ve(t.referImage),r=[],n=[];return{name:"highlight",paths:r,update:i=>{r.length=0;const{characters:o}=i;let a;const h=[];let l;o.forEach(c=>{const{isVertical:u,computedStyle:f}=c;Me(f.highlightImage)||(f.highlightSize!=="1rem"&&(l==null?void 0:l.highlightImage)===f.highlightImage&&(l==null?void 0:l.highlightSize)===f.highlightSize&&(l==null?void 0:l.highlightStrokeWidth)===f.highlightStrokeWidth&&(l==null?void 0:l.highlightOverflow)===f.highlightOverflow&&a.length&&(u?a[0].boundingBox.left===c.boundingBox.left:a[0].boundingBox.top===c.boundingBox.top)&&a[0].fontSize===c.fontSize?a.push(c):(a=[],a.push(c),h.push(a))),l=f}),h.filter(c=>c.length).map(c=>({style:c[0].computedStyle,box:Q.from(...c.map(u=>u.glyphBox))})).forEach(c=>{const{style:u,box:f}=c,{fontSize:g}=u,y=aa(u.highlightStrokeWidth,g,f.width),w=oa(u.highlightSize,g,f.width),d=Me(u.highlightOverflow)?w?"hidden":"visible":u.highlightOverflow,C=Pr(u.highlightImage),P=Ve(C),x=be(P,!1),T=be(e,!1),b=(w?g*w:f.width)/T.width,I=f.height/T.height,S=g/x.width*2,_=T.width*b,j=Math.ceil(f.width/_),R=new yt().translate(-x.left,-x.top).scale(b,I).translate(f.left,f.top).translate((x.left-T.left)*b,(x.top-T.top)*I);for(let L=0;L<j;L++){const mt=R.clone().translate(L*_,0);P.forEach(D=>{const A=D.clone().matrix(mt);A.style.strokeWidth&&(A.style.strokeWidth*=S*y),A.style.strokeMiterlimit&&(A.style.strokeMiterlimit*=S),A.style.strokeDashoffset&&(A.style.strokeDashoffset*=S),A.style.strokeDasharray&&(A.style.strokeDasharray=A.style.strokeDasharray.map($=>$*S)),r.push(A),n[r.length-1]=d==="hidden"?new Q(f.left,f.top-f.height,f.width,f.height*3):void 0})}})},renderOrder:-1,render:(i,o)=>{r.forEach((a,h)=>{Ce({ctx:i,path:a,clipRect:n[h],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,computedStyle:r,fontSize:n,isVertical:i}=t;let o=r.listStyleSize,a;if(!Me(r.listStyleImage))a=r.listStyleImage;else if(!Me(r.listStyleType)){const u=n*.38/2;switch(o=o==="cover"?u*2:o,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((c,u)=>{c!==l&&(c.cancel(),this._loading.delete(u))}),l.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(a)?a:[a]).forEach(f=>{this._namesUrls.set(f,h),typeof document<"u"&&(n&&this.injectFontFace(f,c),i&&this.injectStyleTag(f,h))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(h)})}};we(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,c=i==null?void 0:i.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),f=new Map;u.forEach(w=>{const d=a.get(w)??0;let C=f.get(d);C||f.set(d,C=new Set),C.add(w)});const g=[],y=w=>{const d=l[w],C=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},P=h[w],x=h[w+1]??P,T={...d,...C,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(f.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+P,x-P)};return g.push(T),T};return y(0),u.forEach(w=>y(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let P=10,x;do{x=d.getUint16(P);const T=P+2,v=d.getUint16(T);P+=4,Kt.ARG_1_AND_2_ARE_WORDS&x?P+=4:P+=2,Kt.WE_HAVE_A_SCALE&x?P+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&x?P+=4:Kt.WE_HAVE_A_TWO_BY_TWO&x&&(P+=8);const b=y(v);d.setUint16(T,b.glyphIndex)}while(Kt.MORE_COMPONENTS&x)}),g}function bn(s,t){const e=vn(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=p.Loca.from([...e.map(f=>{const g=h;return h+=f.view.byteLength,g}),h],n.indexToLocFormat);const l=e.reduce((f,g,y)=>(g.unicodes.forEach(w=>f.set(w,y)),f),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(f=>f.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(f=>({advanceWidth:f.advanceWidth,leftSideBearing:f.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(f=>({advanceHeight:f.advanceHeight,topSideBearing:f.topSideBearing}))));const u=new p.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,s.post=u,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function io(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Ut)e=s.sfnt.clone(),r="woff";else{const i=Gt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Ut.is(i))e=new Ut(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const oo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function gr(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:h=[],strokeDashoffset:l=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=oo[o],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=f,s.shadowColor=g}class M{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new M(1/0,1/0)}static get MIN(){return new M(-1/0,-1/0)}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 M(this.x,this.y)}}class Q{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}static from(...t){if(t.length===0)return new Q;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 Q(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new M((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new Q(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var ao=Object.defineProperty,lo=(s,t,e)=>t in s?ao(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ho=(s,t,e)=>(lo(s,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){ho(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=h,c[6]=r,c[7]=o,c[8]=l,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],h=r[6],l=r[1],c=r[4],u=r[7],f=r[2],g=r[5],y=r[8],w=n[0],d=n[3],C=n[6],P=n[1],x=n[4],T=n[7],v=n[2],b=n[5],I=n[8];return i[0]=o*w+a*P+h*v,i[3]=o*d+a*x+h*b,i[6]=o*C+a*T+h*I,i[1]=l*w+c*P+u*v,i[4]=l*d+c*x+u*b,i[7]=l*C+c*T+u*I,i[2]=f*w+g*P+y*v,i[5]=f*d+g*x+y*b,i[8]=f*C+g*T+y*I,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*o-a*l,f=a*h-c*i,g=l*i-o*h,y=e*u+r*f+n*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return t[0]=u*w,t[1]=(n*l-c*r)*w,t[2]=(a*r-n*o)*w,t[3]=f*w,t[4]=(c*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=g*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,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(yr.makeScale(t,e)),this}rotate(t){return this.premultiply(yr.makeRotation(-t)),this}translate(t,e){return this.premultiply(yr.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 yr=new yt;function Mn(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 xn(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 h=(o.x-a.x)/2,l=(o.y-a.y)/2,c=Math.cos(r)*h+Math.sin(r)*l,u=-Math.sin(r)*h+Math.cos(r)*l;let f=t*t,g=e*e;const y=c*c,w=u*u,d=y/f+w/g;if(d>1){const j=Math.sqrt(d);t=j*t,e=j*e,f=t*t,g=e*e}const C=f*w+g*y,P=(f*g-C)/C;let x=Math.sqrt(Math.max(0,P));n===i&&(x=-x);const T=x*t*u/e,v=-x*e*c/t,b=Math.cos(r)*T-Math.sin(r)*v+(o.x+a.x)/2,I=Math.sin(r)*T+Math.cos(r)*v+(o.y+a.y)/2,S=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);s.ellipse(b,I,t,e,r,S,S+_,i===1)}function Jt(s,t){return s-(t-s)}function mr(s,t){const e=new M,r=new M;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(Jt(e.x,r.x),Jt(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(Jt(e.x,r.x),Jt(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=Jt(e.x,r.x),h=Jt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,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),xn(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 Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(s,t,e=0){let a=0,h=!0,l="",c="";const u=[];function f(d,C,P){const x=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw x.partial=P,x}function g(){l!==""&&(c===""?u.push(Number(l)):u.push(Number(l)*10**Number(c))),l="",c=""}let y;const w=s.length;for(let d=0;d<w;d++){if(y=s[d],Array.isArray(t)&&t.includes(u.length%e)&&Z.FLAGS.test(y)){a=1,l=y,g();continue}if(a===0){if(Z.WHITESPACE.test(y))continue;if(Z.DIGIT.test(y)||Z.SIGN.test(y)){a=1,l=y;continue}if(Z.POINT.test(y)){a=2,l=y;continue}Z.COMMA.test(y)&&(h&&f(y,d,u),h=!0)}if(a===1){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.POINT.test(y)){l+=y,a=2;continue}if(Z.EXP.test(y)){a=3;continue}Z.SIGN.test(y)&&l.length===1&&Z.SIGN.test(l[0])&&f(y,d,u)}if(a===2){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.EXP.test(y)){a=3;continue}Z.POINT.test(y)&&l[l.length-1]==="."&&f(y,d,u)}if(a===3){if(Z.DIGIT.test(y)){c+=y;continue}if(Z.SIGN.test(y)){if(c===""){c+=y;continue}c.length===1&&Z.SIGN.test(c)&&f(y,d,u)}}Z.WHITESPACE.test(y)?(g(),a=0,h=!1):Z.COMMA.test(y)?(g(),a=0,h=!0):Z.SIGN.test(y)?(g(),a=1,l=y):Z.POINT.test(y)?(g(),a=2,l=y):f(y,d,u)}return g(),u}function co(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function Cn(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${co(s[e])} `;return t}const uo=/[a-df-z][^a-df-z]*/gi;function wr(s){const t=[],e=s.match(uo);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 h;switch(o){case"m":case"M":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,c=h.length;l<c;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,c=h.length;l<c;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var fo=Object.defineProperty,po=(s,t,e)=>t in s?fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(po(s,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){vr(this,"arcLengthDivisions",200),vr(this,"_cacheArcLengths"),vr(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 M){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,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const c=r[n],f=r[n+1]-c,g=(o-c)/f;return(n+g)/(i-1)}getTangent(t,e=new M){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 M){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=M.MAX,e=M.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(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 Cn(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)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new M){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new M){const{start:r,end:n}=this,i=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(i),Math.sin(i))}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function go(s,t){const e=1-s;return e*e*t}function yo(s,t){return 2*(1-s)*s*t}function mo(s,t){return s*s*t}function Pn(s,t,e,r){return go(s,t)+yo(s,e)+mo(s,r)}function wo(s,t){const e=1-s;return e*e*e*t}function vo(s,t){const e=1-s;return 3*e*e*s*t}function bo(s,t){return 3*(1-s)*s*s*t}function Mo(s,t){return s*s*s*t}function _n(s,t,e,r,n){return wo(s,t)+vo(s,e)+bo(s,r)+Mo(s,n)}class Tn extends _t{constructor(t=new M,e=new M,r=new M,n=new M){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new M){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(_n(t,r.x,n.x,i.x,o.x),_n(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(h=>h>=0&&h<=1)}getMinMax(t=M.MAX,e=M.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)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((u,f)=>{for(const g of u)for(let y=0;y<=f;y++){const w=y/f-.5,d=Math.min(1,Math.max(0,g+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,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 xo=new yt,On=new yt,In=new yt,Fe=new M;class An extends _t{constructor(t=new M,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 M){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),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,f=h-this.center.y;a=u*l-f*c+this.center.x,h=u*c+f*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,c=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),f=Math.abs(n-i),g=f>Math.PI?1:0,y=o?1:0,w=a*180/Math.PI;if(f>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),P=l+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:w,largeArcFlag:0,sweepFlag:y,x:C,y:P},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:c,y:u}]}else{const d=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),C=l+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:w,largeArcFlag:g,sweepFlag:y,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,Po(t)?Co(this,t):So(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*l*l+i*i*c*c),f=Math.sqrt(n*n*c*c+i*i*l*l);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,h-f),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,h+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 Co(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new M(e*n,e*i),a=new M(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),c=xo.set(h.x,l.x,0,h.y,l.y,0,0,0,1),u=On.copy(c).invert(),y=In.copy(u).transpose().multiply(u).elements,w=_o(y[0],y[1],y[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(s.radiusX=1/d,s.radiusY=1/C,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(d,0,0,0,C,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(c),b=I=>{const{x:S,y:_}=new M(Math.cos(I),Math.sin(I)).applyMatrix3(v);return Math.atan2(_,S)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),Dn(t)&&(s.clockwise=!s.clockwise)}}function So(s,t){const e=Nn(t),r=zn(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,Dn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Dn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Po(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(s),n=zn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function _o(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,c=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+c),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-c):(r=.5*c,n=-.5*c),l>0?i=l+c:i=l-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),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Ht extends _t{constructor(t=new M,e=new M){super(),this.start=t,this.end=e}getPoint(t,e=new M){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new M){return this.getPoint(t,e)}getTangent(t,e=new M){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new M){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=M.MAX,e=M.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}}var To=Object.defineProperty,Oo=(s,t,e)=>t in s?To(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Io=(s,t,e)=>(Oo(s,t+"",e),e);class Ao extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Io(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new M(t+.5*this.size,e-.5*this.size),n=new M(t-.5*this.size,e-.5*this.size),i=new M(t,e+.5*this.size),o=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new je(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new M(t,e+this.size),c=new M(t+this.size,e),u=new M().lerpVectors(c,l,.75),f=new M(t-this.size,e),g=new M().lerpVectors(f,l,.75),y=new Ht(c,u),w=new Ht(g,f);return this.curves=[o,y,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}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=M.MAX,e=M.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}}var Do=Object.defineProperty,No=(s,t,e)=>t in s?Do(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,br=(s,t,e)=>(No(s,typeof t!="symbol"?t+"":t,e),e);class zo extends _t{constructor(t,e=0,r=0,n=0,i=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=i,br(this,"curves",[]),br(this,"curveT",0),br(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new M(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}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=M.MAX,e=M.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 En extends _t{constructor(t=new M,e=new M,r=new M){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new M){const{start:r,control:n,end:i}=this;return e.set(Pn(t,r.x,n.x,i.x),Pn(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=M.MAX,e=M.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{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 Eo=Object.defineProperty,Uo=(s,t,e)=>t in s?Eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Un=(s,t,e)=>(Uo(s,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{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,Un(this,"curves",[]),Un(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 M(t-r,e-n),new M(t+r,e-n),new M(t+r,e+n),new M(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new Ht(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=M.MAX,e=M.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 $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new M){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Sn(o,a.x,h.x,l.x,c.x),Sn(o,a.y,h.y,l.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 Lo=Object.defineProperty,$o=(s,t,e)=>t in s?Lo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ve=(s,t,e)=>($o(s,typeof t!="symbol"?t+"":t,e),e);class te extends _t{constructor(t){super(),ve(this,"curves",[]),ve(this,"startPoint"),ve(this,"currentPoint",new M),ve(this,"autoClose",!1),ve(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 mr(t,this),this}addData(t){return this.addCommands(wr(t)),this}getPoint(t,e=new M){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],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,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 h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const c=h[l];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 Ht(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 Ht(this.currentPoint.clone(),new M(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 Tn(this.currentPoint.clone(),new M(t,e),new M(r,n),new M(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 En(this.currentPoint.clone(),new M(t,e),new M(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,h=!0){const l=new An(new M(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new Ln(new M(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new $n([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(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 ko(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(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 M((s.x+e.x)/2,(s.y+e.y)/2);const h=o.cross(i)/a;return Math.abs(h)>1?new M((s.x+e.x)/2,(s.y+e.y)/2):new M(s.x+h*n.x,s.y+h*n.y)}var jo=Object.defineProperty,Fo=(s,t,e)=>t in s?jo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Mr=(s,t,e)=>(Fo(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){Mr(this,"currentPath",new te),Mr(this,"paths",[this.currentPath]),Mr(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}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 bt?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 te().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 te().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,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return mr(t,this),this}addData(t){return this.addCommands(wr(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,h)=>{const l=a.getControlPoints(),c=a.isClockwise();i[h]=l,n[h]=c;const u=l[0],f=l[l.length-1]??u;r.push({start:c?f:u,end:c?u:f,index:h})});const o=[];return r.forEach((a,h)=>{o[h]=[],r.forEach((l,c)=>{c!==h&&l.start.equals(a.end)&&o[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];i[h].forEach(u=>{const f=a.getTForPoint(u),g=a.getNormal(f).scale(l?t:-t);u.add(g)})}),o.forEach((a,h)=>{const l=i[h];a.forEach(c=>{const u=i[c],f=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],u[0],u[1]??u[0]);f&&(l[l.length-1].copy(f),u[0].copy(f))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=M.MAX,e=M.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(),h=[];for(let l=0;l<=1;l+=1/i.arcLengthDivisions){const c=i.getPoint(l),u=i.getNormal(l),f=u.clone().scale(a?o:-o),g=u.clone().scale(a?-o:o);h.push(c.clone().add(f),c.clone().add(g),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(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new Q(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(),gr(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(),gr(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[ko(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(),h=document.createElement("canvas");h.width=o*e,h.height=a*e,h.style.width=`${o}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-i),this.drawTo(l,r)),h}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 xr="px",kn=90,Bn=["mm","cm","in","pt","pc","px"],Cr={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 E(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Bn.length;r<n;r++){const i=Bn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&xr!=="px"?e=Cr.in[xr]/kn:(e=Cr[t][xr],e<0&&(e=Cr[t].in*kn)),e*Number.parseFloat(s)}const Go=new yt,Ge=new yt,jn=new yt,Fn=new yt;function Vo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ro(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ro(s){const t=new yt,e=Go;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(E(s.getAttribute("x")),E(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 h=i.slice(0,o),l=Pt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const c=l[0];let u=0;l.length>=2&&(u=l[1]),e.translate(c,u)}break;case"rotate":if(l.length>=1){let c=0,u=0,f=0;c=l[0]*Math.PI/180,l.length>=3&&(u=l[1],f=l[2]),Ge.makeTranslation(-u,-f),jn.makeRotation(c),Fn.multiplyMatrices(jn,Ge),Ge.makeTranslation(u,f),e.multiplyMatrices(Ge,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Wo(s){return new bt().addPath(new te().arc(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("r")||0),0,Math.PI*2))}function qo(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(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Ho(s){return new bt().addPath(new te().ellipse(E(s.getAttribute("cx")||0),E(s.getAttribute("cy")||0),E(s.getAttribute("rx")||0),E(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(s){return new bt().moveTo(E(s.getAttribute("x1")||0),E(s.getAttribute("y1")||0)).lineTo(E(s.getAttribute("x2")||0),E(s.getAttribute("y2")||0))}function Xo(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Yo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Zo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Yo,(n,i,o)=>{const a=E(i),h=E(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ko=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ko,(n,i,o)=>{const a=E(i),h=E(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ta(s){const t=E(s.getAttribute("x")||0),e=E(s.getAttribute("y")||0),r=E(s.getAttribute("rx")||s.getAttribute("ry")||0),n=E(s.getAttribute("ry")||s.getAttribute("rx")||0),i=E(s.getAttribute("width")),o=E(s.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,c){c===void 0&&(c=function(f){return f.startsWith("url")&&console.warn("url access in attributes is not implemented."),f}),s.hasAttribute(h)&&(t[l]=c(s.getAttribute(h))),r[h]&&(t[l]=c(r[h])),s.style&&s.style[h]!==""&&(t[l]=c(s.style[h]))}function i(h){return Math.max(0,Math.min(1,E(h)))}function o(h){return Math.max(0,E(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>E(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",E),n("visibility","visibility"),t}function Sr(s,t,e=[]){var c;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=At(s,t,i);break;case"style":qo(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=Xo(s));break;case"rect":t=At(s,t,i),n=ta(s);break;case"polygon":t=At(s,t,i),n=Zo(s);break;case"polyline":t=At(s,t,i),n=Jo(s);break;case"circle":t=At(s,t,i),n=Wo(s);break;case"ellipse":t=At(s,t,i),n=Ho(s);break;case"line":t=At(s,t,i),n=Qo(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const f=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(c=s.viewportElement)==null?void 0:c.getElementById(f);g?Sr(g,t,e):console.warn(`'use node' references non-existent node id: ${f}`);break}default:console.warn(s);break}const o=new yt,a=[],h=Vo(s,o,a);n&&(n.matrix(o),e.push(n),n.style=t);const l=s.childNodes;for(let u=0,f=l.length;u<f;u++){const g=l[u];r&&g.nodeName!=="style"&&g.nodeName!=="defs"||Sr(g,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Gn="data:image/svg+xml;",Vn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function Pr(s){if(typeof s=="string"){let t;return s.startsWith(Vn)?(s=s.substring(Vn.length,s.length),t=atob(s)):s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Ve(s){return Sr(Pr(s),{})}function be(s,t=!0){if(!s.length)return;const e=M.MAX,r=M.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new Q(e.x,e.y,r.x-e.x,r.y-e.y)}const ea=new Set(["©","®","÷"]),ra=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),na={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Wn{constructor(t,e,r){z(this,"boundingBox",new Q);z(this,"textWidth",0);z(this,"textHeight",0);z(this,"glyphHeight",0);z(this,"glyphWidth",0);z(this,"underlinePosition",0);z(this,"underlineThickness",0);z(this,"yStrikeoutPosition",0);z(this,"yStrikeoutSize",0);z(this,"baseline",0);z(this,"centerDiviation",0);z(this,"path",new bt);z(this,"glyphBox",new Q);z(this,"center",new M);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:c}=l,{fontSize:u}=h,f=e/u,g=t.getAdvanceWidth(a,u),y=(r+Math.abs(n))/f,w=r/f,d=(r-i.yStrikeoutPosition)/f,C=i.yStrikeoutSize/f,P=(r-o.underlinePosition)/f,x=o.underlineThickness/f;return this.glyphWidth=g,this.glyphHeight=y,this.underlinePosition=P,this.underlineThickness=x,this.yStrikeoutPosition=d,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*c-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:c}=this.updateGlyph(t),{os2:u,ascender:f,descender:g}=t,y=f,w=g,d=u.sTypoAscender,{left:C,top:P}=o,{fontSize:x,fontStyle:T}=a;let v=C,b=P+h,I;const S=new bt;if(e&&(v+=(l-c)/2,Math.abs(n-i)>.1&&(b-=(y-d)/(y+Math.abs(w))*l),I=void 0),e&&!ea.has(r)&&(r.codePointAt(0)<=256||ra.has(r))){S.addCommands(t.getPathCommands(r,v,P+h-(l-c)/2,x)??[]);const _={y:P-(l-c)/2+l/2,x:v+c/2};T==="italic"&&this._italic(S,e?{x:_.x,y:P-(l-c)/2+h}:void 0),S.rotate(90,_)}else I!==void 0?(S.addCommands(t.glyphs.get(I).getPathCommands(v,b,x)),T==="italic"&&this._italic(S,e?{x:v+c/2,y:P+d/(y+Math.abs(w))*l}:void 0)):(S.addCommands(t.getPathCommands(r,v,b,x)??[]),T==="italic"&&this._italic(S,e?{x:v+l/2,y:b}:void 0));return S.addCommands(this._decoration()),S.bold(na[a.fontWeight??400]*x*.05),S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=S,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,c=.1*i;let u;switch(n){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+h/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+l},{type:"L",x:u+c,y:a+l},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+h,y:u},{type:"L",x:o+h,y:u+c},{type:"L",x:o,y:u+c},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.boundingBox.top+this.baseline,x:this.boundingBox.left+this.glyphWidth/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r);{t??(t=M.MAX),e??(e=M.MIN);const{left:i,top:o}=this.boundingBox,a=i+this.glyphWidth,h=o+this.glyphHeight;return t.x=Math.min(t.x,i),t.y=Math.min(t.y,o),e.x=Math.max(e.x,a),e.y=Math.max(e.y,h),{min:t,max:e}}}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new Q(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function Me(s){return!s||s==="none"}function Re(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class qn{constructor(t,e={},r){z(this,"boundingBox",new Q);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,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Wn(r,e++,this));return this.characters=t,this}}class ee{constructor(t,e){z(this,"boundingBox",new Q);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new qn(t,e,this);return this.fragments.push(r),r}}class Hn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_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("span").forEach((h,l)=>{var f;const c=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:c.left,top:c.top,width:c.width,height:c.height});const u=h.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const y=u.data?u.data.length:0;let w=0;for(;w<=y;){g.setStart(u,Math.max(w-1,0)),g.setEnd(u,w);const d=((f=g.getClientRects)==null?void 0:f.call(g))??[g.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const P=g.toString();P!==""&&C&&C.width+C.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((g,y)=>{const w=i?"left":"top";return Math.abs(y[w]-g[w])>4e3/2&&(h=[],a.push(h)),h.push(y),y})),n.style.lineHeight=o;const c=this._measureDom(t);c.paragraphs.forEach(g=>{const y=e[g.paragraphIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height}),c.fragments.forEach(g=>{const y=e[g.paragraphIndex].fragments[g.fragmentIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height});const u=[];let f=0;return a.forEach(g=>{g.forEach(y=>{const w=c.characters[f],{paragraphIndex:d,fragmentIndex:C,characterIndex:P}=w;u.push({...w,newParagraphIndex:d,textWidth:y.width,textHeight:y.height,left:w.left-r.left,top:w.top-r.top});const x=e[d].fragments[C].characters[P];x.boundingBox.left=u[f].left,x.boundingBox.top=u[f].top,x.boundingBox.width=u[f].width,x.boundingBox.height=u[f].height,x.textWidth=u[f].textWidth,x.textHeight=u[f].textHeight,f++})}),{paragraphs:e,boundingBox:new Q(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Qn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ee({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new ee({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new ee({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,...h}=o;a!==void 0&&i.addFragment(a,h)}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new ee(o,e);i.forEach(h=>{const{content:l,...c}=h;l!==void 0&&a.addFragment(l,c)}),r.push(a)}else if("content"in n){const{content:i,...o}=n;if(i!==void 0){const a=new ee(o,e);a.addFragment(i),r.push(a)}}}return r}}function sa(s){return s}const jt=new M,re=new yt,Ft=new yt;function Xn(){return{name:"effect",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(i=>{r==null||r.forEach(o=>{const a=i.glyphBox.clone(),h=_r(s,o);jt.set(a.left,a.top),jt.applyMatrix3(h),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(h),a.width=jt.x-a.left,a.height=jt.y-a.top;const l=(o.shadowOffsetX??0)*e,c=(o.shadowOffsetY??0)*e,u=Math.max(.1,o.textStrokeWidth??0)*e;a.left+=l-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?Q.from(...n):void 0},render:(s,t)=>{const{characters:e,renderBoundingBox:r,effects:n}=t;n?n.forEach(i=>{Tt(i,r,s),s.save();const[o,a,h,l,c,u]=_r(t,i).transpose().elements;s.transform(o,l,a,c,h,u),e.forEach(f=>{f.drawTo(s,i)}),s.restore()}):e.forEach(i=>{i.drawTo(s)})}}}function _r(s,t){const{fontSize:e,renderBoundingBox:r}=s,n=(t.offsetX??0)*e,i=(t.offsetY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,h=(t.skewY??0)/360*o,{left:l,top:c,width:u,height:f}=r,g=l+u/2,y=c+f/2;return re.identity(),Ft.makeTranslation(n,i),re.multiply(Ft),Ft.makeTranslation(g,y),re.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),re.multiply(Ft),Ft.makeTranslation(-g,-y),re.multiply(Ft),re.clone()}const ia={referImage:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4="};function oa(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function aa(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Yn(s={}){const t={...ia,...s},e=Ve(t.referImage),r=[],n=[];return{name:"highlight",paths:r,update:i=>{r.length=0;const{characters:o}=i;let a;const h=[];let l;o.forEach(c=>{const{isVertical:u,computedStyle:f}=c;Me(f.highlightImage)||(f.highlightSize!=="1rem"&&(l==null?void 0:l.highlightImage)===f.highlightImage&&(l==null?void 0:l.highlightSize)===f.highlightSize&&(l==null?void 0:l.highlightStrokeWidth)===f.highlightStrokeWidth&&(l==null?void 0:l.highlightOverflow)===f.highlightOverflow&&a.length&&(u?a[0].boundingBox.left===c.boundingBox.left:a[0].boundingBox.top===c.boundingBox.top)&&a[0].fontSize===c.fontSize?a.push(c):(a=[],a.push(c),h.push(a))),l=f}),h.filter(c=>c.length).map(c=>({style:c[0].computedStyle,box:Q.from(...c.map(u=>u.glyphBox))})).forEach(c=>{const{style:u,box:f}=c,{fontSize:g}=u,y=aa(u.highlightStrokeWidth,g,f.width),w=oa(u.highlightSize,g,f.width),d=Me(u.highlightOverflow)?w?"hidden":"visible":u.highlightOverflow,C=Pr(u.highlightImage),P=Ve(C),x=be(P,!1),T=be(e,!1),b=(w?g*w:f.width)/T.width,I=f.height/T.height,S=g/x.width*2,_=x.width*b,j=Math.ceil(f.width/_),R=new yt().translate(-x.left,-x.top).scale(b,I).translate(f.left,f.top).translate((x.left-T.left)*b,(x.top-T.top)*I);for(let L=0;L<j;L++){const mt=R.clone().translate(L*_,0);P.forEach(D=>{const A=D.clone().matrix(mt);A.style.strokeWidth&&(A.style.strokeWidth*=S*y),A.style.strokeMiterlimit&&(A.style.strokeMiterlimit*=S),A.style.strokeDashoffset&&(A.style.strokeDashoffset*=S),A.style.strokeDasharray&&(A.style.strokeDasharray=A.style.strokeDasharray.map($=>$*S)),r.push(A),n[r.length-1]=d==="hidden"?new Q(f.left,f.top-f.height,f.width,f.height*3):void 0})}})},renderOrder:-1,render:(i,o)=>{r.forEach((a,h)=>{Ce({ctx:i,path:a,clipRect:n[h],fontSize:o.computedStyle.fontSize})})}}}function Zn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function Kn(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,computedStyle:r,fontSize:n,isVertical:i}=t;let o=r.listStyleSize,a;if(!Me(r.listStyleImage))a=r.listStyleImage;else if(!Me(r.listStyleType)){const u=n*.38/2;switch(o=o==="cover"?u*2:o,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${u}" cy="${u}" r="${u}" fill="${r.color}" />
|
|
6
6
|
</svg>`;break}}if(!a)return;const h=n*.45,l=Ve(a),c=be(l);e.forEach(u=>{var g,y;const f=(y=(g=u.fragments[0])==null?void 0:g.characters[0])==null?void 0:y.getGlyphBoundingBox();if(f){const w=new yt;if(i){const d=Zn(o,r.fontSize,f.width),C=f.width/c.height*d;w.translate(-c.left,-c.top),w.rotate(Math.PI/2),w.scale(C,C),w.translate(f.width/2-c.height*C/2,0),w.translate(f.left,f.top-h)}else{const d=Zn(o,r.fontSize,f.height),C=f.height/c.height*d;w.translate(-c.left,-c.top),w.translate(-c.width,0),w.scale(C,C),w.translate(0,f.height/2-c.height*C/2),w.translate(f.left-h,f.top)}s.push(...l.map(d=>d.clone().matrix(w)))}})}}}const Tr={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textTransform:"none",textOrientation:"mixed",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none"};class la{constructor(t={}){z(this,"content");z(this,"style");z(this,"effects");z(this,"measureDom");z(this,"needsUpdate",!0);z(this,"computedStyle",{...Tr});z(this,"paragraphs",[]);z(this,"boundingBox",new Q);z(this,"renderBoundingBox",new Q);z(this,"parser",new Qn(this));z(this,"measurer",new Hn(this));z(this,"plugins",new Map);const{content:e="",style:r={},measureDom:n,effects:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=i,this.use(Xn()).use(Yn(t.highlight)).use(Kn())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}measure(t=this.measureDom){this.computedStyle={...Tr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(a=>a.update());const n=[...this.plugins.values()];n.sort((a,h)=>(a.updateOrder??0)-(h.updateOrder??0)).forEach(a=>{var h;(h=a.update)==null||h.call(a,this)});const i=M.MAX,o=M.MIN;return r.forEach(a=>a.getGlyphMinMax(i,o)),this.renderBoundingBox=new Q(i.x,i.y,o.x-i.x,o.y-i.y),this.renderBoundingBox=Q.from(this.renderBoundingBox,...n.map(a=>a.getBoundingBox?a.getBoundingBox(this):be(a.paths??[])).filter(Boolean)),this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Dr(n,r,this.renderBoundingBox),Nr(n,this),[...this.plugins.values()].sort((o,a)=>(o.renderOrder??0)-(a.renderOrder??0)).forEach(o=>{var a;o.render?(a=o.render)==null||a.call(o,n,this):o.paths&&o.paths.forEach(h=>{Ce({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}p.BoundingBox=Q,p.Character=Wn,p.CircleCurve=je,p.CmapSubtableFormat0=or,p.CmapSubtableFormat12=cr,p.CmapSubtableFormat14=ge,p.CmapSubtableFormat2=fe,p.CmapSubtableFormat4=hr,p.CmapSubtableFormat6=Rt,p.CubicBezierCurve=Tn,p.Curve=_t,p.CurvePath=te,p.EllipseCurve=An,p.Eot=zs,p.Font=Oe,p.Fonts=mn,p.Fragment=qn,p.Glyph=er,p.GlyphSet=rr,p.HeartCurve=Ao,p.LineCurve=Ht,p.Matrix3=yt,p.Measurer=Hn,p.Paragraph=ee,p.Parser=Qn,p.Path2D=bt,p.PloygonCurve=zo,p.QuadraticBezierCurve=En,p.RectangularCurve=Ln,p.Sfnt=he,p.SplineCurve=$n,p.TableDirectory=Yt,p.Text=la,p.Ttf=st,p.Vector2=M,p.Woff=Ut,p.WoffTableDirectoryEntry=qt,p.addPathCommandsToPath2D=mr,p.componentFlags=Kt,p.createCmapSegments=lr,p.defaultTextStyles=Tr,p.definePlugin=sa,p.defineSfntTable=nt,p.drawPath=Ce,p.effect=Xn,p.fillBackground=is,p.filterEmpty=Re,p.fonts=wn,p.getPathsBoundingBox=be,p.getTransform2D=_r,p.highlight=Yn,p.isNone=Me,p.listStyle=Kn,p.minify=io,p.minifyGlyphs=vn,p.minifySfnt=bn,p.parse=gn,p.parseArcCommand=xn,p.parseColor=it,p.parsePathDataArgs=Pt,p.parseSvg=Ve,p.parseSvgToDom=Pr,p.pathCommandsToPathData=Cn,p.pathDataToPathCommands=wr,p.setCanvasContext=gr,p.setupView=Dr,p.uploadColor=Tt,p.uploadColors=Nr,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -898,7 +898,7 @@ function highlight(options = {}) {
|
|
|
898
898
|
const scaleX = scaleWidth / refBox.width;
|
|
899
899
|
const scaleY = groupBox.height / refBox.height;
|
|
900
900
|
const styleScale = fontSize / box.width * 2;
|
|
901
|
-
const unitWidth =
|
|
901
|
+
const unitWidth = box.width * scaleX;
|
|
902
902
|
const total = Math.ceil(groupBox.width / unitWidth);
|
|
903
903
|
const transform = new Matrix3().translate(-box.left, -box.top).scale(scaleX, scaleY).translate(groupBox.left, groupBox.top).translate(
|
|
904
904
|
(box.left - refBox.left) * scaleX,
|