modern-text 0.2.36 → 0.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -853,17 +853,35 @@ function parseStrokeWidthScale(strokeWidth, fontSize, total) {
853
853
  return strokeWidth / total;
854
854
  }
855
855
  }
856
- function getTransformMatrix(a, b, c) {
857
- const scaleX = c.width / b.width;
858
- const scaleY = c.height / b.height;
859
- const aCenterInB = new modernPath2d.Vector2(a.x + a.width / 2, a.y + a.height / 2);
860
- const cCenter = new modernPath2d.Vector2(c.x + c.width / 2, c.y + c.height / 2);
861
- const translatedCenterInC = cCenter.add(
862
- aCenterInB.clone().sub(new modernPath2d.Vector2(b.x + b.width / 2, b.y + b.height / 2)).scale(scaleX, scaleY)
863
- );
864
- const newX = translatedCenterInC.x - a.width * scaleX / 2;
865
- const newY = translatedCenterInC.y - a.height * scaleY / 2;
866
- return new modernPath2d.Matrix3().translate(-a.left, -a.top).scale(scaleX, scaleY).translate(newX, newY);
856
+ function getTransformMatrix(a, b, c, isVertical) {
857
+ let scale;
858
+ if (isVertical) {
859
+ scale = {
860
+ x: c.width / b.height,
861
+ y: c.height / b.width
862
+ };
863
+ } else {
864
+ scale = {
865
+ x: c.width / b.width,
866
+ y: c.height / b.height
867
+ };
868
+ }
869
+ const offset = c.getCenterPoint().add(
870
+ a.getCenterPoint().sub(b.getCenterPoint()).scale(scale.x, scale.y)
871
+ ).sub({
872
+ x: a.width * scale.x / 2,
873
+ y: a.height * scale.y / 2
874
+ });
875
+ const m = new modernPath2d.Matrix3();
876
+ m.translate(-a.left, -a.top);
877
+ if (isVertical) {
878
+ m.translate(-a.width / 2, -a.height / 2);
879
+ m.rotate(Math.PI / 2);
880
+ m.translate(a.width / 2, a.height / 2);
881
+ }
882
+ m.scale(scale.x, scale.y);
883
+ m.translate(offset.x, offset.y);
884
+ return m;
867
885
  }
868
886
  function highlight() {
869
887
  const paths = [];
@@ -906,7 +924,8 @@ function highlight() {
906
924
  };
907
925
  }).forEach((group2) => {
908
926
  const { style, box: groupBox } = group2;
909
- const { fontSize } = style;
927
+ const { fontSize, writingMode } = style;
928
+ const isVertical = writingMode.includes("vertical");
910
929
  const strokeWidthScale = parseStrokeWidthScale(style.highlightStrokeWidth, fontSize, groupBox.width);
911
930
  const charsPerRepeat = parseCharsPerRepeat(style.highlightSize, fontSize, groupBox.width);
912
931
  const highlightOverflow = isNone(style.highlightOverflow) ? charsPerRepeat ? "hidden" : "visible" : style.highlightOverflow;
@@ -914,8 +933,13 @@ function highlight() {
914
933
  const svgPaths = getPaths(style.highlightImage);
915
934
  const box = modernPath2d.getPathsBoundingBox(svgPaths, true);
916
935
  const refBox = modernPath2d.getPathsBoundingBox(refPaths, false);
917
- const transform = getTransformMatrix(box, refBox, groupBox);
918
936
  const unitWidth = charsPerRepeat ? fontSize * charsPerRepeat : groupBox.width;
937
+ const transform = getTransformMatrix(
938
+ box,
939
+ refBox,
940
+ new modernPath2d.BoundingBox(groupBox.left, groupBox.top, unitWidth, groupBox.height),
941
+ isVertical
942
+ );
919
943
  const styleScale = fontSize / box.width * 2;
920
944
  const total = Math.ceil(groupBox.width / unitWidth);
921
945
  for (let i = 0; i < total; i++) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- (function(f,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(f=typeof globalThis<"u"?globalThis:f||self,it(f.modernText={}))})(this,function(f){"use strict";var da=Object.defineProperty;var pa=(f,it,Tt)=>it in f?da(f,it,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[it]=Tt;var z=(f,it,Tt)=>pa(f,typeof it!="symbol"?it+"":it,Tt);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=os(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Tt(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function os(s,t,e,r,n){var y;const i=((y=s.match(/linear-gradient\((.+)\)$/))==null?void 0:y[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),d=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+d,x1:t+r/2+u,y1:e+n/2-d,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[3].replace("%",""))/100,color:w}})}}function Ce(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style,o={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}function as(s,t){const{computedStyle:e,paragraphs:r}=t;function n(i,o,a,h,l){s.fillStyle=i,s.fillRect(o,a,h,l)}e!=null&&e.backgroundColor&&n(e.backgroundColor,0,0,s.canvas.width,s.canvas.height),r.forEach(i=>{var o;(o=i.style)!=null&&o.backgroundColor&&n(i.computedStyle.backgroundColor,...i.boundingBox.toArray()),i.fragments.forEach(a=>{var h;(h=a.style)!=null&&h.backgroundColor&&n(a.computedStyle.backgroundColor,...a.boundingBox.toArray())})})}function Dr(s,t,e){const{left:r,top:n,width:i,height:o}=e,a=s.canvas;a.dataset.viewbox=`${r} ${n} ${i} ${o}`,a.dataset.pixelRatio=String(t),a.width=Math.max(1,Math.ceil(i*t)),a.height=Math.max(1,Math.ceil(o*t)),a.style.marginTop=`${n}px`,a.style.marginLeft=`${r}px`,a.style.width=`${i}px`,a.style.height=`${o}px`,s.clearRect(0,0,s.canvas.width,s.canvas.height),s.scale(t,t),s.translate(-r,-n)}function Nr(s,t){const{paragraphs:e,computedStyle:r,renderBoundingBox:n}=t;Tt(r,n,s),e.forEach(i=>{Tt(i.computedStyle,i.boundingBox,s),i.fragments.forEach(o=>{Tt(o.computedStyle,o.boundingBox,s)})})}var ot=Uint8Array,mt=Uint16Array,Ve=Int32Array,Se=new ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),We=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(s,t){for(var e=new mt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ve(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},Er=zr(Se,2),Ur=Er.b,qe=Er.r;Ur[28]=258,qe[258]=28;for(var Lr=zr(Pe,0),ls=Lr.b,$r=Lr.r,He=new mt(32768),j=0;j<32768;++j){var $t=(j&43690)>>1|(j&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[j]=(($t&65280)>>8|($t&255)<<8)>>1}for(var Ot=function(s,t,e){for(var r=s.length,n=0,i=new mt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new mt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new mt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],c=t-s[n],u=o[s[n]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)a[He[u]>>h]=l}else for(a=new mt(r),n=0;n<r;++n)s[n]&&(a[n]=He[o[s[n]-1]++]>>15-s[n]);return a},kt=new ot(288),j=0;j<144;++j)kt[j]=8;for(var j=144;j<256;++j)kt[j]=9;for(var j=256;j<280;++j)kt[j]=7;for(var j=280;j<288;++j)kt[j]=8;for(var oe=new ot(32),j=0;j<32;++j)oe[j]=5;var hs=Ot(kt,9,0),cs=Ot(kt,9,1),us=Ot(oe,5,0),fs=Ot(oe,5,1),Qe=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},Ct=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},Xe=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ye=function(s){return(s+7)/8|0},kr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},ds=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],St=function(s,t,e){var r=new Error(t||ds[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},ps=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new ot(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},c=t.f||0,u=t.p||0,d=t.b||0,y=t.l,g=t.d,w=t.m,p=t.n,C=n*8;do{if(!y){c=Ct(s,u,1);var P=Ct(s,u+1,3);if(u+=3,P)if(P==1)y=cs,g=fs,w=9,p=5;else if(P==2){var M=Ct(s,u,31)+257,I=Ct(s,u+10,15)+4,S=M+Ct(s,u+5,31)+1;u+=14;for(var _=new ot(S),U=new ot(19),N=0;N<I;++N)U[We[N]]=Ct(s,u+N*3,7);u+=I*3;for(var R=Qe(U),Mt=(1<<R)-1,D=Ot(U,R,1),N=0;N<S;){var E=D[Ct(s,u,Mt)];u+=E&15;var x=E>>4;if(x<16)_[N++]=x;else{var V=0,$=0;for(x==16?($=3+Ct(s,u,3),u+=2,V=_[N-1]):x==17?($=3+Ct(s,u,7),u+=3):x==18&&($=11+Ct(s,u,127),u+=7);$--;)_[N++]=V}}var J=_.subarray(0,M),W=_.subarray(M);w=Qe(J),p=Qe(W),y=Ot(J,w,1),g=Ot(W,p,1)}else St(1);else{var x=Ye(u)+4,T=s[x-4]|s[x-3]<<8,v=x+T;if(v>n){h&&St(0);break}a&&l(d+T),e.set(s.subarray(x,v),d),t.b=d+=T,t.p=u=v*8,t.f=c;continue}if(u>C){h&&St(0);break}}a&&l(d+131072);for(var xt=(1<<w)-1,B=(1<<p)-1,K=u;;K=u){var V=y[Xe(s,u)&xt],k=V>>4;if(u+=V&15,u>C){h&&St(0);break}if(V||St(2),k<256)e[d++]=k;else if(k==256){K=u,y=null;break}else{var F=k-254;if(k>264){var N=k-257,A=Se[N];F=Ct(s,u,(1<<A)-1)+Ur[N],u+=A}var X=g[Xe(s,u)&B],q=X>>4;X||St(3),u+=X&15;var W=ls[q];if(q>3){var A=Pe[q];W+=Xe(s,u)&(1<<A)-1,u+=A}if(u>C){h&&St(0);break}a&&l(d+131072);var tt=d+F;if(d<W){var Xt=i-W,Yt=Math.min(W,tt);for(Xt+d<0&&St(3);d<Yt;++d)e[d]=r[Xt+d]}for(;d<tt;++d)e[d]=e[d-W]}}t.l=y,t.p=K,t.b=d,t.f=c,y&&(c=1,t.m=w,t.d=g,t.n=p)}while(!c);return d!=e.length&&o?kr(e,0,d):e.subarray(0,d)},Et=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ae=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},Ze=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Gr,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(v,M){return v.f-M.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,c=1,u=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};c!=n-1;)a=e[e[l].f<e[u].f?l++:u++],h=e[l!=c&&e[l].f<e[u].f?l++:u++],e[c++]={s:-1,f:a.f+h.f,l:a,r:h};for(var d=i[0].s,r=1;r<n;++r)i[r].s>d&&(d=i[r].s);var y=new mt(d+1),g=Ke(e[c-1],y,0);if(g>t){var r=0,w=0,p=g-t,C=1<<p;for(i.sort(function(M,I){return y[I.s]-y[M.s]||M.f-I.f});r<n;++r){var P=i[r].s;if(y[P]>t)w+=C-(1<<g-y[P]),y[P]=t;else break}for(w>>=p;w>0;){var x=i[r].s;y[x]<t?w-=1<<t-y[x]++-1:++r}for(;r>=0&&w;--r){var T=i[r].s;y[T]==t&&(--y[T],++w)}g=t}return{t:new ot(y),l:g}},Ke=function(s,t,e){return s.s==-1?Math.max(Ke(s.l,t,e+1),Ke(s.r,t,e+1)):t[s.s]=e},jr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new mt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},le=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Br=function(s,t,e){var r=e.length,n=Ye(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Fr=function(s,t,e,r,n,i,o,a,h,l,c){Et(t,c++,e),++n[256];for(var u=Ze(n,15),d=u.t,y=u.l,g=Ze(i,15),w=g.t,p=g.l,C=jr(d),P=C.c,x=C.n,T=jr(w),v=T.c,M=T.n,I=new mt(19),S=0;S<P.length;++S)++I[P[S]&31];for(var S=0;S<v.length;++S)++I[v[S]&31];for(var _=Ze(I,7),U=_.t,N=_.l,R=19;R>4&&!U[We[R-1]];--R);var Mt=l+5<<3,D=le(n,kt)+le(i,oe)+o,E=le(n,d)+le(i,w)+o+14+3*R+le(I,U)+2*I[16]+3*I[17]+7*I[18];if(h>=0&&Mt<=D&&Mt<=E)return Br(t,c,s.subarray(h,h+l));var V,$,J,W;if(Et(t,c,1+(E<D)),c+=2,E<D){V=Ot(d,y,0),$=d,J=Ot(w,p,0),W=w;var xt=Ot(U,N,0);Et(t,c,x-257),Et(t,c+5,M-1),Et(t,c+10,R-4),c+=14;for(var S=0;S<R;++S)Et(t,c+3*S,U[We[S]]);c+=3*R;for(var B=[P,v],K=0;K<2;++K)for(var k=B[K],S=0;S<k.length;++S){var F=k[S]&31;Et(t,c,xt[F]),c+=U[F],F>15&&(Et(t,c,k[S]>>5&127),c+=k[S]>>12)}}else V=hs,$=kt,J=us,W=oe;for(var S=0;S<a;++S){var A=r[S];if(A>255){var F=A>>18&31;ae(t,c,V[F+257]),c+=$[F+257],F>7&&(Et(t,c,A>>23&31),c+=Se[F]);var X=A&31;ae(t,c,J[X]),c+=W[X],X>3&&(ae(t,c,A>>5&8191),c+=Pe[X])}else ae(t,c,V[A]),c+=$[A]}return ae(t,c,V[256]),c+$[256]},gs=new Ve([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gr=new ot(0),ys=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,c=(i.r||0)&7;if(t){c&&(h[0]=i.r>>3);for(var u=gs[t-1],d=u>>13,y=u&8191,g=(1<<e)-1,w=i.p||new mt(32768),p=i.h||new mt(g+1),C=Math.ceil(e/3),P=2*C,x=function(ie){return(s[ie]^s[ie+1]<<C^s[ie+2]<<P)&g},T=new Ve(25e3),v=new mt(288),M=new mt(32),I=0,S=0,_=i.i||0,U=0,N=i.w||0,R=0;_+2<o;++_){var Mt=x(_),D=_&32767,E=p[Mt];if(w[D]=E,p[Mt]=D,N<=_){var V=o-_;if((I>7e3||U>24576)&&(V>423||!l)){c=Fr(s,h,0,T,v,M,S,U,R,_-R,c),U=I=S=0,R=_;for(var $=0;$<286;++$)v[$]=0;for(var $=0;$<30;++$)M[$]=0}var J=2,W=0,xt=y,B=D-E&32767;if(V>2&&Mt==x(_-B))for(var K=Math.min(d,V)-1,k=Math.min(32767,_),F=Math.min(258,V);B<=k&&--xt&&D!=E;){if(s[_+J]==s[_+J-B]){for(var A=0;A<F&&s[_+A]==s[_+A-B];++A);if(A>J){if(J=A,W=B,A>K)break;for(var X=Math.min(B,A-2),q=0,$=0;$<X;++$){var tt=_-B+$&32767,Xt=w[tt],Yt=tt-Xt&32767;Yt>q&&(q=Yt,E=tt)}}}D=E,E=w[D],B+=D-E&32767}if(W){T[U++]=268435456|qe[J]<<18|$r[W];var Dt=qe[J]&31,Nt=$r[W]&31;S+=Se[Dt]+Pe[Nt],++v[257+Dt],++M[Nt],N=_+J,++I}else T[U++]=s[_],++v[s[_]]}}for(_=Math.max(_,N);_<o;++_)T[U++]=s[_],++v[s[_]];c=Fr(s,h,l,T,v,M,S,U,R,_-R,c),l||(i.r=c&7|h[c/8|0]<<3,c-=7,i.h=p,i.p=w,i.i=_,i.w=N)}else{for(var _=i.w||0;_<o+l;_+=65535){var Lt=_+65535;Lt>=o&&(h[c/8|0]=l,Lt=o),c=Br(h,c+1,s.subarray(_,Lt))}i.i=o}return kr(a,0,r+Ye(c)+n)},Rr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},ms=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return ys(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},Vr=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},ws=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Rr();n.p(t.dictionary),Vr(s,2,n.d())}},vs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&St(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function bs(s,t){t||(t={});var e=Rr();e.p(s);var r=ms(s,t,t.dictionary?6:2,4);return ws(r,t),Vr(r,r.length-4,e.d()),r}function Ms(s,t){return ps(s.subarray(vs(s,t),-4),{i:2},t,t)}var xs=typeof TextDecoder<"u"&&new TextDecoder,Cs=0;try{xs.decode(Gr,{stream:!0}),Cs=1}catch{}const Ss="modern-font";function he(s,t){if(!s)throw new Error(`[${Ss}] ${t}`)}function Ps(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function Gt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Wr=Object.defineProperty,_s=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Wr(t,e,n),n},Ts=(s,t,e)=>(_s(s,t+"",e),e);const _e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(Ps(t),e,r),this.littleEndian=n,Ts(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=_e[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=_e[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var Os=Object.defineProperty,Is=(s,t,e)=>t in s?Os(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,As=(s,t,e)=>(Is(s,t+"",e),e);const qr=new WeakMap;function m(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=qr.get(n);o||(o={columns:[],byteLength:0},qr.set(n,o));const a={...t,name:i,byteLength:e*_e[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class bt{constructor(t,e,r,n){As(this,"view"),this.view=new rt(t,e,r,n)}}function Ds(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(s){s=Ds(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Ns(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function zs(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class Oe extends bt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Hr=Object.defineProperty,Es=(s,t,e)=>t in s?Hr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Hr(t,e,n),n},Qr=(s,t,e)=>(Es(s,typeof t!="symbol"?t+"":t,e),e);const ht=class es extends Oe{constructor(){super(...arguments),Qr(this,"format","EmbeddedOpenType"),Qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Te(n.fontFamily||""),o=i.length,a=Te(n.fontStyle||""),h=a.length,l=Te(n.version||""),c=l.length,u=Te(n.fullName||""),d=u.length,y=86+o+4+h+4+c+4+d+2+t.view.byteLength,g=new es(new ArrayBuffer(y),0,y,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let Us=ht;var Ls=Object.defineProperty,Ie=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ls(t,e,n),n};class Zt extends bt{constructor(t,e){super(t,e,16)}}Ie([m({type:"char",size:4})],Zt.prototype,"tag"),Ie([m("uint32")],Zt.prototype,"checkSum"),Ie([m("uint32")],Zt.prototype,"offset"),Ie([m("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],$s=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];var ks=Object.defineProperty,js=(s,t,e)=>t in s?ks(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ce=(s,t,e)=>(js(s,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,c=[];for(let u=0,d=l.length;u<d;u+=1){const y=l[u];y.type==="M"?c.push({type:"M",x:t+y.x*a,y:e+-y.y*h}):y.type==="L"?c.push({type:"L",x:t+y.x*a,y:e+-y.y*h}):y.type==="Q"?c.push({type:"Q",x1:t+y.x1*a,y1:e+-y.y1*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="C"?c.push({type:"C",x1:t+y.x1*a,y1:e+-y.y1*h,x2:t+y.x2*a,y2:e+-y.y2*h,x:t+y.x*a,y:e+-y.y*h}):y.type==="Z"&&c.push({type:"Z"})}return c}}class Bs extends tr{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,c=this.index;let u,d,y,g;const w=[],p=[];let C=0,P=!1,x=!1,T=o,v=0,M=0;function I(D,E){w.push({type:"L",x:D,y:E})}function S(D,E,V,$,J,W){w.push({type:"C",x1:D,y1:E,x2:V,y2:$,x:J,y:W})}function _(D,E){x&&l!==2&&U(),x=!0,w.push({type:"M",x:D,y:E})}function U(){w.push({type:"Z"})}function N(D){w.push(...D)}function R(){p.length%2!==0&&!P&&(T=p.shift()+i),C+=p.length>>1,p.length=0,P=!0}function Mt(D){let E,V,$,J,W,xt,B,K,k,F,A,X,q=0;for(;q<D.length;){let tt=D[q++];switch(tt){case 1:R();break;case 3:R();break;case 4:p.length>1&&!P&&(T=p.shift()+i,P=!0),M+=p.pop(),_(v,M);break;case 5:for(;p.length>0;)v+=p.shift(),M+=p.shift(),I(v,M);break;case 6:for(;p.length>0&&(v+=p.shift(),I(v,M),p.length!==0);)M+=p.shift(),I(v,M);break;case 7:for(;p.length>0&&(M+=p.shift(),I(v,M),p.length!==0);)v+=p.shift(),I(v,M);break;case 8:for(;p.length>0;)u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g+p.shift(),S(u,d,y,g,v,M);break;case 10:W=p.pop()+h,xt=t.subrs[W],xt&&Mt(xt);break;case 11:return;case 12:switch(tt=D[q],q+=1,tt){case 35:u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),B=y+p.shift(),K=g+p.shift(),k=B+p.shift(),F=K+p.shift(),A=k+p.shift(),X=F+p.shift(),v=A+p.shift(),M=X+p.shift(),p.shift(),S(u,d,y,g,B,K),S(k,F,A,X,v,M);break;case 34:u=v+p.shift(),d=M,y=u+p.shift(),g=d+p.shift(),B=y+p.shift(),K=g,k=B+p.shift(),F=g,A=k+p.shift(),X=M,v=A+p.shift(),S(u,d,y,g,B,K),S(k,F,A,X,v,M);break;case 36:u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),B=y+p.shift(),K=g,k=B+p.shift(),F=g,A=k+p.shift(),X=F+p.shift(),v=A+p.shift(),S(u,d,y,g,B,K),S(k,F,A,X,v,M);break;case 37:u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),B=y+p.shift(),K=g+p.shift(),k=B+p.shift(),F=K+p.shift(),A=k+p.shift(),X=F+p.shift(),Math.abs(A-v)>Math.abs(X-M)?v=A+p.shift():M=X+p.shift(),S(u,d,y,g,B,K),S(k,F,A,X,v,M);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+tt}`),p.length=0}break;case 14:if(p.length>=4){const Xt=Je[p.pop()],Yt=Je[p.pop()],Dt=p.pop(),Nt=p.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),ie=t.charset.indexOf(Yt);n.components.push({glyphIndex:ie,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),N(r.get(ie).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ir=0;Ir<Or.length;Ir+=1){const zt=Or[Ir];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}N(Or)}}else p.length>0&&!P&&(T=p.shift()+i,P=!0);x&&l!==2&&(U(),x=!1);break;case 18:R();break;case 19:case 20:R(),q+=C+7>>3;break;case 21:p.length>2&&!P&&(T=p.shift()+i,P=!0),M+=p.pop(),v+=p.pop(),_(v,M);break;case 22:p.length>1&&!P&&(T=p.shift()+i,P=!0),v+=p.pop(),_(v,M);break;case 23:R();break;case 24:for(;p.length>2;)u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g+p.shift(),S(u,d,y,g,v,M);v+=p.shift(),M+=p.shift(),I(v,M);break;case 25:for(;p.length>6;)v+=p.shift(),M+=p.shift(),I(v,M);u=v+p.shift(),d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g+p.shift(),S(u,d,y,g,v,M);break;case 26:for(p.length%2&&(v+=p.shift());p.length>0;)u=v,d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y,M=g+p.shift(),S(u,d,y,g,v,M);break;case 27:for(p.length%2&&(M+=p.shift());p.length>0;)u=v+p.shift(),d=M,y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g,S(u,d,y,g,v,M);break;case 28:E=D[q],V=D[q+1],p.push((E<<24|V<<16)>>16),q+=2;break;case 29:W=p.pop()+a,xt=t.gsubrs[W],xt&&Mt(xt);break;case 30:for(;p.length>0&&(u=v,d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g+(p.length===1?p.shift():0),S(u,d,y,g,v,M),p.length!==0);)u=v+p.shift(),d=M,y=u+p.shift(),g=d+p.shift(),M=g+p.shift(),v=y+(p.length===1?p.shift():0),S(u,d,y,g,v,M);break;case 31:for(;p.length>0&&(u=v+p.shift(),d=M,y=u+p.shift(),g=d+p.shift(),M=g+p.shift(),v=y+(p.length===1?p.shift():0),S(u,d,y,g,v,M),p.length!==0);)u=v,d=M+p.shift(),y=u+p.shift(),g=d+p.shift(),v=y+p.shift(),M=g+(p.length===1?p.shift():0),S(u,d,y,g,v,M);break;default:tt<32?console.warn(`Glyph ${c}: unknown operator ${tt}`):tt<247?p.push(tt-139):tt<251?(E=D[q],q+=1,p.push((tt-247)*256+E+108)):tt<255?(E=D[q],q+=1,p.push(-(tt-251)*256-E-108)):(E=D[q],V=D[q+1],$=D[q+2],J=D[q+3],q+=4,p.push((E<<24|V<<16|$<<8|J)/65536))}}}Mt(e),this.pathCommands=w,P&&(this.advanceWidth=T)}}var Fs=Object.defineProperty,Gs=(s,t,e)=>t in s?Fs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Rs=(s,t,e)=>(Gs(s,t+"",e),e);class er{constructor(t){this._sfnt=t,Rs(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class Vs extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Bs({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Xr=Object.defineProperty,Ws=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Xr(t,e,n),n},Ae=(s,t,e)=>(Ws(s,typeof t!="symbol"?t+"":t,e),e);class De extends bt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}Yr([m("uint16")],De.prototype,"count"),Yr([m("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Zr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const qs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","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"],Hs=[".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"],Qs=[".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"],Xs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function ze(s,t){return t<=390?qs[t]:s[t-391]}var Ys=Object.defineProperty,Zs=(s,t,e)=>t in s?Ys(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Kr=(s,t,e)=>(Zs(s,typeof t!="symbol"?t+"":t,e),e);function G(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class Jr extends bt{constructor(){super(...arguments),Kr(this,"_dict"),Kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ks=Object.defineProperty,rr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ks(t,e,n),n};class Ee extends Jr{}rr([G(19)],Ee.prototype,"subrs"),rr([G(20)],Ee.prototype,"defaultWidthX"),rr([G(21)],Ee.prototype,"nominalWidthX");var Js=Object.defineProperty,Y=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Js(t,e,n),n};class H extends Jr{}Y([G(0,"string")],H.prototype,"version"),Y([G(1,"string")],H.prototype,"notice"),Y([G(1200,"string")],H.prototype,"copyright"),Y([G(2,"string")],H.prototype,"fullName"),Y([G(3,"string")],H.prototype,"familyName"),Y([G(4,"string")],H.prototype,"weight"),Y([G(1201)],H.prototype,"isFixedPitch"),Y([G(1202)],H.prototype,"italicAngle"),Y([G(1203,"number",-100)],H.prototype,"underlinePosition"),Y([G(1204,"number",50)],H.prototype,"underlineThickness"),Y([G(1205)],H.prototype,"paintType"),Y([G(1206,"number",2)],H.prototype,"charstringType"),Y([G(1207,"number[]",[.001,0,0,.001,0,0])],H.prototype,"fontMatrix"),Y([G(13)],H.prototype,"uniqueId"),Y([G(5,"number[]",[0,0,0,0])],H.prototype,"fontBBox"),Y([G(1208)],H.prototype,"strokeWidth"),Y([G(14)],H.prototype,"xuid"),Y([G(15)],H.prototype,"charset"),Y([G(16)],H.prototype,"encoding"),Y([G(17)],H.prototype,"charStrings"),Y([G(18,"number[]",[0,0])],H.prototype,"private");var ti=Object.defineProperty,ei=(s,t,e)=>t in s?ti(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,nr=(s,t,e)=>(ei(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{ue.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const tn=class xe{constructor(t){nr(this,"tables",new Map),nr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const c=h[l];o.call(this,c,e,r,n,i),c.advanceWidth&&(e+=c.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};nr(tn,"tableDefinitions",new Map);let ue=tn;class ct extends bt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var en=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e)=>t in s?en(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ri(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&en(t,e,n),n},sr=(s,t,e)=>(ni(s,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),sr(this,"_glyphs"),sr(this,"privateDict"),sr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Vs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Zr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new H(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new Ee(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hs:this.topDict.charset===1?this.charset=Qs:this.topDict.charset===2?this.charset=Xs:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=$s:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(ze(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(ze(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(ze(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let c=h;c<=h+l;c+=1)i[c]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([m("uint8")],f.Cff.prototype,"majorVersion",2),fe([m("uint8")],f.Cff.prototype,"minorVersion",2),fe([m("uint8")],f.Cff.prototype,"headerSize",2),fe([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([nt("CFF ","cff")],f.Cff);var si=Object.defineProperty,Ue=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&si(t,e,n),n};const de=class rs extends bt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new rs;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ue([m("uint16")],de.prototype,"format"),Ue([m("uint16")],de.prototype,"length"),Ue([m("uint16")],de.prototype,"language"),Ue([m({type:"uint8",size:256})],de.prototype,"glyphIndexArray");let ir=de;var ii=Object.defineProperty,or=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ii(t,e,n),n};class pe extends bt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const c=r[l];for(let u=0,d=i[c].entryCount;u<d;u++)if(i[c].idRangeOffset+u>=o.length?h=0:(h=o[i[c].idRangeOffset+u],h!==0&&(h=h+i[c].idDelta)),h!==0&&h<t){const y=(l<<8|u+i[c].firstCode)%65535;e.set(y,h)}}return e}}or([m("uint16")],pe.prototype,"format"),or([m("uint16")],pe.prototype,"length"),or([m("uint16")],pe.prototype,"language");function rn(s){return s>32767?s-65536:s<-32767?s+65536:s}function ar(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:rn(i-o)}):(n.start=Number(o),n.startId=i,n.delta=rn(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var oi=Object.defineProperty,Rt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&oi(t,e,n),n};const jt=class ns extends bt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new ns(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let c=n[l],u=i[l];c<=u;++c)if(o[l]===0)t.set(c,(c+a[l])%65536);else{const d=l+o[l]/2+(c-n[l])-r,y=h[d];y!==0?t.set(c,(y+a[l])%65536):t.set(c,0)}return t.delete(65535),t}};Rt([m("uint16")],jt.prototype,"format"),Rt([m("uint16")],jt.prototype,"length"),Rt([m("uint16")],jt.prototype,"language"),Rt([m("uint16")],jt.prototype,"segCountX2"),Rt([m("uint16")],jt.prototype,"searchRange"),Rt([m("uint16")],jt.prototype,"entrySelector"),Rt([m("uint16")],jt.prototype,"rangeShift");let lr=jt;var ai=Object.defineProperty,ge=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&ai(t,e,n),n};class Vt extends bt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}ge([m("uint16")],Vt.prototype,"format"),ge([m("uint16")],Vt.prototype,"length"),ge([m("uint16")],Vt.prototype,"language"),ge([m("uint16")],Vt.prototype,"firstCode"),ge([m("uint16")],Vt.prototype,"entryCount");var li=Object.defineProperty,ye=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&li(t,e,n),n};const Kt=class ss extends bt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ar(t),r=new ss(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};ye([m("uint16")],Kt.prototype,"format"),ye([m("uint16")],Kt.prototype,"reserved"),ye([m("uint32")],Kt.prototype,"length"),ye([m("uint32")],Kt.prototype,"language"),ye([m("uint32")],Kt.prototype,"nGroups");let hr=Kt;var hi=Object.defineProperty,cr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&hi(t,e,n),n};class me extends bt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}cr([m("uint16")],me.prototype,"format"),cr([m("uint32")],me.prototype,"length"),cr([m("uint32")],me.prototype,"numVarSelectorRecords");var nn=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,ui=(s,t,e)=>t in s?nn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ur=(s,t,e,r)=>{for(var n=r>1?void 0:r?ci(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&nn(t,e,n),n},sn=(s,t,e)=>(ui(s,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),sn(this,"_unicodeToGlyphIndexMap"),sn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),r=lr.from(t),n=ir.from(t),i=e?hr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),c=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(r.view,o),c.view.writeBytes(n.view,a),i&&c.view.writeBytes(i.view,h),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new ir(this.view.buffer,e.offset);break;case 2:n=new pe(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Vt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,c,u;const t=this.readSubtables(),e=(a=t.find(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,i=(c=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:c.view,o=(u=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},ur([m("uint16")],f.Cmap.prototype,"version",2),ur([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([nt("cmap")],f.Cmap);class fi extends tr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return he(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();he(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;he(u<2e4,`Bad numberOfCoordinates:${c}`);const d=[];let y,g=0;for(;g<u;)if(y=t.view.readUint8(),d.push(y),g++,y&8&&g<u){const w=t.view.readUint8();for(let p=0;p<w;p++)d.push(y),g++}if(he(d.length===u,`Bad flags length: ${d.length}, numberOfCoordinates: ${u}`),a.length>0){const w=[];let p;if(u>0){for(let x=0;x<u;x+=1)y=d[x],p={},p.onCurve=!!(y&1),p.lastPointOfContour=a.includes(x),w.push(p);let C=0;for(let x=0;x<u;x+=1)y=d[x],p=w[x],p.x=this._parseGlyphCoordinate(t,y,C,2,16),C=p.x;let P=0;for(let x=0;x<u;x+=1)y=d[x],p=w[x],p.y=this._parseGlyphCoordinate(t,y,P,4,32),P=p.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let c;if(h.matchedPoints===void 0)c=this._transformPoints(l.points,h);else{he(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let d=l.points[h.matchedPoints[1]];const y={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],y)[0],y.dx=u.x-d.x,y.dy=u.y-d.y,c=this._transformPoints(l.points,y)}this.points=this.points.concat(c)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let c=l[l.length-1],u=l[0];c.onCurve?i.push({type:"M",x:c.x,y:c.y}):u.onCurve?i.push({type:"M",x:u.x,y:u.y}):i.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let d=0,y=l.length;d<y;++d)if(c=u,u=l[(d+1)%y],c.onCurve)i.push({type:"L",x:c.x,y:c.y});else{let g=u;u.onCurve||(g={x:(c.x+u.x)*.5,y:(c.y+u.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 di extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new fi({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var on=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,gi=(s,t,e)=>t in s?on(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yi=(s,t,e,r)=>{for(var n=r>1?void 0:r?pi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&on(t,e,n),n},mi=(s,t,e)=>(gi(s,t+"",e),e);const Jt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ct{constructor(){super(...arguments),mi(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new di(this._sfnt))}},f.Glyf=yi([nt("glyf")],f.Glyf);var wi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,bi=(s,t,e,r)=>{for(var n=r>1?void 0:r?vi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&wi(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=bi([nt("GPOS","gpos")],f.Gpos);var Mi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,Wt=(s,t,e,r)=>{for(var n=r>1?void 0:r?xi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Mi(t,e,n),n};f.Gsub=class extends ct{},Wt([m("uint16")],f.Gsub.prototype,"majorVersion",2),Wt([m("uint16")],f.Gsub.prototype,"minorVersion",2),Wt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Wt([nt("GSUB","gsub")],f.Gsub);var Ci=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ci(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],f.Head.prototype,"version",2),et([m("fixed")],f.Head.prototype,"fontRevision",2),et([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],f.Head.prototype,"magickNumber",2),et([m("uint16")],f.Head.prototype,"flags",2),et([m("uint16")],f.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],f.Head.prototype,"created",2),et([m({type:"longDateTime"})],f.Head.prototype,"modified",2),et([m("int16")],f.Head.prototype,"xMin",2),et([m("int16")],f.Head.prototype,"yMin",2),et([m("int16")],f.Head.prototype,"xMax",2),et([m("int16")],f.Head.prototype,"yMax",2),et([m("uint16")],f.Head.prototype,"macStyle",2),et([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([m("int16")],f.Head.prototype,"fontDirectionHint",2),et([m("int16")],f.Head.prototype,"indexToLocFormat",2),et([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var Pi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Pi(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],f.Hhea.prototype,"version",2),dt([m("int16")],f.Hhea.prototype,"ascent",2),dt([m("int16")],f.Hhea.prototype,"descent",2),dt([m("int16")],f.Hhea.prototype,"lineGap",2),dt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),dt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),dt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),dt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),dt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),dt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),dt([m("int16")],f.Hhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),dt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),dt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=dt([nt("hhea")],f.Hhea);var an=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Oi=(s,t,e)=>t in s?an(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ii=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&an(t,e,n),n},Ai=(s,t,e)=>(Oi(s,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),Ai(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Ii([nt("hmtx")],f.Hmtx);var Di=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,zi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ni(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Di(t,e,n),n};f.Kern=class extends ct{},f.Kern=zi([nt("kern","kern")],f.Kern);var ln=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Ui=(s,t,e)=>t in s?ln(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Li=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ei(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ln(t,e,n),n},$i=(s,t,e)=>(Ui(s,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),$i(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Li([nt("loca")],f.Loca);var ki=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?ji(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ki(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],f.Maxp.prototype,"version",2),ut([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],f.Maxp.prototype,"maxPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxContours",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],f.Maxp.prototype,"maxZones",2),ut([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxStorage",2),ut([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var hn=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Fi=(s,t,e)=>t in s?hn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Le=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&hn(t,e,n),n},Gi=(s,t,e)=>(Fi(s,t+"",e),e);const cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ri={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},un={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Gi(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=fr.Macintosh,i=Ri.Default,o=0;e.some(h=>h.platform===fr.Microsoft&&h.encoding===un.UCS2&&h.language===1033)&&(n=fr.Microsoft,i=un.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&cn[l.nameId]&&(a[cn[l.nameId]]=o===0?Ns(l.name):zs(l.name))}return a}},Le([m("uint16")],f.Name.prototype,"format",2),Le([m("uint16")],f.Name.prototype,"count",2),Le([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([nt("name")],f.Name);var Vi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,O=(s,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Vi(t,e,n),n};f.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([m("uint16")],f.Os2.prototype,"version",2),O([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([m("uint16")],f.Os2.prototype,"usWeightClass",2),O([m("uint16")],f.Os2.prototype,"usWidthClass",2),O([m("uint16")],f.Os2.prototype,"fsType",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([m("uint16")],f.Os2.prototype,"sFamilyClass",2),O([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([m("uint16")],f.Os2.prototype,"fsSelection",2),O([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([m("int16")],f.Os2.prototype,"sTypoAscender",2),O([m("int16")],f.Os2.prototype,"sTypoDescender",2),O([m("int16")],f.Os2.prototype,"sTypoLineGap",2),O([m("uint16")],f.Os2.prototype,"usWinAscent",2),O([m("uint16")],f.Os2.prototype,"usWinDescent",2),O([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([m("int16")],f.Os2.prototype,"sCapHeight",2),O([m("uint16")],f.Os2.prototype,"usDefaultChar",2),O([m("uint16")],f.Os2.prototype,"usBreakChar",2),O([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([nt("OS/2","os2")],f.Os2);var qi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,It=(s,t,e,r)=>{for(var n=r>1?void 0:r?Hi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&qi(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},It([m("fixed")],f.Post.prototype,"format",2),It([m("fixed")],f.Post.prototype,"italicAngle",2),It([m("int16")],f.Post.prototype,"underlinePosition",2),It([m("int16")],f.Post.prototype,"underlineThickness",2),It([m("uint32")],f.Post.prototype,"isFixedPitch",2),It([m("uint32")],f.Post.prototype,"minMemType42",2),It([m("uint32")],f.Post.prototype,"maxMemType42",2),It([m("uint32")],f.Post.prototype,"minMemType1",2),It([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=It([nt("post")],f.Post);var Qi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Qi(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Vhea.prototype,"version",2),pt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),pt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),pt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),pt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),pt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),pt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),pt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),pt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Vhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),pt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),pt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=pt([nt("vhea")],f.Vhea);var fn=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,Zi=(s,t,e)=>t in s?fn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ki=(s,t,e,r)=>{for(var n=r>1?void 0:r?Yi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&fn(t,e,n),n},Ji=(s,t,e)=>(Zi(s,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Ji(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Ki([nt("vmtx")],f.Vmtx);var dn=Object.defineProperty,to=(s,t,e)=>t in s?dn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&dn(t,e,n),n},$e=(s,t,e)=>(to(s,typeof t!="symbol"?t+"":t,e),e);class st extends Oe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,d)=>u+e(d.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,h=0;const l=i.getDirectories();t.tableViews.forEach((u,d)=>{const y=l[h++];y.tag=d,y.checkSum=this.checksum(u),y.offset=a,y.length=u.byteLength,i.view.writeBytes(u,a),a+=e(y.length)});const c=i.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(st,"signature",new Set([65536,1953658213,1954115633])),we([m("uint32")],st.prototype,"scalerType"),we([m("uint16")],st.prototype,"numTables"),we([m("uint16")],st.prototype,"searchRange"),we([m("uint16")],st.prototype,"entrySelector"),we([m("uint16")],st.prototype,"rangeShift");var eo=Object.defineProperty,ro=(s,t,e)=>t in s?eo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,dr=(s,t,e)=>(ro(s,typeof t!="symbol"?t+"":t,e),e);class ke extends st{constructor(){super(...arguments),dr(this,"format","OpenType"),dr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}dr(ke,"signature",new Set([1330926671]));var no=Object.defineProperty,ve=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&no(t,e,n),n};class qt extends bt{constructor(t,e){super(t,e,20)}}ve([m({type:"char",size:4})],qt.prototype,"tag"),ve([m("uint32")],qt.prototype,"offset"),ve([m("uint32")],qt.prototype,"compLength"),ve([m("uint32")],qt.prototype,"origLength"),ve([m("uint32")],qt.prototype,"origChecksum");var pn=Object.defineProperty,so=(s,t,e)=>t in s?pn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&pn(t,e,n),n},je=(s,t,e)=>(so(s,typeof t!="symbol"?t+"":t,e),e);const gt=class Ar extends Oe{constructor(){super(...arguments),je(this,"format","WOFF"),je(this,"mimeType","font/woff"),je(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":ke.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,d)=>{const y=Gt(bs(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:d,view:y.byteLength<u.byteLength?y:u,rawView:u})});const i=n.length,o=n.reduce((u,d)=>u+r(d.view.byteLength),0),a=new Ar(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+i*20,l=0;const c=a.getDirectories();return n.forEach(u=>{const d=c[l++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=Ar.checkSum(u.rawView),d.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,h),h+=r(d.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new qt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(Ms(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};je(gt,"signature",new Set([2001684038])),wt([m("uint32")],gt.prototype,"signature"),wt([m("uint32")],gt.prototype,"flavor"),wt([m("uint32")],gt.prototype,"length"),wt([m("uint16")],gt.prototype,"numTables"),wt([m("uint16")],gt.prototype,"reserved"),wt([m("uint32")],gt.prototype,"totalSfntSize"),wt([m("uint16")],gt.prototype,"majorVersion"),wt([m("uint16")],gt.prototype,"minorVersion"),wt([m("uint32")],gt.prototype,"metaOffset"),wt([m("uint32")],gt.prototype,"metaLength"),wt([m("uint32")],gt.prototype,"metaOrigLength"),wt([m("uint32")],gt.prototype,"privOffset"),wt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function gn(s){if(st.is(s))return new st(s);if(ke.is(s))return new ke(s);if(Ut.is(s))return new Ut(s)}var io=Object.defineProperty,oo=(s,t,e)=>t in s?io(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,be=(s,t,e)=>(oo(s,typeof t!="symbol"?t+"":t,e),e);const yn=class is{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...is.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
1
+ (function(f,ot){typeof exports=="object"&&typeof module<"u"?ot(exports):typeof define=="function"&&define.amd?define(["exports"],ot):(f=typeof globalThis<"u"?globalThis:f||self,ot(f.modernText={}))})(this,function(f){"use strict";var da=Object.defineProperty;var pa=(f,ot,Tt)=>ot in f?da(f,ot,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):f[ot]=Tt;var z=(f,ot,Tt)=>pa(f,typeof ot!="symbol"?ot+"":ot,Tt);function ot(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:o,y1:s,stops:a}=oi(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(r,n,o,s);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Tt(i,t,e){i!=null&&i.color&&(i.color=ot(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=ot(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=ot(e,i.textStrokeColor,t))}function oi(i,t,e,r,n){var g;const o=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",h=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=r*Math.sin(c),d=n*Math.cos(c);return{x0:t+r/2-u,y0:e+n/2+d,x1:t+r/2+u,y1:e+n/2-d,stops:Array.from(h).map(y=>{let w=y[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(y[3].replace("%",""))/100,color:w}})}}function Ce(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const o=e.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,s),t.restore()}function ai(i,t){const{computedStyle:e,paragraphs:r}=t;function n(o,s,a,h,l){i.fillStyle=o,i.fillRect(s,a,h,l)}e!=null&&e.backgroundColor&&n(e.backgroundColor,0,0,i.canvas.width,i.canvas.height),r.forEach(o=>{var s;(s=o.style)!=null&&s.backgroundColor&&n(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(a=>{var h;(h=a.style)!=null&&h.backgroundColor&&n(a.computedStyle.backgroundColor,...a.boundingBox.toArray())})})}function Dr(i,t,e){const{left:r,top:n,width:o,height:s}=e,a=i.canvas;a.dataset.viewbox=`${r} ${n} ${o} ${s}`,a.dataset.pixelRatio=String(t),a.width=Math.max(1,Math.ceil(o*t)),a.height=Math.max(1,Math.ceil(s*t)),a.style.marginTop=`${n}px`,a.style.marginLeft=`${r}px`,a.style.width=`${o}px`,a.style.height=`${s}px`,i.clearRect(0,0,i.canvas.width,i.canvas.height),i.scale(t,t),i.translate(-r,-n)}function Nr(i,t){const{paragraphs:e,computedStyle:r,renderBoundingBox:n}=t;Tt(r,n,i),e.forEach(o=>{Tt(o.computedStyle,o.boundingBox,i),o.fragments.forEach(s=>{Tt(s.computedStyle,s.boundingBox,i)})})}var at=Uint8Array,wt=Uint16Array,Re=Int32Array,Se=new at([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pe=new at([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]),We=new at([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zr=function(i,t){for(var e=new wt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Re(e[30]),r=1;r<30;++r)for(var o=e[r];o<e[r+1];++o)n[o]=o-e[r]<<5|r;return{b:e,r:n}},Er=zr(Se,2),Ur=Er.b,qe=Er.r;Ur[28]=258,qe[258]=28;for(var Lr=zr(Pe,0),li=Lr.b,$r=Lr.r,He=new wt(32768),k=0;k<32768;++k){var $t=(k&43690)>>1|(k&21845)<<1;$t=($t&52428)>>2|($t&13107)<<2,$t=($t&61680)>>4|($t&3855)<<4,He[k]=(($t&65280)>>8|($t&255)<<8)>>1}for(var Ot=function(i,t,e){for(var r=i.length,n=0,o=new wt(t);n<r;++n)i[n]&&++o[i[n]-1];var s=new wt(t);for(n=1;n<t;++n)s[n]=s[n-1]+o[n-1]<<1;var a;if(e){a=new wt(1<<t);var h=15-t;for(n=0;n<r;++n)if(i[n])for(var l=n<<4|i[n],c=t-i[n],u=s[i[n]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)a[He[u]>>h]=l}else for(a=new wt(r),n=0;n<r;++n)i[n]&&(a[n]=He[s[i[n]-1]++]>>15-i[n]);return a},kt=new at(288),k=0;k<144;++k)kt[k]=8;for(var k=144;k<256;++k)kt[k]=9;for(var k=256;k<280;++k)kt[k]=7;for(var k=280;k<288;++k)kt[k]=8;for(var oe=new at(32),k=0;k<32;++k)oe[k]=5;var hi=Ot(kt,9,0),ci=Ot(kt,9,1),ui=Ot(oe,5,0),fi=Ot(oe,5,1),Qe=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},Ct=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ye=function(i){return(i+7)/8|0},kr=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new at(i.subarray(t,e))},di=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],St=function(i,t,e){var r=new Error(t||di[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},pi=function(i,t,e,r){var n=i.length,o=0;if(!n||t.f&&!t.l)return e||new at(0);var s=!e,a=s||t.i!=2,h=t.i;s&&(e=new at(n*3));var l=function(Dt){var Nt=e.length;if(Dt>Nt){var Lt=new at(Math.max(Nt*2,Dt));Lt.set(e),e=Lt}},c=t.f||0,u=t.p||0,d=t.b||0,g=t.l,y=t.d,w=t.m,p=t.n,C=n*8;do{if(!g){c=Ct(i,u,1);var P=Ct(i,u+1,3);if(u+=3,P)if(P==1)g=ci,y=fi,w=9,p=5;else if(P==2){var b=Ct(i,u,31)+257,I=Ct(i,u+10,15)+4,S=b+Ct(i,u+5,31)+1;u+=14;for(var _=new at(S),N=new at(19),G=0;G<I;++G)N[We[G]]=Ct(i,u+G*3,7);u+=I*3;for(var V=Qe(N),Q=(1<<V)-1,A=Ot(N,V,1),G=0;G<S;){var E=A[Ct(i,u,Q)];u+=E&15;var x=E>>4;if(x<16)_[G++]=x;else{var R=0,L=0;for(x==16?(L=3+Ct(i,u,3),u+=2,R=_[G-1]):x==17?(L=3+Ct(i,u,7),u+=3):x==18&&(L=11+Ct(i,u,127),u+=7);L--;)_[G++]=R}}var tt=_.subarray(0,b),W=_.subarray(b);w=Qe(tt),p=Qe(W),g=Ot(tt,w,1),y=Ot(W,p,1)}else St(1);else{var x=Ye(u)+4,T=i[x-4]|i[x-3]<<8,v=x+T;if(v>n){h&&St(0);break}a&&l(d+T),e.set(i.subarray(x,v),d),t.b=d+=T,t.p=u=v*8,t.f=c;continue}if(u>C){h&&St(0);break}}a&&l(d+131072);for(var xt=(1<<w)-1,j=(1<<p)-1,J=u;;J=u){var R=g[Xe(i,u)&xt],$=R>>4;if(u+=R&15,u>C){h&&St(0);break}if(R||St(2),$<256)e[d++]=$;else if($==256){J=u,g=null;break}else{var B=$-254;if($>264){var G=$-257,D=Se[G];B=Ct(i,u,(1<<D)-1)+Ur[G],u+=D}var Y=y[Xe(i,u)&j],q=Y>>4;Y||St(3),u+=Y&15;var W=li[q];if(q>3){var D=Pe[q];W+=Xe(i,u)&(1<<D)-1,u+=D}if(u>C){h&&St(0);break}a&&l(d+131072);var et=d+B;if(d<W){var Xt=o-W,Yt=Math.min(W,et);for(Xt+d<0&&St(3);d<Yt;++d)e[d]=r[Xt+d]}for(;d<et;++d)e[d]=e[d-W]}}t.l=g,t.p=J,t.b=d,t.f=c,g&&(c=1,t.m=w,t.d=y,t.n=p)}while(!c);return d!=e.length&&s?kr(e,0,d):e.subarray(0,d)},Et=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},ae=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ze=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,o=e.slice();if(!n)return{t:Gr,l:0};if(n==1){var s=new at(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(v,b){return v.f-b.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,c=1,u=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};c!=n-1;)a=e[e[l].f<e[u].f?l++:u++],h=e[l!=c&&e[l].f<e[u].f?l++:u++],e[c++]={s:-1,f:a.f+h.f,l:a,r:h};for(var d=o[0].s,r=1;r<n;++r)o[r].s>d&&(d=o[r].s);var g=new wt(d+1),y=Ke(e[c-1],g,0);if(y>t){var r=0,w=0,p=y-t,C=1<<p;for(o.sort(function(b,I){return g[I.s]-g[b.s]||b.f-I.f});r<n;++r){var P=o[r].s;if(g[P]>t)w+=C-(1<<y-g[P]),g[P]=t;else break}for(w>>=p;w>0;){var x=o[r].s;g[x]<t?w-=1<<t-g[x]++-1:++r}for(;r>=0&&w;--r){var T=o[r].s;g[T]==t&&(--g[T],++w)}y=t}return{t:new at(g),l:y}},Ke=function(i,t,e){return i.s==-1?Math.max(Ke(i.l,t,e+1),Ke(i.r,t,e+1)):t[i.s]=e},jr=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new wt(++t),r=0,n=i[0],o=1,s=function(h){e[r++]=h},a=1;a<=t;++a)if(i[a]==n&&a!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=i[a]}return{c:e.subarray(0,r),n:t}},le=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},Br=function(i,t,e){var r=e.length,n=Ye(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var o=0;o<r;++o)i[n+o+4]=e[o];return(n+4+r)*8},Fr=function(i,t,e,r,n,o,s,a,h,l,c){Et(t,c++,e),++n[256];for(var u=Ze(n,15),d=u.t,g=u.l,y=Ze(o,15),w=y.t,p=y.l,C=jr(d),P=C.c,x=C.n,T=jr(w),v=T.c,b=T.n,I=new wt(19),S=0;S<P.length;++S)++I[P[S]&31];for(var S=0;S<v.length;++S)++I[v[S]&31];for(var _=Ze(I,7),N=_.t,G=_.l,V=19;V>4&&!N[We[V-1]];--V);var Q=l+5<<3,A=le(n,kt)+le(o,oe)+s,E=le(n,d)+le(o,w)+s+14+3*V+le(I,N)+2*I[16]+3*I[17]+7*I[18];if(h>=0&&Q<=A&&Q<=E)return Br(t,c,i.subarray(h,h+l));var R,L,tt,W;if(Et(t,c,1+(E<A)),c+=2,E<A){R=Ot(d,g,0),L=d,tt=Ot(w,p,0),W=w;var xt=Ot(N,G,0);Et(t,c,x-257),Et(t,c+5,b-1),Et(t,c+10,V-4),c+=14;for(var S=0;S<V;++S)Et(t,c+3*S,N[We[S]]);c+=3*V;for(var j=[P,v],J=0;J<2;++J)for(var $=j[J],S=0;S<$.length;++S){var B=$[S]&31;Et(t,c,xt[B]),c+=N[B],B>15&&(Et(t,c,$[S]>>5&127),c+=$[S]>>12)}}else R=hi,L=kt,tt=ui,W=oe;for(var S=0;S<a;++S){var D=r[S];if(D>255){var B=D>>18&31;ae(t,c,R[B+257]),c+=L[B+257],B>7&&(Et(t,c,D>>23&31),c+=Se[B]);var Y=D&31;ae(t,c,tt[Y]),c+=W[Y],Y>3&&(ae(t,c,D>>5&8191),c+=Pe[Y])}else ae(t,c,R[D]),c+=L[D]}return ae(t,c,R[256]),c+L[256]},gi=new Re([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gr=new at(0),yi=function(i,t,e,r,n,o){var s=o.z||i.length,a=new at(r+s+5*(1+Math.ceil(s/7e3))+n),h=a.subarray(r,a.length-n),l=o.l,c=(o.r||0)&7;if(t){c&&(h[0]=o.r>>3);for(var u=gi[t-1],d=u>>13,g=u&8191,y=(1<<e)-1,w=o.p||new wt(32768),p=o.h||new wt(y+1),C=Math.ceil(e/3),P=2*C,x=function(se){return(i[se]^i[se+1]<<C^i[se+2]<<P)&y},T=new Re(25e3),v=new wt(288),b=new wt(32),I=0,S=0,_=o.i||0,N=0,G=o.w||0,V=0;_+2<s;++_){var Q=x(_),A=_&32767,E=p[Q];if(w[A]=E,p[Q]=A,G<=_){var R=s-_;if((I>7e3||N>24576)&&(R>423||!l)){c=Fr(i,h,0,T,v,b,S,N,V,_-V,c),N=I=S=0,V=_;for(var L=0;L<286;++L)v[L]=0;for(var L=0;L<30;++L)b[L]=0}var tt=2,W=0,xt=g,j=A-E&32767;if(R>2&&Q==x(_-j))for(var J=Math.min(d,R)-1,$=Math.min(32767,_),B=Math.min(258,R);j<=$&&--xt&&A!=E;){if(i[_+tt]==i[_+tt-j]){for(var D=0;D<B&&i[_+D]==i[_+D-j];++D);if(D>tt){if(tt=D,W=j,D>J)break;for(var Y=Math.min(j,D-2),q=0,L=0;L<Y;++L){var et=_-j+L&32767,Xt=w[et],Yt=et-Xt&32767;Yt>q&&(q=Yt,E=et)}}}A=E,E=w[A],j+=A-E&32767}if(W){T[N++]=268435456|qe[tt]<<18|$r[W];var Dt=qe[tt]&31,Nt=$r[W]&31;S+=Se[Dt]+Pe[Nt],++v[257+Dt],++b[Nt],G=_+tt,++I}else T[N++]=i[_],++v[i[_]]}}for(_=Math.max(_,G);_<s;++_)T[N++]=i[_],++v[i[_]];c=Fr(i,h,l,T,v,b,S,N,V,_-V,c),l||(o.r=c&7|h[c/8|0]<<3,c-=7,o.h=p,o.p=w,o.i=_,o.w=G)}else{for(var _=o.w||0;_<s+l;_+=65535){var Lt=_+65535;Lt>=s&&(h[c/8|0]=l,Lt=s),c=Br(h,c+1,i.subarray(_,Lt))}o.i=s}return kr(a,0,r+Ye(c)+n)},Vr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,o=e.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)n+=r+=e[s];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},mi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new at(o.length+i.length);s.set(o),s.set(i,o.length),i=s,n.w=o.length}return yi(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},Rr=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},wi=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Vr();n.p(t.dictionary),Rr(i,2,n.d())}},vi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function bi(i,t){t||(t={});var e=Vr();e.p(i);var r=mi(i,t,t.dictionary?6:2,4);return wi(r,t),Rr(r,r.length-4,e.d()),r}function Mi(i,t){return pi(i.subarray(vi(i,t),-4),{i:2},t,t)}var xi=typeof TextDecoder<"u"&&new TextDecoder,Ci=0;try{xi.decode(Gr,{stream:!0}),Ci=1}catch{}const Si="modern-font";function he(i,t){if(!i)throw new Error(`[${Si}] ${t}`)}function Pi(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Gt(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var Wr=Object.defineProperty,_i=(i,t,e)=>t in i?Wr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,lt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Wr(t,e,n),n},Ti=(i,t,e)=>(_i(i,t+"",e),e);const _e={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function ht(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class nt extends DataView{constructor(t,e,r,n){super(Pi(t),e,r),this.littleEndian=n,Ti(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,s=>s.toUpperCase())}`,o=this[n](e,r);return this.cursor+=_e[t],o}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let o=0,s=r.length;o<s;o++)n+=String.fromCharCode(r[o]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const o=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,s=this[o](r,e,n);return this.cursor+=_e[t.toLowerCase()],s}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,o=t.length,s;n<o;++n)s=t.charCodeAt(n)||0,s>127?this.writeUint16(s):this.writeUint8(s);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Gt(t);r=n.byteLength;for(let o=0;o<r;++o)this.setUint8(e+o,n.getUint8(o))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}lt([ht()],nt.prototype,"readInt8"),lt([ht()],nt.prototype,"readInt16"),lt([ht()],nt.prototype,"readInt32"),lt([ht()],nt.prototype,"readUint8"),lt([ht()],nt.prototype,"readUint16"),lt([ht()],nt.prototype,"readUint32"),lt([ht()],nt.prototype,"readFloat32"),lt([ht()],nt.prototype,"readFloat64"),lt([ht()],nt.prototype,"writeInt8"),lt([ht()],nt.prototype,"writeInt16"),lt([ht()],nt.prototype,"writeInt32"),lt([ht()],nt.prototype,"writeUint8"),lt([ht()],nt.prototype,"writeUint16"),lt([ht()],nt.prototype,"writeUint32"),lt([ht()],nt.prototype,"writeFloat32"),lt([ht()],nt.prototype,"writeFloat64");var Oi=Object.defineProperty,Ii=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ai=(i,t,e)=>(Ii(i,t+"",e),e);const qr=new WeakMap;function m(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,o)=>{if(typeof o!="string")return;let s=qr.get(n);s||(s={columns:[],byteLength:0},qr.set(n,s));const a={...t,name:o,byteLength:e*_e[r],offset:t.offset??s.columns.reduce((h,l)=>h+l.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((h,l)=>h+_e[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class Mt{constructor(t,e,r,n){Ai(this,"view"),this.view=new nt(t,e,r,n)}}function Di(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Te(i){i=Di(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Ni(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function zi(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Oe extends Mt{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(t){return new FontFace(t,this.view.buffer)}}var Hr=Object.defineProperty,Ei=(i,t,e)=>t in i?Hr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,dt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Hr(t,e,n),n},Qr=(i,t,e)=>(Ei(i,typeof t!="symbol"?t+"":t,e),e);const ct=class ei extends Oe{constructor(){super(...arguments),Qr(this,"format","EmbeddedOpenType"),Qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,o=Te(n.fontFamily||""),s=o.length,a=Te(n.fontStyle||""),h=a.length,l=Te(n.version||""),c=l.length,u=Te(n.fullName||""),d=u.length,g=86+s+4+h+4+c+4+d+2+t.view.byteLength,y=new ei(new ArrayBuffer(g),0,g,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(y.FontPANOSE=w.fontPANOSE,y.Italic=w.fsSelection,y.Weight=w.usWeightClass,y.fsType=w.fsType,y.UnicodeRange=w.ulUnicodeRange,y.CodePageRange=w.ulCodePageRange),y.view.writeUint16(s),y.view.writeBytes(o),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(a),y.view.writeUint16(0),y.view.writeUint16(c),y.view.writeBytes(l),y.view.writeUint16(0),y.view.writeUint16(d),y.view.writeBytes(u),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};dt([m("uint32")],ct.prototype,"EOTSize"),dt([m("uint32")],ct.prototype,"FontDataSize"),dt([m("uint32")],ct.prototype,"Version"),dt([m("uint32")],ct.prototype,"Flags"),dt([m({type:"uint8",size:10})],ct.prototype,"FontPANOSE"),dt([m("uint8")],ct.prototype,"Charset"),dt([m("uint8")],ct.prototype,"Italic"),dt([m("uint32")],ct.prototype,"Weight"),dt([m("uint16")],ct.prototype,"fsType"),dt([m("uint16")],ct.prototype,"MagicNumber"),dt([m({type:"uint8",size:16})],ct.prototype,"UnicodeRange"),dt([m({type:"uint8",size:8})],ct.prototype,"CodePageRange"),dt([m("uint32")],ct.prototype,"CheckSumAdjustment"),dt([m({type:"uint8",size:16})],ct.prototype,"Reserved"),dt([m("uint16")],ct.prototype,"Padding1");let Ui=ct;var Li=Object.defineProperty,Ie=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Li(t,e,n),n};class Zt extends Mt{constructor(t,e){super(t,e,16)}}Ie([m({type:"char",size:4})],Zt.prototype,"tag"),Ie([m("uint32")],Zt.prototype,"checkSum"),Ie([m("uint32")],Zt.prototype,"offset"),Ie([m("uint32")],Zt.prototype,"length");const Je=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],$i=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];var ki=Object.defineProperty,ji=(i,t,e)=>t in i?ki(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e)=>(ji(i,typeof t!="symbol"?t+"":t,e),e);class tr{constructor(t){ce(this,"index"),ce(this,"name"),ce(this,"isComposite",!1),ce(this,"components",[]),ce(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*r,{xScale:a=s,yScale:h=s}=n,l=this.pathCommands,c=[];for(let u=0,d=l.length;u<d;u+=1){const g=l[u];g.type==="M"?c.push({type:"M",x:t+g.x*a,y:e+-g.y*h}):g.type==="L"?c.push({type:"L",x:t+g.x*a,y:e+-g.y*h}):g.type==="Q"?c.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="C"?c.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*h,x2:t+g.x2*a,y2:e+-g.y2*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="Z"&&c.push({type:"Z"})}return c}}class Bi extends tr{parse(t,e,r){const n=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,c=this.index;let u,d,g,y;const w=[],p=[];let C=0,P=!1,x=!1,T=s,v=0,b=0;function I(A,E){w.push({type:"L",x:A,y:E})}function S(A,E,R,L,tt,W){w.push({type:"C",x1:A,y1:E,x2:R,y2:L,x:tt,y:W})}function _(A,E){x&&l!==2&&N(),x=!0,w.push({type:"M",x:A,y:E})}function N(){w.push({type:"Z"})}function G(A){w.push(...A)}function V(){p.length%2!==0&&!P&&(T=p.shift()+o),C+=p.length>>1,p.length=0,P=!0}function Q(A){let E,R,L,tt,W,xt,j,J,$,B,D,Y,q=0;for(;q<A.length;){let et=A[q++];switch(et){case 1:V();break;case 3:V();break;case 4:p.length>1&&!P&&(T=p.shift()+o,P=!0),b+=p.pop(),_(v,b);break;case 5:for(;p.length>0;)v+=p.shift(),b+=p.shift(),I(v,b);break;case 6:for(;p.length>0&&(v+=p.shift(),I(v,b),p.length!==0);)b+=p.shift(),I(v,b);break;case 7:for(;p.length>0&&(b+=p.shift(),I(v,b),p.length!==0);)v+=p.shift(),I(v,b);break;case 8:for(;p.length>0;)u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y+p.shift(),S(u,d,g,y,v,b);break;case 10:W=p.pop()+h,xt=t.subrs[W],xt&&Q(xt);break;case 11:return;case 12:switch(et=A[q],q+=1,et){case 35:u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),j=g+p.shift(),J=y+p.shift(),$=j+p.shift(),B=J+p.shift(),D=$+p.shift(),Y=B+p.shift(),v=D+p.shift(),b=Y+p.shift(),p.shift(),S(u,d,g,y,j,J),S($,B,D,Y,v,b);break;case 34:u=v+p.shift(),d=b,g=u+p.shift(),y=d+p.shift(),j=g+p.shift(),J=y,$=j+p.shift(),B=y,D=$+p.shift(),Y=b,v=D+p.shift(),S(u,d,g,y,j,J),S($,B,D,Y,v,b);break;case 36:u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),j=g+p.shift(),J=y,$=j+p.shift(),B=y,D=$+p.shift(),Y=B+p.shift(),v=D+p.shift(),S(u,d,g,y,j,J),S($,B,D,Y,v,b);break;case 37:u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),j=g+p.shift(),J=y+p.shift(),$=j+p.shift(),B=J+p.shift(),D=$+p.shift(),Y=B+p.shift(),Math.abs(D-v)>Math.abs(Y-b)?v=D+p.shift():b=Y+p.shift(),S(u,d,g,y,j,J),S($,B,D,Y,v,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+et}`),p.length=0}break;case 14:if(p.length>=4){const Xt=Je[p.pop()],Yt=Je[p.pop()],Dt=p.pop(),Nt=p.pop();if(Xt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Xt),se=t.charset.indexOf(Yt);n.components.push({glyphIndex:se,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Nt,dy:Dt}),G(r.get(se).pathCommands);const Or=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let Ir=0;Ir<Or.length;Ir+=1){const zt=Or[Ir];zt.type!=="Z"&&(zt.x+=Nt,zt.y+=Dt),(zt.type==="Q"||zt.type==="C")&&(zt.x1+=Nt,zt.y1+=Dt),zt.type==="C"&&(zt.x2+=Nt,zt.y2+=Dt)}G(Or)}}else p.length>0&&!P&&(T=p.shift()+o,P=!0);x&&l!==2&&(N(),x=!1);break;case 18:V();break;case 19:case 20:V(),q+=C+7>>3;break;case 21:p.length>2&&!P&&(T=p.shift()+o,P=!0),b+=p.pop(),v+=p.pop(),_(v,b);break;case 22:p.length>1&&!P&&(T=p.shift()+o,P=!0),v+=p.pop(),_(v,b);break;case 23:V();break;case 24:for(;p.length>2;)u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y+p.shift(),S(u,d,g,y,v,b);v+=p.shift(),b+=p.shift(),I(v,b);break;case 25:for(;p.length>6;)v+=p.shift(),b+=p.shift(),I(v,b);u=v+p.shift(),d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y+p.shift(),S(u,d,g,y,v,b);break;case 26:for(p.length%2&&(v+=p.shift());p.length>0;)u=v,d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g,b=y+p.shift(),S(u,d,g,y,v,b);break;case 27:for(p.length%2&&(b+=p.shift());p.length>0;)u=v+p.shift(),d=b,g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y,S(u,d,g,y,v,b);break;case 28:E=A[q],R=A[q+1],p.push((E<<24|R<<16)>>16),q+=2;break;case 29:W=p.pop()+a,xt=t.gsubrs[W],xt&&Q(xt);break;case 30:for(;p.length>0&&(u=v,d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y+(p.length===1?p.shift():0),S(u,d,g,y,v,b),p.length!==0);)u=v+p.shift(),d=b,g=u+p.shift(),y=d+p.shift(),b=y+p.shift(),v=g+(p.length===1?p.shift():0),S(u,d,g,y,v,b);break;case 31:for(;p.length>0&&(u=v+p.shift(),d=b,g=u+p.shift(),y=d+p.shift(),b=y+p.shift(),v=g+(p.length===1?p.shift():0),S(u,d,g,y,v,b),p.length!==0);)u=v,d=b+p.shift(),g=u+p.shift(),y=d+p.shift(),v=g+p.shift(),b=y+(p.length===1?p.shift():0),S(u,d,g,y,v,b);break;default:et<32?console.warn(`Glyph ${c}: unknown operator ${et}`):et<247?p.push(et-139):et<251?(E=A[q],q+=1,p.push((et-247)*256+E+108)):et<255?(E=A[q],q+=1,p.push(-(et-251)*256-E-108)):(E=A[q],R=A[q+1],L=A[q+2],tt=A[q+3],q+=4,p.push((E<<24|R<<16|L<<8|tt)/65536))}}}Q(e),this.pathCommands=w,P&&(this.advanceWidth=T)}}var Fi=Object.defineProperty,Gi=(i,t,e)=>t in i?Fi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vi=(i,t,e)=>(Gi(i,t+"",e),e);class er{constructor(t){this._sfnt=t,Vi(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);o&&(r.unicode??(r.unicode=o[0]),r.unicodes??(r.unicodes=o)),this._items[t]=r}return r}}class Ri extends er{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Bi({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Xr=Object.defineProperty,Wi=(i,t,e)=>t in i?Xr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Yr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Xr(t,e,n),n},Ae=(i,t,e)=>(Wi(i,typeof t!="symbol"?t+"":t,e),e);class De extends Mt{constructor(t,e,r,n){super(t,e,r,n),Ae(this,"_offsets"),Ae(this,"_objects"),this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let o=0,s=e+1;o<s;o++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],s=r+e[t+1]-n;return this._isString?this.view.readString(n,s):this.view.readBytes(n,s)}}Yr([m("uint16")],De.prototype,"count"),Yr([m("uint8")],De.prototype,"offsetSize");class Ne extends De{constructor(){super(...arguments),Ae(this,"_isString",!1)}}class Zr extends De{constructor(){super(...arguments),Ae(this,"_isString",!0)}}const qi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Hi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Qi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Xi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function ze(i,t){return t<=390?qi[t]:i[t-391]}var Yi=Object.defineProperty,Zi=(i,t,e)=>t in i?Yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Kr=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);function F(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const o={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Jr extends Mt{constructor(){super(...arguments),Kr(this,"_dict"),Kr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const o=t.readUint8(),s=o>>4,a=o&15;if(s===r||(e+=n[s],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,o,s;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),o=e.readUint8(),s=e.readUint8(),r<<24|n<<16|o<<8|s;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let o=t.readUint8();o<=21?(o===12&&(o=1200+t.readUint8()),n[o]=e,e=[]):e.push(this._readOperand(o))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return ze(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ki=Object.defineProperty,rr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ki(t,e,n),n};class Ee extends Jr{}rr([F(19)],Ee.prototype,"subrs"),rr([F(20)],Ee.prototype,"defaultWidthX"),rr([F(21)],Ee.prototype,"nominalWidthX");var Ji=Object.defineProperty,Z=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&Ji(t,e,n),n};class X extends Jr{}Z([F(0,"string")],X.prototype,"version"),Z([F(1,"string")],X.prototype,"notice"),Z([F(1200,"string")],X.prototype,"copyright"),Z([F(2,"string")],X.prototype,"fullName"),Z([F(3,"string")],X.prototype,"familyName"),Z([F(4,"string")],X.prototype,"weight"),Z([F(1201)],X.prototype,"isFixedPitch"),Z([F(1202)],X.prototype,"italicAngle"),Z([F(1203,"number",-100)],X.prototype,"underlinePosition"),Z([F(1204,"number",50)],X.prototype,"underlineThickness"),Z([F(1205)],X.prototype,"paintType"),Z([F(1206,"number",2)],X.prototype,"charstringType"),Z([F(1207,"number[]",[.001,0,0,.001,0,0])],X.prototype,"fontMatrix"),Z([F(13)],X.prototype,"uniqueId"),Z([F(5,"number[]",[0,0,0,0])],X.prototype,"fontBBox"),Z([F(1208)],X.prototype,"strokeWidth"),Z([F(14)],X.prototype,"xuid"),Z([F(15)],X.prototype,"charset"),Z([F(16)],X.prototype,"encoding"),Z([F(17)],X.prototype,"charStrings"),Z([F(18,"number[]",[0,0])],X.prototype,"private");var ts=Object.defineProperty,es=(i,t,e)=>t in i?ts(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nr=(i,t,e)=>(es(i,typeof t!="symbol"?t+"":t,e),e);function it(i,t=i){return e=>{ue.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(ue.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const tn=class xe{constructor(t){nr(this,"tables",new Map),nr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,o=Array.from({length:n}),s=e.get(0);for(let a=0;a<n;a+=1)o[a]=e.get(r[a])||s;return o}getPathCommands(t,e,r,n,o){var s;return(s=this.charToGlyph(t))==null?void 0:s.getPathCommands(e,r,n,o,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,o={},s){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const c=h[l];s.call(this,c,e,r,n,o),c.advanceWidth&&(e+=c.advanceWidth*a),o.letterSpacing?e+=o.letterSpacing*n:o.tracking&&(e+=o.tracking/1e3*n)}return e}clone(){return new xe(this.tableViews)}delete(t){const e=xe.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=xe.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=xe.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const o=this.tableViews.get(t);if(!o)return;r=new n(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};nr(tn,"tableDefinitions",new Map);let ue=tn;class ut extends Mt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var en=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,ns=(i,t,e)=>t in i?en(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fe=(i,t,e,r)=>{for(var n=r>1?void 0:r?rs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&en(t,e,n),n},ir=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ut{constructor(t,e,r,n){super(t,e,r,n),ir(this,"_glyphs"),ir(this,"privateDict"),ir(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ri(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Zr(e,n),this.topDictIndex=new Ne(e,this.nameIndex.endOffset),this.stringIndex=new Zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ne(e,this.stringIndex.endOffset),this.topDict=new X(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Ee(e,r+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ne(e,r+s+this.privateDict.subrs))),this.charStringsIndex=new Ne(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Hi:this.topDict.charset===1?this.charset=Qi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Je:this.topDict.encoding===1?this.encoding=$i:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let o,s,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(o=0;o<e;o+=1)s=n.readUint16(),h.push(ze(r,s));else if(l===1)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint8(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else if(l===2)for(;h.length<=e;)for(s=n.readUint16(),a=n.readUint16(),o=0;o<=a;o+=1)h.push(ze(r,s)),s+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const o={},s=e.readUint8();if(s===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),o[n]=r}else if(s===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let c=h;c<=h+l;c+=1)o[c]=n,n+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},fe([m("uint8")],f.Cff.prototype,"majorVersion",2),fe([m("uint8")],f.Cff.prototype,"minorVersion",2),fe([m("uint8")],f.Cff.prototype,"headerSize",2),fe([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=fe([it("CFF ","cff")],f.Cff);var is=Object.defineProperty,Ue=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&is(t,e,n),n};const de=class ri extends Mt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new ri;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};Ue([m("uint16")],de.prototype,"format"),Ue([m("uint16")],de.prototype,"length"),Ue([m("uint16")],de.prototype,"language"),Ue([m({type:"uint8",size:256})],de.prototype,"glyphIndexArray");let sr=de;var ss=Object.defineProperty,or=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ss(t,e,n),n};class pe extends Mt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<o[0].firstCode||l>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(l-o[0].firstCode)>=s.length?h=0:(h=s[o[0].idRangeOffset+(l-o[0].firstCode)],h!==0&&(h=h+o[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const c=r[l];for(let u=0,d=o[c].entryCount;u<d;u++)if(o[c].idRangeOffset+u>=s.length?h=0:(h=s[o[c].idRangeOffset+u],h!==0&&(h=h+o[c].idDelta)),h!==0&&h<t){const g=(l<<8|u+o[c].firstCode)%65535;e.set(g,h)}}return e}}or([m("uint16")],pe.prototype,"format"),or([m("uint16")],pe.prototype,"length"),or([m("uint16")],pe.prototype,"language");function rn(i){return i>32767?i-65536:i<-32767?i+65536:i}function ar(i,t){let e;const r=[];let n={};return i.forEach((o,s)=>{t&&s>t||((!e||s!==e.unicode+1||o!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:s,startId:o,delta:rn(o-s)}):(n.start=Number(s),n.startId=o,n.delta=rn(o-s))),e={unicode:s,glyphIndex:o})}),e&&(n.end=e.unicode,r.push(n)),r}var os=Object.defineProperty,Vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&os(t,e,n),n};const jt=class ni extends Mt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=ar(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),o=2*2**n,s=new ni(new ArrayBuffer(24+e.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=r*2,s.searchRange=o,s.entrySelector=n,s.rangeShift=2*r-o,s.endCode=[...e.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...e.map(a=>a.start),65535],s.idDelta=[...e.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:r},()=>0),s}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let c=n[l],u=o[l];c<=u;++c)if(s[l]===0)t.set(c,(c+a[l])%65536);else{const d=l+s[l]/2+(c-n[l])-r,g=h[d];g!==0?t.set(c,(g+a[l])%65536):t.set(c,0)}return t.delete(65535),t}};Vt([m("uint16")],jt.prototype,"format"),Vt([m("uint16")],jt.prototype,"length"),Vt([m("uint16")],jt.prototype,"language"),Vt([m("uint16")],jt.prototype,"segCountX2"),Vt([m("uint16")],jt.prototype,"searchRange"),Vt([m("uint16")],jt.prototype,"entrySelector"),Vt([m("uint16")],jt.prototype,"rangeShift");let lr=jt;var as=Object.defineProperty,ge=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&as(t,e,n),n};class Rt extends Mt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}ge([m("uint16")],Rt.prototype,"format"),ge([m("uint16")],Rt.prototype,"length"),ge([m("uint16")],Rt.prototype,"language"),ge([m("uint16")],Rt.prototype,"firstCode"),ge([m("uint16")],Rt.prototype,"entryCount");var ls=Object.defineProperty,ye=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&ls(t,e,n),n};const Kt=class ii extends Mt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=ar(t),r=new ii(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const o=e[r];let s=o.startGlyphCode,a=o.startCharCode;const h=o.endCharCode;for(;a<=h;)t.set(a++,s++)}return t}};ye([m("uint16")],Kt.prototype,"format"),ye([m("uint16")],Kt.prototype,"reserved"),ye([m("uint32")],Kt.prototype,"length"),ye([m("uint32")],Kt.prototype,"language"),ye([m("uint32")],Kt.prototype,"nGroups");let hr=Kt;var hs=Object.defineProperty,cr=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&hs(t,e,n),n};class me extends Mt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:o}=e[r];o.forEach(s=>{t.set(s.unicodeValue,s.glyphID)})}return t}}cr([m("uint16")],me.prototype,"format"),cr([m("uint32")],me.prototype,"length"),cr([m("uint32")],me.prototype,"numVarSelectorRecords");var nn=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(i,t,e)=>t in i?nn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ur=(i,t,e,r)=>{for(var n=r>1?void 0:r?cs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&nn(t,e,n),n},sn=(i,t,e)=>(us(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ut{constructor(){super(...arguments),sn(this,"_unicodeToGlyphIndexMap"),sn(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),r=lr.from(t),n=sr.from(t),o=e?hr.from(t):void 0,s=4+(o?32:24),a=s+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),c=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(r.view,s),c.view.writeBytes(n.view,a),o&&c.view.writeBytes(o.view,h),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,o=r.length;n<o;n++){const s=r[n],a=e.get(s);t.has(a)?t.get(a).push(s):t.set(a,[s])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new sr(this.view.buffer,e.offset);break;case 2:n=new pe(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new lr(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Rt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new hr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new me(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,c,u;const t=this.readSubtables(),e=(a=t.find(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,o=(c=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:c.view,s=(u=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}},ur([m("uint16")],f.Cmap.prototype,"version",2),ur([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=ur([it("cmap")],f.Cmap);class fs extends tr{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const o=t[n];r.push(o),o.lastPointOfContour&&(e.push(r),r=[])}return he(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const o=t[n],s={x:e.xScale*o.x+e.scale10*o.y+e.dx,y:e.scale01*o.x+e.yScale*o.y+e.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};r.push(s)}return r}_parseGlyphCoordinate(t,e,r,n,o){let s;return(e&n)>0?(s=t.view.readUint8(),e&o||(s=-s),s=r+s):(e&o)>0?s=r:s=r+t.view.readInt16(),s}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();he(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const c=t.view.byteOffset,u=a[a.length-1]+1;he(u<2e4,`Bad numberOfCoordinates:${c}`);const d=[];let g,y=0;for(;y<u;)if(g=t.view.readUint8(),d.push(g),y++,g&8&&y<u){const w=t.view.readUint8();for(let p=0;p<w;p++)d.push(g),y++}if(he(d.length===u,`Bad flags length: ${d.length}, numberOfCoordinates: ${u}`),a.length>0){const w=[];let p;if(u>0){for(let x=0;x<u;x+=1)g=d[x],p={},p.onCurve=!!(g&1),p.lastPointOfContour=a.includes(x),w.push(p);let C=0;for(let x=0;x<u;x+=1)g=d[x],p=w[x],p.x=this._parseGlyphCoordinate(t,g,C,2,16),C=p.x;let P=0;for(let x=0;x<u;x+=1)g=d[x],p=w[x],p.y=this._parseGlyphCoordinate(t,g,P,4,32),P=p.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let c;if(h.matchedPoints===void 0)c=this._transformPoints(l.points,h);else{he(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let d=l.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],g)[0],g.dx=u.x-d.x,g.dy=u.y-d.y,c=this._transformPoints(l.points,g)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,h=s.length;a<h;++a){const l=s[a];let c=l[l.length-1],u=l[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let d=0,g=l.length;d<g;++d)if(c=u,u=l[(d+1)%g],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let y=u;u.onCurve||(y={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:y.x,y:y.y})}o.push({type:"Z"})}this.pathCommands=o}}class ds extends er{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new fs({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var on=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,gs=(i,t,e)=>t in i?on(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ys=(i,t,e,r)=>{for(var n=r>1?void 0:r?ps(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&on(t,e,n),n},ms=(i,t,e)=>(gs(i,t+"",e),e);const Jt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ut{constructor(){super(...arguments),ms(this,"_glyphs")}static from(t){const e=t.reduce((n,o)=>n+o.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new ds(this._sfnt))}},f.Glyf=ys([it("glyf")],f.Glyf);var ws=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,bs=(i,t,e,r)=>{for(var n=r>1?void 0:r?vs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ws(t,e,n),n};f.Gpos=class extends ut{},f.Gpos=bs([it("GPOS","gpos")],f.Gpos);var Ms=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,Wt=(i,t,e,r)=>{for(var n=r>1?void 0:r?xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ms(t,e,n),n};f.Gsub=class extends ut{},Wt([m("uint16")],f.Gsub.prototype,"majorVersion",2),Wt([m("uint16")],f.Gsub.prototype,"minorVersion",2),Wt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),Wt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Wt([it("GSUB","gsub")],f.Gsub);var Cs=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,rt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ss(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Cs(t,e,n),n};f.Head=class extends ut{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},rt([m("fixed")],f.Head.prototype,"version",2),rt([m("fixed")],f.Head.prototype,"fontRevision",2),rt([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),rt([m("uint32")],f.Head.prototype,"magickNumber",2),rt([m("uint16")],f.Head.prototype,"flags",2),rt([m("uint16")],f.Head.prototype,"unitsPerEm",2),rt([m({type:"longDateTime"})],f.Head.prototype,"created",2),rt([m({type:"longDateTime"})],f.Head.prototype,"modified",2),rt([m("int16")],f.Head.prototype,"xMin",2),rt([m("int16")],f.Head.prototype,"yMin",2),rt([m("int16")],f.Head.prototype,"xMax",2),rt([m("int16")],f.Head.prototype,"yMax",2),rt([m("uint16")],f.Head.prototype,"macStyle",2),rt([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),rt([m("int16")],f.Head.prototype,"fontDirectionHint",2),rt([m("int16")],f.Head.prototype,"indexToLocFormat",2),rt([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=rt([it("head")],f.Head);var Ps=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ps(t,e,n),n};f.Hhea=class extends ut{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Hhea.prototype,"version",2),pt([m("int16")],f.Hhea.prototype,"ascent",2),pt([m("int16")],f.Hhea.prototype,"descent",2),pt([m("int16")],f.Hhea.prototype,"lineGap",2),pt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([it("hhea")],f.Hhea);var an=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,Os=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Is=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ts(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&an(t,e,n),n},As=(i,t,e)=>(Os(i,t+"",e),e);f.Hmtx=class extends ut{constructor(){super(...arguments),As(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((o,s)=>(s<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=Is([it("hmtx")],f.Hmtx);var Ds=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,zs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ns(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ds(t,e,n),n};f.Kern=class extends ut{},f.Kern=zs([it("kern","kern")],f.Kern);var ln=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,Us=(i,t,e)=>t in i?ln(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ls=(i,t,e,r)=>{for(var n=r>1?void 0:r?Es(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ln(t,e,n),n},$s=(i,t,e)=>(Us(i,t+"",e),e);f.Loca=class extends ut{constructor(){super(...arguments),$s(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(o=>{e?n.view.writeUint32(o):n.view.writeUint16(o/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Ls([it("loca")],f.Loca);var ks=Object.defineProperty,js=Object.getOwnPropertyDescriptor,ft=(i,t,e,r)=>{for(var n=r>1?void 0:r?js(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&ks(t,e,n),n};f.Maxp=class extends ut{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ft([m("fixed")],f.Maxp.prototype,"version",2),ft([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ft([m("uint16")],f.Maxp.prototype,"maxPoints",2),ft([m("uint16")],f.Maxp.prototype,"maxContours",2),ft([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ft([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ft([m("uint16")],f.Maxp.prototype,"maxZones",2),ft([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ft([m("uint16")],f.Maxp.prototype,"maxStorage",2),ft([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ft([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ft([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ft([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ft([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ft([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ft([it("maxp")],f.Maxp);var hn=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Fs=(i,t,e)=>t in i?hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Le=(i,t,e,r)=>{for(var n=r>1?void 0:r?Bs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&hn(t,e,n),n},Gs=(i,t,e)=>(Fs(i,t+"",e),e);const cn={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},fr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Vs={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},un={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ut{constructor(){super(...arguments),Gs(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=fr.Macintosh,o=Vs.Default,s=0;e.some(h=>h.platform===fr.Microsoft&&h.encoding===un.UCS2&&h.language===1033)&&(n=fr.Microsoft,o=un.UCS2,s=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===o&&l.language===s&&cn[l.nameId]&&(a[cn[l.nameId]]=s===0?Ni(l.name):zi(l.name))}return a}},Le([m("uint16")],f.Name.prototype,"format",2),Le([m("uint16")],f.Name.prototype,"count",2),Le([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Le([it("name")],f.Name);var Rs=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,O=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ws(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Rs(t,e,n),n};f.Os2=class extends ut{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([m("uint16")],f.Os2.prototype,"version",2),O([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([m("uint16")],f.Os2.prototype,"usWeightClass",2),O([m("uint16")],f.Os2.prototype,"usWidthClass",2),O([m("uint16")],f.Os2.prototype,"fsType",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([m("uint16")],f.Os2.prototype,"sFamilyClass",2),O([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([m("uint16")],f.Os2.prototype,"fsSelection",2),O([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([m("int16")],f.Os2.prototype,"sTypoAscender",2),O([m("int16")],f.Os2.prototype,"sTypoDescender",2),O([m("int16")],f.Os2.prototype,"sTypoLineGap",2),O([m("uint16")],f.Os2.prototype,"usWinAscent",2),O([m("uint16")],f.Os2.prototype,"usWinDescent",2),O([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([m("int16")],f.Os2.prototype,"sCapHeight",2),O([m("uint16")],f.Os2.prototype,"usDefaultChar",2),O([m("uint16")],f.Os2.prototype,"usBreakChar",2),O([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([it("OS/2","os2")],f.Os2);var qs=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,It=(i,t,e,r)=>{for(var n=r>1?void 0:r?Hs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&qs(t,e,n),n};f.Post=class extends ut{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},It([m("fixed")],f.Post.prototype,"format",2),It([m("fixed")],f.Post.prototype,"italicAngle",2),It([m("int16")],f.Post.prototype,"underlinePosition",2),It([m("int16")],f.Post.prototype,"underlineThickness",2),It([m("uint32")],f.Post.prototype,"isFixedPitch",2),It([m("uint32")],f.Post.prototype,"minMemType42",2),It([m("uint32")],f.Post.prototype,"maxMemType42",2),It([m("uint32")],f.Post.prototype,"minMemType1",2),It([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=It([it("post")],f.Post);var Qs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,gt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Xs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Qs(t,e,n),n};f.Vhea=class extends ut{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},gt([m("fixed")],f.Vhea.prototype,"version",2),gt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),gt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),gt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),gt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),gt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),gt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),gt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),gt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),gt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),gt([m("int16")],f.Vhea.prototype,"caretOffset",2),gt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),gt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),gt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=gt([it("vhea")],f.Vhea);var fn=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Zs=(i,t,e)=>t in i?fn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ks=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ys(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&fn(t,e,n),n},Js=(i,t,e)=>(Zs(i,t+"",e),e);f.Vmtx=class extends ut{constructor(){super(...arguments),Js(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const t=this._sfnt.maxp.numGlyphs,e=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((s,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Ks([it("vmtx")],f.Vmtx);var dn=Object.defineProperty,to=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&dn(t,e,n),n},$e=(i,t,e)=>(to(i,typeof t!="symbol"?t+"":t,e),e);class st extends Oe{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checksum(t){const e=Gt(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let o=0,s=r/4;o<s;o+=4)o*4<r-4&&(n+=e.getUint32(o*4,!1));return n&4294967295}static from(t){const e=u=>u+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((u,d)=>u+e(d.byteLength),0),o=new this(new ArrayBuffer(12+r*16+n));o.scalerType=65536,o.numTables=r;const s=Math.log(2);o.searchRange=Math.floor(Math.log(r)/s)*16,o.entrySelector=Math.floor(o.searchRange/s),o.rangeShift=r*16-o.searchRange;let a=12+r*16,h=0;const l=o.getDirectories();t.tableViews.forEach((u,d)=>{const g=l[h++];g.tag=d,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,o.view.writeBytes(u,a),a+=e(g.length)});const c=o.createSfnt().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(o.view),o}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Zt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(st,"signature",new Set([65536,1953658213,1954115633])),we([m("uint32")],st.prototype,"scalerType"),we([m("uint16")],st.prototype,"numTables"),we([m("uint16")],st.prototype,"searchRange"),we([m("uint16")],st.prototype,"entrySelector"),we([m("uint16")],st.prototype,"rangeShift");var eo=Object.defineProperty,ro=(i,t,e)=>t in i?eo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,dr=(i,t,e)=>(ro(i,typeof t!="symbol"?t+"":t,e),e);class ke extends st{constructor(){super(...arguments),dr(this,"format","OpenType"),dr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}dr(ke,"signature",new Set([1330926671]));var no=Object.defineProperty,ve=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&no(t,e,n),n};class qt extends Mt{constructor(t,e){super(t,e,20)}}ve([m({type:"char",size:4})],qt.prototype,"tag"),ve([m("uint32")],qt.prototype,"offset"),ve([m("uint32")],qt.prototype,"compLength"),ve([m("uint32")],qt.prototype,"origLength"),ve([m("uint32")],qt.prototype,"origChecksum");var pn=Object.defineProperty,io=(i,t,e)=>t in i?pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vt=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&pn(t,e,n),n},je=(i,t,e)=>(io(i,typeof t!="symbol"?t+"":t,e),e);const yt=class Ar extends Oe{constructor(){super(...arguments),je(this,"format","WOFF"),je(this,"mimeType","font/woff"),je(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":ke.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(Gt(t).getUint32(0))}static checkSum(t){const e=Gt(t),r=e.byteLength,n=Math.floor(r/4);let o=0,s=0;for(;s<n;)o+=e.getUint32(4*s++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)o+=e.getUint8(h)<<a*8,h++,a--}return o%4294967296}static from(t,e=new ArrayBuffer(0)){const r=u=>u+3&-4,n=[];t.tableViews.forEach((u,d)=>{const g=Gt(bi(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));n.push({tag:d,view:g.byteLength<u.byteLength?g:u,rawView:u})});const o=n.length,s=n.reduce((u,d)=>u+r(d.view.byteLength),0),a=new Ar(new ArrayBuffer(44+20*o+s+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=o,a.totalSfntSize=12+16*o+n.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+o*20,l=0;const c=a.getDirectories();return n.forEach(u=>{const d=c[l++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=Ar.checkSum(u.rawView),d.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,h),h+=r(d.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new qt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ue(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,o=e.compLength,s=e.origLength,a=n+o;return t[r]=o>=s?new DataView(this.view.buffer,n,o):new DataView(Mi(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};je(yt,"signature",new Set([2001684038])),vt([m("uint32")],yt.prototype,"signature"),vt([m("uint32")],yt.prototype,"flavor"),vt([m("uint32")],yt.prototype,"length"),vt([m("uint16")],yt.prototype,"numTables"),vt([m("uint16")],yt.prototype,"reserved"),vt([m("uint32")],yt.prototype,"totalSfntSize"),vt([m("uint16")],yt.prototype,"majorVersion"),vt([m("uint16")],yt.prototype,"minorVersion"),vt([m("uint32")],yt.prototype,"metaOffset"),vt([m("uint32")],yt.prototype,"metaLength"),vt([m("uint32")],yt.prototype,"metaOrigLength"),vt([m("uint32")],yt.prototype,"privOffset"),vt([m("uint32")],yt.prototype,"privLength");let Ut=yt;function gn(i){if(st.is(i))return new st(i);if(ke.is(i))return new ke(i);if(Ut.is(i))return new Ut(i)}var so=Object.defineProperty,oo=(i,t,e)=>t in i?so(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,be=(i,t,e)=>(oo(i,typeof t!="symbol"?t+"":t,e),e);const yn=class si{constructor(){be(this,"fallbackFont"),be(this,"_loading",new Map),be(this,"_loaded",new Map),be(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...si.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((c,u)=>{c!==l&&(c.cancel(),this._loading.delete(u))}),l.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,c),i&&this.injectStyleTag(d,h))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(h)})}};be(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,c=i==null?void 0:i.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,p)=>w-p),d=new Map;u.forEach(w=>{const p=a.get(w)??0;let C=d.get(p);C||d.set(p,C=new Set),C.add(w)});const y=[],g=w=>{const p=l[w],C=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},P=h[w],x=h[w+1]??P,T={...p,...C,rawGlyphIndex:w,glyphIndex:y.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+P,x-P)};return y.push(T),T};return g(0),u.forEach(w=>g(a.get(w))),y.slice().forEach(w=>{const{view:p}=w;if(!p.byteLength||p.getInt16(0)>=0)return;let P=10,x;do{x=p.getUint16(P);const T=P+2,v=p.getUint16(T);P+=4,Jt.ARG_1_AND_2_ARE_WORDS&x?P+=4:P+=2,Jt.WE_HAVE_A_SCALE&x?P+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&x?P+=4:Jt.WE_HAVE_A_TWO_BY_TWO&x&&(P+=8);const M=g(v);p.setUint16(T,M.glyphIndex)}while(Jt.MORE_COMPONENTS&x)}),y}function bn(s,t){const e=vn(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=f.Loca.from([...e.map(d=>{const y=h;return h+=d.view.byteLength,y}),h],n.indexToLocFormat);const l=e.reduce((d,y,g)=>(y.unicodes.forEach(w=>d.set(w,g)),d),new Map);s.cmap=f.Cmap.from(l),s.glyf=f.Glyf.from(e.map(d=>d.view)),o.numOfLongHorMetrics=r,s.hmtx=f.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=f.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,s.post=u,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function ao(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Ut)e=s.sfnt.clone(),r="woff";else{const i=Gt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Ut.is(i))e=new Ut(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function pr(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:d=0,shadowColor:y="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=lo[o],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=c,s.shadowOffsetY=u,s.shadowBlur=d,s.shadowColor=y}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,i=-(this.y-e.y),o=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-i*o),e.y-(n*o+i*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,i=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=i*Math.abs(e),this}skew(t,e=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(t)*i),this.y=r.y+(i+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class Q{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new Q;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new Q(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new Q(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var ho=Object.defineProperty,co=(s,t,e)=>t in s?ho(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,uo=(s,t,e)=>(co(s,t+"",e),e);class yt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){uo(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=i,c[5]=h,c[6]=r,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],c=r[4],u=r[7],d=r[2],y=r[5],g=r[8],w=n[0],p=n[3],C=n[6],P=n[1],x=n[4],T=n[7],v=n[2],M=n[5],I=n[8];return i[0]=o*w+a*P+h*v,i[3]=o*p+a*x+h*M,i[6]=o*C+a*T+h*I,i[1]=l*w+c*P+u*v,i[4]=l*p+c*x+u*M,i[7]=l*C+c*T+u*I,i[2]=d*w+y*P+g*v,i[5]=d*p+y*x+g*M,i[8]=d*C+y*T+g*I,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*o-a*l,d=a*h-c*i,y=l*i-o*h,g=e*u+r*d+n*y;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=u*w,t[1]=(n*l-c*r)*w,t[2]=(a*r-n*o)*w,t[3]=d*w,t[4]=(c*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=y*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const gr=new yt;function Mn(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function xn(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,c=Math.cos(r)*h+Math.sin(r)*l,u=-Math.sin(r)*h+Math.cos(r)*l;let d=t*t,y=e*e;const g=c*c,w=u*u,p=g/d+w/y;if(p>1){const U=Math.sqrt(p);t=U*t,e=U*e,d=t*t,y=e*e}const C=d*w+y*g,P=(d*y-C)/C;let x=Math.sqrt(Math.max(0,P));n===i&&(x=-x);const T=x*t*u/e,v=-x*e*c/t,M=Math.cos(r)*T-Math.sin(r)*v+(o.x+a.x)/2,I=Math.sin(r)*T+Math.cos(r)*v+(o.y+a.y)/2,S=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);s.ellipse(M,I,t,e,r,S,S+_,i===1)}function te(s,t){return s-(t-s)}function yr(s,t){const e=new b,r=new b;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=te(e.x,r.x),h=te(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),xn(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(s,t,e=0){let a=0,h=!0,l="",c="";const u=[];function d(p,C,P){const x=new SyntaxError(`Unexpected character "${p}" at index ${C}.`);throw x.partial=P,x}function y(){l!==""&&(c===""?u.push(Number(l)):u.push(Number(l)*10**Number(c))),l="",c=""}let g;const w=s.length;for(let p=0;p<w;p++){if(g=s[p],Array.isArray(t)&&t.includes(u.length%e)&&Z.FLAGS.test(g)){a=1,l=g,y();continue}if(a===0){if(Z.WHITESPACE.test(g))continue;if(Z.DIGIT.test(g)||Z.SIGN.test(g)){a=1,l=g;continue}if(Z.POINT.test(g)){a=2,l=g;continue}Z.COMMA.test(g)&&(h&&d(g,p,u),h=!0)}if(a===1){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.POINT.test(g)){l+=g,a=2;continue}if(Z.EXP.test(g)){a=3;continue}Z.SIGN.test(g)&&l.length===1&&Z.SIGN.test(l[0])&&d(g,p,u)}if(a===2){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.EXP.test(g)){a=3;continue}Z.POINT.test(g)&&l[l.length-1]==="."&&d(g,p,u)}if(a===3){if(Z.DIGIT.test(g)){c+=g;continue}if(Z.SIGN.test(g)){if(c===""){c+=g;continue}c.length===1&&Z.SIGN.test(c)&&d(g,p,u)}}Z.WHITESPACE.test(g)?(y(),a=0,h=!1):Z.COMMA.test(g)?(y(),a=0,h=!0):Z.SIGN.test(g)?(y(),a=1,l=g):Z.POINT.test(g)?(y(),a=2,l=g):d(g,p,u)}return y(),u}function Cn(s){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,i=s.length;n<i;n++){const o=s[n];switch(o.type){case"m":case"M":if(o.x===e.x&&o.y===e.y)continue;r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y,t.x=o.x,t.y=o.y;break;case"h":case"H":r+=`${o.type} ${o.x}`,e.x=o.x;break;case"v":case"V":r+=`${o.type} ${o.y}`,e.y=o.y;break;case"l":case"L":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"c":case"C":r+=`${o.type} ${o.x1} ${o.y1} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"s":case"S":r+=`${o.type} ${o.x2} ${o.y2} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"q":case"Q":r+=`${o.type} ${o.x1} ${o.y1} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"t":case"T":r+=`${o.type} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"a":case"A":r+=`${o.type} ${o.rx} ${o.ry} ${o.angle} ${o.largeArcFlag} ${o.sweepFlag} ${o.x} ${o.y}`,e.x=o.x,e.y=o.y;break;case"z":case"Z":r+=o.type,e.x=t.x,e.y=t.y;break}}return r}const fo=/[a-df-z][^a-df-z]*/gi;function mr(s){const t=[],e=s.match(fo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let h;switch(o){case"m":case"M":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,c=h.length;l<c;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,c=h.length;l<c;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var po=Object.defineProperty,go=(s,t,e)=>t in s?po(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wr=(s,t,e)=>(go(s,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new b){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const c=r[n],d=r[n+1]-c,y=(o-c)/d;return(n+y)/(i-1)}getTangent(t,e=new b){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new b){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,i=(r+n)/2;for(;n-r>e;){i=(r+n)/2;const o=this.getPoint(i);if(o.distanceTo(t)<e)return i;o.x<t.x?r=i:n=i}return i}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return Cn(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class Be extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new b){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new b){const{start:r,end:n}=this,i=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(i),Math.sin(i))}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function yo(s,t){const e=1-s;return e*e*t}function mo(s,t){return 2*(1-s)*s*t}function wo(s,t){return s*s*t}function Pn(s,t,e,r){return yo(s,t)+mo(s,e)+wo(s,r)}function vo(s,t){const e=1-s;return e*e*e*t}function bo(s,t){const e=1-s;return 3*e*e*s*t}function Mo(s,t){return 3*(1-s)*s*s*t}function xo(s,t){return s*s*s*t}function _n(s,t,e,r,n){return vo(s,t)+bo(s,e)+Mo(s,r)+xo(s,n)}class Tn extends _t{constructor(t=new b,e=new b,r=new b,n=new b){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new b){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(_n(t,r.x,n.x,i.x,o.x),_n(t,r.y,n.y,i.y,o.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=b.MAX,e=b.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((u,d)=>{for(const y of u)for(let g=0;g<=d;g++){const w=g/d-.5,p=Math.min(1,Math.max(0,y+w)),C=this.getPoint(p);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:i}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,i.x,i.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Co=new yt,On=new yt,In=new yt,Fe=new b;class An extends _t{constructor(t=new b,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=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 o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,d=h-this.center.y;a=u*l-d*c+this.center.x,h=u*c+d*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,c=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),d=Math.abs(n-i),y=d>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const p=n+Math.PI,C=h+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),P=l+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:C,y:P},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:c,y:u}]}else{const p=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),C=l+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:y,sweepFlag:g,x:p,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,_o(t)?So(this,t):Po(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=b.MAX,e=b.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),c=Math.sin(o),u=Math.sqrt(n*n*l*l+i*i*c*c),d=Math.sqrt(n*n*c*c+i*i*l*l);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,h-d),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,h+d),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function So(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new b(e*n,e*i),a=new b(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),c=Co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),u=On.copy(c).invert(),g=In.copy(u).transpose().multiply(u).elements,w=To(g[0],g[1],g[4]),p=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(s.radiusX=1/p,s.radiusY=1/C,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(p,0,0,0,C,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(c),M=I=>{const{x:S,y:_}=new b(Math.cos(I),Math.sin(I)).applyMatrix3(v);return Math.atan2(_,S)};s.startAngle=M(s.startAngle),s.endAngle=M(s.endAngle),Dn(t)&&(s.clockwise=!s.clockwise)}}function Po(s,t){const e=Nn(t),r=zn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,Dn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function Dn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function _o(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(s),n=zn(s);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function To(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,c=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+c),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-c):(r=.5*c,n=-.5*c),l>0?i=l+c:i=l-c,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class Ht extends _t{constructor(t=new b,e=new b){super(),this.start=t,this.end=e}getPoint(t,e=new b){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}var Oo=Object.defineProperty,Io=(s,t,e)=>t in s?Oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ao=(s,t,e)=>(Io(s,t+"",e),e);class Do extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Ao(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new b(t+.5*this.size,e-.5*this.size),n=new b(t-.5*this.size,e-.5*this.size),i=new b(t,e+.5*this.size),o=new Be(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new Be(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new Be(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new b(t,e+this.size),c=new b(t+this.size,e),u=new b().lerpVectors(c,l,.75),d=new b(t-this.size,e),y=new b().lerpVectors(d,l,.75),g=new Ht(c,u),w=new Ht(y,d);return this.curves=[o,g,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}var No=Object.defineProperty,zo=(s,t,e)=>t in s?No(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vr=(s,t,e)=>(zo(s,typeof t!="symbol"?t+"":t,e),e);class Eo extends _t{constructor(t,e=0,r=0,n=0,i=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=i,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new b(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class En extends _t{constructor(t=new b,e=new b,r=new b){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new b){const{start:r,control:n,end:i}=this;return e.set(Pn(t,r.x,n.x,i.x),Pn(t,r.y,n.y,i.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=b.MAX,e=b.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Uo=Object.defineProperty,Lo=(s,t,e)=>t in s?Uo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Un=(s,t,e)=>(Lo(s,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,Un(this,"curves",[]),Un(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,i=[new b(t-r,e-n),new b(t+r,e-n),new b(t+r,e+n),new b(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new Ht(i[o].clone(),i[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new b){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],c=r[i>r.length-3?r.length-1:i+2];return e.set(Sn(o,a.x,h.x,l.x,c.x),Sn(o,a.y,h.y,l.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,ko=(s,t,e)=>t in s?$o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Me=(s,t,e)=>(ko(s,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new b),Me(this,"autoClose",!1),Me(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}getPoint(t,e=new b){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}i++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let i=0,o=r.length;i<o;i++){const h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const c=h[l];n!=null&&n.equals(c)||(e.push(c),n=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Ht(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Ht(this.currentPoint.clone(),new b(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new Tn(this.currentPoint.clone(),new b(t,e),new b(r,n),new b(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new En(this.currentPoint.clone(),new b(t,e),new b(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,h=!0){const l=new An(new b(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new Ln(new b(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new $n([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new Q(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function jo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(s,t,e,r){const n=t.clone().sub(s),i=r.clone().sub(e),o=e.clone().sub(s),a=n.cross(i);if(a===0)return new b((s.x+e.x)/2,(s.y+e.y)/2);const h=o.cross(i)/a;return Math.abs(h)>1?new b((s.x+e.x)/2,(s.y+e.y)/2):new b(s.x+h*n.x,s.y+h*n.y)}var Fo=Object.defineProperty,Go=(s,t,e)=>t in s?Fo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,br=(s,t,e)=>(Go(s,typeof t!="symbol"?t+"":t,e),e);class vt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(this,"style",{}),t&&(t instanceof vt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof vt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ee().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new ee().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],i=[];e.forEach((a,h)=>{const l=a.getControlPoints(),c=a.isClockwise();i[h]=l,n[h]=c;const u=l[0],d=l[l.length-1]??u;r.push({start:c?d:u,end:c?u:d,index:h})});const o=[];return r.forEach((a,h)=>{o[h]=[],r.forEach((l,c)=>{c!==h&&l.start.equals(a.end)&&o[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];i[h].forEach(u=>{const d=a.getTForPoint(u),y=a.getNormal(d).scale(l?t:-t);u.add(y)})}),o.forEach((a,h)=>{const l=i[h];a.forEach(c=>{const u=i[c],d=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],u[0],u[1]??u[0]);d&&(l[l.length-1].copy(d),u[0].copy(d))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=b.MAX,e=b.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(i=>{if(i.getMinMax(t,e),r&&n>1){const o=n/2,a=i.isClockwise(),h=[];for(let l=0;l<=1;l+=1/i.arcLengthDivisions){const c=i.getPoint(l),u=i.getNormal(l),d=u.clone().scale(a?o:-o),y=u.clone().scale(a?-o:o);h.push(c.clone().add(d),c.clone().add(y),c.clone().add({x:o,y:0}),c.clone().add({x:-o,y:0}),c.clone().add({x:0,y:o}),c.clone().add({x:0,y:-o}),c.clone().add({x:o,y:o}),c.clone().add({x:-o,y:-o}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new Q(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),pr(t,e),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),pr(t,e),this.getControlPoints().forEach(i=>{t.moveTo(i.x,i.y),t.arc(i.x,i.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[jo(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${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(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:i,width:o,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=o*e,h.height=a*e,h.style.width=`${o}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-i),this.drawTo(l,r)),h}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Mr="px",kn=90,jn=["mm","cm","in","pt","pc","px"],xr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function L(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=jn.length;r<n;r++){const i=jn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(s)}const Ro=new yt,Ge=new yt,Bn=new yt,Fn=new yt;function Vo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Wo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Wo(s){const t=new yt,e=Ro;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(L(s.getAttribute("x")),L(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const h=i.slice(0,o),l=Pt(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const c=l[0];let u=0;l.length>=2&&(u=l[1]),e.translate(c,u)}break;case"rotate":if(l.length>=1){let c=0,u=0,d=0;c=l[0]*Math.PI/180,l.length>=3&&(u=l[1],d=l[2]),Ge.makeTranslation(-u,-d),Bn.makeRotation(c),Fn.multiplyMatrices(Bn,Ge),Ge.makeTranslation(u,d),e.multiplyMatrices(Ge,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function qo(s){return new vt().addPath(new ee().arc(L(s.getAttribute("cx")||0),L(s.getAttribute("cy")||0),L(s.getAttribute("r")||0),0,Math.PI*2))}function Ho(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Qo(s){return new vt().addPath(new ee().ellipse(L(s.getAttribute("cx")||0),L(s.getAttribute("cy")||0),L(s.getAttribute("rx")||0),L(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(s){return new vt().moveTo(L(s.getAttribute("x1")||0),L(s.getAttribute("y1")||0)).lineTo(L(s.getAttribute("x2")||0),L(s.getAttribute("y2")||0))}function Yo(s){const t=new vt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(s){var r;const t=new vt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Zo,(n,i,o)=>{const a=L(i),h=L(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(s){var r;const t=new vt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Jo,(n,i,o)=>{const a=L(i),h=L(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ea(s){const t=L(s.getAttribute("x")||0),e=L(s.getAttribute("y")||0),r=L(s.getAttribute("rx")||s.getAttribute("ry")||0),n=L(s.getAttribute("ry")||s.getAttribute("rx")||0),i=L(s.getAttribute("width")),o=L(s.getAttribute("height")),a=1-.551915024494,h=new vt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const l=s.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<l.length;c++)r=Object.assign(r,e[`.${l[c]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));for(let l=s.style.length,c=0;c<l;c++){const u=s.style.item(c),d=s.style.getPropertyValue(u);t[u]=d,r[u]=d}function n(l,c,u=i){s.hasAttribute(l)&&(t[c]=u(s.getAttribute(l))),r[l]&&(t[c]=u(r[l]))}function i(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function o(l){return Math.max(0,Math.min(1,L(l)))}function a(l){return Math.max(0,L(l))}function h(l){return l.split(" ").filter(c=>c!=="").map(c=>L(c))}return n("fill","fill"),n("fill-opacity","fillOpacity",o),n("fill-rule","fillRule"),n("opacity","opacity",o),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",o),n("stroke-width","strokeWidth",a),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",a),n("stroke-dasharray","strokeDasharray",h),n("stroke-dashoffset","strokeDashoffset",L),n("visibility","visibility"),t}function Cr(s,t,e=[]){var u;if(s.nodeType!==1)return e;let r=!1,n=null,i={...t};const o={};switch(s.nodeName){case"svg":i=At(s,i,o);break;case"style":Ho(s,o);break;case"g":i=At(s,i,o);break;case"path":i=At(s,i,o),s.hasAttribute("d")&&(n=Yo(s));break;case"rect":i=At(s,i,o),n=ea(s);break;case"polygon":i=At(s,i,o),n=Ko(s);break;case"polyline":i=At(s,i,o),n=ta(s);break;case"circle":i=At(s,i,o),n=qo(s);break;case"ellipse":i=At(s,i,o),n=Qo(s);break;case"line":i=At(s,i,o),n=Xo(s);break;case"defs":r=!0;break;case"use":{i=At(s,i,o);const y=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(y);g?Cr(g,i,e):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(s);break}if(i.display==="none")return e;Object.assign(t,i);const a=new yt,h=[],l=Vo(s,a,h);n&&(n.matrix(a),e.push(n),n.style=t);const c=s.childNodes;for(let d=0,y=c.length;d<y;d++){const g=c[d];r&&g.nodeName!=="style"&&g.nodeName!=="defs"||Cr(g,t,e)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",Rn=`${Gn}base64,`,Vn=`${Gn}charset=utf8,`;function Wn(s){if(typeof s=="string"){let t;return s.startsWith(Rn)?(s=s.substring(Rn.length,s.length),t=atob(s)):s.startsWith(Vn)?(s=s.substring(Vn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Sr(s){return Cr(Wn(s),{})}function Qt(s,t=!0){if(!s.length)return;const e=b.MAX,r=b.MIN;return s.forEach(n=>n.getMinMax(e,r,t)),new Q(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(s){const{x:t,y:e,width:r,height:n}=Qt(s),i=s.map(o=>o.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}function ra(s){return`data:image/svg+xml;base64,${btoa(Pr(s))}`}function na(s){return new DOMParser().parseFromString(Pr(s),"image/svg+xml").documentElement}function sa(s,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:i,width:o,height:a}=Qt(s),h=document.createElement("canvas");h.width=o*e,h.height=a*e,h.style.width=`${o}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-i),s.forEach(c=>{c.drawTo(l,r)})),h}const ia=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),qn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Hn{constructor(t,e,r){z(this,"boundingBox",new Q);z(this,"textWidth",0);z(this,"textHeight",0);z(this,"glyphHeight",0);z(this,"glyphWidth",0);z(this,"underlinePosition",0);z(this,"underlineThickness",0);z(this,"yStrikeoutPosition",0);z(this,"yStrikeoutSize",0);z(this,"baseline",0);z(this,"centerDiviation",0);z(this,"path",new vt);z(this,"glyphBox",new Q);z(this,"center",new b);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:c}=l,{fontSize:u}=h,d=e/u,y=t.getAdvanceWidth(a,u),g=(r+Math.abs(n))/d,w=r/d,p=(r-i.yStrikeoutPosition)/d,C=i.yStrikeoutSize/d,P=(r-o.underlinePosition)/d,x=o.underlineThickness/d;return this.glyphWidth=y,this.glyphHeight=g,this.underlinePosition=P,this.underlineThickness=x,this.yStrikeoutPosition=p,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*c-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:c}=this.updateGlyph(t),{os2:u,ascender:d,descender:y}=t,g=d,w=y,p=u.sTypoAscender,{left:C,top:P}=o,{fontSize:x,fontStyle:T}=a;let v=C,M=P+h,I;const S=new vt;if(e&&(v+=(l-c)/2,Math.abs(n-i)>.1&&(M-=(g-p)/(g+Math.abs(w))*l),I=void 0),e&&!ia.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){S.addCommands(t.getPathCommands(r,v,P+h-(l-c)/2,x)??[]);const U={y:P-(l-c)/2+l/2,x:v+c/2};T==="italic"&&this._italic(S,e?{x:U.x,y:P-(l-c)/2+h}:void 0),S.rotate(90,U)}else I!==void 0?(S.addCommands(t.glyphs.get(I).getPathCommands(v,M,x)),T==="italic"&&this._italic(S,e?{x:v+c/2,y:P+p/(g+Math.abs(w))*l}:void 0)):(S.addCommands(t.getPathCommands(r,v,M,x)??[]),T==="italic"&&this._italic(S,e?{x:v+l/2,y:M}:void 0));S.addCommands(this._decoration());const _=a.fontWeight??400;return _ in qn&&S.bold(qn[_]*x*.05),S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=S,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,c=.1*i;let u;switch(n){case"underline":t?u=o:u=a+e;break;case"line-through":t?u=o+h/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+l},{type:"L",x:u+c,y:a+l},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+h,y:u},{type:"L",x:o+h,y:u+c},{type:"L",x:o,y:u+c},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.boundingBox.top+this.baseline,x:this.boundingBox.left+this.glyphWidth/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r);{t??(t=b.MAX),e??(e=b.MIN);const{left:i,top:o}=this.boundingBox,a=i+this.glyphWidth,h=o+this.glyphHeight;return t.x=Math.min(t.x,i),t.y=Math.min(t.y,o),e.x=Math.max(e.x,a),e.y=Math.max(e.y,h),{min:t,max:e}}}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new Q(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(s){return!s||s==="none"}function Re(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}class Qn{constructor(t,e={},r){z(this,"boundingBox",new Q);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Re(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Hn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){z(this,"boundingBox",new Q);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Re(this.parentStyle),...Re(this.style)},this}addFragment(t,e){const r=new Qn(t,e,this);return this.fragments.push(r),r}}class Xn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll("span").forEach((h,l)=>{var d;const c=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:c.left,top:c.top,width:c.width,height:c.height});const u=h.firstChild;if(u instanceof window.Text){const y=document.createRange();y.selectNodeContents(u);const g=u.data?u.data.length:0;let w=0;for(;w<=g;){y.setStart(u,Math.max(w-1,0)),y.setEnd(u,w);const p=((d=y.getClientRects)==null?void 0:d.call(y))??[y.getBoundingClientRect()];let C=p[p.length-1];p.length>1&&C.width<2&&(C=p[p.length-2]);const P=y.toString();P!==""&&C&&C.width+C.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((y,g)=>{const w=i?"left":"top";return Math.abs(g[w]-y[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const c=this._measureDom(t);c.paragraphs.forEach(y=>{const g=e[y.paragraphIndex];g.boundingBox.left=y.left-r.left,g.boundingBox.top=y.top-r.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height}),c.fragments.forEach(y=>{const g=e[y.paragraphIndex].fragments[y.fragmentIndex];g.boundingBox.left=y.left-r.left,g.boundingBox.top=y.top-r.top,g.boundingBox.width=y.width,g.boundingBox.height=y.height});const u=[];let d=0;return a.forEach(y=>{y.forEach(g=>{const w=c.characters[d],{paragraphIndex:p,fragmentIndex:C,characterIndex:P}=w;u.push({...w,newParagraphIndex:p,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[p].fragments[C].characters[P];x.boundingBox.left=u[d].left,x.boundingBox.top=u[d].top,x.boundingBox.width=u[d].width,x.boundingBox.height=u[d].height,x.textWidth=u[d].textWidth,x.textHeight=u[d].textHeight,d++})}),{paragraphs:e,boundingBox:new Q(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Yn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new ne({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new ne({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,...h}=o;a!==void 0&&i.addFragment(a,h)}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new ne(o,e);i.forEach(h=>{const{content:l,...c}=h;l!==void 0&&a.addFragment(l,c)}),r.push(a)}else if("content"in n){const{content:i,...o}=n;if(i!==void 0){const a=new ne(o,e);a.addFragment(i),r.push(a)}}}return r}}function aa(s){return s}const Bt=new b,se=new yt,Ft=new yt;function Zn(){return{name:"effect",getBoundingBox:s=>{const{characters:t,fontSize:e,effects:r}=s,n=[];return t.forEach(i=>{r==null||r.forEach(o=>{const a=i.glyphBox.clone(),h=_r(s,o);Bt.set(a.left,a.top),Bt.applyMatrix3(h),a.left=Bt.x,a.top=Bt.y,Bt.set(a.right,a.bottom),Bt.applyMatrix3(h),a.width=Bt.x-a.left,a.height=Bt.y-a.top;const l=(o.shadowOffsetX??0)*e,c=(o.shadowOffsetY??0)*e,u=Math.max(.1,o.textStrokeWidth??0)*e;a.left+=l-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?Q.from(...n):void 0},render:(s,t)=>{const{characters:e,renderBoundingBox:r,effects:n}=t;n?n.forEach(i=>{Tt(i,r,s),s.save();const[o,a,h,l,c,u]=_r(t,i).transpose().elements;s.transform(o,l,a,c,h,u),e.forEach(d=>{d.drawTo(s,i)}),s.restore()}):e.forEach(i=>{i.drawTo(s)})}}}function _r(s,t){const{fontSize:e,renderBoundingBox:r}=s,n=(t.offsetX??0)*e,i=(t.offsetY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,h=(t.skewY??0)/360*o,{left:l,top:c,width:u,height:d}=r,y=l+u/2,g=c+d/2;return se.identity(),Ft.makeTranslation(n,i),se.multiply(Ft),Ft.makeTranslation(y,g),se.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),se.multiply(Ft),Ft.makeTranslation(-y,-g),se.multiply(Ft),se.clone()}const la="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ha(s,t,e){if(s==="cover")return 0;if(typeof s=="string")if(s.endsWith("%")){const r=Number(s.substring(0,s.length-1))/100;return Math.ceil(r*e/t)}else return s.endsWith("rem")?Number(s.substring(0,s.length-3)):Math.ceil(Number(s)/t);else return Math.ceil(s/t)}function ca(s,t,e){return typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ua(s,t,e){const r=e.width/t.width,n=e.height/t.height,i=new b(s.x+s.width/2,s.y+s.height/2),a=new b(e.x+e.width/2,e.y+e.height/2).add(i.clone().sub(new b(t.x+t.width/2,t.y+t.height/2)).scale(r,n)),h=a.x-s.width*r/2,l=a.y-s.height*n/2;return new yt().translate(-s.left,-s.top).scale(r,n).translate(h,l)}function Kn(){const s=[],t=[],e=new Map;function r(n){let i=e.get(n);return i||(i=Sr(n),e.set(n,i)),i}return{name:"highlight",paths:s,update:n=>{s.length=0;const{characters:i}=n;let o;const a=[];let h;i.forEach(l=>{const{isVertical:c,computedStyle:u}=l;re(u.highlightImage)||(u.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===u.highlightImage&&(h==null?void 0:h.highlightSize)===u.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===u.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===u.highlightOverflow&&o.length&&(c?o[0].boundingBox.left===l.boundingBox.left:o[0].boundingBox.top===l.boundingBox.top)&&o[0].fontSize===l.fontSize?o.push(l):(o=[],o.push(l),a.push(o))),h=u}),a.filter(l=>l.length).map(l=>({style:l[0].computedStyle,box:Q.from(...l.map(c=>c.glyphBox))})).forEach(l=>{const{style:c,box:u}=l,{fontSize:d}=c,y=ca(c.highlightStrokeWidth,d,u.width),g=ha(c.highlightSize,d,u.width),w=re(c.highlightOverflow)?g?"hidden":"visible":c.highlightOverflow,p=r(re(c.highlightReferImage)?la:c.highlightReferImage),C=r(c.highlightImage),P=Qt(C,!0),x=Qt(p,!1),T=ua(P,x,u),v=g?d*g:u.width,M=d/P.width*2,I=Math.ceil(u.width/v);for(let S=0;S<I;S++){const _=T.clone().translate(S*v,0);C.forEach(U=>{const N=U.clone().matrix(_);N.style.strokeWidth&&(N.style.strokeWidth*=M*y),N.style.strokeMiterlimit&&(N.style.strokeMiterlimit*=M),N.style.strokeDashoffset&&(N.style.strokeDashoffset*=M),N.style.strokeDasharray&&(N.style.strokeDasharray=N.style.strokeDasharray.map(R=>R*M)),s.push(N),t[s.length-1]=w==="hidden"?new Q(u.left,u.top-u.height,u.width,u.height*3):void 0})}})},renderOrder:-1,render:(n,i)=>{s.forEach((o,a)=>{Ce({ctx:n,path:o,clipRect:t[a],fontSize:i.computedStyle.fontSize})})}}}function Jn(s,t,e){return s==="cover"?1:typeof s=="string"?s.endsWith("%")?Number(s.substring(0,s.length-1))/100:s.endsWith("rem")?Number(s.substring(0,s.length-3))*t/e:Number(s)/e:s/e}function ts(){const s=[];return{name:"listStyle",paths:s,update:t=>{s.length=0;const{paragraphs:e,computedStyle:r,fontSize:n,isVertical:i}=t;let o=r.listStyleSize,a;if(!re(r.listStyleImage))a=r.listStyleImage;else if(!re(r.listStyleType)){const u=n*.38/2;switch(o=o==="cover"?u*2:o,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
4
+ }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:o=!0,...s}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(c=>c.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,s),this._loading.set(h,l)),r&&this._loading.forEach((c,u)=>{c!==l&&(c.cancel(),this._loading.delete(u))}),l.when.then(c=>{const u={...t,font:gn(c)??c};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,c),o&&this.injectStyleTag(d,h))})),u}).catch(c=>{if(c instanceof DOMException&&c.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw c}).finally(()=>{this._loading.delete(h)})}};be(yn,"defaultRequestInit",{cache:"force-cache"});let mn=yn;const wn=new mn;function vn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:o,glyf:s}=i,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,c=o==null?void 0:o.metrics,u=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,p)=>w-p),d=new Map;u.forEach(w=>{const p=a.get(w)??0;let C=d.get(p);C||d.set(p,C=new Set),C.add(w)});const g=[],y=w=>{const p=l[w],C=(c==null?void 0:c[w])??{advanceHeight:0,topSideBearing:0},P=h[w],x=h[w+1]??P,T={...p,...C,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(s.view.buffer,s.view.byteOffset+P,x-P)};return g.push(T),T};return y(0),u.forEach(w=>y(a.get(w))),g.slice().forEach(w=>{const{view:p}=w;if(!p.byteLength||p.getInt16(0)>=0)return;let P=10,x;do{x=p.getUint16(P);const T=P+2,v=p.getUint16(T);P+=4,Jt.ARG_1_AND_2_ARE_WORDS&x?P+=4:P+=2,Jt.WE_HAVE_A_SCALE&x?P+=2:Jt.WE_HAVE_AN_X_AND_Y_SCALE&x?P+=4:Jt.WE_HAVE_A_TWO_BY_TWO&x&&(P+=8);const b=y(v);p.setUint16(T,b.glyphIndex)}while(Jt.MORE_COMPONENTS&x)}),g}function bn(i,t){const e=vn(i,t),r=e.length,{head:n,maxp:o,hhea:s,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,o.numGlyphs=r;let h=0;i.loca=f.Loca.from([...e.map(d=>{const g=h;return h+=d.view.byteLength,g}),h],n.indexToLocFormat);const l=e.reduce((d,g,y)=>(g.unicodes.forEach(w=>d.set(w,y)),d),new Map);i.cmap=f.Cmap.from(l),i.glyf=f.Glyf.from(e.map(d=>d.view)),s.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=r,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function ao(i,t){let e,r;if(i instanceof st)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const o=Gt(i);if(st.is(o))e=new st(o).sfnt,r="ttf-buffer";else if(Ut.is(o))e=new Ut(o).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=bn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function pr(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:d=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(h),i.lineDashOffset=l,i.shadowOffsetX=c,i.shadowOffsetY=u,i.shadowBlur=d,i.shadowColor=g}class M{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new M(1/0,1/0)}static get MIN(){return new M(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const r=-t/180*Math.PI,n=this.x-e.x,o=-(this.y-e.y),s=Math.sin(r),a=Math.cos(r);return this.set(e.x+(n*a-o*s),e.y-(n*s+o*a)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,r={x:0,y:0}){const n=t<0?r.x-this.x+r.x:this.x,o=e<0?r.y-this.y+r.y:this.y;return this.x=n*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,r={x:0,y:0}){const n=this.x-r.x,o=this.y-r.y;return this.x=r.x+(n+Math.tan(t)*o),this.y=r.y+(o+Math.tan(e)*n),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new M(this.x,this.y)}}class H{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new H;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,o)=>(n.left=Math.min(n.left,o.left),n.top=Math.min(n.top,o.top),n.right=Math.max(n.right,o.right),n.bottom=Math.max(n.bottom,o.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new H(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new M((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new H(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var ho=Object.defineProperty,co=(i,t,e)=>t in i?ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,uo=(i,t,e)=>(co(i,t+"",e),e);class mt{constructor(t=1,e=0,r=0,n=0,o=1,s=0,a=0,h=0,l=1){uo(this,"elements",[]),this.set(t,e,r,n,o,s,a,h,l)}set(t,e,r,n,o,s,a,h,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=o,c[5]=h,c[6]=r,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,o=this.elements,s=r[0],a=r[3],h=r[6],l=r[1],c=r[4],u=r[7],d=r[2],g=r[5],y=r[8],w=n[0],p=n[3],C=n[6],P=n[1],x=n[4],T=n[7],v=n[2],b=n[5],I=n[8];return o[0]=s*w+a*P+h*v,o[3]=s*p+a*x+h*b,o[6]=s*C+a*T+h*I,o[1]=l*w+c*P+u*v,o[4]=l*p+c*x+u*b,o[7]=l*C+c*T+u*I,o[2]=d*w+g*P+y*v,o[5]=d*p+g*x+y*b,o[8]=d*C+g*T+y*I,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*s-a*l,d=a*h-c*o,g=l*o-s*h,y=e*u+r*d+n*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return t[0]=u*w,t[1]=(n*l-c*r)*w,t[2]=(a*r-n*s)*w,t[3]=d*w,t[4]=(c*e-n*h)*w,t[5]=(n*o-a*e)*w,t[6]=g*w,t[7]=(r*h-l*e)*w,t[8]=(s*e-r*o)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(gr.makeScale(t,e)),this}rotate(t){return this.premultiply(gr.makeRotation(-t)),this}translate(t,e){return this.premultiply(gr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const gr=new mt;function Mn(i,t,e,r){const n=i*e+t*r,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let s=Math.acos(Math.max(-1,Math.min(1,n/o)));return i*r-t*e<0&&(s=-s),s}function xn(i,t,e,r,n,o,s,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(s.x-a.x)/2,l=(s.y-a.y)/2,c=Math.cos(r)*h+Math.sin(r)*l,u=-Math.sin(r)*h+Math.cos(r)*l;let d=t*t,g=e*e;const y=c*c,w=u*u,p=y/d+w/g;if(p>1){const N=Math.sqrt(p);t=N*t,e=N*e,d=t*t,g=e*e}const C=d*w+g*y,P=(d*g-C)/C;let x=Math.sqrt(Math.max(0,P));n===o&&(x=-x);const T=x*t*u/e,v=-x*e*c/t,b=Math.cos(r)*T-Math.sin(r)*v+(s.x+a.x)/2,I=Math.sin(r)*T+Math.cos(r)*v+(s.y+a.y)/2,S=Mn(1,0,(c-T)/t,(u-v)/e),_=Mn((c-T)/t,(u-v)/e,(-c-T)/t,(-u-v)/e)%(Math.PI*2);i.ellipse(b,I,t,e,r,S,S+_,o===1)}function te(i,t){return i-(t-i)}function yr(i,t){const e=new M,r=new M;for(let n=0,o=i.length;n<o;n++){const s=i[n];if(s.type==="m"||s.type==="M")s.type==="m"?e.add(s):e.copy(s),t.moveTo(e.x,e.y),r.copy(e);else if(s.type==="h"||s.type==="H")s.type==="h"?e.x+=s.x:e.x=s.x,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="v"||s.type==="V")s.type==="v"?e.y+=s.y:e.y=s.y,t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="l"||s.type==="L")s.type==="l"?e.add(s):e.copy(s),t.lineTo(e.x,e.y),r.copy(e);else if(s.type==="c"||s.type==="C")s.type==="c"?(t.bezierCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),e.x+s.x2,e.y+s.y2,e.x+s.x,e.y+s.y),r.x=e.x+s.x2,r.y=e.y+s.y2,e.add(s)):(t.bezierCurveTo(te(e.x,r.x),te(e.y,r.y),s.x2,s.y2,s.x,s.y),r.x=s.x2,r.y=s.y2,e.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(t.quadraticCurveTo(e.x+s.x1,e.y+s.y1,e.x+s.x,e.y+s.y),r.x=e.x+s.x1,r.y=e.y+s.y1,e.add(s)):(t.quadraticCurveTo(s.x1,s.y1,s.x,s.y),r.x=s.x1,r.y=s.y1,e.copy(s));else if(s.type==="t"||s.type==="T"){const a=te(e.x,r.x),h=te(e.y,r.y);r.x=a,r.y=h,s.type==="t"?(t.quadraticCurveTo(a,h,e.x+s.x,e.y+s.y),e.add(s)):(t.quadraticCurveTo(a,h,s.x,s.y),e.copy(s))}else if(s.type==="a"||s.type==="A"){const a=e.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;e.add(s)}else{if(e.equals(s))continue;e.copy(s)}r.copy(e),xn(t,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,e)}else s.type==="z"||s.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",s)}}const K={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Pt(i,t,e=0){let a=0,h=!0,l="",c="";const u=[];function d(p,C,P){const x=new SyntaxError(`Unexpected character "${p}" at index ${C}.`);throw x.partial=P,x}function g(){l!==""&&(c===""?u.push(Number(l)):u.push(Number(l)*10**Number(c))),l="",c=""}let y;const w=i.length;for(let p=0;p<w;p++){if(y=i[p],Array.isArray(t)&&t.includes(u.length%e)&&K.FLAGS.test(y)){a=1,l=y,g();continue}if(a===0){if(K.WHITESPACE.test(y))continue;if(K.DIGIT.test(y)||K.SIGN.test(y)){a=1,l=y;continue}if(K.POINT.test(y)){a=2,l=y;continue}K.COMMA.test(y)&&(h&&d(y,p,u),h=!0)}if(a===1){if(K.DIGIT.test(y)){l+=y;continue}if(K.POINT.test(y)){l+=y,a=2;continue}if(K.EXP.test(y)){a=3;continue}K.SIGN.test(y)&&l.length===1&&K.SIGN.test(l[0])&&d(y,p,u)}if(a===2){if(K.DIGIT.test(y)){l+=y;continue}if(K.EXP.test(y)){a=3;continue}K.POINT.test(y)&&l[l.length-1]==="."&&d(y,p,u)}if(a===3){if(K.DIGIT.test(y)){c+=y;continue}if(K.SIGN.test(y)){if(c===""){c+=y;continue}c.length===1&&K.SIGN.test(c)&&d(y,p,u)}}K.WHITESPACE.test(y)?(g(),a=0,h=!1):K.COMMA.test(y)?(g(),a=0,h=!0):K.SIGN.test(y)?(g(),a=1,l=y):K.POINT.test(y)?(g(),a=2,l=y):d(y,p,u)}return g(),u}function Cn(i){const t={x:0,y:0},e={x:0,y:0};let r="";for(let n=0,o=i.length;n<o;n++){const s=i[n];switch(s.type){case"m":case"M":if(s.x===e.x&&s.y===e.y)continue;r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y,t.x=s.x,t.y=s.y;break;case"h":case"H":r+=`${s.type} ${s.x}`,e.x=s.x;break;case"v":case"V":r+=`${s.type} ${s.y}`,e.y=s.y;break;case"l":case"L":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"c":case"C":r+=`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"s":case"S":r+=`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"q":case"Q":r+=`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"t":case"T":r+=`${s.type} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"a":case"A":r+=`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`,e.x=s.x,e.y=s.y;break;case"z":case"Z":r+=s.type,e.x=t.x,e.y=t.y;break}}return r}const fo=/[a-df-z][^a-df-z]*/gi;function mr(i){const t=[],e=i.match(fo);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const o=e[r],s=o.charAt(0),a=o.slice(1).trim();let h;switch(s){case"m":case"M":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)l===0?t.push({type:s,x:h[l],y:h[l+1]}):t.push({type:s==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:s,x:h[l]});break;case"v":case"V":h=Pt(a);for(let l=0,c=h.length;l<c;l++)t.push({type:s,y:h[l]});break;case"l":case"L":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"c":case"C":h=Pt(a);for(let l=0,c=h.length;l<c;l+=6)t.push({type:s,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:s,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Pt(a);for(let l=0,c=h.length;l<c;l+=4)t.push({type:s,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Pt(a);for(let l=0,c=h.length;l<c;l+=2)t.push({type:s,x:h[l],y:h[l+1]});break;case"a":case"A":h=Pt(a,[3,4],7);for(let l=0,c=h.length;l<c;l+=7)t.push({type:s,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:s});break;default:console.warn(o)}}return t}var po=Object.defineProperty,go=(i,t,e)=>t in i?po(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,wr=(i,t,e)=>(go(i,typeof t!="symbol"?t+"":t,e),e);class _t{constructor(){wr(this,"arcLengthDivisions",200),wr(this,"_cacheArcLengths"),wr(this,"_needsUpdate",!1)}isClockwise(){const t=this.getPoint(1),e=this.getPoint(.5),r=this.getPoint(1);return(e.x-t.x)*(r.y-e.y)-(e.y-t.y)*(r.x-e.x)<0}getPointAt(t,e=new M){return this.getPoint(this.getUToTMapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}forEachControlPoints(t){return this.getControlPoints().forEach(t),this}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),o=0;e.push(0);for(let s=1;s<=t;s++)r=this.getPoint(s/t),o+=r.distanceTo(n),e.push(o),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(t,e){const r=this.getLengths();let n=0;const o=r.length;let s;e?s=e:s=t*r[o-1];let a=0,h=o-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-s,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===s)return n/(o-1);const c=r[n],d=r[n+1]-c,g=(s-c)/d;return(n+g)/(o-1)}getTangent(t,e=new M){const n=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new M){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let r=0,n=1,o=(r+n)/2;for(;n-r>e;){o=(r+n)/2;const s=this.getPoint(o);if(s.distanceTo(t)<e)return o;s.x<t.x?r=o:n=o}return o}matrix(t){return this.forEachControlPoints(e=>e.applyMatrix3(t)),this}getMinMax(t=M.MAX,e=M.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new H(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}toData(){return Cn(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class Be extends _t{constructor(t,e,r=0,n=Math.PI*2){super(),this.center=t,this.radius=e,this.start=r,this.end=n}getPoint(t){const{radius:e,center:r}=this;return r.clone().add(this.getNormal(t).clone().scale(e))}getTangent(t,e=new M){const{x:r,y:n}=this.getNormal(t);return e.set(-n,r)}getNormal(t,e=new M){const{start:r,end:n}=this,o=t*(n-r)+r-.5*Math.PI;return e.set(Math.cos(o),Math.sin(o))}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){return t.x=Math.min(t.x,this.center.x-this.radius),t.y=Math.min(t.y,this.center.y-this.radius),e.x=Math.max(e.x,this.center.x+this.radius),e.y=Math.max(e.y,this.center.y+this.radius),{min:t,max:e}}}function Sn(i,t,e,r,n){const o=(r-t)*.5,s=(n-e)*.5,a=i*i,h=i*a;return(2*e-2*r+o+s)*h+(-3*e+3*r-2*o-s)*a+o*i+e}function yo(i,t){const e=1-i;return e*e*t}function mo(i,t){return 2*(1-i)*i*t}function wo(i,t){return i*i*t}function Pn(i,t,e,r){return yo(i,t)+mo(i,e)+wo(i,r)}function vo(i,t){const e=1-i;return e*e*e*t}function bo(i,t){const e=1-i;return 3*e*e*i*t}function Mo(i,t){return 3*(1-i)*i*i*t}function xo(i,t){return i*i*i*t}function _n(i,t,e,r,n){return vo(i,t)+bo(i,e)+Mo(i,r)+xo(i,n)}class Tn extends _t{constructor(t=new M,e=new M,r=new M,n=new M){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new M){const{start:r,startControl:n,endControl:o,end:s}=this;return e.set(_n(t,r.x,n.x,o.x,s.x),_n(t,r.y,n.y,o.y,s.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const o=Math.sqrt(n),s=(-e+o)/(2*t),a=(-e-o)/(2*t);return[s,a].filter(h=>h>=0&&h<=1)}getMinMax(t=M.MAX,e=M.MIN){const r=this.start,n=this.startControl,o=this.endControl,s=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(o.x-n.x),3*(s.x-o.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(o.y-n.y),3*(s.y-o.y)),l=[0,1,...a,...h];return((u,d)=>{for(const g of u)for(let y=0;y<=d;y++){const w=y/d-.5,p=Math.min(1,Math.max(0,g+w)),C=this.getPoint(p);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}toCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{start:e,startControl:r,endControl:n,end:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,n.x,n.y,o.x,o.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const Co=new mt,On=new mt,In=new mt,Fe=new M;class An extends _t{constructor(t=new M,e=1,r=1,n=0,o=0,s=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=o,this.endAngle=s,this.clockwise=a}isClockwise(){return this.clockwise}getPoint(t,e=new M){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(o?n=0:n=r),this.clockwise&&!o&&(n===r?n=-r:n=n-r);const s=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(s),h=this.center.y+this.radiusY*Math.sin(s);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,d=h-this.center.y;a=u*l-d*c+this.center.x,h=u*c+d*l+this.center.y}return e.set(a,h)}toCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:o,clockwise:s,rotation:a}=this,{x:h,y:l}=t,c=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),u=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),d=Math.abs(n-o),g=d>Math.PI?1:0,y=s?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const p=n+Math.PI,C=h+e*Math.cos(p)*Math.cos(a)-r*Math.sin(p)*Math.sin(a),P=l+e*Math.cos(p)*Math.sin(a)+r*Math.sin(p)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:C,y:P},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:c,y:u}]}else{const p=h+e*Math.cos(o)*Math.cos(a)-r*Math.sin(o)*Math.sin(a),C=l+e*Math.cos(o)*Math.sin(a)+r*Math.sin(o)*Math.cos(a);return[{type:"M",x:c,y:u},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:g,sweepFlag:y,x:p,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:o,startAngle:s,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,o,s,a,!h),this}matrix(t){return Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,_o(t)?So(this,t):Po(this,t),this}getControlPoints(){return[this.center]}getMinMax(t=M.MAX,e=M.MIN){const{center:r,radiusX:n,radiusY:o,rotation:s}=this,{x:a,y:h}=r,l=Math.cos(s),c=Math.sin(s),u=Math.sqrt(n*n*l*l+o*o*c*c),d=Math.sqrt(n*n*c*c+o*o*l*l);return t.x=Math.min(t.x,a-u),t.y=Math.min(t.y,h-d),e.x=Math.max(e.x,a+u),e.y=Math.max(e.y,h+d),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function So(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new M(e*n,e*o),a=new M(-r*o,r*n),h=s.applyMatrix3(t),l=a.applyMatrix3(t),c=Co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),u=On.copy(c).invert(),y=In.copy(u).transpose().multiply(u).elements,w=To(y[0],y[1],y[4]),p=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(i.radiusX=1/p,i.radiusY=1/C,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=On.set(p,0,0,0,C,0,0,0,1),T=In.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(T).multiply(c),b=I=>{const{x:S,y:_}=new M(Math.cos(I),Math.sin(I)).applyMatrix3(v);return Math.atan2(_,S)};i.startAngle=b(i.startAngle),i.endAngle=b(i.endAngle),Dn(t)&&(i.clockwise=!i.clockwise)}}function Po(i,t){const e=Nn(t),r=zn(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,Dn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Dn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function _o(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=Nn(i),n=zn(i);return Math.abs(e/(r*n))>Number.EPSILON}function Nn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function zn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function To(i,t,e){let r,n,o,s,a;const h=i+e,l=i-e,c=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+c),a=1/r,n=i*a*e-t*a*t):h<0?n=.5*(h-c):(r=.5*c,n=-.5*c),l>0?o=l+c:o=l-c,Math.abs(o)>2*Math.abs(t)?(a=-2*t/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(t)===0?(o=1,s=0):(a=-.5*o/t,o=1/Math.sqrt(1+a*a),s=a*o),l>0&&(a=o,o=-s,s=a),{rt1:r,rt2:n,cs:o,sn:s}}class Ht extends _t{constructor(t=new M,e=new M){super(),this.start=t,this.end=e}getPoint(t,e=new M){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).scale(t).add(this.start),e}getPointAt(t,e=new M){return this.getPoint(t,e)}getTangent(t,e=new M){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new M){return this.getTangent(t,e)}getControlPoints(){return[this.start,this.end]}getMinMax(t=M.MAX,e=M.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}toCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{start:e,end:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}var Oo=Object.defineProperty,Io=(i,t,e)=>t in i?Oo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ao=(i,t,e)=>(Io(i,t+"",e),e);class Do extends _t{constructor(t,e,r=0,n=1){super(),this.center=t,this.size=e,this.start=r,this.end=n,Ao(this,"curveT",0),this.update()}update(){const{x:t,y:e}=this.center,r=new M(t+.5*this.size,e-.5*this.size),n=new M(t-.5*this.size,e-.5*this.size),o=new M(t,e+.5*this.size),s=new Be(r,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new Be(n,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new Be(o,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new M(t,e+this.size),c=new M(t+this.size,e),u=new M().lerpVectors(c,l,.75),d=new M(t-this.size,e),g=new M().lerpVectors(d,l,.75),y=new Ht(c,u),w=new Ht(g,d);return this.curves=[s,y,h,w,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=9*Math.PI/8+1.5;let r;const n=.5*Math.PI;return e<n?(r=0,this.curveT=e/n):e<n+.75?(r=1,this.curveT=(e-n)/.75):e<5*Math.PI/8+.75?(r=2,this.curveT=(e-n-.75)/(Math.PI/8)):e<5*Math.PI/8+1.5?(r=3,this.curveT=(e-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(e-5*Math.PI/8-1.5)/n),this.curves[r]}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}var No=Object.defineProperty,zo=(i,t,e)=>t in i?No(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vr=(i,t,e)=>(zo(i,typeof t!="symbol"?t+"":t,e),e);class Eo extends _t{constructor(t,e=0,r=0,n=0,o=1){super(),this.center=t,this.radius=e,this.number=r,this.start=n,this.end=o,vr(this,"curves",[]),vr(this,"curveT",0),vr(this,"points",[]),this.update()}update(){for(let t=0;t<this.number;t++){let e=t*2*Math.PI/this.number;e-=.5*Math.PI,this.points.push(new M(this.radius*Math.cos(e),this.radius*Math.sin(e)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new Ht(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1);const r=e*this.number,n=Math.floor(r);return this.curveT=r-n,this.curves[n]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class En extends _t{constructor(t=new M,e=new M,r=new M){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new M){const{start:r,control:n,end:o}=this;return e.set(Pn(t,r.x,n.x,o.x),Pn(t,r.y,n.y,o.y)),e}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(t=M.MAX,e=M.MIN){const{start:r,control:n,end:o}=this,s=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+o.x),l=.5*(r.y+o.y);return t.x=Math.min(t.x,r.x,o.x,s,h),t.y=Math.min(t.y,r.y,o.y,a,l),e.x=Math.max(e.x,r.x,o.x,s,h),e.y=Math.max(e.y,r.y,o.y,a,l),{min:t,max:e}}toCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{start:e,control:r,end:n}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var Uo=Object.defineProperty,Lo=(i,t,e)=>t in i?Uo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Un=(i,t,e)=>(Lo(i,typeof t!="symbol"?t+"":t,e),e);class Ln extends _t{constructor(t,e,r=1,n=0,o=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=o,Un(this,"curves",[]),Un(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,o=[new M(t-r,e-n),new M(t+r,e-n),new M(t+r,e+n),new M(t-r,e+n)];for(let s=0;s<4;s++)this.curves.push(new Ht(o[s].clone(),o[(s+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class $n extends _t{constructor(t=[]){super(),this.points=t}getPoint(t,e=new M){const{points:r}=this,n=(r.length-1)*t,o=Math.floor(n),s=n-o,a=r[o===0?o:o-1],h=r[o],l=r[o>r.length-2?r.length-1:o+1],c=r[o>r.length-3?r.length-1:o+2];return e.set(Sn(s,a.x,h.x,l.x,c.x),Sn(s,a.y,h.y,l.y,c.y)),e}getControlPoints(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var $o=Object.defineProperty,ko=(i,t,e)=>t in i?$o(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>(ko(i,typeof t!="symbol"?t+"":t,e),e);class ee extends _t{constructor(t){super(),Me(this,"curves",[]),Me(this,"startPoint"),Me(this,"currentPoint",new M),Me(this,"autoClose",!1),Me(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:o}=t[e];this.lineTo(n,o)}return this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}getPoint(t,e=new M){const r=t*this.getLength(),n=this.getCurveLengths();let o=0;for(;o<n.length;){if(n[o]>=r){const s=n[o]-r,a=this.curves[o],h=a.getLength();return a.getPointAt(h===0?0:1-s/h,e)}o++}return e}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let o=0,s=r.length;o<s;o++){const h=r[o].getPoints(t);for(let l=0;l<h.length;l++){const c=h[l];n!=null&&n.equals(c)||(e.push(c),n=c)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new Ht(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new Ht(this.currentPoint.clone(),new M(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPoint.equals({x:o,y:s})||this.curves.push(new Tn(this.currentPoint.clone(),new M(t,e),new M(r,n),new M(o,s))),this._setCurrentPoint({x:o,y:s}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new En(this.currentPoint.clone(),new M(t,e),new M(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,o,s){return this.ellipse(t,e,r,r,0,n,o,s),this}relativeArc(t,e,r,n,o,s){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,o,s),this}arcTo(t,e,r,n,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,o,s,a,h=!0){const l=new An(new M(t,e),r,n,o,s,a,!h);if(this.curves.length>0){const c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,o,s,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,o,s,a,h),this}rect(t,e,r,n){return this.curves.push(new Ln(new M(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new $n([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new H(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function jo(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Bo(i,t,e,r){const n=t.clone().sub(i),o=r.clone().sub(e),s=e.clone().sub(i),a=n.cross(o);if(a===0)return new M((i.x+e.x)/2,(i.y+e.y)/2);const h=s.cross(o)/a;return Math.abs(h)>1?new M((i.x+e.x)/2,(i.y+e.y)/2):new M(i.x+h*n.x,i.y+h*n.y)}var Fo=Object.defineProperty,Go=(i,t,e)=>t in i?Fo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,br=(i,t,e)=>(Go(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){br(this,"currentPath",new ee),br(this,"paths",[this.currentPath]),br(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new ee().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new ee().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,o,s){return this.currentPath.bezierCurveTo(t,e,r,n,o,s),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,o,s){return this.currentPath.arc(t,e,r,n,o,s),this}arcTo(t,e,r,n,o){return this.currentPath.arcTo(t,e,r,n,o),this}ellipse(t,e,r,n,o,s,a,h){return this.currentPath.ellipse(t,e,r,n,o,s,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return yr(t,this),this}addData(t){return this.addCommands(mr(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}getControlPoints(){return this.paths.flatMap(t=>t.getControlPoints())}getCurves(){return this.paths.flatMap(t=>t.curves)}scale(t,e=t,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPoints().forEach(n=>{n.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPoints().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getCurves(),r=[],n=[],o=[];e.forEach((a,h)=>{const l=a.getControlPoints(),c=a.isClockwise();o[h]=l,n[h]=c;const u=l[0],d=l[l.length-1]??u;r.push({start:c?d:u,end:c?u:d,index:h})});const s=[];return r.forEach((a,h)=>{s[h]=[],r.forEach((l,c)=>{c!==h&&l.start.equals(a.end)&&s[h].push(l.index)})}),e.forEach((a,h)=>{const l=n[h];o[h].forEach(u=>{const d=a.getTForPoint(u),g=a.getNormal(d).scale(l?t:-t);u.add(g)})}),s.forEach((a,h)=>{const l=o[h];a.forEach(c=>{const u=o[c],d=Bo(l[l.length-1],l[l.length-2]??l[l.length-1],u[0],u[1]??u[0]);d&&(l[l.length-1].copy(d),u[0].copy(d))})}),this}matrix(t){return this.getCurves().forEach(e=>e.matrix(t)),this}getMinMax(t=M.MAX,e=M.MIN,r=!0){const n=this.strokeWidth;return this.getCurves().forEach(o=>{if(o.getMinMax(t,e),r&&n>1){const s=n/2,a=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivisions){const c=o.getPoint(l),u=o.getNormal(l),d=u.clone().scale(a?s:-s),g=u.clone().scale(a?-s:s);h.push(c.clone().add(d),c.clone().add(g),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}))}t.min(...h),e.max(...h)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new H(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),pr(t,e),this.paths.forEach(o=>{o.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;return t.beginPath(),t.save(),pr(t,e),this.getControlPoints().forEach(o=>{t.moveTo(o.x,o.y),t.arc(o.x,o.y,4,0,Math.PI*2)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.paths.flatMap(t=>t.toCommands())}toData(){return this.paths.map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[jo(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.toData()}" style="${r}"></path>`}toSvgString(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),o=this.toSvgPathString();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),"image/svg+xml").documentElement}toCanvas(t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),this.drawTo(l,r)),h}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}const Mr="px",kn=90,jn=["mm","cm","in","pt","pc","px"],xr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function U(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=jn.length;r<n;r++){const o=jn[r];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return t==="px"&&Mr!=="px"?e=xr.in[Mr]/kn:(e=xr[t][Mr],e<0&&(e=xr[t].in*kn)),e*Number.parseFloat(i)}const Vo=new mt,Ge=new mt,Bn=new mt,Fn=new mt;function Ro(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=Wo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Wo(i){const t=new mt,e=Vo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(U(i.getAttribute("x")),U(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const o=r[n].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const h=o.slice(0,s),l=Pt(o.slice(s+1));switch(e.identity(),h){case"translate":if(l.length>=1){const c=l[0];let u=0;l.length>=2&&(u=l[1]),e.translate(c,u)}break;case"rotate":if(l.length>=1){let c=0,u=0,d=0;c=l[0]*Math.PI/180,l.length>=3&&(u=l[1],d=l[2]),Ge.makeTranslation(-u,-d),Bn.makeRotation(c),Fn.multiplyMatrices(Bn,Ge),Ge.makeTranslation(u,d),e.multiplyMatrices(Ge,Fn)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function qo(i){return new bt().addPath(new ee().arc(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("r")||0),0,Math.PI*2))}function Ho(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=r.style.length,a=0;a<s;a++){const h=r.style.item(a);o[h]=r.style.getPropertyValue(h)}for(let s=0;s<n.length;s++)t[n[s]]=Object.assign(t[n[s]]||{},{...o})}}function Qo(i){return new bt().addPath(new ee().ellipse(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("rx")||0),U(i.getAttribute("ry")||0),0,0,Math.PI*2))}function Xo(i){return new bt().moveTo(U(i.getAttribute("x1")||0),U(i.getAttribute("y1")||0)).lineTo(U(i.getAttribute("x2")||0),U(i.getAttribute("y2")||0))}function Yo(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Zo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ko(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Zo,(n,o,s)=>{const a=U(o),h=U(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Jo,(n,o,s)=>{const a=U(o),h=U(s);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ea(i){const t=U(i.getAttribute("x")||0),e=U(i.getAttribute("y")||0),r=U(i.getAttribute("rx")||i.getAttribute("ry")||0),n=U(i.getAttribute("ry")||i.getAttribute("rx")||0),o=U(i.getAttribute("width")),s=U(i.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+o-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+o-r*a,e,t+o,e+n*a,t+o,e+n),h.lineTo(t+o,e+s-n),(r!==0||n!==0)&&h.bezierCurveTo(t+o,e+s-n*a,t+o-r*a,e+s,t+o-r,e+s),h.lineTo(t+r,e+s),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+s,t,e+s-n*a,t,e+s-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const l=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<l.length;c++)r=Object.assign(r,e[`.${l[c]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));for(let l=i.style.length,c=0;c<l;c++){const u=i.style.item(c),d=i.style.getPropertyValue(u);t[u]=d,r[u]=d}function n(l,c,u=o){i.hasAttribute(l)&&(t[c]=u(i.getAttribute(l))),r[l]&&(t[c]=u(r[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function s(l){return Math.max(0,Math.min(1,U(l)))}function a(l){return Math.max(0,U(l))}function h(l){return l.split(" ").filter(c=>c!=="").map(c=>U(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",h),n("stroke-dashoffset","strokeDashoffset",U),n("visibility","visibility"),t}function Cr(i,t,e=[],r={}){var u;if(i.nodeType!==1)return e;let n=!1,o=null,s={...t};switch(i.nodeName){case"svg":s=At(i,s,r);break;case"style":Ho(i,r);break;case"g":s=At(i,s,r);break;case"path":s=At(i,s,r),i.hasAttribute("d")&&(o=Yo(i));break;case"rect":s=At(i,s,r),o=ea(i);break;case"polygon":s=At(i,s,r),o=Ko(i);break;case"polyline":s=At(i,s,r),o=ta(i);break;case"circle":s=At(i,s,r),o=qo(i);break;case"ellipse":s=At(i,s,r),o=Qo(i);break;case"line":s=At(i,s,r),o=Xo(i);break;case"defs":n=!0;break;case"use":{s=At(i,s,r);const g=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),y=(u=i.viewportElement)==null?void 0:u.getElementById(g);y?Cr(y,s,e,r):console.warn(`'use node' references non-existent node id: ${g}`);break}default:console.warn(i);break}if(s.display==="none")return e;Object.assign(t,s);const a=new mt,h=[],l=Ro(i,a,h);o&&(o.matrix(a),e.push(o),o.style=t);const c=i.childNodes;for(let d=0,g=c.length;d<g;d++){const y=c[d];n&&y.nodeName!=="style"&&y.nodeName!=="defs"||Cr(y,t,e,r)}return l&&(h.pop(),h.length>0?a.copy(h[h.length-1]):a.identity()),e}const Gn="data:image/svg+xml;",Vn=`${Gn}base64,`,Rn=`${Gn}charset=utf8,`;function Wn(i){if(typeof i=="string"){let t;return i.startsWith(Vn)?(i=i.substring(Vn.length,i.length),t=atob(i)):i.startsWith(Rn)?(i=i.substring(Rn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Sr(i){return Cr(Wn(i),{})}function Qt(i,t=!0){if(!i.length)return;const e=M.MAX,r=M.MIN;return i.forEach(n=>n.getMinMax(e,r,t)),new H(e.x,e.y,r.x-e.x,r.y-e.y)}function Pr(i){const{x:t,y:e,width:r,height:n}=Qt(i),o=i.map(s=>s.toSvgPathString()).join("");return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}function ra(i){return`data:image/svg+xml;base64,${btoa(Pr(i))}`}function na(i){return new DOMParser().parseFromString(Pr(i),"image/svg+xml").documentElement}function ia(i,t={}){const{pixelRatio:e=2,...r}=t,{left:n,top:o,width:s,height:a}=Qt(i),h=document.createElement("canvas");h.width=s*e,h.height=a*e,h.style.width=`${s}px`,h.style.height=`${a}px`;const l=h.getContext("2d");return l&&(l.scale(e,e),l.translate(-n,-o),i.forEach(c=>{c.drawTo(l,r)})),h}const sa=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),qn={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Hn{constructor(t,e,r){z(this,"boundingBox",new H);z(this,"textWidth",0);z(this,"textHeight",0);z(this,"glyphHeight",0);z(this,"glyphWidth",0);z(this,"underlinePosition",0);z(this,"underlineThickness",0);z(this,"yStrikeoutPosition",0);z(this,"yStrikeoutSize",0);z(this,"baseline",0);z(this,"centerDiviation",0);z(this,"path",new bt);z(this,"glyphBox",new H);z(this,"center",new M);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=wn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:o,post:s}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:c}=l,{fontSize:u}=h,d=e/u,g=t.getAdvanceWidth(a,u),y=(r+Math.abs(n))/d,w=r/d,p=(r-o.yStrikeoutPosition)/d,C=o.yStrikeoutSize/d,P=(r-s.underlinePosition)/d,x=s.underlineThickness/d;return this.glyphWidth=g,this.glyphHeight=y,this.underlinePosition=P,this.underlineThickness=x,this.yStrikeoutPosition=p,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*c-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:o,boundingBox:s,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:c}=this.updateGlyph(t),{os2:u,ascender:d,descender:g}=t,y=d,w=g,p=u.sTypoAscender,{left:C,top:P}=s,{fontSize:x,fontStyle:T}=a;let v=C,b=P+h,I;const S=new bt;if(e&&(v+=(l-c)/2,Math.abs(n-o)>.1&&(b-=(y-p)/(y+Math.abs(w))*l),I=void 0),e&&!sa.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){S.addCommands(t.getPathCommands(r,v,P+h-(l-c)/2,x)??[]);const N={y:P-(l-c)/2+l/2,x:v+c/2};T==="italic"&&this._italic(S,e?{x:N.x,y:P-(l-c)/2+h}:void 0),S.rotate(90,N)}else I!==void 0?(S.addCommands(t.glyphs.get(I).getPathCommands(v,b,x)),T==="italic"&&this._italic(S,e?{x:v+c/2,y:P+p/(y+Math.abs(w))*l}:void 0)):(S.addCommands(t.getPathCommands(r,v,b,x)??[]),T==="italic"&&this._italic(S,e?{x:v+l/2,y:b}:void 0));S.addCommands(this._decoration());const _=a.fontWeight??400;return _ in qn&&S.bold(qn[_]*x*.05),S.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=S,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:o}=this.computedStyle,{left:s,top:a,width:h,height:l}=this.boundingBox,c=.1*o;let u;switch(n){case"underline":t?u=s:u=a+e;break;case"line-through":t?u=s+h/2:u=a+r;break;case"none":default:return[]}return t?[{type:"M",x:u,y:a},{type:"L",x:u,y:a+l},{type:"L",x:u+c,y:a+l},{type:"L",x:u+c,y:a},{type:"Z"}]:[{type:"M",x:s,y:u},{type:"L",x:s+h,y:u},{type:"L",x:s+h,y:u+c},{type:"L",x:s,y:u+c},{type:"Z"}]}_italic(t,e){t.skew(-.24,0,e||{y:this.boundingBox.top+this.baseline,x:this.boundingBox.left+this.glyphWidth/2})}getGlyphMinMax(t,e,r){var n;if((n=this.path.paths[0])!=null&&n.curves.length)return this.path.getMinMax(t,e,r);{t??(t=M.MAX),e??(e=M.MIN);const{left:o,top:s}=this.boundingBox,a=o+this.glyphWidth,h=s+this.glyphHeight;return t.x=Math.min(t.x,o),t.y=Math.min(t.y,s),e.x=Math.max(e.x,a),e.y=Math.max(e.y,h),{min:t,max:e}}}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new H(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){Ce({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}function re(i){return!i||i==="none"}function Ve(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}class Qn{constructor(t,e={},r){z(this,"boundingBox",new H);this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Ve(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new Hn(r,e++,this));return this.characters=t,this}}class ne{constructor(t,e){z(this,"boundingBox",new H);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ve(this.parentStyle),...Ve(this.style)},this}addFragment(t,e){const r=new Qn(t,e,this);return this.fragments.push(r),r}}class Xn{constructor(t){this._text=t}_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const o=document.createElement("ul");return Object.assign(o.style,{listStyleType:"inherit",padding:"0",margin:"0"}),t.forEach(s=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(s.style)),s.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),o.appendChild(a)}),n.appendChild(o),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var s;return(s=n.parentNode)==null?void 0:s.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();e.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll("span").forEach((h,l)=>{var d;const c=o.getBoundingClientRect();r.push({paragraphIndex:s,fragmentIndex:l,left:c.left,top:c.top,width:c.width,height:c.height});const u=h.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const y=u.data?u.data.length:0;let w=0;for(;w<=y;){g.setStart(u,Math.max(w-1,0)),g.setEnd(u,w);const p=((d=g.getClientRects)==null?void 0:d.call(g))??[g.getBoundingClientRect()];let C=p[p.length-1];p.length>1&&C.width<2&&(C=p[p.length-2]);const P=g.toString();P!==""&&C&&C.width+C.height!==0&&n.push({content:P,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),o=window.getComputedStyle(t).writingMode.includes("vertical"),s=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((g,y)=>{const w=o?"left":"top";return Math.abs(y[w]-g[w])>4e3/2&&(h=[],a.push(h)),h.push(y),y})),n.style.lineHeight=s;const c=this._measureDom(t);c.paragraphs.forEach(g=>{const y=e[g.paragraphIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height}),c.fragments.forEach(g=>{const y=e[g.paragraphIndex].fragments[g.fragmentIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height});const u=[];let d=0;return a.forEach(g=>{g.forEach(y=>{const w=c.characters[d],{paragraphIndex:p,fragmentIndex:C,characterIndex:P}=w;u.push({...w,newParagraphIndex:p,textWidth:y.width,textHeight:y.height,left:w.left-r.left,top:w.top-r.top});const x=e[p].fragments[C].characters[P];x.boundingBox.left=u[d].left,x.boundingBox.top=u[d].top,x.boundingBox.width=u[d].width,x.boundingBox.height=u[d].height,x.textWidth=u[d].textWidth,x.textHeight=u[d].textHeight,d++})}),{paragraphs:e,boundingBox:new H(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Yn{constructor(t){this._text=t}parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new ne({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const o=new ne({},e);o.addFragment(n),r.push(o)}else if(Array.isArray(n)){const o=new ne({},e);n.forEach(s=>{if(typeof s=="string")o.addFragment(s);else{const{content:a,...h}=s;a!==void 0&&o.addFragment(a,h)}}),r.push(o)}else if("fragments"in n){const{fragments:o,...s}=n,a=new ne(s,e);o.forEach(h=>{const{content:l,...c}=h;l!==void 0&&a.addFragment(l,c)}),r.push(a)}else if("content"in n){const{content:o,...s}=n;if(o!==void 0){const a=new ne(s,e);a.addFragment(o),r.push(a)}}}return r}}function aa(i){return i}const Bt=new M,ie=new mt,Ft=new mt;function Zn(){return{name:"effect",getBoundingBox:i=>{const{characters:t,fontSize:e,effects:r}=i,n=[];return t.forEach(o=>{r==null||r.forEach(s=>{const a=o.glyphBox.clone(),h=_r(i,s);Bt.set(a.left,a.top),Bt.applyMatrix3(h),a.left=Bt.x,a.top=Bt.y,Bt.set(a.right,a.bottom),Bt.applyMatrix3(h),a.width=Bt.x-a.left,a.height=Bt.y-a.top;const l=(s.shadowOffsetX??0)*e,c=(s.shadowOffsetY??0)*e,u=Math.max(.1,s.textStrokeWidth??0)*e;a.left+=l-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,n.push(a)})}),n.length?H.from(...n):void 0},render:(i,t)=>{const{characters:e,renderBoundingBox:r,effects:n}=t;n?n.forEach(o=>{Tt(o,r,i),i.save();const[s,a,h,l,c,u]=_r(t,o).transpose().elements;i.transform(s,l,a,c,h,u),e.forEach(d=>{d.drawTo(i,o)}),i.restore()}):e.forEach(o=>{o.drawTo(i)})}}}function _r(i,t){const{fontSize:e,renderBoundingBox:r}=i,n=(t.offsetX??0)*e,o=(t.offsetY??0)*e,s=Math.PI*2,a=(t.skewX??0)/360*s,h=(t.skewY??0)/360*s,{left:l,top:c,width:u,height:d}=r,g=l+u/2,y=c+d/2;return ie.identity(),Ft.makeTranslation(n,o),ie.multiply(Ft),Ft.makeTranslation(g,y),ie.multiply(Ft),Ft.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),ie.multiply(Ft),Ft.makeTranslation(-g,-y),ie.multiply(Ft),ie.clone()}const la="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=";function ha(i,t,e){if(i==="cover")return 0;if(typeof i=="string")if(i.endsWith("%")){const r=Number(i.substring(0,i.length-1))/100;return Math.ceil(r*e/t)}else return i.endsWith("rem")?Number(i.substring(0,i.length-3)):Math.ceil(Number(i)/t);else return Math.ceil(i/t)}function ca(i,t,e){return typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ua(i,t,e,r){let n;r?n={x:e.width/t.height,y:e.height/t.width}:n={x:e.width/t.width,y:e.height/t.height};const o=e.getCenterPoint().add(i.getCenterPoint().sub(t.getCenterPoint()).scale(n.x,n.y)).sub({x:i.width*n.x/2,y:i.height*n.y/2}),s=new mt;return s.translate(-i.left,-i.top),r&&(s.translate(-i.width/2,-i.height/2),s.rotate(Math.PI/2),s.translate(i.width/2,i.height/2)),s.scale(n.x,n.y),s.translate(o.x,o.y),s}function Kn(){const i=[],t=[],e=new Map;function r(n){let o=e.get(n);return o||(o=Sr(n),e.set(n,o)),o}return{name:"highlight",paths:i,update:n=>{i.length=0;const{characters:o}=n;let s;const a=[];let h;o.forEach(l=>{const{isVertical:c,computedStyle:u}=l;re(u.highlightImage)||(u.highlightSize!=="1rem"&&(h==null?void 0:h.highlightImage)===u.highlightImage&&(h==null?void 0:h.highlightSize)===u.highlightSize&&(h==null?void 0:h.highlightStrokeWidth)===u.highlightStrokeWidth&&(h==null?void 0:h.highlightOverflow)===u.highlightOverflow&&s.length&&(c?s[0].boundingBox.left===l.boundingBox.left:s[0].boundingBox.top===l.boundingBox.top)&&s[0].fontSize===l.fontSize?s.push(l):(s=[],s.push(l),a.push(s))),h=u}),a.filter(l=>l.length).map(l=>({style:l[0].computedStyle,box:H.from(...l.map(c=>c.glyphBox))})).forEach(l=>{const{style:c,box:u}=l,{fontSize:d,writingMode:g}=c,y=g.includes("vertical"),w=ca(c.highlightStrokeWidth,d,u.width),p=ha(c.highlightSize,d,u.width),C=re(c.highlightOverflow)?p?"hidden":"visible":c.highlightOverflow,P=r(re(c.highlightReferImage)?la:c.highlightReferImage),x=r(c.highlightImage),T=Qt(x,!0),v=Qt(P,!1),b=p?d*p:u.width,I=ua(T,v,new H(u.left,u.top,b,u.height),y),S=d/T.width*2,_=Math.ceil(u.width/b);for(let N=0;N<_;N++){const G=I.clone().translate(N*b,0);x.forEach(V=>{const Q=V.clone().matrix(G);Q.style.strokeWidth&&(Q.style.strokeWidth*=S*w),Q.style.strokeMiterlimit&&(Q.style.strokeMiterlimit*=S),Q.style.strokeDashoffset&&(Q.style.strokeDashoffset*=S),Q.style.strokeDasharray&&(Q.style.strokeDasharray=Q.style.strokeDasharray.map(A=>A*S)),i.push(Q),t[i.length-1]=C==="hidden"?new H(u.left,u.top-u.height,u.width,u.height*3):void 0})}})},renderOrder:-1,render:(n,o)=>{i.forEach((s,a)=>{Ce({ctx:n,path:s,clipRect:t[a],fontSize:o.computedStyle.fontSize})})}}}function Jn(i,t,e){return i==="cover"?1:typeof i=="string"?i.endsWith("%")?Number(i.substring(0,i.length-1))/100:i.endsWith("rem")?Number(i.substring(0,i.length-3))*t/e:Number(i)/e:i/e}function ti(){const i=[];return{name:"listStyle",paths:i,update:t=>{i.length=0;const{paragraphs:e,computedStyle:r,fontSize:n,isVertical:o}=t;let s=r.listStyleSize,a;if(!re(r.listStyleImage))a=r.listStyleImage;else if(!re(r.listStyleType)){const u=n*.38/2;switch(s=s==="cover"?u*2:s,r.listStyleType){case"disc":a=`<svg width="${u*2}" height="${u*2}" xmlns="http://www.w3.org/2000/svg">
5
5
  <circle cx="${u}" cy="${u}" r="${u}" fill="${r.color}" />
6
- </svg>`;break}}if(!a)return;const h=n*.45,l=Sr(a),c=Qt(l);e.forEach(u=>{var y,g;const d=(g=(y=u.fragments[0])==null?void 0:y.characters[0])==null?void 0:g.getGlyphBoundingBox();if(d){const w=new yt;if(i){const p=Jn(o,r.fontSize,d.width),C=d.width/c.height*p;w.translate(-c.left,-c.top),w.rotate(Math.PI/2),w.scale(C,C),w.translate(d.width/2-c.height*C/2,0),w.translate(d.left,d.top-h)}else{const p=Jn(o,r.fontSize,d.height),C=d.height/c.height*p;w.translate(-c.left,-c.top),w.translate(-c.width,0),w.scale(C,C),w.translate(0,d.height/2-c.height*C/2),w.translate(d.left-h,d.top)}s.push(...l.map(p=>p.clone().matrix(w)))}})}}}const Tr={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textTransform:"none",textOrientation:"mixed",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none"};class fa{constructor(t={}){z(this,"content");z(this,"style");z(this,"effects");z(this,"measureDom");z(this,"needsUpdate",!0);z(this,"computedStyle",{...Tr});z(this,"paragraphs",[]);z(this,"boundingBox",new Q);z(this,"renderBoundingBox",new Q);z(this,"parser",new Yn(this));z(this,"measurer",new Xn(this));z(this,"plugins",new Map);const{content:e="",style:r={},measureDom:n,effects:i}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=i,this.use(Zn()).use(Kn()).use(ts())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}measure(t=this.measureDom){this.computedStyle={...Tr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(a=>a.update());const n=[...this.plugins.values()];n.sort((a,h)=>(a.updateOrder??0)-(h.updateOrder??0)).forEach(a=>{var h;(h=a.update)==null||h.call(a,this)});const i=b.MAX,o=b.MIN;return r.forEach(a=>a.getGlyphMinMax(i,o)),this.renderBoundingBox=new Q(i.x,i.y,o.x-i.x,o.y-i.y),this.renderBoundingBox=Q.from(this.renderBoundingBox,...n.map(a=>a.getBoundingBox?a.getBoundingBox(this):Qt(a.paths??[])).filter(Boolean)),this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Dr(n,r,this.renderBoundingBox),Nr(n,this),[...this.plugins.values()].sort((o,a)=>(o.renderOrder??0)-(a.renderOrder??0)).forEach(o=>{var a;o.render?(a=o.render)==null||a.call(o,n,this):o.paths&&o.paths.forEach(h=>{Ce({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}f.BoundingBox=Q,f.Character=Hn,f.CircleCurve=Be,f.CmapSubtableFormat0=ir,f.CmapSubtableFormat12=hr,f.CmapSubtableFormat14=me,f.CmapSubtableFormat2=pe,f.CmapSubtableFormat4=lr,f.CmapSubtableFormat6=Vt,f.CubicBezierCurve=Tn,f.Curve=_t,f.CurvePath=ee,f.EllipseCurve=An,f.Eot=Us,f.Font=Oe,f.Fonts=mn,f.Fragment=Qn,f.Glyph=tr,f.GlyphSet=er,f.HeartCurve=Do,f.LineCurve=Ht,f.Matrix3=yt,f.Measurer=Xn,f.Paragraph=ne,f.Parser=Yn,f.Path2D=vt,f.PloygonCurve=Eo,f.QuadraticBezierCurve=En,f.RectangularCurve=Ln,f.Sfnt=ue,f.SplineCurve=$n,f.TableDirectory=Zt,f.Text=fa,f.Ttf=st,f.Vector2=b,f.Woff=Ut,f.WoffTableDirectoryEntry=qt,f.addPathCommandsToPath2D=yr,f.componentFlags=Jt,f.createCmapSegments=ar,f.defaultTextStyles=Tr,f.definePlugin=aa,f.defineSfntTable=nt,f.drawPath=Ce,f.effect=Zn,f.fillBackground=as,f.filterEmpty=Re,f.fonts=wn,f.getPathsBoundingBox=Qt,f.getTransform2D=_r,f.highlight=Kn,f.isNone=re,f.listStyle=ts,f.minify=ao,f.minifyGlyphs=vn,f.minifySfnt=bn,f.parse=gn,f.parseArcCommand=xn,f.parseColor=it,f.parsePathDataArgs=Pt,f.parseSvg=Sr,f.parseSvgToDom=Wn,f.pathCommandsToPathData=Cn,f.pathDataToPathCommands=mr,f.pathsToCanvas=sa,f.pathsToSvg=na,f.pathsToSvgString=Pr,f.pathsToSvgUrl=ra,f.setCanvasContext=pr,f.setupView=Dr,f.uploadColor=Tt,f.uploadColors=Nr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
6
+ </svg>`;break}}if(!a)return;const h=n*.45,l=Sr(a),c=Qt(l);e.forEach(u=>{var g,y;const d=(y=(g=u.fragments[0])==null?void 0:g.characters[0])==null?void 0:y.getGlyphBoundingBox();if(d){const w=new mt;if(o){const p=Jn(s,r.fontSize,d.width),C=d.width/c.height*p;w.translate(-c.left,-c.top),w.rotate(Math.PI/2),w.scale(C,C),w.translate(d.width/2-c.height*C/2,0),w.translate(d.left,d.top-h)}else{const p=Jn(s,r.fontSize,d.height),C=d.height/c.height*p;w.translate(-c.left,-c.top),w.translate(-c.width,0),w.scale(C,C),w.translate(0,d.height/2-c.height*C/2),w.translate(d.left-h,d.top)}i.push(...l.map(p=>p.clone().matrix(w)))}})}}}const Tr={writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1,letterSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textTransform:"none",textOrientation:"mixed",color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,listStyleType:"none",listStyleImage:"none",listStyleSize:"cover",listStylePosition:"outside",highlightReferImage:"none",highlightImage:"none",highlightSize:"cover",highlightStrokeWidth:"100%",highlightOverflow:"none"};class fa{constructor(t={}){z(this,"content");z(this,"style");z(this,"effects");z(this,"measureDom");z(this,"needsUpdate",!0);z(this,"computedStyle",{...Tr});z(this,"paragraphs",[]);z(this,"boundingBox",new H);z(this,"renderBoundingBox",new H);z(this,"parser",new Yn(this));z(this,"measurer",new Xn(this));z(this,"plugins",new Map);const{content:e="",style:r={},measureDom:n,effects:o}=t;this.content=e,this.style=r,this.measureDom=n,this.effects=o,this.use(Zn()).use(Kn()).use(ti())}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}use(t){return this.plugins.set(t.name,t),this}measure(t=this.measureDom){this.computedStyle={...Tr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(a=>a.update());const n=[...this.plugins.values()];n.sort((a,h)=>(a.updateOrder??0)-(h.updateOrder??0)).forEach(a=>{var h;(h=a.update)==null||h.call(a,this)});const o=M.MAX,s=M.MIN;return r.forEach(a=>a.getGlyphMinMax(o,s)),this.renderBoundingBox=new H(o.x,o.y,s.x-o.x,s.y-o.y),this.renderBoundingBox=H.from(this.renderBoundingBox,...n.map(a=>a.getBoundingBox?a.getBoundingBox(this):Qt(a.paths??[])).filter(Boolean)),this}render(t){const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),Dr(n,r,this.renderBoundingBox),Nr(n,this),[...this.plugins.values()].sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;s.render?(a=s.render)==null||a.call(s,n,this):s.paths&&s.paths.forEach(h=>{Ce({ctx:n,path:h,fontSize:this.computedStyle.fontSize})})}),this):this}}f.BoundingBox=H,f.Character=Hn,f.CircleCurve=Be,f.CmapSubtableFormat0=sr,f.CmapSubtableFormat12=hr,f.CmapSubtableFormat14=me,f.CmapSubtableFormat2=pe,f.CmapSubtableFormat4=lr,f.CmapSubtableFormat6=Rt,f.CubicBezierCurve=Tn,f.Curve=_t,f.CurvePath=ee,f.EllipseCurve=An,f.Eot=Ui,f.Font=Oe,f.Fonts=mn,f.Fragment=Qn,f.Glyph=tr,f.GlyphSet=er,f.HeartCurve=Do,f.LineCurve=Ht,f.Matrix3=mt,f.Measurer=Xn,f.Paragraph=ne,f.Parser=Yn,f.Path2D=bt,f.PloygonCurve=Eo,f.QuadraticBezierCurve=En,f.RectangularCurve=Ln,f.Sfnt=ue,f.SplineCurve=$n,f.TableDirectory=Zt,f.Text=fa,f.Ttf=st,f.Vector2=M,f.Woff=Ut,f.WoffTableDirectoryEntry=qt,f.addPathCommandsToPath2D=yr,f.componentFlags=Jt,f.createCmapSegments=ar,f.defaultTextStyles=Tr,f.definePlugin=aa,f.defineSfntTable=it,f.drawPath=Ce,f.effect=Zn,f.fillBackground=ai,f.filterEmpty=Ve,f.fonts=wn,f.getPathsBoundingBox=Qt,f.getTransform2D=_r,f.highlight=Kn,f.isNone=re,f.listStyle=ti,f.minify=ao,f.minifyGlyphs=vn,f.minifySfnt=bn,f.parse=gn,f.parseArcCommand=xn,f.parseColor=ot,f.parsePathDataArgs=Pt,f.parseSvg=Sr,f.parseSvgToDom=Wn,f.pathCommandsToPathData=Cn,f.pathDataToPathCommands=mr,f.pathsToCanvas=ia,f.pathsToSvg=na,f.pathsToSvgString=Pr,f.pathsToSvgUrl=ra,f.setCanvasContext=pr,f.setupView=Dr,f.uploadColor=Tt,f.uploadColors=Nr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -853,17 +853,35 @@ function parseStrokeWidthScale(strokeWidth, fontSize, total) {
853
853
  return strokeWidth / total;
854
854
  }
855
855
  }
856
- function getTransformMatrix(a, b, c) {
857
- const scaleX = c.width / b.width;
858
- const scaleY = c.height / b.height;
859
- const aCenterInB = new Vector2(a.x + a.width / 2, a.y + a.height / 2);
860
- const cCenter = new Vector2(c.x + c.width / 2, c.y + c.height / 2);
861
- const translatedCenterInC = cCenter.add(
862
- aCenterInB.clone().sub(new Vector2(b.x + b.width / 2, b.y + b.height / 2)).scale(scaleX, scaleY)
863
- );
864
- const newX = translatedCenterInC.x - a.width * scaleX / 2;
865
- const newY = translatedCenterInC.y - a.height * scaleY / 2;
866
- return new Matrix3().translate(-a.left, -a.top).scale(scaleX, scaleY).translate(newX, newY);
856
+ function getTransformMatrix(a, b, c, isVertical) {
857
+ let scale;
858
+ if (isVertical) {
859
+ scale = {
860
+ x: c.width / b.height,
861
+ y: c.height / b.width
862
+ };
863
+ } else {
864
+ scale = {
865
+ x: c.width / b.width,
866
+ y: c.height / b.height
867
+ };
868
+ }
869
+ const offset = c.getCenterPoint().add(
870
+ a.getCenterPoint().sub(b.getCenterPoint()).scale(scale.x, scale.y)
871
+ ).sub({
872
+ x: a.width * scale.x / 2,
873
+ y: a.height * scale.y / 2
874
+ });
875
+ const m = new Matrix3();
876
+ m.translate(-a.left, -a.top);
877
+ if (isVertical) {
878
+ m.translate(-a.width / 2, -a.height / 2);
879
+ m.rotate(Math.PI / 2);
880
+ m.translate(a.width / 2, a.height / 2);
881
+ }
882
+ m.scale(scale.x, scale.y);
883
+ m.translate(offset.x, offset.y);
884
+ return m;
867
885
  }
868
886
  function highlight() {
869
887
  const paths = [];
@@ -906,7 +924,8 @@ function highlight() {
906
924
  };
907
925
  }).forEach((group2) => {
908
926
  const { style, box: groupBox } = group2;
909
- const { fontSize } = style;
927
+ const { fontSize, writingMode } = style;
928
+ const isVertical = writingMode.includes("vertical");
910
929
  const strokeWidthScale = parseStrokeWidthScale(style.highlightStrokeWidth, fontSize, groupBox.width);
911
930
  const charsPerRepeat = parseCharsPerRepeat(style.highlightSize, fontSize, groupBox.width);
912
931
  const highlightOverflow = isNone(style.highlightOverflow) ? charsPerRepeat ? "hidden" : "visible" : style.highlightOverflow;
@@ -914,8 +933,13 @@ function highlight() {
914
933
  const svgPaths = getPaths(style.highlightImage);
915
934
  const box = getPathsBoundingBox(svgPaths, true);
916
935
  const refBox = getPathsBoundingBox(refPaths, false);
917
- const transform = getTransformMatrix(box, refBox, groupBox);
918
936
  const unitWidth = charsPerRepeat ? fontSize * charsPerRepeat : groupBox.width;
937
+ const transform = getTransformMatrix(
938
+ box,
939
+ refBox,
940
+ new BoundingBox(groupBox.left, groupBox.top, unitWidth, groupBox.height),
941
+ isVertical
942
+ );
919
943
  const styleScale = fontSize / box.width * 2;
920
944
  const total = Math.ceil(groupBox.width / unitWidth);
921
945
  for (let i = 0; i < total; i++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.36",
4
+ "version": "0.2.37",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "modern-font": "^0.2.1",
61
- "modern-path2d": "^0.2.3"
61
+ "modern-path2d": "^0.2.4"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@antfu/eslint-config": "^3.7.3",