modern-text 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,77 @@
1
- (function(W,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(W=typeof globalThis<"u"?globalThis:W||self,ct(W.modernText={}))})(this,function(W){"use strict";var Pa=Object.defineProperty;var Ta=(W,ct,Gt)=>ct in W?Pa(W,ct,{enumerable:!0,configurable:!0,writable:!0,value:Gt}):W[ct]=Gt;var T=(W,ct,Gt)=>Ta(W,typeof ct!="symbol"?ct+"":ct,Gt);var ee;function ct(i,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:o,y1:s,stops:a}=yi(e,t.left,t.top,t.width,t.height),l=i.createLinearGradient(n,r,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function Gt(i,e,t){i!=null&&i.color&&(i.color=ct(t,i.color,e)),i!=null&&i.backgroundColor&&(i.backgroundColor=ct(t,i.backgroundColor,e)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=ct(t,i.textStrokeColor,e))}function yi(i,e,t,n,r){var d;const o=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(c),f=r*Math.cos(c);return{x0:e+n/2-u,y0:t+r/2+f,x1:e+n/2+u,y1:t+r/2-f,stops:Array.from(l).map(p=>{let y=p[2];return y.startsWith("(")?y=y.split(",").length>3?`rgba${y}`:`rgb${y}`:y=`#${y}`,{offset:Number(p[3].replace("%",""))/100,color:y}})}}function ne(i){const{ctx:e,path:t,fontSize:n,clipRect:r}=i;e.save(),e.beginPath();const o=t.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Qn(i,e,t){const{left:n,top:r,width:o,height:s}=t,a=i.canvas;a.dataset.viewBox=`${n} ${r} ${o} ${s}`,a.dataset.pixelRatio=String(e);const l=o,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,i.clearRect(0,0,a.width,a.height),i.scale(e,e),i.translate(-n,-r)}function Jn(i,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;Gt(n,r,i),t.forEach(o=>{Gt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Gt(s.computedStyle,s.inlineBox,i)})})}var ut=Uint8Array,_t=Uint16Array,yn=Int32Array,Ne=new ut([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ge=new ut([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),mn=new ut([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tr=function(i,e){for(var t=new _t(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new yn(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},er=tr(Ne,2),nr=er.b,xn=er.r;nr[28]=258,xn[258]=28;for(var rr=tr(Ge,0),mi=rr.b,ir=rr.r,vn=new _t(32768),Q=0;Q<32768;++Q){var Zt=(Q&43690)>>1|(Q&21845)<<1;Zt=(Zt&52428)>>2|(Zt&13107)<<2,Zt=(Zt&61680)>>4|(Zt&3855)<<4,vn[Q]=((Zt&65280)>>8|(Zt&255)<<8)>>1}for(var jt=function(i,e,t){for(var n=i.length,r=0,o=new _t(e);r<n;++r)i[r]&&++o[i[r]-1];var s=new _t(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new _t(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],c=e-i[r],u=s[i[r]-1]++<<c,f=u|(1<<c)-1;u<=f;++u)a[vn[u]>>l]=h}else for(a=new _t(n),r=0;r<n;++r)i[r]&&(a[r]=vn[s[i[r]-1]++]>>15-i[r]);return a},Yt=new ut(288),Q=0;Q<144;++Q)Yt[Q]=8;for(var Q=144;Q<256;++Q)Yt[Q]=9;for(var Q=256;Q<280;++Q)Yt[Q]=7;for(var Q=280;Q<288;++Q)Yt[Q]=8;for(var Se=new ut(32),Q=0;Q<32;++Q)Se[Q]=5;var xi=jt(Yt,9,0),vi=jt(Yt,9,1),wi=jt(Se,5,0),bi=jt(Se,5,1),wn=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Lt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},bn=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},Sn=function(i){return(i+7)/8|0},sr=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ut(i.subarray(e,t))},Si=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(i,e,t){var n=new Error(e||Si[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},Ci=function(i,e,t,n){var r=i.length,o=0;if(!r||e.f&&!e.l)return t||new ut(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ut(r*3));var h=function(Mt){var kt=t.length;if(Mt>kt){var ht=new ut(Math.max(kt*2,Mt));ht.set(t),t=ht}},c=e.f||0,u=e.p||0,f=e.b||0,d=e.l,p=e.d,y=e.m,g=e.n,M=r*8;do{if(!d){c=Lt(i,u,1);var A=Lt(i,u+1,3);if(u+=3,A)if(A==1)d=vi,p=bi,y=9,g=5;else if(A==2){var v=Lt(i,u,31)+257,S=Lt(i,u+10,15)+4,w=v+Lt(i,u+5,31)+1;u+=14;for(var D=new ut(w),R=new ut(19),B=0;B<S;++B)R[mn[B]]=Lt(i,u+B*3,7);u+=S*3;for(var L=wn(R),N=(1<<L)-1,U=jt(R,L,1),B=0;B<w;){var I=U[Lt(i,u,N)];u+=I&15;var b=I>>4;if(b<16)D[B++]=b;else{var X=0,O=0;for(b==16?(O=3+Lt(i,u,3),u+=2,X=D[B-1]):b==17?(O=3+Lt(i,u,7),u+=3):b==18&&(O=11+Lt(i,u,127),u+=7);O--;)D[B++]=X}}var $=D.subarray(0,v),j=D.subarray(v);y=wn($),g=wn(j),d=jt($,y,1),p=jt(j,g,1)}else Ut(1);else{var b=Sn(u)+4,C=i[b-4]|i[b-3]<<8,x=b+C;if(x>r){l&&Ut(0);break}a&&h(f+C),t.set(i.subarray(b,x),f),e.b=f+=C,e.p=u=x*8,e.f=c;continue}if(u>M){l&&Ut(0);break}}a&&h(f+131072);for(var E=(1<<y)-1,G=(1<<g)-1,k=u;;k=u){var X=d[bn(i,u)&E],P=X>>4;if(u+=X&15,u>M){l&&Ut(0);break}if(X||Ut(2),P<256)t[f++]=P;else if(P==256){k=u,d=null;break}else{var F=P-254;if(P>264){var B=P-257,z=Ne[B];F=Lt(i,u,(1<<z)-1)+nr[B],u+=z}var H=p[bn(i,u)&G],Y=H>>4;H||Ut(3),u+=H&15;var j=mi[Y];if(Y>3){var z=Ge[Y];j+=bn(i,u)&(1<<z)-1,u+=z}if(u>M){l&&Ut(0);break}a&&h(f+131072);var nt=f+F;if(f<j){var Wt=o-j,Bt=Math.min(j,nt);for(Wt+f<0&&Ut(3);f<Bt;++f)t[f]=n[Wt+f]}for(;f<nt;++f)t[f]=t[f-j]}}e.l=d,e.p=k,e.b=f,e.f=c,d&&(c=1,e.m=y,e.d=p,e.n=g)}while(!c);return f!=t.length&&s?sr(t,0,f):t.subarray(0,f)},Ht=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},Ce=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},Cn=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,o=t.slice();if(!r)return{t:hr,l:0};if(r==1){var s=new ut(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(x,v){return x.f-v.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[u].f?h++:u++],l=t[h!=c&&t[h].f<t[u].f?h++:u++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=o[0].s,n=1;n<r;++n)o[n].s>f&&(f=o[n].s);var d=new _t(f+1),p=Mn(t[c-1],d,0);if(p>e){var n=0,y=0,g=p-e,M=1<<g;for(o.sort(function(v,S){return d[S.s]-d[v.s]||v.f-S.f});n<r;++n){var A=o[n].s;if(d[A]>e)y+=M-(1<<p-d[A]),d[A]=e;else break}for(y>>=g;y>0;){var b=o[n].s;d[b]<e?y-=1<<e-d[b]++-1:++n}for(;n>=0&&y;--n){var C=o[n].s;d[C]==e&&(--d[C],++y)}p=e}return{t:new ut(d),l:p}},Mn=function(i,e,t){return i.s==-1?Math.max(Mn(i.l,e,t+1),Mn(i.r,e,t+1)):e[i.s]=t},or=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new _t(++e),n=0,r=i[0],o=1,s=function(l){t[n++]=l},a=1;a<=e;++a)if(i[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=i[a]}return{c:t.subarray(0,n),n:e}},Me=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},ar=function(i,e,t){var n=t.length,r=Sn(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},lr=function(i,e,t,n,r,o,s,a,l,h,c){Ht(e,c++,t),++r[256];for(var u=Cn(r,15),f=u.t,d=u.l,p=Cn(o,15),y=p.t,g=p.l,M=or(f),A=M.c,b=M.n,C=or(y),x=C.c,v=C.n,S=new _t(19),w=0;w<A.length;++w)++S[A[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var D=Cn(S,7),R=D.t,B=D.l,L=19;L>4&&!R[mn[L-1]];--L);var N=h+5<<3,U=Me(r,Yt)+Me(o,Se)+s,I=Me(r,f)+Me(o,y)+s+14+3*L+Me(S,R)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&N<=U&&N<=I)return ar(e,c,i.subarray(l,l+h));var X,O,$,j;if(Ht(e,c,1+(I<U)),c+=2,I<U){X=jt(f,d,0),O=f,$=jt(y,g,0),j=y;var E=jt(R,B,0);Ht(e,c,b-257),Ht(e,c+5,v-1),Ht(e,c+10,L-4),c+=14;for(var w=0;w<L;++w)Ht(e,c+3*w,R[mn[w]]);c+=3*L;for(var G=[A,x],k=0;k<2;++k)for(var P=G[k],w=0;w<P.length;++w){var F=P[w]&31;Ht(e,c,E[F]),c+=R[F],F>15&&(Ht(e,c,P[w]>>5&127),c+=P[w]>>12)}}else X=xi,O=Yt,$=wi,j=Se;for(var w=0;w<a;++w){var z=n[w];if(z>255){var F=z>>18&31;Ce(e,c,X[F+257]),c+=O[F+257],F>7&&(Ht(e,c,z>>23&31),c+=Ne[F]);var H=z&31;Ce(e,c,$[H]),c+=j[H],H>3&&(Ce(e,c,z>>5&8191),c+=Ge[H])}else Ce(e,c,X[z]),c+=O[z]}return Ce(e,c,X[256]),c+O[256]},Mi=new yn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),hr=new ut(0),Pi=function(i,e,t,n,r,o){var s=o.z||i.length,a=new ut(n+s+5*(1+Math.ceil(s/7e3))+r),l=a.subarray(n,a.length-r),h=o.l,c=(o.r||0)&7;if(e){c&&(l[0]=o.r>>3);for(var u=Mi[e-1],f=u>>13,d=u&8191,p=(1<<t)-1,y=o.p||new _t(32768),g=o.h||new _t(p+1),M=Math.ceil(t/3),A=2*M,b=function(At){return(i[At]^i[At+1]<<M^i[At+2]<<A)&p},C=new yn(25e3),x=new _t(288),v=new _t(32),S=0,w=0,D=o.i||0,R=0,B=o.w||0,L=0;D+2<s;++D){var N=b(D),U=D&32767,I=g[N];if(y[U]=I,g[N]=U,B<=D){var X=s-D;if((S>7e3||R>24576)&&(X>423||!h)){c=lr(i,l,0,C,x,v,w,R,L,D-L,c),R=S=w=0,L=D;for(var O=0;O<286;++O)x[O]=0;for(var O=0;O<30;++O)v[O]=0}var $=2,j=0,E=d,G=U-I&32767;if(X>2&&N==b(D-G))for(var k=Math.min(f,X)-1,P=Math.min(32767,D),F=Math.min(258,X);G<=P&&--E&&U!=I;){if(i[D+$]==i[D+$-G]){for(var z=0;z<F&&i[D+z]==i[D+z-G];++z);if(z>$){if($=z,j=G,z>k)break;for(var H=Math.min(G,z-2),Y=0,O=0;O<H;++O){var nt=D-G+O&32767,Wt=y[nt],Bt=nt-Wt&32767;Bt>Y&&(Y=Bt,I=nt)}}}U=I,I=y[U],G+=U-I&32767}if(j){C[R++]=268435456|xn[$]<<18|ir[j];var Mt=xn[$]&31,kt=ir[j]&31;w+=Ne[Mt]+Ge[kt],++x[257+Mt],++v[kt],B=D+$,++S}else C[R++]=i[D],++x[i[D]]}}for(D=Math.max(D,B);D<s;++D)C[R++]=i[D],++x[i[D]];c=lr(i,l,h,C,x,v,w,R,L,D-L,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=g,o.p=y,o.i=D,o.w=B)}else{for(var D=o.w||0;D<s+h;D+=65535){var ht=D+65535;ht>=s&&(l[c/8|0]=h,ht=s),c=ar(l,c+1,i.subarray(D,ht))}o.i=s}return sr(a,0,n+Sn(c)+r)},cr=function(){var i=1,e=0;return{p:function(t){for(var n=i,r=e,o=t.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=n+=t[s];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,e=r},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},Ti=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new ut(o.length+i.length);s.set(o),s.set(i,o.length),i=s,r.w=o.length}return Pi(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},ur=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},ki=function(i,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=n<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var r=cr();r.p(e.dictionary),ur(i,2,r.d())}},Ai=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Ut(6,"invalid zlib data"),(i[1]>>5&1)==1&&Ut(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function _i(i,e){e||(e={});var t=cr();t.p(i);var n=Ti(i,e,e.dictionary?6:2,4);return ki(n,e),ur(n,n.length-4,t.d()),n}function Ii(i,e){return Ci(i.subarray(Ai(i),-4),{i:2},e,e)}var Oi=typeof TextDecoder<"u"&&new TextDecoder,Ei=0;try{Oi.decode(hr,{stream:!0}),Ei=1}catch{}const Bi="modern-font";function Pe(i,e){if(!i)throw new Error(`[${Bi}] ${e}`)}function Di(i){if("buffer"in i){const e=i.buffer;return i.byteOffset>0||i.byteLength<i.buffer.byteLength?e.slice(i.byteOffset,i.byteOffset+i.byteLength):e}else return i}function ce(i){return"buffer"in i?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}function Li(i){let e="";for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function je(i){i=Li(i);const e=[];for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Ui(i){let e="";for(let t=0,n=i.length;t<n;t++)i[t]<127?e+=String.fromCharCode(i[t]):e+=`%${(256+i[t]).toString(16).slice(1)}`;return unescape(e)}function Fi(i){let e="";for(let t=0,n=i.length;t<n;t+=2)e+=String.fromCharCode((i[t]<<8)+i[t+1]);return e}var $i=Object.defineProperty,ft=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&$i(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(i,e){Object.defineProperty(i.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,o){super(Di(t),n,r);T(this,"cursor",0);this.littleEndian=o}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,o)=>this.read(t.type,t.offset+o));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,o)=>{this.write(t.type,n[o],t.offset+o)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const o=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[o])==null?void 0:h.bind(s),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,o]=this.readBytes(t,3);return(n<<16)+(r<<8)+o}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let o=0;o<n;++o)r.push(this.getUint8(t+o));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let o="";for(let s=0,a=r.length;s<a;s++)o+=String.fromCharCode(r[s]);return o}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),o=new Date;return o.setTime(r*1e3+-20775456e5),o}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,o=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const s=`set${t.replace(/^\S/,u=>u.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,o);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let o=0,s=t.length,a;o<s;++o)a=t.charCodeAt(o)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const o=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(o,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let o=0;o<r;++o)this.setUint8(n+o,t[o])}else{const o=ce(t);r=o.byteLength;for(let s=0;s<r;++s)this.setUint8(n+s,o.getUint8(s))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ft([pt()],at.prototype,"readInt8"),ft([pt()],at.prototype,"readInt16"),ft([pt()],at.prototype,"readInt32"),ft([pt()],at.prototype,"readUint8"),ft([pt()],at.prototype,"readUint16"),ft([pt()],at.prototype,"readUint32"),ft([pt()],at.prototype,"readFloat32"),ft([pt()],at.prototype,"readFloat64"),ft([pt()],at.prototype,"writeInt8"),ft([pt()],at.prototype,"writeInt16"),ft([pt()],at.prototype,"writeInt32"),ft([pt()],at.prototype,"writeUint8"),ft([pt()],at.prototype,"writeUint16"),ft([pt()],at.prototype,"writeUint32"),ft([pt()],at.prototype,"writeFloat32"),ft([pt()],at.prototype,"writeFloat64");const fr=new WeakMap;function m(i){const e=typeof i=="object"?i:{type:i},{size:t=1,type:n}=e;return(r,o)=>{if(typeof o!="string")return;let s=fr.get(r);s||(s={columns:[],byteLength:0},fr.set(r,s));const a={...e,name:o,byteLength:t*Re[n],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){T(this,"view");this.view=new at(e,t,n,r)}}class Pn extends Ot{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var zi=Object.defineProperty,vt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zi(e,t,r),r};const wt=class fi extends Pn{constructor(){super(...arguments);T(this,"format","EmbeddedOpenType");T(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,o=n.name.names,s=je(o.fontFamily||""),a=s.length,l=je(o.fontStyle||""),h=l.length,c=je(o.version||""),u=c.length,f=je(o.fullName||""),d=f.length,p=86+a+4+h+4+u+4+d+2+t.view.byteLength,y=new fi(new ArrayBuffer(p),0,p,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=n.head.checkSumAdjustment;const g=n.os2;return g&&(y.FontPANOSE=g.fontPANOSE,y.Italic=g.fsSelection,y.Weight=g.usWeightClass,y.fsType=g.fsType,y.UnicodeRange=g.ulUnicodeRange,y.CodePageRange=g.ulCodePageRange),y.view.writeUint16(a),y.view.writeBytes(s),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(l),y.view.writeUint16(0),y.view.writeUint16(u),y.view.writeBytes(c),y.view.writeUint16(0),y.view.writeUint16(d),y.view.writeBytes(f),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};vt([m("uint32")],wt.prototype,"EOTSize"),vt([m("uint32")],wt.prototype,"FontDataSize"),vt([m("uint32")],wt.prototype,"Version"),vt([m("uint32")],wt.prototype,"Flags"),vt([m({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),vt([m("uint8")],wt.prototype,"Charset"),vt([m("uint8")],wt.prototype,"Italic"),vt([m("uint32")],wt.prototype,"Weight"),vt([m("uint16")],wt.prototype,"fsType"),vt([m("uint16")],wt.prototype,"MagicNumber"),vt([m({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),vt([m({type:"uint8",size:8})],wt.prototype,"CodePageRange"),vt([m("uint32")],wt.prototype,"CheckSumAdjustment"),vt([m({type:"uint8",size:16})],wt.prototype,"Reserved"),vt([m("uint16")],wt.prototype,"Padding1");var Ni=Object.defineProperty,Ve=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ni(e,t,r),r};class Te extends Ot{constructor(e,t){super(e,t,16)}}Ve([m({type:"char",size:4})],Te.prototype,"tag"),Ve([m("uint32")],Te.prototype,"checkSum"),Ve([m("uint32")],Te.prototype,"offset"),Ve([m("uint32")],Te.prototype,"length");const Tn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Gi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class pr{constructor(e){T(this,"index");T(this,"name");T(this,"isComposite",!1);T(this,"components",[]);T(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*n,{xScale:a=s,yScale:l=s}=r,h=this.pathCommands,c=[];for(let u=0,f=h.length;u<f;u+=1){const d=h[u];d.type==="M"?c.push({type:"M",x:e+d.x*a,y:t+-d.y*l}):d.type==="L"?c.push({type:"L",x:e+d.x*a,y:t+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:e+d.x1*a,y1:t+-d.y1*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="C"?c.push({type:"C",x1:e+d.x1*a,y1:t+-d.y1*l,x2:e+d.x2*a,y2:t+-d.y2*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class ji extends pr{parse(e,t,n){const r=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let u,f,d,p;const y=[],g=[];let M=0,A=!1,b=!1,C=s,x=0,v=0;function S(U,I){y.push({type:"L",x:U,y:I})}function w(U,I,X,O,$,j){y.push({type:"C",x1:U,y1:I,x2:X,y2:O,x:$,y:j})}function D(U,I){b&&h!==2&&R(),b=!0,y.push({type:"M",x:U,y:I})}function R(){y.push({type:"Z"})}function B(U){y.push(...U)}function L(){g.length%2!==0&&!A&&(C=g.shift()+o),M+=g.length>>1,g.length=0,A=!0}function N(U){let I,X,O,$,j,E,G,k,P,F,z,H,Y=0;for(;Y<U.length;){let nt=U[Y++];switch(nt){case 1:L();break;case 3:L();break;case 4:g.length>1&&!A&&(C=g.shift()+o,A=!0),v+=g.pop(),D(x,v);break;case 5:for(;g.length>0;)x+=g.shift(),v+=g.shift(),S(x,v);break;case 6:for(;g.length>0&&(x+=g.shift(),S(x,v),g.length!==0);)v+=g.shift(),S(x,v);break;case 7:for(;g.length>0&&(v+=g.shift(),S(x,v),g.length!==0);)x+=g.shift(),S(x,v);break;case 8:for(;g.length>0;)u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p+g.shift(),w(u,f,d,p,x,v);break;case 10:j=g.pop()+l,E=e.subrs[j],E&&N(E);break;case 11:return;case 12:switch(nt=U[Y],Y+=1,nt){case 35:u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),G=d+g.shift(),k=p+g.shift(),P=G+g.shift(),F=k+g.shift(),z=P+g.shift(),H=F+g.shift(),x=z+g.shift(),v=H+g.shift(),g.shift(),w(u,f,d,p,G,k),w(P,F,z,H,x,v);break;case 34:u=x+g.shift(),f=v,d=u+g.shift(),p=f+g.shift(),G=d+g.shift(),k=p,P=G+g.shift(),F=p,z=P+g.shift(),H=v,x=z+g.shift(),w(u,f,d,p,G,k),w(P,F,z,H,x,v);break;case 36:u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),G=d+g.shift(),k=p,P=G+g.shift(),F=p,z=P+g.shift(),H=F+g.shift(),x=z+g.shift(),w(u,f,d,p,G,k),w(P,F,z,H,x,v);break;case 37:u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),G=d+g.shift(),k=p+g.shift(),P=G+g.shift(),F=k+g.shift(),z=P+g.shift(),H=F+g.shift(),Math.abs(z-x)>Math.abs(H-v)?x=z+g.shift():v=H+g.shift(),w(u,f,d,p,G,k),w(P,F,z,H,x,v);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),g.length=0}break;case 14:if(g.length>=4){const Wt=Tn[g.pop()],Bt=Tn[g.pop()],Mt=g.pop(),kt=g.pop();if(Wt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),At=e.charset.indexOf(Bt);r.components.push({glyphIndex:At,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:kt,dy:Mt}),B(n.get(At).pathCommands);const zt=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let Nt=0;Nt<zt.length;Nt+=1){const Dt=zt[Nt];Dt.type!=="Z"&&(Dt.x+=kt,Dt.y+=Mt),(Dt.type==="Q"||Dt.type==="C")&&(Dt.x1+=kt,Dt.y1+=Mt),Dt.type==="C"&&(Dt.x2+=kt,Dt.y2+=Mt)}B(zt)}}else g.length>0&&!A&&(C=g.shift()+o,A=!0);b&&h!==2&&(R(),b=!1);break;case 18:L();break;case 19:case 20:L(),Y+=M+7>>3;break;case 21:g.length>2&&!A&&(C=g.shift()+o,A=!0),v+=g.pop(),x+=g.pop(),D(x,v);break;case 22:g.length>1&&!A&&(C=g.shift()+o,A=!0),x+=g.pop(),D(x,v);break;case 23:L();break;case 24:for(;g.length>2;)u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p+g.shift(),w(u,f,d,p,x,v);x+=g.shift(),v+=g.shift(),S(x,v);break;case 25:for(;g.length>6;)x+=g.shift(),v+=g.shift(),S(x,v);u=x+g.shift(),f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p+g.shift(),w(u,f,d,p,x,v);break;case 26:for(g.length%2&&(x+=g.shift());g.length>0;)u=x,f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d,v=p+g.shift(),w(u,f,d,p,x,v);break;case 27:for(g.length%2&&(v+=g.shift());g.length>0;)u=x+g.shift(),f=v,d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p,w(u,f,d,p,x,v);break;case 28:I=U[Y],X=U[Y+1],g.push((I<<24|X<<16)>>16),Y+=2;break;case 29:j=g.pop()+a,E=e.gsubrs[j],E&&N(E);break;case 30:for(;g.length>0&&(u=x,f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p+(g.length===1?g.shift():0),w(u,f,d,p,x,v),g.length!==0);)u=x+g.shift(),f=v,d=u+g.shift(),p=f+g.shift(),v=p+g.shift(),x=d+(g.length===1?g.shift():0),w(u,f,d,p,x,v);break;case 31:for(;g.length>0&&(u=x+g.shift(),f=v,d=u+g.shift(),p=f+g.shift(),v=p+g.shift(),x=d+(g.length===1?g.shift():0),w(u,f,d,p,x,v),g.length!==0);)u=x,f=v+g.shift(),d=u+g.shift(),p=f+g.shift(),x=d+g.shift(),v=p+(g.length===1?g.shift():0),w(u,f,d,p,x,v);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?g.push(nt-139):nt<251?(I=U[Y],Y+=1,g.push((nt-247)*256+I+108)):nt<255?(I=U[Y],Y+=1,g.push(-(nt-251)*256-I-108)):(I=U[Y],X=U[Y+1],O=U[Y+2],$=U[Y+3],Y+=4,g.push((I<<24|X<<16|O<<8|$)/65536))}}}N(t),this.pathCommands=y,A&&(this.advanceWidth=C)}}class dr{constructor(e){T(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);o&&(n.unicode??(n.unicode=o[0]),n.unicodes??(n.unicodes=o)),this._items[e]=n}return n}}class Ri extends dr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new ji({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var Vi=Object.defineProperty,gr=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Vi(e,t,r),r};class qe extends Ot{constructor(t,n,r,o){super(t,n,r,o);T(this,"_offsets");T(this,"_objects");this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const o=[];for(let s=0,a=n+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();o.push(h)}return o}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,o=r+n[t],a=r+n[t+1]-o;return this._isString?this.view.readString(o,a):this.view.readBytes(o,a)}}gr([m("uint16")],qe.prototype,"count"),gr([m("uint8")],qe.prototype,"offsetSize");class We extends qe{constructor(){super(...arguments);T(this,"_isString",!1)}}class yr extends qe{constructor(){super(...arguments);T(this,"_isString",!0)}}const qi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Wi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Hi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Xi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function He(i,e){return e<=390?qi[e]:i[e-391]}function J(i,e="number",t){return(n,r)=>{if(typeof r!="string")return;const o={type:e,operator:i,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class mr extends Ot{constructor(){super(...arguments);T(this,"_dict");T(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,o=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===r||(n+=o[a],l===r))break;n+=o[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,o,s,a;if(t===28)return r=n.readUint8(),o=n.readUint8(),r<<8|o;if(t===29)return r=n.readUint8(),o=n.readUint8(),s=n.readUint8(),a=n.readUint8(),r<<24|o<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,o={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),o[s]=n,n=[]):n.push(this._readOperand(s))}return o}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return He(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Zi=Object.defineProperty,kn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Zi(e,t,r),r};class Xe extends mr{}kn([J(19)],Xe.prototype,"subrs"),kn([J(20)],Xe.prototype,"defaultWidthX"),kn([J(21)],Xe.prototype,"nominalWidthX");var Yi=Object.defineProperty,rt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Yi(e,t,r),r};class et extends mr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(i,e=i){return t=>{ue.tableDefinitions.set(i,{tag:i,prop:e,class:t}),Object.defineProperty(ue.prototype,e,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const he=class he{constructor(e){T(this,"tables",new Map);T(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,o=Array.from({length:r}),s=t.get(0);for(let a=0;a<r;a+=1)o[a]=t.get(n[a])||s;return o}getPathCommands(e,t,n,r,o){const s=[];return this.forEachGlyph(e,t,n,r,o,(a,l,h,c,u)=>{s.push(...a.getPathCommands(l,h,c,u,this))}),s}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,o={},s){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,n,r,o),c.advanceWidth&&(t+=c.advanceWidth*a),o.letterSpacing?t+=o.letterSpacing*r:o.tracking&&(t+=o.tracking/1e3*r)}return t}clone(){return new he(this.tableViews)}delete(e){const t=he.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=he.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=he.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const o=this.tableViews.get(e);if(!o)return;n=new r(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(t.prop,n)}}return n}};T(he,"tableDefinitions",new Map);let ue=he;class gt extends Ot{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var Ki=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,ke=(i,e,t,n)=>{for(var r=n>1?void 0:n?Qi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ki(e,t,r),r};let fe=class extends gt{constructor(e,t,n,r){super(e,t,n,r);T(this,"_glyphs");T(this,"privateDict");T(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Ri(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new yr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new yr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Xe(t,n+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Wi:this.topDict.charset===1?this.charset=Hi:this.topDict.charset===2?this.charset=Xi:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Tn:this.topDict.encoding===1?this.encoding=Gi:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let o,s,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(o=0;o<t;o+=1)s=r.readUint16(),l.push(He(n,s));else if(h===1)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint8(),o=0;o<=a;o+=1)l.push(He(n,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint16(),o=0;o<=a;o+=1)l.push(He(n,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const o={},s=t.readUint8();if(s===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),o[r]=n}else if(s===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)o[c]=r,r+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};ke([m("uint8")],fe.prototype,"majorVersion",2),ke([m("uint8")],fe.prototype,"minorVersion",2),ke([m("uint8")],fe.prototype,"headerSize",2),ke([m("uint8")],fe.prototype,"offsetSize",2),fe=ke([dt("CFF ","cff")],fe);var Ji=Object.defineProperty,Ze=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ji(e,t,r),r};const Ae=class pi extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new pi;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Ze([m("uint16")],Ae.prototype,"format"),Ze([m("uint16")],Ae.prototype,"length"),Ze([m("uint16")],Ae.prototype,"language"),Ze([m({type:"uint8",size:256})],Ae.prototype,"glyphIndexArray");let xr=Ae;var ts=Object.defineProperty,An=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&ts(e,t,r),r};class Ye extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let u=0,f=o[c].entryCount;u<f;u++)if(o[c].idRangeOffset+u>=s.length?l=0:(l=s[o[c].idRangeOffset+u],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<e){const d=(h<<8|u+o[c].firstCode)%65535;t.set(d,l)}}return t}}An([m("uint16")],Ye.prototype,"format"),An([m("uint16")],Ye.prototype,"length"),An([m("uint16")],Ye.prototype,"language");function vr(i){return i>32767?i-65536:i<-32767?i+65536:i}function wr(i,e){let t;const n=[];let r={};return i.forEach((o,s)=>{e&&s>e||((!t||s!==t.unicode+1||o!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:s,startId:o,delta:vr(o-s)}):(r.start=Number(s),r.startId=o,r.delta=vr(o-s))),t={unicode:s,glyphIndex:o})}),t&&(r.end=t.unicode,n.push(r)),n}var es=Object.defineProperty,re=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&es(e,t,r),r};const Kt=class di extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=wr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),o=2*2**r,s=new di(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=r,s.rangeShift=2*n-o,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],u=o[h];c<=u;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const f=h+s[h]/2+(c-r[h])-n,d=l[f];d!==0?e.set(c,(d+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};re([m("uint16")],Kt.prototype,"format"),re([m("uint16")],Kt.prototype,"length"),re([m("uint16")],Kt.prototype,"language"),re([m("uint16")],Kt.prototype,"segCountX2"),re([m("uint16")],Kt.prototype,"searchRange"),re([m("uint16")],Kt.prototype,"entrySelector"),re([m("uint16")],Kt.prototype,"rangeShift");let br=Kt;var ns=Object.defineProperty,_e=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&ns(e,t,r),r};class pe extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}_e([m("uint16")],pe.prototype,"format"),_e([m("uint16")],pe.prototype,"length"),_e([m("uint16")],pe.prototype,"language"),_e([m("uint16")],pe.prototype,"firstCode"),_e([m("uint16")],pe.prototype,"entryCount");var rs=Object.defineProperty,Ie=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&rs(e,t,r),r};const de=class gi extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=wr(e),n=new gi(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const o=t[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};Ie([m("uint16")],de.prototype,"format"),Ie([m("uint16")],de.prototype,"reserved"),Ie([m("uint32")],de.prototype,"length"),Ie([m("uint32")],de.prototype,"language"),Ie([m("uint32")],de.prototype,"nGroups");let Sr=de;var is=Object.defineProperty,_n=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&is(e,t,r),r};class Ke extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:o}=t[n];o.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}_n([m("uint16")],Ke.prototype,"format"),_n([m("uint32")],Ke.prototype,"length"),_n([m("uint32")],Ke.prototype,"numVarSelectorRecords");var ss=Object.defineProperty,os=Object.getOwnPropertyDescriptor,In=(i,e,t,n)=>{for(var r=n>1?void 0:n?os(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ss(e,t,r),r};let Oe=class extends gt{constructor(){super(...arguments);T(this,"_unicodeToGlyphIndexMap");T(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(u=>u>65535),n=br.from(e),r=xr.from(e),o=t?Sr.from(e):void 0,s=4+(o?32:24),a=s+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Oe(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(u=>{c.view.writeUint16(u.platformID),c.view.writeUint16(u.platformSpecificID),c.view.writeUint32(u.offset)}),c.view.writeBytes(n.view,s),c.view.writeBytes(r.view,a),o&&c.view.writeBytes(o.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,o=n.length;r<o;r++){const s=n[r],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new xr(this.view.buffer,t.offset);break;case 2:r=new Ye(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new br(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new pe(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new Sr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ke(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,u;const e=this.readSubtables(),t=(a=e.find(f=>f.format===0))==null?void 0:a.view,n=(l=e.find(f=>f.platformID===3&&f.platformSpecificID===3&&f.format===2))==null?void 0:l.view,r=(h=e.find(f=>f.platformID===3&&f.platformSpecificID===1&&f.format===4))==null?void 0:h.view,o=(c=e.find(f=>f.platformID===3&&f.platformSpecificID===10&&f.format===12))==null?void 0:c.view,s=(u=e.find(f=>f.platformID===0&&f.platformSpecificID===5&&f.format===14))==null?void 0:u.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};In([m("uint16")],Oe.prototype,"version",2),In([m("uint16")],Oe.prototype,"numberSubtables",2),Oe=In([dt("cmap")],Oe);class as extends pr{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const o=e[r];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return Pe(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const o=e[r],s={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,r,o){let s;return(t&r)>0?(s=e.view.readUint8(),(t&o)===0&&(s=-s),s=n+s):(t&o)>0?s=n:s=n+e.view.readInt16(),s}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let y=0;y<r;y++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Pe(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let y=0;y<l;++y)h.push(e.view.readUint8());const c=e.view.byteOffset,u=a[a.length-1]+1;Pe(u<2e4,`Bad numberOfCoordinates:${c}`);const f=[];let d,p=0;for(;p<u;)if(d=e.view.readUint8(),f.push(d),p++,d&8&&p<u){const y=e.view.readUint8();for(let g=0;g<y;g++)f.push(d),p++}if(Pe(f.length===u,`Bad flags length: ${f.length}, numberOfCoordinates: ${u}`),a.length>0){const y=[];let g;if(u>0){for(let b=0;b<u;b+=1)d=f[b],g={},g.onCurve=!!(d&1),g.lastPointOfContour=a.includes(b),y.push(g);let M=0;for(let b=0;b<u;b+=1)d=f[b],g=y[b],g.x=this._parseGlyphCoordinate(e,d,M,2,16),M=g.x;let A=0;for(let b=0;b<u;b+=1)d=f[b],g=y[b],g.y=this._parseGlyphCoordinate(e,d,A,4,32),A=g.y}this.points=y}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Pe(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let f=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};f=this._transformPoints([f],d)[0],d.dx=u.x-f.x,d.dy=u.y-f.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],u=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):u.onCurve?o.push({type:"M",x:u.x,y:u.y}):o.push({type:"M",x:(c.x+u.x)*.5,y:(c.y+u.y)*.5});for(let f=0,d=h.length;f<d;++f)if(c=u,u=h[(f+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let p=u;u.onCurve||(p={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class ls extends dr{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new as({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var hs=Object.getOwnPropertyDescriptor,cs=(i,e,t,n)=>{for(var r=n>1?void 0:n?hs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let On=class extends gt{constructor(){super(...arguments);T(this,"_glyphs")}static from(e){const t=e.reduce((r,o)=>r+o.byteLength,0),n=new On(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new ls(this._sfnt))}};On=cs([dt("glyf")],On);var us=Object.getOwnPropertyDescriptor,fs=(i,e,t,n)=>{for(var r=n>1?void 0:n?us(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let Cr=class extends gt{};Cr=fs([dt("GPOS","gpos")],Cr);var ps=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?ds(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ps(e,t,r),r};let Qt=class extends gt{};ie([m("uint16")],Qt.prototype,"majorVersion",2),ie([m("uint16")],Qt.prototype,"minorVersion",2),ie([m("uint16")],Qt.prototype,"scriptListOffset",2),ie([m("uint16")],Qt.prototype,"featureListOffset",2),ie([m("uint16")],Qt.prototype,"lookupListOffset",2),ie([m("uint16")],Qt.prototype,"featureVariationsOffset",2),Qt=ie([dt("GSUB","gsub")],Qt);var gs=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,ot=(i,e,t,n)=>{for(var r=n>1?void 0:n?ys(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gs(e,t,r),r};let st=class extends gt{constructor(i=new ArrayBuffer(54),e){super(i,e,Math.min(54,i.byteLength-(e??0)))}};ot([m("fixed")],st.prototype,"version",2),ot([m("fixed")],st.prototype,"fontRevision",2),ot([m("uint32")],st.prototype,"checkSumAdjustment",2),ot([m("uint32")],st.prototype,"magickNumber",2),ot([m("uint16")],st.prototype,"flags",2),ot([m("uint16")],st.prototype,"unitsPerEm",2),ot([m({type:"longDateTime"})],st.prototype,"created",2),ot([m({type:"longDateTime"})],st.prototype,"modified",2),ot([m("int16")],st.prototype,"xMin",2),ot([m("int16")],st.prototype,"yMin",2),ot([m("int16")],st.prototype,"xMax",2),ot([m("int16")],st.prototype,"yMax",2),ot([m("uint16")],st.prototype,"macStyle",2),ot([m("uint16")],st.prototype,"lowestRecPPEM",2),ot([m("int16")],st.prototype,"fontDirectionHint",2),ot([m("int16")],st.prototype,"indexToLocFormat",2),ot([m("int16")],st.prototype,"glyphDataFormat",2),st=ot([dt("head")],st);var ms=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,bt=(i,e,t,n)=>{for(var r=n>1?void 0:n?xs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ms(e,t,r),r};let yt=class extends gt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};bt([m("fixed")],yt.prototype,"version",2),bt([m("int16")],yt.prototype,"ascent",2),bt([m("int16")],yt.prototype,"descent",2),bt([m("int16")],yt.prototype,"lineGap",2),bt([m("uint16")],yt.prototype,"advanceWidthMax",2),bt([m("int16")],yt.prototype,"minLeftSideBearing",2),bt([m("int16")],yt.prototype,"minRightSideBearing",2),bt([m("int16")],yt.prototype,"xMaxExtent",2),bt([m("int16")],yt.prototype,"caretSlopeRise",2),bt([m("int16")],yt.prototype,"caretSlopeRun",2),bt([m("int16")],yt.prototype,"caretOffset",2),bt([m({type:"int16",size:4})],yt.prototype,"reserved",2),bt([m("int16")],yt.prototype,"metricDataFormat",2),bt([m("uint16")],yt.prototype,"numOfLongHorMetrics",2),yt=bt([dt("hhea")],yt);var vs=Object.getOwnPropertyDescriptor,ws=(i,e,t,n)=>{for(var r=n>1?void 0:n?vs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let En=class extends gt{constructor(){super(...arguments);T(this,"_metrics")}static from(e){const t=e.length*4,n=new En(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((o,s)=>(s<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};En=ws([dt("hmtx")],En);var bs=Object.getOwnPropertyDescriptor,Ss=(i,e,t,n)=>{for(var r=n>1?void 0:n?bs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let Mr=class extends gt{};Mr=Ss([dt("kern","kern")],Mr);var Cs=Object.getOwnPropertyDescriptor,Ms=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let Bn=class extends gt{constructor(){super(...arguments);T(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new Bn(new ArrayBuffer(n));return e.forEach(o=>{t?r.view.writeUint32(o):r.view.writeUint16(o/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};Bn=Ms([dt("loca")],Bn);var Ps=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,mt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ts(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ps(e,t,r),r};let lt=class extends gt{constructor(i=new ArrayBuffer(32),e){super(i,e,Math.min(32,i.byteLength-(e??0)))}};mt([m("fixed")],lt.prototype,"version",2),mt([m("uint16")],lt.prototype,"numGlyphs",2),mt([m("uint16")],lt.prototype,"maxPoints",2),mt([m("uint16")],lt.prototype,"maxContours",2),mt([m("uint16")],lt.prototype,"maxComponentPoints",2),mt([m("uint16")],lt.prototype,"maxComponentContours",2),mt([m("uint16")],lt.prototype,"maxZones",2),mt([m("uint16")],lt.prototype,"maxTwilightPoints",2),mt([m("uint16")],lt.prototype,"maxStorage",2),mt([m("uint16")],lt.prototype,"maxFunctionDefs",2),mt([m("uint16")],lt.prototype,"maxInstructionDefs",2),mt([m("uint16")],lt.prototype,"maxStackElements",2),mt([m("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([m("uint16")],lt.prototype,"maxComponentElements",2),mt([m("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var ks=Object.defineProperty,As=Object.getOwnPropertyDescriptor,Qe=(i,e,t,n)=>{for(var r=n>1?void 0:n?As(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ks(e,t,r),r};const Pr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},Dn={Macintosh:1,Microsoft:3},_s={Default:0},Tr={UCS2:1};let Ee=class extends gt{constructor(){super(...arguments);T(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=Dn.Macintosh,o=_s.Default,s=0;t.some(l=>l.platform===Dn.Microsoft&&l.encoding===Tr.UCS2&&l.language===1033)&&(r=Dn.Microsoft,o=Tr.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===o&&h.language===s&&Pr[h.nameId]&&(a[Pr[h.nameId]]=s===0?Ui(h.name):Fi(h.name))}return a}};Qe([m("uint16")],Ee.prototype,"format",2),Qe([m("uint16")],Ee.prototype,"count",2),Qe([m("uint16")],Ee.prototype,"stringOffset",2),Ee=Qe([dt("name")],Ee);var Is=Object.defineProperty,Os=Object.getOwnPropertyDescriptor,q=(i,e,t,n)=>{for(var r=n>1?void 0:n?Os(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Is(e,t,r),r};let V=class extends gt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};q([m("uint16")],V.prototype,"version",2),q([m("int16")],V.prototype,"xAvgCharWidth",2),q([m("uint16")],V.prototype,"usWeightClass",2),q([m("uint16")],V.prototype,"usWidthClass",2),q([m("uint16")],V.prototype,"fsType",2),q([m("uint16")],V.prototype,"ySubscriptXSize",2),q([m("uint16")],V.prototype,"ySubscriptYSize",2),q([m("uint16")],V.prototype,"ySubscriptXOffset",2),q([m("uint16")],V.prototype,"ySubscriptYOffset",2),q([m("uint16")],V.prototype,"ySuperscriptXSize",2),q([m("uint16")],V.prototype,"ySuperscriptYSize",2),q([m("uint16")],V.prototype,"ySuperscriptXOffset",2),q([m("uint16")],V.prototype,"ySuperscriptYOffset",2),q([m("uint16")],V.prototype,"yStrikeoutSize",2),q([m("uint16")],V.prototype,"yStrikeoutPosition",2),q([m("uint16")],V.prototype,"sFamilyClass",2),q([m({type:"uint8"})],V.prototype,"bFamilyType",2),q([m({type:"uint8"})],V.prototype,"bSerifStyle",2),q([m({type:"uint8"})],V.prototype,"bWeight",2),q([m({type:"uint8"})],V.prototype,"bProportion",2),q([m({type:"uint8"})],V.prototype,"bContrast",2),q([m({type:"uint8"})],V.prototype,"bStrokeVariation",2),q([m({type:"uint8"})],V.prototype,"bArmStyle",2),q([m({type:"uint8"})],V.prototype,"bLetterform",2),q([m({type:"uint8"})],V.prototype,"bMidline",2),q([m({type:"uint8"})],V.prototype,"bXHeight",2),q([m({type:"uint8",size:16})],V.prototype,"ulUnicodeRange",2),q([m({type:"char",size:4})],V.prototype,"achVendID",2),q([m("uint16")],V.prototype,"fsSelection",2),q([m("uint16")],V.prototype,"usFirstCharIndex",2),q([m("uint16")],V.prototype,"usLastCharIndex",2),q([m("int16")],V.prototype,"sTypoAscender",2),q([m("int16")],V.prototype,"sTypoDescender",2),q([m("int16")],V.prototype,"sTypoLineGap",2),q([m("uint16")],V.prototype,"usWinAscent",2),q([m("uint16")],V.prototype,"usWinDescent",2),q([m({offset:72,type:"uint8",size:8})],V.prototype,"ulCodePageRange",2),q([m({offset:72,type:"int16"})],V.prototype,"sxHeight",2),q([m("int16")],V.prototype,"sCapHeight",2),q([m("uint16")],V.prototype,"usDefaultChar",2),q([m("uint16")],V.prototype,"usBreakChar",2),q([m("uint16")],V.prototype,"usMaxContext",2),V=q([dt("OS/2","os2")],V);var Es=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Rt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Bs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Es(e,t,r),r};let Ft=class extends gt{constructor(i=new ArrayBuffer(32),e,t){super(i,e,t)}};Rt([m("fixed")],Ft.prototype,"format",2),Rt([m("fixed")],Ft.prototype,"italicAngle",2),Rt([m("int16")],Ft.prototype,"underlinePosition",2),Rt([m("int16")],Ft.prototype,"underlineThickness",2),Rt([m("uint32")],Ft.prototype,"isFixedPitch",2),Rt([m("uint32")],Ft.prototype,"minMemType42",2),Rt([m("uint32")],Ft.prototype,"maxMemType42",2),Rt([m("uint32")],Ft.prototype,"minMemType1",2),Rt([m("uint32")],Ft.prototype,"maxMemType1",2),Ft=Rt([dt("post")],Ft);var Ds=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,St=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ls(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ds(e,t,r),r};let xt=class extends gt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};St([m("fixed")],xt.prototype,"version",2),St([m("int16")],xt.prototype,"vertTypoAscender",2),St([m("int16")],xt.prototype,"vertTypoDescender",2),St([m("int16")],xt.prototype,"vertTypoLineGap",2),St([m("int16")],xt.prototype,"advanceHeightMax",2),St([m("int16")],xt.prototype,"minTopSideBearing",2),St([m("int16")],xt.prototype,"minBottomSideBearing",2),St([m("int16")],xt.prototype,"yMaxExtent",2),St([m("int16")],xt.prototype,"caretSlopeRise",2),St([m("int16")],xt.prototype,"caretSlopeRun",2),St([m("int16")],xt.prototype,"caretOffset",2),St([m({type:"int16",size:4})],xt.prototype,"reserved",2),St([m("int16")],xt.prototype,"metricDataFormat",2),St([m("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Us=Object.getOwnPropertyDescriptor,Fs=(i,e,t,n)=>{for(var r=n>1?void 0:n?Us(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(r)||r);return r};let Ln=class extends gt{constructor(){super(...arguments);T(this,"_metrics")}static from(e){const t=e.length*4,n=new Ln(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const e=this._sfnt.maxp.numGlyphs,t=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((s,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};Ln=Fs([dt("vmtx")],Ln);var $s=Object.defineProperty,Be=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&$s(e,t,r),r};class $t extends Pn{constructor(){super(...arguments);T(this,"format","TrueType");T(this,"mimeType","font/ttf");T(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ce(t).getUint32(0))}static checksum(t){const n=ce(t);let r=n.byteLength;for(;r%4;)r++;let o=0;for(let s=0,a=r/4;s<a;s+=4)s*4<r-4&&(o+=n.getUint32(s*4,!1));return o&4294967295}static from(t){const n=f=>f+3&-4,r=t.tableViews.size,o=Array.from(t.tableViews.values()).reduce((f,d)=>f+n(d.byteLength),0),s=new this(new ArrayBuffer(12+r*16+o));s.scalerType=65536,s.numTables=r;const a=Math.log(2);s.searchRange=Math.floor(Math.log(r)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=r*16-s.searchRange;let l=12+r*16,h=0;const c=s.getDirectories();t.tableViews.forEach((f,d)=>{const p=c[h++];p.tag=d,p.checkSum=this.checksum(f),p.offset=l,p.length=f.byteLength,s.view.writeBytes(f,l),l+=n(p.length)});const u=s.createSFNT().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Te(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new ue(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}T($t,"signature",new Set([65536,1953658213,1954115633])),Be([m("uint32")],$t.prototype,"scalerType"),Be([m("uint16")],$t.prototype,"numTables"),Be([m("uint16")],$t.prototype,"searchRange"),Be([m("uint16")],$t.prototype,"entrySelector"),Be([m("uint16")],$t.prototype,"rangeShift");class Je extends $t{constructor(){super(...arguments);T(this,"format","OpenType");T(this,"mimeType","font/otf")}static from(t){return super.from(t)}}T(Je,"signature",new Set([1330926671]));var zs=Object.defineProperty,De=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zs(e,t,r),r};class ge extends Ot{constructor(e,t){super(e,t,20)}}De([m({type:"char",size:4})],ge.prototype,"tag"),De([m("uint32")],ge.prototype,"offset"),De([m("uint32")],ge.prototype,"compLength"),De([m("uint32")],ge.prototype,"origLength"),De([m("uint32")],ge.prototype,"origChecksum");var Ns=Object.defineProperty,It=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ns(e,t,r),r};const Pt=(ee=class extends Pn{constructor(){super(...arguments);T(this,"format","WOFF");T(this,"mimeType","font/woff");T(this,"_sfnt")}get subfontFormat(){return $t.is(this.flavor)?"TrueType":Je.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(ce(t).getUint32(0))}static checkSum(t){const n=ce(t),r=n.byteLength,o=Math.floor(r/4);let s=0,a=0;for(;a<o;)s+=n.getUint32(4*a++,!1);let l=r-o*4;if(l){let h=o*4;for(;l>0;)s+=n.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,n=new ArrayBuffer(0)){const r=f=>f+3&-4,o=[];t.tableViews.forEach((f,d)=>{const p=ce(_i(new Uint8Array(f.buffer,f.byteOffset,f.byteLength)));o.push({tag:d,view:p.byteLength<f.byteLength?p:f,rawView:f})});const s=o.length,a=o.reduce((f,d)=>f+r(d.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*s+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSFNTSize=12+16*s+o.reduce((f,d)=>f+r(d.rawView.byteLength),0);let h=44+s*20,c=0;const u=l.getDirectories();return o.forEach(f=>{const d=u[c++];d.tag=f.tag,d.offset=h,d.compLength=f.view.byteLength,d.origChecksum=ee.checkSum(f.rawView),d.origLength=f.rawView.byteLength,l.view.writeBytes(f.view,h),h+=r(d.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new ge(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new ue(this.getDirectories().reduce((t,n)=>{const r=n.tag,o=this.view.byteOffset+n.offset,s=n.compLength,a=n.origLength,l=o+s;return t[r]=s>=a?new DataView(this.view.buffer,o,s):new DataView(Ii(new Uint8Array(this.view.buffer.slice(o,l))).buffer),t},{}))}},T(ee,"signature",new Set([2001684038])),ee);It([m("uint32")],Pt.prototype,"signature"),It([m("uint32")],Pt.prototype,"flavor"),It([m("uint32")],Pt.prototype,"length"),It([m("uint16")],Pt.prototype,"numTables"),It([m("uint16")],Pt.prototype,"reserved"),It([m("uint32")],Pt.prototype,"totalSFNTSize"),It([m("uint16")],Pt.prototype,"majorVersion"),It([m("uint16")],Pt.prototype,"minorVersion"),It([m("uint32")],Pt.prototype,"metaOffset"),It([m("uint32")],Pt.prototype,"metaLength"),It([m("uint32")],Pt.prototype,"metaOrigLength"),It([m("uint32")],Pt.prototype,"privOffset"),It([m("uint32")],Pt.prototype,"privLength");let Un=Pt;function Gs(i,e=!0){if($t.is(i))return new $t(i);if(Je.is(i))return new Je(i);if(Un.is(i))return new Un(i);if(e)throw new Error("Failed to parseFont")}function js(i,e=!0){const t=Gs(i,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}const gn=class gn{constructor(){T(this,"fallbackFont");T(this,"loading",new Map);T(this,"loaded",new Map);T(this,"familyToUrl",new Map)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...gn.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
1
+ (function(W,ft){typeof exports=="object"&&typeof module<"u"?ft(exports):typeof define=="function"&&define.amd?define(["exports"],ft):(W=typeof globalThis<"u"?globalThis:W||self,ft(W.modernText={}))})(this,function(W){"use strict";var Sa=Object.defineProperty;var Ba=(W,ft,jt)=>ft in W?Sa(W,ft,{enumerable:!0,configurable:!0,writable:!0,value:jt}):W[ft]=jt;var E=(W,ft,jt)=>Ba(W,typeof ft!="symbol"?ft+"":ft,jt);var se;function ft(r,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:i,x1:o,y1:s,stops:u}=Xr(e,t.left,t.top,t.width,t.height),a=r.createLinearGradient(n,i,o,s);return u.forEach(l=>a.addColorStop(l.offset,l.color)),a}return e}function jt(r,e,t){r!=null&&r.color&&(r.color=ft(t,r.color,e)),r!=null&&r.backgroundColor&&(r.backgroundColor=ft(t,r.backgroundColor,e)),r!=null&&r.textStrokeColor&&(r.textStrokeColor=ft(t,r.textStrokeColor,e))}function Xr(r,e,t,n,i){var d;const o=((d=r.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",s=o.split(",")[0],u=s.includes("deg")?s:"0deg",a=o.replace(u,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),h=(Number(u.replace("deg",""))||0)*Math.PI/180,c=n*Math.sin(h),f=i*Math.cos(h);return{x0:e+n/2-c,y0:t+i/2+f,x1:e+n/2+c,y1:t+i/2-f,stops:Array.from(a).map(p=>{let g=p[2];return g.startsWith("(")?g=g.split(",").length>3?`rgba${g}`:`rgb${g}`:g=`#${g}`,{offset:Number(p[3].replace("%",""))/100,color:g}})}}function oe(r){const{ctx:e,path:t,fontSize:n,clipRect:i}=r;e.save(),e.beginPath();const o=t.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*n:o.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",shadowOffsetX:(r.shadowOffsetX??0)*n,shadowOffsetY:(r.shadowOffsetY??0)*n,shadowBlur:(r.shadowBlur??0)*n,shadowColor:r.shadowColor};i&&(e.rect(i.left,i.top,i.width,i.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Di(r,e,t){const{left:n,top:i,width:o,height:s}=t,u=r.canvas;u.dataset.viewBox=`${n} ${i} ${o} ${s}`,u.dataset.pixelRatio=String(e);const a=o,l=s;u.width=Math.max(1,Math.ceil(a*e)),u.height=Math.max(1,Math.ceil(l*e)),u.style.width=`${a}px`,u.style.height=`${l}px`,r.clearRect(0,0,u.width,u.height),r.scale(e,e),r.translate(-n,-i)}function gi(r,e){const{paragraphs:t,computedStyle:n,glyphBox:i}=e;jt(n,i,r),t.forEach(o=>{jt(o.computedStyle,o.lineBox,r),o.fragments.forEach(s=>{jt(s.computedStyle,s.inlineBox,r)})})}var pt=Uint8Array,Tt=Uint16Array,An=Int32Array,Xe=new pt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ze=new pt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Pn=new pt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yi=function(r,e){for(var t=new Tt(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new An(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)i[o]=o-t[n]<<5|n;return{b:t,r:i}},mi=yi(Xe,2),xi=mi.b,Tn=mi.r;xi[28]=258,Tn[258]=28;for(var vi=yi(Ze,0),Zr=vi.b,Fi=vi.r,kn=new Tt(32768),Q=0;Q<32768;++Q){var Jt=(Q&43690)>>1|(Q&21845)<<1;Jt=(Jt&52428)>>2|(Jt&13107)<<2,Jt=(Jt&61680)>>4|(Jt&3855)<<4,kn[Q]=((Jt&65280)>>8|(Jt&255)<<8)>>1}for(var Gt=function(r,e,t){for(var n=r.length,i=0,o=new Tt(e);i<n;++i)r[i]&&++o[r[i]-1];var s=new Tt(e);for(i=1;i<e;++i)s[i]=s[i-1]+o[i-1]<<1;var u;if(t){u=new Tt(1<<e);var a=15-e;for(i=0;i<n;++i)if(r[i])for(var l=i<<4|r[i],h=e-r[i],c=s[r[i]-1]++<<h,f=c|(1<<h)-1;c<=f;++c)u[kn[c]>>a]=l}else for(u=new Tt(n),i=0;i<n;++i)r[i]&&(u[i]=kn[s[r[i]-1]++]>>15-r[i]);return u},te=new pt(288),Q=0;Q<144;++Q)te[Q]=8;for(var Q=144;Q<256;++Q)te[Q]=9;for(var Q=256;Q<280;++Q)te[Q]=7;for(var Q=280;Q<288;++Q)te[Q]=8;for(var Se=new pt(32),Q=0;Q<32;++Q)Se[Q]=5;var Yr=Gt(te,9,0),Kr=Gt(te,9,1),Qr=Gt(Se,5,0),Jr=Gt(Se,5,1),_n=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},$t=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},In=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},On=function(r){return(r+7)/8|0},wi=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new pt(r.subarray(e,t))},ts=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(r,e,t){var n=new Error(e||ts[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},es=function(r,e,t,n){var i=r.length,o=0;if(!i||e.f&&!e.l)return t||new pt(0);var s=!t,u=s||e.i!=2,a=e.i;s&&(t=new pt(i*3));var l=function(St){var At=t.length;if(St>At){var ct=new pt(Math.max(At*2,St));ct.set(t),t=ct}},h=e.f||0,c=e.p||0,f=e.b||0,d=e.l,p=e.d,g=e.m,D=e.n,S=i*8;do{if(!d){h=$t(r,c,1);var C=$t(r,c+1,3);if(c+=3,C)if(C==1)d=Kr,p=Jr,g=9,D=5;else if(C==2){var F=$t(r,c,31)+257,w=$t(r,c+10,15)+4,v=F+$t(r,c+5,31)+1;c+=14;for(var O=new pt(v),j=new pt(19),_=0;_<w;++_)j[Pn[_]]=$t(r,c+_*3,7);c+=w*3;for(var L=_n(j),z=(1<<L)-1,I=Gt(j,L,1),_=0;_<v;){var P=I[$t(r,c,z)];c+=P&15;var x=P>>4;if(x<16)O[_++]=x;else{var X=0,T=0;for(x==16?(T=3+$t(r,c,3),c+=2,X=O[_-1]):x==17?(T=3+$t(r,c,7),c+=3):x==18&&(T=11+$t(r,c,127),c+=7);T--;)O[_++]=X}}var U=O.subarray(0,F),R=O.subarray(F);g=_n(U),D=_n(R),d=Gt(U,g,1),p=Gt(R,D,1)}else Ut(1);else{var x=On(c)+4,b=r[x-4]|r[x-3]<<8,m=x+b;if(m>i){a&&Ut(0);break}u&&l(f+b),t.set(r.subarray(x,m),f),e.b=f+=b,e.p=c=m*8,e.f=h;continue}if(c>S){a&&Ut(0);break}}u&&l(f+131072);for(var k=(1<<g)-1,N=(1<<D)-1,M=c;;M=c){var X=d[In(r,c)&k],B=X>>4;if(c+=X&15,c>S){a&&Ut(0);break}if(X||Ut(2),B<256)t[f++]=B;else if(B==256){M=c,d=null;break}else{var $=B-254;if(B>264){var _=B-257,V=Xe[_];$=$t(r,c,(1<<V)-1)+xi[_],c+=V}var H=p[In(r,c)&N],Y=H>>4;H||Ut(3),c+=H&15;var R=Zr[Y];if(Y>3){var V=Ze[Y];R+=In(r,c)&(1<<V)-1,c+=V}if(c>S){a&&Ut(0);break}u&&l(f+131072);var nt=f+$;if(f<R){var Zt=o-R,Ot=Math.min(R,nt);for(Zt+f<0&&Ut(3);f<Ot;++f)t[f]=n[Zt+f]}for(;f<nt;++f)t[f]=t[f-R]}}e.l=d,e.p=M,e.b=f,e.f=h,d&&(h=1,e.m=g,e.d=p,e.n=D)}while(!h);return f!=t.length&&s?wi(t,0,f):t.subarray(0,f)},Yt=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8},Be=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8,r[n+2]|=t>>16},Ln=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,o=t.slice();if(!i)return{t:Si,l:0};if(i==1){var s=new pt(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(m,F){return m.f-F.f}),t.push({s:-1,f:25001});var u=t[0],a=t[1],l=0,h=1,c=2;for(t[0]={s:-1,f:u.f+a.f,l:u,r:a};h!=i-1;)u=t[t[l].f<t[c].f?l++:c++],a=t[l!=h&&t[l].f<t[c].f?l++:c++],t[h++]={s:-1,f:u.f+a.f,l:u,r:a};for(var f=o[0].s,n=1;n<i;++n)o[n].s>f&&(f=o[n].s);var d=new Tt(f+1),p=$n(t[h-1],d,0);if(p>e){var n=0,g=0,D=p-e,S=1<<D;for(o.sort(function(F,w){return d[w.s]-d[F.s]||F.f-w.f});n<i;++n){var C=o[n].s;if(d[C]>e)g+=S-(1<<p-d[C]),d[C]=e;else break}for(g>>=D;g>0;){var x=o[n].s;d[x]<e?g-=1<<e-d[x]++-1:++n}for(;n>=0&&g;--n){var b=o[n].s;d[b]==e&&(--d[b],++g)}p=e}return{t:new pt(d),l:p}},$n=function(r,e,t){return r.s==-1?Math.max($n(r.l,e,t+1),$n(r.r,e,t+1)):e[r.s]=t},Ci=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Tt(++e),n=0,i=r[0],o=1,s=function(a){t[n++]=a},u=1;u<=e;++u)if(r[u]==i&&u!=e)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=r[u]}return{c:t.subarray(0,n),n:e}},Me=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},bi=function(r,e,t){var n=t.length,i=On(e+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var o=0;o<n;++o)r[i+o+4]=t[o];return(i+4+n)*8},Ei=function(r,e,t,n,i,o,s,u,a,l,h){Yt(e,h++,t),++i[256];for(var c=Ln(i,15),f=c.t,d=c.l,p=Ln(o,15),g=p.t,D=p.l,S=Ci(f),C=S.c,x=S.n,b=Ci(g),m=b.c,F=b.n,w=new Tt(19),v=0;v<C.length;++v)++w[C[v]&31];for(var v=0;v<m.length;++v)++w[m[v]&31];for(var O=Ln(w,7),j=O.t,_=O.l,L=19;L>4&&!j[Pn[L-1]];--L);var z=l+5<<3,I=Me(i,te)+Me(o,Se)+s,P=Me(i,f)+Me(o,g)+s+14+3*L+Me(w,j)+2*w[16]+3*w[17]+7*w[18];if(a>=0&&z<=I&&z<=P)return bi(e,h,r.subarray(a,a+l));var X,T,U,R;if(Yt(e,h,1+(P<I)),h+=2,P<I){X=Gt(f,d,0),T=f,U=Gt(g,D,0),R=g;var k=Gt(j,_,0);Yt(e,h,x-257),Yt(e,h+5,F-1),Yt(e,h+10,L-4),h+=14;for(var v=0;v<L;++v)Yt(e,h+3*v,j[Pn[v]]);h+=3*L;for(var N=[C,m],M=0;M<2;++M)for(var B=N[M],v=0;v<B.length;++v){var $=B[v]&31;Yt(e,h,k[$]),h+=j[$],$>15&&(Yt(e,h,B[v]>>5&127),h+=B[v]>>12)}}else X=Yr,T=te,U=Qr,R=Se;for(var v=0;v<u;++v){var V=n[v];if(V>255){var $=V>>18&31;Be(e,h,X[$+257]),h+=T[$+257],$>7&&(Yt(e,h,V>>23&31),h+=Xe[$]);var H=V&31;Be(e,h,U[H]),h+=R[H],H>3&&(Be(e,h,V>>5&8191),h+=Ze[H])}else Be(e,h,X[V]),h+=T[V]}return Be(e,h,X[256]),h+T[256]},ns=new An([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Si=new pt(0),is=function(r,e,t,n,i,o){var s=o.z||r.length,u=new pt(n+s+5*(1+Math.ceil(s/7e3))+i),a=u.subarray(n,u.length-i),l=o.l,h=(o.r||0)&7;if(e){h&&(a[0]=o.r>>3);for(var c=ns[e-1],f=c>>13,d=c&8191,p=(1<<t)-1,g=o.p||new Tt(32768),D=o.h||new Tt(p+1),S=Math.ceil(t/3),C=2*S,x=function(Pt){return(r[Pt]^r[Pt+1]<<S^r[Pt+2]<<C)&p},b=new An(25e3),m=new Tt(288),F=new Tt(32),w=0,v=0,O=o.i||0,j=0,_=o.w||0,L=0;O+2<s;++O){var z=x(O),I=O&32767,P=D[z];if(g[I]=P,D[z]=I,_<=O){var X=s-O;if((w>7e3||j>24576)&&(X>423||!l)){h=Ei(r,a,0,b,m,F,v,j,L,O-L,h),j=w=v=0,L=O;for(var T=0;T<286;++T)m[T]=0;for(var T=0;T<30;++T)F[T]=0}var U=2,R=0,k=d,N=I-P&32767;if(X>2&&z==x(O-N))for(var M=Math.min(f,X)-1,B=Math.min(32767,O),$=Math.min(258,X);N<=B&&--k&&I!=P;){if(r[O+U]==r[O+U-N]){for(var V=0;V<$&&r[O+V]==r[O+V-N];++V);if(V>U){if(U=V,R=N,V>M)break;for(var H=Math.min(N,V-2),Y=0,T=0;T<H;++T){var nt=O-N+T&32767,Zt=g[nt],Ot=nt-Zt&32767;Ot>Y&&(Y=Ot,P=nt)}}}I=P,P=g[I],N+=I-P&32767}if(R){b[j++]=268435456|Tn[U]<<18|Fi[R];var St=Tn[U]&31,At=Fi[R]&31;v+=Xe[St]+Ze[At],++m[257+St],++F[At],_=O+U,++w}else b[j++]=r[O],++m[r[O]]}}for(O=Math.max(O,_);O<s;++O)b[j++]=r[O],++m[r[O]];h=Ei(r,a,l,b,m,F,v,j,L,O-L,h),l||(o.r=h&7|a[h/8|0]<<3,h-=7,o.h=D,o.p=g,o.i=O,o.w=_)}else{for(var O=o.w||0;O<s+l;O+=65535){var ct=O+65535;ct>=s&&(a[h/8|0]=l,ct=s),h=bi(a,h+1,r.subarray(O,ct))}o.i=s}return wi(u,0,n+On(h)+i)},Bi=function(){var r=1,e=0;return{p:function(t){for(var n=r,i=e,o=t.length|0,s=0;s!=o;){for(var u=Math.min(s+2655,o);s<u;++s)i+=n+=t[s];n=(n&65535)+15*(n>>16),i=(i&65535)+15*(i>>16)}r=n,e=i},d:function(){return r%=65521,e%=65521,(r&255)<<24|(r&65280)<<8|(e&255)<<8|e>>8}}},rs=function(r,e,t,n,i){if(!i&&(i={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new pt(o.length+r.length);s.set(o),s.set(r,o.length),r=s,i.w=o.length}return is(r,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,t,n,i)},Mi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8},ss=function(r,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(r[0]=120,r[1]=n<<6|(e.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,e.dictionary){var i=Bi();i.p(e.dictionary),Mi(r,2,i.d())}},os=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&Ut(6,"invalid zlib data"),(r[1]>>5&1)==1&&Ut(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function us(r,e){e||(e={});var t=Bi();t.p(r);var n=rs(r,e,e.dictionary?6:2,4);return ss(n,e),Mi(n,n.length-4,t.d()),n}function as(r,e){return es(r.subarray(os(r),-4),{i:2},e,e)}var ls=typeof TextDecoder<"u"&&new TextDecoder,hs=0;try{ls.decode(Si,{stream:!0}),hs=1}catch{}const cs="modern-font";function Ae(r,e){if(!r)throw new Error(`[${cs}] ${e}`)}function fs(r){if("buffer"in r){const e=r.buffer;return r.byteOffset>0||r.byteLength<r.buffer.byteLength?e.slice(r.byteOffset,r.byteOffset+r.byteLength):e}else return r}function de(r){return"buffer"in r?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(r)}function ps(r){let e="";for(let t=0,n=r.length,i;t<n;t++)i=r.charCodeAt(t),i!==0&&(e+=String.fromCharCode(i));return e}function Ye(r){r=ps(r);const e=[];for(let t=0,n=r.length,i;t<n;t++)i=r.charCodeAt(t),e.push(i>>8),e.push(i&255);return e}function ds(r){let e="";for(let t=0,n=r.length;t<n;t++)r[t]<127?e+=String.fromCharCode(r[t]):e+=`%${(256+r[t]).toString(16).slice(1)}`;return unescape(e)}function Ds(r){let e="";for(let t=0,n=r.length;t<n;t+=2)e+=String.fromCharCode((r[t]<<8)+r[t+1]);return e}var gs=Object.defineProperty,dt=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&gs(e,t,i),i};const Ke={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function Dt(){return function(r,e){Object.defineProperty(r.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,i,o){super(fs(t),n,i);E(this,"cursor",0);this.littleEndian=o}readColumn(t){if(t.size){const n=Array.from({length:t.size},(i,o)=>this.read(t.type,t.offset+o));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(i,o)=>{this.write(t.type,n[o],t.offset+o)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,i=this.littleEndian){var l;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,i);case"longDateTime":return this.readLongDateTime(n,i)}const o=`get${t.replace(/^\S/,h=>h.toUpperCase())}`,s=this,u=(l=s[o])==null?void 0:l.bind(s),a=u==null?void 0:u(n,i);return this.cursor+=Ke[t],a}readUint24(t=this.cursor){const[n,i,o]=this.readBytes(t,3);return(n<<16)+(i<<8)+o}readBytes(t,n){n==null&&(n=t,t=this.cursor);const i=[];for(let o=0;o<n;++o)i.push(this.getUint8(t+o));return this.cursor=t+n,i}readString(t,n){const i=this.readBytes(t,n);let o="";for(let s=0,u=i.length;s<u;s++)o+=String.fromCharCode(i[s]);return o}readFixed(t,n){const i=this.readInt32(t,n)/65536;return Math.ceil(i*1e5)/1e5}readLongDateTime(t=this.cursor,n){const i=this.readUint32(t+4,n),o=new Date;return o.setTime(i*1e3+-20775456e5),o}readChar(t){return this.readString(t,1)}write(t,n,i=this.cursor,o=this.littleEndian){var h;switch(t){case"char":return this.writeChar(n,i);case"fixed":return this.writeFixed(n,i);case"longDateTime":return this.writeLongDateTime(n,i)}const s=`set${t.replace(/^\S/,c=>c.toUpperCase())}`,u=this,a=(h=u[s])==null?void 0:h.bind(u),l=a==null?void 0:a(i,n,o);return this.cursor+=Ke[t.toLowerCase()],l}writeString(t="",n=this.cursor){const i=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let o=0,s=t.length,u;o<s;++o)u=t.charCodeAt(o)||0,u>127?this.writeUint16(u):this.writeUint8(u);return this.cursor+=i,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const o=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(o,n+4),this}writeBytes(t,n=this.cursor){let i;if(Array.isArray(t)){i=t.length;for(let o=0;o<i;++o)this.setUint8(n+o,t[o])}else{const o=de(t);i=o.byteLength;for(let s=0;s<i;++s)this.setUint8(n+s,o.getUint8(s))}return this.cursor=n+i,this}seek(t){return this.cursor=t,this}}dt([Dt()],at.prototype,"readInt8"),dt([Dt()],at.prototype,"readInt16"),dt([Dt()],at.prototype,"readInt32"),dt([Dt()],at.prototype,"readUint8"),dt([Dt()],at.prototype,"readUint16"),dt([Dt()],at.prototype,"readUint32"),dt([Dt()],at.prototype,"readFloat32"),dt([Dt()],at.prototype,"readFloat64"),dt([Dt()],at.prototype,"writeInt8"),dt([Dt()],at.prototype,"writeInt16"),dt([Dt()],at.prototype,"writeInt32"),dt([Dt()],at.prototype,"writeUint8"),dt([Dt()],at.prototype,"writeUint16"),dt([Dt()],at.prototype,"writeUint32"),dt([Dt()],at.prototype,"writeFloat32"),dt([Dt()],at.prototype,"writeFloat64");const Ai=new WeakMap;function y(r){const e=typeof r=="object"?r:{type:r},{size:t=1,type:n}=e;return(i,o)=>{if(typeof o!="string")return;let s=Ai.get(i);s||(s={columns:[],byteLength:0},Ai.set(i,s));const u={...e,name:o,byteLength:t*Ke[n],offset:e.offset??s.columns.reduce((a,l)=>a+l.byteLength,0)};s.columns.push(u),s.byteLength=s.columns.reduce((a,l)=>a+Ke[l.type]*(l.size??1),0),Object.defineProperty(i.constructor.prototype,o,{get(){return this.view.readColumn(u)},set(a){this.view.writeColumn(u,a)},configurable:!0,enumerable:!0})}}class _t{constructor(e,t,n,i){E(this,"view");this.view=new at(e,t,n,i)}}class Un extends _t{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var ys=Object.defineProperty,Ft=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&ys(e,t,i),i};const wt=class Gr extends Un{constructor(){super(...arguments);E(this,"format","EmbeddedOpenType");E(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,o=n.name.names,s=Ye(o.fontFamily||""),u=s.length,a=Ye(o.fontStyle||""),l=a.length,h=Ye(o.version||""),c=h.length,f=Ye(o.fullName||""),d=f.length,p=86+u+4+l+4+c+4+d+2+t.view.byteLength,g=new Gr(new ArrayBuffer(p),0,p,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=n.head.checkSumAdjustment;const D=n.os2;return D&&(g.FontPANOSE=D.fontPANOSE,g.Italic=D.fsSelection,g.Weight=D.usWeightClass,g.fsType=D.fsType,g.UnicodeRange=D.ulUnicodeRange,g.CodePageRange=D.ulCodePageRange),g.view.writeUint16(u),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(f),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Ft([y("uint32")],wt.prototype,"EOTSize"),Ft([y("uint32")],wt.prototype,"FontDataSize"),Ft([y("uint32")],wt.prototype,"Version"),Ft([y("uint32")],wt.prototype,"Flags"),Ft([y({type:"uint8",size:10})],wt.prototype,"FontPANOSE"),Ft([y("uint8")],wt.prototype,"Charset"),Ft([y("uint8")],wt.prototype,"Italic"),Ft([y("uint32")],wt.prototype,"Weight"),Ft([y("uint16")],wt.prototype,"fsType"),Ft([y("uint16")],wt.prototype,"MagicNumber"),Ft([y({type:"uint8",size:16})],wt.prototype,"UnicodeRange"),Ft([y({type:"uint8",size:8})],wt.prototype,"CodePageRange"),Ft([y("uint32")],wt.prototype,"CheckSumAdjustment"),Ft([y({type:"uint8",size:16})],wt.prototype,"Reserved"),Ft([y("uint16")],wt.prototype,"Padding1");var ms=Object.defineProperty,Qe=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&ms(e,t,i),i};class Pe extends _t{constructor(e,t){super(e,t,16)}}Qe([y({type:"char",size:4})],Pe.prototype,"tag"),Qe([y("uint32")],Pe.prototype,"checkSum"),Qe([y("uint32")],Pe.prototype,"offset"),Qe([y("uint32")],Pe.prototype,"length");const Vn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],xs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class Pi{constructor(e){E(this,"index");E(this,"name");E(this,"isComposite",!1);E(this,"components",[]);E(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,i={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*n,{xScale:u=s,yScale:a=s}=i,l=this.pathCommands,h=[];for(let c=0,f=l.length;c<f;c+=1){const d=l[c];d.type==="M"?h.push({type:"M",x:e+d.x*u,y:t+-d.y*a}):d.type==="L"?h.push({type:"L",x:e+d.x*u,y:t+-d.y*a}):d.type==="Q"?h.push({type:"Q",x1:e+d.x1*u,y1:t+-d.y1*a,x:e+d.x*u,y:t+-d.y*a}):d.type==="C"?h.push({type:"C",x1:e+d.x1*u,y1:t+-d.y1*a,x2:e+d.x2*u,y2:t+-d.y2*a,x:e+d.x*u,y:t+-d.y*a}):d.type==="Z"&&h.push({type:"Z"})}return h}}class vs extends Pi{parse(e,t,n){const i=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:u,subrsBias:a}=e,l=e.topDict.paintType,h=this.index;let c,f,d,p;const g=[],D=[];let S=0,C=!1,x=!1,b=s,m=0,F=0;function w(I,P){g.push({type:"L",x:I,y:P})}function v(I,P,X,T,U,R){g.push({type:"C",x1:I,y1:P,x2:X,y2:T,x:U,y:R})}function O(I,P){x&&l!==2&&j(),x=!0,g.push({type:"M",x:I,y:P})}function j(){g.push({type:"Z"})}function _(I){g.push(...I)}function L(){D.length%2!==0&&!C&&(b=D.shift()+o),S+=D.length>>1,D.length=0,C=!0}function z(I){let P,X,T,U,R,k,N,M,B,$,V,H,Y=0;for(;Y<I.length;){let nt=I[Y++];switch(nt){case 1:L();break;case 3:L();break;case 4:D.length>1&&!C&&(b=D.shift()+o,C=!0),F+=D.pop(),O(m,F);break;case 5:for(;D.length>0;)m+=D.shift(),F+=D.shift(),w(m,F);break;case 6:for(;D.length>0&&(m+=D.shift(),w(m,F),D.length!==0);)F+=D.shift(),w(m,F);break;case 7:for(;D.length>0&&(F+=D.shift(),w(m,F),D.length!==0);)m+=D.shift(),w(m,F);break;case 8:for(;D.length>0;)c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p+D.shift(),v(c,f,d,p,m,F);break;case 10:R=D.pop()+a,k=e.subrs[R],k&&z(k);break;case 11:return;case 12:switch(nt=I[Y],Y+=1,nt){case 35:c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),N=d+D.shift(),M=p+D.shift(),B=N+D.shift(),$=M+D.shift(),V=B+D.shift(),H=$+D.shift(),m=V+D.shift(),F=H+D.shift(),D.shift(),v(c,f,d,p,N,M),v(B,$,V,H,m,F);break;case 34:c=m+D.shift(),f=F,d=c+D.shift(),p=f+D.shift(),N=d+D.shift(),M=p,B=N+D.shift(),$=p,V=B+D.shift(),H=F,m=V+D.shift(),v(c,f,d,p,N,M),v(B,$,V,H,m,F);break;case 36:c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),N=d+D.shift(),M=p,B=N+D.shift(),$=p,V=B+D.shift(),H=$+D.shift(),m=V+D.shift(),v(c,f,d,p,N,M),v(B,$,V,H,m,F);break;case 37:c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),N=d+D.shift(),M=p+D.shift(),B=N+D.shift(),$=M+D.shift(),V=B+D.shift(),H=$+D.shift(),Math.abs(V-m)>Math.abs(H-F)?m=V+D.shift():F=H+D.shift(),v(c,f,d,p,N,M),v(B,$,V,H,m,F);break;default:console.warn(`Glyph ${h}: unknown operator ${1200+nt}`),D.length=0}break;case 14:if(D.length>=4){const Zt=Vn[D.pop()],Ot=Vn[D.pop()],St=D.pop(),At=D.pop();if(Zt&&Ot){i.isComposite=!0,i.components=[];const ct=e.charset.indexOf(Zt),Pt=e.charset.indexOf(Ot);i.components.push({glyphIndex:Pt,dx:0,dy:0}),i.components.push({glyphIndex:ct,dx:At,dy:St}),_(n.get(Pt).pathCommands);const Nt=JSON.parse(JSON.stringify(n.get(ct).pathCommands));for(let Rt=0;Rt<Nt.length;Rt+=1){const Lt=Nt[Rt];Lt.type!=="Z"&&(Lt.x+=At,Lt.y+=St),(Lt.type==="Q"||Lt.type==="C")&&(Lt.x1+=At,Lt.y1+=St),Lt.type==="C"&&(Lt.x2+=At,Lt.y2+=St)}_(Nt)}}else D.length>0&&!C&&(b=D.shift()+o,C=!0);x&&l!==2&&(j(),x=!1);break;case 18:L();break;case 19:case 20:L(),Y+=S+7>>3;break;case 21:D.length>2&&!C&&(b=D.shift()+o,C=!0),F+=D.pop(),m+=D.pop(),O(m,F);break;case 22:D.length>1&&!C&&(b=D.shift()+o,C=!0),m+=D.pop(),O(m,F);break;case 23:L();break;case 24:for(;D.length>2;)c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p+D.shift(),v(c,f,d,p,m,F);m+=D.shift(),F+=D.shift(),w(m,F);break;case 25:for(;D.length>6;)m+=D.shift(),F+=D.shift(),w(m,F);c=m+D.shift(),f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p+D.shift(),v(c,f,d,p,m,F);break;case 26:for(D.length%2&&(m+=D.shift());D.length>0;)c=m,f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d,F=p+D.shift(),v(c,f,d,p,m,F);break;case 27:for(D.length%2&&(F+=D.shift());D.length>0;)c=m+D.shift(),f=F,d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p,v(c,f,d,p,m,F);break;case 28:P=I[Y],X=I[Y+1],D.push((P<<24|X<<16)>>16),Y+=2;break;case 29:R=D.pop()+u,k=e.gsubrs[R],k&&z(k);break;case 30:for(;D.length>0&&(c=m,f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p+(D.length===1?D.shift():0),v(c,f,d,p,m,F),D.length!==0);)c=m+D.shift(),f=F,d=c+D.shift(),p=f+D.shift(),F=p+D.shift(),m=d+(D.length===1?D.shift():0),v(c,f,d,p,m,F);break;case 31:for(;D.length>0&&(c=m+D.shift(),f=F,d=c+D.shift(),p=f+D.shift(),F=p+D.shift(),m=d+(D.length===1?D.shift():0),v(c,f,d,p,m,F),D.length!==0);)c=m,f=F+D.shift(),d=c+D.shift(),p=f+D.shift(),m=d+D.shift(),F=p+(D.length===1?D.shift():0),v(c,f,d,p,m,F);break;default:nt<32?console.warn(`Glyph ${h}: unknown operator ${nt}`):nt<247?D.push(nt-139):nt<251?(P=I[Y],Y+=1,D.push((nt-247)*256+P+108)):nt<255?(P=I[Y],Y+=1,D.push(-(nt-251)*256-P-108)):(P=I[Y],X=I[Y+1],T=I[Y+2],U=I[Y+3],Y+=4,D.push((P<<24|X<<16|T<<8|U)/65536))}}}z(t),this.pathCommands=g,C&&(this.advanceWidth=b)}}class Ti{constructor(e){E(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const i=this._sfnt.hmtx.metrics[e];i&&(n.advanceWidth=n.advanceWidth||i.advanceWidth,n.leftSideBearing=n.leftSideBearing||i.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);o&&(n.unicode??(n.unicode=o[0]),n.unicodes??(n.unicodes=o)),this._items[e]=n}return n}}class Fs extends Ti{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new vs({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var ws=Object.defineProperty,ki=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&ws(e,t,i),i};class Je extends _t{constructor(t,n,i,o){super(t,n,i,o);E(this,"_offsets");E(this,"_objects");this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,n=this.count,i=this.offsetSize;this.objectOffset=(n+1)*i+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,i=this.offsetSize;t.seek(3);const o=[];for(let s=0,u=n+1;s<u;s++){const a=this.view;let l=0;for(let h=0;h<i;h++)l<<=8,l+=a.readUint8();o.push(l)}return o}readObjects(){const t=[];for(let n=0,i=this.count;n<i;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,i=this.objectOffset,o=i+n[t],u=i+n[t+1]-o;return this._isString?this.view.readString(o,u):this.view.readBytes(o,u)}}ki([y("uint16")],Je.prototype,"count"),ki([y("uint8")],Je.prototype,"offsetSize");class tn extends Je{constructor(){super(...arguments);E(this,"_isString",!1)}}class _i extends Je{constructor(){super(...arguments);E(this,"_isString",!0)}}const Cs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],bs=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Es=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Ss=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function en(r,e){return e<=390?Cs[e]:r[e-391]}function J(r,e="number",t){return(n,i)=>{if(typeof i!="string")return;const o={type:e,operator:r,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,i,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class Ii extends _t{constructor(){super(...arguments);E(this,"_dict");E(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const i=15,o=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),u=s>>4,a=s&15;if(u===i||(n+=o[u],a===i))break;n+=o[a]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let i,o,s,u;if(t===28)return i=n.readUint8(),o=n.readUint8(),i<<8|o;if(t===29)return i=n.readUint8(),o=n.readUint8(),s=n.readUint8(),u=n.readUint8(),i<<24|o<<16|s<<8|u;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return i=n.readUint8(),(t-247)*256+i+108;if(t>=251&&t<=254)return i=n.readUint8(),-(t-251)*256-i-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const i=t.cursor+t.byteLength,o={};for(;t.cursor<i;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),o[s]=n,n=[]):n.push(this._readOperand(s))}return o}_getProp(t){var i;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return en(((i=this._stringIndex)==null?void 0:i.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Bs=Object.defineProperty,zn=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Bs(e,t,i),i};class nn extends Ii{}zn([J(19)],nn.prototype,"subrs"),zn([J(20)],nn.prototype,"defaultWidthX"),zn([J(21)],nn.prototype,"nominalWidthX");var Ms=Object.defineProperty,it=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Ms(e,t,i),i};class et extends Ii{}it([J(0,"string")],et.prototype,"version"),it([J(1,"string")],et.prototype,"notice"),it([J(1200,"string")],et.prototype,"copyright"),it([J(2,"string")],et.prototype,"fullName"),it([J(3,"string")],et.prototype,"familyName"),it([J(4,"string")],et.prototype,"weight"),it([J(1201)],et.prototype,"isFixedPitch"),it([J(1202)],et.prototype,"italicAngle"),it([J(1203,"number",-100)],et.prototype,"underlinePosition"),it([J(1204,"number",50)],et.prototype,"underlineThickness"),it([J(1205)],et.prototype,"paintType"),it([J(1206,"number",2)],et.prototype,"charstringType"),it([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),it([J(13)],et.prototype,"uniqueId"),it([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),it([J(1208)],et.prototype,"strokeWidth"),it([J(14)],et.prototype,"xuid"),it([J(15)],et.prototype,"charset"),it([J(16)],et.prototype,"encoding"),it([J(17)],et.prototype,"charStrings"),it([J(18,"number[]",[0,0])],et.prototype,"private");function gt(r,e=r){return t=>{De.tableDefinitions.set(r,{tag:r,prop:e,class:t}),Object.defineProperty(De.prototype,e,{get(){return this.get(r)},set(n){return this.set(r,n)},configurable:!0,enumerable:!0})}}const pe=class pe{constructor(e){E(this,"tables",new Map);E(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,i)=>{this.tableViews.set(i,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:i}=this.cff;t=i.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),i=n.length,o=Array.from({length:i}),s=t.get(0);for(let u=0;u<i;u+=1)o[u]=t.get(n[u])||s;return o}getPathCommands(e,t,n,i,o){const s=[];return this.forEachGlyph(e,t,n,i,o,(u,a,l,h,c)=>{s.push(...u.getPathCommands(a,l,h,c,this))}),s}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,i=72,o={},s){const u=1/this.unitsPerEm*i,a=this.textToGlyphs(e);for(let l=0;l<a.length;l+=1){const h=a[l];s.call(this,h,t,n,i,o),h.advanceWidth&&(t+=h.advanceWidth*u),o.letterSpacing?t+=o.letterSpacing*i:o.tracking&&(t+=o.tracking/1e3*i)}return t}clone(){return new pe(this.tableViews)}delete(e){const t=pe.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=pe.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=pe.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const i=t.class;if(i){const o=this.tableViews.get(e);if(!o)return;n=new i(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(t.prop,n)}}return n}};E(pe,"tableDefinitions",new Map);let De=pe;class yt extends _t{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var As=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Te=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ps(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&As(e,t,i),i};let ge=class extends yt{constructor(e,t,n,i){super(e,t,n,i);E(this,"_glyphs");E(this,"privateDict");E(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Fs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,i=n+4;this.nameIndex=new _i(t,i),this.topDictIndex=new tn(t,this.nameIndex.endOffset),this.stringIndex=new _i(t,this.topDictIndex.endOffset),this.globalSubrIndex=new tn(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new nn(t,n+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new tn(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new tn(t,n+this.topDict.charStrings);const u=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=bs:this.topDict.charset===1?this.charset=Es:this.topDict.charset===2?this.charset=Ss:this.charset=this._readCharset(n+this.topDict.charset,u,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Vn:this.topDict.encoding===1?this.encoding=xs:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const i=this.view;i.seek(e);let o,s,u;t-=1;const a=[".notdef"],l=i.readUint8();if(l===0)for(o=0;o<t;o+=1)s=i.readUint16(),a.push(en(n,s));else if(l===1)for(;a.length<=t;)for(s=i.readUint16(),u=i.readUint8(),o=0;o<=u;o+=1)a.push(en(n,s)),s+=1;else if(l===2)for(;a.length<=t;)for(s=i.readUint16(),u=i.readUint16(),o=0;o<=u;o+=1)a.push(en(n,s)),s+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(e){const t=this.view;t.seek(e);let n,i;const o={},s=t.readUint8();if(s===0){const u=t.readUint8();for(n=0;n<u;n+=1)i=t.readUint8(),o[i]=n}else if(s===1){const u=t.readUint8();for(i=1,n=0;n<u;n+=1){const a=t.readUint8(),l=t.readUint8();for(let h=a;h<=a+l;h+=1)o[h]=i,i+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Te([y("uint8")],ge.prototype,"majorVersion",2),Te([y("uint8")],ge.prototype,"minorVersion",2),Te([y("uint8")],ge.prototype,"headerSize",2),Te([y("uint8")],ge.prototype,"offsetSize",2),ge=Te([gt("CFF ","cff")],ge);var Ts=Object.defineProperty,rn=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Ts(e,t,i),i};const ke=class qr extends _t{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new qr;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,i)=>{i<256&&n<256&&t.view.writeUint8(n,6+i)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};rn([y("uint16")],ke.prototype,"format"),rn([y("uint16")],ke.prototype,"length"),rn([y("uint16")],ke.prototype,"language"),rn([y({type:"uint8",size:256})],ke.prototype,"glyphIndexArray");let Oi=ke;var ks=Object.defineProperty,Nn=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&ks(e,t,i),i};class sn extends _t{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,i=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,u=n.findIndex(l=>l===i);let a=0;for(let l=0;l<256;l++)if(n[l]===0)l>=u||l<o[0].firstCode||l>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(l-o[0].firstCode)>=s.length?a=0:(a=s[o[0].idRangeOffset+(l-o[0].firstCode)],a!==0&&(a=a+o[0].idDelta)),a!==0&&a<e&&t.set(l,a);else{const h=n[l];for(let c=0,f=o[h].entryCount;c<f;c++)if(o[h].idRangeOffset+c>=s.length?a=0:(a=s[o[h].idRangeOffset+c],a!==0&&(a=a+o[h].idDelta)),a!==0&&a<e){const d=(l<<8|c+o[h].firstCode)%65535;t.set(d,a)}}return t}}Nn([y("uint16")],sn.prototype,"format"),Nn([y("uint16")],sn.prototype,"length"),Nn([y("uint16")],sn.prototype,"language");function Li(r){return r>32767?r-65536:r<-32767?r+65536:r}function $i(r,e){let t;const n=[];let i={};return r.forEach((o,s)=>{e&&s>e||((!t||s!==t.unicode+1||o!==t.glyphIndex+1)&&(t?(i.end=t.unicode,n.push(i),i={start:s,startId:o,delta:Li(o-s)}):(i.start=Number(s),i.startId=o,i.delta=Li(o-s))),t={unicode:s,glyphIndex:o})}),t&&(i.end=t.unicode,n.push(i)),n}var _s=Object.defineProperty,ue=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&_s(e,t,i),i};const ee=class Wr extends _t{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=$i(e,65535),n=t.length+1,i=Math.floor(Math.log(n)/Math.LN2),o=2*2**i,s=new Wr(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=i,s.rangeShift=2*n-o,s.endCode=[...t.map(u=>u.end),65535],s.reservedPad=0,s.startCode=[...t.map(u=>u.start),65535],s.idDelta=[...t.map(u=>u.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,o=this.endCode,s=this.idRangeOffset,u=this.idDelta,a=this.glyphIndexArray;for(let l=0;l<t;++l)for(let h=i[l],c=o[l];h<=c;++h)if(s[l]===0)e.set(h,(h+u[l])%65536);else{const f=l+s[l]/2+(h-i[l])-n,d=a[f];d!==0?e.set(h,(d+u[l])%65536):e.set(h,0)}return e.delete(65535),e}};ue([y("uint16")],ee.prototype,"format"),ue([y("uint16")],ee.prototype,"length"),ue([y("uint16")],ee.prototype,"language"),ue([y("uint16")],ee.prototype,"segCountX2"),ue([y("uint16")],ee.prototype,"searchRange"),ue([y("uint16")],ee.prototype,"entrySelector"),ue([y("uint16")],ee.prototype,"rangeShift");let Ui=ee;var Is=Object.defineProperty,_e=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Is(e,t,i),i};class ye extends _t{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,i)=>{t.set(i,n)}),t}}_e([y("uint16")],ye.prototype,"format"),_e([y("uint16")],ye.prototype,"length"),_e([y("uint16")],ye.prototype,"language"),_e([y("uint16")],ye.prototype,"firstCode"),_e([y("uint16")],ye.prototype,"entryCount");var Os=Object.defineProperty,Ie=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Os(e,t,i),i};const me=class Hr extends _t{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=$i(e),n=new Hr(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(i=>{n.view.writeUint32(i.start),n.view.writeUint32(i.end),n.view.writeUint32(i.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,i=t.length;n<i;n++){const o=t[n];let s=o.startGlyphCode,u=o.startCharCode;const a=o.endCharCode;for(;u<=a;)e.set(u++,s++)}return e}};Ie([y("uint16")],me.prototype,"format"),Ie([y("uint16")],me.prototype,"reserved"),Ie([y("uint32")],me.prototype,"length"),Ie([y("uint32")],me.prototype,"language"),Ie([y("uint32")],me.prototype,"nGroups");let Vi=me;var Ls=Object.defineProperty,Rn=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&Ls(e,t,i),i};class on extends _t{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,i=t.length;n<i;n++){const{uVSMappings:o}=t[n];o.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}Rn([y("uint16")],on.prototype,"format"),Rn([y("uint32")],on.prototype,"length"),Rn([y("uint32")],on.prototype,"numVarSelectorRecords");var $s=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,jn=(r,e,t,n)=>{for(var i=n>1?void 0:n?Us(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&$s(e,t,i),i};let Oe=class extends yt{constructor(){super(...arguments);E(this,"_unicodeToGlyphIndexMap");E(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(c=>c>65535),n=Ui.from(e),i=Oi.from(e),o=t?Vi.from(e):void 0,s=4+(o?32:24),u=s+n.view.byteLength,a=u+i.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:u},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),h=new Oe(new ArrayBuffer(4+8*l.length+n.view.byteLength+i.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return h.numberSubtables=l.length,h.view.seek(4),l.forEach(c=>{h.view.writeUint16(c.platformID),h.view.writeUint16(c.platformSpecificID),h.view.writeUint32(c.offset)}),h.view.writeBytes(n.view,s),h.view.writeBytes(i.view,u),o&&h.view.writeBytes(o.view,a),h}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let i=0,o=n.length;i<o;i++){const s=n[i],u=t.get(s);e.has(u)?e.get(u).push(s):e.set(u,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let i;switch(n){case 0:i=new Oi(this.view.buffer,t.offset);break;case 2:i=new sn(this.view.buffer,t.offset,this.view.readUint16());break;case 4:i=new Ui(this.view.buffer,t.offset,this.view.readUint16());break;case 6:i=new ye(this.view.buffer,t.offset,this.view.readUint16());break;case 12:i=new Vi(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:i=new on(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:i}})}readunicodeToGlyphIndexMap(){var u,a,l,h,c;const e=this.readSubtables(),t=(u=e.find(f=>f.format===0))==null?void 0:u.view,n=(a=e.find(f=>f.platformID===3&&f.platformSpecificID===3&&f.format===2))==null?void 0:a.view,i=(l=e.find(f=>f.platformID===3&&f.platformSpecificID===1&&f.format===4))==null?void 0:l.view,o=(h=e.find(f=>f.platformID===3&&f.platformSpecificID===10&&f.format===12))==null?void 0:h.view,s=(c=e.find(f=>f.platformID===0&&f.platformSpecificID===5&&f.format===14))==null?void 0:c.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};jn([y("uint16")],Oe.prototype,"version",2),jn([y("uint16")],Oe.prototype,"numberSubtables",2),Oe=jn([gt("cmap")],Oe);class Vs extends Pi{_parseContours(e){const t=[];let n=[];for(let i=0;i<e.length;i+=1){const o=e[i];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return Ae(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let i=0;i<e.length;i+=1){const o=e[i],s={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,i,o){let s;return(t&i)>0?(s=e.view.readUint8(),(t&o)===0&&(s=-s),s=n+s):(t&o)>0?s=n:s=n+e.view.readInt16(),s}parse(e,t,n){e.view.seek(t);const i=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),i>0){const u=this.endPointIndices=[];for(let g=0;g<i;g++)u.push(e.view.readUint16());const a=this.instructionLength=e.view.readUint16();Ae(a<5e3,`Bad instructionLength:${a}`);const l=this.instructions=[];for(let g=0;g<a;++g)l.push(e.view.readUint8());const h=e.view.byteOffset,c=u[u.length-1]+1;Ae(c<2e4,`Bad numberOfCoordinates:${h}`);const f=[];let d,p=0;for(;p<c;)if(d=e.view.readUint8(),f.push(d),p++,d&8&&p<c){const g=e.view.readUint8();for(let D=0;D<g;D++)f.push(d),p++}if(Ae(f.length===c,`Bad flags length: ${f.length}, numberOfCoordinates: ${c}`),u.length>0){const g=[];let D;if(c>0){for(let x=0;x<c;x+=1)d=f[x],D={},D.onCurve=!!(d&1),D.lastPointOfContour=u.includes(x),g.push(D);let S=0;for(let x=0;x<c;x+=1)d=f[x],D=g[x],D.x=this._parseGlyphCoordinate(e,d,S,2,16),S=D.x;let C=0;for(let x=0;x<c;x+=1)d=f[x],D=g[x],D.y=this._parseGlyphCoordinate(e,d,C,4,32),C=D.y}this.points=g}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let u,a=!0;for(;a;){u=e.view.readUint16();const l={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(u&1)>0?(u&2)>0?(l.dx=e.view.readInt16(),l.dy=e.view.readInt16()):l.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(u&2)>0?(l.dx=e.view.readInt8(),l.dy=e.view.readInt8()):l.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(u&8)>0?l.xScale=l.yScale=e.view.readInt16()/16384:(u&64)>0?(l.xScale=e.view.readInt16()/16384,l.yScale=e.view.readInt16()/16384):(u&128)>0&&(l.xScale=e.view.readInt16()/16384,l.scale01=e.view.readInt16()/16384,l.scale10=e.view.readInt16()/16384,l.yScale=e.view.readInt16()/16384),this.components.push(l),a=!!(u&32)}if(u&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let u=0;u<this.components.length;u+=1){const a=this.components[u],l=n.get(a.glyphIndex);if(l.getPathCommands(),l.points){let h;if(a.matchedPoints===void 0)h=this._transformPoints(l.points,a);else{Ae(a.matchedPoints[0]>this.points.length-1||a.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[a.matchedPoints[0]];let f=l.points[a.matchedPoints[1]];const d={xScale:a.xScale,scale01:a.scale01,scale10:a.scale10,yScale:a.yScale,dx:0,dy:0};f=this._transformPoints([f],d)[0],d.dx=c.x-f.x,d.dy=c.y-f.y,h=this._transformPoints(l.points,d)}this.points=this.points.concat(h)}}const o=[],s=this._parseContours(this.points);for(let u=0,a=s.length;u<a;++u){const l=s[u];let h=l[l.length-1],c=l[0];h.onCurve?o.push({type:"M",x:h.x,y:h.y}):c.onCurve?o.push({type:"M",x:c.x,y:c.y}):o.push({type:"M",x:(h.x+c.x)*.5,y:(h.y+c.y)*.5});for(let f=0,d=l.length;f<d;++f)if(h=c,c=l[(f+1)%d],h.onCurve)o.push({type:"L",x:h.x,y:h.y});else{let p=c;c.onCurve||(p={x:(h.x+c.x)*.5,y:(h.y+c.y)*.5}),o.push({type:"Q",x1:h.x,y1:h.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class zs extends Ti{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],i=new Vs({index:e});return n!==t[e+1]&&i.parse(this._sfnt.glyf,n,this),i}}var Ns=Object.getOwnPropertyDescriptor,Rs=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ns(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Gn=class extends yt{constructor(){super(...arguments);E(this,"_glyphs")}static from(e){const t=e.reduce((i,o)=>i+o.byteLength,0),n=new Gn(new ArrayBuffer(t));return e.forEach(i=>{n.view.writeBytes(i)}),n}get glyphs(){return this._glyphs??(this._glyphs=new zs(this._sfnt))}};Gn=Rs([gt("glyf")],Gn);var js=Object.getOwnPropertyDescriptor,Gs=(r,e,t,n)=>{for(var i=n>1?void 0:n?js(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let zi=class extends yt{};zi=Gs([gt("GPOS","gpos")],zi);var qs=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,ae=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ws(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&qs(e,t,i),i};let ne=class extends yt{};ae([y("uint16")],ne.prototype,"majorVersion",2),ae([y("uint16")],ne.prototype,"minorVersion",2),ae([y("uint16")],ne.prototype,"scriptListOffset",2),ae([y("uint16")],ne.prototype,"featureListOffset",2),ae([y("uint16")],ne.prototype,"lookupListOffset",2),ae([y("uint16")],ne.prototype,"featureVariationsOffset",2),ne=ae([gt("GSUB","gsub")],ne);var Hs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?Xs(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Hs(e,t,i),i};let st=class extends yt{constructor(r=new ArrayBuffer(54),e){super(r,e,Math.min(54,r.byteLength-(e??0)))}};ot([y("fixed")],st.prototype,"version",2),ot([y("fixed")],st.prototype,"fontRevision",2),ot([y("uint32")],st.prototype,"checkSumAdjustment",2),ot([y("uint32")],st.prototype,"magickNumber",2),ot([y("uint16")],st.prototype,"flags",2),ot([y("uint16")],st.prototype,"unitsPerEm",2),ot([y({type:"longDateTime"})],st.prototype,"created",2),ot([y({type:"longDateTime"})],st.prototype,"modified",2),ot([y("int16")],st.prototype,"xMin",2),ot([y("int16")],st.prototype,"yMin",2),ot([y("int16")],st.prototype,"xMax",2),ot([y("int16")],st.prototype,"yMax",2),ot([y("uint16")],st.prototype,"macStyle",2),ot([y("uint16")],st.prototype,"lowestRecPPEM",2),ot([y("int16")],st.prototype,"fontDirectionHint",2),ot([y("int16")],st.prototype,"indexToLocFormat",2),ot([y("int16")],st.prototype,"glyphDataFormat",2),st=ot([gt("head")],st);var Zs=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Ct=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ys(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Zs(e,t,i),i};let mt=class extends yt{constructor(r=new ArrayBuffer(36),e){super(r,e,Math.min(36,r.byteLength-(e??0)))}};Ct([y("fixed")],mt.prototype,"version",2),Ct([y("int16")],mt.prototype,"ascent",2),Ct([y("int16")],mt.prototype,"descent",2),Ct([y("int16")],mt.prototype,"lineGap",2),Ct([y("uint16")],mt.prototype,"advanceWidthMax",2),Ct([y("int16")],mt.prototype,"minLeftSideBearing",2),Ct([y("int16")],mt.prototype,"minRightSideBearing",2),Ct([y("int16")],mt.prototype,"xMaxExtent",2),Ct([y("int16")],mt.prototype,"caretSlopeRise",2),Ct([y("int16")],mt.prototype,"caretSlopeRun",2),Ct([y("int16")],mt.prototype,"caretOffset",2),Ct([y({type:"int16",size:4})],mt.prototype,"reserved",2),Ct([y("int16")],mt.prototype,"metricDataFormat",2),Ct([y("uint16")],mt.prototype,"numOfLongHorMetrics",2),mt=Ct([gt("hhea")],mt);var Ks=Object.getOwnPropertyDescriptor,Qs=(r,e,t,n)=>{for(var i=n>1?void 0:n?Ks(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let qn=class extends yt{constructor(){super(...arguments);E(this,"_metrics")}static from(e){const t=e.length*4,n=new qn(new ArrayBuffer(t));return e.forEach(i=>{n.view.writeUint16(i.advanceWidth),n.view.writeUint16(i.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const i=this.view;return i.seek(0),Array.from({length:e}).map((o,s)=>(s<t&&(n=i.readUint16()),{advanceWidth:n,leftSideBearing:i.readUint16()}))}};qn=Qs([gt("hmtx")],qn);var Js=Object.getOwnPropertyDescriptor,to=(r,e,t,n)=>{for(var i=n>1?void 0:n?Js(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Ni=class extends yt{};Ni=to([gt("kern","kern")],Ni);var eo=Object.getOwnPropertyDescriptor,no=(r,e,t,n)=>{for(var i=n>1?void 0:n?eo(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Wn=class extends yt{constructor(){super(...arguments);E(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),i=new Wn(new ArrayBuffer(n));return e.forEach(o=>{t?i.view.writeUint32(o):i.view.writeUint16(o/2)}),i}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};Wn=no([gt("loca")],Wn);var io=Object.defineProperty,ro=Object.getOwnPropertyDescriptor,xt=(r,e,t,n)=>{for(var i=n>1?void 0:n?ro(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&io(e,t,i),i};let lt=class extends yt{constructor(r=new ArrayBuffer(32),e){super(r,e,Math.min(32,r.byteLength-(e??0)))}};xt([y("fixed")],lt.prototype,"version",2),xt([y("uint16")],lt.prototype,"numGlyphs",2),xt([y("uint16")],lt.prototype,"maxPoints",2),xt([y("uint16")],lt.prototype,"maxContours",2),xt([y("uint16")],lt.prototype,"maxComponentPoints",2),xt([y("uint16")],lt.prototype,"maxComponentContours",2),xt([y("uint16")],lt.prototype,"maxZones",2),xt([y("uint16")],lt.prototype,"maxTwilightPoints",2),xt([y("uint16")],lt.prototype,"maxStorage",2),xt([y("uint16")],lt.prototype,"maxFunctionDefs",2),xt([y("uint16")],lt.prototype,"maxInstructionDefs",2),xt([y("uint16")],lt.prototype,"maxStackElements",2),xt([y("uint16")],lt.prototype,"maxSizeOfInstructions",2),xt([y("uint16")],lt.prototype,"maxComponentElements",2),xt([y("uint16")],lt.prototype,"maxComponentDepth",2),lt=xt([gt("maxp")],lt);var so=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,un=(r,e,t,n)=>{for(var i=n>1?void 0:n?oo(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&so(e,t,i),i};const Ri={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},Hn={Macintosh:1,Microsoft:3},uo={Default:0},ji={UCS2:1};let Le=class extends yt{constructor(){super(...arguments);E(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let a=0;a<e;++a)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let a=0;a<e;++a){const l=t[a];l.name=this.view.readBytes(n+l.offset,l.length)}let i=Hn.Macintosh,o=uo.Default,s=0;t.some(a=>a.platform===Hn.Microsoft&&a.encoding===ji.UCS2&&a.language===1033)&&(i=Hn.Microsoft,o=ji.UCS2,s=1033);const u={};for(let a=0;a<e;++a){const l=t[a];l.platform===i&&l.encoding===o&&l.language===s&&Ri[l.nameId]&&(u[Ri[l.nameId]]=s===0?ds(l.name):Ds(l.name))}return u}};un([y("uint16")],Le.prototype,"format",2),un([y("uint16")],Le.prototype,"count",2),un([y("uint16")],Le.prototype,"stringOffset",2),Le=un([gt("name")],Le);var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,q=(r,e,t,n)=>{for(var i=n>1?void 0:n?lo(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&ao(e,t,i),i};let G=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};q([y("uint16")],G.prototype,"version",2),q([y("int16")],G.prototype,"xAvgCharWidth",2),q([y("uint16")],G.prototype,"usWeightClass",2),q([y("uint16")],G.prototype,"usWidthClass",2),q([y("uint16")],G.prototype,"fsType",2),q([y("uint16")],G.prototype,"ySubscriptXSize",2),q([y("uint16")],G.prototype,"ySubscriptYSize",2),q([y("uint16")],G.prototype,"ySubscriptXOffset",2),q([y("uint16")],G.prototype,"ySubscriptYOffset",2),q([y("uint16")],G.prototype,"ySuperscriptXSize",2),q([y("uint16")],G.prototype,"ySuperscriptYSize",2),q([y("uint16")],G.prototype,"ySuperscriptXOffset",2),q([y("uint16")],G.prototype,"ySuperscriptYOffset",2),q([y("uint16")],G.prototype,"yStrikeoutSize",2),q([y("uint16")],G.prototype,"yStrikeoutPosition",2),q([y("uint16")],G.prototype,"sFamilyClass",2),q([y({type:"uint8"})],G.prototype,"bFamilyType",2),q([y({type:"uint8"})],G.prototype,"bSerifStyle",2),q([y({type:"uint8"})],G.prototype,"bWeight",2),q([y({type:"uint8"})],G.prototype,"bProportion",2),q([y({type:"uint8"})],G.prototype,"bContrast",2),q([y({type:"uint8"})],G.prototype,"bStrokeVariation",2),q([y({type:"uint8"})],G.prototype,"bArmStyle",2),q([y({type:"uint8"})],G.prototype,"bLetterform",2),q([y({type:"uint8"})],G.prototype,"bMidline",2),q([y({type:"uint8"})],G.prototype,"bXHeight",2),q([y({type:"uint8",size:16})],G.prototype,"ulUnicodeRange",2),q([y({type:"char",size:4})],G.prototype,"achVendID",2),q([y("uint16")],G.prototype,"fsSelection",2),q([y("uint16")],G.prototype,"usFirstCharIndex",2),q([y("uint16")],G.prototype,"usLastCharIndex",2),q([y("int16")],G.prototype,"sTypoAscender",2),q([y("int16")],G.prototype,"sTypoDescender",2),q([y("int16")],G.prototype,"sTypoLineGap",2),q([y("uint16")],G.prototype,"usWinAscent",2),q([y("uint16")],G.prototype,"usWinDescent",2),q([y({offset:72,type:"uint8",size:8})],G.prototype,"ulCodePageRange",2),q([y({offset:72,type:"int16"})],G.prototype,"sxHeight",2),q([y("int16")],G.prototype,"sCapHeight",2),q([y("uint16")],G.prototype,"usDefaultChar",2),q([y("uint16")],G.prototype,"usBreakChar",2),q([y("uint16")],G.prototype,"usMaxContext",2),G=q([gt("OS/2","os2")],G);var ho=Object.defineProperty,co=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?co(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&ho(e,t,i),i};let Vt=class extends yt{constructor(r=new ArrayBuffer(32),e,t){super(r,e,t)}};qt([y("fixed")],Vt.prototype,"format",2),qt([y("fixed")],Vt.prototype,"italicAngle",2),qt([y("int16")],Vt.prototype,"underlinePosition",2),qt([y("int16")],Vt.prototype,"underlineThickness",2),qt([y("uint32")],Vt.prototype,"isFixedPitch",2),qt([y("uint32")],Vt.prototype,"minMemType42",2),qt([y("uint32")],Vt.prototype,"maxMemType42",2),qt([y("uint32")],Vt.prototype,"minMemType1",2),qt([y("uint32")],Vt.prototype,"maxMemType1",2),Vt=qt([gt("post")],Vt);var fo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,bt=(r,e,t,n)=>{for(var i=n>1?void 0:n?po(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&fo(e,t,i),i};let vt=class extends yt{constructor(r=new ArrayBuffer(36),e){super(r,e,Math.min(36,r.byteLength-(e??0)))}};bt([y("fixed")],vt.prototype,"version",2),bt([y("int16")],vt.prototype,"vertTypoAscender",2),bt([y("int16")],vt.prototype,"vertTypoDescender",2),bt([y("int16")],vt.prototype,"vertTypoLineGap",2),bt([y("int16")],vt.prototype,"advanceHeightMax",2),bt([y("int16")],vt.prototype,"minTopSideBearing",2),bt([y("int16")],vt.prototype,"minBottomSideBearing",2),bt([y("int16")],vt.prototype,"yMaxExtent",2),bt([y("int16")],vt.prototype,"caretSlopeRise",2),bt([y("int16")],vt.prototype,"caretSlopeRun",2),bt([y("int16")],vt.prototype,"caretOffset",2),bt([y({type:"int16",size:4})],vt.prototype,"reserved",2),bt([y("int16")],vt.prototype,"metricDataFormat",2),bt([y("int16")],vt.prototype,"numOfLongVerMetrics",2),vt=bt([gt("vhea")],vt);var Do=Object.getOwnPropertyDescriptor,go=(r,e,t,n)=>{for(var i=n>1?void 0:n?Do(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i};let Xn=class extends yt{constructor(){super(...arguments);E(this,"_metrics")}static from(e){const t=e.length*4,n=new Xn(new ArrayBuffer(t));return e.forEach(i=>{n.view.writeUint16(i.advanceHeight),n.view.writeInt16(i.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const e=this._sfnt.maxp.numGlyphs,t=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let i=0;return Array.from({length:e}).map((s,u)=>(u<t&&(i=n.readUint16()),{advanceHeight:i,topSideBearing:n.readUint8()}))}};Xn=go([gt("vmtx")],Xn);var yo=Object.defineProperty,$e=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&yo(e,t,i),i};class zt extends Un{constructor(){super(...arguments);E(this,"format","TrueType");E(this,"mimeType","font/ttf");E(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(de(t).getUint32(0))}static checksum(t){const n=de(t);let i=n.byteLength;for(;i%4;)i++;let o=0;for(let s=0,u=i/4;s<u;s+=4)s*4<i-4&&(o+=n.getUint32(s*4,!1));return o&4294967295}static from(t){const n=f=>f+3&-4,i=t.tableViews.size,o=Array.from(t.tableViews.values()).reduce((f,d)=>f+n(d.byteLength),0),s=new this(new ArrayBuffer(12+i*16+o));s.scalerType=65536,s.numTables=i;const u=Math.log(2);s.searchRange=Math.floor(Math.log(i)/u)*16,s.entrySelector=Math.floor(s.searchRange/u),s.rangeShift=i*16-s.searchRange;let a=12+i*16,l=0;const h=s.getDirectories();t.tableViews.forEach((f,d)=>{const p=h[l++];p.tag=d,p.checkSum=this.checksum(f),p.offset=a,p.length=f.byteLength,s.view.writeBytes(f,a),a+=n(p.length)});const c=s.createSFNT().head;return c.checkSumAdjustment=0,c.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Pe(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new De(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}E(zt,"signature",new Set([65536,1953658213,1954115633])),$e([y("uint32")],zt.prototype,"scalerType"),$e([y("uint16")],zt.prototype,"numTables"),$e([y("uint16")],zt.prototype,"searchRange"),$e([y("uint16")],zt.prototype,"entrySelector"),$e([y("uint16")],zt.prototype,"rangeShift");class an extends zt{constructor(){super(...arguments);E(this,"format","OpenType");E(this,"mimeType","font/otf")}static from(t){return super.from(t)}}E(an,"signature",new Set([1330926671]));var mo=Object.defineProperty,Ue=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&mo(e,t,i),i};class xe extends _t{constructor(e,t){super(e,t,20)}}Ue([y({type:"char",size:4})],xe.prototype,"tag"),Ue([y("uint32")],xe.prototype,"offset"),Ue([y("uint32")],xe.prototype,"compLength"),Ue([y("uint32")],xe.prototype,"origLength"),Ue([y("uint32")],xe.prototype,"origChecksum");var xo=Object.defineProperty,kt=(r,e,t,n)=>{for(var i=void 0,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(e,t,i)||i);return i&&xo(e,t,i),i};const Bt=(se=class extends Un{constructor(){super(...arguments);E(this,"format","WOFF");E(this,"mimeType","font/woff");E(this,"_sfnt")}get subfontFormat(){return zt.is(this.flavor)?"TrueType":an.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(de(t).getUint32(0))}static checkSum(t){const n=de(t),i=n.byteLength,o=Math.floor(i/4);let s=0,u=0;for(;u<o;)s+=n.getUint32(4*u++,!1);let a=i-o*4;if(a){let l=o*4;for(;a>0;)s+=n.getUint8(l)<<a*8,l++,a--}return s%4294967296}static from(t,n=new ArrayBuffer(0)){const i=f=>f+3&-4,o=[];t.tableViews.forEach((f,d)=>{const p=de(us(new Uint8Array(f.buffer,f.byteOffset,f.byteLength)));o.push({tag:d,view:p.byteLength<f.byteLength?p:f,rawView:f})});const s=o.length,u=o.reduce((f,d)=>f+i(d.view.byteLength),0),a=new se(new ArrayBuffer(44+20*s+u+n.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=s,a.totalSFNTSize=12+16*s+o.reduce((f,d)=>f+i(d.rawView.byteLength),0);let l=44+s*20,h=0;const c=a.getDirectories();return o.forEach(f=>{const d=c[h++];d.tag=f.tag,d.offset=l,d.compLength=f.view.byteLength,d.origChecksum=se.checkSum(f.rawView),d.origLength=f.rawView.byteLength,a.view.writeBytes(f.view,l),l+=i(d.compLength)}),a.view.writeBytes(n),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new xe(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new De(this.getDirectories().reduce((t,n)=>{const i=n.tag,o=this.view.byteOffset+n.offset,s=n.compLength,u=n.origLength,a=o+s;return t[i]=s>=u?new DataView(this.view.buffer,o,s):new DataView(as(new Uint8Array(this.view.buffer.slice(o,a))).buffer),t},{}))}},E(se,"signature",new Set([2001684038])),se);kt([y("uint32")],Bt.prototype,"signature"),kt([y("uint32")],Bt.prototype,"flavor"),kt([y("uint32")],Bt.prototype,"length"),kt([y("uint16")],Bt.prototype,"numTables"),kt([y("uint16")],Bt.prototype,"reserved"),kt([y("uint32")],Bt.prototype,"totalSFNTSize"),kt([y("uint16")],Bt.prototype,"majorVersion"),kt([y("uint16")],Bt.prototype,"minorVersion"),kt([y("uint32")],Bt.prototype,"metaOffset"),kt([y("uint32")],Bt.prototype,"metaLength"),kt([y("uint32")],Bt.prototype,"metaOrigLength"),kt([y("uint32")],Bt.prototype,"privOffset"),kt([y("uint32")],Bt.prototype,"privLength");let Zn=Bt;function vo(r,e=!0){if(zt.is(r))return new zt(r);if(an.is(r))return new an(r);if(Zn.is(r))return new Zn(r);if(e)throw new Error("Failed to parseFont")}function Fo(r,e=!0){const t=vo(r,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}const Mn=class Mn{constructor(){E(this,"fallbackFont");E(this,"loading",new Map);E(this,"loaded",new Map);E(this,"familyToUrl",new Map)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...Mn.defaultRequestInit,...t,signal:n.signal}).then(i=>i.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${e}";
3
3
  src: url(${t});
4
- }`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,o)=>r||this.loaded.get(o),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:o=!0,...s}=t;let a,l;if(typeof e=="string"?a=e:{src:a,family:l}=e,this.loaded.has(a))return n&&(this.loading.forEach(d=>d.cancel()),this.loading.clear()),u(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,s),this.loading.set(a,h)),n&&this.loading.forEach((d,p)=>{d!==h&&(d.cancel(),this.loading.delete(p))}),h.when.then(d=>{if(this.loaded.has(a))return u(this.loaded.get(a));{const p=f(d);return t.noAdd||this.loaded.set(a,p),p.familySet.forEach(y=>{this.familyToUrl.set(y,a),typeof document<"u"&&(r&&this.injectFontFace(y,d),o&&this.injectStyleTag(y,a))}),p}}).catch(d=>{if(d instanceof DOMException&&d.message==="The user aborted a request.")return f();throw d}).finally(()=>{this.loading.delete(a)});function c(){return l?Array.isArray(l)?l:[l]:[]}function u(d){return c().forEach(p=>{d.familySet.add(p)}),d}function f(d=new ArrayBuffer(0)){let p;function y(){return p||(p=d.byteLength?js(d,!1):void 0),p}function g(){const M=y();if(M instanceof $t||M instanceof Un)return M.sfnt}return{src:a,family:l,buffer:d,familySet:new Set(c()),getFont:y,getSFNT:g}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};T(gn,"defaultRequestInit",{cache:"force-cache"});let Fn=gn;const Rs=new Fn;function Vs(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=kr(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h;if(n&&(o=Zs(i,e,o,t)),i.length>80*t){a=1/0,l=1/0;let c=-1/0,u=-1/0;for(let f=t;f<r;f+=t){const d=i[f],p=i[f+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>u&&(u=p)}h=Math.max(c-a,u-l),h=h!==0?32767/h:0}return Le(o,s,t,a,l,h,0),s}function kr(i,e,t,n,r){let o;if(r===oo(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=Or(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=Or(s/n|0,i[s],i[s+1],o);return o&&ye(o,o.next)&&($e(o),o=o.next),o}function se(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(ye(t,t.next)||tt(t.prev,t,t.next)===0)){if($e(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Le(i,e,t,n,r,o,s){if(!i)return;!s&&o&&to(i,n,r,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,h=i.next;if(o?Ws(i,n,r,o):qs(i)){e.push(l.i,i.i,h.i),$e(i),i=h.next,a=h.next;continue}if(i=h,i===a){s?s===1?(i=Hs(se(i),e),Le(i,e,t,n,r,o,2)):s===2&&Xs(i,e,t,n,r,o):Le(se(i),e,t,n,r,o,1);break}}}function qs(i){const e=i.prev,t=i,n=i.next;if(tt(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,o,s),u=Math.min(a,l,h),f=Math.max(r,o,s),d=Math.max(a,l,h);let p=n.next;for(;p!==e;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&Ue(r,a,o,l,s,h,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ws(i,e,t,n){const r=i.prev,o=i,s=i.next;if(tt(r,o,s)>=0)return!1;const a=r.x,l=o.x,h=s.x,c=r.y,u=o.y,f=s.y,d=Math.min(a,l,h),p=Math.min(c,u,f),y=Math.max(a,l,h),g=Math.max(c,u,f),M=$n(d,p,e,t,n),A=$n(y,g,e,t,n);let b=i.prevZ,C=i.nextZ;for(;b&&b.z>=M&&C&&C.z<=A;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=g&&b!==r&&b!==s&&Ue(a,c,l,u,h,f,b.x,b.y)&&tt(b.prev,b,b.next)>=0||(b=b.prevZ,C.x>=d&&C.x<=y&&C.y>=p&&C.y<=g&&C!==r&&C!==s&&Ue(a,c,l,u,h,f,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;b&&b.z>=M;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=g&&b!==r&&b!==s&&Ue(a,c,l,u,h,f,b.x,b.y)&&tt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;C&&C.z<=A;){if(C.x>=d&&C.x<=y&&C.y>=p&&C.y<=g&&C!==r&&C!==s&&Ue(a,c,l,u,h,f,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Hs(i,e){let t=i;do{const n=t.prev,r=t.next.next;!ye(n,r)&&_r(n,t,t.next,r)&&Fe(n,r)&&Fe(r,n)&&(e.push(n.i,t.i,r.i),$e(t),$e(t.next),t=i=r),t=t.next}while(t!==i);return se(t)}function Xs(i,e,t,n,r,o){let s=i;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&ro(s,a)){let l=Ir(s,a);s=se(s,s.next),l=se(l,l.next),Le(s,e,t,n,r,o,0),Le(l,e,t,n,r,o,0);return}a=a.next}s=s.next}while(s!==i)}function Zs(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const a=e[o]*n,l=o<s-1?e[o+1]*n:i.length,h=kr(i,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(no(h))}r.sort(Ys);for(let o=0;o<r.length;o++)t=Ks(r[o],t);return t}function Ys(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Ks(i,e){const t=Qs(i,e);if(!t)return e;const n=Ir(t,i);return se(n,n.next),se(t,t.next)}function Qs(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(ye(i,t))return t;do{if(ye(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const u=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>o&&(o=u,s=t.x<t.next.x?t:t.next,u===n))return s}t=t.next}while(t!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;t=s;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Ar(r<h?n:o,r,l,h,r<h?o:n,r,t.x,t.y)){const u=Math.abs(r-t.y)/(n-t.x);Fe(t,i)&&(u<c||u===c&&(t.x>s.x||t.x===s.x&&Js(s,t)))&&(s=t,c=u)}t=t.next}while(t!==a);return s}function Js(i,e){return tt(i.prev,i,e.prev)<0&&tt(e.next,i,i.next)<0}function to(i,e,t,n){let r=i;do r.z===0&&(r.z=$n(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,eo(r)}function eo(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let s=n,a=0;for(let h=0;h<t&&(a++,s=s.nextZ,!!s);h++);let l=t;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function $n(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function no(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Ar(i,e,t,n,r,o,s,a){return(r-s)*(e-a)>=(i-s)*(o-a)&&(i-s)*(n-a)>=(t-s)*(e-a)&&(t-s)*(o-a)>=(r-s)*(n-a)}function Ue(i,e,t,n,r,o,s,a){return!(i===s&&e===a)&&Ar(i,e,t,n,r,o,s,a)}function ro(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!io(i,e)&&(Fe(i,e)&&Fe(e,i)&&so(i,e)&&(tt(i.prev,i,e.prev)||tt(i,e.prev,e))||ye(i,e)&&tt(i.prev,i,i.next)>0&&tt(e.prev,e,e.next)>0)}function tt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ye(i,e){return i.x===e.x&&i.y===e.y}function _r(i,e,t,n){const r=en(tt(i,e,t)),o=en(tt(i,e,n)),s=en(tt(t,n,i)),a=en(tt(t,n,e));return!!(r!==o&&s!==a||r===0&&tn(i,t,e)||o===0&&tn(i,n,e)||s===0&&tn(t,i,n)||a===0&&tn(t,e,n))}function tn(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function en(i){return i>0?1:i<0?-1:0}function io(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&_r(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Fe(i,e){return tt(i.prev,i,i.next)<0?tt(i,e,i.next)>=0&&tt(i,i.prev,e)>=0:tt(i,e,i.prev)<0||tt(i,i.next,e)<0}function so(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function Ir(i,e){const t=zn(i.i,i.x,i.y),n=zn(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Or(i,e,t,n){const r=zn(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $e(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function zn(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function oo(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function ao(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Nn(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:u=0,shadowBlur:f=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=u,i.shadowBlur=f,i.shadowColor=d}class _{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new _(1/0,1/0)}static get MIN(){return new _(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-o*s),t.y-(r*s+o*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const r=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new _(this.x,this.y)}}class Z{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new _((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new Z;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new Z(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new Z(this.left,this.top,this.width,this.height)}}class Ct{constructor(e=1,t=0,n=0,r=0,o=1,s=0,a=0,l=0,h=1){T(this,"elements",[]);this.set(e,t,n,r,o,s,a,l,h)}set(e,t,n,r,o,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=o,c[5]=l,c[6]=n,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,s=n[0],a=n[3],l=n[6],h=n[1],c=n[4],u=n[7],f=n[2],d=n[5],p=n[8],y=r[0],g=r[3],M=r[6],A=r[1],b=r[4],C=r[7],x=r[2],v=r[5],S=r[8];return o[0]=s*y+a*A+l*x,o[3]=s*g+a*b+l*v,o[6]=s*M+a*C+l*S,o[1]=h*y+c*A+u*x,o[4]=h*g+c*b+u*v,o[7]=h*M+c*C+u*S,o[2]=f*y+d*A+p*x,o[5]=f*g+d*b+p*v,o[8]=f*M+d*C+p*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],u=c*s-a*h,f=a*l-c*o,d=h*o-s*l,p=t*u+n*f+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/p;return e[0]=u*y,e[1]=(r*h-c*n)*y,e[2]=(a*n-r*s)*y,e[3]=f*y,e[4]=(c*t-r*l)*y,e[5]=(r*o-a*t)*y,e[6]=d*y,e[7]=(n*l-h*t)*y,e[8]=(s*t-n*o)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(Gn.makeScale(e,t)),this}rotate(e){return this.premultiply(Gn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gn.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Gn=new Ct;function Er(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function ho(i,e,t,n,r,o,s,a){if(e===0||t===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,u=-Math.sin(n)*l+Math.cos(n)*h;let f=e*e,d=t*t;const p=c*c,y=u*u,g=p/f+y/d;if(g>1){const R=Math.sqrt(g);e=R*e,t=R*t,f=e*e,d=t*t}const M=f*y+d*p,A=(f*d-M)/M;let b=Math.sqrt(Math.max(0,A));r===o&&(b=-b);const C=b*e*u/t,x=-b*t*c/e,v=Math.cos(n)*C-Math.sin(n)*x+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(s.y+a.y)/2,w=Er(1,0,(c-C)/e,(u-x)/t),D=Er((c-C)/e,(u-x)/t,(-c-C)/e,(-u-x)/t)%(Math.PI*2);i.ellipse(v,S,e,t,n,w,w+D,o===0)}const it={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Vt(i,e,t=0){let a=0,l=!0,h="",c="";const u=[];function f(g,M,A){const b=new SyntaxError(`Unexpected character "${g}" at index ${M}.`);throw b.partial=A,b}function d(){h!==""&&(c===""?u.push(Number(h)):u.push(Number(h)*10**Number(c))),h="",c=""}let p;const y=i.length;for(let g=0;g<y;g++){if(p=i[g],Array.isArray(e)&&e.includes(u.length%t)&&it.FLAGS.test(p)){a=1,h=p,d();continue}if(a===0){if(it.WHITESPACE.test(p))continue;if(it.DIGIT.test(p)||it.SIGN.test(p)){a=1,h=p;continue}if(it.POINT.test(p)){a=2,h=p;continue}it.COMMA.test(p)&&(l&&f(p,g,u),l=!0)}if(a===1){if(it.DIGIT.test(p)){h+=p;continue}if(it.POINT.test(p)){h+=p,a=2;continue}if(it.EXP.test(p)){a=3;continue}it.SIGN.test(p)&&h.length===1&&it.SIGN.test(h[0])&&f(p,g,u)}if(a===2){if(it.DIGIT.test(p)){h+=p;continue}if(it.EXP.test(p)){a=3;continue}it.POINT.test(p)&&h[h.length-1]==="."&&f(p,g,u)}if(a===3){if(it.DIGIT.test(p)){c+=p;continue}if(it.SIGN.test(p)){if(c===""){c+=p;continue}c.length===1&&it.SIGN.test(c)&&f(p,g,u)}}it.WHITESPACE.test(p)?(d(),a=0,l=!1):it.COMMA.test(p)?(d(),a=0,l=!0):it.SIGN.test(p)?(d(),a=1,h=p):it.POINT.test(p)?(d(),a=2,h=p):f(p,g,u)}return d(),u}function me(i,e){return i-(e-i)}function Br(i,e){const t=new _,n=new _;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(me(t.x,n.x),me(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=me(t.x,n.x),l=me(t.y,n.y);n.x=a,n.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),ho(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function co(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const uo=/[a-df-z][^a-df-z]*/gi;function Dr(i){const e=[],t=i.match(uo);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=Vt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=Vt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=Vt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=Vt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=Vt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=Vt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=Vt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=Vt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=Vt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function Lr(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*i+t}function fo(i,e){const t=1-i;return t*t*t*e}function po(i,e){const t=1-i;return 3*t*t*i*e}function go(i,e){return 3*(1-i)*i*i*e}function yo(i,e){return i*i*i*e}function Ur(i,e,t,n,r){return fo(i,e)+po(i,t)+go(i,n)+yo(i,r)}function Fr(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=t.length/o,indicesOffset:a=n.length}=e;const l=Vs(i,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+s,n[a++]=l[c+1]+s,n[a++]=l[c+2]+s;let h=s*o;for(let c=0;c<i.length;c+=2)t[h]=i[c],t[h+1]=i[c+1],h+=o}return{vertices:t,indices:n}}const mo=8,nn=11920929e-14,xo=1;function vo(i,e,t,n,r,o,s,a,l=.5,h=[]){const u=Math.min(.99,Math.max(0,l));let f=(xo-u)/1;return f*=f,jn(i,e,t,n,r,o,s,a,h,f,0),h.push(s,a),h}function jn(i,e,t,n,r,o,s,a,l,h,c){if(c>mo)return;const u=(i+t)/2,f=(e+n)/2,d=(t+r)/2,p=(n+o)/2,y=(r+s)/2,g=(o+a)/2,M=(u+d)/2,A=(f+p)/2,b=(d+y)/2,C=(p+g)/2,x=(M+b)/2,v=(A+C)/2;if(c>0){let S=s-i,w=a-e;const D=Math.abs((t-s)*w-(n-a)*S),R=Math.abs((r-s)*w-(o-a)*S);if(D>nn&&R>nn){if((D+R)*(D+R)<=h*(S*S+w*w)){l.push(x,v);return}}else if(D>nn){if(D*D<=h*(S*S+w*w)){l.push(x,v);return}}else if(R>nn){if(R*R<=h*(S*S+w*w)){l.push(x,v);return}}else if(S=x-(i+s)/2,w=v-(e+a)/2,S*S+w*w<=h){l.push(x,v);return}}jn(i,e,u,f,M,A,x,v,l,h,c+1),jn(x,v,b,C,y,g,s,a,l,h,c+1)}const wo=8,bo=11920929e-14,So=1;function Co(i,e,t,n,r,o,s=.5,a=[]){const h=Math.min(.99,Math.max(0,s));let c=(So-h)/1;return c*=c,Rn(a,i,e,t,n,r,o,c,0),a.push(r,o),a}function Rn(i,e,t,n,r,o,s,a,l){if(l>wo)return;const h=(e+n)/2,c=(t+r)/2,u=(n+o)/2,f=(r+s)/2,d=(h+u)/2,p=(c+f)/2;let y=o-e,g=s-t;const M=Math.abs((n-o)*g-(r-s)*y);if(M>bo){if(M*M<=a*(y*y+g*g)){i.push(d,p);return}}else if(y=d-(e+o)/2,g=p-(t+s)/2,y*y+g*g<=a){i.push(d,p);return}Rn(i,e,t,h,c,d,p,a,l+1),Rn(i,d,p,u,f,o,s,a,l+1)}function Mo(i,e){const t=1-i;return t*t*e}function Po(i,e){return 2*(1-i)*i*e}function To(i,e){return i*i*e}function $r(i,e,t,n){return Mo(i,e)+Po(i,t)+To(i,n)}const ko=1e-4,zr=1e-4;function Ao(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,a=ko;if(i.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let E=_o(i);o&&(E*=-1),h=(h-.5)*E+.5}const c={x:i[0],y:i[1]},u={x:i[i.length-2],y:i[i.length-1]},f=s,d=Math.abs(c.x-u.x)<a&&Math.abs(c.y-u.y)<a;if(f){i=i.slice(),d&&(i.pop(),i.pop(),u.x=i[i.length-2],u.y=i[i.length-1]);const E=(c.x+u.x)*.5,G=(u.y+c.y)*.5;i.unshift(E,G),i.push(E,G)}const p=t,y=i.length/2;let g=i.length;const M=p.length/2,A=l.width/2,b=A*A,C=l.miterLimit*l.miterLimit;let x=i[0],v=i[1],S=i[2],w=i[3],D=0,R=0,B=-(v-w),L=x-S,N=0,U=0,I=Math.sqrt(B*B+L*L);B/=I,L/=I,B*=A,L*=A;const X=h,O=(1-X)*2,$=X*2;f||(l.cap==="round"?g+=oe(x-B*(O-$)*.5,v-L*(O-$)*.5,x-B*O,v-L*O,x+B*$,v+L*$,p,!0)+2:l.cap==="square"&&(g+=Nr(x,v,B,L,O,$,!0,p))),p.push(x-B*O,v-L*O),p.push(x+B*$,v+L*$);for(let E=1;E<y-1;++E){x=i[(E-1)*2],v=i[(E-1)*2+1],S=i[E*2],w=i[E*2+1],D=i[(E+1)*2],R=i[(E+1)*2+1],B=-(v-w),L=x-S,I=Math.sqrt(B*B+L*L),B/=I,L/=I,B*=A,L*=A,N=-(w-R),U=S-D,I=Math.sqrt(N*N+U*U),N/=I,U/=I,N*=A,U*=A;const G=S-x,k=v-w,P=S-D,F=R-w,z=G*P+k*F,H=k*P-F*G,Y=H<0;if(Math.abs(H)<.001*Math.abs(z)){p.push(S-B*O,w-L*O),p.push(S+B*$,w+L*$),z>=0&&(l.join==="round"?g+=oe(S,w,S-B*O,w-L*O,S-N*O,w-U*O,p,!1)+4:g+=2,p.push(S-N*$,w-U*$),p.push(S+N*O,w+U*O));continue}const nt=(-B+x)*(-L+w)-(-B+S)*(-L+v),Wt=(-N+D)*(-U+w)-(-N+S)*(-U+R),Bt=(G*Wt-P*nt)/H,Mt=(F*nt-k*Wt)/H,kt=(Bt-S)*(Bt-S)+(Mt-w)*(Mt-w),ht=S+(Bt-S)*O,At=w+(Mt-w)*O,zt=S-(Bt-S)*$,Nt=w-(Mt-w)*$,Dt=Math.min(G*G+k*k,P*P+F*F),ui=Y?O:$,Ma=Dt+ui*ui*b;kt<=Ma?l.join==="bevel"||kt/b>C?(Y?(p.push(ht,At),p.push(S+B*$,w+L*$),p.push(ht,At),p.push(S+N*$,w+U*$)):(p.push(S-B*O,w-L*O),p.push(zt,Nt),p.push(S-N*O,w-U*O),p.push(zt,Nt)),g+=2):l.join==="round"?Y?(p.push(ht,At),p.push(S+B*$,w+L*$),g+=oe(S,w,S+B*$,w+L*$,S+N*$,w+U*$,p,!0)+4,p.push(ht,At),p.push(S+N*$,w+U*$)):(p.push(S-B*O,w-L*O),p.push(zt,Nt),g+=oe(S,w,S-B*O,w-L*O,S-N*O,w-U*O,p,!1)+4,p.push(S-N*O,w-U*O),p.push(zt,Nt)):(p.push(ht,At),p.push(zt,Nt)):(p.push(S-B*O,w-L*O),p.push(S+B*$,w+L*$),l.join==="round"?Y?g+=oe(S,w,S+B*$,w+L*$,S+N*$,w+U*$,p,!0)+2:g+=oe(S,w,S-B*O,w-L*O,S-N*O,w-U*O,p,!1)+2:l.join==="miter"&&kt/b<=C&&(Y?(p.push(zt,Nt),p.push(zt,Nt)):(p.push(ht,At),p.push(ht,At)),g+=2),p.push(S-N*O,w-U*O),p.push(S+N*$,w+U*$),g+=2)}x=i[(y-2)*2],v=i[(y-2)*2+1],S=i[(y-1)*2],w=i[(y-1)*2+1],B=-(v-w),L=x-S,I=Math.sqrt(B*B+L*L),B/=I,L/=I,B*=A,L*=A,p.push(S-B*O,w-L*O),p.push(S+B*$,w+L*$),f||(l.cap==="round"?g+=oe(S-B*(O-$)*.5,w-L*(O-$)*.5,S-B*O,w-L*O,S+B*$,w+L*$,p,!1)+2:l.cap==="square"&&(g+=Nr(S,w,B,L,O,$,!1,p)));const j=zr*zr;for(let E=M;E<g+M-2;++E)x=p[E*2],v=p[E*2+1],S=p[(E+1)*2],w=p[(E+1)*2+1],D=p[(E+2)*2],R=p[(E+2)*2+1],!(Math.abs(x*(w-R)+S*(R-v)+D*(v-w))<j)&&n.push(E,E+1,E+2);return{vertices:t,indices:n}}function _o(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],a=i[n+1];t+=(s-r)*(a+o),r=s,o=a}return t<0?-1:1}function Nr(i,e,t,n,r,o,s,a){const l=i-t*r,h=e-n*r,c=i+t*o,u=e+n*o;let f,d;s?(f=n,d=-t):(f=-n,d=t);const p=l+f,y=h+d,g=c+f,M=u+d;return a.push(p,y),a.push(g,M),2}function oe(i,e,t,n,r,o,s,a){const l=t-i,h=n-e;let c=Math.atan2(l,h),u=Math.atan2(r-i,o-e);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,p=Math.abs(d),y=Math.sqrt(l*l+h*h),g=(15*p*Math.sqrt(y)/Math.PI>>0)+1,M=d/g;if(f+=M,a){s.push(i,e),s.push(t,n);for(let A=1,b=f;A<g;A++,b+=M)s.push(i,e),s.push(i+Math.sin(b)*y,e+Math.cos(b)*y);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let A=1,b=f;A<g;A++,b+=M)s.push(i+Math.sin(b)*y,e+Math.cos(b)*y),s.push(i,e);s.push(r,o),s.push(i,e)}return g*2}class xe{constructor(){T(this,"arcLengthDivision",200);T(this,"_arcLengths")}getPointAt(e,t=new _){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){const t=typeof e=="function";return this.getControlPointRefs().forEach(n=>{t?e(n):n.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new _;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new _;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const o=e[n],s=e[n+1];t.push(new _(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/n[0];let s=0,a=0,l=r-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=n[s]-o,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(r-1);const c=n[s],f=n[s+1]-c,d=(o-c)/f;return(s+d)/(r-1)}getTangent(e,t=new _){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new _){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=_.MAX,t=_.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;r++){const s=n[r];e.min(s),t.max(s)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Z(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return Fr(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Ao(this.getAdaptivePointArray(),e)}toTriangulatedSVGString(e=this.fillTriangulate(),t=0){const{vertices:n,indices:r}=e,o={x:-t,y:-t},s={x:t,y:t},a=c=>{const u=n[c*2],f=n[c*2+1];return o.x=Math.min(o.x,u+t),s.x=Math.max(s.x,u+t),o.y=Math.min(o.y,f+t),s.y=Math.max(s.y,f+t),[u,f]};let l="";for(let c=0,u=r.length;c<u;c+=3){const f=a(r[c]),d=a(r[c+1]),p=a(r[c+2]);l+=`<polygon points="${f.join(",")} ${d.join(",")} ${p.join(",")}" fill="none" stroke="black" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" />`}const h=[o.x,o.y,s.x-o.x,s.y-o.y];return`<svg width="${h[2]}" height="${h[3]}" viewBox="${h.join(" ")}" xmlns="http://www.w3.org/2000/svg">${l}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return co(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Io=new Ct,Gr=new Ct,jr=new Ct,rn=new _;class Vn extends xe{constructor(e=new _,t=new _,n=new _,r=0,o=0,s=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=a}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new _){const n=this._getDeltaAngle(),r=this.startAngle+e*n;let o=this.cx+this.rx*Math.cos(r),s=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const a=Math.cos(this.rotate),l=Math.sin(this.rotate),h=o-this.cx,c=s-this.cy;o=h*a-c*l+this.cx,s=h*l+c*a+this.cy}return t.set(o,s)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,h=e+n*Math.cos(o)*Math.cos(l)-r*Math.sin(o)*Math.sin(l),c=t+n*Math.cos(o)*Math.sin(l)+r*Math.sin(o)*Math.cos(l),u=Math.abs(o-s),f=u>Math.PI?1:0,d=a?1:0,p=l*180/Math.PI;if(u>=2*Math.PI){const y=o+Math.PI,g=e+n*Math.cos(y)*Math.cos(l)-r*Math.sin(y)*Math.sin(l),M=t+n*Math.cos(y)*Math.sin(l)+r*Math.sin(y)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:g,y:M},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:h,y:c}]}else{const y=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),g=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:f,sweepFlag:d,x:y,y:g}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,o,s,a,l,!h),this}applyTransform(e){return rn.set(this.cx,this.cy),rn.applyMatrix3(e),this.cx=rn.x,this.cy=rn.y,Bo(e)?Oo(this,e):Eo(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:a}=this;if(!(r>=0&&o>=0&&s>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+o)),h=t,c=n,u=l*8+(s?4:0)+(a?4:0);if(u===0)return e;if(l===0)return e[0]=e[6]=h+s,e[1]=e[3]=c+a,e[2]=e[4]=h-s,e[5]=e[7]=c-a,e;let f=0,d=l*4+(s?2:0)+2,p=d,y=u,g=s+r,M=a,A=h+g,b=h-g,C=c+M;if(e[f++]=A,e[f++]=C,e[--d]=C,e[--d]=b,a){const v=c-M;e[p++]=b,e[p++]=v,e[--y]=v,e[--y]=A}for(let v=1;v<l;v++){const S=Math.PI/2*(v/l),w=s+Math.cos(S)*r,D=a+Math.sin(S)*o,R=h+w,B=h-w,L=c+D,N=c-D;e[f++]=R,e[f++]=L,e[--d]=L,e[--d]=B,e[p++]=B,e[p++]=N,e[--y]=N,e[--y]=R}g=s,M=a+o,A=h+g,b=h-g,C=c+M;const x=c-M;return e[f++]=A,e[f++]=C,e[--y]=x,e[--y]=A,s&&(e[f++]=b,e[f++]=C,e[--y]=x,e[--y]=b),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let f=0;f<a.length;f+=2)l+=a[f],h+=a[f+1];l/=a.length/2,h/=a.length/2;let c=o;t[c*r]=l,t[c*r+1]=h;const u=c++;for(let f=0;f<a.length;f+=2)t[c*r]=a[f],t[c*r+1]=a[f+1],f>0&&(n[s++]=c,n[s++]=u,n[s++]=c-1),c++;return n[s++]=u+1,n[s++]=u,n[s++]=c-1,{vertices:t,indices:n}}getMinMax(e=_.MAX,t=_.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(o*o*l*l+s*s*h*h),u=Math.sqrt(o*o*h*h+s*s*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-u),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+u),{min:e.finite(),max:t.finite()}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function Oo(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new _(t*r,t*o),a=new _(-n*o,n*r),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=Io.set(l.x,h.x,0,l.y,h.y,0,0,0,1),u=Gr.copy(c).invert(),p=jr.copy(u).transpose().multiply(u).elements,y=Do(p[0],p[1],p[4]),g=Math.sqrt(y.rt1),M=Math.sqrt(y.rt2);if(i.rx=1/g,i.ry=1/M,i.rotate=Math.atan2(y.sn,y.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=Gr.set(g,0,0,0,M,0,0,0,1),C=jr.set(y.cs,y.sn,0,-y.sn,y.cs,0,0,0,1),x=b.multiply(C).multiply(c),v=S=>{const{x:w,y:D}=new _(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(D,w)};i.startAngle=v(i.startAngle),i.endAngle=v(i.endAngle),Rr(e)&&(i.clockwise=!i.clockwise)}}function Eo(i,e){const t=Vr(e),n=qr(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,Rr(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Rr(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function Bo(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=Vr(i),r=qr(i);return Math.abs(t/(n*r))>Number.EPSILON}function Vr(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function qr(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Do(i,e,t){let n,r,o,s,a;const l=i+t,h=i-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=i*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(e)?(a=-2*e/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(e)===0?(o=1,s=0):(a=-.5*o/e,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:n,rt2:r,cs:o,sn:s}}class Lo extends Vn{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new _(e,t),new _(n,n),new _,0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;return e.arc(t,n,r,o,s,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;let l=Math.abs(o-s);(!a&&o>s||a&&s>o)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,u=o;c*=a?1:-1;for(let f=0;f<h+1;f++){const d=Math.cos(u),p=Math.sin(u),y=t+d*r,g=n+p*r;e.push(y,g),u+=c}return e}}class Xt extends xe{constructor(e=new _,t=new _){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Xt(new _(e,t),new _(n,r))}getPoint(e,t=new _){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new _){return this.getPoint(e,t)}getTangent(e,t=new _){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new _){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=_.MAX,t=_.MIN){const{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const a=this.p1.x,l=this.p1.y,h=this.p2.x-this.p1.x||1,c=this.p2.y-this.p2.y||1,u=[a,l,a+h,l,a+h,l+c,a,l+c];let f=0;o*=r,t[o+f]=u[0],t[o+f+1]=u[1],f+=r,t[o+f]=u[2],t[o+f+1]=u[3],f+=r,t[o+f]=u[6],t[o+f+1]=u[7],f+=r,t[o+f]=u[4],t[o+f+1]=u[5],f+=r;const d=o/r;return n[s++]=d,n[s++]=d+1,n[s++]=d+2,n[s++]=d+1,n[s++]=d+3,n[s++]=d+2,{vertices:t,indices:n}}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class ze extends xe{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof ze?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new _){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){return e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),e}getSpacedPointArray(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedPointArray(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}fillTriangulate(e){const t=(e==null?void 0:e.indices)??[],n=(e==null?void 0:e.vertices)??[],r=[],o=()=>{if(r.length){const s=[];r.forEach(a=>{const l=a.p1.x,h=a.p1.y;(s[s.length-2]!==l||s[s.length-1]!==h)&&s.push(l,h),s.push(a.p2.x,a.p2.y)}),Fr(s,{...e,indices:t,vertices:n}),r.length=0}};return this.curves.forEach(s=>{s instanceof Xt?r.push(s):(o(),s.fillTriangulate({...e,indices:t,vertices:n}))}),o(),{indices:t,vertices:n}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=_.MAX,t=_.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Z(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class qn extends xe{constructor(e=new _,t=new _,n=new _,r=new _){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,a,l){return new qn(new _(e,t),new _(n,r),new _(o,s),new _(a,l))}getPoint(e,t=new _){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Ur(e,n.x,r.x,o.x,s.x),Ur(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return vo(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),a=(-t-o)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=_.MAX,t=_.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((u,f)=>{for(const d of u)for(let p=0;p<=f;p++){const y=p/f-.5,g=Math.min(1,Math.max(0,d+y)),M=this.getPoint(g);e.x=Math.min(e.x,M.x),e.y=Math.min(e.y,M.y),t.x=Math.max(t.x,M.x),t.y=Math.max(t.y,M.y)}})(h,10),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class Uo extends Vn{constructor(e=0,t=0,n=1,r=1,o=0,s=0,a=Math.PI*2,l=!1){super(new _(e,t),new _(n,r),new _,o,s,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Fo extends ze{}class Wn extends xe{constructor(e=new _,t=new _,n=new _){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new Wn(new _(e,t),new _(n,r),new _(o,s))}getPoint(e,t=new _){const{p1:n,cp:r,p2:o}=this;return t.set($r(e,n.x,r.x,o.x),$r(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Co(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=_.MAX,t=_.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+o.x),h=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,l),e.y=Math.min(e.y,n.y,o.y,a,h),t.x=Math.max(t.x,n.x,o.x,s,l),t.y=Math.max(t.y,n.y,o.y,a,h),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class $o extends Fo{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){const{x:e,y:t,width:n,height:r}=this,o=[new _(e,t),new _(e+n,t),new _(e+n,t+r),new _(e,t+r)];return this.curves=[new Xt(o[0],o[1]),new Xt(o[1],o[2]),new Xt(o[2],o[3]),new Xt(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=t.length/r,indicesOffset:s=n.length}=e;const{x:a,y:l,width:h,height:c}=this,u=[a,l,a+h,l,a+h,l+c,a,l+c];let f=0;o*=r,t[o+f]=u[0],t[o+f+1]=u[1],f+=r,t[o+f]=u[2],t[o+f+1]=u[3],f+=r,t[o+f]=u[6],t[o+f+1]=u[7],f+=r,t[o+f]=u[4],t[o+f+1]=u[5],f+=r;const d=o/r;return n[s++]=d,n[s++]=d+1,n[s++]=d+2,n[s++]=d+1,n[s++]=d+3,n[s++]=d+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class zo extends Vn{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,a=r/2,l=e+s,h=t+a,c=Math.max(0,Math.min(o,Math.min(s,a))),u=c;return this._center=new _(l,h),this._radius=new _(c,u),this._diff=new _(s-c,a-u),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class No extends xe{constructor(e=[]){super(),this.points=e}getPoint(e,t=new _){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,a=n[o===0?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],c=n[o>n.length-3?n.length-1:o+2];return t.set(Lr(s,a.x,l.x,h.x,c.x),Lr(s,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class sn extends ze{constructor(t){super();T(this,"startPoint");T(this,"currentPoint");T(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return Br(t,this),this}addData(t){return this.addCommands(Dr(t)),this}_closePointArray(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenPointArray(t=40,n=[]){return this._closePointArray(super.getUnevenPointArray(t,n))}getSpacedPointArray(t=40,n=[]){return this._closePointArray(super.getSpacedPointArray(t,n))}getAdaptivePointArray(t=[]){return this._closePointArray(super.getAdaptivePointArray(t))}_setCurrentPoint(t){return this.currentPoint=new _(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Xt(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new _(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Xt.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(qn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,o,s,a)),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(Wn.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,a){const l=new Lo(t,n,r,o,s,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,o,s,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,a,l,h=!0){const c=new Uo(t,n,r,o,s,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,o,s,a,l,h){var c,u;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((u=this.currentPoint)==null?void 0:u.y)??0,this.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){const s=new $o(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const a=new zo(t,n,r,o,s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new _;return this.curves.push(new No([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function Go(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function jo(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),a=r.cross(o);if(a===0)return new _((i.x+t.x)/2,(i.y+t.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new _((i.x+t.x)/2,(i.y+t.y)/2):new _(i.x+l*r.x,i.y+l*r.y)}class Tt extends ze{constructor(t,n={}){super();T(this,"currentCurve",new sn);T(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(r=>r===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof Tt?this.curves.push(...t.curves.filter(r=>r.curves.length).map(r=>r.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new sn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new sn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,o,s,a){return this.currentCurve.bezierCurveTo(t,n,r,o,s,a),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,a){return this.currentCurve.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,a,l,h){return this.currentCurve.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}reset(){return this.currentCurve=new sn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Br(t,this),this}addData(t){return this.addCommands(Dr(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],o=[],s=[];n.forEach((l,h)=>{const c=l.getControlPointRefs(),u=l.isClockwise();s[h]=c,o[h]=u;const f=c[0],d=c[c.length-1]??f;r.push({start:u?d:f,end:u?f:d,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,u)=>{var f;c.start&&l.end&&u!==h&&((f=c.start)!=null&&f.equals(l.end))&&a[h].push(c.index)})}),n.forEach((l,h)=>{const c=o[h];s[h].forEach(u=>{u.add(l.getNormal(l.getTForPoint(u)).scale(c?t:-t))})}),a.forEach((l,h)=>{const c=s[h];l.forEach(u=>{const f=s[u],d=jo(c[c.length-1],c[c.length-2]??c[c.length-1],f[0],f[1]??f[0]);d&&(c[c.length-1].copy(d),f[0].copy(d))})}),this}getMinMax(t=_.MAX,n=_.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const a=o/2,l=s.isClockwise(),h=[];for(let c=0;c<=1;c+=1/s.arcLengthDivision){const u=s.getPoint(c),f=s.getNormal(c),d=f.clone().scale(l?a:-a),p=f.clone().scale(l?-a:a);h.push(u.clone().add(d),u.clone().add(p),u.clone().add({x:a,y:0}),u.clone().add({x:-a,y:0}),u.clone().add({x:0,y:a}),u.clone().add({x:0,y:-a}),u.clone().add({x:a,y:a}),u.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t.finite(),max:n.finite()}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],r=(t==null?void 0:t.vertices)??[];return this.curves.forEach(o=>{o.strokeTriangulate({...t,indices:n,vertices:r})}),{indices:n,vertices:r}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new Z(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Nn(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Nn(t,n),this.getControlPointRefs().forEach(s=>{ao(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[Go(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ae{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=_.MAX,n=_.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new Z(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-o),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const Wr="data:image/svg+xml;",Hr=`${Wr}base64,`,Xr=`${Wr}charset=utf8,`;function Zr(i){if(typeof i=="string"){let e;i.startsWith(Hr)?(i=i.substring(Hr.length,i.length),e=atob(i)):i.startsWith(Xr)?(i=i.substring(Xr.length,i.length),e=decodeURIComponent(i)):e=i;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
5
- ${e}`);return t.documentElement}else return i}const Ro="px",Vo=90,Yr=["mm","cm","in","pt","pc","px"],Kr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function K(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Yr.length;n<r;n++){const o=Yr[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=Kr[e][Ro],t<0&&(t=Kr[e].in*Vo),t*Number.parseFloat(i)}const qo=new Ct,on=new Ct,Qr=new Ct,Jr=new Ct;function Wo(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Ho(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Ho(i){const e=new Ct,t=qo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(K(i.getAttribute("x")),K(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=Vt(o.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let u=0;h.length>=2&&(u=h[1]),t.translate(c,u)}break;case"rotate":if(h.length>=1){let c=0,u=0,f=0;c=h[0]*Math.PI/180,h.length>=3&&(u=h[1],f=h[2]),on.makeTranslation(-u,-f),Qr.makeRotation(c),Jr.multiplyMatrices(Qr,on),on.makeTranslation(u,f),t.multiplyMatrices(on,Jr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Xo(i){return new Tt().arc(K(i.getAttribute("cx")||0),K(i.getAttribute("cy")||0),K(i.getAttribute("r")||0),0,Math.PI*2)}function Zo(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function Yo(i){return new Tt().ellipse(K(i.getAttribute("cx")||0),K(i.getAttribute("cy")||0),K(i.getAttribute("rx")||0),K(i.getAttribute("ry")||0),0,0,Math.PI*2)}function Ko(i){return new Tt().moveTo(K(i.getAttribute("x1")||0),K(i.getAttribute("y1")||0)).lineTo(K(i.getAttribute("x2")||0),K(i.getAttribute("y2")||0))}function Qo(i){const e=new Tt,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const Jo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ta(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(Jo,(r,o,s)=>{const a=K(o),l=K(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!0,e}const ea=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(ea,(r,o,s)=>{const a=K(o),l=K(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!1,e}function ra(i){const e=K(i.getAttribute("x")||0),t=K(i.getAttribute("y")||0),n=K(i.getAttribute("rx")||i.getAttribute("ry")||0),r=K(i.getAttribute("ry")||i.getAttribute("rx")||0),o=K(i.getAttribute("width")),s=K(i.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+o-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+o-n*a,t,e+o,t+r*a,e+o,t+r),l.lineTo(e+o,t+s-r),(n!==0||r!==0)&&l.bezierCurveTo(e+o,t+s-r*a,e+o-n*a,t+s,e+o-n,t+s),l.lineTo(e+n,t+s),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+s,e,t+s-r*a,e,t+s-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function qt(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const u=i.style.item(c),f=i.style.getPropertyValue(u);e[u]=f,n[u]=f}function r(h,c,u=o){i.hasAttribute(h)&&(e[c]=u(i.getAttribute(h))),n[h]&&(e[c]=u(n[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,K(h)))}function a(h){return Math.max(0,K(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>K(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",K),r("visibility","visibility"),e}function Hn(i,e,t=[],n={}){var u;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=qt(i,s,n);break;case"style":Zo(i,n);break;case"g":s=qt(i,s,n);break;case"path":s=qt(i,s,n),i.hasAttribute("d")&&(o=Qo(i));break;case"rect":s=qt(i,s,n),o=ra(i);break;case"polygon":s=qt(i,s,n),o=ta(i);break;case"polyline":s=qt(i,s,n),o=na(i);break;case"circle":s=qt(i,s,n),o=Xo(i);break;case"ellipse":s=qt(i,s,n),o=Yo(i);break;case"line":s=qt(i,s,n),o=Ko(i);break;case"defs":r=!0;break;case"use":{s=qt(i,s,n);const d=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),p=(u=i.viewportElement)==null?void 0:u.getElementById(d);p?Hn(p,s,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(i);break}if(s.display==="none")return t;const a=new Ct,l=[],h=Wo(i,a,l);o&&(o.applyTransform(a),t.push(o),o.style={...s});const c=i.childNodes;for(let f=0,d=c.length;f<d;f++){const p=c[f];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||Hn(p,s,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function ti(i){var t;const e=Zr(i);return new ae(Hn(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}const ia=new Set(["©","®","÷"]),sa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),oa={1:"italic",32:"bold"},aa={1:"italic",2:"bold"},ei={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class ni{constructor(e,t,n){T(this,"path",new Tt);T(this,"lineBox",new Z);T(this,"inlineBox",new Z);T(this,"glyphBox");T(this,"advanceWidth",0);T(this,"advanceHeight",0);T(this,"underlinePosition",0);T(this,"underlineThickness",0);T(this,"strikeoutPosition",0);T(this,"strikeoutSize",0);T(this,"ascender",0);T(this,"descender",0);T(this,"typoAscender",0);T(this,"typoDescender",0);T(this,"typoLineGap",0);T(this,"winAscent",0);T(this,"winDescent",0);T(this,"xHeight",0);T(this,"capHeight",0);T(this,"baseline",0);T(this,"centerDiviation",0);T(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get compatibleGlyphBox(){const e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new Z(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new Z(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(e){const t=this.computedStyle.fontFamily,n=e??Rs,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSFNT()}updateGlyph(e=this._getFontSFNT()){if(!e)return this;const{hhea:t,os2:n,post:r,head:o}=e,s=o.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:u}=this,{fontSize:f}=c,d=s/f,p=e.getAdvanceWidth(h,f),y=(a+Math.abs(l))/d,g=a/d;return this.advanceWidth=p,this.advanceHeight=y,this.inlineBox.width=u?y:p,this.inlineBox.height=u?p:y,this.underlinePosition=(a-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(a-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=g,this.centerDiviation=y/2-g,this.fontStyle=oa[n.fsSelection]??aa[o.macStyle],this}update(e){const t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:u,advanceWidth:f,advanceHeight:d}=this,{left:p,top:y}=a,g=o.fontStyle==="italic"&&u!=="italic";let M=p,A=y+s,b;const C=new Tt;if(n&&(M+=(d-f)/2,Math.abs(f-d)>.1&&(A-=(l-c)/(l+Math.abs(h))*d),b=void 0),n&&!ia.has(r)&&(r.codePointAt(0)<=256||sa.has(r))){C.addCommands(t.getPathCommands(r,M,y+s-(d-f)/2,o.fontSize));const v={y:y-(d-f)/2+d/2,x:M+f/2};g&&this._italic(C,n?{x:v.x,y:y-(d-f)/2+s}:void 0),C.rotate(90,v)}else b!==void 0?(C.addCommands(t.glyphs.get(b).getPathCommands(M,A,o.fontSize)),g&&this._italic(C,n?{x:M+f/2,y:y+c/(l+Math.abs(h))*d}:void 0)):(C.addCommands(t.getPathCommands(r,M,A,o.fontSize)),g&&this._italic(C,n?{x:M+d/2,y:A}:void 0));const x=o.fontWeight??400;return x in ei&&(x===700||x==="bold")&&u!=="bold"&&C.bold(ei[x]*o.fontSize*.05),C.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new Z(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)ne(r);else{e.save(),e.beginPath();const o=this.path.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:o.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};Nn(e,s),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function Xn(){const i=new Map;async function e(n){if(!i.has(n)){i.set(n,n);try{i.set(n,await fetch(n).then(r=>r.text()))}catch(r){console.warn(r),i.delete(n)}}}function t(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:i,needsLoad:t,load:e}}function Zn(i){const e=new Map;function t(n){let r=e.get(n);if(!r){const o=Zr(i.needsLoad(n)?i.loaded.get(n)??n:n),s=ti(o);r={dom:o,pathSet:s},e.set(n,r)}return r}return{parsed:e,parse:t}}function Et(i){return i==null||i==="none"}var an=an||{};an.parse=function(){const i={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function t(k){const P=new Error(`${e}: ${k}`);throw P.source=e,P}function n(){const k=r();return e.length>0&&t("Invalid input not EOF"),k}function r(){return b(o)}function o(){return s("linear-gradient",i.linearGradient,l)||s("repeating-linear-gradient",i.repeatingLinearGradient,l)||s("radial-gradient",i.radialGradient,u)||s("repeating-radial-gradient",i.repeatingRadialGradient,u)}function s(k,P,F){return a(P,z=>{const H=F();return H&&(E(i.comma)||t("Missing comma before color stops")),{type:k,orientation:H,colorStops:b(C)}})}function a(k,P){const F=E(k);if(F){E(i.startCall)||t("Missing (");const z=P(F);return E(i.endCall)||t("Missing )"),z}}function l(){const k=h();if(k)return k;const P=j("position-keyword",i.positionKeywords,1);return P?{type:"directional",value:P.value}:c()}function h(){return j("directional",i.sideOrCorner,1)}function c(){return j("angular",i.angleValue,1)||j("angular",i.radianValue,1)}function u(){let k,P=f(),F;return P&&(k=[],k.push(P),F=e,E(i.comma)&&(P=f(),P?k.push(P):e=F)),k}function f(){let k=d()||p();if(k)k.at=g();else{const P=y();if(P){k=P;const F=g();F&&(k.at=F)}else{const F=g();if(F)k={type:"default-radial",at:F};else{const z=M();z&&(k={type:"default-radial",at:z})}}}return k}function d(){const k=j("shape",/^(circle)/i,0);return k&&(k.style=$()||y()),k}function p(){const k=j("shape",/^(ellipse)/i,0);return k&&(k.style=M()||I()||y()),k}function y(){return j("extent-keyword",i.extentKeywords,1)}function g(){if(j("position",/^at/,0)){const k=M();return k||t("Missing positioning value"),k}}function M(){const k=A();if(k.x||k.y)return{type:"position",value:k}}function A(){return{x:I(),y:I()}}function b(k){let P=k();const F=[];if(P)for(F.push(P);E(i.comma);)P=k(),P?F.push(P):t("One extra comma");return F}function C(){const k=x();return k||t("Expected color definition"),k.length=I(),k}function x(){return S()||L()||B()||D()||w()||R()||v()}function v(){return j("literal",i.literalColor,0)}function S(){return j("hex",i.hexColor,1)}function w(){return a(i.rgbColor,()=>({type:"rgb",value:b(U)}))}function D(){return a(i.rgbaColor,()=>({type:"rgba",value:b(U)}))}function R(){return a(i.varColor,()=>({type:"var",value:N()}))}function B(){return a(i.hslColor,()=>{E(i.percentageValue)&&t("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const P=U();E(i.comma);let F=E(i.percentageValue);const z=F?F[1]:null;E(i.comma),F=E(i.percentageValue);const H=F?F[1]:null;return(!z||!H)&&t("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[P,z,H]}})}function L(){return a(i.hslaColor,()=>{const k=U();E(i.comma);let P=E(i.percentageValue);const F=P?P[1]:null;E(i.comma),P=E(i.percentageValue);const z=P?P[1]:null;E(i.comma);const H=U();return(!F||!z)&&t("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[k,F,z,H]}})}function N(){return E(i.variableName)[1]}function U(){return E(i.number)[1]}function I(){return j("%",i.percentageValue,1)||X()||O()||$()}function X(){return j("position-keyword",i.positionKeywords,1)}function O(){return a(i.calcValue,()=>{let k=1,P=0;for(;k>0&&P<e.length;){const z=e.charAt(P);z==="("?k++:z===")"&&k--,P++}k>0&&t("Missing closing parenthesis in calc() expression");const F=e.substring(0,P-1);return G(P-1),{type:"calc",value:F}})}function $(){return j("px",i.pixelValue,1)||j("em",i.emValue,1)}function j(k,P,F){const z=E(P);if(z)return{type:k,value:z[F]}}function E(k){let P,F;return F=/^\s+/.exec(e),F&&G(F[0].length),P=k.exec(e),P&&G(P[0].length),P}function G(k){e=e.substr(k)}return function(k){return e=k.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}(),an.parse.bind(an);var ln=ln||{};ln.stringify=function(){var i={"visit_linear-gradient":function(e){return i.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return i.visit_gradient(e)},"visit_radial-gradient":function(e){return i.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return i.visit_gradient(e)},visit_gradient:function(e){var t=i.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+i.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=i.visit(e.at),r=i.visit(e.style);return r&&(t+=" "+r),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=i.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=i.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return i.visit(e.value.x)+" "+i.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return i.visit_color(e.value,e)},visit_hex:function(e){return i.visit_color("#"+e.value,e)},visit_rgb:function(e){return i.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return i.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return i.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return i.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return i.visit_color("var("+e.value+")",e)},visit_color:function(e,t){var n=e,r=i.visit(t.length);return r&&(n+=" "+r),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach(function(r,o){t+=i.visit(r),o<n-1&&(t+=", ")}),t},visit_object:function(e){return e.width&&e.height?i.visit(e.width)+" "+i.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return i.visit_array(e);if(typeof e=="object"&&!e.type)return i.visit_object(e);if(e.type){var t=i["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return i.visit(e)}}(),ln.stringify.bind(ln);function la(){return{boxShadow:"none"}}function ha(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ca(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ua(){return{...ha(),...ca(),...la(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function fa(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function pa(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function da(){return{...fa(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function ga(){return{...pa(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ya(){return{...ga(),...da(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function ma(){return{...ua(),...ya()}}function hn(i,e){return typeof i=="number"?i:i.endsWith("%")?(i=i.substring(0,i.length-1),Math.ceil(Number(i)/100*e.total)):i.endsWith("rem")?(i=i.substring(0,i.length-3),Number(i)*e.fontSize):i.endsWith("em")?(i=i.substring(0,i.length-2),Number(i)*e.fontSize):Number(i)}function cn(i){return Et(i)?{}:i}function ri(i,e){const t=Object.keys(i),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(o=>le(i[o],e[o]))}function le(i,e){const t=typeof i;return t===typeof e?t==="object"?ri(i,e):i===e:!1}function xa(i){const e=i.startsWith("#")?i.slice(1):i;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${o}, ${s})`}function un(i){if(!i)return i;const e={};for(const t in i)i[t]!==""&&i[t]!==void 0&&(e[t]=i[t]);return e}class ii{constructor(e,t={},n){T(this,"inlineBox",new Z);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...un(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new ni(n,t++,this));return this.characters=e,this}}class ve{constructor(e,t){T(this,"lineBox",new Z);T(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...un(this.parentStyle),...un(this.style)},this}addFragment(e,t){const n=new ii(e,t,this);return this.fragments.push(n),n}}function va(i){return i}const be=class be{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];be.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&be.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),o={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":o.justifyContent="flex-start";break;case"center":o.justifyContent="center";break;case"end":case"right":o.justifyContent="flex-end";break}switch(t.verticalAlign){case"top":o.alignItems="flex-start";break;case"middle":o.alignItems="center";break;case"bottom":o.alignItems="flex-end";break}const a=!!(o.justifyContent||o.alignItems);Object.assign(r.style,{...this._styleToDomStyle({...o,boxSizing:o.boxSizing??"border-box",display:o.display??(a?"inline-flex":void 0),width:o.width??"max-content",height:o.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all",position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(u=>{const f=document.createElement("span");Object.assign(f.style,{verticalAlign:"inherit",...this._styleToDomStyle(u.style)}),f.appendChild(document.createTextNode(u.content)),c.appendChild(f)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(o=>{var u;const s=r+=n.substring(r).indexOf(o),a=s+o.length;r+=o.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((u=t.getClientRects)==null?void 0:u.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let u=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(f=>{r.push({...f,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDomText(f.firstChild).forEach(d=>{r.push({...d,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:u++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const u=e[l].fragments[h].characters[c],{fontHeight:f,isVertical:d}=u,p=o[s];u.inlineBox.left=p.left,u.inlineBox.top=p.top,u.inlineBox.width=p.width,u.inlineBox.height=p.height,d?(u.lineBox.left=p.left+(p.width-f)/2,u.lineBox.top=p.top,u.lineBox.width=f,u.lineBox.height=p.height):(u.lineBox.left=p.left,u.lineBox.top=p.top+(p.height-f)/2,u.lineBox.width=p.width,u.lineBox.height=f),s++}),{paragraphs:e,boundingBox:new Z(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const o=this.measureParagraphDom(e,n);return r==null||r(),o}};T(be,"notZeroStyles",new Set(["width","height"])),T(be,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let fn=be;class wa{constructor(){T(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(r):this.eventListeners.set(e,[o,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var o,s;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((o=c.options)!=null&&o.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(s=r.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,o;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let s=n.length,a=0;a<s;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((o=n.options)!=null&&o.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function si(){const i=new ae,e=Xn(),t=Zn(e);return{name:"background",pathSet:i,load:async n=>{const{backgroundImage:r}=n.style;r&&e.needsLoad(r)&&await e.load(r)},update:n=>{i.paths.length=0;const{style:r,lineBox:o,isVertical:s}=n,{backgroundImage:a,backgroundSize:l,backgroundColormap:h}=r;if(Et(a))return;const{pathSet:c}=t.parse(a),u=c.getBoundingBox(!0);let f,d,p,y;s?{x:d,y:f,width:y,height:p}=o:{x:f,y:d,width:p,height:y}=o;const g=cn(h??"none"),M=c.paths.map(x=>{const v=x.clone();return v.style.fill&&v.style.fill in g&&(v.style.fill=g[v.style.fill]),v.style.stroke&&v.style.stroke in g&&(v.style.stroke=g[v.style.stroke]),v});let A,b;if(l==="rigid"){A=Math.max(n.fontSize*5/u.width),b=A;const x=new _;x.x=u.width-p/A,x.y=u.height-y/b,M.forEach(v=>{v.applyTransform(S=>{const w=S.x>u.left+u.width/2,D=S.y>u.top+u.height/2;w&&(S.x-=x.x),D&&(S.y-=x.y)})})}else A=p/u.width,b=y/u.height;const C=new Ct;C.translate(-u.x,-u.y),C.scale(A,b),s&&(C.translate(-p/2,-y/2),C.rotate(-Math.PI/2),C.translate(y/2,p/2)),C.translate(f,d),M.forEach(x=>{x.applyTransform(v=>{v.applyMatrix3(C)})}),i.paths.push(...M)},renderOrder:-2,render:(n,r)=>{const{boundingBox:o,computedStyle:s}=r;Et(s.backgroundColor)||(n.fillStyle=s.backgroundColor,n.fillRect(...o.array)),i.paths.forEach(a=>{if(ne({ctx:n,path:a,fontSize:s.fontSize}),r.debug){const l=new ae([a]).getBoundingBox();l&&n.strokeRect(l.x,l.y,l.width,l.height)}}),r.paragraphs.forEach(a=>{const{lineBox:l,style:h}=a;Et(h.backgroundColor)||(n.fillStyle=h.backgroundColor,n.fillRect(...l.array)),a.fragments.forEach(c=>{const{inlineBox:u,style:f}=c;Et(f.backgroundColor)||(n.fillStyle=f.backgroundColor,n.fillRect(...u.array))})})}}}function pn(i){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:o,highlightSize:s,highlightThickness:a}=i;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??o??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function oi(){const i=new ae,e=[],t=Xn(),n=Zn(t);return{name:"highlight",pathSet:i,load:async r=>{const o=new Set;r.forEachCharacter(s=>{const{computedStyle:a}=s,{image:l,referImage:h}=pn(a);l&&t.needsLoad(l)&&o.add(l),h&&t.needsLoad(h)&&o.add(h)}),await Promise.all(Array.from(o).map(s=>t.load(s)))},update:r=>{e.length=0,i.paths.length=0;let o=[],s,a;r.forEachCharacter(l=>{const{computedStyle:h}=l,c=pn(h),{image:u,colormap:f,line:d,size:p,thickness:y}=c;if(Et(u))s!=null&&s.length&&(s=[],o.push(s));else{const{inlineBox:g,isVertical:M}=l,{fontSize:A}=h;(!a||le(a.image,u)&&le(a.colormap,f)&&le(a.line,d)&&le(a.size,p)&&le(a.thickness,y))&&(s!=null&&s.length)&&(M?s[0].inlineBox.left===g.left:s[0].inlineBox.top===g.top)&&s[0].fontSize===A?s.push(l):(s=[],s.push(l),o.push(s))}a=c}),o=o.filter(l=>l.length);for(let l=0;l<o.length;l++){const h=o[l],c=h[0],u=Z.from(...h.map(E=>E.compatibleGlyphBox));if(!u.height||!u.width)continue;const{computedStyle:f,isVertical:d,inlineBox:p,compatibleGlyphBox:y,strikeoutPosition:g,underlinePosition:M}=c,{fontSize:A}=f,{image:b,referImage:C,colormap:x,line:v,size:S,thickness:w}=pn(f),D=hn(w,{fontSize:A,total:u.width})/u.width,R=cn(x),{pathSet:B,dom:L}=n.parse(b),N=B.getBoundingBox(!0),U=A/N.width*2,I=new Z().copy(u);d&&(I.width=u.height,I.height=u.width,I.left=u.left+u.width);const X=Math.floor(I.width);let O=X;S!=="cover"&&(O=hn(S,{fontSize:A,total:u.width})||X,I.width=O);const $=!Et(C)&&Et(v);if($)N.copy(n.parse(C).pathSet.getBoundingBox(!0));else{let E;if(Et(v))if(N.width/N.height>4){E="underline";const G=L.getAttribute("viewBox");if(G){const[k,P,F,z]=G.split(" ").map(Y=>Number(Y)),H=P+z/2;N.y<H&&N.y+N.height>H?E="line-through":N.y+N.height<H?E="overline":E="underline"}}else E="outline";else E=v;switch(E){case"outline":{const G=I.width*.2,k=I.height*.2;d?(I.x-=k/2,I.y-=G/2,I.x-=I.height):(I.x-=G/2,I.y-=k/2),I.width+=G,I.height+=k;break}case"overline":I.height=N.height*U,d?I.x=p.left+p.width:I.y=p.top;break;case"line-through":I.height=N.height*U,d?I.x=p.left+p.width-g+I.height/2:I.y=p.top+g-I.height/2;break;case"underline":I.height=N.height*U,d?I.x=y.left+y.width-M:I.y=p.top+M;break}}const j=new Ct;if(j.translate(-N.x,-N.y),j.scale(I.width/N.width,I.height/N.height),d){const E=I.width/2,G=I.height/2;$||j.translate(-E,-G),j.rotate(-Math.PI/2),$||j.translate(G,E)}j.translate(I.x,I.y);for(let E=0;E<Math.ceil(X/O);E++){const G=j.clone();d?G.translate(0,E*I.width):G.translate(E*I.width,0),B.paths.forEach(k=>{const P=k.clone().applyTransform(G);P.style.strokeWidth&&(P.style.strokeWidth*=U*D),P.style.strokeMiterlimit&&(P.style.strokeMiterlimit*=U),P.style.strokeDashoffset&&(P.style.strokeDashoffset*=U),P.style.strokeDasharray&&(P.style.strokeDasharray=P.style.strokeDasharray.map(F=>F*U)),P.style.fill&&P.style.fill in R&&(P.style.fill=R[P.style.fill]),P.style.stroke&&P.style.stroke in R&&(P.style.stroke=R[P.style.stroke]),i.paths.push(P),X!==O&&(d?e[i.paths.length-1]=new Z(u.left-u.width*2,u.top,u.width*4,u.height):e[i.paths.length-1]=new Z(u.left,u.top-u.height*2,u.width,u.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const r=[];return i.paths.forEach((o,s)=>{const a=e[s];let l=o.getBoundingBox();if(a){const h=Math.max(l.x,a.x),c=Math.max(l.y,a.y),u=Math.min(l.right,a.right),f=Math.min(l.bottom,a.bottom);l=new Z(h,c,u-h,f-c)}r.push(l)}),Z.from(...r)},render:(r,o)=>{i.paths.forEach((s,a)=>{if(ne({ctx:r,path:s,fontSize:o.computedStyle.fontSize,clipRect:e[a]}),o.debug){const l=new ae([s]).getBoundingBox();l&&r.strokeRect(l.x,l.y,l.width,l.height)}})}}}function ba(i,e){return`<svg width="${i*2}" height="${i*2}" xmlns="http://www.w3.org/2000/svg">
6
- <circle cx="${i}" cy="${i}" r="${i}" fill="${e}" />
7
- </svg>`}function ai(){const i=new ae;return{name:"listStyle",pathSet:i,update:e=>{i.paths.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,o=r*.45;t.forEach(s=>{var v;const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:u,listStyleType:f}=a,d=cn(c);let p=u,y;if(!Et(h))y=h;else if(!Et(f)){const S=r*.38/2;switch(p=p==="cover"?S*2:p,f){case"disc":y=ba(S,String(l));break}}if(!y)return;const g=ti(y),M=g.getBoundingBox(),A=(v=s.fragments[0])==null?void 0:v.characters[0];if(!A)return;const{inlineBox:b}=A,C=p==="cover"?1:hn(p,{total:r,fontSize:r})/r,x=new Ct;if(n){const S=r/M.height*C;x.translate(-M.left,-M.top).rotate(Math.PI/2).scale(S,S).translate(b.left+(b.width-M.height*S)/2,b.top-o)}else{const S=r/M.height*C;x.translate(-M.left,-M.top).scale(S,S).translate(b.left-M.width*S-o,b.top+(b.height-M.height*S)/2)}i.paths.push(...g.paths.map(S=>{const w=S.clone();return w.applyTransform(x),w.style.fill&&w.style.fill in d&&(w.style.fill=d[w.style.fill]),w.style.stroke&&w.style.stroke in d&&(w.style.stroke=d[w.style.stroke]),w}))})}}}function li(){return{name:"outline"}}const Jt=new _,we=new Ct,te=new Ct;function hi(){return{name:"render",getBoundingBox:i=>{const{characters:e,fontSize:t,effects:n}=i,r=[];return e.forEach(o=>{n==null||n.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=dn(i,s);Jt.set(a.left,a.top),Jt.applyMatrix3(l),a.left=Jt.x,a.top=Jt.y,Jt.set(a.right,a.bottom),Jt.applyMatrix3(l),a.width=Jt.x-a.left,a.height=Jt.y-a.top;const h=(s.shadowOffsetX??0)*t,c=(s.shadowOffsetY??0)*t,u=Math.max(.1,s.textStrokeWidth??0)*t;a.left+=h-u,a.top+=c-u,a.width+=u*2,a.height+=u*2,r.push(a)})}),r.length?Z.from(...r):void 0},render:(i,e)=>{const{paragraphs:t,glyphBox:n,effects:r}=e;r?r.forEach(o=>{Gt(o,n,i),i.save();const[s,a,l,h,c,u]=dn(e,o).transpose().elements;i.transform(s,h,a,c,l,u),e.forEachCharacter(f=>{f.drawTo(i,o)}),i.restore()}):t.forEach(o=>{o.fragments.forEach(s=>{s.characters.forEach(a=>{a.drawTo(i)})})}),e.debug&&t.forEach(o=>{i.strokeRect(o.lineBox.x,o.lineBox.y,o.lineBox.width,o.lineBox.height)})}}}function dn(i,e){const{fontSize:t,glyphBox:n}=i,r=(e.translateX??0)*t,o=(e.translateY??0)*t,s=Math.PI*2,a=(e.skewX??0)/360*s,l=(e.skewY??0)/360*s,{left:h,top:c,width:u,height:f}=n,d=h+u/2,p=c+f/2;return we.identity(),te.makeTranslation(r,o),we.multiply(te),te.makeTranslation(d,p),we.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),we.multiply(te),te.makeTranslation(-d,-p),we.multiply(te),we.clone()}function ci(){const i=new ae;return{name:"textDecoration",pathSet:i,update:e=>{i.paths.length=0;const t=[];let n,r;e.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:u,strikeoutSize:f}=o,{color:d,textDecoration:p,writingMode:y}=s;if(Et(p))r=void 0;else{let g=!1;if((r==null?void 0:r.textDecoration)===p&&(r==null?void 0:r.writingMode)===y&&(r==null?void 0:r.color)===d&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(p){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(g=!0);break;case"line-through":n[0].strikeoutPosition===u&&n[0].strikeoutSize===f&&(g=!0);break}g?n.push(o):(n=[],n.push(o),t.push(n)),r=s}}),t.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:u}=o[0],{color:f,textDecoration:d}=s,p=Z.from(...o.map(S=>S.inlineBox)),{left:y,top:g,width:M,height:A}=p;let b=a?y+M:g;const C=a?-1:1;let x=0;switch(d){case"overline":x=h*2;break;case"underline":b+=C*l,x=h*2;break;case"line-through":b+=C*c,x=u*2;break}b-=x;let v;a?v=new Tt([{type:"M",x:b,y:g},{type:"L",x:b,y:g+A},{type:"L",x:b+x,y:g+A},{type:"L",x:b+x,y:g},{type:"Z"}],{fill:f}):v=new Tt([{type:"M",x:y,y:b},{type:"L",x:y+M,y:b},{type:"L",x:y+M,y:b+x},{type:"L",x:y,y:b+x},{type:"Z"}],{fill:f}),i.paths.push(v)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(o=>{e.save();const[s,a,l,h,c,u]=dn(t,o).transpose().elements;e.transform(s,h,a,c,l,u),i.paths.forEach(f=>{ne({ctx:e,path:f,fontSize:r.fontSize,...o})}),e.restore()}):i.paths.forEach(o=>{ne({ctx:e,path:o,fontSize:r.fontSize})})}}}const Yn=ma();class Kn extends wa{constructor(t={}){super();T(this,"debug");T(this,"content");T(this,"style");T(this,"effects");T(this,"measureDom");T(this,"needsUpdate",!0);T(this,"computedStyle",{...Yn});T(this,"paragraphs",[]);T(this,"lineBox",new Z);T(this,"rawGlyphBox",new Z);T(this,"glyphBox",new Z);T(this,"pathBox",new Z);T(this,"boundingBox",new Z);T(this,"measurer",new fn);T(this,"plugins",new Map);T(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(si()).use(li()).use(ai()).use(ci()).use(oi()).use(hi()),(t.plugins??[]).forEach(n=>{this.use(n)}),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,r)=>{n.fragments.forEach((o,s)=>{o.characters.forEach((a,l)=>{t(a,{paragraphIndex:r,fragmentIndex:s,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...Yn,...this.style};let{content:t,computedStyle:n}=this;const r=[];if(typeof t=="string"){const o=new ve({},n);o.addFragment(t),r.push(o)}else{t=Array.isArray(t)?t:[t];for(const o of t)if(typeof o=="string"){const s=new ve({},n);s.addFragment(o),r.push(s)}else if(Array.isArray(o)){const s=new ve({},n);o.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&s.addFragment(l,h)}}),r.push(s)}else if("fragments"in o){const{fragments:s,...a}=o,l=new ve(a,n);s.forEach(h=>{const{content:c,...u}=h;c!==void 0&&l.addFragment(c,u)}),r.push(l)}else if("content"in o){const{content:s,...a}=o;if(s!==void 0){const l=new ve(a,n);l.addFragment(s),r.push(l)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((o,s)=>(o.updateOrder??0)-(s.updateOrder??0)).forEach(o=>{var s;(s=o.update)==null||s.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in n)r[o]=this[o],this[o]=n[o];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=_.MAX,n=_.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:o}=r,{left:s,top:a,width:l,height:h}=o,c=new _(s,a),u=new _(s+l,a+h);t.min(c,u),n.max(c,u)}}),new Z(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=Z.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>{var n;return t.getBoundingBox?t.getBoundingBox(this):(n=t.pathSet)==null?void 0:n.getBoundingBox()}).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=Z.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const n in t)this[n]=t[n];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:n,pixelRatio:r=2}=t,o=n.getContext("2d");o&&(this.needsUpdate&&this.update(),Qn(o,r,this.boundingBox),Jn(o,this),Array.from(this.plugins.values()).sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;if(s.render)(a=s.render)==null||a.call(s,o,this);else if(s.pathSet){const l=this.computedStyle;s.pathSet.paths.forEach(h=>{ne({ctx:o,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function Sa(i,e){const t=new Kn(i);return e?t.load().then(()=>t.measure()):t.measure()}function Ca(i,e){const t=new Kn(i);return e?t.load().then(()=>t.render(i)):t.render(i)}W.Character=ni,W.Fragment=ii,W.Measurer=fn,W.Paragraph=ve,W.Text=Kn,W.background=si,W.createSVGLoader=Xn,W.createSVGParser=Zn,W.definePlugin=va,W.drawPath=ne,W.filterEmpty=un,W.getHighlightStyle=pn,W.getTransform2D=dn,W.hexToRgb=xa,W.highlight=oi,W.isEqualObject=ri,W.isEqualValue=le,W.listStyle=ai,W.measureText=Sa,W.outline=li,W.parseColor=ct,W.parseColormap=cn,W.parseValueNumber=hn,W.render=hi,W.renderText=Ca,W.setupView=Qn,W.textDecoration=ci,W.textDefaultStyle=Yn,W.uploadColor=Gt,W.uploadColors=Jn,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
4
+ }`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((i,o)=>i||this.loaded.get(o),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:i=!0,injectStyleTag:o=!0,...s}=t;let u,a;if(typeof e=="string"?u=e:{src:u,family:a}=e,this.loaded.has(u))return n&&(this.loading.forEach(d=>d.cancel()),this.loading.clear()),c(this.loaded.get(u));let l=this.loading.get(u);return l||(l=this._createRequest(u,s),this.loading.set(u,l)),n&&this.loading.forEach((d,p)=>{d!==l&&(d.cancel(),this.loading.delete(p))}),l.when.then(d=>{if(this.loaded.has(u))return c(this.loaded.get(u));{const p=f(d);return t.noAdd||this.loaded.set(u,p),p.familySet.forEach(g=>{this.familyToUrl.set(g,u),typeof document<"u"&&(i&&this.injectFontFace(g,d),o&&this.injectStyleTag(g,u))}),p}}).catch(d=>{if(d instanceof DOMException&&d.message==="The user aborted a request.")return f();throw d}).finally(()=>{this.loading.delete(u)});function h(){return a?Array.isArray(a)?a:[a]:[]}function c(d){return h().forEach(p=>{d.familySet.add(p)}),d}function f(d=new ArrayBuffer(0)){let p;function g(){return p||(p=d.byteLength?Fo(d,!1):void 0),p}function D(){const S=g();if(S instanceof zt||S instanceof Zn)return S.sfnt}return{src:u,family:a,buffer:d,familySet:new Set(h()),getFont:g,getSFNT:D}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};E(Mn,"defaultRequestInit",{cache:"force-cache"});let Yn=Mn;const wo=new Yn;function Co(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let o=Gi(r,0,i,t,!0);const s=[];if(!o||o.next===o.prev)return s;let u,a,l;if(n&&(o=Mo(r,e,o,t)),r.length>80*t){u=1/0,a=1/0;let h=-1/0,c=-1/0;for(let f=t;f<i;f+=t){const d=r[f],p=r[f+1];d<u&&(u=d),p<a&&(a=p),d>h&&(h=d),p>c&&(c=p)}l=Math.max(h-u,c-a),l=l!==0?32767/l:0}return Ve(o,s,t,u,a,l,0),s}function Gi(r,e,t,n,i){let o;if(i===Vo(r,e,t,n)>0)for(let s=e;s<t;s+=n)o=Xi(s/n|0,r[s],r[s+1],o);else for(let s=t-n;s>=e;s-=n)o=Xi(s/n|0,r[s],r[s+1],o);return o&&ve(o,o.next)&&(Re(o),o=o.next),o}function le(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ve(t,t.next)||tt(t.prev,t,t.next)===0)){if(Re(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ve(r,e,t,n,i,o,s){if(!r)return;!s&&o&&_o(r,n,i,o);let u=r;for(;r.prev!==r.next;){const a=r.prev,l=r.next;if(o?Eo(r,n,i,o):bo(r)){e.push(a.i,r.i,l.i),Re(r),r=l.next,u=l.next;continue}if(r=l,r===u){s?s===1?(r=So(le(r),e),Ve(r,e,t,n,i,o,2)):s===2&&Bo(r,e,t,n,i,o):Ve(le(r),e,t,n,i,o,1);break}}}function bo(r){const e=r.prev,t=r,n=r.next;if(tt(e,t,n)>=0)return!1;const i=e.x,o=t.x,s=n.x,u=e.y,a=t.y,l=n.y,h=Math.min(i,o,s),c=Math.min(u,a,l),f=Math.max(i,o,s),d=Math.max(u,a,l);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=d&&ze(i,u,o,a,s,l,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Eo(r,e,t,n){const i=r.prev,o=r,s=r.next;if(tt(i,o,s)>=0)return!1;const u=i.x,a=o.x,l=s.x,h=i.y,c=o.y,f=s.y,d=Math.min(u,a,l),p=Math.min(h,c,f),g=Math.max(u,a,l),D=Math.max(h,c,f),S=Kn(d,p,e,t,n),C=Kn(g,D,e,t,n);let x=r.prevZ,b=r.nextZ;for(;x&&x.z>=S&&b&&b.z<=C;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=D&&x!==i&&x!==s&&ze(u,h,a,c,l,f,x.x,x.y)&&tt(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=d&&b.x<=g&&b.y>=p&&b.y<=D&&b!==i&&b!==s&&ze(u,h,a,c,l,f,b.x,b.y)&&tt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=S;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=D&&x!==i&&x!==s&&ze(u,h,a,c,l,f,x.x,x.y)&&tt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=C;){if(b.x>=d&&b.x<=g&&b.y>=p&&b.y<=D&&b!==i&&b!==s&&ze(u,h,a,c,l,f,b.x,b.y)&&tt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function So(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ve(n,i)&&Wi(n,t,t.next,i)&&Ne(n,i)&&Ne(i,n)&&(e.push(n.i,t.i,i.i),Re(t),Re(t.next),t=r=i),t=t.next}while(t!==r);return le(t)}function Bo(r,e,t,n,i,o){let s=r;do{let u=s.next.next;for(;u!==s.prev;){if(s.i!==u.i&&Lo(s,u)){let a=Hi(s,u);s=le(s,s.next),a=le(a,a.next),Ve(s,e,t,n,i,o,0),Ve(a,e,t,n,i,o,0);return}u=u.next}s=s.next}while(s!==r)}function Mo(r,e,t,n){const i=[];for(let o=0,s=e.length;o<s;o++){const u=e[o]*n,a=o<s-1?e[o+1]*n:r.length,l=Gi(r,u,a,n,!1);l===l.next&&(l.steiner=!0),i.push(Oo(l))}i.sort(Ao);for(let o=0;o<i.length;o++)t=Po(i[o],t);return t}function Ao(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function Po(r,e){const t=To(r,e);if(!t)return e;const n=Hi(t,r);return le(n,n.next),le(t,t.next)}function To(r,e){let t=e;const n=r.x,i=r.y;let o=-1/0,s;if(ve(r,t))return t;do{if(ve(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const c=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(c<=n&&c>o&&(o=c,s=t.x<t.next.x?t:t.next,c===n))return s}t=t.next}while(t!==e);if(!s)return null;const u=s,a=s.x,l=s.y;let h=1/0;t=s;do{if(n>=t.x&&t.x>=a&&n!==t.x&&qi(i<l?n:o,i,a,l,i<l?o:n,i,t.x,t.y)){const c=Math.abs(i-t.y)/(n-t.x);Ne(t,r)&&(c<h||c===h&&(t.x>s.x||t.x===s.x&&ko(s,t)))&&(s=t,h=c)}t=t.next}while(t!==u);return s}function ko(r,e){return tt(r.prev,r,e.prev)<0&&tt(e.next,r,r.next)<0}function _o(r,e,t,n){let i=r;do i.z===0&&(i.z=Kn(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Io(i)}function Io(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let s=n,u=0;for(let l=0;l<t&&(u++,s=s.nextZ,!!s);l++);let a=t;for(;u>0||a>0&&s;)u!==0&&(a===0||!s||n.z<=s.z)?(i=n,n=n.nextZ,u--):(i=s,s=s.nextZ,a--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=s}o.nextZ=null,t*=2}while(e>1);return r}function Kn(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Oo(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function qi(r,e,t,n,i,o,s,u){return(i-s)*(e-u)>=(r-s)*(o-u)&&(r-s)*(n-u)>=(t-s)*(e-u)&&(t-s)*(o-u)>=(i-s)*(n-u)}function ze(r,e,t,n,i,o,s,u){return!(r===s&&e===u)&&qi(r,e,t,n,i,o,s,u)}function Lo(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!$o(r,e)&&(Ne(r,e)&&Ne(e,r)&&Uo(r,e)&&(tt(r.prev,r,e.prev)||tt(r,e.prev,e))||ve(r,e)&&tt(r.prev,r,r.next)>0&&tt(e.prev,e,e.next)>0)}function tt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ve(r,e){return r.x===e.x&&r.y===e.y}function Wi(r,e,t,n){const i=hn(tt(r,e,t)),o=hn(tt(r,e,n)),s=hn(tt(t,n,r)),u=hn(tt(t,n,e));return!!(i!==o&&s!==u||i===0&&ln(r,t,e)||o===0&&ln(r,n,e)||s===0&&ln(t,r,n)||u===0&&ln(t,e,n))}function ln(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function hn(r){return r>0?1:r<0?-1:0}function $o(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Wi(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ne(r,e){return tt(r.prev,r,r.next)<0?tt(r,e,r.next)>=0&&tt(r,r.prev,e)>=0:tt(r,e,r.prev)<0||tt(r,r.next,e)<0}function Uo(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Hi(r,e){const t=Qn(r.i,r.x,r.y),n=Qn(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function Xi(r,e,t,n){const i=Qn(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Re(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Qn(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vo(r,e,t,n){let i=0;for(let o=e,s=t-n;o<t;o+=n)i+=(r[s]-r[o])*(r[o+1]+r[s+1]),s=o;return i}function zo(r,e,t,n={}){const{radius:i=1}=n;r.moveTo(e,t),r.arc(e,t,i,0,Math.PI*2)}const No={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Jn(r,e){const{fill:t="#000",stroke:n="none",strokeWidth:i=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:u=0,strokeDasharray:a=[],strokeDashoffset:l=0,shadowOffsetX:h=0,shadowOffsetY:c=0,shadowBlur:f=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;r.fillStyle=t,r.strokeStyle=n,r.lineWidth=i,r.lineCap=o,r.lineJoin=No[s],r.miterLimit=u,r.setLineDash(a),r.lineDashOffset=l,r.shadowOffsetX=h,r.shadowOffsetY=c,r.shadowBlur=f,r.shadowColor=d}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,i=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),u=Math.cos(n);return this.set(t.x+(i*u-o*s),t.y-(i*s+o*u)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){const i=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=i*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const i=this.x-n.x,o=this.y-n.y;return this.x=n.x+(i+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*i),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class Z{constructor(e=0,t=0,n=0,i=0){this.left=e,this.top=t,this.width=n,this.height=i}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new Z;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((i,o)=>(i.left=Math.min(i.left,o.left),i.top=Math.min(i.top,o.top),i.right=Math.max(i.right,o.right),i.bottom=Math.max(i.bottom,o.bottom),i),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new Z(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new Z(this.left,this.top,this.width,this.height)}}class Et{constructor(e=1,t=0,n=0,i=0,o=1,s=0,u=0,a=0,l=1){E(this,"elements",[]);this.set(e,t,n,i,o,s,u,a,l)}set(e,t,n,i,o,s,u,a,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=u,h[3]=t,h[4]=o,h[5]=a,h[6]=n,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,o=this.elements,s=n[0],u=n[3],a=n[6],l=n[1],h=n[4],c=n[7],f=n[2],d=n[5],p=n[8],g=i[0],D=i[3],S=i[6],C=i[1],x=i[4],b=i[7],m=i[2],F=i[5],w=i[8];return o[0]=s*g+u*C+a*m,o[3]=s*D+u*x+a*F,o[6]=s*S+u*b+a*w,o[1]=l*g+h*C+c*m,o[4]=l*D+h*x+c*F,o[7]=l*S+h*b+c*w,o[2]=f*g+d*C+p*m,o[5]=f*D+d*x+p*F,o[8]=f*S+d*b+p*w,this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],a=e[6],l=e[7],h=e[8],c=h*s-u*l,f=u*a-h*o,d=l*o-s*a,p=t*c+n*f+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/p;return e[0]=c*g,e[1]=(i*l-h*n)*g,e[2]=(u*n-i*s)*g,e[3]=f*g,e[4]=(h*t-i*a)*g,e[5]=(i*o-u*t)*g,e[6]=d*g,e[7]=(n*a-l*t)*g,e[8]=(s*t-n*o)*g,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(ti.makeScale(e,t)),this}rotate(e){return this.premultiply(ti.makeRotation(-e)),this}translate(e,t){return this.premultiply(ti.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const ti=new Et;function Zi(r,e,t,n){const i=r*t+e*n,o=Math.sqrt(r*r+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,i/o)));return r*n-e*t<0&&(s=-s),s}function Ro(r,e,t,n,i,o,s,u){if(e===0||t===0){r.lineTo(u.x,u.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const a=(s.x-u.x)/2,l=(s.y-u.y)/2,h=Math.cos(n)*a+Math.sin(n)*l,c=-Math.sin(n)*a+Math.cos(n)*l;let f=e*e,d=t*t;const p=h*h,g=c*c,D=p/f+g/d;if(D>1){const j=Math.sqrt(D);e=j*e,t=j*t,f=e*e,d=t*t}const S=f*g+d*p,C=(f*d-S)/S;let x=Math.sqrt(Math.max(0,C));i===o&&(x=-x);const b=x*e*c/t,m=-x*t*h/e,F=Math.cos(n)*b-Math.sin(n)*m+(s.x+u.x)/2,w=Math.sin(n)*b+Math.cos(n)*m+(s.y+u.y)/2,v=Zi(1,0,(h-b)/e,(c-m)/t),O=Zi((h-b)/e,(c-m)/t,(-h-b)/e,(-c-m)/t)%(Math.PI*2);r.ellipse(F,w,e,t,n,v,v+O,o===0)}const rt={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Wt(r,e,t=0){let u=0,a=!0,l="",h="";const c=[];function f(D,S,C){const x=new SyntaxError(`Unexpected character "${D}" at index ${S}.`);throw x.partial=C,x}function d(){l!==""&&(h===""?c.push(Number(l)):c.push(Number(l)*10**Number(h))),l="",h=""}let p;const g=r.length;for(let D=0;D<g;D++){if(p=r[D],Array.isArray(e)&&e.includes(c.length%t)&&rt.FLAGS.test(p)){u=1,l=p,d();continue}if(u===0){if(rt.WHITESPACE.test(p))continue;if(rt.DIGIT.test(p)||rt.SIGN.test(p)){u=1,l=p;continue}if(rt.POINT.test(p)){u=2,l=p;continue}rt.COMMA.test(p)&&(a&&f(p,D,c),a=!0)}if(u===1){if(rt.DIGIT.test(p)){l+=p;continue}if(rt.POINT.test(p)){l+=p,u=2;continue}if(rt.EXP.test(p)){u=3;continue}rt.SIGN.test(p)&&l.length===1&&rt.SIGN.test(l[0])&&f(p,D,c)}if(u===2){if(rt.DIGIT.test(p)){l+=p;continue}if(rt.EXP.test(p)){u=3;continue}rt.POINT.test(p)&&l[l.length-1]==="."&&f(p,D,c)}if(u===3){if(rt.DIGIT.test(p)){h+=p;continue}if(rt.SIGN.test(p)){if(h===""){h+=p;continue}h.length===1&&rt.SIGN.test(h)&&f(p,D,c)}}rt.WHITESPACE.test(p)?(d(),u=0,a=!1):rt.COMMA.test(p)?(d(),u=0,a=!0):rt.SIGN.test(p)?(d(),u=1,l=p):rt.POINT.test(p)?(d(),u=2,l=p):f(p,D,c)}return d(),c}function Fe(r,e){return r-(e-r)}function Yi(r,e){const t=new A,n=new A;for(let i=0,o=r.length;i<o;i++){const s=r[i];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(Fe(t.x,n.x),Fe(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(Fe(t.x,n.x),Fe(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const u=Fe(t.x,n.x),a=Fe(t.y,n.y);n.x=u,n.y=a,s.type==="t"?(e.quadraticCurveTo(u,a,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(u,a,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const u=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),Ro(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,u,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function jo(r){let e,t;const n=[];for(let i=0,o=r.length;i<o;i++){const s=r[i];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const Go=/[a-df-z][^a-df-z]*/gi;function Ki(r){const e=[],t=r.match(Go);if(!t)return e;for(let n=0,i=t.length;n<i;n++){const o=t[n],s=o.charAt(0),u=o.slice(1).trim();let a;switch(s){case"m":case"M":a=Wt(u);for(let l=0,h=a.length;l<h;l+=2)l===0?e.push({type:s,x:a[l],y:a[l+1]}):e.push({type:s==="m"?"l":"L",x:a[l],y:a[l+1]});break;case"h":case"H":a=Wt(u);for(let l=0,h=a.length;l<h;l++)e.push({type:s,x:a[l]});break;case"v":case"V":a=Wt(u);for(let l=0,h=a.length;l<h;l++)e.push({type:s,y:a[l]});break;case"l":case"L":a=Wt(u);for(let l=0,h=a.length;l<h;l+=2)e.push({type:s,x:a[l],y:a[l+1]});break;case"c":case"C":a=Wt(u);for(let l=0,h=a.length;l<h;l+=6)e.push({type:s,x1:a[l],y1:a[l+1],x2:a[l+2],y2:a[l+3],x:a[l+4],y:a[l+5]});break;case"s":case"S":a=Wt(u);for(let l=0,h=a.length;l<h;l+=4)e.push({type:s,x2:a[l],y2:a[l+1],x:a[l+2],y:a[l+3]});break;case"q":case"Q":a=Wt(u);for(let l=0,h=a.length;l<h;l+=4)e.push({type:s,x1:a[l],y1:a[l+1],x:a[l+2],y:a[l+3]});break;case"t":case"T":a=Wt(u);for(let l=0,h=a.length;l<h;l+=2)e.push({type:s,x:a[l],y:a[l+1]});break;case"a":case"A":a=Wt(u,[3,4],7);for(let l=0,h=a.length;l<h;l+=7)e.push({type:s,rx:a[l],ry:a[l+1],angle:a[l+2],largeArcFlag:a[l+3],sweepFlag:a[l+4],x:a[l+5],y:a[l+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function Qi(r,e,t,n,i){const o=(n-e)*.5,s=(i-t)*.5,u=r*r,a=r*u;return(2*t-2*n+o+s)*a+(-3*t+3*n-2*o-s)*u+o*r+t}function qo(r,e){const t=1-r;return t*t*t*e}function Wo(r,e){const t=1-r;return 3*t*t*r*e}function Ho(r,e){return 3*(1-r)*r*r*e}function Xo(r,e){return r*r*r*e}function Ji(r,e,t,n,i){return qo(r,e)+Wo(r,t)+Ho(r,n)+Xo(r,i)}function tr(r,e={}){let{vertices:t=[],indices:n=[],holes:i=[],verticesStride:o=2,verticesOffset:s=t.length/o,indicesOffset:u=n.length}=e;const a=Co(r,i,2);if(a.length){for(let h=0;h<a.length;h+=3)n[u++]=a[h]+s,n[u++]=a[h+1]+s,n[u++]=a[h+2]+s;let l=s*o;for(let h=0;h<r.length;h+=2)t[l]=r[h],t[l+1]=r[h+1],l+=o}return{vertices:t,indices:n}}const Zo=8,cn=11920929e-14,Yo=1;function Ko(r,e,t,n,i,o,s,u,a=.5,l=[]){const c=Math.min(.99,Math.max(0,a));let f=(Yo-c)/1;return f*=f,ei(r,e,t,n,i,o,s,u,l,f,0),l.push(s,u),l}function ei(r,e,t,n,i,o,s,u,a,l,h){if(h>Zo)return;const c=(r+t)/2,f=(e+n)/2,d=(t+i)/2,p=(n+o)/2,g=(i+s)/2,D=(o+u)/2,S=(c+d)/2,C=(f+p)/2,x=(d+g)/2,b=(p+D)/2,m=(S+x)/2,F=(C+b)/2;if(h>0){let w=s-r,v=u-e;const O=Math.abs((t-s)*v-(n-u)*w),j=Math.abs((i-s)*v-(o-u)*w);if(O>cn&&j>cn){if((O+j)*(O+j)<=l*(w*w+v*v)){a.push(m,F);return}}else if(O>cn){if(O*O<=l*(w*w+v*v)){a.push(m,F);return}}else if(j>cn){if(j*j<=l*(w*w+v*v)){a.push(m,F);return}}else if(w=m-(r+s)/2,v=F-(e+u)/2,w*w+v*v<=l){a.push(m,F);return}}ei(r,e,c,f,S,C,m,F,a,l,h+1),ei(m,F,x,b,g,D,s,u,a,l,h+1)}const Qo=8,Jo=11920929e-14,tu=1;function eu(r,e,t,n,i,o,s=.5,u=[]){const l=Math.min(.99,Math.max(0,s));let h=(tu-l)/1;return h*=h,ni(u,r,e,t,n,i,o,h,0),u.push(i,o),u}function ni(r,e,t,n,i,o,s,u,a){if(a>Qo)return;const l=(e+n)/2,h=(t+i)/2,c=(n+o)/2,f=(i+s)/2,d=(l+c)/2,p=(h+f)/2;let g=o-e,D=s-t;const S=Math.abs((n-o)*D-(i-s)*g);if(S>Jo){if(S*S<=u*(g*g+D*D)){r.push(d,p);return}}else if(g=d-(e+o)/2,D=p-(t+s)/2,g*g+D*D<=u){r.push(d,p);return}ni(r,e,t,l,h,d,p,u,a+1),ni(r,d,p,c,f,o,s,u,a+1)}function nu(r,e){let t=!1;const[n,i]=r,o=e.length/2;for(let s=0,u=o-1;s<o;u=s++){const a=e[s*2],l=e[s*2+1],h=e[u*2],c=e[u*2+1];l>i!=c>i&&n<(h-a)*(i-l)/(c-l)+a&&(t=!t)}return t}function iu(r,e){const t=1-r;return t*t*e}function ru(r,e){return 2*(1-r)*r*e}function su(r,e){return r*r*e}function er(r,e,t,n){return iu(r,e)+ru(r,t)+su(r,n)}const ou=1e-4,nr=1e-4;function uu(r,e={}){const{vertices:t=[],indices:n=[],lineStyle:i={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,u=ou;if(r.length===0)return{vertices:t,indices:n};const a=i;let l=a.alignment;if(i.alignment!==.5){let k=au(r);o&&(k*=-1),l=(l-.5)*k+.5}const h={x:r[0],y:r[1]},c={x:r[r.length-2],y:r[r.length-1]},f=s,d=Math.abs(h.x-c.x)<u&&Math.abs(h.y-c.y)<u;if(f){r=r.slice(),d&&(r.pop(),r.pop(),c.x=r[r.length-2],c.y=r[r.length-1]);const k=(h.x+c.x)*.5,N=(c.y+h.y)*.5;r.unshift(k,N),r.push(k,N)}const p=t,g=r.length/2;let D=r.length;const S=p.length/2,C=a.width/2,x=C*C,b=a.miterLimit*a.miterLimit;let m=r[0],F=r[1],w=r[2],v=r[3],O=0,j=0,_=-(F-v),L=m-w,z=0,I=0,P=Math.sqrt(_*_+L*L);_/=P,L/=P,_*=C,L*=C;const X=l,T=(1-X)*2,U=X*2;f||(a.cap==="round"?D+=he(m-_*(T-U)*.5,F-L*(T-U)*.5,m-_*T,F-L*T,m+_*U,F+L*U,p,!0)+2:a.cap==="square"&&(D+=ir(m,F,_,L,T,U,!0,p))),p.push(m-_*T,F-L*T),p.push(m+_*U,F+L*U);for(let k=1;k<g-1;++k){m=r[(k-1)*2],F=r[(k-1)*2+1],w=r[k*2],v=r[k*2+1],O=r[(k+1)*2],j=r[(k+1)*2+1],_=-(F-v),L=m-w,P=Math.sqrt(_*_+L*L),_/=P,L/=P,_*=C,L*=C,z=-(v-j),I=w-O,P=Math.sqrt(z*z+I*I),z/=P,I/=P,z*=C,I*=C;const N=w-m,M=F-v,B=w-O,$=j-v,V=N*B+M*$,H=M*B-$*N,Y=H<0;if(Math.abs(H)<.001*Math.abs(V)){p.push(w-_*T,v-L*T),p.push(w+_*U,v+L*U),V>=0&&(a.join==="round"?D+=he(w,v,w-_*T,v-L*T,w-z*T,v-I*T,p,!1)+4:D+=2,p.push(w-z*U,v-I*U),p.push(w+z*T,v+I*T));continue}const nt=(-_+m)*(-L+v)-(-_+w)*(-L+F),Zt=(-z+O)*(-I+v)-(-z+w)*(-I+j),Ot=(N*Zt-B*nt)/H,St=($*nt-M*Zt)/H,At=(Ot-w)*(Ot-w)+(St-v)*(St-v),ct=w+(Ot-w)*T,Pt=v+(St-v)*T,Nt=w-(Ot-w)*U,Rt=v-(St-v)*U,Lt=Math.min(N*N+M*M,B*B+$*$),jr=Y?T:U,Ea=Lt+jr*jr*x;At<=Ea?a.join==="bevel"||At/x>b?(Y?(p.push(ct,Pt),p.push(w+_*U,v+L*U),p.push(ct,Pt),p.push(w+z*U,v+I*U)):(p.push(w-_*T,v-L*T),p.push(Nt,Rt),p.push(w-z*T,v-I*T),p.push(Nt,Rt)),D+=2):a.join==="round"?Y?(p.push(ct,Pt),p.push(w+_*U,v+L*U),D+=he(w,v,w+_*U,v+L*U,w+z*U,v+I*U,p,!0)+4,p.push(ct,Pt),p.push(w+z*U,v+I*U)):(p.push(w-_*T,v-L*T),p.push(Nt,Rt),D+=he(w,v,w-_*T,v-L*T,w-z*T,v-I*T,p,!1)+4,p.push(w-z*T,v-I*T),p.push(Nt,Rt)):(p.push(ct,Pt),p.push(Nt,Rt)):(p.push(w-_*T,v-L*T),p.push(w+_*U,v+L*U),a.join==="round"?Y?D+=he(w,v,w+_*U,v+L*U,w+z*U,v+I*U,p,!0)+2:D+=he(w,v,w-_*T,v-L*T,w-z*T,v-I*T,p,!1)+2:a.join==="miter"&&At/x<=b&&(Y?(p.push(Nt,Rt),p.push(Nt,Rt)):(p.push(ct,Pt),p.push(ct,Pt)),D+=2),p.push(w-z*T,v-I*T),p.push(w+z*U,v+I*U),D+=2)}m=r[(g-2)*2],F=r[(g-2)*2+1],w=r[(g-1)*2],v=r[(g-1)*2+1],_=-(F-v),L=m-w,P=Math.sqrt(_*_+L*L),_/=P,L/=P,_*=C,L*=C,p.push(w-_*T,v-L*T),p.push(w+_*U,v+L*U),f||(a.cap==="round"?D+=he(w-_*(T-U)*.5,v-L*(T-U)*.5,w-_*T,v-L*T,w+_*U,v+L*U,p,!1)+2:a.cap==="square"&&(D+=ir(w,v,_,L,T,U,!1,p)));const R=nr*nr;for(let k=S;k<D+S-2;++k)m=p[k*2],F=p[k*2+1],w=p[(k+1)*2],v=p[(k+1)*2+1],O=p[(k+2)*2],j=p[(k+2)*2+1],!(Math.abs(m*(v-j)+w*(j-F)+O*(F-v))<R)&&n.push(k,k+1,k+2);return{vertices:t,indices:n}}function au(r){const e=r.length;if(e<6)return 1;let t=0;for(let n=0,i=r[e-2],o=r[e-1];n<e;n+=2){const s=r[n],u=r[n+1];t+=(s-i)*(u+o),i=s,o=u}return t<0?-1:1}function ir(r,e,t,n,i,o,s,u){const a=r-t*i,l=e-n*i,h=r+t*o,c=e+n*o;let f,d;s?(f=n,d=-t):(f=-n,d=t);const p=a+f,g=l+d,D=h+f,S=c+d;return u.push(p,g),u.push(D,S),2}function he(r,e,t,n,i,o,s,u){const a=t-r,l=n-e;let h=Math.atan2(a,l),c=Math.atan2(i-r,o-e);u&&h<c?h+=Math.PI*2:!u&&h>c&&(c+=Math.PI*2);let f=h;const d=c-h,p=Math.abs(d),g=Math.sqrt(a*a+l*l),D=(15*p*Math.sqrt(g)/Math.PI>>0)+1,S=d/D;if(f+=S,u){s.push(r,e),s.push(t,n);for(let C=1,x=f;C<D;C++,x+=S)s.push(r,e),s.push(r+Math.sin(x)*g,e+Math.cos(x)*g);s.push(r,e),s.push(i,o)}else{s.push(t,n),s.push(r,e);for(let C=1,x=f;C<D;C++,x+=S)s.push(r+Math.sin(x)*g,e+Math.cos(x)*g),s.push(r,e);s.push(i,o),s.push(r,e)}return D*2}class we{constructor(){E(this,"arcLengthDivision",200);E(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){const t=typeof e=="function";return this.getControlPointRefs().forEach(n=>{t?e(n):n.applyMatrix3(e)}),this}getUnevenVertices(e=5,t=[]){const n=new A;for(let i=0,o=Math.max(1,e)-1;i<=o;i++)this.getPoint(i/o,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){const n=new A;for(let i=0,o=Math.max(1,e)-1;i<=o;i++)this.getPointAt(i/o,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,i=e.length;n<i;n+=2){const o=e[n],s=e[n+1];t.push(new A(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenVertices(e):n=this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,i=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(i),t.push(n),i=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),i=n.length,o=t??e*n[i-1];if(i<2)return o/n[0];let s=0,u=0,a=i-1,l;for(;u<=a;)if(s=Math.floor(u+(a-u)/2),l=n[s]-o,l<0)u=s+1;else if(l>0)a=s-1;else{a=s;break}if(s=a,n[s]===o)return s/(i-1);const h=n[s],f=n[s+1]-h,d=(o-h)/f;return(s+d)/(i-1)}getTangent(e,t=new A){const i=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(i)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,i=1,o=(n+i)/2;for(;i-n>t;){o=(n+i)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:i=o}return o}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let i=0,o=n.length;i<o;i++){const s=n[i];e.min(s),t.max(s)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Z(e.x,e.y,t.x-e.x,t.y-e.y)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return tr(this.getFillVertices(e),e)}strokeTriangulate(e){return uu(this.getAdaptiveVertices(),e)}toCommands(){const e=[],t=this.getPoints();for(let n=0,i=t.length;n<i;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return jo(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const lu=new Et,rr=new Et,sr=new Et,fn=new A;class ii extends we{constructor(e=new A,t=new A,n=new A,i=0,o=0,s=Math.PI*2,u=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=i,this.startAngle=o,this.endAngle=s,this.clockwise=u}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){const e=Math.PI*2;let t=this.endAngle-this.startAngle;const n=Math.abs(t)<Number.EPSILON;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new A){const n=this._getDeltaAngle(),i=this.startAngle+e*n;let o=this.cx+this.rx*Math.cos(i),s=this.cy+this.ry*Math.sin(i);if(this.rotate!==0){const u=Math.cos(this.rotate),a=Math.sin(this.rotate),l=o-this.cx,h=s-this.cy;o=l*u-h*a+this.cx,s=l*a+h*u+this.cy}return t.set(o,s)}toCommands(){const{cx:e,cy:t,rx:n,ry:i,startAngle:o,endAngle:s,clockwise:u,rotate:a}=this,l=e+n*Math.cos(o)*Math.cos(a)-i*Math.sin(o)*Math.sin(a),h=t+n*Math.cos(o)*Math.sin(a)+i*Math.sin(o)*Math.cos(a),c=Math.abs(o-s),f=c>Math.PI?1:0,d=u?1:0,p=a*180/Math.PI;if(c>=2*Math.PI){const g=o+Math.PI,D=e+n*Math.cos(g)*Math.cos(a)-i*Math.sin(g)*Math.sin(a),S=t+n*Math.cos(g)*Math.sin(a)+i*Math.sin(g)*Math.cos(a);return[{type:"M",x:l,y:h},{type:"A",rx:n,ry:i,angle:p,largeArcFlag:0,sweepFlag:d,x:D,y:S},{type:"A",rx:n,ry:i,angle:p,largeArcFlag:0,sweepFlag:d,x:l,y:h}]}else{const g=e+n*Math.cos(s)*Math.cos(a)-i*Math.sin(s)*Math.sin(a),D=t+n*Math.cos(s)*Math.sin(a)+i*Math.sin(s)*Math.cos(a);return[{type:"M",x:l,y:h},{type:"A",rx:n,ry:i,angle:p,largeArcFlag:f,sweepFlag:d,x:g,y:D}]}}drawTo(e){const{cx:t,cy:n,rx:i,ry:o,rotate:s,startAngle:u,endAngle:a,clockwise:l}=this;return e.ellipse(t,n,i,o,s,u,a,!l),this}applyTransform(e){return fn.set(this.cx,this.cy),fn.applyMatrix3(e),this.cx=fn.x,this.cy=fn.y,fu(e)?hu(this,e):cu(this,e),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){const{cx:t,cy:n,rx:i,ry:o,dx:s,dy:u,startAngle:a,endAngle:l,clockwise:h}=this,c=!h,f=t,d=n,p=a,g=l;let D=Math.abs(p-g);(!c&&p>g||c&&g>p)&&(D=2*Math.PI-D);let S=Math.max(6,Math.floor(6*i**(1/3)*(D/Math.PI)));S=Math.max(S,3);let C=D/S,x=p;C*=c?-1:1;for(let b=0;b<S+1;b++){const m=Math.cos(x),F=Math.sin(x),w=f+s+m*i,v=d+u+F*o;e.push(w,v),x+=C}return e}_getAdaptiveVerticesByCircle(e=[]){const{cx:t,cy:n,rx:i,ry:o,dx:s,dy:u}=this;if(!(i>=0&&o>=0&&s>=0&&u>=0))return e;const a=Math.ceil(2.3*Math.sqrt(i+o)),l=t,h=n,c=a*8+(s?4:0)+(u?4:0);if(c===0)return e;const f=e.length;if(a===0)return e[f]=e[f+6]=l+s,e[f+1]=e[f+3]=h+u,e[f+2]=e[f+4]=l-s,e[f+5]=e[f+7]=h-u,e;let d=f,p=f+a*4+(s?2:0)+2,g=p,D=c,S=s+i,C=u,x=l+S,b=l-S,m=h+C;if(e[d++]=x,e[d++]=m,e[--p]=m,e[--p]=b,u){const w=h-C;e[g++]=b,e[g++]=w,e[--D]=w,e[--D]=x}for(let w=1;w<a;w++){const v=Math.PI/2*(w/a),O=s+Math.cos(v)*i,j=u+Math.sin(v)*o,_=l+O,L=l-O,z=h+j,I=h-j;e[d++]=_,e[d++]=z,e[--p]=z,e[--p]=L,e[g++]=L,e[g++]=I,e[--D]=I,e[--D]=_}S=s,C=u+o,x=l+S,b=l-S,m=h+C;const F=h-C;return e[d++]=x,e[d++]=m,e[--D]=F,e[--D]=x,s&&(e[d++]=b,e[d++]=m,e[--D]=F,e[--D]=b),e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:i,rx:o,ry:s,rotate:u}=this,a=Math.cos(u),l=Math.sin(u),h=Math.sqrt(o*o*a*a+s*s*l*l),c=Math.sqrt(o*o*l*l+s*s*a*a);return e.x=Math.min(e.x,n-h),e.y=Math.min(e.y,i-c),t.x=Math.max(t.x,n+h),t.y=Math.max(t.y,i+c),{min:e.finite(),max:t.finite()}}copy(e){return super.copy(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}}function hu(r,e){const t=r.rx,n=r.ry,i=Math.cos(r.rotate),o=Math.sin(r.rotate),s=new A(t*i,t*o),u=new A(-n*o,n*i),a=s.applyMatrix3(e),l=u.applyMatrix3(e),h=lu.set(a.x,l.x,0,a.y,l.y,0,0,0,1),c=rr.copy(h).invert(),p=sr.copy(c).transpose().multiply(c).elements,g=pu(p[0],p[1],p[4]),D=Math.sqrt(g.rt1),S=Math.sqrt(g.rt2);if(r.rx=1/D,r.ry=1/S,r.rotate=Math.atan2(g.sn,g.cs),!((r.endAngle-r.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=rr.set(D,0,0,0,S,0,0,0,1),b=sr.set(g.cs,g.sn,0,-g.sn,g.cs,0,0,0,1),m=x.multiply(b).multiply(h),F=w=>{const{x:v,y:O}=new A(Math.cos(w),Math.sin(w)).applyMatrix3(m);return Math.atan2(O,v)};r.startAngle=F(r.startAngle),r.endAngle=F(r.endAngle),or(e)&&(r.clockwise=!r.clockwise)}}function cu(r,e){const t=ur(e),n=ar(e);r.rx*=t,r.ry*=n;const i=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);r.rotate+=i,or(e)&&(r.startAngle*=-1,r.endAngle*=-1,r.clockwise=!r.clockwise)}function or(r){const e=r.elements;return e[0]*e[4]-e[1]*e[3]<0}function fu(r){const e=r.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=ur(r),i=ar(r);return Math.abs(t/(n*i))>Number.EPSILON}function ur(r){const e=r.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ar(r){const e=r.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function pu(r,e,t){let n,i,o,s,u;const a=r+t,l=r-t,h=Math.sqrt(l*l+4*e*e);return a>0?(n=.5*(a+h),u=1/n,i=r*u*t-e*u*e):a<0?i=.5*(a-h):(n=.5*h,i=-.5*h),l>0?o=l+h:o=l-h,Math.abs(o)>2*Math.abs(e)?(u=-2*e/o,s=1/Math.sqrt(1+u*u),o=u*s):Math.abs(e)===0?(o=1,s=0):(u=-.5*o/e,o=1/Math.sqrt(1+u*u),s=u*o),l>0&&(u=o,o=-s,s=u),{rt1:n,rt2:i,cs:o,sn:s}}class du extends ii{constructor(e=0,t=0,n=1,i=0,o=Math.PI*2,s=!1){super(new A(e,t),new A(n,n),new A,0,i,o,s)}drawTo(e){const{cx:t,cy:n,rx:i,startAngle:o,endAngle:s,clockwise:u}=this;return e.arc(t,n,i,o,s,!u),this}getAdaptiveVertices(e=[]){const{cx:t,cy:n,rx:i,startAngle:o,endAngle:s,clockwise:u}=this;let a=Math.abs(o-s);(!u&&o>s||u&&s>o)&&(a=2*Math.PI-a);let l=Math.max(6,Math.floor(6*i**(1/3)*(a/Math.PI)));l=Math.max(l,3);let h=a/l,c=o;h*=u?1:-1;for(let f=0;f<l+1;f++){const d=Math.cos(c),p=Math.sin(c),g=t+d*i,D=n+p*i;e.push(g,D),c+=h}return e}}class Kt extends we{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,i){return new Kt(new A(e,t),new A(n,i))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,p2:i}=this;return e.x=Math.min(e.x,n.x,i.x),e.y=Math.min(e.y,n.y,i.y),t.x=Math.max(t.x,n.x,i.x),t.y=Math.max(t.y,n.y,i.y),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}getFillVertices(e={}){var h,c;const t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),i=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),s=t,u=i,a=n-t||((h=e.style)==null?void 0:h.strokeWidth)||0,l=o-i||((c=e.style)==null?void 0:c.strokeWidth)||0;return[s,u,s+a,u,s+a,u+l,s,u+l]}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class je extends we{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof je?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),i=this.getLengths();let o=0;for(;o<i.length;){if(i[o]>=n){const s=i[o]-n,u=this.curves[o],a=u.getLength();return u.getPointAt(a===0?0:1-s/a,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,i=this.curves.length;t<i;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){const n=[e[t-1],e[t]],i=[e[t+1],e[t+2]];return n[0]===i[0]&&n[1]===i[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(i=>{i.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{const t=[];let n;return this.curves.forEach(i=>{let o;i instanceof Kt?o=i.getAdaptiveVertices():o=i.getFillVertices(e),t.push(...o),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new Z(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(i=>i.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class ri extends we{constructor(e=new A,t=new A,n=new A,i=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=i}static from(e,t,n,i,o,s,u,a){return new ri(new A(e,t),new A(n,i),new A(o,s),new A(u,a))}getPoint(e,t=new A){const{p1:n,cp1:i,cp2:o,p2:s}=this;return t.set(Ji(e,n.x,i.x,o.x,s.x),Ji(e,n.y,i.y,o.y,s.y))}getAdaptiveVertices(e=[]){return Ko(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){const i=t*t-4*e*n;if(i<0)return[];const o=Math.sqrt(i),s=(-t+o)/(2*e),u=(-t-o)/(2*e);return[s,u].filter(a=>a>=0&&a<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:i,cp2:o,p2:s}=this,u=this._solveQuadratic(3*(i.x-n.x),6*(o.x-i.x),3*(s.x-o.x)),a=this._solveQuadratic(3*(i.y-n.y),6*(o.y-i.y),3*(s.y-o.y)),l=[0,1,...u,...a];return((c,f)=>{for(const d of c)for(let p=0;p<=f;p++){const g=p/f-.5,D=Math.min(1,Math.max(0,d+g)),S=this.getPoint(D);e.x=Math.min(e.x,S.x),e.y=Math.min(e.y,S.y),t.x=Math.max(t.x,S.x),t.y=Math.max(t.y,S.y)}})(l,10),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,cp1:t,cp2:n,p2:i}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:i.x,y:i.y}]}drawTo(e){const{p1:t,cp1:n,cp2:i,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,i.x,i.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class Du extends ii{constructor(e=0,t=0,n=1,i=1,o=0,s=0,u=Math.PI*2,a=!1){super(new A(e,t),new A(n,i),new A,o,s,u,a)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class gu extends je{}class si extends we{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,i,o,s){return new si(new A(e,t),new A(n,i),new A(o,s))}getPoint(e,t=new A){const{p1:n,cp:i,p2:o}=this;return t.set(er(e,n.x,i.x,o.x),er(e,n.y,i.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return eu(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:i,p2:o}=this,s=.5*(n.x+i.x),u=.5*(n.y+i.y),a=.5*(n.x+o.x),l=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,a),e.y=Math.min(e.y,n.y,o.y,u,l),t.x=Math.max(t.x,n.x,o.x,s,a),t.y=Math.max(t.y,n.y,o.y,u,l),{min:e.finite(),max:t.finite()}}toCommands(){const{p1:e,cp:t,p2:n}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){const{p1:t,cp:n,p2:i}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,i.x,i.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class yu extends gu{constructor(e=0,t=0,n=0,i=0){super(),this.x=e,this.y=t,this.width=n,this.height=i,this.update()}update(){const{x:e,y:t,width:n,height:i}=this,o=[new A(e,t),new A(e+n,t),new A(e+n,t+i),new A(e,t+i)];return this.curves=[new Kt(o[0],o[1]),new Kt(o[1],o[2]),new Kt(o[2],o[3]),new Kt(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){const{x:t,y:n,width:i,height:o}=this;return[t,n,t+i,n,t+i,n+o,t,n+o]}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class mu extends ii{constructor(e=0,t=0,n=1,i=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=i,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:i,radius:o}=this,s=n/2,u=i/2,a=e+s,l=t+u,h=Math.max(0,Math.min(o,Math.min(s,u))),c=h;return this._center=new A(a,l),this._radius=new A(h,c),this._diff=new A(s-h,u-c),this}drawTo(e){const{x:t,y:n,width:i,height:o,radius:s}=this;return e.roundRect(t,n,i,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class xu extends we{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,i=(n.length-1)*e,o=Math.floor(i),s=i-o,u=n[o===0?o:o-1],a=n[o],l=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return t.set(Qi(s,u.x,a.x,l.x,h.x),Qi(s,u.y,a.y,l.y,h.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class pn extends je{constructor(t){super();E(this,"startPoint");E(this,"currentPoint");E(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,i=t.length;n<i;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return Yi(t,this),this}addData(t){return this.addCommands(Ki(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,n=[]){return this._closeVertices(super.getUnevenVertices(t,n))}getSpacedVertices(t=40,n=[]){return this._closeVertices(super.getSpacedVertices(t,n))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Kt(n.clone(),t.clone())),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const i=this.currentPoint;return i!=null&&i.equals({x:t,y:n})||this.curves.push(Kt.from((i==null?void 0:i.x)??0,(i==null?void 0:i.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,i,o,s,u){const a=this.currentPoint;return a!=null&&a.equals({x:s,y:u})||this.curves.push(ri.from((a==null?void 0:a.x)??0,(a==null?void 0:a.y)??0,t,n,i,o,s,u)),this._setCurrentPoint({x:s,y:u}),this}quadraticCurveTo(t,n,i,o){const s=this.currentPoint;return s!=null&&s.equals({x:i,y:o})||this.curves.push(si.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,i,o)),this._setCurrentPoint({x:i,y:o}),this}arc(t,n,i,o,s,u){const a=new du(t,n,i,o,s,!u);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint(a.getPoint(1)),this}relativeArc(t,n,i,o,s,u){var a,l;return t+=((a=this.currentPoint)==null?void 0:a.x)??0,n+=((l=this.currentPoint)==null?void 0:l.y)??0,this.arc(t,n,i,o,s,u),this}arcTo(t,n,i,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,i,o,s,u,a,l=!0){const h=new Du(t,n,i,o,s,u,a,!l);return this._connetLineTo(h),this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeEllipse(t,n,i,o,s,u,a,l){var h,c;return t+=((h=this.currentPoint)==null?void 0:h.x)??0,n+=((c=this.currentPoint)==null?void 0:c.y)??0,this.ellipse(t,n,i,o,s,u,a,l),this}rect(t,n,i,o){const s=new yu(t,n,i,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,i,o,s){const u=new mu(t,n,i,o,s);return this._connetLineTo(u),this.curves.push(u),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new xu([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var i;const n=(i=this.curves[0])==null?void 0:i.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function vu(r){return r.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Fu(r,e,t,n){const i=e.clone().sub(r),o=n.clone().sub(t),s=t.clone().sub(r),u=i.cross(o);if(u===0)return new A((r.x+t.x)/2,(r.y+t.y)/2);const a=s.cross(o)/u;return Math.abs(a)>1?new A((r.x+t.x)/2,(r.y+t.y)/2):new A(r.x+a*i.x,r.y+a*i.y)}class Mt extends je{constructor(t,n={}){super();E(this,"currentCurve",new pn);E(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Mt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){const n=this.curves.findIndex(i=>i===this.currentCurve);return n>-1&&this.curves.splice(n,1),t instanceof Mt?this.curves.push(...t.curves.filter(i=>i.curves.length).map(i=>i.clone())):t.curves.length&&this.curves.push(t),this.curves.push(this.currentCurve),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length&&(this.currentCurve=new pn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var i;return(i=this.currentCurve.currentPoint)!=null&&i.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new pn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,i,o,s,u){return this.currentCurve.bezierCurveTo(t,n,i,o,s,u),this}quadraticCurveTo(t,n,i,o){return this.currentCurve.quadraticCurveTo(t,n,i,o),this}arc(t,n,i,o,s,u){return this.currentCurve.arc(t,n,i,o,s,u),this}arcTo(t,n,i,o,s){return this.currentCurve.arcTo(t,n,i,o,s),this}ellipse(t,n,i,o,s,u,a,l){return this.currentCurve.ellipse(t,n,i,o,s,u,a,l),this}rect(t,n,i,o){return this.currentCurve.rect(t,n,i,o),this}roundRect(t,n,i,o,s){return this.currentCurve.roundRect(t,n,i,o,s),this}reset(){return this.currentCurve=new pn,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return Yi(t,this),this}addData(t){return this.addCommands(Ki(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,i={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,i)}),this}skew(t,n=0,i={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,i)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(i=>{i.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),i=[],o=[],s=[];n.forEach((a,l)=>{const h=a.getControlPointRefs(),c=a.isClockwise();s[l]=h,o[l]=c;const f=h[0],d=h[h.length-1]??f;i.push({start:c?d:f,end:c?f:d,index:l})});const u=[];return i.forEach((a,l)=>{u[l]=[],i.forEach((h,c)=>{var f;h.start&&a.end&&c!==l&&((f=h.start)!=null&&f.equals(a.end))&&u[l].push(h.index)})}),n.forEach((a,l)=>{const h=o[l];s[l].forEach(c=>{c.add(a.getNormal(a.getTForPoint(c)).scale(h?t:-t))})}),u.forEach((a,l)=>{const h=s[l];a.forEach(c=>{const f=s[c],d=Fu(h[h.length-1],h[h.length-2]??h[h.length-1],f[0],f[1]??f[0]);d&&(h[h.length-1].copy(d),f[0].copy(d))})}),this}getMinMax(t=A.MAX,n=A.MIN,i=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),i&&o>1){const u=o/2,a=s.isClockwise(),l=[];for(let h=0;h<=1;h+=1/s.arcLengthDivision){const c=s.getPoint(h),f=s.getNormal(h),d=f.clone().scale(a?u:-u),p=f.clone().scale(a?-u:u);l.push(c.clone().add(d),c.clone().add(p),c.clone().add({x:u,y:0}),c.clone().add({x:-u,y:0}),c.clone().add({x:0,y:u}),c.clone().add({x:0,y:-u}),c.clone().add({x:u,y:u}),c.clone().add({x:-u,y:-u}))}t.min(...l),n.max(...l)}}),{min:t.finite(),max:n.finite()}}strokeTriangulate(t){const n=(t==null?void 0:t.indices)??[],i=(t==null?void 0:t.vertices)??[];return this.curves.forEach(o=>{o.strokeTriangulate({...t,indices:n,vertices:i,style:{...this.style}})}),{indices:n,vertices:i}}fillTriangulate(t){const n={...t,style:{...this.style,...t==null?void 0:t.style}},i=n.indices??[],o=n.vertices??[];if((n.style.fillRule??"nonzero")==="nonzero"){const u=this.curves.map(h=>h.getFillVertices(n)),a=new Map,l=new Set;for(let h=0;h<u.length;h++){const c=[];for(let f=0;f<u.length;f++)h!==f&&nu([u[h][0],u[h][1]],u[f])&&c.push(f);c.length&&(c.forEach(f=>{let d=a.get(f);d||(d=new Set,a.set(f,d)),d.add(h)}),l.add(h))}u.forEach((h,c)=>{var p;if(l.has(c)||!h.length)return;const f=h.slice(),d=[];(p=a.get(c))==null||p.forEach(g=>{d.push(f.length/2),f.push(...u[g])}),tr(f,{...t,indices:i,vertices:o,holes:d,style:{...this.style}})})}else this.curves.forEach(u=>{u.fillTriangulate({...t,indices:i,vertices:o,style:{...this.style}})});return{indices:i,vertices:o}}getBoundingBox(t=!0){const{min:n,max:i}=this.getMinMax(void 0,void 0,t);return new Z(n.x,n.y,i.x-n.x,i.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:i="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Jn(t,n),this.curves.forEach(s=>{s.drawTo(t)}),i!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:i="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Jn(t,n),this.getControlPointRefs().forEach(s=>{zo(t,s.x,s.y,{radius:4})}),i!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[vu(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let i="";for(const o in n)n[o]!==void 0&&(i+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${i}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ce{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(i=>i.getMinMax(t,n,e)),new Z(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSVGString(e=this.paths.map(n=>n.fillTriangulate()),t=0){let n="";const i={x:-t,y:-t},o={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:a,indices:l})=>{const h=c=>{const f=a[c*2],d=a[c*2+1];return i.x=Math.min(i.x,f+t),o.x=Math.max(o.x,f+t),i.y=Math.min(i.y,d+t),o.y=Math.max(o.y,d+t),[f,d]};for(let c=0,f=l.length;c<f;c+=3){const d=h(l[c]),p=h(l[c+1]),g=h(l[c+2]);n+=`<polygon points="${d.join(",")} ${p.join(",")} ${g.join(",")}" fill="black" />`}});const u=[i.x,i.y,o.x-i.x,o.y-i.y];return`<svg width="${u[2]}" height="${u[3]}" viewBox="${u.join(" ")}" xmlns="http://www.w3.org/2000/svg">${n}</svg>`}toTriangulatedSVG(e,t){return new DOMParser().parseFromString(this.toTriangulatedSVGString(e,t),"image/svg+xml").documentElement}toSVGString(){const{x:e,y:t,width:n,height:i}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${i}" width="${n}px" height="${i}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:i,top:o,width:s,height:u}=this.getBoundingBox(),a=document.createElement("canvas");a.width=s*t,a.height=u*t,a.style.width=`${s}px`,a.style.height=`${u}px`;const l=a.getContext("2d");return l&&(l.scale(t,t),l.translate(-i,-o),this.paths.forEach(h=>{h.drawTo(l,n)})),a}}const lr="data:image/svg+xml;",hr=`${lr}base64,`,cr=`${lr}charset=utf8,`;function fr(r){if(typeof r=="string"){let e;r.startsWith(hr)?(r=r.substring(hr.length,r.length),e=atob(r)):r.startsWith(cr)?(r=r.substring(cr.length,r.length),e=decodeURIComponent(r)):e=r;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
5
+ ${e}`);return t.documentElement}else return r}const wu="px",Cu=90,pr=["mm","cm","in","pt","pc","px"],dr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function K(r){let e="px";if(typeof r=="string"||r instanceof String)for(let n=0,i=pr.length;n<i;n++){const o=pr[n];if(r.endsWith(o)){e=o,r=r.substring(0,r.length-o.length);break}}let t;return t=dr[e][wu],t<0&&(t=dr[e].in*Cu),t*Number.parseFloat(r)}const bu=new Et,dn=new Et,Dr=new Et,gr=new Et;function Eu(r,e,t){if(!(r.hasAttribute("transform")||r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))))return null;const n=Su(r);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Su(r){const e=new Et,t=bu;if(r.nodeName==="use"&&(r.hasAttribute("x")||r.hasAttribute("y"))&&e.translate(K(r.getAttribute("x")),K(r.getAttribute("y"))),r.hasAttribute("transform")){const n=r.getAttribute("transform").split(")");for(let i=n.length-1;i>=0;i--){const o=n[i].trim();if(o==="")continue;const s=o.indexOf("("),u=o.length;if(s>0&&s<u){const a=o.slice(0,s),l=Wt(o.slice(s+1));switch(t.identity(),a){case"translate":if(l.length>=1){const h=l[0];let c=0;l.length>=2&&(c=l[1]),t.translate(h,c)}break;case"rotate":if(l.length>=1){let h=0,c=0,f=0;h=l[0]*Math.PI/180,l.length>=3&&(c=l[1],f=l[2]),dn.makeTranslation(-c,-f),Dr.makeRotation(h),gr.multiplyMatrices(Dr,dn),dn.makeTranslation(c,f),t.multiplyMatrices(dn,gr)}break;case"scale":l.length>=1&&t.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&t.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&t.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&t.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}e.premultiply(t)}}return e}function Bu(r){return new Mt().arc(K(r.getAttribute("cx")||0),K(r.getAttribute("cy")||0),K(r.getAttribute("r")||0),0,Math.PI*2)}function Mu(r,e){if(!(!r.sheet||!r.sheet.cssRules||!r.sheet.cssRules.length))for(let t=0;t<r.sheet.cssRules.length;t++){const n=r.sheet.cssRules[t];if(n.type!==1)continue;const i=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,u=0;u<s;u++){const a=n.style.item(u);o[a]=n.style.getPropertyValue(a)}for(let s=0;s<i.length;s++)e[i[s]]=Object.assign(e[i[s]]||{},{...o})}}function Au(r){return new Mt().ellipse(K(r.getAttribute("cx")||0),K(r.getAttribute("cy")||0),K(r.getAttribute("rx")||0),K(r.getAttribute("ry")||0),0,0,Math.PI*2)}function Pu(r){return new Mt().moveTo(K(r.getAttribute("x1")||0),K(r.getAttribute("y1")||0)).lineTo(K(r.getAttribute("x2")||0),K(r.getAttribute("y2")||0))}function Tu(r){const e=new Mt,t=r.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const ku=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function _u(r){var n;const e=new Mt;let t=0;return(n=r.getAttribute("points"))==null||n.replace(ku,(i,o,s)=>{const u=K(o),a=K(s);return t===0?e.moveTo(u,a):e.lineTo(u,a),t++,i}),e.currentCurve.autoClose=!0,e}const Iu=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ou(r){var n;const e=new Mt;let t=0;return(n=r.getAttribute("points"))==null||n.replace(Iu,(i,o,s)=>{const u=K(o),a=K(s);return t===0?e.moveTo(u,a):e.lineTo(u,a),t++,i}),e.currentCurve.autoClose=!1,e}function Lu(r){const e=K(r.getAttribute("x")||0),t=K(r.getAttribute("y")||0),n=K(r.getAttribute("rx")||r.getAttribute("ry")||0),i=K(r.getAttribute("ry")||r.getAttribute("rx")||0),o=K(r.getAttribute("width")),s=K(r.getAttribute("height")),u=1-.551915024494,a=new Mt;return a.moveTo(e+n,t),a.lineTo(e+o-n,t),(n!==0||i!==0)&&a.bezierCurveTo(e+o-n*u,t,e+o,t+i*u,e+o,t+i),a.lineTo(e+o,t+s-i),(n!==0||i!==0)&&a.bezierCurveTo(e+o,t+s-i*u,e+o-n*u,t+s,e+o-n,t+s),a.lineTo(e+n,t+s),(n!==0||i!==0)&&a.bezierCurveTo(e+n*u,t+s,e,t+s-i*u,e,t+s-i),a.lineTo(e,t+i),(n!==0||i!==0)&&a.bezierCurveTo(e,t+i*u,e+n*u,t,e+n,t),a}function Ht(r,e,t){e=Object.assign({},e);let n={};if(r.hasAttribute("class")){const l=r.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<l.length;h++)n=Object.assign(n,t[`.${l[h]}`])}r.hasAttribute("id")&&(n=Object.assign(n,t[`#${r.getAttribute("id")}`]));for(let l=r.style.length,h=0;h<l;h++){const c=r.style.item(h),f=r.style.getPropertyValue(c);e[c]=f,n[c]=f}function i(l,h,c=o){r.hasAttribute(l)&&(e[h]=c(r.getAttribute(l))),n[l]&&(e[h]=c(n[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function s(l){return Math.max(0,Math.min(1,K(l)))}function u(l){return Math.max(0,K(l))}function a(l){return l.split(" ").filter(h=>h!=="").map(h=>K(h))}return i("fill","fill"),i("fill-opacity","fillOpacity",s),i("fill-rule","fillRule"),i("opacity","opacity",s),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",s),i("stroke-width","strokeWidth",u),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",u),i("stroke-dasharray","strokeDasharray",a),i("stroke-dashoffset","strokeDashoffset",K),i("visibility","visibility"),e}function oi(r,e,t=[],n={}){var c;if(r.nodeType!==1)return t;let i=!1,o=null,s={...e};switch(r.nodeName){case"svg":s=Ht(r,s,n);break;case"style":Mu(r,n);break;case"g":s=Ht(r,s,n);break;case"path":s=Ht(r,s,n),r.hasAttribute("d")&&(o=Tu(r));break;case"rect":s=Ht(r,s,n),o=Lu(r);break;case"polygon":s=Ht(r,s,n),o=_u(r);break;case"polyline":s=Ht(r,s,n),o=Ou(r);break;case"circle":s=Ht(r,s,n),o=Bu(r);break;case"ellipse":s=Ht(r,s,n),o=Au(r);break;case"line":s=Ht(r,s,n),o=Pu(r);break;case"defs":i=!0;break;case"use":{s=Ht(r,s,n);const d=(r.getAttributeNS("http://www.w3.org/1999/xlink","href")||r.getAttribute("href")||"").substring(1),p=(c=r.viewportElement)==null?void 0:c.getElementById(d);p?oi(p,s,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(r);break}if(s.display==="none")return t;const u=new Et,a=[],l=Eu(r,u,a);o&&(o.applyTransform(u),t.push(o),o.style={...s});const h=r.childNodes;for(let f=0,d=h.length;f<d;f++){const p=h[f];i&&p.nodeName!=="style"&&p.nodeName!=="defs"||oi(p,s,t,n)}return l&&(a.pop(),a.length>0?u.copy(a[a.length-1]):u.identity()),t}function yr(r){var t;const e=fr(r);return new ce(oi(e,{}),(t=e.getAttribute("viewBox"))==null?void 0:t.trim().split(" ").map(n=>Number(n)))}const $u=new Set(["©","®","÷"]),Uu=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),Vu={1:"italic",32:"bold"},zu={1:"italic",2:"bold"},mr={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class xr{constructor(e,t,n){E(this,"path",new Mt);E(this,"lineBox",new Z);E(this,"inlineBox",new Z);E(this,"glyphBox");E(this,"advanceWidth",0);E(this,"advanceHeight",0);E(this,"underlinePosition",0);E(this,"underlineThickness",0);E(this,"strikeoutPosition",0);E(this,"strikeoutSize",0);E(this,"ascender",0);E(this,"descender",0);E(this,"typoAscender",0);E(this,"typoDescender",0);E(this,"typoLineGap",0);E(this,"winAscent",0);E(this,"winDescent",0);E(this,"xHeight",0);E(this,"capHeight",0);E(this,"baseline",0);E(this,"centerDiviation",0);E(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get compatibleGlyphBox(){const e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new Z(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new Z(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(e){const t=this.computedStyle.fontFamily,n=e??wo,i=t?n.get(t):n.fallbackFont;return i==null?void 0:i.getSFNT()}updateGlyph(e=this._getFontSFNT()){if(!e)return this;const{hhea:t,os2:n,post:i,head:o}=e,s=o.unitsPerEm,u=t.ascent,a=t.descent,{content:l,computedStyle:h,isVertical:c}=this,{fontSize:f}=h,d=s/f,p=e.getAdvanceWidth(l,f),g=(u+Math.abs(a))/d,D=u/d;return this.advanceWidth=p,this.advanceHeight=g,this.inlineBox.width=c?g:p,this.inlineBox.height=c?p:g,this.underlinePosition=(u-i.underlinePosition)/d,this.underlineThickness=i.underlineThickness/d,this.strikeoutPosition=(u-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=u/d,this.descender=a/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=D,this.centerDiviation=g/2-D,this.fontStyle=Vu[n.fsSelection]??zu[o.macStyle],this}update(e){const t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:i,computedStyle:o,baseline:s,inlineBox:u,ascender:a,descender:l,typoAscender:h,fontStyle:c,advanceWidth:f,advanceHeight:d}=this,{left:p,top:g}=u,D=o.fontStyle==="italic"&&c!=="italic";let S=p,C=g+s,x;const b=new Mt;if(n&&(S+=(d-f)/2,Math.abs(f-d)>.1&&(C-=(a-h)/(a+Math.abs(l))*d),x=void 0),n&&!$u.has(i)&&(i.codePointAt(0)<=256||Uu.has(i))){b.addCommands(t.getPathCommands(i,S,g+s-(d-f)/2,o.fontSize));const F={y:g-(d-f)/2+d/2,x:S+f/2};D&&this._italic(b,n?{x:F.x,y:g-(d-f)/2+s}:void 0),b.rotate(90,F)}else x!==void 0?(b.addCommands(t.glyphs.get(x).getPathCommands(S,C,o.fontSize)),D&&this._italic(b,n?{x:S+f/2,y:g+h/(a+Math.abs(l))*d}:void 0)):(b.addCommands(t.getPathCommands(i,S,C,o.fontSize)),D&&this._italic(b,n?{x:S+d/2,y:C}:void 0));const m=o.fontWeight??400;return m in mr&&(m===700||m==="bold")&&c!=="bold"&&b.bold(mr[m]*o.fontSize*.05),b.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=b,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var i;if((i=this.path.curves[0])!=null&&i.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:i}=t;return new Z(n.x,n.y,i.x-n.x,i.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,i={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)oe(i);else{e.save(),e.beginPath();const o=this.path.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*i.fontSize,shadowOffsetY:(i.shadowOffsetY??0)*i.fontSize,shadowBlur:(i.shadowBlur??0)*i.fontSize,shadowColor:i.shadowColor};Jn(e,s),e.font=`${i.fontSize}px ${i.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function ui(){const r=new Map;async function e(n){if(!r.has(n)){r.set(n,n);try{r.set(n,await fetch(n).then(i=>i.text()))}catch(i){console.warn(i),r.delete(n)}}}function t(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob://")}return{loaded:r,needsLoad:t,load:e}}function ai(r){const e=new Map;function t(n){let i=e.get(n);if(!i){const o=fr(r.needsLoad(n)?r.loaded.get(n)??n:n),s=yr(o);i={dom:o,pathSet:s},e.set(n,i)}return i}return{parsed:e,parse:t}}var Nu={grad:.9,turn:360,rad:360/(2*Math.PI)},Qt=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ut=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},It=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},vr=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Fr=function(r){return{r:It(r.r,0,255),g:It(r.g,0,255),b:It(r.b,0,255),a:It(r.a)}},li=function(r){return{r:ut(r.r),g:ut(r.g),b:ut(r.b),a:ut(r.a,3)}},Ru=/^#([0-9a-f]{3,8})$/i,Dn=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},wr=function(r){var e=r.r,t=r.g,n=r.b,i=r.a,o=Math.max(e,t,n),s=o-Math.min(e,t,n),u=s?o===e?(t-n)/s:o===t?2+(n-e)/s:4+(e-t)/s:0;return{h:60*(u<0?u+6:u),s:o?s/o*100:0,v:o/255*100,a:i}},Cr=function(r){var e=r.h,t=r.s,n=r.v,i=r.a;e=e/360*6,t/=100,n/=100;var o=Math.floor(e),s=n*(1-t),u=n*(1-(e-o)*t),a=n*(1-(1-e+o)*t),l=o%6;return{r:255*[n,u,s,s,a,n][l],g:255*[a,n,n,u,s,s][l],b:255*[s,s,a,n,n,u][l],a:i}},br=function(r){return{h:vr(r.h),s:It(r.s,0,100),l:It(r.l,0,100),a:It(r.a)}},Er=function(r){return{h:ut(r.h),s:ut(r.s),l:ut(r.l),a:ut(r.a,3)}},Sr=function(r){return Cr((t=(e=r).s,{h:e.h,s:(t*=((n=e.l)<50?n:100-n)/100)>0?2*t/(n+t)*100:0,v:n+t,a:e.a}));var e,t,n},Ge=function(r){return{h:(e=wr(r)).h,s:(i=(200-(t=e.s))*(n=e.v)/100)>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,t,n,i},ju=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gu=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qu=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wu=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Br={string:[[function(r){var e=Ru.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ut(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ut(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=qu.exec(r)||Wu.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Fr({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(r){var e=ju.exec(r)||Gu.exec(r);if(!e)return null;var t,n,i=br({h:(t=e[1],n=e[2],n===void 0&&(n="deg"),Number(t)*(Nu[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Sr(i)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,n=r.b,i=r.a,o=i===void 0?1:i;return Qt(e)&&Qt(t)&&Qt(n)?Fr({r:Number(e),g:Number(t),b:Number(n),a:Number(o)}):null},"rgb"],[function(r){var e=r.h,t=r.s,n=r.l,i=r.a,o=i===void 0?1:i;if(!Qt(e)||!Qt(t)||!Qt(n))return null;var s=br({h:Number(e),s:Number(t),l:Number(n),a:Number(o)});return Sr(s)},"hsl"],[function(r){var e=r.h,t=r.s,n=r.v,i=r.a,o=i===void 0?1:i;if(!Qt(e)||!Qt(t)||!Qt(n))return null;var s=function(u){return{h:vr(u.h),s:It(u.s,0,100),v:It(u.v,0,100),a:It(u.a)}}({h:Number(e),s:Number(t),v:Number(n),a:Number(o)});return Cr(s)},"hsv"]]},Mr=function(r,e){for(var t=0;t<e.length;t++){var n=e[t][0](r);if(n)return[n,e[t][1]]}return[null,void 0]},Hu=function(r){return typeof r=="string"?Mr(r.trim(),Br.string):typeof r=="object"&&r!==null?Mr(r,Br.object):[null,void 0]},hi=function(r,e){var t=Ge(r);return{h:t.h,s:It(t.s+100*e,0,100),l:t.l,a:t.a}},ci=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ar=function(r,e){var t=Ge(r);return{h:t.h,s:t.s,l:It(t.l+100*e,0,100),a:t.a}},Pr=function(){function r(e){this.parsed=Hu(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ut(ci(this.rgba),2)},r.prototype.isDark=function(){return ci(this.rgba)<.5},r.prototype.isLight=function(){return ci(this.rgba)>=.5},r.prototype.toHex=function(){return e=li(this.rgba),t=e.r,n=e.g,i=e.b,s=(o=e.a)<1?Dn(ut(255*o)):"","#"+Dn(t)+Dn(n)+Dn(i)+s;var e,t,n,i,o,s},r.prototype.toRgb=function(){return li(this.rgba)},r.prototype.toRgbString=function(){return e=li(this.rgba),t=e.r,n=e.g,i=e.b,(o=e.a)<1?"rgba("+t+", "+n+", "+i+", "+o+")":"rgb("+t+", "+n+", "+i+")";var e,t,n,i,o},r.prototype.toHsl=function(){return Er(Ge(this.rgba))},r.prototype.toHslString=function(){return e=Er(Ge(this.rgba)),t=e.h,n=e.s,i=e.l,(o=e.a)<1?"hsla("+t+", "+n+"%, "+i+"%, "+o+")":"hsl("+t+", "+n+"%, "+i+"%)";var e,t,n,i,o},r.prototype.toHsv=function(){return e=wr(this.rgba),{h:ut(e.h),s:ut(e.s),v:ut(e.v),a:ut(e.a,3)};var e},r.prototype.invert=function(){return Xt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),Xt(hi(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),Xt(hi(this.rgba,-e))},r.prototype.grayscale=function(){return Xt(hi(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),Xt(Ar(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),Xt(Ar(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?Xt({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):ut(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=Ge(this.rgba);return typeof e=="number"?Xt({h:e,s:t.s,l:t.l,a:t.a}):ut(t.h)},r.prototype.isEqual=function(e){return this.toHex()===Xt(e).toHex()},r}(),Xt=function(r){return r instanceof Pr?r:new Pr(r)};function ht(r){return r==null||r==="none"}function qe(r,e=0,t=10**e){return Math.round(t*r)/t+0}function fi(r,e=!1){if(typeof r!="object"||!r)return r;if(Array.isArray(r))return e?r.map(n=>fi(n,e)):r;const t={};for(const n in r){const i=r[n];i!=null&&(e?t[n]=fi(i,e):t[n]=i)}return t}function Xu(r){let e;return typeof r=="number"?e={r:r>>24&255,g:r>>16&255,b:r>>8&255,a:(r&255)/255}:e=r,Xt(e)}function Zu(r){return{r:qe(r.r),g:qe(r.g),b:qe(r.b),a:qe(r.a,3)}}function gn(r){const e=r.toString(16);return e.length<2?`0${e}`:e}const Yu="#000000FF";function We(r,e=!1){const t=Xu(r);if(!t.isValid()){if(typeof r=="string")return r;const u=`Failed to normalizeColor ${r}`;if(e)throw new Error(u);return console.warn(u),Yu}const{r:n,g:i,b:o,a:s}=Zu(t.rgba);return`#${gn(n)}${gn(i)}${gn(o)}${gn(qe(s*255))}`}var yn=yn||{};yn.parse=function(){const r={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function t(M){const B=new Error(`${e}: ${M}`);throw B.source=e,B}function n(){const M=i();return e.length>0&&t("Invalid input not EOF"),M}function i(){return x(o)}function o(){return s("linear-gradient",r.linearGradient,a)||s("repeating-linear-gradient",r.repeatingLinearGradient,a)||s("radial-gradient",r.radialGradient,c)||s("repeating-radial-gradient",r.repeatingRadialGradient,c)}function s(M,B,$){return u(B,V=>{const H=$();return H&&(k(r.comma)||t("Missing comma before color stops")),{type:M,orientation:H,colorStops:x(b)}})}function u(M,B){const $=k(M);if($){k(r.startCall)||t("Missing (");const V=B($);return k(r.endCall)||t("Missing )"),V}}function a(){const M=l();if(M)return M;const B=R("position-keyword",r.positionKeywords,1);return B?{type:"directional",value:B.value}:h()}function l(){return R("directional",r.sideOrCorner,1)}function h(){return R("angular",r.angleValue,1)||R("angular",r.radianValue,1)}function c(){let M,B=f(),$;return B&&(M=[],M.push(B),$=e,k(r.comma)&&(B=f(),B?M.push(B):e=$)),M}function f(){let M=d()||p();if(M)M.at=D();else{const B=g();if(B){M=B;const $=D();$&&(M.at=$)}else{const $=D();if($)M={type:"default-radial",at:$};else{const V=S();V&&(M={type:"default-radial",at:V})}}}return M}function d(){const M=R("shape",/^(circle)/i,0);return M&&(M.style=U()||g()),M}function p(){const M=R("shape",/^(ellipse)/i,0);return M&&(M.style=S()||P()||g()),M}function g(){return R("extent-keyword",r.extentKeywords,1)}function D(){if(R("position",/^at/,0)){const M=S();return M||t("Missing positioning value"),M}}function S(){const M=C();if(M.x||M.y)return{type:"position",value:M}}function C(){return{x:P(),y:P()}}function x(M){let B=M();const $=[];if(B)for($.push(B);k(r.comma);)B=M(),B?$.push(B):t("One extra comma");return $}function b(){const M=m();return M||t("Expected color definition"),M.length=P(),M}function m(){return w()||L()||_()||O()||v()||j()||F()}function F(){return R("literal",r.literalColor,0)}function w(){return R("hex",r.hexColor,1)}function v(){return u(r.rgbColor,()=>({type:"rgb",value:x(I)}))}function O(){return u(r.rgbaColor,()=>({type:"rgba",value:x(I)}))}function j(){return u(r.varColor,()=>({type:"var",value:z()}))}function _(){return u(r.hslColor,()=>{k(r.percentageValue)&&t("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const B=I();k(r.comma);let $=k(r.percentageValue);const V=$?$[1]:null;k(r.comma),$=k(r.percentageValue);const H=$?$[1]:null;return(!V||!H)&&t("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[B,V,H]}})}function L(){return u(r.hslaColor,()=>{const M=I();k(r.comma);let B=k(r.percentageValue);const $=B?B[1]:null;k(r.comma),B=k(r.percentageValue);const V=B?B[1]:null;k(r.comma);const H=I();return(!$||!V)&&t("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[M,$,V,H]}})}function z(){return k(r.variableName)[1]}function I(){return k(r.number)[1]}function P(){return R("%",r.percentageValue,1)||X()||T()||U()}function X(){return R("position-keyword",r.positionKeywords,1)}function T(){return u(r.calcValue,()=>{let M=1,B=0;for(;M>0&&B<e.length;){const V=e.charAt(B);V==="("?M++:V===")"&&M--,B++}M>0&&t("Missing closing parenthesis in calc() expression");const $=e.substring(0,B-1);return N(B-1),{type:"calc",value:$}})}function U(){return R("px",r.pixelValue,1)||R("em",r.emValue,1)}function R(M,B,$){const V=k(B);if(V)return{type:M,value:V[$]}}function k(M){let B,$;return $=/^\s+/.exec(e),$&&N($[0].length),B=M.exec(e),B&&N(B[0].length),B}function N(M){e=e.substr(M)}return function(M){return e=M.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}(),yn.parse.bind(yn);var mn=mn||{};mn.stringify=function(){var r={"visit_linear-gradient":function(e){return r.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return r.visit_gradient(e)},"visit_radial-gradient":function(e){return r.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return r.visit_gradient(e)},visit_gradient:function(e){var t=r.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+r.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=r.visit(e.at),i=r.visit(e.style);return i&&(t+=" "+i),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=r.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=r.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return r.visit(e.value.x)+" "+r.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return r.visit_color(e.value,e)},visit_hex:function(e){return r.visit_color("#"+e.value,e)},visit_rgb:function(e){return r.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return r.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return r.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return r.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return r.visit_color("var("+e.value+")",e)},visit_color:function(e,t){var n=e,i=r.visit(t.length);return i&&(n+=" "+i),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach(function(i,o){t+=r.visit(i),o<n-1&&(t+=", ")}),t},visit_object:function(e){return e.width&&e.height?r.visit(e.width)+" "+r.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return r.visit_array(e);if(typeof e=="object"&&!e.type)return r.visit_object(e);if(e.type){var t=r["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return r.visit(e)}}(),mn.stringify.bind(mn);function Ku(){return{boxShadow:"none"}}function Qu(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Ju(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ta(){return{...Qu(),...Ju(),...Ku(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ea(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function na(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ia(){return{...ea(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function ra(){return{...na(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function sa(){return{...ra(),...ia(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function xn(r){return fi({...r,color:ht(r.color)?void 0:We(r.color),backgroundColor:ht(r.backgroundColor)?void 0:We(r.backgroundColor),borderColor:ht(r.borderColor)?void 0:We(r.borderColor),outlineColor:ht(r.outlineColor)?void 0:We(r.outlineColor),shadowColor:ht(r.shadowColor)?void 0:We(r.shadowColor)})}function oa(){return{...ta(),...sa()}}const Tr=/\r\n|\n\r|\n|\r/,ua=new RegExp(`${Tr.source}|<br\\/>`,"g"),aa=new RegExp(`^(${Tr.source})$`),vn=`
6
+ `;function Ce(r){return aa.test(r)}function He(r){return r.replace(ua,vn)}function la(r,e){const t=Array.from(new Set([...Object.keys(r),...Object.keys(e)]));return!t.length||t.every(n=>r[n]===e[n])}function pi(r){const e=[];function t(){return e[e.length-1]||n()}function n(s={}){let u=e[e.length-1];return(u==null?void 0:u.fragments.length)===0?(u={...s,fragments:[]},e[e.length-1]=u):(u={...s,fragments:[]},e.push(u)),u}function i(s="",u={}){Array.from(s).forEach(a=>{if(Ce(a)){const{fragments:l,...h}=t();l.length||l.push({...u,content:vn}),n(h)}else{const l=t(),h=l.fragments[l.fragments.length-1];if(h){const{content:c,...f}=h;if(la(u,f)){h.content=`${c}${a}`;return}}l.fragments.push({...u,content:a})}})}return(Array.isArray(r)?r:[r]).forEach(s=>{if(typeof s=="string")n(),i(s);else if("content"in s){const{content:u,...a}=s;n(xn(a)),i(u)}else if("fragments"in s){const{fragments:u,...a}=s;n(xn(a)),u.forEach(l=>{const{content:h,...c}=l;i(h,xn(c))})}else Array.isArray(s)?(n(),s.forEach(u=>{if(typeof u=="string")i(u);else{const{content:a,...l}=u;i(a,xn(l))}})):console.warn("Failed to parse text content",s)}),t().fragments.length||i(vn),e}function kr(r){return pi(r).map(e=>{const t=He(e.fragments.flatMap(n=>n.content).join(""));return Ce(t)?"":t}).join(vn)}function Fn(r,e){return typeof r=="number"?r:r.endsWith("%")?(r=r.substring(0,r.length-1),Math.ceil(Number(r)/100*e.total)):r.endsWith("rem")?(r=r.substring(0,r.length-3),Number(r)*e.fontSize):r.endsWith("em")?(r=r.substring(0,r.length-2),Number(r)*e.fontSize):Number(r)}function wn(r){return ht(r)?{}:r}function _r(r,e){const t=Object.keys(r),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(o=>fe(r[o],e[o]))}function fe(r,e){const t=typeof r;return t===typeof e?t==="object"?_r(r,e):r===e:!1}function ha(r){const e=r.startsWith("#")?r.slice(1):r;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(u=>u+u).join(""):e,i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i}, ${o}, ${s})`}function Cn(r){if(!r)return r;const e={};for(const t in r)r[t]!==""&&r[t]!==void 0&&(e[t]=r[t]);return e}class Ir{constructor(e,t={},n){E(this,"inlineBox",new Z);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...Cn(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new xr(n,t++,this));return this.characters=e,this}}class Or{constructor(e,t){E(this,"lineBox",new Z);E(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Cn(this.parentStyle),...Cn(this.style)},this}addFragment(e,t){const n=new Ir(e,t,this);return this.fragments.push(n),n}}function ca(r){return r}const Ee=class Ee{_toDOMStyle(e){const t={};for(const n in e){const i=e[n];Ee.notZeroStyles.has(n)&&i===0||(typeof i=="number"&&Ee.pxStyles.has(n)?t[n]=`${i}px`:t[n]=i)}return t}createDOM(e,t){const n=document.createElement("section"),i={...t},o=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":i.justifyContent="flex-start";break;case"center":i.justifyContent="center";break;case"end":case"right":i.justifyContent="flex-end";break}switch(t.verticalAlign){case"top":i.alignItems="flex-start";break;case"middle":i.alignItems="center";break;case"bottom":i.alignItems="flex-end";break}const s=!!(i.justifyContent||i.alignItems);Object.assign(n.style,{...this._toDOMStyle({...i,boxSizing:i.boxSizing??"border-box",display:i.display??(s?"inline-flex":void 0),width:i.width??"max-content",height:i.height??"max-content"}),whiteSpace:"pre-wrap",wordBreak:"break-all"});const u=document.createElement("ul");return Object.assign(u.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:s&&o?"100%":void 0,height:s&&!o?"100%":void 0}),e.forEach(a=>{const l=document.createElement("li");Object.assign(l.style,{verticalAlign:"inherit",...this._toDOMStyle(a.style)}),a.fragments.forEach(h=>{const c=document.createElement("span");Object.assign(c.style,{verticalAlign:"inherit",...this._toDOMStyle(h.style)}),c.appendChild(document.createTextNode(h.content)),l.appendChild(c)}),u.appendChild(l)}),n.appendChild(u),n}measureDOMText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let i=0;return Array.from(n).map(o=>{var c;const s=i+=n.substring(i).indexOf(o),u=s+o.length;i+=o.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,u);const a=((c=t.getClientRects)==null?void 0:c.call(t))??[t.getBoundingClientRect()];let l=a[a.length-1];a.length>1&&l.width<2&&(l=a[a.length-2]);const h=t.toString();if(h!==""&&l&&l.width+l.height!==0)return{content:h,top:l.top,left:l.left,height:l.height,width:l.width}}).filter(Boolean)}measureDOM(e){const t=[],n=[],i=[];return e.querySelectorAll("li").forEach((o,s)=>{const u=o.getBoundingClientRect();t.push({paragraphIndex:s,left:u.left,top:u.top,width:u.width,height:u.height}),o.querySelectorAll(":scope > *").forEach((a,l)=>{const h=a.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:l,left:h.left,top:h.top,width:h.width,height:h.height});let c=0;!a.children.length&&a.firstChild instanceof window.Text?this.measureDOMText(a.firstChild).forEach(f=>{i.push({...f,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:l,characterIndex:c++,textWidth:-1,textHeight:-1})}):a.querySelectorAll(":scope > *").forEach(f=>{f.firstChild instanceof window.Text&&this.measureDOMText(f.firstChild).forEach(d=>{i.push({...d,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:l,characterIndex:c++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:i}}measureParagraphDOM(e,t){const n=t.getBoundingClientRect(),i=this.measureDOM(t);i.paragraphs.forEach(u=>{const a=e[u.paragraphIndex];a.lineBox.left=u.left-n.left,a.lineBox.top=u.top-n.top,a.lineBox.width=u.width,a.lineBox.height=u.height}),i.fragments.forEach(u=>{const a=e[u.paragraphIndex].fragments[u.fragmentIndex];a.inlineBox.left=u.left-n.left,a.inlineBox.top=u.top-n.top,a.inlineBox.width=u.width,a.inlineBox.height=u.height});const o=[];let s=0;return i.characters.forEach(u=>{const{paragraphIndex:a,fragmentIndex:l,characterIndex:h}=u;o.push({...u,newParagraphIndex:a,left:u.left-n.left,top:u.top-n.top});const c=e[a].fragments[l].characters[h],{fontHeight:f,isVertical:d}=c,p=o[s];c.inlineBox.left=p.left,c.inlineBox.top=p.top,c.inlineBox.width=p.width,c.inlineBox.height=p.height,d?(c.lineBox.left=p.left+(p.width-f)/2,c.lineBox.top=p.top,c.lineBox.width=f,c.lineBox.height=p.height):(c.lineBox.left=p.left,c.lineBox.top=p.top+(p.height-f)/2,c.lineBox.width=p.width,c.lineBox.height=f),s++}),{paragraphs:e,boundingBox:new Z(0,0,n.width,n.height)}}measure(e,t,n){let i;n||(n=this.createDOM(e,t),Object.assign(n.style,{position:"fixed",visibility:"hidden"}),document.body.appendChild(n),i=()=>{var s;return(s=n==null?void 0:n.parentNode)==null?void 0:s.removeChild(n)});const o=this.measureParagraphDOM(e,n);return i==null||i(),o}};E(Ee,"notZeroStyles",new Set(["width","height"])),E(Ee,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","margin","marginLeft","marginTop","marginRight","marginBottom","padding","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let bn=Ee;class fa{constructor(){E(this,"eventListeners",new Map)}addEventListener(e,t,n){const i={value:t,options:n},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(i):this.eventListeners.set(e,[o,i]):this.eventListeners.set(e,i),this}removeEventListener(e,t,n){var o,s;if(!t)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const u=[];for(let a=0,l=i.length;a<l;a++){const h=i[a];(h.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof h.options=="boolean"||!((o=h.options)!=null&&o.once)))&&u.push(h)}u.length?this.eventListeners.set(e,u.length===1?u[0]:u):this.eventListeners.delete(e)}else i.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof i.options=="boolean"||(s=i.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var i,o;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let s=n.length,u=0;u<s;u++){const a=n[u];typeof a.options=="object"&&((i=a.options)!=null&&i.once)&&this.off(e,a.value,a.options),a.value.apply(this,[t])}else typeof n.options=="object"&&((o=n.options)!=null&&o.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function Lr(){const r=new ce,e=ui(),t=ai(e);return{name:"background",pathSet:r,load:async n=>{const{backgroundImage:i}=n.style;i&&e.needsLoad(i)&&await e.load(i)},update:n=>{r.paths.length=0;const{style:i,lineBox:o,isVertical:s}=n,{backgroundImage:u,backgroundSize:a,backgroundColormap:l}=i;if(ht(u))return;const{pathSet:h}=t.parse(u),c=h.getBoundingBox(!0);let f,d,p,g;s?{x:d,y:f,width:g,height:p}=o:{x:f,y:d,width:p,height:g}=o;const D=wn(l??"none"),S=h.paths.map(m=>{const F=m.clone();return F.style.fill&&F.style.fill in D&&(F.style.fill=D[F.style.fill]),F.style.stroke&&F.style.stroke in D&&(F.style.stroke=D[F.style.stroke]),F});let C,x;if(a==="rigid"){C=Math.max(n.fontSize*5/c.width),x=C;const m=new A;m.x=c.width-p/C,m.y=c.height-g/x,S.forEach(F=>{F.applyTransform(w=>{const v=w.x>c.left+c.width/2,O=w.y>c.top+c.height/2;v&&(w.x-=m.x),O&&(w.y-=m.y)})})}else C=p/c.width,x=g/c.height;const b=new Et;b.translate(-c.x,-c.y),b.scale(C,x),s&&(b.translate(-p/2,-g/2),b.rotate(-Math.PI/2),b.translate(g/2,p/2)),b.translate(f,d),S.forEach(m=>{m.applyTransform(F=>{F.applyMatrix3(b)})}),r.paths.push(...S)},renderOrder:-2,render:(n,i)=>{const{boundingBox:o,computedStyle:s}=i;ht(s.backgroundColor)||(n.fillStyle=s.backgroundColor,n.fillRect(...o.array)),r.paths.forEach(u=>{if(oe({ctx:n,path:u,fontSize:s.fontSize}),i.debug){const a=new ce([u]).getBoundingBox();a&&n.strokeRect(a.x,a.y,a.width,a.height)}}),i.paragraphs.forEach(u=>{const{lineBox:a,style:l}=u;ht(l.backgroundColor)||(n.fillStyle=l.backgroundColor,n.fillRect(...a.array)),u.fragments.forEach(h=>{const{inlineBox:c,style:f}=h;ht(f.backgroundColor)||(n.fillStyle=f.backgroundColor,n.fillRect(...c.array))})})}}}function En(r){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:i,highlightLine:o,highlightSize:s,highlightThickness:u}=r;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??i??"none",line:(e==null?void 0:e.line)??o??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??u??"100%"}}function $r(){const r=new ce,e=[],t=ui(),n=ai(t);return{name:"highlight",pathSet:r,load:async i=>{const o=new Set;i.forEachCharacter(s=>{const{computedStyle:u}=s,{image:a,referImage:l}=En(u);a&&t.needsLoad(a)&&o.add(a),l&&t.needsLoad(l)&&o.add(l)}),await Promise.all(Array.from(o).map(s=>t.load(s)))},update:i=>{e.length=0,r.paths.length=0;let o=[],s,u;i.forEachCharacter(a=>{const{computedStyle:l}=a,h=En(l),{image:c,colormap:f,line:d,size:p,thickness:g}=h;if(ht(c))s!=null&&s.length&&(s=[],o.push(s));else{const{inlineBox:D,isVertical:S}=a,{fontSize:C}=l;(!u||fe(u.image,c)&&fe(u.colormap,f)&&fe(u.line,d)&&fe(u.size,p)&&fe(u.thickness,g))&&(s!=null&&s.length)&&(S?s[0].inlineBox.left===D.left:s[0].inlineBox.top===D.top)&&s[0].fontSize===C?s.push(a):(s=[],s.push(a),o.push(s))}u=h}),o=o.filter(a=>a.length);for(let a=0;a<o.length;a++){const l=o[a],h=l[0],c=Z.from(...l.map(k=>k.compatibleGlyphBox));if(!c.height||!c.width)continue;const{computedStyle:f,isVertical:d,inlineBox:p,compatibleGlyphBox:g,strikeoutPosition:D,underlinePosition:S}=h,{fontSize:C}=f,{image:x,referImage:b,colormap:m,line:F,size:w,thickness:v}=En(f),O=Fn(v,{fontSize:C,total:c.width})/c.width,j=wn(m),{pathSet:_,dom:L}=n.parse(x),z=_.getBoundingBox(!0),I=C/z.width*2,P=new Z().copy(c);d&&(P.width=c.height,P.height=c.width,P.left=c.left+c.width);const X=Math.floor(P.width);let T=X;w!=="cover"&&(T=Fn(w,{fontSize:C,total:c.width})||X,P.width=T);const U=!ht(b)&&ht(F);if(U)z.copy(n.parse(b).pathSet.getBoundingBox(!0));else{let k;if(ht(F))if(z.width/z.height>4){k="underline";const N=L.getAttribute("viewBox");if(N){const[M,B,$,V]=N.split(" ").map(Y=>Number(Y)),H=B+V/2;z.y<H&&z.y+z.height>H?k="line-through":z.y+z.height<H?k="overline":k="underline"}}else k="outline";else k=F;switch(k){case"outline":{const N=P.width*.2,M=P.height*.2;d?(P.x-=M/2,P.y-=N/2,P.x-=P.height):(P.x-=N/2,P.y-=M/2),P.width+=N,P.height+=M;break}case"overline":P.height=z.height*I,d?P.x=p.left+p.width:P.y=p.top;break;case"line-through":P.height=z.height*I,d?P.x=p.left+p.width-D+P.height/2:P.y=p.top+D-P.height/2;break;case"underline":P.height=z.height*I,d?P.x=g.left+g.width-S:P.y=p.top+S;break}}const R=new Et;if(R.translate(-z.x,-z.y),R.scale(P.width/z.width,P.height/z.height),d){const k=P.width/2,N=P.height/2;U||R.translate(-k,-N),R.rotate(-Math.PI/2),U||R.translate(N,k)}R.translate(P.x,P.y);for(let k=0;k<Math.ceil(X/T);k++){const N=R.clone();d?N.translate(0,k*P.width):N.translate(k*P.width,0),_.paths.forEach(M=>{const B=M.clone().applyTransform(N);B.style.strokeWidth&&(B.style.strokeWidth*=I*O),B.style.strokeMiterlimit&&(B.style.strokeMiterlimit*=I),B.style.strokeDashoffset&&(B.style.strokeDashoffset*=I),B.style.strokeDasharray&&(B.style.strokeDasharray=B.style.strokeDasharray.map($=>$*I)),B.style.fill&&B.style.fill in j&&(B.style.fill=j[B.style.fill]),B.style.stroke&&B.style.stroke in j&&(B.style.stroke=j[B.style.stroke]),r.paths.push(B),X!==T&&(d?e[r.paths.length-1]=new Z(c.left-c.width*2,c.top,c.width*4,c.height):e[r.paths.length-1]=new Z(c.left,c.top-c.height*2,c.width,c.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{const i=[];return r.paths.forEach((o,s)=>{const u=e[s];let a=o.getBoundingBox();if(u){const l=Math.max(a.x,u.x),h=Math.max(a.y,u.y),c=Math.min(a.right,u.right),f=Math.min(a.bottom,u.bottom);a=new Z(l,h,c-l,f-h)}i.push(a)}),Z.from(...i)},render:(i,o)=>{r.paths.forEach((s,u)=>{if(oe({ctx:i,path:s,fontSize:o.computedStyle.fontSize,clipRect:e[u]}),o.debug){const a=new ce([s]).getBoundingBox();a&&i.strokeRect(a.x,a.y,a.width,a.height)}})}}}function pa(r,e){return`<svg width="${r*2}" height="${r*2}" xmlns="http://www.w3.org/2000/svg">
7
+ <circle cx="${r}" cy="${r}" r="${r}" fill="${e}" />
8
+ </svg>`}function Ur(){const r=new ce;return{name:"listStyle",pathSet:r,update:e=>{r.paths.length=0;const{paragraphs:t,isVertical:n,fontSize:i}=e,o=i*.45;t.forEach(s=>{var F;const{computedStyle:u}=s,{color:a,listStyleImage:l,listStyleColormap:h,listStyleSize:c,listStyleType:f}=u,d=wn(h);let p=c,g;if(!ht(l))g=l;else if(!ht(f)){const w=i*.38/2;switch(p=p==="cover"?w*2:p,f){case"disc":g=pa(w,String(a));break}}if(!g)return;const D=yr(g),S=D.getBoundingBox(),C=(F=s.fragments[0])==null?void 0:F.characters[0];if(!C)return;const{inlineBox:x}=C,b=p==="cover"?1:Fn(p,{total:i,fontSize:i})/i,m=new Et;if(n){const w=i/S.height*b;m.translate(-S.left,-S.top).rotate(Math.PI/2).scale(w,w).translate(x.left+(x.width-S.height*w)/2,x.top-o)}else{const w=i/S.height*b;m.translate(-S.left,-S.top).scale(w,w).translate(x.left-S.width*w-o,x.top+(x.height-S.height*w)/2)}r.paths.push(...D.paths.map(w=>{const v=w.clone();return v.applyTransform(m),v.style.fill&&v.style.fill in d&&(v.style.fill=d[v.style.fill]),v.style.stroke&&v.style.stroke in d&&(v.style.stroke=d[v.style.stroke]),v}))})}}}function Vr(){return{name:"outline"}}const ie=new A,be=new Et,re=new Et;function zr(){return{name:"render",getBoundingBox:r=>{const{characters:e,fontSize:t,effects:n}=r,i=[];return e.forEach(o=>{n==null||n.forEach(s=>{if(!o.glyphBox)return;const u=o.glyphBox.clone(),a=Sn(r,s);ie.set(u.left,u.top),ie.applyMatrix3(a),u.left=ie.x,u.top=ie.y,ie.set(u.right,u.bottom),ie.applyMatrix3(a),u.width=ie.x-u.left,u.height=ie.y-u.top;const l=(s.shadowOffsetX??0)*t,h=(s.shadowOffsetY??0)*t,c=Math.max(.1,s.textStrokeWidth??0)*t;u.left+=l-c,u.top+=h-c,u.width+=c*2,u.height+=c*2,i.push(u)})}),i.length?Z.from(...i):void 0},render:(r,e)=>{const{paragraphs:t,glyphBox:n,effects:i}=e;i?i.forEach(o=>{jt(o,n,r),r.save();const[s,u,a,l,h,c]=Sn(e,o).transpose().elements;r.transform(s,l,u,h,a,c),e.forEachCharacter(f=>{f.drawTo(r,o)}),r.restore()}):t.forEach(o=>{o.fragments.forEach(s=>{s.characters.forEach(u=>{u.drawTo(r)})})}),e.debug&&t.forEach(o=>{r.strokeRect(o.lineBox.x,o.lineBox.y,o.lineBox.width,o.lineBox.height)})}}}function Sn(r,e){const{fontSize:t,glyphBox:n}=r,i=(e.translateX??0)*t,o=(e.translateY??0)*t,s=Math.PI*2,u=(e.skewX??0)/360*s,a=(e.skewY??0)/360*s,{left:l,top:h,width:c,height:f}=n,d=l+c/2,p=h+f/2;return be.identity(),re.makeTranslation(i,o),be.multiply(re),re.makeTranslation(d,p),be.multiply(re),re.set(1,Math.tan(u),0,Math.tan(a),1,0,0,0,1),be.multiply(re),re.makeTranslation(-d,-p),be.multiply(re),be.clone()}function Nr(){const r=new ce;return{name:"textDecoration",pathSet:r,update:e=>{r.paths.length=0;const t=[];let n,i;e.forEachCharacter(o=>{const{computedStyle:s,isVertical:u,inlineBox:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=o,{color:d,textDecoration:p,writingMode:g}=s;if(ht(p))i=void 0;else{let D=!1;if((i==null?void 0:i.textDecoration)===p&&(i==null?void 0:i.writingMode)===g&&(i==null?void 0:i.color)===d&&(u?n[0].inlineBox.left===a.left:n[0].inlineBox.top===a.top))switch(p){case"underline":n[0].underlinePosition===l&&n[0].underlineThickness===h&&(D=!0);break;case"line-through":n[0].strikeoutPosition===c&&n[0].strikeoutSize===f&&(D=!0);break}D?n.push(o):(n=[],n.push(o),t.push(n)),i=s}}),t.forEach(o=>{const{computedStyle:s,isVertical:u,underlinePosition:a,underlineThickness:l,strikeoutPosition:h,strikeoutSize:c}=o[0],{color:f,textDecoration:d}=s,p=Z.from(...o.map(w=>w.inlineBox)),{left:g,top:D,width:S,height:C}=p;let x=u?g+S:D;const b=u?-1:1;let m=0;switch(d){case"overline":m=l*2;break;case"underline":x+=b*a,m=l*2;break;case"line-through":x+=b*h,m=c*2;break}x-=m;let F;u?F=new Mt([{type:"M",x,y:D},{type:"L",x,y:D+C},{type:"L",x:x+m,y:D+C},{type:"L",x:x+m,y:D},{type:"Z"}],{fill:f}):F=new Mt([{type:"M",x:g,y:x},{type:"L",x:g+S,y:x},{type:"L",x:g+S,y:x+m},{type:"L",x:g,y:x+m},{type:"Z"}],{fill:f}),r.paths.push(F)})},render:(e,t)=>{const{effects:n,computedStyle:i}=t;n?n.forEach(o=>{e.save();const[s,u,a,l,h,c]=Sn(t,o).transpose().elements;e.transform(s,l,u,h,a,c),r.paths.forEach(f=>{oe({ctx:e,path:f,fontSize:i.fontSize,...o})}),e.restore()}):r.paths.forEach(o=>{oe({ctx:e,path:o,fontSize:i.fontSize})})}}}const di=oa();class Bn extends fa{constructor(t={}){super();E(this,"debug");E(this,"content");E(this,"style");E(this,"effects");E(this,"measureDOM");E(this,"needsUpdate",!0);E(this,"computedStyle",{...di});E(this,"paragraphs",[]);E(this,"lineBox",new Z);E(this,"rawGlyphBox",new Z);E(this,"glyphBox",new Z);E(this,"pathBox",new Z);E(this,"boundingBox",new Z);E(this,"measurer",new bn);E(this,"plugins",new Map);E(this,"fonts");this.set(t)}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}set(t={}){this.debug=t.debug??!1,this.content=pi(t.content??""),this.style=t.style??{},this.measureDOM=t.measureDOM,this.effects=t.effects,this.fonts=t.fonts,this.use(Lr()).use(Vr()).use(Ur()).use(Nr()).use($r()).use(zr()),(t.plugins??[]).forEach(n=>{this.use(n)}),this.updateParagraphs()}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,i)=>{n.fragments.forEach((o,s)=>{o.characters.forEach((u,a)=>{t(u,{paragraphIndex:i,fragmentIndex:s,characterIndex:a})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...di,...this.style};const{content:t,computedStyle:n}=this,i=[];return t.forEach(o=>{const{fragments:s,...u}=o,a=new Or(u,n);s.forEach(l=>{const{content:h,...c}=l;h!==void 0&&a.addFragment(h,c)}),i.push(a)}),this.paragraphs=i,this}createDOM(){return this.updateParagraphs(),this.measurer.createDOM(this.paragraphs,this.computedStyle)}measure(t=this.measureDOM){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const i=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=i.paragraphs,this.lineBox=i.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((o,s)=>(o.updateOrder??0)-(s.updateOrder??0)).forEach(o=>{var s;(s=o.update)==null||s.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in n)i[o]=this[o],this[o]=n[o];return this.emit("measure",{text:this,result:i}),i}getGlyphBox(){const t=A.MAX,n=A.MIN;return this.characters.forEach(i=>{if(!i.getGlyphMinMax(t,n)){const{inlineBox:o}=i,{left:s,top:u,width:a,height:l}=o,h=new A(s,u),c=new A(s+a,u+l);t.min(h,c),n.max(h,c)}}),new Z(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=Z.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>{var n;return t.getBoundingBox?t.getBoundingBox(this):(n=t.pathSet)==null?void 0:n.getBoundingBox()}).filter(Boolean)),this}updateBoundingBox(){return this.boundingBox=Z.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(t=this.measureDOM){const n=this.measure(t);for(const i in n)this[i]=n[i];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){var s;const{view:n,pixelRatio:i=2}=t,o=n.getContext("2d");o&&(this.needsUpdate&&this.update(),Di(o,i,this.boundingBox),gi(o,this),Array.from(this.plugins.values()).sort((u,a)=>(u.renderOrder??0)-(a.renderOrder??0)).forEach(u=>{var a;if(u.render)(a=u.render)==null||a.call(u,o,this);else if(u.pathSet){const l=this.computedStyle;u.pathSet.paths.forEach(h=>{oe({ctx:o,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:i}),(s=t.onContext)==null||s.call(t,o))}}function da(r,e){const t=new Bn(r);return e?t.load().then(()=>t.measure()):t.measure()}function Da(r,e){const t=new Bn(r);return e?t.load().then(()=>t.render(r)):t.render(r)}class ga{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);const o=this.castInput(e,n),s=this.castInput(t,n),u=this.removeEmpty(this.tokenize(o,n)),a=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(u,a,n,i)}diffWithOptionsObj(e,t,n,i){var o;const s=C=>{if(C=this.postProcess(C,n),i){setTimeout(function(){i(C)},0);return}else return C},u=t.length,a=e.length;let l=1,h=u+a;n.maxEditLength!=null&&(h=Math.min(h,n.maxEditLength));const c=(o=n.timeout)!==null&&o!==void 0?o:1/0,f=Date.now()+c,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=a&&p+1>=u)return s(this.buildValues(d[0].lastComponent,t,e));let g=-1/0,D=1/0;const S=()=>{for(let C=Math.max(g,-l);C<=Math.min(D,l);C+=2){let x;const b=d[C-1],m=d[C+1];b&&(d[C-1]=void 0);let F=!1;if(m){const v=m.oldPos-C;F=m&&0<=v&&v<u}const w=b&&b.oldPos+1<a;if(!F&&!w){d[C]=void 0;continue}if(!w||F&&b.oldPos<m.oldPos?x=this.addToPath(m,!0,!1,0,n):x=this.addToPath(b,!1,!0,1,n),p=this.extractCommon(x,t,e,C,n),x.oldPos+1>=a&&p+1>=u)return s(this.buildValues(x.lastComponent,t,e))||!0;d[C]=x,x.oldPos+1>=a&&(D=Math.min(D,C-1)),p+1>=u&&(g=Math.max(g,C+1))}l++};if(i)(function C(){setTimeout(function(){if(l>h||Date.now()>f)return i(void 0);S()||C()},0)})();else for(;l<=h&&Date.now()<=f;){const C=S();if(C)return C}}addToPath(e,t,n,i,o){const s=e.lastComponent;return s&&!o.oneChangePerToken&&s.added===t&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:t,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:s}}}extractCommon(e,t,n,i,o){const s=t.length,u=n.length;let a=e.oldPos,l=a-i,h=0;for(;l+1<s&&a+1<u&&this.equals(n[a+1],t[l+1],o);)l++,a++,h++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return h&&!o.oneChangePerToken&&(e.lastComponent={count:h,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const i=[];let o;for(;e;)i.push(e),o=e.previousComponent,delete e.previousComponent,e=o;i.reverse();const s=i.length;let u=0,a=0,l=0;for(;u<s;u++){const h=i[u];if(h.removed)h.value=this.join(n.slice(l,l+h.count)),l+=h.count;else{if(!h.added&&this.useLongestToken){let c=t.slice(a,a+h.count);c=c.map(function(f,d){const p=n[l+d];return p.length>f.length?p:f}),h.value=this.join(c)}else h.value=this.join(t.slice(a,a+h.count));a+=h.count,h.added||(l+=h.count)}}return i}}class ya extends ga{}const ma=new ya;function xa(r,e,t){return ma.diff(r,e,t)}function va(r){const e={};for(const t in r)t!=="id"&&r[t]!==void 0&&r[t]!==""&&(e[t]=r[t]);return e}function Fa(r){return r.flatMap(e=>{var n;const t=e.fragments.flatMap(i=>{const{content:o,...s}=i;return Array.from(He(o)).map(()=>({...s}))});return Ce(He(((n=e.fragments[e.fragments.length-1])==null?void 0:n.content)??""))?t:[...t,{}]})}function wa(r,e){const t=Object.keys(r),n=Object.keys(e),i=Array.from(new Set([...t,...n]));return!i.length||i.every(o=>r[o]===e[o])}const Ca=/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function ba(r){const e=document.createElement("template");return e.innerHTML=r,e.content.cloneNode(!0)}class Rr extends HTMLElement{constructor(){super();E(this,"left",0);E(this,"top",0);E(this,"width",0);E(this,"height",0);E(this,"pixelRatio",2);E(this,"text",new Bn);E(this,"composition",!1);E(this,"selection",[0,0]);E(this,"prevSelection",[0,0]);E(this,"_oldText","");E(this,"$preview");E(this,"$textInput");E(this,"$cursor");E(this,"$cursorInput");E(this,"_timer");const t=this.attachShadow({mode:"open"});t.appendChild(ba(`
9
+ <style>
10
+ :host {
11
+ position: absolute;
12
+ width: 0;
13
+ height: 0;
14
+ --color: 0, 0, 0;
15
+ }
16
+
17
+ .preview {
18
+ position: absolute;
19
+ left: 0;
20
+ top: 0;
21
+ width: 100%;
22
+ height: 100%;
23
+ --selection-color: rgba(var(--color, 0, 0, 0), 0.4);
24
+ }
25
+
26
+ .text-input {
27
+ position: absolute;
28
+ z-index: -9999;
29
+ opacity: 0;
30
+ caret-color: transparent;
31
+ left: 0;
32
+ top: 0;
33
+ width: 100%;
34
+ height: 100%;
35
+ padding: 0;
36
+ border: 0;
37
+ }
38
+
39
+ .cursor {
40
+ position: absolute;
41
+ left: 0;
42
+ top: 0;
43
+ }
44
+
45
+ .cursor.blink {
46
+ animation: cursor-blink 1s steps(2, start) infinite;
47
+ }
48
+
49
+ @keyframes cursor-blink {
50
+ 100% {
51
+ display: none;
52
+ }
53
+ }
54
+
55
+ .cursor-input {
56
+ position: absolute;
57
+ cursor: text;
58
+ left: 0;
59
+ top: 0;
60
+ width: 100%;
61
+ height: 100%;
62
+ outline: 0;
63
+ }
64
+ </style>
65
+
66
+ <canvas class="preview"></canvas>
67
+
68
+ <textarea class="text-input"></textarea>
69
+
70
+ <div class="cursor blink"></div>
71
+
72
+ <div
73
+ class="cursor-input"
74
+ autofocus
75
+ contenteditable="true"
76
+ ></div>
77
+ `)),this.$preview=t.querySelector(".preview"),this.$textInput=t.querySelector(".text-input"),this.$cursor=t.querySelector(".cursor"),this.$cursorInput=t.querySelector(".cursor-input"),this.$textInput.addEventListener("compositionstart",()=>this.composition=!0),this.$textInput.addEventListener("compositionend",()=>this.composition=!1),this.$textInput.addEventListener("keydown",this.onKeydown.bind(this)),this.$textInput.addEventListener("input",this.onInput.bind(this)),this.$textInput.addEventListener("blur",this.onBlur.bind(this)),this.$cursorInput.addEventListener("keydown",n=>n.preventDefault()),this.$cursorInput.addEventListener("focus",this.onFocus.bind(this)),this.$cursorInput.addEventListener("mousedown",this.onMousedown.bind(this))}static register(){customElements.define("text-editor",this)}get selectionMinMax(){return{min:Math.min(...this.selection),max:Math.max(...this.selection)}}get selectedCharacters(){const{min:t,max:n}=this.selectionMinMax;return this.selectableCharacters.filter((i,o)=>o>=t&&o<n)}get selectableCharacters(){var s;const t=[];(s=this.text)==null||s.paragraphs.forEach((u,a)=>{u.fragments.forEach((l,h)=>{l.characters.forEach(c=>{t[a]||(t[a]=[]),t[a][h]||(t[a][h]=[]),t[a][h].push(c)})})});const n=u=>({color:u.computedStyle.color,left:u.inlineBox.left-this.text.boundingBox.left,top:u.inlineBox.top-this.text.boundingBox.top,width:u.inlineBox.width,height:u.inlineBox.height,content:u.content}),i=[];let o=0;return t.forEach(u=>{if(u.length===1&&u[0].length===1&&Ce(u[0][0].content)){const a=u[0][0];i[o]={...n(a),isCrlf:!0}}else u.forEach(a=>{a.forEach(l=>{i[o]={...n(l)},o++,Ce(l.content)||(i[o]={...n(l),content:" ",isLastSelected:!0})})});o++}),i[0]&&(i[0].isFirst=!0),i[i.length-1]&&(i[i.length-1].isLast=!0),i}get cursorPosition(){let t=0,n=0;const i=this.selectableCharacters[this.selectionMinMax.min];return i!=null&&i.isLastSelected&&(this.text.isVertical?n+=(i==null?void 0:i.height)??0:t+=(i==null?void 0:i.width)??0),t+=(i==null?void 0:i.left)??0,n+=(i==null?void 0:i.top)??0,{color:i==null?void 0:i.color,left:t,top:n,height:(i==null?void 0:i.height)??0,width:(i==null?void 0:i.width)??0}}update(t){this.text.set(t),this.setTextInput(this.getTextValue()),this.render()}getTextValue(){return kr(this.getContentValue(this.text.content))}getContentValue(t,n=kr(t),i=n){n=He(n),n=n.replace(Ca,d=>Array.from(d).length>1?"?":d),i=He(i);const o=Fa(t),s=[];let u=0,a=0,l={};xa(i,n).forEach(d=>{const p=Array.from(d.value);d.removed?a+=p.length:p.forEach(()=>{d.added?s[u]={...l}:(l=va(o[a]),s[u]={...l},a++),u++})});let c=0;const f=[];return pi(n).forEach(d=>{let p={fragments:[]},g;d.fragments.forEach(D=>{Array.from(D.content).forEach(S=>{const C=s[c]??{};if(g){const{content:x,...b}=g;wa(C,b)?g.content+=S:(p.fragments.push(g),g={...C,content:S})}else g={...C,content:S};c++})}),Ce(d.fragments[d.fragments.length-1].content)||c++,g&&p.fragments.push(g),p.fragments.length&&(f.push(p),p={fragments:[]})}),f}setTextInput(t){this.$textInput.value=t,this._oldText=t}onInput(){const t=this.$textInput.value;this.text.content=this.getContentValue(this.text.content,t,this._oldText),this._oldText=t,this.updateSelection(),this.render()}onKeydown(t){t.key,this.updateSelection(),this.render(),setTimeout(()=>{this.updateSelection(),this.render()},0),setTimeout(()=>{this.updateSelection(),this.render()},100)}onFocus(t){var n;t.preventDefault(),this.$cursorInput.blur(),(n=this.$textInput)==null||n.focus()}onBlur(){}findNearest(t){const{x:n,y:i,xWeight:o=1,yWeight:s=1}=t,u=this.selectableCharacters.reduce((a,l,h)=>{const c=Math.abs(l.left+l.width/2-n)*o+Math.abs(l.top+l.height/2-i)*s;return c<a.diff?{diff:c,index:h,value:l}:a},{diff:Number.MAX_SAFE_INTEGER,index:-1,value:void 0});if(u!=null&&u.value){const a=u.value.left+u.value.width/2;return n>a&&!u.value.isCrlf&&!u.value.isLastSelected?u.index+1:u.index}return-1}updateSelection(){if(this.composition)this.selection=this.prevSelection;else{let t=0;const n=[];this.selectableCharacters.forEach((i,o)=>{t<=this.$textInput.selectionStart?n[0]=o:t<=this.$textInput.selectionEnd&&(n[1]=o),t+=i.content.length}),this.selection=n,this.prevSelection=this.selection}}updateDOMSelection(){let t=0,n=0;this.selectableCharacters.forEach((i,o)=>{o<this.selectionMinMax.min?(t+=i.content.length,n=t):o<this.selectionMinMax.max&&(n+=i.content.length)}),this.$textInput.selectionStart=t,this.$textInput.selectionEnd=n}onMousedown(t){const n=this.findNearest({x:t.offsetX,y:t.offsetY});this.selection=[n,n],this.updateDOMSelection(),this.render();const i=s=>{this.selection[1]=this.findNearest({x:s.offsetX,y:s.offsetY}),this.updateDOMSelection(),this.render()},o=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}render(){this.text.update(),this.width=this.text.boundingBox.width,this.height=this.text.boundingBox.height;const t=this.text.isVertical;this.style.left=`${this.left}px`,this.style.top=`${this.top}px`,this.style.width=`${this.width}px`,this.style.height=`${this.height}px`;let n;this.text.render({pixelRatio:this.pixelRatio,view:this.$preview,onContext:o=>n=o});const i=this.selectedCharacters;if(n){const o={};i.forEach(s=>{if(s.isLastSelected)return;const u=t?s.left:s.top;o[u]||(o[u]=[]),o[u].push({x:s.left,y:s.top,w:s.width,h:s.height})}),n.fillStyle=getComputedStyle(this.$preview).getPropertyValue("--selection-color"),Object.values(o).forEach(s=>{const u={x:Math.min(...s.map(l=>l.x)),y:Math.min(...s.map(l=>l.y))},a={x:Math.max(...s.map(l=>l.x+l.w)),y:Math.max(...s.map(l=>l.y+l.h))};n.fillRect(u.x+this.text.boundingBox.left,u.y+this.text.boundingBox.top,a.x-u.x,a.y-u.y)})}if(i.length===0){this.$cursor.style.visibility="visible";const o=this.cursorPosition;this.$cursor.style.backgroundColor=o.color??"rgba(var(--color)",this.$cursor.style.left=`${o.left}px`,this.$cursor.style.top=`${o.top}px`,this.$cursor.style.height=t?"1px":`${o.height}px`,this.$cursor.style.width=t?`${o.width}px`:"1px"}else this.$cursor.style.visibility="hidden";this.$cursor.classList.remove("blink"),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>this.$cursor.classList.add("blink"),500)}attributeChangedCallback(t,n,i){switch(t){case"left":case"top":case"width":case"height":this[t]=i,this.render();break}}}E(Rr,"observedAttributes",["left","top","width","height","is-vertical"]),W.Character=xr,W.Fragment=Ir,W.Measurer=bn,W.Paragraph=Or,W.Text=Bn,W.TextEditor=Rr,W.background=Lr,W.createSVGLoader=ui,W.createSVGParser=ai,W.definePlugin=ca,W.drawPath=oe,W.filterEmpty=Cn,W.getHighlightStyle=En,W.getTransform2D=Sn,W.hexToRgb=ha,W.highlight=$r,W.isEqualObject=_r,W.isEqualValue=fe,W.listStyle=Ur,W.measureText=da,W.outline=Vr,W.parseColor=ft,W.parseColormap=wn,W.parseValueNumber=Fn,W.render=zr,W.renderText=Da,W.setupView=Di,W.textDecoration=Nr,W.textDefaultStyle=di,W.uploadColor=jt,W.uploadColors=gi,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});