modern-text 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -168,8 +168,22 @@ class Character {
168
168
  baseline = 0;
169
169
  centerDiviation = 0;
170
170
  fontStyle;
171
+ get compatibleGlyphBox() {
172
+ const size = this.computedStyle.fontSize * 0.8;
173
+ return this.glyphBox ?? (this.isVertical ? new modernPath2d.BoundingBox(
174
+ this.lineBox.left + this.lineBox.width / 2 - size / 2,
175
+ this.lineBox.top,
176
+ size,
177
+ this.lineBox.height
178
+ ) : new modernPath2d.BoundingBox(
179
+ this.lineBox.left,
180
+ this.lineBox.top + this.lineBox.height / 2 - size / 2,
181
+ this.lineBox.width,
182
+ size
183
+ ));
184
+ }
171
185
  get center() {
172
- return this.glyphBox?.center;
186
+ return this.compatibleGlyphBox.center;
173
187
  }
174
188
  get computedStyle() {
175
189
  return this.parent.computedStyle;
@@ -1063,14 +1077,15 @@ function highlight() {
1063
1077
  for (let i = 0; i < groups.length; i++) {
1064
1078
  const characters = groups[i];
1065
1079
  const char = characters[0];
1066
- const groupBox = modernPath2d.BoundingBox.from(
1067
- ...characters.filter((c) => c.glyphBox).map((c) => c.glyphBox)
1068
- );
1080
+ const groupBox = modernPath2d.BoundingBox.from(...characters.map((c) => c.compatibleGlyphBox));
1081
+ if (!groupBox.height || !groupBox.width) {
1082
+ continue;
1083
+ }
1069
1084
  const {
1070
1085
  computedStyle: style,
1071
1086
  isVertical,
1072
1087
  inlineBox,
1073
- glyphBox = inlineBox,
1088
+ compatibleGlyphBox: glyphBox,
1074
1089
  strikeoutPosition,
1075
1090
  underlinePosition
1076
1091
  } = char;
@@ -1727,9 +1742,10 @@ class Text extends EventEmitter {
1727
1742
  const max = modernPath2d.Vector2.MIN;
1728
1743
  this.characters.forEach((c) => {
1729
1744
  if (!c.getGlyphMinMax(min, max)) {
1730
- const { inlineBox } = c;
1731
- const a = new modernPath2d.Vector2(inlineBox.left, inlineBox.top);
1732
- const b = new modernPath2d.Vector2(inlineBox.left + inlineBox.width, inlineBox.top + inlineBox.height);
1745
+ const { inlineBox: glyphBox } = c;
1746
+ const { left, top, width, height } = glyphBox;
1747
+ const a = new modernPath2d.Vector2(left, top);
1748
+ const b = new modernPath2d.Vector2(left + width, top + height);
1733
1749
  min.min(a, b);
1734
1750
  max.max(a, b);
1735
1751
  }
package/dist/index.d.cts CHANGED
@@ -64,7 +64,8 @@ declare class Character {
64
64
  baseline: number;
65
65
  centerDiviation: number;
66
66
  fontStyle?: 'bold' | 'italic';
67
- get center(): Vector2 | undefined;
67
+ get compatibleGlyphBox(): BoundingBox;
68
+ get center(): Vector2;
68
69
  get computedStyle(): StyleDeclaration;
69
70
  get isVertical(): boolean;
70
71
  get fontSize(): number;
package/dist/index.d.mts CHANGED
@@ -64,7 +64,8 @@ declare class Character {
64
64
  baseline: number;
65
65
  centerDiviation: number;
66
66
  fontStyle?: 'bold' | 'italic';
67
- get center(): Vector2 | undefined;
67
+ get compatibleGlyphBox(): BoundingBox;
68
+ get center(): Vector2;
68
69
  get computedStyle(): StyleDeclaration;
69
70
  get isVertical(): boolean;
70
71
  get fontSize(): number;
package/dist/index.d.ts CHANGED
@@ -64,7 +64,8 @@ declare class Character {
64
64
  baseline: number;
65
65
  centerDiviation: number;
66
66
  fontStyle?: 'bold' | 'italic';
67
- get center(): Vector2 | undefined;
67
+ get compatibleGlyphBox(): BoundingBox;
68
+ get center(): Vector2;
68
69
  get computedStyle(): StyleDeclaration;
69
70
  get isVertical(): boolean;
70
71
  get fontSize(): number;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(G,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(G=typeof globalThis<"u"?globalThis:G||self,ct(G.modernText={}))})(this,function(G){"use strict";var wa=Object.defineProperty;var va=(G,ct,jt)=>ct in G?wa(G,ct,{enumerable:!0,configurable:!0,writable:!0,value:jt}):G[ct]=jt;var M=(G,ct,jt)=>va(G,typeof ct!="symbol"?ct+"":ct,jt);var ee;function ct(o,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:i,stops:a}=yi(e,t.left,t.top,t.width,t.height),l=o.createLinearGradient(n,r,s,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function jt(o,e,t){o!=null&&o.color&&(o.color=ct(t,o.color,e)),o!=null&&o.backgroundColor&&(o.backgroundColor=ct(t,o.backgroundColor,e)),o!=null&&o.textStrokeColor&&(o.textStrokeColor=ct(t,o.textStrokeColor,e))}function yi(o,e,t,n,r){var d;const s=((d=o.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",i=s.split(",")[0],a=i.includes("deg")?i:"0deg",l=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(p=>{let m=p[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(p[3].replace("%",""))/100,color:m}})}}function ne(o){const{ctx:e,path:t,fontSize:n,clipRect:r}=o;e.save(),e.beginPath();const s=t.style,i={...s,fill:o.color??s.fill,stroke:o.textStrokeColor??s.stroke,strokeWidth:o.textStrokeWidth?o.textStrokeWidth*n:s.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(o.shadowOffsetX??0)*n,shadowOffsetY:(o.shadowOffsetY??0)*n,shadowBlur:(o.shadowBlur??0)*n,shadowColor:o.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,i),e.restore()}function Kn(o,e,t){const{left:n,top:r,width:s,height:i}=t,a=o.canvas;a.dataset.viewBox=`${n} ${r} ${s} ${i}`,a.dataset.pixelRatio=String(e);const l=s,h=i;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,o.clearRect(0,0,a.width,a.height),o.scale(e,e),o.translate(-n,-r)}function Qn(o,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;jt(n,r,o),t.forEach(s=>{jt(s.computedStyle,s.lineBox,o),s.fragments.forEach(i=>{jt(i.computedStyle,i.inlineBox,o)})})}var ft=Uint8Array,It=Uint16Array,pn=Int32Array,Ne=new ft([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]),je=new ft([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]),dn=new ft([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jn=function(o,e){for(var t=new It(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var r=new pn(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)r[s]=s-t[n]<<5|n;return{b:t,r}},tr=Jn(Ne,2),er=tr.b,yn=tr.r;er[28]=258,yn[258]=28;for(var nr=Jn(je,0),gi=nr.b,rr=nr.r,gn=new It(32768),Q=0;Q<32768;++Q){var Zt=(Q&43690)>>1|(Q&21845)<<1;Zt=(Zt&52428)>>2|(Zt&13107)<<2,Zt=(Zt&61680)>>4|(Zt&3855)<<4,gn[Q]=((Zt&65280)>>8|(Zt&255)<<8)>>1}for(var Gt=function(o,e,t){for(var n=o.length,r=0,s=new It(e);r<n;++r)o[r]&&++s[o[r]-1];var i=new It(e);for(r=1;r<e;++r)i[r]=i[r-1]+s[r-1]<<1;var a;if(t){a=new It(1<<e);var l=15-e;for(r=0;r<n;++r)if(o[r])for(var h=r<<4|o[r],c=e-o[r],f=i[o[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[gn[f]>>l]=h}else for(a=new It(n),r=0;r<n;++r)o[r]&&(a[r]=gn[i[o[r]-1]++]>>15-o[r]);return a},Yt=new ft(288),Q=0;Q<144;++Q)Yt[Q]=8;for(var Q=144;Q<256;++Q)Yt[Q]=9;for(var Q=256;Q<280;++Q)Yt[Q]=7;for(var Q=280;Q<288;++Q)Yt[Q]=8;for(var Se=new ft(32),Q=0;Q<32;++Q)Se[Q]=5;var mi=Gt(Yt,9,0),xi=Gt(Yt,9,1),wi=Gt(Se,5,0),vi=Gt(Se,5,1),mn=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Dt=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},xn=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},wn=function(o){return(o+7)/8|0},ir=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new ft(o.subarray(e,t))},bi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Lt=function(o,e,t){var n=new Error(e||bi[o]);if(n.code=o,Error.captureStackTrace&&Error.captureStackTrace(n,Lt),!t)throw n;return n},Si=function(o,e,t,n){var r=o.length,s=0;if(!r||e.f&&!e.l)return t||new ft(0);var i=!t,a=i||e.i!=2,l=e.i;i&&(t=new ft(r*3));var h=function(Ct){var At=t.length;if(Ct>At){var ht=new ft(Math.max(At*2,Ct));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,d=e.l,p=e.d,m=e.m,y=e.n,P=r*8;do{if(!d){c=Dt(o,f,1);var T=Dt(o,f+1,3);if(f+=3,T)if(T==1)d=xi,p=vi,m=9,y=5;else if(T==2){var v=Dt(o,f,31)+257,S=Dt(o,f+10,15)+4,w=v+Dt(o,f+5,31)+1;f+=14;for(var k=new ft(w),z=new ft(19),O=0;O<S;++O)z[dn[O]]=Dt(o,f+O*3,7);f+=S*3;for(var E=mn(z),U=(1<<E)-1,D=Gt(z,E,1),O=0;O<w;){var _=D[Dt(o,f,U)];f+=_&15;var b=_>>4;if(b<16)k[O++]=b;else{var X=0,I=0;for(b==16?(I=3+Dt(o,f,3),f+=2,X=k[O-1]):b==17?(I=3+Dt(o,f,7),f+=3):b==18&&(I=11+Dt(o,f,127),f+=7);I--;)k[O++]=X}}var B=k.subarray(0,v),q=k.subarray(v);m=mn(B),y=mn(q),d=Gt(B,m,1),p=Gt(q,y,1)}else Lt(1);else{var b=wn(f)+4,C=o[b-4]|o[b-3]<<8,x=b+C;if(x>r){l&&Lt(0);break}a&&h(u+C),t.set(o.subarray(b,x),u),e.b=u+=C,e.p=f=x*8,e.f=c;continue}if(f>P){l&&Lt(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,$=(1<<y)-1,W=f;;W=f){var X=d[xn(o,f)&L],F=X>>4;if(f+=X&15,f>P){l&&Lt(0);break}if(X||Lt(2),F<256)t[u++]=F;else if(F==256){W=f,d=null;break}else{var V=F-254;if(F>264){var O=F-257,R=Ne[O];V=Dt(o,f,(1<<R)-1)+er[O],f+=R}var Z=p[xn(o,f)&$],H=Z>>4;Z||Lt(3),f+=Z&15;var q=gi[H];if(H>3){var R=je[H];q+=xn(o,f)&(1<<R)-1,f+=R}if(f>P){l&&Lt(0);break}a&&h(u+131072);var nt=u+V;if(u<q){var Wt=s-q,Et=Math.min(q,nt);for(Wt+u<0&&Lt(3);u<Et;++u)t[u]=n[Wt+u]}for(;u<nt;++u)t[u]=t[u-q]}}e.l=d,e.p=W,e.b=u,e.f=c,d&&(c=1,e.m=m,e.d=p,e.n=y)}while(!c);return u!=t.length&&i?ir(t,0,u):t.subarray(0,u)},Xt=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8},Me=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8,o[n+2]|=t>>16},vn=function(o,e){for(var t=[],n=0;n<o.length;++n)o[n]&&t.push({s:n,f:o[n]});var r=t.length,s=t.slice();if(!r)return{t:lr,l:0};if(r==1){var i=new ft(t[0].s+1);return i[t[0].s]=1,{t:i,l:1}}t.sort(function(x,v){return x.f-v.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=s[0].s,n=1;n<r;++n)s[n].s>u&&(u=s[n].s);var d=new It(u+1),p=bn(t[c-1],d,0);if(p>e){var n=0,m=0,y=p-e,P=1<<y;for(s.sort(function(v,S){return d[S.s]-d[v.s]||v.f-S.f});n<r;++n){var T=s[n].s;if(d[T]>e)m+=P-(1<<p-d[T]),d[T]=e;else break}for(m>>=y;m>0;){var b=s[n].s;d[b]<e?m-=1<<e-d[b]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;d[C]==e&&(--d[C],++m)}p=e}return{t:new ft(d),l:p}},bn=function(o,e,t){return o.s==-1?Math.max(bn(o.l,e,t+1),bn(o.r,e,t+1)):e[o.s]=t},sr=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new It(++e),n=0,r=o[0],s=1,i=function(l){t[n++]=l},a=1;a<=e;++a)if(o[a]==r&&a!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(r),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(r);s=1,r=o[a]}return{c:t.subarray(0,n),n:e}},Ce=function(o,e){for(var t=0,n=0;n<e.length;++n)t+=o[n]*e[n];return t},or=function(o,e,t){var n=t.length,r=wn(e+2);o[r]=n&255,o[r+1]=n>>8,o[r+2]=o[r]^255,o[r+3]=o[r+1]^255;for(var s=0;s<n;++s)o[r+s+4]=t[s];return(r+4+n)*8},ar=function(o,e,t,n,r,s,i,a,l,h,c){Xt(e,c++,t),++r[256];for(var f=vn(r,15),u=f.t,d=f.l,p=vn(s,15),m=p.t,y=p.l,P=sr(u),T=P.c,b=P.n,C=sr(m),x=C.c,v=C.n,S=new It(19),w=0;w<T.length;++w)++S[T[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var k=vn(S,7),z=k.t,O=k.l,E=19;E>4&&!z[dn[E-1]];--E);var U=h+5<<3,D=Ce(r,Yt)+Ce(s,Se)+i,_=Ce(r,u)+Ce(s,m)+i+14+3*E+Ce(S,z)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&U<=D&&U<=_)return or(e,c,o.subarray(l,l+h));var X,I,B,q;if(Xt(e,c,1+(_<D)),c+=2,_<D){X=Gt(u,d,0),I=u,B=Gt(m,y,0),q=m;var L=Gt(z,O,0);Xt(e,c,b-257),Xt(e,c+5,v-1),Xt(e,c+10,E-4),c+=14;for(var w=0;w<E;++w)Xt(e,c+3*w,z[dn[w]]);c+=3*E;for(var $=[T,x],W=0;W<2;++W)for(var F=$[W],w=0;w<F.length;++w){var V=F[w]&31;Xt(e,c,L[V]),c+=z[V],V>15&&(Xt(e,c,F[w]>>5&127),c+=F[w]>>12)}}else X=mi,I=Yt,B=wi,q=Se;for(var w=0;w<a;++w){var R=n[w];if(R>255){var V=R>>18&31;Me(e,c,X[V+257]),c+=I[V+257],V>7&&(Xt(e,c,R>>23&31),c+=Ne[V]);var Z=R&31;Me(e,c,B[Z]),c+=q[Z],Z>3&&(Me(e,c,R>>5&8191),c+=je[Z])}else Me(e,c,X[R]),c+=I[R]}return Me(e,c,X[256]),c+I[256]},Mi=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lr=new ft(0),Ci=function(o,e,t,n,r,s){var i=s.z||o.length,a=new ft(n+i+5*(1+Math.ceil(i/7e3))+r),l=a.subarray(n,a.length-r),h=s.l,c=(s.r||0)&7;if(e){c&&(l[0]=s.r>>3);for(var f=Mi[e-1],u=f>>13,d=f&8191,p=(1<<t)-1,m=s.p||new It(32768),y=s.h||new It(p+1),P=Math.ceil(t/3),T=2*P,b=function(kt){return(o[kt]^o[kt+1]<<P^o[kt+2]<<T)&p},C=new pn(25e3),x=new It(288),v=new It(32),S=0,w=0,k=s.i||0,z=0,O=s.w||0,E=0;k+2<i;++k){var U=b(k),D=k&32767,_=y[U];if(m[D]=_,y[U]=D,O<=k){var X=i-k;if((S>7e3||z>24576)&&(X>423||!h)){c=ar(o,l,0,C,x,v,w,z,E,k-E,c),z=S=w=0,E=k;for(var I=0;I<286;++I)x[I]=0;for(var I=0;I<30;++I)v[I]=0}var B=2,q=0,L=d,$=D-_&32767;if(X>2&&U==b(k-$))for(var W=Math.min(u,X)-1,F=Math.min(32767,k),V=Math.min(258,X);$<=F&&--L&&D!=_;){if(o[k+B]==o[k+B-$]){for(var R=0;R<V&&o[k+R]==o[k+R-$];++R);if(R>B){if(B=R,q=$,R>W)break;for(var Z=Math.min($,R-2),H=0,I=0;I<Z;++I){var nt=k-$+I&32767,Wt=m[nt],Et=nt-Wt&32767;Et>H&&(H=Et,_=nt)}}}D=_,_=m[D],$+=D-_&32767}if(q){C[z++]=268435456|yn[B]<<18|rr[q];var Ct=yn[B]&31,At=rr[q]&31;w+=Ne[Ct]+je[At],++x[257+Ct],++v[At],O=k+B,++S}else C[z++]=o[k],++x[o[k]]}}for(k=Math.max(k,O);k<i;++k)C[z++]=o[k],++x[o[k]];c=ar(o,l,h,C,x,v,w,z,E,k-E,c),h||(s.r=c&7|l[c/8|0]<<3,c-=7,s.h=y,s.p=m,s.i=k,s.w=O)}else{for(var k=s.w||0;k<i+h;k+=65535){var ht=k+65535;ht>=i&&(l[c/8|0]=h,ht=i),c=or(l,c+1,o.subarray(k,ht))}s.i=i}return ir(a,0,n+wn(c)+r)},hr=function(){var o=1,e=0;return{p:function(t){for(var n=o,r=e,s=t.length|0,i=0;i!=s;){for(var a=Math.min(i+2655,s);i<a;++i)r+=n+=t[i];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}o=n,e=r},d:function(){return o%=65521,e%=65521,(o&255)<<24|(o&65280)<<8|(e&255)<<8|e>>8}}},Pi=function(o,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),i=new ft(s.length+o.length);i.set(s),i.set(o,s.length),o=i,r.w=s.length}return Ci(o,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,n,r)},cr=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Ti=function(o,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(o[0]=120,o[1]=n<<6|(e.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,e.dictionary){var r=hr();r.p(e.dictionary),cr(o,2,r.d())}},Ai=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&Lt(6,"invalid zlib data"),(o[1]>>5&1)==1&&Lt(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function ki(o,e){e||(e={});var t=hr();t.p(o);var n=Pi(o,e,e.dictionary?6:2,4);return Ti(n,e),cr(n,n.length-4,t.d()),n}function Ii(o,e){return Si(o.subarray(Ai(o),-4),{i:2},e,e)}var _i=typeof TextDecoder<"u"&&new TextDecoder,Oi=0;try{_i.decode(lr,{stream:!0}),Oi=1}catch{}const Ei="modern-font";function Pe(o,e){if(!o)throw new Error(`[${Ei}] ${e}`)}function Bi(o){if("buffer"in o){const e=o.buffer;return o.byteOffset>0||o.byteLength<o.buffer.byteLength?e.slice(o.byteOffset,o.byteOffset+o.byteLength):e}else return o}function ce(o){return"buffer"in o?new DataView(o.buffer,o.byteOffset,o.byteLength):new DataView(o)}function Di(o){let e="";for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function Ge(o){o=Di(o);const e=[];for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Li(o){let e="";for(let t=0,n=o.length;t<n;t++)o[t]<127?e+=String.fromCharCode(o[t]):e+=`%${(256+o[t]).toString(16).slice(1)}`;return unescape(e)}function Ui(o){let e="";for(let t=0,n=o.length;t<n;t+=2)e+=String.fromCharCode((o[t]<<8)+o[t+1]);return e}var Fi=Object.defineProperty,ut=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Fi(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(o,e){Object.defineProperty(o.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,s){super(Bi(t),n,r);M(this,"cursor",0);this.littleEndian=s}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,s)=>this.read(t.type,t.offset+s));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,s)=>{this.write(t.type,n[s],t.offset+s)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const s=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,i=this,a=(h=i[s])==null?void 0:h.bind(i),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,s]=this.readBytes(t,3);return(n<<16)+(r<<8)+s}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let s=0;s<n;++s)r.push(this.getUint8(t+s));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let s="";for(let i=0,a=r.length;i<a;i++)s+=String.fromCharCode(r[i]);return s}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),s=new Date;return s.setTime(r*1e3+-20775456e5),s}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,s=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const i=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[i])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,s);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let s=0,i=t.length,a;s<i;++s)a=t.charCodeAt(s)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const s=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(s,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let s=0;s<r;++s)this.setUint8(n+s,t[s])}else{const s=ce(t);r=s.byteLength;for(let i=0;i<r;++i)this.setUint8(n+i,s.getUint8(i))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ut([pt()],at.prototype,"readInt8"),ut([pt()],at.prototype,"readInt16"),ut([pt()],at.prototype,"readInt32"),ut([pt()],at.prototype,"readUint8"),ut([pt()],at.prototype,"readUint16"),ut([pt()],at.prototype,"readUint32"),ut([pt()],at.prototype,"readFloat32"),ut([pt()],at.prototype,"readFloat64"),ut([pt()],at.prototype,"writeInt8"),ut([pt()],at.prototype,"writeInt16"),ut([pt()],at.prototype,"writeInt32"),ut([pt()],at.prototype,"writeUint8"),ut([pt()],at.prototype,"writeUint16"),ut([pt()],at.prototype,"writeUint32"),ut([pt()],at.prototype,"writeFloat32"),ut([pt()],at.prototype,"writeFloat64");const fr=new WeakMap;function g(o){const e=typeof o=="object"?o:{type:o},{size:t=1,type:n}=e;return(r,s)=>{if(typeof s!="string")return;let i=fr.get(r);i||(i={columns:[],byteLength:0},fr.set(r,i));const a={...e,name:s,byteLength:t*Re[n],offset:e.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class Sn extends Ot{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(e){return new FontFace(e,this.view.buffer)}}var $i=Object.defineProperty,wt=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&$i(e,t,r),r};const vt=class fi extends Sn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,s=n.name.names,i=Ge(s.fontFamily||""),a=i.length,l=Ge(s.fontStyle||""),h=l.length,c=Ge(s.version||""),f=c.length,u=Ge(s.fullName||""),d=u.length,p=86+a+4+h+4+f+4+d+2+t.view.byteLength,m=new fi(new ArrayBuffer(p),0,p,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(i),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(d),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var zi=Object.defineProperty,qe=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&zi(e,t,r),r};class Te extends Ot{constructor(e,t){super(e,t,16)}}qe([g({type:"char",size:4})],Te.prototype,"tag"),qe([g("uint32")],Te.prototype,"checkSum"),qe([g("uint32")],Te.prototype,"offset"),qe([g("uint32")],Te.prototype,"length");const Mn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class ur{constructor(e){M(this,"index");M(this,"name");M(this,"isComposite",!1);M(this,"components",[]);M(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.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=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},s){const i=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:a=i,yScale:l=i}=r,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const d=h[f];d.type==="M"?c.push({type:"M",x:e+d.x*a,y:t+-d.y*l}):d.type==="L"?c.push({type:"L",x:e+d.x*a,y:t+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:e+d.x1*a,y1:t+-d.y1*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="C"?c.push({type:"C",x1:e+d.x1*a,y1:t+-d.y1*l,x2:e+d.x2*a,y2:t+-d.y2*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class ji extends ur{parse(e,t,n){const r=this,{nominalWidthX:s,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,d,p;const m=[],y=[];let P=0,T=!1,b=!1,C=i,x=0,v=0;function S(D,_){m.push({type:"L",x:D,y:_})}function w(D,_,X,I,B,q){m.push({type:"C",x1:D,y1:_,x2:X,y2:I,x:B,y:q})}function k(D,_){b&&h!==2&&z(),b=!0,m.push({type:"M",x:D,y:_})}function z(){m.push({type:"Z"})}function O(D){m.push(...D)}function E(){y.length%2!==0&&!T&&(C=y.shift()+s),P+=y.length>>1,y.length=0,T=!0}function U(D){let _,X,I,B,q,L,$,W,F,V,R,Z,H=0;for(;H<D.length;){let nt=D[H++];switch(nt){case 1:E();break;case 3:E();break;case 4:y.length>1&&!T&&(C=y.shift()+s,T=!0),v+=y.pop(),k(x,v);break;case 5:for(;y.length>0;)x+=y.shift(),v+=y.shift(),S(x,v);break;case 6:for(;y.length>0&&(x+=y.shift(),S(x,v),y.length!==0);)v+=y.shift(),S(x,v);break;case 7:for(;y.length>0&&(v+=y.shift(),S(x,v),y.length!==0);)x+=y.shift(),S(x,v);break;case 8:for(;y.length>0;)f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p+y.shift(),w(f,u,d,p,x,v);break;case 10:q=y.pop()+l,L=e.subrs[q],L&&U(L);break;case 11:return;case 12:switch(nt=D[H],H+=1,nt){case 35:f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),$=d+y.shift(),W=p+y.shift(),F=$+y.shift(),V=W+y.shift(),R=F+y.shift(),Z=V+y.shift(),x=R+y.shift(),v=Z+y.shift(),y.shift(),w(f,u,d,p,$,W),w(F,V,R,Z,x,v);break;case 34:f=x+y.shift(),u=v,d=f+y.shift(),p=u+y.shift(),$=d+y.shift(),W=p,F=$+y.shift(),V=p,R=F+y.shift(),Z=v,x=R+y.shift(),w(f,u,d,p,$,W),w(F,V,R,Z,x,v);break;case 36:f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),$=d+y.shift(),W=p,F=$+y.shift(),V=p,R=F+y.shift(),Z=V+y.shift(),x=R+y.shift(),w(f,u,d,p,$,W),w(F,V,R,Z,x,v);break;case 37:f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),$=d+y.shift(),W=p+y.shift(),F=$+y.shift(),V=W+y.shift(),R=F+y.shift(),Z=V+y.shift(),Math.abs(R-x)>Math.abs(Z-v)?x=R+y.shift():v=Z+y.shift(),w(f,u,d,p,$,W),w(F,V,R,Z,x,v);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Wt=Mn[y.pop()],Et=Mn[y.pop()],Ct=y.pop(),At=y.pop();if(Wt&&Et){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),kt=e.charset.indexOf(Et);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Ct}),O(n.get(kt).pathCommands);const zt=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let Nt=0;Nt<zt.length;Nt+=1){const Bt=zt[Nt];Bt.type!=="Z"&&(Bt.x+=At,Bt.y+=Ct),(Bt.type==="Q"||Bt.type==="C")&&(Bt.x1+=At,Bt.y1+=Ct),Bt.type==="C"&&(Bt.x2+=At,Bt.y2+=Ct)}O(zt)}}else y.length>0&&!T&&(C=y.shift()+s,T=!0);b&&h!==2&&(z(),b=!1);break;case 18:E();break;case 19:case 20:E(),H+=P+7>>3;break;case 21:y.length>2&&!T&&(C=y.shift()+s,T=!0),v+=y.pop(),x+=y.pop(),k(x,v);break;case 22:y.length>1&&!T&&(C=y.shift()+s,T=!0),x+=y.pop(),k(x,v);break;case 23:E();break;case 24:for(;y.length>2;)f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p+y.shift(),w(f,u,d,p,x,v);x+=y.shift(),v+=y.shift(),S(x,v);break;case 25:for(;y.length>6;)x+=y.shift(),v+=y.shift(),S(x,v);f=x+y.shift(),u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p+y.shift(),w(f,u,d,p,x,v);break;case 26:for(y.length%2&&(x+=y.shift());y.length>0;)f=x,u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d,v=p+y.shift(),w(f,u,d,p,x,v);break;case 27:for(y.length%2&&(v+=y.shift());y.length>0;)f=x+y.shift(),u=v,d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p,w(f,u,d,p,x,v);break;case 28:_=D[H],X=D[H+1],y.push((_<<24|X<<16)>>16),H+=2;break;case 29:q=y.pop()+a,L=e.gsubrs[q],L&&U(L);break;case 30:for(;y.length>0&&(f=x,u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p+(y.length===1?y.shift():0),w(f,u,d,p,x,v),y.length!==0);)f=x+y.shift(),u=v,d=f+y.shift(),p=u+y.shift(),v=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,v);break;case 31:for(;y.length>0&&(f=x+y.shift(),u=v,d=f+y.shift(),p=u+y.shift(),v=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,v),y.length!==0);)f=x,u=v+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),v=p+(y.length===1?y.shift():0),w(f,u,d,p,x,v);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?y.push(nt-139):nt<251?(_=D[H],H+=1,y.push((nt-247)*256+_+108)):nt<255?(_=D[H],H+=1,y.push(-(nt-251)*256-_-108)):(_=D[H],X=D[H+1],I=D[H+2],B=D[H+3],H+=4,y.push((_<<24|X<<16|I<<8|B)/65536))}}}U(t),this.pathCommands=m,T&&(this.advanceWidth=C)}}class pr{constructor(e){M(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const s=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);s&&(n.unicode??(n.unicode=s[0]),n.unicodes??(n.unicodes=s)),this._items[e]=n}return n}}class Gi extends pr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new ji({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var Ri=Object.defineProperty,dr=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Ri(e,t,r),r};class Ve extends Ot{constructor(t,n,r,s){super(t,n,r,s);M(this,"_offsets");M(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,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const s=[];for(let i=0,a=n+1;i<a;i++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();s.push(h)}return s}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,s=r+n[t],a=r+n[t+1]-s;return this._isString?this.view.readString(s,a):this.view.readBytes(s,a)}}dr([g("uint16")],Ve.prototype,"count"),dr([g("uint8")],Ve.prototype,"offsetSize");class We extends Ve{constructor(){super(...arguments);M(this,"_isString",!1)}}class yr extends Ve{constructor(){super(...arguments);M(this,"_isString",!0)}}const qi=[".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"],Vi=[".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"],Wi=[".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"],Xi=[".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 Xe(o,e){return e<=390?qi[e]:o[e-391]}function J(o,e="number",t){return(n,r)=>{if(typeof r!="string")return;const s={type:e,operator:o,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(s)},set(i){this._setProp(s,i)},configurable:!0,enumerable:!0})}}class gr extends Ot{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),a=i>>4,l=i&15;if(a===r||(n+=s[a],l===r))break;n+=s[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,s,i,a;if(t===28)return r=n.readUint8(),s=n.readUint8(),r<<8|s;if(t===29)return r=n.readUint8(),s=n.readUint8(),i=n.readUint8(),a=n.readUint8(),r<<24|s<<16|i<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,s={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),s[i]=n,n=[]):n.push(this._readOperand(i))}return s}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return Xe(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Hi=Object.defineProperty,Cn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Hi(e,t,r),r};class He extends gr{}Cn([J(19)],He.prototype,"subrs"),Cn([J(20)],He.prototype,"defaultWidthX"),Cn([J(21)],He.prototype,"nominalWidthX");var Zi=Object.defineProperty,rt=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Zi(e,t,r),r};class et extends gr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(o,e=o){return t=>{fe.tableDefinitions.set(o,{tag:o,prop:e,class:t}),Object.defineProperty(fe.prototype,e,{get(){return this.get(o)},set(n){return this.set(o,n)},configurable:!0,enumerable:!0})}}const he=class he{constructor(e){M(this,"tables",new Map);M(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.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 numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,s=Array.from({length:r}),i=t.get(0);for(let a=0;a<r;a+=1)s[a]=t.get(n[a])||i;return s}getPathCommands(e,t,n,r,s){const i=[];return this.forEachGlyph(e,t,n,r,s,(a,l,h,c,f)=>{i.push(...a.getPathCommands(l,h,c,f,this))}),i}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,s={},i){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,t,n,r,s),c.advanceWidth&&(t+=c.advanceWidth*a),s.letterSpacing?t+=s.letterSpacing*r:s.tracking&&(t+=s.tracking/1e3*r)}return t}clone(){return new he(this.tableViews)}delete(e){const t=he.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=he.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=he.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const s=this.tableViews.get(e);if(!s)return;n=new r(s.buffer,s.byteOffset,s.byteLength).setSFNT(this),this.tables.set(t.prop,n)}}return n}};M(he,"tableDefinitions",new Map);let fe=he;class yt extends Ot{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var Yi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Ae=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ki(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Yi(e,t,r),r};let ue=class extends yt{constructor(e,t,n,r){super(e,t,n,r);M(this,"_glyphs");M(this,"privateDict");M(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Gi(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new yr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new yr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const s=this.topDict.private[0],i=this.topDict.private[1];s&&(this.privateDict=new He(t,n+i,s).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+i+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Vi:this.topDict.charset===1?this.charset=Wi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Mn:this.topDict.encoding===1?this.encoding=Ni:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let s,i,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(s=0;s<t;s+=1)i=r.readUint16(),l.push(Xe(n,i));else if(h===1)for(;l.length<=t;)for(i=r.readUint16(),a=r.readUint8(),s=0;s<=a;s+=1)l.push(Xe(n,i)),i+=1;else if(h===2)for(;l.length<=t;)for(i=r.readUint16(),a=r.readUint16(),s=0;s<=a;s+=1)l.push(Xe(n,i)),i+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const s={},i=t.readUint8();if(i===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),s[r]=n}else if(i===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)s[c]=r,r+=1}}else console.warn(`unknown encoding format:${i}`);return s}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Ae([g("uint8")],ue.prototype,"majorVersion",2),Ae([g("uint8")],ue.prototype,"minorVersion",2),Ae([g("uint8")],ue.prototype,"headerSize",2),Ae([g("uint8")],ue.prototype,"offsetSize",2),ue=Ae([dt("CFF ","cff")],ue);var Qi=Object.defineProperty,Ze=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Qi(e,t,r),r};const ke=class ui extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new ui;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Ze([g("uint16")],ke.prototype,"format"),Ze([g("uint16")],ke.prototype,"length"),Ze([g("uint16")],ke.prototype,"language"),Ze([g({type:"uint8",size:256})],ke.prototype,"glyphIndexArray");let mr=ke;var Ji=Object.defineProperty,Pn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Ji(e,t,r),r};class Ye extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,i=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<s[0].firstCode||h>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(h-s[0].firstCode)>=i.length?l=0:(l=i[s[0].idRangeOffset+(h-s[0].firstCode)],l!==0&&(l=l+s[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=s[c].entryCount;f<u;f++)if(s[c].idRangeOffset+f>=i.length?l=0:(l=i[s[c].idRangeOffset+f],l!==0&&(l=l+s[c].idDelta)),l!==0&&l<e){const d=(h<<8|f+s[c].firstCode)%65535;t.set(d,l)}}return t}}Pn([g("uint16")],Ye.prototype,"format"),Pn([g("uint16")],Ye.prototype,"length"),Pn([g("uint16")],Ye.prototype,"language");function xr(o){return o>32767?o-65536:o<-32767?o+65536:o}function wr(o,e){let t;const n=[];let r={};return o.forEach((s,i)=>{e&&i>e||((!t||i!==t.unicode+1||s!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:i,startId:s,delta:xr(s-i)}):(r.start=Number(i),r.startId=s,r.delta=xr(s-i))),t={unicode:i,glyphIndex:s})}),t&&(r.end=t.unicode,n.push(r)),n}var ts=Object.defineProperty,re=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&ts(e,t,r),r};const Kt=class pi extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=wr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,i=new pi(new ArrayBuffer(24+t.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=n*2,i.searchRange=s,i.entrySelector=r,i.rangeShift=2*n-s,i.endCode=[...t.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...t.map(a=>a.start),65535],i.idDelta=[...t.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:n},()=>0),i}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=s[h];c<=f;++c)if(i[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+i[h]/2+(c-r[h])-n,d=l[u];d!==0?e.set(c,(d+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};re([g("uint16")],Kt.prototype,"format"),re([g("uint16")],Kt.prototype,"length"),re([g("uint16")],Kt.prototype,"language"),re([g("uint16")],Kt.prototype,"segCountX2"),re([g("uint16")],Kt.prototype,"searchRange"),re([g("uint16")],Kt.prototype,"entrySelector"),re([g("uint16")],Kt.prototype,"rangeShift");let vr=Kt;var es=Object.defineProperty,Ie=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&es(e,t,r),r};class pe extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}Ie([g("uint16")],pe.prototype,"format"),Ie([g("uint16")],pe.prototype,"length"),Ie([g("uint16")],pe.prototype,"language"),Ie([g("uint16")],pe.prototype,"firstCode"),Ie([g("uint16")],pe.prototype,"entryCount");var ns=Object.defineProperty,_e=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&ns(e,t,r),r};const de=class di extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=wr(e),n=new di(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const s=t[n];let i=s.startGlyphCode,a=s.startCharCode;const l=s.endCharCode;for(;a<=l;)e.set(a++,i++)}return e}};_e([g("uint16")],de.prototype,"format"),_e([g("uint16")],de.prototype,"reserved"),_e([g("uint32")],de.prototype,"length"),_e([g("uint32")],de.prototype,"language"),_e([g("uint32")],de.prototype,"nGroups");let br=de;var rs=Object.defineProperty,Tn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&rs(e,t,r),r};class Ke extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:s}=t[n];s.forEach(i=>{e.set(i.unicodeValue,i.glyphID)})}return e}}Tn([g("uint16")],Ke.prototype,"format"),Tn([g("uint32")],Ke.prototype,"length"),Tn([g("uint32")],Ke.prototype,"numVarSelectorRecords");var is=Object.defineProperty,ss=Object.getOwnPropertyDescriptor,An=(o,e,t,n)=>{for(var r=n>1?void 0:n?ss(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&is(e,t,r),r};let Oe=class extends yt{constructor(){super(...arguments);M(this,"_unicodeToGlyphIndexMap");M(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),n=vr.from(e),r=mr.from(e),s=t?br.from(e):void 0,i=4+(s?32:24),a=i+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:i},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:i},s&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Oe(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(n.view,i),c.view.writeBytes(r.view,a),s&&c.view.writeBytes(s.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,s=n.length;r<s;r++){const i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new mr(this.view.buffer,t.offset);break;case 2:r=new Ye(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new vr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new pe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new br(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ke(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,n=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,r=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,s=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,i=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[]])}};An([g("uint16")],Oe.prototype,"version",2),An([g("uint16")],Oe.prototype,"numberSubtables",2),Oe=An([dt("cmap")],Oe);class os extends ur{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const s=e[r];n.push(s),s.lastPointOfContour&&(t.push(n),n=[])}return Pe(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const s=e[r],i={x:t.xScale*s.x+t.scale10*s.y+t.dx,y:t.scale01*s.x+t.yScale*s.y+t.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(i)}return n}_parseGlyphCoordinate(e,t,n,r,s){let i;return(t&r)>0?(i=e.view.readUint8(),(t&s)===0&&(i=-i),i=n+i):(t&s)>0?i=n:i=n+e.view.readInt16(),i}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Pe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;Pe(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let d,p=0;for(;p<f;)if(d=e.view.readUint8(),u.push(d),p++,d&8&&p<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(d),p++}if(Pe(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let y;if(f>0){for(let b=0;b<f;b+=1)d=u[b],y={},y.onCurve=!!(d&1),y.lastPointOfContour=a.includes(b),m.push(y);let P=0;for(let b=0;b<f;b+=1)d=u[b],y=m[b],y.x=this._parseGlyphCoordinate(e,d,P,2,16),P=y.x;let T=0;for(let b=0;b<f;b+=1)d=u[b],y=m[b],y.y=this._parseGlyphCoordinate(e,d,T,4,32),T=y.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Pe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],d)[0],d.dx=f.x-u.x,d.dy=f.y-u.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const s=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],f=h[0];c.onCurve?s.push({type:"M",x:c.x,y:c.y}):f.onCurve?s.push({type:"M",x:f.x,y:f.y}):s.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,d=h.length;u<d;++u)if(c=f,f=h[(u+1)%d],c.onCurve)s.push({type:"L",x:c.x,y:c.y});else{let p=f;f.onCurve||(p={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),s.push({type:"Q",x1:c.x,y1:c.y,x:p.x,y:p.y})}s.push({type:"Z"})}this.pathCommands=s}}class as extends pr{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new os({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var ls=Object.getOwnPropertyDescriptor,hs=(o,e,t,n)=>{for(var r=n>1?void 0:n?ls(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let kn=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,s)=>r+s.byteLength,0),n=new kn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new as(this._sfnt))}};kn=hs([dt("glyf")],kn);var cs=Object.getOwnPropertyDescriptor,fs=(o,e,t,n)=>{for(var r=n>1?void 0:n?cs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let Sr=class extends yt{};Sr=fs([dt("GPOS","gpos")],Sr);var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ie=(o,e,t,n)=>{for(var r=n>1?void 0:n?ps(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&us(e,t,r),r};let Qt=class extends yt{};ie([g("uint16")],Qt.prototype,"majorVersion",2),ie([g("uint16")],Qt.prototype,"minorVersion",2),ie([g("uint16")],Qt.prototype,"scriptListOffset",2),ie([g("uint16")],Qt.prototype,"featureListOffset",2),ie([g("uint16")],Qt.prototype,"lookupListOffset",2),ie([g("uint16")],Qt.prototype,"featureVariationsOffset",2),Qt=ie([dt("GSUB","gsub")],Qt);var ds=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,ot=(o,e,t,n)=>{for(var r=n>1?void 0:n?ys(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&ds(e,t,r),r};let st=class extends yt{constructor(o=new ArrayBuffer(54),e){super(o,e,Math.min(54,o.byteLength-(e??0)))}};ot([g("fixed")],st.prototype,"version",2),ot([g("fixed")],st.prototype,"fontRevision",2),ot([g("uint32")],st.prototype,"checkSumAdjustment",2),ot([g("uint32")],st.prototype,"magickNumber",2),ot([g("uint16")],st.prototype,"flags",2),ot([g("uint16")],st.prototype,"unitsPerEm",2),ot([g({type:"longDateTime"})],st.prototype,"created",2),ot([g({type:"longDateTime"})],st.prototype,"modified",2),ot([g("int16")],st.prototype,"xMin",2),ot([g("int16")],st.prototype,"yMin",2),ot([g("int16")],st.prototype,"xMax",2),ot([g("int16")],st.prototype,"yMax",2),ot([g("uint16")],st.prototype,"macStyle",2),ot([g("uint16")],st.prototype,"lowestRecPPEM",2),ot([g("int16")],st.prototype,"fontDirectionHint",2),ot([g("int16")],st.prototype,"indexToLocFormat",2),ot([g("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var gs=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,bt=(o,e,t,n)=>{for(var r=n>1?void 0:n?ms(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&gs(e,t,r),r};let gt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};bt([g("fixed")],gt.prototype,"version",2),bt([g("int16")],gt.prototype,"ascent",2),bt([g("int16")],gt.prototype,"descent",2),bt([g("int16")],gt.prototype,"lineGap",2),bt([g("uint16")],gt.prototype,"advanceWidthMax",2),bt([g("int16")],gt.prototype,"minLeftSideBearing",2),bt([g("int16")],gt.prototype,"minRightSideBearing",2),bt([g("int16")],gt.prototype,"xMaxExtent",2),bt([g("int16")],gt.prototype,"caretSlopeRise",2),bt([g("int16")],gt.prototype,"caretSlopeRun",2),bt([g("int16")],gt.prototype,"caretOffset",2),bt([g({type:"int16",size:4})],gt.prototype,"reserved",2),bt([g("int16")],gt.prototype,"metricDataFormat",2),bt([g("uint16")],gt.prototype,"numOfLongHorMetrics",2),gt=bt([dt("hhea")],gt);var xs=Object.getOwnPropertyDescriptor,ws=(o,e,t,n)=>{for(var r=n>1?void 0:n?xs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let In=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new In(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((s,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};In=ws([dt("hmtx")],In);var vs=Object.getOwnPropertyDescriptor,bs=(o,e,t,n)=>{for(var r=n>1?void 0:n?vs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let Mr=class extends yt{};Mr=bs([dt("kern","kern")],Mr);var Ss=Object.getOwnPropertyDescriptor,Ms=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ss(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new _n(new ArrayBuffer(n));return e.forEach(s=>{t?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};_n=Ms([dt("loca")],_n);var Cs=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,mt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ps(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Cs(e,t,r),r};let lt=class extends yt{constructor(o=new ArrayBuffer(32),e){super(o,e,Math.min(32,o.byteLength-(e??0)))}};mt([g("fixed")],lt.prototype,"version",2),mt([g("uint16")],lt.prototype,"numGlyphs",2),mt([g("uint16")],lt.prototype,"maxPoints",2),mt([g("uint16")],lt.prototype,"maxContours",2),mt([g("uint16")],lt.prototype,"maxComponentPoints",2),mt([g("uint16")],lt.prototype,"maxComponentContours",2),mt([g("uint16")],lt.prototype,"maxZones",2),mt([g("uint16")],lt.prototype,"maxTwilightPoints",2),mt([g("uint16")],lt.prototype,"maxStorage",2),mt([g("uint16")],lt.prototype,"maxFunctionDefs",2),mt([g("uint16")],lt.prototype,"maxInstructionDefs",2),mt([g("uint16")],lt.prototype,"maxStackElements",2),mt([g("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([g("uint16")],lt.prototype,"maxComponentElements",2),mt([g("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var Ts=Object.defineProperty,As=Object.getOwnPropertyDescriptor,Qe=(o,e,t,n)=>{for(var r=n>1?void 0:n?As(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Ts(e,t,r),r};const Cr={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"},On={Macintosh:1,Microsoft:3},ks={Default:0},Pr={UCS2:1};let Ee=class extends yt{constructor(){super(...arguments);M(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=On.Macintosh,s=ks.Default,i=0;t.some(l=>l.platform===On.Microsoft&&l.encoding===Pr.UCS2&&l.language===1033)&&(r=On.Microsoft,s=Pr.UCS2,i=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===s&&h.language===i&&Cr[h.nameId]&&(a[Cr[h.nameId]]=i===0?Li(h.name):Ui(h.name))}return a}};Qe([g("uint16")],Ee.prototype,"format",2),Qe([g("uint16")],Ee.prototype,"count",2),Qe([g("uint16")],Ee.prototype,"stringOffset",2),Ee=Qe([dt("name")],Ee);var Is=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,j=(o,e,t,n)=>{for(var r=n>1?void 0:n?_s(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Is(e,t,r),r};let N=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};j([g("uint16")],N.prototype,"version",2),j([g("int16")],N.prototype,"xAvgCharWidth",2),j([g("uint16")],N.prototype,"usWeightClass",2),j([g("uint16")],N.prototype,"usWidthClass",2),j([g("uint16")],N.prototype,"fsType",2),j([g("uint16")],N.prototype,"ySubscriptXSize",2),j([g("uint16")],N.prototype,"ySubscriptYSize",2),j([g("uint16")],N.prototype,"ySubscriptXOffset",2),j([g("uint16")],N.prototype,"ySubscriptYOffset",2),j([g("uint16")],N.prototype,"ySuperscriptXSize",2),j([g("uint16")],N.prototype,"ySuperscriptYSize",2),j([g("uint16")],N.prototype,"ySuperscriptXOffset",2),j([g("uint16")],N.prototype,"ySuperscriptYOffset",2),j([g("uint16")],N.prototype,"yStrikeoutSize",2),j([g("uint16")],N.prototype,"yStrikeoutPosition",2),j([g("uint16")],N.prototype,"sFamilyClass",2),j([g({type:"uint8"})],N.prototype,"bFamilyType",2),j([g({type:"uint8"})],N.prototype,"bSerifStyle",2),j([g({type:"uint8"})],N.prototype,"bWeight",2),j([g({type:"uint8"})],N.prototype,"bProportion",2),j([g({type:"uint8"})],N.prototype,"bContrast",2),j([g({type:"uint8"})],N.prototype,"bStrokeVariation",2),j([g({type:"uint8"})],N.prototype,"bArmStyle",2),j([g({type:"uint8"})],N.prototype,"bLetterform",2),j([g({type:"uint8"})],N.prototype,"bMidline",2),j([g({type:"uint8"})],N.prototype,"bXHeight",2),j([g({type:"uint8",size:16})],N.prototype,"ulUnicodeRange",2),j([g({type:"char",size:4})],N.prototype,"achVendID",2),j([g("uint16")],N.prototype,"fsSelection",2),j([g("uint16")],N.prototype,"usFirstCharIndex",2),j([g("uint16")],N.prototype,"usLastCharIndex",2),j([g("int16")],N.prototype,"sTypoAscender",2),j([g("int16")],N.prototype,"sTypoDescender",2),j([g("int16")],N.prototype,"sTypoLineGap",2),j([g("uint16")],N.prototype,"usWinAscent",2),j([g("uint16")],N.prototype,"usWinDescent",2),j([g({offset:72,type:"uint8",size:8})],N.prototype,"ulCodePageRange",2),j([g({offset:72,type:"int16"})],N.prototype,"sxHeight",2),j([g("int16")],N.prototype,"sCapHeight",2),j([g("uint16")],N.prototype,"usDefaultChar",2),j([g("uint16")],N.prototype,"usBreakChar",2),j([g("uint16")],N.prototype,"usMaxContext",2),N=j([dt("OS/2","os2")],N);var Os=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,Rt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Es(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Os(e,t,r),r};let Ut=class extends yt{constructor(o=new ArrayBuffer(32),e,t){super(o,e,t)}};Rt([g("fixed")],Ut.prototype,"format",2),Rt([g("fixed")],Ut.prototype,"italicAngle",2),Rt([g("int16")],Ut.prototype,"underlinePosition",2),Rt([g("int16")],Ut.prototype,"underlineThickness",2),Rt([g("uint32")],Ut.prototype,"isFixedPitch",2),Rt([g("uint32")],Ut.prototype,"minMemType42",2),Rt([g("uint32")],Ut.prototype,"maxMemType42",2),Rt([g("uint32")],Ut.prototype,"minMemType1",2),Rt([g("uint32")],Ut.prototype,"maxMemType1",2),Ut=Rt([dt("post")],Ut);var Bs=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,St=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ds(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Bs(e,t,r),r};let xt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};St([g("fixed")],xt.prototype,"version",2),St([g("int16")],xt.prototype,"vertTypoAscender",2),St([g("int16")],xt.prototype,"vertTypoDescender",2),St([g("int16")],xt.prototype,"vertTypoLineGap",2),St([g("int16")],xt.prototype,"advanceHeightMax",2),St([g("int16")],xt.prototype,"minTopSideBearing",2),St([g("int16")],xt.prototype,"minBottomSideBearing",2),St([g("int16")],xt.prototype,"yMaxExtent",2),St([g("int16")],xt.prototype,"caretSlopeRise",2),St([g("int16")],xt.prototype,"caretSlopeRun",2),St([g("int16")],xt.prototype,"caretOffset",2),St([g({type:"int16",size:4})],xt.prototype,"reserved",2),St([g("int16")],xt.prototype,"metricDataFormat",2),St([g("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Ls=Object.getOwnPropertyDescriptor,Us=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ls(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let En=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new En(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var s;const e=this._sfnt.maxp.numGlyphs,t=((s=this._sfnt.vhea)==null?void 0:s.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((i,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};En=Us([dt("vmtx")],En);var Fs=Object.defineProperty,Be=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Fs(e,t,r),r};class Ft extends Sn{constructor(){super(...arguments);M(this,"format","TrueType");M(this,"mimeType","font/ttf");M(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(ce(t).getUint32(0))}static checksum(t){const n=ce(t);let r=n.byteLength;for(;r%4;)r++;let s=0;for(let i=0,a=r/4;i<a;i+=4)i*4<r-4&&(s+=n.getUint32(i*4,!1));return s&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,s=Array.from(t.tableViews.values()).reduce((u,d)=>u+n(d.byteLength),0),i=new this(new ArrayBuffer(12+r*16+s));i.scalerType=65536,i.numTables=r;const a=Math.log(2);i.searchRange=Math.floor(Math.log(r)/a)*16,i.entrySelector=Math.floor(i.searchRange/a),i.rangeShift=r*16-i.searchRange;let l=12+r*16,h=0;const c=i.getDirectories();t.tableViews.forEach((u,d)=>{const p=c[h++];p.tag=d,p.checkSum=this.checksum(u),p.offset=l,p.length=u.byteLength,i.view.writeBytes(u,l),l+=n(p.length)});const f=i.createSFNT().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Te(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new fe(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}M(Ft,"signature",new Set([65536,1953658213,1954115633])),Be([g("uint32")],Ft.prototype,"scalerType"),Be([g("uint16")],Ft.prototype,"numTables"),Be([g("uint16")],Ft.prototype,"searchRange"),Be([g("uint16")],Ft.prototype,"entrySelector"),Be([g("uint16")],Ft.prototype,"rangeShift");class Je extends Ft{constructor(){super(...arguments);M(this,"format","OpenType");M(this,"mimeType","font/otf")}static from(t){return super.from(t)}}M(Je,"signature",new Set([1330926671]));var $s=Object.defineProperty,De=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&$s(e,t,r),r};class ye extends Ot{constructor(e,t){super(e,t,20)}}De([g({type:"char",size:4})],ye.prototype,"tag"),De([g("uint32")],ye.prototype,"offset"),De([g("uint32")],ye.prototype,"compLength"),De([g("uint32")],ye.prototype,"origLength"),De([g("uint32")],ye.prototype,"origChecksum");var zs=Object.defineProperty,_t=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&zs(e,t,r),r};const Pt=(ee=class extends Sn{constructor(){super(...arguments);M(this,"format","WOFF");M(this,"mimeType","font/woff");M(this,"_sfnt")}get subfontFormat(){return Ft.is(this.flavor)?"TrueType":Je.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(ce(t).getUint32(0))}static checkSum(t){const n=ce(t),r=n.byteLength,s=Math.floor(r/4);let i=0,a=0;for(;a<s;)i+=n.getUint32(4*a++,!1);let l=r-s*4;if(l){let h=s*4;for(;l>0;)i+=n.getUint8(h)<<l*8,h++,l--}return i%4294967296}static from(t,n=new ArrayBuffer(0)){const r=u=>u+3&-4,s=[];t.tableViews.forEach((u,d)=>{const p=ce(ki(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));s.push({tag:d,view:p.byteLength<u.byteLength?p:u,rawView:u})});const i=s.length,a=s.reduce((u,d)=>u+r(d.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*i+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=i,l.totalSFNTSize=12+16*i+s.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+i*20,c=0;const f=l.getDirectories();return s.forEach(u=>{const d=f[c++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=ee.checkSum(u.rawView),d.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(d.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new ye(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new fe(this.getDirectories().reduce((t,n)=>{const r=n.tag,s=this.view.byteOffset+n.offset,i=n.compLength,a=n.origLength,l=s+i;return t[r]=i>=a?new DataView(this.view.buffer,s,i):new DataView(Ii(new Uint8Array(this.view.buffer.slice(s,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);_t([g("uint32")],Pt.prototype,"signature"),_t([g("uint32")],Pt.prototype,"flavor"),_t([g("uint32")],Pt.prototype,"length"),_t([g("uint16")],Pt.prototype,"numTables"),_t([g("uint16")],Pt.prototype,"reserved"),_t([g("uint32")],Pt.prototype,"totalSFNTSize"),_t([g("uint16")],Pt.prototype,"majorVersion"),_t([g("uint16")],Pt.prototype,"minorVersion"),_t([g("uint32")],Pt.prototype,"metaOffset"),_t([g("uint32")],Pt.prototype,"metaLength"),_t([g("uint32")],Pt.prototype,"metaOrigLength"),_t([g("uint32")],Pt.prototype,"privOffset"),_t([g("uint32")],Pt.prototype,"privLength");let Bn=Pt;function Ns(o,e=!0){if(Ft.is(o))return new Ft(o);if(Je.is(o))return new Je(o);if(Bn.is(o))return new Bn(o);if(e)throw new Error("Failed to parseFont")}function js(o,e=!0){const t=Ns(o,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}const un=class un{constructor(){M(this,"fallbackFont");M(this,"loading",new Map);M(this,"loaded",new Map);M(this,"familyToUrl",new Map)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...un.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
1
+ (function(G,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(G=typeof globalThis<"u"?globalThis:G||self,ct(G.modernText={}))})(this,function(G){"use strict";var wa=Object.defineProperty;var va=(G,ct,jt)=>ct in G?wa(G,ct,{enumerable:!0,configurable:!0,writable:!0,value:jt}):G[ct]=jt;var M=(G,ct,jt)=>va(G,typeof ct!="symbol"?ct+"":ct,jt);var ee;function ct(o,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:i,stops:a}=yi(e,t.left,t.top,t.width,t.height),l=o.createLinearGradient(n,r,s,i);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function jt(o,e,t){o!=null&&o.color&&(o.color=ct(t,o.color,e)),o!=null&&o.backgroundColor&&(o.backgroundColor=ct(t,o.backgroundColor,e)),o!=null&&o.textStrokeColor&&(o.textStrokeColor=ct(t,o.textStrokeColor,e))}function yi(o,e,t,n,r){var p;const s=((p=o.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",i=s.split(",")[0],a=i.includes("deg")?i:"0deg",l=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function ne(o){const{ctx:e,path:t,fontSize:n,clipRect:r}=o;e.save(),e.beginPath();const s=t.style,i={...s,fill:o.color??s.fill,stroke:o.textStrokeColor??s.stroke,strokeWidth:o.textStrokeWidth?o.textStrokeWidth*n:s.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(o.shadowOffsetX??0)*n,shadowOffsetY:(o.shadowOffsetY??0)*n,shadowBlur:(o.shadowBlur??0)*n,shadowColor:o.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,i),e.restore()}function Kn(o,e,t){const{left:n,top:r,width:s,height:i}=t,a=o.canvas;a.dataset.viewBox=`${n} ${r} ${s} ${i}`,a.dataset.pixelRatio=String(e);const l=s,h=i;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,o.clearRect(0,0,a.width,a.height),o.scale(e,e),o.translate(-n,-r)}function Qn(o,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;jt(n,r,o),t.forEach(s=>{jt(s.computedStyle,s.lineBox,o),s.fragments.forEach(i=>{jt(i.computedStyle,i.inlineBox,o)})})}var ft=Uint8Array,It=Uint16Array,pn=Int32Array,Ne=new ft([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]),je=new ft([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]),dn=new ft([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jn=function(o,e){for(var t=new It(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var r=new pn(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)r[s]=s-t[n]<<5|n;return{b:t,r}},tr=Jn(Ne,2),er=tr.b,yn=tr.r;er[28]=258,yn[258]=28;for(var nr=Jn(je,0),gi=nr.b,rr=nr.r,gn=new It(32768),Q=0;Q<32768;++Q){var Zt=(Q&43690)>>1|(Q&21845)<<1;Zt=(Zt&52428)>>2|(Zt&13107)<<2,Zt=(Zt&61680)>>4|(Zt&3855)<<4,gn[Q]=((Zt&65280)>>8|(Zt&255)<<8)>>1}for(var Gt=function(o,e,t){for(var n=o.length,r=0,s=new It(e);r<n;++r)o[r]&&++s[o[r]-1];var i=new It(e);for(r=1;r<e;++r)i[r]=i[r-1]+s[r-1]<<1;var a;if(t){a=new It(1<<e);var l=15-e;for(r=0;r<n;++r)if(o[r])for(var h=r<<4|o[r],c=e-o[r],f=i[o[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[gn[f]>>l]=h}else for(a=new It(n),r=0;r<n;++r)o[r]&&(a[r]=gn[i[o[r]-1]++]>>15-o[r]);return a},Yt=new ft(288),Q=0;Q<144;++Q)Yt[Q]=8;for(var Q=144;Q<256;++Q)Yt[Q]=9;for(var Q=256;Q<280;++Q)Yt[Q]=7;for(var Q=280;Q<288;++Q)Yt[Q]=8;for(var Se=new ft(32),Q=0;Q<32;++Q)Se[Q]=5;var mi=Gt(Yt,9,0),xi=Gt(Yt,9,1),wi=Gt(Se,5,0),vi=Gt(Se,5,1),mn=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Dt=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},xn=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},wn=function(o){return(o+7)/8|0},ir=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new ft(o.subarray(e,t))},bi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Lt=function(o,e,t){var n=new Error(e||bi[o]);if(n.code=o,Error.captureStackTrace&&Error.captureStackTrace(n,Lt),!t)throw n;return n},Si=function(o,e,t,n){var r=o.length,s=0;if(!r||e.f&&!e.l)return t||new ft(0);var i=!t,a=i||e.i!=2,l=e.i;i&&(t=new ft(r*3));var h=function(Ct){var At=t.length;if(Ct>At){var ht=new ft(Math.max(At*2,Ct));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,p=e.l,d=e.d,m=e.m,y=e.n,P=r*8;do{if(!p){c=Dt(o,f,1);var T=Dt(o,f+1,3);if(f+=3,T)if(T==1)p=xi,d=vi,m=9,y=5;else if(T==2){var v=Dt(o,f,31)+257,S=Dt(o,f+10,15)+4,w=v+Dt(o,f+5,31)+1;f+=14;for(var k=new ft(w),z=new ft(19),O=0;O<S;++O)z[dn[O]]=Dt(o,f+O*3,7);f+=S*3;for(var B=mn(z),U=(1<<B)-1,D=Gt(z,B,1),O=0;O<w;){var _=D[Dt(o,f,U)];f+=_&15;var b=_>>4;if(b<16)k[O++]=b;else{var H=0,I=0;for(b==16?(I=3+Dt(o,f,3),f+=2,H=k[O-1]):b==17?(I=3+Dt(o,f,7),f+=3):b==18&&(I=11+Dt(o,f,127),f+=7);I--;)k[O++]=H}}var E=k.subarray(0,v),q=k.subarray(v);m=mn(E),y=mn(q),p=Gt(E,m,1),d=Gt(q,y,1)}else Lt(1);else{var b=wn(f)+4,C=o[b-4]|o[b-3]<<8,x=b+C;if(x>r){l&&Lt(0);break}a&&h(u+C),t.set(o.subarray(b,x),u),e.b=u+=C,e.p=f=x*8,e.f=c;continue}if(f>P){l&&Lt(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,$=(1<<y)-1,W=f;;W=f){var H=p[xn(o,f)&L],F=H>>4;if(f+=H&15,f>P){l&&Lt(0);break}if(H||Lt(2),F<256)t[u++]=F;else if(F==256){W=f,p=null;break}else{var V=F-254;if(F>264){var O=F-257,R=Ne[O];V=Dt(o,f,(1<<R)-1)+er[O],f+=R}var Y=d[xn(o,f)&$],Z=Y>>4;Y||Lt(3),f+=Y&15;var q=gi[Z];if(Z>3){var R=je[Z];q+=xn(o,f)&(1<<R)-1,f+=R}if(f>P){l&&Lt(0);break}a&&h(u+131072);var nt=u+V;if(u<q){var Wt=s-q,Bt=Math.min(q,nt);for(Wt+u<0&&Lt(3);u<Bt;++u)t[u]=n[Wt+u]}for(;u<nt;++u)t[u]=t[u-q]}}e.l=p,e.p=W,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=d,e.n=y)}while(!c);return u!=t.length&&i?ir(t,0,u):t.subarray(0,u)},Xt=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8},Me=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8,o[n+2]|=t>>16},vn=function(o,e){for(var t=[],n=0;n<o.length;++n)o[n]&&t.push({s:n,f:o[n]});var r=t.length,s=t.slice();if(!r)return{t:lr,l:0};if(r==1){var i=new ft(t[0].s+1);return i[t[0].s]=1,{t:i,l:1}}t.sort(function(x,v){return x.f-v.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=s[0].s,n=1;n<r;++n)s[n].s>u&&(u=s[n].s);var p=new It(u+1),d=bn(t[c-1],p,0);if(d>e){var n=0,m=0,y=d-e,P=1<<y;for(s.sort(function(v,S){return p[S.s]-p[v.s]||v.f-S.f});n<r;++n){var T=s[n].s;if(p[T]>e)m+=P-(1<<d-p[T]),p[T]=e;else break}for(m>>=y;m>0;){var b=s[n].s;p[b]<e?m-=1<<e-p[b]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;p[C]==e&&(--p[C],++m)}d=e}return{t:new ft(p),l:d}},bn=function(o,e,t){return o.s==-1?Math.max(bn(o.l,e,t+1),bn(o.r,e,t+1)):e[o.s]=t},sr=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new It(++e),n=0,r=o[0],s=1,i=function(l){t[n++]=l},a=1;a<=e;++a)if(o[a]==r&&a!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(r),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(r);s=1,r=o[a]}return{c:t.subarray(0,n),n:e}},Ce=function(o,e){for(var t=0,n=0;n<e.length;++n)t+=o[n]*e[n];return t},or=function(o,e,t){var n=t.length,r=wn(e+2);o[r]=n&255,o[r+1]=n>>8,o[r+2]=o[r]^255,o[r+3]=o[r+1]^255;for(var s=0;s<n;++s)o[r+s+4]=t[s];return(r+4+n)*8},ar=function(o,e,t,n,r,s,i,a,l,h,c){Xt(e,c++,t),++r[256];for(var f=vn(r,15),u=f.t,p=f.l,d=vn(s,15),m=d.t,y=d.l,P=sr(u),T=P.c,b=P.n,C=sr(m),x=C.c,v=C.n,S=new It(19),w=0;w<T.length;++w)++S[T[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var k=vn(S,7),z=k.t,O=k.l,B=19;B>4&&!z[dn[B-1]];--B);var U=h+5<<3,D=Ce(r,Yt)+Ce(s,Se)+i,_=Ce(r,u)+Ce(s,m)+i+14+3*B+Ce(S,z)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&U<=D&&U<=_)return or(e,c,o.subarray(l,l+h));var H,I,E,q;if(Xt(e,c,1+(_<D)),c+=2,_<D){H=Gt(u,p,0),I=u,E=Gt(m,y,0),q=m;var L=Gt(z,O,0);Xt(e,c,b-257),Xt(e,c+5,v-1),Xt(e,c+10,B-4),c+=14;for(var w=0;w<B;++w)Xt(e,c+3*w,z[dn[w]]);c+=3*B;for(var $=[T,x],W=0;W<2;++W)for(var F=$[W],w=0;w<F.length;++w){var V=F[w]&31;Xt(e,c,L[V]),c+=z[V],V>15&&(Xt(e,c,F[w]>>5&127),c+=F[w]>>12)}}else H=mi,I=Yt,E=wi,q=Se;for(var w=0;w<a;++w){var R=n[w];if(R>255){var V=R>>18&31;Me(e,c,H[V+257]),c+=I[V+257],V>7&&(Xt(e,c,R>>23&31),c+=Ne[V]);var Y=R&31;Me(e,c,E[Y]),c+=q[Y],Y>3&&(Me(e,c,R>>5&8191),c+=je[Y])}else Me(e,c,H[R]),c+=I[R]}return Me(e,c,H[256]),c+I[256]},Mi=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lr=new ft(0),Ci=function(o,e,t,n,r,s){var i=s.z||o.length,a=new ft(n+i+5*(1+Math.ceil(i/7e3))+r),l=a.subarray(n,a.length-r),h=s.l,c=(s.r||0)&7;if(e){c&&(l[0]=s.r>>3);for(var f=Mi[e-1],u=f>>13,p=f&8191,d=(1<<t)-1,m=s.p||new It(32768),y=s.h||new It(d+1),P=Math.ceil(t/3),T=2*P,b=function(kt){return(o[kt]^o[kt+1]<<P^o[kt+2]<<T)&d},C=new pn(25e3),x=new It(288),v=new It(32),S=0,w=0,k=s.i||0,z=0,O=s.w||0,B=0;k+2<i;++k){var U=b(k),D=k&32767,_=y[U];if(m[D]=_,y[U]=D,O<=k){var H=i-k;if((S>7e3||z>24576)&&(H>423||!h)){c=ar(o,l,0,C,x,v,w,z,B,k-B,c),z=S=w=0,B=k;for(var I=0;I<286;++I)x[I]=0;for(var I=0;I<30;++I)v[I]=0}var E=2,q=0,L=p,$=D-_&32767;if(H>2&&U==b(k-$))for(var W=Math.min(u,H)-1,F=Math.min(32767,k),V=Math.min(258,H);$<=F&&--L&&D!=_;){if(o[k+E]==o[k+E-$]){for(var R=0;R<V&&o[k+R]==o[k+R-$];++R);if(R>E){if(E=R,q=$,R>W)break;for(var Y=Math.min($,R-2),Z=0,I=0;I<Y;++I){var nt=k-$+I&32767,Wt=m[nt],Bt=nt-Wt&32767;Bt>Z&&(Z=Bt,_=nt)}}}D=_,_=m[D],$+=D-_&32767}if(q){C[z++]=268435456|yn[E]<<18|rr[q];var Ct=yn[E]&31,At=rr[q]&31;w+=Ne[Ct]+je[At],++x[257+Ct],++v[At],O=k+E,++S}else C[z++]=o[k],++x[o[k]]}}for(k=Math.max(k,O);k<i;++k)C[z++]=o[k],++x[o[k]];c=ar(o,l,h,C,x,v,w,z,B,k-B,c),h||(s.r=c&7|l[c/8|0]<<3,c-=7,s.h=y,s.p=m,s.i=k,s.w=O)}else{for(var k=s.w||0;k<i+h;k+=65535){var ht=k+65535;ht>=i&&(l[c/8|0]=h,ht=i),c=or(l,c+1,o.subarray(k,ht))}s.i=i}return ir(a,0,n+wn(c)+r)},hr=function(){var o=1,e=0;return{p:function(t){for(var n=o,r=e,s=t.length|0,i=0;i!=s;){for(var a=Math.min(i+2655,s);i<a;++i)r+=n+=t[i];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}o=n,e=r},d:function(){return o%=65521,e%=65521,(o&255)<<24|(o&65280)<<8|(e&255)<<8|e>>8}}},Pi=function(o,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),i=new ft(s.length+o.length);i.set(s),i.set(o,s.length),o=i,r.w=s.length}return Ci(o,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,n,r)},cr=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Ti=function(o,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(o[0]=120,o[1]=n<<6|(e.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,e.dictionary){var r=hr();r.p(e.dictionary),cr(o,2,r.d())}},Ai=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&Lt(6,"invalid zlib data"),(o[1]>>5&1)==1&&Lt(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function ki(o,e){e||(e={});var t=hr();t.p(o);var n=Pi(o,e,e.dictionary?6:2,4);return Ti(n,e),cr(n,n.length-4,t.d()),n}function Ii(o,e){return Si(o.subarray(Ai(o),-4),{i:2},e,e)}var _i=typeof TextDecoder<"u"&&new TextDecoder,Oi=0;try{_i.decode(lr,{stream:!0}),Oi=1}catch{}const Bi="modern-font";function Pe(o,e){if(!o)throw new Error(`[${Bi}] ${e}`)}function Ei(o){if("buffer"in o){const e=o.buffer;return o.byteOffset>0||o.byteLength<o.buffer.byteLength?e.slice(o.byteOffset,o.byteOffset+o.byteLength):e}else return o}function ce(o){return"buffer"in o?new DataView(o.buffer,o.byteOffset,o.byteLength):new DataView(o)}function Di(o){let e="";for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function Ge(o){o=Di(o);const e=[];for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Li(o){let e="";for(let t=0,n=o.length;t<n;t++)o[t]<127?e+=String.fromCharCode(o[t]):e+=`%${(256+o[t]).toString(16).slice(1)}`;return unescape(e)}function Ui(o){let e="";for(let t=0,n=o.length;t<n;t+=2)e+=String.fromCharCode((o[t]<<8)+o[t+1]);return e}var Fi=Object.defineProperty,ut=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Fi(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(o,e){Object.defineProperty(o.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,s){super(Ei(t),n,r);M(this,"cursor",0);this.littleEndian=s}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,s)=>this.read(t.type,t.offset+s));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,s)=>{this.write(t.type,n[s],t.offset+s)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const s=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,i=this,a=(h=i[s])==null?void 0:h.bind(i),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,s]=this.readBytes(t,3);return(n<<16)+(r<<8)+s}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let s=0;s<n;++s)r.push(this.getUint8(t+s));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let s="";for(let i=0,a=r.length;i<a;i++)s+=String.fromCharCode(r[i]);return s}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),s=new Date;return s.setTime(r*1e3+-20775456e5),s}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,s=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const i=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[i])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,s);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let s=0,i=t.length,a;s<i;++s)a=t.charCodeAt(s)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const s=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(s,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let s=0;s<r;++s)this.setUint8(n+s,t[s])}else{const s=ce(t);r=s.byteLength;for(let i=0;i<r;++i)this.setUint8(n+i,s.getUint8(i))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ut([pt()],at.prototype,"readInt8"),ut([pt()],at.prototype,"readInt16"),ut([pt()],at.prototype,"readInt32"),ut([pt()],at.prototype,"readUint8"),ut([pt()],at.prototype,"readUint16"),ut([pt()],at.prototype,"readUint32"),ut([pt()],at.prototype,"readFloat32"),ut([pt()],at.prototype,"readFloat64"),ut([pt()],at.prototype,"writeInt8"),ut([pt()],at.prototype,"writeInt16"),ut([pt()],at.prototype,"writeInt32"),ut([pt()],at.prototype,"writeUint8"),ut([pt()],at.prototype,"writeUint16"),ut([pt()],at.prototype,"writeUint32"),ut([pt()],at.prototype,"writeFloat32"),ut([pt()],at.prototype,"writeFloat64");const fr=new WeakMap;function g(o){const e=typeof o=="object"?o:{type:o},{size:t=1,type:n}=e;return(r,s)=>{if(typeof s!="string")return;let i=fr.get(r);i||(i={columns:[],byteLength:0},fr.set(r,i));const a={...e,name:s,byteLength:t*Re[n],offset:e.offset??i.columns.reduce((l,h)=>l+h.byteLength,0)};i.columns.push(a),i.byteLength=i.columns.reduce((l,h)=>l+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class Sn extends Ot{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(e){return new FontFace(e,this.view.buffer)}}var $i=Object.defineProperty,wt=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&$i(e,t,r),r};const vt=class fi extends Sn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,s=n.name.names,i=Ge(s.fontFamily||""),a=i.length,l=Ge(s.fontStyle||""),h=l.length,c=Ge(s.version||""),f=c.length,u=Ge(s.fullName||""),p=u.length,d=86+a+4+h+4+f+4+p+2+t.view.byteLength,m=new fi(new ArrayBuffer(d),0,d,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(i),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var zi=Object.defineProperty,qe=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&zi(e,t,r),r};class Te extends Ot{constructor(e,t){super(e,t,16)}}qe([g({type:"char",size:4})],Te.prototype,"tag"),qe([g("uint32")],Te.prototype,"checkSum"),qe([g("uint32")],Te.prototype,"offset"),qe([g("uint32")],Te.prototype,"length");const Mn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class ur{constructor(e){M(this,"index");M(this,"name");M(this,"isComposite",!1);M(this,"components",[]);M(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.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=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},s){const i=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:a=i,yScale:l=i}=r,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const p=h[f];p.type==="M"?c.push({type:"M",x:e+p.x*a,y:t+-p.y*l}):p.type==="L"?c.push({type:"L",x:e+p.x*a,y:t+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:e+p.x1*a,y1:t+-p.y1*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="C"?c.push({type:"C",x1:e+p.x1*a,y1:t+-p.y1*l,x2:e+p.x2*a,y2:t+-p.y2*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class ji extends ur{parse(e,t,n){const r=this,{nominalWidthX:s,defaultWidthX:i,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,p,d;const m=[],y=[];let P=0,T=!1,b=!1,C=i,x=0,v=0;function S(D,_){m.push({type:"L",x:D,y:_})}function w(D,_,H,I,E,q){m.push({type:"C",x1:D,y1:_,x2:H,y2:I,x:E,y:q})}function k(D,_){b&&h!==2&&z(),b=!0,m.push({type:"M",x:D,y:_})}function z(){m.push({type:"Z"})}function O(D){m.push(...D)}function B(){y.length%2!==0&&!T&&(C=y.shift()+s),P+=y.length>>1,y.length=0,T=!0}function U(D){let _,H,I,E,q,L,$,W,F,V,R,Y,Z=0;for(;Z<D.length;){let nt=D[Z++];switch(nt){case 1:B();break;case 3:B();break;case 4:y.length>1&&!T&&(C=y.shift()+s,T=!0),v+=y.pop(),k(x,v);break;case 5:for(;y.length>0;)x+=y.shift(),v+=y.shift(),S(x,v);break;case 6:for(;y.length>0&&(x+=y.shift(),S(x,v),y.length!==0);)v+=y.shift(),S(x,v);break;case 7:for(;y.length>0&&(v+=y.shift(),S(x,v),y.length!==0);)x+=y.shift(),S(x,v);break;case 8:for(;y.length>0;)f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d+y.shift(),w(f,u,p,d,x,v);break;case 10:q=y.pop()+l,L=e.subrs[q],L&&U(L);break;case 11:return;case 12:switch(nt=D[Z],Z+=1,nt){case 35:f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),$=p+y.shift(),W=d+y.shift(),F=$+y.shift(),V=W+y.shift(),R=F+y.shift(),Y=V+y.shift(),x=R+y.shift(),v=Y+y.shift(),y.shift(),w(f,u,p,d,$,W),w(F,V,R,Y,x,v);break;case 34:f=x+y.shift(),u=v,p=f+y.shift(),d=u+y.shift(),$=p+y.shift(),W=d,F=$+y.shift(),V=d,R=F+y.shift(),Y=v,x=R+y.shift(),w(f,u,p,d,$,W),w(F,V,R,Y,x,v);break;case 36:f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),$=p+y.shift(),W=d,F=$+y.shift(),V=d,R=F+y.shift(),Y=V+y.shift(),x=R+y.shift(),w(f,u,p,d,$,W),w(F,V,R,Y,x,v);break;case 37:f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),$=p+y.shift(),W=d+y.shift(),F=$+y.shift(),V=W+y.shift(),R=F+y.shift(),Y=V+y.shift(),Math.abs(R-x)>Math.abs(Y-v)?x=R+y.shift():v=Y+y.shift(),w(f,u,p,d,$,W),w(F,V,R,Y,x,v);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Wt=Mn[y.pop()],Bt=Mn[y.pop()],Ct=y.pop(),At=y.pop();if(Wt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),kt=e.charset.indexOf(Bt);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Ct}),O(n.get(kt).pathCommands);const zt=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let Nt=0;Nt<zt.length;Nt+=1){const Et=zt[Nt];Et.type!=="Z"&&(Et.x+=At,Et.y+=Ct),(Et.type==="Q"||Et.type==="C")&&(Et.x1+=At,Et.y1+=Ct),Et.type==="C"&&(Et.x2+=At,Et.y2+=Ct)}O(zt)}}else y.length>0&&!T&&(C=y.shift()+s,T=!0);b&&h!==2&&(z(),b=!1);break;case 18:B();break;case 19:case 20:B(),Z+=P+7>>3;break;case 21:y.length>2&&!T&&(C=y.shift()+s,T=!0),v+=y.pop(),x+=y.pop(),k(x,v);break;case 22:y.length>1&&!T&&(C=y.shift()+s,T=!0),x+=y.pop(),k(x,v);break;case 23:B();break;case 24:for(;y.length>2;)f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d+y.shift(),w(f,u,p,d,x,v);x+=y.shift(),v+=y.shift(),S(x,v);break;case 25:for(;y.length>6;)x+=y.shift(),v+=y.shift(),S(x,v);f=x+y.shift(),u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d+y.shift(),w(f,u,p,d,x,v);break;case 26:for(y.length%2&&(x+=y.shift());y.length>0;)f=x,u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p,v=d+y.shift(),w(f,u,p,d,x,v);break;case 27:for(y.length%2&&(v+=y.shift());y.length>0;)f=x+y.shift(),u=v,p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d,w(f,u,p,d,x,v);break;case 28:_=D[Z],H=D[Z+1],y.push((_<<24|H<<16)>>16),Z+=2;break;case 29:q=y.pop()+a,L=e.gsubrs[q],L&&U(L);break;case 30:for(;y.length>0&&(f=x,u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d+(y.length===1?y.shift():0),w(f,u,p,d,x,v),y.length!==0);)f=x+y.shift(),u=v,p=f+y.shift(),d=u+y.shift(),v=d+y.shift(),x=p+(y.length===1?y.shift():0),w(f,u,p,d,x,v);break;case 31:for(;y.length>0&&(f=x+y.shift(),u=v,p=f+y.shift(),d=u+y.shift(),v=d+y.shift(),x=p+(y.length===1?y.shift():0),w(f,u,p,d,x,v),y.length!==0);)f=x,u=v+y.shift(),p=f+y.shift(),d=u+y.shift(),x=p+y.shift(),v=d+(y.length===1?y.shift():0),w(f,u,p,d,x,v);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?y.push(nt-139):nt<251?(_=D[Z],Z+=1,y.push((nt-247)*256+_+108)):nt<255?(_=D[Z],Z+=1,y.push(-(nt-251)*256-_-108)):(_=D[Z],H=D[Z+1],I=D[Z+2],E=D[Z+3],Z+=4,y.push((_<<24|H<<16|I<<8|E)/65536))}}}U(t),this.pathCommands=m,T&&(this.advanceWidth=C)}}class pr{constructor(e){M(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const s=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);s&&(n.unicode??(n.unicode=s[0]),n.unicodes??(n.unicodes=s)),this._items[e]=n}return n}}class Gi extends pr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new ji({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var Ri=Object.defineProperty,dr=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Ri(e,t,r),r};class Ve extends Ot{constructor(t,n,r,s){super(t,n,r,s);M(this,"_offsets");M(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,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const s=[];for(let i=0,a=n+1;i<a;i++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();s.push(h)}return s}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,s=r+n[t],a=r+n[t+1]-s;return this._isString?this.view.readString(s,a):this.view.readBytes(s,a)}}dr([g("uint16")],Ve.prototype,"count"),dr([g("uint8")],Ve.prototype,"offsetSize");class We extends Ve{constructor(){super(...arguments);M(this,"_isString",!1)}}class yr extends Ve{constructor(){super(...arguments);M(this,"_isString",!0)}}const qi=[".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"],Vi=[".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"],Wi=[".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"],Xi=[".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 Xe(o,e){return e<=390?qi[e]:o[e-391]}function J(o,e="number",t){return(n,r)=>{if(typeof r!="string")return;const s={type:e,operator:o,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(s)},set(i){this._setProp(s,i)},configurable:!0,enumerable:!0})}}class gr extends Ot{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),a=i>>4,l=i&15;if(a===r||(n+=s[a],l===r))break;n+=s[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,s,i,a;if(t===28)return r=n.readUint8(),s=n.readUint8(),r<<8|s;if(t===29)return r=n.readUint8(),s=n.readUint8(),i=n.readUint8(),a=n.readUint8(),r<<24|s<<16|i<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,s={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),s[i]=n,n=[]):n.push(this._readOperand(i))}return s}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return Xe(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Hi=Object.defineProperty,Cn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Hi(e,t,r),r};class He extends gr{}Cn([J(19)],He.prototype,"subrs"),Cn([J(20)],He.prototype,"defaultWidthX"),Cn([J(21)],He.prototype,"nominalWidthX");var Zi=Object.defineProperty,rt=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Zi(e,t,r),r};class et extends gr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(o,e=o){return t=>{fe.tableDefinitions.set(o,{tag:o,prop:e,class:t}),Object.defineProperty(fe.prototype,e,{get(){return this.get(o)},set(n){return this.set(o,n)},configurable:!0,enumerable:!0})}}const he=class he{constructor(e){M(this,"tables",new Map);M(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.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 numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,s=Array.from({length:r}),i=t.get(0);for(let a=0;a<r;a+=1)s[a]=t.get(n[a])||i;return s}getPathCommands(e,t,n,r,s){const i=[];return this.forEachGlyph(e,t,n,r,s,(a,l,h,c,f)=>{i.push(...a.getPathCommands(l,h,c,f,this))}),i}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,s={},i){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];i.call(this,c,t,n,r,s),c.advanceWidth&&(t+=c.advanceWidth*a),s.letterSpacing?t+=s.letterSpacing*r:s.tracking&&(t+=s.tracking/1e3*r)}return t}clone(){return new he(this.tableViews)}delete(e){const t=he.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=he.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=he.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const s=this.tableViews.get(e);if(!s)return;n=new r(s.buffer,s.byteOffset,s.byteLength).setSFNT(this),this.tables.set(t.prop,n)}}return n}};M(he,"tableDefinitions",new Map);let fe=he;class yt extends Ot{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var Yi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Ae=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ki(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Yi(e,t,r),r};let ue=class extends yt{constructor(e,t,n,r){super(e,t,n,r);M(this,"_glyphs");M(this,"privateDict");M(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Gi(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new yr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new yr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const s=this.topDict.private[0],i=this.topDict.private[1];s&&(this.privateDict=new He(t,n+i,s).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+i+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Vi:this.topDict.charset===1?this.charset=Wi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Mn:this.topDict.encoding===1?this.encoding=Ni:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let s,i,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(s=0;s<t;s+=1)i=r.readUint16(),l.push(Xe(n,i));else if(h===1)for(;l.length<=t;)for(i=r.readUint16(),a=r.readUint8(),s=0;s<=a;s+=1)l.push(Xe(n,i)),i+=1;else if(h===2)for(;l.length<=t;)for(i=r.readUint16(),a=r.readUint16(),s=0;s<=a;s+=1)l.push(Xe(n,i)),i+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const s={},i=t.readUint8();if(i===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),s[r]=n}else if(i===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)s[c]=r,r+=1}}else console.warn(`unknown encoding format:${i}`);return s}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Ae([g("uint8")],ue.prototype,"majorVersion",2),Ae([g("uint8")],ue.prototype,"minorVersion",2),Ae([g("uint8")],ue.prototype,"headerSize",2),Ae([g("uint8")],ue.prototype,"offsetSize",2),ue=Ae([dt("CFF ","cff")],ue);var Qi=Object.defineProperty,Ze=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Qi(e,t,r),r};const ke=class ui extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new ui;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Ze([g("uint16")],ke.prototype,"format"),Ze([g("uint16")],ke.prototype,"length"),Ze([g("uint16")],ke.prototype,"language"),Ze([g({type:"uint8",size:256})],ke.prototype,"glyphIndexArray");let mr=ke;var Ji=Object.defineProperty,Pn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Ji(e,t,r),r};class Ye extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,i=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<s[0].firstCode||h>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(h-s[0].firstCode)>=i.length?l=0:(l=i[s[0].idRangeOffset+(h-s[0].firstCode)],l!==0&&(l=l+s[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=s[c].entryCount;f<u;f++)if(s[c].idRangeOffset+f>=i.length?l=0:(l=i[s[c].idRangeOffset+f],l!==0&&(l=l+s[c].idDelta)),l!==0&&l<e){const p=(h<<8|f+s[c].firstCode)%65535;t.set(p,l)}}return t}}Pn([g("uint16")],Ye.prototype,"format"),Pn([g("uint16")],Ye.prototype,"length"),Pn([g("uint16")],Ye.prototype,"language");function xr(o){return o>32767?o-65536:o<-32767?o+65536:o}function wr(o,e){let t;const n=[];let r={};return o.forEach((s,i)=>{e&&i>e||((!t||i!==t.unicode+1||s!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:i,startId:s,delta:xr(s-i)}):(r.start=Number(i),r.startId=s,r.delta=xr(s-i))),t={unicode:i,glyphIndex:s})}),t&&(r.end=t.unicode,n.push(r)),n}var ts=Object.defineProperty,re=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&ts(e,t,r),r};const Kt=class pi extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=wr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,i=new pi(new ArrayBuffer(24+t.length*8));return i.format=4,i.length=i.view.byteLength,i.language=0,i.segCountX2=n*2,i.searchRange=s,i.entrySelector=r,i.rangeShift=2*n-s,i.endCode=[...t.map(a=>a.end),65535],i.reservedPad=0,i.startCode=[...t.map(a=>a.start),65535],i.idDelta=[...t.map(a=>a.delta),1],i.idRangeOffset=Array.from({length:n},()=>0),i}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,i=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=s[h];c<=f;++c)if(i[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+i[h]/2+(c-r[h])-n,p=l[u];p!==0?e.set(c,(p+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};re([g("uint16")],Kt.prototype,"format"),re([g("uint16")],Kt.prototype,"length"),re([g("uint16")],Kt.prototype,"language"),re([g("uint16")],Kt.prototype,"segCountX2"),re([g("uint16")],Kt.prototype,"searchRange"),re([g("uint16")],Kt.prototype,"entrySelector"),re([g("uint16")],Kt.prototype,"rangeShift");let vr=Kt;var es=Object.defineProperty,Ie=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&es(e,t,r),r};class pe extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}Ie([g("uint16")],pe.prototype,"format"),Ie([g("uint16")],pe.prototype,"length"),Ie([g("uint16")],pe.prototype,"language"),Ie([g("uint16")],pe.prototype,"firstCode"),Ie([g("uint16")],pe.prototype,"entryCount");var ns=Object.defineProperty,_e=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&ns(e,t,r),r};const de=class di extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=wr(e),n=new di(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const s=t[n];let i=s.startGlyphCode,a=s.startCharCode;const l=s.endCharCode;for(;a<=l;)e.set(a++,i++)}return e}};_e([g("uint16")],de.prototype,"format"),_e([g("uint16")],de.prototype,"reserved"),_e([g("uint32")],de.prototype,"length"),_e([g("uint32")],de.prototype,"language"),_e([g("uint32")],de.prototype,"nGroups");let br=de;var rs=Object.defineProperty,Tn=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&rs(e,t,r),r};class Ke extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:s}=t[n];s.forEach(i=>{e.set(i.unicodeValue,i.glyphID)})}return e}}Tn([g("uint16")],Ke.prototype,"format"),Tn([g("uint32")],Ke.prototype,"length"),Tn([g("uint32")],Ke.prototype,"numVarSelectorRecords");var is=Object.defineProperty,ss=Object.getOwnPropertyDescriptor,An=(o,e,t,n)=>{for(var r=n>1?void 0:n?ss(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&is(e,t,r),r};let Oe=class extends yt{constructor(){super(...arguments);M(this,"_unicodeToGlyphIndexMap");M(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),n=vr.from(e),r=mr.from(e),s=t?br.from(e):void 0,i=4+(s?32:24),a=i+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:i},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:i},s&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Oe(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(n.view,i),c.view.writeBytes(r.view,a),s&&c.view.writeBytes(s.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,s=n.length;r<s;r++){const i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new mr(this.view.buffer,t.offset);break;case 2:r=new Ye(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new vr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new pe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new br(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ke(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,n=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,r=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,s=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,i=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[]])}};An([g("uint16")],Oe.prototype,"version",2),An([g("uint16")],Oe.prototype,"numberSubtables",2),Oe=An([dt("cmap")],Oe);class os extends ur{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const s=e[r];n.push(s),s.lastPointOfContour&&(t.push(n),n=[])}return Pe(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const s=e[r],i={x:t.xScale*s.x+t.scale10*s.y+t.dx,y:t.scale01*s.x+t.yScale*s.y+t.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(i)}return n}_parseGlyphCoordinate(e,t,n,r,s){let i;return(t&r)>0?(i=e.view.readUint8(),(t&s)===0&&(i=-i),i=n+i):(t&s)>0?i=n:i=n+e.view.readInt16(),i}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Pe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;Pe(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let p,d=0;for(;d<f;)if(p=e.view.readUint8(),u.push(p),d++,p&8&&d<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(p),d++}if(Pe(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let y;if(f>0){for(let b=0;b<f;b+=1)p=u[b],y={},y.onCurve=!!(p&1),y.lastPointOfContour=a.includes(b),m.push(y);let P=0;for(let b=0;b<f;b+=1)p=u[b],y=m[b],y.x=this._parseGlyphCoordinate(e,p,P,2,16),P=y.x;let T=0;for(let b=0;b<f;b+=1)p=u[b],y=m[b],y.y=this._parseGlyphCoordinate(e,p,T,4,32),T=y.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Pe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],p)[0],p.dx=f.x-u.x,p.dy=f.y-u.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const s=[],i=this._parseContours(this.points);for(let a=0,l=i.length;a<l;++a){const h=i[a];let c=h[h.length-1],f=h[0];c.onCurve?s.push({type:"M",x:c.x,y:c.y}):f.onCurve?s.push({type:"M",x:f.x,y:f.y}):s.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,p=h.length;u<p;++u)if(c=f,f=h[(u+1)%p],c.onCurve)s.push({type:"L",x:c.x,y:c.y});else{let d=f;f.onCurve||(d={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),s.push({type:"Q",x1:c.x,y1:c.y,x:d.x,y:d.y})}s.push({type:"Z"})}this.pathCommands=s}}class as extends pr{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new os({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var ls=Object.getOwnPropertyDescriptor,hs=(o,e,t,n)=>{for(var r=n>1?void 0:n?ls(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let kn=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,s)=>r+s.byteLength,0),n=new kn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new as(this._sfnt))}};kn=hs([dt("glyf")],kn);var cs=Object.getOwnPropertyDescriptor,fs=(o,e,t,n)=>{for(var r=n>1?void 0:n?cs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let Sr=class extends yt{};Sr=fs([dt("GPOS","gpos")],Sr);var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ie=(o,e,t,n)=>{for(var r=n>1?void 0:n?ps(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&us(e,t,r),r};let Qt=class extends yt{};ie([g("uint16")],Qt.prototype,"majorVersion",2),ie([g("uint16")],Qt.prototype,"minorVersion",2),ie([g("uint16")],Qt.prototype,"scriptListOffset",2),ie([g("uint16")],Qt.prototype,"featureListOffset",2),ie([g("uint16")],Qt.prototype,"lookupListOffset",2),ie([g("uint16")],Qt.prototype,"featureVariationsOffset",2),Qt=ie([dt("GSUB","gsub")],Qt);var ds=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,ot=(o,e,t,n)=>{for(var r=n>1?void 0:n?ys(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&ds(e,t,r),r};let st=class extends yt{constructor(o=new ArrayBuffer(54),e){super(o,e,Math.min(54,o.byteLength-(e??0)))}};ot([g("fixed")],st.prototype,"version",2),ot([g("fixed")],st.prototype,"fontRevision",2),ot([g("uint32")],st.prototype,"checkSumAdjustment",2),ot([g("uint32")],st.prototype,"magickNumber",2),ot([g("uint16")],st.prototype,"flags",2),ot([g("uint16")],st.prototype,"unitsPerEm",2),ot([g({type:"longDateTime"})],st.prototype,"created",2),ot([g({type:"longDateTime"})],st.prototype,"modified",2),ot([g("int16")],st.prototype,"xMin",2),ot([g("int16")],st.prototype,"yMin",2),ot([g("int16")],st.prototype,"xMax",2),ot([g("int16")],st.prototype,"yMax",2),ot([g("uint16")],st.prototype,"macStyle",2),ot([g("uint16")],st.prototype,"lowestRecPPEM",2),ot([g("int16")],st.prototype,"fontDirectionHint",2),ot([g("int16")],st.prototype,"indexToLocFormat",2),ot([g("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var gs=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,bt=(o,e,t,n)=>{for(var r=n>1?void 0:n?ms(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&gs(e,t,r),r};let gt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};bt([g("fixed")],gt.prototype,"version",2),bt([g("int16")],gt.prototype,"ascent",2),bt([g("int16")],gt.prototype,"descent",2),bt([g("int16")],gt.prototype,"lineGap",2),bt([g("uint16")],gt.prototype,"advanceWidthMax",2),bt([g("int16")],gt.prototype,"minLeftSideBearing",2),bt([g("int16")],gt.prototype,"minRightSideBearing",2),bt([g("int16")],gt.prototype,"xMaxExtent",2),bt([g("int16")],gt.prototype,"caretSlopeRise",2),bt([g("int16")],gt.prototype,"caretSlopeRun",2),bt([g("int16")],gt.prototype,"caretOffset",2),bt([g({type:"int16",size:4})],gt.prototype,"reserved",2),bt([g("int16")],gt.prototype,"metricDataFormat",2),bt([g("uint16")],gt.prototype,"numOfLongHorMetrics",2),gt=bt([dt("hhea")],gt);var xs=Object.getOwnPropertyDescriptor,ws=(o,e,t,n)=>{for(var r=n>1?void 0:n?xs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let In=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new In(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((s,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};In=ws([dt("hmtx")],In);var vs=Object.getOwnPropertyDescriptor,bs=(o,e,t,n)=>{for(var r=n>1?void 0:n?vs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let Mr=class extends yt{};Mr=bs([dt("kern","kern")],Mr);var Ss=Object.getOwnPropertyDescriptor,Ms=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ss(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new _n(new ArrayBuffer(n));return e.forEach(s=>{t?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};_n=Ms([dt("loca")],_n);var Cs=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,mt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ps(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Cs(e,t,r),r};let lt=class extends yt{constructor(o=new ArrayBuffer(32),e){super(o,e,Math.min(32,o.byteLength-(e??0)))}};mt([g("fixed")],lt.prototype,"version",2),mt([g("uint16")],lt.prototype,"numGlyphs",2),mt([g("uint16")],lt.prototype,"maxPoints",2),mt([g("uint16")],lt.prototype,"maxContours",2),mt([g("uint16")],lt.prototype,"maxComponentPoints",2),mt([g("uint16")],lt.prototype,"maxComponentContours",2),mt([g("uint16")],lt.prototype,"maxZones",2),mt([g("uint16")],lt.prototype,"maxTwilightPoints",2),mt([g("uint16")],lt.prototype,"maxStorage",2),mt([g("uint16")],lt.prototype,"maxFunctionDefs",2),mt([g("uint16")],lt.prototype,"maxInstructionDefs",2),mt([g("uint16")],lt.prototype,"maxStackElements",2),mt([g("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([g("uint16")],lt.prototype,"maxComponentElements",2),mt([g("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var Ts=Object.defineProperty,As=Object.getOwnPropertyDescriptor,Qe=(o,e,t,n)=>{for(var r=n>1?void 0:n?As(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Ts(e,t,r),r};const Cr={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"},On={Macintosh:1,Microsoft:3},ks={Default:0},Pr={UCS2:1};let Be=class extends yt{constructor(){super(...arguments);M(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=On.Macintosh,s=ks.Default,i=0;t.some(l=>l.platform===On.Microsoft&&l.encoding===Pr.UCS2&&l.language===1033)&&(r=On.Microsoft,s=Pr.UCS2,i=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===s&&h.language===i&&Cr[h.nameId]&&(a[Cr[h.nameId]]=i===0?Li(h.name):Ui(h.name))}return a}};Qe([g("uint16")],Be.prototype,"format",2),Qe([g("uint16")],Be.prototype,"count",2),Qe([g("uint16")],Be.prototype,"stringOffset",2),Be=Qe([dt("name")],Be);var Is=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,j=(o,e,t,n)=>{for(var r=n>1?void 0:n?_s(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Is(e,t,r),r};let N=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};j([g("uint16")],N.prototype,"version",2),j([g("int16")],N.prototype,"xAvgCharWidth",2),j([g("uint16")],N.prototype,"usWeightClass",2),j([g("uint16")],N.prototype,"usWidthClass",2),j([g("uint16")],N.prototype,"fsType",2),j([g("uint16")],N.prototype,"ySubscriptXSize",2),j([g("uint16")],N.prototype,"ySubscriptYSize",2),j([g("uint16")],N.prototype,"ySubscriptXOffset",2),j([g("uint16")],N.prototype,"ySubscriptYOffset",2),j([g("uint16")],N.prototype,"ySuperscriptXSize",2),j([g("uint16")],N.prototype,"ySuperscriptYSize",2),j([g("uint16")],N.prototype,"ySuperscriptXOffset",2),j([g("uint16")],N.prototype,"ySuperscriptYOffset",2),j([g("uint16")],N.prototype,"yStrikeoutSize",2),j([g("uint16")],N.prototype,"yStrikeoutPosition",2),j([g("uint16")],N.prototype,"sFamilyClass",2),j([g({type:"uint8"})],N.prototype,"bFamilyType",2),j([g({type:"uint8"})],N.prototype,"bSerifStyle",2),j([g({type:"uint8"})],N.prototype,"bWeight",2),j([g({type:"uint8"})],N.prototype,"bProportion",2),j([g({type:"uint8"})],N.prototype,"bContrast",2),j([g({type:"uint8"})],N.prototype,"bStrokeVariation",2),j([g({type:"uint8"})],N.prototype,"bArmStyle",2),j([g({type:"uint8"})],N.prototype,"bLetterform",2),j([g({type:"uint8"})],N.prototype,"bMidline",2),j([g({type:"uint8"})],N.prototype,"bXHeight",2),j([g({type:"uint8",size:16})],N.prototype,"ulUnicodeRange",2),j([g({type:"char",size:4})],N.prototype,"achVendID",2),j([g("uint16")],N.prototype,"fsSelection",2),j([g("uint16")],N.prototype,"usFirstCharIndex",2),j([g("uint16")],N.prototype,"usLastCharIndex",2),j([g("int16")],N.prototype,"sTypoAscender",2),j([g("int16")],N.prototype,"sTypoDescender",2),j([g("int16")],N.prototype,"sTypoLineGap",2),j([g("uint16")],N.prototype,"usWinAscent",2),j([g("uint16")],N.prototype,"usWinDescent",2),j([g({offset:72,type:"uint8",size:8})],N.prototype,"ulCodePageRange",2),j([g({offset:72,type:"int16"})],N.prototype,"sxHeight",2),j([g("int16")],N.prototype,"sCapHeight",2),j([g("uint16")],N.prototype,"usDefaultChar",2),j([g("uint16")],N.prototype,"usBreakChar",2),j([g("uint16")],N.prototype,"usMaxContext",2),N=j([dt("OS/2","os2")],N);var Os=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Rt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Bs(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Os(e,t,r),r};let Ut=class extends yt{constructor(o=new ArrayBuffer(32),e,t){super(o,e,t)}};Rt([g("fixed")],Ut.prototype,"format",2),Rt([g("fixed")],Ut.prototype,"italicAngle",2),Rt([g("int16")],Ut.prototype,"underlinePosition",2),Rt([g("int16")],Ut.prototype,"underlineThickness",2),Rt([g("uint32")],Ut.prototype,"isFixedPitch",2),Rt([g("uint32")],Ut.prototype,"minMemType42",2),Rt([g("uint32")],Ut.prototype,"maxMemType42",2),Rt([g("uint32")],Ut.prototype,"minMemType1",2),Rt([g("uint32")],Ut.prototype,"maxMemType1",2),Ut=Rt([dt("post")],Ut);var Es=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,St=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ds(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&Es(e,t,r),r};let xt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};St([g("fixed")],xt.prototype,"version",2),St([g("int16")],xt.prototype,"vertTypoAscender",2),St([g("int16")],xt.prototype,"vertTypoDescender",2),St([g("int16")],xt.prototype,"vertTypoLineGap",2),St([g("int16")],xt.prototype,"advanceHeightMax",2),St([g("int16")],xt.prototype,"minTopSideBearing",2),St([g("int16")],xt.prototype,"minBottomSideBearing",2),St([g("int16")],xt.prototype,"yMaxExtent",2),St([g("int16")],xt.prototype,"caretSlopeRise",2),St([g("int16")],xt.prototype,"caretSlopeRun",2),St([g("int16")],xt.prototype,"caretOffset",2),St([g({type:"int16",size:4})],xt.prototype,"reserved",2),St([g("int16")],xt.prototype,"metricDataFormat",2),St([g("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Ls=Object.getOwnPropertyDescriptor,Us=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ls(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(r)||r);return r};let Bn=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new Bn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var s;const e=this._sfnt.maxp.numGlyphs,t=((s=this._sfnt.vhea)==null?void 0:s.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((i,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};Bn=Us([dt("vmtx")],Bn);var Fs=Object.defineProperty,Ee=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&Fs(e,t,r),r};class Ft extends Sn{constructor(){super(...arguments);M(this,"format","TrueType");M(this,"mimeType","font/ttf");M(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(ce(t).getUint32(0))}static checksum(t){const n=ce(t);let r=n.byteLength;for(;r%4;)r++;let s=0;for(let i=0,a=r/4;i<a;i+=4)i*4<r-4&&(s+=n.getUint32(i*4,!1));return s&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,s=Array.from(t.tableViews.values()).reduce((u,p)=>u+n(p.byteLength),0),i=new this(new ArrayBuffer(12+r*16+s));i.scalerType=65536,i.numTables=r;const a=Math.log(2);i.searchRange=Math.floor(Math.log(r)/a)*16,i.entrySelector=Math.floor(i.searchRange/a),i.rangeShift=r*16-i.searchRange;let l=12+r*16,h=0;const c=i.getDirectories();t.tableViews.forEach((u,p)=>{const d=c[h++];d.tag=p,d.checkSum=this.checksum(u),d.offset=l,d.length=u.byteLength,i.view.writeBytes(u,l),l+=n(d.length)});const f=i.createSFNT().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Te(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new fe(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}M(Ft,"signature",new Set([65536,1953658213,1954115633])),Ee([g("uint32")],Ft.prototype,"scalerType"),Ee([g("uint16")],Ft.prototype,"numTables"),Ee([g("uint16")],Ft.prototype,"searchRange"),Ee([g("uint16")],Ft.prototype,"entrySelector"),Ee([g("uint16")],Ft.prototype,"rangeShift");class Je extends Ft{constructor(){super(...arguments);M(this,"format","OpenType");M(this,"mimeType","font/otf")}static from(t){return super.from(t)}}M(Je,"signature",new Set([1330926671]));var $s=Object.defineProperty,De=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&$s(e,t,r),r};class ye extends Ot{constructor(e,t){super(e,t,20)}}De([g({type:"char",size:4})],ye.prototype,"tag"),De([g("uint32")],ye.prototype,"offset"),De([g("uint32")],ye.prototype,"compLength"),De([g("uint32")],ye.prototype,"origLength"),De([g("uint32")],ye.prototype,"origChecksum");var zs=Object.defineProperty,_t=(o,e,t,n)=>{for(var r=void 0,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=i(e,t,r)||r);return r&&zs(e,t,r),r};const Pt=(ee=class extends Sn{constructor(){super(...arguments);M(this,"format","WOFF");M(this,"mimeType","font/woff");M(this,"_sfnt")}get subfontFormat(){return Ft.is(this.flavor)?"TrueType":Je.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(ce(t).getUint32(0))}static checkSum(t){const n=ce(t),r=n.byteLength,s=Math.floor(r/4);let i=0,a=0;for(;a<s;)i+=n.getUint32(4*a++,!1);let l=r-s*4;if(l){let h=s*4;for(;l>0;)i+=n.getUint8(h)<<l*8,h++,l--}return i%4294967296}static from(t,n=new ArrayBuffer(0)){const r=u=>u+3&-4,s=[];t.tableViews.forEach((u,p)=>{const d=ce(ki(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));s.push({tag:p,view:d.byteLength<u.byteLength?d:u,rawView:u})});const i=s.length,a=s.reduce((u,p)=>u+r(p.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*i+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=i,l.totalSFNTSize=12+16*i+s.reduce((u,p)=>u+r(p.rawView.byteLength),0);let h=44+i*20,c=0;const f=l.getDirectories();return s.forEach(u=>{const p=f[c++];p.tag=u.tag,p.offset=h,p.compLength=u.view.byteLength,p.origChecksum=ee.checkSum(u.rawView),p.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(p.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new ye(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new fe(this.getDirectories().reduce((t,n)=>{const r=n.tag,s=this.view.byteOffset+n.offset,i=n.compLength,a=n.origLength,l=s+i;return t[r]=i>=a?new DataView(this.view.buffer,s,i):new DataView(Ii(new Uint8Array(this.view.buffer.slice(s,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);_t([g("uint32")],Pt.prototype,"signature"),_t([g("uint32")],Pt.prototype,"flavor"),_t([g("uint32")],Pt.prototype,"length"),_t([g("uint16")],Pt.prototype,"numTables"),_t([g("uint16")],Pt.prototype,"reserved"),_t([g("uint32")],Pt.prototype,"totalSFNTSize"),_t([g("uint16")],Pt.prototype,"majorVersion"),_t([g("uint16")],Pt.prototype,"minorVersion"),_t([g("uint32")],Pt.prototype,"metaOffset"),_t([g("uint32")],Pt.prototype,"metaLength"),_t([g("uint32")],Pt.prototype,"metaOrigLength"),_t([g("uint32")],Pt.prototype,"privOffset"),_t([g("uint32")],Pt.prototype,"privLength");let En=Pt;function Ns(o,e=!0){if(Ft.is(o))return new Ft(o);if(Je.is(o))return new Je(o);if(En.is(o))return new En(o);if(e)throw new Error("Failed to parseFont")}function js(o,e=!0){const t=Ns(o,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}const un=class un{constructor(){M(this,"fallbackFont");M(this,"loading",new Map);M(this,"loaded",new Map);M(this,"familyToUrl",new Map)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...un.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${e}";
3
3
  src: url(${t});
4
- }`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,s)=>r||this.loaded.get(s),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...i}=t;let a,l;if(typeof e=="string"?a=e:{src:a,family:l}=e,this.loaded.has(a))return n&&(this.loading.forEach(d=>d.cancel()),this.loading.clear()),f(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,i),this.loading.set(a,h)),n&&this.loading.forEach((d,p)=>{d!==h&&(d.cancel(),this.loading.delete(p))}),h.when.then(d=>{if(this.loaded.has(a))return f(this.loaded.get(a));{const p=u(d);return t.noAdd||this.loaded.set(a,p),p.familySet.forEach(m=>{this.familyToUrl.set(m,a),typeof document<"u"&&(r&&this.injectFontFace(m,d),s&&this.injectStyleTag(m,a))}),p}}).catch(d=>{if(d instanceof DOMException&&d.message==="The user aborted a request.")return u();throw d}).finally(()=>{this.loading.delete(a)});function c(){return l?Array.isArray(l)?l:[l]:[]}function f(d){return c().forEach(p=>{d.familySet.add(p)}),d}function u(d=new ArrayBuffer(0)){let p;function m(){return p||(p=d.byteLength?js(d,!1):void 0),p}function y(){const P=m();if(P instanceof Ft||P instanceof Bn)return P.sfnt}return{src:a,family:l,buffer:d,familySet:new Set(c()),getFont:m,getSFNT:y}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};M(un,"defaultRequestInit",{cache:"force-cache"});let Dn=un;const Gs=new Dn;function Rs(o,e,t=2){const n=e&&e.length,r=n?e[0]*t:o.length;let s=Tr(o,0,r,t,!0);const i=[];if(!s||s.next===s.prev)return i;let a,l,h;if(n&&(s=Hs(o,e,s,t)),o.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const d=o[u],p=o[u+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>f&&(f=p)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return Le(s,i,t,a,l,h,0),i}function Tr(o,e,t,n,r){let s;if(r===so(o,e,t,n)>0)for(let i=e;i<t;i+=n)s=_r(i/n|0,o[i],o[i+1],s);else for(let i=t-n;i>=e;i-=n)s=_r(i/n|0,o[i],o[i+1],s);return s&&ge(s,s.next)&&($e(s),s=s.next),s}function se(o,e){if(!o)return o;e||(e=o);let t=o,n;do if(n=!1,!t.steiner&&(ge(t,t.next)||tt(t.prev,t,t.next)===0)){if($e(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Le(o,e,t,n,r,s,i){if(!o)return;!i&&s&&Js(o,n,r,s);let a=o;for(;o.prev!==o.next;){const l=o.prev,h=o.next;if(s?Vs(o,n,r,s):qs(o)){e.push(l.i,o.i,h.i),$e(o),o=h.next,a=h.next;continue}if(o=h,o===a){i?i===1?(o=Ws(se(o),e),Le(o,e,t,n,r,s,2)):i===2&&Xs(o,e,t,n,r,s):Le(se(o),e,t,n,r,s,1);break}}}function qs(o){const e=o.prev,t=o,n=o.next;if(tt(e,t,n)>=0)return!1;const r=e.x,s=t.x,i=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,s,i),f=Math.min(a,l,h),u=Math.max(r,s,i),d=Math.max(a,l,h);let p=n.next;for(;p!==e;){if(p.x>=c&&p.x<=u&&p.y>=f&&p.y<=d&&Ue(r,a,s,l,i,h,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Vs(o,e,t,n){const r=o.prev,s=o,i=o.next;if(tt(r,s,i)>=0)return!1;const a=r.x,l=s.x,h=i.x,c=r.y,f=s.y,u=i.y,d=Math.min(a,l,h),p=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),P=Ln(d,p,e,t,n),T=Ln(m,y,e,t,n);let b=o.prevZ,C=o.nextZ;for(;b&&b.z>=P&&C&&C.z<=T;){if(b.x>=d&&b.x<=m&&b.y>=p&&b.y<=y&&b!==r&&b!==i&&Ue(a,c,l,f,h,u,b.x,b.y)&&tt(b.prev,b,b.next)>=0||(b=b.prevZ,C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==i&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;b&&b.z>=P;){if(b.x>=d&&b.x<=m&&b.y>=p&&b.y<=y&&b!==r&&b!==i&&Ue(a,c,l,f,h,u,b.x,b.y)&&tt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;C&&C.z<=T;){if(C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==i&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Ws(o,e){let t=o;do{const n=t.prev,r=t.next.next;!ge(n,r)&&kr(n,t,t.next,r)&&Fe(n,r)&&Fe(r,n)&&(e.push(n.i,t.i,r.i),$e(t),$e(t.next),t=o=r),t=t.next}while(t!==o);return se(t)}function Xs(o,e,t,n,r,s){let i=o;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&no(i,a)){let l=Ir(i,a);i=se(i,i.next),l=se(l,l.next),Le(i,e,t,n,r,s,0),Le(l,e,t,n,r,s,0);return}a=a.next}i=i.next}while(i!==o)}function Hs(o,e,t,n){const r=[];for(let s=0,i=e.length;s<i;s++){const a=e[s]*n,l=s<i-1?e[s+1]*n:o.length,h=Tr(o,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(eo(h))}r.sort(Zs);for(let s=0;s<r.length;s++)t=Ys(r[s],t);return t}function Zs(o,e){let t=o.x-e.x;if(t===0&&(t=o.y-e.y,t===0)){const n=(o.next.y-o.y)/(o.next.x-o.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Ys(o,e){const t=Ks(o,e);if(!t)return e;const n=Ir(t,o);return se(n,n.next),se(t,t.next)}function Ks(o,e){let t=e;const n=o.x,r=o.y;let s=-1/0,i;if(ge(o,t))return t;do{if(ge(o,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,i=t.x<t.next.x?t:t.next,f===n))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,l=i.x,h=i.y;let c=1/0;t=i;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Ar(r<h?n:s,r,l,h,r<h?s:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Fe(t,o)&&(f<c||f===c&&(t.x>i.x||t.x===i.x&&Qs(i,t)))&&(i=t,c=f)}t=t.next}while(t!==a);return i}function Qs(o,e){return tt(o.prev,o,e.prev)<0&&tt(e.next,o,o.next)<0}function Js(o,e,t,n){let r=o;do r.z===0&&(r.z=Ln(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==o);r.prevZ.nextZ=null,r.prevZ=null,to(r)}function to(o){let e,t=1;do{let n=o,r;o=null;let s=null;for(e=0;n;){e++;let i=n,a=0;for(let h=0;h<t&&(a++,i=i.nextZ,!!i);h++);let l=t;for(;a>0||l>0&&i;)a!==0&&(l===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:o=r,r.prevZ=s,s=r;n=i}s.nextZ=null,t*=2}while(e>1);return o}function Ln(o,e,t,n,r){return o=(o-t)*r|0,e=(e-n)*r|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function eo(o){let e=o,t=o;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==o);return t}function Ar(o,e,t,n,r,s,i,a){return(r-i)*(e-a)>=(o-i)*(s-a)&&(o-i)*(n-a)>=(t-i)*(e-a)&&(t-i)*(s-a)>=(r-i)*(n-a)}function Ue(o,e,t,n,r,s,i,a){return!(o===i&&e===a)&&Ar(o,e,t,n,r,s,i,a)}function no(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!ro(o,e)&&(Fe(o,e)&&Fe(e,o)&&io(o,e)&&(tt(o.prev,o,e.prev)||tt(o,e.prev,e))||ge(o,e)&&tt(o.prev,o,o.next)>0&&tt(e.prev,e,e.next)>0)}function tt(o,e,t){return(e.y-o.y)*(t.x-e.x)-(e.x-o.x)*(t.y-e.y)}function ge(o,e){return o.x===e.x&&o.y===e.y}function kr(o,e,t,n){const r=en(tt(o,e,t)),s=en(tt(o,e,n)),i=en(tt(t,n,o)),a=en(tt(t,n,e));return!!(r!==s&&i!==a||r===0&&tn(o,t,e)||s===0&&tn(o,n,e)||i===0&&tn(t,o,n)||a===0&&tn(t,e,n))}function tn(o,e,t){return e.x<=Math.max(o.x,t.x)&&e.x>=Math.min(o.x,t.x)&&e.y<=Math.max(o.y,t.y)&&e.y>=Math.min(o.y,t.y)}function en(o){return o>0?1:o<0?-1:0}function ro(o,e){let t=o;do{if(t.i!==o.i&&t.next.i!==o.i&&t.i!==e.i&&t.next.i!==e.i&&kr(t,t.next,o,e))return!0;t=t.next}while(t!==o);return!1}function Fe(o,e){return tt(o.prev,o,o.next)<0?tt(o,e,o.next)>=0&&tt(o,o.prev,e)>=0:tt(o,e,o.prev)<0||tt(o,o.next,e)<0}function io(o,e){let t=o,n=!1;const r=(o.x+e.x)/2,s=(o.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==o);return n}function Ir(o,e){const t=Un(o.i,o.x,o.y),n=Un(e.i,e.x,e.y),r=o.next,s=e.prev;return o.next=e,e.prev=o,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function _r(o,e,t,n){const r=Un(o,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $e(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Un(o,e,t){return{i:o,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function so(o,e,t,n){let r=0;for(let s=e,i=t-n;s<t;s+=n)r+=(o[i]-o[s])*(o[s+1]+o[i+1]),i=s;return r}function oo(o,e,t,n={}){const{radius:r=1}=n;o.moveTo(e,t),o.arc(e,t,r,0,Math.PI*2)}const ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Fn(o,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=n,o.lineWidth=r,o.lineCap=s,o.lineJoin=ao[i],o.miterLimit=a,o.setLineDash(l),o.lineDashOffset=h,o.shadowOffsetX=c,o.shadowOffsetY=f,o.shadowBlur=u,o.shadowColor=d}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,s=-(this.y-t.y),i=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-s*i),t.y-(r*i+s*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,s=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=s*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,s=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*s),this.y=n.y+(s+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class Y{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new Y;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new Y(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new Y(this.left,this.top,this.width,this.height)}}class Mt{constructor(e=1,t=0,n=0,r=0,s=1,i=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,s,i,a,l,h)}set(e,t,n,r,s,i,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=n,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,i=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],d=n[5],p=n[8],m=r[0],y=r[3],P=r[6],T=r[1],b=r[4],C=r[7],x=r[2],v=r[5],S=r[8];return s[0]=i*m+a*T+l*x,s[3]=i*y+a*b+l*v,s[6]=i*P+a*C+l*S,s[1]=h*m+c*T+f*x,s[4]=h*y+c*b+f*v,s[7]=h*P+c*C+f*S,s[2]=u*m+d*T+p*x,s[5]=u*y+d*b+p*v,s[8]=u*P+d*C+p*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*i-a*h,u=a*l-c*s,d=h*s-i*l,p=t*f+n*u+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*i)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*s-a*t)*m,e[6]=d*m,e[7]=(n*l-h*t)*m,e[8]=(i*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply($n.makeScale(e,t)),this}rotate(e){return this.premultiply($n.makeRotation(-e)),this}translate(e,t){return this.premultiply($n.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const $n=new Mt;function Or(o,e,t,n){const r=o*t+e*n,s=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+n*n);let i=Math.acos(Math.max(-1,Math.min(1,r/s)));return o*n-e*t<0&&(i=-i),i}function lo(o,e,t,n,r,s,i,a){if(e===0||t===0){o.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,f=-Math.sin(n)*l+Math.cos(n)*h;let u=e*e,d=t*t;const p=c*c,m=f*f,y=p/u+m/d;if(y>1){const z=Math.sqrt(y);e=z*e,t=z*t,u=e*e,d=t*t}const P=u*m+d*p,T=(u*d-P)/P;let b=Math.sqrt(Math.max(0,T));r===s&&(b=-b);const C=b*e*f/t,x=-b*t*c/e,v=Math.cos(n)*C-Math.sin(n)*x+(i.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(i.y+a.y)/2,w=Or(1,0,(c-C)/e,(f-x)/t),k=Or((c-C)/e,(f-x)/t,(-c-C)/e,(-f-x)/t)%(Math.PI*2);o.ellipse(v,S,e,t,n,w,w+k,s===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function qt(o,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,P,T){const b=new SyntaxError(`Unexpected character "${y}" at index ${P}.`);throw b.partial=T,b}function d(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let p;const m=o.length;for(let y=0;y<m;y++){if(p=o[y],Array.isArray(e)&&e.includes(f.length%t)&&it.FLAGS.test(p)){a=1,h=p,d();continue}if(a===0){if(it.WHITESPACE.test(p))continue;if(it.DIGIT.test(p)||it.SIGN.test(p)){a=1,h=p;continue}if(it.POINT.test(p)){a=2,h=p;continue}it.COMMA.test(p)&&(l&&u(p,y,f),l=!0)}if(a===1){if(it.DIGIT.test(p)){h+=p;continue}if(it.POINT.test(p)){h+=p,a=2;continue}if(it.EXP.test(p)){a=3;continue}it.SIGN.test(p)&&h.length===1&&it.SIGN.test(h[0])&&u(p,y,f)}if(a===2){if(it.DIGIT.test(p)){h+=p;continue}if(it.EXP.test(p)){a=3;continue}it.POINT.test(p)&&h[h.length-1]==="."&&u(p,y,f)}if(a===3){if(it.DIGIT.test(p)){c+=p;continue}if(it.SIGN.test(p)){if(c===""){c+=p;continue}c.length===1&&it.SIGN.test(c)&&u(p,y,f)}}it.WHITESPACE.test(p)?(d(),a=0,l=!1):it.COMMA.test(p)?(d(),a=0,l=!0):it.SIGN.test(p)?(d(),a=1,h=p):it.POINT.test(p)?(d(),a=2,h=p):u(p,y,f)}return d(),f}function me(o,e){return o-(e-o)}function Er(o,e){const t=new A,n=new A;for(let r=0,s=o.length;r<s;r++){const i=o[r];if(i.type==="m"||i.type==="M")i.type==="m"?t.add(i):t.copy(i),e.moveTo(t.x,t.y),n.copy(t);else if(i.type==="h"||i.type==="H")i.type==="h"?t.x+=i.x:t.x=i.x,e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="v"||i.type==="V")i.type==="v"?t.y+=i.y:t.y=i.y,e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="l"||i.type==="L")i.type==="l"?t.add(i):t.copy(i),e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="c"||i.type==="C")i.type==="c"?(e.bezierCurveTo(t.x+i.x1,t.y+i.y1,t.x+i.x2,t.y+i.y2,t.x+i.x,t.y+i.y),n.x=t.x+i.x2,n.y=t.y+i.y2,t.add(i)):(e.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),n.x=i.x2,n.y=i.y2,t.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),t.x+i.x2,t.y+i.y2,t.x+i.x,t.y+i.y),n.x=t.x+i.x2,n.y=t.y+i.y2,t.add(i)):(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),i.x2,i.y2,i.x,i.y),n.x=i.x2,n.y=i.y2,t.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(e.quadraticCurveTo(t.x+i.x1,t.y+i.y1,t.x+i.x,t.y+i.y),n.x=t.x+i.x1,n.y=t.y+i.y1,t.add(i)):(e.quadraticCurveTo(i.x1,i.y1,i.x,i.y),n.x=i.x1,n.y=i.y1,t.copy(i));else if(i.type==="t"||i.type==="T"){const a=me(t.x,n.x),l=me(t.y,n.y);n.x=a,n.y=l,i.type==="t"?(e.quadraticCurveTo(a,l,t.x+i.x,t.y+i.y),t.add(i)):(e.quadraticCurveTo(a,l,i.x,i.y),t.copy(i))}else if(i.type==="a"||i.type==="A"){const a=t.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;t.add(i)}else{if(t.equals(i))continue;t.copy(i)}n.copy(t),lo(e,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,t)}else i.type==="z"||i.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",i)}}function ho(o){let e,t;const n=[];for(let r=0,s=o.length;r<s;r++){const i=o[r];switch(i.type){case"m":case"M":if(i.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&i.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y},e={x:i.x,y:i.y};break;case"h":case"H":n.push(`${i.type} ${i.x}`),t={x:i.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${i.type} ${i.y}`),t={x:(t==null?void 0:t.x)??0,y:i.y};break;case"l":case"L":n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"c":case"C":n.push(`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"s":case"S":n.push(`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"q":case"Q":n.push(`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"t":case"T":n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"a":case"A":n.push(`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"z":case"Z":n.push(i.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const co=/[a-df-z][^a-df-z]*/gi;function Br(o){const e=[],t=o.match(co);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const s=t[n],i=s.charAt(0),a=s.slice(1).trim();let l;switch(i){case"m":case"M":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:i,x:l[h],y:l[h+1]}):e.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:i,x:l[h]});break;case"v":case"V":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:i,y:l[h]});break;case"l":case"L":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=qt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=qt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:i});break;default:console.warn(s)}}return e}function Dr(o,e,t,n,r){const s=(n-e)*.5,i=(r-t)*.5,a=o*o,l=o*a;return(2*t-2*n+s+i)*l+(-3*t+3*n-2*s-i)*a+s*o+t}function fo(o,e){const t=1-o;return t*t*t*e}function uo(o,e){const t=1-o;return 3*t*t*o*e}function po(o,e){return 3*(1-o)*o*o*e}function yo(o,e){return o*o*o*e}function Lr(o,e,t,n,r){return fo(o,e)+uo(o,t)+po(o,n)+yo(o,r)}function Ur(o,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:s=2,verticesOffset:i=t.length/s,indicesOffset:a=n.length}=e;const l=Rs(o,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+i,n[a++]=l[c+1]+i,n[a++]=l[c+2]+i;let h=i*s;for(let c=0;c<o.length;c+=2)t[h]=o[c],t[h+1]=o[c+1],h+=s}return{vertices:t,indices:n}}const go=8,nn=11920929e-14,mo=1;function xo(o,e,t,n,r,s,i,a,l=.5,h=[]){const f=Math.min(.99,Math.max(0,l));let u=(mo-f)/1;return u*=u,zn(o,e,t,n,r,s,i,a,h,u,0),h.push(i,a),h}function zn(o,e,t,n,r,s,i,a,l,h,c){if(c>go)return;const f=(o+t)/2,u=(e+n)/2,d=(t+r)/2,p=(n+s)/2,m=(r+i)/2,y=(s+a)/2,P=(f+d)/2,T=(u+p)/2,b=(d+m)/2,C=(p+y)/2,x=(P+b)/2,v=(T+C)/2;if(c>0){let S=i-o,w=a-e;const k=Math.abs((t-i)*w-(n-a)*S),z=Math.abs((r-i)*w-(s-a)*S);if(k>nn&&z>nn){if((k+z)*(k+z)<=h*(S*S+w*w)){l.push(x,v);return}}else if(k>nn){if(k*k<=h*(S*S+w*w)){l.push(x,v);return}}else if(z>nn){if(z*z<=h*(S*S+w*w)){l.push(x,v);return}}else if(S=x-(o+i)/2,w=v-(e+a)/2,S*S+w*w<=h){l.push(x,v);return}}zn(o,e,f,u,P,T,x,v,l,h,c+1),zn(x,v,b,C,m,y,i,a,l,h,c+1)}const wo=8,vo=11920929e-14,bo=1;function So(o,e,t,n,r,s,i=.5,a=[]){const h=Math.min(.99,Math.max(0,i));let c=(bo-h)/1;return c*=c,Nn(a,o,e,t,n,r,s,c,0),a.push(r,s),a}function Nn(o,e,t,n,r,s,i,a,l){if(l>wo)return;const h=(e+n)/2,c=(t+r)/2,f=(n+s)/2,u=(r+i)/2,d=(h+f)/2,p=(c+u)/2;let m=s-e,y=i-t;const P=Math.abs((n-s)*y-(r-i)*m);if(P>vo){if(P*P<=a*(m*m+y*y)){o.push(d,p);return}}else if(m=d-(e+s)/2,y=p-(t+i)/2,m*m+y*y<=a){o.push(d,p);return}Nn(o,e,t,h,c,d,p,a,l+1),Nn(o,d,p,f,u,s,i,a,l+1)}function Mo(o,e){const t=1-o;return t*t*e}function Co(o,e){return 2*(1-o)*o*e}function Po(o,e){return o*o*e}function Fr(o,e,t,n){return Mo(o,e)+Co(o,t)+Po(o,n)}const To=1e-4,$r=1e-4;function Ao(o,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:s=!1,closed:i=!0}=e,a=To;if(o.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=ko(o);s&&(L*=-1),h=(h-.5)*L+.5}const c={x:o[0],y:o[1]},f={x:o[o.length-2],y:o[o.length-1]},u=i,d=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){o=o.slice(),d&&(o.pop(),o.pop(),f.x=o[o.length-2],f.y=o[o.length-1]);const L=(c.x+f.x)*.5,$=(f.y+c.y)*.5;o.unshift(L,$),o.push(L,$)}const p=t,m=o.length/2;let y=o.length;const P=p.length/2,T=l.width/2,b=T*T,C=l.miterLimit*l.miterLimit;let x=o[0],v=o[1],S=o[2],w=o[3],k=0,z=0,O=-(v-w),E=x-S,U=0,D=0,_=Math.sqrt(O*O+E*E);O/=_,E/=_,O*=T,E*=T;const X=h,I=(1-X)*2,B=X*2;u||(l.cap==="round"?y+=oe(x-O*(I-B)*.5,v-E*(I-B)*.5,x-O*I,v-E*I,x+O*B,v+E*B,p,!0)+2:l.cap==="square"&&(y+=zr(x,v,O,E,I,B,!0,p))),p.push(x-O*I,v-E*I),p.push(x+O*B,v+E*B);for(let L=1;L<m-1;++L){x=o[(L-1)*2],v=o[(L-1)*2+1],S=o[L*2],w=o[L*2+1],k=o[(L+1)*2],z=o[(L+1)*2+1],O=-(v-w),E=x-S,_=Math.sqrt(O*O+E*E),O/=_,E/=_,O*=T,E*=T,U=-(w-z),D=S-k,_=Math.sqrt(U*U+D*D),U/=_,D/=_,U*=T,D*=T;const $=S-x,W=v-w,F=S-k,V=z-w,R=$*F+W*V,Z=W*F-V*$,H=Z<0;if(Math.abs(Z)<.001*Math.abs(R)){p.push(S-O*I,w-E*I),p.push(S+O*B,w+E*B),R>=0&&(l.join==="round"?y+=oe(S,w,S-O*I,w-E*I,S-U*I,w-D*I,p,!1)+4:y+=2,p.push(S-U*B,w-D*B),p.push(S+U*I,w+D*I));continue}const nt=(-O+x)*(-E+w)-(-O+S)*(-E+v),Wt=(-U+k)*(-D+w)-(-U+S)*(-D+z),Et=($*Wt-F*nt)/Z,Ct=(V*nt-W*Wt)/Z,At=(Et-S)*(Et-S)+(Ct-w)*(Ct-w),ht=S+(Et-S)*I,kt=w+(Ct-w)*I,zt=S-(Et-S)*B,Nt=w-(Ct-w)*B,Bt=Math.min($*$+W*W,F*F+V*V),ci=H?I:B,xa=Bt+ci*ci*b;At<=xa?l.join==="bevel"||At/b>C?(H?(p.push(ht,kt),p.push(S+O*B,w+E*B),p.push(ht,kt),p.push(S+U*B,w+D*B)):(p.push(S-O*I,w-E*I),p.push(zt,Nt),p.push(S-U*I,w-D*I),p.push(zt,Nt)),y+=2):l.join==="round"?H?(p.push(ht,kt),p.push(S+O*B,w+E*B),y+=oe(S,w,S+O*B,w+E*B,S+U*B,w+D*B,p,!0)+4,p.push(ht,kt),p.push(S+U*B,w+D*B)):(p.push(S-O*I,w-E*I),p.push(zt,Nt),y+=oe(S,w,S-O*I,w-E*I,S-U*I,w-D*I,p,!1)+4,p.push(S-U*I,w-D*I),p.push(zt,Nt)):(p.push(ht,kt),p.push(zt,Nt)):(p.push(S-O*I,w-E*I),p.push(S+O*B,w+E*B),l.join==="round"?H?y+=oe(S,w,S+O*B,w+E*B,S+U*B,w+D*B,p,!0)+2:y+=oe(S,w,S-O*I,w-E*I,S-U*I,w-D*I,p,!1)+2:l.join==="miter"&&At/b<=C&&(H?(p.push(zt,Nt),p.push(zt,Nt)):(p.push(ht,kt),p.push(ht,kt)),y+=2),p.push(S-U*I,w-D*I),p.push(S+U*B,w+D*B),y+=2)}x=o[(m-2)*2],v=o[(m-2)*2+1],S=o[(m-1)*2],w=o[(m-1)*2+1],O=-(v-w),E=x-S,_=Math.sqrt(O*O+E*E),O/=_,E/=_,O*=T,E*=T,p.push(S-O*I,w-E*I),p.push(S+O*B,w+E*B),u||(l.cap==="round"?y+=oe(S-O*(I-B)*.5,w-E*(I-B)*.5,S-O*I,w-E*I,S+O*B,w+E*B,p,!1)+2:l.cap==="square"&&(y+=zr(S,w,O,E,I,B,!1,p)));const q=$r*$r;for(let L=P;L<y+P-2;++L)x=p[L*2],v=p[L*2+1],S=p[(L+1)*2],w=p[(L+1)*2+1],k=p[(L+2)*2],z=p[(L+2)*2+1],!(Math.abs(x*(w-z)+S*(z-v)+k*(v-w))<q)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function ko(o){const e=o.length;if(e<6)return 1;let t=0;for(let n=0,r=o[e-2],s=o[e-1];n<e;n+=2){const i=o[n],a=o[n+1];t+=(i-r)*(a+s),r=i,s=a}return t<0?-1:1}function zr(o,e,t,n,r,s,i,a){const l=o-t*r,h=e-n*r,c=o+t*s,f=e+n*s;let u,d;i?(u=n,d=-t):(u=-n,d=t);const p=l+u,m=h+d,y=c+u,P=f+d;return a.push(p,m),a.push(y,P),2}function oe(o,e,t,n,r,s,i,a){const l=t-o,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-o,s-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const d=f-c,p=Math.abs(d),m=Math.sqrt(l*l+h*h),y=(15*p*Math.sqrt(m)/Math.PI>>0)+1,P=d/y;if(u+=P,a){i.push(o,e),i.push(t,n);for(let T=1,b=u;T<y;T++,b+=P)i.push(o,e),i.push(o+Math.sin(b)*m,e+Math.cos(b)*m);i.push(o,e),i.push(r,s)}else{i.push(t,n),i.push(o,e);for(let T=1,b=u;T<y;T++,b+=P)i.push(o+Math.sin(b)*m,e+Math.cos(b)*m),i.push(o,e);i.push(r,s),i.push(o,e)}return y*2}class xe{constructor(){M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new A;for(let r=0,s=Math.max(1,e)-1;r<=s;r++)this.getPoint(r/s,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new A;for(let r=0,s=Math.max(1,e)-1;r<=s;r++)this.getPointAt(r/s,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const s=e[n],i=e[n+1];t.push(new A(s,i))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),s=1;s<=e;s++){const i=this.getPoint(s/e);n+=i.distanceTo(r),t.push(n),r=i}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,s=t??e*n[r-1];if(r<2)return s/n[0];let i=0,a=0,l=r-1,h;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),h=n[i]-s,h<0)a=i+1;else if(h>0)l=i-1;else{l=i;break}if(i=l,n[i]===s)return i/(r-1);const c=n[i],u=n[i+1]-c,d=(s-c)/u;return(i+d)/(r-1)}getTangent(e,t=new A){const r=Math.max(0,e-1e-4),s=Math.min(1,e+1e-4);return t.copy(this.getPoint(s).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,s=(n+r)/2;for(;r-n>t;){s=(n+r)/2;const i=this.getPoint(s);if(i.distanceTo(e)<t)return s;i.x<e.x?n=s:r=s}return s}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let r=0,s=n.length;r<s;r++){const i=n[r];e.min(i),t.max(i)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Y(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return Ur(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Ao(this.getAdaptivePointArray(),e)}toTriangulatedSVGString(e=this.fillTriangulate(),t=0){const{vertices:n,indices:r}=e,s={x:-t,y:-t},i={x:t,y:t},a=c=>{const f=n[c*2],u=n[c*2+1];return s.x=Math.min(s.x,f+t),i.x=Math.max(i.x,f+t),s.y=Math.min(s.y,u+t),i.y=Math.max(i.y,u+t),[f,u]};let l="";for(let c=0,f=r.length;c<f;c+=3){const u=a(r[c]),d=a(r[c+1]),p=a(r[c+2]);l+=`<polygon points="${u.join(",")} ${d.join(",")} ${p.join(",")}" fill="none" stroke="black" />`}const h=[s.x,s.y,i.x-s.x,i.y-s.y];return`<svg width="${h[2]}" height="${h[3]}" viewBox="${h.join(" ")}" xmlns="http://www.w3.org/2000/svg">${l}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const s=t[n];n===0?e.push({type:"M",x:s.x,y:s.y}):e.push({type:"L",x:s.x,y:s.y})}return e}toData(){return ho(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Io=new Mt,Nr=new Mt,jr=new Mt,rn=new A;class jn extends xe{constructor(e=new A,t=new A,n=new A,r=0,s=0,i=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=s,this.endAngle=i,this.clockwise=a}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new A){const n=this._getDeltaAngle(),r=this.startAngle+e*n;let s=this.cx+this.rx*Math.cos(r),i=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),h=s-this.cx,c=i-this.cy;s=h*a-c*l+this.cx,i=h*l+c*a+this.cy}return t.set(s,i)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:s,endAngle:i,clockwise:a,rotate:l}=this,h=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),c=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l),f=Math.abs(s-i),u=f>Math.PI?1:0,d=a?1:0,p=l*180/Math.PI;if(f>=2*Math.PI){const m=s+Math.PI,y=e+n*Math.cos(m)*Math.cos(l)-r*Math.sin(m)*Math.sin(l),P=t+n*Math.cos(m)*Math.sin(l)+r*Math.sin(m)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:y,y:P},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:h,y:c}]}else{const m=e+n*Math.cos(i)*Math.cos(l)-r*Math.sin(i)*Math.sin(l),y=t+n*Math.cos(i)*Math.sin(l)+r*Math.sin(i)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:u,sweepFlag:d,x:m,y}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:s,rotate:i,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,s,i,a,l,!h),this}applyTransform(e){return rn.set(this.cx,this.cy),rn.applyMatrix3(e),this.cx=rn.x,this.cy=rn.y,Eo(e)?_o(this,e):Oo(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:s,dx:i,dy:a}=this;if(!(r>=0&&s>=0&&i>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+s)),h=t,c=n,f=l*8+(i?4:0)+(a?4:0);if(f===0)return e;if(l===0)return e[0]=e[6]=h+i,e[1]=e[3]=c+a,e[2]=e[4]=h-i,e[5]=e[7]=c-a,e;let u=0,d=l*4+(i?2:0)+2,p=d,m=f,y=i+r,P=a,T=h+y,b=h-y,C=c+P;if(e[u++]=T,e[u++]=C,e[--d]=C,e[--d]=b,a){const v=c-P;e[p++]=b,e[p++]=v,e[--m]=v,e[--m]=T}for(let v=1;v<l;v++){const S=Math.PI/2*(v/l),w=i+Math.cos(S)*r,k=a+Math.sin(S)*s,z=h+w,O=h-w,E=c+k,U=c-k;e[u++]=z,e[u++]=E,e[--d]=E,e[--d]=O,e[p++]=O,e[p++]=U,e[--m]=U,e[--m]=z}y=i,P=a+s,T=h+y,b=h-y,C=c+P;const x=c-P;return e[u++]=T,e[u++]=C,e[--m]=x,e[--m]=T,i&&(e[u++]=b,e[u++]=C,e[--m]=x,e[--m]=b),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let u=0;u<a.length;u+=2)l+=a[u],h+=a[u+1];l/=a.length/2,h/=a.length/2;let c=s;t[c*r]=l,t[c*r+1]=h;const f=c++;for(let u=0;u<a.length;u+=2)t[c*r]=a[u],t[c*r+1]=a[u+1],u>0&&(n[i++]=c,n[i++]=f,n[i++]=c-1),c++;return n[i++]=f+1,n[i++]=f,n[i++]=c-1,{vertices:t,indices:n}}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:r,rx:s,ry:i,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(s*s*l*l+i*i*h*h),f=Math.sqrt(s*s*h*h+i*i*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-f),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+f),{min:e,max:t}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function _o(o,e){const t=o.rx,n=o.ry,r=Math.cos(o.rotate),s=Math.sin(o.rotate),i=new A(t*r,t*s),a=new A(-n*s,n*r),l=i.applyMatrix3(e),h=a.applyMatrix3(e),c=Io.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=Nr.copy(c).invert(),p=jr.copy(f).transpose().multiply(f).elements,m=Bo(p[0],p[1],p[4]),y=Math.sqrt(m.rt1),P=Math.sqrt(m.rt2);if(o.rx=1/y,o.ry=1/P,o.rotate=Math.atan2(m.sn,m.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=Nr.set(y,0,0,0,P,0,0,0,1),C=jr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),x=b.multiply(C).multiply(c),v=S=>{const{x:w,y:k}=new A(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(k,w)};o.startAngle=v(o.startAngle),o.endAngle=v(o.endAngle),Gr(e)&&(o.clockwise=!o.clockwise)}}function Oo(o,e){const t=Rr(e),n=qr(e);o.rx*=t,o.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotate+=r,Gr(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function Gr(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Eo(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=Rr(o),r=qr(o);return Math.abs(t/(n*r))>Number.EPSILON}function Rr(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function qr(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Bo(o,e,t){let n,r,s,i,a;const l=o+t,h=o-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=o*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?s=h+c:s=h-c,Math.abs(s)>2*Math.abs(e)?(a=-2*e/s,i=1/Math.sqrt(1+a*a),s=a*i):Math.abs(e)===0?(s=1,i=0):(a=-.5*s/e,s=1/Math.sqrt(1+a*a),i=a*s),h>0&&(a=s,s=-i,i=a),{rt1:n,rt2:r,cs:s,sn:i}}class Do extends jn{constructor(e=0,t=0,n=1,r=0,s=Math.PI*2,i=!1){super(new A(e,t),new A(n,n),new A,0,r,s,i)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:s,endAngle:i,clockwise:a}=this;return e.arc(t,n,r,s,i,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:s,endAngle:i,clockwise:a}=this;let l=Math.abs(s-i);(!a&&s>i||a&&i>s)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=s;c*=a?1:-1;for(let u=0;u<h+1;u++){const d=Math.cos(f),p=Math.sin(f),m=t+d*r,y=n+p*r;e.push(m,y),f+=c}return e}}class Ht extends xe{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Ht(new A(e,t),new A(n,r))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const a=this.p1.x,l=this.p1.y,h=this.p2.x-this.p1.x||1,c=this.p2.y-this.p2.y||1,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;s*=r,t[s+u]=f[0],t[s+u+1]=f[1],u+=r,t[s+u]=f[2],t[s+u+1]=f[3],u+=r,t[s+u]=f[6],t[s+u+1]=f[7],u+=r,t[s+u]=f[4],t[s+u+1]=f[5],u+=r;const d=s/r;return n[i++]=d,n[i++]=d+1,n[i++]=d+2,n[i++]=d+1,n[i++]=d+3,n[i++]=d+2,{vertices:t,indices:n}}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class ze extends xe{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof ze?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),r=this.getLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const i=r[s]-n,a=this.curves[s],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,t)}s++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){return e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),e}getSpacedPointArray(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedPointArray(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}fillTriangulate(e){const t=(e==null?void 0:e.indices)??[],n=(e==null?void 0:e.vertices)??[],r=[],s=()=>{if(r.length){const i=[];r.forEach(a=>{const l=a.p1.x,h=a.p1.y;(i[i.length-2]!==l||i[i.length-1]!==h)&&i.push(l,h),i.push(a.p2.x,a.p2.y)}),Ur(i,{...e,indices:t,vertices:n}),r.length=0}};return this.curves.forEach(i=>{i instanceof Ht?r.push(i):(s(),i.fillTriangulate({...e,indices:t,vertices:n}))}),s(),{indices:t,vertices:n}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Y(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Gn extends xe{constructor(e=new A,t=new A,n=new A,r=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,s,i,a,l){return new Gn(new A(e,t),new A(n,r),new A(s,i),new A(a,l))}getPoint(e,t=new A){const{p1:n,cp1:r,cp2:s,p2:i}=this;return t.set(Lr(e,n.x,r.x,s.x,i.x),Lr(e,n.y,r.y,s.y,i.y))}getAdaptivePointArray(e=[]){return xo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const s=Math.sqrt(r),i=(-t+s)/(2*e),a=(-t-s)/(2*e);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:r,cp2:s,p2:i}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(s.x-r.x),3*(i.x-s.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(s.y-r.y),3*(i.y-s.y)),h=[0,1,...a,...l];return((f,u)=>{for(const d of f)for(let p=0;p<=u;p++){const m=p/u-.5,y=Math.min(1,Math.max(0,d+m)),P=this.getPoint(y);e.x=Math.min(e.x,P.x),e.y=Math.min(e.y,P.y),t.x=Math.max(t.x,P.x),t.y=Math.max(t.y,P.y)}})(h,10),{min:e,max:t}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:s}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,s.x,s.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class Lo extends jn{constructor(e=0,t=0,n=1,r=1,s=0,i=0,a=Math.PI*2,l=!1){super(new A(e,t),new A(n,r),new A,s,i,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Uo extends ze{}class Rn extends xe{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,s,i){return new Rn(new A(e,t),new A(n,r),new A(s,i))}getPoint(e,t=new A){const{p1:n,cp:r,p2:s}=this;return t.set(Fr(e,n.x,r.x,s.x),Fr(e,n.y,r.y,s.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return So(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:r,p2:s}=this,i=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+s.x),h=.5*(n.y+s.y);return e.x=Math.min(e.x,n.x,s.x,i,l),e.y=Math.min(e.y,n.y,s.y,a,h),t.x=Math.max(t.x,n.x,s.x,i,l),t.y=Math.max(t.y,n.y,s.y,a,h),{min:e,max:t}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class Fo extends Uo{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,s=[new A(e,t),new A(e+n,t),new A(e+n,t+r),new A(e,t+r)];return this.curves=[new Ht(s[0],s[1]),new Ht(s[1],s[2]),new Ht(s[2],s[3]),new Ht(s[3],s[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const{x:a,y:l,width:h,height:c}=this,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;s*=r,t[s+u]=f[0],t[s+u+1]=f[1],u+=r,t[s+u]=f[2],t[s+u+1]=f[3],u+=r,t[s+u]=f[6],t[s+u+1]=f[7],u+=r,t[s+u]=f[4],t[s+u+1]=f[5],u+=r;const d=s/r;return n[i++]=d,n[i++]=d+1,n[i++]=d+2,n[i++]=d+1,n[i++]=d+3,n[i++]=d+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class $o extends jn{constructor(e=0,t=0,n=1,r=1,s=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=s,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:s}=this,i=n/2,a=r/2,l=e+i,h=t+a,c=Math.max(0,Math.min(s,Math.min(i,a))),f=c;return this._center=new A(l,h),this._radius=new A(c,f),this._diff=new A(i-c,a-f),this}drawTo(e){const{x:t,y:n,width:r,height:s,radius:i}=this;return e.roundRect(t,n,r,s,i),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class zo extends xe{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,r=(n.length-1)*e,s=Math.floor(r),i=r-s,a=n[s===0?s:s-1],l=n[s],h=n[s>n.length-2?n.length-1:s+1],c=n[s>n.length-3?n.length-1:s+2];return t.set(Dr(i,a.x,l.x,h.x,c.x),Dr(i,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class sn extends ze{constructor(t){super();M(this,"startPoint");M(this,"currentPoint");M(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:s,y:i}=t[n];this.lineTo(s,i)}return this}addCommands(t){return Er(t,this),this}addData(t){return this.addCommands(Br(t)),this}_closePointArray(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenPointArray(t=40,n=[]){return this._closePointArray(super.getUnevenPointArray(t,n))}getSpacedPointArray(t=40,n=[]){return this._closePointArray(super.getSpacedPointArray(t,n))}getAdaptivePointArray(t=[]){return this._closePointArray(super.getAdaptivePointArray(t))}_setCurrentPoint(t){return this.currentPoint=new A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Ht(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Ht.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,s,i,a){const l=this.currentPoint;return l!=null&&l.equals({x:i,y:a})||this.curves.push(Gn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,s,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(t,n,r,s){const i=this.currentPoint;return i!=null&&i.equals({x:r,y:s})||this.curves.push(Rn.from((i==null?void 0:i.x)??0,(i==null?void 0:i.y)??0,t,n,r,s)),this._setCurrentPoint({x:r,y:s}),this}arc(t,n,r,s,i,a){const l=new Do(t,n,r,s,i,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,s,i,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,s,i,a),this}arcTo(t,n,r,s,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,s,i,a,l,h=!0){const c=new Lo(t,n,r,s,i,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,s,i,a,l,h){var c,f;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,n,r,s,i,a,l,h),this}rect(t,n,r,s){const i=new Fo(t,n,r,s);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,s,i){const a=new $o(t,n,r,s,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new zo([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(s=>s.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function No(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(o,e,t,n){const r=e.clone().sub(o),s=n.clone().sub(t),i=t.clone().sub(o),a=r.cross(s);if(a===0)return new A((o.x+t.x)/2,(o.y+t.y)/2);const l=i.cross(s)/a;return Math.abs(l)>1?new A((o.x+t.x)/2,(o.y+t.y)/2):new A(o.x+l*r.x,o.y+l*r.y)}class Tt extends ze{constructor(t,n={}){super();M(this,"currentCurve",new sn);M(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(r=>r===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof Tt?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new sn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new sn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,s,i,a){return this.currentCurve.bezierCurveTo(t,n,r,s,i,a),this}quadraticCurveTo(t,n,r,s){return this.currentCurve.quadraticCurveTo(t,n,r,s),this}arc(t,n,r,s,i,a){return this.currentCurve.arc(t,n,r,s,i,a),this}arcTo(t,n,r,s,i){return this.currentCurve.arcTo(t,n,r,s,i),this}ellipse(t,n,r,s,i,a,l,h){return this.currentCurve.ellipse(t,n,r,s,i,a,l,h),this}rect(t,n,r,s){return this.currentCurve.rect(t,n,r,s),this}roundRect(t,n,r,s,i){return this.currentCurve.roundRect(t,n,r,s,i),this}reset(){return this.currentCurve=new sn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Er(t,this),this}addData(t){return this.addCommands(Br(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],s=[],i=[];n.forEach((l,h)=>{const c=l.getControlPointRefs(),f=l.isClockwise();i[h]=c,s[h]=f;const u=c[0],d=c[c.length-1]??u;r.push({start:f?d:u,end:f?u:d,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{var u;c.start&&l.end&&f!==h&&((u=c.start)!=null&&u.equals(l.end))&&a[h].push(c.index)})}),n.forEach((l,h)=>{const c=s[h];i[h].forEach(f=>{f.add(l.getNormal(l.getTForPoint(f)).scale(c?t:-t))})}),a.forEach((l,h)=>{const c=i[h];l.forEach(f=>{const u=i[f],d=jo(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);d&&(c[c.length-1].copy(d),u[0].copy(d))})}),this}getMinMax(t=A.MAX,n=A.MIN,r=!0){const s=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(t,n),r&&s>1){const a=s/2,l=i.isClockwise(),h=[];for(let c=0;c<=1;c+=1/i.arcLengthDivision){const f=i.getPoint(c),u=i.getNormal(c),d=u.clone().scale(l?a:-a),p=u.clone().scale(l?-a:a);h.push(f.clone().add(d),f.clone().add(p),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(s=>{s.strokeTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new Y(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:s="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.curves.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:s="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.getControlPointRefs().forEach(i=>{oo(t,i.x,i.y,{radius:4})}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const s in t)t[s]!==void 0&&(n[No(s)]=t[s]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const s in n)n[s]!==void 0&&(r+=`${s}:${n[s]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ae{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new Y(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),s=this.paths.map(i=>i.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:s,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*t,l.height=a*t,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-s),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const Vr="data:image/svg+xml;",Wr=`${Vr}base64,`,Xr=`${Vr}charset=utf8,`;function Hr(o){if(typeof o=="string"){let e;o.startsWith(Wr)?(o=o.substring(Wr.length,o.length),e=atob(o)):o.startsWith(Xr)?(o=o.substring(Xr.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
5
- ${e}`);return t.documentElement}else return o}const Go="px",Ro=90,Zr=["mm","cm","in","pt","pc","px"],Yr={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 K(o){let e="px";if(typeof o=="string"||o instanceof String)for(let n=0,r=Zr.length;n<r;n++){const s=Zr[n];if(o.endsWith(s)){e=s,o=o.substring(0,o.length-s.length);break}}let t;return t=Yr[e][Go],t<0&&(t=Yr[e].in*Ro),t*Number.parseFloat(o)}const qo=new Mt,on=new Mt,Kr=new Mt,Qr=new Mt;function Vo(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const n=Wo(o);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Wo(o){const e=new Mt,t=qo;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(K(o.getAttribute("x")),K(o.getAttribute("y"))),o.hasAttribute("transform")){const n=o.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const i=s.indexOf("("),a=s.length;if(i>0&&i<a){const l=s.slice(0,i),h=qt(s.slice(i+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),on.makeTranslation(-f,-u),Kr.makeRotation(c),Qr.multiplyMatrices(Kr,on),on.makeTranslation(f,u),t.multiplyMatrices(on,Qr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Xo(o){return new Tt().arc(K(o.getAttribute("cx")||0),K(o.getAttribute("cy")||0),K(o.getAttribute("r")||0),0,Math.PI*2)}function Ho(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const n=o.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),s={};for(let i=n.style.length,a=0;a<i;a++){const l=n.style.item(a);s[l]=n.style.getPropertyValue(l)}for(let i=0;i<r.length;i++)e[r[i]]=Object.assign(e[r[i]]||{},{...s})}}function Zo(o){return new Tt().ellipse(K(o.getAttribute("cx")||0),K(o.getAttribute("cy")||0),K(o.getAttribute("rx")||0),K(o.getAttribute("ry")||0),0,0,Math.PI*2)}function Yo(o){return new Tt().moveTo(K(o.getAttribute("x1")||0),K(o.getAttribute("y1")||0)).lineTo(K(o.getAttribute("x2")||0),K(o.getAttribute("y2")||0))}function Ko(o){const e=new Tt,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Qo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(Qo,(r,s,i)=>{const a=K(s),l=K(i);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!0,e}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(ta,(r,s,i)=>{const a=K(s),l=K(i);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!1,e}function na(o){const e=K(o.getAttribute("x")||0),t=K(o.getAttribute("y")||0),n=K(o.getAttribute("rx")||o.getAttribute("ry")||0),r=K(o.getAttribute("ry")||o.getAttribute("rx")||0),s=K(o.getAttribute("width")),i=K(o.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+s-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+s-n*a,t,e+s,t+r*a,e+s,t+r),l.lineTo(e+s,t+i-r),(n!==0||r!==0)&&l.bezierCurveTo(e+s,t+i-r*a,e+s-n*a,t+i,e+s-n,t+i),l.lineTo(e+n,t+i),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+i,e,t+i-r*a,e,t+i-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function Vt(o,e,t){e=Object.assign({},e);let n={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}o.hasAttribute("id")&&(n=Object.assign(n,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,c=0;c<h;c++){const f=o.style.item(c),u=o.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=s){o.hasAttribute(h)&&(e[c]=f(o.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function s(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,K(h)))}function a(h){return Math.max(0,K(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>K(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",i),r("fill-rule","fillRule"),r("opacity","opacity",i),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",i),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",K),r("visibility","visibility"),e}function qn(o,e,t=[],n={}){var f;if(o.nodeType!==1)return t;let r=!1,s=null,i={...e};switch(o.nodeName){case"svg":i=Vt(o,i,n);break;case"style":Ho(o,n);break;case"g":i=Vt(o,i,n);break;case"path":i=Vt(o,i,n),o.hasAttribute("d")&&(s=Ko(o));break;case"rect":i=Vt(o,i,n),s=na(o);break;case"polygon":i=Vt(o,i,n),s=Jo(o);break;case"polyline":i=Vt(o,i,n),s=ea(o);break;case"circle":i=Vt(o,i,n),s=Xo(o);break;case"ellipse":i=Vt(o,i,n),s=Zo(o);break;case"line":i=Vt(o,i,n),s=Yo(o);break;case"defs":r=!0;break;case"use":{i=Vt(o,i,n);const d=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("href")||"").substring(1),p=(f=o.viewportElement)==null?void 0:f.getElementById(d);p?qn(p,i,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(o);break}if(i.display==="none")return t;const a=new Mt,l=[],h=Vo(o,a,l);s&&(s.applyTransform(a),t.push(s),s.style={...i});const c=o.childNodes;for(let u=0,d=c.length;u<d;u++){const p=c[u];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||qn(p,i,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function Jr(o){var t;const e=Hr(o);return new ae(qn(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}const ra=new Set(["©","®","÷"]),ia=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),sa={1:"italic",32:"bold"},oa={1:"italic",2:"bold"},ti={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class ei{constructor(e,t,n){M(this,"path",new Tt);M(this,"lineBox",new Y);M(this,"inlineBox",new Y);M(this,"glyphBox");M(this,"advanceWidth",0);M(this,"advanceHeight",0);M(this,"underlinePosition",0);M(this,"underlineThickness",0);M(this,"strikeoutPosition",0);M(this,"strikeoutSize",0);M(this,"ascender",0);M(this,"descender",0);M(this,"typoAscender",0);M(this,"typoDescender",0);M(this,"typoLineGap",0);M(this,"winAscent",0);M(this,"winDescent",0);M(this,"xHeight",0);M(this,"capHeight",0);M(this,"baseline",0);M(this,"centerDiviation",0);M(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get center(){var e;return(e=this.glyphBox)==null?void 0:e.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(e){const t=this.computedStyle.fontFamily,n=e??Gs,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSFNT()}updateGlyph(e=this._getFontSFNT()){if(!e)return this;const{hhea:t,os2:n,post:r,head:s}=e,i=s.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,d=i/u,p=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/d,y=a/d;return this.advanceWidth=p,this.advanceHeight=m,this.inlineBox.width=f?m:p,this.inlineBox.height=f?p:m,this.underlinePosition=(a-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(a-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=sa[n.fsSelection]??oa[s.macStyle],this}update(e){const t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:s,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:d}=this,{left:p,top:m}=a,y=s.fontStyle==="italic"&&f!=="italic";let P=p,T=m+i,b;const C=new Tt;if(n&&(P+=(d-u)/2,Math.abs(u-d)>.1&&(T-=(l-c)/(l+Math.abs(h))*d),b=void 0),n&&!ra.has(r)&&(r.codePointAt(0)<=256||ia.has(r))){C.addCommands(t.getPathCommands(r,P,m+i-(d-u)/2,s.fontSize));const v={y:m-(d-u)/2+d/2,x:P+u/2};y&&this._italic(C,n?{x:v.x,y:m-(d-u)/2+i}:void 0),C.rotate(90,v)}else b!==void 0?(C.addCommands(t.glyphs.get(b).getPathCommands(P,T,s.fontSize)),y&&this._italic(C,n?{x:P+u/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(C.addCommands(t.getPathCommands(r,P,T,s.fontSize)),y&&this._italic(C,n?{x:P+d/2,y:T}:void 0));const x=s.fontWeight??400;return x in ti&&(x===700||x==="bold")&&f!=="bold"&&C.bold(ti[x]*s.fontSize*.05),C.style={fill:s.color,stroke:s.textStrokeWidth?s.textStrokeColor:"none",strokeWidth:s.textStrokeWidth?s.textStrokeWidth*s.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new Y(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)ne(r);else{e.save(),e.beginPath();const s=this.path.style,i={...s,fill:r.color??s.fill,stroke:r.textStrokeColor??s.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:s.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};Fn(e,i),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function Vn(){const o=new Map;async function e(n){if(!o.has(n)){o.set(n,n);try{o.set(n,await fetch(n).then(r=>r.text()))}catch(r){console.warn(r),o.delete(n)}}}function t(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:o,needsLoad:t,load:e}}function Wn(o){const e=new Map;function t(n){let r=e.get(n);if(!r){const s=Hr(o.needsLoad(n)?o.loaded.get(n)??n:n),i=Jr(s);r={dom:s,pathSet:i},e.set(n,r)}return r}return{parsed:e,parse:t}}function an(o,e){return typeof o=="number"?o:o.endsWith("%")?(o=o.substring(0,o.length-1),Math.ceil(Number(o)/100*e.total)):o.endsWith("rem")?(o=o.substring(0,o.length-3),Number(o)*e.fontSize):o.endsWith("em")?(o=o.substring(0,o.length-2),Number(o)*e.fontSize):Number(o)}function Xn(o){const e=$t(o)?{}:o;return Object.keys(e).reduce((t,n)=>{let r=e[n];const s=Hn(n),i=Hn(r);return s&&(n=s),i&&(r=i),t[n]=r,t},{})}function $t(o){return!o||o==="none"}function ni(o,e){const t=Object.keys(o),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(s=>le(o[s],e[s]))}function le(o,e){const t=typeof o;return t===typeof e?t==="object"?ni(o,e):o===e:!1}function Hn(o){const e=o.startsWith("#")?o.slice(1):o;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${s}, ${i})`}function ln(o){if(!o)return o;const e={};for(const t in o)o[t]!==""&&o[t]!==void 0&&(e[t]=o[t]);return e}class ri{constructor(e,t={},n){M(this,"inlineBox",new Y);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...ln(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new ei(n,t++,this));return this.characters=e,this}}class we{constructor(e,t){M(this,"lineBox",new Y);M(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...ln(this.parentStyle),...ln(this.style)},this}addFragment(e,t){const n=new ri(e,t,this);return this.fragments.push(n),n}}function aa(o){return o}const be=class be{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];be.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&be.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),s={...t},i=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":s.justifyContent="flex-start";break;case"center":s.justifyContent="center";break;case"end":case"right":s.justifyContent="flex-end";break}switch(t.verticalAlign){case"top":s.alignItems="flex-start";break;case"middle":s.alignItems="center";break;case"bottom":s.alignItems="flex-end";break}const a=!!(s.justifyContent||s.alignItems);Object.assign(r.style,{...this._styleToDomStyle({...s,boxSizing:s.boxSizing??"border-box",display:s.display??(a?"inline-flex":void 0),width:s.width??"max-content",height:s.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all",position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&i?"100%":void 0,height:a&&!i?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(s=>{var f;const i=r+=n.substring(r).indexOf(s),a=i+s.length;r+=s.length,t.setStart(e,Math.max(i,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((s,i)=>{const a=s.getBoundingClientRect();t.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{r.push({...u,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(d=>{r.push({...d,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const s=[];let i=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;s.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:d}=f,p=s[i];f.inlineBox.left=p.left,f.inlineBox.top=p.top,f.inlineBox.width=p.width,f.inlineBox.height=p.height,d?(f.lineBox.left=p.left+(p.width-u)/2,f.lineBox.top=p.top,f.lineBox.width=u,f.lineBox.height=p.height):(f.lineBox.left=p.left,f.lineBox.top=p.top+(p.height-u)/2,f.lineBox.width=p.width,f.lineBox.height=u),i++}),{paragraphs:e,boundingBox:new Y(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const s=this.measureParagraphDom(e,n);return r==null||r(),s}};M(be,"notZeroStyles",new Set(["width","height"])),M(be,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let hn=be;function la(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ha(){return{boxShadow:"none"}}function ca(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function fa(){return{...la(),...ca(),...ha(),backgroundImage:"none",backgroundColor:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"#000000",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ua(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function pa(){return{...fa(),...ua()}}class da{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},s=this.eventListeners.get(e);return s?Array.isArray(s)?s.push(r):this.eventListeners.set(e,[s,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var s,i;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((s=c.options)!=null&&s.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(i=r.options)!=null&&i.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,s;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let i=n.length,a=0;a<i;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((s=n.options)!=null&&s.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function ii(){const o=new ae,e=Vn(),t=Wn(e);return{name:"background",pathSet:o,load:async n=>{const{backgroundImage:r}=n.style;r&&e.needsLoad(r)&&await e.load(r)},update:n=>{o.paths.length=0;const{style:r,lineBox:s,isVertical:i}=n;if($t(r.backgroundImage))return;const{pathSet:a}=t.parse(r.backgroundImage),l=a.getBoundingBox(!0),h=new Mt;if(h.translate(-l.x,-l.y),i){h.scale(s.height/l.width,s.width/l.height);const c=s.height/2,f=s.width/2;h.translate(-c,-f),h.rotate(-Math.PI/2),h.translate(f,c)}else h.scale(s.width/l.width,s.height/l.height);h.translate(s.x,s.y),a.paths.forEach(c=>{o.paths.push(c.clone().applyTransform(h))})},render:(n,r)=>{const{boundingBox:s,computedStyle:i}=r;$t(i.backgroundColor)||(n.fillStyle=i.backgroundColor,n.fillRect(...s.array)),o.paths.forEach(a=>{if(ne({ctx:n,path:a,fontSize:i.fontSize}),r.debug){const l=new ae([a]).getBoundingBox();l&&n.strokeRect(l.x,l.y,l.width,l.height)}})}}}function cn(o){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:s,highlightSize:i,highlightThickness:a}=o;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??s??"none",size:(e==null?void 0:e.size)??i??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function si(){const o=new ae,e=[],t=Vn(),n=Wn(t);return{name:"highlight",pathSet:o,load:async r=>{const s=new Set;r.forEachCharacter(i=>{const{computedStyle:a}=i,{image:l,referImage:h}=cn(a);t.needsLoad(l)&&s.add(l),t.needsLoad(h)&&s.add(h)}),await Promise.all(Array.from(s).map(i=>t.load(i)))},update:r=>{e.length=0,o.paths.length=0;let s=[],i,a;r.forEachCharacter(l=>{const{computedStyle:h}=l,c=cn(h),{image:f,colormap:u,line:d,size:p,thickness:m}=c;if($t(f))i!=null&&i.length&&(i=[],s.push(i));else{const{inlineBox:y,isVertical:P}=l,{fontSize:T}=h;(!a||le(a.image,f)&&le(a.colormap,u)&&le(a.line,d)&&le(a.size,p)&&le(a.thickness,m))&&(i!=null&&i.length)&&(P?i[0].inlineBox.left===y.left:i[0].inlineBox.top===y.top)&&i[0].fontSize===T?i.push(l):(i=[],i.push(l),s.push(i))}a=c}),s=s.filter(l=>l.length);for(let l=0;l<s.length;l++){const h=s[l],c=h[0],f=Y.from(...h.filter(L=>L.glyphBox).map(L=>L.glyphBox)),{computedStyle:u,isVertical:d,inlineBox:p,glyphBox:m=p,strikeoutPosition:y,underlinePosition:P}=c,{fontSize:T}=u,{image:b,referImage:C,colormap:x,line:v,size:S,thickness:w}=cn(u),k=an(w,{fontSize:T,total:f.width})/f.width,z=Xn(x),{pathSet:O,dom:E}=n.parse(b),U=O.getBoundingBox(!0),D=T/U.width*2,_=new Y().copy(f);d&&(_.width=f.height,_.height=f.width,_.left=f.left+f.width);const X=Math.floor(_.width);let I=X;S!=="cover"&&(I=an(S,{fontSize:T,total:f.width})||X,_.width=I);const B=!$t(C)&&$t(v);if(B)U.copy(n.parse(C).pathSet.getBoundingBox(!0));else{let L;if($t(v))if(U.width/U.height>4){L="underline";const $=E.getAttribute("viewBox");if($){const[W,F,V,R]=$.split(" ").map(H=>Number(H)),Z=F+R/2;U.y<Z&&U.y+U.height>Z?L="line-through":U.y+U.height<Z?L="overline":L="underline"}}else L="outline";else L=v;switch(L){case"outline":{const $=_.width*.2,W=_.height*.2;d?(_.x-=W/2,_.y-=$/2,_.x-=_.height):(_.x-=$/2,_.y-=W/2),_.width+=$,_.height+=W;break}case"overline":_.height=U.height*D,d?_.x=p.left+p.width:_.y=p.top;break;case"line-through":_.height=U.height*D,d?_.x=p.left+p.width-y+_.height/2:_.y=p.top+y-_.height/2;break;case"underline":_.height=U.height*D,d?_.x=m.left+m.width-P:_.y=p.top+P;break}}const q=new Mt;if(q.translate(-U.x,-U.y),q.scale(_.width/U.width,_.height/U.height),d){const L=_.width/2,$=_.height/2;B||q.translate(-L,-$),q.rotate(-Math.PI/2),B||q.translate($,L)}q.translate(_.x,_.y);for(let L=0;L<Math.ceil(X/I);L++){const $=q.clone();d?$.translate(0,L*_.width):$.translate(L*_.width,0),O.paths.forEach(W=>{const F=W.clone().applyTransform($);F.style.strokeWidth&&(F.style.strokeWidth*=D*k),F.style.strokeMiterlimit&&(F.style.strokeMiterlimit*=D),F.style.strokeDashoffset&&(F.style.strokeDashoffset*=D),F.style.strokeDasharray&&(F.style.strokeDasharray=F.style.strokeDasharray.map(V=>V*D)),F.style.fill&&F.style.fill in z&&(F.style.fill=z[F.style.fill]),F.style.stroke&&F.style.stroke in z&&(F.style.stroke=z[F.style.stroke]),o.paths.push(F),X!==I&&(d?e[o.paths.length-1]=new Y(f.left-f.width*2,f.top,f.width*4,f.height):e[o.paths.length-1]=new Y(f.left,f.top-f.height*2,f.width,f.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const r=[];return o.paths.forEach((s,i)=>{const a=e[i];let l=s.getBoundingBox();if(a){const h=Math.max(l.x,a.x),c=Math.max(l.y,a.y),f=Math.min(l.right,a.right),u=Math.min(l.bottom,a.bottom);l=new Y(h,c,f-h,u-c)}r.push(l)}),Y.from(...r)},render:(r,s)=>{o.paths.forEach((i,a)=>{if(ne({ctx:r,path:i,fontSize:s.computedStyle.fontSize,clipRect:e[a]}),s.debug){const l=new ae([i]).getBoundingBox();l&&r.strokeRect(l.x,l.y,l.width,l.height)}})}}}function ya(o,e){return`<svg width="${o*2}" height="${o*2}" xmlns="http://www.w3.org/2000/svg">
4
+ }`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,s)=>r||this.loaded.get(s),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:s=!0,...i}=t;let a,l;if(typeof e=="string"?a=e:{src:a,family:l}=e,this.loaded.has(a))return n&&(this.loading.forEach(p=>p.cancel()),this.loading.clear()),f(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,i),this.loading.set(a,h)),n&&this.loading.forEach((p,d)=>{p!==h&&(p.cancel(),this.loading.delete(d))}),h.when.then(p=>{if(this.loaded.has(a))return f(this.loaded.get(a));{const d=u(p);return t.noAdd||this.loaded.set(a,d),d.familySet.forEach(m=>{this.familyToUrl.set(m,a),typeof document<"u"&&(r&&this.injectFontFace(m,p),s&&this.injectStyleTag(m,a))}),d}}).catch(p=>{if(p instanceof DOMException&&p.message==="The user aborted a request.")return u();throw p}).finally(()=>{this.loading.delete(a)});function c(){return l?Array.isArray(l)?l:[l]:[]}function f(p){return c().forEach(d=>{p.familySet.add(d)}),p}function u(p=new ArrayBuffer(0)){let d;function m(){return d||(d=p.byteLength?js(p,!1):void 0),d}function y(){const P=m();if(P instanceof Ft||P instanceof En)return P.sfnt}return{src:a,family:l,buffer:p,familySet:new Set(c()),getFont:m,getSFNT:y}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};M(un,"defaultRequestInit",{cache:"force-cache"});let Dn=un;const Gs=new Dn;function Rs(o,e,t=2){const n=e&&e.length,r=n?e[0]*t:o.length;let s=Tr(o,0,r,t,!0);const i=[];if(!s||s.next===s.prev)return i;let a,l,h;if(n&&(s=Hs(o,e,s,t)),o.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const p=o[u],d=o[u+1];p<a&&(a=p),d<l&&(l=d),p>c&&(c=p),d>f&&(f=d)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return Le(s,i,t,a,l,h,0),i}function Tr(o,e,t,n,r){let s;if(r===so(o,e,t,n)>0)for(let i=e;i<t;i+=n)s=_r(i/n|0,o[i],o[i+1],s);else for(let i=t-n;i>=e;i-=n)s=_r(i/n|0,o[i],o[i+1],s);return s&&ge(s,s.next)&&($e(s),s=s.next),s}function se(o,e){if(!o)return o;e||(e=o);let t=o,n;do if(n=!1,!t.steiner&&(ge(t,t.next)||tt(t.prev,t,t.next)===0)){if($e(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Le(o,e,t,n,r,s,i){if(!o)return;!i&&s&&Js(o,n,r,s);let a=o;for(;o.prev!==o.next;){const l=o.prev,h=o.next;if(s?Vs(o,n,r,s):qs(o)){e.push(l.i,o.i,h.i),$e(o),o=h.next,a=h.next;continue}if(o=h,o===a){i?i===1?(o=Ws(se(o),e),Le(o,e,t,n,r,s,2)):i===2&&Xs(o,e,t,n,r,s):Le(se(o),e,t,n,r,s,1);break}}}function qs(o){const e=o.prev,t=o,n=o.next;if(tt(e,t,n)>=0)return!1;const r=e.x,s=t.x,i=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,s,i),f=Math.min(a,l,h),u=Math.max(r,s,i),p=Math.max(a,l,h);let d=n.next;for(;d!==e;){if(d.x>=c&&d.x<=u&&d.y>=f&&d.y<=p&&Ue(r,a,s,l,i,h,d.x,d.y)&&tt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Vs(o,e,t,n){const r=o.prev,s=o,i=o.next;if(tt(r,s,i)>=0)return!1;const a=r.x,l=s.x,h=i.x,c=r.y,f=s.y,u=i.y,p=Math.min(a,l,h),d=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),P=Ln(p,d,e,t,n),T=Ln(m,y,e,t,n);let b=o.prevZ,C=o.nextZ;for(;b&&b.z>=P&&C&&C.z<=T;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=y&&b!==r&&b!==i&&Ue(a,c,l,f,h,u,b.x,b.y)&&tt(b.prev,b,b.next)>=0||(b=b.prevZ,C.x>=p&&C.x<=m&&C.y>=d&&C.y<=y&&C!==r&&C!==i&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;b&&b.z>=P;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=y&&b!==r&&b!==i&&Ue(a,c,l,f,h,u,b.x,b.y)&&tt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;C&&C.z<=T;){if(C.x>=p&&C.x<=m&&C.y>=d&&C.y<=y&&C!==r&&C!==i&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Ws(o,e){let t=o;do{const n=t.prev,r=t.next.next;!ge(n,r)&&kr(n,t,t.next,r)&&Fe(n,r)&&Fe(r,n)&&(e.push(n.i,t.i,r.i),$e(t),$e(t.next),t=o=r),t=t.next}while(t!==o);return se(t)}function Xs(o,e,t,n,r,s){let i=o;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&no(i,a)){let l=Ir(i,a);i=se(i,i.next),l=se(l,l.next),Le(i,e,t,n,r,s,0),Le(l,e,t,n,r,s,0);return}a=a.next}i=i.next}while(i!==o)}function Hs(o,e,t,n){const r=[];for(let s=0,i=e.length;s<i;s++){const a=e[s]*n,l=s<i-1?e[s+1]*n:o.length,h=Tr(o,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(eo(h))}r.sort(Zs);for(let s=0;s<r.length;s++)t=Ys(r[s],t);return t}function Zs(o,e){let t=o.x-e.x;if(t===0&&(t=o.y-e.y,t===0)){const n=(o.next.y-o.y)/(o.next.x-o.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Ys(o,e){const t=Ks(o,e);if(!t)return e;const n=Ir(t,o);return se(n,n.next),se(t,t.next)}function Ks(o,e){let t=e;const n=o.x,r=o.y;let s=-1/0,i;if(ge(o,t))return t;do{if(ge(o,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,i=t.x<t.next.x?t:t.next,f===n))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,l=i.x,h=i.y;let c=1/0;t=i;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Ar(r<h?n:s,r,l,h,r<h?s:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Fe(t,o)&&(f<c||f===c&&(t.x>i.x||t.x===i.x&&Qs(i,t)))&&(i=t,c=f)}t=t.next}while(t!==a);return i}function Qs(o,e){return tt(o.prev,o,e.prev)<0&&tt(e.next,o,o.next)<0}function Js(o,e,t,n){let r=o;do r.z===0&&(r.z=Ln(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==o);r.prevZ.nextZ=null,r.prevZ=null,to(r)}function to(o){let e,t=1;do{let n=o,r;o=null;let s=null;for(e=0;n;){e++;let i=n,a=0;for(let h=0;h<t&&(a++,i=i.nextZ,!!i);h++);let l=t;for(;a>0||l>0&&i;)a!==0&&(l===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:o=r,r.prevZ=s,s=r;n=i}s.nextZ=null,t*=2}while(e>1);return o}function Ln(o,e,t,n,r){return o=(o-t)*r|0,e=(e-n)*r|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function eo(o){let e=o,t=o;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==o);return t}function Ar(o,e,t,n,r,s,i,a){return(r-i)*(e-a)>=(o-i)*(s-a)&&(o-i)*(n-a)>=(t-i)*(e-a)&&(t-i)*(s-a)>=(r-i)*(n-a)}function Ue(o,e,t,n,r,s,i,a){return!(o===i&&e===a)&&Ar(o,e,t,n,r,s,i,a)}function no(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!ro(o,e)&&(Fe(o,e)&&Fe(e,o)&&io(o,e)&&(tt(o.prev,o,e.prev)||tt(o,e.prev,e))||ge(o,e)&&tt(o.prev,o,o.next)>0&&tt(e.prev,e,e.next)>0)}function tt(o,e,t){return(e.y-o.y)*(t.x-e.x)-(e.x-o.x)*(t.y-e.y)}function ge(o,e){return o.x===e.x&&o.y===e.y}function kr(o,e,t,n){const r=en(tt(o,e,t)),s=en(tt(o,e,n)),i=en(tt(t,n,o)),a=en(tt(t,n,e));return!!(r!==s&&i!==a||r===0&&tn(o,t,e)||s===0&&tn(o,n,e)||i===0&&tn(t,o,n)||a===0&&tn(t,e,n))}function tn(o,e,t){return e.x<=Math.max(o.x,t.x)&&e.x>=Math.min(o.x,t.x)&&e.y<=Math.max(o.y,t.y)&&e.y>=Math.min(o.y,t.y)}function en(o){return o>0?1:o<0?-1:0}function ro(o,e){let t=o;do{if(t.i!==o.i&&t.next.i!==o.i&&t.i!==e.i&&t.next.i!==e.i&&kr(t,t.next,o,e))return!0;t=t.next}while(t!==o);return!1}function Fe(o,e){return tt(o.prev,o,o.next)<0?tt(o,e,o.next)>=0&&tt(o,o.prev,e)>=0:tt(o,e,o.prev)<0||tt(o,o.next,e)<0}function io(o,e){let t=o,n=!1;const r=(o.x+e.x)/2,s=(o.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==o);return n}function Ir(o,e){const t=Un(o.i,o.x,o.y),n=Un(e.i,e.x,e.y),r=o.next,s=e.prev;return o.next=e,e.prev=o,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function _r(o,e,t,n){const r=Un(o,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $e(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Un(o,e,t){return{i:o,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function so(o,e,t,n){let r=0;for(let s=e,i=t-n;s<t;s+=n)r+=(o[i]-o[s])*(o[s+1]+o[i+1]),i=s;return r}function oo(o,e,t,n={}){const{radius:r=1}=n;o.moveTo(e,t),o.arc(e,t,r,0,Math.PI*2)}const ao={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Fn(o,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:i="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:p="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=n,o.lineWidth=r,o.lineCap=s,o.lineJoin=ao[i],o.miterLimit=a,o.setLineDash(l),o.lineDashOffset=h,o.shadowOffsetX=c,o.shadowOffsetY=f,o.shadowBlur=u,o.shadowColor=p}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,s=-(this.y-t.y),i=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-s*i),t.y-(r*i+s*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,s=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=s*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,s=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*s),this.y=n.y+(s+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class X{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new X;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new X(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new X(this.left,this.top,this.width,this.height)}}class Mt{constructor(e=1,t=0,n=0,r=0,s=1,i=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,s,i,a,l,h)}set(e,t,n,r,s,i,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=n,c[7]=i,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,i=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],p=n[5],d=n[8],m=r[0],y=r[3],P=r[6],T=r[1],b=r[4],C=r[7],x=r[2],v=r[5],S=r[8];return s[0]=i*m+a*T+l*x,s[3]=i*y+a*b+l*v,s[6]=i*P+a*C+l*S,s[1]=h*m+c*T+f*x,s[4]=h*y+c*b+f*v,s[7]=h*P+c*C+f*S,s[2]=u*m+p*T+d*x,s[5]=u*y+p*b+d*v,s[8]=u*P+p*C+d*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*i-a*h,u=a*l-c*s,p=h*s-i*l,d=t*f+n*u+r*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*i)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*s-a*t)*m,e[6]=p*m,e[7]=(n*l-h*t)*m,e[8]=(i*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply($n.makeScale(e,t)),this}rotate(e){return this.premultiply($n.makeRotation(-e)),this}translate(e,t){return this.premultiply($n.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const $n=new Mt;function Or(o,e,t,n){const r=o*t+e*n,s=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+n*n);let i=Math.acos(Math.max(-1,Math.min(1,r/s)));return o*n-e*t<0&&(i=-i),i}function lo(o,e,t,n,r,s,i,a){if(e===0||t===0){o.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(i.x-a.x)/2,h=(i.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,f=-Math.sin(n)*l+Math.cos(n)*h;let u=e*e,p=t*t;const d=c*c,m=f*f,y=d/u+m/p;if(y>1){const z=Math.sqrt(y);e=z*e,t=z*t,u=e*e,p=t*t}const P=u*m+p*d,T=(u*p-P)/P;let b=Math.sqrt(Math.max(0,T));r===s&&(b=-b);const C=b*e*f/t,x=-b*t*c/e,v=Math.cos(n)*C-Math.sin(n)*x+(i.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(i.y+a.y)/2,w=Or(1,0,(c-C)/e,(f-x)/t),k=Or((c-C)/e,(f-x)/t,(-c-C)/e,(-f-x)/t)%(Math.PI*2);o.ellipse(v,S,e,t,n,w,w+k,s===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function qt(o,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,P,T){const b=new SyntaxError(`Unexpected character "${y}" at index ${P}.`);throw b.partial=T,b}function p(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let d;const m=o.length;for(let y=0;y<m;y++){if(d=o[y],Array.isArray(e)&&e.includes(f.length%t)&&it.FLAGS.test(d)){a=1,h=d,p();continue}if(a===0){if(it.WHITESPACE.test(d))continue;if(it.DIGIT.test(d)||it.SIGN.test(d)){a=1,h=d;continue}if(it.POINT.test(d)){a=2,h=d;continue}it.COMMA.test(d)&&(l&&u(d,y,f),l=!0)}if(a===1){if(it.DIGIT.test(d)){h+=d;continue}if(it.POINT.test(d)){h+=d,a=2;continue}if(it.EXP.test(d)){a=3;continue}it.SIGN.test(d)&&h.length===1&&it.SIGN.test(h[0])&&u(d,y,f)}if(a===2){if(it.DIGIT.test(d)){h+=d;continue}if(it.EXP.test(d)){a=3;continue}it.POINT.test(d)&&h[h.length-1]==="."&&u(d,y,f)}if(a===3){if(it.DIGIT.test(d)){c+=d;continue}if(it.SIGN.test(d)){if(c===""){c+=d;continue}c.length===1&&it.SIGN.test(c)&&u(d,y,f)}}it.WHITESPACE.test(d)?(p(),a=0,l=!1):it.COMMA.test(d)?(p(),a=0,l=!0):it.SIGN.test(d)?(p(),a=1,h=d):it.POINT.test(d)?(p(),a=2,h=d):u(d,y,f)}return p(),f}function me(o,e){return o-(e-o)}function Br(o,e){const t=new A,n=new A;for(let r=0,s=o.length;r<s;r++){const i=o[r];if(i.type==="m"||i.type==="M")i.type==="m"?t.add(i):t.copy(i),e.moveTo(t.x,t.y),n.copy(t);else if(i.type==="h"||i.type==="H")i.type==="h"?t.x+=i.x:t.x=i.x,e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="v"||i.type==="V")i.type==="v"?t.y+=i.y:t.y=i.y,e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="l"||i.type==="L")i.type==="l"?t.add(i):t.copy(i),e.lineTo(t.x,t.y),n.copy(t);else if(i.type==="c"||i.type==="C")i.type==="c"?(e.bezierCurveTo(t.x+i.x1,t.y+i.y1,t.x+i.x2,t.y+i.y2,t.x+i.x,t.y+i.y),n.x=t.x+i.x2,n.y=t.y+i.y2,t.add(i)):(e.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y),n.x=i.x2,n.y=i.y2,t.copy(i));else if(i.type==="s"||i.type==="S")i.type==="s"?(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),t.x+i.x2,t.y+i.y2,t.x+i.x,t.y+i.y),n.x=t.x+i.x2,n.y=t.y+i.y2,t.add(i)):(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),i.x2,i.y2,i.x,i.y),n.x=i.x2,n.y=i.y2,t.copy(i));else if(i.type==="q"||i.type==="Q")i.type==="q"?(e.quadraticCurveTo(t.x+i.x1,t.y+i.y1,t.x+i.x,t.y+i.y),n.x=t.x+i.x1,n.y=t.y+i.y1,t.add(i)):(e.quadraticCurveTo(i.x1,i.y1,i.x,i.y),n.x=i.x1,n.y=i.y1,t.copy(i));else if(i.type==="t"||i.type==="T"){const a=me(t.x,n.x),l=me(t.y,n.y);n.x=a,n.y=l,i.type==="t"?(e.quadraticCurveTo(a,l,t.x+i.x,t.y+i.y),t.add(i)):(e.quadraticCurveTo(a,l,i.x,i.y),t.copy(i))}else if(i.type==="a"||i.type==="A"){const a=t.clone();if(i.type==="a"){if(i.x===0&&i.y===0)continue;t.add(i)}else{if(t.equals(i))continue;t.copy(i)}n.copy(t),lo(e,i.rx,i.ry,i.angle,i.largeArcFlag,i.sweepFlag,a,t)}else i.type==="z"||i.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",i)}}function ho(o){let e,t;const n=[];for(let r=0,s=o.length;r<s;r++){const i=o[r];switch(i.type){case"m":case"M":if(i.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&i.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y},e={x:i.x,y:i.y};break;case"h":case"H":n.push(`${i.type} ${i.x}`),t={x:i.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${i.type} ${i.y}`),t={x:(t==null?void 0:t.x)??0,y:i.y};break;case"l":case"L":n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"c":case"C":n.push(`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"s":case"S":n.push(`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"q":case"Q":n.push(`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"t":case"T":n.push(`${i.type} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"a":case"A":n.push(`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`),t={x:i.x,y:i.y};break;case"z":case"Z":n.push(i.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const co=/[a-df-z][^a-df-z]*/gi;function Er(o){const e=[],t=o.match(co);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const s=t[n],i=s.charAt(0),a=s.slice(1).trim();let l;switch(i){case"m":case"M":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:i,x:l[h],y:l[h+1]}):e.push({type:i==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:i,x:l[h]});break;case"v":case"V":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:i,y:l[h]});break;case"l":case"L":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:i,x:l[h],y:l[h+1]});break;case"c":case"C":l=qt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:i,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:i,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:i,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:i,x:l[h],y:l[h+1]});break;case"a":case"A":l=qt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:i,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:i});break;default:console.warn(s)}}return e}function Dr(o,e,t,n,r){const s=(n-e)*.5,i=(r-t)*.5,a=o*o,l=o*a;return(2*t-2*n+s+i)*l+(-3*t+3*n-2*s-i)*a+s*o+t}function fo(o,e){const t=1-o;return t*t*t*e}function uo(o,e){const t=1-o;return 3*t*t*o*e}function po(o,e){return 3*(1-o)*o*o*e}function yo(o,e){return o*o*o*e}function Lr(o,e,t,n,r){return fo(o,e)+uo(o,t)+po(o,n)+yo(o,r)}function Ur(o,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:s=2,verticesOffset:i=t.length/s,indicesOffset:a=n.length}=e;const l=Rs(o,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+i,n[a++]=l[c+1]+i,n[a++]=l[c+2]+i;let h=i*s;for(let c=0;c<o.length;c+=2)t[h]=o[c],t[h+1]=o[c+1],h+=s}return{vertices:t,indices:n}}const go=8,nn=11920929e-14,mo=1;function xo(o,e,t,n,r,s,i,a,l=.5,h=[]){const f=Math.min(.99,Math.max(0,l));let u=(mo-f)/1;return u*=u,zn(o,e,t,n,r,s,i,a,h,u,0),h.push(i,a),h}function zn(o,e,t,n,r,s,i,a,l,h,c){if(c>go)return;const f=(o+t)/2,u=(e+n)/2,p=(t+r)/2,d=(n+s)/2,m=(r+i)/2,y=(s+a)/2,P=(f+p)/2,T=(u+d)/2,b=(p+m)/2,C=(d+y)/2,x=(P+b)/2,v=(T+C)/2;if(c>0){let S=i-o,w=a-e;const k=Math.abs((t-i)*w-(n-a)*S),z=Math.abs((r-i)*w-(s-a)*S);if(k>nn&&z>nn){if((k+z)*(k+z)<=h*(S*S+w*w)){l.push(x,v);return}}else if(k>nn){if(k*k<=h*(S*S+w*w)){l.push(x,v);return}}else if(z>nn){if(z*z<=h*(S*S+w*w)){l.push(x,v);return}}else if(S=x-(o+i)/2,w=v-(e+a)/2,S*S+w*w<=h){l.push(x,v);return}}zn(o,e,f,u,P,T,x,v,l,h,c+1),zn(x,v,b,C,m,y,i,a,l,h,c+1)}const wo=8,vo=11920929e-14,bo=1;function So(o,e,t,n,r,s,i=.5,a=[]){const h=Math.min(.99,Math.max(0,i));let c=(bo-h)/1;return c*=c,Nn(a,o,e,t,n,r,s,c,0),a.push(r,s),a}function Nn(o,e,t,n,r,s,i,a,l){if(l>wo)return;const h=(e+n)/2,c=(t+r)/2,f=(n+s)/2,u=(r+i)/2,p=(h+f)/2,d=(c+u)/2;let m=s-e,y=i-t;const P=Math.abs((n-s)*y-(r-i)*m);if(P>vo){if(P*P<=a*(m*m+y*y)){o.push(p,d);return}}else if(m=p-(e+s)/2,y=d-(t+i)/2,m*m+y*y<=a){o.push(p,d);return}Nn(o,e,t,h,c,p,d,a,l+1),Nn(o,p,d,f,u,s,i,a,l+1)}function Mo(o,e){const t=1-o;return t*t*e}function Co(o,e){return 2*(1-o)*o*e}function Po(o,e){return o*o*e}function Fr(o,e,t,n){return Mo(o,e)+Co(o,t)+Po(o,n)}const To=1e-4,$r=1e-4;function Ao(o,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:s=!1,closed:i=!0}=e,a=To;if(o.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=ko(o);s&&(L*=-1),h=(h-.5)*L+.5}const c={x:o[0],y:o[1]},f={x:o[o.length-2],y:o[o.length-1]},u=i,p=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){o=o.slice(),p&&(o.pop(),o.pop(),f.x=o[o.length-2],f.y=o[o.length-1]);const L=(c.x+f.x)*.5,$=(f.y+c.y)*.5;o.unshift(L,$),o.push(L,$)}const d=t,m=o.length/2;let y=o.length;const P=d.length/2,T=l.width/2,b=T*T,C=l.miterLimit*l.miterLimit;let x=o[0],v=o[1],S=o[2],w=o[3],k=0,z=0,O=-(v-w),B=x-S,U=0,D=0,_=Math.sqrt(O*O+B*B);O/=_,B/=_,O*=T,B*=T;const H=h,I=(1-H)*2,E=H*2;u||(l.cap==="round"?y+=oe(x-O*(I-E)*.5,v-B*(I-E)*.5,x-O*I,v-B*I,x+O*E,v+B*E,d,!0)+2:l.cap==="square"&&(y+=zr(x,v,O,B,I,E,!0,d))),d.push(x-O*I,v-B*I),d.push(x+O*E,v+B*E);for(let L=1;L<m-1;++L){x=o[(L-1)*2],v=o[(L-1)*2+1],S=o[L*2],w=o[L*2+1],k=o[(L+1)*2],z=o[(L+1)*2+1],O=-(v-w),B=x-S,_=Math.sqrt(O*O+B*B),O/=_,B/=_,O*=T,B*=T,U=-(w-z),D=S-k,_=Math.sqrt(U*U+D*D),U/=_,D/=_,U*=T,D*=T;const $=S-x,W=v-w,F=S-k,V=z-w,R=$*F+W*V,Y=W*F-V*$,Z=Y<0;if(Math.abs(Y)<.001*Math.abs(R)){d.push(S-O*I,w-B*I),d.push(S+O*E,w+B*E),R>=0&&(l.join==="round"?y+=oe(S,w,S-O*I,w-B*I,S-U*I,w-D*I,d,!1)+4:y+=2,d.push(S-U*E,w-D*E),d.push(S+U*I,w+D*I));continue}const nt=(-O+x)*(-B+w)-(-O+S)*(-B+v),Wt=(-U+k)*(-D+w)-(-U+S)*(-D+z),Bt=($*Wt-F*nt)/Y,Ct=(V*nt-W*Wt)/Y,At=(Bt-S)*(Bt-S)+(Ct-w)*(Ct-w),ht=S+(Bt-S)*I,kt=w+(Ct-w)*I,zt=S-(Bt-S)*E,Nt=w-(Ct-w)*E,Et=Math.min($*$+W*W,F*F+V*V),ci=Z?I:E,xa=Et+ci*ci*b;At<=xa?l.join==="bevel"||At/b>C?(Z?(d.push(ht,kt),d.push(S+O*E,w+B*E),d.push(ht,kt),d.push(S+U*E,w+D*E)):(d.push(S-O*I,w-B*I),d.push(zt,Nt),d.push(S-U*I,w-D*I),d.push(zt,Nt)),y+=2):l.join==="round"?Z?(d.push(ht,kt),d.push(S+O*E,w+B*E),y+=oe(S,w,S+O*E,w+B*E,S+U*E,w+D*E,d,!0)+4,d.push(ht,kt),d.push(S+U*E,w+D*E)):(d.push(S-O*I,w-B*I),d.push(zt,Nt),y+=oe(S,w,S-O*I,w-B*I,S-U*I,w-D*I,d,!1)+4,d.push(S-U*I,w-D*I),d.push(zt,Nt)):(d.push(ht,kt),d.push(zt,Nt)):(d.push(S-O*I,w-B*I),d.push(S+O*E,w+B*E),l.join==="round"?Z?y+=oe(S,w,S+O*E,w+B*E,S+U*E,w+D*E,d,!0)+2:y+=oe(S,w,S-O*I,w-B*I,S-U*I,w-D*I,d,!1)+2:l.join==="miter"&&At/b<=C&&(Z?(d.push(zt,Nt),d.push(zt,Nt)):(d.push(ht,kt),d.push(ht,kt)),y+=2),d.push(S-U*I,w-D*I),d.push(S+U*E,w+D*E),y+=2)}x=o[(m-2)*2],v=o[(m-2)*2+1],S=o[(m-1)*2],w=o[(m-1)*2+1],O=-(v-w),B=x-S,_=Math.sqrt(O*O+B*B),O/=_,B/=_,O*=T,B*=T,d.push(S-O*I,w-B*I),d.push(S+O*E,w+B*E),u||(l.cap==="round"?y+=oe(S-O*(I-E)*.5,w-B*(I-E)*.5,S-O*I,w-B*I,S+O*E,w+B*E,d,!1)+2:l.cap==="square"&&(y+=zr(S,w,O,B,I,E,!1,d)));const q=$r*$r;for(let L=P;L<y+P-2;++L)x=d[L*2],v=d[L*2+1],S=d[(L+1)*2],w=d[(L+1)*2+1],k=d[(L+2)*2],z=d[(L+2)*2+1],!(Math.abs(x*(w-z)+S*(z-v)+k*(v-w))<q)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function ko(o){const e=o.length;if(e<6)return 1;let t=0;for(let n=0,r=o[e-2],s=o[e-1];n<e;n+=2){const i=o[n],a=o[n+1];t+=(i-r)*(a+s),r=i,s=a}return t<0?-1:1}function zr(o,e,t,n,r,s,i,a){const l=o-t*r,h=e-n*r,c=o+t*s,f=e+n*s;let u,p;i?(u=n,p=-t):(u=-n,p=t);const d=l+u,m=h+p,y=c+u,P=f+p;return a.push(d,m),a.push(y,P),2}function oe(o,e,t,n,r,s,i,a){const l=t-o,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-o,s-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const p=f-c,d=Math.abs(p),m=Math.sqrt(l*l+h*h),y=(15*d*Math.sqrt(m)/Math.PI>>0)+1,P=p/y;if(u+=P,a){i.push(o,e),i.push(t,n);for(let T=1,b=u;T<y;T++,b+=P)i.push(o,e),i.push(o+Math.sin(b)*m,e+Math.cos(b)*m);i.push(o,e),i.push(r,s)}else{i.push(t,n),i.push(o,e);for(let T=1,b=u;T<y;T++,b+=P)i.push(o+Math.sin(b)*m,e+Math.cos(b)*m),i.push(o,e);i.push(r,s),i.push(o,e)}return y*2}class xe{constructor(){M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new A;for(let r=0,s=Math.max(1,e)-1;r<=s;r++)this.getPoint(r/s,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new A;for(let r=0,s=Math.max(1,e)-1;r<=s;r++)this.getPointAt(r/s,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const s=e[n],i=e[n+1];t.push(new A(s,i))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),s=1;s<=e;s++){const i=this.getPoint(s/e);n+=i.distanceTo(r),t.push(n),r=i}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,s=t??e*n[r-1];if(r<2)return s/n[0];let i=0,a=0,l=r-1,h;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),h=n[i]-s,h<0)a=i+1;else if(h>0)l=i-1;else{l=i;break}if(i=l,n[i]===s)return i/(r-1);const c=n[i],u=n[i+1]-c,p=(s-c)/u;return(i+p)/(r-1)}getTangent(e,t=new A){const r=Math.max(0,e-1e-4),s=Math.min(1,e+1e-4);return t.copy(this.getPoint(s).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,s=(n+r)/2;for(;r-n>t;){s=(n+r)/2;const i=this.getPoint(s);if(i.distanceTo(e)<t)return s;i.x<e.x?n=s:r=s}return s}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let r=0,s=n.length;r<s;r++){const i=n[r];e.min(i),t.max(i)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new X(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return Ur(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Ao(this.getAdaptivePointArray(),e)}toTriangulatedSVGString(e=this.fillTriangulate(),t=0){const{vertices:n,indices:r}=e,s={x:-t,y:-t},i={x:t,y:t},a=c=>{const f=n[c*2],u=n[c*2+1];return s.x=Math.min(s.x,f+t),i.x=Math.max(i.x,f+t),s.y=Math.min(s.y,u+t),i.y=Math.max(i.y,u+t),[f,u]};let l="";for(let c=0,f=r.length;c<f;c+=3){const u=a(r[c]),p=a(r[c+1]),d=a(r[c+2]);l+=`<polygon points="${u.join(",")} ${p.join(",")} ${d.join(",")}" fill="none" stroke="black" />`}const h=[s.x,s.y,i.x-s.x,i.y-s.y];return`<svg width="${h[2]}" height="${h[3]}" viewBox="${h.join(" ")}" xmlns="http://www.w3.org/2000/svg">${l}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const s=t[n];n===0?e.push({type:"M",x:s.x,y:s.y}):e.push({type:"L",x:s.x,y:s.y})}return e}toData(){return ho(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Io=new Mt,Nr=new Mt,jr=new Mt,rn=new A;class jn extends xe{constructor(e=new A,t=new A,n=new A,r=0,s=0,i=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=s,this.endAngle=i,this.clockwise=a}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new A){const n=this._getDeltaAngle(),r=this.startAngle+e*n;let s=this.cx+this.rx*Math.cos(r),i=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),h=s-this.cx,c=i-this.cy;s=h*a-c*l+this.cx,i=h*l+c*a+this.cy}return t.set(s,i)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:s,endAngle:i,clockwise:a,rotate:l}=this,h=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),c=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l),f=Math.abs(s-i),u=f>Math.PI?1:0,p=a?1:0,d=l*180/Math.PI;if(f>=2*Math.PI){const m=s+Math.PI,y=e+n*Math.cos(m)*Math.cos(l)-r*Math.sin(m)*Math.sin(l),P=t+n*Math.cos(m)*Math.sin(l)+r*Math.sin(m)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:p,x:y,y:P},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:p,x:h,y:c}]}else{const m=e+n*Math.cos(i)*Math.cos(l)-r*Math.sin(i)*Math.sin(l),y=t+n*Math.cos(i)*Math.sin(l)+r*Math.sin(i)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:u,sweepFlag:p,x:m,y}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:s,rotate:i,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,s,i,a,l,!h),this}applyTransform(e){return rn.set(this.cx,this.cy),rn.applyMatrix3(e),this.cx=rn.x,this.cy=rn.y,Bo(e)?_o(this,e):Oo(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:s,dx:i,dy:a}=this;if(!(r>=0&&s>=0&&i>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+s)),h=t,c=n,f=l*8+(i?4:0)+(a?4:0);if(f===0)return e;if(l===0)return e[0]=e[6]=h+i,e[1]=e[3]=c+a,e[2]=e[4]=h-i,e[5]=e[7]=c-a,e;let u=0,p=l*4+(i?2:0)+2,d=p,m=f,y=i+r,P=a,T=h+y,b=h-y,C=c+P;if(e[u++]=T,e[u++]=C,e[--p]=C,e[--p]=b,a){const v=c-P;e[d++]=b,e[d++]=v,e[--m]=v,e[--m]=T}for(let v=1;v<l;v++){const S=Math.PI/2*(v/l),w=i+Math.cos(S)*r,k=a+Math.sin(S)*s,z=h+w,O=h-w,B=c+k,U=c-k;e[u++]=z,e[u++]=B,e[--p]=B,e[--p]=O,e[d++]=O,e[d++]=U,e[--m]=U,e[--m]=z}y=i,P=a+s,T=h+y,b=h-y,C=c+P;const x=c-P;return e[u++]=T,e[u++]=C,e[--m]=x,e[--m]=T,i&&(e[u++]=b,e[u++]=C,e[--m]=x,e[--m]=b),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let u=0;u<a.length;u+=2)l+=a[u],h+=a[u+1];l/=a.length/2,h/=a.length/2;let c=s;t[c*r]=l,t[c*r+1]=h;const f=c++;for(let u=0;u<a.length;u+=2)t[c*r]=a[u],t[c*r+1]=a[u+1],u>0&&(n[i++]=c,n[i++]=f,n[i++]=c-1),c++;return n[i++]=f+1,n[i++]=f,n[i++]=c-1,{vertices:t,indices:n}}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:r,rx:s,ry:i,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(s*s*l*l+i*i*h*h),f=Math.sqrt(s*s*h*h+i*i*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-f),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+f),{min:e,max:t}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function _o(o,e){const t=o.rx,n=o.ry,r=Math.cos(o.rotate),s=Math.sin(o.rotate),i=new A(t*r,t*s),a=new A(-n*s,n*r),l=i.applyMatrix3(e),h=a.applyMatrix3(e),c=Io.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=Nr.copy(c).invert(),d=jr.copy(f).transpose().multiply(f).elements,m=Eo(d[0],d[1],d[4]),y=Math.sqrt(m.rt1),P=Math.sqrt(m.rt2);if(o.rx=1/y,o.ry=1/P,o.rotate=Math.atan2(m.sn,m.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=Nr.set(y,0,0,0,P,0,0,0,1),C=jr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),x=b.multiply(C).multiply(c),v=S=>{const{x:w,y:k}=new A(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(k,w)};o.startAngle=v(o.startAngle),o.endAngle=v(o.endAngle),Gr(e)&&(o.clockwise=!o.clockwise)}}function Oo(o,e){const t=Rr(e),n=qr(e);o.rx*=t,o.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotate+=r,Gr(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function Gr(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Bo(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=Rr(o),r=qr(o);return Math.abs(t/(n*r))>Number.EPSILON}function Rr(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function qr(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Eo(o,e,t){let n,r,s,i,a;const l=o+t,h=o-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=o*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?s=h+c:s=h-c,Math.abs(s)>2*Math.abs(e)?(a=-2*e/s,i=1/Math.sqrt(1+a*a),s=a*i):Math.abs(e)===0?(s=1,i=0):(a=-.5*s/e,s=1/Math.sqrt(1+a*a),i=a*s),h>0&&(a=s,s=-i,i=a),{rt1:n,rt2:r,cs:s,sn:i}}class Do extends jn{constructor(e=0,t=0,n=1,r=0,s=Math.PI*2,i=!1){super(new A(e,t),new A(n,n),new A,0,r,s,i)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:s,endAngle:i,clockwise:a}=this;return e.arc(t,n,r,s,i,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:s,endAngle:i,clockwise:a}=this;let l=Math.abs(s-i);(!a&&s>i||a&&i>s)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=s;c*=a?1:-1;for(let u=0;u<h+1;u++){const p=Math.cos(f),d=Math.sin(f),m=t+p*r,y=n+d*r;e.push(m,y),f+=c}return e}}class Ht extends xe{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Ht(new A(e,t),new A(n,r))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const a=this.p1.x,l=this.p1.y,h=this.p2.x-this.p1.x||1,c=this.p2.y-this.p2.y||1,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;s*=r,t[s+u]=f[0],t[s+u+1]=f[1],u+=r,t[s+u]=f[2],t[s+u+1]=f[3],u+=r,t[s+u]=f[6],t[s+u+1]=f[7],u+=r,t[s+u]=f[4],t[s+u+1]=f[5],u+=r;const p=s/r;return n[i++]=p,n[i++]=p+1,n[i++]=p+2,n[i++]=p+1,n[i++]=p+3,n[i++]=p+2,{vertices:t,indices:n}}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class ze extends xe{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof ze?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),r=this.getLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const i=r[s]-n,a=this.curves[s],l=a.getLength();return a.getPointAt(l===0?0:1-i/l,t)}s++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){return e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),e}getSpacedPointArray(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedPointArray(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}fillTriangulate(e){const t=(e==null?void 0:e.indices)??[],n=(e==null?void 0:e.vertices)??[],r=[],s=()=>{if(r.length){const i=[];r.forEach(a=>{const l=a.p1.x,h=a.p1.y;(i[i.length-2]!==l||i[i.length-1]!==h)&&i.push(l,h),i.push(a.p2.x,a.p2.y)}),Ur(i,{...e,indices:t,vertices:n}),r.length=0}};return this.curves.forEach(i=>{i instanceof Ht?r.push(i):(s(),i.fillTriangulate({...e,indices:t,vertices:n}))}),s(),{indices:t,vertices:n}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new X(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Gn extends xe{constructor(e=new A,t=new A,n=new A,r=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,s,i,a,l){return new Gn(new A(e,t),new A(n,r),new A(s,i),new A(a,l))}getPoint(e,t=new A){const{p1:n,cp1:r,cp2:s,p2:i}=this;return t.set(Lr(e,n.x,r.x,s.x,i.x),Lr(e,n.y,r.y,s.y,i.y))}getAdaptivePointArray(e=[]){return xo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const s=Math.sqrt(r),i=(-t+s)/(2*e),a=(-t-s)/(2*e);return[i,a].filter(l=>l>=0&&l<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:r,cp2:s,p2:i}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(s.x-r.x),3*(i.x-s.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(s.y-r.y),3*(i.y-s.y)),h=[0,1,...a,...l];return((f,u)=>{for(const p of f)for(let d=0;d<=u;d++){const m=d/u-.5,y=Math.min(1,Math.max(0,p+m)),P=this.getPoint(y);e.x=Math.min(e.x,P.x),e.y=Math.min(e.y,P.y),t.x=Math.max(t.x,P.x),t.y=Math.max(t.y,P.y)}})(h,10),{min:e,max:t}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:s}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,s.x,s.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class Lo extends jn{constructor(e=0,t=0,n=1,r=1,s=0,i=0,a=Math.PI*2,l=!1){super(new A(e,t),new A(n,r),new A,s,i,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Uo extends ze{}class Rn extends xe{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,s,i){return new Rn(new A(e,t),new A(n,r),new A(s,i))}getPoint(e,t=new A){const{p1:n,cp:r,p2:s}=this;return t.set(Fr(e,n.x,r.x,s.x),Fr(e,n.y,r.y,s.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return So(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:r,p2:s}=this,i=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+s.x),h=.5*(n.y+s.y);return e.x=Math.min(e.x,n.x,s.x,i,l),e.y=Math.min(e.y,n.y,s.y,a,h),t.x=Math.max(t.x,n.x,s.x,i,l),t.y=Math.max(t.y,n.y,s.y,a,h),{min:e,max:t}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class Fo extends Uo{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,s=[new A(e,t),new A(e+n,t),new A(e+n,t+r),new A(e,t+r)];return this.curves=[new Ht(s[0],s[1]),new Ht(s[1],s[2]),new Ht(s[2],s[3]),new Ht(s[3],s[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:s=t.length/r,indicesOffset:i=n.length}=e;const{x:a,y:l,width:h,height:c}=this,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;s*=r,t[s+u]=f[0],t[s+u+1]=f[1],u+=r,t[s+u]=f[2],t[s+u+1]=f[3],u+=r,t[s+u]=f[6],t[s+u+1]=f[7],u+=r,t[s+u]=f[4],t[s+u+1]=f[5],u+=r;const p=s/r;return n[i++]=p,n[i++]=p+1,n[i++]=p+2,n[i++]=p+1,n[i++]=p+3,n[i++]=p+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class $o extends jn{constructor(e=0,t=0,n=1,r=1,s=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=s,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:s}=this,i=n/2,a=r/2,l=e+i,h=t+a,c=Math.max(0,Math.min(s,Math.min(i,a))),f=c;return this._center=new A(l,h),this._radius=new A(c,f),this._diff=new A(i-c,a-f),this}drawTo(e){const{x:t,y:n,width:r,height:s,radius:i}=this;return e.roundRect(t,n,r,s,i),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class zo extends xe{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,r=(n.length-1)*e,s=Math.floor(r),i=r-s,a=n[s===0?s:s-1],l=n[s],h=n[s>n.length-2?n.length-1:s+1],c=n[s>n.length-3?n.length-1:s+2];return t.set(Dr(i,a.x,l.x,h.x,c.x),Dr(i,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class sn extends ze{constructor(t){super();M(this,"startPoint");M(this,"currentPoint");M(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:s,y:i}=t[n];this.lineTo(s,i)}return this}addCommands(t){return Br(t,this),this}addData(t){return this.addCommands(Er(t)),this}_closePointArray(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenPointArray(t=40,n=[]){return this._closePointArray(super.getUnevenPointArray(t,n))}getSpacedPointArray(t=40,n=[]){return this._closePointArray(super.getSpacedPointArray(t,n))}getAdaptivePointArray(t=[]){return this._closePointArray(super.getAdaptivePointArray(t))}_setCurrentPoint(t){return this.currentPoint=new A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Ht(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Ht.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,s,i,a){const l=this.currentPoint;return l!=null&&l.equals({x:i,y:a})||this.curves.push(Gn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,s,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(t,n,r,s){const i=this.currentPoint;return i!=null&&i.equals({x:r,y:s})||this.curves.push(Rn.from((i==null?void 0:i.x)??0,(i==null?void 0:i.y)??0,t,n,r,s)),this._setCurrentPoint({x:r,y:s}),this}arc(t,n,r,s,i,a){const l=new Do(t,n,r,s,i,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,s,i,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,s,i,a),this}arcTo(t,n,r,s,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,s,i,a,l,h=!0){const c=new Lo(t,n,r,s,i,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,s,i,a,l,h){var c,f;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,n,r,s,i,a,l,h),this}rect(t,n,r,s){const i=new Fo(t,n,r,s);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,s,i){const a=new $o(t,n,r,s,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new zo([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(s=>s.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function No(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(o,e,t,n){const r=e.clone().sub(o),s=n.clone().sub(t),i=t.clone().sub(o),a=r.cross(s);if(a===0)return new A((o.x+t.x)/2,(o.y+t.y)/2);const l=i.cross(s)/a;return Math.abs(l)>1?new A((o.x+t.x)/2,(o.y+t.y)/2):new A(o.x+l*r.x,o.y+l*r.y)}class Tt extends ze{constructor(t,n={}){super();M(this,"currentCurve",new sn);M(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(r=>r===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof Tt?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new sn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new sn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,s,i,a){return this.currentCurve.bezierCurveTo(t,n,r,s,i,a),this}quadraticCurveTo(t,n,r,s){return this.currentCurve.quadraticCurveTo(t,n,r,s),this}arc(t,n,r,s,i,a){return this.currentCurve.arc(t,n,r,s,i,a),this}arcTo(t,n,r,s,i){return this.currentCurve.arcTo(t,n,r,s,i),this}ellipse(t,n,r,s,i,a,l,h){return this.currentCurve.ellipse(t,n,r,s,i,a,l,h),this}rect(t,n,r,s){return this.currentCurve.rect(t,n,r,s),this}roundRect(t,n,r,s,i){return this.currentCurve.roundRect(t,n,r,s,i),this}reset(){return this.currentCurve=new sn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Br(t,this),this}addData(t){return this.addCommands(Er(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],s=[],i=[];n.forEach((l,h)=>{const c=l.getControlPointRefs(),f=l.isClockwise();i[h]=c,s[h]=f;const u=c[0],p=c[c.length-1]??u;r.push({start:f?p:u,end:f?u:p,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{var u;c.start&&l.end&&f!==h&&((u=c.start)!=null&&u.equals(l.end))&&a[h].push(c.index)})}),n.forEach((l,h)=>{const c=s[h];i[h].forEach(f=>{f.add(l.getNormal(l.getTForPoint(f)).scale(c?t:-t))})}),a.forEach((l,h)=>{const c=i[h];l.forEach(f=>{const u=i[f],p=jo(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);p&&(c[c.length-1].copy(p),u[0].copy(p))})}),this}getMinMax(t=A.MAX,n=A.MIN,r=!0){const s=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(t,n),r&&s>1){const a=s/2,l=i.isClockwise(),h=[];for(let c=0;c<=1;c+=1/i.arcLengthDivision){const f=i.getPoint(c),u=i.getNormal(c),p=u.clone().scale(l?a:-a),d=u.clone().scale(l?-a:a);h.push(f.clone().add(p),f.clone().add(d),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(s=>{s.strokeTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new X(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:s="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.curves.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:s="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.getControlPointRefs().forEach(i=>{oo(t,i.x,i.y,{radius:4})}),r!=="none"&&t.fill(),s!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const s in t)t[s]!==void 0&&(n[No(s)]=t[s]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const s in n)n[s]!==void 0&&(r+=`${s}:${n[s]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ae{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new X(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),s=this.paths.map(i=>i.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:s,width:i,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=i*t,l.height=a*t,l.style.width=`${i}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-s),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const Vr="data:image/svg+xml;",Wr=`${Vr}base64,`,Xr=`${Vr}charset=utf8,`;function Hr(o){if(typeof o=="string"){let e;o.startsWith(Wr)?(o=o.substring(Wr.length,o.length),e=atob(o)):o.startsWith(Xr)?(o=o.substring(Xr.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
5
+ ${e}`);return t.documentElement}else return o}const Go="px",Ro=90,Zr=["mm","cm","in","pt","pc","px"],Yr={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 K(o){let e="px";if(typeof o=="string"||o instanceof String)for(let n=0,r=Zr.length;n<r;n++){const s=Zr[n];if(o.endsWith(s)){e=s,o=o.substring(0,o.length-s.length);break}}let t;return t=Yr[e][Go],t<0&&(t=Yr[e].in*Ro),t*Number.parseFloat(o)}const qo=new Mt,on=new Mt,Kr=new Mt,Qr=new Mt;function Vo(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const n=Wo(o);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Wo(o){const e=new Mt,t=qo;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(K(o.getAttribute("x")),K(o.getAttribute("y"))),o.hasAttribute("transform")){const n=o.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const i=s.indexOf("("),a=s.length;if(i>0&&i<a){const l=s.slice(0,i),h=qt(s.slice(i+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),on.makeTranslation(-f,-u),Kr.makeRotation(c),Qr.multiplyMatrices(Kr,on),on.makeTranslation(f,u),t.multiplyMatrices(on,Qr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Xo(o){return new Tt().arc(K(o.getAttribute("cx")||0),K(o.getAttribute("cy")||0),K(o.getAttribute("r")||0),0,Math.PI*2)}function Ho(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const n=o.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim()),s={};for(let i=n.style.length,a=0;a<i;a++){const l=n.style.item(a);s[l]=n.style.getPropertyValue(l)}for(let i=0;i<r.length;i++)e[r[i]]=Object.assign(e[r[i]]||{},{...s})}}function Zo(o){return new Tt().ellipse(K(o.getAttribute("cx")||0),K(o.getAttribute("cy")||0),K(o.getAttribute("rx")||0),K(o.getAttribute("ry")||0),0,0,Math.PI*2)}function Yo(o){return new Tt().moveTo(K(o.getAttribute("x1")||0),K(o.getAttribute("y1")||0)).lineTo(K(o.getAttribute("x2")||0),K(o.getAttribute("y2")||0))}function Ko(o){const e=new Tt,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Qo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(Qo,(r,s,i)=>{const a=K(s),l=K(i);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!0,e}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(ta,(r,s,i)=>{const a=K(s),l=K(i);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!1,e}function na(o){const e=K(o.getAttribute("x")||0),t=K(o.getAttribute("y")||0),n=K(o.getAttribute("rx")||o.getAttribute("ry")||0),r=K(o.getAttribute("ry")||o.getAttribute("rx")||0),s=K(o.getAttribute("width")),i=K(o.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+s-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+s-n*a,t,e+s,t+r*a,e+s,t+r),l.lineTo(e+s,t+i-r),(n!==0||r!==0)&&l.bezierCurveTo(e+s,t+i-r*a,e+s-n*a,t+i,e+s-n,t+i),l.lineTo(e+n,t+i),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+i,e,t+i-r*a,e,t+i-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function Vt(o,e,t){e=Object.assign({},e);let n={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}o.hasAttribute("id")&&(n=Object.assign(n,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,c=0;c<h;c++){const f=o.style.item(c),u=o.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=s){o.hasAttribute(h)&&(e[c]=f(o.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function s(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function i(h){return Math.max(0,Math.min(1,K(h)))}function a(h){return Math.max(0,K(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>K(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",i),r("fill-rule","fillRule"),r("opacity","opacity",i),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",i),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",K),r("visibility","visibility"),e}function qn(o,e,t=[],n={}){var f;if(o.nodeType!==1)return t;let r=!1,s=null,i={...e};switch(o.nodeName){case"svg":i=Vt(o,i,n);break;case"style":Ho(o,n);break;case"g":i=Vt(o,i,n);break;case"path":i=Vt(o,i,n),o.hasAttribute("d")&&(s=Ko(o));break;case"rect":i=Vt(o,i,n),s=na(o);break;case"polygon":i=Vt(o,i,n),s=Jo(o);break;case"polyline":i=Vt(o,i,n),s=ea(o);break;case"circle":i=Vt(o,i,n),s=Xo(o);break;case"ellipse":i=Vt(o,i,n),s=Zo(o);break;case"line":i=Vt(o,i,n),s=Yo(o);break;case"defs":r=!0;break;case"use":{i=Vt(o,i,n);const p=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("href")||"").substring(1),d=(f=o.viewportElement)==null?void 0:f.getElementById(p);d?qn(d,i,t,n):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(o);break}if(i.display==="none")return t;const a=new Mt,l=[],h=Vo(o,a,l);s&&(s.applyTransform(a),t.push(s),s.style={...i});const c=o.childNodes;for(let u=0,p=c.length;u<p;u++){const d=c[u];r&&d.nodeName!=="style"&&d.nodeName!=="defs"||qn(d,i,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function Jr(o){var t;const e=Hr(o);return new ae(qn(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}const ra=new Set(["©","®","÷"]),ia=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),sa={1:"italic",32:"bold"},oa={1:"italic",2:"bold"},ti={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class ei{constructor(e,t,n){M(this,"path",new Tt);M(this,"lineBox",new X);M(this,"inlineBox",new X);M(this,"glyphBox");M(this,"advanceWidth",0);M(this,"advanceHeight",0);M(this,"underlinePosition",0);M(this,"underlineThickness",0);M(this,"strikeoutPosition",0);M(this,"strikeoutSize",0);M(this,"ascender",0);M(this,"descender",0);M(this,"typoAscender",0);M(this,"typoDescender",0);M(this,"typoLineGap",0);M(this,"winAscent",0);M(this,"winDescent",0);M(this,"xHeight",0);M(this,"capHeight",0);M(this,"baseline",0);M(this,"centerDiviation",0);M(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get compatibleGlyphBox(){const e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new X(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new X(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(e){const t=this.computedStyle.fontFamily,n=e??Gs,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSFNT()}updateGlyph(e=this._getFontSFNT()){if(!e)return this;const{hhea:t,os2:n,post:r,head:s}=e,i=s.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,p=i/u,d=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/p,y=a/p;return this.advanceWidth=d,this.advanceHeight=m,this.inlineBox.width=f?m:d,this.inlineBox.height=f?d:m,this.underlinePosition=(a-r.underlinePosition)/p,this.underlineThickness=r.underlineThickness/p,this.strikeoutPosition=(a-n.yStrikeoutPosition)/p,this.strikeoutSize=n.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=n.sTypoAscender/p,this.typoDescender=n.sTypoDescender/p,this.typoLineGap=n.sTypoLineGap/p,this.winAscent=n.usWinAscent/p,this.winDescent=n.usWinDescent/p,this.xHeight=n.sxHeight/p,this.capHeight=n.sCapHeight/p,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=sa[n.fsSelection]??oa[s.macStyle],this}update(e){const t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:s,baseline:i,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:p}=this,{left:d,top:m}=a,y=s.fontStyle==="italic"&&f!=="italic";let P=d,T=m+i,b;const C=new Tt;if(n&&(P+=(p-u)/2,Math.abs(u-p)>.1&&(T-=(l-c)/(l+Math.abs(h))*p),b=void 0),n&&!ra.has(r)&&(r.codePointAt(0)<=256||ia.has(r))){C.addCommands(t.getPathCommands(r,P,m+i-(p-u)/2,s.fontSize));const v={y:m-(p-u)/2+p/2,x:P+u/2};y&&this._italic(C,n?{x:v.x,y:m-(p-u)/2+i}:void 0),C.rotate(90,v)}else b!==void 0?(C.addCommands(t.glyphs.get(b).getPathCommands(P,T,s.fontSize)),y&&this._italic(C,n?{x:P+u/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(C.addCommands(t.getPathCommands(r,P,T,s.fontSize)),y&&this._italic(C,n?{x:P+p/2,y:T}:void 0));const x=s.fontWeight??400;return x in ti&&(x===700||x==="bold")&&f!=="bold"&&C.bold(ti[x]*s.fontSize*.05),C.style={fill:s.color,stroke:s.textStrokeWidth?s.textStrokeColor:"none",strokeWidth:s.textStrokeWidth?s.textStrokeWidth*s.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new X(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)ne(r);else{e.save(),e.beginPath();const s=this.path.style,i={...s,fill:r.color??s.fill,stroke:r.textStrokeColor??s.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:s.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};Fn(e,i),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function Vn(){const o=new Map;async function e(n){if(!o.has(n)){o.set(n,n);try{o.set(n,await fetch(n).then(r=>r.text()))}catch(r){console.warn(r),o.delete(n)}}}function t(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:o,needsLoad:t,load:e}}function Wn(o){const e=new Map;function t(n){let r=e.get(n);if(!r){const s=Hr(o.needsLoad(n)?o.loaded.get(n)??n:n),i=Jr(s);r={dom:s,pathSet:i},e.set(n,r)}return r}return{parsed:e,parse:t}}function an(o,e){return typeof o=="number"?o:o.endsWith("%")?(o=o.substring(0,o.length-1),Math.ceil(Number(o)/100*e.total)):o.endsWith("rem")?(o=o.substring(0,o.length-3),Number(o)*e.fontSize):o.endsWith("em")?(o=o.substring(0,o.length-2),Number(o)*e.fontSize):Number(o)}function Xn(o){const e=$t(o)?{}:o;return Object.keys(e).reduce((t,n)=>{let r=e[n];const s=Hn(n),i=Hn(r);return s&&(n=s),i&&(r=i),t[n]=r,t},{})}function $t(o){return!o||o==="none"}function ni(o,e){const t=Object.keys(o),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(s=>le(o[s],e[s]))}function le(o,e){const t=typeof o;return t===typeof e?t==="object"?ni(o,e):o===e:!1}function Hn(o){const e=o.startsWith("#")?o.slice(1):o;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${s}, ${i})`}function ln(o){if(!o)return o;const e={};for(const t in o)o[t]!==""&&o[t]!==void 0&&(e[t]=o[t]);return e}class ri{constructor(e,t={},n){M(this,"inlineBox",new X);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...ln(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new ei(n,t++,this));return this.characters=e,this}}class we{constructor(e,t){M(this,"lineBox",new X);M(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...ln(this.parentStyle),...ln(this.style)},this}addFragment(e,t){const n=new ri(e,t,this);return this.fragments.push(n),n}}function aa(o){return o}const be=class be{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];be.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&be.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),s={...t},i=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":s.justifyContent="flex-start";break;case"center":s.justifyContent="center";break;case"end":case"right":s.justifyContent="flex-end";break}switch(t.verticalAlign){case"top":s.alignItems="flex-start";break;case"middle":s.alignItems="center";break;case"bottom":s.alignItems="flex-end";break}const a=!!(s.justifyContent||s.alignItems);Object.assign(r.style,{...this._styleToDomStyle({...s,boxSizing:s.boxSizing??"border-box",display:s.display??(a?"inline-flex":void 0),width:s.width??"max-content",height:s.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all",position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&i?"100%":void 0,height:a&&!i?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(s=>{var f;const i=r+=n.substring(r).indexOf(s),a=i+s.length;r+=s.length,t.setStart(e,Math.max(i,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((s,i)=>{const a=s.getBoundingClientRect();t.push({paragraphIndex:i,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{r.push({...u,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(p=>{r.push({...p,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const s=[];let i=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;s.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:p}=f,d=s[i];f.inlineBox.left=d.left,f.inlineBox.top=d.top,f.inlineBox.width=d.width,f.inlineBox.height=d.height,p?(f.lineBox.left=d.left+(d.width-u)/2,f.lineBox.top=d.top,f.lineBox.width=u,f.lineBox.height=d.height):(f.lineBox.left=d.left,f.lineBox.top=d.top+(d.height-u)/2,f.lineBox.width=d.width,f.lineBox.height=u),i++}),{paragraphs:e,boundingBox:new X(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const s=this.measureParagraphDom(e,n);return r==null||r(),s}};M(be,"notZeroStyles",new Set(["width","height"])),M(be,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let hn=be;function la(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ha(){return{boxShadow:"none"}}function ca(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function fa(){return{...la(),...ca(),...ha(),backgroundImage:"none",backgroundColor:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"#000000",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ua(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function pa(){return{...fa(),...ua()}}class da{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},s=this.eventListeners.get(e);return s?Array.isArray(s)?s.push(r):this.eventListeners.set(e,[s,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var s,i;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((s=c.options)!=null&&s.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(i=r.options)!=null&&i.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,s;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let i=n.length,a=0;a<i;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((s=n.options)!=null&&s.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function ii(){const o=new ae,e=Vn(),t=Wn(e);return{name:"background",pathSet:o,load:async n=>{const{backgroundImage:r}=n.style;r&&e.needsLoad(r)&&await e.load(r)},update:n=>{o.paths.length=0;const{style:r,lineBox:s,isVertical:i}=n;if($t(r.backgroundImage))return;const{pathSet:a}=t.parse(r.backgroundImage),l=a.getBoundingBox(!0),h=new Mt;if(h.translate(-l.x,-l.y),i){h.scale(s.height/l.width,s.width/l.height);const c=s.height/2,f=s.width/2;h.translate(-c,-f),h.rotate(-Math.PI/2),h.translate(f,c)}else h.scale(s.width/l.width,s.height/l.height);h.translate(s.x,s.y),a.paths.forEach(c=>{o.paths.push(c.clone().applyTransform(h))})},render:(n,r)=>{const{boundingBox:s,computedStyle:i}=r;$t(i.backgroundColor)||(n.fillStyle=i.backgroundColor,n.fillRect(...s.array)),o.paths.forEach(a=>{if(ne({ctx:n,path:a,fontSize:i.fontSize}),r.debug){const l=new ae([a]).getBoundingBox();l&&n.strokeRect(l.x,l.y,l.width,l.height)}})}}}function cn(o){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:s,highlightSize:i,highlightThickness:a}=o;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??s??"none",size:(e==null?void 0:e.size)??i??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function si(){const o=new ae,e=[],t=Vn(),n=Wn(t);return{name:"highlight",pathSet:o,load:async r=>{const s=new Set;r.forEachCharacter(i=>{const{computedStyle:a}=i,{image:l,referImage:h}=cn(a);t.needsLoad(l)&&s.add(l),t.needsLoad(h)&&s.add(h)}),await Promise.all(Array.from(s).map(i=>t.load(i)))},update:r=>{e.length=0,o.paths.length=0;let s=[],i,a;r.forEachCharacter(l=>{const{computedStyle:h}=l,c=cn(h),{image:f,colormap:u,line:p,size:d,thickness:m}=c;if($t(f))i!=null&&i.length&&(i=[],s.push(i));else{const{inlineBox:y,isVertical:P}=l,{fontSize:T}=h;(!a||le(a.image,f)&&le(a.colormap,u)&&le(a.line,p)&&le(a.size,d)&&le(a.thickness,m))&&(i!=null&&i.length)&&(P?i[0].inlineBox.left===y.left:i[0].inlineBox.top===y.top)&&i[0].fontSize===T?i.push(l):(i=[],i.push(l),s.push(i))}a=c}),s=s.filter(l=>l.length);for(let l=0;l<s.length;l++){const h=s[l],c=h[0],f=X.from(...h.map(L=>L.compatibleGlyphBox));if(!f.height||!f.width)continue;const{computedStyle:u,isVertical:p,inlineBox:d,compatibleGlyphBox:m,strikeoutPosition:y,underlinePosition:P}=c,{fontSize:T}=u,{image:b,referImage:C,colormap:x,line:v,size:S,thickness:w}=cn(u),k=an(w,{fontSize:T,total:f.width})/f.width,z=Xn(x),{pathSet:O,dom:B}=n.parse(b),U=O.getBoundingBox(!0),D=T/U.width*2,_=new X().copy(f);p&&(_.width=f.height,_.height=f.width,_.left=f.left+f.width);const H=Math.floor(_.width);let I=H;S!=="cover"&&(I=an(S,{fontSize:T,total:f.width})||H,_.width=I);const E=!$t(C)&&$t(v);if(E)U.copy(n.parse(C).pathSet.getBoundingBox(!0));else{let L;if($t(v))if(U.width/U.height>4){L="underline";const $=B.getAttribute("viewBox");if($){const[W,F,V,R]=$.split(" ").map(Z=>Number(Z)),Y=F+R/2;U.y<Y&&U.y+U.height>Y?L="line-through":U.y+U.height<Y?L="overline":L="underline"}}else L="outline";else L=v;switch(L){case"outline":{const $=_.width*.2,W=_.height*.2;p?(_.x-=W/2,_.y-=$/2,_.x-=_.height):(_.x-=$/2,_.y-=W/2),_.width+=$,_.height+=W;break}case"overline":_.height=U.height*D,p?_.x=d.left+d.width:_.y=d.top;break;case"line-through":_.height=U.height*D,p?_.x=d.left+d.width-y+_.height/2:_.y=d.top+y-_.height/2;break;case"underline":_.height=U.height*D,p?_.x=m.left+m.width-P:_.y=d.top+P;break}}const q=new Mt;if(q.translate(-U.x,-U.y),q.scale(_.width/U.width,_.height/U.height),p){const L=_.width/2,$=_.height/2;E||q.translate(-L,-$),q.rotate(-Math.PI/2),E||q.translate($,L)}q.translate(_.x,_.y);for(let L=0;L<Math.ceil(H/I);L++){const $=q.clone();p?$.translate(0,L*_.width):$.translate(L*_.width,0),O.paths.forEach(W=>{const F=W.clone().applyTransform($);F.style.strokeWidth&&(F.style.strokeWidth*=D*k),F.style.strokeMiterlimit&&(F.style.strokeMiterlimit*=D),F.style.strokeDashoffset&&(F.style.strokeDashoffset*=D),F.style.strokeDasharray&&(F.style.strokeDasharray=F.style.strokeDasharray.map(V=>V*D)),F.style.fill&&F.style.fill in z&&(F.style.fill=z[F.style.fill]),F.style.stroke&&F.style.stroke in z&&(F.style.stroke=z[F.style.stroke]),o.paths.push(F),H!==I&&(p?e[o.paths.length-1]=new X(f.left-f.width*2,f.top,f.width*4,f.height):e[o.paths.length-1]=new X(f.left,f.top-f.height*2,f.width,f.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const r=[];return o.paths.forEach((s,i)=>{const a=e[i];let l=s.getBoundingBox();if(a){const h=Math.max(l.x,a.x),c=Math.max(l.y,a.y),f=Math.min(l.right,a.right),u=Math.min(l.bottom,a.bottom);l=new X(h,c,f-h,u-c)}r.push(l)}),X.from(...r)},render:(r,s)=>{o.paths.forEach((i,a)=>{if(ne({ctx:r,path:i,fontSize:s.computedStyle.fontSize,clipRect:e[a]}),s.debug){const l=new ae([i]).getBoundingBox();l&&r.strokeRect(l.x,l.y,l.width,l.height)}})}}}function ya(o,e){return`<svg width="${o*2}" height="${o*2}" xmlns="http://www.w3.org/2000/svg">
6
6
  <circle cx="${o}" cy="${o}" r="${o}" fill="${e}" />
7
- </svg>`}function oi(){const o=new ae;return{name:"listStyle",pathSet:o,update:e=>{o.paths.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,s=r*.45;t.forEach(i=>{const{computedStyle:a}=i,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,d=Xn(c);let p=f,m;if(!$t(h))m=h;else if(!$t(u)){const b=r*.38/2;switch(p=p==="cover"?b*2:p,u){case"disc":m=ya(b,String(l));break}}if(!m)return;const y=Jr(m),P=y.getBoundingBox();let T;i.fragments.forEach(b=>{b.characters.forEach(C=>{const{inlineBox:x}=C;if(n?(T==null?void 0:T.inlineBox.left)!==x.left:(T==null?void 0:T.inlineBox.top)!==x.top){T=C;const v=p==="cover"?1:an(p,{total:r,fontSize:r})/r,S=new Mt;if(n){const w=r/P.height*v;S.translate(-P.left,-P.top).rotate(Math.PI/2).scale(w,w).translate(x.left+(x.width-P.height*w)/2,x.top-s)}else{const w=r/P.height*v;S.translate(-P.left,-P.top).scale(w,w).translate(x.left-P.width*w-s,x.top+(x.height-P.height*w)/2)}o.paths.push(...y.paths.map(w=>{const k=w.clone();return k.applyTransform(S),k.style.fill&&k.style.fill in d&&(k.style.fill=d[k.style.fill]),k.style.stroke&&k.style.stroke in d&&(k.style.stroke=d[k.style.stroke]),k}))}})})})}}}function ai(){return{name:"outline"}}const Jt=new A,ve=new Mt,te=new Mt;function li(){return{name:"render",getBoundingBox:o=>{const{characters:e,fontSize:t,effects:n}=o,r=[];return e.forEach(s=>{n==null||n.forEach(i=>{if(!s.glyphBox)return;const a=s.glyphBox.clone(),l=fn(o,i);Jt.set(a.left,a.top),Jt.applyMatrix3(l),a.left=Jt.x,a.top=Jt.y,Jt.set(a.right,a.bottom),Jt.applyMatrix3(l),a.width=Jt.x-a.left,a.height=Jt.y-a.top;const h=(i.shadowOffsetX??0)*t,c=(i.shadowOffsetY??0)*t,f=Math.max(.1,i.textStrokeWidth??0)*t;a.left+=h-f,a.top+=c-f,a.width+=f*2,a.height+=f*2,r.push(a)})}),r.length?Y.from(...r):void 0},render:(o,e)=>{const{paragraphs:t,glyphBox:n,effects:r}=e;r?r.forEach(s=>{jt(s,n,o),o.save();const[i,a,l,h,c,f]=fn(e,s).transpose().elements;o.transform(i,h,a,c,l,f),e.forEachCharacter(u=>{u.drawTo(o,s)}),o.restore()}):t.forEach(s=>{s.fragments.forEach(i=>{i.characters.forEach(a=>{a.drawTo(o)})})}),e.debug&&t.forEach(s=>{o.strokeRect(s.lineBox.x,s.lineBox.y,s.lineBox.width,s.lineBox.height)})}}}function fn(o,e){const{fontSize:t,glyphBox:n}=o,r=(e.translateX??0)*t,s=(e.translateY??0)*t,i=Math.PI*2,a=(e.skewX??0)/360*i,l=(e.skewY??0)/360*i,{left:h,top:c,width:f,height:u}=n,d=h+f/2,p=c+u/2;return ve.identity(),te.makeTranslation(r,s),ve.multiply(te),te.makeTranslation(d,p),ve.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ve.multiply(te),te.makeTranslation(-d,-p),ve.multiply(te),ve.clone()}function hi(){const o=new ae;return{name:"textDecoration",pathSet:o,update:e=>{o.paths.length=0;const t=[];let n,r;e.forEachCharacter(s=>{const{computedStyle:i,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=s,{color:d,textDecoration:p,writingMode:m}=i;if($t(p))r=void 0;else{let y=!1;if((r==null?void 0:r.textDecoration)===p&&(r==null?void 0:r.writingMode)===m&&(r==null?void 0:r.color)===d&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(p){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(y=!0);break;case"line-through":n[0].strikeoutPosition===f&&n[0].strikeoutSize===u&&(y=!0);break}y?n.push(s):(n=[],n.push(s),t.push(n)),r=i}}),t.forEach(s=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=s[0],{color:u,textDecoration:d}=i,p=Y.from(...s.map(S=>S.inlineBox)),{left:m,top:y,width:P,height:T}=p;let b=a?m+P:y;const C=a?-1:1;let x=0;switch(d){case"overline":x=h*2;break;case"underline":b+=C*l,x=h*2;break;case"line-through":b+=C*c,x=f*2;break}b-=x;let v;a?v=new Tt([{type:"M",x:b,y},{type:"L",x:b,y:y+T},{type:"L",x:b+x,y:y+T},{type:"L",x:b+x,y},{type:"Z"}],{fill:u}):v=new Tt([{type:"M",x:m,y:b},{type:"L",x:m+P,y:b},{type:"L",x:m+P,y:b+x},{type:"L",x:m,y:b+x},{type:"Z"}],{fill:u}),o.paths.push(v)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(s=>{e.save();const[i,a,l,h,c,f]=fn(t,s).transpose().elements;e.transform(i,h,a,c,l,f),o.paths.forEach(u=>{ne({ctx:e,path:u,fontSize:r.fontSize,...s})}),e.restore()}):o.paths.forEach(s=>{ne({ctx:e,path:s,fontSize:r.fontSize})})}}}const Zn=pa();class Yn extends da{constructor(t={}){super();M(this,"debug");M(this,"content");M(this,"style");M(this,"effects");M(this,"measureDom");M(this,"needsUpdate",!0);M(this,"computedStyle",{...Zn});M(this,"paragraphs",[]);M(this,"lineBox",new Y);M(this,"rawGlyphBox",new Y);M(this,"glyphBox",new Y);M(this,"pathBox",new Y);M(this,"boundingBox",new Y);M(this,"measurer",new hn);M(this,"plugins",new Map);M(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(ii()).use(ai()).use(oi()).use(hi()).use(si()).use(li()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,r)=>{n.fragments.forEach((s,i)=>{s.characters.forEach((a,l)=>{t(a,{paragraphIndex:r,fragmentIndex:i,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...Zn,...this.style};let{content:t,computedStyle:n}=this;const r=[];if(typeof t=="string"){const s=new we({},n);s.addFragment(t),r.push(s)}else{t=Array.isArray(t)?t:[t];for(const s of t)if(typeof s=="string"){const i=new we({},n);i.addFragment(s),r.push(i)}else if(Array.isArray(s)){const i=new we({},n);s.forEach(a=>{if(typeof a=="string")i.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&i.addFragment(l,h)}}),r.push(i)}else if("fragments"in s){const{fragments:i,...a}=s,l=new we(a,n);i.forEach(h=>{const{content:c,...f}=h;c!==void 0&&l.addFragment(c,f)}),r.push(l)}else if("content"in s){const{content:i,...a}=s;if(i!==void 0){const l=new we(a,n);l.addFragment(i),r.push(l)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(s=>{s.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((s,i)=>(s.updateOrder??0)-(i.updateOrder??0)).forEach(s=>{var i;(i=s.update)==null||i.call(s,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const s in n)r[s]=this[s],this[s]=n[s];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=A.MAX,n=A.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:s}=r,i=new A(s.left,s.top),a=new A(s.left+s.width,s.top+s.height);t.min(i,a),n.max(i,a)}}),new Y(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=Y.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>{var n;return t.getBoundingBox?t.getBoundingBox(this):(n=t.pathSet)==null?void 0:n.getBoundingBox()}).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=Y.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const n in t)this[n]=t[n];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:n,pixelRatio:r=2}=t,s=n.getContext("2d");s&&(this.needsUpdate&&this.update(),Kn(s,r,this.boundingBox),Qn(s,this),Array.from(this.plugins.values()).sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;if(i.render)(a=i.render)==null||a.call(i,s,this);else if(i.pathSet){const l=this.computedStyle;i.pathSet.paths.forEach(h=>{ne({ctx:s,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function ga(o,e){const t=new Yn(o);return e?t.load().then(()=>t.measure()):t.measure()}function ma(o,e){const t=new Yn(o);return e?t.load().then(()=>t.render(o)):t.render(o)}G.Character=ei,G.Fragment=ri,G.Measurer=hn,G.Paragraph=we,G.Text=Yn,G.background=ii,G.createSVGLoader=Vn,G.createSVGParser=Wn,G.definePlugin=aa,G.drawPath=ne,G.filterEmpty=ln,G.getHighlightStyle=cn,G.getTransform2D=fn,G.hexToRgb=Hn,G.highlight=si,G.isEqualObject=ni,G.isEqualValue=le,G.isNone=$t,G.listStyle=oi,G.measureText=ga,G.outline=ai,G.parseColor=ct,G.parseColormap=Xn,G.parseValueNumber=an,G.render=li,G.renderText=ma,G.setupView=Kn,G.textDecoration=hi,G.textDefaultStyle=Zn,G.uploadColor=jt,G.uploadColors=Qn,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
7
+ </svg>`}function oi(){const o=new ae;return{name:"listStyle",pathSet:o,update:e=>{o.paths.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,s=r*.45;t.forEach(i=>{const{computedStyle:a}=i,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,p=Xn(c);let d=f,m;if(!$t(h))m=h;else if(!$t(u)){const b=r*.38/2;switch(d=d==="cover"?b*2:d,u){case"disc":m=ya(b,String(l));break}}if(!m)return;const y=Jr(m),P=y.getBoundingBox();let T;i.fragments.forEach(b=>{b.characters.forEach(C=>{const{inlineBox:x}=C;if(n?(T==null?void 0:T.inlineBox.left)!==x.left:(T==null?void 0:T.inlineBox.top)!==x.top){T=C;const v=d==="cover"?1:an(d,{total:r,fontSize:r})/r,S=new Mt;if(n){const w=r/P.height*v;S.translate(-P.left,-P.top).rotate(Math.PI/2).scale(w,w).translate(x.left+(x.width-P.height*w)/2,x.top-s)}else{const w=r/P.height*v;S.translate(-P.left,-P.top).scale(w,w).translate(x.left-P.width*w-s,x.top+(x.height-P.height*w)/2)}o.paths.push(...y.paths.map(w=>{const k=w.clone();return k.applyTransform(S),k.style.fill&&k.style.fill in p&&(k.style.fill=p[k.style.fill]),k.style.stroke&&k.style.stroke in p&&(k.style.stroke=p[k.style.stroke]),k}))}})})})}}}function ai(){return{name:"outline"}}const Jt=new A,ve=new Mt,te=new Mt;function li(){return{name:"render",getBoundingBox:o=>{const{characters:e,fontSize:t,effects:n}=o,r=[];return e.forEach(s=>{n==null||n.forEach(i=>{if(!s.glyphBox)return;const a=s.glyphBox.clone(),l=fn(o,i);Jt.set(a.left,a.top),Jt.applyMatrix3(l),a.left=Jt.x,a.top=Jt.y,Jt.set(a.right,a.bottom),Jt.applyMatrix3(l),a.width=Jt.x-a.left,a.height=Jt.y-a.top;const h=(i.shadowOffsetX??0)*t,c=(i.shadowOffsetY??0)*t,f=Math.max(.1,i.textStrokeWidth??0)*t;a.left+=h-f,a.top+=c-f,a.width+=f*2,a.height+=f*2,r.push(a)})}),r.length?X.from(...r):void 0},render:(o,e)=>{const{paragraphs:t,glyphBox:n,effects:r}=e;r?r.forEach(s=>{jt(s,n,o),o.save();const[i,a,l,h,c,f]=fn(e,s).transpose().elements;o.transform(i,h,a,c,l,f),e.forEachCharacter(u=>{u.drawTo(o,s)}),o.restore()}):t.forEach(s=>{s.fragments.forEach(i=>{i.characters.forEach(a=>{a.drawTo(o)})})}),e.debug&&t.forEach(s=>{o.strokeRect(s.lineBox.x,s.lineBox.y,s.lineBox.width,s.lineBox.height)})}}}function fn(o,e){const{fontSize:t,glyphBox:n}=o,r=(e.translateX??0)*t,s=(e.translateY??0)*t,i=Math.PI*2,a=(e.skewX??0)/360*i,l=(e.skewY??0)/360*i,{left:h,top:c,width:f,height:u}=n,p=h+f/2,d=c+u/2;return ve.identity(),te.makeTranslation(r,s),ve.multiply(te),te.makeTranslation(p,d),ve.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),ve.multiply(te),te.makeTranslation(-p,-d),ve.multiply(te),ve.clone()}function hi(){const o=new ae;return{name:"textDecoration",pathSet:o,update:e=>{o.paths.length=0;const t=[];let n,r;e.forEachCharacter(s=>{const{computedStyle:i,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=s,{color:p,textDecoration:d,writingMode:m}=i;if($t(d))r=void 0;else{let y=!1;if((r==null?void 0:r.textDecoration)===d&&(r==null?void 0:r.writingMode)===m&&(r==null?void 0:r.color)===p&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(d){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(y=!0);break;case"line-through":n[0].strikeoutPosition===f&&n[0].strikeoutSize===u&&(y=!0);break}y?n.push(s):(n=[],n.push(s),t.push(n)),r=i}}),t.forEach(s=>{const{computedStyle:i,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=s[0],{color:u,textDecoration:p}=i,d=X.from(...s.map(S=>S.inlineBox)),{left:m,top:y,width:P,height:T}=d;let b=a?m+P:y;const C=a?-1:1;let x=0;switch(p){case"overline":x=h*2;break;case"underline":b+=C*l,x=h*2;break;case"line-through":b+=C*c,x=f*2;break}b-=x;let v;a?v=new Tt([{type:"M",x:b,y},{type:"L",x:b,y:y+T},{type:"L",x:b+x,y:y+T},{type:"L",x:b+x,y},{type:"Z"}],{fill:u}):v=new Tt([{type:"M",x:m,y:b},{type:"L",x:m+P,y:b},{type:"L",x:m+P,y:b+x},{type:"L",x:m,y:b+x},{type:"Z"}],{fill:u}),o.paths.push(v)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(s=>{e.save();const[i,a,l,h,c,f]=fn(t,s).transpose().elements;e.transform(i,h,a,c,l,f),o.paths.forEach(u=>{ne({ctx:e,path:u,fontSize:r.fontSize,...s})}),e.restore()}):o.paths.forEach(s=>{ne({ctx:e,path:s,fontSize:r.fontSize})})}}}const Zn=pa();class Yn extends da{constructor(t={}){super();M(this,"debug");M(this,"content");M(this,"style");M(this,"effects");M(this,"measureDom");M(this,"needsUpdate",!0);M(this,"computedStyle",{...Zn});M(this,"paragraphs",[]);M(this,"lineBox",new X);M(this,"rawGlyphBox",new X);M(this,"glyphBox",new X);M(this,"pathBox",new X);M(this,"boundingBox",new X);M(this,"measurer",new hn);M(this,"plugins",new Map);M(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(ii()).use(ai()).use(oi()).use(hi()).use(si()).use(li()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,r)=>{n.fragments.forEach((s,i)=>{s.characters.forEach((a,l)=>{t(a,{paragraphIndex:r,fragmentIndex:i,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...Zn,...this.style};let{content:t,computedStyle:n}=this;const r=[];if(typeof t=="string"){const s=new we({},n);s.addFragment(t),r.push(s)}else{t=Array.isArray(t)?t:[t];for(const s of t)if(typeof s=="string"){const i=new we({},n);i.addFragment(s),r.push(i)}else if(Array.isArray(s)){const i=new we({},n);s.forEach(a=>{if(typeof a=="string")i.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&i.addFragment(l,h)}}),r.push(i)}else if("fragments"in s){const{fragments:i,...a}=s,l=new we(a,n);i.forEach(h=>{const{content:c,...f}=h;c!==void 0&&l.addFragment(c,f)}),r.push(l)}else if("content"in s){const{content:i,...a}=s;if(i!==void 0){const l=new we(a,n);l.addFragment(i),r.push(l)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(s=>{s.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((s,i)=>(s.updateOrder??0)-(i.updateOrder??0)).forEach(s=>{var i;(i=s.update)==null||i.call(s,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const s in n)r[s]=this[s],this[s]=n[s];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=A.MAX,n=A.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:s}=r,{left:i,top:a,width:l,height:h}=s,c=new A(i,a),f=new A(i+l,a+h);t.min(c,f),n.max(c,f)}}),new X(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=X.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>{var n;return t.getBoundingBox?t.getBoundingBox(this):(n=t.pathSet)==null?void 0:n.getBoundingBox()}).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=X.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const n in t)this[n]=t[n];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:n,pixelRatio:r=2}=t,s=n.getContext("2d");s&&(this.needsUpdate&&this.update(),Kn(s,r,this.boundingBox),Qn(s,this),Array.from(this.plugins.values()).sort((i,a)=>(i.renderOrder??0)-(a.renderOrder??0)).forEach(i=>{var a;if(i.render)(a=i.render)==null||a.call(i,s,this);else if(i.pathSet){const l=this.computedStyle;i.pathSet.paths.forEach(h=>{ne({ctx:s,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function ga(o,e){const t=new Yn(o);return e?t.load().then(()=>t.measure()):t.measure()}function ma(o,e){const t=new Yn(o);return e?t.load().then(()=>t.render(o)):t.render(o)}G.Character=ei,G.Fragment=ri,G.Measurer=hn,G.Paragraph=we,G.Text=Yn,G.background=ii,G.createSVGLoader=Vn,G.createSVGParser=Wn,G.definePlugin=aa,G.drawPath=ne,G.filterEmpty=ln,G.getHighlightStyle=cn,G.getTransform2D=fn,G.hexToRgb=Hn,G.highlight=si,G.isEqualObject=ni,G.isEqualValue=le,G.isNone=$t,G.listStyle=oi,G.measureText=ga,G.outline=ai,G.parseColor=ct,G.parseColormap=Xn,G.parseValueNumber=an,G.render=li,G.renderText=ma,G.setupView=Kn,G.textDecoration=hi,G.textDefaultStyle=Zn,G.uploadColor=jt,G.uploadColors=Qn,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -166,8 +166,22 @@ class Character {
166
166
  baseline = 0;
167
167
  centerDiviation = 0;
168
168
  fontStyle;
169
+ get compatibleGlyphBox() {
170
+ const size = this.computedStyle.fontSize * 0.8;
171
+ return this.glyphBox ?? (this.isVertical ? new BoundingBox(
172
+ this.lineBox.left + this.lineBox.width / 2 - size / 2,
173
+ this.lineBox.top,
174
+ size,
175
+ this.lineBox.height
176
+ ) : new BoundingBox(
177
+ this.lineBox.left,
178
+ this.lineBox.top + this.lineBox.height / 2 - size / 2,
179
+ this.lineBox.width,
180
+ size
181
+ ));
182
+ }
169
183
  get center() {
170
- return this.glyphBox?.center;
184
+ return this.compatibleGlyphBox.center;
171
185
  }
172
186
  get computedStyle() {
173
187
  return this.parent.computedStyle;
@@ -1061,14 +1075,15 @@ function highlight() {
1061
1075
  for (let i = 0; i < groups.length; i++) {
1062
1076
  const characters = groups[i];
1063
1077
  const char = characters[0];
1064
- const groupBox = BoundingBox.from(
1065
- ...characters.filter((c) => c.glyphBox).map((c) => c.glyphBox)
1066
- );
1078
+ const groupBox = BoundingBox.from(...characters.map((c) => c.compatibleGlyphBox));
1079
+ if (!groupBox.height || !groupBox.width) {
1080
+ continue;
1081
+ }
1067
1082
  const {
1068
1083
  computedStyle: style,
1069
1084
  isVertical,
1070
1085
  inlineBox,
1071
- glyphBox = inlineBox,
1086
+ compatibleGlyphBox: glyphBox,
1072
1087
  strikeoutPosition,
1073
1088
  underlinePosition
1074
1089
  } = char;
@@ -1725,9 +1740,10 @@ class Text extends EventEmitter {
1725
1740
  const max = Vector2.MIN;
1726
1741
  this.characters.forEach((c) => {
1727
1742
  if (!c.getGlyphMinMax(min, max)) {
1728
- const { inlineBox } = c;
1729
- const a = new Vector2(inlineBox.left, inlineBox.top);
1730
- const b = new Vector2(inlineBox.left + inlineBox.width, inlineBox.top + inlineBox.height);
1743
+ const { inlineBox: glyphBox } = c;
1744
+ const { left, top, width, height } = glyphBox;
1745
+ const a = new Vector2(left, top);
1746
+ const b = new Vector2(left + width, top + height);
1731
1747
  min.min(a, b);
1732
1748
  max.max(a, b);
1733
1749
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "1.3.2",
4
+ "version": "1.3.3",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",