msdfgen-ts 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -6
- package/dist/atlas-worker.js +2727 -1307
- package/dist/msdfgen-ts.iife.js +3 -2
- package/dist/msdfgen-ts.js +3153 -1378
- package/dist/types/atlas-gen.d.ts +58 -28
- package/dist/types/font/font.d.ts +38 -3
- package/dist/types/font/glyph-run.d.ts +50 -0
- package/dist/types/font/script.d.ts +47 -0
- package/dist/types/font/shaper.d.ts +41 -0
- package/dist/types/font/tables/gdef.d.ts +25 -0
- package/dist/types/font/tables/glyf.d.ts +3 -1
- package/dist/types/font/tables/gpos.d.ts +85 -0
- package/dist/types/font/tables/kern.d.ts +31 -14
- package/dist/types/font/tables/otl.d.ts +27 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/msdf/shape-msdf.d.ts +51 -0
- package/dist/types/shape/normalize.d.ts +12 -1
- package/dist/types/shape/union.d.ts +58 -0
- package/dist/types/svg/svg.d.ts +78 -0
- package/package.json +40 -18
package/dist/msdfgen-ts.iife.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var MsdfgenTs=(function(At){"use strict";function so(e,n,t,s){return e*t+n*s}function J(e,n,t,s){return e*s-n*t}function oo(e,n,t){return(1-t)*e+t*n}function rt(e){return+(e>0)-+(e<0)}function Et(e){return 2*+(e>0)-1}function Zn(e,n,t,s){if(n===0||Math.abs(t)>1e12*Math.abs(n))return t===0?s===0?-1:0:(e[0]=-s/t,1);const i=t*t-4*n*s;if(i>0){const o=Math.sqrt(i);return e[0]=(-t+o)/(2*n),e[1]=(-t-o)/(2*n),2}else if(i===0)return e[0]=-t/(2*n),1;return 0}function io(e,n,t,s){const i=n*n,o=1/9*(i-3*t),l=1/54*(n*(2*i-9*t)+27*s),c=l*l,r=o*o*o,h=n*(1/3);if(c<r){let p=l/Math.sqrt(r);p<-1&&(p=-1),p>1&&(p=1),p=Math.acos(p);const a=-2*Math.sqrt(o);return e[0]=a*Math.cos(.3333333333333333*p)-h,e[1]=a*Math.cos(.3333333333333333*(p+2*Math.PI))-h,e[2]=a*Math.cos(.3333333333333333*(p-2*Math.PI))-h,3}else{const p=(l<0?1:-1)*Math.pow(Math.abs(l)+Math.sqrt(c-r),.3333333333333333),a=p===0?0:o/p;return e[0]=p+a-h,p===a||Math.abs(p-a)<1e-12*Math.abs(p+a)?(e[1]=-.5*(p+a)-h,2):1}}function eo(e,n,t,s,i){if(n!==0){const o=t/n;if(Math.abs(o)<1e6)return io(e,o,s/n,i/n)}return Zn(e,t,s,i)}const co=24;function St(e,n,t,s){return((s+e)*s+n)*s+t}function ro(e,n,t,s,i,o,l){const c=o<0;let r=s-o*(i-s)/(l-o);r>s&&r<i||(r=.5*(s+i));for(let h=0;h<co;h++){const p=St(e,n,t,r);if(p===0)return r;p<0===c?s=r:i=r;const a=(3*r+2*e)*r+n;let f=r-p/a;f>s&&f<i||(f=.5*(s+i));const y=f-r;if(r=f,(y<0?-y:y)<=1e-15*(r<0?-r:r))break}return r}function Ut(e,n,t,s,i,o,l,c,r){return o===0?c[r++]=s:o<0!=l<0&&(c[r++]=ro(e,n,t,s,i,o,l)),r}function ao(e,n,t,s,i,o){let l=0;if(e===0){if(n===0)return 0;const f=-t/n;return f>=s&&f<=i&&(o[l++]=f),l}const c=n*n-4*e*t;if(c<0)return 0;const r=Math.sqrt(c),h=-.5*(n+(n<0?-r:r));let p,a;if(h===0)p=0,a=0;else if(p=h/e,a=t/h,p>a){const f=p;p=a,a=f}return p>=s&&p<=i&&(o[l++]=p),a!==p&&a>=s&&a<=i&&(o[l++]=a),l}function ho(e,n,t,s,i,o,l){if(e===0)return ao(n,t,s,i,o,l);const c=1/e;n*=c,t*=c,s*=c;const r=St(n,t,s,i),h=St(n,t,s,o),p=n*n-3*t;let a=0;if(p<=0)a=Ut(n,t,s,i,o,r,h,l,0);else{const f=Math.sqrt(p)/3,y=-n/3,_=y-f,u=y+f;let x=i,M=r;if(_>i&&_<o){const w=St(n,t,s,_);a=Ut(n,t,s,x,_,M,w,l,a),x=_,M=w}if(u>i&&u<o){const w=St(n,t,s,u);a=Ut(n,t,s,x,u,M,w,l,a),x=u,M=w}a=Ut(n,t,s,x,o,M,h,l,a)}return h===0&&(l[a++]=o),a}const ot=0,tt=1,It=2,jn=4,lo=4,U=[0,0,0];class nt{constructor(n,t,s,i,o,l,c,r,h){this.type=n,this.p0x=t,this.p0y=s,this.p1x=i,this.p1y=o,this.p2x=l,this.p2y=c,this.p3x=r,this.p3y=h,this.color=7}endX(){switch(this.type){case ot:return this.p1x;case tt:return this.p2x;default:return this.p3x}}endY(){switch(this.type){case ot:return this.p1y;case tt:return this.p2y;default:return this.p3y}}point(n,t){const s=n;switch(this.type){case ot:{t[0]=this.p0x+s*(this.p1x-this.p0x),t[1]=this.p0y+s*(this.p1y-this.p0y);return}case tt:{const i=this.p0x+s*(this.p1x-this.p0x),o=this.p0y+s*(this.p1y-this.p0y),l=this.p1x+s*(this.p2x-this.p1x),c=this.p1y+s*(this.p2y-this.p1y);t[0]=i+s*(l-i),t[1]=o+s*(c-o);return}default:{const i=this.p0x+s*(this.p1x-this.p0x),o=this.p0y+s*(this.p1y-this.p0y),l=this.p1x+s*(this.p2x-this.p1x),c=this.p1y+s*(this.p2y-this.p1y),r=this.p2x+s*(this.p3x-this.p2x),h=this.p2y+s*(this.p3y-this.p2y),p=i+s*(l-i),a=o+s*(c-o),f=l+s*(r-l),y=c+s*(h-c);t[0]=p+s*(f-p),t[1]=a+s*(y-a);return}}}direction(n,t){const s=n;switch(this.type){case ot:{t[0]=this.p1x-this.p0x,t[1]=this.p1y-this.p0y;return}case tt:{const i=this.p1x-this.p0x+s*(this.p2x-this.p1x-(this.p1x-this.p0x)),o=this.p1y-this.p0y+s*(this.p2y-this.p1y-(this.p1y-this.p0y));i!==0||o!==0?(t[0]=i,t[1]=o):(t[0]=this.p2x-this.p0x,t[1]=this.p2y-this.p0y);return}default:{const i=this.p1x-this.p0x,o=this.p1y-this.p0y,l=this.p2x-this.p1x,c=this.p2y-this.p1y,r=this.p3x-this.p2x,h=this.p3y-this.p2y,p=i+s*(l-i)+s*(l+s*(r-l)-(i+s*(l-i))),a=o+s*(c-o)+s*(c+s*(h-c)-(o+s*(c-o)));p!==0||a!==0?(t[0]=p,t[1]=a):s===0?(t[0]=this.p2x-this.p0x,t[1]=this.p2y-this.p0y):s===1?(t[0]=this.p3x-this.p1x,t[1]=this.p3y-this.p1y):(t[0]=p,t[1]=a);return}}}splitInThirds(){const n=[0,0],t=[0,0];switch(this.type){case ot:{this.point(.3333333333333333,n),this.point(.6666666666666666,t);const s=new nt(ot,this.p0x,this.p0y,n[0],n[1],0,0,0,0),i=new nt(ot,n[0],n[1],t[0],t[1],0,0,0,0),o=new nt(ot,t[0],t[1],this.p1x,this.p1y,0,0,0,0);return s.color=i.color=o.color=this.color,[s,i,o]}case tt:{this.point(.3333333333333333,n),this.point(.6666666666666666,t);const s=this.p0x+1/3*(this.p1x-this.p0x),i=this.p0y+1/3*(this.p1y-this.p0y),o=this.p0x+5/9*(this.p1x-this.p0x),l=this.p0y+5/9*(this.p1y-this.p0y),c=this.p1x+4/9*(this.p2x-this.p1x),r=this.p1y+4/9*(this.p2y-this.p1y),h=o+.5*(c-o),p=l+.5*(r-l),a=this.p1x+2/3*(this.p2x-this.p1x),f=this.p1y+2/3*(this.p2y-this.p1y),y=new nt(tt,this.p0x,this.p0y,s,i,n[0],n[1],0,0),_=new nt(tt,n[0],n[1],h,p,t[0],t[1],0,0),u=new nt(tt,t[0],t[1],a,f,this.p2x,this.p2y,0,0);return y.color=_.color=u.color=this.color,[y,_,u]}default:{this.point(.3333333333333333,n),this.point(.6666666666666666,t);const s=this.p0x===this.p1x&&this.p0y===this.p1y?this.p0x:this.p0x+1/3*(this.p1x-this.p0x),i=this.p0x===this.p1x&&this.p0y===this.p1y?this.p0y:this.p0y+1/3*(this.p1y-this.p0y),o=this.p0x+1/3*(this.p1x-this.p0x),l=this.p0y+1/3*(this.p1y-this.p0y),c=this.p1x+1/3*(this.p2x-this.p1x),r=this.p1y+1/3*(this.p2y-this.p1y),h=this.p2x+1/3*(this.p3x-this.p2x),p=this.p2y+1/3*(this.p3y-this.p2y),a=o+1/3*(c-o),f=l+1/3*(r-l),y=c+1/3*(h-c),_=r+1/3*(p-r),u=a+2/3*(y-a),x=f+2/3*(_-f),M=this.p0x+2/3*(this.p1x-this.p0x),w=this.p0y+2/3*(this.p1y-this.p0y),v=this.p1x+2/3*(this.p2x-this.p1x),C=this.p1y+2/3*(this.p2y-this.p1y),A=this.p2x+2/3*(this.p3x-this.p2x),D=this.p2y+2/3*(this.p3y-this.p2y),I=M+2/3*(v-M),L=w+2/3*(C-w),m=v+2/3*(A-v),b=C+2/3*(D-C),N=I+1/3*(m-I),R=L+1/3*(b-L),q=this.p2x===this.p3x&&this.p2y===this.p3y?this.p3x:this.p2x+2/3*(this.p3x-this.p2x),P=this.p2x===this.p3x&&this.p2y===this.p3y?this.p3y:this.p2y+2/3*(this.p3y-this.p2y),X=new nt(It,this.p0x,this.p0y,s,i,a,f,n[0],n[1]),$=new nt(It,n[0],n[1],u,x,N,R,t[0],t[1]),V=new nt(It,t[0],t[1],m,b,q,P,this.p3x,this.p3y);return X.color=$.color=V.color=this.color,[X,$,V]}}}signedDistance(n,t,s){switch(this.type){case ot:{const i=this.p0x,o=this.p0y,l=this.p1x,c=this.p1y,r=n-i,h=t-o,p=l-i,a=c-o,f=p*p+a*a,y=(r*p+h*a)/f,_=y>.5,u=(_?l:i)-n,x=(_?c:o)-t,M=Math.sqrt(u*u+x*x);if(y>0&&y<1){const C=Math.sqrt(p*p+a*a),A=p/C,I=a/C*r-A*h;if(Math.abs(I)<M){s.distance=I,s.dot=0,s.param=y;return}}const w=r*a-h*p;s.distance=Et(w)*M;const v=Math.sqrt(p*p+a*a);s.dot=M===0||v===0?0:Math.abs((p*u+a*x)/(v*M)),s.param=y;return}case tt:{const i=this.p0x,o=this.p0y,l=this.p1x,c=this.p1y,r=this.p2x,h=this.p2y,p=i-n,a=o-t,f=l-i,y=c-o,_=r-l-f,u=h-c-y,x=_*_+u*u,M=3*(f*_+y*u),w=2*(f*f+y*y)+(p*_+a*u),v=p*f+a*y,C=ho(x,M,w,v,0,1,U);let A=f,D=y;const I=p*p+a*a;let L=Et(A*a-D*p),m=I,b=-(p*A+a*D)/(A*A+D*D);{const R=r-n,q=h-t,P=R*R+q*q;P<m&&(A=r-l,D=h-c,L=Et(A*q-D*R),m=P,b=((n-l)*A+(t-c)*D)/(A*A+D*D))}for(let R=0;R<C;++R){const q=U[R];if(q>0&&q<1){const P=p+2*q*f+q*q*_,X=a+2*q*y+q*q*u,$=P*P+X*X;if($<=m){const V=f+q*_,et=y+q*u;L=Et(V*X-et*P),m=$,b=q}}}const N=L*Math.sqrt(m);if(b>=0&&b<=1){s.distance=N,s.dot=0,s.param=b;return}if(s.distance=N,s.param=b,b<.5){const R=Math.sqrt(f*f+y*y),q=Math.sqrt(I);s.dot=q===0||R===0?0:Math.abs((f*p+y*a)/(R*q))}else{const R=r-l,q=h-c,P=r-n,X=h-t,$=Math.sqrt(R*R+q*q),V=Math.sqrt(P*P+X*X);s.dot=$===0||V===0?0:Math.abs((R*P+q*X)/($*V))}return}default:{const i=this.p0x,o=this.p0y,l=this.p1x,c=this.p1y,r=this.p2x,h=this.p2y,p=this.p3x,a=this.p3y,f=i-n,y=o-t,_=l-i,u=c-o,x=r-l-_,M=h-c-u,w=p-r-(r-l)-x,v=a-h-(h-c)-M;let C=_,A=u;C===0&&A===0&&(C=r-i,A=h-o);const D=Math.sqrt(f*f+y*y);let I=Et(C*y-A*f)*D,L=-(f*C+y*A)/(C*C+A*A);{const m=p-n,b=a-t,N=Math.sqrt(m*m+b*b);if(N<Math.abs(I)){let R=p-r,q=a-h;R===0&&q===0&&(R=p-l,q=a-c),C=R,A=q,I=Et(C*b-A*m)*N,L=((C-m)*C+(A-b)*A)/(C*C+A*A)}}for(let m=0;m<=jn;++m){let b=1/jn*m,N=f+3*b*_+3*b*b*x+b*b*b*w,R=y+3*b*u+3*b*b*M+b*b*b*v,q=3*_+6*b*x+3*b*b*w,P=3*u+6*b*M+3*b*b*v,X=6*x+6*b*w,$=6*M+6*b*v,V=b-(N*q+R*P)/(q*q+P*P+(N*X+R*$));if(V>0&&V<1){let et=lo;do{if(b=V,N=f+3*b*_+3*b*b*x+b*b*b*w,R=y+3*b*u+3*b*b*M+b*b*b*v,q=3*_+6*b*x+3*b*b*w,P=3*u+6*b*M+3*b*b*v,!--et)break;X=6*x+6*b*w,$=6*M+6*b*v,V=b-(N*q+R*P)/(q*q+P*P+(N*X+R*$))}while(V>0&&V<1);const H=Math.sqrt(N*N+R*R);H<Math.abs(I)&&(I=Et(q*R-P*N)*H,L=b)}}if(L>=0&&L<=1){s.distance=I,s.dot=0,s.param=L;return}if(s.distance=I,s.param=L,L<.5){let m=_,b=u;m===0&&b===0&&(m=r-i,b=h-o);const N=Math.sqrt(m*m+b*b);s.dot=D===0||N===0?0:Math.abs((m*f+b*y)/(N*D))}else{let m=p-r,b=a-h;m===0&&b===0&&(m=p-l,b=a-c);const N=p-n,R=a-t,q=Math.sqrt(m*m+b*b),P=Math.sqrt(N*N+R*R);s.dot=q===0||P===0?0:Math.abs((m*N+b*R)/(q*P))}return}}}scanlineIntersections(n,t,s){switch(this.type){case ot:{const i=this.p0y,o=this.p1y;if(n>=i&&n<o||n>=o&&n<i){const l=(n-i)/(o-i);return t[0]=oo(this.p0x,this.p1x,l),s[0]=rt(o-i),1}return 0}case tt:{const i=this.p0x,o=this.p0y,l=this.p1x,c=this.p1y,r=this.p2x,h=this.p2y;let p=0,a=n>o?1:-1;t[p]=i,o===n&&(o<c||o===c&&o<h?s[p++]=1:a=1);{const f=l-i,y=c-o,_=r-l-f,u=h-c-y,x=Zn(U,u,2*y,o-n);if(x>=2&&U[0]>U[1]){const M=U[0];U[0]=U[1],U[1]=M}for(let M=0;M<x&&p<2;++M){const w=U[M];w>=0&&w<=1&&(t[p]=i+2*w*f+w*w*_,a*(y+w*u)>=0&&(s[p++]=a,a=-a))}}return h===n&&(a>0&&p>0&&(--p,a=-1),(h<c||h===c&&h<o)&&p<2&&(t[p]=r,a<0&&(s[p++]=-1,a=1))),a!==(n>=h?1:-1)&&(p>0?--p:(Math.abs(h-n)<Math.abs(o-n)&&(t[p]=r),s[p++]=a)),p}default:{const i=this.p0x,o=this.p0y,l=this.p1x,c=this.p1y,r=this.p2x,h=this.p2y,p=this.p3x,a=this.p3y;let f=0,y=n>o?1:-1;t[f]=i,o===n&&(o<c||o===c&&(o<h||o===h&&o<a)?s[f++]=1:y=1);{const _=p-3*r+3*l-i,u=a-3*h+3*c-o,x=3*r-6*l+3*i,M=3*h-6*c+3*o,w=3*l-3*i,v=3*c-3*o,C=eo(U,u,M,v,o-n);if(C>=2){if(U[0]>U[1]){const A=U[0];U[0]=U[1],U[1]=A}if(C>=3&&U[1]>U[2]){const A=U[1];if(U[1]=U[2],U[2]=A,U[0]>U[1]){const D=U[0];U[0]=U[1],U[1]=D}}}for(let A=0;A<C&&f<3;++A){const D=U[A];D>=0&&D<=1&&(t[f]=((_*D+x)*D+w)*D+i,y*((3*u*D+2*M)*D+v)>=0&&(s[f++]=y,y=-y))}}return a===n&&(y>0&&f>0&&(--f,y=-1),(a<h||a===h&&(a<c||a===c&&a<o))&&f<3&&(t[f]=p,y<0&&(s[f++]=-1,y=1))),y!==(n>=a?1:-1)&&(f>0?--f:(Math.abs(a-n)<Math.abs(o-n)&&(t[f]=p),s[f++]=y)),f}}}convertToCubic(){const n=this.p0x+.6666666666666666*(this.p1x-this.p0x),t=this.p0y+2/3*(this.p1y-this.p0y),s=this.p1x+1/3*(this.p2x-this.p1x),i=this.p1y+1/3*(this.p2y-this.p1y),o=new nt(It,this.p0x,this.p0y,n,t,s,i,this.p2x,this.p2y);return o.color=this.color,o}}class ut{constructor(n,t=0){this._view=new DataView(n),this._pos=t}get pos(){return this._pos}seek(n){this._pos=n}skip(n){this._pos+=n}u8(){return this._view.getUint8(this._pos++)}u16(){const n=this._view.getUint16(this._pos,!1);return this._pos+=2,n}i16(){const n=this._view.getInt16(this._pos,!1);return this._pos+=2,n}u32(){const n=this._view.getUint32(this._pos,!1);return this._pos+=4,n}i32(){const n=this._view.getInt32(this._pos,!1);return this._pos+=4,n}f2dot14(){return this.i16()/16384}offset16(){return this.u16()}offset32(){return this.u32()}peekU16(n){return this._view.getUint16(n,!1)}peekU32(n){return this._view.getUint32(n,!1)}peekI16(n){return this._view.getInt16(n,!1)}}function po(e,n){const t=new ut(e,n);t.skip(2);const s=t.u16();let i=null;for(let l=0;l<s;l++){const c=t.u16(),r=t.u16(),h=t.u32(),p=n+h,a=t.peekU16(p);let f=-1;c===3&&r===10&&a===12?f=5:c===0&&r===6&&a===12?f=4:c===0&&r===4&&a===12?f=3:c===3&&r===1&&a===4?f=2:c===0&&r<=3&&a===4&&(f=1),f>((i==null?void 0:i.priority)??-1)&&(i={priority:f,subtableAbsOffset:p})}if(!i)return()=>0;const o=t.peekU16(i.subtableAbsOffset);return o===12?fo(e,i.subtableAbsOffset):o===4?yo(e,i.subtableAbsOffset):()=>0}function fo(e,n){const t=new ut(e,n);t.skip(2),t.skip(2),t.skip(4),t.skip(4);const s=t.u32(),i=new Uint32Array(s),o=new Uint32Array(s),l=new Uint32Array(s);for(let c=0;c<s;c++)i[c]=t.u32(),o[c]=t.u32(),l[c]=t.u32();return c=>{let r=0,h=s-1;for(;r<=h;){const p=r+h>>>1,a=i[p]??0,f=o[p]??0;if(c<a)h=p-1;else if(c>f)r=p+1;else return(l[p]??0)+(c-a)}return 0}}function yo(e,n){const t=new ut(e,n);t.skip(2),t.skip(2),t.skip(2);const i=t.u16()>>>1;t.skip(6);const o=new Uint16Array(i);for(let a=0;a<i;a++)o[a]=t.u16();t.skip(2);const l=new Uint16Array(i);for(let a=0;a<i;a++)l[a]=t.u16();const c=new Int16Array(i);for(let a=0;a<i;a++)c[a]=t.i16();const r=new Int32Array(i),h=new Uint16Array(i);for(let a=0;a<i;a++)r[a]=t.pos,h[a]=t.u16();const p=new DataView(e);return a=>{if(a>65535)return 0;let f=0,y=i-1;for(;f<=y;){const _=f+y>>>1,u=o[_]??0;if(a>u)f=_+1;else if(a<(l[_]??0))y=_-1;else{if((o[_]??0)===65535)return 0;const M=h[_]??0,w=c[_]??0,v=l[_]??0;if(M===0)return a+w&65535;const C=(r[_]??0)+M+(a-v)*2,A=p.getUint16(C,!1);return A===0?0:A+w&65535}}return 0}}function uo(e,n){const t=new ut(e,n);t.skip(4),t.skip(4),t.skip(4),t.skip(4),t.skip(2);const s=t.u16();t.skip(16),t.skip(8),t.skip(2),t.skip(2),t.skip(2);const i=t.i16();return{unitsPerEm:s,indexToLocFormat:i}}function _o(e,n){const t=new ut(e,n);t.skip(4);const s=t.i16(),i=t.i16(),o=t.i16();t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(8),t.skip(2);const l=t.u16();return{ascender:s,descender:i,lineGap:o,numberOfHMetrics:l}}function xo(e,n,t,s){const i=new ut(e,n),o=new Array(t);let l=0;for(let c=0;c<s;c++){const r=i.u16(),h=i.i16();o[c]={advanceWidth:r,lsb:h},l=r}for(let c=s;c<t;c++){const r=i.i16();o[c]={advanceWidth:l,lsb:r}}return o}function Mo(e,n,t,s){const i=new ut(e,n),o=t+1,l=new Array(o);if(s===0)for(let c=0;c<o;c++)l[c]=i.u16()*2;else for(let c=0;c<o;c++)l[c]=i.u32();return l}function go(e,n){const t=new ut(e,n);return t.skip(4),{numGlyphs:t.u16()}}const bo=1,Ao=2,wo=4,Do=8,Jn=16,ts=32,Eo=1,ns=2,qo=8,vo=32,Co=64,Io=128;function Ro(e,n,t,s,i){const o=ss(e,n,t,s,i),l=[];for(const c of o){const r=Fo(c);r.length>0&&l.push(r)}return{contours:l,inverseYAxis:!1}}function ss(e,n,t,s,i){if(s===0)return[];const o=n+t,l=new ut(e,o),c=l.i16();return l.skip(8),c>=0?To(l,c):ko(e,l,n,i)}function To(e,n){if(n===0)return[];const t=new Array(n);for(let a=0;a<n;a++)t[a]=e.u16();const s=(t[n-1]??0)+1,i=e.u16();e.skip(i);const o=new Uint8Array(s);for(let a=0;a<s;){const f=e.u8();if(o[a++]=f,f&Do){let y=e.u8();for(;y-- >0;)o[a++]=f}}const l=new Float64Array(s);let c=0;for(let a=0;a<s;a++){const f=o[a]??0;if(f&Ao){const y=e.u8();c+=f&Jn?y:-y}else f&Jn||(c+=e.i16());l[a]=c}const r=new Float64Array(s);c=0;for(let a=0;a<s;a++){const f=o[a]??0;if(f&wo){const y=e.u8();c+=f&ts?y:-y}else f&ts||(c+=e.i16());r[a]=c}const h=[];let p=0;for(let a=0;a<n;a++){const f=t[a]??0,y=mo(o,l,r,p,f);y.length>0&&h.push(y),p=f+1}return h}function mo(e,n,t,s,i){const o=i-s+1;if(o<=0)return[];const l=[];for(let c=0;c<o;c++){const r=e[s+c]??0,h=n[s+c]??0,p=t[s+c]??0;l.push({x:h,y:p,onCurve:(r&bo)!==0})}return l}function Fo(e){const n=e.length;if(n<=0)return[];const t=[];for(let c=0;c<n;c++){const r=e[c],h=e[(c+1)%n];t.push(r),!r.onCurve&&!h.onCurve&&t.push({x:Math.trunc((r.x+h.x)/2),y:Math.trunc((r.y+h.y)/2),onCurve:!0})}const s=t.length;let i=0;if(!t[0].onCurve){for(let c=1;c<s;c++)if(t[c].onCurve){i=c;break}}const o=[];let l=0;for(;l<s;){const c=t[(i+l)%s],r=t[(i+l+1)%s];if(r.onCurve)o.push(new nt(ot,c.x,c.y,r.x,r.y,0,0,0,0)),l+=1;else{const h=t[(i+l+2)%s];o.push(new nt(tt,c.x,c.y,r.x,r.y,h.x,h.y,0,0)),l+=2}}return o}function ko(e,n,t,s){const i=[];let o=0;do{o=n.u16();const l=n.u16();let c,r;o&Eo?(c=n.i16(),r=n.i16()):(c=n.u8(),r=n.u8(),o&ns&&(c>127&&(c-=256),r>127&&(r-=256)));let h=0,p=0;o&ns&&(h=c,p=r);let a=1,f=0,y=0,_=1;o&qo?a=_=n.f2dot14():o&Co?(a=n.f2dot14(),_=n.f2dot14()):o&Io&&(a=n.f2dot14(),f=n.f2dot14(),y=n.f2dot14(),_=n.f2dot14());const u=s(l),x=So(u,a,f,y,_,h,p);for(const M of x)i.push(M)}while(o&vo);return i}function os(e){return e>=0?Math.floor(e+.5):Math.ceil(e-.5)}function So(e,n,t,s,i,o,l){if(n===1&&t===0&&s===0&&i===1&&o===0&&l===0)return e;const r=n===1&&t===0&&s===0&&i===1;return e.map(h=>h.map(p=>r?{x:p.x+o,y:p.y+l,onCurve:p.onCurve}:{x:os(n*p.x+t*p.y+o),y:os(s*p.x+i*p.y+l),onCurve:p.onCurve}))}function Lo(e,n){const t=new ut(e,n);if(t.u16()!==0)return is;const i=t.u16(),o=new Map;for(let l=0;l<i;l++){const c=t.pos;t.skip(2);const r=t.u16(),h=t.u16(),p=h>>8&255,a=!(h&2),f=!!(h&4);if(p!==0||!a||f){t.seek(c+r);continue}const y=t.u16();t.skip(6);for(let _=0;_<y;_++){const u=t.u16(),x=t.u16(),M=t.i16(),w=(u&65535)<<16|x&65535;o.set(w,M)}t.seek(c+r)}return o.size===0?is:(l,c)=>{const r=(l&65535)<<16|c&65535;return o.get(r)??0}}const is=()=>0;function Go(e){const n=new ut(e);if(n.u32()===1953784678){if(n.skip(4),n.u32()===0)throw new Error("TTC contains no fonts");const i=n.u32();n.seek(i)}else n.seek(0);return Oo(e,n)}function Oo(e,n){n.skip(4);const t=n.u16();n.skip(6);const s=new Map;for(let i=0;i<t;i++){const o=String.fromCharCode(n.u8(),n.u8(),n.u8(),n.u8());n.skip(4);const l=n.u32(),c=n.u32();s.set(o,{offset:l,length:c})}return s}class Po{constructor(n){this._buffer=n,this._tables=Go(n);const t=this._tables.get("head"),s=this._tables.get("maxp"),i=this._tables.get("hhea"),o=this._tables.get("hmtx"),l=this._tables.get("loca"),c=this._tables.get("cmap");if(!t)throw new Error("Font missing required `head` table");if(!s)throw new Error("Font missing required `maxp` table");if(!i)throw new Error("Font missing required `hhea` table");if(!o)throw new Error("Font missing required `hmtx` table");if(!l)throw new Error("Font missing required `loca` table");if(!c)throw new Error("Font missing required `cmap` table");this._head=uo(n,t.offset);const r=go(n,s.offset);this._hhea=_o(n,i.offset),this._hmtx=xo(n,o.offset,r.numGlyphs,this._hhea.numberOfHMetrics),this._loca=Mo(n,l.offset,r.numGlyphs,this._head.indexToLocFormat),this._cmap=po(n,c.offset);const h=this._tables.get("kern");this._kern=h?Lo(n,h.offset):()=>0,this.metrics={unitsPerEm:this._head.unitsPerEm,ascender:this._hhea.ascender,descender:this._hhea.descender,lineGap:this._hhea.lineGap}}glyphId(n){return this._cmap(n)}get numGlyphs(){return this._loca.length-1}advance(n){return(this._hmtx[n]??this._hmtx[this._hmtx.length-1]??{advanceWidth:0}).advanceWidth}lsb(n){return(this._hmtx[n]??this._hmtx[this._hmtx.length-1]??{lsb:0}).lsb}kerning(n,t){return this._kern(n,t)}shape(n){const t=this._tables.get("glyf");if(!t)return{contours:[],inverseYAxis:!1};const s=this._loca,i=s[n]??0,l=(s[n+1]??i)-i;return Ro(this._buffer,t.offset,i,l,c=>this._glyphRaw(c))}_glyphRaw(n){const t=this._tables.get("glyf");if(!t)return[];const s=this._loca,i=s[n]??0,l=(s[n+1]??i)-i;return ss(this._buffer,t.offset,i,l,c=>this._glyphRaw(c))}}function No(e,n){const t=1/n;for(const s of e.contours)for(let i=0;i<s.length;i++){const o=s[i];if(o.p0x*=t,o.p0y*=t,o.p1x*=t,o.p1y*=t,o.p2x*=t,o.p2y*=t,o.p3x*=t,o.p3y*=t,o.type===tt){const l=o.p1x-o.p0x,c=o.p1y-o.p0y,r=o.p2x-o.p1x,h=o.p2y-o.p1y;J(l,c,r,h)===0&&(s[i]=new nt(ot,o.p0x,o.p0y,o.p2x,o.p2y,0,0,0,0))}}}const es=1e-6,Uo=1.1111111111111112,Yo=new Float64Array(16);function cs(e,n,t){switch(n[t]=e.p0x,n[t+1]=e.p0y,n[t+2]=e.p1x,n[t+3]=e.p1y,e.type){case ot:return 1;case tt:return n[t+4]=e.p2x,n[t+5]=e.p2y,2;default:return n[t+4]=e.p2x,n[t+5]=e.p2y,n[t+6]=e.p3x,n[t+7]=e.p3y,3}}function rs(e,n,t){if(t===3){const s=e[n],i=e[n+1],o=e[n+2],l=e[n+3],c=e[n+4],r=e[n+5],h=e[n+6],p=e[n+7];(o===s&&l===i||o===h&&l===p)&&(c===s&&r===i||c===h&&r===p)&&(e[n+2]=h,e[n+3]=p,t=1)}if(t===2){const s=e[n],i=e[n+1],o=e[n+2],l=e[n+3],c=e[n+4],r=e[n+5];(o===s&&l===i||o===c&&l===r)&&(e[n+2]=c,e[n+3]=r,t=1)}return t===1&&e[n]===e[n+2]&&e[n+1]===e[n+3]&&(t=0),t}function Xo(e,n){const t=Yo;let s=cs(e,t,0),i=cs(n,t,8);if(!(s>=1&&s<=3&&i>=1&&i<=3)||t[s*2]!==t[8]||t[s*2+1]!==t[9])return 0;s=rs(t,0,s),i=rs(t,8,i);const o=t[s*2],l=t[s*2+1];let c=0,r=0,h=0,p=0,a=0,f=0,y=0,_=0,u=0,x=0,M=0,w=0;if(s>=1&&(c=t[(s-1)*2]-o,r=t[(s-1)*2+1]-l),s>=2){const H=t[(s-2)*2]-t[(s-1)*2],B=t[(s-2)*2+1]-t[(s-1)*2+1];h=H-c,p=B-r}if(s>=3){const H=t[(s-3)*2]-t[(s-2)*2],B=t[(s-3)*2+1]-t[(s-2)*2+1],ft=t[(s-2)*2]-t[(s-1)*2],ct=t[(s-2)*2+1]-t[(s-1)*2+1];a=H-ft-h,f=B-ct-p,h*=3,p*=3}if(i>=1&&(y=t[10]-o,_=t[11]-l),i>=2){const H=t[12]-t[10],B=t[13]-t[11];u=H-y,x=B-_}if(i>=3){const H=t[14]-t[12],B=t[15]-t[13],ft=t[12]-t[10],ct=t[13]-t[11];M=H-ft-u,w=B-ct-x,u*=3,x*=3}c*=s,r*=s,y*=i,_*=i;const v=c!==0||r!==0;if(v&&(y!==0||_!==0)){const H=Math.sqrt(c*c+r*r),B=Math.sqrt(y*y+_*_),ft=H*J(c,r,u,x)+B*J(h,p,y,_);if(ft)return rt(ft);const ct=H*H*J(c,r,M,w)+H*B*J(h,p,u,x)+B*B*J(a,f,y,_);if(ct)return rt(ct);const Nt=H*J(h,p,M,w)+B*J(a,f,u,x);return rt(Nt||J(a,f,M,w))}let A=1,D=h,I=p,L=a,m=f,b=y,N=_,R=u,q=x,P=M,X=w;if(v&&(D=u,I=x,L=M,m=w,b=c,N=r,R=h,q=p,P=a,X=f,A=-1),b!==0||N!==0){const H=J(L,m,b,N);if(H)return A*rt(H);const B=J(D,I,R,q);if(B)return A*rt(B);const ft=J(L,m,R,q);if(ft)return A*rt(ft);const ct=J(D,I,P,X);return ct?A*rt(ct):A*rt(J(L,m,P,X))}const $=Math.sqrt(D*D+I*I),V=Math.sqrt(R*R+q*q),et=Math.sqrt($)*J(D,I,P,X)+Math.sqrt(V)*J(L,m,R,q);return rt(et||J(L,m,P,X))}function as(e,n,t,s,i){let o=e[n];if(o.type===tt){const l=o.convertToCubic();e[n]=l,o=l}if(o.type===It)if(t===0){const l=Math.sqrt((o.p1x-o.p0x)**2+(o.p1y-o.p0y)**2);o.p1x+=l*s,o.p1y+=l*i}else{const l=Math.sqrt((o.p2x-o.p3x)**2+(o.p2y-o.p3y)**2);o.p2x+=l*s,o.p2y+=l*i}}const Lt=[0,0],Gt=[0,0];function Wo(e){for(let n=0;n<e.contours.length;n++){const t=e.contours[n];let s=0;for(let i=0;i<t.length;i++){const o=t[i];(o.p0x!==o.endX()||o.p0y!==o.endY())&&(t[s++]=o)}t.length=s}for(const n of e.contours)if(n.length===1){const[t,s,i]=n[0].splitInThirds();n.length=0,n.push(t,s,i)}else if(n.length>0){const t=n.length;for(let s=0;s<t;s++){const i=(s+t-1)%t,o=n[i],l=n[s];o.direction(1,Lt),l.direction(0,Gt);const c=Math.sqrt(Lt[0]**2+Lt[1]**2),r=Math.sqrt(Gt[0]**2+Gt[1]**2);if(c===0||r===0)continue;const h=Lt[0]/c,p=Lt[1]/c,a=Gt[0]/r,f=Gt[1]/r;if(so(h,p,a,f)<es-1){const y=es-1,_=Uo*Math.sqrt(1-y*y)/y;let u=a-h,x=f-p;const M=Math.sqrt(u*u+x*x);if(M===0)continue;u=_*u/M,x=_*x/M,Xo(o,l)<0&&(u=-u,x=-x),as(n,i,1,-x,u),as(n,s,0,x,-u)}}}}const Yt=1,Xt=2,Ho=3,Wt=4,Vo=5,Bo=6,en=7,it=[0,0],qt=[0,0];function zo(e,n){return Math.trunc(3+2.875*e/(n-1)-1.4375+.5)-3}function Qo(e,n,t,s,i){return e*t+n*s<=0||Math.abs(e*s-n*t)>i}function $o(e){const n=Number(e.v&1n);return e.v>>=1n,n}function Ko(e){const n=Number(e.v%3n);return e.v/=3n,n}function hs(e){return[Bo,Vo,Ho][Ko(e)]}function Ot(e,n){const t=e.v<<1+$o(n);e.v=(t|t>>3)&en}function Zo(e,n,t){const s=e.v&t;s===Yt||s===Xt||s===Wt?e.v=s^en:Ot(e,n)}function jo(e,n,t=0n){const s=Math.sin(n),i={v:hs({v:t})},o={v:t};o.v=t,i.v=hs(o);const l=[];for(const c of e.contours){if(c.length===0)continue;l.length=0,c[c.length-1].direction(1,it);const h=Math.sqrt(it[0]*it[0]+it[1]*it[1]);let p=h>0?it[0]/h:0,a=h>0?it[1]/h:0;for(let f=0;f<c.length;f++){const y=c[f];y.direction(0,qt);const _=Math.sqrt(qt[0]*qt[0]+qt[1]*qt[1]),u=_>0?qt[0]/_:0,x=_>0?qt[1]/_:0;Qo(p,a,u,x,s)&&l.push(f),y.direction(1,it);const M=Math.sqrt(it[0]*it[0]+it[1]*it[1]);p=M>0?it[0]/M:0,a=M>0?it[1]/M:0}if(l.length===0){Ot(i,o);for(const f of c)f.color=i.v}else if(l.length===1){const f=[0,en,0];Ot(i,o),f[0]=i.v,Ot(i,o),f[2]=i.v;const y=l[0],_=c.length;if(_>=3)for(let u=0;u<_;u++){const x=zo(u,_);c[(y+u)%_].color=f[1+x]}else if(_>=1){const u=[null,null,null,null,null,null,null],x=c[0].splitInThirds();if(u[0+3*y]=x[0],u[1+3*y]=x[1],u[2+3*y]=x[2],_>=2){const M=c[1].splitInThirds();u[3-3*y]=M[0],u[4-3*y]=M[1],u[5-3*y]=M[2],u[0].color=u[1].color=f[0],u[2].color=u[3].color=f[1],u[4].color=u[5].color=f[2]}else u[0].color=f[0],u[1].color=f[1],u[2].color=f[2];c.length=0;for(const M of u)M!==null&&c.push(M)}}else{const f=l.length;let y=0;const _=l[0],u=c.length;Ot(i,o);const x=i.v;for(let M=0;M<u;M++){const w=(_+M)%u;y+1<f&&l[y+1]===w&&(++y,Zo(i,o,y===f-1?x:0)),c[w].color=i.v}}}}const Y=Number.MAX_VALUE,T=[0,0],ht=[0,0];let ls=0,z=new Float64Array(0),K=new Float64Array(0),k=new Float64Array(0),S=new Float64Array(0),Z=new Int32Array(0),j=new Float64Array(0),Rt=new Float64Array(0),Tt=new Float64Array(0),mt=new Float64Array(0),vt=new Int32Array(0);const Q=[0,0];let ps=0,cn=new Float64Array(0),rn=new Float64Array(0),an=new Float64Array(0),hn=new Float64Array(0),ln=new Float64Array(0),pn=new Float64Array(0),fn=new Float64Array(0),yn=new Float64Array(0),un=new Float64Array(0),_n=new Float64Array(0),xn=new Float64Array(0),Mn=new Float64Array(0),fs=0,Pt=new Int32Array(0);function Jo(e){const n=e.length;if(n===0)return 0;let t=0;if(n===1){e[0].point(0,Q);const s=Q[0],i=Q[1];e[0].point(.3333333333333333,Q);const o=Q[0],l=Q[1];e[0].point(.6666666666666666,Q);const c=Q[0],r=Q[1];t+=s*l-i*o,t+=o*r-l*c,t+=c*i-r*s}else if(n===2){e[0].point(0,Q);const s=Q[0],i=Q[1];e[0].point(.5,Q);const o=Q[0],l=Q[1];e[1].point(0,Q);const c=Q[0],r=Q[1];e[1].point(.5,Q);const h=Q[0],p=Q[1];t+=s*l-i*o,t+=o*r-l*c,t+=c*p-r*h,t+=h*i-p*s}else{const s=e[n-1];let i=s.p0x,o=s.p0y;for(let l=0;l<n;l++){const c=e[l].p0x,r=e[l].p0y;t+=i*r-o*c,i=c,o=r}}return t>0?-1:t<0?1:0}function ti(e,n,t,s,i,o,l){const c=l[e][n];let r=t;if(o<0){c.direction(0,T);const h=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(h>0){const p=T[0]/h,a=T[1]/h;c.point(0,ht);const f=s-ht[0],y=i-ht[1];if(f*p+y*a<0){const u=f*a-y*p;Math.abs(u)<=Math.abs(r)&&(r=u)}}}if(o>1){c.direction(1,T);const h=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(h>0){const p=T[0]/h,a=T[1]/h;c.point(1,ht);const f=s-ht[0],y=i-ht[1];if(f*p+y*a>0){const u=f*a-y*p;Math.abs(u)<=Math.abs(r)&&(r=u)}}}return r}function lt(e,n,t,s,i,o,l,c,r){let h=e<0?n:t;if(i>=0){const p=ti(s,i,e,l,c,o,r);Math.abs(p)<Math.abs(h)&&(h=p)}return h}function _t(e,n,t){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function ni(e,n,t,s,i,o,l,c){if(c.length!==n*t*3)throw new Error(`generateMSDF: out.length ${c.length} !== ${n*t*3}`);const r=e.contours,h=r.length;if(h===0){c.fill(0);return}const p=s/l;vt.length<h&&(vt=new Int32Array(h));for(let y=0;y<h;y++)vt[y]=Jo(r[y]);fs<h+1&&(Pt=new Int32Array(h+1),fs=h+1);let a=0;for(let y=0;y<h;y++)Pt[y]=a,a+=r[y].length;Pt[h]=a,ps<a&&(cn=new Float64Array(a),rn=new Float64Array(a),an=new Float64Array(a),hn=new Float64Array(a),ln=new Float64Array(a),pn=new Float64Array(a),fn=new Float64Array(a),yn=new Float64Array(a),un=new Float64Array(a),_n=new Float64Array(a),xn=new Float64Array(a),Mn=new Float64Array(a),ps=a);for(let y=0;y<h;y++){const _=r[y],u=_.length,x=Pt[y];for(let M=0;M<u;M++){const w=_[M],v=_[(M+u-1)%u],C=_[(M+1)%u],A=x+M;w.point(0,ht),cn[A]=ht[0],rn[A]=ht[1],w.point(1,ht),an[A]=ht[0],hn[A]=ht[1],w.direction(0,T);let D=Math.sqrt(T[0]*T[0]+T[1]*T[1]);const I=D>0?T[0]/D:0,L=D>0?T[1]/D:0;ln[A]=I,pn[A]=L,w.direction(1,T),D=Math.sqrt(T[0]*T[0]+T[1]*T[1]);const m=D>0?T[0]/D:0,b=D>0?T[1]/D:0;fn[A]=m,yn[A]=b,v.direction(1,T),D=Math.sqrt(T[0]*T[0]+T[1]*T[1]);const N=D>0?T[0]/D:0,R=D>0?T[1]/D:0;C.direction(0,T),D=Math.sqrt(T[0]*T[0]+T[1]*T[1]);const q=D>0?T[0]/D:0,P=D>0?T[1]/D:0,X=N+I,$=R+L,V=Math.sqrt(X*X+$*$);un[A]=V>0?X/V:0,_n[A]=V>0?$/V:0;const et=m+q,H=b+P,B=Math.sqrt(et*et+H*H);xn[A]=B>0?-(et/B):0,Mn[A]=B>0?-(H/B):0}}if(ls<h){const y=h*3;z=new Float64Array(y),K=new Float64Array(y),k=new Float64Array(y),S=new Float64Array(y),Z=new Int32Array(y),j=new Float64Array(y),Rt=new Float64Array(h),Tt=new Float64Array(h),mt=new Float64Array(h),ls=h}const f={distance:0,dot:0,param:0};for(let y=0;y<t;y++)for(let _=0;_<n;_++){const u=(_+.5)/s-i,x=(y+.5)/s-o;for(let E=0;E<h;E++){const d=r[E],at=d.length,g=E*3,G=Pt[E];z[g]=z[g+1]=z[g+2]=-Y,K[g]=K[g+1]=K[g+2]=0,k[g]=k[g+1]=k[g+2]=-Y,S[g]=S[g+1]=S[g+2]=Y,Z[g]=Z[g+1]=Z[g+2]=-1,j[g]=j[g+1]=j[g+2]=0;for(let O=0;O<at;O++){const W=d[O],Xn=W.color,Wn=(Xn&Yt)!==0,Hn=(Xn&Xt)!==0,Vn=(Xn&Wt)!==0;W.signedDistance(u,x,f);const on=f.distance,kt=f.dot,Bn=f.param,Dt=Math.abs(on);if(Wn){const bt=Math.abs(z[g]);(Dt<bt||Dt===bt&&kt<K[g])&&(z[g]=on,K[g]=kt,Z[g]=O,j[g]=Bn)}if(Hn){const bt=Math.abs(z[g+1]);(Dt<bt||Dt===bt&&kt<K[g+1])&&(z[g+1]=on,K[g+1]=kt,Z[g+1]=O,j[g+1]=Bn)}if(Vn){const bt=Math.abs(z[g+2]);(Dt<bt||Dt===bt&&kt<K[g+2])&&(z[g+2]=on,K[g+2]=kt,Z[g+2]=O,j[g+2]=Bn)}const yt=G+O,zn=u-cn[yt],Qn=x-rn[yt],$n=u-an[yt],Kn=x-hn[yt],js=ln[yt],Js=pn[yt],to=fn[yt],no=yn[yt],Ei=zn*un[yt]+Qn*_n[yt],qi=$n*xn[yt]+Kn*Mn[yt];if(Ei>0&&-(zn*js+Qn*Js)>0){const F=zn*Js-Qn*js;Math.abs(F)<Dt&&(Wn&&(F<=0&&F>k[g]?k[g]=F:F>0&&F<S[g]&&(S[g]=F)),Hn&&(F<=0&&F>k[g+1]?k[g+1]=F:F>0&&F<S[g+1]&&(S[g+1]=F)),Vn&&(F<=0&&F>k[g+2]?k[g+2]=F:F>0&&F<S[g+2]&&(S[g+2]=F)))}if(qi>0&&$n*to+Kn*no>0){const F=$n*no-Kn*to;Math.abs(F)<Dt&&(Wn&&(F<=0&&F>k[g]?k[g]=F:F>0&&F<S[g]&&(S[g]=F)),Hn&&(F<=0&&F>k[g+1]?k[g+1]=F:F>0&&F<S[g+1]&&(S[g+1]=F)),Vn&&(F<=0&&F>k[g+2]?k[g+2]=F:F>0&&F<S[g+2]&&(S[g+2]=F)))}}Rt[E]=lt(z[g],k[g],S[g],E,Z[g],j[g],u,x,r),Tt[E]=lt(z[g+1],k[g+1],S[g+1],E,Z[g+1],j[g+1],u,x,r),mt[E]=lt(z[g+2],k[g+2],S[g+2],E,Z[g+2],j[g+2],u,x,r)}let M=-Y,w=0,v=-Y,C=Y,A=-1,D=-1,I=0,L=-Y,m=0,b=-Y,N=Y,R=-1,q=-1,P=0,X=-Y,$=0,V=-Y,et=Y,H=-1,B=-1,ft=0,ct=-Y,Nt=0,qn=-Y,vn=Y,Ds=-1,Es=-1,qs=0,Kt=-Y,vs=0,Cn=-Y,In=Y,Cs=-1,Is=-1,Rs=0,Zt=-Y,Ts=0,Rn=-Y,Tn=Y,ms=-1,Fs=-1,ks=0,jt=-Y,Ss=0,mn=-Y,Fn=Y,Ls=-1,Gs=-1,Os=0,Jt=-Y,Ps=0,kn=-Y,Sn=Y,Ns=-1,Us=-1,Ys=0,tn=-Y,Xs=0,Ln=-Y,Gn=Y,Ws=-1,Hs=-1,Vs=0;for(let E=0;E<h;E++){const d=E*3,at=vt[E],g=_t(Rt[E],Tt[E],mt[E]);{const G=z[d],O=K[d],W=Math.abs(G);(W<Math.abs(M)||W===Math.abs(M)&&O<w)&&(M=G,w=O,A=E,D=Z[d],I=j[d]),k[d]>v&&(v=k[d]),S[d]<C&&(C=S[d])}{const G=z[d+1],O=K[d+1],W=Math.abs(G);(W<Math.abs(L)||W===Math.abs(L)&&O<m)&&(L=G,m=O,R=E,q=Z[d+1],P=j[d+1]),k[d+1]>b&&(b=k[d+1]),S[d+1]<N&&(N=S[d+1])}{const G=z[d+2],O=K[d+2],W=Math.abs(G);(W<Math.abs(X)||W===Math.abs(X)&&O<$)&&(X=G,$=O,H=E,B=Z[d+2],ft=j[d+2]),k[d+2]>V&&(V=k[d+2]),S[d+2]<et&&(et=S[d+2])}if(at>0&&g>=0){{const G=z[d],O=K[d],W=Math.abs(G);(W<Math.abs(ct)||W===Math.abs(ct)&&O<Nt)&&(ct=G,Nt=O,Ds=E,Es=Z[d],qs=j[d]),k[d]>qn&&(qn=k[d]),S[d]<vn&&(vn=S[d])}{const G=z[d+1],O=K[d+1],W=Math.abs(G);(W<Math.abs(Kt)||W===Math.abs(Kt)&&O<vs)&&(Kt=G,vs=O,Cs=E,Is=Z[d+1],Rs=j[d+1]),k[d+1]>Cn&&(Cn=k[d+1]),S[d+1]<In&&(In=S[d+1])}{const G=z[d+2],O=K[d+2],W=Math.abs(G);(W<Math.abs(Zt)||W===Math.abs(Zt)&&O<Ts)&&(Zt=G,Ts=O,ms=E,Fs=Z[d+2],ks=j[d+2]),k[d+2]>Rn&&(Rn=k[d+2]),S[d+2]<Tn&&(Tn=S[d+2])}}if(at<0&&g<=0){{const G=z[d],O=K[d],W=Math.abs(G);(W<Math.abs(jt)||W===Math.abs(jt)&&O<Ss)&&(jt=G,Ss=O,Ls=E,Gs=Z[d],Os=j[d]),k[d]>mn&&(mn=k[d]),S[d]<Fn&&(Fn=S[d])}{const G=z[d+1],O=K[d+1],W=Math.abs(G);(W<Math.abs(Jt)||W===Math.abs(Jt)&&O<Ps)&&(Jt=G,Ps=O,Ns=E,Us=Z[d+1],Ys=j[d+1]),k[d+1]>kn&&(kn=k[d+1]),S[d+1]<Sn&&(Sn=S[d+1])}{const G=z[d+2],O=K[d+2],W=Math.abs(G);(W<Math.abs(tn)||W===Math.abs(tn)&&O<Xs)&&(tn=G,Xs=O,Ws=E,Hs=Z[d+2],Vs=j[d+2]),k[d+2]>Ln&&(Ln=k[d+2]),S[d+2]<Gn&&(Gn=S[d+2])}}}const On=lt(M,v,C,A,D,I,u,x,r),Pn=lt(L,b,N,R,q,P,u,x,r),Nn=lt(X,V,et,H,B,ft,u,x,r),Di=_t(On,Pn,Nn),Bs=lt(ct,qn,vn,Ds,Es,qs,u,x,r),zs=lt(Kt,Cn,In,Cs,Is,Rs,u,x,r),Qs=lt(Zt,Rn,Tn,ms,Fs,ks,u,x,r),nn=_t(Bs,zs,Qs),$s=lt(jt,mn,Fn,Ls,Gs,Os,u,x,r),Ks=lt(Jt,kn,Sn,Ns,Us,Ys,u,x,r),Zs=lt(tn,Ln,Gn,Ws,Hs,Vs,u,x,r),sn=_t($s,Ks,Zs);let xt,Mt,gt,Un=0;if(nn>=0&&Math.abs(nn)<=Math.abs(sn)){xt=Bs,Mt=zs,gt=Qs,Un=1;for(let E=0;E<h;E++)if(vt[E]>0){const d=Rt[E],at=Tt[E],g=mt[E],G=_t(d,at,g);Math.abs(G)<Math.abs(sn)&&G>_t(xt,Mt,gt)&&(xt=d,Mt=at,gt=g)}}else if(sn<=0&&Math.abs(sn)<Math.abs(nn)){xt=$s,Mt=Ks,gt=Zs,Un=-1;for(let E=0;E<h;E++)if(vt[E]<0){const d=Rt[E],at=Tt[E],g=mt[E],G=_t(d,at,g);Math.abs(G)<Math.abs(nn)&&G<_t(xt,Mt,gt)&&(xt=d,Mt=at,gt=g)}}else{const E=(y*n+_)*3;c[E+0]=On*p+.5,c[E+1]=Pn*p+.5,c[E+2]=Nn*p+.5;continue}for(let E=0;E<h;E++)if(vt[E]!==Un){const d=Rt[E],at=Tt[E],g=mt[E],G=_t(d,at,g),O=_t(xt,Mt,gt);G*O>=0&&Math.abs(G)<Math.abs(O)&&(xt=d,Mt=at,gt=g)}_t(xt,Mt,gt)===Di&&(xt=On,Mt=Pn,gt=Nn);const Yn=(y*n+_)*3;c[Yn+0]=xt*p+.5,c[Yn+1]=Mt*p+.5,c[Yn+2]=gt*p+.5}}const ys=0,si=1,oi=2,ii=3;function ei(e,n){switch(n){case ys:return e!==0;case si:return(e&1)!==0;case oi:return e>0;case ii:return e<0}return!1}class ci{constructor(){this._intersections=[],this._lastIndex=0}setIntersections(n){if(this._intersections=n,this._lastIndex=0,n.length>0){n.sort((s,i)=>rt(s.x-i.x));let t=0;for(let s=0;s<n.length;s++)t+=n[s].direction,n[s].direction=t}}_moveTo(n){const t=this._intersections.length;if(t===0)return-1;let s=this._lastIndex;if(n<this._intersections[s].x)do{if(s===0)return this._lastIndex=0,-1;--s}while(n<this._intersections[s].x);else for(;s<t-1&&n>=this._intersections[s+1].x;)++s;return this._lastIndex=s,s}sumIntersections(n){const t=this._moveTo(n);return t>=0?this._intersections[t].direction:0}filled(n,t){return ei(this.sumIntersections(n),t)}}const us=[0,0,0],_s=[0,0,0];function ri(e,n,t){const s=[];for(const i of e.contours)for(const o of i){const l=o.scanlineIntersections(n,us,_s);for(let c=0;c<l;c++)s.push({x:us[c],direction:_s[c]})}t.setIntersections(s)}const Ft=2,xs=1,gn=1.001,ai=1.1111111111111112,Ht=.01;function hi(e,n,t,s,i,o,l){if(t===0||s===0)return;const c=new ci,r=new Int8Array(t*s);for(let h=0;h<s;h++){const p=(h+.5)/i-l;ri(n,p,c);for(let a=0;a<t;a++){const f=(a+.5)/i-o,y=c.filled(f,ys),_=(h*t+a)*3,u=e[_],x=e[_+1],M=e[_+2],w=st(u,x,M),v=h*t+a;w===.5?r[v]=0:w>.5!==y?(e[_]=1-u,e[_+1]=1-x,e[_+2]=1-M,r[v]=-1):r[v]=1}}for(let h=0;h<s;h++)for(let p=0;p<t;p++){const a=h*t+p;if(r[a]!==0)continue;let f=0;if(p>0&&(f+=r[a-1]),p<t-1&&(f+=r[a+1]),h>0&&(f+=r[a-t]),h<s-1&&(f+=r[a+t]),f<0){const y=(h*t+p)*3;e[y]=1-e[y],e[y+1]=1-e[y+1],e[y+2]=1-e[y+2]}}}const dn=[0,0];function li(e,n,t,s,i,o,l,c){const r=new Uint8Array(t*s);pi(r,n,t,s,i,o,l),fi(r,e,t,s,i,c),xi(r,e,t,s,c,ai),Mi(r,e,t,s)}function pi(e,n,t,s,i,o,l){for(const c of n.contours){if(c.length===0)continue;let r=c[c.length-1];for(const h of c){const p=r.color&h.color;if(!(p&p-1)){h.point(0,dn);const a=i*(dn[0]+o),f=i*(dn[1]+l),y=Math.floor(a-.5)|0,_=Math.floor(f-.5)|0,u=y+1,x=_+1;y<t&&_<s&&u>=0&&x>=0&&(y>=0&&_>=0&&(e[_*t+y]|=Ft),u<t&&_>=0&&(e[_*t+u]|=Ft),y>=0&&x<s&&(e[x*t+y]|=Ft),u<t&&x<s&&(e[x*t+u]|=Ft))}r=h}}}function Vt(e,n,t){let s=0;for(let i=0;i<3;i++){const o=e[n+i],l=e[t+i],c=o-l;if(c===0)continue;const r=(o-.5)/c;if(r>0&&r<1){const h=1-r,p=h*e[n]+r*e[t],a=h*e[n+1]+r*e[t+1],f=h*e[n+2]+r*e[t+2],y=i===0?p:i===1?a:f;st(p,a,f)===y&&(s|=i===0?Yt:i===1?Xt:Wt)}}return s}function wt(e,n,t,s,i,o){(o&Yt&&t[s]!==i||o&Xt&&t[s+1]!==i||o&Wt&&t[s+2]!==i)&&(e[n]|=Ft)}function fi(e,n,t,s,i,o){const l=gn/o,c=gn/o,r=gn*Math.SQRT2/o;for(let h=0;h<s;h++)for(let p=0;p<t-1;p++){const a=(h*t+p)*3,f=a+3,y=st(n[a],n[a+1],n[a+2]),_=st(n[f],n[f+1],n[f+2]);if(Math.abs(y-.5)+Math.abs(_-.5)<l){const u=Vt(n,a,f);wt(e,h*t+p,n,a,y,u),wt(e,h*t+p+1,n,f,_,u)}}for(let h=0;h<s-1;h++)for(let p=0;p<t;p++){const a=(h*t+p)*3,f=((h+1)*t+p)*3,y=st(n[a],n[a+1],n[a+2]),_=st(n[f],n[f+1],n[f+2]);if(Math.abs(y-.5)+Math.abs(_-.5)<c){const u=Vt(n,a,f);wt(e,h*t+p,n,a,y,u),wt(e,(h+1)*t+p,n,f,_,u)}}for(let h=0;h<s-1;h++)for(let p=0;p<t-1;p++){const a=(h*t+p)*3,f=(h*t+p+1)*3,y=((h+1)*t+p)*3,_=((h+1)*t+p+1)*3,u=st(n[a],n[a+1],n[a+2]),x=st(n[f],n[f+1],n[f+2]),M=st(n[y],n[y+1],n[y+2]),w=st(n[_],n[_+1],n[_+2]);if(Math.abs(u-.5)+Math.abs(w-.5)<r){const v=Vt(n,a,_);wt(e,h*t+p,n,a,u,v),wt(e,(h+1)*t+p+1,n,_,w,v)}if(Math.abs(x-.5)+Math.abs(M-.5)<r){const v=Vt(n,f,y);wt(e,h*t+p+1,n,f,x,v),wt(e,(h+1)*t+p,n,y,M,v)}}}function yi(e,n,t){const s=n<e?n:e,i=e<n?n:e,o=t<i?t:i;return s<o?o:s}function ui(e,n,t,s){return st(e[n]+s*(e[t]-e[n]),e[n+1]+s*(e[t+1]-e[n+1]),e[n+2]+s*(e[t+2]-e[n+2]))}function bn(e,n,t,s){return yi(Math.fround(s*(s*t[0]+n[0])+e[0]),Math.fround(s*(s*t[1]+n[1])+e[1]),Math.fround(s*(s*t[2]+n[2])+e[2]))}const Ct=[0,0,0],dt=[0,0,0],An=[0,0,0],pt=[0,0,0],Ms=1,gs=2;function wn(e,n,t,s,i,o,l,c){if(s>.5&&i>.5&&o<=.5||s<.5&&i<.5&&o>=.5||!c&&_i(s,i,o)!==o){const r=(t-e)*l,h=(n-t)*l;return o>=s-r&&o<=s+r&&o>=i-h&&o<=i+h?Ms:Ms|gs}return 0}function ds(e){return(e&gs)!==0}function _i(e,n,t){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function Bt(e,n,t,s,i,o){const l=st(e[t],e[t+1],e[t+2]);if(Math.abs(s-.5)<Math.abs(l-.5))return!1;for(let c=0;c<3;c++){const r=e[n+c]-e[n+(c+1)%3],h=e[t+c]-e[t+(c+1)%3],p=r-h;if(p===0)continue;const a=r/p;if(a>Ht&&a<1-Ht){const f=ui(e,n,t,a),y=wn(0,1,a,s,l,f,i,o);if(ds(y))return!0}}return!1}function bs(e,n,t,s,i,o,l,c,r){if(!(r>0&&r<1))return 0;const h=r>l?0:r,p=r>l?r:1;pt[0]=e[n],pt[1]=e[n+1],pt[2]=e[n+2];const a=r>l?t:bn(pt,Ct,dt,r);pt[0]=e[n],pt[1]=e[n+1],pt[2]=e[n+2];const f=r>l?bn(pt,Ct,dt,r):s;return wn(h,p,l,a,f,c,i,o)}function zt(e,n,t,s,i,o,l,c,r){if(!(l>Ht&&l<1-Ht))return!1;pt[0]=e[n],pt[1]=e[n+1],pt[2]=e[n+2];const h=bn(pt,Ct,dt,l);let p=wn(0,1,l,t,s,h,i,o);return p|=bs(e,n,t,s,i,o,l,h,c),p|=bs(e,n,t,s,i,o,l,h,r),ds(p)}function Dn(e,n,t,s,i,o,l,c,r,h,p,a,f){const y=Math.fround(e[n+h]-e[n+p]),_=Math.fround(Math.fround(e[t+h]-e[t+p])+Math.fround(e[s+h]-e[s+p])),u=Math.fround(e[i+h]-e[i+p]),x=Math.fround(Math.fround(u-_)+y),M=Math.fround(Math.fround(_-y)-y),w=y;if(x===0||Math.abs(M)>1e12*Math.abs(x)){if(M!==0){const C=-w/M;if(zt(e,n,o,l,c,r,C,a,f))return!0}return!1}const v=M*M-4*x*w;if(v>0){const C=Math.sqrt(v),A=(-M+C)/(2*x);if(zt(e,n,o,l,c,r,A,a,f))return!0;const D=(-M-C)/(2*x);if(zt(e,n,o,l,c,r,D,a,f))return!0}else if(v===0){const C=-M/(2*x);if(zt(e,n,o,l,c,r,C,a,f))return!0}return!1}function Qt(e,n,t,s,i,o,l,c){const r=st(e[i],e[i+1],e[i+2]);if(Math.abs(o-.5)<Math.abs(r-.5))return!1;for(let f=0;f<3;f++)An[f]=Math.fround(Math.fround(e[n+f]-e[t+f])-e[s+f]),Ct[f]=Math.fround(-e[n+f]-An[f]),dt[f]=Math.fround(e[i+f]+An[f]);const h=dt[0]!==0?-.5*Ct[0]/dt[0]:-1,p=dt[1]!==0?-.5*Ct[1]/dt[1]:-1,a=dt[2]!==0?-.5*Ct[2]/dt[2]:-1;return!!(Dn(e,n,t,s,i,o,r,l,c,0,1,h,p)||Dn(e,n,t,s,i,o,r,l,c,1,2,p,a)||Dn(e,n,t,s,i,o,r,l,c,2,0,a,h))}function xi(e,n,t,s,i,o){const l=o/i,c=o/i,r=o*Math.SQRT2/i;for(let h=0;h<s;h++)for(let p=0;p<t;p++){const a=h*t+p,f=a*3,y=st(n[f],n[f+1],n[f+2]),_=(e[a]&Ft)!==0,u=p>0,x=p<t-1,M=h>0,w=h<s-1,v=u?(a-1)*3:-1,C=x?(a+1)*3:-1,A=M?(a-t)*3:-1,D=w?(a+t)*3:-1;let I=!1;if(u&&Bt(n,f,v,y,l,_)&&(I=!0),!I&&M&&Bt(n,f,A,y,c,_)&&(I=!0),!I&&x&&Bt(n,f,C,y,l,_)&&(I=!0),!I&&w&&Bt(n,f,D,y,c,_)&&(I=!0),!I&&u&&M){const L=(a-t-1)*3;Qt(n,f,v,A,L,y,r,_)&&(I=!0)}if(!I&&x&&M){const L=(a-t+1)*3;Qt(n,f,C,A,L,y,r,_)&&(I=!0)}if(!I&&u&&w){const L=(a+t-1)*3;Qt(n,f,v,D,L,y,r,_)&&(I=!0)}if(!I&&x&&w){const L=(a+t+1)*3;Qt(n,f,C,D,L,y,r,_)&&(I=!0)}I&&(e[a]|=xs)}}function Mi(e,n,t,s){const i=t*s;for(let o=0;o<i;o++)if(e[o]&xs){const l=o*3,c=st(n[l],n[l+1],n[l+2]);n[l]=c,n[l+1]=c,n[l+2]=c}}function st(e,n,t){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function gi(e){let n=0,t=0;for(const c of e)n+=c.w*c.h,t=Math.max(t,c.w);e.sort((c,r)=>r.h-c.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),t),h:1/0}];let o=0,l=0;for(const c of e)for(let r=i.length-1;r>=0;r--){const h=i[r];if(!(c.w>h.w||c.h>h.h)){if(c.x=h.x,c.y=h.y,l=Math.max(l,c.y+c.h),o=Math.max(o,c.x+c.w),c.w===h.w&&c.h===h.h){const p=i.pop();p&&r<i.length&&(i[r]=p)}else c.h===h.h?(h.x+=c.w,h.w-=c.w):c.w===h.w?(h.y+=c.h,h.h-=c.h):(i.push({x:h.x+c.w,y:h.y,w:h.w-c.w,h:c.h}),h.y+=c.h,h.h-=c.h);break}}return{w:o,h:l,fill:n/(o*l)||0}}const di=3,bi=0n,As=4,ws=16;function $t(e){const n=e<0?0:e>1?1:e;return~Math.trunc(255.5-255*n)&255}class Ai{constructor(n,t={}){this._width=0,this._height=0,this._pixels=new Uint8Array(0),this._cache=new Map,this._cacheByGid=new Map,this._font=n,this._pxPerEm=t.pixelsPerEm??40,this._pxrange=t.pxrange??4,this.pxrangeEm=this._pxrange/this._pxPerEm}get width(){return this._width}get height(){return this._height}get texture(){return this._pixels}glyphs(n){const t=[];let s=0;for(const i of n){const o=this._cache.get(i);if(o){t.push(o.glyph);continue}const l=this._generateForGlyphId(this._font.glyphId(i));this._cache.set(i,l),t.push(l.glyph),s++}return s>0&&this._repack(),t}glyph(n){return this.glyphs([n])[0]}glyphsByIndex(n){const t=[];let s=0;for(const i of n){const o=this._cacheByGid.get(i);if(o){t.push(o.glyph);continue}const l=this._generateForGlyphId(i);this._cacheByGid.set(i,l),t.push(l.glyph),s++}return s>0&&this._repack(),t}glyphByIndex(n){return this.glyphsByIndex([n])[0]}_generateForGlyphId(n){const t=this._font,s=t.metrics.unitsPerEm,i=t.advance(n)/s,o=t.shape(n);if(No(o,s),o.contours.length===0)return{glyph:{x:0,y:0,w:0,h:0,advance:i,planeLeft:0,planeBottom:0,planeRight:0,planeTop:0},msdf:null};const l=wi(o),c=this._pxPerEm,r=this._pxrange,h=Math.max(1,Math.ceil((l.maxX-l.minX)*c))+2*r,p=Math.max(1,Math.ceil((l.maxY-l.minY)*c))+2*r,a=r/c-l.minX,f=r/c-l.minY;Wo(o),jo(o,di,bi);const y=new Float32Array(h*p*3);return ni(o,h,p,c,a,f,r,y),hi(y,o,h,p,c,a,f),li(y,o,h,p,c,a,f,r),{glyph:{x:0,y:0,w:h,h:p,advance:i,planeLeft:-a,planeBottom:-f,planeRight:h/c-a,planeTop:p/c-f},msdf:y}}layout(n){const t=[];for(const r of n)t.push(r.codePointAt(0));this.glyphs(t);const s=[],i=this._font,o=i.metrics.unitsPerEm;let l=0,c=-1;for(const r of t){const h=i.glyphId(r);c>=0&&(l+=i.kerning(c,h)/o);const p=this._cache.get(r).glyph;s.push({glyph:p,penX:l,penY:0}),l+=p.advance,c=h}return{glyphs:s,widthEm:l}}layoutMultiline(n){const t=this._font,s=t.metrics.unitsPerEm,i=(t.metrics.ascender-t.metrics.descender+t.metrics.lineGap)/s,o=n.split(`
|
|
2
|
-
`),
|
|
1
|
+
var MsdfgenTs=(function(gt){"use strict";function bi(e,t,n,s){return e*n+t*s}function Q(e,t,n,s){return e*s-t*n}function Ue(e,t,n){return(1-n)*e+n*t}function ut(e){return+(e>0)-+(e<0)}function jt(e){return 2*+(e>0)-1}function Te(e,t,n,s){if(t===0||Math.abs(n)>1e12*Math.abs(t))return n===0?s===0?-1:0:(e[0]=-s/n,1);const o=n*n-4*t*s;if(o>0){const i=Math.sqrt(o);return e[0]=(-n+i)/(2*t),e[1]=(-n-i)/(2*t),2}else if(o===0)return e[0]=-n/(2*t),1;return 0}function wi(e,t,n,s){const o=t*t,i=1/9*(o-3*n),r=1/54*(t*(2*o-9*n)+27*s),c=r*r,a=i*i*i,l=t*(1/3);if(c<a){let h=r/Math.sqrt(a);h<-1&&(h=-1),h>1&&(h=1),h=Math.acos(h);const f=-2*Math.sqrt(i);return e[0]=f*Math.cos(.3333333333333333*h)-l,e[1]=f*Math.cos(.3333333333333333*(h+2*Math.PI))-l,e[2]=f*Math.cos(.3333333333333333*(h-2*Math.PI))-l,3}else{const h=(r<0?1:-1)*Math.pow(Math.abs(r)+Math.sqrt(c-a),.3333333333333333),f=h===0?0:i/h;return e[0]=h+f-l,h===f||Math.abs(h-f)<1e-12*Math.abs(h+f)?(e[1]=-.5*(h+f)-l,2):1}}function Ai(e,t,n,s,o){if(t!==0){const i=n/t;if(Math.abs(i)<1e6)return wi(e,i,s/t,o/t)}return Te(e,n,s,o)}const ki=24;function fn(e,t,n,s){return((s+e)*s+t)*s+n}function Ui(e,t,n,s,o,i,r){const c=i<0;let a=s-i*(o-s)/(r-i);a>s&&a<o||(a=.5*(s+o));for(let l=0;l<ki;l++){const h=fn(e,t,n,a);if(h===0)return a;h<0===c?s=a:o=a;const f=(3*a+2*e)*a+t;let u=a-h/f;u>s&&u<o||(u=.5*(s+o));const p=u-a;if(a=u,(p<0?-p:p)<=1e-15*(a<0?-a:a))break}return a}function En(e,t,n,s,o,i,r,c,a){return i===0?c[a++]=s:i<0!=r<0&&(c[a++]=Ui(e,t,n,s,o,i,r)),a}function Ti(e,t,n,s,o,i){let r=0;if(e===0){if(t===0)return 0;const u=-n/t;return u>=s&&u<=o&&(i[r++]=u),r}const c=t*t-4*e*n;if(c<0)return 0;const a=Math.sqrt(c),l=-.5*(t+(t<0?-a:a));let h,f;if(l===0)h=0,f=0;else if(h=l/e,f=n/l,h>f){const u=h;h=f,f=u}return h>=s&&h<=o&&(i[r++]=h),f!==h&&f>=s&&f<=o&&(i[r++]=f),r}function Si(e,t,n,s,o,i,r){if(e===0)return Ti(t,n,s,o,i,r);const c=1/e;t*=c,n*=c,s*=c;const a=fn(t,n,s,o),l=fn(t,n,s,i),h=t*t-3*n;let f=0;if(h<=0)f=En(t,n,s,o,i,a,l,r,0);else{const u=Math.sqrt(h)/3,p=-t/3,_=p-u,y=p+u;let g=o,x=a;if(_>o&&_<i){const b=fn(t,n,s,_);f=En(t,n,s,g,_,x,b,r,f),g=_,x=b}if(y>o&&y<i){const b=fn(t,n,s,y);f=En(t,n,s,g,y,x,b,r,f),g=y,x=b}f=En(t,n,s,g,i,x,l,r,f)}return l===0&&(r[f++]=i),f}const J=0,ot=1,Et=2,Se=4,vi=4,K=[0,0,0];class tt{constructor(t,n,s,o,i,r,c,a,l){this.type=t,this.p0x=n,this.p0y=s,this.p1x=o,this.p1y=i,this.p2x=r,this.p2y=c,this.p3x=a,this.p3y=l,this.color=7}endX(){switch(this.type){case J:return this.p1x;case ot:return this.p2x;default:return this.p3x}}endY(){switch(this.type){case J:return this.p1y;case ot:return this.p2y;default:return this.p3y}}point(t,n){const s=t;switch(this.type){case J:{n[0]=this.p0x+s*(this.p1x-this.p0x),n[1]=this.p0y+s*(this.p1y-this.p0y);return}case ot:{const o=this.p0x+s*(this.p1x-this.p0x),i=this.p0y+s*(this.p1y-this.p0y),r=this.p1x+s*(this.p2x-this.p1x),c=this.p1y+s*(this.p2y-this.p1y);n[0]=o+s*(r-o),n[1]=i+s*(c-i);return}default:{const o=this.p0x+s*(this.p1x-this.p0x),i=this.p0y+s*(this.p1y-this.p0y),r=this.p1x+s*(this.p2x-this.p1x),c=this.p1y+s*(this.p2y-this.p1y),a=this.p2x+s*(this.p3x-this.p2x),l=this.p2y+s*(this.p3y-this.p2y),h=o+s*(r-o),f=i+s*(c-i),u=r+s*(a-r),p=c+s*(l-c);n[0]=h+s*(u-h),n[1]=f+s*(p-f);return}}}direction(t,n){const s=t;switch(this.type){case J:{n[0]=this.p1x-this.p0x,n[1]=this.p1y-this.p0y;return}case ot:{const o=this.p1x-this.p0x+s*(this.p2x-this.p1x-(this.p1x-this.p0x)),i=this.p1y-this.p0y+s*(this.p2y-this.p1y-(this.p1y-this.p0y));o!==0||i!==0?(n[0]=o,n[1]=i):(n[0]=this.p2x-this.p0x,n[1]=this.p2y-this.p0y);return}default:{const o=this.p1x-this.p0x,i=this.p1y-this.p0y,r=this.p2x-this.p1x,c=this.p2y-this.p1y,a=this.p3x-this.p2x,l=this.p3y-this.p2y,h=o+s*(r-o)+s*(r+s*(a-r)-(o+s*(r-o))),f=i+s*(c-i)+s*(c+s*(l-c)-(i+s*(c-i)));h!==0||f!==0?(n[0]=h,n[1]=f):s===0?(n[0]=this.p2x-this.p0x,n[1]=this.p2y-this.p0y):s===1?(n[0]=this.p3x-this.p1x,n[1]=this.p3y-this.p1y):(n[0]=h,n[1]=f);return}}}splitInThirds(){const t=[0,0],n=[0,0];switch(this.type){case J:{this.point(.3333333333333333,t),this.point(.6666666666666666,n);const s=new tt(J,this.p0x,this.p0y,t[0],t[1],0,0,0,0),o=new tt(J,t[0],t[1],n[0],n[1],0,0,0,0),i=new tt(J,n[0],n[1],this.p1x,this.p1y,0,0,0,0);return s.color=o.color=i.color=this.color,[s,o,i]}case ot:{this.point(.3333333333333333,t),this.point(.6666666666666666,n);const s=this.p0x+1/3*(this.p1x-this.p0x),o=this.p0y+1/3*(this.p1y-this.p0y),i=this.p0x+5/9*(this.p1x-this.p0x),r=this.p0y+5/9*(this.p1y-this.p0y),c=this.p1x+4/9*(this.p2x-this.p1x),a=this.p1y+4/9*(this.p2y-this.p1y),l=i+.5*(c-i),h=r+.5*(a-r),f=this.p1x+2/3*(this.p2x-this.p1x),u=this.p1y+2/3*(this.p2y-this.p1y),p=new tt(ot,this.p0x,this.p0y,s,o,t[0],t[1],0,0),_=new tt(ot,t[0],t[1],l,h,n[0],n[1],0,0),y=new tt(ot,n[0],n[1],f,u,this.p2x,this.p2y,0,0);return p.color=_.color=y.color=this.color,[p,_,y]}default:{this.point(.3333333333333333,t),this.point(.6666666666666666,n);const s=this.p0x===this.p1x&&this.p0y===this.p1y?this.p0x:this.p0x+1/3*(this.p1x-this.p0x),o=this.p0x===this.p1x&&this.p0y===this.p1y?this.p0y:this.p0y+1/3*(this.p1y-this.p0y),i=this.p0x+1/3*(this.p1x-this.p0x),r=this.p0y+1/3*(this.p1y-this.p0y),c=this.p1x+1/3*(this.p2x-this.p1x),a=this.p1y+1/3*(this.p2y-this.p1y),l=this.p2x+1/3*(this.p3x-this.p2x),h=this.p2y+1/3*(this.p3y-this.p2y),f=i+1/3*(c-i),u=r+1/3*(a-r),p=c+1/3*(l-c),_=a+1/3*(h-a),y=f+2/3*(p-f),g=u+2/3*(_-u),x=this.p0x+2/3*(this.p1x-this.p0x),b=this.p0y+2/3*(this.p1y-this.p0y),M=this.p1x+2/3*(this.p2x-this.p1x),A=this.p1y+2/3*(this.p2y-this.p1y),k=this.p2x+2/3*(this.p3x-this.p2x),T=this.p2y+2/3*(this.p3y-this.p2y),S=x+2/3*(M-x),w=b+2/3*(A-b),m=M+2/3*(k-M),d=A+2/3*(T-A),U=S+1/3*(m-S),C=w+1/3*(d-w),v=this.p2x===this.p3x&&this.p2y===this.p3y?this.p3x:this.p2x+2/3*(this.p3x-this.p2x),I=this.p2x===this.p3x&&this.p2y===this.p3y?this.p3y:this.p2y+2/3*(this.p3y-this.p2y),R=new tt(Et,this.p0x,this.p0y,s,o,f,u,t[0],t[1]),G=new tt(Et,t[0],t[1],y,g,U,C,n[0],n[1]),F=new tt(Et,n[0],n[1],m,d,v,I,this.p3x,this.p3y);return R.color=G.color=F.color=this.color,[R,G,F]}}}signedDistance(t,n,s){switch(this.type){case J:{const o=this.p0x,i=this.p0y,r=this.p1x,c=this.p1y,a=t-o,l=n-i,h=r-o,f=c-i,u=h*h+f*f,p=(a*h+l*f)/u,_=p>.5,y=(_?r:o)-t,g=(_?c:i)-n,x=Math.sqrt(y*y+g*g);if(p>0&&p<1){const A=Math.sqrt(h*h+f*f),k=h/A,S=f/A*a-k*l;if(Math.abs(S)<x){s.distance=S,s.dot=0,s.param=p;return}}const b=a*f-l*h;s.distance=jt(b)*x;const M=Math.sqrt(h*h+f*f);s.dot=x===0||M===0?0:Math.abs((h*y+f*g)/(M*x)),s.param=p;return}case ot:{const o=this.p0x,i=this.p0y,r=this.p1x,c=this.p1y,a=this.p2x,l=this.p2y,h=o-t,f=i-n,u=r-o,p=c-i,_=a-r-u,y=l-c-p,g=_*_+y*y,x=3*(u*_+p*y),b=2*(u*u+p*p)+(h*_+f*y),M=h*u+f*p,A=Si(g,x,b,M,0,1,K);let k=u,T=p;const S=h*h+f*f;let w=jt(k*f-T*h),m=S,d=-(h*k+f*T)/(k*k+T*T);{const C=a-t,v=l-n,I=C*C+v*v;I<m&&(k=a-r,T=l-c,w=jt(k*v-T*C),m=I,d=((t-r)*k+(n-c)*T)/(k*k+T*T))}for(let C=0;C<A;++C){const v=K[C];if(v>0&&v<1){const I=h+2*v*u+v*v*_,R=f+2*v*p+v*v*y,G=I*I+R*R;if(G<=m){const F=u+v*_,X=p+v*y;w=jt(F*R-X*I),m=G,d=v}}}const U=w*Math.sqrt(m);if(d>=0&&d<=1){s.distance=U,s.dot=0,s.param=d;return}if(s.distance=U,s.param=d,d<.5){const C=Math.sqrt(u*u+p*p),v=Math.sqrt(S);s.dot=v===0||C===0?0:Math.abs((u*h+p*f)/(C*v))}else{const C=a-r,v=l-c,I=a-t,R=l-n,G=Math.sqrt(C*C+v*v),F=Math.sqrt(I*I+R*R);s.dot=G===0||F===0?0:Math.abs((C*I+v*R)/(G*F))}return}default:{const o=this.p0x,i=this.p0y,r=this.p1x,c=this.p1y,a=this.p2x,l=this.p2y,h=this.p3x,f=this.p3y,u=o-t,p=i-n,_=r-o,y=c-i,g=a-r-_,x=l-c-y,b=h-a-(a-r)-g,M=f-l-(l-c)-x;let A=_,k=y;A===0&&k===0&&(A=a-o,k=l-i);const T=Math.sqrt(u*u+p*p);let S=jt(A*p-k*u)*T,w=-(u*A+p*k)/(A*A+k*k);{const m=h-t,d=f-n,U=Math.sqrt(m*m+d*d);if(U<Math.abs(S)){let C=h-a,v=f-l;C===0&&v===0&&(C=h-r,v=f-c),A=C,k=v,S=jt(A*d-k*m)*U,w=((A-m)*A+(k-d)*k)/(A*A+k*k)}}for(let m=0;m<=Se;++m){let d=1/Se*m,U=u+3*d*_+3*d*d*g+d*d*d*b,C=p+3*d*y+3*d*d*x+d*d*d*M,v=3*_+6*d*g+3*d*d*b,I=3*y+6*d*x+3*d*d*M,R=6*g+6*d*b,G=6*x+6*d*M,F=d-(U*v+C*I)/(v*v+I*I+(U*R+C*G));if(F>0&&F<1){let X=vi;do{if(d=F,U=u+3*d*_+3*d*d*g+d*d*d*b,C=p+3*d*y+3*d*d*x+d*d*d*M,v=3*_+6*d*g+3*d*d*b,I=3*y+6*d*x+3*d*d*M,!--X)break;R=6*g+6*d*b,G=6*x+6*d*M,F=d-(U*v+C*I)/(v*v+I*I+(U*R+C*G))}while(F>0&&F<1);const H=Math.sqrt(U*U+C*C);H<Math.abs(S)&&(S=jt(v*C-I*U)*H,w=d)}}if(w>=0&&w<=1){s.distance=S,s.dot=0,s.param=w;return}if(s.distance=S,s.param=w,w<.5){let m=_,d=y;m===0&&d===0&&(m=a-o,d=l-i);const U=Math.sqrt(m*m+d*d);s.dot=T===0||U===0?0:Math.abs((m*u+d*p)/(U*T))}else{let m=h-a,d=f-l;m===0&&d===0&&(m=h-r,d=f-c);const U=h-t,C=f-n,v=Math.sqrt(m*m+d*d),I=Math.sqrt(U*U+C*C);s.dot=v===0||I===0?0:Math.abs((m*U+d*C)/(v*I))}return}}}scanlineIntersections(t,n,s){switch(this.type){case J:{const o=this.p0y,i=this.p1y;if(t>=o&&t<i||t>=i&&t<o){const r=(t-o)/(i-o);return n[0]=Ue(this.p0x,this.p1x,r),s[0]=ut(i-o),1}return 0}case ot:{const o=this.p0x,i=this.p0y,r=this.p1x,c=this.p1y,a=this.p2x,l=this.p2y;let h=0,f=t>i?1:-1;n[h]=o,i===t&&(i<c||i===c&&i<l?s[h++]=1:f=1);{const u=r-o,p=c-i,_=a-r-u,y=l-c-p,g=Te(K,y,2*p,i-t);if(g>=2&&K[0]>K[1]){const x=K[0];K[0]=K[1],K[1]=x}for(let x=0;x<g&&h<2;++x){const b=K[x];b>=0&&b<=1&&(n[h]=o+2*b*u+b*b*_,f*(p+b*y)>=0&&(s[h++]=f,f=-f))}}return l===t&&(f>0&&h>0&&(--h,f=-1),(l<c||l===c&&l<i)&&h<2&&(n[h]=a,f<0&&(s[h++]=-1,f=1))),f!==(t>=l?1:-1)&&(h>0?--h:(Math.abs(l-t)<Math.abs(i-t)&&(n[h]=a),s[h++]=f)),h}default:{const o=this.p0x,i=this.p0y,r=this.p1x,c=this.p1y,a=this.p2x,l=this.p2y,h=this.p3x,f=this.p3y;let u=0,p=t>i?1:-1;n[u]=o,i===t&&(i<c||i===c&&(i<l||i===l&&i<f)?s[u++]=1:p=1);{const _=h-3*a+3*r-o,y=f-3*l+3*c-i,g=3*a-6*r+3*o,x=3*l-6*c+3*i,b=3*r-3*o,M=3*c-3*i,A=Ai(K,y,x,M,i-t);if(A>=2){if(K[0]>K[1]){const k=K[0];K[0]=K[1],K[1]=k}if(A>=3&&K[1]>K[2]){const k=K[1];if(K[1]=K[2],K[2]=k,K[0]>K[1]){const T=K[0];K[0]=K[1],K[1]=T}}}for(let k=0;k<A&&u<3;++k){const T=K[k];T>=0&&T<=1&&(n[u]=((_*T+g)*T+b)*T+o,p*((3*y*T+2*x)*T+M)>=0&&(s[u++]=p,p=-p))}}return f===t&&(p>0&&u>0&&(--u,p=-1),(f<l||f===l&&(f<c||f===c&&f<i))&&u<3&&(n[u]=h,p<0&&(s[u++]=-1,p=1))),p!==(t>=f?1:-1)&&(u>0?--u:(Math.abs(f-t)<Math.abs(i-t)&&(n[u]=h),s[u++]=p)),u}}}convertToCubic(){const t=this.p0x+.6666666666666666*(this.p1x-this.p0x),n=this.p0y+2/3*(this.p1y-this.p0y),s=this.p1x+1/3*(this.p2x-this.p1x),o=this.p1y+1/3*(this.p2y-this.p1y),i=new tt(Et,this.p0x,this.p0y,t,n,s,o,this.p2x,this.p2y);return i.color=this.color,i}}class It{constructor(t,n=0){this._view=new DataView(t),this._pos=n}get pos(){return this._pos}seek(t){this._pos=t}skip(t){this._pos+=t}u8(){return this._view.getUint8(this._pos++)}u16(){const t=this._view.getUint16(this._pos,!1);return this._pos+=2,t}i16(){const t=this._view.getInt16(this._pos,!1);return this._pos+=2,t}u32(){const t=this._view.getUint32(this._pos,!1);return this._pos+=4,t}i32(){const t=this._view.getInt32(this._pos,!1);return this._pos+=4,t}f2dot14(){return this.i16()/16384}offset16(){return this.u16()}offset32(){return this.u32()}peekU16(t){return this._view.getUint16(t,!1)}peekU32(t){return this._view.getUint32(t,!1)}peekI16(t){return this._view.getInt16(t,!1)}}function Ci(e,t){const n=new It(e,t);n.skip(2);const s=n.u16();let o=null;for(let r=0;r<s;r++){const c=n.u16(),a=n.u16(),l=n.u32(),h=t+l,f=n.peekU16(h);let u=-1;c===3&&a===10&&f===12?u=5:c===0&&a===6&&f===12?u=4:c===0&&a===4&&f===12?u=3:c===3&&a===1&&f===4?u=2:c===0&&a<=3&&f===4&&(u=1),u>((o==null?void 0:o.priority)??-1)&&(o={priority:u,subtableAbsOffset:h})}if(!o)return()=>0;const i=n.peekU16(o.subtableAbsOffset);return i===12?Ei(e,o.subtableAbsOffset):i===4?Ii(e,o.subtableAbsOffset):()=>0}function Ei(e,t){const n=new It(e,t);n.skip(2),n.skip(2),n.skip(4),n.skip(4);const s=n.u32(),o=new Uint32Array(s),i=new Uint32Array(s),r=new Uint32Array(s);for(let c=0;c<s;c++)o[c]=n.u32(),i[c]=n.u32(),r[c]=n.u32();return c=>{let a=0,l=s-1;for(;a<=l;){const h=a+l>>>1,f=o[h]??0,u=i[h]??0;if(c<f)l=h-1;else if(c>u)a=h+1;else return(r[h]??0)+(c-f)}return 0}}function Ii(e,t){const n=new It(e,t);n.skip(2),n.skip(2),n.skip(2);const o=n.u16()>>>1;n.skip(6);const i=new Uint16Array(o);for(let f=0;f<o;f++)i[f]=n.u16();n.skip(2);const r=new Uint16Array(o);for(let f=0;f<o;f++)r[f]=n.u16();const c=new Int16Array(o);for(let f=0;f<o;f++)c[f]=n.i16();const a=new Int32Array(o),l=new Uint16Array(o);for(let f=0;f<o;f++)a[f]=n.pos,l[f]=n.u16();const h=new DataView(e);return f=>{if(f>65535)return 0;let u=0,p=o-1;for(;u<=p;){const _=u+p>>>1,y=i[_]??0;if(f>y)u=_+1;else if(f<(r[_]??0))p=_-1;else{if((i[_]??0)===65535)return 0;const x=l[_]??0,b=c[_]??0,M=r[_]??0;if(x===0)return f+b&65535;const A=(a[_]??0)+x+(f-M)*2,k=h.getUint16(A,!1);return k===0?0:k+b&65535}}return 0}}function Di(e,t){const n=new It(e,t);n.skip(4),n.skip(4),n.skip(4),n.skip(4),n.skip(2);const s=n.u16();n.skip(16),n.skip(8),n.skip(2),n.skip(2),n.skip(2);const o=n.i16();return{unitsPerEm:s,indexToLocFormat:o}}function Ri(e,t){const n=new It(e,t);n.skip(4);const s=n.i16(),o=n.i16(),i=n.i16();n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(8),n.skip(2);const r=n.u16();return{ascender:s,descender:o,lineGap:i,numberOfHMetrics:r}}function Li(e,t,n,s){const o=new It(e,t),i=[];let r=0;for(let c=0;c<s;c++){const a=o.u16(),l=o.i16();i[c]={advanceWidth:a,lsb:l},r=a}for(let c=s;c<n;c++){const a=o.i16();i[c]={advanceWidth:r,lsb:a}}return i}function Pi(e,t,n,s){const o=new It(e,t),i=n+1,r=[];if(s===0)for(let c=0;c<i;c++)r[c]=o.u16()*2;else for(let c=0;c<i;c++)r[c]=o.u32();return r}function Fi(e,t){const n=new It(e,t);return n.skip(4),{numGlyphs:n.u16()}}const qi=1,Oi=2,Gi=4,Ni=8,ve=16,Ce=32,$i=1,Ee=2,Bi=8,Yi=32,Hi=64,Xi=128;function Ki(e,t,n,s,o){const i=Ie(e,t,n,s,o),r=[];for(const c of i){const a=Wi(c);a.length>0&&r.push(a)}return{contours:r,inverseYAxis:!1}}function Ie(e,t,n,s,o){if(s===0)return[];const i=t+n,r=new It(e,i),c=r.i16();return r.skip(8),c>=0?ji(r,c):zi(e,r,t,o)}function ji(e,t){if(t===0)return[];const n=[];for(let f=0;f<t;f++)n[f]=e.u16();const s=(n[t-1]??0)+1,o=e.u16();e.skip(o);const i=new Uint8Array(s);for(let f=0;f<s;){const u=e.u8();if(i[f++]=u,u&Ni){let p=e.u8();for(;p-- >0;)i[f++]=u}}const r=new Float64Array(s);let c=0;for(let f=0;f<s;f++){const u=i[f]??0;if(u&Oi){const p=e.u8();c+=u&ve?p:-p}else u&ve||(c+=e.i16());r[f]=c}const a=new Float64Array(s);c=0;for(let f=0;f<s;f++){const u=i[f]??0;if(u&Gi){const p=e.u8();c+=u&Ce?p:-p}else u&Ce||(c+=e.i16());a[f]=c}const l=[];let h=0;for(let f=0;f<t;f++){const u=n[f]??0,p=Vi(i,r,a,h,u);p.length>0&&l.push(p),h=u+1}return l}function Vi(e,t,n,s,o){const i=o-s+1;if(i<=0)return[];const r=[];for(let c=0;c<i;c++){const a=e[s+c]??0,l=t[s+c]??0,h=n[s+c]??0;r.push({x:l,y:h,onCurve:(a&qi)!==0})}return r}function Wi(e){const t=e.length;if(t<=0)return[];const n=[];for(let c=0;c<t;c++){const a=e[c],l=e[(c+1)%t];n.push(a),!a.onCurve&&!l.onCurve&&n.push({x:Math.trunc((a.x+l.x)/2),y:Math.trunc((a.y+l.y)/2),onCurve:!0})}const s=n.length;let o=0;if(!n[0].onCurve){for(let c=1;c<s;c++)if(n[c].onCurve){o=c;break}}const i=[];let r=0;for(;r<s;){const c=n[(o+r)%s],a=n[(o+r+1)%s];if(a.onCurve)i.push(new tt(J,c.x,c.y,a.x,a.y,0,0,0,0)),r+=1;else{const l=n[(o+r+2)%s];i.push(new tt(ot,c.x,c.y,a.x,a.y,l.x,l.y,0,0)),r+=2}}return i}function zi(e,t,n,s){const o=[];let i=0;do{i=t.u16();const r=t.u16();let c,a;i&$i?(c=t.i16(),a=t.i16()):(c=t.u8(),a=t.u8(),i&Ee&&(c>127&&(c-=256),a>127&&(a-=256)));let l=0,h=0;i&Ee&&(l=c,h=a);let f=1,u=0,p=0,_=1;i&Bi?f=_=t.f2dot14():i&Hi?(f=t.f2dot14(),_=t.f2dot14()):i&Xi&&(f=t.f2dot14(),u=t.f2dot14(),p=t.f2dot14(),_=t.f2dot14());const y=s(r),g=Zi(y,f,u,p,_,l,h);for(const x of g)o.push(x)}while(i&Yi);return o}function De(e){return e>=0?Math.floor(e+.5):Math.ceil(e-.5)}function Zi(e,t,n,s,o,i,r){if(t===1&&n===0&&s===0&&o===1&&i===0&&r===0)return e;const a=t===1&&n===0&&s===0&&o===1;return e.map(l=>l.map(h=>a?{x:h.x+i,y:h.y+r,onCurve:h.onCurve}:{x:De(t*h.x+n*h.y+i),y:De(s*h.x+o*h.y+r),onCurve:h.onCurve}))}const nn=1,In=2,Qi=4,Dt=8,un=16,L={_cp:new Int32Array(64),_gid:new Uint16Array(64),_gp:new Uint16Array(64),_xa:new Float64Array(64),_xo:new Float64Array(64),_yo:new Float64Array(64),_runEnd:new Int32Array(64),_runScript:new Int32Array(64)};function pn(e,t,n,s){if(e&n&14)return!1;if(e&Dt){if(n&16)return s!==null&&t<s.length&&s[t]!==65535;if(n&65280)return(n&65280)===(e&65280)}return!0}function gs(e,t,n,s){const o=L._gp,i=L._gid;for(let r=e+1;r<t;r++){const c=o[r];if(!(c&nn)&&pn(c,i[r],n,s))return r}return-1}function Re(e){if(L._gid.length>=e)return;let t=L._gid.length;for(;t<e;)t*=2;L._cp=new Int32Array(t),L._gid=new Uint16Array(t),L._gp=new Uint16Array(t),L._xa=new Float64Array(t),L._xo=new Float64Array(t),L._yo=new Float64Array(t),L._runEnd=new Int32Array(t),L._runScript=new Int32Array(t)}let _n=new Uint8Array(64);class Ji{constructor(t,n){this._pairs=[],this._counts=[],this._cross=[];const s=new DataView(t);this._dv=s;const o=s.getUint16(n)===1,i=o?s.getUint32(n+4):s.getUint16(n+2);let r=n+(o?8:4),c=!1,a=!1;for(let l=0;l<i&&r+8<=s.byteLength;l++){let h,f,u,p,_=!1,y;if(o){h=s.getUint32(r);const g=s.getUint8(r+4);f=s.getUint8(r+5),u=!(g&128),p=!!(g&64),_=!!(g&32),y=r+8}else{h=s.getUint16(r+2),f=s.getUint8(r+4);const g=s.getUint8(r+5);u=!!(g&1),p=!!(g&4),y=r+6}if(f===1&&(c=!0),p&&(a=!0),f===0&&u&&!_&&(this._pairs.push(y+8),this._counts.push(s.getUint16(y)),this._cross.push(p)),h<6)break;r+=h}this._hasData=i>0,this._hasMachine=c,this._hasCross=a}_get(t,n,s){const o=this._dv,i=this._pairs[t],r=(n<<16|s)>>>0;let c=0,a=this._counts[t]-1;for(;c<=a;){const l=c+a>>1,h=o.getUint32(i+6*l);if(h<r)c=l+1;else if(h>r)a=l-1;else return o.getInt16(i+6*l+4)}return 0}_apply(t,n){const s=L._gid,o=L._xa,i=L._xo,r=L._yo;let c=!1,a=!1;for(let l=0;l<this._pairs.length;l++){const h=this._cross[l];h&&!c&&(c=!0,_n.length<n&&(_n=new Uint8Array(n*2)),_n.fill(0,t,n));for(let f=t;f<n;){const u=gs(f,n,Dt,null);if(u<0){f++;continue}const p=this._get(l,s[f],s[u]);if(p)if(h)p===-32768?(_n[u]=1,r[u]=0):(r[u]=p,a=!0);else{const _=p/2;o[f]=o[f]+_,o[u]=o[u]+p-_,i[u]=i[u]+p-_}f=u}}if(a)for(let l=t+1;l<n;l++)_n[l]||(r[l]=r[l]+r[l-1])}}const $t=65535,Le=new Uint16Array(0);function tr(e,t){const n=e.getUint16(t+4);if(!n)return new Uint32Array(0);const s=t+n,o=new Uint32Array(e.getUint16(s));for(let i=0;i<o.length;i++)o[i]=e.getUint32(s+2+6*i);return o}function Pe(e,t){const n=e.getUint16(t),s=e.getUint16(t+2);let o=-1;if(n===1){for(let r=0;r<s;r++)o=Math.max(o,e.getUint16(t+4+2*r));const i=new Uint16Array(o+1).fill($t);for(let r=s-1;r>=0;r--)i[e.getUint16(t+4+2*r)]=r;return i}if(n===2){for(let r=0;r<s;r++)o=Math.max(o,e.getUint16(t+6+6*r));const i=new Uint16Array(o+1).fill($t);for(let r=s-1;r>=0;r--){const c=t+4+6*r,a=e.getUint16(c),l=e.getUint16(c+2),h=e.getUint16(c+4);for(let f=a;f<=l;f++)i[f]=h+f-a}return i}return Le}function xs(e,t){const n=e.getUint16(t);if(n===1){const s=e.getUint16(t+2),o=e.getUint16(t+4),i=new Uint16Array(s+o);for(let r=0;r<o;r++)i[s+r]=e.getUint16(t+6+2*r);return i}if(n===2){const s=e.getUint16(t+2);let o=-1;for(let r=0;r<s;r++)o=Math.max(o,e.getUint16(t+6+6*r));const i=new Uint16Array(o+1);for(let r=s-1;r>=0;r--){const c=t+4+6*r,a=e.getUint16(c+2),l=e.getUint16(c+4);for(let h=e.getUint16(c);h<=a;h++)i[h]=l}return i}return Le}class nr{constructor(t,n,s){this._setCache=[];const o=new DataView(t);this._dv=o;const i=o.getUint16(n+2),r=o.getUint16(n+4),c=o.getUint16(n+10),a=i>=2?o.getUint16(n+12):0;if(this._sets=a?n+a:0,!r){this._props=null;return}const l=xs(o,n+r),h=c?xs(o,n+c):new Uint16Array(0),f=new Uint16Array(s);for(let u=0;u<s&&u<l.length;u++)switch(l[u]){case 1:f[u]=In;break;case 2:f[u]=Qi;break;case 3:f[u]=Dt|(h[u]??0)<<8;break}this._props=f}_markSet(t){let n=this._setCache[t];if(!n){const s=this._dv,o=this._sets;n=o&&t<s.getUint16(o+2)?Pe(s,o+s.getUint32(o+4+4*t)):new Uint16Array(0),this._setCache[t]=n}return n}}const Fe="ZyyyZinhArabArmnBengBopoCherCoptCyrlDsrtDevaEthiGeorGothGrekGujrGuruHaniHangHebrHiraKndaKanaKhmrLaooLatnMlymMongMymrOgamItalOryaRunrSinhSyrcTamlTeluThaaThaiTibtCansYiiiTglgHanoBuhdTagbBraiCprtLimbLinbOsmaShawTaleUgarHrktBugiGlagKharSyloTaluTfngXpeoBaliBatkBlisBrahChamCirtCyrsEgydEgyhEgypGeokHansHantHmngHungIndsJavaKaliLatfLatgLepcLinaMandMayaMeroNkooOrkhPermPhagPhnxPlrdRoroSaraSyreSyrjSyrnTengVaiiVispXsuxZxxxZzzzCariJpanLanaLyciLydiOlckRjngSaurSgnwSundMoonMteiArmiAvstCakmKoreKthiManiPhliPhlpPhlvPrtiSamrTavtZmthZsymBamuLisuNkgbSarbBassDuplElbaGranKpelLomaMendMercNarbNbatPalmSindWaraAfakJurcMrooNshuShrdSoraTakrTangWoleHluwKhojTirhAghbMahjAhomHatrModiMultPaucSiddAdlmBhksMarcNewaOsgeHanbJamoZsyeGonmSoyoZanbDogrGongMakaMedfRohgSogdSogoElymHmnpNandWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmAranGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTols",Dn=Fe.length/4,lt=0,Rt=1,Rn=25,sr=8,er=14;function yn(e){return Fe.substring(e*4,e*4+4)}const or=[],ir=[];function Ln(e,t){const n=t?ir:or;let s=n[e];if(s===void 0){try{s=new RegExp(`^\\p{${t?"scx":"sc"}=${yn(e)}}$`,"u")}catch{s=null}n[e]=s}return s}let ds=null;const Pn=[Rn,lt,Rt,sr,er],gn=[[lt],[Rn]],qe=new Map;let Fn=null;const Oe=new Map;function Ms(e){if(e<128)return gn[e>=65&&e<=90||e>=97&&e<=122?1:0];let t;if(e<65536){Fn||(Fn=new Uint16Array(65536));const n=Fn[e];if(n)return gn[n-1];t=Ge(e),Fn[e]=t+1}else t=Oe.get(e),t===void 0&&(t=Ge(e),Oe.set(e,t));return gn[t]}function Ge(e){const t=String.fromCodePoint(e);let n=103;for(let r=0;r<Pn.length+Dn;r++){const c=r<Pn.length?Pn[r]:r-Pn.length,a=Ln(c,!1);if(a&&a.test(t)){n=c;break}}let s=[n];if(!ds){let r="";for(let c=0;c<Dn;c++)Ln(c,!1)&&Ln(c,!0)&&(r+=`${r?"|":""}(?!\\p{sc=${yn(c)}})\\p{scx=${yn(c)}}`);ds=new RegExp(`^(?:${r})$`,"u")}if(ds.test(t)){const r=[];for(let c=0;c<Dn;c++){const a=Ln(c,!0);a&&a.test(t)&&r.push(c)}r.length&&(s=rr(n,r))}const o=s.join(",");let i=qe.get(o);return i===void 0&&(i=gn.length,gn.push(s),qe.set(o,i)),i}function rr(e,t){if(e===t[0])return t;if(e!==Rt&&e!==lt){const n=t.indexOf(e,1);if(n<0){t.push(e);const s=t[0];t[0]=e,t[t.length-1]=s}else t[n]=t[0],t[0]=e;return t}if(e===lt){if(t.length===1)return[lt,t[0]];for(let n=1;n<t.length;n++)if(t[0]===Rn||t[n]<t[0]){const s=t[0];t[0]=t[n],t[n]=s}return t}t.push(t[0]),t[0]=e;for(let n=2;n<t.length;n++)if(t[1]===Rn||t[n]<t[1]){const s=t[1];t[1]=t[n],t[n]=s}return t}const xn=[40,41,91,93,123,125,3898,3899,3900,3901,5787,5788,8261,8262,8317,8318,8333,8334,8968,8969,8970,8971,9001,9002,10088,10089,10090,10091,10092,10093,10094,10095,10096,10097,10098,10099,10100,10101,10181,10182,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10627,10628,10629,10630,10631,10632,10633,10634,10635,10636,10637,10640,10639,10638,10641,10642,10643,10644,10645,10646,10647,10648,10712,10713,10714,10715,10748,10749,11810,11811,11812,11813,11814,11815,11816,11817,11861,11862,11863,11864,11865,11866,11867,11868,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,12308,12309,12310,12311,12312,12313,12314,12315,65113,65114,65115,65116,65117,65118,65288,65289,65339,65341,65371,65373,65375,65376,65378,65379];let dn=null;function cr(e){if(e<40||e>125&&e<3898)return 0;if(!dn){dn=new Map;for(let t=0;t<xn.length;t+=2)dn.set(xn[t],xn[t+1]),dn.set(xn[t+1],-xn[t])}return dn.get(e)??0}const Ne=32,kt=[],sn=[];let Ft=0,qn=lt;const Bt=[];let en=[],Vt=[];const $e=[];function Be(e){let t=$e[e];return t||($e[e]=t=[e]),t}function ms(){const e=Bt[0];return e===lt?qn:e}function Ye(e,t){let n=Ft;if(n<=0)return;n>kt.length&&(n=kt.length);let s=kt.length-1;for(t?(s--,n--,Ft=1):Ft=0;n>0;s--,n--)sn[s]=e}function ar(){const e=en,t=Bt;if(e.length===0||t.length===0)return!1;if(e.length===1&&t.length===1){const c=e[0];return c<=Rt?!0:t[0]<=Rt?(t[0]=c,!0):t[0]===c}let n=0,s=t[n++];if(e[0]<=Rt)return e.length===2&&s<=Rt&&qn===lt&&(qn=e[1]),!0;if(s<=Rt)return He(Bt,e),!0;let o=e.indexOf(s)>=0;if(n===t.length)return o;let i=0;o||(s=e[i++],o=t.indexOf(s,n)>=0);let r=0;if(o&&(t[r++]=s),i!==e.length)for(;n<t.length;n++)e.indexOf(t[n],i)>=0&&(t[r++]=t[n]);return r>0?(t.length=r,!0):!1}function He(e,t){e.length=t.length;for(let n=0;n<t.length;n++)e[n]=t[n]}function lr(e,t,n,s){if(t===0)return 0;let o=lt,i=0;for(;i<t;i++){const l=Ms(e[i]);if(l.length!==1)break;const h=l[0];if(!(h<=Rt||h===o)){if(o!==lt)break;o=h}}if(i===t)return n[0]=t,s[0]=o,1;kt.length=0,sn.length=0,Ft=0,qn=lt,Bt.length=1,Bt[0]=lt,Vt=Ms(e[0]);let r=1,c=e[0],a=0;for(;Bt.length;){let l=!1;for(;r<=t;){const h=r-1,f=c;en=Vt,r===t?r++:(c=e[r++],Vt=Ms(c),Vt[0]===Rt&&Vt.length>1&&(en[0]===lt&&(en=Vt.slice(1)),Vt=Be(Rt)));const u=cr(f);if(u>0)kt.length===Ne&&(kt.shift(),sn.shift(),Ft===Ne&&Ft--),Ye(ms(),!1),kt.push(f),sn.push(lt),Ft++;else if(u<0){for(let p=kt.length-1;p>=0;p--)if(kt[p]===-u){const _=sn[p];_!==lt&&(en=Be(_));const y=kt.length-1-p;kt.length-=y,sn.length-=y,Ft=Math.max(0,Ft-y);break}}if(!ar()){const p=ms();Ye(p,u>0),n[a]=h,s[a++]=p,He(Bt,en),l=!0;break}}l||(n[a]=t,s[a++]=ms(),Bt.length=0)}return a}const Xe=[];function xt(e){return(e.charCodeAt(0)<<24|e.charCodeAt(1)<<16|e.charCodeAt(2)<<8|e.charCodeAt(3))>>>0}const hr="Bengbng2Devadev2Gujrgjr2Gurugur2Kndaknd2Mlymmlm2Oryaory2Tamltml2Telutel2Mymrmym2",fr="HirakanaLaoolao Yiiiyi Nkoonko Vaiivai Zmthmath";function Ke(e,t){for(let n=0;n<e.length;n+=8)if(e.substring(n,n+4)===t)return e.substring(n+4,n+8);return""}function je(e){let t=Xe[e];if(!t){t=[];const n=yn(e),s=Ke(hr,n);s&&(s!=="mym2"&&t.push(xt(s.substring(0,3)+"3")),t.push(xt(s))),t.push(xt(Ke(fr,n)||n.toLowerCase())),Xe[e]=t}return t}const Ve=64,On=64,ur=["abvm","blwm","mark","mkmk","curs","dist","kern"].map(xt),pr=xt("kern"),We=[xt("DFLT"),xt("dflt"),xt("latn")],bs=0,ws=1,Gn=2,Ut=new Uint16Array(0),_r=new Int16Array(0),yr=new Uint32Array(0);class Mn{constructor(t,n,s,o){this._type=t,this._fmt=n,this._off=s,this._cov=o,this._cd1=Ut,this._cd2=Ut,this._cd3=Ut,this._vf1=0,this._vf2=0,this._len1=0,this._len2=0,this._n1=0,this._n2=0,this._simple=!1,this._kx=_r,this._ps=yr,this._sg=Ut}}class gr{constructor(t,n,s){this._props=t,this._set=n,this._subs=s;let o=0;for(const r of s)o=Math.max(o,r._cov.length);const i=new Uint8Array(o);for(const r of s){const c=r._cov;for(let a=0;a<c.length;a++)c[a]!==$t&&(i[a]=1)}this._any=i,this._pairs=s.length>0&&s.every(r=>r._simple)}}class xr{constructor(t,n){this._lookups=t,this._kern=n}}let dt=new DataView(new ArrayBuffer(0)),ze=0,Nn=0,Ze=0,qt=0,Yt=null;const As=new Int32Array(Ve*On);function $n(e,t,n){let s=e;t&1&&(L._xo[n]=L._xo[n]+dt.getInt16(s),s+=2),t&2&&(L._yo[n]=L._yo[n]+dt.getInt16(s),s+=2),t&4&&(L._xa[n]=L._xa[n]+dt.getInt16(s))}function dr(e,t,n){const s=L._gid,o=L._gp,i=L._xa,r=e._any,c=e._subs,a=e._props,l=e._set;for(let h=t;h<n;h++){const f=s[h];if(f>=r.length||!r[f])continue;const u=o[h];if(u&a&14||u&Dt&&!pn(u,f,a,l))continue;let p=h+1;if(p>=n)break;const _=o[p];if((_&(nn|Dt)||_&a&14)&&(p=gs(h,n,a,l),p<0))continue;const y=s[p];for(let g=0;g<c.length;g++){const x=c[g],b=x._cov,M=f<b.length?b[f]:$t;if(M===$t)continue;let A=-1;if(x._fmt===1){if(M>=x._ps.length-1)continue;const k=x._sg;let T=x._ps[M],S=x._ps[M+1]-1;for(;T<=S;){const w=T+S>>1,m=k[w];if(m<y)T=w+1;else if(m>y)S=w-1;else{A=w;break}}}else{const k=f<x._cd1.length?x._cd1[f]:0,T=y<x._cd2.length?x._cd2[y]:0;k<x._n1&&T<x._n2&&(A=k*x._n2+T)}if(!(A<0)){i[h]=i[h]+x._kx[A],h=p-1;break}}}}function Qe(e){let t=0;for(let n=e&255;n;n&=n-1)t++;return t*2}class Mr{constructor(t,n,s){this._lookupCache=[],this._planCache=[],this._covCache=new Map,this._cdCache=new Map;const o=new DataView(t);this._view=o,this._scripts=n+o.getUint16(n+4),this._features=n+o.getUint16(n+6),this._lookupList=n+o.getUint16(n+8),this._gdef=s}_cov(t,n){if(!n)return Ut;let s=this._covCache.get(t+n);return s||(s=Pe(this._view,t+n),this._covCache.set(t+n,s)),s}_cd(t,n){if(!n)return Ut;let s=this._cdCache.get(t+n);return s||(s=xs(this._view,t+n),this._cdCache.set(t+n,s)),s}_script(t){const n=this._view,s=this._scripts;for(let o=0,i=n.getUint16(s);o<i;o++)if(n.getUint32(s+2+6*o)===t)return s+n.getUint16(s+6+6*o);return 0}_plan(t,n){let s=this._planCache[t];if(s)return s;const o=this._view;let i=0;for(let l=0;l<n.length&&!i;l++)i=this._script(n[l]);for(let l=0;l<We.length&&!i;l++)i=this._script(We[l]);const r=[];let c=!1;const a=i?o.getUint16(i):0;if(a){const l=i+a,h=o.getUint16(l+2),f=this._features,u=o.getUint16(f),p=o.getUint16(l+4);for(let _=-1;_<p;_++){const y=_<0?h:o.getUint16(l+6+2*_);if(y>=u)continue;const g=o.getUint32(f+2+6*y);if(_>=0&&ur.indexOf(g)<0)continue;g===pr&&(c=!0);const x=f+o.getUint16(f+6+6*y);for(let b=0,M=o.getUint16(x+2);b<M;b++){const A=o.getUint16(x+4+2*b);r.indexOf(A)<0&&r.push(A)}}}return r.sort((l,h)=>l-h),s=new xr(r,c),this._planCache[t]=s,s}_lookup(t){const n=this._lookupCache[t];if(n)return n;const s=this._view,o=this._lookupList;if(t>=s.getUint16(o))return null;const i=o+s.getUint16(o+2+2*t),r=s.getUint16(i),c=s.getUint16(i+2),a=s.getUint16(i+4);let l=null;c&16&&(l=this._gdef?this._gdef._markSet(s.getUint16(i+6+2*a)):Ut);const h=[];for(let u=0;u<a;u++){let p=i+s.getUint16(i+6+2*u),_=r;_===9&&(_=s.getUint16(p+2),p+=s.getUint32(p+4));const y=this._sub(_,p);y&&h.push(y)}const f=new gr(c,l,h);return this._lookupCache[t]=f,f}_sub(t,n){const s=this._view,o=s.getUint16(n);if(t===1||t===2){if(o!==1&&o!==2)return null;const i=new Mn(t,o,n,this._cov(n,s.getUint16(n+2)));return i._vf1=s.getUint16(n+4),i._len1=Qe(i._vf1),t===2&&(i._vf2=s.getUint16(n+6),i._len2=Qe(i._vf2),o===2&&(i._cd1=this._cd(n,s.getUint16(n+8)),i._cd2=this._cd(n,s.getUint16(n+10)),i._n1=s.getUint16(n+12),i._n2=s.getUint16(n+14)),(i._vf1&15)===4&&i._vf2===0&&this._decodePairs(i)),i}if(t===7){if(o===3)return new Mn(t,o,n,this._cov(n,s.getUint16(n+6)));if(o!==1&&o!==2)return null;const i=new Mn(t,o,n,this._cov(n,s.getUint16(n+2)));return o===2&&(i._cd1=this._cd(n,s.getUint16(n+4))),i}if(t===8){if(o===3){const r=s.getUint16(n+2);return new Mn(t,o,n,this._cov(n,s.getUint16(n+6+2*r)))}if(o!==1&&o!==2)return null;const i=new Mn(t,o,n,this._cov(n,s.getUint16(n+2)));return o===2&&(i._cd1=this._cd(n,s.getUint16(n+4)),i._cd2=this._cd(n,s.getUint16(n+6)),i._cd3=this._cd(n,s.getUint16(n+8))),i}return null}_decodePairs(t){const n=this._view,s=t._off,o=t._len1;if(t._simple=!0,t._fmt===2){const h=t._n1*t._n2,f=new Int16Array(h);for(let u=0;u<h;u++)f[u]=n.getInt16(s+16+u*o);t._kx=f;return}const i=n.getUint16(s+8),r=new Uint32Array(i+1);let c=0;for(let h=0;h<i;h++)r[h]=c,c+=n.getUint16(s+n.getUint16(s+10+2*h));r[i]=c;const a=new Uint16Array(c),l=new Int16Array(c);for(let h=0;h<i;h++){const f=s+n.getUint16(s+10+2*h);for(let u=0,p=r[h+1]-r[h];u<p;u++){const _=f+2+u*(2+o);a[r[h]+u]=n.getUint16(_),l[r[h]+u]=n.getInt16(_+2)}}t._ps=r,t._sg=a,t._kx=l}_position(t,n,s){dt=this._view,ze=n,Nn=s,Ze=Math.max((s-n)*64,16384);const o=t._lookups;for(let i=0;i<o.length;i++){const r=this._lookup(o[i]);if(!r||!r._subs.length)continue;if(qt=r._props,Yt=r._set,r._pairs){dr(r,n,s);continue}const c=L._gp,a=L._gid,l=r._any;for(let h=n;h<s;){const f=a[h];if(f<l.length&&l[f]&&pn(c[h],f,qt,Yt)){const u=this._applyAt(r,h,0);if(u>=0){h=u;continue}}h++}}}_applyAt(t,n,s){const o=t._subs;for(let i=0;i<o.length;i++){const r=this._applySub(o[i],n,s);if(r>=0)return r}return-1}_applySub(t,n,s){const o=L._gid[n],i=t._cov,r=o<i.length?i[o]:$t;if(r===$t)return-1;const c=dt,a=t._off;switch(t._type){case 1:{if(t._fmt===1)$n(a+6,t._vf1,n);else{if(r>=c.getUint16(a+6))return-1;$n(a+8+r*t._len1,t._vf1,n)}return n+1}case 2:{let l=n+1;if(l>=Nn)return-1;const h=L._gp[l];if((h&(nn|Dt)||h&qt&14)&&(l=gs(n,Nn,qt,Yt),l<0))return-1;const f=L._gid[l];if(t._simple){const p=t._kx;if(t._fmt===1){if(r>=t._ps.length-1)return-1;const g=t._sg;let x=t._ps[r],b=t._ps[r+1]-1;for(;x<=b;){const M=x+b>>1,A=g[M];if(A<f)x=M+1;else if(A>f)b=M-1;else return L._xa[n]=L._xa[n]+p[M],l}return-1}const _=o<t._cd1.length?t._cd1[o]:0,y=f<t._cd2.length?t._cd2[f]:0;return _>=t._n1||y>=t._n2?-1:(L._xa[n]=L._xa[n]+p[_*t._n2+y],l)}let u;if(t._fmt===1){if(r>=c.getUint16(a+8))return-1;const p=a+c.getUint16(a+10+2*r),_=2+t._len1+t._len2;let y=0,g=c.getUint16(p)-1;for(u=-1;y<=g;){const x=y+g>>1,b=p+2+x*_,M=c.getUint16(b);if(M<f)y=x+1;else if(M>f)g=x-1;else{u=b+2;break}}if(u<0)return-1}else{const p=o<t._cd1.length?t._cd1[o]:0,_=f<t._cd2.length?t._cd2[f]:0;if(p>=t._n1||_>=t._n2)return-1;u=a+16+(p*t._n2+_)*(t._len1+t._len2)}return t._vf1&&$n(u,t._vf1,n),t._vf2&&$n(u+t._len1,t._vf2,l),t._len2?l+1:l}case 7:return this._context(t,n,o,r,s);case 8:return this._chain(t,n,o,r,s)}return-1}_context(t,n,s,o,i){const r=dt,c=t._off;if(t._fmt===3){const p=r.getUint16(c+2),_=this._input(n,p,Gn,Ut,c+8,c,i);return _<0?-1:(this._apply(c+6+2*p,r.getUint16(c+4),p,i),_)}let a=o,l=c+4,h=bs;if(t._fmt===2&&(a=s<t._cd1.length?t._cd1[s]:0,l=c+6,h=ws),a>=r.getUint16(l))return-1;const f=r.getUint16(l+2+2*a);if(!f)return-1;const u=c+f;for(let p=0,_=r.getUint16(u);p<_;p++){const y=u+r.getUint16(u+2+2*p),g=r.getUint16(y),x=this._input(n,g,h,t._cd1,y+4,0,i);if(!(x<0))return this._apply(y+4+2*Math.max(g-1,0),r.getUint16(y+2),g,i),x}return-1}_chain(t,n,s,o,i){const r=dt,c=t._off;if(t._fmt===3){let p=c+2;const _=r.getUint16(p),y=p+2;p+=2+2*_;const g=r.getUint16(p),x=p+2;p+=2+2*g;const b=r.getUint16(p),M=p+2;p+=2+2*b;const A=this._input(n,g,Gn,Ut,x+2,c,i);return A<0||!this._lookahead(A,b,Gn,Ut,M,c)||!this._backtrack(n,_,Gn,Ut,y,c)?-1:(this._apply(p+2,r.getUint16(p),g,i),A)}let a=o,l=c+4,h=bs;if(t._fmt===2&&(a=s<t._cd2.length?t._cd2[s]:0,l=c+10,h=ws),a>=r.getUint16(l))return-1;const f=r.getUint16(l+2+2*a);if(!f)return-1;const u=c+f;for(let p=0,_=r.getUint16(u);p<_;p++){let y=u+r.getUint16(u+2+2*p);const g=r.getUint16(y),x=y+2;y+=2+2*g;const b=r.getUint16(y),M=y+2;y+=2+2*Math.max(b-1,0);const A=r.getUint16(y),k=y+2;y+=2+2*A;const T=this._input(n,b,h,t._cd2,M,0,i);if(!(T<0)&&this._lookahead(T,A,h,t._cd3,k,0)&&this._backtrack(n,g,h,t._cd1,x,0))return this._apply(y+2,r.getUint16(y),b,i),T}return-1}_matches(t,n,s,o,i){if(t===bs)return i===o;if(t===ws)return(i<n.length?n[i]:0)===o;const r=this._cov(s,o);return i<r.length&&r[i]!==$t}_next(t,n,s,o,i){const r=L._gp,c=L._gid;for(let a=t+1;a<Nn;a++){const l=r[a],h=c[a];if(pn(l,h,qt,Yt)){if(this._matches(n,s,o,i,h))return a;if(!(l&nn))return-1}}return-1}_prev(t,n,s,o,i){const r=L._gp,c=L._gid;for(let a=t-1;a>=ze;a--){const l=r[a],h=c[a];if(pn(l,h,qt,Yt)){if(this._matches(n,s,o,i,h))return a;if(!(l&nn))return-1}}return-1}_input(t,n,s,o,i,r,c){if(n>On)return-1;const a=c*On;As[a]=t;let l=t;for(let h=1;h<n;h++){if(l=this._next(l,s,o,r,dt.getUint16(i+2*(h-1))),l<0)return-1;As[a+h]=l}return l+1}_lookahead(t,n,s,o,i,r){let c=t-1;for(let a=0;a<n;a++)if(c=this._next(c,s,o,r,dt.getUint16(i+2*a)),c<0)return!1;return!0}_backtrack(t,n,s,o,i,r){let c=t;for(let a=0;a<n;a++)if(c=this._prev(c,s,o,r,dt.getUint16(i+2*a)),c<0)return!1;return!0}_apply(t,n,s,o){const i=o*On;for(let r=0;r<n;r++){const c=dt.getUint16(t+4*r);if(c>=s||o+1>=Ve||Ze--<=0)continue;const a=this._lookup(dt.getUint16(t+4*r+2));if(!a)continue;const l=qt,h=Yt;qt=a._props,Yt=a._set,this._applyAt(a,As[i+c],o+1),qt=l,Yt=h}}}function mr(e){if(e<173)return!1;if(e<65536){switch(e>>8){case 0:return e===173;case 3:return e===847;case 6:return e===1564;case 23:return e>=6068&&e<=6069;case 24:return e>=6155&&e<=6159;case 32:return e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8303;case 254:return e>=65024&&e<=65039||e===65279;case 255:return e>=65520&&e<=65528}return!1}return e>=119155&&e<=119162||e>=917504&&e<=921599}function br(e,t,n){const s=e.metrics.unitsPerEm;switch(t){case 160:return e.advance(n);case 8193:case 8195:case 12288:return s;case 8192:case 8194:return s/2;case 8196:return s/3;case 8197:return s/4;case 8198:return s/6;case 8201:return s/5;case 8202:return s/16;case 8287:return s*4/18;case 8239:return e.advance(n)/2;case 8199:{for(let o=48;o<=57;o++){const i=e.glyphId(o);if(i)return e.advance(i)}return e.advance(n)}case 8200:{const o=e.glyphId(46)||e.glyphId(44);return e.advance(o||n)}}return-1}let ks=null;const Je=new Map;function wr(e){if(e<768)return!1;let t=Je.get(e);return t===void 0&&(ks||(ks=new RegExp("^\\p{Mn}$","u")),t=ks.test(String.fromCodePoint(e)),Je.set(e,t)),t}function Ar(e,t){const n=t.length;Re(n);const s=L._cp,o=L._gid,i=L._gp,r=L._xa,c=L._xo,a=L._yo,l=e._glyphProps(),h=e._advances(),f=h.length?h[h.length-1]:0,u=e.glyphId(32);let p=!1,_=0,y=0;for(let M=0;M<n;M++){let A=t.charCodeAt(M);if(A>=55296&&A<56320&&M+1<n){const m=t.charCodeAt(M+1);m>=56320&&m<57344&&(A=(A-55296<<10)+(m-56320)+65536,M++)}let k=e.glyphId(A),T=-1;!k&&A>=160&&u&&((A===8192||A===8193)&&(k=e.glyphId(A+2)),k||(T=br(e,A,u),T>=0&&(k=u)));const S=A>=173&&mr(A);let w;l?w=k<l.length?l[k]:0:w=!S&&wr(A)?Dt:In,S&&(w|=A===8204?un:un|nn,p=!0),_|=w,s[y]=A,o[y]=k,i[y]=w,r[y]=T>=0?T:k<h.length?h[k]:f,c[y]=0,a[y]=0,y++}const g=lr(s,y,L._runEnd,L._runScript),x=(_&Dt)!==0;let b=0;for(let M=0;M<g;M++){const A=L._runEnd[M];ro(e,b,A,L._runScript[M],x),b=A}if(p)for(let M=0;M<y;M++)i[M]&un&&(r[M]=c[M]=a[M]=0);return y}const Us=0,to=1,Ts=2,kr=3,Ss=4,Bn=Ts|Ss,Ur=Us|Ss,Tr=Ts,no=Us,vs=to,Sr="BengDevaGujrGuruKndaMlymOryaTamlTelu",vr="TibtMongSinhBuhdHanoTglgTagbLimbTaleBugiKharSyloTfngBaliNkooPhagChamKaliLepcRjngSaurSundEgypJavaKthiMteiLanaTavtBatkBrahMandCakmPlrdShrdTakrDuplGranKhojSindMahjManiModiHmngPhlpSiddTirhAhomMultAdlmBhksMarcNewaGonmSoyoZanbDogrGongRohgMakaMedfSogoSogdElymNandHmnpWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTolsJurcPcunSeal",so=xt("DFLT"),eo=xt("latn"),Cr=xt("mymr"),oo=[so,xt("dflt"),eo];function Er(e,t){if(!e)return 0;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>=0)return t[n];for(let n=0;n<3;n++)if(e.indexOf(oo[n])>=0)return oo[n];return 0}function Ir(e,t){const n=t===so||t===eo;return e==="Thai"||e==="Laoo"?Tr:e==="Hang"?Ur:e==="Khmr"?no:e==="Mymr"?n||t===Cr?Bn:vs:Sr.indexOf(e)>=0?n?Bn:(t&255)===51?vs:no:vr.indexOf(e)>=0?n?Bn:vs:Bn}function Dr(e,t){const n=e._shaperCache();let s=n[t];return s<0&&(s=Ir(yn(t),Er(e._gsubScriptTags(),je(t))),n[t]=s),s}function io(e,t,n){const s=L._gp,o=L._xa,i=L._xo;for(let r=e;r<t;r++)s[r]&Dt&&(n&&(i[r]=i[r]-o[r]),o[r]=0)}function ro(e,t,n,s,o){const i=Dr(e,s),r=e._gposTable(),c=e._kernTable(),a=r?r._plan(s,je(s)):null,l=c!==null&&c._hasData&&!(a&&a._kern)&&(i&Ss)!==0,h=!o||l&&c._hasMachine?Us:i&kr,f=!r&&(!l||!c._hasCross);h===to&&io(t,n,f),a&&r._position(a,t,n),l&&c._apply(t,n),h===Ts&&io(t,n,f)}function Rr(e,t,n){Re(2);const s=e._glyphProps(),o=e.advance(t),i=e.advance(n);return L._gid[0]=t,L._gid[1]=n,L._gp[0]=s?t<s.length?s[t]:0:In,L._gp[1]=s?n<s.length?s[n]:0:In,L._xa[0]=o,L._xa[1]=i,L._xo[0]=L._xo[1]=L._yo[0]=L._yo[1]=0,ro(e,0,2,lt,((L._gp[0]|L._gp[1])&Dt)!==0),L._xa[0]+L._xa[1]-o-i}function Lr(e){const t=new It(e);if(t.u32()===1953784678){if(t.skip(4),t.u32()===0)throw new Error("TTC contains no fonts");const o=t.u32();t.seek(o)}else t.seek(0);return Pr(e,t)}function Pr(e,t){t.skip(4);const n=t.u16();t.skip(6);const s=new Map;for(let o=0;o<n;o++){const i=String.fromCharCode(t.u8(),t.u8(),t.u8(),t.u8());t.skip(4);const r=t.u32(),c=t.u32();s.set(i,{offset:r,length:c})}return s}const co=2048,Fr=65536;class qr{constructor(t){this._buffer=t,this._tables=Lr(t);const n=this._tables.get("head"),s=this._tables.get("maxp"),o=this._tables.get("hhea"),i=this._tables.get("hmtx"),r=this._tables.get("loca"),c=this._tables.get("cmap");if(!n)throw new Error("Font missing required `head` table");if(!s)throw new Error("Font missing required `maxp` table");if(!o)throw new Error("Font missing required `hhea` table");if(!i)throw new Error("Font missing required `hmtx` table");if(!r)throw new Error("Font missing required `loca` table");if(!c)throw new Error("Font missing required `cmap` table");this._head=Di(t,n.offset);const a=Fi(t,s.offset);this._hhea=Ri(t,o.offset),this._hmtx=Li(t,i.offset,a.numGlyphs,this._hhea.numberOfHMetrics),this._loca=Pi(t,r.offset,a.numGlyphs,this._head.indexToLocFormat),this._cmap=Ci(t,c.offset),this._cmapCache=null,this._layoutLoaded=!1,this._gdef=null,this._gpos=null,this._kern=null,this._gsubScripts=null,this._shapers=null,this._advanceTable=null,this._pairCache=new Map,this.metrics={unitsPerEm:this._head.unitsPerEm,ascender:this._hhea.ascender,descender:this._hhea.descender,lineGap:this._hhea.lineGap}}glyphId(t){if(t>=co||t<0)return this._cmap(t);let n=this._cmapCache;n||(n=this._cmapCache=new Uint16Array(co));let s=n[t];return s||(n[t]=s=this._cmap(t)+1),s-1}get numGlyphs(){return this._loca.length-1}advance(t){return(this._hmtx[t]??this._hmtx[this._hmtx.length-1]??{advanceWidth:0}).advanceWidth}lsb(t){return(this._hmtx[t]??this._hmtx[this._hmtx.length-1]??{lsb:0}).lsb}kerning(t,n){const s=t<32768&&n<32768?t<<15|n:-1-(t*65536+n),o=this._pairCache.get(s);return o!==void 0?o:this._kerningMiss(s,t,n)}_kerningMiss(t,n,s){const o=Rr(this,n,s);return this._pairCache.size>=Fr&&this._pairCache.clear(),this._pairCache.set(t,o),o}_loadLayout(){if(this._layoutLoaded)return;this._layoutLoaded=!0;const t=this._buffer,n=this._tables.get("GDEF"),s=this._tables.get("GPOS"),o=this._tables.get("kern"),i=this._tables.get("GSUB");n&&(this._gdef=new nr(t,n.offset,this.numGlyphs)),s&&(this._gpos=new Mr(t,s.offset,this._gdef)),o&&(this._kern=new Ji(t,o.offset)),i&&(this._gsubScripts=tr(new DataView(t),i.offset))}_gsubScriptTags(){return this._loadLayout(),this._gsubScripts}_shaperCache(){let t=this._shapers;return t||(t=this._shapers=new Int8Array(Dn).fill(-1)),t}_advances(){let t=this._advanceTable;if(!t){const n=this._hmtx.length;t=new Uint16Array(n);for(let s=0;s<n;s++)t[s]=this._hmtx[s].advanceWidth;this._advanceTable=t}return t}_glyphProps(){return this._loadLayout(),this._gdef?this._gdef._props:null}_gposTable(){return this._loadLayout(),this._gpos}_kernTable(){return this._loadLayout(),this._kern}shape(t){const n=this._tables.get("glyf");if(!n)return{contours:[],inverseYAxis:!1};const s=this._loca,o=s[t]??0,r=(s[t+1]??o)-o;return Ki(this._buffer,n.offset,o,r,c=>this._glyphRaw(c))}_glyphRaw(t){const n=this._tables.get("glyf");if(!n)return[];const s=this._loca,o=s[t]??0,r=(s[t+1]??o)-o;return Ie(this._buffer,n.offset,o,r,c=>this._glyphRaw(c))}}function Yn(e,t){const n=1/t;for(const s of e.contours)for(let o=0;o<s.length;o++){const i=s[o];if(i.p0x*=n,i.p0y*=n,i.p1x*=n,i.p1y*=n,i.p2x*=n,i.p2y*=n,i.p3x*=n,i.p3y*=n,i.type===ot){const r=i.p1x-i.p0x,c=i.p1y-i.p0y,a=i.p2x-i.p1x,l=i.p2y-i.p1y;Q(r,c,a,l)===0&&(s[o]=new tt(J,i.p0x,i.p0y,i.p2x,i.p2y,0,0,0,0))}else if(i.type===Et){const r=i.p2x-i.p1x,c=i.p2y-i.p1y,a=1.5*i.p1x-.5*i.p0x,l=1.5*i.p1y-.5*i.p0y;Q(i.p1x-i.p0x,i.p1y-i.p0y,r,c)===0&&Q(r,c,i.p3x-i.p2x,i.p3y-i.p2y)===0?s[o]=new tt(J,i.p0x,i.p0y,i.p3x,i.p3y,0,0,0,0):a===1.5*i.p2x-.5*i.p3x&&l===1.5*i.p2y-.5*i.p3y&&(s[o]=new tt(ot,i.p0x,i.p0y,a,l,i.p3x,i.p3y,0,0))}}}const ao=1e-6,Or=1.1111111111111112,Gr=new Float64Array(16);function lo(e,t,n){switch(t[n]=e.p0x,t[n+1]=e.p0y,t[n+2]=e.p1x,t[n+3]=e.p1y,e.type){case J:return 1;case ot:return t[n+4]=e.p2x,t[n+5]=e.p2y,2;default:return t[n+4]=e.p2x,t[n+5]=e.p2y,t[n+6]=e.p3x,t[n+7]=e.p3y,3}}function ho(e,t,n){if(n===3){const s=e[t],o=e[t+1],i=e[t+2],r=e[t+3],c=e[t+4],a=e[t+5],l=e[t+6],h=e[t+7];(i===s&&r===o||i===l&&r===h)&&(c===s&&a===o||c===l&&a===h)&&(e[t+2]=l,e[t+3]=h,n=1)}if(n===2){const s=e[t],o=e[t+1],i=e[t+2],r=e[t+3],c=e[t+4],a=e[t+5];(i===s&&r===o||i===c&&r===a)&&(e[t+2]=c,e[t+3]=a,n=1)}return n===1&&e[t]===e[t+2]&&e[t+1]===e[t+3]&&(n=0),n}function Nr(e,t){const n=Gr;let s=lo(e,n,0),o=lo(t,n,8);if(!(s>=1&&s<=3&&o>=1&&o<=3)||n[s*2]!==n[8]||n[s*2+1]!==n[9])return 0;s=ho(n,0,s),o=ho(n,8,o);const i=n[s*2],r=n[s*2+1];let c=0,a=0,l=0,h=0,f=0,u=0,p=0,_=0,y=0,g=0,x=0,b=0;if(s>=1&&(c=n[(s-1)*2]-i,a=n[(s-1)*2+1]-r),s>=2){const H=n[(s-2)*2]-n[(s-1)*2],V=n[(s-2)*2+1]-n[(s-1)*2+1];l=H-c,h=V-a}if(s>=3){const H=n[(s-3)*2]-n[(s-2)*2],V=n[(s-3)*2+1]-n[(s-2)*2+1],et=n[(s-2)*2]-n[(s-1)*2],z=n[(s-2)*2+1]-n[(s-1)*2+1];f=H-et-l,u=V-z-h,l*=3,h*=3}if(o>=1&&(p=n[10]-i,_=n[11]-r),o>=2){const H=n[12]-n[10],V=n[13]-n[11];y=H-p,g=V-_}if(o>=3){const H=n[14]-n[12],V=n[15]-n[13],et=n[12]-n[10],z=n[13]-n[11];x=H-et-y,b=V-z-g,y*=3,g*=3}c*=s,a*=s,p*=o,_*=o;const M=c!==0||a!==0;if(M&&(p!==0||_!==0)){const H=Math.sqrt(c*c+a*a),V=Math.sqrt(p*p+_*_),et=H*Q(c,a,y,g)+V*Q(l,h,p,_);if(et)return ut(et);const z=H*H*Q(c,a,x,b)+H*V*Q(l,h,y,g)+V*V*Q(f,u,p,_);if(z)return ut(z);const Gt=H*Q(l,h,x,b)+V*Q(f,u,y,g);return ut(Gt||Q(f,u,x,b))}let k=1,T=l,S=h,w=f,m=u,d=p,U=_,C=y,v=g,I=x,R=b;if(M&&(T=y,S=g,w=x,m=b,d=c,U=a,C=l,v=h,I=f,R=u,k=-1),d!==0||U!==0){const H=Q(w,m,d,U);if(H)return k*ut(H);const V=Q(T,S,C,v);if(V)return k*ut(V);const et=Q(w,m,C,v);if(et)return k*ut(et);const z=Q(T,S,I,R);return z?k*ut(z):k*ut(Q(w,m,I,R))}const G=Math.sqrt(T*T+S*S),F=Math.sqrt(C*C+v*v),X=Math.sqrt(G)*Q(T,S,I,R)+Math.sqrt(F)*Q(w,m,C,v);return ut(X||Q(w,m,I,R))}function fo(e,t,n,s,o){let i=e[t];if(i.type===ot){const r=i.convertToCubic();e[t]=r,i=r}if(i.type===Et)if(n===0){const r=Math.sqrt((i.p1x-i.p0x)**2+(i.p1y-i.p0y)**2);i.p1x+=r*s,i.p1y+=r*o}else{const r=Math.sqrt((i.p2x-i.p3x)**2+(i.p2y-i.p3y)**2);i.p2x+=r*s,i.p2y+=r*o}}const mn=[0,0],bn=[0,0];function $r(e){for(let t=0;t<e.contours.length;t++){const n=e.contours[t];let s=0;for(let o=0;o<n.length;o++){const i=n[o];(i.p0x!==i.endX()||i.p0y!==i.endY())&&(n[s++]=i)}n.length=s}for(const t of e.contours)if(t.length===1){const[n,s,o]=t[0].splitInThirds();t.length=0,t.push(n,s,o)}else if(t.length>0){const n=t.length;for(let s=0;s<n;s++){const o=(s+n-1)%n,i=t[o],r=t[s];i.direction(1,mn),r.direction(0,bn);const c=Math.sqrt(mn[0]**2+mn[1]**2),a=Math.sqrt(bn[0]**2+bn[1]**2);if(c===0||a===0)continue;const l=mn[0]/c,h=mn[1]/c,f=bn[0]/a,u=bn[1]/a;if(bi(l,h,f,u)<ao-1){const p=ao-1,_=Or*Math.sqrt(1-p*p)/p;let y=f-l,g=u-h;const x=Math.sqrt(y*y+g*g);if(x===0)continue;y=_*y/x,g=_*g/x,Nr(i,r)<0&&(y=-y,g=-g),fo(t,o,1,-g,y),fo(t,s,0,g,-y)}}}}const uo=[0,0,0],po=[0,0,0],_o=[0,0];function yo(e){const t=.5*(Math.sqrt(5)-1),n=e.map(()=>0),s=[];for(let o=0;o<e.length;o++){const i=e[o];if(n[o]||i.length===0)continue;const r=i[0].p0y;let c=r;for(let l=0;l<i.length&&r===c;l++)c=i[l].endY();for(let l=0;l<i.length&&r===c;l++)i[l].point(t,_o),c=_o[1];const a=Ue(r,c,t);for(let l=0;l<e.length;l++)for(const h of e[l]){const f=h.scanlineIntersections(a,uo,po);for(let u=0;u<f;u++)s.push({x:uo[u],dy:po[u],c:l})}s.sort((l,h)=>ut(l.x-h.x));for(let l=1;l<s.length;l++)s[l].x===s[l-1].x&&(s[l].dy=s[l-1].dy=0);for(let l=0;l<s.length;l++){const h=s[l];h.dy&&(n[h.c]+=2*(l&1^(h.dy>0?1:0))-1)}s.length=0}for(let o=0;o<e.length;o++){if(n[o]>=0)continue;const i=e[o].reverse();for(let r=0;r<i.length;r++){const c=i[r];i[r]=c.type===J?new tt(J,c.p1x,c.p1y,c.p0x,c.p0y,0,0,0,0):c.type===ot?new tt(ot,c.p2x,c.p2y,c.p1x,c.p1y,c.p0x,c.p0y,0,0):new tt(Et,c.p3x,c.p3y,c.p2x,c.p2y,c.p1x,c.p1y,c.p0x,c.p0y)}}}const go=1e-5,Cs=1e-6,Br=2e4,Yr=1e5;function Hr(e){return[e.p0x,e.p0y,e.p1x,e.p1y,e.p2x,e.p2y,e.p3x,e.p3y].slice(0,2*e.type+4)}function xo(e){const t=e.length/2-2;return new tt(t,e[0],e[1],e[2],e[3],e[4]??0,e[5]??0,e[6]??0,e[7]??0)}const at=new Float64Array(8),ht=new Float64Array(8),Wt=new Float64Array(8);function Es(e,t,n,s){const o=e.length,i=o/2-1;for(let r=0;r<=i;r++){for(let c=0;c<o;c++)Wt[c]=e[c];for(let c=0,a=o;c<i;c++,a-=2){const l=c<i-r?t:n;for(let h=0;h<a-2;h++)Wt[h]=Wt[h]+l*(Wt[h+2]-Wt[h])}s[2*r]=Wt[0],s[2*r+1]=Wt[1]}}function Xr(e,t,n){return Es(e,t,n,at),Array.from(at.subarray(0,e.length))}let Is=0,Ds=0,Ot=-1,wn=-1,An=0,kn=0,Hn=0,Xn=0;function Kr(e,t){Ot=-1,wn=-1;let n=0;for(let h=0;h<2;h++){const f=h?e.length-2:0;for(let u=0;u<2;u++){const p=u?t.length-2:0;e[f]===t[p]&&e[f+1]===t[p+1]&&(n++,Ot=h,wn=u)}}if(n!==1){Ot=-1;return}const s=Ot?e.length-2:0;An=e[s],kn=e[s+1];let o=0,i=0;for(let h=2;h<e.length&&o===0&&i===0;h+=2){const f=Ot?e.length-2-h:h;o=e[f]-An,i=e[f+1]-kn}let r=0,c=0;for(let h=2;h<t.length&&r===0&&c===0;h+=2){const f=wn?t.length-2-h:h;r=t[f]-An,c=t[f+1]-kn}const a=Math.hypot(o,i),l=Math.hypot(r,c);Hn=o/a-r/l,Xn=i/a-c/l,Math.hypot(Hn,Xn)>1e-9||(Ot=-1)}function jr(e,t){const n=Ot?e-2:0;for(let o=0;o<e;o+=2)if(o!==n&&(at[o]-An)*Hn+(at[o+1]-kn)*Xn<=0)return!1;const s=wn?t-2:0;for(let o=0;o<t;o+=2)if(o!==s&&(ht[o]-An)*Hn+(ht[o+1]-kn)*Xn>=0)return!1;return!0}function Un(e,t,n,s,o,i,r){if(--Is<0||--Ds<0)return;const c=e.length,a=s.length;Es(e,t,n,at),Es(s,o,i,ht);let l=1/0,h=1/0,f=-1/0,u=-1/0;for(let M=0;M<c;M+=2)l=Math.min(l,at[M]),h=Math.min(h,at[M+1]),f=Math.max(f,at[M]),u=Math.max(u,at[M+1]);let p=1/0,_=1/0,y=-1/0,g=-1/0;for(let M=0;M<a;M+=2)p=Math.min(p,ht[M]),_=Math.min(_,ht[M+1]),y=Math.max(y,ht[M]),g=Math.max(g,ht[M+1]);if(l>y||p>f||h>g||_>u||Ot>=0&&(Ot?n===1:t===0)&&(wn?i===1:o===0)&&jr(c,a))return;const x=Math.max(f-l,u-h),b=Math.max(y-p,g-_);if(c===4&&a===4||x<go&&b<go){const M=at[c-2]-at[0],A=at[c-1]-at[1],k=ht[a-2]-ht[0],T=ht[a-1]-ht[1],S=Q(M,A,k,T),w=Q(ht[0]-at[0],ht[1]-at[1],k,T)/S,m=Q(ht[0]-at[0],ht[1]-at[1],M,A)/S;w>=0&&w<=1&&m>=0&&m<=1&&r.push(t+w*(n-t),o+m*(i-o))}else x>b?(Un(e,t,(t+n)/2,s,o,i,r),Un(e,(t+n)/2,n,s,o,i,r)):(Un(e,t,n,s,o,(o+i)/2,r),Un(e,t,n,s,(o+i)/2,i,r))}function Kn(e,t,n){const s=e[2]-e[0],o=e[3]-e[1];return((t-e[0])*s+(n-e[1])*o)/(s*s+o*o)}function Vr(e,t,n){if(e.length!==4||t.length!==4)return!1;const s=e[2]-e[0],o=e[3]-e[1],i=1e-9*Math.hypot(s,o);return Math.abs(Q(s,o,t[0]-e[0],t[1]-e[1]))>i||Math.abs(Q(s,o,t[2]-e[0],t[3]-e[1]))>i?!1:(n.push(Kn(e,t[0],t[1]),0,Kn(e,t[2],t[3]),1),n.push(0,Kn(t,e[0],e[1]),1,Kn(t,e[2],e[3])),!0)}function Wr(e){const t=[];for(let n=e.length-2;n>=0;n-=2)t.push(e[n],e[n+1]);return t}function zr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!(Math.abs(e[n]-t[n])<Cs))return!1;return!0}const Tn=[0,0],zt=[0,0],jn=[0,0,0],Vn=[0,0,0];let on=new Int32Array(8);const Zr=0,Mo=1,Qr=2;function mo(e,t,n,s){let o=0;for(let i=0;i<e.length;i++){if(s<t[4*i+1]-1e-9||s>t[4*i+3]+1e-9)continue;const r=e[i].scanlineIntersections(s,jn,Vn);for(let c=0;c<r;c++)jn[c]<=n&&(o+=Vn[c])}return o!==0}function bo(e,t,n,s,o,i,r){on.fill(0,0,n);for(let a=0;a<e.length;a++){if(r<o[4*a+1]-1e-9||r>o[4*a+3]+1e-9)continue;const l=e[a].scanlineIntersections(r,jn,Vn);for(let h=0;h<l;h++)jn[h]<=i&&(on[t[a]]+=Vn[h])}let c=!1;for(let a=1;a<n&&!c;a++)c=on[a]!==0;return on[0]!==0&&(s===Mo?c:!c)}function Jr(e){const t=Rs([e.contours]);t&&(e.contours=t)}function wo(e,t){const n=Rs([e.contours,...t.length>0?t:[[]]],Mo);n&&(e.contours=n)}function tc(e,t){if(t.length===0)return;const n=Rs([e.contours,...t],Qr);n&&(e.contours=n)}function Rs(e,t=Zr){const n=e.flat(),s=n.flat(),o=s.map(Hr),i=o.length,r=e.length,c=r>1;on.length<r&&(on=new Int32Array(r));const a=new Float64Array(4*i),l=new Int32Array(i),h=new Int32Array(i);let f=0;for(let w=0;w<r;w++)for(const m of e[w]){for(let d=0;d<m.length;d++)l[f+d]=f+(d+1)%m.length,h[f+d]=w;f+=m.length}for(let w=0;w<i;w++){const m=o[w];let d=1/0,U=1/0,C=-1/0,v=-1/0;for(let I=0;I<m.length;I+=2)d=Math.min(d,m[I]),U=Math.min(U,m[I+1]),C=Math.max(C,m[I]),v=Math.max(v,m[I+1]);a[4*w]=d,a[4*w+1]=U,a[4*w+2]=C,a[4*w+3]=v}const u=Array.from({length:i},(w,m)=>m).sort((w,m)=>a[4*w]-a[4*m]),p=o.map(()=>[]),_=new Uint8Array(i);Ds=Yr;for(let w=0;w<i;w++){const m=u[w];for(let d=w+1;d<i;d++){const U=u[d];if(a[4*U]>a[4*m+2])break;if(a[4*m+1]>a[4*U+3]||a[4*U+1]>a[4*m+3])continue;const C=Math.min(m,U),v=Math.max(m,U);l[C]!==v&&l[v]!==C&&(_[C]=_[v]=1);const I=[];if(Is=Br,Vr(o[C],o[v],I)||(Kr(o[C],o[v]),Un(o[C],0,1,o[v],0,1,I)),Is<0||Ds<0)return null;for(let R=0;R<I.length;R+=2)p[C].push(I[R]),p[v].push(I[R+1])}}const y=p.map(w=>{const m=[0];for(const d of w.sort((U,C)=>U-C))d-m[m.length-1]>1e-7&&d<1-1e-7&&m.push(d);return m.push(1),m});let g=!1;const x=[],b=[];let M=0;for(const w of n){const m=M+w.length;let d=!0;for(let I=M;I<m;I++)(_[I]||y[I].length>2)&&(d=!1);let U=!1,C=!1,v=!1;for(let I=M;I<m;I++){const R=y[I];for(let G=1;G<R.length;G++){const F=Xr(o[I],R[G-1],R[G]),X=xo(F);X.point(.5,Tn),X.direction(.5,zt);const H=Math.hypot(zt[0],zt[1]),V=Math.hypot(F[F.length-2]-F[0],F[F.length-1]-F[1]);if(!(H===0||V===0)){if(!d||!U){const et=Math.min(1e-6,V*V/64)/H,z=Tn[0]+zt[1]*et,Gt=Tn[1]-zt[0]*et,_t=Tn[0]-zt[1]*et,Xt=Tn[1]+zt[0]*et;C=c?bo(s,h,r,t,a,z,Gt):mo(s,a,z,Gt),v=c?bo(s,h,r,t,a,_t,Xt):mo(s,a,_t,Xt),U=!0}C===v?h[I]===0&&(g=!0):(x.push(F),b.push(C),h[I]!==0&&(g=!0))}}}M=m}const A=2*b.filter(Boolean).length>=b.length,k=[];for(let w=0;w<x.length;w++){let m=x[w];b[w]!==A&&(m=Wr(m),g=!0);let d=!1;for(let U=0;U<k.length&&!d;U++)d=zr(k[U],m);d?g=!0:k.push(m)}if(!g)return null;const T=new Uint8Array(k.length),S=[];for(let w=0;w<k.length;w++){if(T[w])continue;T[w]=1;const m=[k[w]];for(;;){const d=m[m.length-1],U=d[d.length-2],C=d[d.length-1];if(m.length>1&&Math.hypot(U-m[0][0],C-m[0][1])<Cs){m[0][0]=U,m[0][1]=C;break}let v=-1,I=Cs;for(let R=0;R<k.length;R++){if(T[R])continue;const G=Math.hypot(k[R][0]-U,k[R][1]-C);G<I&&(v=R,I=G)}if(v<0)return null;T[v]=1,k[v][0]=U,k[v][1]=C,m.push(k[v])}S.push(m.map(xo))}return S}const Wn=1,zn=2,nc=3,Zn=4,sc=5,ec=6,Ls=7,pt=[0,0],Zt=[0,0];function oc(e,t){return Math.trunc(3+2.875*e/(t-1)-1.4375+.5)-3}function ic(e,t,n,s,o){return e*n+t*s<=0||Math.abs(e*s-t*n)>o}function rc(e){const t=Number(e.v&1n);return e.v>>=1n,t}function cc(e){const t=Number(e.v%3n);return e.v/=3n,t}function Ao(e){return[ec,sc,nc][cc(e)]}function Sn(e,t){const n=e.v<<1+rc(t);e.v=(n|n>>3)&Ls}function ac(e,t,n){const s=e.v&n;s===Wn||s===zn||s===Zn?e.v=s^Ls:Sn(e,t)}function lc(e,t,n=0n){const s=Math.sin(t),o={v:Ao({v:n})},i={v:n};i.v=n,o.v=Ao(i);const r=[];for(const c of e.contours){if(c.length===0)continue;r.length=0,c[c.length-1].direction(1,pt);const l=Math.sqrt(pt[0]*pt[0]+pt[1]*pt[1]);let h=l>0?pt[0]/l:0,f=l>0?pt[1]/l:0;for(let u=0;u<c.length;u++){const p=c[u];p.direction(0,Zt);const _=Math.sqrt(Zt[0]*Zt[0]+Zt[1]*Zt[1]),y=_>0?Zt[0]/_:0,g=_>0?Zt[1]/_:0;ic(h,f,y,g,s)&&r.push(u),p.direction(1,pt);const x=Math.sqrt(pt[0]*pt[0]+pt[1]*pt[1]);h=x>0?pt[0]/x:0,f=x>0?pt[1]/x:0}if(r.length===0){Sn(o,i);for(const u of c)u.color=o.v}else if(r.length===1){const u=[0,Ls,0];Sn(o,i),u[0]=o.v,Sn(o,i),u[2]=o.v;const p=r[0],_=c.length;if(_>=3)for(let y=0;y<_;y++){const g=oc(y,_);c[(p+y)%_].color=u[1+g]}else if(_>=1){const y=[null,null,null,null,null,null,null],g=c[0].splitInThirds();if(y[0+3*p]=g[0],y[1+3*p]=g[1],y[2+3*p]=g[2],_>=2){const x=c[1].splitInThirds();y[3-3*p]=x[0],y[4-3*p]=x[1],y[5-3*p]=x[2],y[0].color=y[1].color=u[0],y[2].color=y[3].color=u[1],y[4].color=y[5].color=u[2]}else y[0].color=u[0],y[1].color=u[1],y[2].color=u[2];c.length=0;for(const x of y)x!==null&&c.push(x)}}else{const u=r.length;let p=0;const _=r[0],y=c.length;Sn(o,i);const g=o.v;for(let x=0;x<y;x++){const b=(_+x)%y;p+1<u&&r[p+1]===b&&(++p,ac(o,i,p===u-1?g:0)),c[b].color=o.v}}}}const j=Number.MAX_VALUE,q=[0,0],Mt=[0,0];let ko=0,nt=new Float64Array(0),it=new Float64Array(0),N=new Float64Array(0),$=new Float64Array(0),rt=new Int32Array(0),ct=new Float64Array(0),rn=new Float64Array(0),cn=new Float64Array(0),an=new Float64Array(0),Qt=new Int32Array(0);const st=[0,0];let Uo=0,Ps=new Float64Array(0),Fs=new Float64Array(0),qs=new Float64Array(0),Os=new Float64Array(0),Gs=new Float64Array(0),Ns=new Float64Array(0),$s=new Float64Array(0),Bs=new Float64Array(0),Ys=new Float64Array(0),Hs=new Float64Array(0),Xs=new Float64Array(0),Ks=new Float64Array(0),To=0,vn=new Int32Array(0);function hc(e){const t=e.length;if(t===0)return 0;let n=0;if(t===1){e[0].point(0,st);const s=st[0],o=st[1];e[0].point(.3333333333333333,st);const i=st[0],r=st[1];e[0].point(.6666666666666666,st);const c=st[0],a=st[1];n+=s*r-o*i,n+=i*a-r*c,n+=c*o-a*s}else if(t===2){e[0].point(0,st);const s=st[0],o=st[1];e[0].point(.5,st);const i=st[0],r=st[1];e[1].point(0,st);const c=st[0],a=st[1];e[1].point(.5,st);const l=st[0],h=st[1];n+=s*r-o*i,n+=i*a-r*c,n+=c*h-a*l,n+=l*o-h*s}else{const s=e[t-1];let o=s.p0x,i=s.p0y;for(let r=0;r<t;r++){const c=e[r].p0x,a=e[r].p0y;n+=o*a-i*c,o=c,i=a}}return n>0?-1:n<0?1:0}function fc(e,t,n,s,o,i,r){const c=r[e][t];let a=n;if(i<0){c.direction(0,q);const l=Math.sqrt(q[0]*q[0]+q[1]*q[1]);if(l>0){const h=q[0]/l,f=q[1]/l;c.point(0,Mt);const u=s-Mt[0],p=o-Mt[1];if(u*h+p*f<0){const y=u*f-p*h;Math.abs(y)<=Math.abs(a)&&(a=y)}}}if(i>1){c.direction(1,q);const l=Math.sqrt(q[0]*q[0]+q[1]*q[1]);if(l>0){const h=q[0]/l,f=q[1]/l;c.point(1,Mt);const u=s-Mt[0],p=o-Mt[1];if(u*h+p*f>0){const y=u*f-p*h;Math.abs(y)<=Math.abs(a)&&(a=y)}}}return a}function mt(e,t,n,s,o,i,r,c,a){let l=e<0?t:n;if(o>=0){const h=fc(s,o,e,r,c,i,a);Math.abs(h)<Math.abs(l)&&(l=h)}return l}function Tt(e,t,n){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),n))}function uc(e,t,n,s,o,i,r,c){if(c.length!==t*n*3)throw new Error(`generateMSDF: out.length ${c.length} !== ${t*n*3}`);const a=e.contours,l=a.length;if(l===0){c.fill(0);return}const h=s/r;Qt.length<l&&(Qt=new Int32Array(l));for(let p=0;p<l;p++)Qt[p]=hc(a[p]);To<l+1&&(vn=new Int32Array(l+1),To=l+1);let f=0;for(let p=0;p<l;p++)vn[p]=f,f+=a[p].length;vn[l]=f,Uo<f&&(Ps=new Float64Array(f),Fs=new Float64Array(f),qs=new Float64Array(f),Os=new Float64Array(f),Gs=new Float64Array(f),Ns=new Float64Array(f),$s=new Float64Array(f),Bs=new Float64Array(f),Ys=new Float64Array(f),Hs=new Float64Array(f),Xs=new Float64Array(f),Ks=new Float64Array(f),Uo=f);for(let p=0;p<l;p++){const _=a[p],y=_.length,g=vn[p];for(let x=0;x<y;x++){const b=_[x],M=_[(x+y-1)%y],A=_[(x+1)%y],k=g+x;b.point(0,Mt),Ps[k]=Mt[0],Fs[k]=Mt[1],b.point(1,Mt),qs[k]=Mt[0],Os[k]=Mt[1],b.direction(0,q);let T=Math.sqrt(q[0]*q[0]+q[1]*q[1]);const S=T>0?q[0]/T:0,w=T>0?q[1]/T:0;Gs[k]=S,Ns[k]=w,b.direction(1,q),T=Math.sqrt(q[0]*q[0]+q[1]*q[1]);const m=T>0?q[0]/T:0,d=T>0?q[1]/T:0;$s[k]=m,Bs[k]=d,M.direction(1,q),T=Math.sqrt(q[0]*q[0]+q[1]*q[1]);const U=T>0?q[0]/T:0,C=T>0?q[1]/T:0;A.direction(0,q),T=Math.sqrt(q[0]*q[0]+q[1]*q[1]);const v=T>0?q[0]/T:0,I=T>0?q[1]/T:0,R=U+S,G=C+w,F=Math.sqrt(R*R+G*G);Ys[k]=F>0?R/F:0,Hs[k]=F>0?G/F:0;const X=m+v,H=d+I,V=Math.sqrt(X*X+H*H);Xs[k]=V>0?-(X/V):0,Ks[k]=V>0?-(H/V):0}}if(ko<l){const p=l*3;nt=new Float64Array(p),it=new Float64Array(p),N=new Float64Array(p),$=new Float64Array(p),rt=new Int32Array(p),ct=new Float64Array(p),rn=new Float64Array(l),cn=new Float64Array(l),an=new Float64Array(l),ko=l}const u={distance:0,dot:0,param:0};for(let p=0;p<n;p++)for(let _=0;_<t;_++){const y=(_+.5)/s-o,g=(p+.5)/s-i;for(let P=0;P<l;P++){const D=a[P],yt=D.length,E=P*3,B=vn[P];nt[E]=nt[E+1]=nt[E+2]=-j,it[E]=it[E+1]=it[E+2]=0,N[E]=N[E+1]=N[E+2]=-j,$[E]=$[E+1]=$[E+2]=j,rt[E]=rt[E+1]=rt[E+2]=-1,ct[E]=ct[E+1]=ct[E+2]=0;for(let Y=0;Y<yt;Y++){const W=D[Y],ge=W.color,xe=(ge&Wn)!==0,de=(ge&zn)!==0,Me=(ge&Zn)!==0;W.signedDistance(y,g,u);const ys=u.distance,hn=u.dot,me=u.param,Kt=Math.abs(ys);if(xe){const Pt=Math.abs(nt[E]);(Kt<Pt||Kt===Pt&&hn<it[E])&&(nt[E]=ys,it[E]=hn,rt[E]=Y,ct[E]=me)}if(de){const Pt=Math.abs(nt[E+1]);(Kt<Pt||Kt===Pt&&hn<it[E+1])&&(nt[E+1]=ys,it[E+1]=hn,rt[E+1]=Y,ct[E+1]=me)}if(Me){const Pt=Math.abs(nt[E+2]);(Kt<Pt||Kt===Pt&&hn<it[E+2])&&(nt[E+2]=ys,it[E+2]=hn,rt[E+2]=Y,ct[E+2]=me)}const At=B+Y,be=y-Ps[At],we=g-Fs[At],Ae=y-qs[At],ke=g-Os[At],xi=Gs[At],di=Ns[At],Mi=$s[At],mi=Bs[At],Nc=be*Ys[At]+we*Hs[At],$c=Ae*Xs[At]+ke*Ks[At];if(Nc>0&&-(be*xi+we*di)>0){const O=be*di-we*xi;Math.abs(O)<Kt&&(xe&&(O<=0&&O>N[E]?N[E]=O:O>0&&O<$[E]&&($[E]=O)),de&&(O<=0&&O>N[E+1]?N[E+1]=O:O>0&&O<$[E+1]&&($[E+1]=O)),Me&&(O<=0&&O>N[E+2]?N[E+2]=O:O>0&&O<$[E+2]&&($[E+2]=O)))}if($c>0&&Ae*Mi+ke*mi>0){const O=Ae*mi-ke*Mi;Math.abs(O)<Kt&&(xe&&(O<=0&&O>N[E]?N[E]=O:O>0&&O<$[E]&&($[E]=O)),de&&(O<=0&&O>N[E+1]?N[E+1]=O:O>0&&O<$[E+1]&&($[E+1]=O)),Me&&(O<=0&&O>N[E+2]?N[E+2]=O:O>0&&O<$[E+2]&&($[E+2]=O)))}}rn[P]=mt(nt[E],N[E],$[E],P,rt[E],ct[E],y,g,a),cn[P]=mt(nt[E+1],N[E+1],$[E+1],P,rt[E+1],ct[E+1],y,g,a),an[P]=mt(nt[E+2],N[E+2],$[E+2],P,rt[E+2],ct[E+2],y,g,a)}let x=-j,b=0,M=-j,A=j,k=-1,T=-1,S=0,w=-j,m=0,d=-j,U=j,C=-1,v=-1,I=0,R=-j,G=0,F=-j,X=j,H=-1,V=-1,et=0,z=-j,Gt=0,_t=-j,Xt=j,Nt=-1,Yo=-1,Ho=0,as=-j,Xo=0,ne=-j,se=j,Ko=-1,jo=-1,Vo=0,ls=-j,Wo=0,ee=-j,oe=j,zo=-1,Zo=-1,Qo=0,hs=-j,Jo=0,ie=-j,re=j,ti=-1,ni=-1,si=0,fs=-j,ei=0,ce=-j,ae=j,oi=-1,ii=-1,ri=0,us=-j,ci=0,le=-j,he=j,ai=-1,li=-1,hi=0;for(let P=0;P<l;P++){const D=P*3,yt=Qt[P],E=Tt(rn[P],cn[P],an[P]);{const B=nt[D],Y=it[D],W=Math.abs(B);(W<Math.abs(x)||W===Math.abs(x)&&Y<b)&&(x=B,b=Y,k=P,T=rt[D],S=ct[D]),N[D]>M&&(M=N[D]),$[D]<A&&(A=$[D])}{const B=nt[D+1],Y=it[D+1],W=Math.abs(B);(W<Math.abs(w)||W===Math.abs(w)&&Y<m)&&(w=B,m=Y,C=P,v=rt[D+1],I=ct[D+1]),N[D+1]>d&&(d=N[D+1]),$[D+1]<U&&(U=$[D+1])}{const B=nt[D+2],Y=it[D+2],W=Math.abs(B);(W<Math.abs(R)||W===Math.abs(R)&&Y<G)&&(R=B,G=Y,H=P,V=rt[D+2],et=ct[D+2]),N[D+2]>F&&(F=N[D+2]),$[D+2]<X&&(X=$[D+2])}if(yt>0&&E>=0){{const B=nt[D],Y=it[D],W=Math.abs(B);(W<Math.abs(z)||W===Math.abs(z)&&Y<Gt)&&(z=B,Gt=Y,Nt=P,Yo=rt[D],Ho=ct[D]),N[D]>_t&&(_t=N[D]),$[D]<Xt&&(Xt=$[D])}{const B=nt[D+1],Y=it[D+1],W=Math.abs(B);(W<Math.abs(as)||W===Math.abs(as)&&Y<Xo)&&(as=B,Xo=Y,Ko=P,jo=rt[D+1],Vo=ct[D+1]),N[D+1]>ne&&(ne=N[D+1]),$[D+1]<se&&(se=$[D+1])}{const B=nt[D+2],Y=it[D+2],W=Math.abs(B);(W<Math.abs(ls)||W===Math.abs(ls)&&Y<Wo)&&(ls=B,Wo=Y,zo=P,Zo=rt[D+2],Qo=ct[D+2]),N[D+2]>ee&&(ee=N[D+2]),$[D+2]<oe&&(oe=$[D+2])}}if(yt<0&&E<=0){{const B=nt[D],Y=it[D],W=Math.abs(B);(W<Math.abs(hs)||W===Math.abs(hs)&&Y<Jo)&&(hs=B,Jo=Y,ti=P,ni=rt[D],si=ct[D]),N[D]>ie&&(ie=N[D]),$[D]<re&&(re=$[D])}{const B=nt[D+1],Y=it[D+1],W=Math.abs(B);(W<Math.abs(fs)||W===Math.abs(fs)&&Y<ei)&&(fs=B,ei=Y,oi=P,ii=rt[D+1],ri=ct[D+1]),N[D+1]>ce&&(ce=N[D+1]),$[D+1]<ae&&(ae=$[D+1])}{const B=nt[D+2],Y=it[D+2],W=Math.abs(B);(W<Math.abs(us)||W===Math.abs(us)&&Y<ci)&&(us=B,ci=Y,ai=P,li=rt[D+2],hi=ct[D+2]),N[D+2]>le&&(le=N[D+2]),$[D+2]<he&&(he=$[D+2])}}}const fe=mt(x,M,A,k,T,S,y,g,a),ue=mt(w,d,U,C,v,I,y,g,a),pe=mt(R,F,X,H,V,et,y,g,a),Gc=Tt(fe,ue,pe),fi=mt(z,_t,Xt,Nt,Yo,Ho,y,g,a),ui=mt(as,ne,se,Ko,jo,Vo,y,g,a),pi=mt(ls,ee,oe,zo,Zo,Qo,y,g,a),ps=Tt(fi,ui,pi),_i=mt(hs,ie,re,ti,ni,si,y,g,a),yi=mt(fs,ce,ae,oi,ii,ri,y,g,a),gi=mt(us,le,he,ai,li,hi,y,g,a),_s=Tt(_i,yi,gi);let St,vt,Ct,_e=0;if(ps>=0&&Math.abs(ps)<=Math.abs(_s)){St=fi,vt=ui,Ct=pi,_e=1;for(let P=0;P<l;P++)if(Qt[P]>0){const D=rn[P],yt=cn[P],E=an[P],B=Tt(D,yt,E);Math.abs(B)<Math.abs(_s)&&B>Tt(St,vt,Ct)&&(St=D,vt=yt,Ct=E)}}else if(_s<=0&&Math.abs(_s)<Math.abs(ps)){St=_i,vt=yi,Ct=gi,_e=-1;for(let P=0;P<l;P++)if(Qt[P]<0){const D=rn[P],yt=cn[P],E=an[P],B=Tt(D,yt,E);Math.abs(B)<Math.abs(ps)&&B<Tt(St,vt,Ct)&&(St=D,vt=yt,Ct=E)}}else{const P=(p*t+_)*3;c[P+0]=fe*h+.5,c[P+1]=ue*h+.5,c[P+2]=pe*h+.5;continue}for(let P=0;P<l;P++)if(Qt[P]!==_e){const D=rn[P],yt=cn[P],E=an[P],B=Tt(D,yt,E),Y=Tt(St,vt,Ct);B*Y>=0&&Math.abs(B)<Math.abs(Y)&&(St=D,vt=yt,Ct=E)}Tt(St,vt,Ct)===Gc&&(St=fe,vt=ue,Ct=pe);const ye=(p*t+_)*3;c[ye+0]=St*h+.5,c[ye+1]=vt*h+.5,c[ye+2]=Ct*h+.5}}const So=0,pc=1,_c=2,yc=3;function gc(e,t){switch(t){case So:return e!==0;case pc:return(e&1)!==0;case _c:return e>0;case yc:return e<0}return!1}class xc{constructor(){this._intersections=[],this._lastIndex=0}setIntersections(t){if(this._intersections=t,this._lastIndex=0,t.length>0){t.sort((s,o)=>ut(s.x-o.x));let n=0;for(let s=0;s<t.length;s++)n+=t[s].direction,t[s].direction=n}}_moveTo(t){const n=this._intersections.length;if(n===0)return-1;let s=this._lastIndex;if(t<this._intersections[s].x)do{if(s===0)return this._lastIndex=0,-1;--s}while(t<this._intersections[s].x);else for(;s<n-1&&t>=this._intersections[s+1].x;)++s;return this._lastIndex=s,s}sumIntersections(t){const n=this._moveTo(t);return n>=0?this._intersections[n].direction:0}filled(t,n){return gc(this.sumIntersections(t),n)}}const vo=[0,0,0],Co=[0,0,0];function dc(e,t,n){const s=[];for(const o of e.contours)for(const i of o){const r=i.scanlineIntersections(t,vo,Co);for(let c=0;c<r;c++)s.push({x:vo[c],direction:Co[c]})}n.setIntersections(s)}const ln=2,Eo=1,js=1.001,Mc=1.1111111111111112,Qn=.01;function mc(e,t,n,s,o,i,r){if(n===0||s===0)return;const c=new xc,a=new Int8Array(n*s);for(let l=0;l<s;l++){const h=(l+.5)/o-r;dc(t,h,c);for(let f=0;f<n;f++){const u=(f+.5)/o-i,p=c.filled(u,So),_=(l*n+f)*3,y=e[_],g=e[_+1],x=e[_+2],b=ft(y,g,x),M=l*n+f;b===.5?a[M]=0:b>.5!==p?(e[_]=1-y,e[_+1]=1-g,e[_+2]=1-x,a[M]=-1):a[M]=1}}for(let l=0;l<s;l++)for(let h=0;h<n;h++){const f=l*n+h;if(a[f]!==0)continue;let u=0;if(h>0&&(u+=a[f-1]),h<n-1&&(u+=a[f+1]),l>0&&(u+=a[f-n]),l<s-1&&(u+=a[f+n]),u<0){const p=(l*n+h)*3;e[p]=1-e[p],e[p+1]=1-e[p+1],e[p+2]=1-e[p+2]}}}const Vs=[0,0];function bc(e,t,n,s,o,i,r,c){const a=new Uint8Array(n*s);wc(a,t,n,s,o,i,r),Ac(a,e,n,s,o,c),Sc(a,e,n,s,c,Mc),vc(a,e,n,s)}function wc(e,t,n,s,o,i,r){for(const c of t.contours){if(c.length===0)continue;let a=c[c.length-1];for(const l of c){const h=a.color&l.color;if(!(h&h-1)){l.point(0,Vs);const f=o*(Vs[0]+i),u=o*(Vs[1]+r),p=Math.floor(f-.5)|0,_=Math.floor(u-.5)|0,y=p+1,g=_+1;p<n&&_<s&&y>=0&&g>=0&&(p>=0&&_>=0&&(e[_*n+p]|=ln),y<n&&_>=0&&(e[_*n+y]|=ln),p>=0&&g<s&&(e[g*n+p]|=ln),y<n&&g<s&&(e[g*n+y]|=ln))}a=l}}}function Jn(e,t,n){let s=0;for(let o=0;o<3;o++){const i=e[t+o],r=e[n+o],c=i-r;if(c===0)continue;const a=(i-.5)/c;if(a>0&&a<1){const l=1-a,h=l*e[t]+a*e[n],f=l*e[t+1]+a*e[n+1],u=l*e[t+2]+a*e[n+2],p=o===0?h:o===1?f:u;ft(h,f,u)===p&&(s|=o===0?Wn:o===1?zn:Zn)}}return s}function Ht(e,t,n,s,o,i){(i&Wn&&n[s]!==o||i&zn&&n[s+1]!==o||i&Zn&&n[s+2]!==o)&&(e[t]|=ln)}function Ac(e,t,n,s,o,i){const r=js/i,c=js/i,a=js*Math.SQRT2/i;for(let l=0;l<s;l++)for(let h=0;h<n-1;h++){const f=(l*n+h)*3,u=f+3,p=ft(t[f],t[f+1],t[f+2]),_=ft(t[u],t[u+1],t[u+2]);if(Math.abs(p-.5)+Math.abs(_-.5)<r){const y=Jn(t,f,u);Ht(e,l*n+h,t,f,p,y),Ht(e,l*n+h+1,t,u,_,y)}}for(let l=0;l<s-1;l++)for(let h=0;h<n;h++){const f=(l*n+h)*3,u=((l+1)*n+h)*3,p=ft(t[f],t[f+1],t[f+2]),_=ft(t[u],t[u+1],t[u+2]);if(Math.abs(p-.5)+Math.abs(_-.5)<c){const y=Jn(t,f,u);Ht(e,l*n+h,t,f,p,y),Ht(e,(l+1)*n+h,t,u,_,y)}}for(let l=0;l<s-1;l++)for(let h=0;h<n-1;h++){const f=(l*n+h)*3,u=(l*n+h+1)*3,p=((l+1)*n+h)*3,_=((l+1)*n+h+1)*3,y=ft(t[f],t[f+1],t[f+2]),g=ft(t[u],t[u+1],t[u+2]),x=ft(t[p],t[p+1],t[p+2]),b=ft(t[_],t[_+1],t[_+2]);if(Math.abs(y-.5)+Math.abs(b-.5)<a){const M=Jn(t,f,_);Ht(e,l*n+h,t,f,y,M),Ht(e,(l+1)*n+h+1,t,_,b,M)}if(Math.abs(g-.5)+Math.abs(x-.5)<a){const M=Jn(t,u,p);Ht(e,l*n+h+1,t,u,g,M),Ht(e,(l+1)*n+h,t,p,x,M)}}}function kc(e,t,n){const s=t<e?t:e,o=e<t?t:e,i=n<o?n:o;return s<i?i:s}function Uc(e,t,n,s){return ft(e[t]+s*(e[n]-e[t]),e[t+1]+s*(e[n+1]-e[t+1]),e[t+2]+s*(e[n+2]-e[t+2]))}function Ws(e,t,n,s){return kc(Math.fround(s*(s*n[0]+t[0])+e[0]),Math.fround(s*(s*n[1]+t[1])+e[1]),Math.fround(s*(s*n[2]+t[2])+e[2]))}const Jt=[0,0,0],Lt=[0,0,0],zs=[0,0,0],bt=[0,0,0],Io=1,Do=2;function Zs(e,t,n,s,o,i,r,c){if(s>.5&&o>.5&&i<=.5||s<.5&&o<.5&&i>=.5||!c&&Tc(s,o,i)!==i){const a=(n-e)*r,l=(t-n)*r;return i>=s-a&&i<=s+a&&i>=o-l&&i<=o+l?Io:Io|Do}return 0}function Ro(e){return(e&Do)!==0}function Tc(e,t,n){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),n))}function ts(e,t,n,s,o,i){const r=ft(e[n],e[n+1],e[n+2]);if(Math.abs(s-.5)<Math.abs(r-.5))return!1;for(let c=0;c<3;c++){const a=e[t+c]-e[t+(c+1)%3],l=e[n+c]-e[n+(c+1)%3],h=a-l;if(h===0)continue;const f=a/h;if(f>Qn&&f<1-Qn){const u=Uc(e,t,n,f),p=Zs(0,1,f,s,r,u,o,i);if(Ro(p))return!0}}return!1}function Lo(e,t,n,s,o,i,r,c,a){if(!(a>0&&a<1))return 0;const l=a>r?0:a,h=a>r?a:1;bt[0]=e[t],bt[1]=e[t+1],bt[2]=e[t+2];const f=a>r?n:Ws(bt,Jt,Lt,a);bt[0]=e[t],bt[1]=e[t+1],bt[2]=e[t+2];const u=a>r?Ws(bt,Jt,Lt,a):s;return Zs(l,h,r,f,u,c,o,i)}function ns(e,t,n,s,o,i,r,c,a){if(!(r>Qn&&r<1-Qn))return!1;bt[0]=e[t],bt[1]=e[t+1],bt[2]=e[t+2];const l=Ws(bt,Jt,Lt,r);let h=Zs(0,1,r,n,s,l,o,i);return h|=Lo(e,t,n,s,o,i,r,l,c),h|=Lo(e,t,n,s,o,i,r,l,a),Ro(h)}function Qs(e,t,n,s,o,i,r,c,a,l,h,f,u){const p=Math.fround(e[t+l]-e[t+h]),_=Math.fround(Math.fround(e[n+l]-e[n+h])+Math.fround(e[s+l]-e[s+h])),y=Math.fround(e[o+l]-e[o+h]),g=Math.fround(Math.fround(y-_)+p),x=Math.fround(Math.fround(_-p)-p),b=p;if(g===0||Math.abs(x)>1e12*Math.abs(g)){if(x!==0){const A=-b/x;if(ns(e,t,i,r,c,a,A,f,u))return!0}return!1}const M=x*x-4*g*b;if(M>0){const A=Math.sqrt(M),k=(-x+A)/(2*g);if(ns(e,t,i,r,c,a,k,f,u))return!0;const T=(-x-A)/(2*g);if(ns(e,t,i,r,c,a,T,f,u))return!0}else if(M===0){const A=-x/(2*g);if(ns(e,t,i,r,c,a,A,f,u))return!0}return!1}function ss(e,t,n,s,o,i,r,c){const a=ft(e[o],e[o+1],e[o+2]);if(Math.abs(i-.5)<Math.abs(a-.5))return!1;for(let u=0;u<3;u++)zs[u]=Math.fround(Math.fround(e[t+u]-e[n+u])-e[s+u]),Jt[u]=Math.fround(-e[t+u]-zs[u]),Lt[u]=Math.fround(e[o+u]+zs[u]);const l=Lt[0]!==0?-.5*Jt[0]/Lt[0]:-1,h=Lt[1]!==0?-.5*Jt[1]/Lt[1]:-1,f=Lt[2]!==0?-.5*Jt[2]/Lt[2]:-1;return!!(Qs(e,t,n,s,o,i,a,r,c,0,1,l,h)||Qs(e,t,n,s,o,i,a,r,c,1,2,h,f)||Qs(e,t,n,s,o,i,a,r,c,2,0,f,l))}function Sc(e,t,n,s,o,i){const r=i/o,c=i/o,a=i*Math.SQRT2/o;for(let l=0;l<s;l++)for(let h=0;h<n;h++){const f=l*n+h,u=f*3,p=ft(t[u],t[u+1],t[u+2]),_=(e[f]&ln)!==0,y=h>0,g=h<n-1,x=l>0,b=l<s-1,M=y?(f-1)*3:-1,A=g?(f+1)*3:-1,k=x?(f-n)*3:-1,T=b?(f+n)*3:-1;let S=!1;if(y&&ts(t,u,M,p,r,_)&&(S=!0),!S&&x&&ts(t,u,k,p,c,_)&&(S=!0),!S&&g&&ts(t,u,A,p,r,_)&&(S=!0),!S&&b&&ts(t,u,T,p,c,_)&&(S=!0),!S&&y&&x){const w=(f-n-1)*3;ss(t,u,M,k,w,p,a,_)&&(S=!0)}if(!S&&g&&x){const w=(f-n+1)*3;ss(t,u,A,k,w,p,a,_)&&(S=!0)}if(!S&&y&&b){const w=(f+n-1)*3;ss(t,u,M,T,w,p,a,_)&&(S=!0)}if(!S&&g&&b){const w=(f+n+1)*3;ss(t,u,A,T,w,p,a,_)&&(S=!0)}S&&(e[f]|=Eo)}}function vc(e,t,n,s){const o=n*s;for(let i=0;i<o;i++)if(e[i]&Eo){const r=i*3,c=ft(t[r],t[r+1],t[r+2]);t[r]=c,t[r+1]=c,t[r+2]=c}}function ft(e,t,n){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),n))}const Cc=3,Ec=0n,Po=16;function Fo(e,t,n,s=!0){if(s&&Jr(e),e.contours.length===0)return null;const o=es(e),i=t,r=n,c=Math.max(1,Math.ceil((o.maxX-o.minX)*i))+2*r,a=Math.max(1,Math.ceil((o.maxY-o.minY)*i))+2*r,l=r/i-o.minX,h=r/i-o.minY;$r(e),lc(e,Cc,Ec);const f=new Float32Array(c*a*3);return uc(e,c,a,i,l,h,r,f),mc(f,e,c,a,i,l,h),bc(f,e,c,a,i,l,h,r),{msdf:f,w:c,h:a,planeLeft:-l,planeBottom:-h,planeRight:c/i-l,planeTop:a/i-h}}const Js=[0,0];function es(e){let t=1/0,n=1/0,s=-1/0,o=-1/0;for(const i of e.contours)for(const r of i)for(let c=0;c<=Po;c++){r.point(c/Po,Js);const a=Js[0],l=Js[1];a<t&&(t=a),l<n&&(n=l),a>s&&(s=a),l>o&&(o=l)}return{minX:t,minY:n,maxX:s,maxY:o}}function Z(e,t){var n;return(n=new RegExp(`\\s${t}\\s*=\\s*(["'])([\\s\\S]*?)\\1`).exec(e))==null?void 0:n[2]}function os(e,t,n){const s=new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"g"),o=c=>{var a,l;return(l=(a=[...c.matchAll(s)].pop())==null?void 0:a[1])==null?void 0:l.trim()},i=Z(e,"class");let r="";if(i&&n){const c=new Set(i.split(/\s+/));r=n.filter(([a])=>c.has(a)).map(([,a])=>a).join(";")}return o(Z(e,"style")??"")??o(r)??Z(e,t)}function is(e,t){return e===void 0?t:parseFloat(e)/(e.trim().endsWith("%")?100:1)}function tn(e,t){return e===void 0?0:parseFloat(e)*(e.trim().endsWith("%")?t/100:1)}function Ic(e){const{layers:t,width:n}=qo(e);return{shape:{contours:t.flatMap(o=>o.shape.contours),inverseYAxis:!1},width:n}}function qo(e){var k,T;e=e.replace(/<!--[\s\S]*?-->/g,"");const t=((k=/<svg\b[^>]*>/.exec(e))==null?void 0:k[0])??"",n=(Z(t,"viewBox")??`0 0 ${Z(t,"width")} ${Z(t,"height")}`).trim().split(/[\s,]+/).map(parseFloat),[s=0,o=0,i=NaN,r=NaN]=n;if(!(r>0))throw new Error("parseSvg: needs a viewBox or width/height");const c=[i,r],a=[r,0,0,-r,s,o+r],l=[1,0,0,-1,-s,o+r],h=i/r,f=[];i>0&&rs(`M${s} ${o}h${i}v${r}h${-i}z`,l,f),Yn({contours:f},r);const u=new Map,p=/<(linear|radial)Gradient\b([^>]*?)(?:\/>|>([\s\S]*?)<\/\1Gradient>)/g;for(const[,S="",w="",m=""]of e.matchAll(p))u.set(Z(w,"id")??"",[S,w,m]);const _=new Map;for(const[,S="",w=""]of e.matchAll(/<clipPath\b([^>]*?)(?:\/>|>([\s\S]*?)<\/clipPath>)/g))_.set(Z(S,"id")??"",[S,w]);const y=new Map;for(const[,S="",w=""]of e.matchAll(Oo)){const m=Z(w,"id");m!==void 0&&y.set(m,[S,w])}const g=[];for(const[,S=""]of e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/g))for(const[,w="",m=""]of S.matchAll(/([^{}]+)\{([^}]*)\}/g))for(const d of w.split(",")){const U=(T=/^\s*\.([\w-]+)\s*$/.exec(d))==null?void 0:T[1];U&&g.push([U,m])}const x=[],b=[],M=[{m:[1,0,0,1,0,0],fill:"black",rule:"nonzero",fillOpacity:1,opacity:1,clips:[],group:-1}];let A=0;for(const[,S,w="",m="",d]of e.matchAll(/<(\/?)([\w:-]+)([^>]*?)(\/?)>/g)){if(A>0||/^(defs|clipPath|mask|symbol|pattern|marker|style)$/.test(w)){S?A--:d||A++;continue}if(S){M.pop();continue}const U=M[M.length-1],C=_t=>os(m,_t,g),v=is(C("opacity"),1),I=No(w,m,c),R={m:wt(U.m,Cn(Z(m,"transform")??"")),fill:C("fill")??U.fill,rule:C("fill-rule")??U.rule,fillOpacity:is(C("fill-opacity"),U.fillOpacity),opacity:U.opacity*v,clips:U.clips,group:U.group};I===void 0&&v<1&&!d&&(R.group=b.push({members:[],parent:U.group,translucent:!1})-1);const G=_.get(Go(C("clip-path")));if(G&&Z(G[0],"clipPathUnits")!=="objectBoundingBox"&&(R.clips=[...U.clips,Dc(G,y,g,wt(l,R.m),c)]),d||M.push(R),I===void 0||R.fill==="none")continue;const F=[];rs(I,wt(l,R.m),F),R.rule==="evenodd"&&yo(F);const X={contours:F,inverseYAxis:!1};Yn(X,r);const H=u.get(Go(R.fill)),V=wt($o(R.m),a),et=H?Rc(H,u,g,V,I,c):null;for(const _t of R.clips)wo(X,_t);const z=es(X);if(!(z.maxX<=0||z.minX>=h||z.maxY<=0||z.minY>=1||((z.minX<0||z.minY<0||z.maxX>h||z.maxY>1)&&f.length>0&&wo(X,[f]),X.contours.length===0))){if(R.group>=0){const _t=b[R.group];_t.members.push(x.length);const Xt=et?et.stops.some(Nt=>Nt.opacity<1):!1;(v<1||R.fillOpacity<1||Xt)&&(_t.translucent=!0);for(let Nt=_t.parent;Nt>=0;Nt=b[Nt].parent)b[Nt].translucent=!0}x.push({shape:X,color:R.fill,opacity:R.opacity*R.fillOpacity,gradient:et})}}for(const S of b){if(S.translucent||S.members.length<2)continue;const w=S.members.map(m=>es(x[m].shape));for(let m=0;m<S.members.length-1;m++){const d=w[m],U=[];for(let C=m+1;C<S.members.length;C++){const v=w[C];v.minX<d.maxX&&d.minX<v.maxX&&v.minY<d.maxY&&d.minY<v.maxY&&U.push(x[S.members[C]].shape.contours)}tc(x[S.members[m]].shape,U)}}return{layers:x.filter(S=>S.shape.contours.length>0),width:i/r}}const Oo=/<([\w:-]+)\b([^>]*?)\/?>/g;function Go(e){var t;return((t=/url\(\s*['"]?#([^)'"\s]+)/.exec(e??""))==null?void 0:t[1])??""}function Dc([e="",t=""],n,s,o,i){var h;const[r=0,c=1]=i,a=[],l=wt(o,Cn(Z(e,"transform")??""));for(const[,f="",u=""]of t.matchAll(Oo)){let p=[f,u],_=wt(l,Cn(Z(u,"transform")??""));if(f==="use"){const b=n.get(((h=Z(u,"(?:xlink:)?href"))==null?void 0:h.slice(1))??"");if(!b)continue;_=wt(_,[1,0,0,1,tn(Z(u,"x"),r),tn(Z(u,"y"),c)]),_=wt(_,Cn(Z(b[1],"transform")??"")),p=b}const y=No(p[0],p[1],i);if(y===void 0)continue;const g=[];rs(y,_,g),[p[1],u,e].map(b=>os(b,"clip-rule",s)).find(Boolean)==="evenodd"&&yo(g),Yn({contours:g},c),a.push(g)}return a}function No(e,t,[n=0,s=0]){const o=(u,p)=>tn(Z(t,u),p),[i,r,c,a]=[o("x",n),o("y",s),o("width",n),o("height",s)],[l,h,f]=[o("cx",n),o("cy",s),Math.hypot(n,s)/Math.SQRT2];switch(e){case"path":return Z(t,"d")??"";case"polygon":case"polyline":return`M${Z(t,"points")??"0 0"}`;case"circle":case"ellipse":{const[u,p]=e==="circle"?[o("r",f),o("r",f)]:[o("rx",n),o("ry",s)],_=`A${u} ${p} 0 1 0`;return`M${l-u} ${h}${_} ${l+u} ${h}${_} ${l-u} ${h}Z`}case"rect":{const[u,p]=[Z(t,"rx"),Z(t,"ry")],_=Math.min(u===void 0?tn(p,s):tn(u,n),c/2),y=Math.min(p===void 0?tn(u,n):tn(p,s),a/2),g=`A${_} ${y} 0 0 1`;return`M${i+_} ${r}H${i+c-_}${g} ${i+c} ${r+y}V${r+a-y}${g} ${i+c-_} ${r+a}H${i+_}${g} ${i} ${r+a-y}V${r+y}${g} ${i+_} ${r}Z`}default:return}}function Rc(e,t,n,s,o,[i=0,r=0]){var m;const c=[];for(let d=e;d&&!c.includes(d);)c.push(d),d=t.get(((m=Z(d[1]??"","(?:xlink:)?href"))==null?void 0:m.slice(1))??"");const a=d=>c.map(U=>Z(U[1]??"",d)).find(U=>U!==void 0),l=a("gradientUnits")==="userSpaceOnUse",h=(d,U,C)=>{const v=a(d)??U;return parseFloat(v)*(v.trim().endsWith("%")?(l?C:1)/100:1)};let f=Cn(a("gradientTransform")??"");if(!l){const d=[];rs(o,[1,0,0,1,0,0],d);const U=es({contours:d});f=wt([U.maxX-U.minX,0,0,U.maxY-U.minY,U.minX,U.minY],f)}const u=e[0]==="radial",[p,_]=[h("x1","0%",i),h("y1","0%",r)],[y,g]=[h("x2","100%",i)-p,h("y2","0%",r)-_],x=Math.hypot(i,r)/Math.SQRT2,[b,M,A]=[h("cx","50%",i),h("cy","50%",r),h("r","50%",x)],k=y*y+g*g||1,T=u?[1/A,0,0,1/A,-b/A,-M/A]:[y/k,0,g/k,0,-(p*y+_*g)/k,0],w=[...(c.map(d=>d[2]??"").find(d=>/<stop\b/.test(d))??"").matchAll(/<stop\b[^>]*>/g)].map(([d])=>({offset:is(Z(d,"offset"),0),color:os(d,"stop-color",n)??"black",opacity:is(os(d,"stop-opacity",n),1)}));return{radial:u,matrix:wt(T,wt($o(f),s)),stops:w}}function wt(e,t){const[n=0,s=0,o=0,i=0,r=0,c=0]=e,[a=0,l=0,h=0,f=0,u=0,p=0]=t;return[n*a+o*l,s*a+i*l,n*h+o*f,s*h+i*f,n*u+o*p+r,s*u+i*p+c]}function Lc([e=0,t=0,n=0,s=0,o=0,i=0],r,c){return[e*r+n*c+o,t*r+s*c+i]}function $o([e=0,t=0,n=0,s=0,o=0,i=0]){const r=e*s-t*n;return[s/r,-t/r,-n/r,e/r,(n*i-s*o)/r,(t*o-e*i)/r]}function Cn(e){let t=[1,0,0,1,0,0];for(const[,n,s=""]of e.matchAll(/(\w+)\s*\(([^)]*)\)/g)){const[o=0,i,r,c=0,a=0,l=0]=s.trim().split(/[\s,]+/).map(parseFloat),h=o*Math.PI/180,[f,u]=[Math.cos(h),Math.sin(h)],[p,_]=[i??0,r??0];t=wt(t,n==="matrix"?[o,i??0,r??0,c,a,l]:n==="translate"?[1,0,0,1,o,i??0]:n==="scale"?[o,0,0,i??o,0,0]:n==="rotate"?[f,u,-u,f,p-f*p+u*_,_-u*p-f*_]:n==="skewX"?[1,0,Math.tan(h),1,0,0]:[1,Math.tan(h),0,1,0,0])}return t}const te=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y;function rs(e,t,n){let s=0,o=0,i=0,r=0,c=0,a=0,l=0,h="",f="",u=[];const p=()=>{for(;s<e.length&&` \r
|
|
2
|
+
,`.includes(e[s]);)s++},_=()=>{p(),te.lastIndex=s;const b=te.exec(e);if(!b)throw new Error(`parseSvg: expected a number at ${s} in path "${e}"`);return s=te.lastIndex,parseFloat(b[0])},y=()=>(p(),e[s++]==="1"?1:0),g=(b,...M)=>{const A=[o,i,...M],k=[];for(let I=0;I<A.length;I+=2)k.push(...Lc(t,A[I],A[I+1]));const[T=0,S=0,w=0,m=0,d=0,U=0,C=0,v=0]=k;u.push(new tt(b,T,S,w,m,d,U,C,v)),o=M[M.length-2],i=M[M.length-1]},x=()=>{u.length>0&&((o!==r||i!==c)&&g(J,r,c),n.push(u),u=[]),o=r,i=c};for(p();s<e.length;p()){if(/[a-zA-Z]/.test(e[s]))h=e[s++];else if(!h)throw new Error(`parseSvg: expected a command at ${s} in path "${e}"`);const b=h.toUpperCase(),M=h===b?0:o,A=h===b?0:i,k=b==="S"&&"CS".includes(f)||b==="T"&&"QT".includes(f),T=k?2*o-a:o,S=k?2*i-l:i;switch(b){case"M":{const w=M+_(),m=A+_();x(),o=r=w,i=c=m,h=h==="M"?"L":"l";break}case"L":g(J,M+_(),A+_());break;case"H":g(J,M+_(),i);break;case"V":g(J,o,A+_());break;case"C":case"S":{const w=b==="C"?M+_():T,m=b==="C"?A+_():S;a=M+_(),l=A+_(),g(Et,w,m,a,l,M+_(),A+_());break}case"Q":case"T":a=b==="Q"?M+_():T,l=b==="Q"?A+_():S,g(ot,a,l,M+_(),A+_());break;case"A":{const w=_(),m=_(),d=_(),U=y(),C=y();Pc(g,o,i,w,m,d,U,C,M+_(),A+_());break}case"Z":x(),h="";break;default:throw new Error(`parseSvg: unknown path command "${h}"`)}f=b}x()}function Pc(e,t,n,s,o,i,r,c,a,l){if(t===a&&n===l)return;if(s=Math.abs(s),o=Math.abs(o),s===0||o===0)return e(J,a,l);const h=Math.cos(i*Math.PI/180),f=Math.sin(i*Math.PI/180),u=(t-a)/2,p=(n-l)/2,_=h*u+f*p,y=-f*u+h*p,g=_*_/(s*s)+y*y/(o*o);g>1&&(s*=Math.sqrt(g),o*=Math.sqrt(g));const x=s*s*y*y+o*o*_*_,b=(r===c?-1:1)*Math.sqrt(Math.max(0,(s*s*o*o-x)/x)),M=b*s*y/o,A=-b*o*_/s,k=h*M-f*A+(t+a)/2,T=f*M+h*A+(n+l)/2,S=Math.atan2((y-A)/o,(_-M)/s);let w=Math.atan2((-y-A)/o,(-_-M)/s)-S;c&&w<0?w+=2*Math.PI:!c&&w>0&&(w-=2*Math.PI);const m=Math.max(1,Math.ceil(Math.abs(w)/(Math.PI/2)-1e-9)),d=w/m,U=4/3*Math.tan(d/4),C=(I,R)=>k+s*I*h-o*R*f,v=(I,R)=>T+s*I*f+o*R*h;for(let I=0;I<m;I++){const R=Math.cos(S+I*d),G=Math.sin(S+I*d),F=Math.cos(S+(I+1)*d),X=Math.sin(S+(I+1)*d),H=I===m-1;e(Et,C(R-U*G,G+U*R),v(R-U*G,G+U*R),C(F+U*X,X-U*F),v(F+U*X,X-U*F),H?a:C(F,X),H?l:v(F,X))}}function Fc(e){let t=0,n=0;for(const c of e)t+=c.w*c.h,n=Math.max(n,c.w);e.sort((c,a)=>a.h-c.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let i=0,r=0;for(const c of e)for(let a=o.length-1;a>=0;a--){const l=o[a];if(!(c.w>l.w||c.h>l.h)){if(c.x=l.x,c.y=l.y,r=Math.max(r,c.y+c.h),i=Math.max(i,c.x+c.w),c.w===l.w&&c.h===l.h){const h=o.pop();h&&a<o.length&&(o[a]=h)}else c.h===l.h?(l.x+=c.w,l.w-=c.w):c.w===l.w?(l.y+=c.h,l.h-=c.h):(o.push({x:l.x+c.w,y:l.y,w:l.w-c.w,h:c.h}),l.y+=c.h,l.h-=c.h);break}}return{w:i,h:r,fill:t/(i*r)||0}}const Bo=4,qc={x:0,y:0,w:0,h:0,advance:0,planeLeft:0,planeBottom:0,planeRight:0,planeTop:0};function cs(e){const t=e<0?0:e>1?1:e;return~Math.trunc(255.5-255*t)&255}class Oc{constructor(t,n={}){this._width=0,this._height=0,this._pixels=new Uint8Array(0),this._cache=new Map,this._byGid=[],this._cacheByKey=new Map,this._font=t,this._pxPerEm=n.pixelsPerEm??40,this._pxrange=n.pxrange??4,this._floats=n.float?new Float32Array(0):null,this.pxrangeEm=this._pxrange/this._pxPerEm}get width(){return this._width}get height(){return this._height}get texture(){return this._pixels}get floatTexture(){return this._floats}glyphs(t){const n=this._requireFont();return this.glyphsByIndex(Array.from(t,s=>n.glyphId(s)))}glyph(t){return this.glyphs([t])[0]}glyphsByIndex(t){const n=[];let s=0;for(const o of t){const i=this._cache.get(o);if(i){n.push(i.glyph);continue}const r=this._generateForGlyphId(o);this._cache.set(o,r),this._byGid[o]=r.glyph,n.push(r.glyph),s++}return s>0&&this._repack(),n}glyphByIndex(t){return this.glyphsByIndex([t])[0]}shapes(t){const n=[];let s=0;for(const[o,i]of t){let r=this._cacheByKey.get(o);r||(r=this._generate(i,0),this._cacheByKey.set(o,r),s++),n.push(r.glyph)}return s>0&&this._repack(),n}_requireFont(){if(!this._font)throw new Error("Atlas: no font — this atlas only supports shapes()");return this._font}_generateForGlyphId(t){const n=this._requireFont(),s=n.metrics.unitsPerEm,o=n.shape(t);return Yn(o,s),this._generate(o,n.advance(t)/s)}_generate(t,n){const s=Fo(t,this._pxPerEm,this._pxrange);return{glyph:{x:0,y:0,w:s?s.w:0,h:s?s.h:0,advance:n,planeLeft:s?s.planeLeft:0,planeBottom:s?s.planeBottom:0,planeRight:s?s.planeRight:0,planeTop:s?s.planeTop:0},msdf:s?s.msdf:null}}layout(t){const n=this._requireFont(),s=Ar(n,t),o=L._gid,i=L._gp;let r=0;const c=this._byGid;for(let _=0;_<s;_++){const y=o[_];if(i[_]&un||c[y])continue;const g=this._generateForGlyphId(y);this._cache.set(y,g),c[y]=g.glyph,r++}r>0&&this._repack();const a=L._xa,l=L._xo,h=L._yo,f=n.metrics.unitsPerEm,u=[];let p=0;for(let _=0;_<s;_++){const y=i[_]&un?qc:c[o[_]];u.push({glyph:y,penX:(p+l[_])/f,penY:h[_]/f}),p+=a[_]}return{glyphs:u,widthEm:p/f}}layoutMultiline(t){const n=this._requireFont(),s=n.metrics.unitsPerEm,o=(n.metrics.ascender-n.metrics.descender+n.metrics.lineGap)/s,i=t.split(`
|
|
3
|
+
`),r=[];let c=0;for(let a=0;a<i.length;a++){const{glyphs:l,widthEm:h}=this.layout(i[a]),f=-a*o;for(const u of l)r.push({glyph:u.glyph,penX:u.penX,penY:f+u.penY});h>c&&(c=h)}return{glyphs:r,widthEm:c,heightEm:i.length*o}}_repack(){const t=[];for(const o of[this._cache,this._cacheByKey])for(const{glyph:i,msdf:r}of o.values())r&&t.push({w:i.w+1,h:i.h+1,x:0,y:0,glyph:i,msdf:r});const{w:n,h:s}=Fc(t);this._width=n,this._height=s,this._pixels=new Uint8Array(n*s*Bo),this._floats&&(this._floats=new Float32Array(n*s*3));for(const o of t)o.glyph.x=o.x,o.glyph.y=o.y,this._blit(o.msdf,o.x,o.y,o.glyph.w,o.glyph.h)}_blit(t,n,s,o,i){var a;const r=this._width,c=this._pixels;for(let l=0;l<i;l++){const h=s+(i-1-l);(a=this._floats)==null||a.set(t.subarray(l*o*3,(l+1)*o*3),(h*r+n)*3);for(let f=0;f<o;f++){const u=(l*o+f)*3,p=(h*r+(n+f))*Bo;c[p]=cs(t[u]),c[p+1]=cs(t[u+1]),c[p+2]=cs(t[u+2]),c[p+3]=255}}}}return gt.Atlas=Oc,gt.CUBIC=Et,gt.EdgeSegment=tt,gt.Font=qr,gt.LINEAR=J,gt.QUADRATIC=ot,gt.generateShapeMSDF=Fo,gt.parseSvg=Ic,gt.parseSvgLayers=qo,gt.pixelFloatToByte=cs,Object.defineProperty(gt,Symbol.toStringTag,{value:"Module"}),gt})({});
|