modern-text 0.2.16 → 0.2.17

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
@@ -52,7 +52,9 @@ function parseCssLinearGradient(css, x, y, width, height) {
52
52
  };
53
53
  }
54
54
 
55
- function drawPath(options) {
55
+ const _tempM1 = new modernPath2d.Matrix3();
56
+ const _tempM2 = new modernPath2d.Matrix3();
57
+ function drawPath(options, isText = false) {
56
58
  const { ctx, path, fontSize, clipRect } = options;
57
59
  ctx.save();
58
60
  ctx.beginPath();
@@ -69,13 +71,33 @@ function drawPath(options) {
69
71
  };
70
72
  const offsetX = (options.offsetX ?? 0) * fontSize;
71
73
  const offsetY = (options.offsetY ?? 0) * fontSize;
72
- ctx.translate(offsetX, offsetY);
74
+ const skewX = (options.skewX ?? 0) / 180 * Math.PI;
75
+ const skewY = (options.skewY ?? 0) / 180 * Math.PI;
76
+ if (offsetX || offsetY || skewX || skewY) {
77
+ _tempM1.makeTranslation(offsetX, offsetY);
78
+ _tempM2.set(1, Math.tan(skewX), 0, Math.tan(skewY), 1, 0, 0, 0, 1);
79
+ const [a, c, e, b, d, f] = _tempM1.multiply(_tempM2).transpose().elements;
80
+ ctx.transform(a, b, c, d, e, f);
81
+ }
73
82
  if (clipRect) {
74
83
  ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
75
84
  ctx.clip();
76
85
  ctx.beginPath();
77
86
  }
78
- path.drawTo(ctx);
87
+ if (isText && path.style.strokeWidth) {
88
+ const scale = path.style.strokeWidth / fontSize + 1;
89
+ const box = path.getBoundingBox();
90
+ ctx.translate(
91
+ box.left * (1 - scale) + box.width * (1 - scale) / 2,
92
+ box.top * (1 - scale) + box.height * (1 - scale) / 2
93
+ );
94
+ ctx.scale(scale, scale);
95
+ const clone = path.clone();
96
+ clone.style.strokeWidth /= scale * 2;
97
+ clone.drawTo(ctx);
98
+ } else {
99
+ path.drawTo(ctx);
100
+ }
79
101
  ctx.restore();
80
102
  }
81
103
 
@@ -394,7 +416,7 @@ class Character {
394
416
  fontSize: this.computedStyle.fontSize,
395
417
  color: this.computedStyle.color,
396
418
  ...config
397
- });
419
+ }, true);
398
420
  }
399
421
  }
400
422
 
package/dist/index.d.cts CHANGED
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -76,7 +78,7 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
76
78
  fontSize: number;
77
79
  clipRect?: BoundingBox;
78
80
  }
79
- declare function drawPath(options: DrawShapePathsOptions): void;
81
+ declare function drawPath(options: DrawShapePathsOptions, isText?: boolean): void;
80
82
 
81
83
  declare class Fragment {
82
84
  content: string;
package/dist/index.d.mts CHANGED
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -76,7 +78,7 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
76
78
  fontSize: number;
77
79
  clipRect?: BoundingBox;
78
80
  }
79
- declare function drawPath(options: DrawShapePathsOptions): void;
81
+ declare function drawPath(options: DrawShapePathsOptions, isText?: boolean): void;
80
82
 
81
83
  declare class Fragment {
82
84
  content: string;
package/dist/index.d.ts CHANGED
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -76,7 +78,7 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
76
78
  fontSize: number;
77
79
  clipRect?: BoundingBox;
78
80
  }
79
- declare function drawPath(options: DrawShapePathsOptions): void;
81
+ declare function drawPath(options: DrawShapePathsOptions, isText?: boolean): void;
80
82
 
81
83
  declare class Fragment {
82
84
  content: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(p,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(p=typeof globalThis<"u"?globalThis:p||self,it(p.modernText={}))})(this,function(p){"use strict";var Ho=Object.defineProperty;var Wo=(p,it,Ct)=>it in p?Ho(p,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):p[it]=Ct;var F=(p,it,Ct)=>Wo(p,typeof it!="symbol"?it+"":it,Ct);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=Vn(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ct(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function Vn(s,t,e,r,n){var m;const i=((m=s.match(/linear-gradient\((.+)\)$/))==null?void 0:m[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),d=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+d,x1:t+r/2+c,y1:e+n/2-d,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[3].replace("%",""))/100,color:w}})}}function Fe(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style;e.style={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};const o=(s.offsetX??0)*r,a=(s.offsetY??0)*r;t.translate(o,a),n&&(t.rect(n.x,n.y,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t),t.restore()}var ot=Uint8Array,mt=Uint16Array,Ne=Int32Array,we=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ve=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ke=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(s,t){for(var e=new mt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ne(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},xr=br(we,2),_r=xr.b,Ge=xr.r;_r[28]=258,Ge[258]=28;for(var Sr=br(ve,0),Hn=Sr.b,Pr=Sr.r,Re=new mt(32768),N=0;N<32768;++N){var Bt=(N&43690)>>1|(N&21845)<<1;Bt=(Bt&52428)>>2|(Bt&13107)<<2,Bt=(Bt&61680)>>4|(Bt&3855)<<4,Re[N]=((Bt&65280)>>8|(Bt&255)<<8)>>1}for(var Mt=function(s,t,e){for(var r=s.length,n=0,i=new mt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new mt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new mt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],u=t-s[n],c=o[s[n]-1]++<<u,d=c|(1<<u)-1;c<=d;++c)a[Re[c]>>h]=l}else for(a=new mt(r),n=0;n<r;++n)s[n]&&(a[n]=Re[o[s[n]-1]++]>>15-s[n]);return a},Ft=new ot(288),N=0;N<144;++N)Ft[N]=8;for(var N=144;N<256;++N)Ft[N]=9;for(var N=256;N<280;++N)Ft[N]=7;for(var N=280;N<288;++N)Ft[N]=8;for(var te=new ot(32),N=0;N<32;++N)te[N]=5;var Wn=Mt(Ft,9,0),Xn=Mt(Ft,9,1),jn=Mt(te,5,0),Yn=Mt(te,5,1),ze=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},St=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},qe=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ve=function(s){return(s+7)/8|0},Cr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},Kn=["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"],Pt=function(s,t,e){var r=new Error(t||Kn[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Pt),!e)throw r;return r},Zn=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(It){var Et=e.length;if(It>Et){var Lt=new ot(Math.max(Et*2,It));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,d=t.b||0,m=t.l,g=t.d,w=t.m,f=t.n,P=n*8;do{if(!m){u=St(s,c,1);var _=St(s,c+1,3);if(c+=3,_)if(_==1)m=Xn,g=Yn,w=9,f=5;else if(_==2){var b=St(s,c,31)+257,A=St(s,c+10,15)+4,C=b+St(s,c+5,31)+1;c+=14;for(var M=new ot(C),L=new ot(19),X=0;X<A;++X)L[ke[X]]=St(s,c+X*3,7);c+=A*3;for(var j=ze(L),xt=(1<<j)-1,E=Mt(L,j,1),X=0;X<C;){var U=E[St(s,c,xt)];c+=U&15;var x=U>>4;if(x<16)M[X++]=x;else{var q=0,D=0;for(x==16?(D=3+St(s,c,3),c+=2,q=M[X-1]):x==17?(D=3+St(s,c,7),c+=3):x==18&&(D=11+St(s,c,127),c+=7);D--;)M[X++]=q}}var J=M.subarray(0,b),V=M.subarray(b);w=ze(J),f=ze(V),m=Mt(J,w,1),g=Mt(V,f,1)}else Pt(1);else{var x=Ve(c)+4,O=s[x-4]|s[x-3]<<8,v=x+O;if(v>n){h&&Pt(0);break}a&&l(d+O),e.set(s.subarray(x,v),d),t.b=d+=O,t.p=c=v*8,t.f=u;continue}if(c>P){h&&Pt(0);break}}a&&l(d+131072);for(var _t=(1<<w)-1,k=(1<<f)-1,Q=c;;Q=c){var q=m[qe(s,c)&_t],B=q>>4;if(c+=q&15,c>P){h&&Pt(0);break}if(q||Pt(2),B<256)e[d++]=B;else if(B==256){Q=c,m=null;break}else{var G=B-254;if(B>264){var X=B-257,I=we[X];G=St(s,c,(1<<I)-1)+_r[X],c+=I}var Y=g[qe(s,c)&k],H=Y>>4;Y||Pt(3),c+=Y&15;var V=Hn[H];if(H>3){var I=ve[H];V+=qe(s,c)&(1<<I)-1,c+=I}if(c>P){h&&Pt(0);break}a&&l(d+131072);var tt=d+G;if(d<V){var Wt=i-V,Xt=Math.min(V,tt);for(Wt+d<0&&Pt(3);d<Xt;++d)e[d]=r[Wt+d]}for(;d<tt;++d)e[d]=e[d-V]}}t.l=m,t.p=Q,t.b=d,t.f=u,m&&(u=1,t.m=w,t.d=g,t.n=f)}while(!u);return d!=e.length&&o?Cr(e,0,d):e.subarray(0,d)},$t=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ee=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},He=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Ar,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(v,b){return v.f-b.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var d=i[0].s,r=1;r<n;++r)i[r].s>d&&(d=i[r].s);var m=new mt(d+1),g=We(e[u-1],m,0);if(g>t){var r=0,w=0,f=g-t,P=1<<f;for(i.sort(function(b,A){return m[A.s]-m[b.s]||b.f-A.f});r<n;++r){var _=i[r].s;if(m[_]>t)w+=P-(1<<g-m[_]),m[_]=t;else break}for(w>>=f;w>0;){var x=i[r].s;m[x]<t?w-=1<<t-m[x]++-1:++r}for(;r>=0&&w;--r){var O=i[r].s;m[O]==t&&(--m[O],++w)}g=t}return{t:new ot(m),l:g}},We=function(s,t,e){return s.s==-1?Math.max(We(s.l,t,e+1),We(s.r,t,e+1)):t[s.s]=e},Mr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new mt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},re=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Or=function(s,t,e){var r=e.length,n=Ve(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Tr=function(s,t,e,r,n,i,o,a,h,l,u){$t(t,u++,e),++n[256];for(var c=He(n,15),d=c.t,m=c.l,g=He(i,15),w=g.t,f=g.l,P=Mr(d),_=P.c,x=P.n,O=Mr(w),v=O.c,b=O.n,A=new mt(19),C=0;C<_.length;++C)++A[_[C]&31];for(var C=0;C<v.length;++C)++A[v[C]&31];for(var M=He(A,7),L=M.t,X=M.l,j=19;j>4&&!L[ke[j-1]];--j);var xt=l+5<<3,E=re(n,Ft)+re(i,te)+o,U=re(n,d)+re(i,w)+o+14+3*j+re(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&xt<=E&&xt<=U)return Or(t,u,s.subarray(h,h+l));var q,D,J,V;if($t(t,u,1+(U<E)),u+=2,U<E){q=Mt(d,m,0),D=d,J=Mt(w,f,0),V=w;var _t=Mt(L,X,0);$t(t,u,x-257),$t(t,u+5,b-1),$t(t,u+10,j-4),u+=14;for(var C=0;C<j;++C)$t(t,u+3*C,L[ke[C]]);u+=3*j;for(var k=[_,v],Q=0;Q<2;++Q)for(var B=k[Q],C=0;C<B.length;++C){var G=B[C]&31;$t(t,u,_t[G]),u+=L[G],G>15&&($t(t,u,B[C]>>5&127),u+=B[C]>>12)}}else q=Wn,D=Ft,J=jn,V=te;for(var C=0;C<a;++C){var I=r[C];if(I>255){var G=I>>18&31;ee(t,u,q[G+257]),u+=D[G+257],G>7&&($t(t,u,I>>23&31),u+=we[G]);var Y=I&31;ee(t,u,J[Y]),u+=V[Y],Y>3&&(ee(t,u,I>>5&8191),u+=ve[Y])}else ee(t,u,q[I]),u+=D[I]}return ee(t,u,q[256]),u+D[256]},Qn=new Ne([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ar=new ot(0),Jn=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,u=(i.r||0)&7;if(t){u&&(h[0]=i.r>>3);for(var c=Qn[t-1],d=c>>13,m=c&8191,g=(1<<e)-1,w=i.p||new mt(32768),f=i.h||new mt(g+1),P=Math.ceil(e/3),_=2*P,x=function(Jt){return(s[Jt]^s[Jt+1]<<P^s[Jt+2]<<_)&g},O=new Ne(25e3),v=new mt(288),b=new mt(32),A=0,C=0,M=i.i||0,L=0,X=i.w||0,j=0;M+2<o;++M){var xt=x(M),E=M&32767,U=f[xt];if(w[E]=U,f[xt]=E,X<=M){var q=o-M;if((A>7e3||L>24576)&&(q>423||!l)){u=Tr(s,h,0,O,v,b,C,L,j,M-j,u),L=A=C=0,j=M;for(var D=0;D<286;++D)v[D]=0;for(var D=0;D<30;++D)b[D]=0}var J=2,V=0,_t=m,k=E-U&32767;if(q>2&&xt==x(M-k))for(var Q=Math.min(d,q)-1,B=Math.min(32767,M),G=Math.min(258,q);k<=B&&--_t&&E!=U;){if(s[M+J]==s[M+J-k]){for(var I=0;I<G&&s[M+I]==s[M+I-k];++I);if(I>J){if(J=I,V=k,I>Q)break;for(var Y=Math.min(k,I-2),H=0,D=0;D<Y;++D){var tt=M-k+D&32767,Wt=w[tt],Xt=tt-Wt&32767;Xt>H&&(H=Xt,U=tt)}}}E=U,U=w[E],k+=E-U&32767}if(V){O[L++]=268435456|Ge[J]<<18|Pr[V];var It=Ge[J]&31,Et=Pr[V]&31;C+=we[It]+ve[Et],++v[257+It],++b[Et],X=M+J,++A}else O[L++]=s[M],++v[s[M]]}}for(M=Math.max(M,X);M<o;++M)O[L++]=s[M],++v[s[M]];u=Tr(s,h,l,O,v,b,C,L,j,M-j,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=f,i.p=w,i.i=M,i.w=X)}else{for(var M=i.w||0;M<o+l;M+=65535){var Lt=M+65535;Lt>=o&&(h[u/8|0]=l,Lt=o),u=Or(h,u+1,s.subarray(M,Lt))}i.i=o}return Cr(a,0,r+Ve(u)+n)},Ir=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ts=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return Jn(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Er=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},es=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Ir();n.p(t.dictionary),Er(s,2,n.d())}},rs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Pt(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Pt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ns(s,t){t||(t={});var e=Ir();e.p(s);var r=ts(s,t,t.dictionary?6:2,4);return es(r,t),Er(r,r.length-4,e.d()),r}function ss(s,t){return Zn(s.subarray(rs(s,t),-4),{i:2},t,t)}var is=typeof TextDecoder<"u"&&new TextDecoder,os=0;try{is.decode(Ar,{stream:!0}),os=1}catch{}const as="modern-font";function ne(s,t){if(!s)throw new Error(`[${as}] ${t}`)}function ls(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function kt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Ur=Object.defineProperty,hs=(s,t,e)=>t in s?Ur(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ur(t,e,n),n},cs=(s,t,e)=>(hs(s,t+"",e),e);const be={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(ls(t),e,r),this.littleEndian=n,cs(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=be[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=be[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=kt(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var us=Object.defineProperty,fs=(s,t,e)=>t in s?us(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ps=(s,t,e)=>(fs(s,t+"",e),e);const $r=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=$r.get(n);o||(o={columns:[],byteLength:0},$r.set(n,o));const a={...t,name:i,byteLength:e*be[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+be[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class wt{constructor(t,e,r,n){ps(this,"view"),this.view=new rt(t,e,r,n)}}function ds(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function xe(s){s=ds(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function gs(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function ms(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class _e extends wt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Dr=Object.defineProperty,ys=(s,t,e)=>t in s?Dr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Dr(t,e,n),n},Lr=(s,t,e)=>(ys(s,typeof t!="symbol"?t+"":t,e),e);const ht=class kn extends _e{constructor(){super(...arguments),Lr(this,"format","EmbeddedOpenType"),Lr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=xe(n.fontFamily||""),o=i.length,a=xe(n.fontStyle||""),h=a.length,l=xe(n.version||""),u=l.length,c=xe(n.fullName||""),d=c.length,m=86+o+4+h+4+u+4+d+2+t.view.byteLength,g=new kn(new ArrayBuffer(m),0,m,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(u),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let ws=ht;var vs=Object.defineProperty,Se=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&vs(t,e,n),n};class jt extends wt{constructor(t,e){super(t,e,16)}}Se([y({type:"char",size:4})],jt.prototype,"tag"),Se([y("uint32")],jt.prototype,"checkSum"),Se([y("uint32")],jt.prototype,"offset"),Se([y("uint32")],jt.prototype,"length");const Xe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],bs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];var xs=Object.defineProperty,_s=(s,t,e)=>t in s?xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,se=(s,t,e)=>(_s(s,typeof t!="symbol"?t+"":t,e),e);class je{constructor(t){se(this,"index"),se(this,"name"),se(this,"isComposite",!1),se(this,"components",[]),se(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,u=[];for(let c=0,d=l.length;c<d;c+=1){const m=l[c];m.type==="M"?u.push({type:"M",x:t+m.x*a,y:e+-m.y*h}):m.type==="L"?u.push({type:"L",x:t+m.x*a,y:e+-m.y*h}):m.type==="Q"?u.push({type:"Q",x1:t+m.x1*a,y1:e+-m.y1*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="C"?u.push({type:"C",x1:t+m.x1*a,y1:e+-m.y1*h,x2:t+m.x2*a,y2:e+-m.y2*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="Z"&&u.push({type:"Z"})}return u}}class Ss extends je{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,d,m,g;const w=[],f=[];let P=0,_=!1,x=!1,O=o,v=0,b=0;function A(E,U){w.push({type:"L",x:E,y:U})}function C(E,U,q,D,J,V){w.push({type:"C",x1:E,y1:U,x2:q,y2:D,x:J,y:V})}function M(E,U){x&&l!==2&&L(),x=!0,w.push({type:"M",x:E,y:U})}function L(){w.push({type:"Z"})}function X(E){w.push(...E)}function j(){f.length%2!==0&&!_&&(O=f.shift()+i),P+=f.length>>1,f.length=0,_=!0}function xt(E){let U,q,D,J,V,_t,k,Q,B,G,I,Y,H=0;for(;H<E.length;){let tt=E[H++];switch(tt){case 1:j();break;case 3:j();break;case 4:f.length>1&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),M(v,b);break;case 5:for(;f.length>0;)v+=f.shift(),b+=f.shift(),A(v,b);break;case 6:for(;f.length>0&&(v+=f.shift(),A(v,b),f.length!==0);)b+=f.shift(),A(v,b);break;case 7:for(;f.length>0&&(b+=f.shift(),A(v,b),f.length!==0);)v+=f.shift(),A(v,b);break;case 8:for(;f.length>0;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 10:V=f.pop()+h,_t=t.subrs[V],_t&&xt(_t);break;case 11:return;case 12:switch(tt=E[H],H+=1,tt){case 35:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),b=Y+f.shift(),f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 34:c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=b,v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 36:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 37:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),Math.abs(I-v)>Math.abs(Y-b)?v=I+f.shift():b=Y+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),f.length=0}break;case 14:if(f.length>=4){const Wt=Xe[f.pop()],Xt=Xe[f.pop()],It=f.pop(),Et=f.pop();if(Wt&&Xt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Wt),Jt=t.charset.indexOf(Xt);n.components.push({glyphIndex:Jt,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Et,dy:It}),X(r.get(Jt).pathCommands);const yr=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let wr=0;wr<yr.length;wr+=1){const Ut=yr[wr];Ut.type!=="Z"&&(Ut.x+=Et,Ut.y+=It),(Ut.type==="Q"||Ut.type==="C")&&(Ut.x1+=Et,Ut.y1+=It),Ut.type==="C"&&(Ut.x2+=Et,Ut.y2+=It)}X(yr)}}else f.length>0&&!_&&(O=f.shift()+i,_=!0);x&&l!==2&&(L(),x=!1);break;case 18:j();break;case 19:case 20:j(),H+=P+7>>3;break;case 21:f.length>2&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),v+=f.pop(),M(v,b);break;case 22:f.length>1&&!_&&(O=f.shift()+i,_=!0),v+=f.pop(),M(v,b);break;case 23:j();break;case 24:for(;f.length>2;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);v+=f.shift(),b+=f.shift(),A(v,b);break;case 25:for(;f.length>6;)v+=f.shift(),b+=f.shift(),A(v,b);c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 26:for(f.length%2&&(v+=f.shift());f.length>0;)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m,b=g+f.shift(),C(c,d,m,g,v,b);break;case 27:for(f.length%2&&(b+=f.shift());f.length>0;)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g,C(c,d,m,g,v,b);break;case 28:U=E[H],q=E[H+1],f.push((U<<24|q<<16)>>16),H+=2;break;case 29:V=f.pop()+a,_t=t.gsubrs[V],_t&&xt(_t);break;case 30:for(;f.length>0&&(c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;case 31:for(;f.length>0&&(c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?f.push(tt-139):tt<251?(U=E[H],H+=1,f.push((tt-247)*256+U+108)):tt<255?(U=E[H],H+=1,f.push(-(tt-251)*256-U-108)):(U=E[H],q=E[H+1],D=E[H+2],J=E[H+3],H+=4,f.push((U<<24|q<<16|D<<8|J)/65536))}}}xt(e),this.pathCommands=w,_&&(this.advanceWidth=O)}}var Ps=Object.defineProperty,Cs=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ms=(s,t,e)=>(Cs(s,t+"",e),e);class Ye{constructor(t){this._sfnt=t,Ms(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Os extends Ye{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ss({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Br=Object.defineProperty,Ts=(s,t,e)=>t in s?Br(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Br(t,e,n),n},Pe=(s,t,e)=>(Ts(s,typeof t!="symbol"?t+"":t,e),e);class Ce extends wt{constructor(t,e,r,n){super(t,e,r,n),Pe(this,"_offsets"),Pe(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}Fr([y("uint16")],Ce.prototype,"count"),Fr([y("uint8")],Ce.prototype,"offsetSize");class Me extends Ce{constructor(){super(...arguments),Pe(this,"_isString",!1)}}class Nr extends Ce{constructor(){super(...arguments),Pe(this,"_isString",!0)}}const As=[".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"],Is=[".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"],Es=[".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"],Us=[".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 Oe(s,t){return t<=390?As[t]:s[t-391]}var $s=Object.defineProperty,Ds=(s,t,e)=>t in s?$s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,kr=(s,t,e)=>(Ds(s,typeof t!="symbol"?t+"":t,e),e);function R(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class Gr extends wt{constructor(){super(...arguments),kr(this,"_dict"),kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Oe(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ls=Object.defineProperty,Ke=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ls(t,e,n),n};class Te extends Gr{}Ke([R(19)],Te.prototype,"subrs"),Ke([R(20)],Te.prototype,"defaultWidthX"),Ke([R(21)],Te.prototype,"nominalWidthX");var Bs=Object.defineProperty,K=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Bs(t,e,n),n};class W extends Gr{}K([R(0,"string")],W.prototype,"version"),K([R(1,"string")],W.prototype,"notice"),K([R(1200,"string")],W.prototype,"copyright"),K([R(2,"string")],W.prototype,"fullName"),K([R(3,"string")],W.prototype,"familyName"),K([R(4,"string")],W.prototype,"weight"),K([R(1201)],W.prototype,"isFixedPitch"),K([R(1202)],W.prototype,"italicAngle"),K([R(1203,"number",-100)],W.prototype,"underlinePosition"),K([R(1204,"number",50)],W.prototype,"underlineThickness"),K([R(1205)],W.prototype,"paintType"),K([R(1206,"number",2)],W.prototype,"charstringType"),K([R(1207,"number[]",[.001,0,0,.001,0,0])],W.prototype,"fontMatrix"),K([R(13)],W.prototype,"uniqueId"),K([R(5,"number[]",[0,0,0,0])],W.prototype,"fontBBox"),K([R(1208)],W.prototype,"strokeWidth"),K([R(14)],W.prototype,"xuid"),K([R(15)],W.prototype,"charset"),K([R(16)],W.prototype,"encoding"),K([R(17)],W.prototype,"charStrings"),K([R(18,"number[]",[0,0])],W.prototype,"private");var Fs=Object.defineProperty,Ns=(s,t,e)=>t in s?Fs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ze=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{ie.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ie.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const Rr=class ye{constructor(t){Ze(this,"tables",new Map),Ze(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];o.call(this,u,e,r,n,i),u.advanceWidth&&(e+=u.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new ye(this.tableViews)}delete(t){const e=ye.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=ye.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ye.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};Ze(Rr,"tableDefinitions",new Map);let ie=Rr;class ct extends wt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var zr=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Gs=(s,t,e)=>t in s?zr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,oe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&zr(t,e,n),n},Qe=(s,t,e)=>(Gs(s,typeof t!="symbol"?t+"":t,e),e);p.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),Qe(this,"_glyphs"),Qe(this,"privateDict"),Qe(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Os(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Nr(e,n),this.topDictIndex=new Me(e,this.nameIndex.endOffset),this.stringIndex=new Nr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Me(e,this.stringIndex.endOffset),this.topDict=new W(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new Te(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Me(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Me(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Is:this.topDict.charset===1?this.charset=Es:this.topDict.charset===2?this.charset=Us:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Xe:this.topDict.encoding===1?this.encoding=bs:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(Oe(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(Oe(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(Oe(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let u=h;u<=h+l;u+=1)i[u]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},oe([y("uint8")],p.Cff.prototype,"majorVersion",2),oe([y("uint8")],p.Cff.prototype,"minorVersion",2),oe([y("uint8")],p.Cff.prototype,"headerSize",2),oe([y("uint8")],p.Cff.prototype,"offsetSize",2),p.Cff=oe([nt("CFF ","cff")],p.Cff);var Rs=Object.defineProperty,Ae=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Rs(t,e,n),n};const ae=class Gn extends wt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Gn;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ae([y("uint16")],ae.prototype,"format"),Ae([y("uint16")],ae.prototype,"length"),Ae([y("uint16")],ae.prototype,"language"),Ae([y({type:"uint8",size:256})],ae.prototype,"glyphIndexArray");let Je=ae;var zs=Object.defineProperty,tr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&zs(t,e,n),n};class le extends wt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,d=i[u].entryCount;c<d;c++)if(i[u].idRangeOffset+c>=o.length?h=0:(h=o[i[u].idRangeOffset+c],h!==0&&(h=h+i[u].idDelta)),h!==0&&h<t){const m=(l<<8|c+i[u].firstCode)%65535;e.set(m,h)}}return e}}tr([y("uint16")],le.prototype,"format"),tr([y("uint16")],le.prototype,"length"),tr([y("uint16")],le.prototype,"language");function qr(s){return s>32767?s-65536:s<-32767?s+65536:s}function er(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:qr(i-o)}):(n.start=Number(o),n.startId=i,n.delta=qr(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var qs=Object.defineProperty,Gt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&qs(t,e,n),n};const Nt=class Rn extends wt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=er(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new Rn(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=i[l];u<=c;++u)if(o[l]===0)t.set(u,(u+a[l])%65536);else{const d=l+o[l]/2+(u-n[l])-r,m=h[d];m!==0?t.set(u,(m+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Gt([y("uint16")],Nt.prototype,"format"),Gt([y("uint16")],Nt.prototype,"length"),Gt([y("uint16")],Nt.prototype,"language"),Gt([y("uint16")],Nt.prototype,"segCountX2"),Gt([y("uint16")],Nt.prototype,"searchRange"),Gt([y("uint16")],Nt.prototype,"entrySelector"),Gt([y("uint16")],Nt.prototype,"rangeShift");let rr=Nt;var Vs=Object.defineProperty,he=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Vs(t,e,n),n};class Rt extends wt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}he([y("uint16")],Rt.prototype,"format"),he([y("uint16")],Rt.prototype,"length"),he([y("uint16")],Rt.prototype,"language"),he([y("uint16")],Rt.prototype,"firstCode"),he([y("uint16")],Rt.prototype,"entryCount");var Hs=Object.defineProperty,ce=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Hs(t,e,n),n};const Yt=class zn extends wt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=er(t),r=new zn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};ce([y("uint16")],Yt.prototype,"format"),ce([y("uint16")],Yt.prototype,"reserved"),ce([y("uint32")],Yt.prototype,"length"),ce([y("uint32")],Yt.prototype,"language"),ce([y("uint32")],Yt.prototype,"nGroups");let nr=Yt;var Ws=Object.defineProperty,sr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ws(t,e,n),n};class ue extends wt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}sr([y("uint16")],ue.prototype,"format"),sr([y("uint32")],ue.prototype,"length"),sr([y("uint32")],ue.prototype,"numVarSelectorRecords");var Vr=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,js=(s,t,e)=>t in s?Vr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ir=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Vr(t,e,n),n},Hr=(s,t,e)=>(js(s,typeof t!="symbol"?t+"":t,e),e);p.Cmap=class extends ct{constructor(){super(...arguments),Hr(this,"_unicodeToGlyphIndexMap"),Hr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=rr.from(t),n=Je.from(t),i=e?nr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new p.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return u.numberSubtables=l.length,u.view.seek(4),l.forEach(c=>{u.view.writeUint16(c.platformID),u.view.writeUint16(c.platformSpecificID),u.view.writeUint32(c.offset)}),u.view.writeBytes(r.view,o),u.view.writeBytes(n.view,a),i&&u.view.writeBytes(i.view,h),u}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new Je(this.view.buffer,e.offset);break;case 2:n=new le(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new rr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Rt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new nr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ue(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,u,c;const t=this.readSubtables(),e=(a=t.find(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,i=(u=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:u.view,o=(c=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.format===14))==null?void 0:c.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},ir([y("uint16")],p.Cmap.prototype,"version",2),ir([y("uint16")],p.Cmap.prototype,"numberSubtables",2),p.Cmap=ir([nt("cmap")],p.Cmap);class Ys extends je{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return ne(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ne(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;ne(c<2e4,`Bad numberOfCoordinates:${u}`);const d=[];let m,g=0;for(;g<c;)if(m=t.view.readUint8(),d.push(m),g++,m&8&&g<c){const w=t.view.readUint8();for(let f=0;f<w;f++)d.push(m),g++}if(ne(d.length===c,`Bad flags length: ${d.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let f;if(c>0){for(let x=0;x<c;x+=1)m=d[x],f={},f.onCurve=!!(m&1),f.lastPointOfContour=a.includes(x),w.push(f);let P=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.x=this._parseGlyphCoordinate(t,m,P,2,16),P=f.x;let _=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.y=this._parseGlyphCoordinate(t,m,_,4,32),_=f.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{ne(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let d=l.points[h.matchedPoints[1]];const m={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],m)[0],m.dx=c.x-d.x,m.dy=c.y-d.y,u=this._transformPoints(l.points,m)}this.points=this.points.concat(u)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let u=l[l.length-1],c=l[0];u.onCurve?i.push({type:"M",x:u.x,y:u.y}):c.onCurve?i.push({type:"M",x:c.x,y:c.y}):i.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let d=0,m=l.length;d<m;++d)if(u=c,c=l[(d+1)%m],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let g=c;c.onCurve||(g={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Ks extends Ye{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new Ys({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Wr=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Js=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zs(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Wr(t,e,n),n},ti=(s,t,e)=>(Qs(s,t+"",e),e);const Kt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};p.Glyf=class extends ct{constructor(){super(...arguments),ti(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new p.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Ks(this._sfnt))}},p.Glyf=Js([nt("glyf")],p.Glyf);var ei=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e,r)=>{for(var n=r>1?void 0:r?ri(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ei(t,e,n),n};p.Gpos=class extends ct{},p.Gpos=ni([nt("GPOS","gpos")],p.Gpos);var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,zt=(s,t,e,r)=>{for(var n=r>1?void 0:r?ii(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&si(t,e,n),n};p.Gsub=class extends ct{},zt([y("uint16")],p.Gsub.prototype,"majorVersion",2),zt([y("uint16")],p.Gsub.prototype,"minorVersion",2),zt([y("uint16")],p.Gsub.prototype,"scriptListOffset",2),zt([y("uint16")],p.Gsub.prototype,"featureListOffset",2),zt([y("uint16")],p.Gsub.prototype,"lookupListOffset",2),zt([y("uint16")],p.Gsub.prototype,"featureVariationsOffset",2),p.Gsub=zt([nt("GSUB","gsub")],p.Gsub);var oi=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?ai(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&oi(t,e,n),n};p.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],p.Head.prototype,"version",2),et([y("fixed")],p.Head.prototype,"fontRevision",2),et([y("uint32")],p.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],p.Head.prototype,"magickNumber",2),et([y("uint16")],p.Head.prototype,"flags",2),et([y("uint16")],p.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],p.Head.prototype,"created",2),et([y({type:"longDateTime"})],p.Head.prototype,"modified",2),et([y("int16")],p.Head.prototype,"xMin",2),et([y("int16")],p.Head.prototype,"yMin",2),et([y("int16")],p.Head.prototype,"xMax",2),et([y("int16")],p.Head.prototype,"yMax",2),et([y("uint16")],p.Head.prototype,"macStyle",2),et([y("uint16")],p.Head.prototype,"lowestRecPPEM",2),et([y("int16")],p.Head.prototype,"fontDirectionHint",2),et([y("int16")],p.Head.prototype,"indexToLocFormat",2),et([y("int16")],p.Head.prototype,"glyphDataFormat",2),p.Head=et([nt("head")],p.Head);var li=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?hi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&li(t,e,n),n};p.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],p.Hhea.prototype,"version",2),pt([y("int16")],p.Hhea.prototype,"ascent",2),pt([y("int16")],p.Hhea.prototype,"descent",2),pt([y("int16")],p.Hhea.prototype,"lineGap",2),pt([y("uint16")],p.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],p.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],p.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],p.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],p.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],p.Hhea.prototype,"reserved",2),pt([y("int16")],p.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],p.Hhea.prototype,"numOfLongHorMetrics",2),p.Hhea=pt([nt("hhea")],p.Hhea);var Xr=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,ui=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fi=(s,t,e,r)=>{for(var n=r>1?void 0:r?ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Xr(t,e,n),n},pi=(s,t,e)=>(ui(s,t+"",e),e);p.Hmtx=class extends ct{constructor(){super(...arguments),pi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},p.Hmtx=fi([nt("hmtx")],p.Hmtx);var di=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,mi=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&di(t,e,n),n};p.Kern=class extends ct{},p.Kern=mi([nt("kern","kern")],p.Kern);var jr=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,wi=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vi=(s,t,e,r)=>{for(var n=r>1?void 0:r?yi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&jr(t,e,n),n},bi=(s,t,e)=>(wi(s,t+"",e),e);p.Loca=class extends ct{constructor(){super(...arguments),bi(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new p.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},p.Loca=vi([nt("loca")],p.Loca);var xi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xi(t,e,n),n};p.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],p.Maxp.prototype,"version",2),ut([y("uint16")],p.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],p.Maxp.prototype,"maxPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxContours",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],p.Maxp.prototype,"maxZones",2),ut([y("uint16")],p.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxStorage",2),ut([y("uint16")],p.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],p.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentDepth",2),p.Maxp=ut([nt("maxp")],p.Maxp);var Yr=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Pi=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ie=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yr(t,e,n),n},Ci=(s,t,e)=>(Pi(s,t+"",e),e);const Kr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},or={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Mi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Zr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};p.Name=class extends ct{constructor(){super(...arguments),Ci(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=or.Macintosh,i=Mi.Default,o=0;e.some(h=>h.platform===or.Microsoft&&h.encoding===Zr.UCS2&&h.language===1033)&&(n=or.Microsoft,i=Zr.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&Kr[l.nameId]&&(a[Kr[l.nameId]]=o===0?gs(l.name):ms(l.name))}return a}},Ie([y("uint16")],p.Name.prototype,"format",2),Ie([y("uint16")],p.Name.prototype,"count",2),Ie([y("uint16")],p.Name.prototype,"stringOffset",2),p.Name=Ie([nt("name")],p.Name);var Oi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,T=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Oi(t,e,n),n};p.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},T([y("uint16")],p.Os2.prototype,"version",2),T([y("int16")],p.Os2.prototype,"xAvgCharWidth",2),T([y("uint16")],p.Os2.prototype,"usWeightClass",2),T([y("uint16")],p.Os2.prototype,"usWidthClass",2),T([y("uint16")],p.Os2.prototype,"fsType",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutSize",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutPosition",2),T([y("uint16")],p.Os2.prototype,"sFamilyClass",2),T([y({type:"uint8"})],p.Os2.prototype,"bFamilyType",2),T([y({type:"uint8"})],p.Os2.prototype,"bSerifStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bWeight",2),T([y({type:"uint8"})],p.Os2.prototype,"bProportion",2),T([y({type:"uint8"})],p.Os2.prototype,"bContrast",2),T([y({type:"uint8"})],p.Os2.prototype,"bStrokeVariation",2),T([y({type:"uint8"})],p.Os2.prototype,"bArmStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bLetterform",2),T([y({type:"uint8"})],p.Os2.prototype,"bMidline",2),T([y({type:"uint8"})],p.Os2.prototype,"bXHeight",2),T([y({type:"uint8",size:16})],p.Os2.prototype,"ulUnicodeRange",2),T([y({type:"char",size:4})],p.Os2.prototype,"achVendID",2),T([y("uint16")],p.Os2.prototype,"fsSelection",2),T([y("uint16")],p.Os2.prototype,"usFirstCharIndex",2),T([y("uint16")],p.Os2.prototype,"usLastCharIndex",2),T([y("int16")],p.Os2.prototype,"sTypoAscender",2),T([y("int16")],p.Os2.prototype,"sTypoDescender",2),T([y("int16")],p.Os2.prototype,"sTypoLineGap",2),T([y("uint16")],p.Os2.prototype,"usWinAscent",2),T([y("uint16")],p.Os2.prototype,"usWinDescent",2),T([y({offset:72,type:"uint8",size:8})],p.Os2.prototype,"ulCodePageRange",2),T([y({offset:72,type:"int16"})],p.Os2.prototype,"sxHeight",2),T([y("int16")],p.Os2.prototype,"sCapHeight",2),T([y("uint16")],p.Os2.prototype,"usDefaultChar",2),T([y("uint16")],p.Os2.prototype,"usBreakChar",2),T([y("uint16")],p.Os2.prototype,"usMaxContext",2),p.Os2=T([nt("OS/2","os2")],p.Os2);var Ai=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Ot=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ii(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ai(t,e,n),n};p.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([y("fixed")],p.Post.prototype,"format",2),Ot([y("fixed")],p.Post.prototype,"italicAngle",2),Ot([y("int16")],p.Post.prototype,"underlinePosition",2),Ot([y("int16")],p.Post.prototype,"underlineThickness",2),Ot([y("uint32")],p.Post.prototype,"isFixedPitch",2),Ot([y("uint32")],p.Post.prototype,"minMemType42",2),Ot([y("uint32")],p.Post.prototype,"maxMemType42",2),Ot([y("uint32")],p.Post.prototype,"minMemType1",2),Ot([y("uint32")],p.Post.prototype,"maxMemType1",2),p.Post=Ot([nt("post")],p.Post);var Ei=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ui(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ei(t,e,n),n};p.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],p.Vhea.prototype,"version",2),dt([y("int16")],p.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],p.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],p.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],p.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],p.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],p.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],p.Vhea.prototype,"reserved",2),dt([y("int16")],p.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],p.Vhea.prototype,"numOfLongVerMetrics",2),p.Vhea=dt([nt("vhea")],p.Vhea);var Qr=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Di=(s,t,e)=>t in s?Qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Li=(s,t,e,r)=>{for(var n=r>1?void 0:r?$i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Qr(t,e,n),n},Bi=(s,t,e)=>(Di(s,t+"",e),e);p.Vmtx=class extends ct{constructor(){super(...arguments),Bi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},p.Vmtx=Li([nt("vmtx")],p.Vmtx);var Jr=Object.defineProperty,Fi=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Jr(t,e,n),n},Ee=(s,t,e)=>(Fi(s,typeof t!="symbol"?t+"":t,e),e);class st extends _e{constructor(){super(...arguments),Ee(this,"format","TrueType"),Ee(this,"mimeType","font/ttf"),Ee(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(kt(t).getUint32(0))}static checksum(t){const e=kt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,d)=>c+e(d.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,h=0;const l=i.getDirectories();t.tableViews.forEach((c,d)=>{const m=l[h++];m.tag=d,m.checkSum=this.checksum(c),m.offset=a,m.length=c.byteLength,i.view.writeBytes(c,a),a+=e(m.length)});const u=i.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new jt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ie(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ee(st,"signature",new Set([65536,1953658213,1954115633])),fe([y("uint32")],st.prototype,"scalerType"),fe([y("uint16")],st.prototype,"numTables"),fe([y("uint16")],st.prototype,"searchRange"),fe([y("uint16")],st.prototype,"entrySelector"),fe([y("uint16")],st.prototype,"rangeShift");var Ni=Object.defineProperty,ki=(s,t,e)=>t in s?Ni(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ar=(s,t,e)=>(ki(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends st{constructor(){super(...arguments),ar(this,"format","OpenType"),ar(this,"mimeType","font/otf")}static from(t){return super.from(t)}}ar(Ue,"signature",new Set([1330926671]));var Gi=Object.defineProperty,pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Gi(t,e,n),n};class qt extends wt{constructor(t,e){super(t,e,20)}}pe([y({type:"char",size:4})],qt.prototype,"tag"),pe([y("uint32")],qt.prototype,"offset"),pe([y("uint32")],qt.prototype,"compLength"),pe([y("uint32")],qt.prototype,"origLength"),pe([y("uint32")],qt.prototype,"origChecksum");var tn=Object.defineProperty,Ri=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&tn(t,e,n),n},$e=(s,t,e)=>(Ri(s,typeof t!="symbol"?t+"":t,e),e);const gt=class vr extends _e{constructor(){super(...arguments),$e(this,"format","WOFF"),$e(this,"mimeType","font/woff"),$e(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":Ue.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(kt(t).getUint32(0))}static checkSum(t){const e=kt(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,d)=>{const m=kt(ns(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:d,view:m.byteLength<c.byteLength?m:c,rawView:c})});const i=n.length,o=n.reduce((c,d)=>c+r(d.view.byteLength),0),a=new vr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((c,d)=>c+r(d.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const d=u[l++];d.tag=c.tag,d.offset=h,d.compLength=c.view.byteLength,d.origChecksum=vr.checkSum(c.rawView),d.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(d.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new qt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ie(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(ss(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};$e(gt,"signature",new Set([2001684038])),yt([y("uint32")],gt.prototype,"signature"),yt([y("uint32")],gt.prototype,"flavor"),yt([y("uint32")],gt.prototype,"length"),yt([y("uint16")],gt.prototype,"numTables"),yt([y("uint16")],gt.prototype,"reserved"),yt([y("uint32")],gt.prototype,"totalSfntSize"),yt([y("uint16")],gt.prototype,"majorVersion"),yt([y("uint16")],gt.prototype,"minorVersion"),yt([y("uint32")],gt.prototype,"metaOffset"),yt([y("uint32")],gt.prototype,"metaLength"),yt([y("uint32")],gt.prototype,"metaOrigLength"),yt([y("uint32")],gt.prototype,"privOffset"),yt([y("uint32")],gt.prototype,"privLength");let Dt=gt;function en(s){if(st.is(s))return new st(s);if(Ue.is(s))return new Ue(s);if(Dt.is(s))return new Dt(s)}var zi=Object.defineProperty,qi=(s,t,e)=>t in s?zi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>(qi(s,typeof t!="symbol"?t+"":t,e),e);const rn=class qn{constructor(){de(this,"fallbackFont"),de(this,"_loading",new Map),de(this,"_loaded",new Map),de(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...qn.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
1
+ (function(d,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(d=typeof globalThis<"u"?globalThis:d||self,it(d.modernText={}))})(this,function(d){"use strict";var Xo=Object.defineProperty;var jo=(d,it,Ct)=>it in d?Xo(d,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):d[it]=Ct;var F=(d,it,Ct)=>jo(d,typeof it!="symbol"?it+"":it,Ct);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=Hn(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ct(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function Hn(s,t,e,r,n){var m;const i=((m=s.match(/linear-gradient\((.+)\)$/))==null?void 0:m[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),p=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+p,x1:t+r/2+c,y1:e+n/2-p,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[3].replace("%",""))/100,color:w}})}}const Xn={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function jn(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h,strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:m="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=Xn[o],s.miterLimit=a,h&&s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=p,s.shadowColor=m}class S{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new S(1/0,1/0)}static get MIN(){return new S(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new S(this.x,this.y)}}class R{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new R(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new S((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new R(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Yn=Object.defineProperty,Kn=(s,t,e)=>t in s?Yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Zn=(s,t,e)=>(Kn(s,t+"",e),e);class mt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){Zn(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=h,u[6]=r,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],m=r[5],g=r[8],w=n[0],f=n[3],P=n[6],_=n[1],x=n[4],O=n[7],v=n[2],b=n[5],A=n[8];return i[0]=o*w+a*_+h*v,i[3]=o*f+a*x+h*b,i[6]=o*P+a*O+h*A,i[1]=l*w+u*_+c*v,i[4]=l*f+u*x+c*b,i[7]=l*P+u*O+c*A,i[2]=p*w+m*_+g*v,i[5]=p*f+m*x+g*b,i[8]=p*P+m*O+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*o-a*l,p=a*h-u*i,m=l*i-o*h,g=e*c+r*p+n*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=p*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=m*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(Fe.makeScale(t,e)),this}rotate(t){return this.premultiply(Fe.makeRotation(-t)),this}translate(t,e){return this.premultiply(Fe.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Fe=new mt;function br(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function Qn(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let p=t*t,m=e*e;const g=u*u,w=c*c,f=g/p+w/m;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,p=t*t,m=e*e}const P=p*w+m*g,_=(p*m-P)/P;let x=Math.sqrt(Math.max(0,_));n===i&&(x=-x);const O=x*t*c/e,v=-x*e*u/t,b=Math.cos(r)*O-Math.sin(r)*v+(o.x+a.x)/2,A=Math.sin(r)*O+Math.cos(r)*v+(o.y+a.y)/2,C=br(1,0,(u-O)/t,(c-v)/e),M=br((u-O)/t,(c-v)/e,(-u-O)/t,(-c-v)/e)%(Math.PI*2);s.ellipse(b,A,t,e,r,C,C+M,i===1)}function jt(s,t){return s-(t-s)}function xr(s,t){const e=new S,r=new S;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(jt(e.x,r.x),jt(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(jt(e.x,r.x),jt(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=jt(e.x,r.x),h=jt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),Qn(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const K={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Mt(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(f,P,_){const x=new SyntaxError(`Unexpected character "${f}" at index ${P}.`);throw x.partial=_,x}function m(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=s.length;for(let f=0;f<w;f++){if(g=s[f],Array.isArray(t)&&t.includes(c.length%e)&&K.FLAGS.test(g)){a=1,l=g,m();continue}if(a===0){if(K.WHITESPACE.test(g))continue;if(K.DIGIT.test(g)||K.SIGN.test(g)){a=1,l=g;continue}if(K.POINT.test(g)){a=2,l=g;continue}K.COMMA.test(g)&&(h&&p(g,f,c),h=!0)}if(a===1){if(K.DIGIT.test(g)){l+=g;continue}if(K.POINT.test(g)){l+=g,a=2;continue}if(K.EXP.test(g)){a=3;continue}K.SIGN.test(g)&&l.length===1&&K.SIGN.test(l[0])&&p(g,f,c)}if(a===2){if(K.DIGIT.test(g)){l+=g;continue}if(K.EXP.test(g)){a=3;continue}K.POINT.test(g)&&l[l.length-1]==="."&&p(g,f,c)}if(a===3){if(K.DIGIT.test(g)){u+=g;continue}if(K.SIGN.test(g)){if(u===""){u+=g;continue}u.length===1&&K.SIGN.test(u)&&p(g,f,c)}}K.WHITESPACE.test(g)?(m(),a=0,h=!1):K.COMMA.test(g)?(m(),a=0,h=!0):K.SIGN.test(g)?(m(),a=1,l=g):K.POINT.test(g)?(m(),a=2,l=g):p(g,f,c)}return m(),c}function Jn(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function ts(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${Jn(s[e])} `;return t}const es=/[a-df-z][^a-df-z]*/gi;function _r(s){const t=[],e=s.match(es);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let h;switch(o){case"m":case"M":h=Mt(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Mt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Mt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Mt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Mt(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Mt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Mt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Mt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Mt(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var rs=Object.defineProperty,ns=(s,t,e)=>t in s?rs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ne=(s,t,e)=>(ns(s,typeof t!="symbol"?t+"":t,e),e);class kt{constructor(){Ne(this,"arcLengthDivisions",200),Ne(this,"_cacheArcLengths"),Ne(this,"_needsUpdate",!1)}getPointAt(t,e=new S){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const u=r[n],p=r[n+1]-u,m=(o-u)/p;return(n+m)/(i-1)}getTangent(t,e=new S){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new R(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return ts(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Sr(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function ss(s,t){const e=1-s;return e*e*t}function is(s,t){return 2*(1-s)*s*t}function os(s,t){return s*s*t}function Pr(s,t,e,r){return ss(s,t)+is(s,e)+os(s,r)}function as(s,t){const e=1-s;return e*e*e*t}function ls(s,t){const e=1-s;return 3*e*e*s*t}function hs(s,t){return 3*(1-s)*s*s*t}function cs(s,t){return s*s*s*t}function Cr(s,t,e,r,n){return as(s,t)+ls(s,e)+hs(s,r)+cs(s,n)}class us extends kt{constructor(t=new S,e=new S,r=new S,n=new S){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new S){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(Cr(t,r.x,n.x,i.x,o.x),Cr(t,r.y,n.y,i.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=S.MAX,e=S.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((c,p)=>{for(const m of c)for(let g=0;g<=p;g++){const w=g/p-.5,f=Math.min(1,Math.max(0,m+w)),P=this.getPoint(f);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(l,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{startControl:e,endControl:r,end:n}=this;return t.bezierCurveTo(e.x,e.y,r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const fs=new mt,Mr=new mt,Or=new mt,we=new S;class ps extends kt{constructor(t=new S,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}getPoint(t,e=new S){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,p=h-this.center.y;a=c*l-p*u+this.center.x,h=c*u+p*l+this.center.y}return e.set(a,h)}getCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),p=Math.abs(n-i),m=p>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const f=n+Math.PI,P=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),_=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:P,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const f=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),P=l+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:m,sweepFlag:g,x:f,y:P}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}transform(t){return we.set(this.center.x,this.center.y),we.applyMatrix3(t),this.center.x=we.x,this.center.y=we.y,ms(t)?ds(this,t):gs(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=S.MAX,e=S.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),u=Math.sin(o),c=Math.sqrt(n*n*l*l+i*i*u*u),p=Math.sqrt(n*n*u*u+i*i*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-p),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function ds(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new S(e*n,e*i),a=new S(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=fs.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=Mr.copy(u).invert(),g=Or.copy(c).transpose().multiply(c).elements,w=ys(g[0],g[1],g[4]),f=Math.sqrt(w.rt1),P=Math.sqrt(w.rt2);if(s.radiusX=1/f,s.radiusY=1/P,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=Mr.set(f,0,0,0,P,0,0,0,1),O=Or.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(O).multiply(u),b=A=>{const{x:C,y:M}=new S(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(M,C)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),Tr(t)&&(s.clockwise=!s.clockwise)}}function gs(s,t){const e=Ar(t),r=Ir(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Tr(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Tr(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function ms(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Ar(s),n=Ir(s);return Math.abs(e/(r*n))>Number.EPSILON}function Ar(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ir(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function ys(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?i=l+u:i=l-u,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class ke extends kt{constructor(t=new S,e=new S){super(),this.start=t,this.end=e}getPoint(t,e=new S){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new S){return this.getPoint(t,e)}getTangent(t,e=new S){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new S){return this.getTangent(t,e)}getNormal(t,e=new S){const{x:r,y:n}=this.getPoint(t).sub(this.start);return e.set(n,-r).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class ws extends kt{constructor(t=new S,e=new S,r=new S){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new S){const{start:r,control:n,end:i}=this;return e.set(Pr(t,r.x,n.x,i.x),Pr(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{min:t,max:e}}getCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{control:e,end:r}=this;return t.quadraticCurveTo(e.x,e.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var vs=Object.defineProperty,bs=(s,t,e)=>t in s?vs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Er=(s,t,e)=>(bs(s,typeof t!="symbol"?t+"":t,e),e);class xs extends kt{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,Er(this,"curves",[]),Er(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,i=[new S(t-r,e-n),new S(t+r,e-n),new S(t+r,e+n),new S(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new ke(i[o].clone(),i[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class _s extends kt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new S){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],u=r[i>r.length-3?r.length-1:i+2];return e.set(Sr(o,a.x,h.x,l.x,u.x),Sr(o,a.y,h.y,l.y,u.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var Ss=Object.defineProperty,Ps=(s,t,e)=>t in s?Ss(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,te=(s,t,e)=>(Ps(s,typeof t!="symbol"?t+"":t,e),e);class ee extends kt{constructor(t){super(),te(this,"curves",[]),te(this,"startPoint"),te(this,"currentPoint",new S),te(this,"autoClose",!1),te(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return xr(t,this),this}addData(t){return this.addCommands(_r(t)),this}getPoint(t,e=new S){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}i++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let i=0,o=r.length;i<o;i++){const h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new ke(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new ke(this.currentPoint.clone(),new S(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new us(this.currentPoint.clone(),new S(t,e),new S(r,n),new S(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new ws(this.currentPoint.clone(),new S(t,e),new S(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,h=!0){const l=new ps(new S(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new xs(new S(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new _s([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new R(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Cs(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Ms=Object.defineProperty,Os=(s,t,e)=>t in s?Ms(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ge=(s,t,e)=>(Os(s,typeof t!="symbol"?t+"":t,e),e);class vt{constructor(t){Ge(this,"currentPath",new ee),Ge(this,"paths",[this.currentPath]),Ge(this,"style",{}),t&&(t instanceof vt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof vt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ee().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new ee().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return xr(t,this),this}addData(t){return this.addCommands(_r(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(r=>t(r))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=S.MAX,e=S.MIN,r=!0){if(this.forEachCurve(n=>n.getMinMax(t,e)),r){const n=this.strokeWidth/2;t.x-=n,t.y-=n,e.x+=n,e.y+=n}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new R(e.x,e.y,r.x-e.x,r.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[Cs(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.getData()}" style="${r}"></path>`}getSvgXml(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:r="#000",stroke:n="none"}=this.style;e&&jn(t,this.style),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:r,width:n,height:i}=this.getBoundingBox(),o=document.createElement("canvas");o.width=n*t,o.height=i*t,o.style.width=`${n}px`,o.style.height=`${i}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-r),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const Re="px",Ur=90,$r=["mm","cm","in","pt","pc","px"],ze={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 $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=$r.length;r<n;r++){const i=$r[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&Re!=="px"?e=ze.in[Re]/Ur:(e=ze[t][Re],e<0&&(e=ze[t].in*Ur)),e*Number.parseFloat(s)}const Ts=new mt,ve=new mt,Dr=new mt,Lr=new mt;function As(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Is(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Is(s){const t=new mt,e=Ts;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const h=i.slice(0,o),l=Mt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,p=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],p=l[2]),ve.makeTranslation(-c,-p),Dr.makeRotation(u),Lr.multiplyMatrices(Dr,ve),ve.makeTranslation(c,p),e.multiplyMatrices(ve,Lr)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Es(s){return new vt().addPath(new ee().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Us(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function $s(s){return new vt().addPath(new ee().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Ds(s){return new vt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Ls(s){const t=new vt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Bs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Fs(s){var r;const t=new vt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Bs,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ns=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ks(s){var r;const t=new vt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ns,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function Gs(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),i=$(s.getAttribute("width")),o=$(s.getAttribute("height")),a=1-.551915024494,h=new vt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function Ot(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,u){u===void 0&&(u=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),s.hasAttribute(h)&&(t[l]=u(s.getAttribute(h))),r[h]&&(t[l]=u(r[h])),s.style&&s.style[h]!==""&&(t[l]=u(s.style[h]))}function i(h){return Math.max(0,Math.min(1,$(h)))}function o(h){return Math.max(0,$(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>$(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function qe(s,t,e=[]){var u;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=Ot(s,t,i);break;case"style":Us(s,i);break;case"g":t=Ot(s,t,i);break;case"path":t=Ot(s,t,i),s.hasAttribute("d")&&(n=Ls(s));break;case"rect":t=Ot(s,t,i),n=Gs(s);break;case"polygon":t=Ot(s,t,i),n=Fs(s);break;case"polyline":t=Ot(s,t,i),n=ks(s);break;case"circle":t=Ot(s,t,i),n=Es(s);break;case"ellipse":t=Ot(s,t,i),n=$s(s);break;case"line":t=Ot(s,t,i),n=Ds(s);break;case"defs":r=!0;break;case"use":{t=Ot(s,t,i);const p=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=s.viewportElement)==null?void 0:u.getElementById(p);m?qe(m,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(s);break}const o=new mt,a=[],h=As(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,p=l.length;c<p;c++){const m=l[c];r&&m.nodeName!=="style"&&m.nodeName!=="defs"||qe(m,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Br="data:image/svg+xml;",Fr=`${Br}base64,`,Nr=`${Br}charset=utf8,`;function kr(s){if(typeof s=="string"){let t;return s.startsWith(Fr)?(s=s.substring(Fr.length,s.length),t=atob(s)):s.startsWith(Nr)?(s=s.substring(Nr.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Rs(s){return qe(kr(s),{})}const Gr=new mt,Rr=new mt;function Ve(s,t=!1){const{ctx:e,path:r,fontSize:n,clipRect:i}=s;e.save(),e.beginPath();const o=r.style;r.style={...o,fill:s.color??o.fill,stroke:s.textStrokeColor??o.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*n:o.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*n,shadowOffsetY:(s.shadowOffsetY??0)*n,shadowBlur:(s.shadowBlur??0)*n,shadowColor:s.shadowColor};const a=(s.offsetX??0)*n,h=(s.offsetY??0)*n,l=(s.skewX??0)/180*Math.PI,u=(s.skewY??0)/180*Math.PI;if(a||h||l||u){Gr.makeTranslation(a,h),Rr.set(1,Math.tan(l),0,Math.tan(u),1,0,0,0,1);const[c,p,m,g,w,f]=Gr.multiply(Rr).transpose().elements;e.transform(c,g,p,w,m,f)}if(i&&(e.rect(i.x,i.y,i.width,i.height),e.clip(),e.beginPath()),t&&r.style.strokeWidth){const c=r.style.strokeWidth/n+1,p=r.getBoundingBox();e.translate(p.left*(1-c)+p.width*(1-c)/2,p.top*(1-c)+p.height*(1-c)/2),e.scale(c,c);const m=r.clone();m.style.strokeWidth/=c*2,m.drawTo(e)}else r.drawTo(e);e.restore()}var ot=Uint8Array,yt=Uint16Array,We=Int32Array,be=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),He=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(s,t){for(var e=new yt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new We(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},qr=zr(be,2),Vr=qr.b,Xe=qr.r;Vr[28]=258,Xe[258]=28;for(var Wr=zr(xe,0),zs=Wr.b,Hr=Wr.r,je=new yt(32768),N=0;N<32768;++N){var Bt=(N&43690)>>1|(N&21845)<<1;Bt=(Bt&52428)>>2|(Bt&13107)<<2,Bt=(Bt&61680)>>4|(Bt&3855)<<4,je[N]=((Bt&65280)>>8|(Bt&255)<<8)>>1}for(var Tt=function(s,t,e){for(var r=s.length,n=0,i=new yt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new yt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new yt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],u=t-s[n],c=o[s[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[je[c]>>h]=l}else for(a=new yt(r),n=0;n<r;++n)s[n]&&(a[n]=je[o[s[n]-1]++]>>15-s[n]);return a},Ft=new ot(288),N=0;N<144;++N)Ft[N]=8;for(var N=144;N<256;++N)Ft[N]=9;for(var N=256;N<280;++N)Ft[N]=7;for(var N=280;N<288;++N)Ft[N]=8;for(var re=new ot(32),N=0;N<32;++N)re[N]=5;var qs=Tt(Ft,9,0),Vs=Tt(Ft,9,1),Ws=Tt(re,5,0),Hs=Tt(re,5,1),Ye=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},St=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},Ke=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ze=function(s){return(s+7)/8|0},Xr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},Xs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Pt=function(s,t,e){var r=new Error(t||Xs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Pt),!e)throw r;return r},js=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(It){var Et=e.length;if(It>Et){var Lt=new ot(Math.max(Et*2,It));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,p=t.b||0,m=t.l,g=t.d,w=t.m,f=t.n,P=n*8;do{if(!m){u=St(s,c,1);var _=St(s,c+1,3);if(c+=3,_)if(_==1)m=Vs,g=Hs,w=9,f=5;else if(_==2){var b=St(s,c,31)+257,A=St(s,c+10,15)+4,C=b+St(s,c+5,31)+1;c+=14;for(var M=new ot(C),L=new ot(19),X=0;X<A;++X)L[He[X]]=St(s,c+X*3,7);c+=A*3;for(var j=Ye(L),xt=(1<<j)-1,E=Tt(L,j,1),X=0;X<C;){var U=E[St(s,c,xt)];c+=U&15;var x=U>>4;if(x<16)M[X++]=x;else{var q=0,D=0;for(x==16?(D=3+St(s,c,3),c+=2,q=M[X-1]):x==17?(D=3+St(s,c,7),c+=3):x==18&&(D=11+St(s,c,127),c+=7);D--;)M[X++]=q}}var J=M.subarray(0,b),V=M.subarray(b);w=Ye(J),f=Ye(V),m=Tt(J,w,1),g=Tt(V,f,1)}else Pt(1);else{var x=Ze(c)+4,O=s[x-4]|s[x-3]<<8,v=x+O;if(v>n){h&&Pt(0);break}a&&l(p+O),e.set(s.subarray(x,v),p),t.b=p+=O,t.p=c=v*8,t.f=u;continue}if(c>P){h&&Pt(0);break}}a&&l(p+131072);for(var _t=(1<<w)-1,k=(1<<f)-1,Q=c;;Q=c){var q=m[Ke(s,c)&_t],B=q>>4;if(c+=q&15,c>P){h&&Pt(0);break}if(q||Pt(2),B<256)e[p++]=B;else if(B==256){Q=c,m=null;break}else{var G=B-254;if(B>264){var X=B-257,I=be[X];G=St(s,c,(1<<I)-1)+Vr[X],c+=I}var Y=g[Ke(s,c)&k],W=Y>>4;Y||Pt(3),c+=Y&15;var V=zs[W];if(W>3){var I=xe[W];V+=Ke(s,c)&(1<<I)-1,c+=I}if(c>P){h&&Pt(0);break}a&&l(p+131072);var tt=p+G;if(p<V){var Ht=i-V,Xt=Math.min(V,tt);for(Ht+p<0&&Pt(3);p<Xt;++p)e[p]=r[Ht+p]}for(;p<tt;++p)e[p]=e[p-V]}}t.l=m,t.p=Q,t.b=p,t.f=u,m&&(u=1,t.m=w,t.d=g,t.n=f)}while(!u);return p!=e.length&&o?Xr(e,0,p):e.subarray(0,p)},$t=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ne=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},Qe=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Zr,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(v,b){return v.f-b.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var p=i[0].s,r=1;r<n;++r)i[r].s>p&&(p=i[r].s);var m=new yt(p+1),g=Je(e[u-1],m,0);if(g>t){var r=0,w=0,f=g-t,P=1<<f;for(i.sort(function(b,A){return m[A.s]-m[b.s]||b.f-A.f});r<n;++r){var _=i[r].s;if(m[_]>t)w+=P-(1<<g-m[_]),m[_]=t;else break}for(w>>=f;w>0;){var x=i[r].s;m[x]<t?w-=1<<t-m[x]++-1:++r}for(;r>=0&&w;--r){var O=i[r].s;m[O]==t&&(--m[O],++w)}g=t}return{t:new ot(m),l:g}},Je=function(s,t,e){return s.s==-1?Math.max(Je(s.l,t,e+1),Je(s.r,t,e+1)):t[s.s]=e},jr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new yt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},se=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Yr=function(s,t,e){var r=e.length,n=Ze(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Kr=function(s,t,e,r,n,i,o,a,h,l,u){$t(t,u++,e),++n[256];for(var c=Qe(n,15),p=c.t,m=c.l,g=Qe(i,15),w=g.t,f=g.l,P=jr(p),_=P.c,x=P.n,O=jr(w),v=O.c,b=O.n,A=new yt(19),C=0;C<_.length;++C)++A[_[C]&31];for(var C=0;C<v.length;++C)++A[v[C]&31];for(var M=Qe(A,7),L=M.t,X=M.l,j=19;j>4&&!L[He[j-1]];--j);var xt=l+5<<3,E=se(n,Ft)+se(i,re)+o,U=se(n,p)+se(i,w)+o+14+3*j+se(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&xt<=E&&xt<=U)return Yr(t,u,s.subarray(h,h+l));var q,D,J,V;if($t(t,u,1+(U<E)),u+=2,U<E){q=Tt(p,m,0),D=p,J=Tt(w,f,0),V=w;var _t=Tt(L,X,0);$t(t,u,x-257),$t(t,u+5,b-1),$t(t,u+10,j-4),u+=14;for(var C=0;C<j;++C)$t(t,u+3*C,L[He[C]]);u+=3*j;for(var k=[_,v],Q=0;Q<2;++Q)for(var B=k[Q],C=0;C<B.length;++C){var G=B[C]&31;$t(t,u,_t[G]),u+=L[G],G>15&&($t(t,u,B[C]>>5&127),u+=B[C]>>12)}}else q=qs,D=Ft,J=Ws,V=re;for(var C=0;C<a;++C){var I=r[C];if(I>255){var G=I>>18&31;ne(t,u,q[G+257]),u+=D[G+257],G>7&&($t(t,u,I>>23&31),u+=be[G]);var Y=I&31;ne(t,u,J[Y]),u+=V[Y],Y>3&&(ne(t,u,I>>5&8191),u+=xe[Y])}else ne(t,u,q[I]),u+=D[I]}return ne(t,u,q[256]),u+D[256]},Ys=new We([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zr=new ot(0),Ks=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,u=(i.r||0)&7;if(t){u&&(h[0]=i.r>>3);for(var c=Ys[t-1],p=c>>13,m=c&8191,g=(1<<e)-1,w=i.p||new yt(32768),f=i.h||new yt(g+1),P=Math.ceil(e/3),_=2*P,x=function(Jt){return(s[Jt]^s[Jt+1]<<P^s[Jt+2]<<_)&g},O=new We(25e3),v=new yt(288),b=new yt(32),A=0,C=0,M=i.i||0,L=0,X=i.w||0,j=0;M+2<o;++M){var xt=x(M),E=M&32767,U=f[xt];if(w[E]=U,f[xt]=E,X<=M){var q=o-M;if((A>7e3||L>24576)&&(q>423||!l)){u=Kr(s,h,0,O,v,b,C,L,j,M-j,u),L=A=C=0,j=M;for(var D=0;D<286;++D)v[D]=0;for(var D=0;D<30;++D)b[D]=0}var J=2,V=0,_t=m,k=E-U&32767;if(q>2&&xt==x(M-k))for(var Q=Math.min(p,q)-1,B=Math.min(32767,M),G=Math.min(258,q);k<=B&&--_t&&E!=U;){if(s[M+J]==s[M+J-k]){for(var I=0;I<G&&s[M+I]==s[M+I-k];++I);if(I>J){if(J=I,V=k,I>Q)break;for(var Y=Math.min(k,I-2),W=0,D=0;D<Y;++D){var tt=M-k+D&32767,Ht=w[tt],Xt=tt-Ht&32767;Xt>W&&(W=Xt,U=tt)}}}E=U,U=w[E],k+=E-U&32767}if(V){O[L++]=268435456|Xe[J]<<18|Hr[V];var It=Xe[J]&31,Et=Hr[V]&31;C+=be[It]+xe[Et],++v[257+It],++b[Et],X=M+J,++A}else O[L++]=s[M],++v[s[M]]}}for(M=Math.max(M,X);M<o;++M)O[L++]=s[M],++v[s[M]];u=Kr(s,h,l,O,v,b,C,L,j,M-j,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=f,i.p=w,i.i=M,i.w=X)}else{for(var M=i.w||0;M<o+l;M+=65535){var Lt=M+65535;Lt>=o&&(h[u/8|0]=l,Lt=o),u=Yr(h,u+1,s.subarray(M,Lt))}i.i=o}return Xr(a,0,r+Ze(u)+n)},Qr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},Zs=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return Ks(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Jr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},Qs=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Qr();n.p(t.dictionary),Jr(s,2,n.d())}},Js=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Pt(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Pt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ti(s,t){t||(t={});var e=Qr();e.p(s);var r=Zs(s,t,t.dictionary?6:2,4);return Qs(r,t),Jr(r,r.length-4,e.d()),r}function ei(s,t){return js(s.subarray(Js(s,t),-4),{i:2},t,t)}var ri=typeof TextDecoder<"u"&&new TextDecoder,ni=0;try{ri.decode(Zr,{stream:!0}),ni=1}catch{}const si="modern-font";function ie(s,t){if(!s)throw new Error(`[${si}] ${t}`)}function ii(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function Gt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var tn=Object.defineProperty,oi=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&tn(t,e,n),n},ai=(s,t,e)=>(oi(s,t+"",e),e);const _e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(ii(t),e,r),this.littleEndian=n,ai(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=_e[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=_e[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var li=Object.defineProperty,hi=(s,t,e)=>t in s?li(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ci=(s,t,e)=>(hi(s,t+"",e),e);const en=new WeakMap;function y(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=en.get(n);o||(o={columns:[],byteLength:0},en.set(n,o));const a={...t,name:i,byteLength:e*_e[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class bt{constructor(t,e,r,n){ci(this,"view"),this.view=new rt(t,e,r,n)}}function ui(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Se(s){s=ui(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function fi(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function pi(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class Pe extends bt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var rn=Object.defineProperty,di=(s,t,e)=>t in s?rn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&rn(t,e,n),n},nn=(s,t,e)=>(di(s,typeof t!="symbol"?t+"":t,e),e);const ht=class Rn extends Pe{constructor(){super(...arguments),nn(this,"format","EmbeddedOpenType"),nn(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Se(n.fontFamily||""),o=i.length,a=Se(n.fontStyle||""),h=a.length,l=Se(n.version||""),u=l.length,c=Se(n.fullName||""),p=c.length,m=86+o+4+h+4+u+4+p+2+t.view.byteLength,g=new Rn(new ArrayBuffer(m),0,m,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(u),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(p),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let gi=ht;var mi=Object.defineProperty,Ce=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&mi(t,e,n),n};class Yt extends bt{constructor(t,e){super(t,e,16)}}Ce([y({type:"char",size:4})],Yt.prototype,"tag"),Ce([y("uint32")],Yt.prototype,"checkSum"),Ce([y("uint32")],Yt.prototype,"offset"),Ce([y("uint32")],Yt.prototype,"length");const tr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],yi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];var wi=Object.defineProperty,vi=(s,t,e)=>t in s?wi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,oe=(s,t,e)=>(vi(s,typeof t!="symbol"?t+"":t,e),e);class er{constructor(t){oe(this,"index"),oe(this,"name"),oe(this,"isComposite",!1),oe(this,"components",[]),oe(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const m=l[c];m.type==="M"?u.push({type:"M",x:t+m.x*a,y:e+-m.y*h}):m.type==="L"?u.push({type:"L",x:t+m.x*a,y:e+-m.y*h}):m.type==="Q"?u.push({type:"Q",x1:t+m.x1*a,y1:e+-m.y1*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="C"?u.push({type:"C",x1:t+m.x1*a,y1:e+-m.y1*h,x2:t+m.x2*a,y2:e+-m.y2*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="Z"&&u.push({type:"Z"})}return u}}class bi extends er{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,m,g;const w=[],f=[];let P=0,_=!1,x=!1,O=o,v=0,b=0;function A(E,U){w.push({type:"L",x:E,y:U})}function C(E,U,q,D,J,V){w.push({type:"C",x1:E,y1:U,x2:q,y2:D,x:J,y:V})}function M(E,U){x&&l!==2&&L(),x=!0,w.push({type:"M",x:E,y:U})}function L(){w.push({type:"Z"})}function X(E){w.push(...E)}function j(){f.length%2!==0&&!_&&(O=f.shift()+i),P+=f.length>>1,f.length=0,_=!0}function xt(E){let U,q,D,J,V,_t,k,Q,B,G,I,Y,W=0;for(;W<E.length;){let tt=E[W++];switch(tt){case 1:j();break;case 3:j();break;case 4:f.length>1&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),M(v,b);break;case 5:for(;f.length>0;)v+=f.shift(),b+=f.shift(),A(v,b);break;case 6:for(;f.length>0&&(v+=f.shift(),A(v,b),f.length!==0);)b+=f.shift(),A(v,b);break;case 7:for(;f.length>0&&(b+=f.shift(),A(v,b),f.length!==0);)v+=f.shift(),A(v,b);break;case 8:for(;f.length>0;)c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,p,m,g,v,b);break;case 10:V=f.pop()+h,_t=t.subrs[V],_t&&xt(_t);break;case 11:return;case 12:switch(tt=E[W],W+=1,tt){case 35:c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),b=Y+f.shift(),f.shift(),C(c,p,m,g,k,Q),C(B,G,I,Y,v,b);break;case 34:c=v+f.shift(),p=b,m=c+f.shift(),g=p+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=b,v=I+f.shift(),C(c,p,m,g,k,Q),C(B,G,I,Y,v,b);break;case 36:c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),C(c,p,m,g,k,Q),C(B,G,I,Y,v,b);break;case 37:c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),Math.abs(I-v)>Math.abs(Y-b)?v=I+f.shift():b=Y+f.shift(),C(c,p,m,g,k,Q),C(B,G,I,Y,v,b);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),f.length=0}break;case 14:if(f.length>=4){const Ht=tr[f.pop()],Xt=tr[f.pop()],It=f.pop(),Et=f.pop();if(Ht&&Xt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Ht),Jt=t.charset.indexOf(Xt);n.components.push({glyphIndex:Jt,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Et,dy:It}),X(r.get(Jt).pathCommands);const yr=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let wr=0;wr<yr.length;wr+=1){const Ut=yr[wr];Ut.type!=="Z"&&(Ut.x+=Et,Ut.y+=It),(Ut.type==="Q"||Ut.type==="C")&&(Ut.x1+=Et,Ut.y1+=It),Ut.type==="C"&&(Ut.x2+=Et,Ut.y2+=It)}X(yr)}}else f.length>0&&!_&&(O=f.shift()+i,_=!0);x&&l!==2&&(L(),x=!1);break;case 18:j();break;case 19:case 20:j(),W+=P+7>>3;break;case 21:f.length>2&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),v+=f.pop(),M(v,b);break;case 22:f.length>1&&!_&&(O=f.shift()+i,_=!0),v+=f.pop(),M(v,b);break;case 23:j();break;case 24:for(;f.length>2;)c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,p,m,g,v,b);v+=f.shift(),b+=f.shift(),A(v,b);break;case 25:for(;f.length>6;)v+=f.shift(),b+=f.shift(),A(v,b);c=v+f.shift(),p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,p,m,g,v,b);break;case 26:for(f.length%2&&(v+=f.shift());f.length>0;)c=v,p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m,b=g+f.shift(),C(c,p,m,g,v,b);break;case 27:for(f.length%2&&(b+=f.shift());f.length>0;)c=v+f.shift(),p=b,m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g,C(c,p,m,g,v,b);break;case 28:U=E[W],q=E[W+1],f.push((U<<24|q<<16)>>16),W+=2;break;case 29:V=f.pop()+a,_t=t.gsubrs[V],_t&&xt(_t);break;case 30:for(;f.length>0&&(c=v,p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,p,m,g,v,b),f.length!==0);)c=v+f.shift(),p=b,m=c+f.shift(),g=p+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,p,m,g,v,b);break;case 31:for(;f.length>0&&(c=v+f.shift(),p=b,m=c+f.shift(),g=p+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,p,m,g,v,b),f.length!==0);)c=v,p=b+f.shift(),m=c+f.shift(),g=p+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,p,m,g,v,b);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?f.push(tt-139):tt<251?(U=E[W],W+=1,f.push((tt-247)*256+U+108)):tt<255?(U=E[W],W+=1,f.push(-(tt-251)*256-U-108)):(U=E[W],q=E[W+1],D=E[W+2],J=E[W+3],W+=4,f.push((U<<24|q<<16|D<<8|J)/65536))}}}xt(e),this.pathCommands=w,_&&(this.advanceWidth=O)}}var xi=Object.defineProperty,_i=(s,t,e)=>t in s?xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Si=(s,t,e)=>(_i(s,t+"",e),e);class rr{constructor(t){this._sfnt=t,Si(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Pi extends rr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new bi({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var sn=Object.defineProperty,Ci=(s,t,e)=>t in s?sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,on=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&sn(t,e,n),n},Me=(s,t,e)=>(Ci(s,typeof t!="symbol"?t+"":t,e),e);class Oe extends bt{constructor(t,e,r,n){super(t,e,r,n),Me(this,"_offsets"),Me(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}on([y("uint16")],Oe.prototype,"count"),on([y("uint8")],Oe.prototype,"offsetSize");class Te extends Oe{constructor(){super(...arguments),Me(this,"_isString",!1)}}class an extends Oe{constructor(){super(...arguments),Me(this,"_isString",!0)}}const Mi=[".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"],Oi=[".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"],Ti=[".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"],Ai=[".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 Ae(s,t){return t<=390?Mi[t]:s[t-391]}var Ii=Object.defineProperty,Ei=(s,t,e)=>t in s?Ii(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ln=(s,t,e)=>(Ei(s,typeof t!="symbol"?t+"":t,e),e);function z(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class hn extends bt{constructor(){super(...arguments),ln(this,"_dict"),ln(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Ae(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ui=Object.defineProperty,nr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ui(t,e,n),n};class Ie extends hn{}nr([z(19)],Ie.prototype,"subrs"),nr([z(20)],Ie.prototype,"defaultWidthX"),nr([z(21)],Ie.prototype,"nominalWidthX");var $i=Object.defineProperty,Z=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&$i(t,e,n),n};class H extends hn{}Z([z(0,"string")],H.prototype,"version"),Z([z(1,"string")],H.prototype,"notice"),Z([z(1200,"string")],H.prototype,"copyright"),Z([z(2,"string")],H.prototype,"fullName"),Z([z(3,"string")],H.prototype,"familyName"),Z([z(4,"string")],H.prototype,"weight"),Z([z(1201)],H.prototype,"isFixedPitch"),Z([z(1202)],H.prototype,"italicAngle"),Z([z(1203,"number",-100)],H.prototype,"underlinePosition"),Z([z(1204,"number",50)],H.prototype,"underlineThickness"),Z([z(1205)],H.prototype,"paintType"),Z([z(1206,"number",2)],H.prototype,"charstringType"),Z([z(1207,"number[]",[.001,0,0,.001,0,0])],H.prototype,"fontMatrix"),Z([z(13)],H.prototype,"uniqueId"),Z([z(5,"number[]",[0,0,0,0])],H.prototype,"fontBBox"),Z([z(1208)],H.prototype,"strokeWidth"),Z([z(14)],H.prototype,"xuid"),Z([z(15)],H.prototype,"charset"),Z([z(16)],H.prototype,"encoding"),Z([z(17)],H.prototype,"charStrings"),Z([z(18,"number[]",[0,0])],H.prototype,"private");var Di=Object.defineProperty,Li=(s,t,e)=>t in s?Di(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,sr=(s,t,e)=>(Li(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{ae.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ae.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const cn=class ye{constructor(t){sr(this,"tables",new Map),sr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];o.call(this,u,e,r,n,i),u.advanceWidth&&(e+=u.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new ye(this.tableViews)}delete(t){const e=ye.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=ye.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ye.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};sr(cn,"tableDefinitions",new Map);let ae=cn;class ct extends bt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var un=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Fi=(s,t,e)=>t in s?un(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,le=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&un(t,e,n),n},ir=(s,t,e)=>(Fi(s,typeof t!="symbol"?t+"":t,e),e);d.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),ir(this,"_glyphs"),ir(this,"privateDict"),ir(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Pi(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new an(e,n),this.topDictIndex=new Te(e,this.nameIndex.endOffset),this.stringIndex=new an(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Te(e,this.stringIndex.endOffset),this.topDict=new H(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new Ie(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Te(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Te(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Oi:this.topDict.charset===1?this.charset=Ti:this.topDict.charset===2?this.charset=Ai:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=tr:this.topDict.encoding===1?this.encoding=yi:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(Ae(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(Ae(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(Ae(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let u=h;u<=h+l;u+=1)i[u]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},le([y("uint8")],d.Cff.prototype,"majorVersion",2),le([y("uint8")],d.Cff.prototype,"minorVersion",2),le([y("uint8")],d.Cff.prototype,"headerSize",2),le([y("uint8")],d.Cff.prototype,"offsetSize",2),d.Cff=le([nt("CFF ","cff")],d.Cff);var Ni=Object.defineProperty,Ee=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ni(t,e,n),n};const he=class zn extends bt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new zn;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ee([y("uint16")],he.prototype,"format"),Ee([y("uint16")],he.prototype,"length"),Ee([y("uint16")],he.prototype,"language"),Ee([y({type:"uint8",size:256})],he.prototype,"glyphIndexArray");let or=he;var ki=Object.defineProperty,ar=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ki(t,e,n),n};class ce extends bt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=i[u].entryCount;c<p;c++)if(i[u].idRangeOffset+c>=o.length?h=0:(h=o[i[u].idRangeOffset+c],h!==0&&(h=h+i[u].idDelta)),h!==0&&h<t){const m=(l<<8|c+i[u].firstCode)%65535;e.set(m,h)}}return e}}ar([y("uint16")],ce.prototype,"format"),ar([y("uint16")],ce.prototype,"length"),ar([y("uint16")],ce.prototype,"language");function fn(s){return s>32767?s-65536:s<-32767?s+65536:s}function lr(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:fn(i-o)}):(n.start=Number(o),n.startId=i,n.delta=fn(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var Gi=Object.defineProperty,Rt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Gi(t,e,n),n};const Nt=class qn extends bt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=lr(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new qn(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=i[l];u<=c;++u)if(o[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+o[l]/2+(u-n[l])-r,m=h[p];m!==0?t.set(u,(m+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Rt([y("uint16")],Nt.prototype,"format"),Rt([y("uint16")],Nt.prototype,"length"),Rt([y("uint16")],Nt.prototype,"language"),Rt([y("uint16")],Nt.prototype,"segCountX2"),Rt([y("uint16")],Nt.prototype,"searchRange"),Rt([y("uint16")],Nt.prototype,"entrySelector"),Rt([y("uint16")],Nt.prototype,"rangeShift");let hr=Nt;var Ri=Object.defineProperty,ue=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ri(t,e,n),n};class zt extends bt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}ue([y("uint16")],zt.prototype,"format"),ue([y("uint16")],zt.prototype,"length"),ue([y("uint16")],zt.prototype,"language"),ue([y("uint16")],zt.prototype,"firstCode"),ue([y("uint16")],zt.prototype,"entryCount");var zi=Object.defineProperty,fe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&zi(t,e,n),n};const Kt=class Vn extends bt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=lr(t),r=new Vn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};fe([y("uint16")],Kt.prototype,"format"),fe([y("uint16")],Kt.prototype,"reserved"),fe([y("uint32")],Kt.prototype,"length"),fe([y("uint32")],Kt.prototype,"language"),fe([y("uint32")],Kt.prototype,"nGroups");let cr=Kt;var qi=Object.defineProperty,ur=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&qi(t,e,n),n};class pe extends bt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}ur([y("uint16")],pe.prototype,"format"),ur([y("uint32")],pe.prototype,"length"),ur([y("uint32")],pe.prototype,"numVarSelectorRecords");var pn=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,Wi=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(s,t,e,r)=>{for(var n=r>1?void 0:r?Vi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&pn(t,e,n),n},dn=(s,t,e)=>(Wi(s,typeof t!="symbol"?t+"":t,e),e);d.Cmap=class extends ct{constructor(){super(...arguments),dn(this,"_unicodeToGlyphIndexMap"),dn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=hr.from(t),n=or.from(t),i=e?cr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new d.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return u.numberSubtables=l.length,u.view.seek(4),l.forEach(c=>{u.view.writeUint16(c.platformID),u.view.writeUint16(c.platformSpecificID),u.view.writeUint32(c.offset)}),u.view.writeBytes(r.view,o),u.view.writeBytes(n.view,a),i&&u.view.writeBytes(i.view,h),u}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new or(this.view.buffer,e.offset);break;case 2:n=new ce(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new hr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new zt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new cr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new pe(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,u,c;const t=this.readSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:h.view,n=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:l.view,i=(u=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:u.view,o=(c=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:c.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},fr([y("uint16")],d.Cmap.prototype,"version",2),fr([y("uint16")],d.Cmap.prototype,"numberSubtables",2),d.Cmap=fr([nt("cmap")],d.Cmap);class Hi extends er{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return ie(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ie(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;ie(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let m,g=0;for(;g<c;)if(m=t.view.readUint8(),p.push(m),g++,m&8&&g<c){const w=t.view.readUint8();for(let f=0;f<w;f++)p.push(m),g++}if(ie(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let f;if(c>0){for(let x=0;x<c;x+=1)m=p[x],f={},f.onCurve=!!(m&1),f.lastPointOfContour=a.includes(x),w.push(f);let P=0;for(let x=0;x<c;x+=1)m=p[x],f=w[x],f.x=this._parseGlyphCoordinate(t,m,P,2,16),P=f.x;let _=0;for(let x=0;x<c;x+=1)m=p[x],f=w[x],f.y=this._parseGlyphCoordinate(t,m,_,4,32),_=f.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{ie(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let p=l.points[h.matchedPoints[1]];const m={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],m)[0],m.dx=c.x-p.x,m.dy=c.y-p.y,u=this._transformPoints(l.points,m)}this.points=this.points.concat(u)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let u=l[l.length-1],c=l[0];u.onCurve?i.push({type:"M",x:u.x,y:u.y}):c.onCurve?i.push({type:"M",x:c.x,y:c.y}):i.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,m=l.length;p<m;++p)if(u=c,c=l[(p+1)%m],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let g=c;c.onCurve||(g={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Xi extends rr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new Hi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var gn=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Yi=(s,t,e)=>t in s?gn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ki=(s,t,e,r)=>{for(var n=r>1?void 0:r?ji(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&gn(t,e,n),n},Zi=(s,t,e)=>(Yi(s,t+"",e),e);const Zt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};d.Glyf=class extends ct{constructor(){super(...arguments),Zi(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new d.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Xi(this._sfnt))}},d.Glyf=Ki([nt("glyf")],d.Glyf);var Qi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,to=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ji(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Qi(t,e,n),n};d.Gpos=class extends ct{},d.Gpos=to([nt("GPOS","gpos")],d.Gpos);var eo=Object.defineProperty,ro=Object.getOwnPropertyDescriptor,qt=(s,t,e,r)=>{for(var n=r>1?void 0:r?ro(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&eo(t,e,n),n};d.Gsub=class extends ct{},qt([y("uint16")],d.Gsub.prototype,"majorVersion",2),qt([y("uint16")],d.Gsub.prototype,"minorVersion",2),qt([y("uint16")],d.Gsub.prototype,"scriptListOffset",2),qt([y("uint16")],d.Gsub.prototype,"featureListOffset",2),qt([y("uint16")],d.Gsub.prototype,"lookupListOffset",2),qt([y("uint16")],d.Gsub.prototype,"featureVariationsOffset",2),d.Gsub=qt([nt("GSUB","gsub")],d.Gsub);var no=Object.defineProperty,so=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?so(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&no(t,e,n),n};d.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],d.Head.prototype,"version",2),et([y("fixed")],d.Head.prototype,"fontRevision",2),et([y("uint32")],d.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],d.Head.prototype,"magickNumber",2),et([y("uint16")],d.Head.prototype,"flags",2),et([y("uint16")],d.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],d.Head.prototype,"created",2),et([y({type:"longDateTime"})],d.Head.prototype,"modified",2),et([y("int16")],d.Head.prototype,"xMin",2),et([y("int16")],d.Head.prototype,"yMin",2),et([y("int16")],d.Head.prototype,"xMax",2),et([y("int16")],d.Head.prototype,"yMax",2),et([y("uint16")],d.Head.prototype,"macStyle",2),et([y("uint16")],d.Head.prototype,"lowestRecPPEM",2),et([y("int16")],d.Head.prototype,"fontDirectionHint",2),et([y("int16")],d.Head.prototype,"indexToLocFormat",2),et([y("int16")],d.Head.prototype,"glyphDataFormat",2),d.Head=et([nt("head")],d.Head);var io=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?oo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&io(t,e,n),n};d.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],d.Hhea.prototype,"version",2),pt([y("int16")],d.Hhea.prototype,"ascent",2),pt([y("int16")],d.Hhea.prototype,"descent",2),pt([y("int16")],d.Hhea.prototype,"lineGap",2),pt([y("uint16")],d.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],d.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],d.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],d.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],d.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],d.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],d.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],d.Hhea.prototype,"reserved",2),pt([y("int16")],d.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],d.Hhea.prototype,"numOfLongHorMetrics",2),d.Hhea=pt([nt("hhea")],d.Hhea);var mn=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,lo=(s,t,e)=>t in s?mn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ho=(s,t,e,r)=>{for(var n=r>1?void 0:r?ao(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&mn(t,e,n),n},co=(s,t,e)=>(lo(s,t+"",e),e);d.Hmtx=class extends ct{constructor(){super(...arguments),co(this,"_metrics")}static from(t){const e=t.length*4,r=new d.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},d.Hmtx=ho([nt("hmtx")],d.Hmtx);var uo=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,po=(s,t,e,r)=>{for(var n=r>1?void 0:r?fo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&uo(t,e,n),n};d.Kern=class extends ct{},d.Kern=po([nt("kern","kern")],d.Kern);var yn=Object.defineProperty,go=Object.getOwnPropertyDescriptor,mo=(s,t,e)=>t in s?yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yo=(s,t,e,r)=>{for(var n=r>1?void 0:r?go(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&yn(t,e,n),n},wo=(s,t,e)=>(mo(s,t+"",e),e);d.Loca=class extends ct{constructor(){super(...arguments),wo(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new d.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},d.Loca=yo([nt("loca")],d.Loca);var vo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?bo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&vo(t,e,n),n};d.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],d.Maxp.prototype,"version",2),ut([y("uint16")],d.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],d.Maxp.prototype,"maxPoints",2),ut([y("uint16")],d.Maxp.prototype,"maxContours",2),ut([y("uint16")],d.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],d.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],d.Maxp.prototype,"maxZones",2),ut([y("uint16")],d.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],d.Maxp.prototype,"maxStorage",2),ut([y("uint16")],d.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],d.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],d.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],d.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],d.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],d.Maxp.prototype,"maxComponentDepth",2),d.Maxp=ut([nt("maxp")],d.Maxp);var wn=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,_o=(s,t,e)=>t in s?wn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ue=(s,t,e,r)=>{for(var n=r>1?void 0:r?xo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&wn(t,e,n),n},So=(s,t,e)=>(_o(s,t+"",e),e);const vn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},pr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Po={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},bn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};d.Name=class extends ct{constructor(){super(...arguments),So(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=pr.Macintosh,i=Po.Default,o=0;e.some(h=>h.platform===pr.Microsoft&&h.encoding===bn.UCS2&&h.language===1033)&&(n=pr.Microsoft,i=bn.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&vn[l.nameId]&&(a[vn[l.nameId]]=o===0?fi(l.name):pi(l.name))}return a}},Ue([y("uint16")],d.Name.prototype,"format",2),Ue([y("uint16")],d.Name.prototype,"count",2),Ue([y("uint16")],d.Name.prototype,"stringOffset",2),d.Name=Ue([nt("name")],d.Name);var Co=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,T=(s,t,e,r)=>{for(var n=r>1?void 0:r?Mo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Co(t,e,n),n};d.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},T([y("uint16")],d.Os2.prototype,"version",2),T([y("int16")],d.Os2.prototype,"xAvgCharWidth",2),T([y("uint16")],d.Os2.prototype,"usWeightClass",2),T([y("uint16")],d.Os2.prototype,"usWidthClass",2),T([y("uint16")],d.Os2.prototype,"fsType",2),T([y("uint16")],d.Os2.prototype,"ySubscriptXSize",2),T([y("uint16")],d.Os2.prototype,"ySubscriptYSize",2),T([y("uint16")],d.Os2.prototype,"ySubscriptXOffset",2),T([y("uint16")],d.Os2.prototype,"ySubscriptYOffset",2),T([y("uint16")],d.Os2.prototype,"ySuperscriptXSize",2),T([y("uint16")],d.Os2.prototype,"ySuperscriptYSize",2),T([y("uint16")],d.Os2.prototype,"ySuperscriptXOffset",2),T([y("uint16")],d.Os2.prototype,"ySuperscriptYOffset",2),T([y("uint16")],d.Os2.prototype,"yStrikeoutSize",2),T([y("uint16")],d.Os2.prototype,"yStrikeoutPosition",2),T([y("uint16")],d.Os2.prototype,"sFamilyClass",2),T([y({type:"uint8"})],d.Os2.prototype,"bFamilyType",2),T([y({type:"uint8"})],d.Os2.prototype,"bSerifStyle",2),T([y({type:"uint8"})],d.Os2.prototype,"bWeight",2),T([y({type:"uint8"})],d.Os2.prototype,"bProportion",2),T([y({type:"uint8"})],d.Os2.prototype,"bContrast",2),T([y({type:"uint8"})],d.Os2.prototype,"bStrokeVariation",2),T([y({type:"uint8"})],d.Os2.prototype,"bArmStyle",2),T([y({type:"uint8"})],d.Os2.prototype,"bLetterform",2),T([y({type:"uint8"})],d.Os2.prototype,"bMidline",2),T([y({type:"uint8"})],d.Os2.prototype,"bXHeight",2),T([y({type:"uint8",size:16})],d.Os2.prototype,"ulUnicodeRange",2),T([y({type:"char",size:4})],d.Os2.prototype,"achVendID",2),T([y("uint16")],d.Os2.prototype,"fsSelection",2),T([y("uint16")],d.Os2.prototype,"usFirstCharIndex",2),T([y("uint16")],d.Os2.prototype,"usLastCharIndex",2),T([y("int16")],d.Os2.prototype,"sTypoAscender",2),T([y("int16")],d.Os2.prototype,"sTypoDescender",2),T([y("int16")],d.Os2.prototype,"sTypoLineGap",2),T([y("uint16")],d.Os2.prototype,"usWinAscent",2),T([y("uint16")],d.Os2.prototype,"usWinDescent",2),T([y({offset:72,type:"uint8",size:8})],d.Os2.prototype,"ulCodePageRange",2),T([y({offset:72,type:"int16"})],d.Os2.prototype,"sxHeight",2),T([y("int16")],d.Os2.prototype,"sCapHeight",2),T([y("uint16")],d.Os2.prototype,"usDefaultChar",2),T([y("uint16")],d.Os2.prototype,"usBreakChar",2),T([y("uint16")],d.Os2.prototype,"usMaxContext",2),d.Os2=T([nt("OS/2","os2")],d.Os2);var Oo=Object.defineProperty,To=Object.getOwnPropertyDescriptor,At=(s,t,e,r)=>{for(var n=r>1?void 0:r?To(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Oo(t,e,n),n};d.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},At([y("fixed")],d.Post.prototype,"format",2),At([y("fixed")],d.Post.prototype,"italicAngle",2),At([y("int16")],d.Post.prototype,"underlinePosition",2),At([y("int16")],d.Post.prototype,"underlineThickness",2),At([y("uint32")],d.Post.prototype,"isFixedPitch",2),At([y("uint32")],d.Post.prototype,"minMemType42",2),At([y("uint32")],d.Post.prototype,"maxMemType42",2),At([y("uint32")],d.Post.prototype,"minMemType1",2),At([y("uint32")],d.Post.prototype,"maxMemType1",2),d.Post=At([nt("post")],d.Post);var Ao=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Io(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ao(t,e,n),n};d.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],d.Vhea.prototype,"version",2),dt([y("int16")],d.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],d.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],d.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],d.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],d.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],d.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],d.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],d.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],d.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],d.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],d.Vhea.prototype,"reserved",2),dt([y("int16")],d.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],d.Vhea.prototype,"numOfLongVerMetrics",2),d.Vhea=dt([nt("vhea")],d.Vhea);var xn=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,Uo=(s,t,e)=>t in s?xn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$o=(s,t,e,r)=>{for(var n=r>1?void 0:r?Eo(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&xn(t,e,n),n},Do=(s,t,e)=>(Uo(s,t+"",e),e);d.Vmtx=class extends ct{constructor(){super(...arguments),Do(this,"_metrics")}static from(t){const e=t.length*4,r=new d.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},d.Vmtx=$o([nt("vmtx")],d.Vmtx);var _n=Object.defineProperty,Lo=(s,t,e)=>t in s?_n(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&_n(t,e,n),n},$e=(s,t,e)=>(Lo(s,typeof t!="symbol"?t+"":t,e),e);class st extends Pe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,p)=>c+e(p.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,h=0;const l=i.getDirectories();t.tableViews.forEach((c,p)=>{const m=l[h++];m.tag=p,m.checkSum=this.checksum(c),m.offset=a,m.length=c.byteLength,i.view.writeBytes(c,a),a+=e(m.length)});const u=i.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Yt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ae(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(st,"signature",new Set([65536,1953658213,1954115633])),de([y("uint32")],st.prototype,"scalerType"),de([y("uint16")],st.prototype,"numTables"),de([y("uint16")],st.prototype,"searchRange"),de([y("uint16")],st.prototype,"entrySelector"),de([y("uint16")],st.prototype,"rangeShift");var Bo=Object.defineProperty,Fo=(s,t,e)=>t in s?Bo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,dr=(s,t,e)=>(Fo(s,typeof t!="symbol"?t+"":t,e),e);class De extends st{constructor(){super(...arguments),dr(this,"format","OpenType"),dr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}dr(De,"signature",new Set([1330926671]));var No=Object.defineProperty,ge=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&No(t,e,n),n};class Vt extends bt{constructor(t,e){super(t,e,20)}}ge([y({type:"char",size:4})],Vt.prototype,"tag"),ge([y("uint32")],Vt.prototype,"offset"),ge([y("uint32")],Vt.prototype,"compLength"),ge([y("uint32")],Vt.prototype,"origLength"),ge([y("uint32")],Vt.prototype,"origChecksum");var Sn=Object.defineProperty,ko=(s,t,e)=>t in s?Sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Sn(t,e,n),n},Le=(s,t,e)=>(ko(s,typeof t!="symbol"?t+"":t,e),e);const gt=class vr extends Pe{constructor(){super(...arguments),Le(this,"format","WOFF"),Le(this,"mimeType","font/woff"),Le(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":De.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const m=Gt(ti(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:m.byteLength<c.byteLength?m:c,rawView:c})});const i=n.length,o=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new vr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const p=u[l++];p.tag=c.tag,p.offset=h,p.compLength=c.view.byteLength,p.origChecksum=vr.checkSum(c.rawView),p.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Vt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ae(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(ei(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Le(gt,"signature",new Set([2001684038])),wt([y("uint32")],gt.prototype,"signature"),wt([y("uint32")],gt.prototype,"flavor"),wt([y("uint32")],gt.prototype,"length"),wt([y("uint16")],gt.prototype,"numTables"),wt([y("uint16")],gt.prototype,"reserved"),wt([y("uint32")],gt.prototype,"totalSfntSize"),wt([y("uint16")],gt.prototype,"majorVersion"),wt([y("uint16")],gt.prototype,"minorVersion"),wt([y("uint32")],gt.prototype,"metaOffset"),wt([y("uint32")],gt.prototype,"metaLength"),wt([y("uint32")],gt.prototype,"metaOrigLength"),wt([y("uint32")],gt.prototype,"privOffset"),wt([y("uint32")],gt.prototype,"privLength");let Dt=gt;function Pn(s){if(st.is(s))return new st(s);if(De.is(s))return new De(s);if(Dt.is(s))return new Dt(s)}var Go=Object.defineProperty,Ro=(s,t,e)=>t in s?Go(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,me=(s,t,e)=>(Ro(s,typeof t!="symbol"?t+"":t,e),e);const Cn=class Wn{constructor(){me(this,"fallbackFont"),me(this,"_loading",new Map),me(this,"_loaded",new Map),me(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Wn.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(u=>u.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((u,c)=>{u!==l&&(u.cancel(),this._loading.delete(c))}),l.when.then(u=>{const c={...t,font:en(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,u),i&&this.injectStyleTag(d,h))})),c}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw u}).finally(()=>{this._loading.delete(h)})}};de(rn,"defaultRequestInit",{cache:"force-cache"});let nn=rn;const sn=new nn;function on(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=i==null?void 0:i.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,f)=>w-f),d=new Map;c.forEach(w=>{const f=a.get(w)??0;let P=d.get(f);P||d.set(f,P=new Set),P.add(w)});const m=[],g=w=>{const f=l[w],P=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],x=h[w+1]??_,O={...f,...P,rawGlyphIndex:w,glyphIndex:m.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,x-_)};return m.push(O),O};return g(0),c.forEach(w=>g(a.get(w))),m.slice().forEach(w=>{const{view:f}=w;if(!f.byteLength||f.getInt16(0)>=0)return;let _=10,x;do{x=f.getUint16(_);const O=_+2,v=f.getUint16(O);_+=4,Kt.ARG_1_AND_2_ARE_WORDS&x?_+=4:_+=2,Kt.WE_HAVE_A_SCALE&x?_+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&x?_+=4:Kt.WE_HAVE_A_TWO_BY_TWO&x&&(_+=8);const b=g(v);f.setUint16(O,b.glyphIndex)}while(Kt.MORE_COMPONENTS&x)}),m}function an(s,t){const e=on(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=p.Loca.from([...e.map(d=>{const m=h;return h+=d.view.byteLength,m}),h],n.indexToLocFormat);const l=e.reduce((d,m,g)=>(m.unicodes.forEach(w=>d.set(w,g)),d),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(d=>d.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const c=new p.Post;return c.format=3,c.italicAngle=0,c.underlinePosition=0,c.underlineThickness=0,c.isFixedPitch=0,c.minMemType42=0,c.minMemType42=0,c.minMemType1=0,c.maxMemType1=r,s.post=c,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function Vi(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Dt)e=s.sfnt.clone(),r="woff";else{const i=kt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Dt.is(i))e=new Dt(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=an(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Dt.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Dt.from(n).view.buffer}}const Hi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Wi(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h,strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:d=0,shadowColor:m="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=Hi[o],s.miterLimit=a,h&&s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=d,s.shadowColor=m}class S{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new S(1/0,1/0)}static get MIN(){return new S(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new S(this.x,this.y)}}class z{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new z(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new S((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new z(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Xi=Object.defineProperty,ji=(s,t,e)=>t in s?Xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yi=(s,t,e)=>(ji(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){Yi(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=h,u[6]=r,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],d=r[2],m=r[5],g=r[8],w=n[0],f=n[3],P=n[6],_=n[1],x=n[4],O=n[7],v=n[2],b=n[5],A=n[8];return i[0]=o*w+a*_+h*v,i[3]=o*f+a*x+h*b,i[6]=o*P+a*O+h*A,i[1]=l*w+u*_+c*v,i[4]=l*f+u*x+c*b,i[7]=l*P+u*O+c*A,i[2]=d*w+m*_+g*v,i[5]=d*f+m*x+g*b,i[8]=d*P+m*O+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*o-a*l,d=a*h-u*i,m=l*i-o*h,g=e*c+r*d+n*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=d*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=m*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(lr.makeScale(t,e)),this}rotate(t){return this.premultiply(lr.makeRotation(-t)),this}translate(t,e){return this.premultiply(lr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const lr=new vt;function ln(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function Ki(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let d=t*t,m=e*e;const g=u*u,w=c*c,f=g/d+w/m;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,d=t*t,m=e*e}const P=d*w+m*g,_=(d*m-P)/P;let x=Math.sqrt(Math.max(0,_));n===i&&(x=-x);const O=x*t*c/e,v=-x*e*u/t,b=Math.cos(r)*O-Math.sin(r)*v+(o.x+a.x)/2,A=Math.sin(r)*O+Math.cos(r)*v+(o.y+a.y)/2,C=ln(1,0,(u-O)/t,(c-v)/e),M=ln((u-O)/t,(c-v)/e,(-u-O)/t,(-c-v)/e)%(Math.PI*2);s.ellipse(b,A,t,e,r,C,C+M,i===1)}function Zt(s,t){return s-(t-s)}function hn(s,t){const e=new S,r=new S;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Zt(e.x,r.x),Zt(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Zt(e.x,r.x),Zt(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Zt(e.x,r.x),h=Zt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),Ki(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Tt(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function d(f,P,_){const x=new SyntaxError(`Unexpected character "${f}" at index ${P}.`);throw x.partial=_,x}function m(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=s.length;for(let f=0;f<w;f++){if(g=s[f],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,m();continue}if(a===0){if(Z.WHITESPACE.test(g))continue;if(Z.DIGIT.test(g)||Z.SIGN.test(g)){a=1,l=g;continue}if(Z.POINT.test(g)){a=2,l=g;continue}Z.COMMA.test(g)&&(h&&d(g,f,c),h=!0)}if(a===1){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.POINT.test(g)){l+=g,a=2;continue}if(Z.EXP.test(g)){a=3;continue}Z.SIGN.test(g)&&l.length===1&&Z.SIGN.test(l[0])&&d(g,f,c)}if(a===2){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.EXP.test(g)){a=3;continue}Z.POINT.test(g)&&l[l.length-1]==="."&&d(g,f,c)}if(a===3){if(Z.DIGIT.test(g)){u+=g;continue}if(Z.SIGN.test(g)){if(u===""){u+=g;continue}u.length===1&&Z.SIGN.test(u)&&d(g,f,c)}}Z.WHITESPACE.test(g)?(m(),a=0,h=!1):Z.COMMA.test(g)?(m(),a=0,h=!0):Z.SIGN.test(g)?(m(),a=1,l=g):Z.POINT.test(g)?(m(),a=2,l=g):d(g,f,c)}return m(),c}function Zi(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function Qi(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${Zi(s[e])} `;return t}const Ji=/[a-df-z][^a-df-z]*/gi;function cn(s){const t=[],e=s.match(Ji);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let h;switch(o){case"m":case"M":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Tt(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Tt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Tt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Tt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Tt(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var to=Object.defineProperty,eo=(s,t,e)=>t in s?to(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,hr=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);class Vt{constructor(){hr(this,"arcLengthDivisions",200),hr(this,"_cacheArcLengths"),hr(this,"_needsUpdate",!1)}getPointAt(t,e=new S){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const u=r[n],d=r[n+1]-u,m=(o-u)/d;return(n+m)/(i-1)}getTangent(t,e=new S){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new z(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return Qi(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function un(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function ro(s,t){const e=1-s;return e*e*t}function no(s,t){return 2*(1-s)*s*t}function so(s,t){return s*s*t}function fn(s,t,e,r){return ro(s,t)+no(s,e)+so(s,r)}function io(s,t){const e=1-s;return e*e*e*t}function oo(s,t){const e=1-s;return 3*e*e*s*t}function ao(s,t){return 3*(1-s)*s*s*t}function lo(s,t){return s*s*s*t}function pn(s,t,e,r,n){return io(s,t)+oo(s,e)+ao(s,r)+lo(s,n)}class ho extends Vt{constructor(t=new S,e=new S,r=new S,n=new S){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new S){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(pn(t,r.x,n.x,i.x,o.x),pn(t,r.y,n.y,i.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=S.MAX,e=S.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((c,d)=>{for(const m of c)for(let g=0;g<=d;g++){const w=g/d-.5,f=Math.min(1,Math.max(0,m+w)),P=this.getPoint(f);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.y)}})(l,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{startControl:e,endControl:r,end:n}=this;return t.bezierCurveTo(e.x,e.y,r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const co=new vt,dn=new vt,gn=new vt,De=new S;class uo extends Vt{constructor(t=new S,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}getPoint(t,e=new S){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,d=h-this.center.y;a=c*l-d*u+this.center.x,h=c*u+d*l+this.center.y}return e.set(a,h)}getCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),d=Math.abs(n-i),m=d>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const f=n+Math.PI,P=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),_=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:P,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const f=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),P=l+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:m,sweepFlag:g,x:f,y:P}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}transform(t){return De.set(this.center.x,this.center.y),De.applyMatrix3(t),this.center.x=De.x,this.center.y=De.y,go(t)?fo(this,t):po(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=S.MAX,e=S.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),u=Math.sin(o),c=Math.sqrt(n*n*l*l+i*i*u*u),d=Math.sqrt(n*n*u*u+i*i*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-d),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+d),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function fo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new S(e*n,e*i),a=new S(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=dn.copy(u).invert(),g=gn.copy(c).transpose().multiply(c).elements,w=mo(g[0],g[1],g[4]),f=Math.sqrt(w.rt1),P=Math.sqrt(w.rt2);if(s.radiusX=1/f,s.radiusY=1/P,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=dn.set(f,0,0,0,P,0,0,0,1),O=gn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(O).multiply(u),b=A=>{const{x:C,y:M}=new S(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(M,C)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),mn(t)&&(s.clockwise=!s.clockwise)}}function po(s,t){const e=yn(t),r=wn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,mn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function mn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function go(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=yn(s),n=wn(s);return Math.abs(e/(r*n))>Number.EPSILON}function yn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function wn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function mo(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?i=l+u:i=l-u,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class cr extends Vt{constructor(t=new S,e=new S){super(),this.start=t,this.end=e}getPoint(t,e=new S){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new S){return this.getPoint(t,e)}getTangent(t,e=new S){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new S){return this.getTangent(t,e)}getNormal(t,e=new S){const{x:r,y:n}=this.getPoint(t).sub(this.start);return e.set(n,-r).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class yo extends Vt{constructor(t=new S,e=new S,r=new S){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new S){const{start:r,control:n,end:i}=this;return e.set(fn(t,r.x,n.x,i.x),fn(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=S.MAX,e=S.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{min:t,max:e}}getCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{control:e,end:r}=this;return t.quadraticCurveTo(e.x,e.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var wo=Object.defineProperty,vo=(s,t,e)=>t in s?wo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vn=(s,t,e)=>(vo(s,typeof t!="symbol"?t+"":t,e),e);class bo extends Vt{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,vn(this,"curves",[]),vn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,i=[new S(t-r,e-n),new S(t+r,e-n),new S(t+r,e+n),new S(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new cr(i[o].clone(),i[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class xo extends Vt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new S){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],u=r[i>r.length-3?r.length-1:i+2];return e.set(un(o,a.x,h.x,l.x,u.x),un(o,a.y,h.y,l.y,u.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var _o=Object.defineProperty,So=(s,t,e)=>t in s?_o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e)=>(So(s,typeof t!="symbol"?t+"":t,e),e);class me extends Vt{constructor(t){super(),ge(this,"curves",[]),ge(this,"startPoint"),ge(this,"currentPoint",new S),ge(this,"autoClose",!1),ge(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return hn(t,this),this}addData(t){return this.addCommands(cn(t)),this}getPoint(t,e=new S){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}i++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let i=0,o=r.length;i<o;i++){const h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new cr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new cr(this.currentPoint.clone(),new S(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new ho(this.currentPoint.clone(),new S(t,e),new S(r,n),new S(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new yo(this.currentPoint.clone(),new S(t,e),new S(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,h=!0){const l=new uo(new S(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new bo(new S(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new xo([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new z(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Po(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Co=Object.defineProperty,Mo=(s,t,e)=>t in s?Co(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ur=(s,t,e)=>(Mo(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){ur(this,"currentPath",new me),ur(this,"paths",[this.currentPath]),ur(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new me().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new me().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return hn(t,this),this}addData(t){return this.addCommands(cn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(r=>t(r))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=S.MAX,e=S.MIN,r=!0){if(this.forEachCurve(n=>n.getMinMax(t,e)),r){const n=this.strokeWidth/2;t.x-=n,t.y-=n,e.x+=n,e.y+=n}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new z(e.x,e.y,r.x-e.x,r.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[Po(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.getData()}" style="${r}"></path>`}getSvgXml(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e=!0){const{fill:r="#000",stroke:n="none"}=this.style;e&&Wi(t,this.style),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:r,width:n,height:i}=this.getBoundingBox(),o=document.createElement("canvas");o.width=n*t,o.height=i*t,o.style.width=`${n}px`,o.style.height=`${i}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-r),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const fr="px",bn=90,xn=["mm","cm","in","pt","pc","px"],pr={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 $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=xn.length;r<n;r++){const i=xn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&fr!=="px"?e=pr.in[fr]/bn:(e=pr[t][fr],e<0&&(e=pr[t].in*bn)),e*Number.parseFloat(s)}const Oo=new vt,Le=new vt,_n=new vt,Sn=new vt;function To(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ao(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ao(s){const t=new vt,e=Oo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const h=i.slice(0,o),l=Tt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,d=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],d=l[2]),Le.makeTranslation(-c,-d),_n.makeRotation(u),Sn.multiplyMatrices(_n,Le),Le.makeTranslation(c,d),e.multiplyMatrices(Le,Sn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Io(s){return new bt().addPath(new me().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Eo(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Uo(s){return new bt().addPath(new me().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function $o(s){return new bt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Do(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Lo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Bo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Lo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Fo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function No(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Fo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ko(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),i=$(s.getAttribute("width")),o=$(s.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,u){u===void 0&&(u=function(d){return d.startsWith("url")&&console.warn("url access in attributes is not implemented."),d}),s.hasAttribute(h)&&(t[l]=u(s.getAttribute(h))),r[h]&&(t[l]=u(r[h])),s.style&&s.style[h]!==""&&(t[l]=u(s.style[h]))}function i(h){return Math.max(0,Math.min(1,$(h)))}function o(h){return Math.max(0,$(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>$(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",$),n("visibility","visibility"),t}function dr(s,t,e=[]){var u;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=At(s,t,i);break;case"style":Eo(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=Do(s));break;case"rect":t=At(s,t,i),n=ko(s);break;case"polygon":t=At(s,t,i),n=Bo(s);break;case"polyline":t=At(s,t,i),n=No(s);break;case"circle":t=At(s,t,i),n=Io(s);break;case"ellipse":t=At(s,t,i),n=Uo(s);break;case"line":t=At(s,t,i),n=$o(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=s.viewportElement)==null?void 0:u.getElementById(d);m?dr(m,t,e):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}const o=new vt,a=[],h=To(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,d=l.length;c<d;c++){const m=l[c];r&&m.nodeName!=="style"&&m.nodeName!=="defs"||dr(m,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Pn="data:image/svg+xml;",Cn=`${Pn}base64,`,Mn=`${Pn}charset=utf8,`;function On(s){if(typeof s=="string"){let t;return s.startsWith(Cn)?(s=s.substring(Cn.length,s.length),t=atob(s)):s.startsWith(Mn)?(s=s.substring(Mn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Go(s){return dr(On(s),{})}function Be(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Tn(s,t){const{x:e,y:r}=s,n=Math.sin(t),i=Math.cos(t);return{x:e*i-r*n,y:e*n+r*i}}function gr(s,t,e,r){const n=s.x-t.x,i=s.y-t.y;return{x:t.x+(n+Math.tan(e)*i),y:t.y+(i+Math.tan(r)*n)}}function An(s,t,e,r){const n=e<0?t.x-s.x+t.x:s.x,i=r<0?t.y-s.y+t.y:s.y;return{x:n*Math.abs(e),y:i*Math.abs(r)}}function In(s,t,e=0,r=0,n=0,i=1,o=1){let a=Array.isArray(s)?s:[s];const h=-e/180*Math.PI,{x:l,y:u}=t;return(i!==1||o!==1)&&(a=a.map(c=>An(c,t,i,o))),(r||n)&&(a=a.map(c=>gr(c,t,r,n))),a=a.map(c=>{const d=c.x-l,m=-(c.y-u);return c=Tn({x:d,y:m},h),{x:l+c.x,y:u-c.y}}),a[0]}const Ro=new Set(["©","®","÷"]),zo=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class En{constructor(t,e,r){F(this,"boundingBox",new z);F(this,"textWidth",0);F(this,"textHeight",0);F(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=sn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Dt||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l,isVertical:u}=this,{left:c,top:d,height:m}=l,{fontSize:g}=h,w=e/g,f=t.getAdvanceWidth(a,g),P=(r+Math.abs(n))/w,_=r/w,x=(r-i.yStrikeoutPosition)/w,O=i.yStrikeoutSize/w,v=(r-o.underlinePosition)/w,b=o.underlineThickness/w;return this.glyphWidth=f,this.glyphHeight=P,this.underlinePosition=v,this.underlineThickness=b,this.yStrikeoutPosition=x,this.yStrikeoutSize=O,this.baseline=_,this.centerDiviation=.5*m-_,this.glyphBox=u?new z(c,d,P,f):new z(c,d,f,P),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:u}=this.updateGlyph(t),{os2:c,ascender:d,descender:m}=t,g=d,w=m,f=c.sTypoAscender,{left:P,top:_}=o,{fontSize:x,fontStyle:O}=a;let v=P,b=_+h,A,C;if(e&&(v+=(l-u)/2,Math.abs(n-i)>.1&&(b-=(g-f)/(g+Math.abs(w))*l),A=void 0),e&&!Ro.has(r)&&(r.codePointAt(0)<=256||zo.has(r))){C=t.getPathCommands(r,v,_+h-(l-u)/2,x)??[];const L={y:_-(l-u)/2+l/2,x:v+u/2};O==="italic"&&(C=this._italic(C,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),C=this._rotation90(C,L)}else A!==void 0?(C=t.glyphs.get(A).getPathCommands(v,b,x),O==="italic"&&(C=this._italic(C,e?{x:v+u/2,y:_+f/(g+Math.abs(w))*l}:void 0))):(C=t.getPathCommands(r,v,b,x)??[],O==="italic"&&(C=this._italic(C,e?{x:v+l/2,y:b}:void 0)));C.push(...this._decoration());const M=new bt(C);return M.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=M,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,u=.1*i;let c;switch(n){case"underline":t?c=o:c=a+e;break;case"line-through":t?c=o+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:o,y:c},{type:"L",x:o+h,y:c},{type:"L",x:o+h,y:c+u},{type:"L",x:o,y:c+u},{type:"Z"}]}_italic(t,e){const{baseline:r,glyphWidth:n}=this,{left:i,top:o}=this.boundingBox,a=e||{y:o+r,x:i+n/2};return this._transform(t,(h,l)=>{const u=gr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=In({x:r,y:n},e,90);return[i.x,i.y]})}_transform(t,e){return t.map(r=>{const n={...r};switch(n.type){case"L":case"M":[n.x,n.y]=e(n.x,n.y);break;case"Q":[n.x1,n.y1]=e(n.x1,n.y1),[n.x,n.y]=e(n.x,n.y);break;case"C":[n.x1,n.y1]=e(n.x1,n.y1),[n.x2,n.y2]=e(n.x2,n.y2),[n.x,n.y]=e(n.x,n.y);break}return n})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Fe({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Un{constructor(t,e={},r){F(this,"boundingBox",new z);F(this,"highlight");this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Be(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new En(r,e++,this));return this.characters=t,this}}class Qt{constructor(t,e){F(this,"boundingBox",new z);F(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Be(this.parentStyle),...Be(this.style)},this}addFragment(t,e){const r=new Un(t,e,this);return this.fragments.push(r),r}}class Ht{constructor(t){this._text=t}}class $n extends Ht{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class Dn extends Ht{getBoundingBox(){const{characters:t,effects:e}=this._text,r=[];return t.forEach(n=>{const i=n.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*i,h=(o.offsetY??0)*i,l=(o.shadowOffsetX??0)*i,u=(o.shadowOffsetY??0)*i,c=Math.max(.1,o.textStrokeWidth??0)*i,d=n.boundingBox.clone();d.left+=a+l-c,d.top+=h+u-c,d.width+=c*2,d.height+=c*2,r.push(d)})}),z.from(...r)}draw(t){const{ctx:e}=t,{effects:r,characters:n,boundingBox:i}=this._text;return r&&(r.forEach(o=>{Ct(o,i,e)}),n.forEach(o=>{r.forEach(a=>{o.drawTo(e,a)})})),this}}class Ln extends Ht{constructor(){super(...arguments);F(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new z;const e=S.MAX,r=S.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new z(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(){const{characters:e}=this._text;let r;const n=[];let i;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((i==null?void 0:i.url)===a.url&&r.length&&r[0].boundingBox.top===o.boundingBox.top&&r[0].fontSize===o.fontSize?r.push(o):(r=[],r.push(o),n.push(r))),i=a}),this.paths=n.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:z.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const r=On(e),n=Go(r),i=S.MAX,o=S.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new z(i.x,i.y,o.x-i.x,o.y-i.y),viewBox:new z(...r.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:r,box:n,baseline:i,fontSize:o}=e,{box:a,viewBox:h,paths:l}=this._parseSvg(r),u=h.top+h.height/2,c=[],d=u>a.top?0:1;function m(g,w){g.style.strokeWidth&&(g.style.strokeWidth*=w),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=w),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=w),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(f=>f*w))}if(d===0){const g={x:n.left-o*.2,y:n.top},w=(n.width+o*.2*2)/a.width,f=n.height/a.height,P=new vt().translate(-a.x,-a.y).scale(w,f).translate(g.x,g.y);l.forEach(_=>{const x=_.clone().transform(P);m(x,w),c.push({path:x})})}else if(d===1){const g=o/a.width,w=a.width*g,f=Math.ceil(n.width/w),P={x:n.left,y:n.top+i+o*.1},_=new vt().translate(-a.x,-a.y).scale(g,g).translate(P.x,P.y);for(let x=0;x<f;x++){const O=_.clone().translate(x*w,0);l.forEach(v=>{const b=v.clone().transform(O);m(b,g),c.push({clipRect:n,path:b})})}}return c}draw({ctx:e}){return this.paths.forEach(r=>{Fe({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class Bn extends Ht{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll("span").forEach((h,l)=>{var d;const u=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const m=document.createRange();m.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){m.setStart(c,Math.max(w-1,0)),m.setEnd(c,w);const f=((d=m.getClientRects)==null?void 0:d.call(m))??[m.getBoundingClientRect()];let P=f[f.length-1];f.length>1&&P.width<2&&(P=f[f.length-2]);const _=m.toString();_!==""&&P&&P.width+P.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:P.top,left:P.left,height:P.height,width:P.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((m,g)=>{const w=i?"left":"top";return Math.abs(g[w]-m[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(m=>{const g=e[m.paragraphIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height}),u.fragments.forEach(m=>{const g=e[m.paragraphIndex].fragments[m.fragmentIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height});const c=[];let d=0;return a.forEach(m=>{m.forEach(g=>{const w=u.characters[d],{paragraphIndex:f,fragmentIndex:P,characterIndex:_}=w;c.push({...w,newParagraphIndex:f,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[f].fragments[P].characters[_];x.boundingBox.left=c[d].left,x.boundingBox.top=c[d].top,x.boundingBox.width=c[d].width,x.boundingBox.height=c[d].height,x.textWidth=c[d].textWidth,x.textHeight=c[d].textHeight,d++})}),{paragraphs:e,boundingBox:new z(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Fn extends Ht{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new Qt({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new Qt({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new Qt({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,highlight:h,...l}=o;if(a!==void 0){const u=i.addFragment(a,l);u.highlight=h}}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new Qt(o,e);i.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const d=a.addFragment(l,c);d.highlight=u}}),r.push(a)}else if("content"in n){const{content:i,highlight:o,...a}=n;if(i!==void 0){const h=new Qt(a,e),l=h.addFragment(i);l.highlight=o,r.push(h)}}}return r}}class qo extends Ht{}class Nn extends Ht{setupView(t){const{ctx:e,pixelRatio:r}=t,{renderBoundingBox:n}=this._text,{left:i,top:o,width:a,height:h}=n,l=e.canvas;return l.dataset.viewbox=`${i} ${o} ${a} ${h}`,l.dataset.pixelRatio=String(r),l.width=Math.max(1,Math.ceil(a*r)),l.height=Math.max(1,Math.ceil(h*r)),l.style.marginTop=`${o}px`,l.style.marginLeft=`${i}px`,l.style.width=`${a}px`,l.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(r,r),e.translate(-i,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:r,computedStyle:n,renderBoundingBox:i}=this._text,{width:o,height:a}=i;return Ct(n,new z(0,0,o,a),e),r.forEach(h=>{Ct(h.computedStyle,h.boundingBox,e),h.fragments.forEach(l=>{Ct(l.computedStyle,l.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:r,paragraphs:n}=this._text;function i(o,a,h,l,u){e.fillStyle=o,e.fillRect(a,h,l,u)}return r!=null&&r.backgroundColor&&i(r.backgroundColor,0,0,e.canvas.width,e.canvas.height),n.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&i(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&i(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:r}=this._text;return r.forEach(n=>{n.drawTo(e)}),this}}const mr={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class Vo{constructor(t={}){F(this,"content");F(this,"style");F(this,"effects");F(this,"deformation");F(this,"measureDom");F(this,"needsUpdate",!0);F(this,"computedStyle",{...mr});F(this,"paragraphs",[]);F(this,"boundingBox",new z);F(this,"renderBoundingBox",new z);F(this,"parser",new Fn(this));F(this,"measurer",new Bn(this));F(this,"deformer",new $n(this));F(this,"effector",new Dn(this));F(this,"highlighter",new Ln(this));F(this,"renderer2D",new Nn(this));const{content:e="",style:r={},effects:n,deformation:i,measureDom:o}=t;this.content=e,this.style=r,this.effects=n,this.deformation=i,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...mr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const n=S.MAX,i=S.MIN;return r.forEach(o=>o.getMinMax(n,i)),this.renderBoundingBox=new z(n.x,n.y,i.x-n.x,i.y-n.y),this}render(t){var i,o;const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),(i=this.effects)!=null&&i.length?this.renderBoundingBox=z.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=z.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:r,ctx:n}),this.renderer2D.uploadColors({ctx:n}),this.highlighter.draw({ctx:n}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:n}):this.renderer2D.draw({ctx:n}),this):this}}p.Character=En,p.CmapSubtableFormat0=Je,p.CmapSubtableFormat12=nr,p.CmapSubtableFormat14=ue,p.CmapSubtableFormat2=le,p.CmapSubtableFormat4=rr,p.CmapSubtableFormat6=Rt,p.Deformer=$n,p.Effector=Dn,p.Eot=ws,p.Font=_e,p.Fonts=nn,p.Fragment=Un,p.Glyph=je,p.GlyphSet=Ye,p.Highlighter=Ln,p.Measurer=Bn,p.Paragraph=Qt,p.Parser=Fn,p.Reflector=qo,p.Renderer2D=Nn,p.Sfnt=ie,p.TableDirectory=jt,p.Text=Vo,p.Ttf=st,p.Woff=Dt,p.WoffTableDirectoryEntry=qt,p.componentFlags=Kt,p.createCmapSegments=er,p.defaultTextStyles=mr,p.defineSfntTable=nt,p.drawPath=Fe,p.filterEmpty=Be,p.fonts=sn,p.getPointPosition=In,p.getRotationPoint=Tn,p.getScalePoint=An,p.getSkewPoint=gr,p.minify=Vi,p.minifyGlyphs=on,p.minifySfnt=an,p.parse=en,p.parseColor=it,p.uploadColor=Ct,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
4
+ }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(u=>u.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((u,c)=>{u!==l&&(u.cancel(),this._loading.delete(c))}),l.when.then(u=>{const c={...t,font:Pn(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,h),typeof document<"u"&&(n&&this.injectFontFace(p,u),i&&this.injectStyleTag(p,h))})),c}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw u}).finally(()=>{this._loading.delete(h)})}};me(Cn,"defaultRequestInit",{cache:"force-cache"});let Mn=Cn;const On=new Mn;function Tn(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=i==null?void 0:i.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,f)=>w-f),p=new Map;c.forEach(w=>{const f=a.get(w)??0;let P=p.get(f);P||p.set(f,P=new Set),P.add(w)});const m=[],g=w=>{const f=l[w],P=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],x=h[w+1]??_,O={...f,...P,rawGlyphIndex:w,glyphIndex:m.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,x-_)};return m.push(O),O};return g(0),c.forEach(w=>g(a.get(w))),m.slice().forEach(w=>{const{view:f}=w;if(!f.byteLength||f.getInt16(0)>=0)return;let _=10,x;do{x=f.getUint16(_);const O=_+2,v=f.getUint16(O);_+=4,Zt.ARG_1_AND_2_ARE_WORDS&x?_+=4:_+=2,Zt.WE_HAVE_A_SCALE&x?_+=2:Zt.WE_HAVE_AN_X_AND_Y_SCALE&x?_+=4:Zt.WE_HAVE_A_TWO_BY_TWO&x&&(_+=8);const b=g(v);f.setUint16(O,b.glyphIndex)}while(Zt.MORE_COMPONENTS&x)}),m}function An(s,t){const e=Tn(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=d.Loca.from([...e.map(p=>{const m=h;return h+=p.view.byteLength,m}),h],n.indexToLocFormat);const l=e.reduce((p,m,g)=>(m.unicodes.forEach(w=>p.set(w,g)),p),new Map);s.cmap=d.Cmap.from(l),s.glyf=d.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=r,s.hmtx=d.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=d.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const c=new d.Post;return c.format=3,c.italicAngle=0,c.underlinePosition=0,c.underlineThickness=0,c.isFixedPitch=0,c.minMemType42=0,c.minMemType42=0,c.minMemType1=0,c.maxMemType1=r,s.post=c,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function zo(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Dt)e=s.sfnt.clone(),r="woff";else{const i=Gt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Dt.is(i))e=new Dt(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=An(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Dt.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Dt.from(n).view.buffer}}function Be(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function In(s,t){const{x:e,y:r}=s,n=Math.sin(t),i=Math.cos(t);return{x:e*i-r*n,y:e*n+r*i}}function gr(s,t,e,r){const n=s.x-t.x,i=s.y-t.y;return{x:t.x+(n+Math.tan(e)*i),y:t.y+(i+Math.tan(r)*n)}}function En(s,t,e,r){const n=e<0?t.x-s.x+t.x:s.x,i=r<0?t.y-s.y+t.y:s.y;return{x:n*Math.abs(e),y:i*Math.abs(r)}}function Un(s,t,e=0,r=0,n=0,i=1,o=1){let a=Array.isArray(s)?s:[s];const h=-e/180*Math.PI,{x:l,y:u}=t;return(i!==1||o!==1)&&(a=a.map(c=>En(c,t,i,o))),(r||n)&&(a=a.map(c=>gr(c,t,r,n))),a=a.map(c=>{const p=c.x-l,m=-(c.y-u);return c=In({x:p,y:m},h),{x:l+c.x,y:u-c.y}}),a[0]}const qo=new Set(["©","®","÷"]),Vo=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class $n{constructor(t,e,r){F(this,"boundingBox",new R);F(this,"textWidth",0);F(this,"textHeight",0);F(this,"path",new vt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=On.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Dt||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l,isVertical:u}=this,{left:c,top:p,height:m}=l,{fontSize:g}=h,w=e/g,f=t.getAdvanceWidth(a,g),P=(r+Math.abs(n))/w,_=r/w,x=(r-i.yStrikeoutPosition)/w,O=i.yStrikeoutSize/w,v=(r-o.underlinePosition)/w,b=o.underlineThickness/w;return this.glyphWidth=f,this.glyphHeight=P,this.underlinePosition=v,this.underlineThickness=b,this.yStrikeoutPosition=x,this.yStrikeoutSize=O,this.baseline=_,this.centerDiviation=.5*m-_,this.glyphBox=u?new R(c,p,P,f):new R(c,p,f,P),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:u}=this.updateGlyph(t),{os2:c,ascender:p,descender:m}=t,g=p,w=m,f=c.sTypoAscender,{left:P,top:_}=o,{fontSize:x,fontStyle:O}=a;let v=P,b=_+h,A,C;if(e&&(v+=(l-u)/2,Math.abs(n-i)>.1&&(b-=(g-f)/(g+Math.abs(w))*l),A=void 0),e&&!qo.has(r)&&(r.codePointAt(0)<=256||Vo.has(r))){C=t.getPathCommands(r,v,_+h-(l-u)/2,x)??[];const L={y:_-(l-u)/2+l/2,x:v+u/2};O==="italic"&&(C=this._italic(C,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),C=this._rotation90(C,L)}else A!==void 0?(C=t.glyphs.get(A).getPathCommands(v,b,x),O==="italic"&&(C=this._italic(C,e?{x:v+u/2,y:_+f/(g+Math.abs(w))*l}:void 0))):(C=t.getPathCommands(r,v,b,x)??[],O==="italic"&&(C=this._italic(C,e?{x:v+l/2,y:b}:void 0)));C.push(...this._decoration());const M=new vt(C);return M.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=M,this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,u=.1*i;let c;switch(n){case"underline":t?c=o:c=a+e;break;case"line-through":t?c=o+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:o,y:c},{type:"L",x:o+h,y:c},{type:"L",x:o+h,y:c+u},{type:"L",x:o,y:c+u},{type:"Z"}]}_italic(t,e){const{baseline:r,glyphWidth:n}=this,{left:i,top:o}=this.boundingBox,a=e||{y:o+r,x:i+n/2};return this._transform(t,(h,l)=>{const u=gr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=Un({x:r,y:n},e,90);return[i.x,i.y]})}_transform(t,e){return t.map(r=>{const n={...r};switch(n.type){case"L":case"M":[n.x,n.y]=e(n.x,n.y);break;case"Q":[n.x1,n.y1]=e(n.x1,n.y1),[n.x,n.y]=e(n.x,n.y);break;case"C":[n.x1,n.y1]=e(n.x1,n.y1),[n.x2,n.y2]=e(n.x2,n.y2),[n.x,n.y]=e(n.x,n.y);break}return n})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Ve({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e},!0)}}class Dn{constructor(t,e={},r){F(this,"boundingBox",new R);F(this,"highlight");this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Be(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new $n(r,e++,this));return this.characters=t,this}}class Qt{constructor(t,e){F(this,"boundingBox",new R);F(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Be(this.parentStyle),...Be(this.style)},this}addFragment(t,e){const r=new Dn(t,e,this);return this.fragments.push(r),r}}class Wt{constructor(t){this._text=t}}class Ln extends Wt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class Bn extends Wt{getBoundingBox(){const{characters:t,effects:e}=this._text,r=[];return t.forEach(n=>{const i=n.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*i,h=(o.offsetY??0)*i,l=(o.shadowOffsetX??0)*i,u=(o.shadowOffsetY??0)*i,c=Math.max(.1,o.textStrokeWidth??0)*i,p=n.boundingBox.clone();p.left+=a+l-c,p.top+=h+u-c,p.width+=c*2,p.height+=c*2,r.push(p)})}),R.from(...r)}draw(t){const{ctx:e}=t,{effects:r,characters:n,boundingBox:i}=this._text;return r&&(r.forEach(o=>{Ct(o,i,e)}),n.forEach(o=>{r.forEach(a=>{o.drawTo(e,a)})})),this}}class Fn extends Wt{constructor(){super(...arguments);F(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new R;const e=S.MAX,r=S.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new R(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(){const{characters:e}=this._text;let r;const n=[];let i;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((i==null?void 0:i.url)===a.url&&r.length&&r[0].boundingBox.top===o.boundingBox.top&&r[0].fontSize===o.fontSize?r.push(o):(r=[],r.push(o),n.push(r))),i=a}),this.paths=n.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:R.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const r=kr(e),n=Rs(r),i=S.MAX,o=S.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new R(i.x,i.y,o.x-i.x,o.y-i.y),viewBox:new R(...r.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:r,box:n,baseline:i,fontSize:o}=e,{box:a,viewBox:h,paths:l}=this._parseSvg(r),u=h.top+h.height/2,c=[],p=u>a.top?0:1;function m(g,w){g.style.strokeWidth&&(g.style.strokeWidth*=w),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=w),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=w),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(f=>f*w))}if(p===0){const g={x:n.left-o*.2,y:n.top},w=(n.width+o*.2*2)/a.width,f=n.height/a.height,P=new mt().translate(-a.x,-a.y).scale(w,f).translate(g.x,g.y);l.forEach(_=>{const x=_.clone().transform(P);m(x,w),c.push({path:x})})}else if(p===1){const g=o/a.width,w=a.width*g,f=Math.ceil(n.width/w),P={x:n.left,y:n.top+i+o*.1},_=new mt().translate(-a.x,-a.y).scale(g,g).translate(P.x,P.y);for(let x=0;x<f;x++){const O=_.clone().translate(x*w,0);l.forEach(v=>{const b=v.clone().transform(O);m(b,g),c.push({clipRect:n,path:b})})}}return c}draw({ctx:e}){return this.paths.forEach(r=>{Ve({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class Nn extends Wt{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll("span").forEach((h,l)=>{var p;const u=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const m=document.createRange();m.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){m.setStart(c,Math.max(w-1,0)),m.setEnd(c,w);const f=((p=m.getClientRects)==null?void 0:p.call(m))??[m.getBoundingClientRect()];let P=f[f.length-1];f.length>1&&P.width<2&&(P=f[f.length-2]);const _=m.toString();_!==""&&P&&P.width+P.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:P.top,left:P.left,height:P.height,width:P.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((m,g)=>{const w=i?"left":"top";return Math.abs(g[w]-m[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(m=>{const g=e[m.paragraphIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height}),u.fragments.forEach(m=>{const g=e[m.paragraphIndex].fragments[m.fragmentIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height});const c=[];let p=0;return a.forEach(m=>{m.forEach(g=>{const w=u.characters[p],{paragraphIndex:f,fragmentIndex:P,characterIndex:_}=w;c.push({...w,newParagraphIndex:f,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[f].fragments[P].characters[_];x.boundingBox.left=c[p].left,x.boundingBox.top=c[p].top,x.boundingBox.width=c[p].width,x.boundingBox.height=c[p].height,x.textWidth=c[p].textWidth,x.textHeight=c[p].textHeight,p++})}),{paragraphs:e,boundingBox:new R(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class kn extends Wt{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new Qt({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new Qt({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new Qt({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,highlight:h,...l}=o;if(a!==void 0){const u=i.addFragment(a,l);u.highlight=h}}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new Qt(o,e);i.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const p=a.addFragment(l,c);p.highlight=u}}),r.push(a)}else if("content"in n){const{content:i,highlight:o,...a}=n;if(i!==void 0){const h=new Qt(a,e),l=h.addFragment(i);l.highlight=o,r.push(h)}}}return r}}class Wo extends Wt{}class Gn extends Wt{setupView(t){const{ctx:e,pixelRatio:r}=t,{renderBoundingBox:n}=this._text,{left:i,top:o,width:a,height:h}=n,l=e.canvas;return l.dataset.viewbox=`${i} ${o} ${a} ${h}`,l.dataset.pixelRatio=String(r),l.width=Math.max(1,Math.ceil(a*r)),l.height=Math.max(1,Math.ceil(h*r)),l.style.marginTop=`${o}px`,l.style.marginLeft=`${i}px`,l.style.width=`${a}px`,l.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(r,r),e.translate(-i,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:r,computedStyle:n,renderBoundingBox:i}=this._text,{width:o,height:a}=i;return Ct(n,new R(0,0,o,a),e),r.forEach(h=>{Ct(h.computedStyle,h.boundingBox,e),h.fragments.forEach(l=>{Ct(l.computedStyle,l.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:r,paragraphs:n}=this._text;function i(o,a,h,l,u){e.fillStyle=o,e.fillRect(a,h,l,u)}return r!=null&&r.backgroundColor&&i(r.backgroundColor,0,0,e.canvas.width,e.canvas.height),n.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&i(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&i(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:r}=this._text;return r.forEach(n=>{n.drawTo(e)}),this}}const mr={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class Ho{constructor(t={}){F(this,"content");F(this,"style");F(this,"effects");F(this,"deformation");F(this,"measureDom");F(this,"needsUpdate",!0);F(this,"computedStyle",{...mr});F(this,"paragraphs",[]);F(this,"boundingBox",new R);F(this,"renderBoundingBox",new R);F(this,"parser",new kn(this));F(this,"measurer",new Nn(this));F(this,"deformer",new Ln(this));F(this,"effector",new Bn(this));F(this,"highlighter",new Fn(this));F(this,"renderer2D",new Gn(this));const{content:e="",style:r={},effects:n,deformation:i,measureDom:o}=t;this.content=e,this.style=r,this.effects=n,this.deformation=i,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...mr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(o=>o.update()),this.highlighter.highlight(),this.deformation&&this.deformer.deform();const n=S.MAX,i=S.MIN;return r.forEach(o=>o.getMinMax(n,i)),this.renderBoundingBox=new R(n.x,n.y,i.x-n.x,i.y-n.y),this}render(t){var i,o;const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),(i=this.effects)!=null&&i.length?this.renderBoundingBox=R.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=R.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),this.renderer2D.setupView({pixelRatio:r,ctx:n}),this.renderer2D.uploadColors({ctx:n}),this.highlighter.draw({ctx:n}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:n}):this.renderer2D.draw({ctx:n}),this):this}}d.Character=$n,d.CmapSubtableFormat0=or,d.CmapSubtableFormat12=cr,d.CmapSubtableFormat14=pe,d.CmapSubtableFormat2=ce,d.CmapSubtableFormat4=hr,d.CmapSubtableFormat6=zt,d.Deformer=Ln,d.Effector=Bn,d.Eot=gi,d.Font=Pe,d.Fonts=Mn,d.Fragment=Dn,d.Glyph=er,d.GlyphSet=rr,d.Highlighter=Fn,d.Measurer=Nn,d.Paragraph=Qt,d.Parser=kn,d.Reflector=Wo,d.Renderer2D=Gn,d.Sfnt=ae,d.TableDirectory=Yt,d.Text=Ho,d.Ttf=st,d.Woff=Dt,d.WoffTableDirectoryEntry=Vt,d.componentFlags=Zt,d.createCmapSegments=lr,d.defaultTextStyles=mr,d.defineSfntTable=nt,d.drawPath=Ve,d.filterEmpty=Be,d.fonts=On,d.getPointPosition=Un,d.getRotationPoint=In,d.getScalePoint=En,d.getSkewPoint=gr,d.minify=zo,d.minifyGlyphs=Tn,d.minifySfnt=An,d.parse=Pn,d.parseColor=it,d.uploadColor=Ct,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, Vector2, parseSvgToDom, parseSvg, Matrix3 } from 'modern-path2d';
1
+ import { Matrix3, BoundingBox, Path2D, Vector2, parseSvgToDom, parseSvg } from 'modern-path2d';
2
2
  import { fonts, Woff, Ttf } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -51,7 +51,9 @@ function parseCssLinearGradient(css, x, y, width, height) {
51
51
  };
52
52
  }
53
53
 
54
- function drawPath(options) {
54
+ const _tempM1 = new Matrix3();
55
+ const _tempM2 = new Matrix3();
56
+ function drawPath(options, isText = false) {
55
57
  const { ctx, path, fontSize, clipRect } = options;
56
58
  ctx.save();
57
59
  ctx.beginPath();
@@ -68,13 +70,33 @@ function drawPath(options) {
68
70
  };
69
71
  const offsetX = (options.offsetX ?? 0) * fontSize;
70
72
  const offsetY = (options.offsetY ?? 0) * fontSize;
71
- ctx.translate(offsetX, offsetY);
73
+ const skewX = (options.skewX ?? 0) / 180 * Math.PI;
74
+ const skewY = (options.skewY ?? 0) / 180 * Math.PI;
75
+ if (offsetX || offsetY || skewX || skewY) {
76
+ _tempM1.makeTranslation(offsetX, offsetY);
77
+ _tempM2.set(1, Math.tan(skewX), 0, Math.tan(skewY), 1, 0, 0, 0, 1);
78
+ const [a, c, e, b, d, f] = _tempM1.multiply(_tempM2).transpose().elements;
79
+ ctx.transform(a, b, c, d, e, f);
80
+ }
72
81
  if (clipRect) {
73
82
  ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
74
83
  ctx.clip();
75
84
  ctx.beginPath();
76
85
  }
77
- path.drawTo(ctx);
86
+ if (isText && path.style.strokeWidth) {
87
+ const scale = path.style.strokeWidth / fontSize + 1;
88
+ const box = path.getBoundingBox();
89
+ ctx.translate(
90
+ box.left * (1 - scale) + box.width * (1 - scale) / 2,
91
+ box.top * (1 - scale) + box.height * (1 - scale) / 2
92
+ );
93
+ ctx.scale(scale, scale);
94
+ const clone = path.clone();
95
+ clone.style.strokeWidth /= scale * 2;
96
+ clone.drawTo(ctx);
97
+ } else {
98
+ path.drawTo(ctx);
99
+ }
78
100
  ctx.restore();
79
101
  }
80
102
 
@@ -393,7 +415,7 @@ class Character {
393
415
  fontSize: this.computedStyle.fontSize,
394
416
  color: this.computedStyle.color,
395
417
  ...config
396
- });
418
+ }, true);
397
419
  }
398
420
  }
399
421
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.16",
4
+ "version": "0.2.17",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",