modern-text 1.0.7 → 1.2.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 +15 -15
- package/dist/index.js +5 -5
- package/dist/index.mjs +16 -16
- package/package.json +2 -2
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;
|
|
@@ -909,11 +909,11 @@ function highlight() {
|
|
|
909
909
|
function getPaths(svg) {
|
|
910
910
|
let result = parsed.get(svg);
|
|
911
911
|
if (!result) {
|
|
912
|
-
const dom = modernPath2d.
|
|
912
|
+
const dom = modernPath2d.svgToDOM(
|
|
913
913
|
needsFetch(svg) ? loaded.get(svg) ?? svg : svg
|
|
914
914
|
);
|
|
915
|
-
const
|
|
916
|
-
result = { dom,
|
|
915
|
+
const pathSet = modernPath2d.svgToPath2DSet(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,8 +1096,8 @@ function highlight() {
|
|
|
1096
1096
|
} else {
|
|
1097
1097
|
_transform.translate(i2 * cBox.width, 0);
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1100
|
-
const path = originalPath.clone().
|
|
1099
|
+
svgPathSet.paths.forEach((originalPath) => {
|
|
1100
|
+
const path = originalPath.clone().applyTransform(_transform);
|
|
1101
1101
|
if (path.style.strokeWidth) {
|
|
1102
1102
|
path.style.strokeWidth *= styleScale * _thickness;
|
|
1103
1103
|
}
|
|
@@ -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.svgToPath2DSet(image);
|
|
1204
|
+
const imageBox = imagePathSet.getBoundingBox();
|
|
1205
1205
|
let prevChar;
|
|
1206
1206
|
paragraph.fragments.forEach((f) => {
|
|
1207
1207
|
f.characters.forEach((c) => {
|
|
@@ -1223,9 +1223,9 @@ 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
|
-
path.
|
|
1228
|
+
path.applyTransform(m);
|
|
1229
1229
|
if (path.style.fill && path.style.fill in colormap) {
|
|
1230
1230
|
path.style.fill = colormap[path.style.fill];
|
|
1231
1231
|
}
|
|
@@ -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.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(R,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(R=typeof globalThis<"u"?globalThis:R||self,ct(R.modernText={}))})(this,function(R){"use strict";var xa=Object.defineProperty;var wa=(R,ct,jt)=>ct in R?xa(R,ct,{enumerable:!0,configurable:!0,writable:!0,value:jt}):R[ct]=jt;var M=(R,ct,jt)=>wa(R,typeof ct!="symbol"?ct+"":ct,jt);var ee;function ct(i,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:o,y1:s,stops:a}=fs(e,t.left,t.top,t.width,t.height),l=i.createLinearGradient(n,r,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function jt(i,e,t){i!=null&&i.color&&(i.color=ct(t,i.color,e)),i!=null&&i.backgroundColor&&(i.backgroundColor=ct(t,i.backgroundColor,e)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=ct(t,i.textStrokeColor,e))}function fs(i,e,t,n,r){var d;const o=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(p=>{let m=p[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(p[3].replace("%",""))/100,color:m}})}}function le(i){const{ctx:e,path:t,fontSize:n,clipRect:r}=i;e.save(),e.beginPath();const o=t.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Yn(i,e,t){const{left:n,top:r,width:o,height:s}=t,a=i.canvas;a.dataset.viewBox=`${n} ${r} ${o} ${s}`,a.dataset.pixelRatio=String(e);const l=o,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`,i.clearRect(0,0,a.width,a.height),i.scale(e,e),i.translate(-n,-r)}function Kn(i,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;jt(n,r,i),t.forEach(o=>{jt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{jt(s.computedStyle,s.inlineBox,i)})})}var ft=Uint8Array,_t=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(i,e){for(var t=new _t(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new un(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-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),us=er.b,nr=er.r,yn=new _t(32768),Q=0;Q<32768;++Q){var Ht=(Q&43690)>>1|(Q&21845)<<1;Ht=(Ht&52428)>>2|(Ht&13107)<<2,Ht=(Ht&61680)>>4|(Ht&3855)<<4,yn[Q]=((Ht&65280)>>8|(Ht&255)<<8)>>1}for(var Nt=function(i,e,t){for(var n=i.length,r=0,o=new _t(e);r<n;++r)i[r]&&++o[i[r]-1];var s=new _t(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new _t(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],c=e-i[r],f=s[i[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[yn[f]>>l]=h}else for(a=new _t(n),r=0;r<n;++r)i[r]&&(a[r]=yn[s[i[r]-1]++]>>15-i[r]);return a},Zt=new ft(288),Q=0;Q<144;++Q)Zt[Q]=8;for(var Q=144;Q<256;++Q)Zt[Q]=9;for(var Q=256;Q<280;++Q)Zt[Q]=7;for(var Q=280;Q<288;++Q)Zt[Q]=8;for(var be=new ft(32),Q=0;Q<32;++Q)be[Q]=5;var ps=Nt(Zt,9,0),ds=Nt(Zt,9,1),ys=Nt(be,5,0),gs=Nt(be,5,1),gn=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Dt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},mn=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},xn=function(i){return(i+7)/8|0},rr=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ft(i.subarray(e,t))},ms=["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(i,e,t){var n=new Error(e||ms[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},xs=function(i,e,t,n){var r=i.length,o=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(Ct){var At=t.length;if(Ct>At){var ht=new ft(Math.max(At*2,Ct));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,d=e.l,p=e.d,m=e.m,y=e.n,k=r*8;do{if(!d){c=Dt(i,f,1);var P=Dt(i,f+1,3);if(f+=3,P)if(P==1)d=ds,p=gs,m=9,y=5;else if(P==2){var b=Dt(i,f,31)+257,S=Dt(i,f+10,15)+4,w=b+Dt(i,f+5,31)+1;f+=14;for(var I=new ft(w),F=new ft(19),E=0;E<S;++E)F[pn[E]]=Dt(i,f+E*3,7);f+=S*3;for(var _=gn(F),j=(1<<_)-1,T=Nt(F,_,1),E=0;E<w;){var U=T[Dt(i,f,j)];f+=U&15;var v=U>>4;if(v<16)I[E++]=v;else{var V=0,B=0;for(v==16?(B=3+Dt(i,f,3),f+=2,V=I[E-1]):v==17?(B=3+Dt(i,f,7),f+=3):v==18&&(B=11+Dt(i,f,127),f+=7);B--;)I[E++]=V}}var O=I.subarray(0,b),q=I.subarray(b);m=gn(O),y=gn(q),d=Nt(O,m,1),p=Nt(q,y,1)}else Ut(1);else{var v=xn(f)+4,C=i[v-4]|i[v-3]<<8,x=v+C;if(x>r){l&&Ut(0);break}a&&h(u+C),t.set(i.subarray(v,x),u),e.b=u+=C,e.p=f=x*8,e.f=c;continue}if(f>k){l&&Ut(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,D=(1<<y)-1,Z=f;;Z=f){var V=d[mn(i,f)&L],W=V>>4;if(f+=V&15,f>k){l&&Ut(0);break}if(V||Ut(2),W<256)t[u++]=W;else if(W==256){Z=f,d=null;break}else{var G=W-254;if(W>264){var E=W-257,N=ze[E];G=Dt(i,f,(1<<N)-1)+tr[E],f+=N}var K=p[mn(i,f)&D],X=K>>4;K||Ut(3),f+=K&15;var q=us[X];if(X>3){var N=je[X];q+=mn(i,f)&(1<<N)-1,f+=N}if(f>k){l&&Ut(0);break}a&&h(u+131072);var nt=u+G;if(u<q){var Wt=o-q,Bt=Math.min(q,nt);for(Wt+u<0&&Ut(3);u<Bt;++u)t[u]=n[Wt+u]}for(;u<nt;++u)t[u]=t[u-q]}}e.l=d,e.p=Z,e.b=u,e.f=c,d&&(c=1,e.m=m,e.d=p,e.n=y)}while(!c);return u!=t.length&&s?rr(t,0,u):t.subarray(0,u)},Vt=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},Se=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},wn=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,o=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(x,b){return x.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=o[0].s,n=1;n<r;++n)o[n].s>u&&(u=o[n].s);var d=new _t(u+1),p=vn(t[c-1],d,0);if(p>e){var n=0,m=0,y=p-e,k=1<<y;for(o.sort(function(b,S){return d[S.s]-d[b.s]||b.f-S.f});n<r;++n){var P=o[n].s;if(d[P]>e)m+=k-(1<<p-d[P]),d[P]=e;else break}for(m>>=y;m>0;){var v=o[n].s;d[v]<e?m-=1<<e-d[v]++-1:++n}for(;n>=0&&m;--n){var C=o[n].s;d[C]==e&&(--d[C],++m)}p=e}return{t:new ft(d),l:p}},vn=function(i,e,t){return i.s==-1?Math.max(vn(i.l,e,t+1),vn(i.r,e,t+1)):e[i.s]=t},sr=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new _t(++e),n=0,r=i[0],o=1,s=function(l){t[n++]=l},a=1;a<=e;++a)if(i[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=i[a]}return{c:t.subarray(0,n),n:e}},Ce=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},ir=function(i,e,t){var n=t.length,r=xn(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},or=function(i,e,t,n,r,o,s,a,l,h,c){Vt(e,c++,t),++r[256];for(var f=wn(r,15),u=f.t,d=f.l,p=wn(o,15),m=p.t,y=p.l,k=sr(u),P=k.c,v=k.n,C=sr(m),x=C.c,b=C.n,S=new _t(19),w=0;w<P.length;++w)++S[P[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var I=wn(S,7),F=I.t,E=I.l,_=19;_>4&&!F[pn[_-1]];--_);var j=h+5<<3,T=Ce(r,Zt)+Ce(o,be)+s,U=Ce(r,u)+Ce(o,m)+s+14+3*_+Ce(S,F)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&j<=T&&j<=U)return ir(e,c,i.subarray(l,l+h));var V,B,O,q;if(Vt(e,c,1+(U<T)),c+=2,U<T){V=Nt(u,d,0),B=u,O=Nt(m,y,0),q=m;var L=Nt(F,E,0);Vt(e,c,v-257),Vt(e,c+5,b-1),Vt(e,c+10,_-4),c+=14;for(var w=0;w<_;++w)Vt(e,c+3*w,F[pn[w]]);c+=3*_;for(var D=[P,x],Z=0;Z<2;++Z)for(var W=D[Z],w=0;w<W.length;++w){var G=W[w]&31;Vt(e,c,L[G]),c+=F[G],G>15&&(Vt(e,c,W[w]>>5&127),c+=W[w]>>12)}}else V=ps,B=Zt,O=ys,q=be;for(var w=0;w<a;++w){var N=n[w];if(N>255){var G=N>>18&31;Se(e,c,V[G+257]),c+=B[G+257],G>7&&(Vt(e,c,N>>23&31),c+=ze[G]);var K=N&31;Se(e,c,O[K]),c+=q[K],K>3&&(Se(e,c,N>>5&8191),c+=je[K])}else Se(e,c,V[N]),c+=B[N]}return Se(e,c,V[256]),c+B[256]},ws=new un([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ar=new ft(0),vs=function(i,e,t,n,r,o){var s=o.z||i.length,a=new ft(n+s+5*(1+Math.ceil(s/7e3))+r),l=a.subarray(n,a.length-r),h=o.l,c=(o.r||0)&7;if(e){c&&(l[0]=o.r>>3);for(var f=ws[e-1],u=f>>13,d=f&8191,p=(1<<t)-1,m=o.p||new _t(32768),y=o.h||new _t(p+1),k=Math.ceil(t/3),P=2*k,v=function(kt){return(i[kt]^i[kt+1]<<k^i[kt+2]<<P)&p},C=new un(25e3),x=new _t(288),b=new _t(32),S=0,w=0,I=o.i||0,F=0,E=o.w||0,_=0;I+2<s;++I){var j=v(I),T=I&32767,U=y[j];if(m[T]=U,y[j]=T,E<=I){var V=s-I;if((S>7e3||F>24576)&&(V>423||!h)){c=or(i,l,0,C,x,b,w,F,_,I-_,c),F=S=w=0,_=I;for(var B=0;B<286;++B)x[B]=0;for(var B=0;B<30;++B)b[B]=0}var O=2,q=0,L=d,D=T-U&32767;if(V>2&&j==v(I-D))for(var Z=Math.min(u,V)-1,W=Math.min(32767,I),G=Math.min(258,V);D<=W&&--L&&T!=U;){if(i[I+O]==i[I+O-D]){for(var N=0;N<G&&i[I+N]==i[I+N-D];++N);if(N>O){if(O=N,q=D,N>Z)break;for(var K=Math.min(D,N-2),X=0,B=0;B<K;++B){var nt=I-D+B&32767,Wt=m[nt],Bt=nt-Wt&32767;Bt>X&&(X=Bt,U=nt)}}}T=U,U=m[T],D+=T-U&32767}if(q){C[F++]=268435456|dn[O]<<18|nr[q];var Ct=dn[O]&31,At=nr[q]&31;w+=ze[Ct]+je[At],++x[257+Ct],++b[At],E=I+O,++S}else C[F++]=i[I],++x[i[I]]}}for(I=Math.max(I,E);I<s;++I)C[F++]=i[I],++x[i[I]];c=or(i,l,h,C,x,b,w,F,_,I-_,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=y,o.p=m,o.i=I,o.w=E)}else{for(var I=o.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,i.subarray(I,ht))}o.i=s}return rr(a,0,n+xn(c)+r)},lr=function(){var i=1,e=0;return{p:function(t){for(var n=i,r=e,o=t.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=n+=t[s];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,e=r},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},bs=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new ft(o.length+i.length);s.set(o),s.set(i,o.length),i=s,r.w=o.length}return vs(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},hr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},Ss=function(i,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=n<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var r=lr();r.p(e.dictionary),hr(i,2,r.d())}},Cs=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Ut(6,"invalid zlib data"),(i[1]>>5&1)==+!e&&Ut(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ms(i,e){e||(e={});var t=lr();t.p(i);var n=bs(i,e,e.dictionary?6:2,4);return Ss(n,e),hr(n,n.length-4,t.d()),n}function Ps(i,e){return xs(i.subarray(Cs(i,e),-4),{i:2},e,e)}var Ts=typeof TextDecoder<"u"&&new TextDecoder,As=0;try{Ts.decode(ar,{stream:!0}),As=1}catch{}const ks="modern-font";function Me(i,e){if(!i)throw new Error(`[${ks}] ${e}`)}function _s(i){if("buffer"in i){const e=i.buffer;return i.byteOffset>0||i.byteLength<i.buffer.byteLength?e.slice(i.byteOffset,i.byteOffset+i.byteLength):e}else return i}function he(i){return"buffer"in i?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}function Is(i){let e="";for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function Ne(i){i=Is(i);const e=[];for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Os(i){let e="";for(let t=0,n=i.length;t<n;t++)i[t]<127?e+=String.fromCharCode(i[t]):e+=`%${(256+i[t]).toString(16).slice(1)}`;return unescape(e)}function Bs(i){let e="";for(let t=0,n=i.length;t<n;t+=2)e+=String.fromCharCode((i[t]<<8)+i[t+1]);return e}var Es=Object.defineProperty,ut=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Es(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(i,e){Object.defineProperty(i.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,o){super(_s(t),n,r);M(this,"cursor",0);this.littleEndian=o}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,o)=>this.read(t.type,t.offset+o));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,o)=>{this.write(t.type,n[o],t.offset+o)}):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 o=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[o])==null?void 0:h.bind(s),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,o]=this.readBytes(t,3);return(n<<16)+(r<<8)+o}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let o=0;o<n;++o)r.push(this.getUint8(t+o));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let o="";for(let s=0,a=r.length;s<a;s++)o+=String.fromCharCode(r[s]);return o}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),o=new Date;return o.setTime(r*1e3+-20775456e5),o}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,o=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,o);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let o=0,s=t.length,a;o<s;++o)a=t.charCodeAt(o)||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 o=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(o,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let o=0;o<r;++o)this.setUint8(n+o,t[o])}else{const o=he(t);r=o.byteLength;for(let s=0;s<r;++s)this.setUint8(n+s,o.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(i){const e=typeof i=="object"?i:{type:i},{size:t=1,type:n}=e;return(r,o)=>{if(typeof o!="string")return;let s=cr.get(r);s||(s={columns:[],byteLength:0},cr.set(r,s));const a={...e,name:o,byteLength:t*Re[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+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class bn extends Ot{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Ds=Object.defineProperty,wt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ds(e,t,r),r};const vt=class as extends bn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,o=n.name.names,s=Ne(o.fontFamily||""),a=s.length,l=Ne(o.fontStyle||""),h=l.length,c=Ne(o.version||""),f=c.length,u=Ne(o.fullName||""),d=u.length,p=86+a+4+h+4+f+4+d+2+t.view.byteLength,m=new as(new ArrayBuffer(p),0,p,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(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(d),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var Us=Object.defineProperty,qe=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Us(e,t,r),r};class Pe extends Ot{constructor(e,t){super(e,t,16)}}qe([g({type:"char",size:4})],Pe.prototype,"tag"),qe([g("uint32")],Pe.prototype,"checkSum"),qe([g("uint32")],Pe.prototype,"offset"),qe([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"],Ls=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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={},o){const s=1/((o==null?void 0:o.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 d=h[f];d.type==="M"?c.push({type:"M",x:e+d.x*a,y:t+-d.y*l}):d.type==="L"?c.push({type:"L",x:e+d.x*a,y:t+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:e+d.x1*a,y1:t+-d.y1*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="C"?c.push({type:"C",x1:e+d.x1*a,y1:t+-d.y1*l,x2:e+d.x2*a,y2:t+-d.y2*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class $s extends fr{parse(e,t,n){const r=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,d,p;const m=[],y=[];let k=0,P=!1,v=!1,C=s,x=0,b=0;function S(T,U){m.push({type:"L",x:T,y:U})}function w(T,U,V,B,O,q){m.push({type:"C",x1:T,y1:U,x2:V,y2:B,x:O,y:q})}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 _(){y.length%2!==0&&!P&&(C=y.shift()+o),k+=y.length>>1,y.length=0,P=!0}function j(T){let U,V,B,O,q,L,D,Z,W,G,N,K,X=0;for(;X<T.length;){let nt=T[X++];switch(nt){case 1:_();break;case 3:_();break;case 4:y.length>1&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),I(x,b);break;case 5:for(;y.length>0;)x+=y.shift(),b+=y.shift(),S(x,b);break;case 6:for(;y.length>0&&(x+=y.shift(),S(x,b),y.length!==0);)b+=y.shift(),S(x,b);break;case 7:for(;y.length>0&&(b+=y.shift(),S(x,b),y.length!==0);)x+=y.shift(),S(x,b);break;case 8:for(;y.length>0;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 10:q=y.pop()+l,L=e.subrs[q],L&&j(L);break;case 11:return;case 12:switch(nt=T[X],X+=1,nt){case 35:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),N=W+y.shift(),K=G+y.shift(),x=N+y.shift(),b=K+y.shift(),y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 34:f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,N=W+y.shift(),K=b,x=N+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 36:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,N=W+y.shift(),K=G+y.shift(),x=N+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 37:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),N=W+y.shift(),K=G+y.shift(),Math.abs(N-x)>Math.abs(K-b)?x=N+y.shift():b=K+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Wt=Sn[y.pop()],Bt=Sn[y.pop()],Ct=y.pop(),At=y.pop();if(Wt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),kt=e.charset.indexOf(Bt);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Ct}),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+=Ct),(Et.type==="Q"||Et.type==="C")&&(Et.x1+=At,Et.y1+=Ct),Et.type==="C"&&(Et.x2+=At,Et.y2+=Ct)}E(Ft)}}else y.length>0&&!P&&(C=y.shift()+o,P=!0);v&&h!==2&&(F(),v=!1);break;case 18:_();break;case 19:case 20:_(),X+=k+7>>3;break;case 21:y.length>2&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),x+=y.pop(),I(x,b);break;case 22:y.length>1&&!P&&(C=y.shift()+o,P=!0),x+=y.pop(),I(x,b);break;case 23:_();break;case 24:for(;y.length>2;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);x+=y.shift(),b+=y.shift(),S(x,b);break;case 25:for(;y.length>6;)x+=y.shift(),b+=y.shift(),S(x,b);f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 26:for(y.length%2&&(x+=y.shift());y.length>0;)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d,b=p+y.shift(),w(f,u,d,p,x,b);break;case 27:for(y.length%2&&(b+=y.shift());y.length>0;)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p,w(f,u,d,p,x,b);break;case 28:U=T[X],V=T[X+1],y.push((U<<24|V<<16)>>16),X+=2;break;case 29:q=y.pop()+a,L=e.gsubrs[q],L&&j(L);break;case 30:for(;y.length>0&&(f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b);break;case 31:for(;y.length>0&&(f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,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],V=T[X+1],B=T[X+2],O=T[X+3],X+=4,y.push((U<<24|V<<16|B<<8|O)/65536))}}}j(t),this.pathCommands=m,P&&(this.advanceWidth=C)}}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 o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);o&&(n.unicode??(n.unicode=o[0]),n.unicodes??(n.unicodes=o)),this._items[e]=n}return n}}class Fs extends ur{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new $s({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var zs=Object.defineProperty,pr=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zs(e,t,r),r};class Ge extends Ot{constructor(t,n,r,o){super(t,n,r,o);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 o=[];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();o.push(h)}return o}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,o=r+n[t],a=r+n[t+1]-o;return this._isString?this.view.readString(o,a):this.view.readBytes(o,a)}}pr([g("uint16")],Ge.prototype,"count"),pr([g("uint8")],Ge.prototype,"offsetSize");class We extends Ge{constructor(){super(...arguments);M(this,"_isString",!1)}}class dr extends Ge{constructor(){super(...arguments);M(this,"_isString",!0)}}const js=[".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"],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"],Rs=[".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"],qs=[".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 Ve(i,e){return e<=390?js[e]:i[e-391]}function J(i,e="number",t){return(n,r)=>{if(typeof r!="string")return;const o={type:e,operator:i,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class yr extends Ot{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,o=["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+=o[a],l===r))break;n+=o[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,o,s,a;if(t===28)return r=n.readUint8(),o=n.readUint8(),r<<8|o;if(t===29)return r=n.readUint8(),o=n.readUint8(),s=n.readUint8(),a=n.readUint8(),r<<24|o<<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,o={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),o[s]=n,n=[]):n.push(this._readOperand(s))}return o}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return Ve(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Gs=Object.defineProperty,Cn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Gs(e,t,r),r};class Xe extends yr{}Cn([J(19)],Xe.prototype,"subrs"),Cn([J(20)],Xe.prototype,"defaultWidthX"),Cn([J(21)],Xe.prototype,"nominalWidthX");var Ws=Object.defineProperty,rt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(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(i,e=i){return t=>{ce.tableDefinitions.set(i,{tag:i,prop:e,class:t}),Object.defineProperty(ce.prototype,e,{get(){return this.get(i)},set(n){return this.set(i,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,o=Array.from({length:r}),s=t.get(0);for(let a=0;a<r;a+=1)o[a]=t.get(n[a])||s;return o}getPathCommands(e,t,n,r,o){const s=[];return this.forEachGlyph(e,t,n,r,o,(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,o={},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,o),c.advanceWidth&&(t+=c.advanceWidth*a),o.letterSpacing?t+=o.letterSpacing*r:o.tracking&&(t+=o.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 o=this.tableViews.get(e);if(!o)return;n=new r(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(t.prop,n)}}return n}};M(ae,"tableDefinitions",new Map);let ce=ae;class yt extends Ot{setSfnt(e){return this._sfnt=e,this}getSfnt(){return this._sfnt}}var Vs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Te=(i,e,t,n)=>{for(var r=n>1?void 0:n?Xs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Vs(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 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:n}=e,r=n+4;this.nameIndex=new dr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new dr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Xe(t,n+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ns:this.topDict.charset===1?this.charset=Rs:this.topDict.charset===2?this.charset=qs: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=Ls:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let o,s,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(o=0;o<t;o+=1)s=r.readUint16(),l.push(Ve(n,s));else if(h===1)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint8(),o=0;o<=a;o+=1)l.push(Ve(n,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint16(),o=0;o<=a;o+=1)l.push(Ve(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 o={},s=t.readUint8();if(s===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),o[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)o[c]=r,r+=1}}else console.warn(`unknown encoding format:${s}`);return o}_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 Hs=Object.defineProperty,He=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Hs(e,t,r),r};const Ae=class ls extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new ls;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 Zs=Object.defineProperty,Mn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Zs(e,t,r),r};class Ze extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,o=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<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=o[c].entryCount;f<u;f++)if(o[c].idRangeOffset+f>=s.length?l=0:(l=s[o[c].idRangeOffset+f],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<e){const d=(h<<8|f+o[c].firstCode)%65535;t.set(d,l)}}return t}}Mn([g("uint16")],Ze.prototype,"format"),Mn([g("uint16")],Ze.prototype,"length"),Mn([g("uint16")],Ze.prototype,"language");function mr(i){return i>32767?i-65536:i<-32767?i+65536:i}function xr(i,e){let t;const n=[];let r={};return i.forEach((o,s)=>{e&&s>e||((!t||s!==t.unicode+1||o!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:s,startId:o,delta:mr(o-s)}):(r.start=Number(s),r.startId=o,r.delta=mr(o-s))),t={unicode:s,glyphIndex:o})}),t&&(r.end=t.unicode,n.push(r)),n}var Ys=Object.defineProperty,ne=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ys(e,t,r),r};const Yt=class hs extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=xr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),o=2*2**r,s=new hs(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=r,s.rangeShift=2*n-o,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,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=o[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,d=l[u];d!==0?e.set(c,(d+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};ne([g("uint16")],Yt.prototype,"format"),ne([g("uint16")],Yt.prototype,"length"),ne([g("uint16")],Yt.prototype,"language"),ne([g("uint16")],Yt.prototype,"segCountX2"),ne([g("uint16")],Yt.prototype,"searchRange"),ne([g("uint16")],Yt.prototype,"entrySelector"),ne([g("uint16")],Yt.prototype,"rangeShift");let wr=Yt;var Ks=Object.defineProperty,ke=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ks(e,t,r),r};class ue extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}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 Qs=Object.defineProperty,_e=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Qs(e,t,r),r};const pe=class cs extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=xr(e),n=new cs(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 o=t[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};_e([g("uint16")],pe.prototype,"format"),_e([g("uint16")],pe.prototype,"reserved"),_e([g("uint32")],pe.prototype,"length"),_e([g("uint32")],pe.prototype,"language"),_e([g("uint32")],pe.prototype,"nGroups");let vr=pe;var Js=Object.defineProperty,Pn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Js(e,t,r),r};class Ye extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:o}=t[n];o.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 ti=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,Tn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ti(e,t,r),r};let Ie=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),o=t?vr.from(e):void 0,s=4+(o?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},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Ie(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((o==null?void 0:o.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),o&&c.view.writeBytes(o.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,o=n.length;r<o;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,o=(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())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};Tn([g("uint16")],Ie.prototype,"version",2),Tn([g("uint16")],Ie.prototype,"numberSubtables",2),Ie=Tn([dt("cmap")],Ie);class ni extends fr{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const o=e[r];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return Me(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 o=e[r],s={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,r,o){let s;return(t&r)>0?(s=e.view.readUint8(),t&o||(s=-s),s=n+s):(t&o)>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();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 d,p=0;for(;p<f;)if(d=e.view.readUint8(),u.push(d),p++,d&8&&p<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(d),p++}if(Me(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)d=u[v],y={},y.onCurve=!!(d&1),y.lastPointOfContour=a.includes(v),m.push(y);let k=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.x=this._parseGlyphCoordinate(e,d,k,2,16),k=y.x;let P=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.y=this._parseGlyphCoordinate(e,d,P,4,32),P=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{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 d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],d)[0],d.dx=f.x-u.x,d.dy=f.y-u.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],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?o.push({type:"M",x:c.x,y:c.y}):f.onCurve?o.push({type:"M",x:f.x,y:f.y}):o.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,d=h.length;u<d;++u)if(c=f,f=h[(u+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let p=f;f.onCurve||(p={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class ri extends ur{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new ni({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi=(i,e,t,n)=>{for(var r=n>1?void 0:n?ii(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&si(e,t,r),r};let An=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,o)=>r+o.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 ri(this._sfnt))}};An=oi([dt("glyf")],An);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(i,e,t,n)=>{for(var r=n>1?void 0:n?li(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ai(e,t,r),r};let br=class extends yt{};br=hi([dt("GPOS","gpos")],br);var ci=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,re=(i,e,t,n)=>{for(var r=n>1?void 0:n?fi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ci(e,t,r),r};let Kt=class extends yt{};re([g("uint16")],Kt.prototype,"majorVersion",2),re([g("uint16")],Kt.prototype,"minorVersion",2),re([g("uint16")],Kt.prototype,"scriptListOffset",2),re([g("uint16")],Kt.prototype,"featureListOffset",2),re([g("uint16")],Kt.prototype,"lookupListOffset",2),re([g("uint16")],Kt.prototype,"featureVariationsOffset",2),Kt=re([dt("GSUB","gsub")],Kt);var ui=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ot=(i,e,t,n)=>{for(var r=n>1?void 0:n?pi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ui(e,t,r),r};let it=class extends yt{constructor(i=new ArrayBuffer(54),e){super(i,e,Math.min(54,i.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 di=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,bt=(i,e,t,n)=>{for(var r=n>1?void 0:n?yi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&di(e,t,r),r};let gt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.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 gi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,xi=(i,e,t,n)=>{for(var r=n>1?void 0:n?mi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gi(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((o,s)=>(s<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};kn=xi([dt("hmtx")],kn);var wi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,bi=(i,e,t,n)=>{for(var r=n>1?void 0:n?vi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wi(e,t,r),r};let Sr=class extends yt{};Sr=bi([dt("kern","kern")],Sr);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Mi=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ci(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Si(e,t,r),r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new _n(new ArrayBuffer(n));return e.forEach(o=>{t?r.view.writeUint32(o):r.view.writeUint16(o/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};_n=Mi([dt("loca")],_n);var Pi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,mt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ti(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Pi(e,t,r),r};let lt=class extends yt{constructor(i=new ArrayBuffer(32),e){super(i,e,Math.min(32,i.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 Ai=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Ke=(i,e,t,n)=>{for(var r=n>1?void 0:n?ki(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ai(e,t,r),r};const Cr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},In={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},_i={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Mr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Oe=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=In.Macintosh,o=_i.Default,s=0;t.some(l=>l.platform===In.Microsoft&&l.encoding===Mr.UCS2&&l.language===1033)&&(r=In.Microsoft,o=Mr.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===o&&h.language===s&&Cr[h.nameId]&&(a[Cr[h.nameId]]=s===0?Os(h.name):Bs(h.name))}return a}};Ke([g("uint16")],Oe.prototype,"format",2),Ke([g("uint16")],Oe.prototype,"count",2),Ke([g("uint16")],Oe.prototype,"stringOffset",2),Oe=Ke([dt("name")],Oe);var Ii=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,z=(i,e,t,n)=>{for(var r=n>1?void 0:n?Oi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ii(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]}};z([g("uint16")],$.prototype,"version",2),z([g("int16")],$.prototype,"xAvgCharWidth",2),z([g("uint16")],$.prototype,"usWeightClass",2),z([g("uint16")],$.prototype,"usWidthClass",2),z([g("uint16")],$.prototype,"fsType",2),z([g("uint16")],$.prototype,"ySubscriptXSize",2),z([g("uint16")],$.prototype,"ySubscriptYSize",2),z([g("uint16")],$.prototype,"ySubscriptXOffset",2),z([g("uint16")],$.prototype,"ySubscriptYOffset",2),z([g("uint16")],$.prototype,"ySuperscriptXSize",2),z([g("uint16")],$.prototype,"ySuperscriptYSize",2),z([g("uint16")],$.prototype,"ySuperscriptXOffset",2),z([g("uint16")],$.prototype,"ySuperscriptYOffset",2),z([g("uint16")],$.prototype,"yStrikeoutSize",2),z([g("uint16")],$.prototype,"yStrikeoutPosition",2),z([g("uint16")],$.prototype,"sFamilyClass",2),z([g({type:"uint8"})],$.prototype,"bFamilyType",2),z([g({type:"uint8"})],$.prototype,"bSerifStyle",2),z([g({type:"uint8"})],$.prototype,"bWeight",2),z([g({type:"uint8"})],$.prototype,"bProportion",2),z([g({type:"uint8"})],$.prototype,"bContrast",2),z([g({type:"uint8"})],$.prototype,"bStrokeVariation",2),z([g({type:"uint8"})],$.prototype,"bArmStyle",2),z([g({type:"uint8"})],$.prototype,"bLetterform",2),z([g({type:"uint8"})],$.prototype,"bMidline",2),z([g({type:"uint8"})],$.prototype,"bXHeight",2),z([g({type:"uint8",size:16})],$.prototype,"ulUnicodeRange",2),z([g({type:"char",size:4})],$.prototype,"achVendID",2),z([g("uint16")],$.prototype,"fsSelection",2),z([g("uint16")],$.prototype,"usFirstCharIndex",2),z([g("uint16")],$.prototype,"usLastCharIndex",2),z([g("int16")],$.prototype,"sTypoAscender",2),z([g("int16")],$.prototype,"sTypoDescender",2),z([g("int16")],$.prototype,"sTypoLineGap",2),z([g("uint16")],$.prototype,"usWinAscent",2),z([g("uint16")],$.prototype,"usWinDescent",2),z([g({offset:72,type:"uint8",size:8})],$.prototype,"ulCodePageRange",2),z([g({offset:72,type:"int16"})],$.prototype,"sxHeight",2),z([g("int16")],$.prototype,"sCapHeight",2),z([g("uint16")],$.prototype,"usDefaultChar",2),z([g("uint16")],$.prototype,"usBreakChar",2),z([g("uint16")],$.prototype,"usMaxContext",2),$=z([dt("OS/2","os2")],$);var Bi=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Rt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Bi(e,t,r),r};let Lt=class extends yt{constructor(i=new ArrayBuffer(32),e,t){super(i,e,t)}};Rt([g("fixed")],Lt.prototype,"format",2),Rt([g("fixed")],Lt.prototype,"italicAngle",2),Rt([g("int16")],Lt.prototype,"underlinePosition",2),Rt([g("int16")],Lt.prototype,"underlineThickness",2),Rt([g("uint32")],Lt.prototype,"isFixedPitch",2),Rt([g("uint32")],Lt.prototype,"minMemType42",2),Rt([g("uint32")],Lt.prototype,"maxMemType42",2),Rt([g("uint32")],Lt.prototype,"minMemType1",2),Rt([g("uint32")],Lt.prototype,"maxMemType1",2),Lt=Rt([dt("post")],Lt);var Di=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,St=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ui(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Di(e,t,r),r};let xt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.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 Li=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Fi=(i,e,t,n)=>{for(var r=n>1?void 0:n?$i(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Li(e,t,r),r};let On=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new On(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 o;const e=this._sfnt.maxp.numGlyphs,t=((o=this._sfnt.vhea)==null?void 0:o.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()}))}};On=Fi([dt("vmtx")],On);var zi=Object.defineProperty,Be=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zi(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 o=0;for(let s=0,a=r/4;s<a;s+=4)s*4<r-4&&(o+=n.getUint32(s*4,!1));return o&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,o=Array.from(t.tableViews.values()).reduce((u,d)=>u+n(d.byteLength),0),s=new this(new ArrayBuffer(12+r*16+o));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,d)=>{const p=c[h++];p.tag=d,p.checkSum=this.checksum(u),p.offset=l,p.length=u.byteLength,s.view.writeBytes(u,l),l+=n(p.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 ji=Object.defineProperty,Ee=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&ji(e,t,r),r};class de extends Ot{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 Ni=Object.defineProperty,It=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ni(e,t,r),r};const Mt=(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,o=Math.floor(r/4);let s=0,a=0;for(;a<o;)s+=n.getUint32(4*a++,!1);let l=r-o*4;if(l){let h=o*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,o=[];t.tableViews.forEach((u,d)=>{const p=he(Ms(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));o.push({tag:d,view:p.byteLength<u.byteLength?p:u,rawView:u})});const s=o.length,a=o.reduce((u,d)=>u+r(d.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+o.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return o.forEach(u=>{const d=f[c++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=ee.checkSum(u.rawView),d.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(d.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new de(this.view.buffer,t);return t+=n.view.byteLength,n})}createSfnt(){return new ce(this.getDirectories().reduce((t,n)=>{const r=n.tag,o=this.view.byteOffset+n.offset,s=n.compLength,a=n.origLength,l=o+s;return t[r]=s>=a?new DataView(this.view.buffer,o,s):new DataView(Ps(new Uint8Array(this.view.buffer.slice(o,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);It([g("uint32")],Mt.prototype,"signature"),It([g("uint32")],Mt.prototype,"flavor"),It([g("uint32")],Mt.prototype,"length"),It([g("uint16")],Mt.prototype,"numTables"),It([g("uint16")],Mt.prototype,"reserved"),It([g("uint32")],Mt.prototype,"totalSfntSize"),It([g("uint16")],Mt.prototype,"majorVersion"),It([g("uint16")],Mt.prototype,"minorVersion"),It([g("uint32")],Mt.prototype,"metaOffset"),It([g("uint32")],Mt.prototype,"metaLength"),It([g("uint32")],Mt.prototype,"metaOrigLength"),It([g("uint32")],Mt.prototype,"privOffset"),It([g("uint32")],Mt.prototype,"privLength");let Bn=Mt;function Ri(i,e=!0){if($t.is(i))return new $t(i);if(Qe.is(i))return new Qe(i);if(Bn.is(i))return new Bn(i);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">
|
|
6
|
-
<circle cx="${
|
|
7
|
-
</svg>`}function
|
|
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,o)=>r||this.loaded.get(o),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:o=!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,d)=>{u!==l&&(u.cancel(),this.loading.delete(d))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const d=f(u);return t.noAdd||this.loaded.set(e.src,d),d.familySet.forEach(p=>{this.familyToUrl.set(p,a),typeof document<"u"&&(r&&this.injectFontFace(p,u),o&&this.injectStyleTag(p,a))}),d}}).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(d=>{u.familySet.add(d)}),u}function f(u=new ArrayBuffer(0)){let d;function p(){return d||(d=u.byteLength?Ri(u,!1):void 0),d}function m(){const y=p();if(y instanceof $t||y instanceof Bn)return y.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:p,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 qi=new En;function Gi(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=Pr(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h;if(n&&(o=Zi(i,e,o,t)),i.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const d=i[u],p=i[u+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>f&&(f=p)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return De(o,s,t,a,l,h,0),s}function Pr(i,e,t,n,r){let o;if(r===oo(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=_r(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=_r(s/n|0,i[s],i[s+1],o);return o&&ye(o,o.next)&&($e(o),o=o.next),o}function se(i,e){if(!i)return i;e||(e=i);let t=i,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(i,e,t,n,r,o,s){if(!i)return;!s&&o&&to(i,n,r,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,h=i.next;if(o?Vi(i,n,r,o):Wi(i)){e.push(l.i,i.i,h.i),$e(i),i=h.next,a=h.next;continue}if(i=h,i===a){s?s===1?(i=Xi(se(i),e),De(i,e,t,n,r,o,2)):s===2&&Hi(i,e,t,n,r,o):De(se(i),e,t,n,r,o,1);break}}}function Wi(i){const e=i.prev,t=i,n=i.next;if(tt(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,o,s),f=Math.min(a,l,h),u=Math.max(r,o,s),d=Math.max(a,l,h);let p=n.next;for(;p!==e;){if(p.x>=c&&p.x<=u&&p.y>=f&&p.y<=d&&Ue(r,a,o,l,s,h,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Vi(i,e,t,n){const r=i.prev,o=i,s=i.next;if(tt(r,o,s)>=0)return!1;const a=r.x,l=o.x,h=s.x,c=r.y,f=o.y,u=s.y,d=Math.min(a,l,h),p=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),k=Dn(d,p,e,t,n),P=Dn(m,y,e,t,n);let v=i.prevZ,C=i.nextZ;for(;v&&v.z>=k&&C&&C.z<=P;){if(v.x>=d&&v.x<=m&&v.y>=p&&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,C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;v&&v.z>=k;){if(v.x>=d&&v.x<=m&&v.y>=p&&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(;C&&C.z<=P;){if(C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Xi(i,e){let t=i;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=i=r),t=t.next}while(t!==i);return se(t)}function Hi(i,e,t,n,r,o){let s=i;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&ro(s,a)){let l=kr(s,a);s=se(s,s.next),l=se(l,l.next),De(s,e,t,n,r,o,0),De(l,e,t,n,r,o,0);return}a=a.next}s=s.next}while(s!==i)}function Zi(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const a=e[o]*n,l=o<s-1?e[o+1]*n:i.length,h=Pr(i,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(no(h))}r.sort(Yi);for(let o=0;o<r.length;o++)t=Ki(r[o],t);return t}function Yi(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Ki(i,e){const t=Qi(i,e);if(!t)return e;const n=kr(t,i);return se(n,n.next),se(t,t.next)}function Qi(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(ye(i,t))return t;do{if(ye(i,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>o&&(o=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:o,r,l,h,r<h?o:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Le(t,i)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&Ji(s,t)))&&(s=t,c=f)}t=t.next}while(t!==a);return s}function Ji(i,e){return tt(i.prev,i,e.prev)<0&&tt(e.next,i,i.next)<0}function to(i,e,t,n){let r=i;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!==i);r.prevZ.nextZ=null,r.prevZ=null,eo(r)}function eo(i){let e,t=1;do{let n=i,r;i=null;let o=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--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function Dn(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function no(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Tr(i,e,t,n,r,o,s,a){return(r-s)*(e-a)>=(i-s)*(o-a)&&(i-s)*(n-a)>=(t-s)*(e-a)&&(t-s)*(o-a)>=(r-s)*(n-a)}function Ue(i,e,t,n,r,o,s,a){return!(i===s&&e===a)&&Tr(i,e,t,n,r,o,s,a)}function ro(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!so(i,e)&&(Le(i,e)&&Le(e,i)&&io(i,e)&&(tt(i.prev,i,e.prev)||tt(i,e.prev,e))||ye(i,e)&&tt(i.prev,i,i.next)>0&&tt(e.prev,e,e.next)>0)}function tt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ye(i,e){return i.x===e.x&&i.y===e.y}function Ar(i,e,t,n){const r=tn(tt(i,e,t)),o=tn(tt(i,e,n)),s=tn(tt(t,n,i)),a=tn(tt(t,n,e));return!!(r!==o&&s!==a||r===0&&Je(i,t,e)||o===0&&Je(i,n,e)||s===0&&Je(t,i,n)||a===0&&Je(t,e,n))}function Je(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tn(i){return i>0?1:i<0?-1:0}function so(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Ar(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Le(i,e){return tt(i.prev,i,i.next)<0?tt(i,e,i.next)>=0&&tt(i,i.prev,e)>=0:tt(i,e,i.prev)<0||tt(i,i.next,e)<0}function io(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function kr(i,e){const t=Un(i.i,i.x,i.y),n=Un(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function _r(i,e,t,n){const r=Un(i,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(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Un(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function oo(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function ao(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ln(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=f,i.shadowBlur=u,i.shadowColor=d}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-o*s),t.y-(r*s+o*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,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class 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 A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new H;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.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,o=1,s=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,o,s,a,l,h)}set(e,t,n,r,o,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=o,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,o=this.elements,s=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],d=n[5],p=n[8],m=r[0],y=r[3],k=r[6],P=r[1],v=r[4],C=r[7],x=r[2],b=r[5],S=r[8];return o[0]=s*m+a*P+l*x,o[3]=s*y+a*v+l*b,o[6]=s*k+a*C+l*S,o[1]=h*m+c*P+f*x,o[4]=h*y+c*v+f*b,o[7]=h*k+c*C+f*S,o[2]=u*m+d*P+p*x,o[5]=u*y+d*v+p*b,o[8]=u*k+d*C+p*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=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*o,d=h*o-s*l,p=t*f+n*u+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*s)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*o-a*t)*m,e[6]=d*m,e[7]=(n*l-h*t)*m,e[8]=(s*t-n*o)*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 Ir(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function ho(i,e,t,n,r,o,s,a){if(e===0||t===0){i.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,d=t*t;const p=c*c,m=f*f,y=p/u+m/d;if(y>1){const F=Math.sqrt(y);e=F*e,t=F*t,u=e*e,d=t*t}const k=u*m+d*p,P=(u*d-k)/k;let v=Math.sqrt(Math.max(0,P));r===o&&(v=-v);const C=v*e*f/t,x=-v*t*c/e,b=Math.cos(n)*C-Math.sin(n)*x+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(s.y+a.y)/2,w=Ir(1,0,(c-C)/e,(f-x)/t),I=Ir((c-C)/e,(f-x)/t,(-c-C)/e,(-f-x)/t)%(Math.PI*2);i.ellipse(b,S,e,t,n,w,w+I,o===0)}const st={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function qt(i,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,k,P){const v=new SyntaxError(`Unexpected character "${y}" at index ${k}.`);throw v.partial=P,v}function d(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let p;const m=i.length;for(let y=0;y<m;y++){if(p=i[y],Array.isArray(e)&&e.includes(f.length%t)&&st.FLAGS.test(p)){a=1,h=p,d();continue}if(a===0){if(st.WHITESPACE.test(p))continue;if(st.DIGIT.test(p)||st.SIGN.test(p)){a=1,h=p;continue}if(st.POINT.test(p)){a=2,h=p;continue}st.COMMA.test(p)&&(l&&u(p,y,f),l=!0)}if(a===1){if(st.DIGIT.test(p)){h+=p;continue}if(st.POINT.test(p)){h+=p,a=2;continue}if(st.EXP.test(p)){a=3;continue}st.SIGN.test(p)&&h.length===1&&st.SIGN.test(h[0])&&u(p,y,f)}if(a===2){if(st.DIGIT.test(p)){h+=p;continue}if(st.EXP.test(p)){a=3;continue}st.POINT.test(p)&&h[h.length-1]==="."&&u(p,y,f)}if(a===3){if(st.DIGIT.test(p)){c+=p;continue}if(st.SIGN.test(p)){if(c===""){c+=p;continue}c.length===1&&st.SIGN.test(c)&&u(p,y,f)}}st.WHITESPACE.test(p)?(d(),a=0,l=!1):st.COMMA.test(p)?(d(),a=0,l=!0):st.SIGN.test(p)?(d(),a=1,h=p):st.POINT.test(p)?(d(),a=2,h=p):u(p,y,f)}return d(),f}function ge(i,e){return i-(e-i)}function Or(i,e){const t=new A,n=new A;for(let r=0,o=i.length;r<o;r++){const s=i[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),ho(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 co(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[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 fo=/[a-df-z][^a-df-z]*/gi;function Br(i){const e=[],t=i.match(fo);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=qt(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=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=qt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type: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=qt(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=qt(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=qt(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=qt(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(o)}}return e}function Er(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*i+t}function uo(i,e){const t=1-i;return t*t*t*e}function po(i,e){const t=1-i;return 3*t*t*i*e}function yo(i,e){return 3*(1-i)*i*i*e}function go(i,e){return i*i*i*e}function Dr(i,e,t,n,r){return uo(i,e)+po(i,t)+yo(i,n)+go(i,r)}function mo(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=0,indicesOffset:a=0}=e;const l=Gi(i,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*o;for(let c=0;c<i.length;c+=2)t[h]=i[c],t[h+1]=i[c+1],h+=o}return{vertices:t,indices:n}}const xo=8,en=11920929e-14,wo=1;function vo(i,e,t,n,r,o,s,a,l=.5,h){const f=Math.min(.99,Math.max(0,l));let u=(wo-f)/1;return u*=u,Fn(i,e,t,n,r,o,s,a,h,u,0),h.push(s,a),h}function Fn(i,e,t,n,r,o,s,a,l,h,c){if(c>xo)return;const f=(i+t)/2,u=(e+n)/2,d=(t+r)/2,p=(n+o)/2,m=(r+s)/2,y=(o+a)/2,k=(f+d)/2,P=(u+p)/2,v=(d+m)/2,C=(p+y)/2,x=(k+v)/2,b=(P+C)/2;if(c>0){let S=s-i,w=a-e;const I=Math.abs((t-s)*w-(n-a)*S),F=Math.abs((r-s)*w-(o-a)*S);if(I>en&&F>en){if((I+F)*(I+F)<=h*(S*S+w*w)){l.push(x,b);return}}else if(I>en){if(I*I<=h*(S*S+w*w)){l.push(x,b);return}}else if(F>en){if(F*F<=h*(S*S+w*w)){l.push(x,b);return}}else if(S=x-(i+s)/2,w=b-(e+a)/2,S*S+w*w<=h){l.push(x,b);return}}Fn(i,e,f,u,k,P,x,b,l,h,c+1),Fn(x,b,v,C,m,y,s,a,l,h,c+1)}const bo=8,So=11920929e-14,Co=1;function Mo(i,e,t,n,r,o,s=.5,a){const h=Math.min(.99,Math.max(0,s));let c=(Co-h)/1;return c*=c,zn(a,i,e,t,n,r,o,c,0),a.push(r,o),a}function zn(i,e,t,n,r,o,s,a,l){if(l>bo)return;const h=(e+n)/2,c=(t+r)/2,f=(n+o)/2,u=(r+s)/2,d=(h+f)/2,p=(c+u)/2;let m=o-e,y=s-t;const k=Math.abs((n-o)*y-(r-s)*m);if(k>So){if(k*k<=a*(m*m+y*y)){i.push(d,p);return}}else if(m=d-(e+o)/2,y=p-(t+s)/2,m*m+y*y<=a){i.push(d,p);return}zn(i,e,t,h,c,d,p,a,l+1),zn(i,d,p,f,u,o,s,a,l+1)}function Po(i,e){const t=1-i;return t*t*e}function To(i,e){return 2*(1-i)*i*e}function Ao(i,e){return i*i*e}function Ur(i,e,t,n){return Po(i,e)+To(i,t)+Ao(i,n)}const ko=1e-4,Lr=1e-4;function _o(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,a=ko;if(i.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=Io(i);o&&(L*=-1),h=(h-.5)*L+.5}const c={x:i[0],y:i[1]},f={x:i[i.length-2],y:i[i.length-1]},u=s,d=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){i=i.slice(),d&&(i.pop(),i.pop(),f.x=i[i.length-2],f.y=i[i.length-1]);const L=(c.x+f.x)*.5,D=(f.y+c.y)*.5;i.unshift(L,D),i.push(L,D)}const p=t,m=i.length/2;let y=i.length;const k=p.length/2,P=l.width/2,v=P*P,C=l.miterLimit*l.miterLimit;let x=i[0],b=i[1],S=i[2],w=i[3],I=0,F=0,E=-(b-w),_=x-S,j=0,T=0,U=Math.sqrt(E*E+_*_);E/=U,_/=U,E*=P,_*=P;const V=h,B=(1-V)*2,O=V*2;u||(l.cap==="round"?y+=ie(x-E*(B-O)*.5,b-_*(B-O)*.5,x-E*B,b-_*B,x+E*O,b+_*O,p,!0)+2:l.cap==="square"&&(y+=$r(x,b,E,_,B,O,!0,p))),p.push(x-E*B,b-_*B),p.push(x+E*O,b+_*O);for(let L=1;L<m-1;++L){x=i[(L-1)*2],b=i[(L-1)*2+1],S=i[L*2],w=i[L*2+1],I=i[(L+1)*2],F=i[(L+1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,j=-(w-F),T=S-I,U=Math.sqrt(j*j+T*T),j/=U,T/=U,j*=P,T*=P;const D=S-x,Z=b-w,W=S-I,G=F-w,N=D*W+Z*G,K=Z*W-G*D,X=K<0;if(Math.abs(K)<.001*Math.abs(N)){p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),N>=0&&(l.join==="round"?y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+4:y+=2,p.push(S-j*O,w-T*O),p.push(S+j*B,w+T*B));continue}const nt=(-E+x)*(-_+w)-(-E+S)*(-_+b),Wt=(-j+I)*(-T+w)-(-j+S)*(-T+F),Bt=(D*Wt-W*nt)/K,Ct=(G*nt-Z*Wt)/K,At=(Bt-S)*(Bt-S)+(Ct-w)*(Ct-w),ht=S+(Bt-S)*B,kt=w+(Ct-w)*B,Ft=S-(Bt-S)*O,zt=w-(Ct-w)*O,Et=Math.min(D*D+Z*Z,W*W+G*G),os=X?B:O,ma=Et+os*os*v;At<=ma?l.join==="bevel"||At/v>C?(X?(p.push(ht,kt),p.push(S+E*O,w+_*O),p.push(ht,kt),p.push(S+j*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push(Ft,zt),p.push(S-j*B,w-T*B),p.push(Ft,zt)),y+=2):l.join==="round"?X?(p.push(ht,kt),p.push(S+E*O,w+_*O),y+=ie(S,w,S+E*O,w+_*O,S+j*O,w+T*O,p,!0)+4,p.push(ht,kt),p.push(S+j*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push(Ft,zt),y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+4,p.push(S-j*B,w-T*B),p.push(Ft,zt)):(p.push(ht,kt),p.push(Ft,zt)):(p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),l.join==="round"?X?y+=ie(S,w,S+E*O,w+_*O,S+j*O,w+T*O,p,!0)+2:y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+2:l.join==="miter"&&At/v<=C&&(X?(p.push(Ft,zt),p.push(Ft,zt)):(p.push(ht,kt),p.push(ht,kt)),y+=2),p.push(S-j*B,w-T*B),p.push(S+j*O,w+T*O),y+=2)}x=i[(m-2)*2],b=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),u||(l.cap==="round"?y+=ie(S-E*(B-O)*.5,w-_*(B-O)*.5,S-E*B,w-_*B,S+E*O,w+_*O,p,!1)+2:l.cap==="square"&&(y+=$r(S,w,E,_,B,O,!1,p)));const q=Lr*Lr;for(let L=k;L<y+k-2;++L)x=p[L*2],b=p[L*2+1],S=p[(L+1)*2],w=p[(L+1)*2+1],I=p[(L+2)*2],F=p[(L+2)*2+1],!(Math.abs(x*(w-F)+S*(F-b)+I*(b-w))<q)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function Io(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],a=i[n+1];t+=(s-r)*(a+o),r=s,o=a}return t<0?-1:1}function $r(i,e,t,n,r,o,s,a){const l=i-t*r,h=e-n*r,c=i+t*o,f=e+n*o;let u,d;s?(u=n,d=-t):(u=-n,d=t);const p=l+u,m=h+d,y=c+u,k=f+d;return a.push(p,m),a.push(y,k),2}function ie(i,e,t,n,r,o,s,a){const l=t-i,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-i,o-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const d=f-c,p=Math.abs(d),m=Math.sqrt(l*l+h*h),y=(15*p*Math.sqrt(m)/Math.PI>>0)+1,k=d/y;if(u+=k,a){s.push(i,e),s.push(t,n);for(let P=1,v=u;P<y;P++,v+=k)s.push(i,e),s.push(i+Math.sin(v)*m,e+Math.cos(v)*m);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let P=1,v=u;P<y;P++,v+=k)s.push(i+Math.sin(v)*m,e+Math.cos(v)*m),s.push(i,e);s.push(r,o),s.push(i,e)}return y*2}class me{constructor(){M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,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 o=e[n],s=e[n+1];t.push(new A(o,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),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/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]-o,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(r-1);const c=n[s],u=n[s+1]-c,d=(o-c)/u;return(s+d)/(r-1)}getTangent(e,t=new A){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;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 mo(this.getPoints().reduce((t,n)=>(t.push(n.x,n.y),t),[]),e)}strokeTriangulate(e){return _o(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 o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return co(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 Oo=new Pt,Fr=new Pt,zr=new Pt,nn=new A;class jn extends me{constructor(e=new A,t=new A,n=new A,r=0,o=0,s=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}getPoint(e,t=new A){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(o?r=0:r=n),this.clockwise&&!o&&(r===n?r=-n:r=r-n);const s=this.startAngle+e*r;let a=this.cx+this.rx*Math.cos(s),l=this.cy+this.ry*Math.sin(s);if(this.rotate!==0){const h=Math.cos(this.rotate),c=Math.sin(this.rotate),f=a-this.cx,u=l-this.cy;a=f*h-u*c+this.cx,l=f*c+u*h+this.cy}return t.set(a,l)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,h=e+n*Math.cos(o)*Math.cos(l)-r*Math.sin(o)*Math.sin(l),c=t+n*Math.cos(o)*Math.sin(l)+r*Math.sin(o)*Math.cos(l),f=Math.abs(o-s),u=f>Math.PI?1:0,d=a?1:0,p=l*180/Math.PI;if(f>=2*Math.PI){const m=o+Math.PI,y=e+n*Math.cos(m)*Math.cos(l)-r*Math.sin(m)*Math.sin(l),k=t+n*Math.cos(m)*Math.sin(l)+r*Math.sin(m)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:y,y:k},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:h,y:c}]}else{const m=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),y=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:u,sweepFlag:d,x:m,y}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,o,s,a,l,!h),this}applyTransform(e){return nn.set(this.cx,this.cy),nn.applyMatrix3(e),this.cx=nn.x,this.cy=nn.y,Do(e)?Bo(this,e):Eo(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:a}=this;if(!(r>=0&&o>=0&&s>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+o)),h=l*8+(s?4:0)+(a?4:0);if(h===0)return e;const c=[];if(l===0)c[0]=c[6]=t+s,c[1]=c[3]=n+a,c[2]=c[4]=t-s,c[5]=c[7]=n-a;else{let f=0,u=l*4+(s?2:0)+2,d=u,p=h,m=s+r,y=a,k=t+m,P=t-m,v=n+y;if(c[f++]=k,c[f++]=v,c[--u]=v,c[--u]=P,a){const x=n-y;c[d++]=P,c[d++]=x,c[--p]=x,c[--p]=k}for(let x=1;x<l;x++){const b=Math.PI/2*(x/l),S=s+Math.cos(b)*r,w=a+Math.sin(b)*o,I=t+S,F=t-S,E=n+w,_=n-w;c[f++]=I,c[f++]=E,c[--u]=E,c[--u]=F,c[d++]=F,c[d++]=_,c[--p]=_,c[--p]=I}m=s,y=a+o,k=t+m,P=t-m,v=n+y;const C=n-y;c[f++]=k,c[f++]=v,c[--p]=C,c[--p]=k,s&&(c[f++]=P,c[f++]=v,c[--p]=C,c[--p]=P)}return Array.prototype.push.apply(e,c),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let u=0;u<a.length;u+=2)l+=a[u],h+=a[u+1];l/=a.length/2,h/=a.length/2;let c=o;t[c*r]=l,t[c*r+1]=h;const f=c++;for(let u=0;u<a.length;u+=2)t[c*r]=a[u],t[c*r+1]=a[u+1],u>0&&(n[s++]=c,n[s++]=f,n[s++]=c-1),c++;return n[s++]=f+1,n[s++]=f,n[s++]=c-1,{vertices:t,indices:n}}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(o*o*l*l+s*s*h*h),f=Math.sqrt(o*o*h*h+s*s*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-f),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+f),{min:e,max:t}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function Bo(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new A(t*r,t*o),a=new A(-n*o,n*r),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=Oo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=Fr.copy(c).invert(),p=zr.copy(f).transpose().multiply(f).elements,m=Uo(p[0],p[1],p[4]),y=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(i.rx=1/y,i.ry=1/k,i.rotate=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=Fr.set(y,0,0,0,k,0,0,0,1),C=zr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),x=v.multiply(C).multiply(c),b=S=>{const{x:w,y:I}=new A(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(I,w)};i.startAngle=b(i.startAngle),i.endAngle=b(i.endAngle),jr(e)&&(i.clockwise=!i.clockwise)}}function Eo(i,e){const t=Nr(e),n=Rr(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,jr(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function jr(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function Do(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=Nr(i),r=Rr(i);return Math.abs(t/(n*r))>Number.EPSILON}function Nr(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Rr(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Uo(i,e,t){let n,r,o,s,a;const l=i+t,h=i-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=i*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(e)?(a=-2*e/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(e)===0?(o=1,s=0):(a=-.5*o/e,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:n,rt2:r,cs:o,sn:s}}class Lo extends jn{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new A(e,t),new A(n,n),new A(0,0),0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;return e.arc(t,n,r,o,s,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;let l=Math.abs(o-s);(!a&&o>s||a&&s>o)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=o;c*=a?1:-1;for(let u=0;u<h+1;u++){const d=Math.cos(f),p=Math.sin(f),m=t+d*r,y=n+p*r;e.push(m,y),f+=c}return e}}class Nn extends me{constructor(e=[]){super(),this.curves=e}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,t)}o++}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=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new 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}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Rn extends me{constructor(e=new A,t=new A,n=new A,r=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,a,l){return new Rn(new A(e,t),new A(n,r),new A(o,s),new A(a,l))}getPoint(e,t=new A){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Dr(e,n.x,r.x,o.x,s.x),Dr(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return vo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),a=(-t-o)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((f,u)=>{for(const d of f)for(let p=0;p<=u;p++){const m=p/u-.5,y=Math.min(1,Math.max(0,d+m)),k=this.getPoint(y);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{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class $o extends jn{constructor(e=0,t=0,n=1,r=1,o=0,s=0,a=Math.PI*2,l=!1){super(new A(e,t),new A(n,r),new A,o,s,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Qt extends me{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Qt(new A(e,t),new A(n,r))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class Fo extends Nn{}class qn extends me{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new qn(new A(e,t),new A(n,r),new A(o,s))}getPoint(e,t=new A){const{p1:n,cp:r,p2:o}=this;return t.set(Ur(e,n.x,r.x,o.x),Ur(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Mo(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+o.x),h=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,l),e.y=Math.min(e.y,n.y,o.y,a,h),t.x=Math.max(t.x,n.x,o.x,s,l),t.y=Math.max(t.y,n.y,o.y,a,h),{min:e,max:t}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class zo extends Fo{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,o=[new A(e,t),new A(e+n,t),new A(e+n,t+r),new A(e,t+r)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=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;o*=r,t[o+u]=f[0],t[o+u+1]=f[1],u+=r,t[o+u]=f[2],t[o+u+1]=f[3],u+=r,t[o+u]=f[6],t[o+u+1]=f[7],u+=r,t[o+u]=f[4],t[o+u+1]=f[5],u+=r;const d=o/r;return n[s++]=d,n[s++]=d+1,n[s++]=d+2,n[s++]=d+1,n[s++]=d+3,n[s++]=d+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class jo extends jn{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,a=r/2,l=e+s,h=t+a,c=Math.max(0,Math.min(o,Math.min(s,a))),f=c,u=s-c,d=a-f;return this._center=new A(l,h),this._radius=new A(c,f),this._diff=new A(u,d),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class No extends me{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,a=n[o===0?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],c=n[o>n.length-3?n.length-1:o+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 Nn{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:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return Or(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 A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Qt(n,t)),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Qt.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(Rn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,o,s,a)),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(qn.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,a){const l=new Lo(t,n,r,o,s,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,o,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,o,s,a),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,a,l,h=!0){const c=new $o(t,n,r,o,s,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,o,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,o,s,a,l,h),this}rect(t,n,r,o){const s=new zo(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const a=new jo(t,n,r,o,s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new No([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(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function Ro(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function qo(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),a=r.cross(o);if(a===0)return new A((i.x+t.x)/2,(i.y+t.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new A((i.x+t.x)/2,(i.y+t.y)/2):new A(i.x+l*r.x,i.y+l*r.y)}class Tt extends Nn{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,o,s,a){return this.currentCurve.bezierCurveTo(t,n,r,o,s,a),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,a){return this.currentCurve.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,a,l,h){return this.currentCurve.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}addCommands(t){return Or(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(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.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=[],o=[],s=[];n.forEach((l,h)=>{if(!l.getLength())return;const c=l.getControlPointRefs(),f=l.isClockwise();s[h]=c,o[h]=f;const u=c[0],d=c[c.length-1]??u;r.push({start:f?d:u,end:f?u:d,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{f!==h&&c.start.equals(l.end)&&a[h].push(c.index)})}),n.forEach((l,h)=>{if(!l.getLength())return;const c=o[h];s[h].forEach(u=>{const d=l.getTForPoint(u),p=l.getNormal(d).scale(c?t:-t);u.add(p)})}),a.forEach((l,h)=>{const c=s[h];l.forEach(f=>{const u=s[f],d=qo(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);d&&(c[c.length-1].copy(d),u[0].copy(d))})}),this}applyTransform(t){return this.curves.forEach(n=>n.applyTransform(t)),this}getMinMax(t=A.MAX,n=A.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const a=o/2,l=s.isClockwise(),h=[];for(let c=0;c<=1;c+=1/s.arcLengthDivision){const f=s.getPoint(c),u=s.getNormal(c),d=u.clone().scale(l?a:-a),p=u.clone().scale(l?-a:a);h.push(f.clone().add(d),f.clone().add(p),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}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:o="none"}=n;return t.beginPath(),t.save(),Ln(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Ln(t,n),this.getControlPointRefs().forEach(s=>{ao(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="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 o in t)t[o]!==void 0&&(n[Ro(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class Gn{constructor(e=[]){this.paths=e}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new 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(),o=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">${o}</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:o,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,-o),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const qr="data:image/svg+xml;",Gr=`${qr}base64,`,Wr=`${qr}charset=utf8,`;function Vr(i){if(typeof i=="string"){let e;i.startsWith(Gr)?(i=i.substring(Gr.length,i.length),e=atob(i)):i.startsWith(Wr)?(i=i.substring(Wr.length,i.length),e=decodeURIComponent(i)):e=i;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 i}const Go="px",Wo=90,Xr=["mm","cm","in","pt","pc","px"],Hr={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(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Xr.length;n<r;n++){const o=Xr[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=Hr[e][Go],t<0&&(t=Hr[e].in*Wo),t*Number.parseFloat(i)}const Vo=new Pt,rn=new Pt,Zr=new Pt,Yr=new Pt;function Xo(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Ho(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Ho(i){const e=new Pt,t=Vo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(Y(i.getAttribute("x")),Y(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=qt(o.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),Zr.makeRotation(c),Yr.multiplyMatrices(Zr,rn),rn.makeTranslation(f,u),t.multiplyMatrices(rn,Yr)}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 Zo(i){return new Tt().addPath(new Fe().arc(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("r")||0),0,Math.PI*2))}function Yo(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function Ko(i){return new Tt().addPath(new Fe().ellipse(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("rx")||0),Y(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Qo(i){return new Tt().moveTo(Y(i.getAttribute("x1")||0),Y(i.getAttribute("y1")||0)).lineTo(Y(i.getAttribute("x2")||0),Y(i.getAttribute("y2")||0))}function Jo(i){const e=new Tt,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(ta,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentPath.autoClose=!0,e}const na=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ra(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(na,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentPath.autoClose=!1,e}function sa(i){const e=Y(i.getAttribute("x")||0),t=Y(i.getAttribute("y")||0),n=Y(i.getAttribute("rx")||i.getAttribute("ry")||0),r=Y(i.getAttribute("ry")||i.getAttribute("rx")||0),o=Y(i.getAttribute("width")),s=Y(i.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+o-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+o-n*a,t,e+o,t+r*a,e+o,t+r),l.lineTo(e+o,t+s-r),(n!==0||r!==0)&&l.bezierCurveTo(e+o,t+s-r*a,e+o-n*a,t+s,e+o-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 Gt(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const h=i.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]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const f=i.style.item(c),u=i.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=o){i.hasAttribute(h)&&(e[c]=f(i.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function o(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 Wn(i,e,t=[],n={}){var f;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=Gt(i,s,n);break;case"style":Yo(i,n);break;case"g":s=Gt(i,s,n);break;case"path":s=Gt(i,s,n),i.hasAttribute("d")&&(o=Jo(i));break;case"rect":s=Gt(i,s,n),o=sa(i);break;case"polygon":s=Gt(i,s,n),o=ea(i);break;case"polyline":s=Gt(i,s,n),o=ra(i);break;case"circle":s=Gt(i,s,n),o=Zo(i);break;case"ellipse":s=Gt(i,s,n),o=Ko(i);break;case"line":s=Gt(i,s,n),o=Qo(i);break;case"defs":r=!0;break;case"use":{s=Gt(i,s,n);const d=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),p=(f=i.viewportElement)==null?void 0:f.getElementById(d);p?Wn(p,s,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(i);break}if(s.display==="none")return t;Object.assign(e,s);const a=new Pt,l=[],h=Xo(i,a,l);o&&(o.applyTransform(a),t.push(o),o.style=e);const c=i.childNodes;for(let u=0,d=c.length;u<d;u++){const p=c[u];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||Wn(p,e,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function Kr(i){return new Gn(Wn(Vr(i),{}))}const ia=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Qr={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Jr{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??qi,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:o}=e,s=o.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,d=s/u,p=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/d,y=a/d;return this.advanceWidth=p,this.advanceHeight=m,this.inlineBox.width=f?m:p,this.inlineBox.height=f?p:m,this.underlinePosition=(a-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(a-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=aa[n.fsSelection]??la[o.macStyle],this}update(e){const t=this._getFontSfnt(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:d}=this,{left:p,top:m}=a,y=o.fontStyle==="italic"&&f!=="italic";let k=p,P=m+s,v;const C=new Tt;if(n&&(k+=(d-u)/2,Math.abs(u-d)>.1&&(P-=(l-c)/(l+Math.abs(h))*d),v=void 0),n&&!ia.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){C.addCommands(t.getPathCommands(r,k,m+s-(d-u)/2,o.fontSize));const b={y:m-(d-u)/2+d/2,x:k+u/2};y&&this._italic(C,n?{x:b.x,y:m-(d-u)/2+s}:void 0),C.rotate(90,b)}else v!==void 0?(C.addCommands(t.glyphs.get(v).getPathCommands(k,P,o.fontSize)),y&&this._italic(C,n?{x:k+u/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(C.addCommands(t.getPathCommands(r,k,P,o.fontSize)),y&&this._italic(C,n?{x:k+d/2,y:P}:void 0));const x=o.fontWeight??400;return x in Qr&&(x===700||x==="bold")&&f!=="bold"&&C.bold(Qr[x]*o.fontSize*.05),C.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new 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 o=this.path.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:o.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(i,e){return typeof i=="number"?i:i.endsWith("%")?(i=i.substring(0,i.length-1),Math.ceil(Number(i)/100*e.total)):i.endsWith("rem")?(i=i.substring(0,i.length-3),Number(i)*e.fontSize):i.endsWith("em")?(i=i.substring(0,i.length-2),Number(i)*e.fontSize):Number(i)}function Vn(i){const e=Xt(i)?{}:i;return Object.keys(e).reduce((t,n)=>{let r=e[n];const o=Xn(n),s=Xn(r);return o&&(n=o),s&&(r=s),t[n]=r,t},{})}function Xt(i){return!i||i==="none"}function ts(i,e){const t=Object.keys(i),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(o=>oe(i[o],e[o]))}function oe(i,e){const t=typeof i;return t===typeof e?t==="object"?ts(i,e):i===e:!1}function Xn(i){const e=i.startsWith("#")?i.slice(1):i;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),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${o}, ${s})`}function on(i){if(!i)return i;const e={};for(const t in i)i[t]!==""&&i[t]!==void 0&&(e[t]=i[t]);return e}function an(i){return i.startsWith("http://")||i.startsWith("https://")||i.startsWith("blob://")}class es{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 Jr(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 es(e,t,this);return this.fragments.push(n),n}}function ha(i){return i}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"),o={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":o.justifyContent="start";break;case"center":o.justifyContent="center";break;case"end":case"right":o.justifyContent="end";break}switch(t.verticalAlign){case"top":o.alignItems="top";break;case"middle":o.alignItems="center";break;case"bottom":o.alignItems="end";break}const a=!!(o.justifyContent||o.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(o),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(o=>{var f;const s=r+=n.substring(r).indexOf(o),a=s+o.length;r+=o.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((o,s)=>{const a=o.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.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(d=>{r.push({...d,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 o=[];let s=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:d}=f,p=o[s];f.inlineBox.left=p.left,f.inlineBox.top=p.top,f.inlineBox.width=p.width,f.inlineBox.height=p.height,d?(f.lineBox.left=p.left+(p.width-u)/2,f.lineBox.top=p.top,f.lineBox.width=u,f.lineBox.height=p.height):(f.lineBox.left=p.left,f.lineBox.top=p.top+(p.height-u)/2,f.lineBox.width=p.width,f.lineBox.height=u),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 o=this.measureParagraphDom(e,n);return r==null||r(),o}};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 ca(){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 fa(){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 ua(){return{...ca(),...fa()}}class pa{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(r):this.eventListeners.set(e,[o,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var o,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"||!((o=c.options)!=null&&o.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,o;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"&&((o=n.options)!=null&&o.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(i){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:o,highlightSize:s,highlightThickness:a}=i;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)??o??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function ns(){const i=[],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 o(s){let a=n.get(s);if(!a){const l=Vr(an(s)?t.get(s)??s:s),h=Kr(l);a={dom:l,pathSet:h},n.set(s,a)}return a}return{name:"highlight",paths:i,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,i.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=hn(f),{image:d,colormap:p,line:m,size:y,thickness:k}=u;if(Xt(d))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:P,isVertical:v}=c,{fontSize:C}=f;(!h||oe(h.image,d)&&oe(h.colormap,p)&&oe(h.line,m)&&oe(h.size,y)&&oe(h.thickness,k))&&(l!=null&&l.length)&&(v?l[0].inlineBox.left===P.left:l[0].inlineBox.top===P.top)&&l[0].fontSize===C?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],d=H.from(...f.filter(O=>O.glyphBox).map(O=>O.glyphBox)),{computedStyle:p}=u,{fontSize:m,writingMode:y}=p,{image:k,referImage:P,colormap:v,line:C,size:x,thickness:b}=hn(p),S=y.includes("vertical"),w=sn(b,{fontSize:m,total:d.width})/d.width,I=Vn(v),{pathSet:F,dom:E}=o(k),_=F.getBoundingBox(!0),j=m/_.width*2,T=new H().copy(d);S&&(T.width=d.height,T.height=d.width,T.left=d.left+d.width);const U=Math.floor(T.width);let V=U;if(x!=="cover"&&(V=sn(x,{fontSize:m,total:d.width})||U,T.width=V),!Xt(P)&&Xt(C)){const O=o(P).pathSet.getBoundingBox(!0);_.copy(O)}else{let O;if(Xt(C))if(_.width/_.height>4){O="underline";const q=E.getAttribute("viewBox");if(q){const[L,D,Z,W]=q.split(" ").map(N=>Number(N)),G=D+W/2;_.y<G&&_.y+_.height>G?O="line-through":_.y+_.height<G?O="overline":O="underline"}}else O="outline";else O=C;switch(O){case"outline":{const q=T.width*.2,L=T.height*.2;T.width+=q,T.height+=L,S?(T.x-=L/2,T.y-=q/2,T.x+=T.height):(T.x-=q/2,T.y-=L/2);break}case"overline":T.height=_.height*j,S?T.x=u.inlineBox.left+u.inlineBox.width:T.y=u.inlineBox.top;break;case"line-through":T.height=_.height*j,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=_.height*j,S?T.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:T.y=u.inlineBox.top+u.underlinePosition;break}}const B=new Pt().translate(-_.x,-_.y).scale(T.width/_.width,T.height/_.height);S&&B.rotate(-Math.PI/2),B.translate(T.x,T.y);for(let O=0;O<Math.ceil(U/V);O++){const q=B.clone();S?q.translate(0,O*T.width):q.translate(O*T.width,0),F.paths.forEach(L=>{const D=L.clone().applyTransform(q);D.style.strokeWidth&&(D.style.strokeWidth*=j*w),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=j),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=j),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(Z=>Z*j)),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]),i.push(D),U!==V&&(S?e[i.length-1]=new H(d.left-d.width*2,d.top,d.width*4,d.height):e[i.length-1]=new H(d.left,d.top-d.height*2,d.width,d.height*4))})}}},renderOrder:-1,render:(s,a)=>{i.forEach((l,h)=>{if(le({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=new Gn([l]).getBoundingBox();c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function da(i,e){return`<svg width="${i*2}" height="${i*2}" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<circle cx="${i}" cy="${i}" r="${i}" fill="${e}" />
|
|
7
|
+
</svg>`}function rs(){const i=[];return{name:"listStyle",paths:i,update:e=>{i.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,o=r*.45;t.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,d=Vn(c);let p=f,m;if(!Xt(h))m=h;else if(!Xt(u)){const v=r*.38/2;switch(p=p==="cover"?v*2:p,u){case"disc":m=da(v,String(l));break}}if(!m)return;const y=Kr(m),k=y.getBoundingBox();let P;s.fragments.forEach(v=>{v.characters.forEach(C=>{const{inlineBox:x}=C;if(n?(P==null?void 0:P.inlineBox.left)!==x.left:(P==null?void 0:P.inlineBox.top)!==x.top){P=C;const b=p==="cover"?1:sn(p,{total:r,fontSize:r})/r,S=new Pt;if(n){const w=r/k.height*b;S.translate(-k.left,-k.top).rotate(Math.PI/2).scale(w,w).translate(x.left+(x.width-k.height*w)/2,x.top-o)}else{const w=r/k.height*b;S.translate(-k.left,-k.top).scale(w,w).translate(x.left-k.width*w-o,x.top+(x.height-k.height*w)/2)}i.push(...y.paths.map(w=>{const I=w.clone();return I.applyTransform(S),I.style.fill&&I.style.fill in d&&(I.style.fill=d[I.style.fill]),I.style.stroke&&I.style.stroke in d&&(I.style.stroke=d[I.style.stroke]),I}))}})})})}}}const Jt=new A,we=new Pt,te=new Pt;function ss(){return{name:"render",getBoundingBox:i=>{const{characters:e,fontSize:t,effects:n}=i,r=[];return e.forEach(o=>{n==null||n.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=cn(i,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:(i,e)=>{const{paragraphs:t,glyphBox:n,effects:r,style:o}=e;function s(a,l){i.fillStyle=a,i.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&s(o.backgroundColor,new H(0,0,i.canvas.width,i.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,i),i.save();const[l,h,c,f,u,d]=cn(e,a).transpose().elements;i.transform(l,f,h,u,c,d),e.forEachCharacter(p=>{var m;(m=p.parent.style)!=null&&m.backgroundColor&&s(p.parent.style.backgroundColor,p.inlineBox),p.drawTo(i,a)}),i.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(i)})})}),e.debug&&t.forEach(a=>{i.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function cn(i,e){const{fontSize:t,glyphBox:n}=i,r=(e.translateX??0)*t,o=(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,d=h+f/2,p=c+u/2;return we.identity(),te.makeTranslation(r,o),we.multiply(te),te.makeTranslation(d,p),we.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),we.multiply(te),te.makeTranslation(-d,-p),we.multiply(te),we.clone()}function is(){const i=[];return{name:"textDecoration",paths:i,update:e=>{i.length=0;const t=[];let n,r;e.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=o,{color:d,textDecoration:p,writingMode:m}=s;if(Xt(p))r=void 0;else{let y=!1;if((r==null?void 0:r.textDecoration)===p&&(r==null?void 0:r.writingMode)===m&&(r==null?void 0:r.color)===d&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(p){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(y=!0);break;case"line-through":n[0].strikeoutPosition===f&&n[0].strikeoutSize===u&&(y=!0);break}y?n.push(o):(n=[],n.push(o),t.push(n)),r=s}}),t.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=o[0],{color:u,textDecoration:d}=s,{left:p,top:m,width:y,height:k}=H.from(...o.map(b=>b.inlineBox));let P=a?p+y:m;const v=a?-1:1;let C=0;switch(d){case"overline":C=h*2;break;case"underline":P+=v*l,C=h*2;break;case"line-through":P+=v*c,C=f*2;break}P-=C;let x;a?x=new Tt([{type:"M",x:P,y:m},{type:"L",x:P,y:m+k},{type:"L",x:P+C,y:m+k},{type:"L",x:P+C,y:m},{type:"Z"}],{fill:u}):x=new Tt([{type:"M",x:p,y:P},{type:"L",x:p+y,y:P},{type:"L",x:p+y,y:P+C},{type:"L",x:p,y:P+C},{type:"Z"}],{fill:u}),i.push(x)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(o=>{e.save();const[s,a,l,h,c,f]=cn(t,o).transpose().elements;e.transform(s,h,a,c,l,f),i.forEach(u=>{le({ctx:e,path:u,fontSize:r.fontSize,...o})}),e.restore()}):i.forEach(o=>{le({ctx:e,path:o,fontSize:r.fontSize})})}}}const Hn=ua();class Zn extends pa{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(rs()).use(is()).use(ns()).use(ss()),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((o,s)=>{o.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 o=new xe({},n);o.addFragment(t),r.push(o)}else{t=Array.isArray(t)?t:[t];for(const o of t)if(typeof o=="string"){const s=new xe({},n);s.addFragment(o),r.push(s)}else if(Array.isArray(o)){const s=new xe({},n);o.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 o){const{fragments:s,...a}=o,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 o){const{content:s,...a}=o;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(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((o,s)=>(o.updateOrder??0)-(s.updateOrder??0)).forEach(o=>{var s;(s=o.update)==null||s.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in n)r[o]=this[o],this[o]=n[o];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=A.MAX,n=A.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:o}=r,s=new A(o.left,o.top),a=new A(o.left+o.width,o.top+o.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 Gn(t.paths??[]).getBoundingBox()).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:n,pathBox:r}=this,o=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(o,s,a-o,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,o=n.getContext("2d");o&&(this.needsUpdate&&this.update(),Yn(o,r,this.boundingBox),Kn(o,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,o,this);else if(s.paths){const l=this.computedStyle;s.paths.forEach(h=>{le({ctx:o,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function ya(i,e){const t=new Zn(i);return e?t.load().then(()=>t.measure()):t.measure()}function ga(i,e){const t=new Zn(i);return e?t.load().then(()=>t.render(i)):t.render(i)}R.Character=Jr,R.Fragment=es,R.Measurer=ln,R.Paragraph=xe,R.Text=Zn,R.definePlugin=ha,R.drawPath=le,R.filterEmpty=on,R.getHighlightStyle=hn,R.getTransform2D=cn,R.hexToRgb=Xn,R.highlight=ns,R.isEqualObject=ts,R.isEqualValue=oe,R.isNone=Xt,R.listStyle=rs,R.measureText=ya,R.needsFetch=an,R.parseColor=ct,R.parseColormap=Vn,R.parseValueNumber=sn,R.render=ss,R.renderText=ga,R.setupView=Yn,R.textDecoration=is,R.textDefaultStyle=Hn,R.uploadColor=jt,R.uploadColors=Kn,Object.defineProperty(R,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, svgToDOM, svgToPath2DSet, 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;
|
|
@@ -907,11 +907,11 @@ function highlight() {
|
|
|
907
907
|
function getPaths(svg) {
|
|
908
908
|
let result = parsed.get(svg);
|
|
909
909
|
if (!result) {
|
|
910
|
-
const dom =
|
|
910
|
+
const dom = svgToDOM(
|
|
911
911
|
needsFetch(svg) ? loaded.get(svg) ?? svg : svg
|
|
912
912
|
);
|
|
913
|
-
const
|
|
914
|
-
result = { dom,
|
|
913
|
+
const pathSet = svgToPath2DSet(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,8 +1094,8 @@ function highlight() {
|
|
|
1094
1094
|
} else {
|
|
1095
1095
|
_transform.translate(i2 * cBox.width, 0);
|
|
1096
1096
|
}
|
|
1097
|
-
|
|
1098
|
-
const path = originalPath.clone().
|
|
1097
|
+
svgPathSet.paths.forEach((originalPath) => {
|
|
1098
|
+
const path = originalPath.clone().applyTransform(_transform);
|
|
1099
1099
|
if (path.style.strokeWidth) {
|
|
1100
1100
|
path.style.strokeWidth *= styleScale * _thickness;
|
|
1101
1101
|
}
|
|
@@ -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 = svgToPath2DSet(image);
|
|
1202
|
+
const imageBox = imagePathSet.getBoundingBox();
|
|
1203
1203
|
let prevChar;
|
|
1204
1204
|
paragraph.fragments.forEach((f) => {
|
|
1205
1205
|
f.characters.forEach((c) => {
|
|
@@ -1221,9 +1221,9 @@ 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
|
-
path.
|
|
1226
|
+
path.applyTransform(m);
|
|
1227
1227
|
if (path.style.fill && path.style.fill in colormap) {
|
|
1228
1228
|
path.style.fill = colormap[path.style.fill];
|
|
1229
1229
|
}
|
|
@@ -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.2.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",
|
|
@@ -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.
|
|
62
|
+
"modern-path2d": "^1.2.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@antfu/eslint-config": "^3.12.1",
|