modern-text 1.0.5 → 1.1.0
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 +12 -12
- package/dist/index.d.cts +5 -3
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +13 -13
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -322,7 +322,7 @@ class Character {
|
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
getGlyphMinMax(min, max, withStyle) {
|
|
325
|
-
if (this.path.
|
|
325
|
+
if (this.path.curves[0]?.curves.length) {
|
|
326
326
|
return this.path.getMinMax(min, max, withStyle);
|
|
327
327
|
} else {
|
|
328
328
|
return void 0;
|
|
@@ -912,8 +912,8 @@ function highlight() {
|
|
|
912
912
|
const dom = modernPath2d.parseSVGToDOM(
|
|
913
913
|
needsFetch(svg) ? loaded.get(svg) ?? svg : svg
|
|
914
914
|
);
|
|
915
|
-
const
|
|
916
|
-
result = { dom,
|
|
915
|
+
const pathSet = modernPath2d.parseSVG(dom);
|
|
916
|
+
result = { dom, pathSet };
|
|
917
917
|
parsed.set(svg, result);
|
|
918
918
|
}
|
|
919
919
|
return result;
|
|
@@ -1001,8 +1001,8 @@ function highlight() {
|
|
|
1001
1001
|
const isVertical = writingMode.includes("vertical");
|
|
1002
1002
|
const _thickness = parseValueNumber(thickness, { fontSize, total: groupBox.width }) / groupBox.width;
|
|
1003
1003
|
const _colormap = parseColormap(colormap);
|
|
1004
|
-
const {
|
|
1005
|
-
const aBox =
|
|
1004
|
+
const { pathSet: svgPathSet, dom: svgDom } = getPaths(image);
|
|
1005
|
+
const aBox = svgPathSet.getBoundingBox(true);
|
|
1006
1006
|
const styleScale = fontSize / aBox.width * 2;
|
|
1007
1007
|
const cBox = new modernPath2d.BoundingBox().copy(groupBox);
|
|
1008
1008
|
if (isVertical) {
|
|
@@ -1017,7 +1017,7 @@ function highlight() {
|
|
|
1017
1017
|
cBox.width = userWidth;
|
|
1018
1018
|
}
|
|
1019
1019
|
if (!isNone(referImage) && isNone(line)) {
|
|
1020
|
-
const bBox =
|
|
1020
|
+
const bBox = getPaths(referImage).pathSet.getBoundingBox(true);
|
|
1021
1021
|
aBox.copy(bBox);
|
|
1022
1022
|
} else {
|
|
1023
1023
|
let _line;
|
|
@@ -1096,7 +1096,7 @@ function highlight() {
|
|
|
1096
1096
|
} else {
|
|
1097
1097
|
_transform.translate(i2 * cBox.width, 0);
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1099
|
+
svgPathSet.paths.forEach((originalPath) => {
|
|
1100
1100
|
const path = originalPath.clone().matrix(_transform);
|
|
1101
1101
|
if (path.style.strokeWidth) {
|
|
1102
1102
|
path.style.strokeWidth *= styleScale * _thickness;
|
|
@@ -1148,7 +1148,7 @@ function highlight() {
|
|
|
1148
1148
|
clipRect: clipRects[index]
|
|
1149
1149
|
});
|
|
1150
1150
|
if (text.debug) {
|
|
1151
|
-
const box = modernPath2d.
|
|
1151
|
+
const box = new modernPath2d.Path2DSet([path]).getBoundingBox();
|
|
1152
1152
|
if (box) {
|
|
1153
1153
|
ctx.strokeRect(box.x, box.y, box.width, box.height);
|
|
1154
1154
|
}
|
|
@@ -1200,8 +1200,8 @@ function listStyle() {
|
|
|
1200
1200
|
if (!image) {
|
|
1201
1201
|
return;
|
|
1202
1202
|
}
|
|
1203
|
-
const
|
|
1204
|
-
const imageBox =
|
|
1203
|
+
const imagePathSet = modernPath2d.parseSVG(image);
|
|
1204
|
+
const imageBox = imagePathSet.getBoundingBox();
|
|
1205
1205
|
let prevChar;
|
|
1206
1206
|
paragraph.fragments.forEach((f) => {
|
|
1207
1207
|
f.characters.forEach((c) => {
|
|
@@ -1223,7 +1223,7 @@ function listStyle() {
|
|
|
1223
1223
|
inlineBox.top + (inlineBox.height - imageBox.height * _scale) / 2
|
|
1224
1224
|
);
|
|
1225
1225
|
}
|
|
1226
|
-
paths.push(...
|
|
1226
|
+
paths.push(...imagePathSet.paths.map((p) => {
|
|
1227
1227
|
const path = p.clone();
|
|
1228
1228
|
path.matrix(m);
|
|
1229
1229
|
if (path.style.fill && path.style.fill in colormap) {
|
|
@@ -1645,7 +1645,7 @@ class Text extends EventEmitter {
|
|
|
1645
1645
|
this.pathBox = modernPath2d.BoundingBox.from(
|
|
1646
1646
|
this.glyphBox,
|
|
1647
1647
|
...Array.from(this.plugins.values()).map((plugin) => {
|
|
1648
|
-
return plugin.getBoundingBox ? plugin.getBoundingBox(this) : modernPath2d.
|
|
1648
|
+
return plugin.getBoundingBox ? plugin.getBoundingBox(this) : new modernPath2d.Path2DSet(plugin.paths ?? []).getBoundingBox();
|
|
1649
1649
|
}).filter(Boolean)
|
|
1650
1650
|
);
|
|
1651
1651
|
return this;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDOCStyleDeclaration,
|
|
1
|
+
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, Sfnt } from 'modern-font';
|
|
4
4
|
|
|
@@ -103,8 +103,10 @@ interface TextPlugin {
|
|
|
103
103
|
renderOrder?: number;
|
|
104
104
|
load?: (text: Text$1) => Promise<void>;
|
|
105
105
|
}
|
|
106
|
-
interface TextOptions
|
|
107
|
-
style?: IDOCStyleDeclaration
|
|
106
|
+
interface TextOptions {
|
|
107
|
+
style?: Partial<IDOCStyleDeclaration>;
|
|
108
|
+
content?: IDOCTextContent;
|
|
109
|
+
effects?: Partial<IDOCStyleDeclaration>[];
|
|
108
110
|
debug?: boolean;
|
|
109
111
|
measureDom?: HTMLElement;
|
|
110
112
|
fonts?: Fonts;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDOCStyleDeclaration,
|
|
1
|
+
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, Sfnt } from 'modern-font';
|
|
4
4
|
|
|
@@ -103,8 +103,10 @@ interface TextPlugin {
|
|
|
103
103
|
renderOrder?: number;
|
|
104
104
|
load?: (text: Text$1) => Promise<void>;
|
|
105
105
|
}
|
|
106
|
-
interface TextOptions
|
|
107
|
-
style?: IDOCStyleDeclaration
|
|
106
|
+
interface TextOptions {
|
|
107
|
+
style?: Partial<IDOCStyleDeclaration>;
|
|
108
|
+
content?: IDOCTextContent;
|
|
109
|
+
effects?: Partial<IDOCStyleDeclaration>[];
|
|
108
110
|
debug?: boolean;
|
|
109
111
|
measureDom?: HTMLElement;
|
|
110
112
|
fonts?: Fonts;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDOCStyleDeclaration,
|
|
1
|
+
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, Sfnt } from 'modern-font';
|
|
4
4
|
|
|
@@ -103,8 +103,10 @@ interface TextPlugin {
|
|
|
103
103
|
renderOrder?: number;
|
|
104
104
|
load?: (text: Text$1) => Promise<void>;
|
|
105
105
|
}
|
|
106
|
-
interface TextOptions
|
|
107
|
-
style?: IDOCStyleDeclaration
|
|
106
|
+
interface TextOptions {
|
|
107
|
+
style?: Partial<IDOCStyleDeclaration>;
|
|
108
|
+
content?: IDOCTextContent;
|
|
109
|
+
effects?: Partial<IDOCStyleDeclaration>[];
|
|
108
110
|
debug?: boolean;
|
|
109
111
|
measureDom?: HTMLElement;
|
|
110
112
|
fonts?: Fonts;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(E,lt){typeof exports=="object"&&typeof module<"u"?lt(exports):typeof define=="function"&&define.amd?define(["exports"],lt):(E=typeof globalThis<"u"?globalThis:E||self,lt(E.modernText={}))})(this,function(E){"use strict";var po=Object.defineProperty;var go=(E,lt,It)=>lt in E?po(E,lt,{enumerable:!0,configurable:!0,writable:!0,value:It}):E[lt]=It;var x=(E,lt,It)=>go(E,typeof lt!="symbol"?lt+"":lt,It);var Ht;function lt(o,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:s,stops:a}=zn(e,t.left,t.top,t.width,t.height),l=o.createLinearGradient(r,n,i,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function It(o,e,t){o!=null&&o.color&&(o.color=lt(t,o.color,e)),o!=null&&o.backgroundColor&&(o.backgroundColor=lt(t,o.backgroundColor,e)),o!=null&&o.textStrokeColor&&(o.textStrokeColor=lt(t,o.textStrokeColor,e))}function zn(o,e,t,r,n){var p;const i=((p=o.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",s=i.split(",")[0],a=s.includes("deg")?s:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=r*Math.sin(c),u=n*Math.cos(c);return{x0:e+r/2-f,y0:t+n/2+u,x1:e+r/2+f,y1:t+n/2-u,stops:Array.from(l).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function re(o){const{ctx:e,path:t,fontSize:r,clipRect:n}=o;e.save(),e.beginPath();const i=t.style,s={...i,fill:o.color??i.fill,stroke:o.textStrokeColor??i.stroke,strokeWidth:o.textStrokeWidth?o.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(o.shadowOffsetX??0)*r,shadowOffsetY:(o.shadowOffsetY??0)*r,shadowBlur:(o.shadowBlur??0)*r,shadowColor:o.shadowColor};n&&(e.rect(n.left,n.top,n.width,n.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Or(o,e,t){const{left:r,top:n,width:i,height:s}=t,a=o.canvas;a.dataset.viewBox=`${r} ${n} ${i} ${s}`,a.dataset.pixelRatio=String(e);const l=i,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,o.clearRect(0,0,a.width,a.height),o.scale(e,e),o.translate(-r,-n)}function Ir(o,e){const{paragraphs:t,computedStyle:r,glyphBox:n}=e;It(r,n,o),t.forEach(i=>{It(i.computedStyle,i.lineBox,o),i.fragments.forEach(s=>{It(s.computedStyle,s.inlineBox,o)})})}var ht=Uint8Array,Pt=Uint16Array,Qe=Int32Array,_e=new ht([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oe=new ht([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Je=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Br=function(o,e){for(var t=new Pt(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new Qe(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)n[i]=i-t[r]<<5|r;return{b:t,r:n}},Er=Br(_e,2),Ur=Er.b,tr=Er.r;Ur[28]=258,tr[258]=28;for(var Dr=Br(Oe,0),Fn=Dr.b,Lr=Dr.r,er=new Pt(32768),W=0;W<32768;++W){var jt=(W&43690)>>1|(W&21845)<<1;jt=(jt&52428)>>2|(jt&13107)<<2,jt=(jt&61680)>>4|(jt&3855)<<4,er[W]=((jt&65280)>>8|(jt&255)<<8)>>1}for(var Bt=function(o,e,t){for(var r=o.length,n=0,i=new Pt(e);n<r;++n)o[n]&&++i[o[n]-1];var s=new Pt(e);for(n=1;n<e;++n)s[n]=s[n-1]+i[n-1]<<1;var a;if(t){a=new Pt(1<<e);var l=15-e;for(n=0;n<r;++n)if(o[n])for(var h=n<<4|o[n],c=e-o[n],f=s[o[n]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[er[f]>>l]=h}else for(a=new Pt(r),n=0;n<r;++n)o[n]&&(a[n]=er[s[o[n]-1]++]>>15-o[n]);return a},Gt=new ht(288),W=0;W<144;++W)Gt[W]=8;for(var W=144;W<256;++W)Gt[W]=9;for(var W=256;W<280;++W)Gt[W]=7;for(var W=280;W<288;++W)Gt[W]=8;for(var de=new ht(32),W=0;W<32;++W)de[W]=5;var Nn=Bt(Gt,9,0),qn=Bt(Gt,9,1),jn=Bt(de,5,0),Gn=Bt(de,5,1),rr=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},kt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},nr=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},sr=function(o){return(o+7)/8|0},$r=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new ht(o.subarray(e,t))},Rn=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],At=function(o,e,t){var r=new Error(e||Rn[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,At),!t)throw r;return r},Vn=function(o,e,t,r){var n=o.length,i=0;if(!n||e.f&&!e.l)return t||new ht(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ht(n*3));var h=function(Lt){var $t=t.length;if(Lt>$t){var qt=new ht(Math.max($t*2,Lt));qt.set(t),t=qt}},c=e.f||0,f=e.p||0,u=e.b||0,p=e.l,g=e.d,m=e.m,d=e.n,k=n*8;do{if(!p){c=kt(o,f,1);var S=kt(o,f+1,3);if(f+=3,S)if(S==1)p=qn,g=Gn,m=9,d=5;else if(S==2){var v=kt(o,f,31)+257,_=kt(o,f+10,15)+4,M=v+kt(o,f+5,31)+1;f+=14;for(var T=new ht(M),V=new ht(19),H=0;H<_;++H)V[Je[H]]=kt(o,f+H*3,7);f+=_*3;for(var U=rr(V),et=(1<<U)-1,P=Bt(V,U,1),H=0;H<M;){var z=P[kt(o,f,et)];f+=z&15;var C=z>>4;if(C<16)T[H++]=C;else{var q=0,F=0;for(C==16?(F=3+kt(o,f,3),f+=2,q=T[H-1]):C==17?(F=3+kt(o,f,7),f+=3):C==18&&(F=11+kt(o,f,127),f+=7);F--;)T[H++]=q}}var D=T.subarray(0,v),$=T.subarray(v);m=rr(D),d=rr($),p=Bt(D,m,1),g=Bt($,d,1)}else At(1);else{var C=sr(f)+4,A=o[C-4]|o[C-3]<<8,w=C+A;if(w>n){l&&At(0);break}a&&h(u+A),t.set(o.subarray(C,w),u),e.b=u+=A,e.p=f=w*8,e.f=c;continue}if(f>k){l&&At(0);break}}a&&h(u+131072);for(var nt=(1<<m)-1,O=(1<<d)-1,Z=f;;Z=f){var q=p[nr(o,f)&nt],G=q>>4;if(f+=q&15,f>k){l&&At(0);break}if(q||At(2),G<256)t[u++]=G;else if(G==256){Z=f,p=null;break}else{var j=G-254;if(G>264){var H=G-257,L=_e[H];j=kt(o,f,(1<<L)-1)+Ur[H],f+=L}var Q=g[nr(o,f)&O],Y=Q>>4;Q||At(3),f+=Q&15;var $=Fn[Y];if(Y>3){var L=Oe[Y];$+=nr(o,f)&(1<<L)-1,f+=L}if(f>k){l&&At(0);break}a&&h(u+131072);var st=u+j;if(u<$){var te=i-$,ee=Math.min($,st);for(te+u<0&&At(3);u<ee;++u)t[u]=r[te+u]}for(;u<st;++u)t[u]=t[u-$]}}e.l=p,e.p=Z,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=g,e.n=d)}while(!c);return u!=t.length&&s?$r(t,0,u):t.subarray(0,u)},Ft=function(o,e,t){t<<=e&7;var r=e/8|0;o[r]|=t,o[r+1]|=t>>8},ge=function(o,e,t){t<<=e&7;var r=e/8|0;o[r]|=t,o[r+1]|=t>>8,o[r+2]|=t>>16},ir=function(o,e){for(var t=[],r=0;r<o.length;++r)o[r]&&t.push({s:r,f:o[r]});var n=t.length,i=t.slice();if(!n)return{t:qr,l:0};if(n==1){var s=new ht(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(w,v){return w.f-v.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=i[0].s,r=1;r<n;++r)i[r].s>u&&(u=i[r].s);var p=new Pt(u+1),g=or(t[c-1],p,0);if(g>e){var r=0,m=0,d=g-e,k=1<<d;for(i.sort(function(v,_){return p[_.s]-p[v.s]||v.f-_.f});r<n;++r){var S=i[r].s;if(p[S]>e)m+=k-(1<<g-p[S]),p[S]=e;else break}for(m>>=d;m>0;){var C=i[r].s;p[C]<e?m-=1<<e-p[C]++-1:++r}for(;r>=0&&m;--r){var A=i[r].s;p[A]==e&&(--p[A],++m)}g=e}return{t:new ht(p),l:g}},or=function(o,e,t){return o.s==-1?Math.max(or(o.l,e,t+1),or(o.r,e,t+1)):e[o.s]=t},zr=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new Pt(++e),r=0,n=o[0],i=1,s=function(l){t[r++]=l},a=1;a<=e;++a)if(o[a]==n&&a!=e)++i;else{if(!n&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(n),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(n);i=1,n=o[a]}return{c:t.subarray(0,r),n:e}},ye=function(o,e){for(var t=0,r=0;r<e.length;++r)t+=o[r]*e[r];return t},Fr=function(o,e,t){var r=t.length,n=sr(e+2);o[n]=r&255,o[n+1]=r>>8,o[n+2]=o[n]^255,o[n+3]=o[n+1]^255;for(var i=0;i<r;++i)o[n+i+4]=t[i];return(n+4+r)*8},Nr=function(o,e,t,r,n,i,s,a,l,h,c){Ft(e,c++,t),++n[256];for(var f=ir(n,15),u=f.t,p=f.l,g=ir(i,15),m=g.t,d=g.l,k=zr(u),S=k.c,C=k.n,A=zr(m),w=A.c,v=A.n,_=new Pt(19),M=0;M<S.length;++M)++_[S[M]&31];for(var M=0;M<w.length;++M)++_[w[M]&31];for(var T=ir(_,7),V=T.t,H=T.l,U=19;U>4&&!V[Je[U-1]];--U);var et=h+5<<3,P=ye(n,Gt)+ye(i,de)+s,z=ye(n,u)+ye(i,m)+s+14+3*U+ye(_,V)+2*_[16]+3*_[17]+7*_[18];if(l>=0&&et<=P&&et<=z)return Fr(e,c,o.subarray(l,l+h));var q,F,D,$;if(Ft(e,c,1+(z<P)),c+=2,z<P){q=Bt(u,p,0),F=u,D=Bt(m,d,0),$=m;var nt=Bt(V,H,0);Ft(e,c,C-257),Ft(e,c+5,v-1),Ft(e,c+10,U-4),c+=14;for(var M=0;M<U;++M)Ft(e,c+3*M,V[Je[M]]);c+=3*U;for(var O=[S,w],Z=0;Z<2;++Z)for(var G=O[Z],M=0;M<G.length;++M){var j=G[M]&31;Ft(e,c,nt[j]),c+=V[j],j>15&&(Ft(e,c,G[M]>>5&127),c+=G[M]>>12)}}else q=Nn,F=Gt,D=jn,$=de;for(var M=0;M<a;++M){var L=r[M];if(L>255){var j=L>>18&31;ge(e,c,q[j+257]),c+=F[j+257],j>7&&(Ft(e,c,L>>23&31),c+=_e[j]);var Q=L&31;ge(e,c,D[Q]),c+=$[Q],Q>3&&(ge(e,c,L>>5&8191),c+=Oe[Q])}else ge(e,c,q[L]),c+=F[L]}return ge(e,c,q[256]),c+F[256]},Wn=new Qe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new ht(0),Xn=function(o,e,t,r,n,i){var s=i.z||o.length,a=new ht(r+s+5*(1+Math.ceil(s/7e3))+n),l=a.subarray(r,a.length-n),h=i.l,c=(i.r||0)&7;if(e){c&&(l[0]=i.r>>3);for(var f=Wn[e-1],u=f>>13,p=f&8191,g=(1<<t)-1,m=i.p||new Pt(32768),d=i.h||new Pt(g+1),k=Math.ceil(t/3),S=2*k,C=function(pe){return(o[pe]^o[pe+1]<<k^o[pe+2]<<S)&g},A=new Qe(25e3),w=new Pt(288),v=new Pt(32),_=0,M=0,T=i.i||0,V=0,H=i.w||0,U=0;T+2<s;++T){var et=C(T),P=T&32767,z=d[et];if(m[P]=z,d[et]=P,H<=T){var q=s-T;if((_>7e3||V>24576)&&(q>423||!h)){c=Nr(o,l,0,A,w,v,M,V,U,T-U,c),V=_=M=0,U=T;for(var F=0;F<286;++F)w[F]=0;for(var F=0;F<30;++F)v[F]=0}var D=2,$=0,nt=p,O=P-z&32767;if(q>2&&et==C(T-O))for(var Z=Math.min(u,q)-1,G=Math.min(32767,T),j=Math.min(258,q);O<=G&&--nt&&P!=z;){if(o[T+D]==o[T+D-O]){for(var L=0;L<j&&o[T+L]==o[T+L-O];++L);if(L>D){if(D=L,$=O,L>Z)break;for(var Q=Math.min(O,L-2),Y=0,F=0;F<Q;++F){var st=T-O+F&32767,te=m[st],ee=st-te&32767;ee>Y&&(Y=ee,z=st)}}}P=z,z=m[P],O+=P-z&32767}if($){A[V++]=268435456|tr[D]<<18|Lr[$];var Lt=tr[D]&31,$t=Lr[$]&31;M+=_e[Lt]+Oe[$t],++w[257+Lt],++v[$t],H=T+D,++_}else A[V++]=o[T],++w[o[T]]}}for(T=Math.max(T,H);T<s;++T)A[V++]=o[T],++w[o[T]];c=Nr(o,l,h,A,w,v,M,V,U,T-U,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=d,i.p=m,i.i=T,i.w=H)}else{for(var T=i.w||0;T<s+h;T+=65535){var qt=T+65535;qt>=s&&(l[c/8|0]=h,qt=s),c=Fr(l,c+1,o.subarray(T,qt))}i.i=s}return $r(a,0,r+sr(c)+n)},jr=function(){var o=1,e=0;return{p:function(t){for(var r=o,n=e,i=t.length|0,s=0;s!=i;){for(var a=Math.min(s+2655,i);s<a;++s)n+=r+=t[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}o=r,e=n},d:function(){return o%=65521,e%=65521,(o&255)<<24|(o&65280)<<8|(e&255)<<8|e>>8}}},Hn=function(o,e,t,r,n){if(!n&&(n={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),s=new ht(i.length+o.length);s.set(i),s.set(o,i.length),o=s,n.w=i.length}return Xn(o,e.level==null?6:e.level,e.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,r,n)},Gr=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Yn=function(o,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(o[0]=120,o[1]=r<<6|(e.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,e.dictionary){var n=jr();n.p(e.dictionary),Gr(o,2,n.d())}},Zn=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&At(6,"invalid zlib data"),(o[1]>>5&1)==+!e&&At(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function Kn(o,e){e||(e={});var t=jr();t.p(o);var r=Hn(o,e,e.dictionary?6:2,4);return Yn(r,e),Gr(r,r.length-4,t.d()),r}function Qn(o,e){return Vn(o.subarray(Zn(o,e),-4),{i:2},e,e)}var Jn=typeof TextDecoder<"u"&&new TextDecoder,ts=0;try{Jn.decode(qr,{stream:!0}),ts=1}catch{}const es="modern-font";function me(o,e){if(!o)throw new Error(`[${es}] ${e}`)}function rs(o){if("buffer"in o){const e=o.buffer;return o.byteOffset>0||o.byteLength<o.buffer.byteLength?e.slice(o.byteOffset,o.byteOffset+o.byteLength):e}else return o}function ne(o){return"buffer"in o?new DataView(o.buffer,o.byteOffset,o.byteLength):new DataView(o)}function ns(o){let e="";for(let t=0,r=o.length,n;t<r;t++)n=o.charCodeAt(t),n!==0&&(e+=String.fromCharCode(n));return e}function Ie(o){o=ns(o);const e=[];for(let t=0,r=o.length,n;t<r;t++)n=o.charCodeAt(t),e.push(n>>8),e.push(n&255);return e}function ss(o){let e="";for(let t=0,r=o.length;t<r;t++)o[t]<127?e+=String.fromCharCode(o[t]):e+=`%${(256+o[t]).toString(16).slice(1)}`;return unescape(e)}function is(o){let e="";for(let t=0,r=o.length;t<r;t+=2)e+=String.fromCharCode((o[t]<<8)+o[t+1]);return e}var os=Object.defineProperty,ct=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&os(e,t,n),n};const Be={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ft(){return function(o,e){Object.defineProperty(o.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class ot extends DataView{constructor(t,r,n,i){super(rs(t),r,n);x(this,"cursor",0);this.littleEndian=i}readColumn(t){if(t.size){const r=Array.from({length:t.size},(n,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return r.join("");default:return r}}else return this.read(t.type,t.offset)}writeColumn(t,r){t.size?Array.from({length:t.size},(n,i)=>{this.write(t.type,r[i],t.offset+i)}):this.write(t.type,r,t.offset)}read(t,r=this.cursor,n=this.littleEndian){var h;switch(t){case"char":return this.readChar(r);case"fixed":return this.readFixed(r,n);case"longDateTime":return this.readLongDateTime(r,n)}const i=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[i])==null?void 0:h.bind(s),l=a==null?void 0:a(r,n);return this.cursor+=Be[t],l}readUint24(t=this.cursor){const[r,n,i]=this.readBytes(t,3);return(r<<16)+(n<<8)+i}readBytes(t,r){r==null&&(r=t,t=this.cursor);const n=[];for(let i=0;i<r;++i)n.push(this.getUint8(t+i));return this.cursor=t+r,n}readString(t,r){const n=this.readBytes(t,r);let i="";for(let s=0,a=n.length;s<a;s++)i+=String.fromCharCode(n[s]);return i}readFixed(t,r){const n=this.readInt32(t,r)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,r){const n=this.readUint32(t+4,r),i=new Date;return i.setTime(n*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,r,n=this.cursor,i=this.littleEndian){var c;switch(t){case"char":return this.writeChar(r,n);case"fixed":return this.writeFixed(r,n);case"longDateTime":return this.writeLongDateTime(r,n)}const s=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(n,r,i);return this.cursor+=Be[t.toLowerCase()],h}writeString(t="",r=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(r);for(let i=0,s=t.length,a;i<s;++i)a=t.charCodeAt(i)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=n,this}writeChar(t,r){return this.writeString(t,r)}writeFixed(t,r){return this.writeInt32(Math.round(t*65536),r),this}writeLongDateTime(t,r=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,r),this.writeUint32(i,r+4),this}writeBytes(t,r=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let i=0;i<n;++i)this.setUint8(r+i,t[i])}else{const i=ne(t);n=i.byteLength;for(let s=0;s<n;++s)this.setUint8(r+s,i.getUint8(s))}return this.cursor=r+n,this}seek(t){return this.cursor=t,this}}ct([ft()],ot.prototype,"readInt8"),ct([ft()],ot.prototype,"readInt16"),ct([ft()],ot.prototype,"readInt32"),ct([ft()],ot.prototype,"readUint8"),ct([ft()],ot.prototype,"readUint16"),ct([ft()],ot.prototype,"readUint32"),ct([ft()],ot.prototype,"readFloat32"),ct([ft()],ot.prototype,"readFloat64"),ct([ft()],ot.prototype,"writeInt8"),ct([ft()],ot.prototype,"writeInt16"),ct([ft()],ot.prototype,"writeInt32"),ct([ft()],ot.prototype,"writeUint8"),ct([ft()],ot.prototype,"writeUint16"),ct([ft()],ot.prototype,"writeUint32"),ct([ft()],ot.prototype,"writeFloat32"),ct([ft()],ot.prototype,"writeFloat64");const Rr=new WeakMap;function y(o){const e=typeof o=="object"?o:{type:o},{size:t=1,type:r}=e;return(n,i)=>{if(typeof i!="string")return;let s=Rr.get(n);s||(s={columns:[],byteLength:0},Rr.set(n,s));const a={...e,name:i,byteLength:t*Be[r],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+Be[h.type]*(h.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Tt{constructor(e,t,r,n){x(this,"view");this.view=new ot(e,t,r,n)}}class ar extends Tt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var as=Object.defineProperty,mt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&as(e,t,n),n};const wt=class Un extends ar{constructor(){super(...arguments);x(this,"format","EmbeddedOpenType");x(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const r=t.sfnt,i=r.name.names,s=Ie(i.fontFamily||""),a=s.length,l=Ie(i.fontStyle||""),h=l.length,c=Ie(i.version||""),f=c.length,u=Ie(i.fullName||""),p=u.length,g=86+a+4+h+4+f+4+p+2+t.view.byteLength,m=new Un(new ArrayBuffer(g),0,g,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=r.head.checkSumAdjustment;const d=r.os2;return d&&(m.FontPANOSE=d.fontPANOSE,m.Italic=d.fsSelection,m.Weight=d.usWeightClass,m.fsType=d.fsType,m.UnicodeRange=d.ulUnicodeRange,m.CodePageRange=d.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(s),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};mt([y("uint32")],wt.prototype,"EOTSize"),mt([y("uint32")],wt.prototype,"FontDataSize"),mt([y("uint32")],wt.prototype,"Version"),mt([y("uint32")],wt.prototype,"Flags"),mt([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),mt([y("uint8")],wt.prototype,"Charset"),mt([y("uint8")],wt.prototype,"Italic"),mt([y("uint32")],wt.prototype,"Weight"),mt([y("uint16")],wt.prototype,"fsType"),mt([y("uint16")],wt.prototype,"MagicNumber"),mt([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),mt([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),mt([y("uint32")],wt.prototype,"CheckSumAdjustment"),mt([y({type:"uint8",size:16})],wt.prototype,"Reserved"),mt([y("uint16")],wt.prototype,"Padding1");var ls=Object.defineProperty,Ee=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ls(e,t,n),n};class we extends Tt{constructor(e,t){super(e,t,16)}}Ee([y({type:"char",size:4})],we.prototype,"tag"),Ee([y("uint32")],we.prototype,"checkSum"),Ee([y("uint32")],we.prototype,"offset"),Ee([y("uint32")],we.prototype,"length");const lr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],hs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Vr{constructor(e){x(this,"index");x(this,"name");x(this,"isComposite",!1);x(this,"components",[]);x(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,r=72,n={},i){const s=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:l=s}=n,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const p=h[f];p.type==="M"?c.push({type:"M",x:e+p.x*a,y:t+-p.y*l}):p.type==="L"?c.push({type:"L",x:e+p.x*a,y:t+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:e+p.x1*a,y1:t+-p.y1*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="C"?c.push({type:"C",x1:e+p.x1*a,y1:t+-p.y1*l,x2:e+p.x2*a,y2:t+-p.y2*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class cs extends Vr{parse(e,t,r){const n=this,{nominalWidthX:i,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,p,g;const m=[],d=[];let k=0,S=!1,C=!1,A=s,w=0,v=0;function _(P,z){m.push({type:"L",x:P,y:z})}function M(P,z,q,F,D,$){m.push({type:"C",x1:P,y1:z,x2:q,y2:F,x:D,y:$})}function T(P,z){C&&h!==2&&V(),C=!0,m.push({type:"M",x:P,y:z})}function V(){m.push({type:"Z"})}function H(P){m.push(...P)}function U(){d.length%2!==0&&!S&&(A=d.shift()+i),k+=d.length>>1,d.length=0,S=!0}function et(P){let z,q,F,D,$,nt,O,Z,G,j,L,Q,Y=0;for(;Y<P.length;){let st=P[Y++];switch(st){case 1:U();break;case 3:U();break;case 4:d.length>1&&!S&&(A=d.shift()+i,S=!0),v+=d.pop(),T(w,v);break;case 5:for(;d.length>0;)w+=d.shift(),v+=d.shift(),_(w,v);break;case 6:for(;d.length>0&&(w+=d.shift(),_(w,v),d.length!==0);)v+=d.shift(),_(w,v);break;case 7:for(;d.length>0&&(v+=d.shift(),_(w,v),d.length!==0);)w+=d.shift(),_(w,v);break;case 8:for(;d.length>0;)f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);break;case 10:$=d.pop()+l,nt=e.subrs[$],nt&&et(nt);break;case 11:return;case 12:switch(st=P[Y],Y+=1,st){case 35:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),j=Z+d.shift(),L=G+d.shift(),Q=j+d.shift(),w=L+d.shift(),v=Q+d.shift(),d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 34:f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),j=g,L=G+d.shift(),Q=v,w=L+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 36:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g,G=O+d.shift(),j=g,L=G+d.shift(),Q=j+d.shift(),w=L+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;case 37:f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),O=p+d.shift(),Z=g+d.shift(),G=O+d.shift(),j=Z+d.shift(),L=G+d.shift(),Q=j+d.shift(),Math.abs(L-w)>Math.abs(Q-v)?w=L+d.shift():v=Q+d.shift(),M(f,u,p,g,O,Z),M(G,j,L,Q,w,v);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+st}`),d.length=0}break;case 14:if(d.length>=4){const te=lr[d.pop()],ee=lr[d.pop()],Lt=d.pop(),$t=d.pop();if(te&&ee){n.isComposite=!0,n.components=[];const qt=e.charset.indexOf(te),pe=e.charset.indexOf(ee);n.components.push({glyphIndex:pe,dx:0,dy:0}),n.components.push({glyphIndex:qt,dx:$t,dy:Lt}),H(r.get(pe).pathCommands);const Ar=JSON.parse(JSON.stringify(r.get(qt).pathCommands));for(let _r=0;_r<Ar.length;_r+=1){const zt=Ar[_r];zt.type!=="Z"&&(zt.x+=$t,zt.y+=Lt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=$t,zt.y1+=Lt),zt.type==="C"&&(zt.x2+=$t,zt.y2+=Lt)}H(Ar)}}else d.length>0&&!S&&(A=d.shift()+i,S=!0);C&&h!==2&&(V(),C=!1);break;case 18:U();break;case 19:case 20:U(),Y+=k+7>>3;break;case 21:d.length>2&&!S&&(A=d.shift()+i,S=!0),v+=d.pop(),w+=d.pop(),T(w,v);break;case 22:d.length>1&&!S&&(A=d.shift()+i,S=!0),w+=d.pop(),T(w,v);break;case 23:U();break;case 24:for(;d.length>2;)f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);w+=d.shift(),v+=d.shift(),_(w,v);break;case 25:for(;d.length>6;)w+=d.shift(),v+=d.shift(),_(w,v);f=w+d.shift(),u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+d.shift(),M(f,u,p,g,w,v);break;case 26:for(d.length%2&&(w+=d.shift());d.length>0;)f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p,v=g+d.shift(),M(f,u,p,g,w,v);break;case 27:for(d.length%2&&(v+=d.shift());d.length>0;)f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g,M(f,u,p,g,w,v);break;case 28:z=P[Y],q=P[Y+1],d.push((z<<24|q<<16)>>16),Y+=2;break;case 29:$=d.pop()+a,nt=e.gsubrs[$],nt&&et(nt);break;case 30:for(;d.length>0&&(f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+(d.length===1?d.shift():0),M(f,u,p,g,w,v),d.length!==0);)f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),v=g+d.shift(),w=p+(d.length===1?d.shift():0),M(f,u,p,g,w,v);break;case 31:for(;d.length>0&&(f=w+d.shift(),u=v,p=f+d.shift(),g=u+d.shift(),v=g+d.shift(),w=p+(d.length===1?d.shift():0),M(f,u,p,g,w,v),d.length!==0);)f=w,u=v+d.shift(),p=f+d.shift(),g=u+d.shift(),w=p+d.shift(),v=g+(d.length===1?d.shift():0),M(f,u,p,g,w,v);break;default:st<32?console.warn(`Glyph ${c}: unknown operator ${st}`):st<247?d.push(st-139):st<251?(z=P[Y],Y+=1,d.push((st-247)*256+z+108)):st<255?(z=P[Y],Y+=1,d.push(-(st-251)*256-z-108)):(z=P[Y],q=P[Y+1],F=P[Y+2],D=P[Y+3],Y+=4,d.push((z<<24|q<<16|F<<8|D)/65536))}}}et(t),this.pathCommands=m,S&&(this.advanceWidth=A)}}class Wr{constructor(e){x(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let r;if(t)r=t;else{r=this._get(e);const n=this._sfnt.hmtx.metrics[e];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[e]=r}return r}}class fs extends Wr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,r=new cs({index:e});return r.parse(t,t.charStringsIndex.get(e),this),r.name=t.charset[e],r}}var us=Object.defineProperty,Xr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&us(e,t,n),n};class Ue extends Tt{constructor(t,r,n,i){super(t,r,n,i);x(this,"_offsets");x(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,r=this.count,n=this.offsetSize;this.objectOffset=(r+1)*n+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[r]}readOffsets(){const t=this.view,r=this.count,n=this.offsetSize;t.seek(3);const i=[];for(let s=0,a=r+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<n;c++)h<<=8,h+=l.readUint8();i.push(h)}return i}readObjects(){const t=[];for(let r=0,n=this.count;r<n;r++)t.push(this.get(r));return t}get(t){const r=this.offsets,n=this.objectOffset,i=n+r[t],a=n+r[t+1]-i;return this._isString?this.view.readString(i,a):this.view.readBytes(i,a)}}Xr([y("uint16")],Ue.prototype,"count"),Xr([y("uint8")],Ue.prototype,"offsetSize");class De extends Ue{constructor(){super(...arguments);x(this,"_isString",!1)}}class Hr extends Ue{constructor(){super(...arguments);x(this,"_isString",!0)}}const ps=[".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"],ds=[".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"],gs=[".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"],ys=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function Le(o,e){return e<=390?ps[e]:o[e-391]}function X(o,e="number",t){return(r,n)=>{if(typeof n!="string")return;const i={type:e,operator:o,default:t??e==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(s){this._setProp(i,s)},configurable:!0,enumerable:!0})}}class Yr extends Tt{constructor(){super(...arguments);x(this,"_dict");x(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let r="";const n=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===n||(r+=i[a],l===n))break;r+=i[l]}return Number.parseFloat(r)}_readOperand(t){const r=this.view;let n,i,s,a;if(t===28)return n=r.readUint8(),i=r.readUint8(),n<<8|i;if(t===29)return n=r.readUint8(),i=r.readUint8(),s=r.readUint8(),a=r.readUint8(),n<<24|i<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=r.readUint8(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=r.readUint8(),-(t-251)*256-n-108;throw new Error(`invalid b0 ${t}, at: ${r.cursor}`)}_readDict(){const t=this.view;t.seek(0);let r=[];const n=t.cursor+t.byteLength,i={};for(;t.cursor<n;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),i[s]=r,r=[]):r.push(this._readOperand(s))}return i}_getProp(t){var n;const r=this.dict[t.operator]??t.default;switch(t.type){case"number":return r[0];case"string":return Le(((n=this._stringIndex)==null?void 0:n.objects)??[],r[0]);case"number[]":return r}return r}_setProp(t,r){}}var ms=Object.defineProperty,hr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ms(e,t,n),n};class $e extends Yr{}hr([X(19)],$e.prototype,"subrs"),hr([X(20)],$e.prototype,"defaultWidthX"),hr([X(21)],$e.prototype,"nominalWidthX");var ws=Object.defineProperty,J=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ws(e,t,n),n};class K extends Yr{}J([X(0,"string")],K.prototype,"version"),J([X(1,"string")],K.prototype,"notice"),J([X(1200,"string")],K.prototype,"copyright"),J([X(2,"string")],K.prototype,"fullName"),J([X(3,"string")],K.prototype,"familyName"),J([X(4,"string")],K.prototype,"weight"),J([X(1201)],K.prototype,"isFixedPitch"),J([X(1202)],K.prototype,"italicAngle"),J([X(1203,"number",-100)],K.prototype,"underlinePosition"),J([X(1204,"number",50)],K.prototype,"underlineThickness"),J([X(1205)],K.prototype,"paintType"),J([X(1206,"number",2)],K.prototype,"charstringType"),J([X(1207,"number[]",[.001,0,0,.001,0,0])],K.prototype,"fontMatrix"),J([X(13)],K.prototype,"uniqueId"),J([X(5,"number[]",[0,0,0,0])],K.prototype,"fontBBox"),J([X(1208)],K.prototype,"strokeWidth"),J([X(14)],K.prototype,"xuid"),J([X(15)],K.prototype,"charset"),J([X(16)],K.prototype,"encoding"),J([X(17)],K.prototype,"charStrings"),J([X(18,"number[]",[0,0])],K.prototype,"private");function ut(o,e=o){return t=>{se.tableDefinitions.set(o,{tag:o,prop:e,class:t}),Object.defineProperty(se.prototype,e,{get(){return this.get(o)},set(r){return this.set(o,r)},configurable:!0,enumerable:!0})}}const Jt=class Jt{constructor(e){x(this,"tables",new Map);x(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).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(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;t=n.indexOf(r[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const r of e)t.push(this.charToGlyphIndex(r));return t}textToGlyphs(e){const t=this.glyphs,r=this.textToGlyphIndexes(e),n=r.length,i=Array.from({length:n}),s=t.get(0);for(let a=0;a<n;a+=1)i[a]=t.get(r[a])||s;return i}getPathCommands(e,t,r,n,i){const s=[];return this.forEachGlyph(e,t,r,n,i,(a,l,h,c,f)=>{s.push(...a.getPathCommands(l,h,c,f,this))}),s}getAdvanceWidth(e,t,r){return this.forEachGlyph(e,0,0,t,r,()=>{})}forEachGlyph(e,t=0,r=0,n=72,i={},s){const a=1/this.unitsPerEm*n,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,r,n,i),c.advanceWidth&&(t+=c.advanceWidth*a),i.letterSpacing?t+=i.letterSpacing*n:i.tracking&&(t+=i.tracking/1e3*n)}return t}clone(){return new Jt(this.tableViews)}delete(e){const t=Jt.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const r=Jt.tableDefinitions.get(e);return r&&this.tables.set(r.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=Jt.tableDefinitions.get(e);if(!t)return;let r=this.tables.get(t.prop);if(!r){const n=t.class;if(n){const i=this.tableViews.get(e);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(t.prop,r)}}return r}};x(Jt,"tableDefinitions",new Map);let se=Jt;class pt extends Tt{setSfnt(e){return this._sfnt=e,this}getSfnt(){return this._sfnt}}var xs=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,xe=(o,e,t,r)=>{for(var n=r>1?void 0:r?vs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&xs(e,t,n),n};let ie=class extends pt{constructor(e,t,r,n){super(e,t,r,n);x(this,"_glyphs");x(this,"privateDict");x(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new fs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:r}=e,n=r+4;this.nameIndex=new Hr(t,n),this.topDictIndex=new De(t,this.nameIndex.endOffset),this.stringIndex=new Hr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new De(t,this.stringIndex.endOffset),this.topDict=new K(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],s=this.topDict.private[1];i&&(this.privateDict=new $e(t,r+s,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(t,r+s+this.privateDict.subrs))),this.charStringsIndex=new De(t,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=ds:this.topDict.charset===1?this.charset=gs:this.topDict.charset===2?this.charset=ys:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=lr:this.topDict.encoding===1?this.encoding=hs:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(e,t,r){const n=this.view;n.seek(e);let i,s,a;t-=1;const l=[".notdef"],h=n.readUint8();if(h===0)for(i=0;i<t;i+=1)s=n.readUint16(),l.push(Le(r,s));else if(h===1)for(;l.length<=t;)for(s=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)l.push(Le(r,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)l.push(Le(r,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let r,n;const i={},s=t.readUint8();if(s===0){const a=t.readUint8();for(r=0;r<a;r+=1)n=t.readUint8(),i[n]=r}else if(s===1){const a=t.readUint8();for(n=1,r=0;r<a;r+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return i}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};xe([y("uint8")],ie.prototype,"majorVersion",2),xe([y("uint8")],ie.prototype,"minorVersion",2),xe([y("uint8")],ie.prototype,"headerSize",2),xe([y("uint8")],ie.prototype,"offsetSize",2),ie=xe([ut("CFF ","cff")],ie);var bs=Object.defineProperty,ze=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&bs(e,t,n),n};const ve=class Dn extends Tt{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new Dn;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((r,n)=>{n<256&&r<256&&t.view.writeUint8(r,6+n)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,r)=>{e.set(r,t)}),e}};ze([y("uint16")],ve.prototype,"format"),ze([y("uint16")],ve.prototype,"length"),ze([y("uint16")],ve.prototype,"language"),ze([y({type:"uint8",size:256})],ve.prototype,"glyphIndexArray");let Zr=ve;var Ss=Object.defineProperty,cr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ss(e,t,n),n};class Fe extends Tt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-r)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const r=(this.view.byteLength-t)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(h=>h===n);let l=0;for(let h=0;h<256;h++)if(r[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=s.length?l=0:(l=s[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=r[h];for(let f=0,u=i[c].entryCount;f<u;f++)if(i[c].idRangeOffset+f>=s.length?l=0:(l=s[i[c].idRangeOffset+f],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<e){const p=(h<<8|f+i[c].firstCode)%65535;t.set(p,l)}}return t}}cr([y("uint16")],Fe.prototype,"format"),cr([y("uint16")],Fe.prototype,"length"),cr([y("uint16")],Fe.prototype,"language");function Kr(o){return o>32767?o-65536:o<-32767?o+65536:o}function Qr(o,e){let t;const r=[];let n={};return o.forEach((i,s)=>{e&&s>e||((!t||s!==t.unicode+1||i!==t.glyphIndex+1)&&(t?(n.end=t.unicode,r.push(n),n={start:s,startId:i,delta:Kr(i-s)}):(n.start=Number(s),n.startId=i,n.delta=Kr(i-s))),t={unicode:s,glyphIndex:i})}),t&&(n.end=t.unicode,r.push(n)),r}var Cs=Object.defineProperty,Yt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Cs(e,t,n),n};const Rt=class Ln extends Tt{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=Qr(e,65535),r=t.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,s=new Ln(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=i,s.entrySelector=n,s.rangeShift=2*r-i,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=n[h],f=i[h];c<=f;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+s[h]/2+(c-n[h])-r,p=l[u];p!==0?e.set(c,(p+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};Yt([y("uint16")],Rt.prototype,"format"),Yt([y("uint16")],Rt.prototype,"length"),Yt([y("uint16")],Rt.prototype,"language"),Yt([y("uint16")],Rt.prototype,"segCountX2"),Yt([y("uint16")],Rt.prototype,"searchRange"),Yt([y("uint16")],Rt.prototype,"entrySelector"),Yt([y("uint16")],Rt.prototype,"rangeShift");let Jr=Rt;var Ps=Object.defineProperty,be=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ps(e,t,n),n};class oe extends Tt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((r,n)=>{t.set(n,r)}),t}}be([y("uint16")],oe.prototype,"format"),be([y("uint16")],oe.prototype,"length"),be([y("uint16")],oe.prototype,"language"),be([y("uint16")],oe.prototype,"firstCode"),be([y("uint16")],oe.prototype,"entryCount");var Ms=Object.defineProperty,Se=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ms(e,t,n),n};const ae=class $n extends Tt{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=Qr(e),r=new $n(new ArrayBuffer(16+t.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=t.length,t.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let r=0,n=t.length;r<n;r++){const i=t[r];let s=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};Se([y("uint16")],ae.prototype,"format"),Se([y("uint16")],ae.prototype,"reserved"),Se([y("uint32")],ae.prototype,"length"),Se([y("uint32")],ae.prototype,"language"),Se([y("uint32")],ae.prototype,"nGroups");let tn=ae;var Ts=Object.defineProperty,fr=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&Ts(e,t,n),n};class Ne extends Tt{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const r=this.view.readUint32();t.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const r=this.view.readUint32();t.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let r=0,n=t.length;r<n;r++){const{uVSMappings:i}=t[r];i.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}fr([y("uint16")],Ne.prototype,"format"),fr([y("uint32")],Ne.prototype,"length"),fr([y("uint32")],Ne.prototype,"numVarSelectorRecords");var ks=Object.defineProperty,As=Object.getOwnPropertyDescriptor,ur=(o,e,t,r)=>{for(var n=r>1?void 0:r?As(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ks(e,t,n),n};let Ce=class extends pt{constructor(){super(...arguments);x(this,"_unicodeToGlyphIndexMap");x(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),r=Jr.from(e),n=Zr.from(e),i=t?tn.from(e):void 0,s=4+(i?32:24),a=s+r.view.byteLength,l=a+n.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},i&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Ce(new ArrayBuffer(4+8*h.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(r.view,s),c.view.writeBytes(n.view,a),i&&c.view.writeBytes(i.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,r=Array.from(t.keys());for(let n=0,i=r.length;n<i;n++){const s=r[n],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new Zr(this.view.buffer,t.offset);break;case 2:n=new Fe(this.view.buffer,t.offset,this.view.readUint16());break;case 4:n=new Jr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:n=new oe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:n=new tn(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:n=new Ne(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,r=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,n=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,i=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,s=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};ur([y("uint16")],Ce.prototype,"version",2),ur([y("uint16")],Ce.prototype,"numberSubtables",2),Ce=ur([ut("cmap")],Ce);class _s extends Vr{_parseContours(e){const t=[];let r=[];for(let n=0;n<e.length;n+=1){const i=e[n];r.push(i),i.lastPointOfContour&&(t.push(r),r=[])}return me(r.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const r=[];for(let n=0;n<e.length;n+=1){const i=e[n],s={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(e,t,r,n,i){let s;return(t&n)>0?(s=e.view.readUint8(),t&i||(s=-s),s=r+s):(t&i)>0?s=r:s=r+e.view.readInt16(),s}parse(e,t,r){e.view.seek(t);const n=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let m=0;m<n;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();me(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;me(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let p,g=0;for(;g<f;)if(p=e.view.readUint8(),u.push(p),g++,p&8&&g<f){const m=e.view.readUint8();for(let d=0;d<m;d++)u.push(p),g++}if(me(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let d;if(f>0){for(let C=0;C<f;C+=1)p=u[C],d={},d.onCurve=!!(p&1),d.lastPointOfContour=a.includes(C),m.push(d);let k=0;for(let C=0;C<f;C+=1)p=u[C],d=m[C],d.x=this._parseGlyphCoordinate(e,p,k,2,16),k=d.x;let S=0;for(let C=0;C<f;C+=1)p=u[C],d=m[C],d.y=this._parseGlyphCoordinate(e,p,S,4,32),S=d.y}this.points=m}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=r.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{me(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],p)[0],p.dx=f.x-u.x,p.dy=f.y-u.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const i=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],f=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):f.onCurve?i.push({type:"M",x:f.x,y:f.y}):i.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,p=h.length;u<p;++u)if(c=f,f=h[(u+1)%p],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let g=f;f.onCurve||(g={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),i.push({type:"Q",x1:c.x,y1:c.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Os extends Wr{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,r=t[e],n=new _s({index:e});return r!==t[e+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Is=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Es=(o,e,t,r)=>{for(var n=r>1?void 0:r?Bs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Is(e,t,n),n};let pr=class extends pt{constructor(){super(...arguments);x(this,"_glyphs")}static from(e){const t=e.reduce((n,i)=>n+i.byteLength,0),r=new pr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Os(this._sfnt))}};pr=Es([ut("glyf")],pr);var Us=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Ls=(o,e,t,r)=>{for(var n=r>1?void 0:r?Ds(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Us(e,t,n),n};let en=class extends pt{};en=Ls([ut("GPOS","gpos")],en);var $s=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Zt=(o,e,t,r)=>{for(var n=r>1?void 0:r?zs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&$s(e,t,n),n};let Vt=class extends pt{};Zt([y("uint16")],Vt.prototype,"majorVersion",2),Zt([y("uint16")],Vt.prototype,"minorVersion",2),Zt([y("uint16")],Vt.prototype,"scriptListOffset",2),Zt([y("uint16")],Vt.prototype,"featureListOffset",2),Zt([y("uint16")],Vt.prototype,"lookupListOffset",2),Zt([y("uint16")],Vt.prototype,"featureVariationsOffset",2),Vt=Zt([ut("GSUB","gsub")],Vt);var Fs=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,it=(o,e,t,r)=>{for(var n=r>1?void 0:r?Ns(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Fs(e,t,n),n};let rt=class extends pt{constructor(o=new ArrayBuffer(54),e){super(o,e,Math.min(54,o.byteLength-(e??0)))}};it([y("fixed")],rt.prototype,"version",2),it([y("fixed")],rt.prototype,"fontRevision",2),it([y("uint32")],rt.prototype,"checkSumAdjustment",2),it([y("uint32")],rt.prototype,"magickNumber",2),it([y("uint16")],rt.prototype,"flags",2),it([y("uint16")],rt.prototype,"unitsPerEm",2),it([y({type:"longDateTime"})],rt.prototype,"created",2),it([y({type:"longDateTime"})],rt.prototype,"modified",2),it([y("int16")],rt.prototype,"xMin",2),it([y("int16")],rt.prototype,"yMin",2),it([y("int16")],rt.prototype,"xMax",2),it([y("int16")],rt.prototype,"yMax",2),it([y("uint16")],rt.prototype,"macStyle",2),it([y("uint16")],rt.prototype,"lowestRecPPEM",2),it([y("int16")],rt.prototype,"fontDirectionHint",2),it([y("int16")],rt.prototype,"indexToLocFormat",2),it([y("int16")],rt.prototype,"glyphDataFormat",2),rt=it([ut("head")],rt);var qs=Object.defineProperty,js=Object.getOwnPropertyDescriptor,xt=(o,e,t,r)=>{for(var n=r>1?void 0:r?js(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&qs(e,t,n),n};let dt=class extends pt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};xt([y("fixed")],dt.prototype,"version",2),xt([y("int16")],dt.prototype,"ascent",2),xt([y("int16")],dt.prototype,"descent",2),xt([y("int16")],dt.prototype,"lineGap",2),xt([y("uint16")],dt.prototype,"advanceWidthMax",2),xt([y("int16")],dt.prototype,"minLeftSideBearing",2),xt([y("int16")],dt.prototype,"minRightSideBearing",2),xt([y("int16")],dt.prototype,"xMaxExtent",2),xt([y("int16")],dt.prototype,"caretSlopeRise",2),xt([y("int16")],dt.prototype,"caretSlopeRun",2),xt([y("int16")],dt.prototype,"caretOffset",2),xt([y({type:"int16",size:4})],dt.prototype,"reserved",2),xt([y("int16")],dt.prototype,"metricDataFormat",2),xt([y("uint16")],dt.prototype,"numOfLongHorMetrics",2),dt=xt([ut("hhea")],dt);var Gs=Object.defineProperty,Rs=Object.getOwnPropertyDescriptor,Vs=(o,e,t,r)=>{for(var n=r>1?void 0:r?Rs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Gs(e,t,n),n};let dr=class extends pt{constructor(){super(...arguments);x(this,"_metrics")}static from(e){const t=e.length*4,r=new dr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:e}).map((i,s)=>(s<t&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}};dr=Vs([ut("hmtx")],dr);var Ws=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Hs=(o,e,t,r)=>{for(var n=r>1?void 0:r?Xs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Ws(e,t,n),n};let rn=class extends pt{};rn=Hs([ut("kern","kern")],rn);var Ys=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Ks=(o,e,t,r)=>{for(var n=r>1?void 0:r?Zs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Ys(e,t,n),n};let gr=class extends pt{constructor(){super(...arguments);x(this,"_locations")}static from(e,t=1){const r=e.length*(t?4:2),n=new gr(new ArrayBuffer(r));return e.forEach(i=>{t?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:e}).map(()=>t?r.readUint32():r.readUint16()*2)}};gr=Ks([ut("loca")],gr);var Qs=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,gt=(o,e,t,r)=>{for(var n=r>1?void 0:r?Js(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Qs(e,t,n),n};let at=class extends pt{constructor(o=new ArrayBuffer(32),e){super(o,e,Math.min(32,o.byteLength-(e??0)))}};gt([y("fixed")],at.prototype,"version",2),gt([y("uint16")],at.prototype,"numGlyphs",2),gt([y("uint16")],at.prototype,"maxPoints",2),gt([y("uint16")],at.prototype,"maxContours",2),gt([y("uint16")],at.prototype,"maxComponentPoints",2),gt([y("uint16")],at.prototype,"maxComponentContours",2),gt([y("uint16")],at.prototype,"maxZones",2),gt([y("uint16")],at.prototype,"maxTwilightPoints",2),gt([y("uint16")],at.prototype,"maxStorage",2),gt([y("uint16")],at.prototype,"maxFunctionDefs",2),gt([y("uint16")],at.prototype,"maxInstructionDefs",2),gt([y("uint16")],at.prototype,"maxStackElements",2),gt([y("uint16")],at.prototype,"maxSizeOfInstructions",2),gt([y("uint16")],at.prototype,"maxComponentElements",2),gt([y("uint16")],at.prototype,"maxComponentDepth",2),at=gt([ut("maxp")],at);var ti=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,qe=(o,e,t,r)=>{for(var n=r>1?void 0:r?ei(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ti(e,t,n),n};const nn={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"},yr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},ri={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},sn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Pe=class extends pt{constructor(){super(...arguments);x(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(r+h.offset,h.length)}let n=yr.Macintosh,i=ri.Default,s=0;t.some(l=>l.platform===yr.Microsoft&&l.encoding===sn.UCS2&&l.language===1033)&&(n=yr.Microsoft,i=sn.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===n&&h.encoding===i&&h.language===s&&nn[h.nameId]&&(a[nn[h.nameId]]=s===0?ss(h.name):is(h.name))}return a}};qe([y("uint16")],Pe.prototype,"format",2),qe([y("uint16")],Pe.prototype,"count",2),qe([y("uint16")],Pe.prototype,"stringOffset",2),Pe=qe([ut("name")],Pe);var ni=Object.defineProperty,si=Object.getOwnPropertyDescriptor,B=(o,e,t,r)=>{for(var n=r>1?void 0:r?si(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ni(e,t,n),n};let I=class extends pt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};B([y("uint16")],I.prototype,"version",2),B([y("int16")],I.prototype,"xAvgCharWidth",2),B([y("uint16")],I.prototype,"usWeightClass",2),B([y("uint16")],I.prototype,"usWidthClass",2),B([y("uint16")],I.prototype,"fsType",2),B([y("uint16")],I.prototype,"ySubscriptXSize",2),B([y("uint16")],I.prototype,"ySubscriptYSize",2),B([y("uint16")],I.prototype,"ySubscriptXOffset",2),B([y("uint16")],I.prototype,"ySubscriptYOffset",2),B([y("uint16")],I.prototype,"ySuperscriptXSize",2),B([y("uint16")],I.prototype,"ySuperscriptYSize",2),B([y("uint16")],I.prototype,"ySuperscriptXOffset",2),B([y("uint16")],I.prototype,"ySuperscriptYOffset",2),B([y("uint16")],I.prototype,"yStrikeoutSize",2),B([y("uint16")],I.prototype,"yStrikeoutPosition",2),B([y("uint16")],I.prototype,"sFamilyClass",2),B([y({type:"uint8"})],I.prototype,"bFamilyType",2),B([y({type:"uint8"})],I.prototype,"bSerifStyle",2),B([y({type:"uint8"})],I.prototype,"bWeight",2),B([y({type:"uint8"})],I.prototype,"bProportion",2),B([y({type:"uint8"})],I.prototype,"bContrast",2),B([y({type:"uint8"})],I.prototype,"bStrokeVariation",2),B([y({type:"uint8"})],I.prototype,"bArmStyle",2),B([y({type:"uint8"})],I.prototype,"bLetterform",2),B([y({type:"uint8"})],I.prototype,"bMidline",2),B([y({type:"uint8"})],I.prototype,"bXHeight",2),B([y({type:"uint8",size:16})],I.prototype,"ulUnicodeRange",2),B([y({type:"char",size:4})],I.prototype,"achVendID",2),B([y("uint16")],I.prototype,"fsSelection",2),B([y("uint16")],I.prototype,"usFirstCharIndex",2),B([y("uint16")],I.prototype,"usLastCharIndex",2),B([y("int16")],I.prototype,"sTypoAscender",2),B([y("int16")],I.prototype,"sTypoDescender",2),B([y("int16")],I.prototype,"sTypoLineGap",2),B([y("uint16")],I.prototype,"usWinAscent",2),B([y("uint16")],I.prototype,"usWinDescent",2),B([y({offset:72,type:"uint8",size:8})],I.prototype,"ulCodePageRange",2),B([y({offset:72,type:"int16"})],I.prototype,"sxHeight",2),B([y("int16")],I.prototype,"sCapHeight",2),B([y("uint16")],I.prototype,"usDefaultChar",2),B([y("uint16")],I.prototype,"usBreakChar",2),B([y("uint16")],I.prototype,"usMaxContext",2),I=B([ut("OS/2","os2")],I);var ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,Et=(o,e,t,r)=>{for(var n=r>1?void 0:r?oi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ii(e,t,n),n};let _t=class extends pt{constructor(o=new ArrayBuffer(32),e,t){super(o,e,t)}};Et([y("fixed")],_t.prototype,"format",2),Et([y("fixed")],_t.prototype,"italicAngle",2),Et([y("int16")],_t.prototype,"underlinePosition",2),Et([y("int16")],_t.prototype,"underlineThickness",2),Et([y("uint32")],_t.prototype,"isFixedPitch",2),Et([y("uint32")],_t.prototype,"minMemType42",2),Et([y("uint32")],_t.prototype,"maxMemType42",2),Et([y("uint32")],_t.prototype,"minMemType1",2),Et([y("uint32")],_t.prototype,"maxMemType1",2),_t=Et([ut("post")],_t);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,vt=(o,e,t,r)=>{for(var n=r>1?void 0:r?li(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ai(e,t,n),n};let yt=class extends pt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};vt([y("fixed")],yt.prototype,"version",2),vt([y("int16")],yt.prototype,"vertTypoAscender",2),vt([y("int16")],yt.prototype,"vertTypoDescender",2),vt([y("int16")],yt.prototype,"vertTypoLineGap",2),vt([y("int16")],yt.prototype,"advanceHeightMax",2),vt([y("int16")],yt.prototype,"minTopSideBearing",2),vt([y("int16")],yt.prototype,"minBottomSideBearing",2),vt([y("int16")],yt.prototype,"yMaxExtent",2),vt([y("int16")],yt.prototype,"caretSlopeRise",2),vt([y("int16")],yt.prototype,"caretSlopeRun",2),vt([y("int16")],yt.prototype,"caretOffset",2),vt([y({type:"int16",size:4})],yt.prototype,"reserved",2),vt([y("int16")],yt.prototype,"metricDataFormat",2),vt([y("int16")],yt.prototype,"numOfLongVerMetrics",2),yt=vt([ut("vhea")],yt);var hi=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,fi=(o,e,t,r)=>{for(var n=r>1?void 0:r?ci(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&hi(e,t,n),n};let mr=class extends pt{constructor(){super(...arguments);x(this,"_metrics")}static from(e){const t=e.length*4,r=new mr(new ArrayBuffer(t));return e.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const e=this._sfnt.maxp.numGlyphs,t=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:e}).map((s,a)=>(a<t&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}};mr=fi([ut("vmtx")],mr);var ui=Object.defineProperty,Me=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&ui(e,t,n),n};class Ot extends ar{constructor(){super(...arguments);x(this,"format","TrueType");x(this,"mimeType","font/ttf");x(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(ne(t).getUint32(0))}static checksum(t){const r=ne(t);let n=r.byteLength;for(;n%4;)n++;let i=0;for(let s=0,a=n/4;s<a;s+=4)s*4<n-4&&(i+=r.getUint32(s*4,!1));return i&4294967295}static from(t){const r=u=>u+3&-4,n=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((u,p)=>u+r(p.byteLength),0),s=new this(new ArrayBuffer(12+n*16+i));s.scalerType=65536,s.numTables=n;const a=Math.log(2);s.searchRange=Math.floor(Math.log(n)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=n*16-s.searchRange;let l=12+n*16,h=0;const c=s.getDirectories();t.tableViews.forEach((u,p)=>{const g=c[h++];g.tag=p,g.checkSum=this.checksum(u),g.offset=l,g.length=u.byteLength,s.view.writeBytes(u,l),l+=r(g.length)});const f=s.createSfnt().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const r=new we(this.view.buffer,t);return t+=r.view.byteLength,r})}createSfnt(){return new se(this.getDirectories().reduce((t,r)=>(t[r.tag]=new DataView(this.view.buffer,this.view.byteOffset+r.offset,r.length),t),{}))}}x(Ot,"signature",new Set([65536,1953658213,1954115633])),Me([y("uint32")],Ot.prototype,"scalerType"),Me([y("uint16")],Ot.prototype,"numTables"),Me([y("uint16")],Ot.prototype,"searchRange"),Me([y("uint16")],Ot.prototype,"entrySelector"),Me([y("uint16")],Ot.prototype,"rangeShift");class je extends Ot{constructor(){super(...arguments);x(this,"format","OpenType");x(this,"mimeType","font/otf")}static from(t){return super.from(t)}}x(je,"signature",new Set([1330926671]));var pi=Object.defineProperty,Te=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&pi(e,t,n),n};class le extends Tt{constructor(e,t){super(e,t,20)}}Te([y({type:"char",size:4})],le.prototype,"tag"),Te([y("uint32")],le.prototype,"offset"),Te([y("uint32")],le.prototype,"compLength"),Te([y("uint32")],le.prototype,"origLength"),Te([y("uint32")],le.prototype,"origChecksum");var di=Object.defineProperty,Mt=(o,e,t,r)=>{for(var n=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(e,t,n)||n);return n&&di(e,t,n),n};const bt=(Ht=class extends ar{constructor(){super(...arguments);x(this,"format","WOFF");x(this,"mimeType","font/woff");x(this,"_sfnt")}get subfontFormat(){return Ot.is(this.flavor)?"TrueType":je.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ne(t).getUint32(0))}static checkSum(t){const r=ne(t),n=r.byteLength,i=Math.floor(n/4);let s=0,a=0;for(;a<i;)s+=r.getUint32(4*a++,!1);let l=n-i*4;if(l){let h=i*4;for(;l>0;)s+=r.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,r=new ArrayBuffer(0)){const n=u=>u+3&-4,i=[];t.tableViews.forEach((u,p)=>{const g=ne(Kn(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:p,view:g.byteLength<u.byteLength?g:u,rawView:u})});const s=i.length,a=i.reduce((u,p)=>u+n(p.view.byteLength),0),l=new Ht(new ArrayBuffer(44+20*s+a+r.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSfntSize=12+16*s+i.reduce((u,p)=>u+n(p.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return i.forEach(u=>{const p=f[c++];p.tag=u.tag,p.offset=h,p.compLength=u.view.byteLength,p.origChecksum=Ht.checkSum(u.rawView),p.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=n(p.compLength)}),l.view.writeBytes(r),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const r=new le(this.view.buffer,t);return t+=r.view.byteLength,r})}createSfnt(){return new se(this.getDirectories().reduce((t,r)=>{const n=r.tag,i=this.view.byteOffset+r.offset,s=r.compLength,a=r.origLength,l=i+s;return t[n]=s>=a?new DataView(this.view.buffer,i,s):new DataView(Qn(new Uint8Array(this.view.buffer.slice(i,l))).buffer),t},{}))}},x(Ht,"signature",new Set([2001684038])),Ht);Mt([y("uint32")],bt.prototype,"signature"),Mt([y("uint32")],bt.prototype,"flavor"),Mt([y("uint32")],bt.prototype,"length"),Mt([y("uint16")],bt.prototype,"numTables"),Mt([y("uint16")],bt.prototype,"reserved"),Mt([y("uint32")],bt.prototype,"totalSfntSize"),Mt([y("uint16")],bt.prototype,"majorVersion"),Mt([y("uint16")],bt.prototype,"minorVersion"),Mt([y("uint32")],bt.prototype,"metaOffset"),Mt([y("uint32")],bt.prototype,"metaLength"),Mt([y("uint32")],bt.prototype,"metaOrigLength"),Mt([y("uint32")],bt.prototype,"privOffset"),Mt([y("uint32")],bt.prototype,"privLength");let wr=bt;function gi(o,e=!0){if(Ot.is(o))return new Ot(o);if(je.is(o))return new je(o);if(wr.is(o))return new wr(o);if(e)throw new Error("Failed to parseFont")}const Ke=class Ke{constructor(){x(this,"fallbackFont");x(this,"loading",new Map);x(this,"loaded",new Map);x(this,"familyToUrl",new Map)}_createRequest(e,t){const r=new AbortController;return{url:e,when:fetch(e,{...Ke.defaultRequestInit,...t,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(q,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(q=typeof globalThis<"u"?globalThis:q||self,ct(q.modernText={}))})(this,function(q){"use strict";var ga=Object.defineProperty;var ma=(q,ct,jt)=>ct in q?ga(q,ct,{enumerable:!0,configurable:!0,writable:!0,value:jt}):q[ct]=jt;var M=(q,ct,jt)=>ma(q,typeof ct!="symbol"?ct+"":ct,jt);var ee;function ct(o,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:i,y1:s,stops:a}=us(e,t.left,t.top,t.width,t.height),l=o.createLinearGradient(n,r,i,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function jt(o,e,t){o!=null&&o.color&&(o.color=ct(t,o.color,e)),o!=null&&o.backgroundColor&&(o.backgroundColor=ct(t,o.backgroundColor,e)),o!=null&&o.textStrokeColor&&(o.textStrokeColor=ct(t,o.textStrokeColor,e))}function us(o,e,t,n,r){var p;const i=((p=o.match(/linear-gradient\((.+)\)$/))==null?void 0:p[1])??"",s=i.split(",")[0],a=s.includes("deg")?s:"0deg",l=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function le(o){const{ctx:e,path:t,fontSize:n,clipRect:r}=o;e.save(),e.beginPath();const i=t.style,s={...i,fill:o.color??i.fill,stroke:o.textStrokeColor??i.stroke,strokeWidth:o.textStrokeWidth?o.textStrokeWidth*n:i.strokeWidth,shadowOffsetX:(o.shadowOffsetX??0)*n,shadowOffsetY:(o.shadowOffsetY??0)*n,shadowBlur:(o.shadowBlur??0)*n,shadowColor:o.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Yn(o,e,t){const{left:n,top:r,width:i,height:s}=t,a=o.canvas;a.dataset.viewBox=`${n} ${r} ${i} ${s}`,a.dataset.pixelRatio=String(e);const l=i,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,o.clearRect(0,0,a.width,a.height),o.scale(e,e),o.translate(-n,-r)}function Kn(o,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;jt(n,r,o),t.forEach(i=>{jt(i.computedStyle,i.lineBox,o),i.fragments.forEach(s=>{jt(s.computedStyle,s.inlineBox,o)})})}var ft=Uint8Array,It=Uint16Array,un=Int32Array,ze=new ft([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),je=new ft([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pn=new ft([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qn=function(o,e){for(var t=new It(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var r=new un(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)r[i]=i-t[n]<<5|n;return{b:t,r}},Jn=Qn(ze,2),tr=Jn.b,dn=Jn.r;tr[28]=258,dn[258]=28;for(var er=Qn(je,0),ps=er.b,nr=er.r,yn=new It(32768),Q=0;Q<32768;++Q){var Zt=(Q&43690)>>1|(Q&21845)<<1;Zt=(Zt&52428)>>2|(Zt&13107)<<2,Zt=(Zt&61680)>>4|(Zt&3855)<<4,yn[Q]=((Zt&65280)>>8|(Zt&255)<<8)>>1}for(var Nt=function(o,e,t){for(var n=o.length,r=0,i=new It(e);r<n;++r)o[r]&&++i[o[r]-1];var s=new It(e);for(r=1;r<e;++r)s[r]=s[r-1]+i[r-1]<<1;var a;if(t){a=new It(1<<e);var l=15-e;for(r=0;r<n;++r)if(o[r])for(var h=r<<4|o[r],c=e-o[r],f=s[o[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[yn[f]>>l]=h}else for(a=new It(n),r=0;r<n;++r)o[r]&&(a[r]=yn[s[o[r]-1]++]>>15-o[r]);return a},Yt=new ft(288),Q=0;Q<144;++Q)Yt[Q]=8;for(var Q=144;Q<256;++Q)Yt[Q]=9;for(var Q=256;Q<280;++Q)Yt[Q]=7;for(var Q=280;Q<288;++Q)Yt[Q]=8;for(var be=new ft(32),Q=0;Q<32;++Q)be[Q]=5;var ds=Nt(Yt,9,0),ys=Nt(Yt,9,1),gs=Nt(be,5,0),ms=Nt(be,5,1),gn=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Dt=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},mn=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},xn=function(o){return(o+7)/8|0},rr=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new ft(o.subarray(e,t))},xs=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(o,e,t){var n=new Error(e||xs[o]);if(n.code=o,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},ws=function(o,e,t,n){var r=o.length,i=0;if(!r||e.f&&!e.l)return t||new ft(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ft(r*3));var h=function(Mt){var At=t.length;if(Mt>At){var ht=new ft(Math.max(At*2,Mt));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,p=e.l,d=e.d,m=e.m,y=e.n,A=r*8;do{if(!p){c=Dt(o,f,1);var C=Dt(o,f+1,3);if(f+=3,C)if(C==1)p=ys,d=ms,m=9,y=5;else if(C==2){var b=Dt(o,f,31)+257,S=Dt(o,f+10,15)+4,x=b+Dt(o,f+5,31)+1;f+=14;for(var I=new ft(x),F=new ft(19),E=0;E<S;++E)F[pn[E]]=Dt(o,f+E*3,7);f+=S*3;for(var k=gn(F),z=(1<<k)-1,T=Nt(F,k,1),E=0;E<x;){var U=T[Dt(o,f,z)];f+=U&15;var v=U>>4;if(v<16)I[E++]=v;else{var W=0,_=0;for(v==16?(_=3+Dt(o,f,3),f+=2,W=I[E-1]):v==17?(_=3+Dt(o,f,7),f+=3):v==18&&(_=11+Dt(o,f,127),f+=7);_--;)I[E++]=W}}var O=I.subarray(0,b),G=I.subarray(b);m=gn(O),y=gn(G),p=Nt(O,m,1),d=Nt(G,y,1)}else Ut(1);else{var v=xn(f)+4,P=o[v-4]|o[v-3]<<8,w=v+P;if(w>r){l&&Ut(0);break}a&&h(u+P),t.set(o.subarray(v,w),u),e.b=u+=P,e.p=f=w*8,e.f=c;continue}if(f>A){l&&Ut(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,D=(1<<y)-1,Z=f;;Z=f){var W=p[mn(o,f)&L],V=W>>4;if(f+=W&15,f>A){l&&Ut(0);break}if(W||Ut(2),V<256)t[u++]=V;else if(V==256){Z=f,p=null;break}else{var R=V-254;if(V>264){var E=V-257,N=ze[E];R=Dt(o,f,(1<<N)-1)+tr[E],f+=N}var K=d[mn(o,f)&D],X=K>>4;K||Ut(3),f+=K&15;var G=ps[X];if(X>3){var N=je[X];G+=mn(o,f)&(1<<N)-1,f+=N}if(f>A){l&&Ut(0);break}a&&h(u+131072);var nt=u+R;if(u<G){var Vt=i-G,Bt=Math.min(G,nt);for(Vt+u<0&&Ut(3);u<Bt;++u)t[u]=n[Vt+u]}for(;u<nt;++u)t[u]=t[u-G]}}e.l=p,e.p=Z,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=d,e.n=y)}while(!c);return u!=t.length&&s?rr(t,0,u):t.subarray(0,u)},Wt=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8},Se=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8,o[n+2]|=t>>16},wn=function(o,e){for(var t=[],n=0;n<o.length;++n)o[n]&&t.push({s:n,f:o[n]});var r=t.length,i=t.slice();if(!r)return{t:ar,l:0};if(r==1){var s=new ft(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(w,b){return w.f-b.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=i[0].s,n=1;n<r;++n)i[n].s>u&&(u=i[n].s);var p=new It(u+1),d=vn(t[c-1],p,0);if(d>e){var n=0,m=0,y=d-e,A=1<<y;for(i.sort(function(b,S){return p[S.s]-p[b.s]||b.f-S.f});n<r;++n){var C=i[n].s;if(p[C]>e)m+=A-(1<<d-p[C]),p[C]=e;else break}for(m>>=y;m>0;){var v=i[n].s;p[v]<e?m-=1<<e-p[v]++-1:++n}for(;n>=0&&m;--n){var P=i[n].s;p[P]==e&&(--p[P],++m)}d=e}return{t:new ft(p),l:d}},vn=function(o,e,t){return o.s==-1?Math.max(vn(o.l,e,t+1),vn(o.r,e,t+1)):e[o.s]=t},sr=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new It(++e),n=0,r=o[0],i=1,s=function(l){t[n++]=l},a=1;a<=e;++a)if(o[a]==r&&a!=e)++i;else{if(!r&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(r),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(r);i=1,r=o[a]}return{c:t.subarray(0,n),n:e}},Me=function(o,e){for(var t=0,n=0;n<e.length;++n)t+=o[n]*e[n];return t},ir=function(o,e,t){var n=t.length,r=xn(e+2);o[r]=n&255,o[r+1]=n>>8,o[r+2]=o[r]^255,o[r+3]=o[r+1]^255;for(var i=0;i<n;++i)o[r+i+4]=t[i];return(r+4+n)*8},or=function(o,e,t,n,r,i,s,a,l,h,c){Wt(e,c++,t),++r[256];for(var f=wn(r,15),u=f.t,p=f.l,d=wn(i,15),m=d.t,y=d.l,A=sr(u),C=A.c,v=A.n,P=sr(m),w=P.c,b=P.n,S=new It(19),x=0;x<C.length;++x)++S[C[x]&31];for(var x=0;x<w.length;++x)++S[w[x]&31];for(var I=wn(S,7),F=I.t,E=I.l,k=19;k>4&&!F[pn[k-1]];--k);var z=h+5<<3,T=Me(r,Yt)+Me(i,be)+s,U=Me(r,u)+Me(i,m)+s+14+3*k+Me(S,F)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&z<=T&&z<=U)return ir(e,c,o.subarray(l,l+h));var W,_,O,G;if(Wt(e,c,1+(U<T)),c+=2,U<T){W=Nt(u,p,0),_=u,O=Nt(m,y,0),G=m;var L=Nt(F,E,0);Wt(e,c,v-257),Wt(e,c+5,b-1),Wt(e,c+10,k-4),c+=14;for(var x=0;x<k;++x)Wt(e,c+3*x,F[pn[x]]);c+=3*k;for(var D=[C,w],Z=0;Z<2;++Z)for(var V=D[Z],x=0;x<V.length;++x){var R=V[x]&31;Wt(e,c,L[R]),c+=F[R],R>15&&(Wt(e,c,V[x]>>5&127),c+=V[x]>>12)}}else W=ds,_=Yt,O=gs,G=be;for(var x=0;x<a;++x){var N=n[x];if(N>255){var R=N>>18&31;Se(e,c,W[R+257]),c+=_[R+257],R>7&&(Wt(e,c,N>>23&31),c+=ze[R]);var K=N&31;Se(e,c,O[K]),c+=G[K],K>3&&(Se(e,c,N>>5&8191),c+=je[K])}else Se(e,c,W[N]),c+=_[N]}return Se(e,c,W[256]),c+_[256]},vs=new un([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ar=new ft(0),bs=function(o,e,t,n,r,i){var s=i.z||o.length,a=new ft(n+s+5*(1+Math.ceil(s/7e3))+r),l=a.subarray(n,a.length-r),h=i.l,c=(i.r||0)&7;if(e){c&&(l[0]=i.r>>3);for(var f=vs[e-1],u=f>>13,p=f&8191,d=(1<<t)-1,m=i.p||new It(32768),y=i.h||new It(d+1),A=Math.ceil(t/3),C=2*A,v=function(kt){return(o[kt]^o[kt+1]<<A^o[kt+2]<<C)&d},P=new un(25e3),w=new It(288),b=new It(32),S=0,x=0,I=i.i||0,F=0,E=i.w||0,k=0;I+2<s;++I){var z=v(I),T=I&32767,U=y[z];if(m[T]=U,y[z]=T,E<=I){var W=s-I;if((S>7e3||F>24576)&&(W>423||!h)){c=or(o,l,0,P,w,b,x,F,k,I-k,c),F=S=x=0,k=I;for(var _=0;_<286;++_)w[_]=0;for(var _=0;_<30;++_)b[_]=0}var O=2,G=0,L=p,D=T-U&32767;if(W>2&&z==v(I-D))for(var Z=Math.min(u,W)-1,V=Math.min(32767,I),R=Math.min(258,W);D<=V&&--L&&T!=U;){if(o[I+O]==o[I+O-D]){for(var N=0;N<R&&o[I+N]==o[I+N-D];++N);if(N>O){if(O=N,G=D,N>Z)break;for(var K=Math.min(D,N-2),X=0,_=0;_<K;++_){var nt=I-D+_&32767,Vt=m[nt],Bt=nt-Vt&32767;Bt>X&&(X=Bt,U=nt)}}}T=U,U=m[T],D+=T-U&32767}if(G){P[F++]=268435456|dn[O]<<18|nr[G];var Mt=dn[O]&31,At=nr[G]&31;x+=ze[Mt]+je[At],++w[257+Mt],++b[At],E=I+O,++S}else P[F++]=o[I],++w[o[I]]}}for(I=Math.max(I,E);I<s;++I)P[F++]=o[I],++w[o[I]];c=or(o,l,h,P,w,b,x,F,k,I-k,c),h||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=y,i.p=m,i.i=I,i.w=E)}else{for(var I=i.w||0;I<s+h;I+=65535){var ht=I+65535;ht>=s&&(l[c/8|0]=h,ht=s),c=ir(l,c+1,o.subarray(I,ht))}i.i=s}return rr(a,0,n+xn(c)+r)},lr=function(){var o=1,e=0;return{p:function(t){for(var n=o,r=e,i=t.length|0,s=0;s!=i;){for(var a=Math.min(s+2655,i);s<a;++s)r+=n+=t[s];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}o=n,e=r},d:function(){return o%=65521,e%=65521,(o&255)<<24|(o&65280)<<8|(e&255)<<8|e>>8}}},Ss=function(o,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),s=new ft(i.length+o.length);s.set(i),s.set(o,i.length),o=s,r.w=i.length}return bs(o,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,n,r)},hr=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Ms=function(o,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(o[0]=120,o[1]=n<<6|(e.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,e.dictionary){var r=lr();r.p(e.dictionary),hr(o,2,r.d())}},Cs=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&Ut(6,"invalid zlib data"),(o[1]>>5&1)==+!e&&Ut(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function Ps(o,e){e||(e={});var t=lr();t.p(o);var n=Ss(o,e,e.dictionary?6:2,4);return Ms(n,e),hr(n,n.length-4,t.d()),n}function Ts(o,e){return ws(o.subarray(Cs(o,e),-4),{i:2},e,e)}var As=typeof TextDecoder<"u"&&new TextDecoder,ks=0;try{As.decode(ar,{stream:!0}),ks=1}catch{}const Is="modern-font";function Ce(o,e){if(!o)throw new Error(`[${Is}] ${e}`)}function Os(o){if("buffer"in o){const e=o.buffer;return o.byteOffset>0||o.byteLength<o.buffer.byteLength?e.slice(o.byteOffset,o.byteOffset+o.byteLength):e}else return o}function he(o){return"buffer"in o?new DataView(o.buffer,o.byteOffset,o.byteLength):new DataView(o)}function _s(o){let e="";for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function Ne(o){o=_s(o);const e=[];for(let t=0,n=o.length,r;t<n;t++)r=o.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Bs(o){let e="";for(let t=0,n=o.length;t<n;t++)o[t]<127?e+=String.fromCharCode(o[t]):e+=`%${(256+o[t]).toString(16).slice(1)}`;return unescape(e)}function Es(o){let e="";for(let t=0,n=o.length;t<n;t+=2)e+=String.fromCharCode((o[t]<<8)+o[t+1]);return e}var Ds=Object.defineProperty,ut=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ds(e,t,r),r};const qe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(o,e){Object.defineProperty(o.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,i){super(Os(t),n,r);M(this,"cursor",0);this.littleEndian=i}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,i)=>this.read(t.type,t.offset+i));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,i)=>{this.write(t.type,n[i],t.offset+i)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const i=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[i])==null?void 0:h.bind(s),l=a==null?void 0:a(n,r);return this.cursor+=qe[t],l}readUint24(t=this.cursor){const[n,r,i]=this.readBytes(t,3);return(n<<16)+(r<<8)+i}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let i=0;i<n;++i)r.push(this.getUint8(t+i));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let i="";for(let s=0,a=r.length;s<a;s++)i+=String.fromCharCode(r[s]);return i}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,i=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const s=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,i);return this.cursor+=qe[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let i=0,s=t.length,a;i<s;++i)a=t.charCodeAt(i)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const i=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(i,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let i=0;i<r;++i)this.setUint8(n+i,t[i])}else{const i=he(t);r=i.byteLength;for(let s=0;s<r;++s)this.setUint8(n+s,i.getUint8(s))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ut([pt()],at.prototype,"readInt8"),ut([pt()],at.prototype,"readInt16"),ut([pt()],at.prototype,"readInt32"),ut([pt()],at.prototype,"readUint8"),ut([pt()],at.prototype,"readUint16"),ut([pt()],at.prototype,"readUint32"),ut([pt()],at.prototype,"readFloat32"),ut([pt()],at.prototype,"readFloat64"),ut([pt()],at.prototype,"writeInt8"),ut([pt()],at.prototype,"writeInt16"),ut([pt()],at.prototype,"writeInt32"),ut([pt()],at.prototype,"writeUint8"),ut([pt()],at.prototype,"writeUint16"),ut([pt()],at.prototype,"writeUint32"),ut([pt()],at.prototype,"writeFloat32"),ut([pt()],at.prototype,"writeFloat64");const cr=new WeakMap;function g(o){const e=typeof o=="object"?o:{type:o},{size:t=1,type:n}=e;return(r,i)=>{if(typeof i!="string")return;let s=cr.get(r);s||(s={columns:[],byteLength:0},cr.set(r,s));const a={...e,name:i,byteLength:t*qe[n],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+qe[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class _t{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class bn extends _t{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Us=Object.defineProperty,wt=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Us(e,t,r),r};const vt=class ls extends bn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,i=n.name.names,s=Ne(i.fontFamily||""),a=s.length,l=Ne(i.fontStyle||""),h=l.length,c=Ne(i.version||""),f=c.length,u=Ne(i.fullName||""),p=u.length,d=86+a+4+h+4+f+4+p+2+t.view.byteLength,m=new ls(new ArrayBuffer(d),0,d,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(s),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(p),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var Ls=Object.defineProperty,Ge=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ls(e,t,r),r};class Pe extends _t{constructor(e,t){super(e,t,16)}}Ge([g({type:"char",size:4})],Pe.prototype,"tag"),Ge([g("uint32")],Pe.prototype,"checkSum"),Ge([g("uint32")],Pe.prototype,"offset"),Ge([g("uint32")],Pe.prototype,"length");const Sn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],$s=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class fr{constructor(e){M(this,"index");M(this,"name");M(this,"isComposite",!1);M(this,"components",[]);M(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},i){const s=1/((i==null?void 0:i.unitsPerEm)??1e3)*n,{xScale:a=s,yScale:l=s}=r,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const p=h[f];p.type==="M"?c.push({type:"M",x:e+p.x*a,y:t+-p.y*l}):p.type==="L"?c.push({type:"L",x:e+p.x*a,y:t+-p.y*l}):p.type==="Q"?c.push({type:"Q",x1:e+p.x1*a,y1:t+-p.y1*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="C"?c.push({type:"C",x1:e+p.x1*a,y1:t+-p.y1*l,x2:e+p.x2*a,y2:t+-p.y2*l,x:e+p.x*a,y:t+-p.y*l}):p.type==="Z"&&c.push({type:"Z"})}return c}}class Fs extends fr{parse(e,t,n){const r=this,{nominalWidthX:i,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,p,d;const m=[],y=[];let A=0,C=!1,v=!1,P=s,w=0,b=0;function S(T,U){m.push({type:"L",x:T,y:U})}function x(T,U,W,_,O,G){m.push({type:"C",x1:T,y1:U,x2:W,y2:_,x:O,y:G})}function I(T,U){v&&h!==2&&F(),v=!0,m.push({type:"M",x:T,y:U})}function F(){m.push({type:"Z"})}function E(T){m.push(...T)}function k(){y.length%2!==0&&!C&&(P=y.shift()+i),A+=y.length>>1,y.length=0,C=!0}function z(T){let U,W,_,O,G,L,D,Z,V,R,N,K,X=0;for(;X<T.length;){let nt=T[X++];switch(nt){case 1:k();break;case 3:k();break;case 4:y.length>1&&!C&&(P=y.shift()+i,C=!0),b+=y.pop(),I(w,b);break;case 5:for(;y.length>0;)w+=y.shift(),b+=y.shift(),S(w,b);break;case 6:for(;y.length>0&&(w+=y.shift(),S(w,b),y.length!==0);)b+=y.shift(),S(w,b);break;case 7:for(;y.length>0&&(b+=y.shift(),S(w,b),y.length!==0);)w+=y.shift(),S(w,b);break;case 8:for(;y.length>0;)f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d+y.shift(),x(f,u,p,d,w,b);break;case 10:G=y.pop()+l,L=e.subrs[G],L&&z(L);break;case 11:return;case 12:switch(nt=T[X],X+=1,nt){case 35:f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),D=p+y.shift(),Z=d+y.shift(),V=D+y.shift(),R=Z+y.shift(),N=V+y.shift(),K=R+y.shift(),w=N+y.shift(),b=K+y.shift(),y.shift(),x(f,u,p,d,D,Z),x(V,R,N,K,w,b);break;case 34:f=w+y.shift(),u=b,p=f+y.shift(),d=u+y.shift(),D=p+y.shift(),Z=d,V=D+y.shift(),R=d,N=V+y.shift(),K=b,w=N+y.shift(),x(f,u,p,d,D,Z),x(V,R,N,K,w,b);break;case 36:f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),D=p+y.shift(),Z=d,V=D+y.shift(),R=d,N=V+y.shift(),K=R+y.shift(),w=N+y.shift(),x(f,u,p,d,D,Z),x(V,R,N,K,w,b);break;case 37:f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),D=p+y.shift(),Z=d+y.shift(),V=D+y.shift(),R=Z+y.shift(),N=V+y.shift(),K=R+y.shift(),Math.abs(N-w)>Math.abs(K-b)?w=N+y.shift():b=K+y.shift(),x(f,u,p,d,D,Z),x(V,R,N,K,w,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Vt=Sn[y.pop()],Bt=Sn[y.pop()],Mt=y.pop(),At=y.pop();if(Vt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Vt),kt=e.charset.indexOf(Bt);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Mt}),E(n.get(kt).pathCommands);const Ft=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let zt=0;zt<Ft.length;zt+=1){const Et=Ft[zt];Et.type!=="Z"&&(Et.x+=At,Et.y+=Mt),(Et.type==="Q"||Et.type==="C")&&(Et.x1+=At,Et.y1+=Mt),Et.type==="C"&&(Et.x2+=At,Et.y2+=Mt)}E(Ft)}}else y.length>0&&!C&&(P=y.shift()+i,C=!0);v&&h!==2&&(F(),v=!1);break;case 18:k();break;case 19:case 20:k(),X+=A+7>>3;break;case 21:y.length>2&&!C&&(P=y.shift()+i,C=!0),b+=y.pop(),w+=y.pop(),I(w,b);break;case 22:y.length>1&&!C&&(P=y.shift()+i,C=!0),w+=y.pop(),I(w,b);break;case 23:k();break;case 24:for(;y.length>2;)f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d+y.shift(),x(f,u,p,d,w,b);w+=y.shift(),b+=y.shift(),S(w,b);break;case 25:for(;y.length>6;)w+=y.shift(),b+=y.shift(),S(w,b);f=w+y.shift(),u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d+y.shift(),x(f,u,p,d,w,b);break;case 26:for(y.length%2&&(w+=y.shift());y.length>0;)f=w,u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p,b=d+y.shift(),x(f,u,p,d,w,b);break;case 27:for(y.length%2&&(b+=y.shift());y.length>0;)f=w+y.shift(),u=b,p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d,x(f,u,p,d,w,b);break;case 28:U=T[X],W=T[X+1],y.push((U<<24|W<<16)>>16),X+=2;break;case 29:G=y.pop()+a,L=e.gsubrs[G],L&&z(L);break;case 30:for(;y.length>0&&(f=w,u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d+(y.length===1?y.shift():0),x(f,u,p,d,w,b),y.length!==0);)f=w+y.shift(),u=b,p=f+y.shift(),d=u+y.shift(),b=d+y.shift(),w=p+(y.length===1?y.shift():0),x(f,u,p,d,w,b);break;case 31:for(;y.length>0&&(f=w+y.shift(),u=b,p=f+y.shift(),d=u+y.shift(),b=d+y.shift(),w=p+(y.length===1?y.shift():0),x(f,u,p,d,w,b),y.length!==0);)f=w,u=b+y.shift(),p=f+y.shift(),d=u+y.shift(),w=p+y.shift(),b=d+(y.length===1?y.shift():0),x(f,u,p,d,w,b);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?y.push(nt-139):nt<251?(U=T[X],X+=1,y.push((nt-247)*256+U+108)):nt<255?(U=T[X],X+=1,y.push(-(nt-251)*256-U-108)):(U=T[X],W=T[X+1],_=T[X+2],O=T[X+3],X+=4,y.push((U<<24|W<<16|_<<8|O)/65536))}}}z(t),this.pathCommands=m,C&&(this.advanceWidth=P)}}class ur{constructor(e){M(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);i&&(n.unicode??(n.unicode=i[0]),n.unicodes??(n.unicodes=i)),this._items[e]=n}return n}}class zs extends ur{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new Fs({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var js=Object.defineProperty,pr=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&js(e,t,r),r};class Re extends _t{constructor(t,n,r,i){super(t,n,r,i);M(this,"_offsets");M(this,"_objects");this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const i=[];for(let s=0,a=n+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();i.push(h)}return i}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,i=r+n[t],a=r+n[t+1]-i;return this._isString?this.view.readString(i,a):this.view.readBytes(i,a)}}pr([g("uint16")],Re.prototype,"count"),pr([g("uint8")],Re.prototype,"offsetSize");class Ve extends Re{constructor(){super(...arguments);M(this,"_isString",!1)}}class dr extends Re{constructor(){super(...arguments);M(this,"_isString",!0)}}const Ns=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],qs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Gs=[".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"],Rs=[".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 We(o,e){return e<=390?Ns[e]:o[e-391]}function J(o,e="number",t){return(n,r)=>{if(typeof r!="string")return;const i={type:e,operator:o,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(i)},set(s){this._setProp(i,s)},configurable:!0,enumerable:!0})}}class yr extends _t{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===r||(n+=i[a],l===r))break;n+=i[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,i,s,a;if(t===28)return r=n.readUint8(),i=n.readUint8(),r<<8|i;if(t===29)return r=n.readUint8(),i=n.readUint8(),s=n.readUint8(),a=n.readUint8(),r<<24|i<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,i={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),i[s]=n,n=[]):n.push(this._readOperand(s))}return i}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return We(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Vs=Object.defineProperty,Mn=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Vs(e,t,r),r};class Xe extends yr{}Mn([J(19)],Xe.prototype,"subrs"),Mn([J(20)],Xe.prototype,"defaultWidthX"),Mn([J(21)],Xe.prototype,"nominalWidthX");var Ws=Object.defineProperty,rt=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ws(e,t,r),r};class et extends yr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(o,e=o){return t=>{ce.tableDefinitions.set(o,{tag:o,prop:e,class:t}),Object.defineProperty(ce.prototype,e,{get(){return this.get(o)},set(n){return this.set(o,n)},configurable:!0,enumerable:!0})}}const ae=class ae{constructor(e){M(this,"tables",new Map);M(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,i=Array.from({length:r}),s=t.get(0);for(let a=0;a<r;a+=1)i[a]=t.get(n[a])||s;return i}getPathCommands(e,t,n,r,i){const s=[];return this.forEachGlyph(e,t,n,r,i,(a,l,h,c,f)=>{s.push(...a.getPathCommands(l,h,c,f,this))}),s}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,i={},s){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,n,r,i),c.advanceWidth&&(t+=c.advanceWidth*a),i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t}clone(){return new ae(this.tableViews)}delete(e){const t=ae.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=ae.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=ae.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const i=this.tableViews.get(e);if(!i)return;n=new r(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(t.prop,n)}}return n}};M(ae,"tableDefinitions",new Map);let ce=ae;class yt extends _t{setSfnt(e){return this._sfnt=e,this}getSfnt(){return this._sfnt}}var Xs=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Te=(o,e,t,n)=>{for(var r=n>1?void 0:n?Hs(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Xs(e,t,r),r};let fe=class extends yt{constructor(e,t,n,r){super(e,t,n,r);M(this,"_glyphs");M(this,"privateDict");M(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new zs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new dr(t,r),this.topDictIndex=new Ve(t,this.nameIndex.endOffset),this.stringIndex=new dr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new Ve(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],s=this.topDict.private[1];i&&(this.privateDict=new Xe(t,n+s,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ve(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new Ve(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=qs:this.topDict.charset===1?this.charset=Gs:this.topDict.charset===2?this.charset=Rs:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Sn:this.topDict.encoding===1?this.encoding=$s:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let i,s,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(i=0;i<t;i+=1)s=r.readUint16(),l.push(We(n,s));else if(h===1)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint8(),i=0;i<=a;i+=1)l.push(We(n,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint16(),i=0;i<=a;i+=1)l.push(We(n,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const i={},s=t.readUint8();if(s===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),i[r]=n}else if(s===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${s}`);return i}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Te([g("uint8")],fe.prototype,"majorVersion",2),Te([g("uint8")],fe.prototype,"minorVersion",2),Te([g("uint8")],fe.prototype,"headerSize",2),Te([g("uint8")],fe.prototype,"offsetSize",2),fe=Te([dt("CFF ","cff")],fe);var Zs=Object.defineProperty,He=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Zs(e,t,r),r};const Ae=class hs extends _t{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new hs;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};He([g("uint16")],Ae.prototype,"format"),He([g("uint16")],Ae.prototype,"length"),He([g("uint16")],Ae.prototype,"language"),He([g({type:"uint8",size:256})],Ae.prototype,"glyphIndexArray");let gr=Ae;var Ys=Object.defineProperty,Cn=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ys(e,t,r),r};class Ze extends _t{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,i=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<i[0].firstCode||h>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(h-i[0].firstCode)>=s.length?l=0:(l=s[i[0].idRangeOffset+(h-i[0].firstCode)],l!==0&&(l=l+i[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=i[c].entryCount;f<u;f++)if(i[c].idRangeOffset+f>=s.length?l=0:(l=s[i[c].idRangeOffset+f],l!==0&&(l=l+i[c].idDelta)),l!==0&&l<e){const p=(h<<8|f+i[c].firstCode)%65535;t.set(p,l)}}return t}}Cn([g("uint16")],Ze.prototype,"format"),Cn([g("uint16")],Ze.prototype,"length"),Cn([g("uint16")],Ze.prototype,"language");function mr(o){return o>32767?o-65536:o<-32767?o+65536:o}function xr(o,e){let t;const n=[];let r={};return o.forEach((i,s)=>{e&&s>e||((!t||s!==t.unicode+1||i!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:s,startId:i,delta:mr(i-s)}):(r.start=Number(s),r.startId=i,r.delta=mr(i-s))),t={unicode:s,glyphIndex:i})}),t&&(r.end=t.unicode,n.push(r)),n}var Ks=Object.defineProperty,ne=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ks(e,t,r),r};const Kt=class cs extends _t{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=xr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),i=2*2**r,s=new cs(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=i,s.entrySelector=r,s.rangeShift=2*n-i,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,i=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=i[h];c<=f;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+s[h]/2+(c-r[h])-n,p=l[u];p!==0?e.set(c,(p+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};ne([g("uint16")],Kt.prototype,"format"),ne([g("uint16")],Kt.prototype,"length"),ne([g("uint16")],Kt.prototype,"language"),ne([g("uint16")],Kt.prototype,"segCountX2"),ne([g("uint16")],Kt.prototype,"searchRange"),ne([g("uint16")],Kt.prototype,"entrySelector"),ne([g("uint16")],Kt.prototype,"rangeShift");let wr=Kt;var Qs=Object.defineProperty,ke=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Qs(e,t,r),r};class ue extends _t{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}ke([g("uint16")],ue.prototype,"format"),ke([g("uint16")],ue.prototype,"length"),ke([g("uint16")],ue.prototype,"language"),ke([g("uint16")],ue.prototype,"firstCode"),ke([g("uint16")],ue.prototype,"entryCount");var Js=Object.defineProperty,Ie=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Js(e,t,r),r};const pe=class fs extends _t{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=xr(e),n=new fs(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const i=t[n];let s=i.startGlyphCode,a=i.startCharCode;const l=i.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};Ie([g("uint16")],pe.prototype,"format"),Ie([g("uint16")],pe.prototype,"reserved"),Ie([g("uint32")],pe.prototype,"length"),Ie([g("uint32")],pe.prototype,"language"),Ie([g("uint32")],pe.prototype,"nGroups");let vr=pe;var ti=Object.defineProperty,Pn=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&ti(e,t,r),r};class Ye extends _t{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:i}=t[n];i.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}Pn([g("uint16")],Ye.prototype,"format"),Pn([g("uint32")],Ye.prototype,"length"),Pn([g("uint32")],Ye.prototype,"numVarSelectorRecords");var ei=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,Tn=(o,e,t,n)=>{for(var r=n>1?void 0:n?ni(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ei(e,t,r),r};let Oe=class extends yt{constructor(){super(...arguments);M(this,"_unicodeToGlyphIndexMap");M(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),n=wr.from(e),r=gr.from(e),i=t?vr.from(e):void 0,s=4+(i?32:24),a=s+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},i&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Oe(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(n.view,s),c.view.writeBytes(r.view,a),i&&c.view.writeBytes(i.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,i=n.length;r<i;r++){const s=n[r],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new gr(this.view.buffer,t.offset);break;case 2:r=new Ze(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new wr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ue(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new vr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ye(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,n=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,r=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,i=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,s=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};Tn([g("uint16")],Oe.prototype,"version",2),Tn([g("uint16")],Oe.prototype,"numberSubtables",2),Oe=Tn([dt("cmap")],Oe);class ri extends fr{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return Ce(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const i=e[r],s={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,r,i){let s;return(t&r)>0?(s=e.view.readUint8(),t&i||(s=-s),s=n+s):(t&i)>0?s=n:s=n+e.view.readInt16(),s}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Ce(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;Ce(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let p,d=0;for(;d<f;)if(p=e.view.readUint8(),u.push(p),d++,p&8&&d<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(p),d++}if(Ce(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let y;if(f>0){for(let v=0;v<f;v+=1)p=u[v],y={},y.onCurve=!!(p&1),y.lastPointOfContour=a.includes(v),m.push(y);let A=0;for(let v=0;v<f;v+=1)p=u[v],y=m[v],y.x=this._parseGlyphCoordinate(e,p,A,2,16),A=y.x;let C=0;for(let v=0;v<f;v+=1)p=u[v],y=m[v],y.y=this._parseGlyphCoordinate(e,p,C,4,32),C=y.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Ce(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const p={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],p)[0],p.dx=f.x-u.x,p.dy=f.y-u.y,c=this._transformPoints(h.points,p)}this.points=this.points.concat(c)}}const i=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],f=h[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):f.onCurve?i.push({type:"M",x:f.x,y:f.y}):i.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,p=h.length;u<p;++u)if(c=f,f=h[(u+1)%p],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let d=f;f.onCurve||(d={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),i.push({type:"Q",x1:c.x,y1:c.y,x:d.x,y:d.y})}i.push({type:"Z"})}this.pathCommands=i}}class si extends ur{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new ri({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ai=(o,e,t,n)=>{for(var r=n>1?void 0:n?oi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ii(e,t,r),r};let An=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,i)=>r+i.byteLength,0),n=new An(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new si(this._sfnt))}};An=ai([dt("glyf")],An);var li=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,ci=(o,e,t,n)=>{for(var r=n>1?void 0:n?hi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&li(e,t,r),r};let br=class extends yt{};br=ci([dt("GPOS","gpos")],br);var fi=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,re=(o,e,t,n)=>{for(var r=n>1?void 0:n?ui(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&fi(e,t,r),r};let Qt=class extends yt{};re([g("uint16")],Qt.prototype,"majorVersion",2),re([g("uint16")],Qt.prototype,"minorVersion",2),re([g("uint16")],Qt.prototype,"scriptListOffset",2),re([g("uint16")],Qt.prototype,"featureListOffset",2),re([g("uint16")],Qt.prototype,"lookupListOffset",2),re([g("uint16")],Qt.prototype,"featureVariationsOffset",2),Qt=re([dt("GSUB","gsub")],Qt);var pi=Object.defineProperty,di=Object.getOwnPropertyDescriptor,ot=(o,e,t,n)=>{for(var r=n>1?void 0:n?di(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&pi(e,t,r),r};let it=class extends yt{constructor(o=new ArrayBuffer(54),e){super(o,e,Math.min(54,o.byteLength-(e??0)))}};ot([g("fixed")],it.prototype,"version",2),ot([g("fixed")],it.prototype,"fontRevision",2),ot([g("uint32")],it.prototype,"checkSumAdjustment",2),ot([g("uint32")],it.prototype,"magickNumber",2),ot([g("uint16")],it.prototype,"flags",2),ot([g("uint16")],it.prototype,"unitsPerEm",2),ot([g({type:"longDateTime"})],it.prototype,"created",2),ot([g({type:"longDateTime"})],it.prototype,"modified",2),ot([g("int16")],it.prototype,"xMin",2),ot([g("int16")],it.prototype,"yMin",2),ot([g("int16")],it.prototype,"xMax",2),ot([g("int16")],it.prototype,"yMax",2),ot([g("uint16")],it.prototype,"macStyle",2),ot([g("uint16")],it.prototype,"lowestRecPPEM",2),ot([g("int16")],it.prototype,"fontDirectionHint",2),ot([g("int16")],it.prototype,"indexToLocFormat",2),ot([g("int16")],it.prototype,"glyphDataFormat",2),it=ot([dt("head")],it);var yi=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,bt=(o,e,t,n)=>{for(var r=n>1?void 0:n?gi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&yi(e,t,r),r};let gt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};bt([g("fixed")],gt.prototype,"version",2),bt([g("int16")],gt.prototype,"ascent",2),bt([g("int16")],gt.prototype,"descent",2),bt([g("int16")],gt.prototype,"lineGap",2),bt([g("uint16")],gt.prototype,"advanceWidthMax",2),bt([g("int16")],gt.prototype,"minLeftSideBearing",2),bt([g("int16")],gt.prototype,"minRightSideBearing",2),bt([g("int16")],gt.prototype,"xMaxExtent",2),bt([g("int16")],gt.prototype,"caretSlopeRise",2),bt([g("int16")],gt.prototype,"caretSlopeRun",2),bt([g("int16")],gt.prototype,"caretOffset",2),bt([g({type:"int16",size:4})],gt.prototype,"reserved",2),bt([g("int16")],gt.prototype,"metricDataFormat",2),bt([g("uint16")],gt.prototype,"numOfLongHorMetrics",2),gt=bt([dt("hhea")],gt);var mi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,wi=(o,e,t,n)=>{for(var r=n>1?void 0:n?xi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&mi(e,t,r),r};let kn=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new kn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((i,s)=>(s<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};kn=wi([dt("hmtx")],kn);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,Si=(o,e,t,n)=>{for(var r=n>1?void 0:n?bi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&vi(e,t,r),r};let Sr=class extends yt{};Sr=Si([dt("kern","kern")],Sr);var Mi=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Pi=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ci(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Mi(e,t,r),r};let In=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new In(new ArrayBuffer(n));return e.forEach(i=>{t?r.view.writeUint32(i):r.view.writeUint16(i/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};In=Pi([dt("loca")],In);var Ti=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,mt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ai(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ti(e,t,r),r};let lt=class extends yt{constructor(o=new ArrayBuffer(32),e){super(o,e,Math.min(32,o.byteLength-(e??0)))}};mt([g("fixed")],lt.prototype,"version",2),mt([g("uint16")],lt.prototype,"numGlyphs",2),mt([g("uint16")],lt.prototype,"maxPoints",2),mt([g("uint16")],lt.prototype,"maxContours",2),mt([g("uint16")],lt.prototype,"maxComponentPoints",2),mt([g("uint16")],lt.prototype,"maxComponentContours",2),mt([g("uint16")],lt.prototype,"maxZones",2),mt([g("uint16")],lt.prototype,"maxTwilightPoints",2),mt([g("uint16")],lt.prototype,"maxStorage",2),mt([g("uint16")],lt.prototype,"maxFunctionDefs",2),mt([g("uint16")],lt.prototype,"maxInstructionDefs",2),mt([g("uint16")],lt.prototype,"maxStackElements",2),mt([g("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([g("uint16")],lt.prototype,"maxComponentElements",2),mt([g("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var ki=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Ke=(o,e,t,n)=>{for(var r=n>1?void 0:n?Ii(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ki(e,t,r),r};const Mr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},On={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Oi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Cr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let _e=class extends yt{constructor(){super(...arguments);M(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=On.Macintosh,i=Oi.Default,s=0;t.some(l=>l.platform===On.Microsoft&&l.encoding===Cr.UCS2&&l.language===1033)&&(r=On.Microsoft,i=Cr.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===i&&h.language===s&&Mr[h.nameId]&&(a[Mr[h.nameId]]=s===0?Bs(h.name):Es(h.name))}return a}};Ke([g("uint16")],_e.prototype,"format",2),Ke([g("uint16")],_e.prototype,"count",2),Ke([g("uint16")],_e.prototype,"stringOffset",2),_e=Ke([dt("name")],_e);var _i=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,j=(o,e,t,n)=>{for(var r=n>1?void 0:n?Bi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_i(e,t,r),r};let $=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};j([g("uint16")],$.prototype,"version",2),j([g("int16")],$.prototype,"xAvgCharWidth",2),j([g("uint16")],$.prototype,"usWeightClass",2),j([g("uint16")],$.prototype,"usWidthClass",2),j([g("uint16")],$.prototype,"fsType",2),j([g("uint16")],$.prototype,"ySubscriptXSize",2),j([g("uint16")],$.prototype,"ySubscriptYSize",2),j([g("uint16")],$.prototype,"ySubscriptXOffset",2),j([g("uint16")],$.prototype,"ySubscriptYOffset",2),j([g("uint16")],$.prototype,"ySuperscriptXSize",2),j([g("uint16")],$.prototype,"ySuperscriptYSize",2),j([g("uint16")],$.prototype,"ySuperscriptXOffset",2),j([g("uint16")],$.prototype,"ySuperscriptYOffset",2),j([g("uint16")],$.prototype,"yStrikeoutSize",2),j([g("uint16")],$.prototype,"yStrikeoutPosition",2),j([g("uint16")],$.prototype,"sFamilyClass",2),j([g({type:"uint8"})],$.prototype,"bFamilyType",2),j([g({type:"uint8"})],$.prototype,"bSerifStyle",2),j([g({type:"uint8"})],$.prototype,"bWeight",2),j([g({type:"uint8"})],$.prototype,"bProportion",2),j([g({type:"uint8"})],$.prototype,"bContrast",2),j([g({type:"uint8"})],$.prototype,"bStrokeVariation",2),j([g({type:"uint8"})],$.prototype,"bArmStyle",2),j([g({type:"uint8"})],$.prototype,"bLetterform",2),j([g({type:"uint8"})],$.prototype,"bMidline",2),j([g({type:"uint8"})],$.prototype,"bXHeight",2),j([g({type:"uint8",size:16})],$.prototype,"ulUnicodeRange",2),j([g({type:"char",size:4})],$.prototype,"achVendID",2),j([g("uint16")],$.prototype,"fsSelection",2),j([g("uint16")],$.prototype,"usFirstCharIndex",2),j([g("uint16")],$.prototype,"usLastCharIndex",2),j([g("int16")],$.prototype,"sTypoAscender",2),j([g("int16")],$.prototype,"sTypoDescender",2),j([g("int16")],$.prototype,"sTypoLineGap",2),j([g("uint16")],$.prototype,"usWinAscent",2),j([g("uint16")],$.prototype,"usWinDescent",2),j([g({offset:72,type:"uint8",size:8})],$.prototype,"ulCodePageRange",2),j([g({offset:72,type:"int16"})],$.prototype,"sxHeight",2),j([g("int16")],$.prototype,"sCapHeight",2),j([g("uint16")],$.prototype,"usDefaultChar",2),j([g("uint16")],$.prototype,"usBreakChar",2),j([g("uint16")],$.prototype,"usMaxContext",2),$=j([dt("OS/2","os2")],$);var Ei=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,qt=(o,e,t,n)=>{for(var r=n>1?void 0:n?Di(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ei(e,t,r),r};let Lt=class extends yt{constructor(o=new ArrayBuffer(32),e,t){super(o,e,t)}};qt([g("fixed")],Lt.prototype,"format",2),qt([g("fixed")],Lt.prototype,"italicAngle",2),qt([g("int16")],Lt.prototype,"underlinePosition",2),qt([g("int16")],Lt.prototype,"underlineThickness",2),qt([g("uint32")],Lt.prototype,"isFixedPitch",2),qt([g("uint32")],Lt.prototype,"minMemType42",2),qt([g("uint32")],Lt.prototype,"maxMemType42",2),qt([g("uint32")],Lt.prototype,"minMemType1",2),qt([g("uint32")],Lt.prototype,"maxMemType1",2),Lt=qt([dt("post")],Lt);var Ui=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,St=(o,e,t,n)=>{for(var r=n>1?void 0:n?Li(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ui(e,t,r),r};let xt=class extends yt{constructor(o=new ArrayBuffer(36),e){super(o,e,Math.min(36,o.byteLength-(e??0)))}};St([g("fixed")],xt.prototype,"version",2),St([g("int16")],xt.prototype,"vertTypoAscender",2),St([g("int16")],xt.prototype,"vertTypoDescender",2),St([g("int16")],xt.prototype,"vertTypoLineGap",2),St([g("int16")],xt.prototype,"advanceHeightMax",2),St([g("int16")],xt.prototype,"minTopSideBearing",2),St([g("int16")],xt.prototype,"minBottomSideBearing",2),St([g("int16")],xt.prototype,"yMaxExtent",2),St([g("int16")],xt.prototype,"caretSlopeRise",2),St([g("int16")],xt.prototype,"caretSlopeRun",2),St([g("int16")],xt.prototype,"caretOffset",2),St([g({type:"int16",size:4})],xt.prototype,"reserved",2),St([g("int16")],xt.prototype,"metricDataFormat",2),St([g("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var $i=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,zi=(o,e,t,n)=>{for(var r=n>1?void 0:n?Fi(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&$i(e,t,r),r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new _n(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const e=this._sfnt.maxp.numGlyphs,t=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((s,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};_n=zi([dt("vmtx")],_n);var ji=Object.defineProperty,Be=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&ji(e,t,r),r};class $t extends bn{constructor(){super(...arguments);M(this,"format","TrueType");M(this,"mimeType","font/ttf");M(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(he(t).getUint32(0))}static checksum(t){const n=he(t);let r=n.byteLength;for(;r%4;)r++;let i=0;for(let s=0,a=r/4;s<a;s+=4)s*4<r-4&&(i+=n.getUint32(s*4,!1));return i&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,i=Array.from(t.tableViews.values()).reduce((u,p)=>u+n(p.byteLength),0),s=new this(new ArrayBuffer(12+r*16+i));s.scalerType=65536,s.numTables=r;const a=Math.log(2);s.searchRange=Math.floor(Math.log(r)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=r*16-s.searchRange;let l=12+r*16,h=0;const c=s.getDirectories();t.tableViews.forEach((u,p)=>{const d=c[h++];d.tag=p,d.checkSum=this.checksum(u),d.offset=l,d.length=u.byteLength,s.view.writeBytes(u,l),l+=n(d.length)});const f=s.createSfnt().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Pe(this.view.buffer,t);return t+=n.view.byteLength,n})}createSfnt(){return new ce(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}M($t,"signature",new Set([65536,1953658213,1954115633])),Be([g("uint32")],$t.prototype,"scalerType"),Be([g("uint16")],$t.prototype,"numTables"),Be([g("uint16")],$t.prototype,"searchRange"),Be([g("uint16")],$t.prototype,"entrySelector"),Be([g("uint16")],$t.prototype,"rangeShift");class Qe extends $t{constructor(){super(...arguments);M(this,"format","OpenType");M(this,"mimeType","font/otf")}static from(t){return super.from(t)}}M(Qe,"signature",new Set([1330926671]));var Ni=Object.defineProperty,Ee=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&Ni(e,t,r),r};class de extends _t{constructor(e,t){super(e,t,20)}}Ee([g({type:"char",size:4})],de.prototype,"tag"),Ee([g("uint32")],de.prototype,"offset"),Ee([g("uint32")],de.prototype,"compLength"),Ee([g("uint32")],de.prototype,"origLength"),Ee([g("uint32")],de.prototype,"origChecksum");var qi=Object.defineProperty,Ot=(o,e,t,n)=>{for(var r=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(r=s(e,t,r)||r);return r&&qi(e,t,r),r};const Ct=(ee=class extends bn{constructor(){super(...arguments);M(this,"format","WOFF");M(this,"mimeType","font/woff");M(this,"_sfnt")}get subfontFormat(){return $t.is(this.flavor)?"TrueType":Qe.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(he(t).getUint32(0))}static checkSum(t){const n=he(t),r=n.byteLength,i=Math.floor(r/4);let s=0,a=0;for(;a<i;)s+=n.getUint32(4*a++,!1);let l=r-i*4;if(l){let h=i*4;for(;l>0;)s+=n.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,n=new ArrayBuffer(0)){const r=u=>u+3&-4,i=[];t.tableViews.forEach((u,p)=>{const d=he(Ps(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:p,view:d.byteLength<u.byteLength?d:u,rawView:u})});const s=i.length,a=i.reduce((u,p)=>u+r(p.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*s+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSfntSize=12+16*s+i.reduce((u,p)=>u+r(p.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return i.forEach(u=>{const p=f[c++];p.tag=u.tag,p.offset=h,p.compLength=u.view.byteLength,p.origChecksum=ee.checkSum(u.rawView),p.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(p.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new de(this.view.buffer,t);return t+=n.view.byteLength,n})}createSfnt(){return new ce(this.getDirectories().reduce((t,n)=>{const r=n.tag,i=this.view.byteOffset+n.offset,s=n.compLength,a=n.origLength,l=i+s;return t[r]=s>=a?new DataView(this.view.buffer,i,s):new DataView(Ts(new Uint8Array(this.view.buffer.slice(i,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);Ot([g("uint32")],Ct.prototype,"signature"),Ot([g("uint32")],Ct.prototype,"flavor"),Ot([g("uint32")],Ct.prototype,"length"),Ot([g("uint16")],Ct.prototype,"numTables"),Ot([g("uint16")],Ct.prototype,"reserved"),Ot([g("uint32")],Ct.prototype,"totalSfntSize"),Ot([g("uint16")],Ct.prototype,"majorVersion"),Ot([g("uint16")],Ct.prototype,"minorVersion"),Ot([g("uint32")],Ct.prototype,"metaOffset"),Ot([g("uint32")],Ct.prototype,"metaLength"),Ot([g("uint32")],Ct.prototype,"metaOrigLength"),Ot([g("uint32")],Ct.prototype,"privOffset"),Ot([g("uint32")],Ct.prototype,"privLength");let Bn=Ct;function Gi(o,e=!0){if($t.is(o))return new $t(o);if(Qe.is(o))return new Qe(o);if(Bn.is(o))return new Bn(o);if(e)throw new Error("Failed to parseFont")}const fn=class fn{constructor(){M(this,"fallbackFont");M(this,"loading",new Map);M(this,"loaded",new Map);M(this,"familyToUrl",new Map)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...fn.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${e}";
|
|
3
3
|
src: url(${t});
|
|
4
|
-
}`)),document.head.appendChild(r),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(r=>this.familyToUrl.get(r.trim())??this.familyToUrl.get(r)??r)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((n,i)=>n||this.loaded.get(i),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...s}=t,{src:a}=e;if(this.loaded.has(a))return r&&(this.loading.forEach(u=>u.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,s),this.loading.set(a,l)),r&&this.loading.forEach((u,p)=>{u!==l&&(u.cancel(),this.loading.delete(p))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=f(u);return t.noAdd||this.loaded.set(e.src,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,a),typeof document<"u"&&(n&&this.injectFontFace(g,u),i&&this.injectStyleTag(g,a))}),p}}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return f();throw u}).finally(()=>{this.loading.delete(a)});function h(){return e.family?Array.isArray(e.family)?e.family:[e.family]:[]}function c(u){return h().forEach(p=>{u.familySet.add(p)}),u}function f(u=new ArrayBuffer(0)){let p;function g(){return p||(p=u.byteLength?gi(u,!1):void 0),p}function m(){const d=g();if(d instanceof Ot||d instanceof wr)return d.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:g,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};x(Ke,"defaultRequestInit",{cache:"force-cache"});let xr=Ke;const yi=new xr,mi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function vr(o,e){const{fill:t="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:p="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=r,o.lineWidth=n,o.lineCap=i,o.lineJoin=mi[s],o.miterLimit=a,o.setLineDash(l),o.lineDashOffset=h,o.shadowOffsetX=c,o.shadowOffsetY=f,o.shadowBlur=u,o.shadowColor=p}class b{constructor(e=0,t=0){this.x=e,this.y=t}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(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const r=-e/180*Math.PI,n=this.x-t.x,i=-(this.y-t.y),s=Math.sin(r),a=Math.cos(r);return this.set(t.x+(n*a-i*s),t.y-(n*s+i*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,r={x:0,y:0}){const n=e<0?r.x-this.x+r.x:this.x,i=t<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(e),this.y=i*Math.abs(t),this}skew(e,t=0,r={x:0,y:0}){const n=this.x-r.x,i=this.y-r.y;return this.x=r.x+(n+Math.tan(e)*i),this.y=r.y+(i+Math.tan(t)*n),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new b(this.x,this.y)}}class N{constructor(e=0,t=0,r=0,n=0){this.left=e,this.top=t,this.width=r,this.height=n}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new N;if(e.length===1)return e[0].clone();const t=e[0],r=e.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new N(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new N(this.left,this.top,this.width,this.height)}}class St{constructor(e=1,t=0,r=0,n=0,i=1,s=0,a=0,l=0,h=1){x(this,"elements",[]);this.set(e,t,r,n,i,s,a,l,h)}set(e,t,r,n,i,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=n,c[2]=a,c[3]=t,c[4]=i,c[5]=l,c[6]=r,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,n=t.elements,i=this.elements,s=r[0],a=r[3],l=r[6],h=r[1],c=r[4],f=r[7],u=r[2],p=r[5],g=r[8],m=n[0],d=n[3],k=n[6],S=n[1],C=n[4],A=n[7],w=n[2],v=n[5],_=n[8];return i[0]=s*m+a*S+l*w,i[3]=s*d+a*C+l*v,i[6]=s*k+a*A+l*_,i[1]=h*m+c*S+f*w,i[4]=h*d+c*C+f*v,i[7]=h*k+c*A+f*_,i[2]=u*m+p*S+g*w,i[5]=u*d+p*C+g*v,i[8]=u*k+p*A+g*_,this}invert(){const e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*s-a*h,u=a*l-c*i,p=h*i-s*l,g=t*f+r*u+n*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return e[0]=f*m,e[1]=(n*h-c*r)*m,e[2]=(a*r-n*s)*m,e[3]=u*m,e[4]=(c*t-n*l)*m,e[5]=(n*i-a*t)*m,e[6]=p*m,e[7]=(r*l-h*t)*m,e[8]=(s*t-r*i)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(br.makeScale(e,t)),this}rotate(e){return this.premultiply(br.makeRotation(-e)),this}translate(e,t){return this.premultiply(br.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const br=new St;function on(o,e,t,r){const n=o*t+e*r,i=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/i)));return o*r-e*t<0&&(s=-s),s}function wi(o,e,t,r,n,i,s,a){if(e===0||t===0){o.lineTo(a.x,a.y);return}r=r*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(r)*l+Math.sin(r)*h,f=-Math.sin(r)*l+Math.cos(r)*h;let u=e*e,p=t*t;const g=c*c,m=f*f,d=g/u+m/p;if(d>1){const V=Math.sqrt(d);e=V*e,t=V*t,u=e*e,p=t*t}const k=u*m+p*g,S=(u*p-k)/k;let C=Math.sqrt(Math.max(0,S));n===i&&(C=-C);const A=C*e*f/t,w=-C*t*c/e,v=Math.cos(r)*A-Math.sin(r)*w+(s.x+a.x)/2,_=Math.sin(r)*A+Math.cos(r)*w+(s.y+a.y)/2,M=on(1,0,(c-A)/e,(f-w)/t),T=on((c-A)/e,(f-w)/t,(-c-A)/e,(-f-w)/t)%(Math.PI*2);o.ellipse(v,_,e,t,r,M,M+T,i===0)}function he(o,e){return o-(e-o)}function an(o,e){const t=new b,r=new b;for(let n=0,i=o.length;n<i;n++){const s=o[n];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),r.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),r.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),r.x=t.x+s.x2,r.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(he(t.x,r.x),he(t.y,r.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),r.x=t.x+s.x2,r.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(he(t.x,r.x),he(t.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),r.x=t.x+s.x1,r.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=he(t.x,r.x),l=he(t.y,r.y);r.x=a,r.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}r.copy(t),wi(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}const tt={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ut(o,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(d,k,S){const C=new SyntaxError(`Unexpected character "${d}" at index ${k}.`);throw C.partial=S,C}function p(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let g;const m=o.length;for(let d=0;d<m;d++){if(g=o[d],Array.isArray(e)&&e.includes(f.length%t)&&tt.FLAGS.test(g)){a=1,h=g,p();continue}if(a===0){if(tt.WHITESPACE.test(g))continue;if(tt.DIGIT.test(g)||tt.SIGN.test(g)){a=1,h=g;continue}if(tt.POINT.test(g)){a=2,h=g;continue}tt.COMMA.test(g)&&(l&&u(g,d,f),l=!0)}if(a===1){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.POINT.test(g)){h+=g,a=2;continue}if(tt.EXP.test(g)){a=3;continue}tt.SIGN.test(g)&&h.length===1&&tt.SIGN.test(h[0])&&u(g,d,f)}if(a===2){if(tt.DIGIT.test(g)){h+=g;continue}if(tt.EXP.test(g)){a=3;continue}tt.POINT.test(g)&&h[h.length-1]==="."&&u(g,d,f)}if(a===3){if(tt.DIGIT.test(g)){c+=g;continue}if(tt.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&tt.SIGN.test(c)&&u(g,d,f)}}tt.WHITESPACE.test(g)?(p(),a=0,l=!1):tt.COMMA.test(g)?(p(),a=0,l=!0):tt.SIGN.test(g)?(p(),a=1,h=g):tt.POINT.test(g)?(p(),a=2,h=g):u(g,d,f)}return p(),f}function xi(o){let e,t;const r=[];for(let n=0,i=o.length;n<i;n++){const s=o[n];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":r.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":r.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":r.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":r.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":r.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":r.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":r.push(s.type),e&&(t={x:e.x,y:e.y});break}}return r.join(" ")}const vi=/[a-df-z][^a-df-z]*/gi;function ln(o){const e=[],t=o.match(vi);if(!t)return e;for(let r=0,n=t.length;r<n;r++){const i=t[r],s=i.charAt(0),a=i.slice(1).trim();let l;switch(s){case"m":case"M":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Ut(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=Ut(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Ut(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Ut(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Ut(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Ut(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(i)}}return e}class Kt{constructor(){x(this,"arcLengthDivisions",200);x(this,"_cacheArcLengths");x(this,"_needsUpdate",!1)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),r=this.getPoint(1);return(t.x-e.x)*(r.y-t.y)-(t.y-e.y)*(r.x-t.x)<0}getPointAt(e,t=new b){return this.getPoint(this.getUToTMapping(e),t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}forEachControlPoints(e){return this.getControlPoints().forEach(e),this}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const t=[];let r,n=this.getPoint(0),i=0;t.push(0);for(let s=1;s<=e;s++)r=this.getPoint(s/e),i+=r.distanceTo(n),t.push(i),n=r;return this._cacheArcLengths=t,t}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(e,t){const r=this.getLengths();let n=0;const i=r.length;let s;t?s=t:s=e*r[i-1];let a=0,l=i-1,h;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),h=r[n]-s,h<0)a=n+1;else if(h>0)l=n-1;else{l=n;break}if(n=l,r[n]===s)return n/(i-1);const c=r[n],u=r[n+1]-c,p=(s-c)/u;return(n+p)/(i-1)}getTangent(e,t=new b){const n=Math.max(0,e-1e-4),i=Math.min(1,e+1e-4);return t.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new b){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let r=0,n=1,i=(r+n)/2;for(;n-r>t;){i=(r+n)/2;const s=this.getPoint(i);if(s.distanceTo(e)<t)return i;s.x<e.x?r=i:n=i}return i}matrix(e){return this.forEachControlPoints(t=>t.applyMatrix3(e)),this}getMinMax(e=b.MAX,t=b.MIN){return this.getPoints().forEach(r=>{e.min(r),t.max(r)}),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new N(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.getPoints().map((e,t)=>t===0?{type:"M",x:e.x,y:e.y}:{type:"L",x:e.x,y:e.y})}toData(){return xi(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function hn(o,e,t,r,n){const i=(r-e)*.5,s=(n-t)*.5,a=o*o,l=o*a;return(2*t-2*r+i+s)*l+(-3*t+3*r-2*i-s)*a+i*o+t}function bi(o,e){const t=1-o;return t*t*e}function Si(o,e){return 2*(1-o)*o*e}function Ci(o,e){return o*o*e}function cn(o,e,t,r){return bi(o,e)+Si(o,t)+Ci(o,r)}function Pi(o,e){const t=1-o;return t*t*t*e}function Mi(o,e){const t=1-o;return 3*t*t*o*e}function Ti(o,e){return 3*(1-o)*o*o*e}function ki(o,e){return o*o*o*e}function fn(o,e,t,r,n){return Pi(o,e)+Mi(o,t)+Ti(o,r)+ki(o,n)}class Ai extends Kt{constructor(e=new b,t=new b,r=new b,n=new b){super(),this.start=e,this.startControl=t,this.endControl=r,this.end=n}getPoint(e,t=new b){const{start:r,startControl:n,endControl:i,end:s}=this;return t.set(fn(e,r.x,n.x,i.x,s.x),fn(e,r.y,n.y,i.y,s.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(e,t,r){const n=t*t-4*e*r;if(n<0)return[];const i=Math.sqrt(n),s=(-t+i)/(2*e),a=(-t-i)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=b.MAX,t=b.MIN){const r=this.start,n=this.startControl,i=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(s.x-i.x)),l=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(s.y-i.y)),h=[0,1,...a,...l];return((f,u)=>{for(const p of f)for(let g=0;g<=u;g++){const m=g/u-.5,d=Math.min(1,Math.max(0,p+m)),k=this.getPoint(d);e.x=Math.min(e.x,k.x),e.y=Math.min(e.y,k.y),t.x=Math.max(t.x,k.x),t.y=Math.max(t.y,k.y)}})(h,10),{min:e,max:t}}toCommands(){const{start:e,startControl:t,endControl:r,end:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(e){const{start:t,startControl:r,endControl:n,end:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.startControl.copy(e.startControl),this.endControl.copy(e.endControl),this.end.copy(e.end),this}}const _i=new St,un=new St,pn=new St,Ge=new b;class Oi extends Kt{constructor(e=new b,t=1,r=1,n=0,i=0,s=Math.PI*2,a=!1){super(),this.center=e,this.radiusX=t,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=s,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(e,t=new b){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const s=this.startAngle+e*n;let a=this.center.x+this.radiusX*Math.cos(s),l=this.center.y+this.radiusY*Math.sin(s);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),f=a-this.center.x,u=l-this.center.y;a=f*h-u*c+this.center.x,l=f*c+u*h+this.center.y}return t.set(a,l)}toCommands(){const{center:e,radiusX:t,radiusY:r,startAngle:n,endAngle:i,clockwise:s,rotation:a}=this,{x:l,y:h}=e,c=l+t*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),f=h+t*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),u=Math.abs(n-i),p=u>Math.PI?1:0,g=s?1:0,m=a*180/Math.PI;if(u>=2*Math.PI){const d=n+Math.PI,k=l+t*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),S=h+t*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:c,y:f},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:k,y:S},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:0,sweepFlag:g,x:c,y:f}]}else{const d=l+t*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),k=h+t*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:c,y:f},{type:"A",rx:t,ry:r,angle:m,largeArcFlag:p,sweepFlag:g,x:d,y:k}]}}drawTo(e){const{center:t,radiusX:r,radiusY:n,rotation:i,startAngle:s,endAngle:a,clockwise:l}=this;return e.ellipse(t.x,t.y,r,n,i,s,a,!l),this}matrix(e){return Ge.set(this.center.x,this.center.y),Ge.applyMatrix3(e),this.center.x=Ge.x,this.center.y=Ge.y,Ei(e)?Ii(this,e):Bi(this,e),this}getControlPoints(){return[this.center]}getMinMax(e=b.MAX,t=b.MIN){const{center:r,radiusX:n,radiusY:i,rotation:s}=this,{x:a,y:l}=r,h=Math.cos(s),c=Math.sin(s),f=Math.sqrt(n*n*h*h+i*i*c*c),u=Math.sqrt(n*n*c*c+i*i*h*h);return e.x=Math.min(e.x,a-f),e.y=Math.min(e.y,l-u),t.x=Math.max(t.x,a+f),t.y=Math.max(t.y,l+u),{min:e,max:t}}copy(e){return super.copy(e),this.center.x=e.center.x,this.center.y=e.center.y,this.radiusX=e.radiusX,this.radiusY=e.radiusY,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}}function Ii(o,e){const t=o.radiusX,r=o.radiusY,n=Math.cos(o.rotation),i=Math.sin(o.rotation),s=new b(t*n,t*i),a=new b(-r*i,r*n),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=_i.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=un.copy(c).invert(),g=pn.copy(f).transpose().multiply(f).elements,m=Ui(g[0],g[1],g[4]),d=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(o.radiusX=1/d,o.radiusY=1/k,o.rotation=Math.atan2(m.sn,m.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const C=un.set(d,0,0,0,k,0,0,0,1),A=pn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=C.multiply(A).multiply(c),v=_=>{const{x:M,y:T}=new b(Math.cos(_),Math.sin(_)).applyMatrix3(w);return Math.atan2(T,M)};o.startAngle=v(o.startAngle),o.endAngle=v(o.endAngle),dn(e)&&(o.clockwise=!o.clockwise)}}function Bi(o,e){const t=gn(e),r=yn(e);o.radiusX*=t,o.radiusY*=r;const n=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotation+=n,dn(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function dn(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Ei(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const r=gn(o),n=yn(o);return Math.abs(t/(r*n))>Number.EPSILON}function gn(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function yn(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Ui(o,e,t){let r,n,i,s,a;const l=o+t,h=o-t,c=Math.sqrt(h*h+4*e*e);return l>0?(r=.5*(l+c),a=1/r,n=o*a*t-e*a*e):l<0?n=.5*(l-c):(r=.5*c,n=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(e)?(a=-2*e/i,s=1/Math.sqrt(1+a*a),i=a*s):Math.abs(e)===0?(i=1,s=0):(a=-.5*i/e,i=1/Math.sqrt(1+a*a),s=a*i),h>0&&(a=i,i=-s,s=a),{rt1:r,rt2:n,cs:i,sn:s}}class Sr extends Kt{constructor(e=new b,t=new b){super(),this.start=e,this.end=t}getPoint(e,t=new b){return e===1?t.copy(this.end):t.copy(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new b){return this.getPoint(e,t)}getTangent(e,t=new b){return t.subVectors(this.end,this.start).normalize()}getTangentAt(e,t=new b){return this.getTangent(e,t)}getControlPoints(){return[this.start,this.end]}getMinMax(e=b.MAX,t=b.MIN){const{start:r,end:n}=this;return e.x=Math.min(e.x,r.x,n.x),e.y=Math.min(e.y,r.y,n.y),t.x=Math.max(t.x,r.x,n.x),t.y=Math.max(t.y,r.y,n.y),{min:e,max:t}}toCommands(){const{start:e,end:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{start:t,end:r}=this;return e.lineTo(t.x,t.y),e.lineTo(r.x,r.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.end.copy(e.end),this}}class Di extends Kt{constructor(e=new b,t=new b,r=new b){super(),this.start=e,this.control=t,this.end=r}getPoint(e,t=new b){const{start:r,control:n,end:i}=this;return t.set(cn(e,r.x,n.x,i.x),cn(e,r.y,n.y,i.y)),t}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(e=b.MAX,t=b.MIN){const{start:r,control:n,end:i}=this,s=.5*(r.x+n.x),a=.5*(r.y+n.y),l=.5*(r.x+i.x),h=.5*(r.y+i.y);return e.x=Math.min(e.x,r.x,i.x,s,l),e.y=Math.min(e.y,r.y,i.y,a,h),t.x=Math.max(t.x,r.x,i.x,s,l),t.y=Math.max(t.y,r.y,i.y,a,h),{min:e,max:t}}toCommands(){const{start:e,control:t,end:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:r.x,y:r.y}]}drawTo(e){const{start:t,control:r,end:n}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.control.copy(e.control),this.end.copy(e.end),this}}class Li extends Kt{constructor(t,r,n=1,i=0,s=1){super();x(this,"curves",[]);x(this,"curveT",0);this.center=t,this.rx=r,this.aspectRatio=n,this.start=i,this.end=s,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:r}=this.center,n=this.rx,i=this.rx/this.aspectRatio,s=[new b(t-n,r-i),new b(t+n,r-i),new b(t+n,r+i),new b(t-n,r+i)];for(let a=0;a<4;a++)this.curves.push(new Sr(s[a].clone(),s[(a+1)%4].clone()));return this}getCurve(t){let r=(t*(this.end-this.start)+this.start)%1;r<0&&(r+=1),r*=(1+this.aspectRatio)*2;let n;return r<this.aspectRatio?(n=0,this.curveT=r/this.aspectRatio):r<this.aspectRatio+1?(n=1,this.curveT=(r-this.aspectRatio)/1):r<2*this.aspectRatio+1?(n=2,this.curveT=(r-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(r-2*this.aspectRatio-1)/1),this.curves[n]}getPoint(t,r){return this.getCurve(t).getPoint(this.curveT,r)}getPointAt(t,r){return this.getPoint(t,r)}getTangent(t,r){return this.getCurve(t).getTangent(this.curveT,r)}getNormal(t,r){return this.getCurve(t).getNormal(this.curveT,r)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,r=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,r)),{min:t,max:r}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(r=>r.drawTo(t)),this}}class $i extends Kt{constructor(e=[]){super(),this.points=e}getPoint(e,t=new b){const{points:r}=this,n=(r.length-1)*e,i=Math.floor(n),s=n-i,a=r[i===0?i:i-1],l=r[i],h=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return t.set(hn(s,a.x,l.x,h.x,c.x),hn(s,a.y,l.y,h.y,c.y)),t}getControlPoints(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++)this.points.push(e.points[t].clone());return this}}class ke extends Kt{constructor(t){super();x(this,"curves",[]);x(this,"startPoint");x(this,"currentPoint");x(this,"autoClose",!1);x(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 r=1,n=t.length;r<n;r++){const{x:i,y:s}=t[r];this.lineTo(i,s)}return this}addCommands(t){return an(t,this),this}addData(t){return this.addCommands(ln(t)),this}getPoint(t,r=new b){const n=t*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,l=this.curves[s],h=l.getLength();return l.getPointAt(h===0?0:1-a/h,r)}s++}return r}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 r=0;for(let n=0,i=this.curves.length;n<i;n++)r+=this.curves[n].getLength(),t.push(r);return this._cacheLengths=t,t}getSpacedPoints(t=40){const r=[];for(let n=0;n<=t;n++)r.push(this.getPoint(n/t));return this.autoClose&&r.push(r[0]),r}getPoints(t=12){const r=[],n=this.curves;let i;for(let s=0,a=n.length;s<a;s++){const h=n[s].getPoints(t);for(let c=0;c<h.length;c++){const f=h[c];i!=null&&i.equals(f)||(r.push(f),i=f)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}_setCurrentPoint(t){return this.currentPoint=new b(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const r=this.currentPoint;r&&!t.equals(r)&&(this.curves.push(new Sr(r.clone(),t)),r.copy(t)),this.startPoint=void 0}return this}moveTo(t,r){return this.currentPoint=new b(t,r),this.startPoint=this.currentPoint.clone(),this}lineTo(t,r){const n=this.currentPoint;return n!=null&&n.equals({x:t,y:r})||this.curves.push(new Sr((n==null?void 0:n.clone())??new b,new b(t,r))),this._setCurrentPoint({x:t,y:r}),this}bezierCurveTo(t,r,n,i,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(new Ai((l==null?void 0:l.clone())??new b,new b(t,r),new b(n,i),new b(s,a))),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,r,n,i){const s=this.currentPoint;return s!=null&&s.equals({x:n,y:i})||this.curves.push(new Di((s==null?void 0:s.clone())??new b,new b(t,r),new b(n,i))),this._setCurrentPoint({x:n,y:i}),this}arc(t,r,n,i,s,a){return this.ellipse(t,r,n,n,0,i,s,a),this}relativeArc(t,r,n,i,s,a){const l=this.currentPoint??new b;return this.arc(t+l.x,r+l.y,n,i,s,a),this}arcTo(t,r,n,i,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,r,n,i,s,a,l,h=!0){const c=new Oi(new b(t,r),n,i,s,a,l,!h);if(this.curves.length>0){const f=c.getPoint(0);(!this.currentPoint||!f.equals(this.currentPoint))&&this.lineTo(f.x,f.y)}return this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,r,n,i,s,a,l,h){const c=this.currentPoint??new b;return this.ellipse(t+c.x,r+c.y,n,i,s,a,l,h),this}rect(t,r,n,i){return this.curves.push(new Li(new b(t+n/2,r+i/2),n/2,n/i)),this._setCurrentPoint({x:t,y:r}),this}splineThru(t){const r=this.currentPoint??new b;return this.curves.push(new $i([r].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,r=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,r)),{min:t,max:r}}getBoundingBox(){const{min:t,max:r}=this.getMinMax();return new N(t.x,t.y,r.x-t.x,r.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var n;const r=(n=this.curves[0])==null?void 0:n.getPoint(0);return r&&t.moveTo(r.x,r.y),this.curves.forEach(i=>i.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var r;super.copy(t),this.curves=[];for(let n=0,i=t.curves.length;n<i;n++)this.curves.push(t.curves[n].clone());return this.autoClose=t.autoClose,this.currentPoint=(r=t.currentPoint)==null?void 0:r.clone(),this}}function zi(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Fi(o,e,t,r){const n=e.clone().sub(o),i=r.clone().sub(t),s=t.clone().sub(o),a=n.cross(i);if(a===0)return new b((o.x+t.x)/2,(o.y+t.y)/2);const l=s.cross(i)/a;return Math.abs(l)>1?new b((o.x+t.x)/2,(o.y+t.y)/2):new b(o.x+l*n.x,o.y+l*n.y)}class Ct{constructor(e,t={}){x(this,"currentPath",new ke);x(this,"paths",[this.currentPath]);x(this,"style");e&&(e instanceof Ct?this.addPath(e):Array.isArray(e)?this.addCommands(e):this.addData(e)),this.style=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(e){return e instanceof Ct?this.paths.push(...e.paths.map(t=>t.clone())):this.paths.push(e),this}closePath(){const e=this.startPoint;return e&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ke().moveTo(e.x,e.y),this.paths.push(this.currentPath))),this}moveTo(e,t){const{currentPoint:r,curves:n}=this.currentPath;return r!=null&&r.equals({x:e,y:t})||(n.length?(this.currentPath=new ke().moveTo(e,t),this.paths.push(this.currentPath)):this.currentPath.moveTo(e,t)),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}bezierCurveTo(e,t,r,n,i,s){return this.currentPath.bezierCurveTo(e,t,r,n,i,s),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}arc(e,t,r,n,i,s){return this.currentPath.arc(e,t,r,n,i,s),this}arcTo(e,t,r,n,i){return this.currentPath.arcTo(e,t,r,n,i),this}ellipse(e,t,r,n,i,s,a,l){return this.currentPath.ellipse(e,t,r,n,i,s,a,l),this}rect(e,t,r,n){return this.currentPath.rect(e,t,r,n),this}addCommands(e){return an(e,this),this}addData(e){return this.addCommands(ln(e)),this}splineThru(e){return this.currentPath.splineThru(e),this}getControlPoints(){return this.paths.flatMap(e=>e.getControlPoints())}getCurves(){return this.paths.flatMap(e=>e.curves)}scale(e,t=e,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(e,t,r)}),this}skew(e,t=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(e,t,r)}),this}rotate(e,t={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(e,t)}),this}bold(e){if(e===0)return this;const t=this.getCurves(),r=[],n=[],i=[];t.forEach((a,l)=>{const h=a.getControlPoints(),c=a.isClockwise();i[l]=h,n[l]=c;const f=h[0],u=h[h.length-1]??f;r.push({start:c?u:f,end:c?f:u,index:l})});const s=[];return r.forEach((a,l)=>{s[l]=[],r.forEach((h,c)=>{c!==l&&h.start.equals(a.end)&&s[l].push(h.index)})}),t.forEach((a,l)=>{const h=n[l];i[l].forEach(f=>{const u=a.getTForPoint(f),p=a.getNormal(u).scale(h?e:-e);f.add(p)})}),s.forEach((a,l)=>{const h=i[l];a.forEach(c=>{const f=i[c],u=Fi(h[h.length-1],h[h.length-2]??h[h.length-1],f[0],f[1]??f[0]);u&&(h[h.length-1].copy(u),f[0].copy(u))})}),this}matrix(e){return this.getCurves().forEach(t=>t.matrix(e)),this}getMinMax(e=b.MAX,t=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(e,t),r&&n>1){const s=n/2,a=i.isClockwise(),l=[];for(let h=0;h<=1;h+=1/i.arcLengthDivisions){const c=i.getPoint(h),f=i.getNormal(h),u=f.clone().scale(a?s:-s),p=f.clone().scale(a?-s:s);l.push(c.clone().add(u),c.clone().add(p),c.clone().add({x:s,y:0}),c.clone().add({x:-s,y:0}),c.clone().add({x:0,y:s}),c.clone().add({x:0,y:-s}),c.clone().add({x:s,y:s}),c.clone().add({x:-s,y:-s}))}e.min(...l),t.max(...l)}}),{min:e,max:t}}getBoundingBox(e=!0){const{min:t,max:r}=this.getMinMax(void 0,void 0,e);return new N(t.x,t.y,r.x-t.x,r.y-t.y)}drawTo(e,t={}){t={...this.style,...t};const{fill:r="#000",stroke:n="none"}=t;return e.beginPath(),e.save(),vr(e,t),this.paths.forEach(i=>{i.drawTo(e)}),r!=="none"&&e.fill(),n!=="none"&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};const{fill:r="#000",stroke:n="none"}=t;return e.beginPath(),e.save(),vr(e,t),this.getControlPoints().forEach(i=>{e.moveTo(i.x,i.y),e.arc(i.x,i.y,4,0,Math.PI*2)}),r!=="none"&&e.fill(),n!=="none"&&e.stroke(),e.restore(),this}toCommands(){return this.paths.flatMap(e=>e.toCommands())}toData(){return this.paths.map(e=>e.toData()).join(" ")}toSVGPathString(){const e={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},t={};for(const n in e)e[n]!==void 0&&(t[zi(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in t)t[n]!==void 0&&(r+=`${n}:${t[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSVGString(){const{x:e,y:t,width:r,height:n}=this.getBoundingBox(),i=this.toSVGPathString();return`<svg viewBox="${e} ${t} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...r}=e,{left:n,top:i,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-n,-i),this.drawTo(h,r)),l}copy(e){return this.currentPath=e.currentPath.clone(),this.paths=e.paths.map(t=>t.clone()),this.style={...e.style},this}clone(){return new this.constructor().copy(this)}}const Ni="px",qi=90,mn=["mm","cm","in","pt","pc","px"],wn={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 R(o){let e="px";if(typeof o=="string"||o instanceof String)for(let r=0,n=mn.length;r<n;r++){const i=mn[r];if(o.endsWith(i)){e=i,o=o.substring(0,o.length-i.length);break}}let t;return t=wn[e][Ni],t<0&&(t=wn[e].in*qi),t*Number.parseFloat(o)}const ji=new St,Re=new St,xn=new St,vn=new St;function Gi(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const r=Ri(o);return t.length>0&&r.premultiply(t[t.length-1]),e.copy(r),t.push(r),r}function Ri(o){const e=new St,t=ji;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(R(o.getAttribute("x")),R(o.getAttribute("y"))),o.hasAttribute("transform")){const r=o.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const s=i.indexOf("("),a=i.length;if(s>0&&s<a){const l=i.slice(0,s),h=Ut(i.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),Re.makeTranslation(-f,-u),xn.makeRotation(c),vn.multiplyMatrices(xn,Re),Re.makeTranslation(f,u),t.multiplyMatrices(Re,vn)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Vi(o){return new Ct().addPath(new ke().arc(R(o.getAttribute("cx")||0),R(o.getAttribute("cy")||0),R(o.getAttribute("r")||0),0,Math.PI*2))}function Wi(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const r=o.sheet.cssRules[t];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),i={};for(let s=r.style.length,a=0;a<s;a++){const l=r.style.item(a);i[l]=r.style.getPropertyValue(l)}for(let s=0;s<n.length;s++)e[n[s]]=Object.assign(e[n[s]]||{},{...i})}}function Xi(o){return new Ct().addPath(new ke().ellipse(R(o.getAttribute("cx")||0),R(o.getAttribute("cy")||0),R(o.getAttribute("rx")||0),R(o.getAttribute("ry")||0),0,0,Math.PI*2))}function Hi(o){return new Ct().moveTo(R(o.getAttribute("x1")||0),R(o.getAttribute("y1")||0)).lineTo(R(o.getAttribute("x2")||0),R(o.getAttribute("y2")||0))}function Yi(o){const e=new Ct,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Zi=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ki(o){var r;const e=new Ct;let t=0;return(r=o.getAttribute("points"))==null||r.replace(Zi,(n,i,s)=>{const a=R(i),l=R(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,n}),e.currentPath.autoClose=!0,e}const Qi=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ji(o){var r;const e=new Ct;let t=0;return(r=o.getAttribute("points"))==null||r.replace(Qi,(n,i,s)=>{const a=R(i),l=R(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,n}),e.currentPath.autoClose=!1,e}function to(o){const e=R(o.getAttribute("x")||0),t=R(o.getAttribute("y")||0),r=R(o.getAttribute("rx")||o.getAttribute("ry")||0),n=R(o.getAttribute("ry")||o.getAttribute("rx")||0),i=R(o.getAttribute("width")),s=R(o.getAttribute("height")),a=1-.551915024494,l=new Ct;return l.moveTo(e+r,t),l.lineTo(e+i-r,t),(r!==0||n!==0)&&l.bezierCurveTo(e+i-r*a,t,e+i,t+n*a,e+i,t+n),l.lineTo(e+i,t+s-n),(r!==0||n!==0)&&l.bezierCurveTo(e+i,t+s-n*a,e+i-r*a,t+s,e+i-r,t+s),l.lineTo(e+r,t+s),(r!==0||n!==0)&&l.bezierCurveTo(e+r*a,t+s,e,t+s-n*a,e,t+s-n),l.lineTo(e,t+n),(r!==0||n!==0)&&l.bezierCurveTo(e,t+n*a,e+r*a,t,e+r,t),l}function Dt(o,e,t){e=Object.assign({},e);let r={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)r=Object.assign(r,t[`.${h[c]}`])}o.hasAttribute("id")&&(r=Object.assign(r,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,c=0;c<h;c++){const f=o.style.item(c),u=o.style.getPropertyValue(f);e[f]=u,r[f]=u}function n(h,c,f=i){o.hasAttribute(h)&&(e[c]=f(o.getAttribute(h))),r[h]&&(e[c]=f(r[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,R(h)))}function a(h){return Math.max(0,R(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>R(c))}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",l),n("stroke-dashoffset","strokeDashoffset",R),n("visibility","visibility"),e}function Cr(o,e,t=[],r={}){var f;if(o.nodeType!==1)return t;let n=!1,i=null,s={...e};switch(o.nodeName){case"svg":s=Dt(o,s,r);break;case"style":Wi(o,r);break;case"g":s=Dt(o,s,r);break;case"path":s=Dt(o,s,r),o.hasAttribute("d")&&(i=Yi(o));break;case"rect":s=Dt(o,s,r),i=to(o);break;case"polygon":s=Dt(o,s,r),i=Ki(o);break;case"polyline":s=Dt(o,s,r),i=Ji(o);break;case"circle":s=Dt(o,s,r),i=Vi(o);break;case"ellipse":s=Dt(o,s,r),i=Xi(o);break;case"line":s=Dt(o,s,r),i=Hi(o);break;case"defs":n=!0;break;case"use":{s=Dt(o,s,r);const p=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("href")||"").substring(1),g=(f=o.viewportElement)==null?void 0:f.getElementById(p);g?Cr(g,s,t,r):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(o);break}if(s.display==="none")return t;Object.assign(e,s);const a=new St,l=[],h=Gi(o,a,l);i&&(i.matrix(a),t.push(i),i.style=e);const c=o.childNodes;for(let u=0,p=c.length;u<p;u++){const g=c[u];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Cr(g,e,t,r)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}const bn="data:image/svg+xml;",Sn=`${bn}base64,`,Cn=`${bn}charset=utf8,`;function Pn(o){if(typeof o=="string"){let e;o.startsWith(Sn)?(o=o.substring(Sn.length,o.length),e=atob(o)):o.startsWith(Cn)?(o=o.substring(Cn.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),r=t.querySelector("parsererror");if(r)throw new Error(`${r.textContent??"parser error"}
|
|
5
|
-
${e}`);return t.documentElement}else return o}function Mn(o){return Cr(Pn(o),{})}function Ae(o,e=!0){if(!o.length)return;const t=b.MAX,r=b.MIN;return o.forEach(n=>n.getMinMax(t,r,e)),new N(t.x,t.y,r.x-t.x,r.y-t.y)}const eo=new Set(["©","®","÷"]),ro=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),no={1:"italic",32:"bold"},so={1:"italic",2:"bold"},Tn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class kn{constructor(e,t,r){x(this,"path",new Ct);x(this,"lineBox",new N);x(this,"inlineBox",new N);x(this,"glyphBox");x(this,"advanceWidth",0);x(this,"advanceHeight",0);x(this,"underlinePosition",0);x(this,"underlineThickness",0);x(this,"strikeoutPosition",0);x(this,"strikeoutSize",0);x(this,"ascender",0);x(this,"descender",0);x(this,"typoAscender",0);x(this,"typoDescender",0);x(this,"typoLineGap",0);x(this,"winAscent",0);x(this,"winDescent",0);x(this,"xHeight",0);x(this,"capHeight",0);x(this,"baseline",0);x(this,"centerDiviation",0);x(this,"fontStyle");this.content=e,this.index=t,this.parent=r}get center(){var e;return(e=this.glyphBox)==null?void 0:e.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(e){const t=this.computedStyle.fontFamily,r=e??yi,n=t?r.get(t):r.fallbackFont;return n==null?void 0:n.getSfnt()}updateGlyph(e=this._getFontSfnt()){if(!e)return this;const{hhea:t,os2:r,post:n,head:i}=e,s=i.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,p=s/u,g=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/p,d=a/p;return this.advanceWidth=g,this.advanceHeight=m,this.inlineBox.width=f?m:g,this.inlineBox.height=f?g:m,this.underlinePosition=(a-n.underlinePosition)/p,this.underlineThickness=n.underlineThickness/p,this.strikeoutPosition=(a-r.yStrikeoutPosition)/p,this.strikeoutSize=r.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=r.sTypoAscender/p,this.typoDescender=r.sTypoDescender/p,this.typoLineGap=r.sTypoLineGap/p,this.winAscent=r.usWinAscent/p,this.winDescent=r.usWinDescent/p,this.xHeight=r.sxHeight/p,this.capHeight=r.sCapHeight/p,this.baseline=d,this.centerDiviation=m/2-d,this.fontStyle=no[r.fsSelection]??so[i.macStyle],this}update(e){const t=this._getFontSfnt(e);if(!t)return this;this.updateGlyph(t);const{isVertical:r,content:n,computedStyle:i,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:p}=this,{left:g,top:m}=a,d=i.fontStyle==="italic"&&f!=="italic";let k=g,S=m+s,C;const A=new Ct;if(r&&(k+=(p-u)/2,Math.abs(u-p)>.1&&(S-=(l-c)/(l+Math.abs(h))*p),C=void 0),r&&!eo.has(n)&&(n.codePointAt(0)<=256||ro.has(n))){A.addCommands(t.getPathCommands(n,k,m+s-(p-u)/2,i.fontSize));const v={y:m-(p-u)/2+p/2,x:k+u/2};d&&this._italic(A,r?{x:v.x,y:m-(p-u)/2+s}:void 0),A.rotate(90,v)}else C!==void 0?(A.addCommands(t.glyphs.get(C).getPathCommands(k,S,i.fontSize)),d&&this._italic(A,r?{x:k+u/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(A.addCommands(t.getPathCommands(n,k,S,i.fontSize)),d&&this._italic(A,r?{x:k+p/2,y:S}:void 0));const w=i.fontWeight??400;return w in Tn&&(w===700||w==="bold")&&f!=="bold"&&A.bold(Tn[w]*i.fontSize*.05),A.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=A,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(e,t,r)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:r,max:n}=t;return new N(r.x,r.y,n.x-r.x,n.y-r.y)}drawTo(e,t={}){const r=this.computedStyle,n={ctx:e,path:this.path,fontSize:r.fontSize,color:r.color,...t};if(this.glyphBox)re(n);else{e.save(),e.beginPath();const i=this.path.style,s={...i,fill:n.color??i.fill,stroke:n.textStrokeColor??i.stroke,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize:i.strokeWidth,shadowOffsetX:(n.shadowOffsetX??0)*n.fontSize,shadowOffsetY:(n.shadowOffsetY??0)*n.fontSize,shadowBlur:(n.shadowBlur??0)*n.fontSize,shadowColor:n.shadowColor};vr(e,s),e.font=`${n.fontSize}px ${n.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function Ve(o,e){return typeof o=="number"?o:o.endsWith("%")?(o=o.substring(0,o.length-1),Math.ceil(Number(o)/100*e.total)):o.endsWith("rem")?(o=o.substring(0,o.length-3),Number(o)*e.fontSize):o.endsWith("em")?(o=o.substring(0,o.length-2),Number(o)*e.fontSize):Number(o)}function Pr(o){const e=Nt(o)?{}:o;return Object.keys(e).reduce((t,r)=>{let n=e[r];const i=Mr(r),s=Mr(n);return i&&(r=i),s&&(n=s),t[r]=n,t},{})}function Nt(o){return!o||o==="none"}function An(o,e){const t=Object.keys(o),r=Object.keys(e);return Array.from(new Set([...t,...r])).every(i=>Qt(o[i],e[i]))}function Qt(o,e){const t=typeof o;return t===typeof e?t==="object"?An(o,e):o===e:!1}function Mr(o){const e=o.startsWith("#")?o.slice(1):o;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const r=e.length===3?e.split("").map(a=>a+a).join(""):e,n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),s=Number.parseInt(r.slice(4,6),16);return`rgb(${n}, ${i}, ${s})`}function We(o){if(!o)return o;const e={};for(const t in o)o[t]!==""&&o[t]!==void 0&&(e[t]=o[t]);return e}function Xe(o){return o.startsWith("http://")||o.startsWith("https://")||o.startsWith("blob://")}class _n{constructor(e,t={},r){x(this,"inlineBox",new N);this.content=e,this.style=t,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...We(this.style)},this}initCharacters(){const e=[];let t=0;for(const r of this.computedContent)e.push(new kn(r,t++,this));return this.characters=e,this}}class ce{constructor(e,t){x(this,"lineBox",new N);x(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...We(this.parentStyle),...We(this.style)},this}addFragment(e,t){const r=new _n(e,t,this);return this.fragments.push(r),r}}function io(o){return o}const ue=class ue{_styleToDomStyle(e){const t={};for(const r in e){const n=e[r];ue.notZeroStyles.has(r)&&n===0||(typeof n=="number"&&ue.pxStyles.has(r)?t[r]=`${n}px`:t[r]=n)}return t}createParagraphDom(e,t){const r=document.createDocumentFragment(),n=document.createElement("section"),i={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(t.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),n.appendChild(l),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var h;return(h=n.parentNode)==null?void 0:h.removeChild(n)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const r=e.data??"";let n=0;return Array.from(r).map(i=>{var f;const s=n+=r.substring(n).indexOf(i),a=s+i.length;n+=i.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],r=[],n=[];return e.querySelectorAll("li").forEach((i,s)=>{const a=i.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{n.push({...u,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(p=>{n.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:r,characters:n}}measureParagraphDom(e,t){const r=t.getBoundingClientRect(),n=this.measureDom(t);n.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-r.left,l.lineBox.top=a.top-r.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),n.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-r.left,l.inlineBox.top=a.top-r.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const i=[];let s=0;return n.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.push({...a,newParagraphIndex:l,left:a.left-r.left,top:a.top-r.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:p}=f,g=i[s];f.inlineBox.left=g.left,f.inlineBox.top=g.top,f.inlineBox.width=g.width,f.inlineBox.height=g.height,p?(f.lineBox.left=g.left+(g.width-u)/2,f.lineBox.top=g.top,f.lineBox.width=u,f.lineBox.height=g.height):(f.lineBox.left=g.left,f.lineBox.top=g.top+(g.height-u)/2,f.lineBox.width=g.width,f.lineBox.height=u),s++}),{paragraphs:e,boundingBox:new N(0,0,r.width,r.height)}}measure(e,t,r){let n;r||({dom:r,destory:n}=this.createParagraphDom(e,t));const i=this.measureParagraphDom(e,r);return n==null||n(),i}};x(ue,"notZeroStyles",new Set(["width","height"])),x(ue,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let He=ue;function oo(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function ao(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function lo(){return{...oo(),...ao()}}class ho{constructor(){x(this,"eventListeners",new Map)}addEventListener(e,t,r){const n={value:t,options:r},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(n):this.eventListeners.set(e,[i,n]):this.eventListeners.set(e,n),this}removeEventListener(e,t,r){var i,s;if(!t)return this.eventListeners.delete(e),this;const n=this.eventListeners.get(e);if(!n)return this;if(Array.isArray(n)){const a=[];for(let l=0,h=n.length;l<h;l++){const c=n[l];(c.value!==t||typeof r=="object"&&(r!=null&&r.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else n.value===t&&(typeof r=="boolean"||!(r!=null&&r.once)||typeof n.options=="boolean"||(s=n.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var n,i;const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let s=r.length,a=0;a<s;a++){const l=r[a];typeof l.options=="object"&&((n=l.options)!=null&&n.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof r.options=="object"&&((i=r.options)!=null&&i.once)&&this.off(e,r.value,r.options),r.value.apply(this,[t]);return!0}else return!1}on(e,t,r){return this.addEventListener(e,t,r)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,r){return this.removeEventListener(e,t,r)}emit(e,t){this.dispatchEvent(e,t)}}function Ye(o){const{highlight:e,highlightImage:t,highlightReferImage:r,highlightColormap:n,highlightLine:i,highlightSize:s,highlightThickness:a}=o;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??r??"none",colormap:(e==null?void 0:e.colormap)??n??"none",line:(e==null?void 0:e.line)??i??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function On(){const o=[],e=[],t=new Map,r=new Map;async function n(s){if(!t.has(s)){t.set(s,s);try{t.set(s,await fetch(s).then(a=>a.text()))}catch(a){console.warn(a),t.delete(s)}}}function i(s){let a=r.get(s);if(!a){const l=Pn(Xe(s)?t.get(s)??s:s),h=Mn(l);a={dom:l,paths:h},r.set(s,a)}return a}return{name:"highlight",paths:o,load:async s=>{const a=new Set;s.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:f}=Ye(h);Xe(c)&&a.add(c),Xe(f)&&a.add(f)}),await Promise.all(Array.from(a).map(l=>n(l)))},update:s=>{e.length=0,o.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=Ye(f),{image:p,colormap:g,line:m,size:d,thickness:k}=u;if(Nt(p))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:S,isVertical:C}=c,{fontSize:A}=f;(!h||Qt(h.image,p)&&Qt(h.colormap,g)&&Qt(h.line,m)&&Qt(h.size,d)&&Qt(h.thickness,k))&&(l!=null&&l.length)&&(C?l[0].inlineBox.left===S.left:l[0].inlineBox.top===S.top)&&l[0].fontSize===A?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const f=a[c],u=f[0],p=N.from(...f.filter(D=>D.glyphBox).map(D=>D.glyphBox)),{computedStyle:g}=u,{fontSize:m,writingMode:d}=g,{image:k,referImage:S,colormap:C,line:A,size:w,thickness:v}=Ye(g),_=d.includes("vertical"),M=Ve(v,{fontSize:m,total:p.width})/p.width,T=Pr(C),{paths:V,dom:H}=i(k),U=Ae(V,!0),et=m/U.width*2,P=new N().copy(p);_&&(P.width=p.height,P.height=p.width,P.left=p.left+p.width);const z=Math.floor(P.width);let q=z;if(w!=="cover"&&(q=Ve(w,{fontSize:m,total:p.width})||z,P.width=q),!Nt(S)&&Nt(A)){const D=Ae(i(S).paths,!0);U.copy(D)}else{let D;if(Nt(A))if(U.width/U.height>4){D="underline";const $=H.getAttribute("viewBox");if($){const[nt,O,Z,G]=$.split(" ").map(L=>Number(L)),j=O+G/2;U.y<j&&U.y+U.height>j?D="line-through":U.y+U.height<j?D="overline":D="underline"}}else D="outline";else D=A;switch(D){case"outline":{const $=P.width*.2,nt=P.height*.2;P.width+=$,P.height+=nt,_?(P.x-=nt/2,P.y-=$/2,P.x+=P.height):(P.x-=$/2,P.y-=nt/2);break}case"overline":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width:P.y=u.inlineBox.top;break;case"line-through":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width-u.strikeoutPosition+P.height/2:P.y=u.inlineBox.top+u.strikeoutPosition-P.height/2;break;case"underline":P.height=U.height*et,_?P.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:P.y=u.inlineBox.top+u.underlinePosition;break}}const F=new St().translate(-U.x,-U.y).scale(P.width/U.width,P.height/U.height);_&&F.rotate(-Math.PI/2),F.translate(P.x,P.y);for(let D=0;D<Math.ceil(z/q);D++){const $=F.clone();_?$.translate(0,D*P.width):$.translate(D*P.width,0),V.forEach(nt=>{const O=nt.clone().matrix($);O.style.strokeWidth&&(O.style.strokeWidth*=et*M),O.style.strokeMiterlimit&&(O.style.strokeMiterlimit*=et),O.style.strokeDashoffset&&(O.style.strokeDashoffset*=et),O.style.strokeDasharray&&(O.style.strokeDasharray=O.style.strokeDasharray.map(Z=>Z*et)),O.style.fill&&O.style.fill in T&&(O.style.fill=T[O.style.fill]),O.style.stroke&&O.style.stroke in T&&(O.style.stroke=T[O.style.stroke]),o.push(O),z!==q&&(_?e[o.length-1]=new N(p.left-p.width*2,p.top,p.width*4,p.height):e[o.length-1]=new N(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(s,a)=>{o.forEach((l,h)=>{if(re({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=Ae([l]);c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function co(o,e){return`<svg width="${o*2}" height="${o*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,i)=>r||this.loaded.get(i),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:i=!0,...s}=t,{src:a}=e;if(this.loaded.has(a))return n&&(this.loading.forEach(u=>u.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,s),this.loading.set(a,l)),n&&this.loading.forEach((u,p)=>{u!==l&&(u.cancel(),this.loading.delete(p))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const p=f(u);return t.noAdd||this.loaded.set(e.src,p),p.familySet.forEach(d=>{this.familyToUrl.set(d,a),typeof document<"u"&&(r&&this.injectFontFace(d,u),i&&this.injectStyleTag(d,a))}),p}}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return f();throw u}).finally(()=>{this.loading.delete(a)});function h(){return e.family?Array.isArray(e.family)?e.family:[e.family]:[]}function c(u){return h().forEach(p=>{u.familySet.add(p)}),u}function f(u=new ArrayBuffer(0)){let p;function d(){return p||(p=u.byteLength?Gi(u,!1):void 0),p}function m(){const y=d();if(y instanceof $t||y instanceof Bn)return y.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:d,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};M(fn,"defaultRequestInit",{cache:"force-cache"});let En=fn;const Ri=new En;function Vi(o,e,t=2){const n=e&&e.length,r=n?e[0]*t:o.length;let i=Pr(o,0,r,t,!0);const s=[];if(!i||i.next===i.prev)return s;let a,l,h;if(n&&(i=Yi(o,e,i,t)),o.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const p=o[u],d=o[u+1];p<a&&(a=p),d<l&&(l=d),p>c&&(c=p),d>f&&(f=d)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return De(i,s,t,a,l,h,0),s}function Pr(o,e,t,n,r){let i;if(r===ao(o,e,t,n)>0)for(let s=e;s<t;s+=n)i=Ir(s/n|0,o[s],o[s+1],i);else for(let s=t-n;s>=e;s-=n)i=Ir(s/n|0,o[s],o[s+1],i);return i&&ye(i,i.next)&&($e(i),i=i.next),i}function se(o,e){if(!o)return o;e||(e=o);let t=o,n;do if(n=!1,!t.steiner&&(ye(t,t.next)||tt(t.prev,t,t.next)===0)){if($e(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function De(o,e,t,n,r,i,s){if(!o)return;!s&&i&&eo(o,n,r,i);let a=o;for(;o.prev!==o.next;){const l=o.prev,h=o.next;if(i?Xi(o,n,r,i):Wi(o)){e.push(l.i,o.i,h.i),$e(o),o=h.next,a=h.next;continue}if(o=h,o===a){s?s===1?(o=Hi(se(o),e),De(o,e,t,n,r,i,2)):s===2&&Zi(o,e,t,n,r,i):De(se(o),e,t,n,r,i,1);break}}}function Wi(o){const e=o.prev,t=o,n=o.next;if(tt(e,t,n)>=0)return!1;const r=e.x,i=t.x,s=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,i,s),f=Math.min(a,l,h),u=Math.max(r,i,s),p=Math.max(a,l,h);let d=n.next;for(;d!==e;){if(d.x>=c&&d.x<=u&&d.y>=f&&d.y<=p&&Ue(r,a,i,l,s,h,d.x,d.y)&&tt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Xi(o,e,t,n){const r=o.prev,i=o,s=o.next;if(tt(r,i,s)>=0)return!1;const a=r.x,l=i.x,h=s.x,c=r.y,f=i.y,u=s.y,p=Math.min(a,l,h),d=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),A=Dn(p,d,e,t,n),C=Dn(m,y,e,t,n);let v=o.prevZ,P=o.nextZ;for(;v&&v.z>=A&&P&&P.z<=C;){if(v.x>=p&&v.x<=m&&v.y>=d&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0||(v=v.prevZ,P.x>=p&&P.x<=m&&P.y>=d&&P.y<=y&&P!==r&&P!==s&&Ue(a,c,l,f,h,u,P.x,P.y)&&tt(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;v&&v.z>=A;){if(v.x>=p&&v.x<=m&&v.y>=d&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;P&&P.z<=C;){if(P.x>=p&&P.x<=m&&P.y>=d&&P.y<=y&&P!==r&&P!==s&&Ue(a,c,l,f,h,u,P.x,P.y)&&tt(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function Hi(o,e){let t=o;do{const n=t.prev,r=t.next.next;!ye(n,r)&&Ar(n,t,t.next,r)&&Le(n,r)&&Le(r,n)&&(e.push(n.i,t.i,r.i),$e(t),$e(t.next),t=o=r),t=t.next}while(t!==o);return se(t)}function Zi(o,e,t,n,r,i){let s=o;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&so(s,a)){let l=kr(s,a);s=se(s,s.next),l=se(l,l.next),De(s,e,t,n,r,i,0),De(l,e,t,n,r,i,0);return}a=a.next}s=s.next}while(s!==o)}function Yi(o,e,t,n){const r=[];for(let i=0,s=e.length;i<s;i++){const a=e[i]*n,l=i<s-1?e[i+1]*n:o.length,h=Pr(o,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(ro(h))}r.sort(Ki);for(let i=0;i<r.length;i++)t=Qi(r[i],t);return t}function Ki(o,e){let t=o.x-e.x;if(t===0&&(t=o.y-e.y,t===0)){const n=(o.next.y-o.y)/(o.next.x-o.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Qi(o,e){const t=Ji(o,e);if(!t)return e;const n=kr(t,o);return se(n,n.next),se(t,t.next)}function Ji(o,e){let t=e;const n=o.x,r=o.y;let i=-1/0,s;if(ye(o,t))return t;do{if(ye(o,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>i&&(i=f,s=t.x<t.next.x?t:t.next,f===n))return s}t=t.next}while(t!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;t=s;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Tr(r<h?n:i,r,l,h,r<h?i:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Le(t,o)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&to(s,t)))&&(s=t,c=f)}t=t.next}while(t!==a);return s}function to(o,e){return tt(o.prev,o,e.prev)<0&&tt(e.next,o,o.next)<0}function eo(o,e,t,n){let r=o;do r.z===0&&(r.z=Dn(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==o);r.prevZ.nextZ=null,r.prevZ=null,no(r)}function no(o){let e,t=1;do{let n=o,r;o=null;let i=null;for(e=0;n;){e++;let s=n,a=0;for(let h=0;h<t&&(a++,s=s.nextZ,!!s);h++);let l=t;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),i?i.nextZ=r:o=r,r.prevZ=i,i=r;n=s}i.nextZ=null,t*=2}while(e>1);return o}function Dn(o,e,t,n,r){return o=(o-t)*r|0,e=(e-n)*r|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function ro(o){let e=o,t=o;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==o);return t}function Tr(o,e,t,n,r,i,s,a){return(r-s)*(e-a)>=(o-s)*(i-a)&&(o-s)*(n-a)>=(t-s)*(e-a)&&(t-s)*(i-a)>=(r-s)*(n-a)}function Ue(o,e,t,n,r,i,s,a){return!(o===s&&e===a)&&Tr(o,e,t,n,r,i,s,a)}function so(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!io(o,e)&&(Le(o,e)&&Le(e,o)&&oo(o,e)&&(tt(o.prev,o,e.prev)||tt(o,e.prev,e))||ye(o,e)&&tt(o.prev,o,o.next)>0&&tt(e.prev,e,e.next)>0)}function tt(o,e,t){return(e.y-o.y)*(t.x-e.x)-(e.x-o.x)*(t.y-e.y)}function ye(o,e){return o.x===e.x&&o.y===e.y}function Ar(o,e,t,n){const r=tn(tt(o,e,t)),i=tn(tt(o,e,n)),s=tn(tt(t,n,o)),a=tn(tt(t,n,e));return!!(r!==i&&s!==a||r===0&&Je(o,t,e)||i===0&&Je(o,n,e)||s===0&&Je(t,o,n)||a===0&&Je(t,e,n))}function Je(o,e,t){return e.x<=Math.max(o.x,t.x)&&e.x>=Math.min(o.x,t.x)&&e.y<=Math.max(o.y,t.y)&&e.y>=Math.min(o.y,t.y)}function tn(o){return o>0?1:o<0?-1:0}function io(o,e){let t=o;do{if(t.i!==o.i&&t.next.i!==o.i&&t.i!==e.i&&t.next.i!==e.i&&Ar(t,t.next,o,e))return!0;t=t.next}while(t!==o);return!1}function Le(o,e){return tt(o.prev,o,o.next)<0?tt(o,e,o.next)>=0&&tt(o,o.prev,e)>=0:tt(o,e,o.prev)<0||tt(o,o.next,e)<0}function oo(o,e){let t=o,n=!1;const r=(o.x+e.x)/2,i=(o.y+e.y)/2;do t.y>i!=t.next.y>i&&t.next.y!==t.y&&r<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==o);return n}function kr(o,e){const t=Un(o.i,o.x,o.y),n=Un(e.i,e.x,e.y),r=o.next,i=e.prev;return o.next=e,e.prev=o,t.next=r,r.prev=t,n.next=t,t.prev=n,i.next=n,n.prev=i,n}function Ir(o,e,t,n){const r=Un(o,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $e(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Un(o,e,t){return{i:o,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ao(o,e,t,n){let r=0;for(let i=e,s=t-n;i<t;i+=n)r+=(o[s]-o[i])*(o[i+1]+o[s+1]),s=i;return r}function lo(o,e,t,n={}){const{radius:r=1}=n;o.moveTo(e,t),o.arc(e,t,r,0,Math.PI*2)}const ho={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ln(o,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:p="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=n,o.lineWidth=r,o.lineCap=i,o.lineJoin=ho[s],o.miterLimit=a,o.setLineDash(l),o.lineDashOffset=h,o.shadowOffsetX=c,o.shadowOffsetY=f,o.shadowBlur=u,o.shadowColor=p}class B{constructor(e=0,t=0){this.x=e,this.y=t}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(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,i=-(this.y-t.y),s=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-i*s),t.y-(r*s+i*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,i=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=i*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,i=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*i),this.y=n.y+(i+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new B(this.x,this.y)}}class H{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new B((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new H;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,i)=>(r.left=Math.min(r.left,i.left),r.top=Math.min(r.top,i.top),r.right=Math.max(r.right,i.right),r.bottom=Math.max(r.bottom,i.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new H(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new H(this.left,this.top,this.width,this.height)}}class Pt{constructor(e=1,t=0,n=0,r=0,i=1,s=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,i,s,a,l,h)}set(e,t,n,r,i,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=i,c[5]=l,c[6]=n,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,s=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],p=n[5],d=n[8],m=r[0],y=r[3],A=r[6],C=r[1],v=r[4],P=r[7],w=r[2],b=r[5],S=r[8];return i[0]=s*m+a*C+l*w,i[3]=s*y+a*v+l*b,i[6]=s*A+a*P+l*S,i[1]=h*m+c*C+f*w,i[4]=h*y+c*v+f*b,i[7]=h*A+c*P+f*S,i[2]=u*m+p*C+d*w,i[5]=u*y+p*v+d*b,i[8]=u*A+p*P+d*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*s-a*h,u=a*l-c*i,p=h*i-s*l,d=t*f+n*u+r*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*s)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*i-a*t)*m,e[6]=p*m,e[7]=(n*l-h*t)*m,e[8]=(s*t-n*i)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply($n.makeScale(e,t)),this}rotate(e){return this.premultiply($n.makeRotation(-e)),this}translate(e,t){return this.premultiply($n.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const $n=new Pt;function Or(o,e,t,n){const r=o*t+e*n,i=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/i)));return o*n-e*t<0&&(s=-s),s}function co(o,e,t,n,r,i,s,a){if(e===0||t===0){o.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,f=-Math.sin(n)*l+Math.cos(n)*h;let u=e*e,p=t*t;const d=c*c,m=f*f,y=d/u+m/p;if(y>1){const F=Math.sqrt(y);e=F*e,t=F*t,u=e*e,p=t*t}const A=u*m+p*d,C=(u*p-A)/A;let v=Math.sqrt(Math.max(0,C));r===i&&(v=-v);const P=v*e*f/t,w=-v*t*c/e,b=Math.cos(n)*P-Math.sin(n)*w+(s.x+a.x)/2,S=Math.sin(n)*P+Math.cos(n)*w+(s.y+a.y)/2,x=Or(1,0,(c-P)/e,(f-w)/t),I=Or((c-P)/e,(f-w)/t,(-c-P)/e,(-f-w)/t)%(Math.PI*2);o.ellipse(b,S,e,t,n,x,x+I,i===0)}const st={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Gt(o,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,A,C){const v=new SyntaxError(`Unexpected character "${y}" at index ${A}.`);throw v.partial=C,v}function p(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let d;const m=o.length;for(let y=0;y<m;y++){if(d=o[y],Array.isArray(e)&&e.includes(f.length%t)&&st.FLAGS.test(d)){a=1,h=d,p();continue}if(a===0){if(st.WHITESPACE.test(d))continue;if(st.DIGIT.test(d)||st.SIGN.test(d)){a=1,h=d;continue}if(st.POINT.test(d)){a=2,h=d;continue}st.COMMA.test(d)&&(l&&u(d,y,f),l=!0)}if(a===1){if(st.DIGIT.test(d)){h+=d;continue}if(st.POINT.test(d)){h+=d,a=2;continue}if(st.EXP.test(d)){a=3;continue}st.SIGN.test(d)&&h.length===1&&st.SIGN.test(h[0])&&u(d,y,f)}if(a===2){if(st.DIGIT.test(d)){h+=d;continue}if(st.EXP.test(d)){a=3;continue}st.POINT.test(d)&&h[h.length-1]==="."&&u(d,y,f)}if(a===3){if(st.DIGIT.test(d)){c+=d;continue}if(st.SIGN.test(d)){if(c===""){c+=d;continue}c.length===1&&st.SIGN.test(c)&&u(d,y,f)}}st.WHITESPACE.test(d)?(p(),a=0,l=!1):st.COMMA.test(d)?(p(),a=0,l=!0):st.SIGN.test(d)?(p(),a=1,h=d):st.POINT.test(d)?(p(),a=2,h=d):u(d,y,f)}return p(),f}function ge(o,e){return o-(e-o)}function _r(o,e){const t=new B,n=new B;for(let r=0,i=o.length;r<i;r++){const s=o[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=ge(t.x,n.x),l=ge(t.y,n.y);n.x=a,n.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),co(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function fo(o){let e,t;const n=[];for(let r=0,i=o.length;r<i;r++){const s=o[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const uo=/[a-df-z][^a-df-z]*/gi;function Br(o){const e=[],t=o.match(uo);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const i=t[n],s=i.charAt(0),a=i.slice(1).trim();let l;switch(s){case"m":case"M":l=Gt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Gt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=Gt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=Gt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Gt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Gt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Gt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Gt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Gt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(i)}}return e}function Er(o,e,t,n,r){const i=(n-e)*.5,s=(r-t)*.5,a=o*o,l=o*a;return(2*t-2*n+i+s)*l+(-3*t+3*n-2*i-s)*a+i*o+t}function po(o,e){const t=1-o;return t*t*t*e}function yo(o,e){const t=1-o;return 3*t*t*o*e}function go(o,e){return 3*(1-o)*o*o*e}function mo(o,e){return o*o*o*e}function Dr(o,e,t,n,r){return po(o,e)+yo(o,t)+go(o,n)+mo(o,r)}function xo(o,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:i=2,verticesOffset:s=0,indicesOffset:a=0}=e;const l=Vi(o,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+s,n[a++]=l[c+1]+s,n[a++]=l[c+2]+s;let h=s*i;for(let c=0;c<o.length;c+=2)t[h]=o[c],t[h+1]=o[c+1],h+=i}return{vertices:t,indices:n}}const wo=8,en=11920929e-14,vo=1;function bo(o,e,t,n,r,i,s,a,l=.5,h){const f=Math.min(.99,Math.max(0,l));let u=(vo-f)/1;return u*=u,Fn(o,e,t,n,r,i,s,a,h,u,0),h.push(s,a),h}function Fn(o,e,t,n,r,i,s,a,l,h,c){if(c>wo)return;const f=(o+t)/2,u=(e+n)/2,p=(t+r)/2,d=(n+i)/2,m=(r+s)/2,y=(i+a)/2,A=(f+p)/2,C=(u+d)/2,v=(p+m)/2,P=(d+y)/2,w=(A+v)/2,b=(C+P)/2;if(c>0){let S=s-o,x=a-e;const I=Math.abs((t-s)*x-(n-a)*S),F=Math.abs((r-s)*x-(i-a)*S);if(I>en&&F>en){if((I+F)*(I+F)<=h*(S*S+x*x)){l.push(w,b);return}}else if(I>en){if(I*I<=h*(S*S+x*x)){l.push(w,b);return}}else if(F>en){if(F*F<=h*(S*S+x*x)){l.push(w,b);return}}else if(S=w-(o+s)/2,x=b-(e+a)/2,S*S+x*x<=h){l.push(w,b);return}}Fn(o,e,f,u,A,C,w,b,l,h,c+1),Fn(w,b,v,P,m,y,s,a,l,h,c+1)}const So=8,Mo=11920929e-14,Co=1;function Po(o,e,t,n,r,i,s=.5,a){const h=Math.min(.99,Math.max(0,s));let c=(Co-h)/1;return c*=c,zn(a,o,e,t,n,r,i,c,0),a.push(r,i),a}function zn(o,e,t,n,r,i,s,a,l){if(l>So)return;const h=(e+n)/2,c=(t+r)/2,f=(n+i)/2,u=(r+s)/2,p=(h+f)/2,d=(c+u)/2;let m=i-e,y=s-t;const A=Math.abs((n-i)*y-(r-s)*m);if(A>Mo){if(A*A<=a*(m*m+y*y)){o.push(p,d);return}}else if(m=p-(e+i)/2,y=d-(t+s)/2,m*m+y*y<=a){o.push(p,d);return}zn(o,e,t,h,c,p,d,a,l+1),zn(o,p,d,f,u,i,s,a,l+1)}function To(o,e){const t=1-o;return t*t*e}function Ao(o,e){return 2*(1-o)*o*e}function ko(o,e){return o*o*e}function Ur(o,e,t,n){return To(o,e)+Ao(o,t)+ko(o,n)}const Io=1e-4,Lr=1e-4;function Oo(o,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:i=!1,closed:s=!0}=e,a=Io;if(o.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=_o(o);i&&(L*=-1),h=(h-.5)*L+.5}const c={x:o[0],y:o[1]},f={x:o[o.length-2],y:o[o.length-1]},u=s,p=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){o=o.slice(),p&&(o.pop(),o.pop(),f.x=o[o.length-2],f.y=o[o.length-1]);const L=(c.x+f.x)*.5,D=(f.y+c.y)*.5;o.unshift(L,D),o.push(L,D)}const d=t,m=o.length/2;let y=o.length;const A=d.length/2,C=l.width/2,v=C*C,P=l.miterLimit*l.miterLimit;let w=o[0],b=o[1],S=o[2],x=o[3],I=0,F=0,E=-(b-x),k=w-S,z=0,T=0,U=Math.sqrt(E*E+k*k);E/=U,k/=U,E*=C,k*=C;const W=h,_=(1-W)*2,O=W*2;u||(l.cap==="round"?y+=ie(w-E*(_-O)*.5,b-k*(_-O)*.5,w-E*_,b-k*_,w+E*O,b+k*O,d,!0)+2:l.cap==="square"&&(y+=$r(w,b,E,k,_,O,!0,d))),d.push(w-E*_,b-k*_),d.push(w+E*O,b+k*O);for(let L=1;L<m-1;++L){w=o[(L-1)*2],b=o[(L-1)*2+1],S=o[L*2],x=o[L*2+1],I=o[(L+1)*2],F=o[(L+1)*2+1],E=-(b-x),k=w-S,U=Math.sqrt(E*E+k*k),E/=U,k/=U,E*=C,k*=C,z=-(x-F),T=S-I,U=Math.sqrt(z*z+T*T),z/=U,T/=U,z*=C,T*=C;const D=S-w,Z=b-x,V=S-I,R=F-x,N=D*V+Z*R,K=Z*V-R*D,X=K<0;if(Math.abs(K)<.001*Math.abs(N)){d.push(S-E*_,x-k*_),d.push(S+E*O,x+k*O),N>=0&&(l.join==="round"?y+=ie(S,x,S-E*_,x-k*_,S-z*_,x-T*_,d,!1)+4:y+=2,d.push(S-z*O,x-T*O),d.push(S+z*_,x+T*_));continue}const nt=(-E+w)*(-k+x)-(-E+S)*(-k+b),Vt=(-z+I)*(-T+x)-(-z+S)*(-T+F),Bt=(D*Vt-V*nt)/K,Mt=(R*nt-Z*Vt)/K,At=(Bt-S)*(Bt-S)+(Mt-x)*(Mt-x),ht=S+(Bt-S)*_,kt=x+(Mt-x)*_,Ft=S-(Bt-S)*O,zt=x-(Mt-x)*O,Et=Math.min(D*D+Z*Z,V*V+R*R),as=X?_:O,ya=Et+as*as*v;At<=ya?l.join==="bevel"||At/v>P?(X?(d.push(ht,kt),d.push(S+E*O,x+k*O),d.push(ht,kt),d.push(S+z*O,x+T*O)):(d.push(S-E*_,x-k*_),d.push(Ft,zt),d.push(S-z*_,x-T*_),d.push(Ft,zt)),y+=2):l.join==="round"?X?(d.push(ht,kt),d.push(S+E*O,x+k*O),y+=ie(S,x,S+E*O,x+k*O,S+z*O,x+T*O,d,!0)+4,d.push(ht,kt),d.push(S+z*O,x+T*O)):(d.push(S-E*_,x-k*_),d.push(Ft,zt),y+=ie(S,x,S-E*_,x-k*_,S-z*_,x-T*_,d,!1)+4,d.push(S-z*_,x-T*_),d.push(Ft,zt)):(d.push(ht,kt),d.push(Ft,zt)):(d.push(S-E*_,x-k*_),d.push(S+E*O,x+k*O),l.join==="round"?X?y+=ie(S,x,S+E*O,x+k*O,S+z*O,x+T*O,d,!0)+2:y+=ie(S,x,S-E*_,x-k*_,S-z*_,x-T*_,d,!1)+2:l.join==="miter"&&At/v<=P&&(X?(d.push(Ft,zt),d.push(Ft,zt)):(d.push(ht,kt),d.push(ht,kt)),y+=2),d.push(S-z*_,x-T*_),d.push(S+z*O,x+T*O),y+=2)}w=o[(m-2)*2],b=o[(m-2)*2+1],S=o[(m-1)*2],x=o[(m-1)*2+1],E=-(b-x),k=w-S,U=Math.sqrt(E*E+k*k),E/=U,k/=U,E*=C,k*=C,d.push(S-E*_,x-k*_),d.push(S+E*O,x+k*O),u||(l.cap==="round"?y+=ie(S-E*(_-O)*.5,x-k*(_-O)*.5,S-E*_,x-k*_,S+E*O,x+k*O,d,!1)+2:l.cap==="square"&&(y+=$r(S,x,E,k,_,O,!1,d)));const G=Lr*Lr;for(let L=A;L<y+A-2;++L)w=d[L*2],b=d[L*2+1],S=d[(L+1)*2],x=d[(L+1)*2+1],I=d[(L+2)*2],F=d[(L+2)*2+1],!(Math.abs(w*(x-F)+S*(F-b)+I*(b-x))<G)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function _o(o){const e=o.length;if(e<6)return 1;let t=0;for(let n=0,r=o[e-2],i=o[e-1];n<e;n+=2){const s=o[n],a=o[n+1];t+=(s-r)*(a+i),r=s,i=a}return t<0?-1:1}function $r(o,e,t,n,r,i,s,a){const l=o-t*r,h=e-n*r,c=o+t*i,f=e+n*i;let u,p;s?(u=n,p=-t):(u=-n,p=t);const d=l+u,m=h+p,y=c+u,A=f+p;return a.push(d,m),a.push(y,A),2}function ie(o,e,t,n,r,i,s,a){const l=t-o,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-o,i-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const p=f-c,d=Math.abs(p),m=Math.sqrt(l*l+h*h),y=(15*d*Math.sqrt(m)/Math.PI>>0)+1,A=p/y;if(u+=A,a){s.push(o,e),s.push(t,n);for(let C=1,v=u;C<y;C++,v+=A)s.push(o,e),s.push(o+Math.sin(v)*m,e+Math.cos(v)*m);s.push(o,e),s.push(r,i)}else{s.push(t,n),s.push(o,e);for(let C=1,v=u;C<y;C++,v+=A)s.push(o+Math.sin(v)*m,e+Math.cos(v)*m),s.push(o,e);s.push(r,i),s.push(o,e)}return y*2}class me{constructor(){M(this,"startT",0);M(this,"endT",1);M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new B){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}getUnevenPointArray(e=5,t=[]){const n=new B;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new B;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const i=e[n],s=e[n+1];t.push(new B(i,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){const s=this.getPoint(i/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let s=0,a=0,l=r-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=n[s]-i,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,n[s]===i)return s/(r-1);const c=n[s],u=n[s+1]-c,p=(i-c)/u;return(s+p)/(r-1)}getTangent(e,t=new B){const r=Math.max(0,e-1e-4),i=Math.min(1,e+1e-4);return t.copy(this.getPoint(i).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new B){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;const s=this.getPoint(i);if(s.distanceTo(e)<t)return i;s.x<e.x?n=i:r=i}return i}matrix(e){return this.getControlPointRefs().forEach(t=>t.applyMatrix3(e)),this}getMinMax(e=B.MAX,t=B.MIN){const n=this.getPoints();for(let r=0,i=n.length;r<i;r++){const s=n[r];e.min(s),t.max(s)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return xo(this.getPoints().reduce((t,n)=>(t.push(n.x,n.y),t),[]),e)}strokeTriangulate(e){return Oo(this.getPoints().reduce((t,n)=>(t.push(n.x,n.y),t),[]),e)}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const i=t[n];n===0?e.push({type:"M",x:i.x,y:i.y}):e.push({type:"L",x:i.x,y:i.y})}return e}toData(){return fo(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Bo=new Pt,Fr=new Pt,zr=new Pt,nn=new B;class jr extends me{constructor(t=0,n=0,r=1,i=1,s=0,a=0,l=Math.PI*2,h=!1){super();M(this,"center");M(this,"radius");this.rotation=s,this.startAngle=a,this.endAngle=l,this.clockwise=h,this.center=new B(t,n),this.radius=new B(r,i)}isClockwise(){return this.clockwise}getPoint(t,n=new B){const r=Math.PI*2;let i=this.endAngle-this.startAngle;const s=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(s?i=0:i=r),this.clockwise&&!s&&(i===r?i=-r:i=i-r);const a=this.startAngle+t*i;let l=this.center.x+this.radius.x*Math.cos(a),h=this.center.y+this.radius.y*Math.sin(a);if(this.rotation!==0){const c=Math.cos(this.rotation),f=Math.sin(this.rotation),u=l-this.center.x,p=h-this.center.y;l=u*c-p*f+this.center.x,h=u*f+p*c+this.center.y}return n.set(l,h)}toCommands(){const{center:t,radius:n,startAngle:r,endAngle:i,clockwise:s,rotation:a}=this,{x:l,y:h}=t,{x:c,y:f}=n,u=l+c*Math.cos(r)*Math.cos(a)-f*Math.sin(r)*Math.sin(a),p=h+c*Math.cos(r)*Math.sin(a)+f*Math.sin(r)*Math.cos(a),d=Math.abs(r-i),m=d>Math.PI?1:0,y=s?1:0,A=a*180/Math.PI;if(d>=2*Math.PI){const C=r+Math.PI,v=l+c*Math.cos(C)*Math.cos(a)-f*Math.sin(C)*Math.sin(a),P=h+c*Math.cos(C)*Math.sin(a)+f*Math.sin(C)*Math.cos(a);return[{type:"M",x:u,y:p},{type:"A",rx:c,ry:f,angle:A,largeArcFlag:0,sweepFlag:y,x:v,y:P},{type:"A",rx:c,ry:f,angle:A,largeArcFlag:0,sweepFlag:y,x:u,y:p}]}else{const C=l+c*Math.cos(i)*Math.cos(a)-f*Math.sin(i)*Math.sin(a),v=h+c*Math.cos(i)*Math.sin(a)+f*Math.sin(i)*Math.cos(a);return[{type:"M",x:u,y:p},{type:"A",rx:c,ry:f,angle:A,largeArcFlag:m,sweepFlag:y,x:C,y:v}]}}drawTo(t){const{center:n,radius:r,rotation:i,startAngle:s,endAngle:a,clockwise:l}=this;return t.ellipse(n.x,n.y,r.x,r.y,i,s,a,!l),this}matrix(t){return nn.set(this.center.x,this.center.y),nn.applyMatrix3(t),this.center.x=nn.x,this.center.y=nn.y,Uo(t)?Eo(this,t):Do(this,t),this}getControlPointRefs(){return[this.center]}getAdaptivePointArray(t=[]){const n=t.length-1,r=this.center.x,i=this.center.y,s=this.radius.x,a=this.radius.y,l=0,h=0;if(!(s>=0&&a>=0&&l>=0&&h>=0))return t;const c=Math.ceil(2.3*Math.sqrt(s+a)),f=c*8+0+0;if(f===0)return t;if(c===0)return t[n]=t[n+6]=r+l,t[n+1]=t[n+3]=i+h,t[n+2]=t[n+4]=r-l,t[n+5]=t[n+7]=i-h,t;let u=n,p=c*4+0+2+n,d=p,m=f+n,y=l+s,A=h,C=r+y,v=r-y,P=i+A;t[u++]=C,t[u++]=P,t[--p]=P,t[--p]=v;for(let b=1;b<c;b++){const S=Math.PI/2*(b/c),x=l+Math.cos(S)*s,I=h+Math.sin(S)*a,F=r+x,E=r-x,k=i+I,z=i-I;t[u++]=F,t[u++]=k,t[--p]=k,t[--p]=E,t[d++]=E,t[d++]=z,t[--m]=z,t[--m]=F}y=l,A=h+a,C=r+y,v=r-y,P=i+A;const w=i-A;return t[u++]=C,t[u++]=P,t[--m]=w,t[--m]=C,t}fillTriangulate(t={}){let{vertices:n=[],indices:r=[],verticesStride:i=2,verticesOffset:s=0,indicesOffset:a=0}=t;const l=this.getAdaptivePointArray();if(l.length===0)return{vertices:n,indices:r};let h=0,c=0;for(let p=0;p<l.length;p+=2)h+=l[p],c+=l[p+1];h/=l.length/2,c/=l.length/2;let f=s;n[f*i]=h,n[f*i+1]=c;const u=f++;for(let p=0;p<l.length;p+=2)n[f*i]=l[p],n[f*i+1]=l[p+1],p>0&&(r[a++]=f,r[a++]=u,r[a++]=f-1),f++;return r[a++]=u+1,r[a++]=u,r[a++]=f-1,{vertices:n,indices:r}}getMinMax(t=B.MAX,n=B.MIN){const{center:r,radius:i,rotation:s}=this,{x:a,y:l}=i,{x:h,y:c}=r,f=Math.cos(s),u=Math.sin(s),p=Math.sqrt(a*a*f*f+l*l*u*u),d=Math.sqrt(a*a*u*u+l*l*f*f);return t.x=Math.min(t.x,h-p),t.y=Math.min(t.y,c-d),n.x=Math.max(n.x,h+p),n.y=Math.max(n.y,c+d),{min:t,max:n}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radius.x=t.radius.x,this.radius.y=t.radius.y,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Eo(o,e){const t=o.radius.x,n=o.radius.y,r=Math.cos(o.rotation),i=Math.sin(o.rotation),s=new B(t*r,t*i),a=new B(-n*i,n*r),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=Bo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=Fr.copy(c).invert(),d=zr.copy(f).transpose().multiply(f).elements,m=Lo(d[0],d[1],d[4]),y=Math.sqrt(m.rt1),A=Math.sqrt(m.rt2);if(o.radius.x=1/y,o.radius.y=1/A,o.rotation=Math.atan2(m.sn,m.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=Fr.set(y,0,0,0,A,0,0,0,1),P=zr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),w=v.multiply(P).multiply(c),b=S=>{const{x,y:I}=new B(Math.cos(S),Math.sin(S)).applyMatrix3(w);return Math.atan2(I,x)};o.startAngle=b(o.startAngle),o.endAngle=b(o.endAngle),Nr(e)&&(o.clockwise=!o.clockwise)}}function Do(o,e){const t=qr(e),n=Gr(e);o.radius.x*=t,o.radius.y*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotation+=r,Nr(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function Nr(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Uo(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=qr(o),r=Gr(o);return Math.abs(t/(n*r))>Number.EPSILON}function qr(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Gr(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Lo(o,e,t){let n,r,i,s,a;const l=o+t,h=o-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=o*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?i=h+c:i=h-c,Math.abs(i)>2*Math.abs(e)?(a=-2*e/i,s=1/Math.sqrt(1+a*a),i=a*s):Math.abs(e)===0?(i=1,s=0):(a=-.5*i/e,i=1/Math.sqrt(1+a*a),s=a*i),h>0&&(a=i,i=-s,s=a),{rt1:n,rt2:r,cs:i,sn:s}}class $o extends jr{constructor(e=0,t=0,n=1,r=0,i=Math.PI*2,s=!1){super(e,t,n,n,0,r,i,s)}getAdaptivePointArray(e=[]){const r=this.center.x,i=this.center.y,s=this.clockwise,a=this.radius.x;let l=Math.abs(-1);s&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*a**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=0;c*=s?-1:1;for(let u=0;u<h+1;u++){const p=Math.cos(f),d=Math.sin(f),m=r+p*a,y=i+d*a;e.push(m,y),f+=c}return e}}class jn extends me{constructor(e=[]){super(),this.curves=e}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new B){const n=e*this.getLength(),r=this.getLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const s=r[i]-n,a=this.curves[i],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,t)}i++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),t=e.length-1}),e}getMinMax(e=B.MAX,t=B.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}}class Nn extends me{constructor(t,n,r,i,s,a,l,h){super();M(this,"p1");M(this,"cp1");M(this,"cp2");M(this,"p2");this.p1=new B(t,n),this.cp1=new B(r,i),this.cp2=new B(s,a),this.p2=new B(l,h)}static from(t,n,r,i){return new Nn(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)}getPoint(t,n=new B){const{p1:r,cp1:i,cp2:s,p2:a}=this;return n.set(Dr(t,r.x,i.x,s.x,a.x),Dr(t,r.y,i.y,s.y,a.y))}getAdaptivePointArray(t=[]){return bo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,n,r){const i=n*n-4*t*r;if(i<0)return[];const s=Math.sqrt(i),a=(-n+s)/(2*t),l=(-n-s)/(2*t);return[a,l].filter(h=>h>=0&&h<=1)}getMinMax(t=B.MAX,n=B.MIN){const{p1:r,cp1:i,cp2:s,p2:a}=this,l=this._solveQuadratic(3*(i.x-r.x),6*(s.x-i.x),3*(a.x-s.x)),h=this._solveQuadratic(3*(i.y-r.y),6*(s.y-i.y),3*(a.y-s.y)),c=[0,1,...l,...h];return((u,p)=>{for(const d of u)for(let m=0;m<=p;m++){const y=m/p-.5,A=Math.min(1,Math.max(0,d+y)),C=this.getPoint(A);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),n.x=Math.max(n.x,C.x),n.y=Math.max(n.y,C.y)}})(c,10),{min:t,max:n}}toCommands(){const{p1:t,cp1:n,cp2:r,p2:i}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:n.x,y1:n.y,x2:r.x,y2:r.y,x:i.x,y:i.y}]}drawTo(t){const{p1:n,cp1:r,cp2:i,p2:s}=this;return t.lineTo(n.x,n.y),t.bezierCurveTo(r.x,r.y,i.x,i.y,s.x,s.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class Xt extends me{constructor(t,n,r,i){super();M(this,"p1");M(this,"p2");this.p1=new B(t,n),this.p2=new B(r,i)}static from(t,n){return new Xt(t.x,t.y,n.x,n.y)}getPoint(t,n=new B){return t===1?n.copy(this.p2):n.copy(this.p2).sub(this.p1).scale(t).add(this.p1),n}getPointAt(t,n=new B){return this.getPoint(t,n)}getTangent(t,n=new B){return n.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,n=new B){return this.getTangent(t,n)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=B.MAX,n=B.MIN){const{p1:r,p2:i}=this;return t.x=Math.min(t.x,r.x,i.x),t.y=Math.min(t.y,r.y,i.y),n.x=Math.max(n.x,r.x,i.x),n.y=Math.max(n.y,r.y,i.y),{min:t,max:n}}toCommands(){const{p1:t,p2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:n.x,y:n.y}]}drawTo(t){const{p1:n,p2:r}=this;return t.lineTo(n.x,n.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class qn extends jn{static equilateral(e=0,t=0,n=1,r=3){const i=new qn,s=[];for(let a=0;a<r;a++){const l=a*2*Math.PI/r-.5*Math.PI;s.push(new B(n*Math.cos(l),n*Math.sin(l)).add({x:e,y:t}))}for(let a=0;a<r;a++)i.curves.push(Xt.from(s[a],s[(a+1)%r]));return i}}class Gn extends me{constructor(t,n,r,i,s,a){super();M(this,"p1");M(this,"cp");M(this,"p2");this.p1=new B(t,n),this.cp=new B(r,i),this.p2=new B(s,a)}static from(t,n,r){return new Gn(t.x,t.y,n.x,n.y,r.x,r.y)}getPoint(t,n=new B){const{p1:r,cp:i,p2:s}=this;return n.set(Ur(t,r.x,i.x,s.x),Ur(t,r.y,i.y,s.y)),n}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(t=[]){return Po(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=B.MAX,n=B.MIN){const{p1:r,cp:i,p2:s}=this,a=.5*(r.x+i.x),l=.5*(r.y+i.y),h=.5*(r.x+s.x),c=.5*(r.y+s.y);return t.x=Math.min(t.x,r.x,s.x,a,h),t.y=Math.min(t.y,r.y,s.y,l,c),n.x=Math.max(n.x,r.x,s.x,a,h),n.y=Math.max(n.y,r.y,s.y,l,c),{min:t,max:n}}toCommands(){const{p1:t,cp:n,p2:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:n.x,y1:n.y,x:r.x,y:r.y}]}drawTo(t){const{p1:n,cp:r,p2:i}=this;return t.lineTo(n.x,n.y),t.quadraticCurveTo(r.x,r.y,i.x,i.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class Fo extends qn{constructor(e=0,t=0,n=0,r=0){const i=[new B(e,t),new B(e+n,t),new B(e+n,t+r),new B(e,t+r)];super([Xt.from(i[0],i[1]),Xt.from(i[1],i[2]),Xt.from(i[2],i[3]),Xt.from(i[3],i[0])]),this.x=e,this.y=t,this.width=n,this.height=r}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:i=0,indicesOffset:s=0}=e;const{x:a,y:l,width:h,height:c}=this,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;i*=r,t[i+u]=f[0],t[i+u+1]=f[1],u+=r,t[i+u]=f[2],t[i+u+1]=f[3],u+=r,t[i+u]=f[6],t[i+u+1]=f[7],u+=r,t[i+u]=f[4],t[i+u+1]=f[5],u+=r;const p=i/r;return n[s++]=p,n[s++]=p+1,n[s++]=p+2,n[s++]=p+1,n[s++]=p+3,n[s++]=p+2,{vertices:t,indices:n}}}class zo extends me{constructor(e=[]){super(),this.points=e}getPoint(e,t=new B){const{points:n}=this,r=(n.length-1)*e,i=Math.floor(r),s=r-i,a=n[i===0?i:i-1],l=n[i],h=n[i>n.length-2?n.length-1:i+1],c=n[i>n.length-3?n.length-1:i+2];return t.set(Er(s,a.x,l.x,h.x,c.x),Er(s,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class Fe extends jn{constructor(t){super();M(this,"startPoint");M(this,"currentPoint");M(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:i,y:s}=t[n];this.lineTo(i,s)}return this}addCommands(t){return _r(t,this),this}addData(t){return this.addCommands(Br(t)),this}getUnevenPointArray(t=40,n=[]){return super.getUnevenPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}getSpacedPointArray(t=40,n=[]){return super.getSpacedPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}_setCurrentPoint(t){return this.currentPoint=new B(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(Xt.from(n,t)),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new B(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(new Xt((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,i,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(new Nn((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,i,s,a)),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,n,r,i){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:i})||this.curves.push(new Gn((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,i)),this._setCurrentPoint({x:r,y:i}),this}arc(t,n,r,i,s,a){const l=new $o(t,n,r,i,s,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,i,s,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,i,s,a),this}arcTo(t,n,r,i,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,i,s,a,l,h=!0){const c=new jr(t,n,r,i,s,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,i,s,a,l,h){var c,f;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,n,r,i,s,a,l,h),this}rect(t,n,r,i){const s=new Fo(t,n,r,i);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new B;return this.curves.push(new zo([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(i=>i.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;super.copy(t),this.curves=[];for(let r=0,i=t.curves.length;r<i;r++)this.curves.push(t.curves[r].clone());return this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function jo(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function No(o,e,t,n){const r=e.clone().sub(o),i=n.clone().sub(t),s=t.clone().sub(o),a=r.cross(i);if(a===0)return new B((o.x+t.x)/2,(o.y+t.y)/2);const l=s.cross(i)/a;return Math.abs(l)>1?new B((o.x+t.x)/2,(o.y+t.y)/2):new B(o.x+l*r.x,o.y+l*r.y)}class Tt extends jn{constructor(t,n={}){super();M(this,"currentCurve",new Fe);M(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Tt?this.curves.push(...t.curves.map(n=>n.clone())):this.curves.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length>0&&(this.currentCurve=new Fe().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new Fe,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,i,s,a){return this.currentCurve.bezierCurveTo(t,n,r,i,s,a),this}quadraticCurveTo(t,n,r,i){return this.currentCurve.quadraticCurveTo(t,n,r,i),this}arc(t,n,r,i,s,a){return this.currentCurve.arc(t,n,r,i,s,a),this}arcTo(t,n,r,i,s){return this.currentCurve.arcTo(t,n,r,i,s),this}ellipse(t,n,r,i,s,a,l,h){return this.currentCurve.ellipse(t,n,r,i,s,a,l,h),this}rect(t,n,r,i){return this.currentCurve.rect(t,n,r,i),this}addCommands(t){return _r(t,this),this}addData(t){return this.addCommands(Br(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.curves,r=[],i=[],s=[];n.forEach((l,h)=>{if(!l.getLength())return;const c=l.getControlPointRefs(),f=l.isClockwise();s[h]=c,i[h]=f;const u=c[0],p=c[c.length-1]??u;r.push({start:f?p:u,end:f?u:p,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{f!==h&&c.start.equals(l.end)&&a[h].push(c.index)})}),n.forEach((l,h)=>{if(!l.getLength())return;const c=i[h];s[h].forEach(u=>{const p=l.getTForPoint(u),d=l.getNormal(p).scale(c?t:-t);u.add(d)})}),a.forEach((l,h)=>{const c=s[h];l.forEach(f=>{const u=s[f],p=No(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);p&&(c[c.length-1].copy(p),u[0].copy(p))})}),this}matrix(t){return this.curves.forEach(n=>n.matrix(t)),this}getMinMax(t=B.MAX,n=B.MIN,r=!0){const i=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&i>1){const a=i/2,l=s.isClockwise(),h=[];for(let c=0;c<=1;c+=1/s.arcLengthDivision){const f=s.getPoint(c),u=s.getNormal(c),p=u.clone().scale(l?a:-a),d=u.clone().scale(l?-a:a);h.push(f.clone().add(p),f.clone().add(d),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:i="none"}=n;return t.beginPath(),t.save(),Ln(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:i="none"}=n;return t.beginPath(),t.save(),Ln(t,n),this.getControlPointRefs().forEach(s=>{lo(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),i!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const i in t)t[i]!==void 0&&(n[jo(i)]=t[i]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const i in n)n[i]!==void 0&&(r+=`${i}:${n[i]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return this.currentCurve=t.currentCurve.clone(),this.curves=t.curves.map(n=>n.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}class Rn{constructor(e=[]){this.paths=e}getBoundingBox(e=!0){if(!this.paths.length)return;const t=B.MAX,n=B.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new H(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),i=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:i,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-i),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const qo="px",Go=90,Rr=["mm","cm","in","pt","pc","px"],Vr={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 Y(o){let e="px";if(typeof o=="string"||o instanceof String)for(let n=0,r=Rr.length;n<r;n++){const i=Rr[n];if(o.endsWith(i)){e=i,o=o.substring(0,o.length-i.length);break}}let t;return t=Vr[e][qo],t<0&&(t=Vr[e].in*Go),t*Number.parseFloat(o)}const Ro=new Pt,rn=new Pt,Wr=new Pt,Xr=new Pt;function Vo(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const n=Wo(o);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Wo(o){const e=new Pt,t=Ro;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(Y(o.getAttribute("x")),Y(o.getAttribute("y"))),o.hasAttribute("transform")){const n=o.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const i=n[r].trim();if(i==="")continue;const s=i.indexOf("("),a=i.length;if(s>0&&s<a){const l=i.slice(0,s),h=Gt(i.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),rn.makeTranslation(-f,-u),Wr.makeRotation(c),Xr.multiplyMatrices(Wr,rn),rn.makeTranslation(f,u),t.multiplyMatrices(rn,Xr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Xo(o){return new Tt().addPath(new Fe().arc(Y(o.getAttribute("cx")||0),Y(o.getAttribute("cy")||0),Y(o.getAttribute("r")||0),0,Math.PI*2))}function Ho(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const n=o.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),i={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);i[l]=n.style.getPropertyValue(l)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...i})}}function Zo(o){return new Tt().addPath(new Fe().ellipse(Y(o.getAttribute("cx")||0),Y(o.getAttribute("cy")||0),Y(o.getAttribute("rx")||0),Y(o.getAttribute("ry")||0),0,0,Math.PI*2))}function Yo(o){return new Tt().moveTo(Y(o.getAttribute("x1")||0),Y(o.getAttribute("y1")||0)).lineTo(Y(o.getAttribute("x2")||0),Y(o.getAttribute("y2")||0))}function Ko(o){const e=new Tt,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Qo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jo(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(Qo,(r,i,s)=>{const a=Y(i),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentPath.autoClose=!0,e}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(o){var n;const e=new Tt;let t=0;return(n=o.getAttribute("points"))==null||n.replace(ta,(r,i,s)=>{const a=Y(i),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentPath.autoClose=!1,e}function na(o){const e=Y(o.getAttribute("x")||0),t=Y(o.getAttribute("y")||0),n=Y(o.getAttribute("rx")||o.getAttribute("ry")||0),r=Y(o.getAttribute("ry")||o.getAttribute("rx")||0),i=Y(o.getAttribute("width")),s=Y(o.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+i-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+i-n*a,t,e+i,t+r*a,e+i,t+r),l.lineTo(e+i,t+s-r),(n!==0||r!==0)&&l.bezierCurveTo(e+i,t+s-r*a,e+i-n*a,t+s,e+i-n,t+s),l.lineTo(e+n,t+s),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+s,e,t+s-r*a,e,t+s-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function Rt(o,e,t){e=Object.assign({},e);let n={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}o.hasAttribute("id")&&(n=Object.assign(n,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,c=0;c<h;c++){const f=o.style.item(c),u=o.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=i){o.hasAttribute(h)&&(e[c]=f(o.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function i(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,Y(h)))}function a(h){return Math.max(0,Y(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>Y(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",Y),r("visibility","visibility"),e}function Vn(o,e,t=[],n={}){var f;if(o.nodeType!==1)return t;let r=!1,i=null,s={...e};switch(o.nodeName){case"svg":s=Rt(o,s,n);break;case"style":Ho(o,n);break;case"g":s=Rt(o,s,n);break;case"path":s=Rt(o,s,n),o.hasAttribute("d")&&(i=Ko(o));break;case"rect":s=Rt(o,s,n),i=na(o);break;case"polygon":s=Rt(o,s,n),i=Jo(o);break;case"polyline":s=Rt(o,s,n),i=ea(o);break;case"circle":s=Rt(o,s,n),i=Xo(o);break;case"ellipse":s=Rt(o,s,n),i=Zo(o);break;case"line":s=Rt(o,s,n),i=Yo(o);break;case"defs":r=!0;break;case"use":{s=Rt(o,s,n);const p=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("href")||"").substring(1),d=(f=o.viewportElement)==null?void 0:f.getElementById(p);d?Vn(d,s,t,n):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(o);break}if(s.display==="none")return t;Object.assign(e,s);const a=new Pt,l=[],h=Vo(o,a,l);i&&(i.matrix(a),t.push(i),i.style=e);const c=o.childNodes;for(let u=0,p=c.length;u<p;u++){const d=c[u];r&&d.nodeName!=="style"&&d.nodeName!=="defs"||Vn(d,e,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}const Hr="data:image/svg+xml;",Zr=`${Hr}base64,`,Yr=`${Hr}charset=utf8,`;function Kr(o){if(typeof o=="string"){let e;o.startsWith(Zr)?(o=o.substring(Zr.length,o.length),e=atob(o)):o.startsWith(Yr)?(o=o.substring(Yr.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
|
|
5
|
+
${e}`);return t.documentElement}else return o}function Qr(o){return new Rn(Vn(Kr(o),{}))}const ra=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),ia={1:"italic",32:"bold"},oa={1:"italic",2:"bold"},Jr={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class ts{constructor(e,t,n){M(this,"path",new Tt);M(this,"lineBox",new H);M(this,"inlineBox",new H);M(this,"glyphBox");M(this,"advanceWidth",0);M(this,"advanceHeight",0);M(this,"underlinePosition",0);M(this,"underlineThickness",0);M(this,"strikeoutPosition",0);M(this,"strikeoutSize",0);M(this,"ascender",0);M(this,"descender",0);M(this,"typoAscender",0);M(this,"typoDescender",0);M(this,"typoLineGap",0);M(this,"winAscent",0);M(this,"winDescent",0);M(this,"xHeight",0);M(this,"capHeight",0);M(this,"baseline",0);M(this,"centerDiviation",0);M(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get center(){var e;return(e=this.glyphBox)==null?void 0:e.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(e){const t=this.computedStyle.fontFamily,n=e??Ri,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSfnt()}updateGlyph(e=this._getFontSfnt()){if(!e)return this;const{hhea:t,os2:n,post:r,head:i}=e,s=i.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,p=s/u,d=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/p,y=a/p;return this.advanceWidth=d,this.advanceHeight=m,this.inlineBox.width=f?m:d,this.inlineBox.height=f?d:m,this.underlinePosition=(a-r.underlinePosition)/p,this.underlineThickness=r.underlineThickness/p,this.strikeoutPosition=(a-n.yStrikeoutPosition)/p,this.strikeoutSize=n.yStrikeoutSize/p,this.ascender=a/p,this.descender=l/p,this.typoAscender=n.sTypoAscender/p,this.typoDescender=n.sTypoDescender/p,this.typoLineGap=n.sTypoLineGap/p,this.winAscent=n.usWinAscent/p,this.winDescent=n.usWinDescent/p,this.xHeight=n.sxHeight/p,this.capHeight=n.sCapHeight/p,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=ia[n.fsSelection]??oa[i.macStyle],this}update(e){const t=this._getFontSfnt(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:i,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:p}=this,{left:d,top:m}=a,y=i.fontStyle==="italic"&&f!=="italic";let A=d,C=m+s,v;const P=new Tt;if(n&&(A+=(p-u)/2,Math.abs(u-p)>.1&&(C-=(l-c)/(l+Math.abs(h))*p),v=void 0),n&&!ra.has(r)&&(r.codePointAt(0)<=256||sa.has(r))){P.addCommands(t.getPathCommands(r,A,m+s-(p-u)/2,i.fontSize));const b={y:m-(p-u)/2+p/2,x:A+u/2};y&&this._italic(P,n?{x:b.x,y:m-(p-u)/2+s}:void 0),P.rotate(90,b)}else v!==void 0?(P.addCommands(t.glyphs.get(v).getPathCommands(A,C,i.fontSize)),y&&this._italic(P,n?{x:A+u/2,y:m+c/(l+Math.abs(h))*p}:void 0)):(P.addCommands(t.getPathCommands(r,A,C,i.fontSize)),y&&this._italic(P,n?{x:A+p/2,y:C}:void 0));const w=i.fontWeight??400;return w in Jr&&(w===700||w==="bold")&&f!=="bold"&&P.bold(Jr[w]*i.fontSize*.05),P.style={fill:i.color,stroke:i.textStrokeWidth?i.textStrokeColor:"none",strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:0},this.path=P,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)le(r);else{e.save(),e.beginPath();const i=this.path.style,s={...i,fill:r.color??i.fill,stroke:r.textStrokeColor??i.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:i.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};Ln(e,s),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function sn(o,e){return typeof o=="number"?o:o.endsWith("%")?(o=o.substring(0,o.length-1),Math.ceil(Number(o)/100*e.total)):o.endsWith("rem")?(o=o.substring(0,o.length-3),Number(o)*e.fontSize):o.endsWith("em")?(o=o.substring(0,o.length-2),Number(o)*e.fontSize):Number(o)}function Wn(o){const e=Ht(o)?{}:o;return Object.keys(e).reduce((t,n)=>{let r=e[n];const i=Xn(n),s=Xn(r);return i&&(n=i),s&&(r=s),t[n]=r,t},{})}function Ht(o){return!o||o==="none"}function es(o,e){const t=Object.keys(o),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(i=>oe(o[i],e[i]))}function oe(o,e){const t=typeof o;return t===typeof e?t==="object"?es(o,e):o===e:!1}function Xn(o){const e=o.startsWith("#")?o.slice(1):o;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),i=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${i}, ${s})`}function on(o){if(!o)return o;const e={};for(const t in o)o[t]!==""&&o[t]!==void 0&&(e[t]=o[t]);return e}function an(o){return o.startsWith("http://")||o.startsWith("https://")||o.startsWith("blob://")}class ns{constructor(e,t={},n){M(this,"inlineBox",new H);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...on(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new ts(n,t++,this));return this.characters=e,this}}class xe{constructor(e,t){M(this,"lineBox",new H);M(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...on(this.parentStyle),...on(this.style)},this}addFragment(e,t){const n=new ns(e,t,this);return this.fragments.push(n),n}}function aa(o){return o}const ve=class ve{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];ve.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&ve.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),i={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":i.justifyContent="start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="end";break}switch(t.verticalAlign){case"top":i.alignItems="top";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="end";break}const a=!!(i.justifyContent||i.alignItems);Object.assign(r.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(i),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(i=>{var f;const s=r+=n.substring(r).indexOf(i),a=s+i.length;r+=i.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((i,s)=>{const a=i.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{r.push({...u,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(p=>{r.push({...p,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const i=[];let s=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;i.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:p}=f,d=i[s];f.inlineBox.left=d.left,f.inlineBox.top=d.top,f.inlineBox.width=d.width,f.inlineBox.height=d.height,p?(f.lineBox.left=d.left+(d.width-u)/2,f.lineBox.top=d.top,f.lineBox.width=u,f.lineBox.height=d.height):(f.lineBox.left=d.left,f.lineBox.top=d.top+(d.height-u)/2,f.lineBox.width=d.width,f.lineBox.height=u),s++}),{paragraphs:e,boundingBox:new H(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const i=this.measureParagraphDom(e,n);return r==null||r(),i}};M(ve,"notZeroStyles",new Set(["width","height"])),M(ve,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let ln=ve;function la(){return{overflow:"visible",visibility:"visible",filter:"none",left:0,top:0,width:0,height:0,rotate:0,opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",backgroundImage:"none",backgroundColor:"transparent",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,borderRadius:0,borderColor:"transparent",borderWidth:1}}function ha(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%",scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"50% 50%",shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function ca(){return{...la(),...ha()}}class fa{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(r):this.eventListeners.set(e,[i,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var i,s;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((i=c.options)!=null&&i.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(s=r.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,i;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let s=n.length,a=0;a<s;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((i=n.options)!=null&&i.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function hn(o){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:i,highlightSize:s,highlightThickness:a}=o;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??i??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function rs(){const o=[],e=[],t=new Map,n=new Map;async function r(s){if(!t.has(s)){t.set(s,s);try{t.set(s,await fetch(s).then(a=>a.text()))}catch(a){console.warn(a),t.delete(s)}}}function i(s){let a=n.get(s);if(!a){const l=Kr(an(s)?t.get(s)??s:s),h=Qr(l);a={dom:l,pathSet:h},n.set(s,a)}return a}return{name:"highlight",paths:o,load:async s=>{const a=new Set;s.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:f}=hn(h);an(c)&&a.add(c),an(f)&&a.add(f)}),await Promise.all(Array.from(a).map(l=>r(l)))},update:s=>{e.length=0,o.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=hn(f),{image:p,colormap:d,line:m,size:y,thickness:A}=u;if(Ht(p))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:C,isVertical:v}=c,{fontSize:P}=f;(!h||oe(h.image,p)&&oe(h.colormap,d)&&oe(h.line,m)&&oe(h.size,y)&&oe(h.thickness,A))&&(l!=null&&l.length)&&(v?l[0].inlineBox.left===C.left:l[0].inlineBox.top===C.top)&&l[0].fontSize===P?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const f=a[c],u=f[0],p=H.from(...f.filter(O=>O.glyphBox).map(O=>O.glyphBox)),{computedStyle:d}=u,{fontSize:m,writingMode:y}=d,{image:A,referImage:C,colormap:v,line:P,size:w,thickness:b}=hn(d),S=y.includes("vertical"),x=sn(b,{fontSize:m,total:p.width})/p.width,I=Wn(v),{pathSet:F,dom:E}=i(A),k=F.getBoundingBox(!0),z=m/k.width*2,T=new H().copy(p);S&&(T.width=p.height,T.height=p.width,T.left=p.left+p.width);const U=Math.floor(T.width);let W=U;if(w!=="cover"&&(W=sn(w,{fontSize:m,total:p.width})||U,T.width=W),!Ht(C)&&Ht(P)){const O=i(C).pathSet.getBoundingBox(!0);k.copy(O)}else{let O;if(Ht(P))if(k.width/k.height>4){O="underline";const G=E.getAttribute("viewBox");if(G){const[L,D,Z,V]=G.split(" ").map(N=>Number(N)),R=D+V/2;k.y<R&&k.y+k.height>R?O="line-through":k.y+k.height<R?O="overline":O="underline"}}else O="outline";else O=P;switch(O){case"outline":{const G=T.width*.2,L=T.height*.2;T.width+=G,T.height+=L,S?(T.x-=L/2,T.y-=G/2,T.x+=T.height):(T.x-=G/2,T.y-=L/2);break}case"overline":T.height=k.height*z,S?T.x=u.inlineBox.left+u.inlineBox.width:T.y=u.inlineBox.top;break;case"line-through":T.height=k.height*z,S?T.x=u.inlineBox.left+u.inlineBox.width-u.strikeoutPosition+T.height/2:T.y=u.inlineBox.top+u.strikeoutPosition-T.height/2;break;case"underline":T.height=k.height*z,S?T.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:T.y=u.inlineBox.top+u.underlinePosition;break}}const _=new Pt().translate(-k.x,-k.y).scale(T.width/k.width,T.height/k.height);S&&_.rotate(-Math.PI/2),_.translate(T.x,T.y);for(let O=0;O<Math.ceil(U/W);O++){const G=_.clone();S?G.translate(0,O*T.width):G.translate(O*T.width,0),F.paths.forEach(L=>{const D=L.clone().matrix(G);D.style.strokeWidth&&(D.style.strokeWidth*=z*x),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=z),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=z),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(Z=>Z*z)),D.style.fill&&D.style.fill in I&&(D.style.fill=I[D.style.fill]),D.style.stroke&&D.style.stroke in I&&(D.style.stroke=I[D.style.stroke]),o.push(D),U!==W&&(S?e[o.length-1]=new H(p.left-p.width*2,p.top,p.width*4,p.height):e[o.length-1]=new H(p.left,p.top-p.height*2,p.width,p.height*4))})}}},renderOrder:-1,render:(s,a)=>{o.forEach((l,h)=>{if(le({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=new Rn([l]).getBoundingBox();c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function ua(o,e){return`<svg width="${o*2}" height="${o*2}" xmlns="http://www.w3.org/2000/svg">
|
|
6
6
|
<circle cx="${o}" cy="${o}" r="${o}" fill="${e}" />
|
|
7
|
-
</svg>`}function
|
|
7
|
+
</svg>`}function ss(){const o=[];return{name:"listStyle",paths:o,update:e=>{o.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,i=r*.45;t.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,p=Wn(c);let d=f,m;if(!Ht(h))m=h;else if(!Ht(u)){const v=r*.38/2;switch(d=d==="cover"?v*2:d,u){case"disc":m=ua(v,String(l));break}}if(!m)return;const y=Qr(m),A=y.getBoundingBox();let C;s.fragments.forEach(v=>{v.characters.forEach(P=>{const{inlineBox:w}=P;if(n?(C==null?void 0:C.inlineBox.left)!==w.left:(C==null?void 0:C.inlineBox.top)!==w.top){C=P;const b=d==="cover"?1:sn(d,{total:r,fontSize:r})/r,S=new Pt;if(n){const x=r/A.height*b;S.translate(-A.left,-A.top).rotate(Math.PI/2).scale(x,x).translate(w.left+(w.width-A.height*x)/2,w.top-i)}else{const x=r/A.height*b;S.translate(-A.left,-A.top).scale(x,x).translate(w.left-A.width*x-i,w.top+(w.height-A.height*x)/2)}o.push(...y.paths.map(x=>{const I=x.clone();return I.matrix(S),I.style.fill&&I.style.fill in p&&(I.style.fill=p[I.style.fill]),I.style.stroke&&I.style.stroke in p&&(I.style.stroke=p[I.style.stroke]),I}))}})})})}}}const Jt=new B,we=new Pt,te=new Pt;function is(){return{name:"render",getBoundingBox:o=>{const{characters:e,fontSize:t,effects:n}=o,r=[];return e.forEach(i=>{n==null||n.forEach(s=>{if(!i.glyphBox)return;const a=i.glyphBox.clone(),l=cn(o,s);Jt.set(a.left,a.top),Jt.applyMatrix3(l),a.left=Jt.x,a.top=Jt.y,Jt.set(a.right,a.bottom),Jt.applyMatrix3(l),a.width=Jt.x-a.left,a.height=Jt.y-a.top;const h=(s.shadowOffsetX??0)*t,c=(s.shadowOffsetY??0)*t,f=Math.max(.1,s.textStrokeWidth??0)*t;a.left+=h-f,a.top+=c-f,a.width+=f*2,a.height+=f*2,r.push(a)})}),r.length?H.from(...r):void 0},render:(o,e)=>{const{paragraphs:t,glyphBox:n,effects:r,style:i}=e;function s(a,l){o.fillStyle=a,o.fillRect(l.left,l.top,l.width,l.height)}i!=null&&i.backgroundColor&&s(i.backgroundColor,new H(0,0,o.canvas.width,o.canvas.height)),t.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&s(a.style.backgroundColor,a.lineBox)}),r?r.forEach(a=>{jt(a,n,o),o.save();const[l,h,c,f,u,p]=cn(e,a).transpose().elements;o.transform(l,f,h,u,c,p),e.forEachCharacter(d=>{var m;(m=d.parent.style)!=null&&m.backgroundColor&&s(d.parent.style.backgroundColor,d.inlineBox),d.drawTo(o,a)}),o.restore()}):t.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&s(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(o)})})}),e.debug&&t.forEach(a=>{o.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function cn(o,e){const{fontSize:t,glyphBox:n}=o,r=(e.translateX??0)*t,i=(e.translateY??0)*t,s=Math.PI*2,a=(e.skewX??0)/360*s,l=(e.skewY??0)/360*s,{left:h,top:c,width:f,height:u}=n,p=h+f/2,d=c+u/2;return we.identity(),te.makeTranslation(r,i),we.multiply(te),te.makeTranslation(p,d),we.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),we.multiply(te),te.makeTranslation(-p,-d),we.multiply(te),we.clone()}function os(){const o=[];return{name:"textDecoration",paths:o,update:e=>{o.length=0;const t=[];let n,r;e.forEachCharacter(i=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=i,{color:p,textDecoration:d,writingMode:m}=s;if(Ht(d))r=void 0;else{let y=!1;if((r==null?void 0:r.textDecoration)===d&&(r==null?void 0:r.writingMode)===m&&(r==null?void 0:r.color)===p&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(d){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(y=!0);break;case"line-through":n[0].strikeoutPosition===f&&n[0].strikeoutSize===u&&(y=!0);break}y?n.push(i):(n=[],n.push(i),t.push(n)),r=s}}),t.forEach(i=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=i[0],{color:u,textDecoration:p}=s,{left:d,top:m,width:y,height:A}=H.from(...i.map(b=>b.inlineBox));let C=a?d+y:m;const v=a?-1:1;let P=0;switch(p){case"overline":P=h*2;break;case"underline":C+=v*l,P=h*2;break;case"line-through":C+=v*c,P=f*2;break}C-=P;let w;a?w=new Tt([{type:"M",x:C,y:m},{type:"L",x:C,y:m+A},{type:"L",x:C+P,y:m+A},{type:"L",x:C+P,y:m},{type:"Z"}],{fill:u}):w=new Tt([{type:"M",x:d,y:C},{type:"L",x:d+y,y:C},{type:"L",x:d+y,y:C+P},{type:"L",x:d,y:C+P},{type:"Z"}],{fill:u}),o.push(w)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(i=>{e.save();const[s,a,l,h,c,f]=cn(t,i).transpose().elements;e.transform(s,h,a,c,l,f),o.forEach(u=>{le({ctx:e,path:u,fontSize:r.fontSize,...i})}),e.restore()}):o.forEach(i=>{le({ctx:e,path:i,fontSize:r.fontSize})})}}}const Hn=ca();class Zn extends fa{constructor(t={}){super();M(this,"debug");M(this,"content");M(this,"style");M(this,"effects");M(this,"measureDom");M(this,"needsUpdate",!0);M(this,"computedStyle",{...Hn});M(this,"paragraphs",[]);M(this,"lineBox",new H);M(this,"rawGlyphBox",new H);M(this,"glyphBox",new H);M(this,"pathBox",new H);M(this,"boundingBox",new H);M(this,"measurer",new ln);M(this,"plugins",new Map);M(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(ss()).use(os()).use(rs()).use(is()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,r)=>{n.fragments.forEach((i,s)=>{i.characters.forEach((a,l)=>{t(a,{paragraphIndex:r,fragmentIndex:s,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...Hn,...this.style};let{content:t,computedStyle:n}=this;const r=[];if(typeof t=="string"){const i=new xe({},n);i.addFragment(t),r.push(i)}else{t=Array.isArray(t)?t:[t];for(const i of t)if(typeof i=="string"){const s=new xe({},n);s.addFragment(i),r.push(s)}else if(Array.isArray(i)){const s=new xe({},n);i.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&s.addFragment(l,h)}}),r.push(s)}else if("fragments"in i){const{fragments:s,...a}=i,l=new xe(a,n);s.forEach(h=>{const{content:c,...f}=h;c!==void 0&&l.addFragment(c,f)}),r.push(l)}else if("content"in i){const{content:s,...a}=i;if(s!==void 0){const l=new xe(a,n);l.addFragment(s),r.push(l)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(i=>{i.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((i,s)=>(i.updateOrder??0)-(s.updateOrder??0)).forEach(i=>{var s;(s=i.update)==null||s.call(i,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const i in n)r[i]=this[i],this[i]=n[i];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=B.MAX,n=B.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:i}=r,s=new B(i.left,i.top),a=new B(i.left+i.width,i.top+i.height);t.min(s,a),n.max(s,a)}}),new H(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=H.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):new Rn(t.paths??[]).getBoundingBox()).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:n,pathBox:r}=this,i=Math.min(r.left,r.left+t.left-n.left),s=Math.min(r.top,r.top+t.top-n.top),a=Math.max(r.right,r.right+t.right-n.right),l=Math.max(r.bottom,r.bottom+t.bottom-n.bottom);return this.boundingBox=new H(i,s,a-i,l-s),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const n in t)this[n]=t[n];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:n,pixelRatio:r=2}=t,i=n.getContext("2d");i&&(this.needsUpdate&&this.update(),Yn(i,r,this.boundingBox),Kn(i,this),Array.from(this.plugins.values()).sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;if(s.render)(a=s.render)==null||a.call(s,i,this);else if(s.paths){const l=this.computedStyle;s.paths.forEach(h=>{le({ctx:i,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function pa(o,e){const t=new Zn(o);return e?t.load().then(()=>t.measure()):t.measure()}function da(o,e){const t=new Zn(o);return e?t.load().then(()=>t.render(o)):t.render(o)}q.Character=ts,q.Fragment=ns,q.Measurer=ln,q.Paragraph=xe,q.Text=Zn,q.definePlugin=aa,q.drawPath=le,q.filterEmpty=on,q.getHighlightStyle=hn,q.getTransform2D=cn,q.hexToRgb=Xn,q.highlight=rs,q.isEqualObject=es,q.isEqualValue=oe,q.isNone=Ht,q.listStyle=ss,q.measureText=pa,q.needsFetch=an,q.parseColor=ct,q.parseColormap=Wn,q.parseValueNumber=sn,q.render=is,q.renderText=da,q.setupView=Yn,q.textDecoration=os,q.textDefaultStyle=Hn,q.uploadColor=jt,q.uploadColors=Kn,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Path2D, BoundingBox, setCanvasContext,
|
|
1
|
+
import { Path2D, BoundingBox, setCanvasContext, Matrix3, Path2DSet, parseSVGToDOM, parseSVG, Vector2 } from 'modern-path2d';
|
|
2
2
|
import { getDefaultStyle } from 'modern-idoc';
|
|
3
3
|
import { fonts } from 'modern-font';
|
|
4
4
|
|
|
@@ -320,7 +320,7 @@ class Character {
|
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
getGlyphMinMax(min, max, withStyle) {
|
|
323
|
-
if (this.path.
|
|
323
|
+
if (this.path.curves[0]?.curves.length) {
|
|
324
324
|
return this.path.getMinMax(min, max, withStyle);
|
|
325
325
|
} else {
|
|
326
326
|
return void 0;
|
|
@@ -910,8 +910,8 @@ function highlight() {
|
|
|
910
910
|
const dom = parseSVGToDOM(
|
|
911
911
|
needsFetch(svg) ? loaded.get(svg) ?? svg : svg
|
|
912
912
|
);
|
|
913
|
-
const
|
|
914
|
-
result = { dom,
|
|
913
|
+
const pathSet = parseSVG(dom);
|
|
914
|
+
result = { dom, pathSet };
|
|
915
915
|
parsed.set(svg, result);
|
|
916
916
|
}
|
|
917
917
|
return result;
|
|
@@ -999,8 +999,8 @@ function highlight() {
|
|
|
999
999
|
const isVertical = writingMode.includes("vertical");
|
|
1000
1000
|
const _thickness = parseValueNumber(thickness, { fontSize, total: groupBox.width }) / groupBox.width;
|
|
1001
1001
|
const _colormap = parseColormap(colormap);
|
|
1002
|
-
const {
|
|
1003
|
-
const aBox =
|
|
1002
|
+
const { pathSet: svgPathSet, dom: svgDom } = getPaths(image);
|
|
1003
|
+
const aBox = svgPathSet.getBoundingBox(true);
|
|
1004
1004
|
const styleScale = fontSize / aBox.width * 2;
|
|
1005
1005
|
const cBox = new BoundingBox().copy(groupBox);
|
|
1006
1006
|
if (isVertical) {
|
|
@@ -1015,7 +1015,7 @@ function highlight() {
|
|
|
1015
1015
|
cBox.width = userWidth;
|
|
1016
1016
|
}
|
|
1017
1017
|
if (!isNone(referImage) && isNone(line)) {
|
|
1018
|
-
const bBox =
|
|
1018
|
+
const bBox = getPaths(referImage).pathSet.getBoundingBox(true);
|
|
1019
1019
|
aBox.copy(bBox);
|
|
1020
1020
|
} else {
|
|
1021
1021
|
let _line;
|
|
@@ -1094,7 +1094,7 @@ function highlight() {
|
|
|
1094
1094
|
} else {
|
|
1095
1095
|
_transform.translate(i2 * cBox.width, 0);
|
|
1096
1096
|
}
|
|
1097
|
-
|
|
1097
|
+
svgPathSet.paths.forEach((originalPath) => {
|
|
1098
1098
|
const path = originalPath.clone().matrix(_transform);
|
|
1099
1099
|
if (path.style.strokeWidth) {
|
|
1100
1100
|
path.style.strokeWidth *= styleScale * _thickness;
|
|
@@ -1146,7 +1146,7 @@ function highlight() {
|
|
|
1146
1146
|
clipRect: clipRects[index]
|
|
1147
1147
|
});
|
|
1148
1148
|
if (text.debug) {
|
|
1149
|
-
const box =
|
|
1149
|
+
const box = new Path2DSet([path]).getBoundingBox();
|
|
1150
1150
|
if (box) {
|
|
1151
1151
|
ctx.strokeRect(box.x, box.y, box.width, box.height);
|
|
1152
1152
|
}
|
|
@@ -1198,8 +1198,8 @@ function listStyle() {
|
|
|
1198
1198
|
if (!image) {
|
|
1199
1199
|
return;
|
|
1200
1200
|
}
|
|
1201
|
-
const
|
|
1202
|
-
const imageBox =
|
|
1201
|
+
const imagePathSet = parseSVG(image);
|
|
1202
|
+
const imageBox = imagePathSet.getBoundingBox();
|
|
1203
1203
|
let prevChar;
|
|
1204
1204
|
paragraph.fragments.forEach((f) => {
|
|
1205
1205
|
f.characters.forEach((c) => {
|
|
@@ -1221,7 +1221,7 @@ function listStyle() {
|
|
|
1221
1221
|
inlineBox.top + (inlineBox.height - imageBox.height * _scale) / 2
|
|
1222
1222
|
);
|
|
1223
1223
|
}
|
|
1224
|
-
paths.push(...
|
|
1224
|
+
paths.push(...imagePathSet.paths.map((p) => {
|
|
1225
1225
|
const path = p.clone();
|
|
1226
1226
|
path.matrix(m);
|
|
1227
1227
|
if (path.style.fill && path.style.fill in colormap) {
|
|
@@ -1643,7 +1643,7 @@ class Text extends EventEmitter {
|
|
|
1643
1643
|
this.pathBox = BoundingBox.from(
|
|
1644
1644
|
this.glyphBox,
|
|
1645
1645
|
...Array.from(this.plugins.values()).map((plugin) => {
|
|
1646
|
-
return plugin.getBoundingBox ? plugin.getBoundingBox(this) :
|
|
1646
|
+
return plugin.getBoundingBox ? plugin.getBoundingBox(this) : new Path2DSet(plugin.paths ?? []).getBoundingBox();
|
|
1647
1647
|
}).filter(Boolean)
|
|
1648
1648
|
);
|
|
1649
1649
|
return this;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "vite build && unbuild",
|
|
50
50
|
"dev": "vite docs",
|
|
51
|
-
"lint": "eslint
|
|
51
|
+
"lint": "eslint src",
|
|
52
52
|
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
53
53
|
"release": "bumpp package.json --commit \"release: v%s\" --push --all --tag",
|
|
54
54
|
"start": "esno src/index.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"modern-font": "^0.3.5",
|
|
61
61
|
"modern-idoc": "^0.1.4",
|
|
62
|
-
"modern-path2d": "^1.0
|
|
62
|
+
"modern-path2d": "^1.1.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@antfu/eslint-config": "^3.12.1",
|
|
@@ -78,6 +78,6 @@
|
|
|
78
78
|
"pre-commit": "pnpm lint-staged"
|
|
79
79
|
},
|
|
80
80
|
"lint-staged": {
|
|
81
|
-
"*": "eslint --fix"
|
|
81
|
+
"*": "eslint src --fix"
|
|
82
82
|
}
|
|
83
83
|
}
|