modern-text 1.12.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -27,9 +27,10 @@ ${t}`);return n.documentElement}else return e}var Gn=`px`,Kn=90,qn=[`mm`,`cm`,`i
27
27
  xmlns="http://www.w3.org/2000/svg"
28
28
  >
29
29
  ${this.paths.map(e=>e.toSvgPathString()).join(``)}
30
- </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),`image/svg+xml`).documentElement}toCanvas(e={}){let{pixelRatio:t=2,...n}=e,{left:r,top:i,width:a,height:o}=this.getBoundingBox(),s=document.createElement(`canvas`);s.width=a*t,s.height=o*t,s.style.width=`${a}px`,s.style.height=`${o}px`;let c=s.getContext(`2d`);return c&&(c.scale(t,t),c.translate(-r,-i),this.paths.forEach(e=>{e.drawTo(c,n)})),s}};function Pr(){let e=new Map;async function t(t){if(!e.has(t)){e.set(t,``);try{e.set(t,await fetch(t).then(e=>e.text()))}catch(n){console.warn(n),e.delete(t)}}}function n(e){return e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`blob://`)}return{loaded:e,needsLoad:n,load:t}}function Fr(e){let t=new Map;function n(n){let r=t.get(n);if(!r){let i=e.needsLoad(n)?e.loaded.get(n):n;if(i){let e=Wn(i);r={dom:e,pathSet:lr(e)},t.set(n,r)}else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.setAttribute(`viewBox`,`0 0 0 0`),r={dom:e,pathSet:new Nr}}}return r}return{parsed:t,parse:n}}function Ir(e,t){let{transform:n,transformOrigin:r}=t,{fontSize:i,lineBox:a}=e,{left:o,top:s,width:c,height:l}=a,{x:u,y:d}=Lr(r??`center`,o,s,c,l),f=new Mn;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Lr(e,t,n,r,i){let a={left:0,center:.5,right:1},o={top:0,center:.5,bottom:1},s=e.trim().split(/\s+/),c=s[0]??`center`,l=s[1]??`center`,u;u=c in a?t+a[c]*r:c.endsWith(`%`)?t+Number.parseFloat(c)/100*r:t+Number.parseFloat(c);let d;return d=l in o?n+o[l]*i:l.endsWith(`%`)?n+Number.parseFloat(l)/100*i:n+Number.parseFloat(l),{x:u,y:d}}function Rr(e,t){return typeof e==`number`?e:e.endsWith(`%`)?(e=e.substring(0,e.length-1),Math.ceil(Number(e)/100*t.total)):e.endsWith(`rem`)?(e=e.substring(0,e.length-3),Number(e)*t.fontSize):e.endsWith(`em`)?(e=e.substring(0,e.length-2),Number(e)*t.fontSize):Number(e)}function zr(e){return O(e)?{}:e}function Br(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vr(e[n],t[n]))}function Vr(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Br(e,t):e===t:!1}var Hr=class{text;context;pixelRatio=window?.devicePixelRatio||1;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,{left:n,top:r,width:i,height:a}=this.text.boundingBox,o=t.canvas;o.dataset.viewBox=String(`${n} ${r} ${i} ${a}`),o.dataset.pixelRatio=String(e);let s=i,c=a;o.width=Math.max(1,Math.ceil(s*e)),o.height=Math.max(1,Math.ceil(c*e)),o.style.width=`${s}px`,o.style.height=`${c}px`,t.clearRect(0,0,o.width,o.height),t.scale(e,e),t.translate(-n,-r)};_setupColors=()=>{this.uploadColor(this.text.glyphBox,{style:this.text.computedStyle,fill:this.text.computedFill,outline:this.text.computedOutline}),this.text.paragraphs.forEach(e=>{this.uploadColor(e.lineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline}),e.fragments.forEach(e=>{this.uploadColor(e.inlineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline})})})};setup=()=>(this._setupView(),this._setupColors(),this);_parseColor=(e,t)=>{if(typeof e==`string`&&ve(e)&&(e=ye(e)[0]),typeof e==`object`&&`type`in e)switch(e.type){case`linear-gradient`:{let{left:n,top:r,width:i,height:a}=t,{angle:o=0,stops:s}=e,c=n+i/2,l=r+a/2,u=(o+90)*Math.PI/180,d=Math.sin(u),f=-Math.cos(u),p=Math.abs(i*Math.sin(u))+Math.abs(a*Math.cos(u)),m=c-p/2*d,h=l-p/2*f,g=c+p/2*d,_=l+p/2*f,v=this.context.createLinearGradient(m,h,g,_);for(let e of s)v.addColorStop(e.offset,e.color);return v}case`radial-gradient`:break}return e};_uploadedStyles=[`color`,`backgroundColor`,`textStrokeColor`];uploadColor=(e,t)=>{let{style:n,fill:r,outline:i}=t;n&&this._uploadedStyles.forEach(t=>{n[t]=this._parseColor(n[t],e)}),r?.enabled&&r.linearGradient&&(r._linearGradient=this._parseColor({type:`linear-gradient`,...r.linearGradient},e)),i?.enabled&&i.linearGradient&&(i._linearGradient=this._parseColor({type:`linear-gradient`,...i.linearGradient},e))};_mergePathStyle(e,t){let n=e.style,r=t.stroke??n.stroke,i=t.strokeWidth?t.strokeWidth:n.strokeWidth;return{...A(n),...A(t),stroke:i===void 0||i>0?r:void 0,strokeLinecap:t.strokeLinecap??n.strokeLinecap??`round`,strokeLinejoin:t.strokeLinejoin??n.strokeLinejoin??`round`,strokeWidth:i}}drawPath=(e,t={})=>{let{clipRect:n,...r}=t,i=this.context;i.save(),i.beginPath(),n&&(i.rect(n.left,n.top,n.width,n.height),i.clip(),i.beginPath()),e.drawTo(i,this._mergePathStyle(e,r)),i.restore()};effectToPathStyle(e){let t=this.text.computedStyle.fontSize,n={};return e.fill?.enabled&&(n={...n,fill:e.fill.color}),e.outline?.enabled&&(n={...n,stroke:e.outline.color,strokeWidth:(e.outline.width??0)*t}),e.shadow?.enabled&&(n={...n,shadowOffsetX:(e.shadow.offsetX??0)*t,shadowOffsetY:(e.shadow.offsetY??0)*t,shadowBlur:(e.shadow.blur??0)*t,shadowColor:e.shadow.color}),n}transformEffect(e){let{a:t,b:n,c:r,d:i,tx:a,ty:o}=Ir(this.text,e);this.context.transform(t,n,r,i,a,o)}_shadowCanvas;_shadowCtx;drawWithShadow=(e,t)=>{let n=this.context,r=n.canvas;this._shadowCanvas||(this._shadowCanvas=document.createElement(`canvas`),this._shadowCtx=this._shadowCanvas.getContext(`2d`));let i=this._shadowCanvas,a=this._shadowCtx;if(!a){t();return}i.width<r.width&&(i.width=r.width),i.height<r.height&&(i.height=r.height),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.width,r.height);let o=n.getTransform();a.setTransform(o.a,o.b,o.c,o.d,o.e,o.f);let s=this.context;this.context=a;try{t()}finally{this.context=s}let c=this.text.computedStyle.fontSize,l=this.pixelRatio;n.save(),n.setTransform(1,0,0,1,0,0),n.shadowOffsetX=(e.offsetX??0)*c*l,n.shadowOffsetY=(e.offsetY??0)*c*l,n.shadowBlur=(e.blur??0)*c*l,n.shadowColor=e.color,n.drawImage(i,0,0,r.width,r.height,0,0,r.width,r.height),n.restore()};drawCharacter=(e,t={})=>{let n=this.context,{computedStyle:r,path:i,glyphBox:a,isVertical:o,content:s,inlineBox:c,baseline:l,computedFill:u,computedOutline:d}=e,f=u?.enabled?u:void 0,p=d?.enabled?d:void 0,m=this.effectToPathStyle(t),h={strokeLinecap:p?.lineCap,strokeLinejoin:p?.lineJoin,...r,...m,fill:m.fill??f?._linearGradient??f?.color??r.color,strokeWidth:m.strokeWidth??p?.width??r.textStrokeWidth,stroke:m.stroke??p?._linearGradient??p?.color??r.textStrokeColor};a?this.drawPath(i,h):(n.save(),n.beginPath(),Wt(n,this._mergePathStyle(i,h)),n.font=`${r.fontSize}px ${r.fontFamily||this.text.defaultFamily}`,o?(n.textBaseline=`middle`,n.fillText(s,c.left,c.top+c.height/2)):(n.textBaseline=`alphabetic`,n.fillText(s,c.left,c.top+l)),n.restore())}},Ur=Uint8Array,Wr=Uint16Array,Gr=Int32Array,Kr=new Ur([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]),qr=new Ur([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]),Jr=new Ur([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yr=function(e,t){for(var n=new Wr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Gr(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Xr=Yr(Kr,2),Zr=Xr.b,Qr=Xr.r;Zr[28]=258,Qr[258]=28;for(var $r=Yr(qr,0),ei=$r.b,ti=$r.r,ni=new Wr(32768),q=0;q<32768;++q){var ri=(q&43690)>>1|(q&21845)<<1;ri=(ri&52428)>>2|(ri&13107)<<2,ri=(ri&61680)>>4|(ri&3855)<<4,ni[q]=((ri&65280)>>8|(ri&255)<<8)>>1}for(var ii=(function(e,t,n){for(var r=e.length,i=0,a=new Wr(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Wr(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Wr(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ni[d]>>c]=l}else for(s=new Wr(r),i=0;i<r;++i)e[i]&&(s[i]=ni[o[e[i]-1]++]>>15-e[i]);return s}),ai=new Ur(288),q=0;q<144;++q)ai[q]=8;for(var q=144;q<256;++q)ai[q]=9;for(var q=256;q<280;++q)ai[q]=7;for(var q=280;q<288;++q)ai[q]=8;for(var oi=new Ur(32),q=0;q<32;++q)oi[q]=5;var si=ii(ai,9,0),ci=ii(ai,9,1),li=ii(oi,5,0),ui=ii(oi,5,1),di=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},fi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},pi=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},mi=function(e){return(e+7)/8|0},hi=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ur(e.subarray(t,n))},gi=[`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`],_i=function(e,t,n){var r=Error(t||gi[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,_i),!n)throw r;return r},vi=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Ur(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Ur(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Ur(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=fi(e,d,1);var v=fi(e,d+1,3);if(d+=3,!v){var y=mi(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&_i(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=ci,m=ui,h=9,g=5;else if(v==2){var S=fi(e,d,31)+257,C=fi(e,d+10,15)+4,w=S+fi(e,d+5,31)+1;d+=14;for(var T=new Ur(w),E=new Ur(19),D=0;D<C;++D)E[Jr[D]]=fi(e,d+D*3,7);d+=C*3;for(var O=di(E),k=(1<<O)-1,A=ii(E,O,1),D=0;D<w;){var j=A[fi(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+fi(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+fi(e,d,7),d+=3):y==18&&(N=11+fi(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=di(P),g=di(F),p=ii(P,h,1),m=ii(F,g,1)}else _i(1);if(d>_){c&&_i(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[pi(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&_i(0);break}if(M||_i(2),z<256)n[f++]=z;else if(z==256){R=d,p=null;break}else{var B=z-254;if(z>264){var D=z-257,V=Kr[D];B=fi(e,d,(1<<V)-1)+Zr[D],d+=V}var ee=m[pi(e,d)&L],te=ee>>4;ee||_i(3),d+=ee&15;var F=ei[te];if(te>3){var V=qr[te];F+=pi(e,d)&(1<<V)-1,d+=V}if(d>_){c&&_i(0);break}s&&l(f+131072);var ne=f+B;if(f<F){var re=a-F,ie=Math.min(F,ne);for(re+f<0&&_i(3);f<ie;++f)n[f]=r[re+f]}for(;f<ne;++f)n[f]=n[f-F]}}t.l=p,t.p=R,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?hi(n,0,f):n.subarray(0,f)},yi=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},bi=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},xi=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Oi,l:0};if(i==1){var o=new Ur(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Wr(f+1),m=Si(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new Ur(p),l:m}},Si=function(e,t,n){return e.s==-1?Math.max(Si(e.l,t,n+1),Si(e.r,t,n+1)):t[e.s]=n},Ci=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Wr(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},wi=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ti=function(e,t,n){var r=n.length,i=mi(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Ei=function(e,t,n,r,i,a,o,s,c,l,u){yi(t,u++,n),++i[256];for(var d=xi(i,15),f=d.t,p=d.l,m=xi(a,15),h=m.t,g=m.l,_=Ci(f),v=_.c,y=_.n,b=Ci(h),x=b.c,S=b.n,C=new Wr(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=xi(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Jr[O-1]];--O);var k=l+5<<3,A=wi(i,ai)+wi(a,oi)+o,j=wi(i,f)+wi(a,h)+o+14+3*O+wi(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Ti(t,u,e.subarray(c,c+l));var M,N,P,F;if(yi(t,u,1+(j<A)),u+=2,j<A){M=ii(f,p,0),N=f,P=ii(h,g,0),F=h;var I=ii(E,D,0);yi(t,u,y-257),yi(t,u+5,S-1),yi(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)yi(t,u+3*w,E[Jr[w]]);u+=3*O;for(var L=[v,x],R=0;R<2;++R)for(var z=L[R],w=0;w<z.length;++w){var B=z[w]&31;yi(t,u,I[B]),u+=E[B],B>15&&(yi(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=si,N=ai,P=li,F=oi;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;bi(t,u,M[B+257]),u+=N[B+257],B>7&&(yi(t,u,V>>23&31),u+=Kr[B]);var ee=V&31;bi(t,u,P[ee]),u+=F[ee],ee>3&&(bi(t,u,V>>5&8191),u+=qr[ee])}else bi(t,u,M[V]),u+=N[V]}return bi(t,u,M[256]),u+N[256]},Di=new Gr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Oi=new Ur(0),ki=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Ur(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Di[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Wr(32768),g=a.h||new Wr(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new Gr(25e3),x=new Wr(288),S=new Wr(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=Ei(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,L=A-j&32767;if(M>2&&k==y(T-L))for(var R=Math.min(f,M)-1,z=Math.min(32767,T),B=Math.min(258,M);L<=z&&--I&&A!=j;){if(e[T+P]==e[T+P-L]){for(var V=0;V<B&&e[T+V]==e[T+V-L];++V);if(V>P){if(P=V,F=L,V>R)break;for(var ee=Math.min(L,V-2),te=0,N=0;N<ee;++N){var ne=T-L+N&32767,re=ne-h[ne]&32767;re>te&&(te=re,j=ne)}}}A=j,j=h[A],L+=A-j&32767}if(F){b[E++]=268435456|Qr[P]<<18|ti[F];var ie=Qr[P]&31,ae=ti[F]&31;w+=Kr[ie]+qr[ae],++x[257+ie],++S[ae],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Ei(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var oe=T+65535;oe>=o&&(c[u/8|0]=l,oe=o),u=Ti(c,u+1,e.subarray(T,oe))}a.i=o}return hi(s,0,r+mi(u)+i)},Ai=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},ji=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Ur(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ki(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Mi=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Ni=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Ai();i.p(t.dictionary),Mi(e,2,i.d())}},Pi=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&_i(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&_i(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Fi(e,t){t||={};var n=Ai();n.p(e);var r=ji(e,t,t.dictionary?6:2,4);return Ni(r,t),Mi(r,r.length-4,n.d()),r}function Ii(e,t){return vi(e.subarray(Pi(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var Li=typeof TextDecoder<`u`&&new TextDecoder;try{Li.decode(Oi,{stream:!0})}catch{}var Ri=`modern-font`;function zi(e,t){if(!e)throw Error(`[${Ri}] ${t}`)}function Bi(e){if(`buffer`in e){let t=e.buffer;return e.byteOffset>0||e.byteLength<e.buffer.byteLength?t.slice(e.byteOffset,e.byteOffset+e.byteLength):t}else return e}function Vi(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function Hi(e){let t=``;for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),i!==0&&(t+=String.fromCharCode(i));return t}function Ui(e){e=Hi(e);let t=[];for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),t.push(i>>8),t.push(i&255);return t}function Wi(e){let t=``;for(let n=0,r=e.length;n<r;n++)e[n]<127?t+=String.fromCharCode(e[n]):t+=`%${(256+e[n]).toString(16).slice(1)}`;return unescape(t)}function Gi(e){let t=``;for(let n=0,r=e.length;n<r;n+=2)t+=String.fromCharCode((e[n]<<8)+e[n+1]);return t}var Ki={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},qi=class extends DataView{constructor(e,t,n,r){super(Bi(e),t,n),this.littleEndian=r}cursor=0;readInt8=e=>this.read(`int8`,e);readInt16=(e,t)=>this.read(`int16`,e,t);readInt32=(e,t)=>this.read(`int32`,e,t);readUint8=e=>this.read(`uint8`,e);readUint16=(e,t)=>this.read(`uint16`,e,t);readUint32=(e,t)=>this.read(`uint32`,e,t);readFloat32=(e,t)=>this.read(`float32`,e,t);readFloat64=(e,t)=>this.read(`float64`,e,t);writeInt8=(e,t)=>this.write(`int8`,e,t);writeInt16=(e,t,n)=>this.write(`int16`,e,t,n);writeInt32=(e,t,n)=>this.write(`int32`,e,t,n);writeUint8=(e,t)=>this.write(`uint8`,e,t);writeUint16=(e,t,n)=>this.write(`uint16`,e,t,n);writeUint32=(e,t,n)=>this.write(`uint32`,e,t,n);writeFloat32=(e,t,n)=>this.write(`float32`,e,t,n);writeFloat64=(e,t,n)=>this.write(`float64`,e,t,n);readColumn(e){if(e.size){let t=Array.from({length:e.size},(t,n)=>this.read(e.type,e.offset+n));switch(e.type){case`char`:return t.join(``);default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(n,r)=>{this.write(e.type,t[r],e.offset+r)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,n=this.littleEndian){let r;switch(e){case`int8`:r=this.getInt8(t);break;case`int16`:r=this.getInt16(t,n);break;case`int32`:r=this.getInt32(t,n);break;case`uint8`:r=this.getUint8(t);break;case`uint16`:r=this.getUint16(t,n);break;case`uint32`:r=this.getUint32(t,n);break;case`float32`:r=this.getFloat32(t,n);break;case`float64`:r=this.getFloat64(t,n);break;case`fixed`:r=this.readFixed(t,n);break;case`longDateTime`:r=this.readLongDateTime(t,n);break;case`char`:r=this.readChar(t);break}return this.cursor+=Ki[e],r}readUint24(e=this.cursor){let[t,n,r]=this.readBytes(e,3);return(t<<16)+(n<<8)+r}readBytes(e,t){t??(t=e,e=this.cursor);let n=[];for(let r=0;r<t;++r)n.push(this.getUint8(e+r));return this.cursor=e+t,n}readString(e,t){let n=this.readBytes(e,t),r=``;for(let e=0,t=n.length;e<t;e++)r+=String.fromCharCode(n[e]);return r}readFixed(e,t){let n=this.readInt32(e,t)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(e=this.cursor,t){let n=this.readUint32(e+4,t),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(e){return this.readString(e,1)}write(e,t,n=this.cursor,r=this.littleEndian){switch(e){case`int8`:this.setInt8(n,t);break;case`int16`:this.setInt16(n,t,r);break;case`int32`:this.setInt32(n,t,r);break;case`uint8`:this.setUint8(n,t);break;case`uint16`:this.setUint16(n,t,r);break;case`uint32`:this.setUint32(n,t,r);break;case`float32`:this.setFloat32(n,t,r);break;case`float64`:this.setFloat64(n,t,r);break;case`char`:this.writeChar(t,n);break;case`fixed`:this.writeFixed(t,n);break;case`longDateTime`:this.writeLongDateTime(t,n);break}return this.cursor+=Ki[e],this}writeString(e=``,t=this.cursor){let n=e.replace(/[^\x00-\xFF]/g,`11`).length;this.seek(t);for(let t=0,n=e.length,r;t<n;++t)r=e.charCodeAt(t)||0,r>127?this.writeUint16(r):this.writeUint8(r);return this.cursor+=n,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){let n=-20775456e5;e=e===void 0?n:typeof e.getTime==`function`?e.getTime():/^\d+$/.test(e)?+e:Date.parse(e);let r=Math.round((e-n)/1e3);return this.writeUint32(0,t),this.writeUint32(r,t+4),this}writeBytes(e,t=this.cursor){let n;if(Array.isArray(e)){n=e.length;for(let r=0;r<n;++r)this.setUint8(t+r,e[r])}else{let r=Vi(e);n=r.byteLength;for(let e=0;e<n;++e)this.setUint8(t+e,r.getUint8(e))}return this.cursor=t+n,this}seek(e){return this.cursor=e,this}},Ji=new WeakMap;function J(e){let t=typeof e==`object`?e:{type:e},{size:n=1,type:r}=t;return(e,i)=>{if(typeof i!=`string`)return;let a=Ji.get(e);a||(a={columns:[],byteLength:0},Ji.set(e,a));let o={...t,name:i,byteLength:n*Ki[r],offset:t.offset??a.columns.reduce((e,t)=>e+t.byteLength,0)};a.columns.push(o),a.byteLength=a.columns.reduce((e,t)=>e+Ki[t.type]*(t.size??1),0),Object.defineProperty(e.constructor.prototype,i,{get(){return this.view.readColumn(o)},set(e){this.view.writeColumn(o,e)},configurable:!0,enumerable:!0})}}var Yi=class{view;constructor(e,t,n,r){this.view=new qi(e,t,n,r)}},Xi=class extends Yi{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)}},Zi=Object.defineProperty,Qi=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Zi(t,n,i),i},$i=class e extends Xi{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=Ui(r.fontFamily||``),a=i.length,o=Ui(r.fontStyle||``),s=o.length,c=Ui(r.version||``),l=c.length,u=Ui(r.fullName||``),d=u.length,f=86+a+4+s+4+l+4+d+2+t.view.byteLength,p=new e(new ArrayBuffer(f),0,f,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=t.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=n.head.checkSumAdjustment;let m=n.os2;return m&&(p.FontPANOSE=m.fontPANOSE,p.Italic=m.fsSelection,p.Weight=m.usWeightClass,p.fsType=m.fsType,p.UnicodeRange=m.ulUnicodeRange,p.CodePageRange=m.version>0?m.ulCodePageRange:[]),p.view.writeUint16(a),p.view.writeBytes(i),p.view.writeUint16(0),p.view.writeUint16(s),p.view.writeBytes(o),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(t.view),p}};Qi([J(`uint32`)],$i.prototype,`EOTSize`),Qi([J(`uint32`)],$i.prototype,`FontDataSize`),Qi([J(`uint32`)],$i.prototype,`Version`),Qi([J(`uint32`)],$i.prototype,`Flags`),Qi([J({type:`uint8`,size:10})],$i.prototype,`FontPANOSE`),Qi([J(`uint8`)],$i.prototype,`Charset`),Qi([J(`uint8`)],$i.prototype,`Italic`),Qi([J(`uint32`)],$i.prototype,`Weight`),Qi([J(`uint16`)],$i.prototype,`fsType`),Qi([J(`uint16`)],$i.prototype,`MagicNumber`),Qi([J({type:`uint32`,size:4})],$i.prototype,`UnicodeRange`),Qi([J({type:`uint8`,size:8})],$i.prototype,`CodePageRange`),Qi([J(`uint32`)],$i.prototype,`CheckSumAdjustment`),Qi([J({type:`uint8`,size:16})],$i.prototype,`Reserved`),Qi([J(`uint16`)],$i.prototype,`Padding1`);var ea=Object.defineProperty,ta=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ea(t,n,i),i},na=class extends Yi{constructor(e,t){super(e,t,16)}};ta([J({type:`char`,size:4})],na.prototype,`tag`),ta([J(`uint32`)],na.prototype,`checkSum`),ta([J(`uint32`)],na.prototype,`offset`),ta([J(`uint32`)],na.prototype,`length`);var ra=`................................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`.split(`.`),ia=`................................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`.split(`.`),aa=class{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){let 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 Error(`The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.`);this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},i){let a=1/(i?.unitsPerEm??1e3)*n,{xScale:o=a,yScale:s=a}=r,c=this.pathCommands,l=[];for(let n=0,r=c.length;n<r;n+=1){let r=c[n];r.type===`M`?l.push({type:`M`,x:e+r.x*o,y:t+-r.y*s}):r.type===`L`?l.push({type:`L`,x:e+r.x*o,y:t+-r.y*s}):r.type===`Q`?l.push({type:`Q`,x1:e+r.x1*o,y1:t+-r.y1*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`C`?l.push({type:`C`,x1:e+r.x1*o,y1:t+-r.y1*s,x2:e+r.x2*o,y2:t+-r.y2*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`Z`&&l.push({type:`Z`})}return l}},oa=class extends aa{parse(e,t,n){let r=this,{nominalWidthX:i,defaultWidthX:a,gsubrsBias:o,subrsBias:s}=e,c=e.topDict.paintType,l=this.index,u,d,f,p,m=[],h=[],g=0,_=!1,v=!1,y=a,b=0,x=0;function S(e,t){m.push({type:`L`,x:e,y:t})}function C(e,t,n,r,i,a){m.push({type:`C`,x1:e,y1:t,x2:n,y2:r,x:i,y:a})}function w(e,t){v&&c!==2&&T(),v=!0,m.push({type:`M`,x:e,y:t})}function T(){m.push({type:`Z`})}function E(e){m.push(...e)}function D(){h.length%2!=0&&!_&&(y=h.shift()+i),g+=h.length>>1,h.length=0,_=!0}function O(t){let a,m,k,A,j,M,N,P,F,I,L,R,z=0;for(;z<t.length;){let B=t[z++];switch(B){case 1:D();break;case 3:D();break;case 4:h.length>1&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),w(b,x);break;case 5:for(;h.length>0;)b+=h.shift(),x+=h.shift(),S(b,x);break;case 6:for(;h.length>0&&(b+=h.shift(),S(b,x),h.length!==0);)x+=h.shift(),S(b,x);break;case 7:for(;h.length>0&&(x+=h.shift(),S(b,x),h.length!==0);)b+=h.shift(),S(b,x);break;case 8:for(;h.length>0;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 10:j=h.pop()+s,M=e.subrs[j],M&&O(M);break;case 11:return;case 12:switch(B=t[z],z+=1,B){case 35:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),x=R+h.shift(),h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 34:u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=x,b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 36:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 37:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),Math.abs(L-b)>Math.abs(R-x)?b=L+h.shift():x=R+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;default:console.warn(`Glyph ${l}: unknown operator ${1200+B}`),h.length=0}break;case 14:if(h.length>=4){let t=ra[h.pop()],i=ra[h.pop()],a=h.pop(),o=h.pop();if(t&&i){r.isComposite=!0,r.components=[];let s=e.charset.indexOf(t),c=e.charset.indexOf(i);r.components.push({glyphIndex:c,dx:0,dy:0}),r.components.push({glyphIndex:s,dx:o,dy:a}),E(n.get(c).pathCommands);let l=JSON.parse(JSON.stringify(n.get(s).pathCommands));for(let e=0;e<l.length;e+=1){let t=l[e];t.type!==`Z`&&(t.x+=o,t.y+=a),(t.type===`Q`||t.type===`C`)&&(t.x1+=o,t.y1+=a),t.type===`C`&&(t.x2+=o,t.y2+=a)}E(l)}}else h.length>0&&!_&&(y=h.shift()+i,_=!0);v&&c!==2&&(T(),v=!1);break;case 18:D();break;case 19:case 20:D(),z+=g+7>>3;break;case 21:h.length>2&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),b+=h.pop(),w(b,x);break;case 22:h.length>1&&!_&&(y=h.shift()+i,_=!0),b+=h.pop(),w(b,x);break;case 23:D();break;case 24:for(;h.length>2;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);b+=h.shift(),x+=h.shift(),S(b,x);break;case 25:for(;h.length>6;)b+=h.shift(),x+=h.shift(),S(b,x);u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 26:for(h.length%2&&(b+=h.shift());h.length>0;)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f,x=p+h.shift(),C(u,d,f,p,b,x);break;case 27:for(h.length%2&&(x+=h.shift());h.length>0;)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p,C(u,d,f,p,b,x);break;case 28:a=t[z],m=t[z+1],h.push((a<<24|m<<16)>>16),z+=2;break;case 29:j=h.pop()+o,M=e.gsubrs[j],M&&O(M);break;case 30:for(;h.length>0&&(u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;case 31:for(;h.length>0&&(u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;default:B<32?console.warn(`Glyph ${l}: unknown operator ${B}`):B<247?h.push(B-139):B<251?(a=t[z],z+=1,h.push((B-247)*256+a+108)):B<255?(a=t[z],z+=1,h.push(-(B-251)*256-a-108)):(a=t[z],m=t[z+1],k=t[z+2],A=t[z+3],z+=4,h.push((a<<24|m<<16|k<<8|A)/65536))}}}O(t),this.pathCommands=m,_&&(this.advanceWidth=y)}},sa=class{constructor(e){this._sfnt=e}_items=[];get(e){let t=this._items[e],n;if(t)n=t;else{n=this._get(e);let t=this._sfnt.hmtx.metrics[e];t&&(n.advanceWidth=n.advanceWidth||t.advanceWidth,n.leftSideBearing=n.leftSideBearing||t.leftSideBearing);let r=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);r&&(n.unicode??=r[0],n.unicodes??=r),this._items[e]=n}return n}},ca=class extends sa{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new oa({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},la=Object.defineProperty,ua=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&la(t,n,i),i},da=class extends Yi{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let e=this.view,t=this.count,n=this.offsetSize;this.objectOffset=(t+1)*n+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){let e=this.view,t=this.count,n=this.offsetSize;e.seek(3);let r=[];for(let e=0,i=t+1;e<i;e++){let e=this.view,t=0;for(let r=0;r<n;r++)t<<=8,t+=e.readUint8();r.push(t)}return r}readObjects(){let e=[];for(let t=0,n=this.count;t<n;t++)e.push(this.get(t));return e}get(e){let t=this.offsets,n=this.objectOffset,r=n+t[e],i=n+t[e+1]-r;return this._isString?this.view.readString(r,i):this.view.readBytes(r,i)}};ua([J(`uint16`)],da.prototype,`count`),ua([J(`uint8`)],da.prototype,`offsetSize`);var fa=class extends da{_isString=!1},pa=class extends da{_isString=!0},ma=`.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`.split(`,`),ha=`.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`.split(`,`),ga=`.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`.split(`,`),_a=`.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`.split(`,`);function va(e,t){return t<=390?ma[t]:e[t-391]}function Y(e,t=`number`,n){return(r,i)=>{if(typeof i!=`string`)return;let a={type:t,operator:e,default:n??t===`number`?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(a)},set(e){this._setProp(a,e)},configurable:!0,enumerable:!0})}}var ya=class extends Yi{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){let e=this.view,t=``,n=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`];for(;;){let r=e.readUint8(),i=r>>4,a=r&15;if(i===15||(t+=n[i],a===15))break;t+=n[a]}return Number.parseFloat(t)}_readOperand(e){let t=this.view,n,r,i,a;if(e===28)return n=t.readUint8(),r=t.readUint8(),n<<8|r;if(e===29)return n=t.readUint8(),r=t.readUint8(),i=t.readUint8(),a=t.readUint8(),n<<24|r<<16|i<<8|a;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return n=t.readUint8(),(e-247)*256+n+108;if(e>=251&&e<=254)return n=t.readUint8(),-(e-251)*256-n-108;throw Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){let e=this.view;e.seek(0);let t=[],n=e.cursor+e.byteLength,r={};for(;e.cursor<n;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),r[n]=t,t=[]):t.push(this._readOperand(n))}return r}_getProp(e){let t=this.dict[e.operator]??e.default;switch(e.type){case`number`:return t[0];case`string`:return va(this._stringIndex?.objects??[],t[0]);case`number[]`:return t}return t}_setProp(e,t){}},ba=Object.defineProperty,xa=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ba(t,n,i),i},Sa=class extends ya{};xa([Y(19)],Sa.prototype,`subrs`),xa([Y(20)],Sa.prototype,`defaultWidthX`),xa([Y(21)],Sa.prototype,`nominalWidthX`);var Ca=Object.defineProperty,X=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ca(t,n,i),i},Z=class extends ya{};X([Y(0,`string`)],Z.prototype,`version`),X([Y(1,`string`)],Z.prototype,`notice`),X([Y(1200,`string`)],Z.prototype,`copyright`),X([Y(2,`string`)],Z.prototype,`fullName`),X([Y(3,`string`)],Z.prototype,`familyName`),X([Y(4,`string`)],Z.prototype,`weight`),X([Y(1201)],Z.prototype,`isFixedPitch`),X([Y(1202)],Z.prototype,`italicAngle`),X([Y(1203,`number`,-100)],Z.prototype,`underlinePosition`),X([Y(1204,`number`,50)],Z.prototype,`underlineThickness`),X([Y(1205)],Z.prototype,`paintType`),X([Y(1206,`number`,2)],Z.prototype,`charstringType`),X([Y(1207,`number[]`,[.001,0,0,.001,0,0])],Z.prototype,`fontMatrix`),X([Y(13)],Z.prototype,`uniqueId`),X([Y(5,`number[]`,[0,0,0,0])],Z.prototype,`fontBBox`),X([Y(1208)],Z.prototype,`strokeWidth`),X([Y(14)],Z.prototype,`xuid`),X([Y(15)],Z.prototype,`charset`),X([Y(16)],Z.prototype,`encoding`),X([Y(17)],Z.prototype,`charStrings`),X([Y(18,`number[]`,[0,0])],Z.prototype,`private`);function wa(e,t=e){return n=>{Ta.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(Ta.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var Ta=class e{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;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){let{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){let t=[];for(let n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){let t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,i=Array.from({length:r}),a=t.get(0);for(let e=0;e<r;e+=1)i[e]=t.get(n[e])||a;return i}getPathCommands(e,t,n,r,i){let a=[];return this.forEachGlyph(e,t,n,r,i,(e,t,n,r,i)=>{a.push(...e.getPathCommands(t,n,r,i,this))}),a}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,i={},a){let o=1/this.unitsPerEm*r,s=this.textToGlyphs(e);for(let e=0;e<s.length;e+=1){let c=s[e];a.call(this,c,t,n,r,i),c.advanceWidth&&(t+=c.advanceWidth*o),i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t}constructor(e){(e instanceof Map?e:new Map(Object.entries(e))).forEach((e,t)=>{this.tableViews.set(t,new DataView(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)))})}clone(){return new e(this.tableViews)}delete(t){let n=e.tableDefinitions.get(t);return n?(this.tableViews.delete(t),this.tables.delete(n.prop),this):this}set(t,n){let r=e.tableDefinitions.get(t);return r&&this.tables.set(r.prop,n),this.tableViews.set(t,n.view),this}get(t){let n=e.tableDefinitions.get(t);if(!n)return;let r=this.tables.get(n.prop);if(!r){let e=n.class;if(e){let i=this.tableViews.get(t);if(!i)return;r=new e(i.buffer,i.byteOffset,i.byteLength).setSFNT(this),this.tables.set(n.prop,r)}}return r}},Ea=class extends Yi{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},Da=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,ka=(e,t,n,r)=>{for(var i=r>1?void 0:r?Oa(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Da(t,n,i),i},Aa=class extends Ea{_glyphs;get glyphs(){return this._glyphs??=new ca(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let{buffer:e,byteOffset:t}=this.view,n=t+4;this.nameIndex=new pa(e,n),this.topDictIndex=new fa(e,this.nameIndex.endOffset),this.stringIndex=new pa(e,this.topDictIndex.endOffset),this.globalSubrIndex=new fa(e,this.stringIndex.endOffset),this.topDict=new Z(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);let r=this.topDict.private[0],i=this.topDict.private[1];r&&(this.privateDict=new Sa(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new fa(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new fa(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=ha:this.topDict.charset===1?this.charset=ga:this.topDict.charset===2?this.charset=_a:this.charset=this._readCharset(t+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=ra:this.topDict.encoding===1?this.encoding=ia:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(e,t,n){let r=this.view;r.seek(e);let i,a,o;--t;let s=[`.notdef`],c=r.readUint8();if(c===0)for(i=0;i<t;i+=1)a=r.readUint16(),s.push(va(n,a));else if(c===1)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)s.push(va(n,a)),a+=1;else if(c===2)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)s.push(va(n,a)),a+=1;else throw Error(`Unknown charset format ${c}`);return s}_readEncoding(e){let t=this.view;t.seek(e);let n,r,i={},a=t.readUint8();if(a===0){let e=t.readUint8();for(n=0;n<e;n+=1)r=t.readUint8(),i[r]=n}else if(a===1){let e=t.readUint8();for(r=1,n=0;n<e;n+=1){let e=t.readUint8(),n=t.readUint8();for(let t=e;t<=e+n;t+=1)i[t]=r,r+=1}}else console.warn(`unknown encoding format:${a}`);return i}_calcSubroutineBias(e){let t;return t=e.length<1240?107:e.length<33900?1131:32768,t}};ka([J(`uint8`)],Aa.prototype,`majorVersion`,2),ka([J(`uint8`)],Aa.prototype,`minorVersion`,2),ka([J(`uint8`)],Aa.prototype,`headerSize`,2),ka([J(`uint8`)],Aa.prototype,`offsetSize`,2),Aa=ka([wa(`CFF `,`cff`)],Aa);var ja=Object.defineProperty,Ma=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ja(t,n,i),i},Na=class e extends Yi{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(t){let n=new e;return n.format=0,n.length=n.view.byteLength,n.language=0,t.forEach((e,t)=>{t<256&&e<256&&n.view.writeUint8(e,6+t)}),n}getUnicodeToGlyphIndexMap(){let e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Ma([J(`uint16`)],Na.prototype,`format`),Ma([J(`uint16`)],Na.prototype,`length`),Ma([J(`uint16`)],Na.prototype,`language`),Ma([J({type:`uint8`,size:256})],Na.prototype,`glyphIndexArray`);var Pa=Na,Fa=Object.defineProperty,Ia=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Fa(t,n,i),i},La=class extends Yi{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(){let e=this.maxSubHeaderKey;return this.view.seek(518),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(){let e=518+this.maxSubHeaderKey*8;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){let t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,i=this.subHeaders,a=this.glyphIndexArray,o=n.findIndex(e=>e===r),s=0;for(let r=0;r<256;r++)if(n[r]===0)r>=o||r<i[0].firstCode||r>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(r-i[0].firstCode)>=a.length?s=0:(s=a[i[0].idRangeOffset+(r-i[0].firstCode)],s!==0&&(s+=i[0].idDelta)),s!==0&&s<e&&t.set(r,s);else{let o=n[r];for(let n=0,c=i[o].entryCount;n<c;n++)if(i[o].idRangeOffset+n>=a.length?s=0:(s=a[i[o].idRangeOffset+n],s!==0&&(s+=i[o].idDelta)),s!==0&&s<e){let e=(r<<8|n+i[o].firstCode)%65535;t.set(e,s)}}return t}};Ia([J(`uint16`)],La.prototype,`format`),Ia([J(`uint16`)],La.prototype,`length`),Ia([J(`uint16`)],La.prototype,`language`);function Ra(e){return e>32767?e-65536:e<-32767?e+65536:e}function za(e,t){let n,r=[],i={};return e.forEach((e,a)=>{t&&a>t||((!n||a!==n.unicode+1||e!==n.glyphIndex+1)&&(n?(i.end=n.unicode,r.push(i),i={start:a,startId:e,delta:Ra(e-a)}):(i.start=Number(a),i.startId=e,i.delta=Ra(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var Ba=Object.defineProperty,Va=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ba(t,n,i),i},Ha=class e extends Yi{get endCode(){let 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(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){let 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(e=>this.view.writeUint16(e))}get idDelta(){let e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){let t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(e=>this.view.writeUint16(e))}get idRangeOffsetCursor(){let e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){let 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(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){let e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){let e=this.glyphIndexArrayCursor;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(t){let n=za(t,65535),r=n.length+1,i=Math.floor(Math.log(r)/Math.LN2),a=2*2**i,o=new e(new ArrayBuffer(24+n.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=a,o.entrySelector=i,o.rangeShift=2*r-a,o.endCode=[...n.map(e=>e.end),65535],o.reservedPad=0,o.startCode=[...n.map(e=>e.start),65535],o.idDelta=[...n.map(e=>e.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,i=this.endCode,a=this.idRangeOffset,o=this.idDelta,s=this.glyphIndexArray;for(let c=0;c<t;++c)for(let t=r[c],l=i[c];t<=l;++t)if(a[c]===0)e.set(t,(t+o[c])%65536);else{let i=s[c+a[c]/2+(t-r[c])-n];i===0?e.set(t,0):e.set(t,(i+o[c])%65536)}return e.delete(65535),e}};Va([J(`uint16`)],Ha.prototype,`format`),Va([J(`uint16`)],Ha.prototype,`length`),Va([J(`uint16`)],Ha.prototype,`language`),Va([J(`uint16`)],Ha.prototype,`segCountX2`),Va([J(`uint16`)],Ha.prototype,`searchRange`),Va([J(`uint16`)],Ha.prototype,`entrySelector`),Va([J(`uint16`)],Ha.prototype,`rangeShift`);var Ua=Ha,Wa=Object.defineProperty,Ga=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Wa(t,n,i),i},Ka=class extends Yi{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){let e=this.glyphIndexArray,t=new Map;return e.forEach((e,n)=>{t.set(n,e)}),t}};Ga([J(`uint16`)],Ka.prototype,`format`),Ga([J(`uint16`)],Ka.prototype,`length`),Ga([J(`uint16`)],Ka.prototype,`language`),Ga([J(`uint16`)],Ka.prototype,`firstCode`),Ga([J(`uint16`)],Ka.prototype,`entryCount`);var qa=Object.defineProperty,Ja=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&qa(t,n,i),i},Ya=class e extends Yi{get groups(){let 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(t){let n=za(t),r=new e(new ArrayBuffer(16+n.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=n.length,n.forEach(e=>{r.view.writeUint32(e.start),r.view.writeUint32(e.end),r.view.writeUint32(e.startId)}),r}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){let r=t[n],i=r.startGlyphCode,a=r.startCharCode,o=r.endCharCode;for(;a<=o;)e.set(a++,i++)}return e}};Ja([J(`uint16`)],Ya.prototype,`format`),Ja([J(`uint16`)],Ya.prototype,`reserved`),Ja([J(`uint32`)],Ya.prototype,`length`),Ja([J(`uint32`)],Ya.prototype,`language`),Ja([J(`uint32`)],Ya.prototype,`nGroups`);var Xa=Ya,Za=Object.defineProperty,Qa=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Za(t,n,i),i},$a=class extends Yi{getVarSelectorRecords(){let e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{let e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);let t=this.view.readUint32();e.unicodeValueRanges=Array.from({length:t},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);let t=this.view.readUint32();e.uVSMappings=Array.from({length:t},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){let{uVSMappings:r}=t[n];r.forEach(t=>{e.set(t.unicodeValue,t.glyphID)})}return e}};Qa([J(`uint16`)],$a.prototype,`format`),Qa([J(`uint32`)],$a.prototype,`length`),Qa([J(`uint32`)],$a.prototype,`numVarSelectorRecords`);var eo=Object.defineProperty,to=Object.getOwnPropertyDescriptor,no=(e,t,n,r)=>{for(var i=r>1?void 0:r?to(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&eo(t,n,i),i},ro=class extends Ea{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=Ua.from(e),r=Pa.from(e),i=t?Xa.from(e):void 0,a=4+(i?32:24),o=a+n.view.byteLength,s=o+r.view.byteLength,c=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:a},i&&{platformID:3,platformSpecificID:10,offset:s}].filter(Boolean),l=new ro(new ArrayBuffer(4+8*c.length+n.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return l.numberSubtables=c.length,l.view.seek(4),c.forEach(e=>{l.view.writeUint16(e.platformID),l.view.writeUint16(e.platformSpecificID),l.view.writeUint32(e.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,o),i&&l.view.writeBytes(i.view,s),l}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){let e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,i=n.length;r<i;r++){let i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){let 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(e=>{this.view.seek(e.offset);let t=this.view.readUint16(),n;switch(t){case 0:n=new Pa(this.view.buffer,e.offset);break;case 2:n=new La(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new Ua(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Ka(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new Xa(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;default:n=new $a(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:t,view:n}})}readunicodeToGlyphIndexMap(){let e=this.readSubtables(),t=e.find(e=>e.format===0)?.view,n=e.find(e=>e.platformID===3&&e.platformSpecificID===3&&e.format===2)?.view,r=e.find(e=>e.platformID===3&&e.platformSpecificID===1&&e.format===4)?.view,i=e.find(e=>e.platformID===3&&e.platformSpecificID===10&&e.format===12)?.view,a=e.find(e=>e.platformID===0&&e.platformSpecificID===5&&e.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...a?.getUnicodeToGlyphIndexMap()??[]])}};no([J(`uint16`)],ro.prototype,`version`,2),no([J(`uint16`)],ro.prototype,`numberSubtables`,2),ro=no([wa(`cmap`)],ro);var io=class extends aa{_parseContours(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return zi(n.length===0,`There are still points left in the current contour.`),t}_transformPoints(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],a={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(a)}return n}_parseGlyphCoordinate(e,t,n,r,i){let a;return(t&r)>0?(a=e.view.readUint8(),(t&i)===0&&(a=-a),a=n+a):a=(t&i)>0?n:n+e.view.readInt16(),a}parse(e,t,n){e.view.seek(t);let 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){let t=this.endPointIndices=[];for(let n=0;n<r;n++)t.push(e.view.readUint16());let n=this.instructionLength=e.view.readUint16();zi(n<5e3,`Bad instructionLength:${n}`);let i=this.instructions=[];for(let t=0;t<n;++t)i.push(e.view.readUint8());let a=e.view.byteOffset,o=t[t.length-1]+1;zi(o<2e4,`Bad numberOfCoordinates:${a}`);let s=[],c,l=0;for(;l<o;)if(c=e.view.readUint8(),s.push(c),l++,c&8&&l<o){let t=e.view.readUint8();for(let e=0;e<t;e++)s.push(c),l++}if(zi(s.length===o,`Bad flags length: ${s.length}, numberOfCoordinates: ${o}`),t.length>0){let n=[],r;if(o>0){for(let e=0;e<o;e+=1)c=s[e],r={},r.onCurve=!!(c&1),r.lastPointOfContour=t.includes(e),n.push(r);let i=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.x=this._parseGlyphCoordinate(e,c,i,2,16),i=r.x;let a=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.y=this._parseGlyphCoordinate(e,c,a,4,32),a=r.y}this.points=n}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let t,n=!0;for(;n;){t=e.view.readUint16();let r={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(t&1)>0?(t&2)>0?(r.dx=e.view.readInt16(),r.dy=e.view.readInt16()):r.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(t&2)>0?(r.dx=e.view.readInt8(),r.dy=e.view.readInt8()):r.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(t&8)>0?r.xScale=r.yScale=e.view.readInt16()/16384:(t&64)>0?(r.xScale=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384):(t&128)>0&&(r.xScale=e.view.readInt16()/16384,r.scale01=e.view.readInt16()/16384,r.scale10=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384),this.components.push(r),n=!!(t&32)}if(t&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let t=0;t<this.instructionLength;t+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let e=0;e<this.components.length;e+=1){let t=this.components[e],r=n.get(t.glyphIndex);if(r.getPathCommands(),r.points){let e;if(t.matchedPoints===void 0)e=this._transformPoints(r.points,t);else{zi(t.matchedPoints[0]>this.points.length-1||t.matchedPoints[1]>r.points.length-1,`Matched points out of range in ${this.name}`);let n=this.points[t.matchedPoints[0]],i=r.points[t.matchedPoints[1]],a={xScale:t.xScale,scale01:t.scale01,scale10:t.scale10,yScale:t.yScale,dx:0,dy:0};i=this._transformPoints([i],a)[0],a.dx=n.x-i.x,a.dy=n.y-i.y,e=this._transformPoints(r.points,a)}this.points=this.points.concat(e)}}let i=[],a=this._parseContours(this.points);for(let e=0,t=a.length;e<t;++e){let t=a[e],n=t[t.length-1],r=t[0];n.onCurve?i.push({type:`M`,x:n.x,y:n.y}):r.onCurve?i.push({type:`M`,x:r.x,y:r.y}):i.push({type:`M`,x:(n.x+r.x)*.5,y:(n.y+r.y)*.5});for(let e=0,a=t.length;e<a;++e)if(n=r,r=t[(e+1)%a],n.onCurve)i.push({type:`L`,x:n.x,y:n.y});else{let e=r;r.onCurve||(e={x:(n.x+r.x)*.5,y:(n.y+r.y)*.5}),i.push({type:`Q`,x1:n.x,y1:n.y,x:e.x,y:e.y})}i.push({type:`Z`})}this.pathCommands=i}},ao=class extends sa{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new io({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},oo=Object.getOwnPropertyDescriptor,so=(e,t,n,r)=>{for(var i=r>1?void 0:r?oo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},co=class extends Ea{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new co(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new ao(this._sfnt)}};co=so([wa(`glyf`)],co);var lo=Object.getOwnPropertyDescriptor,uo=(e,t,n,r)=>{for(var i=r>1?void 0:r?lo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},fo=class extends Ea{};fo=uo([wa(`GPOS`,`gpos`)],fo);var po=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,ho=(e,t,n,r)=>{for(var i=r>1?void 0:r?mo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&po(t,n,i),i},go=class extends Ea{};ho([J(`uint16`)],go.prototype,`majorVersion`,2),ho([J(`uint16`)],go.prototype,`minorVersion`,2),ho([J(`uint16`)],go.prototype,`scriptListOffset`,2),ho([J(`uint16`)],go.prototype,`featureListOffset`,2),ho([J(`uint16`)],go.prototype,`lookupListOffset`,2),ho([J(`uint16`)],go.prototype,`featureVariationsOffset`,2),go=ho([wa(`GSUB`,`gsub`)],go);var _o=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,yo=(e,t,n,r)=>{for(var i=r>1?void 0:r?vo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_o(t,n,i),i},bo=class extends Ea{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};yo([J(`fixed`)],bo.prototype,`version`,2),yo([J(`fixed`)],bo.prototype,`fontRevision`,2),yo([J(`uint32`)],bo.prototype,`checkSumAdjustment`,2),yo([J(`uint32`)],bo.prototype,`magickNumber`,2),yo([J(`uint16`)],bo.prototype,`flags`,2),yo([J(`uint16`)],bo.prototype,`unitsPerEm`,2),yo([J({type:`longDateTime`})],bo.prototype,`created`,2),yo([J({type:`longDateTime`})],bo.prototype,`modified`,2),yo([J(`int16`)],bo.prototype,`xMin`,2),yo([J(`int16`)],bo.prototype,`yMin`,2),yo([J(`int16`)],bo.prototype,`xMax`,2),yo([J(`int16`)],bo.prototype,`yMax`,2),yo([J(`uint16`)],bo.prototype,`macStyle`,2),yo([J(`uint16`)],bo.prototype,`lowestRecPPEM`,2),yo([J(`int16`)],bo.prototype,`fontDirectionHint`,2),yo([J(`int16`)],bo.prototype,`indexToLocFormat`,2),yo([J(`int16`)],bo.prototype,`glyphDataFormat`,2),bo=yo([wa(`head`)],bo);var xo=Object.defineProperty,So=Object.getOwnPropertyDescriptor,Co=(e,t,n,r)=>{for(var i=r>1?void 0:r?So(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&xo(t,n,i),i},wo=class extends Ea{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Co([J(`fixed`)],wo.prototype,`version`,2),Co([J(`int16`)],wo.prototype,`ascent`,2),Co([J(`int16`)],wo.prototype,`descent`,2),Co([J(`int16`)],wo.prototype,`lineGap`,2),Co([J(`uint16`)],wo.prototype,`advanceWidthMax`,2),Co([J(`int16`)],wo.prototype,`minLeftSideBearing`,2),Co([J(`int16`)],wo.prototype,`minRightSideBearing`,2),Co([J(`int16`)],wo.prototype,`xMaxExtent`,2),Co([J(`int16`)],wo.prototype,`caretSlopeRise`,2),Co([J(`int16`)],wo.prototype,`caretSlopeRun`,2),Co([J(`int16`)],wo.prototype,`caretOffset`,2),Co([J({type:`int16`,size:4})],wo.prototype,`reserved`,2),Co([J(`int16`)],wo.prototype,`metricDataFormat`,2),Co([J(`uint16`)],wo.prototype,`numOfLongHorMetrics`,2),wo=Co([wa(`hhea`)],wo);var To=Object.getOwnPropertyDescriptor,Eo=(e,t,n,r)=>{for(var i=r>1?void 0:r?To(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Do=class extends Ea{static from(e){let t=e.length*4,n=new Do(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceWidth),n.view.writeUint16(e.leftSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics,n=0,r=this.view;return r.seek(0),Array.from({length:e}).map((e,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};Do=Eo([wa(`hmtx`)],Do);var Oo=Object.getOwnPropertyDescriptor,ko=(e,t,n,r)=>{for(var i=r>1?void 0:r?Oo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Ao=class extends Ea{};Ao=ko([wa(`kern`,`kern`)],Ao);var jo=Object.getOwnPropertyDescriptor,Mo=(e,t,n,r)=>{for(var i=r>1?void 0:r?jo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},No=class extends Ea{static from(e,t=1){let n=e.length*(t?4:2),r=new No(new ArrayBuffer(n));return e.forEach(e=>{t?r.view.writeUint32(e):r.view.writeUint16(e/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){let 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)}};No=Mo([wa(`loca`)],No);var Po=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Io=(e,t,n,r)=>{for(var i=r>1?void 0:r?Fo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Po(t,n,i),i},Lo=class extends Ea{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};Io([J(`fixed`)],Lo.prototype,`version`,2),Io([J(`uint16`)],Lo.prototype,`numGlyphs`,2),Io([J(`uint16`)],Lo.prototype,`maxPoints`,2),Io([J(`uint16`)],Lo.prototype,`maxContours`,2),Io([J(`uint16`)],Lo.prototype,`maxComponentPoints`,2),Io([J(`uint16`)],Lo.prototype,`maxComponentContours`,2),Io([J(`uint16`)],Lo.prototype,`maxZones`,2),Io([J(`uint16`)],Lo.prototype,`maxTwilightPoints`,2),Io([J(`uint16`)],Lo.prototype,`maxStorage`,2),Io([J(`uint16`)],Lo.prototype,`maxFunctionDefs`,2),Io([J(`uint16`)],Lo.prototype,`maxInstructionDefs`,2),Io([J(`uint16`)],Lo.prototype,`maxStackElements`,2),Io([J(`uint16`)],Lo.prototype,`maxSizeOfInstructions`,2),Io([J(`uint16`)],Lo.prototype,`maxComponentElements`,2),Io([J(`uint16`)],Lo.prototype,`maxComponentDepth`,2),Lo=Io([wa(`maxp`)],Lo);var Ro=Object.defineProperty,zo=Object.getOwnPropertyDescriptor,Bo=(e,t,n,r)=>{for(var i=r>1?void 0:r?zo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ro(t,n,i),i},Vo={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`},Ho={Macintosh:1,Microsoft:3},Uo={Default:0},Wo={UCS2:1},Go=class extends Ea{_names;get names(){return this._names??=this.readNames()}readNames(){let e=this.count;this.view.seek(6);let t=[];for(let n=0;n<e;++n)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()});let n=this.stringOffset;for(let r=0;r<e;++r){let e=t[r];e.name=this.view.readBytes(n+e.offset,e.length)}let r=Ho.Macintosh,i=Uo.Default,a=0;t.some(e=>e.platform===Ho.Microsoft&&e.encoding===Wo.UCS2&&e.language===1033)&&(r=Ho.Microsoft,i=Wo.UCS2,a=1033);let o={};for(let n=0;n<e;++n){let e=t[n];e.platform===r&&e.encoding===i&&e.language===a&&Vo[e.nameId]&&(o[Vo[e.nameId]]=a===0?Wi(e.name):Gi(e.name))}return o}};Bo([J(`uint16`)],Go.prototype,`format`,2),Bo([J(`uint16`)],Go.prototype,`count`,2),Bo([J(`uint16`)],Go.prototype,`stringOffset`,2),Go=Bo([wa(`name`)],Go);var Ko=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?qo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ko(t,n,i),i},$=class extends Ea{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};Q([J(`uint16`)],$.prototype,`version`,2),Q([J(`int16`)],$.prototype,`xAvgCharWidth`,2),Q([J(`uint16`)],$.prototype,`usWeightClass`,2),Q([J(`uint16`)],$.prototype,`usWidthClass`,2),Q([J(`uint16`)],$.prototype,`fsType`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutSize`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutPosition`,2),Q([J(`uint16`)],$.prototype,`sFamilyClass`,2),Q([J({type:`uint8`})],$.prototype,`bFamilyType`,2),Q([J({type:`uint8`})],$.prototype,`bSerifStyle`,2),Q([J({type:`uint8`})],$.prototype,`bWeight`,2),Q([J({type:`uint8`})],$.prototype,`bProportion`,2),Q([J({type:`uint8`})],$.prototype,`bContrast`,2),Q([J({type:`uint8`})],$.prototype,`bStrokeVariation`,2),Q([J({type:`uint8`})],$.prototype,`bArmStyle`,2),Q([J({type:`uint8`})],$.prototype,`bLetterform`,2),Q([J({type:`uint8`})],$.prototype,`bMidline`,2),Q([J({type:`uint8`})],$.prototype,`bXHeight`,2),Q([J({type:`uint32`,size:4})],$.prototype,`ulUnicodeRange`,2),Q([J({type:`char`,size:4})],$.prototype,`achVendID`,2),Q([J(`uint16`)],$.prototype,`fsSelection`,2),Q([J(`uint16`)],$.prototype,`usFirstCharIndex`,2),Q([J(`uint16`)],$.prototype,`usLastCharIndex`,2),Q([J(`int16`)],$.prototype,`sTypoAscender`,2),Q([J(`int16`)],$.prototype,`sTypoDescender`,2),Q([J(`int16`)],$.prototype,`sTypoLineGap`,2),Q([J(`uint16`)],$.prototype,`usWinAscent`,2),Q([J(`uint16`)],$.prototype,`usWinDescent`,2),Q([J({offset:78,type:`uint32`,size:2})],$.prototype,`ulCodePageRange`,2),Q([J({offset:86,type:`int16`})],$.prototype,`sxHeight`,2),Q([J(`int16`)],$.prototype,`sCapHeight`,2),Q([J(`uint16`)],$.prototype,`usDefaultChar`,2),Q([J(`uint16`)],$.prototype,`usBreakChar`,2),Q([J(`uint16`)],$.prototype,`usMaxContext`,2),$=Q([wa(`OS/2`,`os2`)],$);var Jo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,Xo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Yo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Jo(t,n,i),i},Zo=class extends Ea{constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Xo([J(`fixed`)],Zo.prototype,`format`,2),Xo([J(`fixed`)],Zo.prototype,`italicAngle`,2),Xo([J(`int16`)],Zo.prototype,`underlinePosition`,2),Xo([J(`int16`)],Zo.prototype,`underlineThickness`,2),Xo([J(`uint32`)],Zo.prototype,`isFixedPitch`,2),Xo([J(`uint32`)],Zo.prototype,`minMemType42`,2),Xo([J(`uint32`)],Zo.prototype,`maxMemType42`,2),Xo([J(`uint32`)],Zo.prototype,`minMemType1`,2),Xo([J(`uint32`)],Zo.prototype,`maxMemType1`,2),Zo=Xo([wa(`post`)],Zo);var Qo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,es=(e,t,n,r)=>{for(var i=r>1?void 0:r?$o(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Qo(t,n,i),i},ts=class extends Ea{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};es([J(`fixed`)],ts.prototype,`version`,2),es([J(`int16`)],ts.prototype,`vertTypoAscender`,2),es([J(`int16`)],ts.prototype,`vertTypoDescender`,2),es([J(`int16`)],ts.prototype,`vertTypoLineGap`,2),es([J(`int16`)],ts.prototype,`advanceHeightMax`,2),es([J(`int16`)],ts.prototype,`minTopSideBearing`,2),es([J(`int16`)],ts.prototype,`minBottomSideBearing`,2),es([J(`int16`)],ts.prototype,`yMaxExtent`,2),es([J(`int16`)],ts.prototype,`caretSlopeRise`,2),es([J(`int16`)],ts.prototype,`caretSlopeRun`,2),es([J(`int16`)],ts.prototype,`caretOffset`,2),es([J({type:`int16`,size:4})],ts.prototype,`reserved`,2),es([J(`int16`)],ts.prototype,`metricDataFormat`,2),es([J(`int16`)],ts.prototype,`numOfLongVerMetrics`,2),ts=es([wa(`vhea`)],ts);var ns=Object.getOwnPropertyDescriptor,rs=(e,t,n,r)=>{for(var i=r>1?void 0:r?ns(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},is=class extends Ea{static from(e){let t=e.length*4,n=new is(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceHeight),n.view.writeInt16(e.topSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((e,i)=>(i<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};is=rs([wa(`vmtx`)],is);var as=Object.defineProperty,os=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&as(t,n,i),i},ss=class extends Xi{format=`TrueType`;mimeType=`font/ttf`;_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(Vi(e).getUint32(0))}static checksum(e){let t=Vi(e),n=t.byteLength;for(;n%4;)n++;let r=0;for(let e=0,i=n/4;e<i;e+=4)e*4<n-4&&(r+=t.getUint32(e*4,!1));return r&4294967295}static from(e){let t=e=>e+3&-4,n=e.tableViews.size,r=[...e.tableViews.values()].reduce((e,n)=>e+t(n.byteLength),0),i=new this(new ArrayBuffer(12+n*16+r));i.scalerType=65536,i.numTables=n;let a=Math.log(2);i.searchRange=Math.floor(Math.log(n)/a)*16,i.entrySelector=Math.floor(i.searchRange/a),i.rangeShift=n*16-i.searchRange;let o=12+n*16,s=0,c=i.getDirectories();e.tableViews.forEach((e,n)=>{let r=c[s++];r.tag=n,r.checkSum=this.checksum(e),r.offset=o,r.length=e.byteLength,i.view.writeBytes(e,o),o+=t(r.length)});let l=i.createSFNT().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{let t=new na(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new Ta(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};os([J(`uint32`)],ss.prototype,`scalerType`),os([J(`uint16`)],ss.prototype,`numTables`),os([J(`uint16`)],ss.prototype,`searchRange`),os([J(`uint16`)],ss.prototype,`entrySelector`),os([J(`uint16`)],ss.prototype,`rangeShift`);var cs=class extends ss{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},ls=Object.defineProperty,us=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ls(t,n,i),i},ds=class extends Yi{constructor(e,t){super(e,t,20)}};us([J({type:`char`,size:4})],ds.prototype,`tag`),us([J(`uint32`)],ds.prototype,`offset`),us([J(`uint32`)],ds.prototype,`compLength`),us([J(`uint32`)],ds.prototype,`origLength`),us([J(`uint32`)],ds.prototype,`origChecksum`);var fs=Object.defineProperty,ps=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&fs(t,n,i),i},ms=class e extends Xi{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return ss.is(this.flavor)?`TrueType`:cs.is(this.flavor)?`OpenType`:`Open`}_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(Vi(e).getUint32(0))}static checkSum(e){let t=Vi(e),n=t.byteLength,r=Math.floor(n/4),i=0,a=0;for(;a<r;)i+=t.getUint32(4*a++,!1);let o=n-r*4;if(o){let e=r*4;for(;o>0;)i+=t.getUint8(e)<<o*8,e++,o--}return i%4294967296}static from(t,n=new ArrayBuffer(0)){let r=e=>e+3&-4,i=[];t.tableViews.forEach((e,t)=>{let n=Vi(Fi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)));i.push({tag:t,view:n.byteLength<e.byteLength?n:e,rawView:e})});let a=i.length,o=i.reduce((e,t)=>e+r(t.view.byteLength),0),s=new e(new ArrayBuffer(44+20*a+o+n.byteLength));s.signature=2001684038,s.flavor=65536,s.length=s.view.byteLength,s.numTables=a,s.totalSFNTSize=12+16*a+i.reduce((e,t)=>e+r(t.rawView.byteLength),0);let c=44+a*20,l=0,u=s.getDirectories();return i.forEach(t=>{let n=u[l++];n.tag=t.tag,n.offset=c,n.compLength=t.view.byteLength,n.origChecksum=e.checkSum(t.rawView),n.origLength=t.rawView.byteLength,s.view.writeBytes(t.view,c),c+=r(n.compLength)}),s.view.writeBytes(n),s}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{let t=new ds(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new Ta(this.getDirectories().reduce((e,t)=>{let n=t.tag,r=this.view.byteOffset+t.offset,i=t.compLength,a=t.origLength,o=r+i;return e[n]=i>=a?new DataView(this.view.buffer,r,i):new DataView(Ii(new Uint8Array(this.view.buffer.slice(r,o))).buffer),e},{}))}};ps([J(`uint32`)],ms.prototype,`signature`),ps([J(`uint32`)],ms.prototype,`flavor`),ps([J(`uint32`)],ms.prototype,`length`),ps([J(`uint16`)],ms.prototype,`numTables`),ps([J(`uint16`)],ms.prototype,`reserved`),ps([J(`uint32`)],ms.prototype,`totalSFNTSize`),ps([J(`uint16`)],ms.prototype,`majorVersion`),ps([J(`uint16`)],ms.prototype,`minorVersion`),ps([J(`uint32`)],ms.prototype,`metaOffset`),ps([J(`uint32`)],ms.prototype,`metaLength`),ps([J(`uint32`)],ms.prototype,`metaOrigLength`),ps([J(`uint32`)],ms.prototype,`privOffset`),ps([J(`uint32`)],ms.prototype,`privLength`);var hs=ms;function gs(e,t=!0){if(ss.is(e))return new ss(e);if(cs.is(e))return new cs(e);if(hs.is(e))return new hs(e);if(t)throw Error(`Failed to parseFont`)}function _s(e,t=!0){let n=gs(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var vs=new class e{static defaultRequestInit={cache:`force-cache`};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(t,n){let r=new AbortController;return{url:t,when:fetch(t,{...e.defaultRequestInit,...n,signal:r.signal}).then(e=>e.arrayBuffer()),cancel:()=>r.abort()}}async injectFontFace(e,t){if(!document.fonts.check(`14px "${e}"`)){let n=new FontFace(e,t);await n.load(),document.fonts.add(n)}}injectStyleTag(e,t){let n=CSS.escape(e);if(!document.querySelector(`style[data-family="${n}"]`)){let n=document.createElement(`style`);n.type=`text/css`,n.dataset.family=e,n.appendChild(document.createTextNode(`@font-face {
30
+ </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),`image/svg+xml`).documentElement}toCanvas(e={}){let{pixelRatio:t=2,...n}=e,{left:r,top:i,width:a,height:o}=this.getBoundingBox(),s=document.createElement(`canvas`);s.width=a*t,s.height=o*t,s.style.width=`${a}px`,s.style.height=`${o}px`;let c=s.getContext(`2d`);return c&&(c.scale(t,t),c.translate(-r,-i),this.paths.forEach(e=>{e.drawTo(c,n)})),s}};function Pr(){let e=new Map;async function t(t){if(!e.has(t)){e.set(t,``);try{e.set(t,await fetch(t).then(e=>e.text()))}catch(n){console.warn(n),e.delete(t)}}}function n(e){return e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`blob://`)}return{loaded:e,needsLoad:n,load:t}}function Fr(e){let t=new Map;function n(n){let r=t.get(n);if(!r){let i=e.needsLoad(n)?e.loaded.get(n):n;if(i){let e=Wn(i);r={dom:e,pathSet:lr(e)},t.set(n,r)}else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.setAttribute(`viewBox`,`0 0 0 0`),r={dom:e,pathSet:new Nr}}}return r}return{parsed:t,parse:n}}function Ir(e,t){let{transform:n,transformOrigin:r}=t,{fontSize:i,lineBox:a}=e,{left:o,top:s,width:c,height:l}=a,{x:u,y:d}=Lr(r??`center`,o,s,c,l),f=new Mn;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Lr(e,t,n,r,i){let a={left:0,center:.5,right:1},o={top:0,center:.5,bottom:1},s=e.trim().split(/\s+/),c=s[0]??`center`,l=s[1]??`center`,u;u=c in a?t+a[c]*r:c.endsWith(`%`)?t+Number.parseFloat(c)/100*r:t+Number.parseFloat(c);let d;return d=l in o?n+o[l]*i:l.endsWith(`%`)?n+Number.parseFloat(l)/100*i:n+Number.parseFloat(l),{x:u,y:d}}function Rr(e,t){return typeof e==`number`?e:e.endsWith(`%`)?(e=e.substring(0,e.length-1),Math.ceil(Number(e)/100*t.total)):e.endsWith(`rem`)?(e=e.substring(0,e.length-3),Number(e)*t.fontSize):e.endsWith(`em`)?(e=e.substring(0,e.length-2),Number(e)*t.fontSize):Number(e)}function zr(e){return O(e)?{}:e}function Br(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vr(e[n],t[n]))}function Vr(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Br(e,t):e===t:!1}var Hr=class{text;context;pixelRatio=window?.devicePixelRatio||1;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,{left:n,top:r,width:i,height:a}=this.text.boundingBox,o=t.canvas;o.dataset.viewBox=String(`${n} ${r} ${i} ${a}`),o.dataset.pixelRatio=String(e);let s=i,c=a;o.width=Math.max(1,Math.ceil(s*e)),o.height=Math.max(1,Math.ceil(c*e)),o.style.width=`${s}px`,o.style.height=`${c}px`,t.clearRect(0,0,o.width,o.height),t.scale(e,e),t.translate(-n,-r)};_setupColors=()=>{this.uploadColor(this.text.glyphBox,{style:this.text.computedStyle,fill:this.text.computedFill,outline:this.text.computedOutline}),this.text.paragraphs.forEach(e=>{this.uploadColor(e.lineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline}),e.fragments.forEach(e=>{this.uploadColor(e.inlineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline})})})};setup=()=>(this._setupView(),this._setupColors(),this);_parseColor=(e,t)=>{if(typeof e==`string`&&ve(e)&&(e=ye(e)[0]),typeof e==`object`&&`type`in e)switch(e.type){case`linear-gradient`:{let{left:n,top:r,width:i,height:a}=t,{angle:o=0,stops:s}=e,c=n+i/2,l=r+a/2,u=(o+90)*Math.PI/180,d=Math.sin(u),f=-Math.cos(u),p=Math.abs(i*Math.sin(u))+Math.abs(a*Math.cos(u)),m=c-p/2*d,h=l-p/2*f,g=c+p/2*d,_=l+p/2*f,v=this.context.createLinearGradient(m,h,g,_);for(let e of s)v.addColorStop(e.offset,e.color);return v}case`radial-gradient`:break}return e};_uploadedStyles=[`color`,`backgroundColor`,`textStrokeColor`];uploadColor=(e,t)=>{let{style:n,fill:r,outline:i}=t;n&&this._uploadedStyles.forEach(t=>{n[t]=this._parseColor(n[t],e)}),r?.enabled&&r.linearGradient&&(r._linearGradient=this._parseColor({type:`linear-gradient`,...r.linearGradient},e)),i?.enabled&&i.linearGradient&&(i._linearGradient=this._parseColor({type:`linear-gradient`,...i.linearGradient},e))};_mergePathStyle(e,t){let n=e.style,r=t.stroke??n.stroke,i=t.strokeWidth?t.strokeWidth:n.strokeWidth;return{...A(n),...A(t),stroke:i===void 0||i>0?r:void 0,strokeLinecap:t.strokeLinecap??n.strokeLinecap??`round`,strokeLinejoin:t.strokeLinejoin??n.strokeLinejoin??`round`,strokeWidth:i}}drawPath=(e,t={})=>{let{clipRect:n,...r}=t,i=this.context;i.save(),i.beginPath(),n&&(i.rect(n.left,n.top,n.width,n.height),i.clip(),i.beginPath()),e.drawTo(i,this._mergePathStyle(e,r)),i.restore()};effectToPathStyle(e){let t=this.text.computedStyle.fontSize,n={};return e.fill?.enabled&&(n={...n,fill:e.fill.color}),e.outline?.enabled&&(n={...n,stroke:e.outline.color,strokeWidth:(e.outline.width??0)*t}),e.shadow?.enabled&&(n={...n,shadowOffsetX:(e.shadow.offsetX??0)*t,shadowOffsetY:(e.shadow.offsetY??0)*t,shadowBlur:(e.shadow.blur??0)*t,shadowColor:e.shadow.color}),n}transformEffect(e){let{a:t,b:n,c:r,d:i,tx:a,ty:o}=Ir(this.text,e);this.context.transform(t,n,r,i,a,o)}_shadowCanvas;_shadowCtx;drawWithShadow=(e,t)=>{let n=this.context,r=n.canvas;this._shadowCanvas||(this._shadowCanvas=document.createElement(`canvas`),this._shadowCtx=this._shadowCanvas.getContext(`2d`));let i=this._shadowCanvas,a=this._shadowCtx;if(!a){t();return}i.width<r.width&&(i.width=r.width),i.height<r.height&&(i.height=r.height),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.width,r.height);let o=n.getTransform();a.setTransform(o.a,o.b,o.c,o.d,o.e,o.f);let s=this.context;this.context=a;try{t()}finally{this.context=s}let c=this.text.computedStyle.fontSize,l=this.pixelRatio;n.save(),n.setTransform(1,0,0,1,0,0),n.shadowOffsetX=(e.offsetX??0)*c*l,n.shadowOffsetY=(e.offsetY??0)*c*l,n.shadowBlur=(e.blur??0)*c*l,n.shadowColor=e.color,n.drawImage(i,0,0,r.width,r.height,0,0,r.width,r.height),n.restore()};drawCharacter=(e,t={})=>{let n=this.context,{computedStyle:r,path:i,glyphBox:a,isVertical:o,content:s,inlineBox:c,baseline:l,computedFill:u,computedOutline:d}=e,f=u?.enabled?u:void 0,p=d?.enabled?d:void 0,m=this.effectToPathStyle(t),h={strokeLinecap:p?.lineCap,strokeLinejoin:p?.lineJoin,...r,...m,fill:m.fill??f?._linearGradient??f?.color??r.color,strokeWidth:m.strokeWidth??p?.width??r.textStrokeWidth,stroke:m.stroke??p?._linearGradient??p?.color??r.textStrokeColor};a?this.drawPath(i,h):(n.save(),n.beginPath(),Wt(n,this._mergePathStyle(i,h)),n.font=`${r.fontSize}px ${r.fontFamily||this.text.defaultFamily}`,o?(n.textBaseline=`middle`,n.fillText(s,c.left,c.top+c.height/2)):(n.textBaseline=`alphabetic`,n.fillText(s,c.left,c.top+l)),n.restore())}},Ur={},Wr=(function(e,t,n,r,i){var a=new Worker(Ur[t]||(Ur[t]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}),Gr=Uint8Array,Kr=Uint16Array,qr=Int32Array,Jr=new Gr([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]),Yr=new Gr([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]),Xr=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zr=function(e,t){for(var n=new Kr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new qr(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Qr=Zr(Jr,2),$r=Qr.b,ei=Qr.r;$r[28]=258,ei[258]=28;for(var ti=Zr(Yr,0),ni=ti.b,ri=ti.r,ii=new Kr(32768),q=0;q<32768;++q){var ai=(q&43690)>>1|(q&21845)<<1;ai=(ai&52428)>>2|(ai&13107)<<2,ai=(ai&61680)>>4|(ai&3855)<<4,ii[q]=((ai&65280)>>8|(ai&255)<<8)>>1}for(var oi=(function(e,t,n){for(var r=e.length,i=0,a=new Kr(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Kr(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Kr(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ii[d]>>c]=l}else for(s=new Kr(r),i=0;i<r;++i)e[i]&&(s[i]=ii[o[e[i]-1]++]>>15-e[i]);return s}),si=new Gr(288),q=0;q<144;++q)si[q]=8;for(var q=144;q<256;++q)si[q]=9;for(var q=256;q<280;++q)si[q]=7;for(var q=280;q<288;++q)si[q]=8;for(var ci=new Gr(32),q=0;q<32;++q)ci[q]=5;var li=oi(si,9,0),ui=oi(si,9,1),di=oi(ci,5,0),fi=oi(ci,5,1),pi=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},mi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},hi=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},gi=function(e){return(e+7)/8|0},_i=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gr(e.subarray(t,n))},vi=[`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`],yi=function(e,t,n){var r=Error(t||vi[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,yi),!n)throw r;return r},bi=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Gr(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Gr(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Gr(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=mi(e,d,1);var v=mi(e,d+1,3);if(d+=3,!v){var y=gi(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&yi(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=ui,m=fi,h=9,g=5;else if(v==2){var S=mi(e,d,31)+257,C=mi(e,d+10,15)+4,w=S+mi(e,d+5,31)+1;d+=14;for(var T=new Gr(w),E=new Gr(19),D=0;D<C;++D)E[Xr[D]]=mi(e,d+D*3,7);d+=C*3;for(var O=pi(E),k=(1<<O)-1,A=oi(E,O,1),D=0;D<w;){var j=A[mi(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+mi(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+mi(e,d,7),d+=3):y==18&&(N=11+mi(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=pi(P),g=pi(F),p=oi(P,h,1),m=oi(F,g,1)}else yi(1);if(d>_){c&&yi(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[hi(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&yi(0);break}if(M||yi(2),z<256)n[f++]=z;else if(z==256){R=d,p=null;break}else{var B=z-254;if(z>264){var D=z-257,V=Jr[D];B=mi(e,d,(1<<V)-1)+$r[D],d+=V}var ee=m[hi(e,d)&L],te=ee>>4;ee||yi(3),d+=ee&15;var F=ni[te];if(te>3){var V=Yr[te];F+=hi(e,d)&(1<<V)-1,d+=V}if(d>_){c&&yi(0);break}s&&l(f+131072);var ne=f+B;if(f<F){var re=a-F,ie=Math.min(F,ne);for(re+f<0&&yi(3);f<ie;++f)n[f]=r[re+f]}for(;f<ne;++f)n[f]=n[f-F]}}t.l=p,t.p=R,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?_i(n,0,f):n.subarray(0,f)},xi=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Si=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Ci=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Ai,l:0};if(i==1){var o=new Gr(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Kr(f+1),m=wi(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new Gr(p),l:m}},wi=function(e,t,n){return e.s==-1?Math.max(wi(e.l,t,n+1),wi(e.r,t,n+1)):t[e.s]=n},Ti=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kr(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Ei=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Di=function(e,t,n){var r=n.length,i=gi(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Oi=function(e,t,n,r,i,a,o,s,c,l,u){xi(t,u++,n),++i[256];for(var d=Ci(i,15),f=d.t,p=d.l,m=Ci(a,15),h=m.t,g=m.l,_=Ti(f),v=_.c,y=_.n,b=Ti(h),x=b.c,S=b.n,C=new Kr(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Ci(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Xr[O-1]];--O);var k=l+5<<3,A=Ei(i,si)+Ei(a,ci)+o,j=Ei(i,f)+Ei(a,h)+o+14+3*O+Ei(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Di(t,u,e.subarray(c,c+l));var M,N,P,F;if(xi(t,u,1+(j<A)),u+=2,j<A){M=oi(f,p,0),N=f,P=oi(h,g,0),F=h;var I=oi(E,D,0);xi(t,u,y-257),xi(t,u+5,S-1),xi(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)xi(t,u+3*w,E[Xr[w]]);u+=3*O;for(var L=[v,x],R=0;R<2;++R)for(var z=L[R],w=0;w<z.length;++w){var B=z[w]&31;xi(t,u,I[B]),u+=E[B],B>15&&(xi(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=li,N=si,P=di,F=ci;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Si(t,u,M[B+257]),u+=N[B+257],B>7&&(xi(t,u,V>>23&31),u+=Jr[B]);var ee=V&31;Si(t,u,P[ee]),u+=F[ee],ee>3&&(Si(t,u,V>>5&8191),u+=Yr[ee])}else Si(t,u,M[V]),u+=N[V]}return Si(t,u,M[256]),u+N[256]},ki=new qr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ai=new Gr(0),ji=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Gr(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=ki[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Kr(32768),g=a.h||new Kr(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new qr(25e3),x=new Kr(288),S=new Kr(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=Oi(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,L=A-j&32767;if(M>2&&k==y(T-L))for(var R=Math.min(f,M)-1,z=Math.min(32767,T),B=Math.min(258,M);L<=z&&--I&&A!=j;){if(e[T+P]==e[T+P-L]){for(var V=0;V<B&&e[T+V]==e[T+V-L];++V);if(V>P){if(P=V,F=L,V>R)break;for(var ee=Math.min(L,V-2),te=0,N=0;N<ee;++N){var ne=T-L+N&32767,re=ne-h[ne]&32767;re>te&&(te=re,j=ne)}}}A=j,j=h[A],L+=A-j&32767}if(F){b[E++]=268435456|ei[P]<<18|ri[F];var ie=ei[P]&31,ae=ri[F]&31;w+=Jr[ie]+Yr[ae],++x[257+ie],++S[ae],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Oi(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var oe=T+65535;oe>=o&&(c[u/8|0]=l,oe=o),u=Di(c,u+1,e.subarray(T,oe))}a.i=o}return _i(s,0,r+gi(u)+i)},Mi=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Ni=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Gr(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ji(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Pi=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Fi=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype)if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString();else t+=l}else n[c]=s}return t},Ii=[],Li=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},Ri=function(e,t,n,r){if(!Ii[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Fi(e[s],i,a);Ii[n]={c:Fi(e[o],i,a),e:a}}var c=Pi({},Ii[n].e);return Wr(Ii[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,Li(c),r)},zi=function(){return[Gr,Kr,qr,Jr,Yr,Xr,$r,ni,ui,fi,ii,vi,oi,pi,mi,hi,gi,_i,yi,bi,Xi,Ui,Wi]},Bi=function(){return[Gr,Kr,qr,Jr,Yr,Xr,ei,ri,li,si,di,ci,ii,ki,Ai,oi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,gi,_i,ji,Ni,Yi,Ui]},Vi=function(){return[qi,Ki,Mi]},Hi=function(){return[Ji]},Ui=function(e){return postMessage(e,[e.buffer])},Wi=function(e){return e&&{out:e.size&&new Gr(e.size),dictionary:e.dictionary}},Gi=function(e,t,n,r,i,a){var o=Ri(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ki=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},qi=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Mi();i.p(t.dictionary),Ki(e,2,i.d())}},Ji=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&yi(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&yi(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Yi(e,t){return Ni(e,t||{},0,0)}function Xi(e,t){return bi(e,{i:2},t&&t.out,t&&t.dictionary)}function Zi(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&yi(7),Gi(e,t,[Bi,Vi,function(){return[Qi]}],function(e){return Ui(Qi(e.data[0],e.data[1]))},4,n)}function Qi(e,t){t||={};var n=Mi();n.p(e);var r=Ni(e,t,t.dictionary?6:2,4);return qi(r,t),Ki(r,r.length-4,n.d()),r}function $i(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&yi(7),Gi(e,t,[zi,Hi,function(){return[ea]}],function(e){return Ui(ea(e.data[0],Wi(e.data[1])))},5,n)}function ea(e,t){return bi(e.subarray(Ji(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var ta=typeof TextDecoder<`u`&&new TextDecoder;try{ta.decode(Ai,{stream:!0})}catch{}var na=`modern-font`;function ra(e,t){if(!e)throw Error(`[${na}] ${t}`)}function ia(e){if(`buffer`in e){let t=e.buffer;return e.byteOffset>0||e.byteLength<e.buffer.byteLength?t.slice(e.byteOffset,e.byteOffset+e.byteLength):t}else return e}function aa(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function oa(e){let t=``;for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),i!==0&&(t+=String.fromCharCode(i));return t}function sa(e){e=oa(e);let t=[];for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),t.push(i>>8),t.push(i&255);return t}function ca(e){return new TextDecoder().decode(Uint8Array.from(e))}function la(e){let t=``;for(let n=0,r=e.length;n<r;n+=2)t+=String.fromCharCode((e[n]<<8)+e[n+1]);return t}var ua={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},da=class extends DataView{constructor(e,t,n,r){super(ia(e),t,n),this.littleEndian=r}cursor=0;readInt8=e=>this.read(`int8`,e);readInt16=(e,t)=>this.read(`int16`,e,t);readInt32=(e,t)=>this.read(`int32`,e,t);readUint8=e=>this.read(`uint8`,e);readUint16=(e,t)=>this.read(`uint16`,e,t);readUint32=(e,t)=>this.read(`uint32`,e,t);readFloat32=(e,t)=>this.read(`float32`,e,t);readFloat64=(e,t)=>this.read(`float64`,e,t);writeInt8=(e,t)=>this.write(`int8`,e,t);writeInt16=(e,t,n)=>this.write(`int16`,e,t,n);writeInt32=(e,t,n)=>this.write(`int32`,e,t,n);writeUint8=(e,t)=>this.write(`uint8`,e,t);writeUint16=(e,t,n)=>this.write(`uint16`,e,t,n);writeUint32=(e,t,n)=>this.write(`uint32`,e,t,n);writeFloat32=(e,t,n)=>this.write(`float32`,e,t,n);writeFloat64=(e,t,n)=>this.write(`float64`,e,t,n);readColumn(e){if(e.size){let t=Array.from({length:e.size},(t,n)=>this.read(e.type,e.offset+n));switch(e.type){case`char`:return t.join(``);default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(n,r)=>{this.write(e.type,t[r],e.offset+r)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,n=this.littleEndian){let r;switch(e){case`int8`:r=this.getInt8(t);break;case`int16`:r=this.getInt16(t,n);break;case`int32`:r=this.getInt32(t,n);break;case`uint8`:r=this.getUint8(t);break;case`uint16`:r=this.getUint16(t,n);break;case`uint32`:r=this.getUint32(t,n);break;case`float32`:r=this.getFloat32(t,n);break;case`float64`:r=this.getFloat64(t,n);break;case`fixed`:r=this.readFixed(t,n);break;case`longDateTime`:r=this.readLongDateTime(t,n);break;case`char`:r=this.readChar(t);break}return this.cursor+=ua[e],r}readUint24(e=this.cursor){let[t,n,r]=this.readBytes(e,3);return(t<<16)+(n<<8)+r}readBytes(e,t){t??(t=e,e=this.cursor);let n=[];for(let r=0;r<t;++r)n.push(this.getUint8(e+r));return this.cursor=e+t,n}readString(e,t){let n=this.readBytes(e,t),r=``;for(let e=0,t=n.length;e<t;e++)r+=String.fromCharCode(n[e]);return r}readFixed(e,t){let n=this.readInt32(e,t)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(e=this.cursor,t){let n=this.readUint32(e+4,t),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(e){return this.readString(e,1)}write(e,t,n=this.cursor,r=this.littleEndian){switch(e){case`int8`:this.setInt8(n,t);break;case`int16`:this.setInt16(n,t,r);break;case`int32`:this.setInt32(n,t,r);break;case`uint8`:this.setUint8(n,t);break;case`uint16`:this.setUint16(n,t,r);break;case`uint32`:this.setUint32(n,t,r);break;case`float32`:this.setFloat32(n,t,r);break;case`float64`:this.setFloat64(n,t,r);break;case`char`:this.writeChar(t,n);break;case`fixed`:this.writeFixed(t,n);break;case`longDateTime`:this.writeLongDateTime(t,n);break}return this.cursor+=ua[e],this}writeString(e=``,t=this.cursor){let n=e.replace(/[^\x00-\xFF]/g,`11`).length;this.seek(t);for(let t=0,n=e.length,r;t<n;++t)r=e.charCodeAt(t)||0,r>127?this.writeUint16(r):this.writeUint8(r);return this.cursor+=n,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){let n=-20775456e5;e=e===void 0?n:typeof e.getTime==`function`?e.getTime():/^\d+$/.test(e)?+e:Date.parse(e);let r=Math.round((e-n)/1e3);return this.writeUint32(0,t),this.writeUint32(r,t+4),this}writeBytes(e,t=this.cursor){let n;if(Array.isArray(e)){n=e.length;for(let r=0;r<n;++r)this.setUint8(t+r,e[r])}else{let r=aa(e);n=r.byteLength;for(let e=0;e<n;++e)this.setUint8(t+e,r.getUint8(e))}return this.cursor=t+n,this}seek(e){return this.cursor=e,this}},fa=new WeakMap;function J(e){let t=typeof e==`object`?e:{type:e},{size:n=1,type:r}=t;return(e,i)=>{if(typeof i!=`string`)return;let a=fa.get(e);a||(a={columns:[],byteLength:0},fa.set(e,a));let o={...t,name:i,byteLength:n*ua[r],offset:t.offset??a.columns.reduce((e,t)=>e+t.byteLength,0)};a.columns.push(o),a.byteLength=a.columns.reduce((e,t)=>e+ua[t.type]*(t.size??1),0),Object.defineProperty(e.constructor.prototype,i,{get(){return this.view.readColumn(o)},set(e){this.view.writeColumn(o,e)},configurable:!0,enumerable:!0})}}var pa=class{view;constructor(e,t,n,r){this.view=new da(e,t,n,r)}},ma=class extends pa{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)}},ha=Object.defineProperty,ga=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ha(t,n,i),i},_a=class e extends ma{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=sa(r.fontFamily||``),a=i.length,o=sa(r.fontSubFamily||``),s=o.length,c=sa(r.version||``),l=c.length,u=sa(r.fullName||``),d=u.length,f=86+a+4+s+4+l+4+d+2+t.view.byteLength,p=new e(new ArrayBuffer(f),0,f,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=t.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=n.head.checkSumAdjustment;let m=n.os2;return m&&(p.FontPANOSE=m.fontPANOSE,p.Italic=m.fsSelection,p.Weight=m.usWeightClass,p.fsType=m.fsType,p.UnicodeRange=m.ulUnicodeRange,p.CodePageRange=m.version>0?m.ulCodePageRange:[]),p.view.seek(82),p.view.writeUint16(a),p.view.writeBytes(i),p.view.writeUint16(0),p.view.writeUint16(s),p.view.writeBytes(o),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(t.view),p}};ga([J(`uint32`)],_a.prototype,`EOTSize`),ga([J(`uint32`)],_a.prototype,`FontDataSize`),ga([J(`uint32`)],_a.prototype,`Version`),ga([J(`uint32`)],_a.prototype,`Flags`),ga([J({type:`uint8`,size:10})],_a.prototype,`FontPANOSE`),ga([J(`uint8`)],_a.prototype,`Charset`),ga([J(`uint8`)],_a.prototype,`Italic`),ga([J(`uint32`)],_a.prototype,`Weight`),ga([J(`uint16`)],_a.prototype,`fsType`),ga([J(`uint16`)],_a.prototype,`MagicNumber`),ga([J({type:`uint32`,size:4})],_a.prototype,`UnicodeRange`),ga([J({type:`uint8`,size:8})],_a.prototype,`CodePageRange`),ga([J(`uint32`)],_a.prototype,`CheckSumAdjustment`),ga([J({type:`uint8`,size:16})],_a.prototype,`Reserved`),ga([J(`uint16`)],_a.prototype,`Padding1`);var va=Object.defineProperty,ya=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&va(t,n,i),i},ba=class extends pa{constructor(e,t){super(e,t,16)}};ya([J({type:`char`,size:4})],ba.prototype,`tag`),ya([J(`uint32`)],ba.prototype,`checkSum`),ya([J(`uint32`)],ba.prototype,`offset`),ya([J(`uint32`)],ba.prototype,`length`);var xa=`................................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`.split(`.`),Sa=`................................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`.split(`.`),Ca=class{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){let 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 Error(`The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.`);this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},i){let a=1/(i?.unitsPerEm??1e3)*n,{xScale:o=a,yScale:s=a}=r,c=this.pathCommands,l=[];for(let n=0,r=c.length;n<r;n+=1){let r=c[n];r.type===`M`?l.push({type:`M`,x:e+r.x*o,y:t+-r.y*s}):r.type===`L`?l.push({type:`L`,x:e+r.x*o,y:t+-r.y*s}):r.type===`Q`?l.push({type:`Q`,x1:e+r.x1*o,y1:t+-r.y1*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`C`?l.push({type:`C`,x1:e+r.x1*o,y1:t+-r.y1*s,x2:e+r.x2*o,y2:t+-r.y2*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`Z`&&l.push({type:`Z`})}return l}getPathData(e=0,t=0,n=72,r={},i,a=2){return wa(this.getPathCommands(e,t,n,r,i),a)}};function wa(e,t=2){let n=e=>String(Number(e.toFixed(t))),r=``;for(let t=0;t<e.length;t++){let i=e[t];switch(i.type){case`M`:r+=`M${n(i.x)} ${n(i.y)}`;break;case`L`:r+=`L${n(i.x)} ${n(i.y)}`;break;case`Q`:r+=`Q${n(i.x1)} ${n(i.y1)} ${n(i.x)} ${n(i.y)}`;break;case`C`:r+=`C${n(i.x1)} ${n(i.y1)} ${n(i.x2)} ${n(i.y2)} ${n(i.x)} ${n(i.y)}`;break;case`Z`:r+=`Z`;break}}return r}var Ta=class extends Ca{parse(e,t,n){let r=this,{nominalWidthX:i,defaultWidthX:a,gsubrsBias:o,subrsBias:s}=e,c=e.topDict.paintType,l=this.index,u,d,f,p,m=[],h=[],g=0,_=!1,v=!1,y=a,b=0,x=0;function S(e,t){m.push({type:`L`,x:e,y:t})}function C(e,t,n,r,i,a){m.push({type:`C`,x1:e,y1:t,x2:n,y2:r,x:i,y:a})}function w(e,t){v&&c!==2&&T(),v=!0,m.push({type:`M`,x:e,y:t})}function T(){m.push({type:`Z`})}function E(e){m.push(...e)}function D(){h.length%2!=0&&!_&&(y=h.shift()+i),g+=h.length>>1,h.length=0,_=!0}function O(t){let a,m,k,A,j,M,N,P,F,I,L,R,z=0;for(;z<t.length;){let B=t[z++];switch(B){case 1:D();break;case 3:D();break;case 4:h.length>1&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),w(b,x);break;case 5:for(;h.length>0;)b+=h.shift(),x+=h.shift(),S(b,x);break;case 6:for(;h.length>0&&(b+=h.shift(),S(b,x),h.length!==0);)x+=h.shift(),S(b,x);break;case 7:for(;h.length>0&&(x+=h.shift(),S(b,x),h.length!==0);)b+=h.shift(),S(b,x);break;case 8:for(;h.length>0;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 10:j=h.pop()+s,M=e.subrs[j],M&&O(M);break;case 11:return;case 12:switch(B=t[z],z+=1,B){case 35:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),x=R+h.shift(),h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 34:u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=x,b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 36:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 37:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),Math.abs(L-b)>Math.abs(R-x)?b=L+h.shift():x=R+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;default:console.warn(`Glyph ${l}: unknown operator ${1200+B}`),h.length=0}break;case 14:if(h.length>=4){let t=xa[h.pop()],i=xa[h.pop()],a=h.pop(),o=h.pop();if(t&&i){r.isComposite=!0,r.components=[];let s=e.charset.indexOf(t),c=e.charset.indexOf(i);r.components.push({glyphIndex:c,dx:0,dy:0}),r.components.push({glyphIndex:s,dx:o,dy:a}),E(n.get(c).pathCommands);let l=JSON.parse(JSON.stringify(n.get(s).pathCommands));for(let e=0;e<l.length;e+=1){let t=l[e];t.type!==`Z`&&(t.x+=o,t.y+=a),(t.type===`Q`||t.type===`C`)&&(t.x1+=o,t.y1+=a),t.type===`C`&&(t.x2+=o,t.y2+=a)}E(l)}}else h.length>0&&!_&&(y=h.shift()+i,_=!0);v&&c!==2&&(T(),v=!1);break;case 18:D();break;case 19:case 20:D(),z+=g+7>>3;break;case 21:h.length>2&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),b+=h.pop(),w(b,x);break;case 22:h.length>1&&!_&&(y=h.shift()+i,_=!0),b+=h.pop(),w(b,x);break;case 23:D();break;case 24:for(;h.length>2;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);b+=h.shift(),x+=h.shift(),S(b,x);break;case 25:for(;h.length>6;)b+=h.shift(),x+=h.shift(),S(b,x);u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 26:for(h.length%2&&(b+=h.shift());h.length>0;)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f,x=p+h.shift(),C(u,d,f,p,b,x);break;case 27:for(h.length%2&&(x+=h.shift());h.length>0;)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p,C(u,d,f,p,b,x);break;case 28:a=t[z],m=t[z+1],h.push((a<<24|m<<16)>>16),z+=2;break;case 29:j=h.pop()+o,M=e.gsubrs[j],M&&O(M);break;case 30:for(;h.length>0&&(u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;case 31:for(;h.length>0&&(u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;default:B<32?console.warn(`Glyph ${l}: unknown operator ${B}`):B<247?h.push(B-139):B<251?(a=t[z],z+=1,h.push((B-247)*256+a+108)):B<255?(a=t[z],z+=1,h.push(-(B-251)*256-a-108)):(a=t[z],m=t[z+1],k=t[z+2],A=t[z+3],z+=4,h.push((a<<24|m<<16|k<<8|A)/65536))}}}O(t),this.pathCommands=m,_&&(this.advanceWidth=y)}},Ea=class{constructor(e){this._sfnt=e}_items=[];get(e){let t=this._items[e],n;if(t)n=t;else{n=this._get(e);let t=this._sfnt.hmtx.metrics[e];t&&(n.advanceWidth=n.advanceWidth||t.advanceWidth,n.leftSideBearing=n.leftSideBearing||t.leftSideBearing);let r=this._sfnt.vmtx?.metrics[e];r&&(n.advanceHeight=n.advanceHeight||r.advanceHeight,n.topSideBearing=n.topSideBearing||r.topSideBearing);let i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);if(i&&(n.unicode??=i[0],n.unicodes??=i),n.name==null){let t=this._sfnt.post?.getGlyphName(e);t&&(n.name=t)}this._items[e]=n}return n}},Da=class extends Ea{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Ta({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},Oa=Object.defineProperty,ka=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Oa(t,n,i),i},Aa=class extends pa{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let e=this.view,t=this.count,n=this.offsetSize;this.objectOffset=(t+1)*n+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){let e=this.view,t=this.count,n=this.offsetSize;e.seek(3);let r=[];for(let e=0,i=t+1;e<i;e++){let e=this.view,t=0;for(let r=0;r<n;r++)t<<=8,t+=e.readUint8();r.push(t)}return r}readObjects(){let e=[];for(let t=0,n=this.count;t<n;t++)e.push(this.get(t));return e}get(e){let t=this.offsets,n=this.objectOffset,r=n+t[e],i=n+t[e+1]-r;return this._isString?this.view.readString(r,i):this.view.readBytes(r,i)}};ka([J(`uint16`)],Aa.prototype,`count`),ka([J(`uint8`)],Aa.prototype,`offsetSize`);var ja=class extends Aa{_isString=!1},Ma=class extends Aa{_isString=!0},Na=`.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`.split(`,`),Pa=`.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`.split(`,`),Fa=`.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`.split(`,`),Ia=`.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`.split(`,`);function La(e,t){return t<=390?Na[t]:e[t-391]}function Y(e,t=`number`,n){return(r,i)=>{if(typeof i!=`string`)return;let a={type:t,operator:e,default:n};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(a)},set(e){this._setProp(a,e)},configurable:!0,enumerable:!0})}}var Ra=class extends pa{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){let e=this.view,t=``,n=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`];for(;;){let r=e.readUint8(),i=r>>4,a=r&15;if(i===15||(t+=n[i],a===15))break;t+=n[a]}return Number.parseFloat(t)}_readOperand(e){let t=this.view,n,r,i,a;if(e===28)return n=t.readUint8(),r=t.readUint8(),n<<8|r;if(e===29)return n=t.readUint8(),r=t.readUint8(),i=t.readUint8(),a=t.readUint8(),n<<24|r<<16|i<<8|a;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return n=t.readUint8(),(e-247)*256+n+108;if(e>=251&&e<=254)return n=t.readUint8(),-(e-251)*256-n-108;throw Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){let e=this.view;e.seek(0);let t=[],n=e.cursor+e.byteLength,r={};for(;e.cursor<n;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),r[n]=t,t=[]):t.push(this._readOperand(n))}return r}_getProp(e){let t=this.dict[e.operator];switch(e.type){case`number`:return t?t[0]:e.default??0;case`string`:return t?La(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},za=Object.defineProperty,Ba=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&za(t,n,i),i},Va=class extends Ra{};Ba([Y(19)],Va.prototype,`subrs`),Ba([Y(20)],Va.prototype,`defaultWidthX`),Ba([Y(21)],Va.prototype,`nominalWidthX`);var Ha=Object.defineProperty,X=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ha(t,n,i),i},Z=class extends Ra{};X([Y(0,`string`)],Z.prototype,`version`),X([Y(1,`string`)],Z.prototype,`notice`),X([Y(1200,`string`)],Z.prototype,`copyright`),X([Y(2,`string`)],Z.prototype,`fullName`),X([Y(3,`string`)],Z.prototype,`familyName`),X([Y(4,`string`)],Z.prototype,`weight`),X([Y(1201)],Z.prototype,`isFixedPitch`),X([Y(1202)],Z.prototype,`italicAngle`),X([Y(1203,`number`,-100)],Z.prototype,`underlinePosition`),X([Y(1204,`number`,50)],Z.prototype,`underlineThickness`),X([Y(1205)],Z.prototype,`paintType`),X([Y(1206,`number`,2)],Z.prototype,`charstringType`),X([Y(1207,`number[]`,[.001,0,0,.001,0,0])],Z.prototype,`fontMatrix`),X([Y(13)],Z.prototype,`uniqueId`),X([Y(5,`number[]`,[0,0,0,0])],Z.prototype,`fontBBox`),X([Y(1208)],Z.prototype,`strokeWidth`),X([Y(14)],Z.prototype,`xuid`),X([Y(15)],Z.prototype,`charset`),X([Y(16)],Z.prototype,`encoding`),X([Y(17)],Z.prototype,`charStrings`),X([Y(18,`number[]`,[0,0])],Z.prototype,`private`);function Ua(e,t=e){return n=>{Wa.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(Wa.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var Wa=class e{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;_viewLoaders=new Map;get tableTags(){return[...new Set([...this.tableViews.keys(),...this._viewLoaders.keys()])]}hasTable(e){return this.tableViews.has(e)||this._viewLoaders.has(e)}getTableView(e){let t=this.tableViews.get(e);if(!t){let n=this._viewLoaders.get(e);n&&(t=n(),this.tableViews.set(e,t),this._viewLoaders.delete(e))}return t}get hasGlyf(){return this.hasTable(`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}get defaultAdvanceHeight(){return this.ascender+Math.abs(this.descender)}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){let{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))}getSubstituteGlyphIndex(e,t){return this.gsub?.getSingleSubstitutions(t).get(e)??e}applyLigatures(e,t=`liga`){let n=this.gsub?.getLigatures(t);if(!n||!n.size)return e.slice();let r=[];for(let t=0;t<e.length;){let i=n.get(e[t]),a=!1;if(i)for(let n of i){let i=n.components.length,o=!0;for(let r=0;r<i;r++)if(e[t+1+r]!==n.components[r]){o=!1;break}if(o){r.push(n.ligatureGlyph),t+=i+1,a=!0;break}}a||(r.push(e[t]),t++)}return r}textToGlyphIndexes(e){let t=[];for(let n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){let t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,i=Array.from({length:r}),a=t.get(0);for(let e=0;e<r;e+=1)i[e]=t.get(n[e])||a;return i}getPathCommands(e,t,n,r,i){let a=[];return this.forEachGlyph(e,t,n,r,i,(e,t,n,r,i)=>{a.push(...e.getPathCommands(t,n,r,i,this))}),a}getPathData(e,t,n,r,i,a=2){return wa(this.getPathCommands(e,t,n,r,i),a)}getKerningValue(e,t){return(this.gpos?.getKerningValue(e,t)??0)||(this.kern?.getKerningValue(e,t)??0)}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}getAdvanceHeight(e,t=72,n={}){let r=1/this.unitsPerEm*t,i=this.defaultAdvanceHeight,a=this.textToGlyphs(e),o=0;for(let e=0;e<a.length;e+=1)o+=(a[e].advanceHeight||i)*r,n.letterSpacing?o+=n.letterSpacing*t:n.tracking&&(o+=n.tracking/1e3*t);return o}forEachGlyph(e,t=0,n=0,r=72,i={},a){let o=1/this.unitsPerEm*r,s=this.textToGlyphs(e);for(let e=0;e<s.length;e+=1){let c=s[e];a.call(this,c,t,n,r,i),c.advanceWidth&&(t+=c.advanceWidth*o),i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t}constructor(e,t){e&&(e instanceof Map?e:new Map(Object.entries(e))).forEach((e,t)=>this.tableViews.set(t,e)),t?.forEach((e,t)=>this._viewLoaders.set(t,e))}clone(){let t=new Map;return this.tableTags.forEach(e=>{let n=this.getTableView(e);t.set(e,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))}),new e(t)}delete(t){let n=e.tableDefinitions.get(t);return n?(this.tableViews.delete(t),this._viewLoaders.delete(t),this.tables.delete(n.prop),this):this}set(t,n){let r=e.tableDefinitions.get(t);return r&&this.tables.set(r.prop,n),this.tableViews.set(t,n.view),this._viewLoaders.delete(t),this}get(t){let n=e.tableDefinitions.get(t);if(!n)return;let r=this.tables.get(n.prop);if(!r){let e=n.class;if(e){let i=this.getTableView(t);if(!i)return;r=new e(i.buffer,i.byteOffset,i.byteLength).setSFNT(this),this.tables.set(n.prop,r)}}return r}},Ga=class extends pa{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},Ka=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,Ja=(e,t,n,r)=>{for(var i=r>1?void 0:r?qa(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ka(t,n,i),i},Ya=class extends Ga{_glyphs;get glyphs(){return this._glyphs??=new Da(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let{buffer:e,byteOffset:t}=this.view,n=t+4;this.nameIndex=new Ma(e,n),this.topDictIndex=new ja(e,this.nameIndex.endOffset),this.stringIndex=new Ma(e,this.topDictIndex.endOffset),this.globalSubrIndex=new ja(e,this.stringIndex.endOffset),this.topDict=new Z(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);let r=this.topDict.private[0],i=this.topDict.private[1];r&&(this.privateDict=new Va(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new ja(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new ja(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Pa:this.topDict.charset===1?this.charset=Fa:this.topDict.charset===2?this.charset=Ia:this.charset=this._readCharset(t+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=xa:this.topDict.encoding===1?this.encoding=Sa:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(e,t,n){let r=this.view;r.seek(e);let i,a,o;--t;let s=[`.notdef`],c=r.readUint8();if(c===0)for(i=0;i<t;i+=1)a=r.readUint16(),s.push(La(n,a));else if(c===1)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)s.push(La(n,a)),a+=1;else if(c===2)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)s.push(La(n,a)),a+=1;else throw Error(`Unknown charset format ${c}`);return s}_readEncoding(e){let t=this.view;t.seek(e);let n,r,i={},a=t.readUint8();if(a===0){let e=t.readUint8();for(n=0;n<e;n+=1)r=t.readUint8(),i[r]=n}else if(a===1){let e=t.readUint8();for(r=1,n=0;n<e;n+=1){let e=t.readUint8(),n=t.readUint8();for(let t=e;t<=e+n;t+=1)i[t]=r,r+=1}}else console.warn(`unknown encoding format:${a}`);return i}blankGlyphsExcept(e){let t=this.charStringsIndex.offsets,n=t.length-1,r=this.topDict.charStrings+this.charStringsIndex.objectOffset;for(let i=0;i<n;i++){if(e.has(i))continue;let n=r+t[i+1];for(let e=r+t[i];e<n;e++)this.view.setUint8(e,14)}return this}_calcSubroutineBias(e){let t;return t=e.length<1240?107:e.length<33900?1131:32768,t}};Ja([J(`uint8`)],Ya.prototype,`majorVersion`,2),Ja([J(`uint8`)],Ya.prototype,`minorVersion`,2),Ja([J(`uint8`)],Ya.prototype,`headerSize`,2),Ja([J(`uint8`)],Ya.prototype,`offsetSize`,2),Ya=Ja([Ua(`CFF `,`cff`)],Ya);var Xa=Object.defineProperty,Za=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Xa(t,n,i),i},Qa=class e extends pa{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(t){let n=new e;return n.format=0,n.length=n.view.byteLength,n.language=0,t.forEach((e,t)=>{t<256&&e<256&&n.view.writeUint8(e,6+t)}),n}getUnicodeToGlyphIndexMap(){let e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Za([J(`uint16`)],Qa.prototype,`format`),Za([J(`uint16`)],Qa.prototype,`length`),Za([J(`uint16`)],Qa.prototype,`language`),Za([J({type:`uint8`,size:256})],Qa.prototype,`glyphIndexArray`);var $a=Qa,eo=Object.defineProperty,to=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&eo(t,n,i),i},no=class extends pa{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(){let e=this.maxSubHeaderKey;return this.view.seek(518),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(){let e=518+this.maxSubHeaderKey*8;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){let t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,i=this.subHeaders,a=this.glyphIndexArray,o=n.findIndex(e=>e===r),s=0;for(let r=0;r<256;r++)if(n[r]===0)r>=o||r<i[0].firstCode||r>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(r-i[0].firstCode)>=a.length?s=0:(s=a[i[0].idRangeOffset+(r-i[0].firstCode)],s!==0&&(s+=i[0].idDelta)),s!==0&&s<e&&t.set(r,s);else{let o=n[r];for(let n=0,c=i[o].entryCount;n<c;n++)if(i[o].idRangeOffset+n>=a.length?s=0:(s=a[i[o].idRangeOffset+n],s!==0&&(s+=i[o].idDelta)),s!==0&&s<e){let e=(r<<8|n+i[o].firstCode)&65535;t.set(e,s)}}return t}};to([J(`uint16`)],no.prototype,`format`),to([J(`uint16`)],no.prototype,`length`),to([J(`uint16`)],no.prototype,`language`);function ro(e){return e>32767?e-65536:e<-32767?e+65536:e}function io(e,t){let n,r=[],i={};return e.forEach((e,a)=>{t&&a>t||((!n||a!==n.unicode+1||e!==n.glyphIndex+1)&&(n?(i.end=n.unicode,r.push(i),i={start:a,startId:e,delta:ro(e-a)}):(i.start=Number(a),i.startId=e,i.delta=ro(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var ao=Object.defineProperty,oo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ao(t,n,i),i},so=class e extends pa{get endCode(){let 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(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){let 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(e=>this.view.writeUint16(e))}get idDelta(){let e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){let t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(e=>this.view.writeUint16(e))}get idRangeOffsetCursor(){let e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){let 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(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){let e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){let e=this.glyphIndexArrayCursor;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(t){let n=io(t,65535),r=n.length+1,i=Math.floor(Math.log(r)/Math.LN2),a=2*2**i,o=new e(new ArrayBuffer(24+n.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=a,o.entrySelector=i,o.rangeShift=2*r-a,o.endCode=[...n.map(e=>e.end),65535],o.reservedPad=0,o.startCode=[...n.map(e=>e.start),65535],o.idDelta=[...n.map(e=>e.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,i=this.endCode,a=this.idRangeOffset,o=this.idDelta,s=this.glyphIndexArray;for(let c=0;c<t;++c)for(let t=r[c],l=i[c];t<=l;++t)if(a[c]===0)e.set(t,(t+o[c])%65536);else{let i=s[c+a[c]/2+(t-r[c])-n];i===0?e.set(t,0):e.set(t,(i+o[c])%65536)}return e.delete(65535),e}};oo([J(`uint16`)],so.prototype,`format`),oo([J(`uint16`)],so.prototype,`length`),oo([J(`uint16`)],so.prototype,`language`),oo([J(`uint16`)],so.prototype,`segCountX2`),oo([J(`uint16`)],so.prototype,`searchRange`),oo([J(`uint16`)],so.prototype,`entrySelector`),oo([J(`uint16`)],so.prototype,`rangeShift`);var co=so,lo=Object.defineProperty,uo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&lo(t,n,i),i},fo=class extends pa{get glyphIndexArray(){let e=this.entryCount;return Array.from({length:e},(e,t)=>this.view.readUint16(10+t*2))}getUnicodeToGlyphIndexMap(){let e=this.glyphIndexArray,t=this.firstCode,n=new Map;return e.forEach((e,r)=>{n.set(t+r,e)}),n}};uo([J(`uint16`)],fo.prototype,`format`),uo([J(`uint16`)],fo.prototype,`length`),uo([J(`uint16`)],fo.prototype,`language`),uo([J(`uint16`)],fo.prototype,`firstCode`),uo([J(`uint16`)],fo.prototype,`entryCount`);var po=Object.defineProperty,mo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&po(t,n,i),i},ho=class e extends pa{get groups(){let 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(t){let n=io(t),r=new e(new ArrayBuffer(16+n.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=n.length,n.forEach(e=>{r.view.writeUint32(e.start),r.view.writeUint32(e.end),r.view.writeUint32(e.startId)}),r}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){let r=t[n],i=r.startGlyphCode,a=r.startCharCode,o=r.endCharCode;for(;a<=o;)e.set(a++,i++)}return e}};mo([J(`uint16`)],ho.prototype,`format`),mo([J(`uint16`)],ho.prototype,`reserved`),mo([J(`uint32`)],ho.prototype,`length`),mo([J(`uint32`)],ho.prototype,`language`),mo([J(`uint32`)],ho.prototype,`nGroups`);var go=ho,_o=Object.defineProperty,vo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&_o(t,n,i),i},yo=class extends pa{getVarSelectorRecords(){let e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{let e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);let t=this.view.readUint32();e.unicodeValueRanges=Array.from({length:t},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);let t=this.view.readUint32();e.uVSMappings=Array.from({length:t},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){let{uVSMappings:r}=t[n];r.forEach(t=>{e.set(t.unicodeValue,t.glyphID)})}return e}};vo([J(`uint16`)],yo.prototype,`format`),vo([J(`uint32`)],yo.prototype,`length`),vo([J(`uint32`)],yo.prototype,`numVarSelectorRecords`);var bo=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,So=(e,t,n,r)=>{for(var i=r>1?void 0:r?xo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&bo(t,n,i),i},Co=class extends Ga{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=co.from(e),r=$a.from(e),i=t?go.from(e):void 0,a=4+(i?32:24),o=a+n.view.byteLength,s=o+r.view.byteLength,c=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:a},i&&{platformID:3,platformSpecificID:10,offset:s}].filter(Boolean),l=new Co(new ArrayBuffer(4+8*c.length+n.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return l.numberSubtables=c.length,l.view.seek(4),c.forEach(e=>{l.view.writeUint16(e.platformID),l.view.writeUint16(e.platformSpecificID),l.view.writeUint32(e.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,o),i&&l.view.writeBytes(i.view,s),l}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){let e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,i=n.length;r<i;r++){let i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){let 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(e=>{this.view.seek(e.offset);let t=this.view.readUint16(),n;switch(t){case 0:n=new $a(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new no(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new co(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new fo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new go(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new yo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32());break}return{...e,format:t,view:n}})}readunicodeToGlyphIndexMap(){let e=this.readSubtables(),t=e.find(e=>e.format===0)?.view,n=e.find(e=>e.platformID===3&&e.platformSpecificID===3&&e.format===2)?.view,r=e.find(e=>e.platformID===3&&e.platformSpecificID===1&&e.format===4)?.view,i=e.find(e=>e.platformID===3&&e.platformSpecificID===10&&e.format===12)?.view,a=e.find(e=>e.platformID===0&&e.platformSpecificID===5&&e.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...a?.getUnicodeToGlyphIndexMap()??[]])}};So([J(`uint16`)],Co.prototype,`version`,2),So([J(`uint16`)],Co.prototype,`numberSubtables`,2),Co=So([Ua(`cmap`)],Co);var wo=class extends Ca{_parseContours(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return ra(n.length===0,`There are still points left in the current contour.`),t}_transformPoints(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],a={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(a)}return n}_parseGlyphCoordinate(e,t,n,r,i){let a;return(t&r)>0?(a=e.view.readUint8(),(t&i)===0&&(a=-a),a=n+a):a=(t&i)>0?n:n+e.view.readInt16(),a}parse(e,t,n){e.view.seek(t);let 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){let t=this.endPointIndices=[];for(let n=0;n<r;n++)t.push(e.view.readUint16());let n=this.instructionLength=e.view.readUint16();ra(n<5e3,`Bad instructionLength:${n}`);let i=this.instructions=[];for(let t=0;t<n;++t)i.push(e.view.readUint8());let a=e.view.byteOffset,o=t[t.length-1]+1;ra(o<2e4,`Bad numberOfCoordinates:${a}`);let s=[],c,l=0;for(;l<o;)if(c=e.view.readUint8(),s.push(c),l++,c&8&&l<o){let t=e.view.readUint8();for(let e=0;e<t;e++)s.push(c),l++}if(ra(s.length===o,`Bad flags length: ${s.length}, numberOfCoordinates: ${o}`),t.length>0){let n=[],r;if(o>0){for(let e=0;e<o;e+=1)c=s[e],r={},r.onCurve=!!(c&1),r.lastPointOfContour=t.includes(e),n.push(r);let i=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.x=this._parseGlyphCoordinate(e,c,i,2,16),i=r.x;let a=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.y=this._parseGlyphCoordinate(e,c,a,4,32),a=r.y}this.points=n}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let t,n=!0;for(;n;){t=e.view.readUint16();let r={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(t&1)>0?(t&2)>0?(r.dx=e.view.readInt16(),r.dy=e.view.readInt16()):r.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(t&2)>0?(r.dx=e.view.readInt8(),r.dy=e.view.readInt8()):r.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(t&8)>0?r.xScale=r.yScale=e.view.readInt16()/16384:(t&64)>0?(r.xScale=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384):(t&128)>0&&(r.xScale=e.view.readInt16()/16384,r.scale01=e.view.readInt16()/16384,r.scale10=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384),this.components.push(r),n=!!(t&32)}if(t&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let t=0;t<this.instructionLength;t+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let e=0;e<this.components.length;e+=1){let t=this.components[e],r=n.get(t.glyphIndex);if(r.getPathCommands(),r.points){let e;if(t.matchedPoints===void 0)e=this._transformPoints(r.points,t);else{ra(t.matchedPoints[0]>this.points.length-1||t.matchedPoints[1]>r.points.length-1,`Matched points out of range in ${this.name}`);let n=this.points[t.matchedPoints[0]],i=r.points[t.matchedPoints[1]],a={xScale:t.xScale,scale01:t.scale01,scale10:t.scale10,yScale:t.yScale,dx:0,dy:0};i=this._transformPoints([i],a)[0],a.dx=n.x-i.x,a.dy=n.y-i.y,e=this._transformPoints(r.points,a)}this.points=this.points.concat(e)}}let i=[],a=this._parseContours(this.points);for(let e=0,t=a.length;e<t;++e){let t=a[e],n=t[t.length-1],r=t[0];n.onCurve?i.push({type:`M`,x:n.x,y:n.y}):r.onCurve?i.push({type:`M`,x:r.x,y:r.y}):i.push({type:`M`,x:(n.x+r.x)*.5,y:(n.y+r.y)*.5});for(let e=0,a=t.length;e<a;++e)if(n=r,r=t[(e+1)%a],n.onCurve)i.push({type:`L`,x:n.x,y:n.y});else{let e=r;r.onCurve||(e={x:(n.x+r.x)*.5,y:(n.y+r.y)*.5}),i.push({type:`Q`,x1:n.x,y1:n.y,x:e.x,y:e.y})}i.push({type:`Z`})}this.pathCommands=i}},To=class extends Ea{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new wo({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Eo=Object.getOwnPropertyDescriptor,Do=(e,t,n,r)=>{for(var i=r>1?void 0:r?Eo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Oo=class extends Ga{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Oo(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new To(this._sfnt)}};Oo=Do([Ua(`glyf`)],Oo);function ko(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ao(e,t,n){if(!t)return[];let r=e.getUint16(t,!1),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(ko(e,r)!==n)continue;let o=t+e.getUint16(r+4,!1),s=e.getUint16(o+2,!1);for(let t=0;t<s;t++)i.add(e.getUint16(o+4+t*2,!1))}return[...i]}function jo(e,t,n){if(!t||n>=e.getUint16(t,!1))return;let r=t+e.getUint16(t+2+n*2,!1),i=e.getUint16(r+4,!1),a=[];for(let t=0;t<i;t++)a.push(r+e.getUint16(r+6+t*2,!1));return{lookupType:e.getUint16(r,!1),lookupFlag:e.getUint16(r+2,!1),subtableOffsets:a}}function Mo(e,t){let n=e.getUint16(t,!1),r=[];if(n===1){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++)r.push(e.getUint16(t+4+i*2,!1))}else if(n===2){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++){let n=t+4+i*6,a=e.getUint16(n,!1),o=e.getUint16(n+2,!1),s=e.getUint16(n+4,!1);for(let e=a;e<=o;e++)r[s++]=e}}return r}function No(e,t){let n=new Map,r=e.getUint16(t,!1);if(r===1){let r=e.getUint16(t+2,!1),i=e.getUint16(t+4,!1);for(let a=0;a<i;a++)n.set(r+a,e.getUint16(t+6+a*2,!1))}else if(r===2){let r=e.getUint16(t+2,!1);for(let i=0;i<r;i++){let r=t+4+i*6,a=e.getUint16(r,!1),o=e.getUint16(r+2,!1),s=e.getUint16(r+4,!1);for(let e=a;e<=o;e++)n.set(e,s)}}return n}function Po(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Fo(e,t,n){if(!(n&4))return 0;let r=t;return n&1&&(r+=2),n&2&&(r+=2),e.getInt16(r,!1)}var Io=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Ro=(e,t,n,r)=>{for(var i=r>1?void 0:r?Lo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Io(t,n,i),i},zo=class extends Ga{_format1Pairs;_classSubtables;getKerningValue(e,t){this._ensureKerning();let n=this._format1Pairs.get(e*65536+t);if(n!==void 0)return n;for(let n of this._classSubtables){if(!n.coverage.has(e))continue;let r=n.classDef1.get(e)??0,i=n.classDef2.get(t)??0,a=n.class1RecordsOffset+(r*n.class2Count+i)*n.recordSize,o=Fo(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ao(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=jo(this.view,this.lookupListOffset,e);t?.subtableOffsets.forEach(e=>this._collectPairPos(e,t.lookupType))}))}_collectPairPos(e,t){let n=this.view;if(t===9){let t=n.readUint16(e+2),r=n.readUint32(e+4);this._collectPairPos(e+r,t);return}if(t!==2)return;let r=n.readUint16(e),i=Mo(n,e+n.readUint16(e+2)),a=n.readUint16(e+4),o=n.readUint16(e+6);if(r===1){let t=n.readUint16(e+8),r=2+Po(a)+Po(o);for(let o=0;o<t&&o<i.length;o++){let t=i[o],s=e+n.readUint16(e+10+o*2),c=n.readUint16(s),l=s+2;for(let e=0;e<c;e++){let e=n.readUint16(l),i=Fo(n,l+2,a);i&&this._format1Pairs.set(t*65536+e,i),l+=r}}}else r===2&&this._classSubtables.push({coverage:new Set(i),classDef1:No(n,e+n.readUint16(e+8)),classDef2:No(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Po(a)+Po(o),valueFormat1:a})}};Ro([J(`uint16`)],zo.prototype,`majorVersion`,2),Ro([J(`uint16`)],zo.prototype,`minorVersion`,2),Ro([J(`uint16`)],zo.prototype,`scriptListOffset`,2),Ro([J(`uint16`)],zo.prototype,`featureListOffset`,2),Ro([J(`uint16`)],zo.prototype,`lookupListOffset`,2),zo=Ro([Ua(`GPOS`,`gpos`)],zo);var Bo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Ho=(e,t,n,r)=>{for(var i=r>1?void 0:r?Vo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Bo(t,n,i),i},Uo=class extends Ga{_singleSubstitutions;_ligatures;getSingleSubstitutions(e){let t=this._singleSubstitutions??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectSingleSubstitutions(e,t.lookupType,n)})}),t.set(e,n)),n}getLigatures(e){let t=this._ligatures??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectLigatures(e,t.lookupType,n)})}),t.set(e,n)),n}_collectLigatures(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectLigatures(e+i,t,n);return}if(t!==4)return;let i=this._readCoverage(e+r.readUint16(e+2)),a=r.readUint16(e+4);for(let t=0;t<a&&t<i.length;t++){let a=i[t],o=e+r.readUint16(e+6+t*2),s=r.readUint16(o),c=n.get(a)??[];for(let e=0;e<s;e++){let t=o+r.readUint16(o+2+e*2),n=r.readUint16(t),i=r.readUint16(t+2),a=[];for(let e=0;e<i-1;e++)a.push(r.readUint16(t+4+e*2));c.push({components:a,ligatureGlyph:n})}n.has(a)||n.set(a,c)}}readLookup(e){let t=this.lookupListOffset;if(!t)return;let n=this.view;if(e>=n.readUint16(t))return;let r=t+n.readUint16(t+2+e*2),i=n.readUint16(r+4),a=[];for(let e=0;e<i;e++)a.push(r+n.readUint16(r+6+e*2));return{lookupType:n.readUint16(r),lookupFlag:n.readUint16(r+2),subtableOffsets:a}}_featureLookupIndices(e){let t=this.featureListOffset;if(!t)return[];let n=this.view,r=n.readUint16(t),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(n.readString(r,4)!==e)continue;let o=t+n.readUint16(r+4),s=n.readUint16(o+2);for(let e=0;e<s;e++)i.add(n.readUint16(o+4+e*2))}return Array.from(i)}_collectSingleSubstitutions(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectSingleSubstitutions(e+i,t,n);return}if(t!==1)return;let i=r.readUint16(e),a=this._readCoverage(e+r.readUint16(e+2));if(i===1){let t=r.readInt16(e+4);a.forEach(e=>{n.set(e,e+t&65535)})}else if(i===2){let t=r.readUint16(e+4);for(let i=0;i<t&&i<a.length;i++)n.set(a[i],r.readUint16(e+6+i*2))}}_readCoverage(e){let t=this.view,n=t.readUint16(e),r=[];if(n===1){let n=t.readUint16(e+2);for(let i=0;i<n;i++)r.push(t.readUint16(e+4+i*2))}else if(n===2){let n=t.readUint16(e+2);for(let i=0;i<n;i++){let n=e+4+i*6,a=t.readUint16(n),o=t.readUint16(n+2),s=t.readUint16(n+4);for(let e=a;e<=o;e++)r[s++]=e}}return r}};Ho([J(`uint16`)],Uo.prototype,`majorVersion`,2),Ho([J(`uint16`)],Uo.prototype,`minorVersion`,2),Ho([J(`uint16`)],Uo.prototype,`scriptListOffset`,2),Ho([J(`uint16`)],Uo.prototype,`featureListOffset`,2),Ho([J(`uint16`)],Uo.prototype,`lookupListOffset`,2),Uo=Ho([Ua(`GSUB`,`gsub`)],Uo);var Wo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,Ko=(e,t,n,r)=>{for(var i=r>1?void 0:r?Go(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wo(t,n,i),i},qo=class extends Ga{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};Ko([J(`fixed`)],qo.prototype,`version`,2),Ko([J(`fixed`)],qo.prototype,`fontRevision`,2),Ko([J(`uint32`)],qo.prototype,`checkSumAdjustment`,2),Ko([J(`uint32`)],qo.prototype,`magickNumber`,2),Ko([J(`uint16`)],qo.prototype,`flags`,2),Ko([J(`uint16`)],qo.prototype,`unitsPerEm`,2),Ko([J({type:`longDateTime`})],qo.prototype,`created`,2),Ko([J({type:`longDateTime`})],qo.prototype,`modified`,2),Ko([J(`int16`)],qo.prototype,`xMin`,2),Ko([J(`int16`)],qo.prototype,`yMin`,2),Ko([J(`int16`)],qo.prototype,`xMax`,2),Ko([J(`int16`)],qo.prototype,`yMax`,2),Ko([J(`uint16`)],qo.prototype,`macStyle`,2),Ko([J(`uint16`)],qo.prototype,`lowestRecPPEM`,2),Ko([J(`int16`)],qo.prototype,`fontDirectionHint`,2),Ko([J(`int16`)],qo.prototype,`indexToLocFormat`,2),Ko([J(`int16`)],qo.prototype,`glyphDataFormat`,2),qo=Ko([Ua(`head`)],qo);var Jo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,Xo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Yo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Jo(t,n,i),i},Zo=class extends Ga{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Xo([J(`fixed`)],Zo.prototype,`version`,2),Xo([J(`int16`)],Zo.prototype,`ascent`,2),Xo([J(`int16`)],Zo.prototype,`descent`,2),Xo([J(`int16`)],Zo.prototype,`lineGap`,2),Xo([J(`uint16`)],Zo.prototype,`advanceWidthMax`,2),Xo([J(`int16`)],Zo.prototype,`minLeftSideBearing`,2),Xo([J(`int16`)],Zo.prototype,`minRightSideBearing`,2),Xo([J(`int16`)],Zo.prototype,`xMaxExtent`,2),Xo([J(`int16`)],Zo.prototype,`caretSlopeRise`,2),Xo([J(`int16`)],Zo.prototype,`caretSlopeRun`,2),Xo([J(`int16`)],Zo.prototype,`caretOffset`,2),Xo([J({type:`int16`,size:4})],Zo.prototype,`reserved`,2),Xo([J(`int16`)],Zo.prototype,`metricDataFormat`,2),Xo([J(`uint16`)],Zo.prototype,`numOfLongHorMetrics`,2),Zo=Xo([Ua(`hhea`)],Zo);var Qo=Object.getOwnPropertyDescriptor,$o=(e,t,n,r)=>{for(var i=r>1?void 0:r?Qo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},es=class extends Ga{static from(e){let t=e.length*4,n=new es(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceWidth),n.view.writeUint16(e.leftSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics,n=0,r=this.view;return r.seek(0),Array.from({length:e}).map((e,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};es=$o([Ua(`hmtx`)],es);var ts=Object.getOwnPropertyDescriptor,ns=(e,t,n,r)=>{for(var i=r>1?void 0:r?ts(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},rs=class extends Ga{_pairs;get pairs(){return this._pairs??=this._readPairs()}getKerningValue(e,t){return this.pairs.get(e*65536+t)??0}_readPairs(){let e=this.view,t=new Map;if(e.byteLength<4||e.readUint16(0)!==0)return t;let n=e.readUint16(2),r=4;for(let i=0;i<n&&r+6<=e.byteLength;i++){let n=e.readUint16(r+2),i=e.readUint16(r+4),a=i>>8,o=(i&1)!=0;if(a===0&&o){let n=e.readUint16(r+6),i=r+14;for(let r=0;r<n;r++){let n=e.readUint16(i),r=e.readUint16(i+2),a=e.readInt16(i+4);t.set(n*65536+r,a),i+=6}}if(n<=0)break;r+=n}return t}};rs=ns([Ua(`kern`,`kern`)],rs);var is=Object.getOwnPropertyDescriptor,as=(e,t,n,r)=>{for(var i=r>1?void 0:r?is(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},os=class extends Ga{static from(e,t=1){let n=e.length*(t?4:2),r=new os(new ArrayBuffer(n));return e.forEach(e=>{t?r.view.writeUint32(e):r.view.writeUint16(e/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){let 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)}};os=as([Ua(`loca`)],os);var ss=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,ls=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ss(t,n,i),i},us=class extends Ga{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};ls([J(`fixed`)],us.prototype,`version`,2),ls([J(`uint16`)],us.prototype,`numGlyphs`,2),ls([J(`uint16`)],us.prototype,`maxPoints`,2),ls([J(`uint16`)],us.prototype,`maxContours`,2),ls([J(`uint16`)],us.prototype,`maxComponentPoints`,2),ls([J(`uint16`)],us.prototype,`maxComponentContours`,2),ls([J(`uint16`)],us.prototype,`maxZones`,2),ls([J(`uint16`)],us.prototype,`maxTwilightPoints`,2),ls([J(`uint16`)],us.prototype,`maxStorage`,2),ls([J(`uint16`)],us.prototype,`maxFunctionDefs`,2),ls([J(`uint16`)],us.prototype,`maxInstructionDefs`,2),ls([J(`uint16`)],us.prototype,`maxStackElements`,2),ls([J(`uint16`)],us.prototype,`maxSizeOfInstructions`,2),ls([J(`uint16`)],us.prototype,`maxComponentElements`,2),ls([J(`uint16`)],us.prototype,`maxComponentDepth`,2),us=ls([Ua(`maxp`)],us);var ds=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,ps=(e,t,n,r)=>{for(var i=r>1?void 0:r?fs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ds(t,n,i),i},ms={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`},hs={Macintosh:1,Microsoft:3},gs={Default:0},_s={UCS2:1},vs=class extends Ga{_names;get names(){return this._names??=this.readNames()}readNames(){let e=this.count;this.view.seek(6);let t=[];for(let n=0;n<e;++n)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()});let n=this.stringOffset;for(let r=0;r<e;++r){let e=t[r];e.name=this.view.readBytes(n+e.offset,e.length)}let r=hs.Macintosh,i=gs.Default,a=0;t.some(e=>e.platform===hs.Microsoft&&e.encoding===_s.UCS2&&e.language===1033)&&(r=hs.Microsoft,i=_s.UCS2,a=1033);let o={};for(let n=0;n<e;++n){let e=t[n];e.platform===r&&e.encoding===i&&e.language===a&&ms[e.nameId]&&(o[ms[e.nameId]]=a===0?ca(e.name):la(e.name))}return o}};ps([J(`uint16`)],vs.prototype,`format`,2),ps([J(`uint16`)],vs.prototype,`count`,2),ps([J(`uint16`)],vs.prototype,`stringOffset`,2),vs=ps([Ua(`name`)],vs);var ys=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?bs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ys(t,n,i),i},$=class extends Ga{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};Q([J(`uint16`)],$.prototype,`version`,2),Q([J(`int16`)],$.prototype,`xAvgCharWidth`,2),Q([J(`uint16`)],$.prototype,`usWeightClass`,2),Q([J(`uint16`)],$.prototype,`usWidthClass`,2),Q([J(`uint16`)],$.prototype,`fsType`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutSize`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutPosition`,2),Q([J(`uint16`)],$.prototype,`sFamilyClass`,2),Q([J({type:`uint8`})],$.prototype,`bFamilyType`,2),Q([J({type:`uint8`})],$.prototype,`bSerifStyle`,2),Q([J({type:`uint8`})],$.prototype,`bWeight`,2),Q([J({type:`uint8`})],$.prototype,`bProportion`,2),Q([J({type:`uint8`})],$.prototype,`bContrast`,2),Q([J({type:`uint8`})],$.prototype,`bStrokeVariation`,2),Q([J({type:`uint8`})],$.prototype,`bArmStyle`,2),Q([J({type:`uint8`})],$.prototype,`bLetterform`,2),Q([J({type:`uint8`})],$.prototype,`bMidline`,2),Q([J({type:`uint8`})],$.prototype,`bXHeight`,2),Q([J({type:`uint32`,size:4})],$.prototype,`ulUnicodeRange`,2),Q([J({type:`char`,size:4})],$.prototype,`achVendID`,2),Q([J(`uint16`)],$.prototype,`fsSelection`,2),Q([J(`uint16`)],$.prototype,`usFirstCharIndex`,2),Q([J(`uint16`)],$.prototype,`usLastCharIndex`,2),Q([J(`int16`)],$.prototype,`sTypoAscender`,2),Q([J(`int16`)],$.prototype,`sTypoDescender`,2),Q([J(`int16`)],$.prototype,`sTypoLineGap`,2),Q([J(`uint16`)],$.prototype,`usWinAscent`,2),Q([J(`uint16`)],$.prototype,`usWinDescent`,2),Q([J({offset:78,type:`uint32`,size:2})],$.prototype,`ulCodePageRange`,2),Q([J({offset:86,type:`int16`})],$.prototype,`sxHeight`,2),Q([J(`int16`)],$.prototype,`sCapHeight`,2),Q([J(`uint16`)],$.prototype,`usDefaultChar`,2),Q([J(`uint16`)],$.prototype,`usBreakChar`,2),Q([J(`uint16`)],$.prototype,`usMaxContext`,2),$=Q([Ua(`OS/2`,`os2`)],$);var xs=`.notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quotesingle,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,grave,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,Adieresis,Aring,Ccedilla,Eacute,Ntilde,Odieresis,Udieresis,aacute,agrave,acircumflex,adieresis,atilde,aring,ccedilla,eacute,egrave,ecircumflex,edieresis,iacute,igrave,icircumflex,idieresis,ntilde,oacute,ograve,ocircumflex,odieresis,otilde,uacute,ugrave,ucircumflex,udieresis,dagger,degree,cent,sterling,section,bullet,paragraph,germandbls,registered,copyright,trademark,acute,dieresis,notequal,AE,Oslash,infinity,plusminus,lessequal,greaterequal,yen,mu,partialdiff,summation,product,pi,integral,ordfeminine,ordmasculine,Omega,ae,oslash,questiondown,exclamdown,logicalnot,radical,florin,approxequal,Delta,guillemotleft,guillemotright,ellipsis,nonbreakingspace,Agrave,Atilde,Otilde,OE,oe,endash,emdash,quotedblleft,quotedblright,quoteleft,quoteright,divide,lozenge,ydieresis,Ydieresis,fraction,currency,guilsinglleft,guilsinglright,fi,fl,daggerdbl,periodcentered,quotesinglbase,quotedblbase,perthousand,Acircumflex,Ecircumflex,Aacute,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Oacute,Ocircumflex,apple,Ograve,Uacute,Ucircumflex,Ugrave,dotlessi,circumflex,tilde,macron,breve,dotaccent,ring,cedilla,hungarumlaut,ogonek,caron,Lslash,lslash,Scaron,scaron,Zcaron,zcaron,brokenbar,Eth,eth,Yacute,yacute,Thorn,thorn,minus,multiply,onesuperior,twosuperior,threesuperior,onehalf,onequarter,threequarters,franc,Gbreve,gbreve,Idotaccent,Scedilla,scedilla,Cacute,cacute,Ccaron,ccaron,dcroat`.split(`,`),Ss=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,ws=(e,t,n,r)=>{for(var i=r>1?void 0:r?Cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ss(t,n,i),i},Ts=class extends Ga{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return xs.slice();if(e!==2)return[];let t=this.view,n=t.readUint16(32),r=[];for(let e=0;e<n;e++)r.push(t.readUint16(34+e*2));let i=[],a=34+n*2,o=t.byteLength;for(;a<o;){let e=t.readUint8(a);a+=1,i.push(t.readString(a,e)),a+=e}return r.map(e=>e<258?xs[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};ws([J(`fixed`)],Ts.prototype,`format`,2),ws([J(`fixed`)],Ts.prototype,`italicAngle`,2),ws([J(`int16`)],Ts.prototype,`underlinePosition`,2),ws([J(`int16`)],Ts.prototype,`underlineThickness`,2),ws([J(`uint32`)],Ts.prototype,`isFixedPitch`,2),ws([J(`uint32`)],Ts.prototype,`minMemType42`,2),ws([J(`uint32`)],Ts.prototype,`maxMemType42`,2),ws([J(`uint32`)],Ts.prototype,`minMemType1`,2),ws([J(`uint32`)],Ts.prototype,`maxMemType1`,2),Ts=ws([Ua(`post`)],Ts);var Es=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Os=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ds(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Es(t,n,i),i},ks=class extends Ga{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Os([J(`fixed`)],ks.prototype,`version`,2),Os([J(`int16`)],ks.prototype,`vertTypoAscender`,2),Os([J(`int16`)],ks.prototype,`vertTypoDescender`,2),Os([J(`int16`)],ks.prototype,`vertTypoLineGap`,2),Os([J(`int16`)],ks.prototype,`advanceHeightMax`,2),Os([J(`int16`)],ks.prototype,`minTopSideBearing`,2),Os([J(`int16`)],ks.prototype,`minBottomSideBearing`,2),Os([J(`int16`)],ks.prototype,`yMaxExtent`,2),Os([J(`int16`)],ks.prototype,`caretSlopeRise`,2),Os([J(`int16`)],ks.prototype,`caretSlopeRun`,2),Os([J(`int16`)],ks.prototype,`caretOffset`,2),Os([J({type:`int16`,size:4})],ks.prototype,`reserved`,2),Os([J(`int16`)],ks.prototype,`metricDataFormat`,2),Os([J(`int16`)],ks.prototype,`numOfLongVerMetrics`,2),ks=Os([Ua(`vhea`)],ks);var As=Object.getOwnPropertyDescriptor,js=(e,t,n,r)=>{for(var i=r>1?void 0:r?As(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Ms=class extends Ga{static from(e){let t=e.length*4,n=new Ms(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceHeight),n.view.writeInt16(e.topSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((e,i)=>(i<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readInt16()}))}};Ms=js([Ua(`vmtx`)],Ms);var Ns=Object.defineProperty,Ps=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ns(t,n,i),i},Fs=class extends ma{format=`TrueType`;mimeType=`font/ttf`;_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(aa(e).getUint32(0))}static checksum(e){let t=aa(e),n=t.byteLength,r=Math.floor(n/4),i=0;for(let e=0;e<r;e++)i+=t.getUint32(e*4,!1);let a=n-r*4;if(a>0){let e=0,n=r*4;for(let r=0;r<4;r++)e=e*256+(r<a?t.getUint8(n+r):0);i+=e}return i%4294967296}static from(e){let t=e=>e+3&-4,n=e.tableTags,r=n.map(t=>e.getTableView(t)),i=n.length,a=r.reduce((e,n)=>e+t(n.byteLength),0),o=new this(new ArrayBuffer(12+i*16+a));o.scalerType=65536,o.numTables=i;let s=Math.floor(Math.log2(i));o.searchRange=2**s*16,o.entrySelector=s,o.rangeShift=i*16-o.searchRange;let c=12+i*16,l=o.getDirectories();n.forEach((e,n)=>{let i=r[n],a=l[n];a.tag=e,a.checkSum=this.checksum(i),a.offset=c,a.length=i.byteLength,o.view.writeBytes(i,c),c+=t(a.length)});let u=l.find(e=>e.tag===`head`);if(u){let e=u.offset+8;o.view.writeUint32(0,e),o.view.writeUint32(2981146554-this.checksum(o.view)>>>0,e)}return o}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{let t=new ba(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new Wa(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ps([J(`uint32`)],Fs.prototype,`scalerType`),Ps([J(`uint16`)],Fs.prototype,`numTables`),Ps([J(`uint16`)],Fs.prototype,`searchRange`),Ps([J(`uint16`)],Fs.prototype,`entrySelector`),Ps([J(`uint16`)],Fs.prototype,`rangeShift`);var Is=class extends Fs{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},Ls=class{static signature=1953784678;static is(e){let t=aa(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=aa(e),this.numFonts=this.view.getUint32(8,!1)}get sfnts(){return Array.from({length:this.numFonts},(e,t)=>this._readSFNT(this.view.getUint32(12+t*4,!1)))}get fonts(){return this.sfnts.map(e=>e.hasTable(`CFF `)?Is.from(e):Fs.from(e))}_readSFNT(e){let t=this.view,n=t.byteOffset,r=t.getUint16(e+4,!1),i=new Map;for(let a=0;a<r;a++){let r=e+12+a*16,o=String.fromCharCode(t.getUint8(r),t.getUint8(r+1),t.getUint8(r+2),t.getUint8(r+3)),s=t.getUint32(r+8,!1),c=t.getUint32(r+12,!1);i.set(o,new DataView(t.buffer,n+s,c))}return new Wa(i)}},Rs=Object.defineProperty,zs=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Rs(t,n,i),i},Bs=class extends pa{constructor(e,t){super(e,t,20)}};zs([J({type:`char`,size:4})],Bs.prototype,`tag`),zs([J(`uint32`)],Bs.prototype,`offset`),zs([J(`uint32`)],Bs.prototype,`compLength`),zs([J(`uint32`)],Bs.prototype,`origLength`),zs([J(`uint32`)],Bs.prototype,`origChecksum`);var Vs=Object.defineProperty,Hs=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Vs(t,n,i),i};function Us(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Ws(e){return new Promise((t,n)=>{Zi(e,(e,r)=>e?n(e):t(r))})}function Gs(e){return new Promise((t,n)=>{$i(e,(e,r)=>e?n(e):t(r))})}var Ks=class e extends ma{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Fs.is(this.flavor)?`TrueType`:Is.is(this.flavor)?`OpenType`:`Open`}_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(aa(e).getUint32(0))}static checkSum(e){let t=aa(e),n=t.byteLength,r=Math.floor(n/4),i=0,a=0;for(;a<r;)i+=t.getUint32(4*a++,!1);let o=n-r*4;if(o){let e=r*4;for(;o>0;)i+=t.getUint8(e)<<o*8,e++,o--}return i%4294967296}static _pickTable(e,t,n){return{tag:e,view:n.byteLength<t.byteLength?n:t,rawView:t}}static from(e,t=new ArrayBuffer(0)){let n=e.tableTags.map(t=>{let n=e.getTableView(t);return this._pickTable(t,n,aa(Qi(Us(n))))});return this._assemble(n,t)}static async fromAsync(e,t=new ArrayBuffer(0)){let n=await Promise.all(e.tableTags.map(async t=>{let n=e.getTableView(t);return this._pickTable(t,n,aa(await Ws(Us(n))))}));return this._assemble(n,t)}static _assemble(t,n){let r=e=>e+3&-4,i=t.length,a=t.reduce((e,t)=>e+r(t.view.byteLength),0),o=new e(new ArrayBuffer(44+20*i+a+n.byteLength));o.signature=2001684038,o.flavor=65536,o.length=o.view.byteLength,o.numTables=i,o.totalSFNTSize=12+16*i+t.reduce((e,t)=>e+r(t.rawView.byteLength),0);let s=44+i*20,c=0,l=o.getDirectories();return t.forEach(t=>{let n=l[c++];n.tag=t.tag,n.offset=s,n.compLength=t.view.byteLength,n.origChecksum=e.checkSum(t.rawView),n.origLength=t.rawView.byteLength,o.view.writeBytes(t.view,s),s+=r(n.compLength)}),o.view.writeBytes(n),o}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{let t=new Bs(this.view.buffer,e);return e+=t.view.byteLength,t})}_decodeTable(e,t,n){if(t>=n)return new DataView(this.view.buffer,e,t);let r=ea(new Uint8Array(this.view.buffer.slice(e,e+t)));return new DataView(r.buffer,r.byteOffset,r.byteLength)}createSFNT(){let e=new Map;return this.getDirectories().forEach(t=>{let n=t.tag,r=this.view.byteOffset+t.offset,i=t.compLength,a=t.origLength;e.set(n,()=>this._decodeTable(r,i,a))}),new Wa(void 0,e)}async createSFNTAsync(){let e=await Promise.all(this.getDirectories().map(async e=>{let t=e.tag,n=this.view.byteOffset+e.offset,r=e.compLength,i=e.origLength,a;if(r>=i)a=new DataView(this.view.buffer,n,r);else{let e=await Gs(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new Wa(new Map(e))}};Hs([J(`uint32`)],Ks.prototype,`signature`),Hs([J(`uint32`)],Ks.prototype,`flavor`),Hs([J(`uint32`)],Ks.prototype,`length`),Hs([J(`uint16`)],Ks.prototype,`numTables`),Hs([J(`uint16`)],Ks.prototype,`reserved`),Hs([J(`uint32`)],Ks.prototype,`totalSFNTSize`),Hs([J(`uint16`)],Ks.prototype,`majorVersion`),Hs([J(`uint16`)],Ks.prototype,`minorVersion`),Hs([J(`uint32`)],Ks.prototype,`metaOffset`),Hs([J(`uint32`)],Ks.prototype,`metaLength`),Hs([J(`uint32`)],Ks.prototype,`metaOrigLength`),Hs([J(`uint32`)],Ks.prototype,`privOffset`),Hs([J(`uint32`)],Ks.prototype,`privLength`);var qs=Ks;function Js(e,t=!0){if(Fs.is(e))return new Fs(e);if(Is.is(e))return new Is(e);if(qs.is(e))return new qs(e);if(Ls.is(e)){let t=new Ls(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function Ys(e,t=!0){let n=Js(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var Xs=new class e{static defaultRequestInit={cache:`force-cache`};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(t,n){let r=new AbortController;return{url:t,when:fetch(t,{...e.defaultRequestInit,...n,signal:r.signal}).then(e=>e.arrayBuffer()),cancel:()=>r.abort()}}async injectFontFace(e,t){if(!document.fonts.check(`14px "${e}"`)){let n=new FontFace(e,t);await n.load(),document.fonts.add(n)}}injectStyleTag(e,t){let n=CSS.escape(e);if(!document.querySelector(`style[data-family="${n}"]`)){let n=document.createElement(`style`);n.type=`text/css`,n.dataset.family=e,n.appendChild(document.createTextNode(`@font-face {
31
31
  font-family: "${e}";
32
32
  src: url(${t});
33
- }`)),document.head.appendChild(n)}return this}_parseUrls(e){let t=[...new Set([...e.split(`,`),e])];return[...new Set(t.map(e=>this.familyToUrl.get(e.trim())??this.familyToUrl.get(e)??e))]}get(e){let t;return e&&(t=this._parseUrls(e).reduce((e,t)=>e||this.loaded.get(t),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(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>e.split(`,`).map(e=>e.trim())):[]}async load(e,t={}){let{cancelOther:n,injectStyleTag:r=!1,injectFontFace:i=!1,...a}=t,o,s;typeof e==`string`?o=e:{src:o,family:s}=e;let c=this._parseFamilies(s);if(this.loaded.has(o))return n&&(this.loading.forEach(e=>e.cancel()),this.loading.clear()),u(this.loaded.get(o));let l=this.loading.get(o);return l||(l=this._createRequest(o,a),this.loading.set(o,l)),n&&this.loading.forEach((e,t)=>{e!==l&&(e.cancel(),this.loading.delete(t))}),l.when.then(e=>{let n;return this.loaded.has(o)?n=u(this.loaded.get(o)):(n=d(e),t.noAdd||this.loaded.set(o,n)),Promise.all(Array.from(n.familySet,async t=>{if(this.familyToUrl.set(t,o),typeof document<`u`&&(i&&await this.injectFontFace(t,e),r&&this.injectStyleTag(t,o),i||r))return await document.fonts.load(`14px "${t}"`)})).then(()=>n)}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return d();throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}function d(e=new ArrayBuffer(0)){let t;function n(){return t||=e.byteLength?_s(e,!1):void 0,t}function r(){let e=n();if(e instanceof ss||e instanceof hs)return e.sfnt}return{src:o,family:s,buffer:e,familySet:new Set(c),getFont:n,getSFNT:r}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},ys=new Set([`©`,`®`,`÷`]),bs=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),xs={1:`italic`,32:`bold`},Ss={1:`italic`,2:`bold`},Cs={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},ws=class{content;index;parent;path=new Mr().setMeta(this);lineBox=new W;inlineBox=new W;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){let e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new W(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new W(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}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}constructor(e,t,n){this.content=e,this.index=t,this.parent=n}_getFontSFNT(e){let t=this.computedStyle.fontFamily,n=e??vs,r=(t?n.get(t):n.fallbackFont)?.getSFNT();return r?.textToGlyphIndexes(this.content).includes(0)&&(r=n.fallbackFont?.getSFNT()),r}updateGlyph(e=this._getFontSFNT()){if(!e)return this;let{hhea:t,os2:n,post:r,head:i}=e,a=i.unitsPerEm,o=t.ascent,s=t.descent,{content:c,computedStyle:l}=this,{fontSize:u}=l,d=a/u,f=e.getAdvanceWidth(c,u),p=(o+Math.abs(s))/d,m=o/d;return this.advanceWidth=f,this.advanceHeight=p,this.underlinePosition=(o-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(o-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=o/d,this.descender=s/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.version>1?n.sxHeight/d:0,this.capHeight=n.version>1?n.sCapHeight/d:0,this.baseline=m,this.centerDiviation=p/2-m,this.fontStyle=xs[n.fsSelection]??Ss[i.macStyle],this}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let{isVertical:n,content:r,computedStyle:i,baseline:a,inlineBox:o,ascender:s,descender:c,typoAscender:l,fontStyle:u,advanceWidth:d,advanceHeight:f}=this,{left:p,top:m}=o,h=i.fontStyle===`italic`&&u!==`italic`,g=p,_=m+a,v,y=new Mr().setMeta(this);if(n&&(g+=(f-d)/2,Math.abs(d-f)>.1&&(_-=(s-l)/(s+Math.abs(c))*f),v=void 0),n&&!ys.has(r)&&(r.codePointAt(0)<=256||bs.has(r))){y.addCommands(t.getPathCommands(r,g,m+a-(f-d)/2,i.fontSize));let e={y:m-(f-d)/2+f/2,x:g+d/2};h&&this._italic(y,{x:e.x,y:m-(f-d)/2+a}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(r,g,_,i.fontSize)),h&&this._italic(y,n?{x:g+f/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,i.fontSize)),h&&this._italic(y,n?{x:g+d/2,y:m+l/(s+Math.abs(c))*f}:void 0));let b=i.fontWeight??400;return b in Cs&&(b===700||b===`bold`)&&u!==`bold`&&y.bold(Cs[b]*i.fontSize*.05),y.style=A({fill:i.color,fillRule:`nonzero`,stroke:i.textStrokeWidth?i.textStrokeColor:void 0,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:void 0}),this.path=y,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){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){let t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;let{min:n,max:r}=t;return new W(n.x,n.y,r.x-n.x,r.y-n.y)}},Ts=class{content;style;fill;outline;index;parent;inlineBox=new W;get computedContent(){let e=this.computedStyle;return e.textTransform===`uppercase`?this.content.toUpperCase():e.textTransform===`lowercase`?this.content.toLowerCase():this.content}constructor(e,t={},n,r,i,a){this.content=e,this.style=t,this.fill=n,this.outline=r,this.index=i,this.parent=a,this.update().initCharacters()}update(){this.computedStyle={...this.parent.computedStyle,...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new ws(n,t++,this));return this.characters=e,this}},Es=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...A(this.parent.computedStyle),...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}};function Ds(e){return e}var Os;function ks(){if(Os?.isConnected)return Os;let e=document.createElement(`div`);return e.dataset.modernText=`measurer`,Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,visibility:`hidden`,pointerEvents:`none`}),document.body.appendChild(e),Os=e,e}var As=class e{static notZeroStyles=new Set([`width`,`height`]);static pxStyles=new Set([`width`,`height`,`fontSize`,`letterSpacing`,`textStrokeWidth`,`textIndent`,`shadowOffsetX`,`shadowOffsetY`,`shadowBlur`,`margin`,`marginLeft`,`marginTop`,`marginRight`,`marginBottom`,`padding`,`paddingLeft`,`paddingTop`,`paddingRight`,`paddingBottom`]);_styleCache=new WeakMap;_mountedDom;_mountedSignature;_toDomStyle(t){let n=this._styleCache.get(t);if(n)return n;let r={},{notZeroStyles:i,pxStyles:a}=e;for(let e in t){let n=t[e];i.has(e)&&n===0||(r[e]=typeof n==`number`&&a.has(e)?`${n}px`:n)}return this._styleCache.set(t,r),r}_resolveRootStyles(e){let t={...e},n=e.writingMode.includes(`horizontal`);switch(e.textAlign){case`start`:case`left`:t.justifyContent=`flex-start`;break;case`center`:t.justifyContent=`center`;break;case`end`:case`right`:t.justifyContent=`flex-end`;break}switch(e.verticalAlign){case`top`:t.alignItems=`flex-start`;break;case`middle`:t.alignItems=`center`;break;case`bottom`:t.alignItems=`flex-end`;break}let r=!!(t.justifyContent||t.alignItems);return{section:{...this._toDomStyle({...t,boxSizing:t.boxSizing??`border-box`,display:t.display??(r?`inline-flex`:void 0),width:t.width??`max-content`,height:t.height??`max-content`}),whiteSpace:`pre-wrap`,wordBreak:`break-all`},ul:{verticalAlign:`inherit`,listStyleType:`inherit`,padding:`0`,margin:`0`,width:r&&n?`100%`:void 0,height:r&&!n?`100%`:void 0}}}_applyRootStyle(e,t,n){let r=this._resolveRootStyles(n);e.removeAttribute(`style`),Object.assign(e.style,r.section),t.removeAttribute(`style`),Object.assign(t.style,r.ul)}_applyLiStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applySpanStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applyFragmentContent(e,t){let n=e.firstChild;n?n.data!==t.content&&(n.data=t.content):e.appendChild(document.createTextNode(t.content))}_hide(e){e.style.visibility=`hidden`}_signature(e){let t=`${e.length}`;for(let n=0;n<e.length;n++)t+=`:${e[n].fragments.length}`;return t}createDom(e,t){let n=document.createElement(`section`),r=document.createElement(`ul`);return this._applyRootStyle(n,r,t),e.forEach(e=>{let t=document.createElement(`li`);this._applyLiStyle(t,e),e.fragments.forEach(e=>{let n=document.createElement(`span`);this._applySpanStyle(n,e),this._applyFragmentContent(n,e),t.appendChild(n)}),r.appendChild(t)}),n.appendChild(r),n}_patchDom(e,t,n,r){let i=e.firstChild;this._applyRootStyle(e,i,n),r&&this._hide(e);let a=i.children;for(let e=0;e<t.length;e++){let n=a[e];this._applyLiStyle(n,t[e]);let r=t[e].fragments,i=n.children;for(let e=0;e<r.length;e++){let t=i[e];this._applySpanStyle(t,r[e]),this._applyFragmentContent(t,r[e])}}}measureDomText(e){let t=e.data??``,n=[];if(!t.length)return n;let r=document.createRange(),i=0;for(;i<t.length;){let a=t.codePointAt(i),o=i+(a>65535?2:1);r.setStart(e,i),r.setEnd(e,o);let s=r.getClientRects?.(),c;s&&s.length?(c=s[s.length-1],s.length>1&&c.width<2&&(c=s[s.length-2])):c=r.getBoundingClientRect(),c&&c.width+c.height!==0&&n.push({content:t.slice(i,o),top:c.top,left:c.left,width:c.width,height:c.height}),i=o}return n}measureDom(e){let t=[],n=[],r=[];return e.querySelectorAll(`li`).forEach((e,i)=>{let a=e.getBoundingClientRect();t.push({paragraphIndex:i,left:a.x,top:a.y,width:a.width,height:a.height}),e.querySelectorAll(`:scope > *`).forEach((e,t)=>{let a=e.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:t,left:a.x,top:a.y,width:a.width,height:a.height});let o=0,s=e=>{this.measureDomText(e).forEach(e=>{r.push({...e,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:t,characterIndex:o++,textWidth:-1,textHeight:-1})})};!e.children.length&&e.firstChild instanceof window.Text?s(e.firstChild):e.querySelectorAll(`:scope > *`).forEach(e=>{e.firstChild instanceof window.Text&&s(e.firstChild)})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){let n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(t=>{let r=e[t.paragraphIndex].lineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height}),r.fragments.forEach(t=>{let r=e[t.paragraphIndex].fragments[t.fragmentIndex].inlineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height});let i=[];return r.characters.forEach(t=>{let{paragraphIndex:r,fragmentIndex:a,characterIndex:o}=t,s=t.left-n.left,c=t.top-n.top;i.push({...t,newParagraphIndex:r,left:s,top:c});let{fontHeight:l,isVertical:u,inlineBox:d,lineBox:f}=e[r].fragments[a].characters[o];d.left=s,d.top=c,d.width=t.width,d.height=t.height,u?(f.left=s+(t.width-l)/2,f.top=c,f.width=l,f.height=t.height):(f.left=s,f.top=c+(t.height-l)/2,f.width=t.width,f.height=l)}),{paragraphs:e,boundingBox:new W(0,0,n.width,n.height)}}measure(e,t,n){return this.measureParagraphDom(e,n??this._mount(e,t))}_mount(e,t){let n=this._signature(e);if(this._mountedDom?.isConnected&&this._mountedSignature===n)return this._patchDom(this._mountedDom,e,t,!0),this._mountedDom;this._unmount();let r=this.createDom(e,t);return this._hide(r),ks().appendChild(r),this._mountedDom=r,this._mountedSignature=n,r}_unmount(){this._mountedDom?.parentNode?.removeChild(this._mountedDom),this._mountedDom=void 0,this._mountedSignature=void 0}dispose(){this._unmount()}};function js(){let e=new Nr,t=Pr(),n=Fr(t);return{name:`background`,pathSet:e,context:{loader:t,parser:n},load:async e=>{let{backgroundImage:n}=e.computedStyle;n&&t.needsLoad(n)&&await t.load(n)},update:t=>{e.paths.length=0;let{computedStyle:r,lineBox:i,isVertical:a}=t,{backgroundImage:o,backgroundSize:s,backgroundColormap:c}=r;if(O(o))return;let{pathSet:l}=n.parse(o),u=l.getBoundingBox(!0)??new W,d,f,p,m;a?{x:f,y:d,width:m,height:p}=i:{x:d,y:f,width:p,height:m}=i;let h=zr(c??`none`),g=l.paths.map(e=>{let t=e.clone();return t.style.fill&&t.style.fill in h&&(t.style.fill=h[t.style.fill]),t.style.stroke&&t.style.stroke in h&&(t.style.stroke=h[t.style.stroke]),t}),_,v;if(s===`rigid`){_=t.fontSize*5/u.width,v=_;let e=new U;e.x=u.width-p/_,e.y=u.height-m/v,g.forEach(t=>{t.applyTransform(t=>{let n=t.x>u.left+u.width/2,r=t.y>u.top+u.height/2;n&&(t.x-=e.x),r&&(t.y-=e.y)})})}else _=p/u.width,v=m/u.height;let y=new Mn;y.translate(-u.x,-u.y),y.scale(_,v),a&&(y.translate(-p/2,-m/2),y.rotate(Math.PI/2),y.translate(m/2,p/2)),y.translate(d,f),g.forEach(e=>{e.applyTransform(y)}),e.paths.push(...g)},renderOrder:-2,render:t=>{let{text:n,context:r}=t,{lineBox:i,computedStyle:a}=n;O(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Nr([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function Ms(e,t){let{x:n,y:r}=t;if(e instanceof Dr){let{p1:t,cp:i,p2:a}=e,o=n!==void 0&&Math.abs(Math.sign(t.x-n)+Math.sign(i.x-n)+Math.sign(a.x-n))===1,s=r!==void 0&&Math.abs(Math.sign(t.y-r)+Math.sign(i.y-r)+Math.sign(a.y-r))===1,c,l,u,d;if(o&&(c=t.x-2*i.x+a.x,l=2*(-t.x+i.x),u=t.x-n),s&&(c=t.y-2*i.y+a.y,l=2*(-t.y+i.y),u=t.y-r),(o||s)&&(d=l*l-4*c*u,d>0)){let e=Math.sqrt(d),n=[(-l+e)/2/c,(-l-e)/2/c].find(e=>e>0&&e<1);if(n){let e=U.lerp(t,i,n),r=U.lerp(i,a,n),o=U.lerp(e,r,n);return[new Dr(t,e,o),new Dr(o.clone(),r,a)]}}}else if(e instanceof wr){let{p1:t,cp1:i,cp2:a,p2:o}=e,{min:s,max:c}=e.getMinMax(),l=n!==void 0&&(s.x-n)*(c.x-n)<0,u=r!==void 0&&(s.y-r)*(c.y-r)<0;if(l||u){n=.5*t.x+.5*i.x,r=.5*t.y+.5*i.y;let e=new U(n,r);n=.25*t.x+.5*i.x+.25*a.x,r=.25*t.y+.5*i.y+.25*a.y;let s=new U(n,r);n=.125*t.x+.375*i.x+.375*a.x+.125*o.x,r=.125*t.y+.375*i.y+.375*a.y+.125*o.y;let c=new U(n,r);n=.25*i.x+.5*a.x+.25*o.x,r=.25*i.y+.5*a.y+.25*o.y;let l=new U(n,r);n=.5*a.x+.5*o.x,r=.5*a.y+.5*o.y;let u=new U(n,r);return[new wr(t,e,s,c),new wr(c.clone(),l,u,o)]}}else if(e instanceof Sr){let{p1:t,p2:i}=e,a=n!==void 0&&(t.x-n)*(i.x-n)<0,o=r!==void 0&&(t.y-r)*(i.y-r)<0;if(a&&(r=t.y+(i.y-t.y)/(i.x-t.x)*(n-t.x)),o&&(n=t.x+(i.x-t.x)/(i.y-t.y)*(r-t.y)),a||o)return[new Sr(t,new U(n,r)),new Sr(new U(n,r),i)]}return[e]}var Ns=class{get boundingBox(){return this.text.lineBox}get paragraphs(){return this.text.paragraphs}get isHorizontal(){return this.text.computedStyle.writingMode.startsWith(`horizontal`)}get baseWidth(){return this.isHorizontal?this.boundingBox.width:this.boundingBox.height}get baseHeight(){return this.isHorizontal?this.boundingBox.height:this.boundingBox.width}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(e=>e.characters))}constructor({text:e,intensities:t=[],maxFontSize:n=100}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=n}_breakLine(){let e=!this.isHorizontal,{left:t,top:n,bottom:r,right:i}=this.boundingBox,a=.5*(t+i),o=.5*(n+r);this.characters.forEach(t=>{t.glyphBox&&t.path.curves.forEach(t=>{t.curves=t.curves.flatMap(t=>Ms(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Dr&&e.isFromLine){let{p1:t,cp:n,p2:r}=e;n.x=2*n.x-.5*(t.x+r.x),n.y=2*n.y-.5*(t.y+r.y)}})})}_lineToQuadraticBezier(){this.characters.forEach(e=>{e.glyphBox&&e.path.curves.forEach(e=>{e.curves=e.curves.map(e=>{if(e instanceof Sr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new Dr(t.clone(),new U(.5*(t.x+n.x),.5*(t.y+n.y)),n.clone());return r.isFromLine=!0,r}return e})})})}_transform(e,t,n){let r=this.text.plugins.get(`highlight`),i=n?.(),a=0,o=this.characters.filter(e=>e.glyphBox).length;this.paragraphs.forEach((n,s)=>{n.fragments.forEach((n,c)=>{n.characters.forEach((n,l)=>{if(!n.glyphBox)return;let u=t?.({paragraphIndex:s,fragmentIndex:c,characterIndex:l,character:n},i);if(n.path.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)}),t&&r?.pathSet?.paths){let t=r.pathSet.paths.length/o,n=a*t;for(let i=0;i<t;i++)r?.pathSet?.paths[n+i]?.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)});a++}})})}),this.paragraphs.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{e.glyphBox=e.getGlyphBoundingBox(),e.glyphBox&&(e.inlineBox=e.glyphBox)})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},Ps=class extends Ns{preset;constructor(e,t){super(e),this.preset=t}deform(){Math.hypot(...this.intensities)&&(this._lineToQuadraticBezier(),this._bend(),this._makeTheJointSmooth())}_bend(){let{boundingBox:e,baseWidth:t,baseHeight:n,preset:r}=this,i=this.lineHeight*2/Math.sin(this.intensities[0]*Math.PI*.5),a=r.vertical===void 0||r.vertical===`auto`?!this.isHorizontal:r.vertical,{left:o,top:s,width:c,height:l}=e,u=(a?l:c)/2/i,d={x:o+c/2,y:s+l/2},f,p={x:d.x,y:d.y};a?(f=0,p.x-=n/2/Math.tan(u)+Math.sign(u)*c/2):(f=1.5*Math.PI,p.y+=t/2/Math.tan(u)+Math.sign(u)*l/2);let m=r.transform({lineHeight:i,size:u,center:d,centerDist:p,centerDistAngle:f,width:c,height:l,isHorizontal:this.isHorizontal});this._transform(m)}},Fs=class{arcLengthDivisions=200;_cacheArcLengths;_needsUpdate=!1;getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;let t=[0],n=this.getPoint(0),r=0;for(let i=1;i<=e;i++){let a=this.getPoint(i/e);r+=a.distanceTo(n),t.push(r),n=a}return this._cacheArcLengths=t,t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t===void 0?e*n[r-1]:t,a=0,o=r-1,s=0;for(;a<=o;){s=Math.floor(a+(o-a)/2);let e=n[s]-i;if(e<0)a=s+1;else if(e>0)o=s-1;else{o=s;break}}if(s=o,n[s]===i)return s/(r-1);let c=n[s],l=n[s+1]-c,u=(i-c)/l;return(s+u)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}},Is=class extends Fs{curveT=0;getPoint(e,t=new U){return this.getCurve(e).getPoint(this.curveT,t)}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return this.getCurve(e).getTangent(this.curveT,t)}getNormal(e,t=new U){return this.getCurve(e).getNormal(this.curveT,t)}},Ls=class extends Fs{start;end;constructor(e,t){super(),this.start=e,this.end=t}getPoint(e,t=new U){return e===1?t.copyFrom(this.end):t.copyFrom(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.end,this.start).normalize()}},Rs=class extends Fs{center;radius;start;end;constructor(e,t,n=0,r=Math.PI*2){super(),this.center=e,this.radius=t,this.start=n,this.end=r}getPoint(e,t=new U){return t.copyFrom(this.center).add(this.getNormal(e).scale(this.radius))}getTangent(e,t=new U){let{x:n,y:r}=this.getNormal(e);return t.set(-r,n)}getNormal(e,t=new U){let{start:n,end:r}=this,i=e*(r-n)+n-.5*Math.PI;return t.set(Math.cos(i),Math.sin(i))}},zs=class extends Fs{center;radiusX;radiusY;rotation;startAngle;endAngle;clockwise;constructor(e=new U,t=1,n=1,r=0,i=0,a=Math.PI*2,o=!1){super(),this.center=e,this.radiusX=t,this.radiusY=n,this.rotation=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}getPoint(e,t=new U){let n=Math.PI*2,r=this.endAngle-this.startAngle,i=Math.abs(r)<2**-52;for(;r<0;)r+=n;for(;r>n;)r-=n;r<2**-52&&(r=i?0:n),this.clockwise&&!i&&(r=r===n?-n:r-n);let a=this.startAngle+e*r,o=this.center.x+this.radiusX*Math.cos(a),s=this.center.y+this.radiusY*Math.sin(a);if(this.rotation!==0){let e=Math.cos(this.rotation),t=Math.sin(this.rotation),n=o-this.center.x,r=s-this.center.y;o=n*e-r*t+this.center.x,s=n*t+r*e+this.center.y}return t.set(o,s)}},Bs=class extends Is{center;size;start;end;curves=[];constructor(e,t,n=0,r=1){super(),this.center=e,this.size=t,this.start=n,this.end=r,this.update()}update(){let{x:e,y:t}=this.center,n=new U(e+.5*this.size,t-.5*this.size),r=new U(e-.5*this.size,t-.5*this.size),i=new U(e,t+.5*this.size),a=new Rs(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new Rs(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new Rs(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),c=new U(e,t+this.size),l=new U(e+this.size,t),u=U.lerp(l,c,.75),d=new U(e-this.size,t),f=U.lerp(d,c,.75),p=new Ls(l,u),m=new Ls(f,d);return this.curves=[a,p,s,m,o],this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=9*Math.PI/8+1.5;let n=.5*Math.PI,r;return t<n?(r=0,this.curveT=t/n):t<n+.75?(r=1,this.curveT=(t-n)/.75):t<5*Math.PI/8+.75?(r=2,this.curveT=(t-n-.75)/(Math.PI/8)):t<5*Math.PI/8+1.5?(r=3,this.curveT=(t-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(t-5*Math.PI/8-1.5)/n),this.curves[r]}},Vs=class extends Is{center;radius;number;start;end;curves=[];points=[];constructor(e,t=0,n=0,r=0,i=1){super(),this.center=e,this.radius=t,this.number=n,this.start=r,this.end=i,this.update()}update(){for(let e=0;e<this.number;e++){let t=e*2*Math.PI/this.number;t-=.5*Math.PI,this.points.push(new U(this.radius*Math.cos(t),this.radius*Math.sin(t)).add(this.center))}for(let e=0;e<this.number;e++)this.curves.push(new Ls(this.points[e],this.points[(e+1)%this.number]));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1);let n=t*this.number,r=Math.floor(n);return this.curveT=n-r,this.curves[r]}},Hs=class extends Is{center;rx;aspectRatio;start;end;curves=[];constructor(e,t,n=1,r=0,i=1){super(),this.center=e,this.rx=t,this.aspectRatio=n,this.start=r,this.end=i,this.update()}update(){let{x:e,y:t}=this.center,n=this.rx,r=this.rx/this.aspectRatio,i=[new U(e-n,t-r),new U(e+n,t-r),new U(e+n,t+r),new U(e-n,t+r)];for(let e=0;e<4;e++)this.curves.push(new Ls(i[e].clone(),i[(e+1)%4].clone()));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=(1+this.aspectRatio)*2;let n;return t<this.aspectRatio?(n=0,this.curveT=t/this.aspectRatio):t<this.aspectRatio+1?(n=1,this.curveT=t-this.aspectRatio):t<2*this.aspectRatio+1?(n=2,this.curveT=(t-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=t-2*this.aspectRatio-1),this.curves[n]}},Us=class extends Ns{preset;constructor(e,t){super(e),this.preset=t}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this;e.breakLine&&this._breakLine(),e.lineToQuad&&this._lineToQuadraticBezier();let[t,n]=this.intensities,r=this._createFFDControlPoints(e.hBlocks,e.vBlocks);e.build(r,{a:t,b:n,baseWidth:this.baseWidth,baseHeight:this.baseHeight,lineHeight:this.lineHeight,adjust:(e,t,n)=>this._adjustControlPoints(e,{x:t,y:n})}),e.bezier?(this._calculateForBezierFFD(r,e.hBlocks,e.vBlocks),this._makeTheJointSmooth()):this._calculateForLinearFFD(r,e.hBlocks,e.vBlocks)}_calculateForFFD(e,t,n,r){let{left:i,top:a,right:o,width:s,height:c}=this.boundingBox;this._transform(this.isHorizontal?o=>{let l=(o.x-i)/s,u=(o.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,l);for(let n=0;n<r+2;n++){let o=e(r,n,u),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]}:i=>{let l=(o-i.x)/s,u=(i.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,u);for(let n=0;n<r+2;n++){let o=e(r,n,l),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]})}_createFFDControlPoints(e,t){let{left:n,top:r,right:i,width:a,height:o}=this.boundingBox,s=[];if(this.isHorizontal){let i=a/(e+1),c=o/(t+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(n+a*i,r+e*c))}else{let n=a/(t+1),c=o/(e+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(i-e*n,r+a*c))}return s}_adjustControlPoints(e,t){this.isHorizontal?(e.x+=t.x,e.y+=t.y):(e.x-=t.y,e.y+=t.x)}_factorialForFFD(e){let t=1;for(let n=2;n<=e;n++)t*=n;return t}_combineForFFD(e,t){return this._factorialForFFD(e)/this._factorialForFFD(e-t)/this._factorialForFFD(t)}_calculateForBezierFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._combineForFFD(e+1,t)*(1-n)**(e+1-t)*n**t,e,t,n)}_linearBasis(e,t,n){let r=t<n*e?t+1-n*e:n*e-t+1;return Math.max(0,r)}_calculateForLinearFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._linearBasis(e+1,t,n),e,t,n)}},Ws=class extends Ns{preset;constructor(e,t){super(e),this.preset=t}_context(){return{intensities:this.intensities,baseWidth:this.baseWidth,lineHeight:this.lineHeight,isHorizontal:this.isHorizontal,boundingBox:this.boundingBox}}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this,t=this._context();if(e.engine===`offset`)this._transform(e.point,e.perChar?n=>e.perChar(t,n):void 0);else{let n=e.followTangent??!0,{funcPerChar:r,funcPerPoint:i}=this._getPerCharAndPointFunc(n);this._transform(i,r,()=>{let{width:n,height:r,left:i,top:a}=this.boundingBox;return{width:n,height:r,left:i,top:a,curve:e.makeCurve(t),isHorizontal:this.isHorizontal,needExpandAlongNormal:e.expandAlongNormal??!1}})}}_getPerCharAndPointFunc(e=!1){let t,n;return e?(n=this._resetPointPos,t=this._calculateNewCenter):(n=this._resetPointPosWithoutRotate,t=this._calculateNewCenterWithoutRotate),{funcPerPoint:n,funcPerChar:t}}_calculateNewCenter({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s,needExpandAlongNormal:c=!1}=t,{center:l,centerDiviation:u}=e,d=s?(l.x-i)/n:(l.y-a)/r,f=s?new U(0,l.y-a):new U(l.x-i,0);if(c){let e=o.getNormal(d);f.x+=e.x*-u,f.y+=e.y*-u}let p=o.getPointAt(d).add(f),m=o.getTangent(d);return{cos:m.x,sin:m.y,newCenter:p,center:l}}_calculateNewCenterWithoutRotate({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s}=t,{center:c}=e,l=s?(c.x-i)/n:(c.y-a)/r,u=s?new U(0,c.y-a):new U(c.x-i,0);return{newCenter:o.getPointAt(l).add(u),center:c}}_resetPointPos(e,t){let{cos:n=1,sin:r=0,center:i,newCenter:a}=t,o=e.x-i.x,s=e.y-i.y;return[a.x+o*n-s*r,a.y+o*r+s*n]}_resetPointPosWithoutRotate(e,t){let{center:n,newCenter:r}=t;return[e.x-n.x+r.x,e.y-n.y+r.y]}},Gs=new Map;function Ks(e,t){Gs.set(e,t)}function qs(e){Gs.delete(e)}function Js(){return[...Gs.keys()]}function Ys(){return Ds({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Gs.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize},a;switch(r.engine){case`ffd`:a=new Us(i,r);break;case`bend`:a=new Ps(i,r);break;case`curve`:case`offset`:a=new Ws(i,r);break}a.deform();let o=e.getGlyphBox();e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Xs(e){let{highlight:t,highlightImage:n,highlightReferImage:r,highlightColormap:i,highlightLine:a,highlightSize:o,highlightThickness:s}=e;return{image:t?.image??n??`none`,referImage:t?.referImage??r??`none`,colormap:t?.colormap??i??`none`,line:t?.line??a??`none`,size:t?.size??o??`cover`,thickness:t?.thickness??s??`100%`}}function Zs(){let e=new Nr,t=[],n=Pr(),r=Fr(n);return Ds({name:`highlight`,pathSet:e,context:{clipRects:t,loader:n,parser:r},load:async e=>{let t=new Set;e.forEachCharacter(e=>{let{computedStyle:r}=e,{image:i,referImage:a}=Xs(r);i&&n.needsLoad(i)&&t.add(i),a&&n.needsLoad(a)&&t.add(a)}),await Promise.all(Array.from(t).map(e=>n.load(e)))},update:n=>{t.length=0,e.paths.length=0;let i=[],a,o;n.forEachCharacter(e=>{let{computedStyle:t}=e,n=Xs(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(O(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vr(o.image,r)&&Vr(o.colormap,s)&&Vr(o.line,c)&&Vr(o.size,l)&&Vr(o.thickness,u))&&a?.length&&(d?a[0].inlineBox.left===n.left:a[0].inlineBox.top===n.top)&&a[0].fontSize===f?a.push(e):(a=[],a.push(e),i.push(a))}o=n}),i=i.filter(e=>e.length);for(let n=0;n<i.length;n++){let a=i[n],o=a[0],s=W.from(...a.map(e=>e.compatibleGlyphBox));if(!s.height||!s.width)continue;let{computedStyle:c,isVertical:l,inlineBox:u,compatibleGlyphBox:d,strikeoutPosition:f,underlinePosition:p}=o,{fontSize:m}=c,{image:h,referImage:g,colormap:_,line:v,size:y,thickness:b}=Xs(c),x=Rr(b,{fontSize:m,total:s.width})/s.width,S=zr(_),{pathSet:C,dom:w}=r.parse(h),T=C.getBoundingBox(!0)??new W,E=m/T.width*2,D=new W().copy(s);l&&(D.width=s.height,D.height=s.width,D.left=s.left+s.width);let k=Math.floor(D.width),A=k;y!==`cover`&&(A=Rr(y,{fontSize:m,total:s.width})||k,D.width=A);let j=!O(g)&&O(v);if(j)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(O(v))if(T.width/T.height>4){e=`underline`;let t=w.getAttribute(`viewBox`);if(t){let[n,r,i,a]=t.split(` `).map(e=>Number(e)),o=r+a/2;e=T.y<o&&T.y+T.height>o?`line-through`:T.y+T.height<o?`overline`:`underline`}}else e=`outline`;else e=v;switch(e){case`outline`:{let e=D.width*.2,t=D.height*.2;l?(D.x-=t/2,D.y-=e/2,D.x-=D.height):(D.x-=e/2,D.y-=t/2),D.width+=e,D.height+=t;break}case`overline`:D.height=T.height*E,l?D.x=u.left+u.width:D.y=u.top;break;case`line-through`:D.height=T.height*E,l?D.x=u.left+u.width-f+D.height/2:D.y=u.top+f-D.height/2;break;case`underline`:D.height=T.height*E,l?D.x=d.left+d.width-p:D.y=u.top+p;break}}let M=new Mn;if(M.translate(-T.x,-T.y),M.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;j||M.translate(-e,-t),M.rotate(Math.PI/2),j||M.translate(t,e)}M.translate(D.x,D.y);for(let n=0;n<Math.ceil(k/A);n++){let r=M.clone();l?r.translate(0,n*D.width):r.translate(n*D.width,0),C.paths.forEach(n=>{let i=n.clone().applyTransform(r);i.style.strokeWidth&&(i.style.strokeWidth*=E*x),i.style.strokeMiterlimit&&(i.style.strokeMiterlimit*=E),i.style.strokeDashoffset&&(i.style.strokeDashoffset*=E),i.style.strokeDasharray&&(i.style.strokeDasharray=i.style.strokeDasharray.map(e=>e*E)),i.style.fill&&i.style.fill in S&&(i.style.fill=S[i.style.fill]),i.style.stroke&&i.style.stroke in S&&(i.style.stroke=S[i.style.stroke]),e.paths.push(i),k!==A&&(l?t[e.paths.length-1]=new W(s.left-s.width*2,s.top,s.width*4,s.height):t[e.paths.length-1]=new W(s.left,s.top-s.height*2,s.width,s.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{let n=[];return e.paths.forEach((e,r)=>{let i=t[r],a=e.getBoundingBox();if(i){let e=Math.max(a.x,i.x),t=Math.max(a.y,i.y),n=Math.min(a.right,i.right),r=Math.min(a.bottom,i.bottom);a=new W(e,t,n-e,r-t)}n.push(a)}),n.length?W.from(...n):void 0},render:n=>{let{text:r,context:i}=n;e.paths.forEach((e,a)=>{if(n.drawPath(e,{clipRect:t[a]}),r.debug){let t=new Nr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Qs(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
33
+ }`)),document.head.appendChild(n)}return this}_parseUrls(e){let t=[...new Set([...e.split(`,`),e])];return[...new Set(t.map(e=>this.familyToUrl.get(e.trim())??this.familyToUrl.get(e)??e))]}get(e){let t;return e&&(t=this._parseUrls(e).reduce((e,t)=>e||this.loaded.get(t),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(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>e.split(`,`).map(e=>e.trim())):[]}async load(e,t={}){let{cancelOther:n,injectStyleTag:r=!1,injectFontFace:i=!1,...a}=t,o,s;typeof e==`string`?o=e:{src:o,family:s}=e;let c=this._parseFamilies(s);if(this.loaded.has(o))return n&&(this.loading.forEach(e=>e.cancel()),this.loading.clear()),u(this.loaded.get(o));let l=this.loading.get(o);return l||(l=this._createRequest(o,a),this.loading.set(o,l)),n&&this.loading.forEach((e,t)=>{e!==l&&(e.cancel(),this.loading.delete(t))}),l.when.then(e=>{let n;return this.loaded.has(o)?n=u(this.loaded.get(o)):(n=d(e),t.noAdd||this.loaded.set(o,n)),Promise.all(Array.from(n.familySet,async t=>{if(this.familyToUrl.set(t,o),typeof document<`u`&&(i&&await this.injectFontFace(t,e),r&&this.injectStyleTag(t,o),i||r))return await document.fonts.load(`14px "${t}"`)})).then(()=>n)}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return d();throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}function d(e=new ArrayBuffer(0)){let t;function n(){return t||=e.byteLength?Ys(e,!1):void 0,t}function r(){let e=n();if(e instanceof Fs||e instanceof qs)return e.sfnt}return{src:o,family:s,buffer:e,familySet:new Set(c),getFont:n,getSFNT:r}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},Zs=new Set([`©`,`®`,`÷`]),Qs=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),$s={1:`italic`,32:`bold`},ec={1:`italic`,2:`bold`},tc={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},nc=class{content;index;parent;path=new Mr().setMeta(this);lineBox=new W;inlineBox=new W;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){let e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new W(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new W(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}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}constructor(e,t,n){this.content=e,this.index=t,this.parent=n}_getFontSFNT(e){let t=this.computedStyle.fontFamily,n=e??Xs,r=(t?n.get(t):n.fallbackFont)?.getSFNT();return r?.textToGlyphIndexes(this.content).includes(0)&&(r=n.fallbackFont?.getSFNT()),r}updateGlyph(e=this._getFontSFNT()){if(!e)return this;let{hhea:t,os2:n,post:r,head:i}=e,a=i.unitsPerEm,o=t.ascent,s=t.descent,{content:c,computedStyle:l}=this,{fontSize:u}=l,d=a/u,f=e.getAdvanceWidth(c,u),p=(o+Math.abs(s))/d,m=o/d;return this.advanceWidth=f,this.advanceHeight=p,this.underlinePosition=(o-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(o-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=o/d,this.descender=s/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.version>1?n.sxHeight/d:0,this.capHeight=n.version>1?n.sCapHeight/d:0,this.baseline=m,this.centerDiviation=p/2-m,this.fontStyle=$s[n.fsSelection]??ec[i.macStyle],this}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let{isVertical:n,content:r,computedStyle:i,baseline:a,inlineBox:o,ascender:s,descender:c,typoAscender:l,fontStyle:u,advanceWidth:d,advanceHeight:f}=this,{left:p,top:m}=o,h=i.fontStyle===`italic`&&u!==`italic`,g=p,_=m+a,v,y=new Mr().setMeta(this);if(n&&(g+=(f-d)/2,Math.abs(d-f)>.1&&(_-=(s-l)/(s+Math.abs(c))*f),v=void 0),n&&!Zs.has(r)&&(r.codePointAt(0)<=256||Qs.has(r))){y.addCommands(t.getPathCommands(r,g,m+a-(f-d)/2,i.fontSize));let e={y:m-(f-d)/2+f/2,x:g+d/2};h&&this._italic(y,{x:e.x,y:m-(f-d)/2+a}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(r,g,_,i.fontSize)),h&&this._italic(y,n?{x:g+f/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,i.fontSize)),h&&this._italic(y,n?{x:g+d/2,y:m+l/(s+Math.abs(c))*f}:void 0));let b=i.fontWeight??400;return b in tc&&(b===700||b===`bold`)&&u!==`bold`&&y.bold(tc[b]*i.fontSize*.05),y.style=A({fill:i.color,fillRule:`nonzero`,stroke:i.textStrokeWidth?i.textStrokeColor:void 0,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:void 0}),this.path=y,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){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){let t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;let{min:n,max:r}=t;return new W(n.x,n.y,r.x-n.x,r.y-n.y)}},rc=class{content;style;fill;outline;index;parent;inlineBox=new W;get computedContent(){let e=this.computedStyle;return e.textTransform===`uppercase`?this.content.toUpperCase():e.textTransform===`lowercase`?this.content.toLowerCase():this.content}constructor(e,t={},n,r,i,a){this.content=e,this.style=t,this.fill=n,this.outline=r,this.index=i,this.parent=a,this.update().initCharacters()}update(){this.computedStyle={...this.parent.computedStyle,...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new nc(n,t++,this));return this.characters=e,this}},ic=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...A(this.parent.computedStyle),...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}};function ac(e){return e}var oc;function sc(){if(oc?.isConnected)return oc;let e=document.createElement(`div`);return e.dataset.modernText=`measurer`,Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,visibility:`hidden`,pointerEvents:`none`}),document.body.appendChild(e),oc=e,e}var cc=class e{static notZeroStyles=new Set([`width`,`height`]);static pxStyles=new Set([`width`,`height`,`fontSize`,`letterSpacing`,`textStrokeWidth`,`textIndent`,`shadowOffsetX`,`shadowOffsetY`,`shadowBlur`,`margin`,`marginLeft`,`marginTop`,`marginRight`,`marginBottom`,`padding`,`paddingLeft`,`paddingTop`,`paddingRight`,`paddingBottom`]);_styleCache=new WeakMap;_mountedDom;_mountedSignature;_toDomStyle(t){let n=this._styleCache.get(t);if(n)return n;let r={},{notZeroStyles:i,pxStyles:a}=e;for(let e in t){let n=t[e];i.has(e)&&n===0||(r[e]=typeof n==`number`&&a.has(e)?`${n}px`:n)}return this._styleCache.set(t,r),r}_resolveRootStyles(e){let t={...e},n=e.writingMode.includes(`horizontal`);switch(e.textAlign){case`start`:case`left`:t.justifyContent=`flex-start`;break;case`center`:t.justifyContent=`center`;break;case`end`:case`right`:t.justifyContent=`flex-end`;break}switch(e.verticalAlign){case`top`:t.alignItems=`flex-start`;break;case`middle`:t.alignItems=`center`;break;case`bottom`:t.alignItems=`flex-end`;break}let r=!!(t.justifyContent||t.alignItems);return{section:{...this._toDomStyle({...t,boxSizing:t.boxSizing??`border-box`,display:t.display??(r?`inline-flex`:void 0),width:t.width??`max-content`,height:t.height??`max-content`}),whiteSpace:`pre-wrap`,wordBreak:`break-all`},ul:{verticalAlign:`inherit`,listStyleType:`inherit`,padding:`0`,margin:`0`,width:r&&n?`100%`:void 0,height:r&&!n?`100%`:void 0}}}_applyRootStyle(e,t,n){let r=this._resolveRootStyles(n);e.removeAttribute(`style`),Object.assign(e.style,r.section),t.removeAttribute(`style`),Object.assign(t.style,r.ul)}_applyLiStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applySpanStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applyFragmentContent(e,t){let n=e.firstChild;n?n.data!==t.content&&(n.data=t.content):e.appendChild(document.createTextNode(t.content))}_hide(e){e.style.visibility=`hidden`}_signature(e){let t=`${e.length}`;for(let n=0;n<e.length;n++)t+=`:${e[n].fragments.length}`;return t}createDom(e,t){let n=document.createElement(`section`),r=document.createElement(`ul`);return this._applyRootStyle(n,r,t),e.forEach(e=>{let t=document.createElement(`li`);this._applyLiStyle(t,e),e.fragments.forEach(e=>{let n=document.createElement(`span`);this._applySpanStyle(n,e),this._applyFragmentContent(n,e),t.appendChild(n)}),r.appendChild(t)}),n.appendChild(r),n}_patchDom(e,t,n,r){let i=e.firstChild;this._applyRootStyle(e,i,n),r&&this._hide(e);let a=i.children;for(let e=0;e<t.length;e++){let n=a[e];this._applyLiStyle(n,t[e]);let r=t[e].fragments,i=n.children;for(let e=0;e<r.length;e++){let t=i[e];this._applySpanStyle(t,r[e]),this._applyFragmentContent(t,r[e])}}}measureDomText(e){let t=e.data??``,n=[];if(!t.length)return n;let r=document.createRange(),i=0;for(;i<t.length;){let a=t.codePointAt(i),o=i+(a>65535?2:1);r.setStart(e,i),r.setEnd(e,o);let s=r.getClientRects?.(),c;s&&s.length?(c=s[s.length-1],s.length>1&&c.width<2&&(c=s[s.length-2])):c=r.getBoundingClientRect(),c&&c.width+c.height!==0&&n.push({content:t.slice(i,o),top:c.top,left:c.left,width:c.width,height:c.height}),i=o}return n}measureDom(e){let t=[],n=[],r=[];return e.querySelectorAll(`li`).forEach((e,i)=>{let a=e.getBoundingClientRect();t.push({paragraphIndex:i,left:a.x,top:a.y,width:a.width,height:a.height}),e.querySelectorAll(`:scope > *`).forEach((e,t)=>{let a=e.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:t,left:a.x,top:a.y,width:a.width,height:a.height});let o=0,s=e=>{this.measureDomText(e).forEach(e=>{r.push({...e,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:t,characterIndex:o++,textWidth:-1,textHeight:-1})})};!e.children.length&&e.firstChild instanceof window.Text?s(e.firstChild):e.querySelectorAll(`:scope > *`).forEach(e=>{e.firstChild instanceof window.Text&&s(e.firstChild)})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){let n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(t=>{let r=e[t.paragraphIndex].lineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height}),r.fragments.forEach(t=>{let r=e[t.paragraphIndex].fragments[t.fragmentIndex].inlineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height});let i=[];return r.characters.forEach(t=>{let{paragraphIndex:r,fragmentIndex:a,characterIndex:o}=t,s=t.left-n.left,c=t.top-n.top;i.push({...t,newParagraphIndex:r,left:s,top:c});let{fontHeight:l,isVertical:u,inlineBox:d,lineBox:f}=e[r].fragments[a].characters[o];d.left=s,d.top=c,d.width=t.width,d.height=t.height,u?(f.left=s+(t.width-l)/2,f.top=c,f.width=l,f.height=t.height):(f.left=s,f.top=c+(t.height-l)/2,f.width=t.width,f.height=l)}),{paragraphs:e,boundingBox:new W(0,0,n.width,n.height)}}measure(e,t,n){return this.measureParagraphDom(e,n??this._mount(e,t))}_mount(e,t){let n=this._signature(e);if(this._mountedDom?.isConnected&&this._mountedSignature===n)return this._patchDom(this._mountedDom,e,t,!0),this._mountedDom;this._unmount();let r=this.createDom(e,t);return this._hide(r),sc().appendChild(r),this._mountedDom=r,this._mountedSignature=n,r}_unmount(){this._mountedDom?.parentNode?.removeChild(this._mountedDom),this._mountedDom=void 0,this._mountedSignature=void 0}dispose(){this._unmount()}};function lc(e,t,n){return e[`${t}${n}`]??e[t]??0}var uc=class{measure(e,t,n,r){let i=r??Xs;for(let t of e)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:lc(e,`padding`,`Top`),right:lc(e,`padding`,`Right`),bottom:lc(e,`padding`,`Bottom`),left:lc(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=r?t.width-n.left-n.right:1/0,a=n.top,o=n.left;for(let t of e){let e=t.computedStyle,r=t.style,s=lc(r,`margin`,`Top`),c=lc(r,`margin`,`Bottom`),l=lc(r,`margin`,`Left`),u=lc(r,`margin`,`Right`),d=lc(r,`padding`,`Top`),f=lc(r,`padding`,`Bottom`),p=lc(r,`padding`,`Left`),m=lc(r,`padding`,`Right`),h=n.left+l+p,g=i===1/0?1/0:i-l-u-p-m;a+=s+d;let _=a,v=h,y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,o=0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),o+=this._advance(e);let s=h+r;if(g!==1/0){let e=g-r-o;b===`center`?s+=e/2:(b===`end`||b===`right`)&&(s+=e)}for(let e of n){let t=e.advanceWidth,n=e.advanceHeight,r=e.fontHeight;e.inlineBox.left=s,e.inlineBox.top=a+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,e.lineBox.left=s,e.lineBox.top=e.inlineBox.top+(n-r)/2,e.lineBox.width=t,e.lineBox.height=r,s+=this._advance(e)}s>v&&(v=s),a+=i}v>o&&(o=v);for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));t.lineBox.left=h,t.lineBox.top=_,t.lineBox.width=g===1/0?v-h:g,t.lineBox.height=a-_,a+=f+c}let s=a+n.bottom,c=r?t.width:o+n.right,l=typeof t.height==`number`?t.height:s;if(typeof t.height==`number`){let n=l-s,r=t.verticalAlign,i=r===`middle`?n/2:r===`bottom`?n:0;i&&this._shiftAll(e,i)}return{paragraphs:e,boundingBox:new W(0,0,c,l)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=r?t.height-n.top-n.bottom:1/0,a=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,i)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);a.push({chars:n,thickness:t})}}let o=a.reduce((e,t)=>e+t.thickness,0),s=typeof t.width==`number`,c=s?Math.max(t.width-n.left-n.right,o):o,l=n.left+c,u=n.top;for(let e of a){l-=e.thickness;let t=l,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight,o=n.fontHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,n.lineBox.left=n.inlineBox.left+(a-o)/2,n.lineBox.top=r,n.lineBox.width=o,n.lineBox.height=i,r+=this._advance(n)}r>u&&(u=r)}for(let t of e){for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));this._unionInto(t.lineBox,t.fragments.flatMap(e=>e.characters.map(e=>e.inlineBox)))}return{paragraphs:e,boundingBox:new W(0,0,s?t.width:c+n.left+n.right,r?t.height:u+n.bottom)}}_advance(e){return e.advanceWidth+(e.computedStyle.letterSpacing??0)}_breakLines(e,t){let n=[],r=[],i=0,a=()=>{n.push(r),r=[],i=0};for(let n of e.fragments)for(let e of n.characters){if(e.content===`
34
+ `||e.content===`\r`){a();continue}t!==1/0&&r.length>0&&i+e.advanceWidth>t&&a(),r.push(e),i+=this._advance(e)}return a(),n}_unionInto(e,t){let n=t.filter(e=>e.width!==0||e.height!==0);if(!n.length)return;let r=W.from(...n);e.left=r.left,e.top=r.top,e.width=r.width,e.height=r.height}_shiftAll(e,t){for(let n of e){n.lineBox.top+=t;for(let e of n.fragments){e.inlineBox.top+=t;for(let n of e.characters)n.inlineBox.top+=t,n.lineBox.top+=t}}}dispose(){}};function dc(){let e=new Nr,t=Pr(),n=Fr(t);return{name:`background`,pathSet:e,context:{loader:t,parser:n},load:async e=>{let{backgroundImage:n}=e.computedStyle;n&&t.needsLoad(n)&&await t.load(n)},update:t=>{e.paths.length=0;let{computedStyle:r,lineBox:i,isVertical:a}=t,{backgroundImage:o,backgroundSize:s,backgroundColormap:c}=r;if(O(o))return;let{pathSet:l}=n.parse(o),u=l.getBoundingBox(!0)??new W,d,f,p,m;a?{x:f,y:d,width:m,height:p}=i:{x:d,y:f,width:p,height:m}=i;let h=zr(c??`none`),g=l.paths.map(e=>{let t=e.clone();return t.style.fill&&t.style.fill in h&&(t.style.fill=h[t.style.fill]),t.style.stroke&&t.style.stroke in h&&(t.style.stroke=h[t.style.stroke]),t}),_,v;if(s===`rigid`){_=t.fontSize*5/u.width,v=_;let e=new U;e.x=u.width-p/_,e.y=u.height-m/v,g.forEach(t=>{t.applyTransform(t=>{let n=t.x>u.left+u.width/2,r=t.y>u.top+u.height/2;n&&(t.x-=e.x),r&&(t.y-=e.y)})})}else _=p/u.width,v=m/u.height;let y=new Mn;y.translate(-u.x,-u.y),y.scale(_,v),a&&(y.translate(-p/2,-m/2),y.rotate(Math.PI/2),y.translate(m/2,p/2)),y.translate(d,f),g.forEach(e=>{e.applyTransform(y)}),e.paths.push(...g)},renderOrder:-2,render:t=>{let{text:n,context:r}=t,{lineBox:i,computedStyle:a}=n;O(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Nr([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function fc(e,t){let{x:n,y:r}=t;if(e instanceof Dr){let{p1:t,cp:i,p2:a}=e,o=n!==void 0&&Math.abs(Math.sign(t.x-n)+Math.sign(i.x-n)+Math.sign(a.x-n))===1,s=r!==void 0&&Math.abs(Math.sign(t.y-r)+Math.sign(i.y-r)+Math.sign(a.y-r))===1,c,l,u,d;if(o&&(c=t.x-2*i.x+a.x,l=2*(-t.x+i.x),u=t.x-n),s&&(c=t.y-2*i.y+a.y,l=2*(-t.y+i.y),u=t.y-r),(o||s)&&(d=l*l-4*c*u,d>0)){let e=Math.sqrt(d),n=[(-l+e)/2/c,(-l-e)/2/c].find(e=>e>0&&e<1);if(n){let e=U.lerp(t,i,n),r=U.lerp(i,a,n),o=U.lerp(e,r,n);return[new Dr(t,e,o),new Dr(o.clone(),r,a)]}}}else if(e instanceof wr){let{p1:t,cp1:i,cp2:a,p2:o}=e,{min:s,max:c}=e.getMinMax(),l=n!==void 0&&(s.x-n)*(c.x-n)<0,u=r!==void 0&&(s.y-r)*(c.y-r)<0;if(l||u){n=.5*t.x+.5*i.x,r=.5*t.y+.5*i.y;let e=new U(n,r);n=.25*t.x+.5*i.x+.25*a.x,r=.25*t.y+.5*i.y+.25*a.y;let s=new U(n,r);n=.125*t.x+.375*i.x+.375*a.x+.125*o.x,r=.125*t.y+.375*i.y+.375*a.y+.125*o.y;let c=new U(n,r);n=.25*i.x+.5*a.x+.25*o.x,r=.25*i.y+.5*a.y+.25*o.y;let l=new U(n,r);n=.5*a.x+.5*o.x,r=.5*a.y+.5*o.y;let u=new U(n,r);return[new wr(t,e,s,c),new wr(c.clone(),l,u,o)]}}else if(e instanceof Sr){let{p1:t,p2:i}=e,a=n!==void 0&&(t.x-n)*(i.x-n)<0,o=r!==void 0&&(t.y-r)*(i.y-r)<0;if(a&&(r=t.y+(i.y-t.y)/(i.x-t.x)*(n-t.x)),o&&(n=t.x+(i.x-t.x)/(i.y-t.y)*(r-t.y)),a||o)return[new Sr(t,new U(n,r)),new Sr(new U(n,r),i)]}return[e]}var pc=class{get boundingBox(){return this.text.lineBox}get paragraphs(){return this.text.paragraphs}get isHorizontal(){return this.text.computedStyle.writingMode.startsWith(`horizontal`)}get baseWidth(){return this.isHorizontal?this.boundingBox.width:this.boundingBox.height}get baseHeight(){return this.isHorizontal?this.boundingBox.height:this.boundingBox.width}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(e=>e.characters))}constructor({text:e,intensities:t=[],maxFontSize:n=100}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=n}_breakLine(){let e=!this.isHorizontal,{left:t,top:n,bottom:r,right:i}=this.boundingBox,a=.5*(t+i),o=.5*(n+r);this.characters.forEach(t=>{t.glyphBox&&t.path.curves.forEach(t=>{t.curves=t.curves.flatMap(t=>fc(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Dr&&e.isFromLine){let{p1:t,cp:n,p2:r}=e;n.x=2*n.x-.5*(t.x+r.x),n.y=2*n.y-.5*(t.y+r.y)}})})}_lineToQuadraticBezier(){this.characters.forEach(e=>{e.glyphBox&&e.path.curves.forEach(e=>{e.curves=e.curves.map(e=>{if(e instanceof Sr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new Dr(t.clone(),new U(.5*(t.x+n.x),.5*(t.y+n.y)),n.clone());return r.isFromLine=!0,r}return e})})})}_transform(e,t,n){let r=this.text.plugins.get(`highlight`),i=n?.(),a=0,o=this.characters.filter(e=>e.glyphBox).length;this.paragraphs.forEach((n,s)=>{n.fragments.forEach((n,c)=>{n.characters.forEach((n,l)=>{if(!n.glyphBox)return;let u=t?.({paragraphIndex:s,fragmentIndex:c,characterIndex:l,character:n},i);if(n.path.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)}),t&&r?.pathSet?.paths){let t=r.pathSet.paths.length/o,n=a*t;for(let i=0;i<t;i++)r?.pathSet?.paths[n+i]?.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)});a++}})})}),this.paragraphs.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{e.glyphBox=e.getGlyphBoundingBox(),e.glyphBox&&(e.inlineBox=e.glyphBox)})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},mc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}deform(){Math.hypot(...this.intensities)&&(this._lineToQuadraticBezier(),this._bend(),this._makeTheJointSmooth())}_bend(){let{boundingBox:e,baseWidth:t,baseHeight:n,preset:r}=this,i=this.lineHeight*2/Math.sin(this.intensities[0]*Math.PI*.5),a=r.vertical===void 0||r.vertical===`auto`?!this.isHorizontal:r.vertical,{left:o,top:s,width:c,height:l}=e,u=(a?l:c)/2/i,d={x:o+c/2,y:s+l/2},f,p={x:d.x,y:d.y};a?(f=0,p.x-=n/2/Math.tan(u)+Math.sign(u)*c/2):(f=1.5*Math.PI,p.y+=t/2/Math.tan(u)+Math.sign(u)*l/2);let m=r.transform({lineHeight:i,size:u,center:d,centerDist:p,centerDistAngle:f,width:c,height:l,isHorizontal:this.isHorizontal});this._transform(m)}},hc=class{arcLengthDivisions=200;_cacheArcLengths;_needsUpdate=!1;getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;let t=[0],n=this.getPoint(0),r=0;for(let i=1;i<=e;i++){let a=this.getPoint(i/e);r+=a.distanceTo(n),t.push(r),n=a}return this._cacheArcLengths=t,t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t===void 0?e*n[r-1]:t,a=0,o=r-1,s=0;for(;a<=o;){s=Math.floor(a+(o-a)/2);let e=n[s]-i;if(e<0)a=s+1;else if(e>0)o=s-1;else{o=s;break}}if(s=o,n[s]===i)return s/(r-1);let c=n[s],l=n[s+1]-c,u=(i-c)/l;return(s+u)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}},gc=class extends hc{curveT=0;getPoint(e,t=new U){return this.getCurve(e).getPoint(this.curveT,t)}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return this.getCurve(e).getTangent(this.curveT,t)}getNormal(e,t=new U){return this.getCurve(e).getNormal(this.curveT,t)}},_c=class extends hc{start;end;constructor(e,t){super(),this.start=e,this.end=t}getPoint(e,t=new U){return e===1?t.copyFrom(this.end):t.copyFrom(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.end,this.start).normalize()}},vc=class extends hc{center;radius;start;end;constructor(e,t,n=0,r=Math.PI*2){super(),this.center=e,this.radius=t,this.start=n,this.end=r}getPoint(e,t=new U){return t.copyFrom(this.center).add(this.getNormal(e).scale(this.radius))}getTangent(e,t=new U){let{x:n,y:r}=this.getNormal(e);return t.set(-r,n)}getNormal(e,t=new U){let{start:n,end:r}=this,i=e*(r-n)+n-.5*Math.PI;return t.set(Math.cos(i),Math.sin(i))}},yc=class extends hc{center;radiusX;radiusY;rotation;startAngle;endAngle;clockwise;constructor(e=new U,t=1,n=1,r=0,i=0,a=Math.PI*2,o=!1){super(),this.center=e,this.radiusX=t,this.radiusY=n,this.rotation=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}getPoint(e,t=new U){let n=Math.PI*2,r=this.endAngle-this.startAngle,i=Math.abs(r)<2**-52;for(;r<0;)r+=n;for(;r>n;)r-=n;r<2**-52&&(r=i?0:n),this.clockwise&&!i&&(r=r===n?-n:r-n);let a=this.startAngle+e*r,o=this.center.x+this.radiusX*Math.cos(a),s=this.center.y+this.radiusY*Math.sin(a);if(this.rotation!==0){let e=Math.cos(this.rotation),t=Math.sin(this.rotation),n=o-this.center.x,r=s-this.center.y;o=n*e-r*t+this.center.x,s=n*t+r*e+this.center.y}return t.set(o,s)}},bc=class extends gc{center;size;start;end;curves=[];constructor(e,t,n=0,r=1){super(),this.center=e,this.size=t,this.start=n,this.end=r,this.update()}update(){let{x:e,y:t}=this.center,n=new U(e+.5*this.size,t-.5*this.size),r=new U(e-.5*this.size,t-.5*this.size),i=new U(e,t+.5*this.size),a=new vc(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new vc(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new vc(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),c=new U(e,t+this.size),l=new U(e+this.size,t),u=U.lerp(l,c,.75),d=new U(e-this.size,t),f=U.lerp(d,c,.75),p=new _c(l,u),m=new _c(f,d);return this.curves=[a,p,s,m,o],this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=9*Math.PI/8+1.5;let n=.5*Math.PI,r;return t<n?(r=0,this.curveT=t/n):t<n+.75?(r=1,this.curveT=(t-n)/.75):t<5*Math.PI/8+.75?(r=2,this.curveT=(t-n-.75)/(Math.PI/8)):t<5*Math.PI/8+1.5?(r=3,this.curveT=(t-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(t-5*Math.PI/8-1.5)/n),this.curves[r]}},xc=class extends gc{center;radius;number;start;end;curves=[];points=[];constructor(e,t=0,n=0,r=0,i=1){super(),this.center=e,this.radius=t,this.number=n,this.start=r,this.end=i,this.update()}update(){for(let e=0;e<this.number;e++){let t=e*2*Math.PI/this.number;t-=.5*Math.PI,this.points.push(new U(this.radius*Math.cos(t),this.radius*Math.sin(t)).add(this.center))}for(let e=0;e<this.number;e++)this.curves.push(new _c(this.points[e],this.points[(e+1)%this.number]));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1);let n=t*this.number,r=Math.floor(n);return this.curveT=n-r,this.curves[r]}},Sc=class extends gc{center;rx;aspectRatio;start;end;curves=[];constructor(e,t,n=1,r=0,i=1){super(),this.center=e,this.rx=t,this.aspectRatio=n,this.start=r,this.end=i,this.update()}update(){let{x:e,y:t}=this.center,n=this.rx,r=this.rx/this.aspectRatio,i=[new U(e-n,t-r),new U(e+n,t-r),new U(e+n,t+r),new U(e-n,t+r)];for(let e=0;e<4;e++)this.curves.push(new _c(i[e].clone(),i[(e+1)%4].clone()));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=(1+this.aspectRatio)*2;let n;return t<this.aspectRatio?(n=0,this.curveT=t/this.aspectRatio):t<this.aspectRatio+1?(n=1,this.curveT=t-this.aspectRatio):t<2*this.aspectRatio+1?(n=2,this.curveT=(t-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=t-2*this.aspectRatio-1),this.curves[n]}},Cc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this;e.breakLine&&this._breakLine(),e.lineToQuad&&this._lineToQuadraticBezier();let[t,n]=this.intensities,r=this._createFFDControlPoints(e.hBlocks,e.vBlocks);e.build(r,{a:t,b:n,baseWidth:this.baseWidth,baseHeight:this.baseHeight,lineHeight:this.lineHeight,adjust:(e,t,n)=>this._adjustControlPoints(e,{x:t,y:n})}),e.bezier?(this._calculateForBezierFFD(r,e.hBlocks,e.vBlocks),this._makeTheJointSmooth()):this._calculateForLinearFFD(r,e.hBlocks,e.vBlocks)}_calculateForFFD(e,t,n,r){let{left:i,top:a,right:o,width:s,height:c}=this.boundingBox;this._transform(this.isHorizontal?o=>{let l=(o.x-i)/s,u=(o.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,l);for(let n=0;n<r+2;n++){let o=e(r,n,u),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]}:i=>{let l=(o-i.x)/s,u=(i.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,u);for(let n=0;n<r+2;n++){let o=e(r,n,l),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]})}_createFFDControlPoints(e,t){let{left:n,top:r,right:i,width:a,height:o}=this.boundingBox,s=[];if(this.isHorizontal){let i=a/(e+1),c=o/(t+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(n+a*i,r+e*c))}else{let n=a/(t+1),c=o/(e+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(i-e*n,r+a*c))}return s}_adjustControlPoints(e,t){this.isHorizontal?(e.x+=t.x,e.y+=t.y):(e.x-=t.y,e.y+=t.x)}_factorialForFFD(e){let t=1;for(let n=2;n<=e;n++)t*=n;return t}_combineForFFD(e,t){return this._factorialForFFD(e)/this._factorialForFFD(e-t)/this._factorialForFFD(t)}_calculateForBezierFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._combineForFFD(e+1,t)*(1-n)**(e+1-t)*n**t,e,t,n)}_linearBasis(e,t,n){let r=t<n*e?t+1-n*e:n*e-t+1;return Math.max(0,r)}_calculateForLinearFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._linearBasis(e+1,t,n),e,t,n)}},wc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}_context(){return{intensities:this.intensities,baseWidth:this.baseWidth,lineHeight:this.lineHeight,isHorizontal:this.isHorizontal,boundingBox:this.boundingBox}}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this,t=this._context();if(e.engine===`offset`)this._transform(e.point,e.perChar?n=>e.perChar(t,n):void 0);else{let n=e.followTangent??!0,{funcPerChar:r,funcPerPoint:i}=this._getPerCharAndPointFunc(n);this._transform(i,r,()=>{let{width:n,height:r,left:i,top:a}=this.boundingBox;return{width:n,height:r,left:i,top:a,curve:e.makeCurve(t),isHorizontal:this.isHorizontal,needExpandAlongNormal:e.expandAlongNormal??!1}})}}_getPerCharAndPointFunc(e=!1){let t,n;return e?(n=this._resetPointPos,t=this._calculateNewCenter):(n=this._resetPointPosWithoutRotate,t=this._calculateNewCenterWithoutRotate),{funcPerPoint:n,funcPerChar:t}}_calculateNewCenter({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s,needExpandAlongNormal:c=!1}=t,{center:l,centerDiviation:u}=e,d=s?(l.x-i)/n:(l.y-a)/r,f=s?new U(0,l.y-a):new U(l.x-i,0);if(c){let e=o.getNormal(d);f.x+=e.x*-u,f.y+=e.y*-u}let p=o.getPointAt(d).add(f),m=o.getTangent(d);return{cos:m.x,sin:m.y,newCenter:p,center:l}}_calculateNewCenterWithoutRotate({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s}=t,{center:c}=e,l=s?(c.x-i)/n:(c.y-a)/r,u=s?new U(0,c.y-a):new U(c.x-i,0);return{newCenter:o.getPointAt(l).add(u),center:c}}_resetPointPos(e,t){let{cos:n=1,sin:r=0,center:i,newCenter:a}=t,o=e.x-i.x,s=e.y-i.y;return[a.x+o*n-s*r,a.y+o*r+s*n]}_resetPointPosWithoutRotate(e,t){let{center:n,newCenter:r}=t;return[e.x-n.x+r.x,e.y-n.y+r.y]}},Tc=new Map;function Ec(e,t){Tc.set(e,t)}function Dc(e){Tc.delete(e)}function Oc(){return[...Tc.keys()]}function kc(){return ac({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Tc.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize},a;switch(r.engine){case`ffd`:a=new Cc(i,r);break;case`bend`:a=new mc(i,r);break;case`curve`:case`offset`:a=new wc(i,r);break}a.deform();let o=e.getGlyphBox();e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Ac(e){let{highlight:t,highlightImage:n,highlightReferImage:r,highlightColormap:i,highlightLine:a,highlightSize:o,highlightThickness:s}=e;return{image:t?.image??n??`none`,referImage:t?.referImage??r??`none`,colormap:t?.colormap??i??`none`,line:t?.line??a??`none`,size:t?.size??o??`cover`,thickness:t?.thickness??s??`100%`}}function jc(){let e=new Nr,t=[],n=Pr(),r=Fr(n);return ac({name:`highlight`,pathSet:e,context:{clipRects:t,loader:n,parser:r},load:async e=>{let t=new Set;e.forEachCharacter(e=>{let{computedStyle:r}=e,{image:i,referImage:a}=Ac(r);i&&n.needsLoad(i)&&t.add(i),a&&n.needsLoad(a)&&t.add(a)}),await Promise.all(Array.from(t).map(e=>n.load(e)))},update:n=>{t.length=0,e.paths.length=0;let i=[],a,o;n.forEachCharacter(e=>{let{computedStyle:t}=e,n=Ac(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(O(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vr(o.image,r)&&Vr(o.colormap,s)&&Vr(o.line,c)&&Vr(o.size,l)&&Vr(o.thickness,u))&&a?.length&&(d?a[0].inlineBox.left===n.left:a[0].inlineBox.top===n.top)&&a[0].fontSize===f?a.push(e):(a=[],a.push(e),i.push(a))}o=n}),i=i.filter(e=>e.length);for(let n=0;n<i.length;n++){let a=i[n],o=a[0],s=W.from(...a.map(e=>e.compatibleGlyphBox));if(!s.height||!s.width)continue;let{computedStyle:c,isVertical:l,inlineBox:u,compatibleGlyphBox:d,strikeoutPosition:f,underlinePosition:p}=o,{fontSize:m}=c,{image:h,referImage:g,colormap:_,line:v,size:y,thickness:b}=Ac(c),x=Rr(b,{fontSize:m,total:s.width})/s.width,S=zr(_),{pathSet:C,dom:w}=r.parse(h),T=C.getBoundingBox(!0)??new W,E=m/T.width*2,D=new W().copy(s);l&&(D.width=s.height,D.height=s.width,D.left=s.left+s.width);let k=Math.floor(D.width),A=k;y!==`cover`&&(A=Rr(y,{fontSize:m,total:s.width})||k,D.width=A);let j=!O(g)&&O(v);if(j)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(O(v))if(T.width/T.height>4){e=`underline`;let t=w.getAttribute(`viewBox`);if(t){let[n,r,i,a]=t.split(` `).map(e=>Number(e)),o=r+a/2;e=T.y<o&&T.y+T.height>o?`line-through`:T.y+T.height<o?`overline`:`underline`}}else e=`outline`;else e=v;switch(e){case`outline`:{let e=D.width*.2,t=D.height*.2;l?(D.x-=t/2,D.y-=e/2,D.x-=D.height):(D.x-=e/2,D.y-=t/2),D.width+=e,D.height+=t;break}case`overline`:D.height=T.height*E,l?D.x=u.left+u.width:D.y=u.top;break;case`line-through`:D.height=T.height*E,l?D.x=u.left+u.width-f+D.height/2:D.y=u.top+f-D.height/2;break;case`underline`:D.height=T.height*E,l?D.x=d.left+d.width-p:D.y=u.top+p;break}}let M=new Mn;if(M.translate(-T.x,-T.y),M.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;j||M.translate(-e,-t),M.rotate(Math.PI/2),j||M.translate(t,e)}M.translate(D.x,D.y);for(let n=0;n<Math.ceil(k/A);n++){let r=M.clone();l?r.translate(0,n*D.width):r.translate(n*D.width,0),C.paths.forEach(n=>{let i=n.clone().applyTransform(r);i.style.strokeWidth&&(i.style.strokeWidth*=E*x),i.style.strokeMiterlimit&&(i.style.strokeMiterlimit*=E),i.style.strokeDashoffset&&(i.style.strokeDashoffset*=E),i.style.strokeDasharray&&(i.style.strokeDasharray=i.style.strokeDasharray.map(e=>e*E)),i.style.fill&&i.style.fill in S&&(i.style.fill=S[i.style.fill]),i.style.stroke&&i.style.stroke in S&&(i.style.stroke=S[i.style.stroke]),e.paths.push(i),k!==A&&(l?t[e.paths.length-1]=new W(s.left-s.width*2,s.top,s.width*4,s.height):t[e.paths.length-1]=new W(s.left,s.top-s.height*2,s.width,s.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{let n=[];return e.paths.forEach((e,r)=>{let i=t[r],a=e.getBoundingBox();if(i){let e=Math.max(a.x,i.x),t=Math.max(a.y,i.y),n=Math.min(a.right,i.right),r=Math.min(a.bottom,i.bottom);a=new W(e,t,n-e,r-t)}n.push(a)}),n.length?W.from(...n):void 0},render:n=>{let{text:r,context:i}=n;e.paths.forEach((e,a)=>{if(n.drawPath(e,{clipRect:t[a]}),r.debug){let t=new Nr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Mc(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
34
35
  <circle cx="${e}" cy="${e}" r="${e}" fill="${t}" />
35
- </svg>`}function $s(){let e=new Nr;return Ds({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=zr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Qs(e,String(o));break}}if(!p)return;let m=lr(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Rr(f,{total:i,fontSize:i})/i,y=new Mn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function ec(){return{name:`outline`}}function tc(){let e=new Nr;return Ds({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Ir(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function nc(){let e=new Nr;return Ds({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Mr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Mr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function rc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function ic(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var ac,oc=et(),sc=class extends ae{needsUpdate=!0;computedStyle={...oc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new As;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(js()).use(ec()).use($s()).use(nc()).use(Zs()).use(tc()).use(Ys()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all(Array.from(this.plugins.values()).map(e=>e.load?.(this)))}_update(){this.computedStyle={...oc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new Es(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new Ts(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){return this._update(),this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Hr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};ic([ie({internal:!0}),rc(`design:type`,Boolean)],sc.prototype,`debug`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`content`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`style`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`effects`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`fill`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`outline`,void 0),ic([ie(),rc(`design:type`,Object)],sc.prototype,`deformation`,void 0),ic([ie({internal:!0}),rc(`design:type`,typeof(ac=typeof HTMLElement<`u`&&HTMLElement)==`function`?ac:Object)],sc.prototype,`measureDom`,void 0),ic([ie({internal:!0}),rc(`design:type`,Object)],sc.prototype,`fonts`,void 0);function cc(e,t){let n=new sc(e);return t?n.load().then(()=>n.measure()):n.measure()}function lc(e,t){let n=new sc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Hr,e.Character=ws,e.CircleCurve=Rs,e.EllipseCurve=zs,e.Fragment=Ts,e.HeartCurve=Bs,e.Measurer=As,e.Paragraph=Es,e.PolygonCurve=Vs,e.RectangularCurve=Hs,e.Text=sc,e.backgroundPlugin=js,e.createSvgLoader=Pr,e.createSvgParser=Fr,e.defineDeformation=Ks,e.definePlugin=Ds,e.deformationPlugin=Ys,e.getDeformationNames=Js,e.getEffectTransform2D=Ir,e.getHighlightStyle=Xs,e.highlightPlugin=Zs,e.isEqualObject=Br,e.isEqualValue=Vr,e.listStylePlugin=$s,e.measureText=cc,e.outlinePlugin=ec,e.parseColormap=zr,e.parseTransformOrigin=Lr,e.parseValueNumber=Rr,e.removeDeformation=qs,e.renderPlugin=tc,e.renderText=lc,e.textDecorationPlugin=nc,e.textDefaultStyle=oc});
36
+ </svg>`}function Nc(){let e=new Nr;return ac({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=zr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Mc(e,String(o));break}}if(!p)return;let m=lr(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Rr(f,{total:i,fontSize:i})/i,y=new Mn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function Pc(){return{name:`outline`}}function Fc(){let e=new Nr;return ac({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Ir(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function Ic(){let e=new Nr;return ac({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Mr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Mr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function Lc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Rc(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var zc,Bc=et(),Vc=class extends ae{needsUpdate=!0;computedStyle={...Bc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new cc;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);if(e.measurer&&typeof e.measurer!=`string`)this.measurer=e.measurer;else{let t=e.measurer??(a?`font`:`dom`);this.measurer=t===`font`?new uc:new cc}this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(dc()).use(Pc()).use(Nc()).use(Ic()).use(jc()).use(Fc()).use(kc()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all(Array.from(this.plugins.values()).map(e=>e.load?.(this)))}_update(){this.computedStyle={...Bc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new ic(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new rc(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){if(this._update(),!this.measurer.createDom)throw Error(`current measurer does not support createDom()`);return this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e,this.fonts);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Hr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose?.(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};Rc([ie({internal:!0}),Lc(`design:type`,Boolean)],Vc.prototype,`debug`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`content`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`style`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`effects`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`fill`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`outline`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`deformation`,void 0),Rc([ie({internal:!0}),Lc(`design:type`,typeof(zc=typeof HTMLElement<`u`&&HTMLElement)==`function`?zc:Object)],Vc.prototype,`measureDom`,void 0),Rc([ie({internal:!0}),Lc(`design:type`,Object)],Vc.prototype,`fonts`,void 0);function Hc(e,t){let n=new Vc(e);return t?n.load().then(()=>n.measure()):n.measure()}function Uc(e,t){let n=new Vc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Hr,e.Character=nc,e.CircleCurve=vc,e.DomMeasurer=cc,e.EllipseCurve=yc,e.FontMeasurer=uc,e.Fragment=rc,e.HeartCurve=bc,e.Paragraph=ic,e.PolygonCurve=xc,e.RectangularCurve=Sc,e.Text=Vc,e.backgroundPlugin=dc,e.createSvgLoader=Pr,e.createSvgParser=Fr,e.defineDeformation=Ec,e.definePlugin=ac,e.deformationPlugin=kc,e.getDeformationNames=Oc,e.getEffectTransform2D=Ir,e.getHighlightStyle=Ac,e.highlightPlugin=jc,e.isEqualObject=Br,e.isEqualValue=Vr,e.listStylePlugin=Nc,e.measureText=Hc,e.outlinePlugin=Pc,e.parseColormap=zr,e.parseTransformOrigin=Lr,e.parseValueNumber=Rr,e.removeDeformation=Dc,e.renderPlugin=Fc,e.renderText=Uc,e.textDecorationPlugin=Ic,e.textDefaultStyle=Bc});