modern-text 0.3.2 → 0.3.4
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 +13 -10
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +13 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -89,7 +89,7 @@ function setupView(ctx, pixelRatio, boundingBox) {
|
|
|
89
89
|
view.style.height = `${canvasHeight}px`;
|
|
90
90
|
ctx.clearRect(0, 0, view.width, view.height);
|
|
91
91
|
ctx.scale(pixelRatio, pixelRatio);
|
|
92
|
-
ctx.translate(-
|
|
92
|
+
ctx.translate(-left, -top);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function uploadColors(ctx, text) {
|
|
@@ -1106,6 +1106,7 @@ class Text {
|
|
|
1106
1106
|
__publicField(this, "computedStyle", { ...defaultTextStyles });
|
|
1107
1107
|
__publicField(this, "paragraphs", []);
|
|
1108
1108
|
__publicField(this, "lineBox", new modernPath2d.BoundingBox());
|
|
1109
|
+
__publicField(this, "rawGlyphBox", new modernPath2d.BoundingBox());
|
|
1109
1110
|
__publicField(this, "glyphBox", new modernPath2d.BoundingBox());
|
|
1110
1111
|
__publicField(this, "pathBox", new modernPath2d.BoundingBox());
|
|
1111
1112
|
__publicField(this, "boundingBox", new modernPath2d.BoundingBox());
|
|
@@ -1137,6 +1138,7 @@ class Text {
|
|
|
1137
1138
|
const old = {
|
|
1138
1139
|
paragraphs: this.paragraphs,
|
|
1139
1140
|
lineBox: this.lineBox,
|
|
1141
|
+
rawGlyphBox: this.rawGlyphBox,
|
|
1140
1142
|
glyphBox: this.glyphBox,
|
|
1141
1143
|
pathBox: this.pathBox,
|
|
1142
1144
|
boundingBox: this.boundingBox
|
|
@@ -1148,18 +1150,20 @@ class Text {
|
|
|
1148
1150
|
this.characters.forEach((c) => {
|
|
1149
1151
|
c.update();
|
|
1150
1152
|
});
|
|
1153
|
+
this.rawGlyphBox = this.getGlyphBox();
|
|
1151
1154
|
const plugins = [...this.plugins.values()];
|
|
1152
1155
|
plugins.sort((a, b) => (a.updateOrder ?? 0) - (b.updateOrder ?? 0)).forEach((plugin) => {
|
|
1153
1156
|
plugin.update?.(this);
|
|
1154
1157
|
});
|
|
1155
|
-
this.
|
|
1158
|
+
this.glyphBox = this.getGlyphBox();
|
|
1159
|
+
this.updatePathBox().updateBoundingBox();
|
|
1156
1160
|
for (const key in old) {
|
|
1157
1161
|
result[key] = this[key];
|
|
1158
1162
|
this[key] = old[key];
|
|
1159
1163
|
}
|
|
1160
1164
|
return result;
|
|
1161
1165
|
}
|
|
1162
|
-
|
|
1166
|
+
getGlyphBox() {
|
|
1163
1167
|
const min = modernPath2d.Vector2.MAX;
|
|
1164
1168
|
const max = modernPath2d.Vector2.MIN;
|
|
1165
1169
|
this.characters.forEach((c) => {
|
|
@@ -1171,13 +1175,12 @@ class Text {
|
|
|
1171
1175
|
max.max(a, b);
|
|
1172
1176
|
}
|
|
1173
1177
|
});
|
|
1174
|
-
|
|
1178
|
+
return new modernPath2d.BoundingBox(
|
|
1175
1179
|
min.x,
|
|
1176
1180
|
min.y,
|
|
1177
1181
|
max.x - min.x,
|
|
1178
1182
|
max.y - min.y
|
|
1179
1183
|
);
|
|
1180
|
-
return this;
|
|
1181
1184
|
}
|
|
1182
1185
|
updatePathBox() {
|
|
1183
1186
|
const plugins = [...this.plugins.values()];
|
|
@@ -1190,11 +1193,11 @@ class Text {
|
|
|
1190
1193
|
return this;
|
|
1191
1194
|
}
|
|
1192
1195
|
updateBoundingBox() {
|
|
1193
|
-
const { lineBox,
|
|
1194
|
-
const left = pathBox.left + lineBox.left -
|
|
1195
|
-
const top = pathBox.top + lineBox.top -
|
|
1196
|
-
const right = pathBox.right + Math.max(0, lineBox.right -
|
|
1197
|
-
const bottom = pathBox.bottom + Math.max(0, lineBox.bottom -
|
|
1196
|
+
const { lineBox, rawGlyphBox, pathBox } = this;
|
|
1197
|
+
const left = pathBox.left + lineBox.left - rawGlyphBox.left;
|
|
1198
|
+
const top = pathBox.top + lineBox.top - rawGlyphBox.top;
|
|
1199
|
+
const right = pathBox.right + Math.max(0, lineBox.right - rawGlyphBox.right);
|
|
1200
|
+
const bottom = pathBox.bottom + Math.max(0, lineBox.bottom - rawGlyphBox.bottom);
|
|
1198
1201
|
this.boundingBox = new modernPath2d.BoundingBox(
|
|
1199
1202
|
left,
|
|
1200
1203
|
top,
|
package/dist/index.d.cts
CHANGED
|
@@ -245,6 +245,7 @@ interface TextOptions {
|
|
|
245
245
|
interface MeasureResult {
|
|
246
246
|
paragraphs: Paragraph[];
|
|
247
247
|
lineBox: BoundingBox;
|
|
248
|
+
rawGlyphBox: BoundingBox;
|
|
248
249
|
glyphBox: BoundingBox;
|
|
249
250
|
pathBox: BoundingBox;
|
|
250
251
|
boundingBox: BoundingBox;
|
|
@@ -259,6 +260,7 @@ declare class Text {
|
|
|
259
260
|
computedStyle: TextStyle;
|
|
260
261
|
paragraphs: Paragraph[];
|
|
261
262
|
lineBox: BoundingBox;
|
|
263
|
+
rawGlyphBox: BoundingBox;
|
|
262
264
|
glyphBox: BoundingBox;
|
|
263
265
|
pathBox: BoundingBox;
|
|
264
266
|
boundingBox: BoundingBox;
|
|
@@ -271,7 +273,7 @@ declare class Text {
|
|
|
271
273
|
constructor(options?: TextOptions);
|
|
272
274
|
use(plugin: Plugin): this;
|
|
273
275
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
274
|
-
|
|
276
|
+
getGlyphBox(): BoundingBox;
|
|
275
277
|
updatePathBox(): this;
|
|
276
278
|
updateBoundingBox(): this;
|
|
277
279
|
requestUpdate(): this;
|
package/dist/index.d.mts
CHANGED
|
@@ -245,6 +245,7 @@ interface TextOptions {
|
|
|
245
245
|
interface MeasureResult {
|
|
246
246
|
paragraphs: Paragraph[];
|
|
247
247
|
lineBox: BoundingBox;
|
|
248
|
+
rawGlyphBox: BoundingBox;
|
|
248
249
|
glyphBox: BoundingBox;
|
|
249
250
|
pathBox: BoundingBox;
|
|
250
251
|
boundingBox: BoundingBox;
|
|
@@ -259,6 +260,7 @@ declare class Text {
|
|
|
259
260
|
computedStyle: TextStyle;
|
|
260
261
|
paragraphs: Paragraph[];
|
|
261
262
|
lineBox: BoundingBox;
|
|
263
|
+
rawGlyphBox: BoundingBox;
|
|
262
264
|
glyphBox: BoundingBox;
|
|
263
265
|
pathBox: BoundingBox;
|
|
264
266
|
boundingBox: BoundingBox;
|
|
@@ -271,7 +273,7 @@ declare class Text {
|
|
|
271
273
|
constructor(options?: TextOptions);
|
|
272
274
|
use(plugin: Plugin): this;
|
|
273
275
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
274
|
-
|
|
276
|
+
getGlyphBox(): BoundingBox;
|
|
275
277
|
updatePathBox(): this;
|
|
276
278
|
updateBoundingBox(): this;
|
|
277
279
|
requestUpdate(): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -245,6 +245,7 @@ interface TextOptions {
|
|
|
245
245
|
interface MeasureResult {
|
|
246
246
|
paragraphs: Paragraph[];
|
|
247
247
|
lineBox: BoundingBox;
|
|
248
|
+
rawGlyphBox: BoundingBox;
|
|
248
249
|
glyphBox: BoundingBox;
|
|
249
250
|
pathBox: BoundingBox;
|
|
250
251
|
boundingBox: BoundingBox;
|
|
@@ -259,6 +260,7 @@ declare class Text {
|
|
|
259
260
|
computedStyle: TextStyle;
|
|
260
261
|
paragraphs: Paragraph[];
|
|
261
262
|
lineBox: BoundingBox;
|
|
263
|
+
rawGlyphBox: BoundingBox;
|
|
262
264
|
glyphBox: BoundingBox;
|
|
263
265
|
pathBox: BoundingBox;
|
|
264
266
|
boundingBox: BoundingBox;
|
|
@@ -271,7 +273,7 @@ declare class Text {
|
|
|
271
273
|
constructor(options?: TextOptions);
|
|
272
274
|
use(plugin: Plugin): this;
|
|
273
275
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
274
|
-
|
|
276
|
+
getGlyphBox(): BoundingBox;
|
|
275
277
|
updatePathBox(): this;
|
|
276
278
|
updateBoundingBox(): this;
|
|
277
279
|
requestUpdate(): this;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(f,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(f=typeof globalThis<"u"?globalThis:f||self,st(f.modernText={}))})(this,function(f){"use strict";var ya=Object.defineProperty;var ma=(f,st,Tt)=>st in f?ya(f,st,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[st]=Tt;var E=(f,st,Tt)=>ma(f,typeof st!="symbol"?st+"":st,Tt);function st(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:s,stops:a}=ai(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(r,n,o,s);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Tt(i,t,e){i!=null&&i.color&&(i.color=st(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=st(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=st(e,i.textStrokeColor,t))}function ai(i,t,e,r,n){var y;const o=((y=i.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",h=o.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}})}}function Ce(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const o=e.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function Nr(i,t,e){const{left:r,top:n,width:o,height:s}=e,a=i.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${s}`,a.dataset.pixelRatio=String(t);const h=o+Math.abs(r),l=s+Math.abs(n);a.width=Math.max(1,Math.ceil(h*t)),a.height=Math.max(1,Math.ceil(l*t)),a.style.width=`${h}px`,a.style.height=`${l}px`,i.clearRect(0,0,a.width,a.height),i.scale(t,t),i.translate(-Math.min(0,r),-Math.min(0,n))}function zr(i,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;Tt(r,n,i),e.forEach(o=>{Tt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Tt(s.computedStyle,s.inlineBox,i)})})}var ot=Uint8Array,wt=Uint16Array,Ve=Int32Array,Se=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qe=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Er=function(i,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Ve(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},Ur=Er(Se,2),Lr=Ur.b,We=Ur.r;Lr[28]=258,We[258]=28;for(var $r=Er(Pe,0),li=$r.b,Br=$r.r,He=new wt(32768),F=0;F<32768;++F){var $t=(F&43690)>>1|(F&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[F]=(($t&65280)>>8|($t&255)<<8)>>1}for(var It=function(i,t,e){for(var r=i.length,n=0,o=new wt(t);n<r;++n)i[n]&&++o[i[n]-1];var s=new wt(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new wt(1<<t);var h=15-t;for(n=0;n<r;++n)if(i[n])for(var l=n<<4|i[n],u=t-i[n],c=s[i[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[He[c]>>h]=l}else for(a=new wt(r),n=0;n<r;++n)i[n]&&(a[n]=He[s[i[n]-1]++]>>15-i[n]);return a},Bt=new ot(288),F=0;F<144;++F)Bt[F]=8;for(var F=144;F<256;++F)Bt[F]=9;for(var F=256;F<280;++F)Bt[F]=7;for(var F=280;F<288;++F)Bt[F]=8;for(var oe=new ot(32),F=0;F<32;++F)oe[F]=5;var hi=It(Bt,9,0),ci=It(Bt,9,1),ui=It(oe,5,0),fi=It(oe,5,1),Qe=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},Ct=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ye=function(i){return(i+7)/8|0},kr=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new ot(i.subarray(t,e))},pi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],St=function(i,t,e){var r=new Error(t||pi[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},di=function(i,t,e,r){var n=i.length,o=0;if(!n||t.f&&!t.l)return e||new ot(0);var s=!e,a=s||t.i!=2,h=t.i;s&&(e=new ot(n*3));var l=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,p=t.b||0,y=t.l,g=t.d,w=t.m,d=t.n,C=n*8;do{if(!y){u=Ct(i,c,1);var S=Ct(i,c+1,3);if(c+=3,S)if(S==1)y=ci,g=fi,w=9,d=5;else if(S==2){var M=Ct(i,c,31)+257,A=Ct(i,c+10,15)+4,P=M+Ct(i,c+5,31)+1;c+=14;for(var _=new ot(P),z=new ot(19),q=0;q<A;++q)z[qe[q]]=Ct(i,c+q*3,7);c+=A*3;for(var B=Qe(z),mt=(1<<B)-1,D=It(z,B,1),q=0;q<P;){var O=D[Ct(i,c,mt)];c+=O&15;var x=O>>4;if(x<16)_[q++]=x;else{var k=0,$=0;for(x==16?($=3+Ct(i,c,3),c+=2,k=_[q-1]):x==17?($=3+Ct(i,c,7),c+=3):x==18&&($=11+Ct(i,c,127),c+=7);$--;)_[q++]=k}}var J=_.subarray(0,M),W=_.subarray(M);w=Qe(J),d=Qe(W),y=It(J,w,1),g=It(W,d,1)}else St(1);else{var x=Ye(c)+4,T=i[x-4]|i[x-3]<<8,v=x+T;if(v>n){h&&St(0);break}a&&l(p+T),e.set(i.subarray(x,v),p),t.b=p+=T,t.p=c=v*8,t.f=u;continue}if(c>C){h&&St(0);break}}a&&l(p+131072);for(var xt=(1<<w)-1,G=(1<<d)-1,K=c;;K=c){var k=y[Xe(i,c)&xt],j=k>>4;if(c+=k&15,c>C){h&&St(0);break}if(k||St(2),j<256)e[p++]=j;else if(j==256){K=c,y=null;break}else{var R=j-254;if(j>264){var q=j-257,N=Se[q];R=Ct(i,c,(1<<N)-1)+Lr[q],c+=N}var X=g[Xe(i,c)&G],H=X>>4;X||St(3),c+=X&15;var W=li[H];if(H>3){var N=Pe[H];W+=Xe(i,c)&(1<<N)-1,c+=N}if(c>C){h&&St(0);break}a&&l(p+131072);var tt=p+R;if(p<W){var Xt=o-W,Yt=Math.min(W,tt);for(Xt+p<0&&St(3);p<Yt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-W]}}t.l=y,t.p=K,t.b=p,t.f=u,y&&(u=1,t.m=w,t.d=g,t.n=d)}while(!u);return p!=e.length&&s?kr(e,0,p):e.subarray(0,p)},Et=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},ae=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ze=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,o=e.slice();if(!n)return{t:Rr,l:0};if(n==1){var s=new ot(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,M){return v.f-M.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=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var y=new wt(p+1),g=Ke(e[u-1],y,0);if(g>t){var r=0,w=0,d=g-t,C=1<<d;for(o.sort(function(M,A){return y[A.s]-y[M.s]||M.f-A.f});r<n;++r){var S=o[r].s;if(y[S]>t)w+=C-(1<<g-y[S]),y[S]=t;else break}for(w>>=d;w>0;){var x=o[r].s;y[x]<t?w-=1<<t-y[x]++-1:++r}for(;r>=0&&w;--r){var T=o[r].s;y[T]==t&&(--y[T],++w)}g=t}return{t:new ot(y),l:g}},Ke=function(i,t,e){return i.s==-1?Math.max(Ke(i.l,t,e+1),Ke(i.r,t,e+1)):t[i.s]=e},jr=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new wt(++t),r=0,n=i[0],o=1,s=function(h){e[r++]=h},a=1;a<=t;++a)if(i[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=i[a]}return{c:e.subarray(0,r),n:t}},le=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},Fr=function(i,t,e){var r=e.length,n=Ye(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var o=0;o<r;++o)i[n+o+4]=e[o];return(n+4+r)*8},Gr=function(i,t,e,r,n,o,s,a,h,l,u){Et(t,u++,e),++n[256];for(var c=Ze(n,15),p=c.t,y=c.l,g=Ze(o,15),w=g.t,d=g.l,C=jr(p),S=C.c,x=C.n,T=jr(w),v=T.c,M=T.n,A=new wt(19),P=0;P<S.length;++P)++A[S[P]&31];for(var P=0;P<v.length;++P)++A[v[P]&31];for(var _=Ze(A,7),z=_.t,q=_.l,B=19;B>4&&!z[qe[B-1]];--B);var mt=l+5<<3,D=le(n,Bt)+le(o,oe)+s,O=le(n,p)+le(o,w)+s+14+3*B+le(A,z)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&mt<=D&&mt<=O)return Fr(t,u,i.subarray(h,h+l));var k,$,J,W;if(Et(t,u,1+(O<D)),u+=2,O<D){k=It(p,y,0),$=p,J=It(w,d,0),W=w;var xt=It(z,q,0);Et(t,u,x-257),Et(t,u+5,M-1),Et(t,u+10,B-4),u+=14;for(var P=0;P<B;++P)Et(t,u+3*P,z[qe[P]]);u+=3*B;for(var G=[S,v],K=0;K<2;++K)for(var j=G[K],P=0;P<j.length;++P){var R=j[P]&31;Et(t,u,xt[R]),u+=z[R],R>15&&(Et(t,u,j[P]>>5&127),u+=j[P]>>12)}}else k=hi,$=Bt,J=ui,W=oe;for(var P=0;P<a;++P){var N=r[P];if(N>255){var R=N>>18&31;ae(t,u,k[R+257]),u+=$[R+257],R>7&&(Et(t,u,N>>23&31),u+=Se[R]);var X=N&31;ae(t,u,J[X]),u+=W[X],X>3&&(ae(t,u,N>>5&8191),u+=Pe[X])}else ae(t,u,k[N]),u+=$[N]}return ae(t,u,k[256]),u+$[256]},gi=new Ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Rr=new ot(0),yi=function(i,t,e,r,n,o){var s=o.z||i.length,a=new ot(r+s+5*(1+Math.ceil(s/7e3))+n),h=a.subarray(r,a.length-n),l=o.l,u=(o.r||0)&7;if(t){u&&(h[0]=o.r>>3);for(var c=gi[t-1],p=c>>13,y=c&8191,g=(1<<e)-1,w=o.p||new wt(32768),d=o.h||new wt(g+1),C=Math.ceil(e/3),S=2*C,x=function(se){return(i[se]^i[se+1]<<C^i[se+2]<<S)&g},T=new Ve(25e3),v=new wt(288),M=new wt(32),A=0,P=0,_=o.i||0,z=0,q=o.w||0,B=0;_+2<s;++_){var mt=x(_),D=_&32767,O=d[mt];if(w[D]=O,d[mt]=D,q<=_){var k=s-_;if((A>7e3||z>24576)&&(k>423||!l)){u=Gr(i,h,0,T,v,M,P,z,B,_-B,u),z=A=P=0,B=_;for(var $=0;$<286;++$)v[$]=0;for(var $=0;$<30;++$)M[$]=0}var J=2,W=0,xt=y,G=D-O&32767;if(k>2&&mt==x(_-G))for(var K=Math.min(p,k)-1,j=Math.min(32767,_),R=Math.min(258,k);G<=j&&--xt&&D!=O;){if(i[_+J]==i[_+J-G]){for(var N=0;N<R&&i[_+N]==i[_+N-G];++N);if(N>J){if(J=N,W=G,N>K)break;for(var X=Math.min(G,N-2),H=0,$=0;$<X;++$){var tt=_-G+$&32767,Xt=w[tt],Yt=tt-Xt&32767;Yt>H&&(H=Yt,O=tt)}}}D=O,O=w[D],G+=D-O&32767}if(W){T[z++]=268435456|We[J]<<18|Br[W];var Dt=We[J]&31,Nt=Br[W]&31;P+=Se[Dt]+Pe[Nt],++v[257+Dt],++M[Nt],q=_+J,++A}else T[z++]=i[_],++v[i[_]]}}for(_=Math.max(_,q);_<s;++_)T[z++]=i[_],++v[i[_]];u=Gr(i,h,l,T,v,M,P,z,B,_-B,u),l||(o.r=u&7|h[u/8|0]<<3,u-=7,o.h=d,o.p=w,o.i=_,o.w=q)}else{for(var _=o.w||0;_<s+l;_+=65535){var Lt=_+65535;Lt>=s&&(h[u/8|0]=l,Lt=s),u=Fr(h,u+1,i.subarray(_,Lt))}o.i=s}return kr(a,0,r+Ye(u)+n)},Vr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)n+=r+=e[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},mi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ot(o.length+i.length);s.set(o),s.set(i,o.length),i=s,n.w=o.length}return yi(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},qr=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},wi=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Vr();n.p(t.dictionary),qr(i,2,n.d())}},vi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function bi(i,t){t||(t={});var e=Vr();e.p(i);var r=mi(i,t,t.dictionary?6:2,4);return wi(r,t),qr(r,r.length-4,e.d()),r}function Mi(i,t){return di(i.subarray(vi(i,t),-4),{i:2},t,t)}var xi=typeof TextDecoder<"u"&&new TextDecoder,Ci=0;try{xi.decode(Rr,{stream:!0}),Ci=1}catch{}const Si="modern-font";function he(i,t){if(!i)throw new Error(`[${Si}] ${t}`)}function Pi(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Gt(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var Wr=Object.defineProperty,_i=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,at=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Wr(t,e,n),n},Ti=(i,t,e)=>(_i(i,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(i,t){Object.defineProperty(i.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(Pi(t),e,r),this.littleEndian=n,Ti(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/,s=>s.toUpperCase())}`,o=this[n](e,r);return this.cursor+=_e[t],o}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 o=0,s=r.length;o<s;o++)n+=String.fromCharCode(r[o]);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 o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,s=this[o](r,e,n);return this.cursor+=_e[t.toLowerCase()],s}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,s;n<o;++n)s=t.charCodeAt(n)||0,s>127?this.writeUint16(s):this.writeUint8(s);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 o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}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 Ii=Object.defineProperty,Oi=(i,t,e)=>t in i?Ii(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ai=(i,t,e)=>(Oi(i,t+"",e),e);const Hr=new WeakMap;function m(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let s=Hr.get(n);s||(s={columns:[],byteLength:0},Hr.set(n,s));const a={...t,name:o,byteLength:e*_e[r],offset:t.offset??s.columns.reduce((h,l)=>h+l.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Ai(this,"view"),this.view=new rt(t,e,r,n)}}function Di(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(i){i=Di(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Ni(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zi(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Ie extends Mt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Qr=Object.defineProperty,Ei=(i,t,e)=>t in i?Qr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ft=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Qr(t,e,n),n},Xr=(i,t,e)=>(Ei(i,typeof t!="symbol"?t+"":t,e),e);const ht=class ri extends Ie{constructor(){super(...arguments),Xr(this,"format","EmbeddedOpenType"),Xr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Te(n.fontFamily||""),s=o.length,a=Te(n.fontStyle||""),h=a.length,l=Te(n.version||""),u=l.length,c=Te(n.fullName||""),p=c.length,y=86+s+4+h+4+u+4+p+2+t.view.byteLength,g=new ri(new ArrayBuffer(y),0,y,!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(s),g.view.writeBytes(o),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([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let Ui=ht;var Li=Object.defineProperty,Oe=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Li(t,e,n),n};class Zt extends Mt{constructor(t,e){super(t,e,16)}}Oe([m({type:"char",size:4})],Zt.prototype,"tag"),Oe([m("uint32")],Zt.prototype,"checkSum"),Oe([m("uint32")],Zt.prototype,"offset"),Oe([m("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],$i=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Bi=Object.defineProperty,ki=(i,t,e)=>t in i?Bi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e)=>(ki(i,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(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={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:h=s}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const y=l[c];y.type==="M"?u.push({type:"M",x:t+y.x*a,y:e+-y.y*h}):y.type==="L"?u.push({type:"L",x:t+y.x*a,y:e+-y.y*h}):y.type==="Q"?u.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="C"?u.push({type:"C",x1:t+y.x1*a,y1:e+-y.y1*h,x2:t+y.x2*a,y2:e+-y.y2*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="Z"&&u.push({type:"Z"})}return u}}class ji extends tr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,y,g;const w=[],d=[];let C=0,S=!1,x=!1,T=s,v=0,M=0;function A(D,O){w.push({type:"L",x:D,y:O})}function P(D,O,k,$,J,W){w.push({type:"C",x1:D,y1:O,x2:k,y2:$,x:J,y:W})}function _(D,O){x&&l!==2&&z(),x=!0,w.push({type:"M",x:D,y:O})}function z(){w.push({type:"Z"})}function q(D){w.push(...D)}function B(){d.length%2!==0&&!S&&(T=d.shift()+o),C+=d.length>>1,d.length=0,S=!0}function mt(D){let O,k,$,J,W,xt,G,K,j,R,N,X,H=0;for(;H<D.length;){let tt=D[H++];switch(tt){case 1:B();break;case 3:B();break;case 4:d.length>1&&!S&&(T=d.shift()+o,S=!0),M+=d.pop(),_(v,M);break;case 5:for(;d.length>0;)v+=d.shift(),M+=d.shift(),A(v,M);break;case 6:for(;d.length>0&&(v+=d.shift(),A(v,M),d.length!==0);)M+=d.shift(),A(v,M);break;case 7:for(;d.length>0&&(M+=d.shift(),A(v,M),d.length!==0);)v+=d.shift(),A(v,M);break;case 8:for(;d.length>0;)c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);break;case 10:W=d.pop()+h,xt=t.subrs[W],xt&&mt(xt);break;case 11:return;case 12:switch(tt=D[H],H+=1,tt){case 35:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g+d.shift(),j=G+d.shift(),R=K+d.shift(),N=j+d.shift(),X=R+d.shift(),v=N+d.shift(),M=X+d.shift(),d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 34:c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g,j=G+d.shift(),R=g,N=j+d.shift(),X=M,v=N+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 36:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g,j=G+d.shift(),R=g,N=j+d.shift(),X=R+d.shift(),v=N+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 37:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g+d.shift(),j=G+d.shift(),R=K+d.shift(),N=j+d.shift(),X=R+d.shift(),Math.abs(N-v)>Math.abs(X-M)?v=N+d.shift():M=X+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Je[d.pop()],Yt=Je[d.pop()],Dt=d.pop(),Nt=d.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),se=t.charset.indexOf(Yt);n.components.push({glyphIndex:se,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),q(r.get(se).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ar=0;Ar<Or.length;Ar+=1){const zt=Or[Ar];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}q(Or)}}else d.length>0&&!S&&(T=d.shift()+o,S=!0);x&&l!==2&&(z(),x=!1);break;case 18:B();break;case 19:case 20:B(),H+=C+7>>3;break;case 21:d.length>2&&!S&&(T=d.shift()+o,S=!0),M+=d.pop(),v+=d.pop(),_(v,M);break;case 22:d.length>1&&!S&&(T=d.shift()+o,S=!0),v+=d.pop(),_(v,M);break;case 23:B();break;case 24:for(;d.length>2;)c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);v+=d.shift(),M+=d.shift(),A(v,M);break;case 25:for(;d.length>6;)v+=d.shift(),M+=d.shift(),A(v,M);c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y,M=g+d.shift(),P(c,p,y,g,v,M);break;case 27:for(d.length%2&&(M+=d.shift());d.length>0;)c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g,P(c,p,y,g,v,M);break;case 28:O=D[H],k=D[H+1],d.push((O<<24|k<<16)>>16),H+=2;break;case 29:W=d.pop()+a,xt=t.gsubrs[W],xt&&mt(xt);break;case 30:for(;d.length>0&&(c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+(d.length===1?d.shift():0),P(c,p,y,g,v,M),d.length!==0);)c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),M=g+d.shift(),v=y+(d.length===1?d.shift():0),P(c,p,y,g,v,M);break;case 31:for(;d.length>0&&(c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),M=g+d.shift(),v=y+(d.length===1?d.shift():0),P(c,p,y,g,v,M),d.length!==0);)c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+(d.length===1?d.shift():0),P(c,p,y,g,v,M);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(O=D[H],H+=1,d.push((tt-247)*256+O+108)):tt<255?(O=D[H],H+=1,d.push(-(tt-251)*256-O-108)):(O=D[H],k=D[H+1],$=D[H+2],J=D[H+3],H+=4,d.push((O<<24|k<<16|$<<8|J)/65536))}}}mt(e),this.pathCommands=w,S&&(this.advanceWidth=T)}}var Fi=Object.defineProperty,Gi=(i,t,e)=>t in i?Fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ri=(i,t,e)=>(Gi(i,t+"",e),e);class er{constructor(t){this._sfnt=t,Ri(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 o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Vi extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new ji({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Yr=Object.defineProperty,qi=(i,t,e)=>t in i?Yr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Yr(t,e,n),n},Ae=(i,t,e)=>(qi(i,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,s=e+1;o<s;o++){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],s=r+e[t+1]-n;return this._isString?this.view.readString(n,s):this.view.readBytes(n,s)}}Zr([m("uint16")],De.prototype,"count"),Zr([m("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Kr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const Wi=[".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"],Hi=[".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"],Qi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Xi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function ze(i,t){return t<=390?Wi[t]:i[t-391]}var Yi=Object.defineProperty,Zi=(i,t,e)=>t in i?Yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jr=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);function V(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class tn extends Mt{constructor(){super(...arguments),Jr(this,"_dict"),Jr(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 o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=n[s],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,s;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|n<<16|o<<8|s;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 o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ki=Object.defineProperty,rr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ki(t,e,n),n};class Ee extends tn{}rr([V(19)],Ee.prototype,"subrs"),rr([V(20)],Ee.prototype,"defaultWidthX"),rr([V(21)],Ee.prototype,"nominalWidthX");var Ji=Object.defineProperty,Y=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ji(t,e,n),n};class Q extends tn{}Y([V(0,"string")],Q.prototype,"version"),Y([V(1,"string")],Q.prototype,"notice"),Y([V(1200,"string")],Q.prototype,"copyright"),Y([V(2,"string")],Q.prototype,"fullName"),Y([V(3,"string")],Q.prototype,"familyName"),Y([V(4,"string")],Q.prototype,"weight"),Y([V(1201)],Q.prototype,"isFixedPitch"),Y([V(1202)],Q.prototype,"italicAngle"),Y([V(1203,"number",-100)],Q.prototype,"underlinePosition"),Y([V(1204,"number",50)],Q.prototype,"underlineThickness"),Y([V(1205)],Q.prototype,"paintType"),Y([V(1206,"number",2)],Q.prototype,"charstringType"),Y([V(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),Y([V(13)],Q.prototype,"uniqueId"),Y([V(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),Y([V(1208)],Q.prototype,"strokeWidth"),Y([V(14)],Q.prototype,"xuid"),Y([V(15)],Q.prototype,"charset"),Y([V(16)],Q.prototype,"encoding"),Y([V(17)],Q.prototype,"charStrings"),Y([V(18,"number[]",[0,0])],Q.prototype,"private");var ts=Object.defineProperty,es=(i,t,e)=>t in i?ts(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nr=(i,t,e)=>(es(i,typeof t!="symbol"?t+"":t,e),e);function nt(i,t=i){return e=>{ue.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const en=class xe{constructor(t){nr(this,"tables",new Map),nr(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,o=Array.from({length:n}),s=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,n,o){var s;return(s=this.charToGlyph(t))==null?void 0:s.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},s){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];s.call(this,u,e,r,n,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};nr(en,"tableDefinitions",new Map);let ue=en;class ct extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var rn=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,ns=(i,t,e)=>t in i?rn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fe=(i,t,e,r)=>{for(var n=r>1?void 0:r?rs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&rn(t,e,n),n},ir=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);f.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 Vi(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 Kr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Kr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Ee(e,r+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+s+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hi:this.topDict.charset===1?this.charset=Qi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=$i:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let o,s,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(o=0;o<e;o+=1)s=n.readUint16(),h.push(ze(r,s));else if(l===1)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint8(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else if(l===2)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint16(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const o={},s=e.readUint8();if(s===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),o[n]=r}else if(s===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)o[u]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([m("uint8")],f.Cff.prototype,"majorVersion",2),fe([m("uint8")],f.Cff.prototype,"minorVersion",2),fe([m("uint8")],f.Cff.prototype,"headerSize",2),fe([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([nt("CFF ","cff")],f.Cff);var is=Object.defineProperty,Ue=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&is(t,e,n),n};const pe=class ni extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ni;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ue([m("uint16")],pe.prototype,"format"),Ue([m("uint16")],pe.prototype,"length"),Ue([m("uint16")],pe.prototype,"language"),Ue([m({type:"uint8",size:256})],pe.prototype,"glyphIndexArray");let sr=pe;var ss=Object.defineProperty,or=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ss(t,e,n),n};class de extends Mt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,s=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<o[0].firstCode||l>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(l-o[0].firstCode)>=s.length?h=0:(h=s[o[0].idRangeOffset+(l-o[0].firstCode)],h!==0&&(h=h+o[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=o[u].entryCount;c<p;c++)if(o[u].idRangeOffset+c>=s.length?h=0:(h=s[o[u].idRangeOffset+c],h!==0&&(h=h+o[u].idDelta)),h!==0&&h<t){const y=(l<<8|c+o[u].firstCode)%65535;e.set(y,h)}}return e}}or([m("uint16")],de.prototype,"format"),or([m("uint16")],de.prototype,"length"),or([m("uint16")],de.prototype,"language");function nn(i){return i>32767?i-65536:i<-32767?i+65536:i}function ar(i,t){let e;const r=[];let n={};return i.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:s,startId:o,delta:nn(o-s)}):(n.start=Number(s),n.startId=o,n.delta=nn(o-s))),e={unicode:s,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var os=Object.defineProperty,Rt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&os(t,e,n),n};const kt=class ii extends Mt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,s=new ii(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=n,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=o[l];u<=c;++u)if(s[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+s[l]/2+(u-n[l])-r,y=h[p];y!==0?t.set(u,(y+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Rt([m("uint16")],kt.prototype,"format"),Rt([m("uint16")],kt.prototype,"length"),Rt([m("uint16")],kt.prototype,"language"),Rt([m("uint16")],kt.prototype,"segCountX2"),Rt([m("uint16")],kt.prototype,"searchRange"),Rt([m("uint16")],kt.prototype,"entrySelector"),Rt([m("uint16")],kt.prototype,"rangeShift");let lr=kt;var as=Object.defineProperty,ge=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&as(t,e,n),n};class Vt extends Mt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}ge([m("uint16")],Vt.prototype,"format"),ge([m("uint16")],Vt.prototype,"length"),ge([m("uint16")],Vt.prototype,"language"),ge([m("uint16")],Vt.prototype,"firstCode"),ge([m("uint16")],Vt.prototype,"entryCount");var ls=Object.defineProperty,ye=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ls(t,e,n),n};const Kt=class si extends Mt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ar(t),r=new si(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 o=e[r];let s=o.startGlyphCode,a=o.startCharCode;const h=o.endCharCode;for(;a<=h;)t.set(a++,s++)}return t}};ye([m("uint16")],Kt.prototype,"format"),ye([m("uint16")],Kt.prototype,"reserved"),ye([m("uint32")],Kt.prototype,"length"),ye([m("uint32")],Kt.prototype,"language"),ye([m("uint32")],Kt.prototype,"nGroups");let hr=Kt;var hs=Object.defineProperty,cr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&hs(t,e,n),n};class me extends Mt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}cr([m("uint16")],me.prototype,"format"),cr([m("uint32")],me.prototype,"length"),cr([m("uint32")],me.prototype,"numVarSelectorRecords");var sn=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(i,t,e)=>t in i?sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ur=(i,t,e,r)=>{for(var n=r>1?void 0:r?cs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&sn(t,e,n),n},on=(i,t,e)=>(us(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),on(this,"_unicodeToGlyphIndexMap"),on(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=lr.from(t),n=sr.from(t),o=e?hr.from(t):void 0,s=4+(o?32:24),a=s+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((o==null?void 0:o.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,s),u.view.writeBytes(n.view,a),o&&u.view.writeBytes(o.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,o=r.length;n<o;n++){const s=r[n],a=e.get(s);t.has(a)?t.get(a).push(s):t.set(a,[s])}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 sr(this.view.buffer,e.offset);break;case 2:n=new de(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Vt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(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,o=(u=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:u.view,s=(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())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}},ur([m("uint16")],f.Cmap.prototype,"version",2),ur([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([nt("cmap")],f.Cmap);class fs extends tr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return he(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 o=t[n],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(t,e,r,n,o){let s;return(e&n)>0?(s=t.view.readUint8(),e&o||(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}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();he(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;he(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let y,g=0;for(;g<c;)if(y=t.view.readUint8(),p.push(y),g++,y&8&&g<c){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(y),g++}if(he(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let d;if(c>0){for(let x=0;x<c;x+=1)y=p[x],d={},d.onCurve=!!(y&1),d.lastPointOfContour=a.includes(x),w.push(d);let C=0;for(let x=0;x<c;x+=1)y=p[x],d=w[x],d.x=this._parseGlyphCoordinate(t,y,C,2,16),C=d.x;let S=0;for(let x=0;x<c;x+=1)y=p[x],d=w[x],d.y=this._parseGlyphCoordinate(t,y,S,4,32),S=d.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{he(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 y={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],y)[0],y.dx=c.x-p.x,y.dy=c.y-p.y,u=this._transformPoints(l.points,y)}this.points=this.points.concat(u)}}const o=[],s=this._parseContours(this.points);for(let a=0,h=s.length;a<h;++a){const l=s[a];let u=l[l.length-1],c=l[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):c.onCurve?o.push({type:"M",x:c.x,y:c.y}):o.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,y=l.length;p<y;++p)if(u=c,c=l[(p+1)%y],u.onCurve)o.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}),o.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}o.push({type:"Z"})}this.pathCommands=o}}class ps extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new fs({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var an=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,gs=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ys=(i,t,e,r)=>{for(var n=r>1?void 0:r?ds(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&an(t,e,n),n},ms=(i,t,e)=>(gs(i,t+"",e),e);const Jt={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};f.Glyf=class extends ct{constructor(){super(...arguments),ms(this,"_glyphs")}static from(t){const e=t.reduce((n,o)=>n+o.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new ps(this._sfnt))}},f.Glyf=ys([nt("glyf")],f.Glyf);var ws=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,bs=(i,t,e,r)=>{for(var n=r>1?void 0:r?vs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ws(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=bs([nt("GPOS","gpos")],f.Gpos);var Ms=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,qt=(i,t,e,r)=>{for(var n=r>1?void 0:r?xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ms(t,e,n),n};f.Gsub=class extends ct{},qt([m("uint16")],f.Gsub.prototype,"majorVersion",2),qt([m("uint16")],f.Gsub.prototype,"minorVersion",2),qt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),qt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),qt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),qt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=qt([nt("GSUB","gsub")],f.Gsub);var Cs=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,et=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ss(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Cs(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],f.Head.prototype,"version",2),et([m("fixed")],f.Head.prototype,"fontRevision",2),et([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],f.Head.prototype,"magickNumber",2),et([m("uint16")],f.Head.prototype,"flags",2),et([m("uint16")],f.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],f.Head.prototype,"created",2),et([m({type:"longDateTime"})],f.Head.prototype,"modified",2),et([m("int16")],f.Head.prototype,"xMin",2),et([m("int16")],f.Head.prototype,"yMin",2),et([m("int16")],f.Head.prototype,"xMax",2),et([m("int16")],f.Head.prototype,"yMax",2),et([m("uint16")],f.Head.prototype,"macStyle",2),et([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([m("int16")],f.Head.prototype,"fontDirectionHint",2),et([m("int16")],f.Head.prototype,"indexToLocFormat",2),et([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var Ps=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ps(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Hhea.prototype,"version",2),pt([m("int16")],f.Hhea.prototype,"ascent",2),pt([m("int16")],f.Hhea.prototype,"descent",2),pt([m("int16")],f.Hhea.prototype,"lineGap",2),pt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var ln=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,Is=(i,t,e)=>t in i?ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Os=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ts(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ln(t,e,n),n},As=(i,t,e)=>(Is(i,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),As(this,"_metrics")}static from(t){const e=t.length*4,r=new f.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((o,s)=>(s<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Os([nt("hmtx")],f.Hmtx);var Ds=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,zs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ns(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ds(t,e,n),n};f.Kern=class extends ct{},f.Kern=zs([nt("kern","kern")],f.Kern);var hn=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,Us=(i,t,e)=>t in i?hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ls=(i,t,e,r)=>{for(var n=r>1?void 0:r?Es(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&hn(t,e,n),n},$s=(i,t,e)=>(Us(i,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),$s(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(o=>{e?n.view.writeUint32(o):n.view.writeUint16(o/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)}},f.Loca=Ls([nt("loca")],f.Loca);var Bs=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,ut=(i,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Bs(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],f.Maxp.prototype,"version",2),ut([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],f.Maxp.prototype,"maxPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxContours",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],f.Maxp.prototype,"maxZones",2),ut([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxStorage",2),ut([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var cn=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Fs=(i,t,e)=>t in i?cn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Le=(i,t,e,r)=>{for(var n=r>1?void 0:r?js(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&cn(t,e,n),n},Gs=(i,t,e)=>(Fs(i,t+"",e),e);const un={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"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Rs={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},fn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Gs(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=fr.Macintosh,o=Rs.Default,s=0;e.some(h=>h.platform===fr.Microsoft&&h.encoding===fn.UCS2&&h.language===1033)&&(n=fr.Microsoft,o=fn.UCS2,s=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===o&&l.language===s&&un[l.nameId]&&(a[un[l.nameId]]=s===0?Ni(l.name):zi(l.name))}return a}},Le([m("uint16")],f.Name.prototype,"format",2),Le([m("uint16")],f.Name.prototype,"count",2),Le([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([nt("name")],f.Name);var Vs=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,I=(i,t,e,r)=>{for(var n=r>1?void 0:r?qs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Vs(t,e,n),n};f.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]}},I([m("uint16")],f.Os2.prototype,"version",2),I([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),I([m("uint16")],f.Os2.prototype,"usWeightClass",2),I([m("uint16")],f.Os2.prototype,"usWidthClass",2),I([m("uint16")],f.Os2.prototype,"fsType",2),I([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),I([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),I([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),I([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),I([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),I([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),I([m("uint16")],f.Os2.prototype,"sFamilyClass",2),I([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),I([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),I([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),I([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),I([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),I([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),I([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),I([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),I([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),I([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),I([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),I([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),I([m("uint16")],f.Os2.prototype,"fsSelection",2),I([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),I([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),I([m("int16")],f.Os2.prototype,"sTypoAscender",2),I([m("int16")],f.Os2.prototype,"sTypoDescender",2),I([m("int16")],f.Os2.prototype,"sTypoLineGap",2),I([m("uint16")],f.Os2.prototype,"usWinAscent",2),I([m("uint16")],f.Os2.prototype,"usWinDescent",2),I([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),I([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),I([m("int16")],f.Os2.prototype,"sCapHeight",2),I([m("uint16")],f.Os2.prototype,"usDefaultChar",2),I([m("uint16")],f.Os2.prototype,"usBreakChar",2),I([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=I([nt("OS/2","os2")],f.Os2);var Ws=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Ot=(i,t,e,r)=>{for(var n=r>1?void 0:r?Hs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ws(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([m("fixed")],f.Post.prototype,"format",2),Ot([m("fixed")],f.Post.prototype,"italicAngle",2),Ot([m("int16")],f.Post.prototype,"underlinePosition",2),Ot([m("int16")],f.Post.prototype,"underlineThickness",2),Ot([m("uint32")],f.Post.prototype,"isFixedPitch",2),Ot([m("uint32")],f.Post.prototype,"minMemType42",2),Ot([m("uint32")],f.Post.prototype,"maxMemType42",2),Ot([m("uint32")],f.Post.prototype,"minMemType1",2),Ot([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=Ot([nt("post")],f.Post);var Qs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,dt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Qs(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],f.Vhea.prototype,"version",2),dt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([m("int16")],f.Vhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var pn=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Zs=(i,t,e)=>t in i?pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ks=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ys(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&pn(t,e,n),n},Js=(i,t,e)=>(Zs(i,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Js(this,"_metrics")}static from(t){const e=t.length*4,r=new f.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 o;const t=this._sfnt.maxp.numGlyphs,e=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((s,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Ks([nt("vmtx")],f.Vmtx);var dn=Object.defineProperty,to=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&dn(t,e,n),n},$e=(i,t,e)=>(to(i,typeof t!="symbol"?t+"":t,e),e);class it extends Ie{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 o=0,s=r/4;o<s;o+=4)o*4<r-4&&(n+=e.getUint32(o*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),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,h=0;const l=o.getDirectories();t.tableViews.forEach((c,p)=>{const y=l[h++];y.tag=p,y.checkSum=this.checksum(c),y.offset=a,y.length=c.byteLength,o.view.writeBytes(c,a),a+=e(y.length)});const u=o.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(it,"signature",new Set([65536,1953658213,1954115633])),we([m("uint32")],it.prototype,"scalerType"),we([m("uint16")],it.prototype,"numTables"),we([m("uint16")],it.prototype,"searchRange"),we([m("uint16")],it.prototype,"entrySelector"),we([m("uint16")],it.prototype,"rangeShift");var eo=Object.defineProperty,ro=(i,t,e)=>t in i?eo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pr=(i,t,e)=>(ro(i,typeof t!="symbol"?t+"":t,e),e);class Be extends it{constructor(){super(...arguments),pr(this,"format","OpenType"),pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}pr(Be,"signature",new Set([1330926671]));var no=Object.defineProperty,ve=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&no(t,e,n),n};class Wt extends Mt{constructor(t,e){super(t,e,20)}}ve([m({type:"char",size:4})],Wt.prototype,"tag"),ve([m("uint32")],Wt.prototype,"offset"),ve([m("uint32")],Wt.prototype,"compLength"),ve([m("uint32")],Wt.prototype,"origLength"),ve([m("uint32")],Wt.prototype,"origChecksum");var gn=Object.defineProperty,io=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&gn(t,e,n),n},ke=(i,t,e)=>(io(i,typeof t!="symbol"?t+"":t,e),e);const gt=class Dr extends Ie{constructor(){super(...arguments),ke(this,"format","WOFF"),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get subfontFormat(){return it.is(this.flavor)?"TrueType":Be.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 o=0,s=0;for(;s<n;)o+=e.getUint32(4*s++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)o+=e.getUint8(h)<<a*8,h++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const y=Gt(bi(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:y.byteLength<c.byteLength?y:c,rawView:c})});const o=n.length,s=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new Dr(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+o*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=Dr.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 Wt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=n+o;return t[r]=o>=s?new DataView(this.view.buffer,n,o):new DataView(Mi(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};ke(gt,"signature",new Set([2001684038])),vt([m("uint32")],gt.prototype,"signature"),vt([m("uint32")],gt.prototype,"flavor"),vt([m("uint32")],gt.prototype,"length"),vt([m("uint16")],gt.prototype,"numTables"),vt([m("uint16")],gt.prototype,"reserved"),vt([m("uint32")],gt.prototype,"totalSfntSize"),vt([m("uint16")],gt.prototype,"majorVersion"),vt([m("uint16")],gt.prototype,"minorVersion"),vt([m("uint32")],gt.prototype,"metaOffset"),vt([m("uint32")],gt.prototype,"metaLength"),vt([m("uint32")],gt.prototype,"metaOrigLength"),vt([m("uint32")],gt.prototype,"privOffset"),vt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function yn(i){if(it.is(i))return new it(i);if(Be.is(i))return new Be(i);if(Ut.is(i))return new Ut(i)}var so=Object.defineProperty,oo=(i,t,e)=>t in i?so(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(oo(i,typeof t!="symbol"?t+"":t,e),e);const mn=class oi{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...oi.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(f,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(f=typeof globalThis<"u"?globalThis:f||self,st(f.modernText={}))})(this,function(f){"use strict";var ya=Object.defineProperty;var ma=(f,st,Tt)=>st in f?ya(f,st,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[st]=Tt;var z=(f,st,Tt)=>ma(f,typeof st!="symbol"?st+"":st,Tt);function st(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:s,stops:a}=ai(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(r,n,o,s);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Tt(i,t,e){i!=null&&i.color&&(i.color=st(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=st(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=st(e,i.textStrokeColor,t))}function ai(i,t,e,r,n){var y;const o=((y=i.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",h=o.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}})}}function Ce(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const o=e.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function Nr(i,t,e){const{left:r,top:n,width:o,height:s}=e,a=i.canvas;a.dataset.viewBox=`${r} ${n} ${o} ${s}`,a.dataset.pixelRatio=String(t);const h=o+Math.abs(r),l=s+Math.abs(n);a.width=Math.max(1,Math.ceil(h*t)),a.height=Math.max(1,Math.ceil(l*t)),a.style.width=`${h}px`,a.style.height=`${l}px`,i.clearRect(0,0,a.width,a.height),i.scale(t,t),i.translate(-r,-n)}function zr(i,t){const{paragraphs:e,computedStyle:r,glyphBox:n}=t;Tt(r,n,i),e.forEach(o=>{Tt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Tt(s.computedStyle,s.inlineBox,i)})})}var ot=Uint8Array,wt=Uint16Array,Ve=Int32Array,Se=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qe=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Er=function(i,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Ve(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},Ur=Er(Se,2),Lr=Ur.b,We=Ur.r;Lr[28]=258,We[258]=28;for(var $r=Er(Pe,0),li=$r.b,Br=$r.r,He=new wt(32768),F=0;F<32768;++F){var $t=(F&43690)>>1|(F&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[F]=(($t&65280)>>8|($t&255)<<8)>>1}for(var It=function(i,t,e){for(var r=i.length,n=0,o=new wt(t);n<r;++n)i[n]&&++o[i[n]-1];var s=new wt(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new wt(1<<t);var h=15-t;for(n=0;n<r;++n)if(i[n])for(var l=n<<4|i[n],u=t-i[n],c=s[i[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[He[c]>>h]=l}else for(a=new wt(r),n=0;n<r;++n)i[n]&&(a[n]=He[s[i[n]-1]++]>>15-i[n]);return a},Bt=new ot(288),F=0;F<144;++F)Bt[F]=8;for(var F=144;F<256;++F)Bt[F]=9;for(var F=256;F<280;++F)Bt[F]=7;for(var F=280;F<288;++F)Bt[F]=8;for(var oe=new ot(32),F=0;F<32;++F)oe[F]=5;var hi=It(Bt,9,0),ci=It(Bt,9,1),ui=It(oe,5,0),fi=It(oe,5,1),Qe=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},Ct=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ye=function(i){return(i+7)/8|0},kr=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new ot(i.subarray(t,e))},pi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],St=function(i,t,e){var r=new Error(t||pi[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},di=function(i,t,e,r){var n=i.length,o=0;if(!n||t.f&&!t.l)return e||new ot(0);var s=!e,a=s||t.i!=2,h=t.i;s&&(e=new ot(n*3));var l=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,p=t.b||0,y=t.l,g=t.d,w=t.m,d=t.n,C=n*8;do{if(!y){u=Ct(i,c,1);var S=Ct(i,c+1,3);if(c+=3,S)if(S==1)y=ci,g=fi,w=9,d=5;else if(S==2){var M=Ct(i,c,31)+257,A=Ct(i,c+10,15)+4,P=M+Ct(i,c+5,31)+1;c+=14;for(var _=new ot(P),U=new ot(19),q=0;q<A;++q)U[qe[q]]=Ct(i,c+q*3,7);c+=A*3;for(var B=Qe(U),mt=(1<<B)-1,D=It(U,B,1),q=0;q<P;){var O=D[Ct(i,c,mt)];c+=O&15;var x=O>>4;if(x<16)_[q++]=x;else{var k=0,$=0;for(x==16?($=3+Ct(i,c,3),c+=2,k=_[q-1]):x==17?($=3+Ct(i,c,7),c+=3):x==18&&($=11+Ct(i,c,127),c+=7);$--;)_[q++]=k}}var J=_.subarray(0,M),W=_.subarray(M);w=Qe(J),d=Qe(W),y=It(J,w,1),g=It(W,d,1)}else St(1);else{var x=Ye(c)+4,T=i[x-4]|i[x-3]<<8,v=x+T;if(v>n){h&&St(0);break}a&&l(p+T),e.set(i.subarray(x,v),p),t.b=p+=T,t.p=c=v*8,t.f=u;continue}if(c>C){h&&St(0);break}}a&&l(p+131072);for(var xt=(1<<w)-1,G=(1<<d)-1,K=c;;K=c){var k=y[Xe(i,c)&xt],j=k>>4;if(c+=k&15,c>C){h&&St(0);break}if(k||St(2),j<256)e[p++]=j;else if(j==256){K=c,y=null;break}else{var R=j-254;if(j>264){var q=j-257,N=Se[q];R=Ct(i,c,(1<<N)-1)+Lr[q],c+=N}var X=g[Xe(i,c)&G],H=X>>4;X||St(3),c+=X&15;var W=li[H];if(H>3){var N=Pe[H];W+=Xe(i,c)&(1<<N)-1,c+=N}if(c>C){h&&St(0);break}a&&l(p+131072);var tt=p+R;if(p<W){var Xt=o-W,Yt=Math.min(W,tt);for(Xt+p<0&&St(3);p<Yt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-W]}}t.l=y,t.p=K,t.b=p,t.f=u,y&&(u=1,t.m=w,t.d=g,t.n=d)}while(!u);return p!=e.length&&s?kr(e,0,p):e.subarray(0,p)},Et=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},ae=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ze=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,o=e.slice();if(!n)return{t:Rr,l:0};if(n==1){var s=new ot(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,M){return v.f-M.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=o[0].s,r=1;r<n;++r)o[r].s>p&&(p=o[r].s);var y=new wt(p+1),g=Ke(e[u-1],y,0);if(g>t){var r=0,w=0,d=g-t,C=1<<d;for(o.sort(function(M,A){return y[A.s]-y[M.s]||M.f-A.f});r<n;++r){var S=o[r].s;if(y[S]>t)w+=C-(1<<g-y[S]),y[S]=t;else break}for(w>>=d;w>0;){var x=o[r].s;y[x]<t?w-=1<<t-y[x]++-1:++r}for(;r>=0&&w;--r){var T=o[r].s;y[T]==t&&(--y[T],++w)}g=t}return{t:new ot(y),l:g}},Ke=function(i,t,e){return i.s==-1?Math.max(Ke(i.l,t,e+1),Ke(i.r,t,e+1)):t[i.s]=e},jr=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new wt(++t),r=0,n=i[0],o=1,s=function(h){e[r++]=h},a=1;a<=t;++a)if(i[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=i[a]}return{c:e.subarray(0,r),n:t}},le=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},Fr=function(i,t,e){var r=e.length,n=Ye(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var o=0;o<r;++o)i[n+o+4]=e[o];return(n+4+r)*8},Gr=function(i,t,e,r,n,o,s,a,h,l,u){Et(t,u++,e),++n[256];for(var c=Ze(n,15),p=c.t,y=c.l,g=Ze(o,15),w=g.t,d=g.l,C=jr(p),S=C.c,x=C.n,T=jr(w),v=T.c,M=T.n,A=new wt(19),P=0;P<S.length;++P)++A[S[P]&31];for(var P=0;P<v.length;++P)++A[v[P]&31];for(var _=Ze(A,7),U=_.t,q=_.l,B=19;B>4&&!U[qe[B-1]];--B);var mt=l+5<<3,D=le(n,Bt)+le(o,oe)+s,O=le(n,p)+le(o,w)+s+14+3*B+le(A,U)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&mt<=D&&mt<=O)return Fr(t,u,i.subarray(h,h+l));var k,$,J,W;if(Et(t,u,1+(O<D)),u+=2,O<D){k=It(p,y,0),$=p,J=It(w,d,0),W=w;var xt=It(U,q,0);Et(t,u,x-257),Et(t,u+5,M-1),Et(t,u+10,B-4),u+=14;for(var P=0;P<B;++P)Et(t,u+3*P,U[qe[P]]);u+=3*B;for(var G=[S,v],K=0;K<2;++K)for(var j=G[K],P=0;P<j.length;++P){var R=j[P]&31;Et(t,u,xt[R]),u+=U[R],R>15&&(Et(t,u,j[P]>>5&127),u+=j[P]>>12)}}else k=hi,$=Bt,J=ui,W=oe;for(var P=0;P<a;++P){var N=r[P];if(N>255){var R=N>>18&31;ae(t,u,k[R+257]),u+=$[R+257],R>7&&(Et(t,u,N>>23&31),u+=Se[R]);var X=N&31;ae(t,u,J[X]),u+=W[X],X>3&&(ae(t,u,N>>5&8191),u+=Pe[X])}else ae(t,u,k[N]),u+=$[N]}return ae(t,u,k[256]),u+$[256]},gi=new Ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Rr=new ot(0),yi=function(i,t,e,r,n,o){var s=o.z||i.length,a=new ot(r+s+5*(1+Math.ceil(s/7e3))+n),h=a.subarray(r,a.length-n),l=o.l,u=(o.r||0)&7;if(t){u&&(h[0]=o.r>>3);for(var c=gi[t-1],p=c>>13,y=c&8191,g=(1<<e)-1,w=o.p||new wt(32768),d=o.h||new wt(g+1),C=Math.ceil(e/3),S=2*C,x=function(se){return(i[se]^i[se+1]<<C^i[se+2]<<S)&g},T=new Ve(25e3),v=new wt(288),M=new wt(32),A=0,P=0,_=o.i||0,U=0,q=o.w||0,B=0;_+2<s;++_){var mt=x(_),D=_&32767,O=d[mt];if(w[D]=O,d[mt]=D,q<=_){var k=s-_;if((A>7e3||U>24576)&&(k>423||!l)){u=Gr(i,h,0,T,v,M,P,U,B,_-B,u),U=A=P=0,B=_;for(var $=0;$<286;++$)v[$]=0;for(var $=0;$<30;++$)M[$]=0}var J=2,W=0,xt=y,G=D-O&32767;if(k>2&&mt==x(_-G))for(var K=Math.min(p,k)-1,j=Math.min(32767,_),R=Math.min(258,k);G<=j&&--xt&&D!=O;){if(i[_+J]==i[_+J-G]){for(var N=0;N<R&&i[_+N]==i[_+N-G];++N);if(N>J){if(J=N,W=G,N>K)break;for(var X=Math.min(G,N-2),H=0,$=0;$<X;++$){var tt=_-G+$&32767,Xt=w[tt],Yt=tt-Xt&32767;Yt>H&&(H=Yt,O=tt)}}}D=O,O=w[D],G+=D-O&32767}if(W){T[U++]=268435456|We[J]<<18|Br[W];var Dt=We[J]&31,Nt=Br[W]&31;P+=Se[Dt]+Pe[Nt],++v[257+Dt],++M[Nt],q=_+J,++A}else T[U++]=i[_],++v[i[_]]}}for(_=Math.max(_,q);_<s;++_)T[U++]=i[_],++v[i[_]];u=Gr(i,h,l,T,v,M,P,U,B,_-B,u),l||(o.r=u&7|h[u/8|0]<<3,u-=7,o.h=d,o.p=w,o.i=_,o.w=q)}else{for(var _=o.w||0;_<s+l;_+=65535){var Lt=_+65535;Lt>=s&&(h[u/8|0]=l,Lt=s),u=Fr(h,u+1,i.subarray(_,Lt))}o.i=s}return kr(a,0,r+Ye(u)+n)},Vr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)n+=r+=e[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},mi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new ot(o.length+i.length);s.set(o),s.set(i,o.length),i=s,n.w=o.length}return yi(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},qr=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},wi=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Vr();n.p(t.dictionary),qr(i,2,n.d())}},vi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function bi(i,t){t||(t={});var e=Vr();e.p(i);var r=mi(i,t,t.dictionary?6:2,4);return wi(r,t),qr(r,r.length-4,e.d()),r}function Mi(i,t){return di(i.subarray(vi(i,t),-4),{i:2},t,t)}var xi=typeof TextDecoder<"u"&&new TextDecoder,Ci=0;try{xi.decode(Rr,{stream:!0}),Ci=1}catch{}const Si="modern-font";function he(i,t){if(!i)throw new Error(`[${Si}] ${t}`)}function Pi(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Gt(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var Wr=Object.defineProperty,_i=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,at=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Wr(t,e,n),n},Ti=(i,t,e)=>(_i(i,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(i,t){Object.defineProperty(i.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(Pi(t),e,r),this.littleEndian=n,Ti(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/,s=>s.toUpperCase())}`,o=this[n](e,r);return this.cursor+=_e[t],o}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 o=0,s=r.length;o<s;o++)n+=String.fromCharCode(r[o]);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 o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,s=this[o](r,e,n);return this.cursor+=_e[t.toLowerCase()],s}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,s;n<o;++n)s=t.charCodeAt(n)||0,s>127?this.writeUint16(s):this.writeUint8(s);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 o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}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 Ii=Object.defineProperty,Oi=(i,t,e)=>t in i?Ii(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ai=(i,t,e)=>(Oi(i,t+"",e),e);const Hr=new WeakMap;function m(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let s=Hr.get(n);s||(s={columns:[],byteLength:0},Hr.set(n,s));const a={...t,name:o,byteLength:e*_e[r],offset:t.offset??s.columns.reduce((h,l)=>h+l.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Ai(this,"view"),this.view=new rt(t,e,r,n)}}function Di(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(i){i=Di(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Ni(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zi(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Ie extends Mt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Qr=Object.defineProperty,Ei=(i,t,e)=>t in i?Qr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ft=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Qr(t,e,n),n},Xr=(i,t,e)=>(Ei(i,typeof t!="symbol"?t+"":t,e),e);const ht=class ri extends Ie{constructor(){super(...arguments),Xr(this,"format","EmbeddedOpenType"),Xr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Te(n.fontFamily||""),s=o.length,a=Te(n.fontStyle||""),h=a.length,l=Te(n.version||""),u=l.length,c=Te(n.fullName||""),p=c.length,y=86+s+4+h+4+u+4+p+2+t.view.byteLength,g=new ri(new ArrayBuffer(y),0,y,!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(s),g.view.writeBytes(o),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([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let Ui=ht;var Li=Object.defineProperty,Oe=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Li(t,e,n),n};class Zt extends Mt{constructor(t,e){super(t,e,16)}}Oe([m({type:"char",size:4})],Zt.prototype,"tag"),Oe([m("uint32")],Zt.prototype,"checkSum"),Oe([m("uint32")],Zt.prototype,"offset"),Oe([m("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],$i=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Bi=Object.defineProperty,ki=(i,t,e)=>t in i?Bi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e)=>(ki(i,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(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={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:h=s}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const y=l[c];y.type==="M"?u.push({type:"M",x:t+y.x*a,y:e+-y.y*h}):y.type==="L"?u.push({type:"L",x:t+y.x*a,y:e+-y.y*h}):y.type==="Q"?u.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="C"?u.push({type:"C",x1:t+y.x1*a,y1:e+-y.y1*h,x2:t+y.x2*a,y2:e+-y.y2*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="Z"&&u.push({type:"Z"})}return u}}class ji extends tr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,y,g;const w=[],d=[];let C=0,S=!1,x=!1,T=s,v=0,M=0;function A(D,O){w.push({type:"L",x:D,y:O})}function P(D,O,k,$,J,W){w.push({type:"C",x1:D,y1:O,x2:k,y2:$,x:J,y:W})}function _(D,O){x&&l!==2&&U(),x=!0,w.push({type:"M",x:D,y:O})}function U(){w.push({type:"Z"})}function q(D){w.push(...D)}function B(){d.length%2!==0&&!S&&(T=d.shift()+o),C+=d.length>>1,d.length=0,S=!0}function mt(D){let O,k,$,J,W,xt,G,K,j,R,N,X,H=0;for(;H<D.length;){let tt=D[H++];switch(tt){case 1:B();break;case 3:B();break;case 4:d.length>1&&!S&&(T=d.shift()+o,S=!0),M+=d.pop(),_(v,M);break;case 5:for(;d.length>0;)v+=d.shift(),M+=d.shift(),A(v,M);break;case 6:for(;d.length>0&&(v+=d.shift(),A(v,M),d.length!==0);)M+=d.shift(),A(v,M);break;case 7:for(;d.length>0&&(M+=d.shift(),A(v,M),d.length!==0);)v+=d.shift(),A(v,M);break;case 8:for(;d.length>0;)c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);break;case 10:W=d.pop()+h,xt=t.subrs[W],xt&&mt(xt);break;case 11:return;case 12:switch(tt=D[H],H+=1,tt){case 35:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g+d.shift(),j=G+d.shift(),R=K+d.shift(),N=j+d.shift(),X=R+d.shift(),v=N+d.shift(),M=X+d.shift(),d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 34:c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g,j=G+d.shift(),R=g,N=j+d.shift(),X=M,v=N+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 36:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g,j=G+d.shift(),R=g,N=j+d.shift(),X=R+d.shift(),v=N+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;case 37:c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),G=y+d.shift(),K=g+d.shift(),j=G+d.shift(),R=K+d.shift(),N=j+d.shift(),X=R+d.shift(),Math.abs(N-v)>Math.abs(X-M)?v=N+d.shift():M=X+d.shift(),P(c,p,y,g,G,K),P(j,R,N,X,v,M);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Je[d.pop()],Yt=Je[d.pop()],Dt=d.pop(),Nt=d.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),se=t.charset.indexOf(Yt);n.components.push({glyphIndex:se,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),q(r.get(se).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ar=0;Ar<Or.length;Ar+=1){const zt=Or[Ar];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}q(Or)}}else d.length>0&&!S&&(T=d.shift()+o,S=!0);x&&l!==2&&(U(),x=!1);break;case 18:B();break;case 19:case 20:B(),H+=C+7>>3;break;case 21:d.length>2&&!S&&(T=d.shift()+o,S=!0),M+=d.pop(),v+=d.pop(),_(v,M);break;case 22:d.length>1&&!S&&(T=d.shift()+o,S=!0),v+=d.pop(),_(v,M);break;case 23:B();break;case 24:for(;d.length>2;)c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);v+=d.shift(),M+=d.shift(),A(v,M);break;case 25:for(;d.length>6;)v+=d.shift(),M+=d.shift(),A(v,M);c=v+d.shift(),p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+d.shift(),P(c,p,y,g,v,M);break;case 26:for(d.length%2&&(v+=d.shift());d.length>0;)c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y,M=g+d.shift(),P(c,p,y,g,v,M);break;case 27:for(d.length%2&&(M+=d.shift());d.length>0;)c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g,P(c,p,y,g,v,M);break;case 28:O=D[H],k=D[H+1],d.push((O<<24|k<<16)>>16),H+=2;break;case 29:W=d.pop()+a,xt=t.gsubrs[W],xt&&mt(xt);break;case 30:for(;d.length>0&&(c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+(d.length===1?d.shift():0),P(c,p,y,g,v,M),d.length!==0);)c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),M=g+d.shift(),v=y+(d.length===1?d.shift():0),P(c,p,y,g,v,M);break;case 31:for(;d.length>0&&(c=v+d.shift(),p=M,y=c+d.shift(),g=p+d.shift(),M=g+d.shift(),v=y+(d.length===1?d.shift():0),P(c,p,y,g,v,M),d.length!==0);)c=v,p=M+d.shift(),y=c+d.shift(),g=p+d.shift(),v=y+d.shift(),M=g+(d.length===1?d.shift():0),P(c,p,y,g,v,M);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(O=D[H],H+=1,d.push((tt-247)*256+O+108)):tt<255?(O=D[H],H+=1,d.push(-(tt-251)*256-O-108)):(O=D[H],k=D[H+1],$=D[H+2],J=D[H+3],H+=4,d.push((O<<24|k<<16|$<<8|J)/65536))}}}mt(e),this.pathCommands=w,S&&(this.advanceWidth=T)}}var Fi=Object.defineProperty,Gi=(i,t,e)=>t in i?Fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ri=(i,t,e)=>(Gi(i,t+"",e),e);class er{constructor(t){this._sfnt=t,Ri(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 o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Vi extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new ji({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Yr=Object.defineProperty,qi=(i,t,e)=>t in i?Yr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Yr(t,e,n),n},Ae=(i,t,e)=>(qi(i,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,s=e+1;o<s;o++){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],s=r+e[t+1]-n;return this._isString?this.view.readString(n,s):this.view.readBytes(n,s)}}Zr([m("uint16")],De.prototype,"count"),Zr([m("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Kr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const Wi=[".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"],Hi=[".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"],Qi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Xi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function ze(i,t){return t<=390?Wi[t]:i[t-391]}var Yi=Object.defineProperty,Zi=(i,t,e)=>t in i?Yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jr=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);function V(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class tn extends Mt{constructor(){super(...arguments),Jr(this,"_dict"),Jr(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 o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=n[s],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,s;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|n<<16|o<<8|s;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 o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ki=Object.defineProperty,rr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ki(t,e,n),n};class Ee extends tn{}rr([V(19)],Ee.prototype,"subrs"),rr([V(20)],Ee.prototype,"defaultWidthX"),rr([V(21)],Ee.prototype,"nominalWidthX");var Ji=Object.defineProperty,Y=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ji(t,e,n),n};class Q extends tn{}Y([V(0,"string")],Q.prototype,"version"),Y([V(1,"string")],Q.prototype,"notice"),Y([V(1200,"string")],Q.prototype,"copyright"),Y([V(2,"string")],Q.prototype,"fullName"),Y([V(3,"string")],Q.prototype,"familyName"),Y([V(4,"string")],Q.prototype,"weight"),Y([V(1201)],Q.prototype,"isFixedPitch"),Y([V(1202)],Q.prototype,"italicAngle"),Y([V(1203,"number",-100)],Q.prototype,"underlinePosition"),Y([V(1204,"number",50)],Q.prototype,"underlineThickness"),Y([V(1205)],Q.prototype,"paintType"),Y([V(1206,"number",2)],Q.prototype,"charstringType"),Y([V(1207,"number[]",[.001,0,0,.001,0,0])],Q.prototype,"fontMatrix"),Y([V(13)],Q.prototype,"uniqueId"),Y([V(5,"number[]",[0,0,0,0])],Q.prototype,"fontBBox"),Y([V(1208)],Q.prototype,"strokeWidth"),Y([V(14)],Q.prototype,"xuid"),Y([V(15)],Q.prototype,"charset"),Y([V(16)],Q.prototype,"encoding"),Y([V(17)],Q.prototype,"charStrings"),Y([V(18,"number[]",[0,0])],Q.prototype,"private");var ts=Object.defineProperty,es=(i,t,e)=>t in i?ts(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nr=(i,t,e)=>(es(i,typeof t!="symbol"?t+"":t,e),e);function nt(i,t=i){return e=>{ue.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const en=class xe{constructor(t){nr(this,"tables",new Map),nr(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,o=Array.from({length:n}),s=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,n,o){var s;return(s=this.charToGlyph(t))==null?void 0:s.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},s){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];s.call(this,u,e,r,n,o),u.advanceWidth&&(e+=u.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};nr(en,"tableDefinitions",new Map);let ue=en;class ct extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var rn=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,ns=(i,t,e)=>t in i?rn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fe=(i,t,e,r)=>{for(var n=r>1?void 0:r?rs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&rn(t,e,n),n},ir=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);f.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 Vi(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 Kr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Kr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new Q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Ee(e,r+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+s+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hi:this.topDict.charset===1?this.charset=Qi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=$i:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let o,s,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(o=0;o<e;o+=1)s=n.readUint16(),h.push(ze(r,s));else if(l===1)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint8(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else if(l===2)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint16(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const o={},s=e.readUint8();if(s===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),o[n]=r}else if(s===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)o[u]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([m("uint8")],f.Cff.prototype,"majorVersion",2),fe([m("uint8")],f.Cff.prototype,"minorVersion",2),fe([m("uint8")],f.Cff.prototype,"headerSize",2),fe([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([nt("CFF ","cff")],f.Cff);var is=Object.defineProperty,Ue=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&is(t,e,n),n};const pe=class ni extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ni;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ue([m("uint16")],pe.prototype,"format"),Ue([m("uint16")],pe.prototype,"length"),Ue([m("uint16")],pe.prototype,"language"),Ue([m({type:"uint8",size:256})],pe.prototype,"glyphIndexArray");let sr=pe;var ss=Object.defineProperty,or=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ss(t,e,n),n};class de extends Mt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,s=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<o[0].firstCode||l>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(l-o[0].firstCode)>=s.length?h=0:(h=s[o[0].idRangeOffset+(l-o[0].firstCode)],h!==0&&(h=h+o[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=o[u].entryCount;c<p;c++)if(o[u].idRangeOffset+c>=s.length?h=0:(h=s[o[u].idRangeOffset+c],h!==0&&(h=h+o[u].idDelta)),h!==0&&h<t){const y=(l<<8|c+o[u].firstCode)%65535;e.set(y,h)}}return e}}or([m("uint16")],de.prototype,"format"),or([m("uint16")],de.prototype,"length"),or([m("uint16")],de.prototype,"language");function nn(i){return i>32767?i-65536:i<-32767?i+65536:i}function ar(i,t){let e;const r=[];let n={};return i.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:s,startId:o,delta:nn(o-s)}):(n.start=Number(s),n.startId=o,n.delta=nn(o-s))),e={unicode:s,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var os=Object.defineProperty,Rt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&os(t,e,n),n};const kt=class ii extends Mt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,s=new ii(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=n,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=o[l];u<=c;++u)if(s[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+s[l]/2+(u-n[l])-r,y=h[p];y!==0?t.set(u,(y+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Rt([m("uint16")],kt.prototype,"format"),Rt([m("uint16")],kt.prototype,"length"),Rt([m("uint16")],kt.prototype,"language"),Rt([m("uint16")],kt.prototype,"segCountX2"),Rt([m("uint16")],kt.prototype,"searchRange"),Rt([m("uint16")],kt.prototype,"entrySelector"),Rt([m("uint16")],kt.prototype,"rangeShift");let lr=kt;var as=Object.defineProperty,ge=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&as(t,e,n),n};class Vt extends Mt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}ge([m("uint16")],Vt.prototype,"format"),ge([m("uint16")],Vt.prototype,"length"),ge([m("uint16")],Vt.prototype,"language"),ge([m("uint16")],Vt.prototype,"firstCode"),ge([m("uint16")],Vt.prototype,"entryCount");var ls=Object.defineProperty,ye=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ls(t,e,n),n};const Kt=class si extends Mt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ar(t),r=new si(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 o=e[r];let s=o.startGlyphCode,a=o.startCharCode;const h=o.endCharCode;for(;a<=h;)t.set(a++,s++)}return t}};ye([m("uint16")],Kt.prototype,"format"),ye([m("uint16")],Kt.prototype,"reserved"),ye([m("uint32")],Kt.prototype,"length"),ye([m("uint32")],Kt.prototype,"language"),ye([m("uint32")],Kt.prototype,"nGroups");let hr=Kt;var hs=Object.defineProperty,cr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&hs(t,e,n),n};class me extends Mt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}cr([m("uint16")],me.prototype,"format"),cr([m("uint32")],me.prototype,"length"),cr([m("uint32")],me.prototype,"numVarSelectorRecords");var sn=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(i,t,e)=>t in i?sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ur=(i,t,e,r)=>{for(var n=r>1?void 0:r?cs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&sn(t,e,n),n},on=(i,t,e)=>(us(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),on(this,"_unicodeToGlyphIndexMap"),on(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=lr.from(t),n=sr.from(t),o=e?hr.from(t):void 0,s=4+(o?32:24),a=s+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((o==null?void 0:o.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,s),u.view.writeBytes(n.view,a),o&&u.view.writeBytes(o.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,o=r.length;n<o;n++){const s=r[n],a=e.get(s);t.has(a)?t.get(a).push(s):t.set(a,[s])}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 sr(this.view.buffer,e.offset);break;case 2:n=new de(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Vt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(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,o=(u=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:u.view,s=(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())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}},ur([m("uint16")],f.Cmap.prototype,"version",2),ur([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([nt("cmap")],f.Cmap);class fs extends tr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return he(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 o=t[n],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(t,e,r,n,o){let s;return(e&n)>0?(s=t.view.readUint8(),e&o||(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}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();he(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;he(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let y,g=0;for(;g<c;)if(y=t.view.readUint8(),p.push(y),g++,y&8&&g<c){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(y),g++}if(he(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let d;if(c>0){for(let x=0;x<c;x+=1)y=p[x],d={},d.onCurve=!!(y&1),d.lastPointOfContour=a.includes(x),w.push(d);let C=0;for(let x=0;x<c;x+=1)y=p[x],d=w[x],d.x=this._parseGlyphCoordinate(t,y,C,2,16),C=d.x;let S=0;for(let x=0;x<c;x+=1)y=p[x],d=w[x],d.y=this._parseGlyphCoordinate(t,y,S,4,32),S=d.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{he(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 y={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],y)[0],y.dx=c.x-p.x,y.dy=c.y-p.y,u=this._transformPoints(l.points,y)}this.points=this.points.concat(u)}}const o=[],s=this._parseContours(this.points);for(let a=0,h=s.length;a<h;++a){const l=s[a];let u=l[l.length-1],c=l[0];u.onCurve?o.push({type:"M",x:u.x,y:u.y}):c.onCurve?o.push({type:"M",x:c.x,y:c.y}):o.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,y=l.length;p<y;++p)if(u=c,c=l[(p+1)%y],u.onCurve)o.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}),o.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}o.push({type:"Z"})}this.pathCommands=o}}class ps extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new fs({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var an=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,gs=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ys=(i,t,e,r)=>{for(var n=r>1?void 0:r?ds(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&an(t,e,n),n},ms=(i,t,e)=>(gs(i,t+"",e),e);const Jt={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};f.Glyf=class extends ct{constructor(){super(...arguments),ms(this,"_glyphs")}static from(t){const e=t.reduce((n,o)=>n+o.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new ps(this._sfnt))}},f.Glyf=ys([nt("glyf")],f.Glyf);var ws=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,bs=(i,t,e,r)=>{for(var n=r>1?void 0:r?vs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ws(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=bs([nt("GPOS","gpos")],f.Gpos);var Ms=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,qt=(i,t,e,r)=>{for(var n=r>1?void 0:r?xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ms(t,e,n),n};f.Gsub=class extends ct{},qt([m("uint16")],f.Gsub.prototype,"majorVersion",2),qt([m("uint16")],f.Gsub.prototype,"minorVersion",2),qt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),qt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),qt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),qt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=qt([nt("GSUB","gsub")],f.Gsub);var Cs=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,et=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ss(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Cs(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],f.Head.prototype,"version",2),et([m("fixed")],f.Head.prototype,"fontRevision",2),et([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],f.Head.prototype,"magickNumber",2),et([m("uint16")],f.Head.prototype,"flags",2),et([m("uint16")],f.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],f.Head.prototype,"created",2),et([m({type:"longDateTime"})],f.Head.prototype,"modified",2),et([m("int16")],f.Head.prototype,"xMin",2),et([m("int16")],f.Head.prototype,"yMin",2),et([m("int16")],f.Head.prototype,"xMax",2),et([m("int16")],f.Head.prototype,"yMax",2),et([m("uint16")],f.Head.prototype,"macStyle",2),et([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([m("int16")],f.Head.prototype,"fontDirectionHint",2),et([m("int16")],f.Head.prototype,"indexToLocFormat",2),et([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var Ps=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ps(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Hhea.prototype,"version",2),pt([m("int16")],f.Hhea.prototype,"ascent",2),pt([m("int16")],f.Hhea.prototype,"descent",2),pt([m("int16")],f.Hhea.prototype,"lineGap",2),pt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var ln=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,Is=(i,t,e)=>t in i?ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Os=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ts(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ln(t,e,n),n},As=(i,t,e)=>(Is(i,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),As(this,"_metrics")}static from(t){const e=t.length*4,r=new f.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((o,s)=>(s<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Os([nt("hmtx")],f.Hmtx);var Ds=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,zs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ns(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ds(t,e,n),n};f.Kern=class extends ct{},f.Kern=zs([nt("kern","kern")],f.Kern);var hn=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,Us=(i,t,e)=>t in i?hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ls=(i,t,e,r)=>{for(var n=r>1?void 0:r?Es(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&hn(t,e,n),n},$s=(i,t,e)=>(Us(i,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),$s(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(o=>{e?n.view.writeUint32(o):n.view.writeUint16(o/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)}},f.Loca=Ls([nt("loca")],f.Loca);var Bs=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,ut=(i,t,e,r)=>{for(var n=r>1?void 0:r?ks(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Bs(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],f.Maxp.prototype,"version",2),ut([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],f.Maxp.prototype,"maxPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxContours",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],f.Maxp.prototype,"maxZones",2),ut([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxStorage",2),ut([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var cn=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Fs=(i,t,e)=>t in i?cn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Le=(i,t,e,r)=>{for(var n=r>1?void 0:r?js(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&cn(t,e,n),n},Gs=(i,t,e)=>(Fs(i,t+"",e),e);const un={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"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Rs={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},fn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Gs(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=fr.Macintosh,o=Rs.Default,s=0;e.some(h=>h.platform===fr.Microsoft&&h.encoding===fn.UCS2&&h.language===1033)&&(n=fr.Microsoft,o=fn.UCS2,s=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===o&&l.language===s&&un[l.nameId]&&(a[un[l.nameId]]=s===0?Ni(l.name):zi(l.name))}return a}},Le([m("uint16")],f.Name.prototype,"format",2),Le([m("uint16")],f.Name.prototype,"count",2),Le([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([nt("name")],f.Name);var Vs=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,I=(i,t,e,r)=>{for(var n=r>1?void 0:r?qs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Vs(t,e,n),n};f.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]}},I([m("uint16")],f.Os2.prototype,"version",2),I([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),I([m("uint16")],f.Os2.prototype,"usWeightClass",2),I([m("uint16")],f.Os2.prototype,"usWidthClass",2),I([m("uint16")],f.Os2.prototype,"fsType",2),I([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),I([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),I([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),I([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),I([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),I([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),I([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),I([m("uint16")],f.Os2.prototype,"sFamilyClass",2),I([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),I([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),I([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),I([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),I([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),I([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),I([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),I([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),I([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),I([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),I([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),I([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),I([m("uint16")],f.Os2.prototype,"fsSelection",2),I([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),I([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),I([m("int16")],f.Os2.prototype,"sTypoAscender",2),I([m("int16")],f.Os2.prototype,"sTypoDescender",2),I([m("int16")],f.Os2.prototype,"sTypoLineGap",2),I([m("uint16")],f.Os2.prototype,"usWinAscent",2),I([m("uint16")],f.Os2.prototype,"usWinDescent",2),I([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),I([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),I([m("int16")],f.Os2.prototype,"sCapHeight",2),I([m("uint16")],f.Os2.prototype,"usDefaultChar",2),I([m("uint16")],f.Os2.prototype,"usBreakChar",2),I([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=I([nt("OS/2","os2")],f.Os2);var Ws=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Ot=(i,t,e,r)=>{for(var n=r>1?void 0:r?Hs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ws(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([m("fixed")],f.Post.prototype,"format",2),Ot([m("fixed")],f.Post.prototype,"italicAngle",2),Ot([m("int16")],f.Post.prototype,"underlinePosition",2),Ot([m("int16")],f.Post.prototype,"underlineThickness",2),Ot([m("uint32")],f.Post.prototype,"isFixedPitch",2),Ot([m("uint32")],f.Post.prototype,"minMemType42",2),Ot([m("uint32")],f.Post.prototype,"maxMemType42",2),Ot([m("uint32")],f.Post.prototype,"minMemType1",2),Ot([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=Ot([nt("post")],f.Post);var Qs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,dt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Qs(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],f.Vhea.prototype,"version",2),dt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([m("int16")],f.Vhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var pn=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Zs=(i,t,e)=>t in i?pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ks=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ys(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&pn(t,e,n),n},Js=(i,t,e)=>(Zs(i,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Js(this,"_metrics")}static from(t){const e=t.length*4,r=new f.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 o;const t=this._sfnt.maxp.numGlyphs,e=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((s,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Ks([nt("vmtx")],f.Vmtx);var dn=Object.defineProperty,to=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&dn(t,e,n),n},$e=(i,t,e)=>(to(i,typeof t!="symbol"?t+"":t,e),e);class it extends Ie{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 o=0,s=r/4;o<s;o+=4)o*4<r-4&&(n+=e.getUint32(o*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),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,h=0;const l=o.getDirectories();t.tableViews.forEach((c,p)=>{const y=l[h++];y.tag=p,y.checkSum=this.checksum(c),y.offset=a,y.length=c.byteLength,o.view.writeBytes(c,a),a+=e(y.length)});const u=o.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(it,"signature",new Set([65536,1953658213,1954115633])),we([m("uint32")],it.prototype,"scalerType"),we([m("uint16")],it.prototype,"numTables"),we([m("uint16")],it.prototype,"searchRange"),we([m("uint16")],it.prototype,"entrySelector"),we([m("uint16")],it.prototype,"rangeShift");var eo=Object.defineProperty,ro=(i,t,e)=>t in i?eo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pr=(i,t,e)=>(ro(i,typeof t!="symbol"?t+"":t,e),e);class Be extends it{constructor(){super(...arguments),pr(this,"format","OpenType"),pr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}pr(Be,"signature",new Set([1330926671]));var no=Object.defineProperty,ve=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&no(t,e,n),n};class Wt extends Mt{constructor(t,e){super(t,e,20)}}ve([m({type:"char",size:4})],Wt.prototype,"tag"),ve([m("uint32")],Wt.prototype,"offset"),ve([m("uint32")],Wt.prototype,"compLength"),ve([m("uint32")],Wt.prototype,"origLength"),ve([m("uint32")],Wt.prototype,"origChecksum");var gn=Object.defineProperty,io=(i,t,e)=>t in i?gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&gn(t,e,n),n},ke=(i,t,e)=>(io(i,typeof t!="symbol"?t+"":t,e),e);const gt=class Dr extends Ie{constructor(){super(...arguments),ke(this,"format","WOFF"),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get subfontFormat(){return it.is(this.flavor)?"TrueType":Be.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 o=0,s=0;for(;s<n;)o+=e.getUint32(4*s++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)o+=e.getUint8(h)<<a*8,h++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const y=Gt(bi(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:y.byteLength<c.byteLength?y:c,rawView:c})});const o=n.length,s=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new Dr(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+o*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=Dr.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 Wt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=n+o;return t[r]=o>=s?new DataView(this.view.buffer,n,o):new DataView(Mi(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};ke(gt,"signature",new Set([2001684038])),vt([m("uint32")],gt.prototype,"signature"),vt([m("uint32")],gt.prototype,"flavor"),vt([m("uint32")],gt.prototype,"length"),vt([m("uint16")],gt.prototype,"numTables"),vt([m("uint16")],gt.prototype,"reserved"),vt([m("uint32")],gt.prototype,"totalSfntSize"),vt([m("uint16")],gt.prototype,"majorVersion"),vt([m("uint16")],gt.prototype,"minorVersion"),vt([m("uint32")],gt.prototype,"metaOffset"),vt([m("uint32")],gt.prototype,"metaLength"),vt([m("uint32")],gt.prototype,"metaOrigLength"),vt([m("uint32")],gt.prototype,"privOffset"),vt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function yn(i){if(it.is(i))return new it(i);if(Be.is(i))return new Be(i);if(Ut.is(i))return new Ut(i)}var so=Object.defineProperty,oo=(i,t,e)=>t in i?so(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(oo(i,typeof t!="symbol"?t+"":t,e),e);const mn=class oi{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...oi.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:o=!0,...s}=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,s),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:yn(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),o&&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)})}};be(mn,"defaultRequestInit",{cache:"force-cache"});let wn=mn;const vn=new wn;function bn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:o,glyf:s}=i,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=o==null?void 0:o.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;c.forEach(w=>{const d=a.get(w)??0;let C=p.get(d);C||p.set(d,C=new Set),C.add(w)});const y=[],g=w=>{const d=l[w],C=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},S=h[w],x=h[w+1]??S,T={...d,...C,rawGlyphIndex:w,glyphIndex:y.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(s.view.buffer,s.view.byteOffset+S,x-S)};return y.push(T),T};return g(0),c.forEach(w=>g(a.get(w))),y.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let S=10,x;do{x=d.getUint16(S);const T=S+2,v=d.getUint16(T);S+=4,Jt.ARG_1_AND_2_ARE_WORDS&x?S+=4:S+=2,Jt.WE_HAVE_A_SCALE&x?S+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&x?S+=4:Jt.WE_HAVE_A_TWO_BY_TWO&x&&(S+=8);const M=g(v);d.setUint16(T,M.glyphIndex)}while(Jt.MORE_COMPONENTS&x)}),y}function Mn(i,t){const e=bn(i,t),r=e.length,{head:n,maxp:o,hhea:s,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,o.numGlyphs=r;let h=0;i.loca=f.Loca.from([...e.map(p=>{const y=h;return h+=p.view.byteLength,y}),h],n.indexToLocFormat);const l=e.reduce((p,y,g)=>(y.unicodes.forEach(w=>p.set(w,g)),p),new Map);i.cmap=f.Cmap.from(l),i.glyf=f.Glyf.from(e.map(p=>p.view)),s.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const c=new f.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,i.post=c,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ao(i,t){let e,r;if(i instanceof it)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const o=Gt(i);if(it.is(o))e=new it(o).sfnt,r="ttf-buffer";else if(Ut.is(o))e=new Ut(o).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=Mn(e,t);switch(r){case"ttf":return it.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return it.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function dr(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(h),i.lineDashOffset=l,i.shadowOffsetX=u,i.shadowOffsetY=c,i.shadowBlur=p,i.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*s),e.y-(n*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class U{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new U;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.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 U(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new U(this.left,this.top,this.width,this.height)}}var ho=Object.defineProperty,co=(i,t,e)=>t in i?ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,uo=(i,t,e)=>(co(i,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,o=1,s=0,a=0,h=0,l=1){uo(this,"elements",[]),this.set(t,e,r,n,o,s,a,h,l)}set(t,e,r,n,o,s,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=o,u[5]=h,u[6]=r,u[7]=s,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,o=this.elements,s=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],y=r[5],g=r[8],w=n[0],d=n[3],C=n[6],S=n[1],x=n[4],T=n[7],v=n[2],M=n[5],A=n[8];return o[0]=s*w+a*S+h*v,o[3]=s*d+a*x+h*M,o[6]=s*C+a*T+h*A,o[1]=l*w+u*S+c*v,o[4]=l*d+u*x+c*M,o[7]=l*C+u*T+c*A,o[2]=p*w+y*S+g*v,o[5]=p*d+y*x+g*M,o[8]=p*C+y*T+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*s-a*l,p=a*h-u*o,y=l*o-s*h,g=e*c+r*p+n*y;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*s)*w,t[3]=p*w,t[4]=(u*e-n*h)*w,t[5]=(n*o-a*e)*w,t[6]=y*w,t[7]=(r*h-l*e)*w,t[8]=(s*e-r*o)*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(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.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 gr=new yt;function xn(i,t,e,r){const n=i*e+t*r,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/o)));return i*r-t*e<0&&(s=-s),s}function Cn(i,t,e,r,n,o,s,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(s.x-a.x)/2,l=(s.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,y=e*e;const g=u*u,w=c*c,d=g/p+w/y;if(d>1){const z=Math.sqrt(d);t=z*t,e=z*e,p=t*t,y=e*e}const C=p*w+y*g,S=(p*y-C)/C;let x=Math.sqrt(Math.max(0,S));n===o&&(x=-x);const T=x*t*c/e,v=-x*e*u/t,M=Math.cos(r)*T-Math.sin(r)*v+(s.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*v+(s.y+a.y)/2,P=xn(1,0,(u-T)/t,(c-v)/e),_=xn((u-T)/t,(c-v)/e,(-u-T)/t,(-c-v)/e)%(Math.PI*2);i.ellipse(M,A,t,e,r,P,P+_,o===1)}function te(i,t){return i-(t-i)}function yr(i,t){const e=new b,r=new b;for(let n=0,o=i.length;n<o;n++){const s=i[n];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=te(e.x,r.x),h=te(e.y,r.y);r.x=a,r.y=h,s.type==="t"?(t.quadraticCurveTo(a,h,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,h,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),Cn(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(i,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(d,C,S){const x=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw x.partial=S,x}function y(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=i.length;for(let d=0;d<w;d++){if(g=i[d],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,y();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&&p(g,d,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])&&p(g,d,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]==="."&&p(g,d,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)&&p(g,d,c)}}Z.WHITESPACE.test(g)?(y(),a=0,h=!1):Z.COMMA.test(g)?(y(),a=0,h=!0):Z.SIGN.test(g)?(y(),a=1,l=g):Z.POINT.test(g)?(y(),a=2,l=g):p(g,d,c)}return y(),c}function Sn(i){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=i.length;n<o;n++){const s=i[n];switch(s.type){case"m":case"M":if(s.x===e.x&&s.y===e.y)continue;r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y,t.x=s.x,t.y=s.y;break;case"h":case"H":r+=`${s.type} ${s.x}`,e.x=s.x;break;case"v":case"V":r+=`${s.type} ${s.y}`,e.y=s.y;break;case"l":case"L":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"c":case"C":r+=`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"s":case"S":r+=`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"q":case"Q":r+=`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"t":case"T":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"a":case"A":r+=`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"z":case"Z":r+=s.type,e.x=t.x,e.y=t.y;break}}return r}const fo=/[a-df-z][^a-df-z]*/gi;function mr(i){const t=[],e=i.match(fo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let h;switch(s){case"m":case"M":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:s,x:h[l],y:h[l+1]}):t.push({type:s==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:s,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:s,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:s,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:s,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:s,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:s,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:s});break;default:console.warn(o)}}return t}var po=Object.defineProperty,go=(i,t,e)=>t in i?po(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wr=(i,t,e)=>(go(i,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new b){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let s=1;s<=t;s++)r=this.getPoint(s/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let s;e?s=e:s=t*r[o-1];let a=0,h=o-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-s,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===s)return n/(o-1);const u=r[n],p=r[n+1]-u,y=(s-u)/p;return(n+y)/(o-1)}getTangent(t,e=new b){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new b){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new U(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return Sn(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new b){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new b){const{start:r,end:n}=this,o=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(o),Math.sin(o))}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Pn(i,t,e,r,n){const o=(r-t)*.5,s=(n-e)*.5,a=i*i,h=i*a;return(2*e-2*r+o+s)*h+(-3*e+3*r-2*o-s)*a+o*i+e}function yo(i,t){const e=1-i;return e*e*t}function mo(i,t){return 2*(1-i)*i*t}function wo(i,t){return i*i*t}function _n(i,t,e,r){return yo(i,t)+mo(i,e)+wo(i,r)}function vo(i,t){const e=1-i;return e*e*e*t}function bo(i,t){const e=1-i;return 3*e*e*i*t}function Mo(i,t){return 3*(1-i)*i*i*t}function xo(i,t){return i*i*i*t}function Tn(i,t,e,r,n){return vo(i,t)+bo(i,e)+Mo(i,r)+xo(i,n)}class In extends _t{constructor(t=new b,e=new b,r=new b,n=new b){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new b){const{start:r,startControl:n,endControl:o,end:s}=this;return e.set(Tn(t,r.x,n.x,o.x,s.x),Tn(t,r.y,n.y,o.y,s.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(h=>h>=0&&h<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(s.x-o.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(s.y-o.y)),l=[0,1,...a,...h];return((c,p)=>{for(const y of c)for(let g=0;g<=p;g++){const w=g/p-.5,d=Math.min(1,Math.max(0,y+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Co=new yt,On=new yt,An=new yt,Fe=new b;class Dn extends _t{constructor(t=new b,e=1,r=1,n=0,o=0,s=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=s,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const s=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(s),h=this.center.y+this.radiusY*Math.sin(s);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)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:s,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-o),y=p>Math.PI?1:0,g=s?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),S=l+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:C,y:S},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const d=h+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),C=l+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:y,sweepFlag:g,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:s,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,o,s,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,_o(t)?So(this,t):Po(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:s}=this,{x:a,y:h}=r,l=Math.cos(s),u=Math.sin(s),c=Math.sqrt(n*n*l*l+o*o*u*u),p=Math.sqrt(n*n*u*u+o*o*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 So(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new b(e*n,e*o),a=new b(-r*o,r*n),h=s.applyMatrix3(t),l=a.applyMatrix3(t),u=Co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=On.copy(u).invert(),g=An.copy(c).transpose().multiply(c).elements,w=To(g[0],g[1],g[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(i.radiusX=1/d,i.radiusY=1/C,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(d,0,0,0,C,0,0,0,1),T=An.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(u),M=A=>{const{x:P,y:_}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(_,P)};i.startAngle=M(i.startAngle),i.endAngle=M(i.endAngle),Nn(t)&&(i.clockwise=!i.clockwise)}}function Po(i,t){const e=zn(t),r=En(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,Nn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Nn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function _o(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=zn(i),n=En(i);return Math.abs(e/(r*n))>Number.EPSILON}function zn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function To(i,t,e){let r,n,o,s,a;const h=i+e,l=i-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=i*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?o=l+u:o=l-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),l>0&&(a=o,o=-s,s=a),{rt1:r,rt2:n,cs:o,sn:s}}class Ht extends _t{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}var Io=Object.defineProperty,Oo=(i,t,e)=>t in i?Io(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ao=(i,t,e)=>(Oo(i,t+"",e),e);class Do extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Ao(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new b(t+.5*this.size,e-.5*this.size),n=new b(t-.5*this.size,e-.5*this.size),o=new b(t,e+.5*this.size),s=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new je(o,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new b(t,e+this.size),u=new b(t+this.size,e),c=new b().lerpVectors(u,l,.75),p=new b(t-this.size,e),y=new b().lerpVectors(p,l,.75),g=new Ht(u,c),w=new Ht(y,p);return this.curves=[s,g,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}var No=Object.defineProperty,zo=(i,t,e)=>t in i?No(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vr=(i,t,e)=>(zo(i,typeof t!="symbol"?t+"":t,e),e);class Eo extends _t{constructor(t,e=0,r=0,n=0,o=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=o,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new b(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Un extends _t{constructor(t=new b,e=new b,r=new b){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new b){const{start:r,control:n,end:o}=this;return e.set(_n(t,r.x,n.x,o.x),_n(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,control:n,end:o}=this,s=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+o.x),l=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,s,h),t.y=Math.min(t.y,r.y,o.y,a,l),e.x=Math.max(e.x,r.x,o.x,s,h),e.y=Math.max(e.y,r.y,o.y,a,l),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Uo=Object.defineProperty,Lo=(i,t,e)=>t in i?Uo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ln=(i,t,e)=>(Lo(i,typeof t!="symbol"?t+"":t,e),e);class $n extends _t{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,Ln(this,"curves",[]),Ln(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,o=[new b(t-r,e-n),new b(t+r,e-n),new b(t+r,e+n),new b(t-r,e+n)];for(let s=0;s<4;s++)this.curves.push(new Ht(o[s].clone(),o[(s+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Bn extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),s=n-o,a=r[o===0?o:o-1],h=r[o],l=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(Pn(s,a.x,h.x,l.x,u.x),Pn(s,a.y,h.y,l.y,u.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,Bo=(i,t,e)=>t in i?$o(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>(Bo(i,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new b),Me(this,"autoClose",!1),Me(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:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}getPoint(t,e=new b){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const s=n[o]-r,a=this.curves[o],h=a.getLength();return a.getPointAt(h===0?0:1-s/h,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,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 o=0,s=r.length;o<s;o++){const h=r[o].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 Ht(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Ht(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPoint.equals({x:o,y:s})||this.curves.push(new In(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,s))),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Un(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,s){return this.ellipse(t,e,r,r,0,n,o,s),this}relativeArc(t,e,r,n,o,s){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,s),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,s,a,h=!0){const l=new Dn(new b(t,e),r,n,o,s,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,o,s,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,o,s,a,h),this}rect(t,e,r,n){return this.curves.push(new $n(new b(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Bn([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new U(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function ko(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(i,t,e,r){const n=t.clone().sub(i),o=r.clone().sub(e),s=e.clone().sub(i),a=n.cross(o);if(a===0)return new b((i.x+e.x)/2,(i.y+e.y)/2);const h=s.cross(o)/a;return Math.abs(h)>1?new b((i.x+e.x)/2,(i.y+e.y)/2):new b(i.x+h*n.x,i.y+h*n.y)}var Fo=Object.defineProperty,Go=(i,t,e)=>t in i?Fo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,br=(i,t,e)=>(Go(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(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 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,o,s){return this.currentPath.bezierCurveTo(t,e,r,n,o,s),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,s){return this.currentPath.arc(t,e,r,n,o,s),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,s,a,h){return this.currentPath.ellipse(t,e,r,n,o,s,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,h)=>{const l=a.getControlPoints(),u=a.isClockwise();o[h]=l,n[h]=u;const c=l[0],p=l[l.length-1]??c;r.push({start:u?p:c,end:u?c:p,index:h})});const s=[];return r.forEach((a,h)=>{s[h]=[],r.forEach((l,u)=>{u!==h&&l.start.equals(a.end)&&s[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];o[h].forEach(c=>{const p=a.getTForPoint(c),y=a.getNormal(p).scale(l?t:-t);c.add(y)})}),s.forEach((a,h)=>{const l=o[h];a.forEach(u=>{const c=o[u],p=jo(l[l.length-1],l[l.length-2]??l[l.length-1],c[0],c[1]??c[0]);p&&(l[l.length-1].copy(p),c[0].copy(p))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=b.MAX,e=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const s=n/2,a=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivisions){const u=o.getPoint(l),c=o.getNormal(l),p=c.clone().scale(a?s:-s),y=c.clone().scale(a?-s:s);h.push(u.clone().add(p),u.clone().add(y),u.clone().add({x:s,y:0}),u.clone().add({x:-s,y:0}),u.clone().add({x:0,y:s}),u.clone().add({x:0,y:-s}),u.clone().add({x:s,y:s}),u.clone().add({x:-s,y:-s}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new U(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),dr(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),dr(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[ko(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),this.drawTo(l,r)),h}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Mr="px",kn=90,jn=["mm","cm","in","pt","pc","px"],xr={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 L(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=jn.length;r<n;r++){const o=jn[r];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(i)}const Ro=new yt,Ge=new yt,Fn=new yt,Gn=new yt;function Vo(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=qo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function qo(i){const t=new yt,e=Ro;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(L(i.getAttribute("x")),L(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const h=o.slice(0,s),l=Pt(o.slice(s+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]),Ge.makeTranslation(-c,-p),Fn.makeRotation(u),Gn.multiplyMatrices(Fn,Ge),Ge.makeTranslation(c,p),e.multiplyMatrices(Ge,Gn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Wo(i){return new bt().addPath(new ee().arc(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("r")||0),0,Math.PI*2))}function Ho(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const h=r.style.item(a);o[h]=r.style.getPropertyValue(h)}for(let s=0;s<n.length;s++)t[n[s]]=Object.assign(t[n[s]]||{},{...o})}}function Qo(i){return new bt().addPath(new ee().ellipse(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("rx")||0),L(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(i){return new bt().moveTo(L(i.getAttribute("x1")||0),L(i.getAttribute("y1")||0)).lineTo(L(i.getAttribute("x2")||0),L(i.getAttribute("y2")||0))}function Yo(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Zo,(n,o,s)=>{const a=L(o),h=L(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Jo,(n,o,s)=>{const a=L(o),h=L(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ea(i){const t=L(i.getAttribute("x")||0),e=L(i.getAttribute("y")||0),r=L(i.getAttribute("rx")||i.getAttribute("ry")||0),n=L(i.getAttribute("ry")||i.getAttribute("rx")||0),o=L(i.getAttribute("width")),s=L(i.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+o-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),h.lineTo(t+o,e+s-n),(r!==0||n!==0)&&h.bezierCurveTo(t+o,e+s-n*a,t+o-r*a,e+s,t+o-r,e+s),h.lineTo(t+r,e+s),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+s,t,e+s-n*a,t,e+s-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(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const l=i.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<l.length;u++)r=Object.assign(r,e[`.${l[u]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));for(let l=i.style.length,u=0;u<l;u++){const c=i.style.item(u),p=i.style.getPropertyValue(c);t[c]=p,r[c]=p}function n(l,u,c=o){i.hasAttribute(l)&&(t[u]=c(i.getAttribute(l))),r[l]&&(t[u]=c(r[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function s(l){return Math.max(0,Math.min(1,L(l)))}function a(l){return Math.max(0,L(l))}function h(l){return l.split(" ").filter(u=>u!=="").map(u=>L(u))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",h),n("stroke-dashoffset","strokeDashoffset",L),n("visibility","visibility"),t}function Cr(i,t,e=[],r={}){var c;if(i.nodeType!==1)return e;let n=!1,o=null,s={...t};switch(i.nodeName){case"svg":s=At(i,s,r);break;case"style":Ho(i,r);break;case"g":s=At(i,s,r);break;case"path":s=At(i,s,r),i.hasAttribute("d")&&(o=Yo(i));break;case"rect":s=At(i,s,r),o=ea(i);break;case"polygon":s=At(i,s,r),o=Ko(i);break;case"polyline":s=At(i,s,r),o=ta(i);break;case"circle":s=At(i,s,r),o=Wo(i);break;case"ellipse":s=At(i,s,r),o=Qo(i);break;case"line":s=At(i,s,r),o=Xo(i);break;case"defs":n=!0;break;case"use":{s=At(i,s,r);const y=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(c=i.viewportElement)==null?void 0:c.getElementById(y);g?Cr(g,s,e,r):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}if(s.display==="none")return e;Object.assign(t,s);const a=new yt,h=[],l=Vo(i,a,h);o&&(o.matrix(a),e.push(o),o.style=t);const u=i.childNodes;for(let p=0,y=u.length;p<y;p++){const g=u[p];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Cr(g,t,e,r)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Rn="data:image/svg+xml;",Vn=`${Rn}base64,`,qn=`${Rn}charset=utf8,`;function Wn(i){if(typeof i=="string"){let t;return i.startsWith(Vn)?(i=i.substring(Vn.length,i.length),t=atob(i)):i.startsWith(qn)?(i=i.substring(qn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Sr(i){return Cr(Wn(i),{})}function Qt(i,t=!0){if(!i.length)return;const e=b.MAX,r=b.MIN;return i.forEach(n=>n.getMinMax(e,r,t)),new U(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(i){const{x:t,y:e,width:r,height:n}=Qt(i),o=i.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}function ra(i){return`data:image/svg+xml;base64,${btoa(Pr(i))}`}function na(i){return new DOMParser().parseFromString(Pr(i),"image/svg+xml").documentElement}function ia(i,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=Qt(i),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),i.forEach(u=>{u.drawTo(l,r)})),h}const sa=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Hn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){E(this,"lineBox",new U);E(this,"inlineBox",new U);E(this,"glyphBox");E(this,"underlinePosition",0);E(this,"underlineThickness",0);E(this,"yStrikeoutPosition",0);E(this,"yStrikeoutSize",0);E(this,"baseline",0);E(this,"centerDiviation",0);E(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_font(){var e;const t=(e=vn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof it)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:s}=t,{content:a,computedStyle:h}=this,{fontSize:l}=h,u=e/l,c=t.getAdvanceWidth(a,l),p=(r+Math.abs(n))/u,y=r/u,g=(r-o.yStrikeoutPosition)/u,w=o.yStrikeoutSize/u,d=(r-s.underlinePosition)/u,C=s.underlineThickness/u;return this.inlineBox.width=c,this.inlineBox.height=p,this.underlinePosition=d,this.underlineThickness=C,this.yStrikeoutPosition=g,this.yStrikeoutSize=w,this.baseline=y,this.centerDiviation=p/2-y,this}updatePath(){const t=this._font();if(!t)return this;this.updateGlyph(t);const{isVertical:e,content:r,computedStyle:n,baseline:o,inlineBox:s}=this,{os2:a,head:h,ascender:l,descender:u}=t,c=a.sTypoAscender,p=aa[a.fsSelection]??la[h.macStyle],{left:y,top:g}=s,w=n.fontStyle==="italic"&&p!=="italic";let d=y,C=g+o,S;const x=new bt;if(e&&(d+=(s.height-s.width)/2,Math.abs(s.width-s.height)>.1&&(C-=(l-c)/(l+Math.abs(u))*s.height),S=void 0),e&&!sa.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){x.addCommands(t.getPathCommands(r,d,g+o-(s.height-s.width)/2,n.fontSize)??[]);const v={y:g-(s.height-s.width)/2+s.height/2,x:d+s.width/2};w&&this._italic(x,e?{x:v.x,y:g-(s.height-s.width)/2+o}:void 0),x.rotate(90,v)}else S!==void 0?(x.addCommands(t.glyphs.get(S).getPathCommands(d,C,n.fontSize)),w&&this._italic(x,e?{x:d+s.width/2,y:g+c/(l+Math.abs(u))*s.height}:void 0)):(x.addCommands(t.getPathCommands(r,d,C,n.fontSize)??[]),w&&this._italic(x,e?{x:d+s.height/2,y:C}:void 0));x.addCommands(this._decoration());const T=n.fontWeight??400;return T in Hn&&(T===700||T==="bold")&&p!=="bold"&&x.bold(Hn[T]*n.fontSize*.05),x.style={fill:n.color,stroke:n.textStrokeWidth?n.textStrokeColor:"none",strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize*.03:0},this.path=x,this.glyphBox=this.getGlyphBoundingBox(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:s,top:a,width:h,height:l}=this.inlineBox,u=.1*o;let c;switch(n){case"underline":t?c=s:c=a+e;break;case"line-through":t?c=s+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:s,y:c},{type:"L",x:s+h,y:c},{type:"L",x:s+h,y:c+u},{type:"L",x:s,y:c+u},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:n}=e;return new U(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(i){return!i||i==="none"}function Re(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}class Xn{constructor(t,e={},r){E(this,"inlineBox",new U);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){E(this,"lineBox",new U);E(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(s=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(s.style)),s.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),/\s/.test(h.content)&&(l.style.whiteSpace="pre"),a.appendChild(l)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var s;return(s=n.parentNode)==null?void 0:s.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((h,l)=>{var p;const u=h.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const y=document.createRange();y.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){y.setStart(c,Math.max(w-1,0)),y.setEnd(c,w);const d=((p=y.getClientRects)==null?void 0:p.call(y))??[y.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const S=y.toString();S!==""&&C&&C.width+C.height!==0&&n.push({content:S,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const h=e[a.paragraphIndex];h.lineBox.left=a.left-r.left,h.lineBox.top=a.top-r.top,h.lineBox.width=a.width,h.lineBox.height=a.height}),n.fragments.forEach(a=>{const h=e[a.paragraphIndex].fragments[a.fragmentIndex];h.inlineBox.left=a.left-r.left,h.inlineBox.top=a.top-r.top,h.inlineBox.width=a.width,h.inlineBox.height=a.height});const o=[];let s=0;return n.characters.forEach(a=>{const{paragraphIndex:h,fragmentIndex:l,characterIndex:u}=a;o.push({...a,newParagraphIndex:h,left:a.left-r.left,top:a.top-r.top});const c=e[h].fragments[l].characters[u],p=o[s];c.inlineBox.left=p.left,c.inlineBox.top=p.top,c.inlineBox.width=p.width,c.inlineBox.height=p.height;const y=c.fontHeight;c.lineBox.left=p.left,c.lineBox.top=p.top+(p.height-y)/2,c.lineBox.height=y,c.lineBox.width=p.width,s++}),{paragraphs:e,boundingBox:new U(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 Zn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new ne({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ne({},e);n.forEach(s=>{if(typeof s=="string")o.addFragment(s);else{const{content:a,...h}=s;a!==void 0&&o.addFragment(a,h)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...s}=n,a=new ne(s,e);o.forEach(h=>{const{content:l,...u}=h;l!==void 0&&a.addFragment(l,u)}),r.push(a)}else if("content"in n){const{content:o,...s}=n;if(o!==void 0){const a=new ne(s,e);a.addFragment(o),r.push(a)}}}return r}}function ha(i){return i}const ca="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ua(i,t,e){if(i==="cover")return 0;if(typeof i=="string")if(i.endsWith("%")){const r=Number(i.substring(0,i.length-1))/100;return Math.ceil(r*e/t)}else return i.endsWith("rem")?Number(i.substring(0,i.length-3)):Math.ceil(Number(i)/t);else return Math.ceil(i/t)}function fa(i,t,e){return typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function pa(i,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.center.add(i.center.sub(t.center).scale(n.x,n.y)).sub({x:i.width/2*n.x,y:i.height/2*n.y}),s=new yt;return s.translate(-i.left,-i.top),r&&(s.translate(-i.width/2,-i.height/2),s.rotate(Math.PI/2),s.translate(i.width/2,i.height/2)),s.scale(n.x,n.y),s.translate(o.x,o.y),s}function Kn(){const i=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Sr(n),e.set(n,o)),o}return{name:"highlight",paths:i,update:n=>{i.length=0;const{characters:o}=n;let s;const a=[];let h;o.forEach(l=>{const{isVertical:u,computedStyle:c}=l;!re(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===c.highlightImage&&(h==null?void 0:h.highlightSize)===c.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===c.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===c.highlightOverflow&&(s!=null&&s.length)&&(u?s[0].inlineBox.left===l.inlineBox.left:s[0].inlineBox.top===l.inlineBox.top)&&s[0].fontSize===l.fontSize?s.push(l):(s=[],s.push(l),a.push(s))),h=c}),a.filter(l=>l.length).map(l=>{const u=l[0];return{style:u.computedStyle,baseline:u.baseline,box:U.from(...l.map(c=>c.glyphBox))}}).forEach(l=>{const{style:u,box:c,baseline:p}=l,{fontSize:y,writingMode:g}=u,w=g.includes("vertical"),d=fa(u.highlightStrokeWidth,y,c.width),C=ua(u.highlightSize,y,c.width),S=re(u.highlightOverflow)?C?"hidden":"visible":u.highlightOverflow,x=r(re(u.highlightReferImage)?ca:u.highlightReferImage),T=r(u.highlightImage),v=Qt(T,!0),M=Qt(x,!1),A=C?y*C:w?c.height:c.width,P=p*.8,_=pa(v,M,new U(c.left,c.top,w?P:A,w?A:P),w),z=y/v.width*2,q=Math.ceil(c.width/A);for(let B=0;B<q;B++){const mt=_.clone().translate(B*A,0);T.forEach(D=>{const O=D.clone().matrix(mt);O.style.strokeWidth&&(O.style.strokeWidth*=z*d),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=z),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=z),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(k=>k*z)),i.push(O),t[i.length-1]=S==="hidden"?new U(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{i.forEach((s,a)=>{Ce({ctx:n,path:s,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Jn(i,t,e){return i==="cover"?1:typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ti(){const i=[];return{name:"listStyle",paths:i,update:t=>{i.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(s=>{const{computedStyle:a}=s;let h=a.listStyleSize,l;if(!re(a.listStyleImage))l=a.listStyleImage;else if(!re(a.listStyleType)){const g=n*.38/2;switch(h=h==="cover"?g*2:h,a.listStyleType){case"disc":l=`<svg width="${g*2}" height="${g*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...s}=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,s),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:yn(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),o&&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)})}};be(mn,"defaultRequestInit",{cache:"force-cache"});let wn=mn;const vn=new wn;function bn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:o,glyf:s}=i,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=o==null?void 0:o.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;c.forEach(w=>{const d=a.get(w)??0;let C=p.get(d);C||p.set(d,C=new Set),C.add(w)});const y=[],g=w=>{const d=l[w],C=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},S=h[w],x=h[w+1]??S,T={...d,...C,rawGlyphIndex:w,glyphIndex:y.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(s.view.buffer,s.view.byteOffset+S,x-S)};return y.push(T),T};return g(0),c.forEach(w=>g(a.get(w))),y.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let S=10,x;do{x=d.getUint16(S);const T=S+2,v=d.getUint16(T);S+=4,Jt.ARG_1_AND_2_ARE_WORDS&x?S+=4:S+=2,Jt.WE_HAVE_A_SCALE&x?S+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&x?S+=4:Jt.WE_HAVE_A_TWO_BY_TWO&x&&(S+=8);const M=g(v);d.setUint16(T,M.glyphIndex)}while(Jt.MORE_COMPONENTS&x)}),y}function Mn(i,t){const e=bn(i,t),r=e.length,{head:n,maxp:o,hhea:s,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,o.numGlyphs=r;let h=0;i.loca=f.Loca.from([...e.map(p=>{const y=h;return h+=p.view.byteLength,y}),h],n.indexToLocFormat);const l=e.reduce((p,y,g)=>(y.unicodes.forEach(w=>p.set(w,g)),p),new Map);i.cmap=f.Cmap.from(l),i.glyf=f.Glyf.from(e.map(p=>p.view)),s.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const c=new f.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,i.post=c,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ao(i,t){let e,r;if(i instanceof it)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const o=Gt(i);if(it.is(o))e=new it(o).sfnt,r="ttf-buffer";else if(Ut.is(o))e=new Ut(o).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=Mn(e,t);switch(r){case"ttf":return it.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return it.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function dr(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(h),i.lineDashOffset=l,i.shadowOffsetX=u,i.shadowOffsetY=c,i.shadowBlur=p,i.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}get array(){return[this.x,this.y]}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*s),e.y-(n*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class E{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new E;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.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 E(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new E(this.left,this.top,this.width,this.height)}}var ho=Object.defineProperty,co=(i,t,e)=>t in i?ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,uo=(i,t,e)=>(co(i,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,o=1,s=0,a=0,h=0,l=1){uo(this,"elements",[]),this.set(t,e,r,n,o,s,a,h,l)}set(t,e,r,n,o,s,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=o,u[5]=h,u[6]=r,u[7]=s,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,o=this.elements,s=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],y=r[5],g=r[8],w=n[0],d=n[3],C=n[6],S=n[1],x=n[4],T=n[7],v=n[2],M=n[5],A=n[8];return o[0]=s*w+a*S+h*v,o[3]=s*d+a*x+h*M,o[6]=s*C+a*T+h*A,o[1]=l*w+u*S+c*v,o[4]=l*d+u*x+c*M,o[7]=l*C+u*T+c*A,o[2]=p*w+y*S+g*v,o[5]=p*d+y*x+g*M,o[8]=p*C+y*T+g*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*s-a*l,p=a*h-u*o,y=l*o-s*h,g=e*c+r*p+n*y;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*s)*w,t[3]=p*w,t[4]=(u*e-n*h)*w,t[5]=(n*o-a*e)*w,t[6]=y*w,t[7]=(r*h-l*e)*w,t[8]=(s*e-r*o)*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(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.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 gr=new yt;function xn(i,t,e,r){const n=i*e+t*r,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/o)));return i*r-t*e<0&&(s=-s),s}function Cn(i,t,e,r,n,o,s,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(s.x-a.x)/2,l=(s.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,y=e*e;const g=u*u,w=c*c,d=g/p+w/y;if(d>1){const U=Math.sqrt(d);t=U*t,e=U*e,p=t*t,y=e*e}const C=p*w+y*g,S=(p*y-C)/C;let x=Math.sqrt(Math.max(0,S));n===o&&(x=-x);const T=x*t*c/e,v=-x*e*u/t,M=Math.cos(r)*T-Math.sin(r)*v+(s.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*v+(s.y+a.y)/2,P=xn(1,0,(u-T)/t,(c-v)/e),_=xn((u-T)/t,(c-v)/e,(-u-T)/t,(-c-v)/e)%(Math.PI*2);i.ellipse(M,A,t,e,r,P,P+_,o===1)}function te(i,t){return i-(t-i)}function yr(i,t){const e=new b,r=new b;for(let n=0,o=i.length;n<o;n++){const s=i[n];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=te(e.x,r.x),h=te(e.y,r.y);r.x=a,r.y=h,s.type==="t"?(t.quadraticCurveTo(a,h,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,h,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),Cn(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(i,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(d,C,S){const x=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw x.partial=S,x}function y(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=i.length;for(let d=0;d<w;d++){if(g=i[d],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,y();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&&p(g,d,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])&&p(g,d,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]==="."&&p(g,d,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)&&p(g,d,c)}}Z.WHITESPACE.test(g)?(y(),a=0,h=!1):Z.COMMA.test(g)?(y(),a=0,h=!0):Z.SIGN.test(g)?(y(),a=1,l=g):Z.POINT.test(g)?(y(),a=2,l=g):p(g,d,c)}return y(),c}function Sn(i){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=i.length;n<o;n++){const s=i[n];switch(s.type){case"m":case"M":if(s.x===e.x&&s.y===e.y)continue;r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y,t.x=s.x,t.y=s.y;break;case"h":case"H":r+=`${s.type} ${s.x}`,e.x=s.x;break;case"v":case"V":r+=`${s.type} ${s.y}`,e.y=s.y;break;case"l":case"L":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"c":case"C":r+=`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"s":case"S":r+=`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"q":case"Q":r+=`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"t":case"T":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"a":case"A":r+=`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"z":case"Z":r+=s.type,e.x=t.x,e.y=t.y;break}}return r}const fo=/[a-df-z][^a-df-z]*/gi;function mr(i){const t=[],e=i.match(fo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let h;switch(s){case"m":case"M":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:s,x:h[l],y:h[l+1]}):t.push({type:s==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:s,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:s,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:s,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:s,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:s,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:s,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:s});break;default:console.warn(o)}}return t}var po=Object.defineProperty,go=(i,t,e)=>t in i?po(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wr=(i,t,e)=>(go(i,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new b){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let s=1;s<=t;s++)r=this.getPoint(s/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let s;e?s=e:s=t*r[o-1];let a=0,h=o-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-s,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===s)return n/(o-1);const u=r[n],p=r[n+1]-u,y=(s-u)/p;return(n+y)/(o-1)}getTangent(t,e=new b){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new b){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(r=>{t.min(r),e.max(r)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return Sn(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class je extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new b){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new b){const{start:r,end:n}=this,o=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(o),Math.sin(o))}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Pn(i,t,e,r,n){const o=(r-t)*.5,s=(n-e)*.5,a=i*i,h=i*a;return(2*e-2*r+o+s)*h+(-3*e+3*r-2*o-s)*a+o*i+e}function yo(i,t){const e=1-i;return e*e*t}function mo(i,t){return 2*(1-i)*i*t}function wo(i,t){return i*i*t}function _n(i,t,e,r){return yo(i,t)+mo(i,e)+wo(i,r)}function vo(i,t){const e=1-i;return e*e*e*t}function bo(i,t){const e=1-i;return 3*e*e*i*t}function Mo(i,t){return 3*(1-i)*i*i*t}function xo(i,t){return i*i*i*t}function Tn(i,t,e,r,n){return vo(i,t)+bo(i,e)+Mo(i,r)+xo(i,n)}class In extends _t{constructor(t=new b,e=new b,r=new b,n=new b){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new b){const{start:r,startControl:n,endControl:o,end:s}=this;return e.set(Tn(t,r.x,n.x,o.x,s.x),Tn(t,r.y,n.y,o.y,s.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(h=>h>=0&&h<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,o=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(s.x-o.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(s.y-o.y)),l=[0,1,...a,...h];return((c,p)=>{for(const y of c)for(let g=0;g<=p;g++){const w=g/p-.5,d=Math.min(1,Math.max(0,y+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Co=new yt,On=new yt,An=new yt,Fe=new b;class Dn extends _t{constructor(t=new b,e=1,r=1,n=0,o=0,s=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=s,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const s=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(s),h=this.center.y+this.radiusY*Math.sin(s);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)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:s,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-o),y=p>Math.PI?1:0,g=s?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),S=l+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:C,y:S},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const d=h+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),C=l+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:y,sweepFlag:g,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:s,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,o,s,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,_o(t)?So(this,t):Po(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:o,rotation:s}=this,{x:a,y:h}=r,l=Math.cos(s),u=Math.sin(s),c=Math.sqrt(n*n*l*l+o*o*u*u),p=Math.sqrt(n*n*u*u+o*o*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 So(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new b(e*n,e*o),a=new b(-r*o,r*n),h=s.applyMatrix3(t),l=a.applyMatrix3(t),u=Co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=On.copy(u).invert(),g=An.copy(c).transpose().multiply(c).elements,w=To(g[0],g[1],g[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(i.radiusX=1/d,i.radiusY=1/C,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(d,0,0,0,C,0,0,0,1),T=An.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(u),M=A=>{const{x:P,y:_}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(_,P)};i.startAngle=M(i.startAngle),i.endAngle=M(i.endAngle),Nn(t)&&(i.clockwise=!i.clockwise)}}function Po(i,t){const e=zn(t),r=En(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,Nn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Nn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function _o(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=zn(i),n=En(i);return Math.abs(e/(r*n))>Number.EPSILON}function zn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function En(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function To(i,t,e){let r,n,o,s,a;const h=i+e,l=i-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=i*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?o=l+u:o=l-u,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),l>0&&(a=o,o=-s,s=a),{rt1:r,rt2:n,cs:o,sn:s}}class Ht extends _t{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}var Io=Object.defineProperty,Oo=(i,t,e)=>t in i?Io(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ao=(i,t,e)=>(Oo(i,t+"",e),e);class Do extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Ao(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new b(t+.5*this.size,e-.5*this.size),n=new b(t-.5*this.size,e-.5*this.size),o=new b(t,e+.5*this.size),s=new je(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new je(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new je(o,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new b(t,e+this.size),u=new b(t+this.size,e),c=new b().lerpVectors(u,l,.75),p=new b(t-this.size,e),y=new b().lerpVectors(p,l,.75),g=new Ht(u,c),w=new Ht(y,p);return this.curves=[s,g,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}var No=Object.defineProperty,zo=(i,t,e)=>t in i?No(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vr=(i,t,e)=>(zo(i,typeof t!="symbol"?t+"":t,e),e);class Eo extends _t{constructor(t,e=0,r=0,n=0,o=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=o,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new b(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Un extends _t{constructor(t=new b,e=new b,r=new b){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new b){const{start:r,control:n,end:o}=this;return e.set(_n(t,r.x,n.x,o.x),_n(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,control:n,end:o}=this,s=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+o.x),l=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,s,h),t.y=Math.min(t.y,r.y,o.y,a,l),e.x=Math.max(e.x,r.x,o.x,s,h),e.y=Math.max(e.y,r.y,o.y,a,l),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Uo=Object.defineProperty,Lo=(i,t,e)=>t in i?Uo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ln=(i,t,e)=>(Lo(i,typeof t!="symbol"?t+"":t,e),e);class $n extends _t{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,Ln(this,"curves",[]),Ln(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,o=[new b(t-r,e-n),new b(t+r,e-n),new b(t+r,e+n),new b(t-r,e+n)];for(let s=0;s<4;s++)this.curves.push(new Ht(o[s].clone(),o[(s+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class Bn extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),s=n-o,a=r[o===0?o:o-1],h=r[o],l=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return e.set(Pn(s,a.x,h.x,l.x,u.x),Pn(s,a.y,h.y,l.y,u.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,Bo=(i,t,e)=>t in i?$o(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>(Bo(i,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new b),Me(this,"autoClose",!1),Me(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:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}getPoint(t,e=new b){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const s=n[o]-r,a=this.curves[o],h=a.getLength();return a.getPointAt(h===0?0:1-s/h,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,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 o=0,s=r.length;o<s;o++){const h=r[o].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 Ht(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Ht(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPoint.equals({x:o,y:s})||this.curves.push(new In(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(o,s))),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new Un(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,s){return this.ellipse(t,e,r,r,0,n,o,s),this}relativeArc(t,e,r,n,o,s){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,s),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,s,a,h=!0){const l=new Dn(new b(t,e),r,n,o,s,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,o,s,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,o,s,a,h),this}rect(t,e,r,n){return this.curves.push(new $n(new b(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Bn([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new E(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function ko(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(i,t,e,r){const n=t.clone().sub(i),o=r.clone().sub(e),s=e.clone().sub(i),a=n.cross(o);if(a===0)return new b((i.x+e.x)/2,(i.y+e.y)/2);const h=s.cross(o)/a;return Math.abs(h)>1?new b((i.x+e.x)/2,(i.y+e.y)/2):new b(i.x+h*n.x,i.y+h*n.y)}var Fo=Object.defineProperty,Go=(i,t,e)=>t in i?Fo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,br=(i,t,e)=>(Go(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(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 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,o,s){return this.currentPath.bezierCurveTo(t,e,r,n,o,s),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,s){return this.currentPath.arc(t,e,r,n,o,s),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,s,a,h){return this.currentPath.ellipse(t,e,r,n,o,s,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,h)=>{const l=a.getControlPoints(),u=a.isClockwise();o[h]=l,n[h]=u;const c=l[0],p=l[l.length-1]??c;r.push({start:u?p:c,end:u?c:p,index:h})});const s=[];return r.forEach((a,h)=>{s[h]=[],r.forEach((l,u)=>{u!==h&&l.start.equals(a.end)&&s[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];o[h].forEach(c=>{const p=a.getTForPoint(c),y=a.getNormal(p).scale(l?t:-t);c.add(y)})}),s.forEach((a,h)=>{const l=o[h];a.forEach(u=>{const c=o[u],p=jo(l[l.length-1],l[l.length-2]??l[l.length-1],c[0],c[1]??c[0]);p&&(l[l.length-1].copy(p),c[0].copy(p))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=b.MAX,e=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const s=n/2,a=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivisions){const u=o.getPoint(l),c=o.getNormal(l),p=c.clone().scale(a?s:-s),y=c.clone().scale(a?-s:s);h.push(u.clone().add(p),u.clone().add(y),u.clone().add({x:s,y:0}),u.clone().add({x:-s,y:0}),u.clone().add({x:0,y:s}),u.clone().add({x:0,y:-s}),u.clone().add({x:s,y:s}),u.clone().add({x:-s,y:-s}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new E(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),dr(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),dr(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[ko(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),this.drawTo(l,r)),h}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Mr="px",kn=90,jn=["mm","cm","in","pt","pc","px"],xr={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 L(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=jn.length;r<n;r++){const o=jn[r];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(i)}const Ro=new yt,Ge=new yt,Fn=new yt,Gn=new yt;function Vo(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=qo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function qo(i){const t=new yt,e=Ro;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(L(i.getAttribute("x")),L(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const h=o.slice(0,s),l=Pt(o.slice(s+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]),Ge.makeTranslation(-c,-p),Fn.makeRotation(u),Gn.multiplyMatrices(Fn,Ge),Ge.makeTranslation(c,p),e.multiplyMatrices(Ge,Gn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Wo(i){return new bt().addPath(new ee().arc(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("r")||0),0,Math.PI*2))}function Ho(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const h=r.style.item(a);o[h]=r.style.getPropertyValue(h)}for(let s=0;s<n.length;s++)t[n[s]]=Object.assign(t[n[s]]||{},{...o})}}function Qo(i){return new bt().addPath(new ee().ellipse(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("rx")||0),L(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(i){return new bt().moveTo(L(i.getAttribute("x1")||0),L(i.getAttribute("y1")||0)).lineTo(L(i.getAttribute("x2")||0),L(i.getAttribute("y2")||0))}function Yo(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Zo,(n,o,s)=>{const a=L(o),h=L(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Jo,(n,o,s)=>{const a=L(o),h=L(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ea(i){const t=L(i.getAttribute("x")||0),e=L(i.getAttribute("y")||0),r=L(i.getAttribute("rx")||i.getAttribute("ry")||0),n=L(i.getAttribute("ry")||i.getAttribute("rx")||0),o=L(i.getAttribute("width")),s=L(i.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+o-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),h.lineTo(t+o,e+s-n),(r!==0||n!==0)&&h.bezierCurveTo(t+o,e+s-n*a,t+o-r*a,e+s,t+o-r,e+s),h.lineTo(t+r,e+s),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+s,t,e+s-n*a,t,e+s-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(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const l=i.getAttribute("class").split(/\s/).filter(Boolean).map(u=>u.trim());for(let u=0;u<l.length;u++)r=Object.assign(r,e[`.${l[u]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));for(let l=i.style.length,u=0;u<l;u++){const c=i.style.item(u),p=i.style.getPropertyValue(c);t[c]=p,r[c]=p}function n(l,u,c=o){i.hasAttribute(l)&&(t[u]=c(i.getAttribute(l))),r[l]&&(t[u]=c(r[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function s(l){return Math.max(0,Math.min(1,L(l)))}function a(l){return Math.max(0,L(l))}function h(l){return l.split(" ").filter(u=>u!=="").map(u=>L(u))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",h),n("stroke-dashoffset","strokeDashoffset",L),n("visibility","visibility"),t}function Cr(i,t,e=[],r={}){var c;if(i.nodeType!==1)return e;let n=!1,o=null,s={...t};switch(i.nodeName){case"svg":s=At(i,s,r);break;case"style":Ho(i,r);break;case"g":s=At(i,s,r);break;case"path":s=At(i,s,r),i.hasAttribute("d")&&(o=Yo(i));break;case"rect":s=At(i,s,r),o=ea(i);break;case"polygon":s=At(i,s,r),o=Ko(i);break;case"polyline":s=At(i,s,r),o=ta(i);break;case"circle":s=At(i,s,r),o=Wo(i);break;case"ellipse":s=At(i,s,r),o=Qo(i);break;case"line":s=At(i,s,r),o=Xo(i);break;case"defs":n=!0;break;case"use":{s=At(i,s,r);const y=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(c=i.viewportElement)==null?void 0:c.getElementById(y);g?Cr(g,s,e,r):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}if(s.display==="none")return e;Object.assign(t,s);const a=new yt,h=[],l=Vo(i,a,h);o&&(o.matrix(a),e.push(o),o.style=t);const u=i.childNodes;for(let p=0,y=u.length;p<y;p++){const g=u[p];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Cr(g,t,e,r)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Rn="data:image/svg+xml;",Vn=`${Rn}base64,`,qn=`${Rn}charset=utf8,`;function Wn(i){if(typeof i=="string"){let t;return i.startsWith(Vn)?(i=i.substring(Vn.length,i.length),t=atob(i)):i.startsWith(qn)?(i=i.substring(qn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Sr(i){return Cr(Wn(i),{})}function Qt(i,t=!0){if(!i.length)return;const e=b.MAX,r=b.MIN;return i.forEach(n=>n.getMinMax(e,r,t)),new E(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(i){const{x:t,y:e,width:r,height:n}=Qt(i),o=i.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}function ra(i){return`data:image/svg+xml;base64,${btoa(Pr(i))}`}function na(i){return new DOMParser().parseFromString(Pr(i),"image/svg+xml").documentElement}function ia(i,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=Qt(i),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),i.forEach(u=>{u.drawTo(l,r)})),h}const sa=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Hn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Qn{constructor(t,e,r){z(this,"lineBox",new E);z(this,"inlineBox",new E);z(this,"glyphBox");z(this,"underlinePosition",0);z(this,"underlineThickness",0);z(this,"yStrikeoutPosition",0);z(this,"yStrikeoutSize",0);z(this,"baseline",0);z(this,"centerDiviation",0);z(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get center(){var t;return(t=this.glyphBox)==null?void 0:t.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_font(){var e;const t=(e=vn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof it)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:s}=t,{content:a,computedStyle:h}=this,{fontSize:l}=h,u=e/l,c=t.getAdvanceWidth(a,l),p=(r+Math.abs(n))/u,y=r/u,g=(r-o.yStrikeoutPosition)/u,w=o.yStrikeoutSize/u,d=(r-s.underlinePosition)/u,C=s.underlineThickness/u;return this.inlineBox.width=c,this.inlineBox.height=p,this.underlinePosition=d,this.underlineThickness=C,this.yStrikeoutPosition=g,this.yStrikeoutSize=w,this.baseline=y,this.centerDiviation=p/2-y,this}updatePath(){const t=this._font();if(!t)return this;this.updateGlyph(t);const{isVertical:e,content:r,computedStyle:n,baseline:o,inlineBox:s}=this,{os2:a,head:h,ascender:l,descender:u}=t,c=a.sTypoAscender,p=aa[a.fsSelection]??la[h.macStyle],{left:y,top:g}=s,w=n.fontStyle==="italic"&&p!=="italic";let d=y,C=g+o,S;const x=new bt;if(e&&(d+=(s.height-s.width)/2,Math.abs(s.width-s.height)>.1&&(C-=(l-c)/(l+Math.abs(u))*s.height),S=void 0),e&&!sa.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){x.addCommands(t.getPathCommands(r,d,g+o-(s.height-s.width)/2,n.fontSize)??[]);const v={y:g-(s.height-s.width)/2+s.height/2,x:d+s.width/2};w&&this._italic(x,e?{x:v.x,y:g-(s.height-s.width)/2+o}:void 0),x.rotate(90,v)}else S!==void 0?(x.addCommands(t.glyphs.get(S).getPathCommands(d,C,n.fontSize)),w&&this._italic(x,e?{x:d+s.width/2,y:g+c/(l+Math.abs(u))*s.height}:void 0)):(x.addCommands(t.getPathCommands(r,d,C,n.fontSize)??[]),w&&this._italic(x,e?{x:d+s.height/2,y:C}:void 0));x.addCommands(this._decoration());const T=n.fontWeight??400;return T in Hn&&(T===700||T==="bold")&&p!=="bold"&&x.bold(Hn[T]*n.fontSize*.05),x.style={fill:n.color,stroke:n.textStrokeWidth?n.textStrokeColor:"none",strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize*.03:0},this.path=x,this.glyphBox=this.getGlyphBoundingBox(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:s,top:a,width:h,height:l}=this.inlineBox,u=.1*o;let c;switch(n){case"underline":t?c=s:c=a+e;break;case"line-through":t?c=s+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:s,y:c},{type:"L",x:s+h,y:c},{type:"L",x:s+h,y:c+u},{type:"L",x:s,y:c+u},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r)}getGlyphBoundingBox(t){const e=this.getGlyphMinMax(void 0,void 0,t);if(!e)return;const{min:r,max:n}=e;return new E(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(i){return!i||i==="none"}function Re(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}class Xn{constructor(t,e={},r){z(this,"inlineBox",new E);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Qn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){z(this,"lineBox",new E);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new Xn(t,e,this);return this.fragments.push(r),r}}class Yn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(s=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(s.style)),s.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),/\s/.test(h.content)&&(l.style.whiteSpace="pre"),a.appendChild(l)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var s;return(s=n.parentNode)==null?void 0:s.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((h,l)=>{var p;const u=h.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const y=document.createRange();y.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){y.setStart(c,Math.max(w-1,0)),y.setEnd(c,w);const d=((p=y.getClientRects)==null?void 0:p.call(y))??[y.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const S=y.toString();S!==""&&C&&C.width+C.height!==0&&n.push({content:S,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=this._measureDom(t);n.paragraphs.forEach(a=>{const h=e[a.paragraphIndex];h.lineBox.left=a.left-r.left,h.lineBox.top=a.top-r.top,h.lineBox.width=a.width,h.lineBox.height=a.height}),n.fragments.forEach(a=>{const h=e[a.paragraphIndex].fragments[a.fragmentIndex];h.inlineBox.left=a.left-r.left,h.inlineBox.top=a.top-r.top,h.inlineBox.width=a.width,h.inlineBox.height=a.height});const o=[];let s=0;return n.characters.forEach(a=>{const{paragraphIndex:h,fragmentIndex:l,characterIndex:u}=a;o.push({...a,newParagraphIndex:h,left:a.left-r.left,top:a.top-r.top});const c=e[h].fragments[l].characters[u],p=o[s];c.inlineBox.left=p.left,c.inlineBox.top=p.top,c.inlineBox.width=p.width,c.inlineBox.height=p.height;const y=c.fontHeight;c.lineBox.left=p.left,c.lineBox.top=p.top+(p.height-y)/2,c.lineBox.height=y,c.lineBox.width=p.width,s++}),{paragraphs:e,boundingBox:new E(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 Zn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new ne({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ne({},e);n.forEach(s=>{if(typeof s=="string")o.addFragment(s);else{const{content:a,...h}=s;a!==void 0&&o.addFragment(a,h)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...s}=n,a=new ne(s,e);o.forEach(h=>{const{content:l,...u}=h;l!==void 0&&a.addFragment(l,u)}),r.push(a)}else if("content"in n){const{content:o,...s}=n;if(o!==void 0){const a=new ne(s,e);a.addFragment(o),r.push(a)}}}return r}}function ha(i){return i}const ca="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ua(i,t,e){if(i==="cover")return 0;if(typeof i=="string")if(i.endsWith("%")){const r=Number(i.substring(0,i.length-1))/100;return Math.ceil(r*e/t)}else return i.endsWith("rem")?Number(i.substring(0,i.length-3)):Math.ceil(Number(i)/t);else return Math.ceil(i/t)}function fa(i,t,e){return typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function pa(i,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.center.add(i.center.sub(t.center).scale(n.x,n.y)).sub({x:i.width/2*n.x,y:i.height/2*n.y}),s=new yt;return s.translate(-i.left,-i.top),r&&(s.translate(-i.width/2,-i.height/2),s.rotate(Math.PI/2),s.translate(i.width/2,i.height/2)),s.scale(n.x,n.y),s.translate(o.x,o.y),s}function Kn(){const i=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Sr(n),e.set(n,o)),o}return{name:"highlight",paths:i,update:n=>{i.length=0;const{characters:o}=n;let s;const a=[];let h;o.forEach(l=>{const{isVertical:u,computedStyle:c}=l;!re(c.highlightImage)&&l.glyphBox&&(c.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===c.highlightImage&&(h==null?void 0:h.highlightSize)===c.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===c.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===c.highlightOverflow&&(s!=null&&s.length)&&(u?s[0].inlineBox.left===l.inlineBox.left:s[0].inlineBox.top===l.inlineBox.top)&&s[0].fontSize===l.fontSize?s.push(l):(s=[],s.push(l),a.push(s))),h=c}),a.filter(l=>l.length).map(l=>{const u=l[0];return{style:u.computedStyle,baseline:u.baseline,box:E.from(...l.map(c=>c.glyphBox))}}).forEach(l=>{const{style:u,box:c,baseline:p}=l,{fontSize:y,writingMode:g}=u,w=g.includes("vertical"),d=fa(u.highlightStrokeWidth,y,c.width),C=ua(u.highlightSize,y,c.width),S=re(u.highlightOverflow)?C?"hidden":"visible":u.highlightOverflow,x=r(re(u.highlightReferImage)?ca:u.highlightReferImage),T=r(u.highlightImage),v=Qt(T,!0),M=Qt(x,!1),A=C?y*C:w?c.height:c.width,P=p*.8,_=pa(v,M,new E(c.left,c.top,w?P:A,w?A:P),w),U=y/v.width*2,q=Math.ceil(c.width/A);for(let B=0;B<q;B++){const mt=_.clone().translate(B*A,0);T.forEach(D=>{const O=D.clone().matrix(mt);O.style.strokeWidth&&(O.style.strokeWidth*=U*d),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=U),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=U),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(k=>k*U)),i.push(O),t[i.length-1]=S==="hidden"?new E(c.left,c.top-c.height,c.width,c.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{i.forEach((s,a)=>{Ce({ctx:n,path:s,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Jn(i,t,e){return i==="cover"?1:typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ti(){const i=[];return{name:"listStyle",paths:i,update:t=>{i.length=0;const{paragraphs:e,isVertical:r,fontSize:n}=t,o=n*.45;e.forEach(s=>{const{computedStyle:a}=s;let h=a.listStyleSize,l;if(!re(a.listStyleImage))l=a.listStyleImage;else if(!re(a.listStyleType)){const g=n*.38/2;switch(h=h==="cover"?g*2:h,a.listStyleType){case"disc":l=`<svg width="${g*2}" height="${g*2}" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<circle cx="${g}" cy="${g}" r="${g}" fill="${a.color}" />
|
|
6
|
-
</svg>`;break}}if(!l)return;const u=Sr(l),c=Qt(u),p=s.lineBox,y=s.fragments[0].inlineBox;if(y){const g=new yt;if(r){const w=Jn(h,n,n),d=n/c.height*w;g.translate(-c.left,-c.top),g.rotate(Math.PI/2),g.scale(d,d),g.translate(n/2-c.height*d/2,0),g.translate(p.left+(p.width-n)/2,y.top-o)}else{const w=Jn(h,n,n),d=n/c.height*w;g.translate(-c.left,-c.top),g.translate(-c.width,0),g.scale(d,d),g.translate(0,n/2-c.height*d/2),g.translate(y.left-o,p.top+(p.height-n)/2)}i.push(...u.map(w=>w.clone().matrix(g)))}})}}}const jt=new b,ie=new yt,Ft=new yt;function ei(){return{name:"render",getBoundingBox:i=>{const{characters:t,fontSize:e,effects:r}=i,n=[];return t.forEach(o=>{r==null||r.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),h=_r(i,s);jt.set(a.left,a.top),jt.applyMatrix3(h),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(h),a.width=jt.x-a.left,a.height=jt.y-a.top;const l=(s.shadowOffsetX??0)*e,u=(s.shadowOffsetY??0)*e,c=Math.max(.1,s.textStrokeWidth??0)*e;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),n.length?
|
|
6
|
+
</svg>`;break}}if(!l)return;const u=Sr(l),c=Qt(u),p=s.lineBox,y=s.fragments[0].inlineBox;if(y){const g=new yt;if(r){const w=Jn(h,n,n),d=n/c.height*w;g.translate(-c.left,-c.top),g.rotate(Math.PI/2),g.scale(d,d),g.translate(n/2-c.height*d/2,0),g.translate(p.left+(p.width-n)/2,y.top-o)}else{const w=Jn(h,n,n),d=n/c.height*w;g.translate(-c.left,-c.top),g.translate(-c.width,0),g.scale(d,d),g.translate(0,n/2-c.height*d/2),g.translate(y.left-o,p.top+(p.height-n)/2)}i.push(...u.map(w=>w.clone().matrix(g)))}})}}}const jt=new b,ie=new yt,Ft=new yt;function ei(){return{name:"render",getBoundingBox:i=>{const{characters:t,fontSize:e,effects:r}=i,n=[];return t.forEach(o=>{r==null||r.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),h=_r(i,s);jt.set(a.left,a.top),jt.applyMatrix3(h),a.left=jt.x,a.top=jt.y,jt.set(a.right,a.bottom),jt.applyMatrix3(h),a.width=jt.x-a.left,a.height=jt.y-a.top;const l=(s.shadowOffsetX??0)*e,u=(s.shadowOffsetY??0)*e,c=Math.max(.1,s.textStrokeWidth??0)*e;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),n.length?E.from(...n):void 0},render:(i,t)=>{const{characters:e,paragraphs:r,glyphBox:n,effects:o,style:s}=t;function a(h,l){i.fillStyle=h,i.fillRect(l.left,l.top,l.width,l.height)}s!=null&&s.backgroundColor&&a(s.backgroundColor,new E(0,0,i.canvas.width,i.canvas.height)),r.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&a(h.style.backgroundColor,h.lineBox)}),o?o.forEach(h=>{Tt(h,n,i),i.save();const[l,u,c,p,y,g]=_r(t,h).transpose().elements;i.transform(l,p,u,y,c,g),e.forEach(w=>{var d;(d=w.parent.style)!=null&&d.backgroundColor&&a(w.parent.style.backgroundColor,w.inlineBox),w.drawTo(i,h)}),i.restore()}):r.forEach(h=>{h.fragments.forEach(l=>{var u;(u=l.style)!=null&&u.backgroundColor&&a(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(i)})})})}}}function _r(i,t){const{fontSize:e,glyphBox:r}=i,n=(t.translateX??0)*e,o=(t.translateY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,h=(t.skewY??0)/360*s,{left:l,top:u,width:c,height:p}=r,y=l+c/2,g=u+p/2;return ie.identity(),Ft.makeTranslation(n,o),ie.multiply(Ft),Ft.makeTranslation(y,g),ie.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),ie.multiply(Ft),Ft.makeTranslation(-y,-g),ie.multiply(Ft),ie.clone()}const Tr={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,translateX:0,translateY:0,skewX:0,skewY:0};class Ir{constructor(t={}){z(this,"content");z(this,"style");z(this,"effects");z(this,"measureDom");z(this,"needsUpdate",!0);z(this,"computedStyle",{...Tr});z(this,"paragraphs",[]);z(this,"lineBox",new E);z(this,"rawGlyphBox",new E);z(this,"glyphBox",new E);z(this,"pathBox",new E);z(this,"boundingBox",new E);z(this,"parser",new Zn(this));z(this,"measurer",new Yn(this));z(this,"plugins",new Map);const{content:e="",style:r={},measureDom:n,effects:o}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.use(ei()).use(Kn()).use(ti())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}measure(t=this.measureDom){this.computedStyle={...Tr,...this.style};const e={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update()}),this.rawGlyphBox=this.getGlyphBox(),[...this.plugins.values()].sort((o,s)=>(o.updateOrder??0)-(s.updateOrder??0)).forEach(o=>{var s;(s=o.update)==null||s.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in e)r[o]=this[o],this[o]=e[o];return r}getGlyphBox(){const t=b.MAX,e=b.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,e)){const{inlineBox:n}=r,o=new b(n.left,n.top),s=new b(n.left+n.width,n.top+n.height);t.min(o,s),e.max(o,s)}}),new E(t.x,t.y,e.x-t.x,e.y-t.y)}updatePathBox(){const t=[...this.plugins.values()];return this.pathBox=E.from(this.glyphBox,...t.map(e=>e.getBoundingBox?e.getBoundingBox(this):Qt(e.paths??[])).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:e,pathBox:r}=this,n=r.left+t.left-e.left,o=r.top+t.top-e.top,s=r.right+Math.max(0,t.right-e.right),a=r.bottom+Math.max(0,t.bottom-e.bottom);return this.boundingBox=new E(n,o,s-n,a-o),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const e in t)this[e]=t[e];return this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Nr(n,r,this.boundingBox),zr(n,this),[...this.plugins.values()].sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;s.render?(a=s.render)==null||a.call(s,n,this):s.paths&&s.paths.forEach(h=>{Ce({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}function da(i){return new Ir(i).measure()}function ga(i){return new Ir(i).render(i)}f.BoundingBox=E,f.Character=Qn,f.CircleCurve=je,f.CmapSubtableFormat0=sr,f.CmapSubtableFormat12=hr,f.CmapSubtableFormat14=me,f.CmapSubtableFormat2=de,f.CmapSubtableFormat4=lr,f.CmapSubtableFormat6=Vt,f.CubicBezierCurve=In,f.Curve=_t,f.CurvePath=ee,f.EllipseCurve=Dn,f.Eot=Ui,f.Font=Ie,f.Fonts=wn,f.Fragment=Xn,f.Glyph=tr,f.GlyphSet=er,f.HeartCurve=Do,f.LineCurve=Ht,f.Matrix3=yt,f.Measurer=Yn,f.Paragraph=ne,f.Parser=Zn,f.Path2D=bt,f.PloygonCurve=Eo,f.QuadraticBezierCurve=Un,f.RectangularCurve=$n,f.Sfnt=ue,f.SplineCurve=Bn,f.TableDirectory=Zt,f.Text=Ir,f.Ttf=it,f.Vector2=b,f.Woff=Ut,f.WoffTableDirectoryEntry=Wt,f.addPathCommandsToPath2D=yr,f.componentFlags=Jt,f.createCmapSegments=ar,f.defaultTextStyles=Tr,f.definePlugin=ha,f.defineSfntTable=nt,f.drawPath=Ce,f.filterEmpty=Re,f.fonts=vn,f.getPathsBoundingBox=Qt,f.getTransform2D=_r,f.highlight=Kn,f.isNone=re,f.listStyle=ti,f.measureText=da,f.minify=ao,f.minifyGlyphs=bn,f.minifySfnt=Mn,f.parse=yn,f.parseArcCommand=Cn,f.parseColor=st,f.parsePathDataArgs=Pt,f.parseSvg=Sr,f.parseSvgToDom=Wn,f.pathCommandsToPathData=Sn,f.pathDataToPathCommands=mr,f.pathsToCanvas=ia,f.pathsToSvg=na,f.pathsToSvgString=Pr,f.pathsToSvgUrl=ra,f.render=ei,f.renderText=ga,f.setCanvasContext=dr,f.setupView=Nr,f.uploadColor=Tt,f.uploadColors=zr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -89,7 +89,7 @@ function setupView(ctx, pixelRatio, boundingBox) {
|
|
|
89
89
|
view.style.height = `${canvasHeight}px`;
|
|
90
90
|
ctx.clearRect(0, 0, view.width, view.height);
|
|
91
91
|
ctx.scale(pixelRatio, pixelRatio);
|
|
92
|
-
ctx.translate(-
|
|
92
|
+
ctx.translate(-left, -top);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function uploadColors(ctx, text) {
|
|
@@ -1106,6 +1106,7 @@ class Text {
|
|
|
1106
1106
|
__publicField(this, "computedStyle", { ...defaultTextStyles });
|
|
1107
1107
|
__publicField(this, "paragraphs", []);
|
|
1108
1108
|
__publicField(this, "lineBox", new BoundingBox());
|
|
1109
|
+
__publicField(this, "rawGlyphBox", new BoundingBox());
|
|
1109
1110
|
__publicField(this, "glyphBox", new BoundingBox());
|
|
1110
1111
|
__publicField(this, "pathBox", new BoundingBox());
|
|
1111
1112
|
__publicField(this, "boundingBox", new BoundingBox());
|
|
@@ -1137,6 +1138,7 @@ class Text {
|
|
|
1137
1138
|
const old = {
|
|
1138
1139
|
paragraphs: this.paragraphs,
|
|
1139
1140
|
lineBox: this.lineBox,
|
|
1141
|
+
rawGlyphBox: this.rawGlyphBox,
|
|
1140
1142
|
glyphBox: this.glyphBox,
|
|
1141
1143
|
pathBox: this.pathBox,
|
|
1142
1144
|
boundingBox: this.boundingBox
|
|
@@ -1148,18 +1150,20 @@ class Text {
|
|
|
1148
1150
|
this.characters.forEach((c) => {
|
|
1149
1151
|
c.update();
|
|
1150
1152
|
});
|
|
1153
|
+
this.rawGlyphBox = this.getGlyphBox();
|
|
1151
1154
|
const plugins = [...this.plugins.values()];
|
|
1152
1155
|
plugins.sort((a, b) => (a.updateOrder ?? 0) - (b.updateOrder ?? 0)).forEach((plugin) => {
|
|
1153
1156
|
plugin.update?.(this);
|
|
1154
1157
|
});
|
|
1155
|
-
this.
|
|
1158
|
+
this.glyphBox = this.getGlyphBox();
|
|
1159
|
+
this.updatePathBox().updateBoundingBox();
|
|
1156
1160
|
for (const key in old) {
|
|
1157
1161
|
result[key] = this[key];
|
|
1158
1162
|
this[key] = old[key];
|
|
1159
1163
|
}
|
|
1160
1164
|
return result;
|
|
1161
1165
|
}
|
|
1162
|
-
|
|
1166
|
+
getGlyphBox() {
|
|
1163
1167
|
const min = Vector2.MAX;
|
|
1164
1168
|
const max = Vector2.MIN;
|
|
1165
1169
|
this.characters.forEach((c) => {
|
|
@@ -1171,13 +1175,12 @@ class Text {
|
|
|
1171
1175
|
max.max(a, b);
|
|
1172
1176
|
}
|
|
1173
1177
|
});
|
|
1174
|
-
|
|
1178
|
+
return new BoundingBox(
|
|
1175
1179
|
min.x,
|
|
1176
1180
|
min.y,
|
|
1177
1181
|
max.x - min.x,
|
|
1178
1182
|
max.y - min.y
|
|
1179
1183
|
);
|
|
1180
|
-
return this;
|
|
1181
1184
|
}
|
|
1182
1185
|
updatePathBox() {
|
|
1183
1186
|
const plugins = [...this.plugins.values()];
|
|
@@ -1190,11 +1193,11 @@ class Text {
|
|
|
1190
1193
|
return this;
|
|
1191
1194
|
}
|
|
1192
1195
|
updateBoundingBox() {
|
|
1193
|
-
const { lineBox,
|
|
1194
|
-
const left = pathBox.left + lineBox.left -
|
|
1195
|
-
const top = pathBox.top + lineBox.top -
|
|
1196
|
-
const right = pathBox.right + Math.max(0, lineBox.right -
|
|
1197
|
-
const bottom = pathBox.bottom + Math.max(0, lineBox.bottom -
|
|
1196
|
+
const { lineBox, rawGlyphBox, pathBox } = this;
|
|
1197
|
+
const left = pathBox.left + lineBox.left - rawGlyphBox.left;
|
|
1198
|
+
const top = pathBox.top + lineBox.top - rawGlyphBox.top;
|
|
1199
|
+
const right = pathBox.right + Math.max(0, lineBox.right - rawGlyphBox.right);
|
|
1200
|
+
const bottom = pathBox.bottom + Math.max(0, lineBox.bottom - rawGlyphBox.bottom);
|
|
1198
1201
|
this.boundingBox = new BoundingBox(
|
|
1199
1202
|
left,
|
|
1200
1203
|
top,
|