modern-text 2.2.0 → 2.2.2

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.
@@ -1,6 +1,6 @@
1
- import { D as DeformationPreset } from '../shared/modern-text.xspsgB0_.cjs';
1
+ import { D as DeformationPreset } from '../shared/modern-text.C7rfDrCg.cjs';
2
2
  import 'modern-path2d';
3
- import '../shared/modern-text.Byk6gnkH.cjs';
3
+ import '../shared/modern-text.DzKfafj6.cjs';
4
4
  import 'modern-idoc';
5
5
  import 'modern-font';
6
6
 
@@ -1,6 +1,6 @@
1
- import { D as DeformationPreset } from '../shared/modern-text.DwLgm6ho.mjs';
1
+ import { D as DeformationPreset } from '../shared/modern-text.C2l8Y0PX.mjs';
2
2
  import 'modern-path2d';
3
- import '../shared/modern-text.Byk6gnkH.mjs';
3
+ import '../shared/modern-text.DzKfafj6.mjs';
4
4
  import 'modern-idoc';
5
5
  import 'modern-font';
6
6
 
@@ -1,6 +1,6 @@
1
- import { D as DeformationPreset } from '../shared/modern-text.kLi3S9Iu.js';
1
+ import { D as DeformationPreset } from '../shared/modern-text.BGZEf3ha.js';
2
2
  import 'modern-path2d';
3
- import '../shared/modern-text.Byk6gnkH.js';
3
+ import '../shared/modern-text.DzKfafj6.js';
4
4
  import 'modern-idoc';
5
5
  import 'modern-font';
6
6
 
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Text = require('./shared/modern-text.BcZoLKzl.cjs');
3
+ const Text = require('./shared/modern-text.DoajDfJ6.cjs');
4
4
  const deformation = require('./shared/modern-text.NnJOuHzn.cjs');
5
5
  const curves = require('./shared/modern-text.MC5bIC9E.cjs');
6
6
  require('modern-font');
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.Byk6gnkH.cjs';
2
- export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.Byk6gnkH.cjs';
1
+ import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.DzKfafj6.cjs';
2
+ export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.DzKfafj6.cjs';
3
3
  import { Fonts } from 'modern-font';
4
4
  import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
5
5
  import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
6
- import { D as DeformationPreset } from './shared/modern-text.xspsgB0_.cjs';
7
- export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.xspsgB0_.cjs';
6
+ import { D as DeformationPreset } from './shared/modern-text.C7rfDrCg.cjs';
7
+ export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.C7rfDrCg.cjs';
8
8
 
9
9
  declare function definePlugin(options: Plugin): Plugin;
10
10
 
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.Byk6gnkH.mjs';
2
- export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.Byk6gnkH.mjs';
1
+ import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.DzKfafj6.mjs';
2
+ export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.DzKfafj6.mjs';
3
3
  import { Fonts } from 'modern-font';
4
4
  import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
5
5
  import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
6
- import { D as DeformationPreset } from './shared/modern-text.DwLgm6ho.mjs';
7
- export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.DwLgm6ho.mjs';
6
+ import { D as DeformationPreset } from './shared/modern-text.C2l8Y0PX.mjs';
7
+ export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.C2l8Y0PX.mjs';
8
8
 
9
9
  declare function definePlugin(options: Plugin): Plugin;
10
10
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.Byk6gnkH.js';
2
- export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.Byk6gnkH.js';
1
+ import { P as Plugin, T as TextMeasurer, a as Paragraph, M as MeasurerResult, C as Character, O as Options, b as MeasureResult, R as RenderOptions, c as Text } from './shared/modern-text.DzKfafj6.js';
2
+ export { d as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, e as TextEvents, t as textDefaultStyle } from './shared/modern-text.DzKfafj6.js';
3
3
  import { Fonts } from 'modern-font';
4
4
  import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
5
5
  import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
6
- import { D as DeformationPreset } from './shared/modern-text.kLi3S9Iu.js';
7
- export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.kLi3S9Iu.js';
6
+ import { D as DeformationPreset } from './shared/modern-text.BGZEf3ha.js';
7
+ export { B as BendContext, a as BendPreset, C as CurvePreset, b as DeformationCharInfo, c as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.BGZEf3ha.js';
8
8
 
9
9
  declare function definePlugin(options: Plugin): Plugin;
10
10
 
package/dist/index.js CHANGED
@@ -28,10 +28,10 @@ ${t}`);return n.documentElement}else return e}var Wr=`px`,Gr=90,Kr=[`mm`,`cm`,`i
28
28
  xmlns="http://www.w3.org/2000/svg"
29
29
  >
30
30
  ${this.paths.map(e=>e.toSvgPathString()).join(``)}
31
- </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 Pi(){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 Fi(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=Ur(i);r={dom:e,pathSet:ci(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 Ni}}}return r}return{parsed:t,parse:n}}function Ii(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}=Li(r??`center`,o,s,c,l),f=new jr;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Li(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 Ri(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 zi(e){return L(e)?{}:e}function Bi(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vi(e[n],t[n]))}function Vi(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Bi(e,t):e===t:!1}var Hi=class{text;context;pixelRatio=window?.devicePixelRatio||1;region;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,n=this.text.boundingBox,r=this.region,i=n.left+(r?.x??0),a=n.top+(r?.y??0),o=r?.width??n.width,s=r?.height??n.height,c=t.canvas;c.dataset.viewBox=String(`${i} ${a} ${o} ${s}`),c.dataset.pixelRatio=String(e),c.width=Math.max(1,Math.ceil(o*e)),c.height=Math.max(1,Math.ceil(s*e)),c.style.width=`${o}px`,c.style.height=`${s}px`,t.clearRect(0,0,c.width,c.height),t.scale(e,e),t.translate(-i,-a)};_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`&&Oe(e)&&(e=ke(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;if(![n,r,i,a,o].every(Number.isFinite))return s?.find(e=>e?.color)?.color??`transparent`;let 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){let t=Number.isFinite(e.offset)?Math.min(1,Math.max(0,e.offset)):0;try{v.addColorStop(t,e.color)}catch{}}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{...B(n),...B(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}=Ii(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(),Sn(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())}},Ui={},Wi=(function(e,t,n,r,i){var a=new Worker(Ui[t]||(Ui[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}),Gi=Uint8Array,Ki=Uint16Array,qi=Int32Array,Ji=new Gi([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]),Yi=new Gi([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]),Xi=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zi=function(e,t){for(var n=new Ki(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new qi(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}},Qi=Zi(Ji,2),$i=Qi.b,ea=Qi.r;$i[28]=258,ea[258]=28;for(var ta=Zi(Yi,0),na=ta.b,ra=ta.r,ia=new Ki(32768),q=0;q<32768;++q){var aa=(q&43690)>>1|(q&21845)<<1;aa=(aa&52428)>>2|(aa&13107)<<2,aa=(aa&61680)>>4|(aa&3855)<<4,ia[q]=((aa&65280)>>8|(aa&255)<<8)>>1}for(var oa=(function(e,t,n){for(var r=e.length,i=0,a=new Ki(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ki(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ki(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[ia[d]>>c]=l}else for(s=new Ki(r),i=0;i<r;++i)e[i]&&(s[i]=ia[o[e[i]-1]++]>>15-e[i]);return s}),sa=new Gi(288),q=0;q<144;++q)sa[q]=8;for(var q=144;q<256;++q)sa[q]=9;for(var q=256;q<280;++q)sa[q]=7;for(var q=280;q<288;++q)sa[q]=8;for(var ca=new Gi(32),q=0;q<32;++q)ca[q]=5;var la=oa(sa,9,0),ua=oa(sa,9,1),da=oa(ca,5,0),fa=oa(ca,5,1),pa=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ma=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ha=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ga=function(e){return(e+7)/8|0},_a=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gi(e.subarray(t,n))},va=[`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`],ya=function(e,t,n){var r=Error(t||va[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ya),!n)throw r;return r},ba=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Gi(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Gi(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Gi(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=ma(e,d,1);var v=ma(e,d+1,3);if(d+=3,!v){var y=ga(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&ya(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=ua,m=fa,h=9,g=5;else if(v==2){var S=ma(e,d,31)+257,C=ma(e,d+10,15)+4,w=S+ma(e,d+5,31)+1;d+=14;for(var T=new Gi(w),E=new Gi(19),D=0;D<C;++D)E[Xi[D]]=ma(e,d+D*3,7);d+=C*3;for(var O=pa(E),k=(1<<O)-1,A=oa(E,O,1),D=0;D<w;){var j=A[ma(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+ma(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+ma(e,d,7),d+=3):y==18&&(N=11+ma(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=pa(P),g=pa(F),p=oa(P,h,1),m=oa(F,g,1)}else ya(1);if(d>_){c&&ya(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[ha(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&ya(0);break}if(M||ya(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=Ji[D];B=ma(e,d,(1<<V)-1)+$i[D],d+=V}var ee=m[ha(e,d)&L],te=ee>>4;ee||ya(3),d+=ee&15;var F=na[te];if(te>3){var V=Yi[te];F+=ha(e,d)&(1<<V)-1,d+=V}if(d>_){c&&ya(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&&ya(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?_a(n,0,f):n.subarray(0,f)},xa=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Sa=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},Ca=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:Aa,l:0};if(i==1){var o=new Gi(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 Ki(f+1),m=wa(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 Gi(p),l:m}},wa=function(e,t,n){return e.s==-1?Math.max(wa(e.l,t,n+1),wa(e.r,t,n+1)):t[e.s]=n},Ta=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ki(++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}},Ea=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Da=function(e,t,n){var r=n.length,i=ga(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},Oa=function(e,t,n,r,i,a,o,s,c,l,u){xa(t,u++,n),++i[256];for(var d=Ca(i,15),f=d.t,p=d.l,m=Ca(a,15),h=m.t,g=m.l,_=Ta(f),v=_.c,y=_.n,b=Ta(h),x=b.c,S=b.n,C=new Ki(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=Ca(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Xi[O-1]];--O);var k=l+5<<3,A=Ea(i,sa)+Ea(a,ca)+o,j=Ea(i,f)+Ea(a,h)+o+14+3*O+Ea(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Da(t,u,e.subarray(c,c+l));var M,N,P,F;if(xa(t,u,1+(j<A)),u+=2,j<A){M=oa(f,p,0),N=f,P=oa(h,g,0),F=h;var I=oa(E,D,0);xa(t,u,y-257),xa(t,u+5,S-1),xa(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)xa(t,u+3*w,E[Xi[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;xa(t,u,I[B]),u+=E[B],B>15&&(xa(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=la,N=sa,P=da,F=ca;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Sa(t,u,M[B+257]),u+=N[B+257],B>7&&(xa(t,u,V>>23&31),u+=Ji[B]);var ee=V&31;Sa(t,u,P[ee]),u+=F[ee],ee>3&&(Sa(t,u,V>>5&8191),u+=Yi[ee])}else Sa(t,u,M[V]),u+=N[V]}return Sa(t,u,M[256]),u+N[256]},ka=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Aa=new Gi(0),ja=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Gi(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=ka[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Ki(32768),g=a.h||new Ki(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new qi(25e3),x=new Ki(288),S=new Ki(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=Oa(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|ea[P]<<18|ra[F];var ie=ea[P]&31,ae=ra[F]&31;w+=Ji[ie]+Yi[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=Oa(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=Da(c,u+1,e.subarray(T,oe))}a.i=o}return _a(s,0,r+ga(u)+i)},Ma=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}}},Na=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Gi(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ja(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)},Pa=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},Fa=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},Ia=[],La=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},Ra=function(e,t,n,r){if(!Ia[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Fa(e[s],i,a);Ia[n]={c:Fa(e[o],i,a),e:a}}var c=Pa({},Ia[n].e);return Wi(Ia[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,La(c),r)},za=function(){return[Gi,Ki,qi,Ji,Yi,Xi,$i,na,ua,fa,ia,va,oa,pa,ma,ha,ga,_a,ya,ba,Xa,Ua,Wa]},Ba=function(){return[Gi,Ki,qi,Ji,Yi,Xi,ea,ra,la,sa,da,ca,ia,ka,Aa,oa,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ga,_a,ja,Na,Ya,Ua]},Va=function(){return[qa,Ka,Ma]},Ha=function(){return[Ja]},Ua=function(e){return postMessage(e,[e.buffer])},Wa=function(e){return e&&{out:e.size&&new Gi(e.size),dictionary:e.dictionary}},Ga=function(e,t,n,r,i,a){var o=Ra(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ka=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},qa=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=Ma();i.p(t.dictionary),Ka(e,2,i.d())}},Ja=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&ya(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&ya(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Ya(e,t){return Na(e,t||{},0,0)}function Xa(e,t){return ba(e,{i:2},t&&t.out,t&&t.dictionary)}function Za(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[Ba,Va,function(){return[Qa]}],function(e){return Ua(Qa(e.data[0],e.data[1]))},4,n)}function Qa(e,t){t||={};var n=Ma();n.p(e);var r=Na(e,t,t.dictionary?6:2,4);return qa(r,t),Ka(r,r.length-4,n.d()),r}function $a(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[za,Ha,function(){return[eo]}],function(e){return Ua(eo(e.data[0],Wa(e.data[1])))},5,n)}function eo(e,t){return ba(e.subarray(Ja(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var to=typeof TextDecoder<`u`&&new TextDecoder;try{to.decode(Aa,{stream:!0})}catch{}var no=`modern-font`;function ro(e,t){if(!e)throw Error(`[${no}] ${t}`)}function io(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 ao(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function oo(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 so(e){e=oo(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 co(e){return new TextDecoder().decode(Uint8Array.from(e))}function lo(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 uo={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},fo=class extends DataView{constructor(e,t,n,r){super(io(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+=uo[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+=uo[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=ao(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}},po=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=po.get(e);a||(a={columns:[],byteLength:0},po.set(e,a));let o={...t,name:i,byteLength:n*uo[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+uo[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 mo=class{view;constructor(e,t,n,r){this.view=new fo(e,t,n,r)}},ho=class extends mo{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)}},go=Object.defineProperty,_o=(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&&go(t,n,i),i},vo=class e extends ho{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=so(r.fontFamily||``),a=i.length,o=so(r.fontSubFamily||``),s=o.length,c=so(r.version||``),l=c.length,u=so(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}};_o([J(`uint32`)],vo.prototype,`EOTSize`),_o([J(`uint32`)],vo.prototype,`FontDataSize`),_o([J(`uint32`)],vo.prototype,`Version`),_o([J(`uint32`)],vo.prototype,`Flags`),_o([J({type:`uint8`,size:10})],vo.prototype,`FontPANOSE`),_o([J(`uint8`)],vo.prototype,`Charset`),_o([J(`uint8`)],vo.prototype,`Italic`),_o([J(`uint32`)],vo.prototype,`Weight`),_o([J(`uint16`)],vo.prototype,`fsType`),_o([J(`uint16`)],vo.prototype,`MagicNumber`),_o([J({type:`uint32`,size:4})],vo.prototype,`UnicodeRange`),_o([J({type:`uint8`,size:8})],vo.prototype,`CodePageRange`),_o([J(`uint32`)],vo.prototype,`CheckSumAdjustment`),_o([J({type:`uint8`,size:16})],vo.prototype,`Reserved`),_o([J(`uint16`)],vo.prototype,`Padding1`);var yo=`AAEAAAAKAIAAAwAgT1MvMl9CWIkAAACsAAAAYGNtYXAADAAmAAABDAAAACRnbHlmA74GaAAAATAAAAAkaGVhZGEnQtkAAAFUAAAANmhoZWEFegHiAAABjAAAACRobXR4AlgAUAAAAbAAAAAEbG9jYQAAABIAAAG0AAAABG1heHAAAwAGAAABuAAAACBuYW1lAu8GwwAAAdgAAAAucG9zdP+fADIAAAIIAAAAIAADAlgBkAAFAAACigK8AAAAAAKKArwAAAHgADIBLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOT05FAEAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAAACvAAAACAAAAAAAAEAAwABAAAADAAEABgAAAACAAIAAAAA//8AAP//AAEAAAABAFAAAAIIArwAAwAAAQEBAQBQAbgAAP5IAAAAAAK8AAAAAAABAAAAAQAACGtGkV8PPPUACwPoAAAAAAAAAAAAAAAAAAAAAAAA/zgCCAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAJYAFAAUAIIAAEAAAAAAAAAAAAAAAAAAAABAlgAUAAAABIAAQAAAAEABAABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAEAEgADAAEECQABABwAAABNAG8AZABlAHIAbgBGAGEAbABsAGIAYQBjAGsAAAADAAAAAAAA/5wAMgAAAAAAAAAAAAAAAAAAAAAAAAAA`;function bo(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}var xo=Object.defineProperty,So=(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&&xo(t,n,i),i},Co=class extends mo{constructor(e,t){super(e,t,16)}};So([J({type:`char`,size:4})],Co.prototype,`tag`),So([J(`uint32`)],Co.prototype,`checkSum`),So([J(`uint32`)],Co.prototype,`offset`),So([J(`uint32`)],Co.prototype,`length`);var wo=`................................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(`.`),To=`................................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(`.`),Eo=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 Do(this.getPathCommands(e,t,n,r,i),a)}};function Do(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 Oo=class extends Eo{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=wo[h.pop()],i=wo[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)}},ko=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}},Ao=class extends ko{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Oo({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},jo=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&&jo(t,n,i),i},No=class extends mo{_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)}};Mo([J(`uint16`)],No.prototype,`count`),Mo([J(`uint8`)],No.prototype,`offsetSize`);var Po=class extends No{_isString=!1},Fo=class extends No{_isString=!0},Io=`.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(`,`),Lo=`.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(`,`),Ro=`.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(`,`),zo=`.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 Bo(e,t){return t<=390?Io[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 Vo=class extends mo{_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?Bo(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},Ho=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&&Ho(t,n,i),i},Wo=class extends Vo{};Uo([Y(19)],Wo.prototype,`subrs`),Uo([Y(20)],Wo.prototype,`defaultWidthX`),Uo([Y(21)],Wo.prototype,`nominalWidthX`);var Go=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&&Go(t,n,i),i},Z=class extends Vo{};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 Ko(e,t=e){return n=>{qo.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(qo.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var qo=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,i=r.indexOf(n[e.codePointAt(0)]);t=i>=0?i:void 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 Do(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}},Jo=class extends mo{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},Yo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Zo=(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&&Yo(t,n,i),i},Qo=class extends Jo{_glyphs;get glyphs(){return this._glyphs??=new Ao(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 Fo(e,n),this.topDictIndex=new Po(e,this.nameIndex.endOffset),this.stringIndex=new Fo(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Po(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 Wo(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Po(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new Po(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Lo:this.topDict.charset===1?this.charset=Ro:this.topDict.charset===2?this.charset=zo:this.charset=this._readCharset(this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=wo:this.topDict.encoding===1?this.encoding=To:this.encoding=this._readEncoding(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(Bo(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(Bo(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(Bo(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}};Zo([J(`uint8`)],Qo.prototype,`majorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`minorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`headerSize`,2),Zo([J(`uint8`)],Qo.prototype,`offsetSize`,2),Qo=Zo([Ko(`CFF `,`cff`)],Qo);var $o=Object.defineProperty,es=(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},ts=class e extends mo{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}};es([J(`uint16`)],ts.prototype,`format`),es([J(`uint16`)],ts.prototype,`length`),es([J(`uint16`)],ts.prototype,`language`),es([J({type:`uint8`,size:256})],ts.prototype,`glyphIndexArray`);var ns=ts,rs=Object.defineProperty,is=(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},as=class extends mo{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}};is([J(`uint16`)],as.prototype,`format`),is([J(`uint16`)],as.prototype,`length`),is([J(`uint16`)],as.prototype,`language`);function os(e){return e>32767?e-65536:e<-32767?e+65536:e}function ss(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:os(e-a)}):(i.start=Number(a),i.startId=e,i.delta=os(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var cs=Object.defineProperty,ls=(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&&cs(t,n,i),i},us=class e extends mo{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=ss(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}};ls([J(`uint16`)],us.prototype,`format`),ls([J(`uint16`)],us.prototype,`length`),ls([J(`uint16`)],us.prototype,`language`),ls([J(`uint16`)],us.prototype,`segCountX2`),ls([J(`uint16`)],us.prototype,`searchRange`),ls([J(`uint16`)],us.prototype,`entrySelector`),ls([J(`uint16`)],us.prototype,`rangeShift`);var ds=us,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 extends mo{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}};ps([J(`uint16`)],ms.prototype,`format`),ps([J(`uint16`)],ms.prototype,`length`),ps([J(`uint16`)],ms.prototype,`language`),ps([J(`uint16`)],ms.prototype,`firstCode`),ps([J(`uint16`)],ms.prototype,`entryCount`);var hs=Object.defineProperty,gs=(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&&hs(t,n,i),i},_s=class e extends mo{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=ss(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}};gs([J(`uint16`)],_s.prototype,`format`),gs([J(`uint16`)],_s.prototype,`reserved`),gs([J(`uint32`)],_s.prototype,`length`),gs([J(`uint32`)],_s.prototype,`language`),gs([J(`uint32`)],_s.prototype,`nGroups`);var vs=_s,ys=Object.defineProperty,bs=(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&&ys(t,n,i),i},xs=class extends mo{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}};bs([J(`uint16`)],xs.prototype,`format`),bs([J(`uint32`)],xs.prototype,`length`),bs([J(`uint32`)],xs.prototype,`numVarSelectorRecords`);var 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 Jo{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=ds.from(e),r=ns.from(e),i=t?vs.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 Ts(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 ns(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new as(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new ds(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new ms(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new vs(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new xs(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()??[]])}};ws([J(`uint16`)],Ts.prototype,`version`,2),ws([J(`uint16`)],Ts.prototype,`numberSubtables`,2),Ts=ws([Ko(`cmap`)],Ts);var Es=class extends Eo{_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 ro(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();ro(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;ro(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(ro(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{ro(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}},Ds=class extends ko{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new Es({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Os=Object.getOwnPropertyDescriptor,ks=(e,t,n,r)=>{for(var i=r>1?void 0:r?Os(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},As=class extends Jo{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new As(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new Ds(this._sfnt)}};As=ks([Ko(`glyf`)],As);function js(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ms(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(js(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 Ns(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 Ps(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 Fs(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 Is(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Ls(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 Rs=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Bs=(e,t,n,r)=>{for(var i=r>1?void 0:r?zs(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&&Rs(t,n,i),i},Vs=class extends Jo{_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=Ls(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ms(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=Ns(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=Ps(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+Is(a)+Is(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=Ls(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:Fs(n,e+n.readUint16(e+8)),classDef2:Fs(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Is(a)+Is(o),valueFormat1:a})}};Bs([J(`uint16`)],Vs.prototype,`majorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`minorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`scriptListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`featureListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`lookupListOffset`,2),Vs=Bs([Ko(`GPOS`,`gpos`)],Vs);var Hs=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,Ws=(e,t,n,r)=>{for(var i=r>1?void 0:r?Us(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&&Hs(t,n,i),i},Gs=class extends Jo{_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}};Ws([J(`uint16`)],Gs.prototype,`majorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`minorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`scriptListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`featureListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`lookupListOffset`,2),Gs=Ws([Ko(`GSUB`,`gsub`)],Gs);var Ks=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,Js=(e,t,n,r)=>{for(var i=r>1?void 0:r?qs(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&&Ks(t,n,i),i},Ys=class extends Jo{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};Js([J(`fixed`)],Ys.prototype,`version`,2),Js([J(`fixed`)],Ys.prototype,`fontRevision`,2),Js([J(`uint32`)],Ys.prototype,`checkSumAdjustment`,2),Js([J(`uint32`)],Ys.prototype,`magickNumber`,2),Js([J(`uint16`)],Ys.prototype,`flags`,2),Js([J(`uint16`)],Ys.prototype,`unitsPerEm`,2),Js([J({type:`longDateTime`})],Ys.prototype,`created`,2),Js([J({type:`longDateTime`})],Ys.prototype,`modified`,2),Js([J(`int16`)],Ys.prototype,`xMin`,2),Js([J(`int16`)],Ys.prototype,`yMin`,2),Js([J(`int16`)],Ys.prototype,`xMax`,2),Js([J(`int16`)],Ys.prototype,`yMax`,2),Js([J(`uint16`)],Ys.prototype,`macStyle`,2),Js([J(`uint16`)],Ys.prototype,`lowestRecPPEM`,2),Js([J(`int16`)],Ys.prototype,`fontDirectionHint`,2),Js([J(`int16`)],Ys.prototype,`indexToLocFormat`,2),Js([J(`int16`)],Ys.prototype,`glyphDataFormat`,2),Ys=Js([Ko(`head`)],Ys);var Xs=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(e,t,n,r)=>{for(var i=r>1?void 0:r?Zs(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&&Xs(t,n,i),i},$s=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Qs([J(`fixed`)],$s.prototype,`version`,2),Qs([J(`int16`)],$s.prototype,`ascent`,2),Qs([J(`int16`)],$s.prototype,`descent`,2),Qs([J(`int16`)],$s.prototype,`lineGap`,2),Qs([J(`uint16`)],$s.prototype,`advanceWidthMax`,2),Qs([J(`int16`)],$s.prototype,`minLeftSideBearing`,2),Qs([J(`int16`)],$s.prototype,`minRightSideBearing`,2),Qs([J(`int16`)],$s.prototype,`xMaxExtent`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRise`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRun`,2),Qs([J(`int16`)],$s.prototype,`caretOffset`,2),Qs([J({type:`int16`,size:4})],$s.prototype,`reserved`,2),Qs([J(`int16`)],$s.prototype,`metricDataFormat`,2),Qs([J(`uint16`)],$s.prototype,`numOfLongHorMetrics`,2),$s=Qs([Ko(`hhea`)],$s);var ec=Object.getOwnPropertyDescriptor,tc=(e,t,n,r)=>{for(var i=r>1?void 0:r?ec(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},nc=class extends Jo{static from(e){let t=e.length*4,n=new nc(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()}))}};nc=tc([Ko(`hmtx`)],nc);var rc=Object.getOwnPropertyDescriptor,ic=(e,t,n,r)=>{for(var i=r>1?void 0:r?rc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ac=class extends Jo{_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}};ac=ic([Ko(`kern`,`kern`)],ac);var oc=Object.getOwnPropertyDescriptor,sc=(e,t,n,r)=>{for(var i=r>1?void 0:r?oc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},cc=class extends Jo{static from(e,t=1){let n=e.length*(t?4:2),r=new cc(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)}};cc=sc([Ko(`loca`)],cc);var lc=Object.defineProperty,uc=Object.getOwnPropertyDescriptor,dc=(e,t,n,r)=>{for(var i=r>1?void 0:r?uc(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&&lc(t,n,i),i},fc=class extends Jo{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};dc([J(`fixed`)],fc.prototype,`version`,2),dc([J(`uint16`)],fc.prototype,`numGlyphs`,2),dc([J(`uint16`)],fc.prototype,`maxPoints`,2),dc([J(`uint16`)],fc.prototype,`maxContours`,2),dc([J(`uint16`)],fc.prototype,`maxComponentPoints`,2),dc([J(`uint16`)],fc.prototype,`maxComponentContours`,2),dc([J(`uint16`)],fc.prototype,`maxZones`,2),dc([J(`uint16`)],fc.prototype,`maxTwilightPoints`,2),dc([J(`uint16`)],fc.prototype,`maxStorage`,2),dc([J(`uint16`)],fc.prototype,`maxFunctionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxInstructionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxStackElements`,2),dc([J(`uint16`)],fc.prototype,`maxSizeOfInstructions`,2),dc([J(`uint16`)],fc.prototype,`maxComponentElements`,2),dc([J(`uint16`)],fc.prototype,`maxComponentDepth`,2),fc=dc([Ko(`maxp`)],fc);var pc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,hc=(e,t,n,r)=>{for(var i=r>1?void 0:r?mc(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&&pc(t,n,i),i},gc={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`},_c={Macintosh:1,Microsoft:3},vc={Default:0},yc={UCS2:1},bc=class extends Jo{_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=_c.Macintosh,i=vc.Default,a=0;t.some(e=>e.platform===_c.Microsoft&&e.encoding===yc.UCS2&&e.language===1033)&&(r=_c.Microsoft,i=yc.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&&gc[e.nameId]&&(o[gc[e.nameId]]=a===0?co(e.name):lo(e.name))}return o}};hc([J(`uint16`)],bc.prototype,`format`,2),hc([J(`uint16`)],bc.prototype,`count`,2),hc([J(`uint16`)],bc.prototype,`stringOffset`,2),bc=hc([Ko(`name`)],bc);var xc=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?Sc(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&&xc(t,n,i),i},$=class extends Jo{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([Ko(`OS/2`,`os2`)],$);var Cc=`.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(`,`),wc=Object.defineProperty,Tc=Object.getOwnPropertyDescriptor,Ec=(e,t,n,r)=>{for(var i=r>1?void 0:r?Tc(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&&wc(t,n,i),i},Dc=class extends Jo{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return Cc.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?Cc[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Ec([J(`fixed`)],Dc.prototype,`format`,2),Ec([J(`fixed`)],Dc.prototype,`italicAngle`,2),Ec([J(`int16`)],Dc.prototype,`underlinePosition`,2),Ec([J(`int16`)],Dc.prototype,`underlineThickness`,2),Ec([J(`uint32`)],Dc.prototype,`isFixedPitch`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType1`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType1`,2),Dc=Ec([Ko(`post`)],Dc);var Oc=Object.defineProperty,kc=Object.getOwnPropertyDescriptor,Ac=(e,t,n,r)=>{for(var i=r>1?void 0:r?kc(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&&Oc(t,n,i),i},jc=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Ac([J(`fixed`)],jc.prototype,`version`,2),Ac([J(`int16`)],jc.prototype,`vertTypoAscender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoDescender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoLineGap`,2),Ac([J(`int16`)],jc.prototype,`advanceHeightMax`,2),Ac([J(`int16`)],jc.prototype,`minTopSideBearing`,2),Ac([J(`int16`)],jc.prototype,`minBottomSideBearing`,2),Ac([J(`int16`)],jc.prototype,`yMaxExtent`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRise`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRun`,2),Ac([J(`int16`)],jc.prototype,`caretOffset`,2),Ac([J({type:`int16`,size:4})],jc.prototype,`reserved`,2),Ac([J(`int16`)],jc.prototype,`metricDataFormat`,2),Ac([J(`int16`)],jc.prototype,`numOfLongVerMetrics`,2),jc=Ac([Ko(`vhea`)],jc);var Mc=Object.getOwnPropertyDescriptor,Nc=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Pc=class extends Jo{static from(e){let t=e.length*4,n=new Pc(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()}))}};Pc=Nc([Ko(`vmtx`)],Pc);var Fc=Object.defineProperty,Ic=(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&&Fc(t,n,i),i},Lc=class extends ho{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(ao(e).getUint32(0))}static checksum(e){let t=ao(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 Co(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new qo(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ic([J(`uint32`)],Lc.prototype,`scalerType`),Ic([J(`uint16`)],Lc.prototype,`numTables`),Ic([J(`uint16`)],Lc.prototype,`searchRange`),Ic([J(`uint16`)],Lc.prototype,`entrySelector`),Ic([J(`uint16`)],Lc.prototype,`rangeShift`);var Rc=class extends Lc{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},zc=class{static signature=1953784678;static is(e){let t=ao(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=ao(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 `)?Rc.from(e):Lc.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 qo(i)}},Bc=Object.defineProperty,Vc=(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&&Bc(t,n,i),i},Hc=class extends mo{constructor(e,t){super(e,t,20)}};Vc([J({type:`char`,size:4})],Hc.prototype,`tag`),Vc([J(`uint32`)],Hc.prototype,`offset`),Vc([J(`uint32`)],Hc.prototype,`compLength`),Vc([J(`uint32`)],Hc.prototype,`origLength`),Vc([J(`uint32`)],Hc.prototype,`origChecksum`);var Uc=Object.defineProperty,Wc=(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&&Uc(t,n,i),i};function Gc(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Kc(e){return new Promise((t,n)=>{Za(e,(e,r)=>e?n(e):t(r))})}function qc(e){return new Promise((t,n)=>{$a(e,(e,r)=>e?n(e):t(r))})}var Jc=class e extends ho{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Lc.is(this.flavor)?`TrueType`:Rc.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(ao(e).getUint32(0))}static checkSum(e){let t=ao(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,ao(Qa(Gc(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,ao(await Kc(Gc(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 Hc(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=eo(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 qo(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 qc(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new qo(new Map(e))}};Wc([J(`uint32`)],Jc.prototype,`signature`),Wc([J(`uint32`)],Jc.prototype,`flavor`),Wc([J(`uint32`)],Jc.prototype,`length`),Wc([J(`uint16`)],Jc.prototype,`numTables`),Wc([J(`uint16`)],Jc.prototype,`reserved`),Wc([J(`uint32`)],Jc.prototype,`totalSFNTSize`),Wc([J(`uint16`)],Jc.prototype,`majorVersion`),Wc([J(`uint16`)],Jc.prototype,`minorVersion`),Wc([J(`uint32`)],Jc.prototype,`metaOffset`),Wc([J(`uint32`)],Jc.prototype,`metaLength`),Wc([J(`uint32`)],Jc.prototype,`metaOrigLength`),Wc([J(`uint32`)],Jc.prototype,`privOffset`),Wc([J(`uint32`)],Jc.prototype,`privLength`);var Yc=Jc;function Xc(e,t=!0){if(Lc.is(e))return new Lc(e);if(Rc.is(e))return new Rc(e);if(Yc.is(e))return new Yc(e);if(zc.is(e)){let t=new zc(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function Zc(e,t=!0){let n=Xc(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var Qc=new class e{static defaultRequestInit={cache:`force-cache`};loading=new Map;loaded=new Map;familyToUrl=new Map;_loadListeners=new Set;on(e,t){return e===`load`&&this._loadListeners.add(t),this}off(e,t){return e===`load`&&this._loadListeners.delete(t),this}_emitLoad(e){this._loadListeners.forEach(t=>t(e))}_fallbackFont;get fallbackFont(){return this._fallbackFont}set fallbackFont(e){this._fallbackFont=e,e&&this._emitLoad(e)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){if(e!=null){this.fallbackFont=await this.load(e,t);return}let n=await this._loadSystemFallbackFont().catch(()=>void 0);this.fallbackFont=n??this._loadEmbeddedFallbackFont()}async _loadSystemFallbackFont(){let e=globalThis?.queryLocalFonts;if(typeof e!=`function`)return;let t=await e();if(!t?.length)return;let n=[`Arial`,`Helvetica`,`Helvetica Neue`,`Roboto`,`Segoe UI`,`Microsoft YaHei`,`PingFang SC`,`Noto Sans`],r=t.find(e=>n.includes(e.family))??t[0],i=await(await r.blob()).arrayBuffer(),a=r.family??r.fullName??r.postscriptName??`system-fallback`;return this._createLoadedFont(`local-font:${a}`,[a],i)}_loadEmbeddedFallbackFont(){let e=bo(yo);return this._createLoadedFont(`modern-font:embedded-fallback`,[`ModernFallback`],e)}_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
+ </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 Pi(){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 Fi(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=Ur(i);r={dom:e,pathSet:ci(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 Ni}}}return r}return{parsed:t,parse:n}}function Ii(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}=Li(r??`center`,o,s,c,l),f=new jr;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Li(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 Ri(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 zi(e){return L(e)?{}:e}function Bi(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vi(e[n],t[n]))}function Vi(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Bi(e,t):e===t:!1}var Hi=class{text;context;pixelRatio=window?.devicePixelRatio||1;region;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,n=this.text.boundingBox,r=this.region,i=n.left+(r?.x??0),a=n.top+(r?.y??0),o=r?.width??n.width,s=r?.height??n.height,c=t.canvas;c.dataset.viewBox=String(`${i} ${a} ${o} ${s}`),c.dataset.pixelRatio=String(e),c.width=Math.max(1,Math.ceil(o*e)),c.height=Math.max(1,Math.ceil(s*e)),c.style.width=`${o}px`,c.style.height=`${s}px`,t.clearRect(0,0,c.width,c.height),t.scale(e,e),t.translate(-i,-a)};_setupColors=()=>{this.uploadColor(this.text.glyphBox,{style:this.text.computedStyle,fill:this.text.computedFill,outline:this.text.computedOutline,effects:this.text.computedEffects}),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`&&Oe(e)&&(e=ke(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;if(![n,r,i,a,o].every(Number.isFinite))return s?.find(e=>e?.color)?.color??`transparent`;let 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){let t=Number.isFinite(e.offset)?Math.min(1,Math.max(0,e.offset)):0;try{v.addColorStop(t,e.color)}catch{}}return v}case`radial-gradient`:break}return e};_uploadedStyles=[`color`,`backgroundColor`,`textStrokeColor`];uploadColor=(e,t)=>{let{style:n,fill:r,outline:i,effects:a}=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)),a?.forEach(t=>{t.fill?.enabled&&t.fill.linearGradient&&(t.fill._linearGradient=this._parseColor({type:`linear-gradient`,...t.fill.linearGradient},e)),t.outline?.enabled&&t.outline.linearGradient&&(t.outline._linearGradient=this._parseColor({type:`linear-gradient`,...t.outline.linearGradient},e))})};_mergePathStyle(e,t){let n=e.style,r=t.stroke??n.stroke,i=t.strokeWidth?t.strokeWidth:n.strokeWidth;return{...B(n),...B(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._linearGradient??e.fill.color}),e.outline?.enabled&&(n={...n,stroke:e.outline._linearGradient??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}=Ii(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(),Sn(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())}},Ui={},Wi=(function(e,t,n,r,i){var a=new Worker(Ui[t]||(Ui[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}),Gi=Uint8Array,Ki=Uint16Array,qi=Int32Array,Ji=new Gi([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]),Yi=new Gi([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]),Xi=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zi=function(e,t){for(var n=new Ki(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new qi(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}},Qi=Zi(Ji,2),$i=Qi.b,ea=Qi.r;$i[28]=258,ea[258]=28;for(var ta=Zi(Yi,0),na=ta.b,ra=ta.r,ia=new Ki(32768),q=0;q<32768;++q){var aa=(q&43690)>>1|(q&21845)<<1;aa=(aa&52428)>>2|(aa&13107)<<2,aa=(aa&61680)>>4|(aa&3855)<<4,ia[q]=((aa&65280)>>8|(aa&255)<<8)>>1}for(var oa=(function(e,t,n){for(var r=e.length,i=0,a=new Ki(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ki(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ki(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[ia[d]>>c]=l}else for(s=new Ki(r),i=0;i<r;++i)e[i]&&(s[i]=ia[o[e[i]-1]++]>>15-e[i]);return s}),sa=new Gi(288),q=0;q<144;++q)sa[q]=8;for(var q=144;q<256;++q)sa[q]=9;for(var q=256;q<280;++q)sa[q]=7;for(var q=280;q<288;++q)sa[q]=8;for(var ca=new Gi(32),q=0;q<32;++q)ca[q]=5;var la=oa(sa,9,0),ua=oa(sa,9,1),da=oa(ca,5,0),fa=oa(ca,5,1),pa=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ma=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ha=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ga=function(e){return(e+7)/8|0},_a=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gi(e.subarray(t,n))},va=[`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`],ya=function(e,t,n){var r=Error(t||va[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ya),!n)throw r;return r},ba=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Gi(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Gi(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Gi(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=ma(e,d,1);var v=ma(e,d+1,3);if(d+=3,!v){var y=ga(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&ya(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=ua,m=fa,h=9,g=5;else if(v==2){var S=ma(e,d,31)+257,C=ma(e,d+10,15)+4,w=S+ma(e,d+5,31)+1;d+=14;for(var T=new Gi(w),E=new Gi(19),D=0;D<C;++D)E[Xi[D]]=ma(e,d+D*3,7);d+=C*3;for(var O=pa(E),k=(1<<O)-1,A=oa(E,O,1),D=0;D<w;){var j=A[ma(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+ma(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+ma(e,d,7),d+=3):y==18&&(N=11+ma(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=pa(P),g=pa(F),p=oa(P,h,1),m=oa(F,g,1)}else ya(1);if(d>_){c&&ya(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[ha(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&ya(0);break}if(M||ya(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=Ji[D];B=ma(e,d,(1<<V)-1)+$i[D],d+=V}var ee=m[ha(e,d)&L],te=ee>>4;ee||ya(3),d+=ee&15;var F=na[te];if(te>3){var V=Yi[te];F+=ha(e,d)&(1<<V)-1,d+=V}if(d>_){c&&ya(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&&ya(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?_a(n,0,f):n.subarray(0,f)},xa=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Sa=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},Ca=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:Aa,l:0};if(i==1){var o=new Gi(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 Ki(f+1),m=wa(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 Gi(p),l:m}},wa=function(e,t,n){return e.s==-1?Math.max(wa(e.l,t,n+1),wa(e.r,t,n+1)):t[e.s]=n},Ta=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ki(++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}},Ea=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Da=function(e,t,n){var r=n.length,i=ga(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},Oa=function(e,t,n,r,i,a,o,s,c,l,u){xa(t,u++,n),++i[256];for(var d=Ca(i,15),f=d.t,p=d.l,m=Ca(a,15),h=m.t,g=m.l,_=Ta(f),v=_.c,y=_.n,b=Ta(h),x=b.c,S=b.n,C=new Ki(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=Ca(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Xi[O-1]];--O);var k=l+5<<3,A=Ea(i,sa)+Ea(a,ca)+o,j=Ea(i,f)+Ea(a,h)+o+14+3*O+Ea(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Da(t,u,e.subarray(c,c+l));var M,N,P,F;if(xa(t,u,1+(j<A)),u+=2,j<A){M=oa(f,p,0),N=f,P=oa(h,g,0),F=h;var I=oa(E,D,0);xa(t,u,y-257),xa(t,u+5,S-1),xa(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)xa(t,u+3*w,E[Xi[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;xa(t,u,I[B]),u+=E[B],B>15&&(xa(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=la,N=sa,P=da,F=ca;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Sa(t,u,M[B+257]),u+=N[B+257],B>7&&(xa(t,u,V>>23&31),u+=Ji[B]);var ee=V&31;Sa(t,u,P[ee]),u+=F[ee],ee>3&&(Sa(t,u,V>>5&8191),u+=Yi[ee])}else Sa(t,u,M[V]),u+=N[V]}return Sa(t,u,M[256]),u+N[256]},ka=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Aa=new Gi(0),ja=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Gi(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=ka[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Ki(32768),g=a.h||new Ki(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new qi(25e3),x=new Ki(288),S=new Ki(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=Oa(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|ea[P]<<18|ra[F];var ie=ea[P]&31,ae=ra[F]&31;w+=Ji[ie]+Yi[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=Oa(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=Da(c,u+1,e.subarray(T,oe))}a.i=o}return _a(s,0,r+ga(u)+i)},Ma=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}}},Na=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Gi(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ja(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)},Pa=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},Fa=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},Ia=[],La=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},Ra=function(e,t,n,r){if(!Ia[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Fa(e[s],i,a);Ia[n]={c:Fa(e[o],i,a),e:a}}var c=Pa({},Ia[n].e);return Wi(Ia[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,La(c),r)},za=function(){return[Gi,Ki,qi,Ji,Yi,Xi,$i,na,ua,fa,ia,va,oa,pa,ma,ha,ga,_a,ya,ba,Xa,Ua,Wa]},Ba=function(){return[Gi,Ki,qi,Ji,Yi,Xi,ea,ra,la,sa,da,ca,ia,ka,Aa,oa,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ga,_a,ja,Na,Ya,Ua]},Va=function(){return[qa,Ka,Ma]},Ha=function(){return[Ja]},Ua=function(e){return postMessage(e,[e.buffer])},Wa=function(e){return e&&{out:e.size&&new Gi(e.size),dictionary:e.dictionary}},Ga=function(e,t,n,r,i,a){var o=Ra(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ka=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},qa=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=Ma();i.p(t.dictionary),Ka(e,2,i.d())}},Ja=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&ya(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&ya(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Ya(e,t){return Na(e,t||{},0,0)}function Xa(e,t){return ba(e,{i:2},t&&t.out,t&&t.dictionary)}function Za(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[Ba,Va,function(){return[Qa]}],function(e){return Ua(Qa(e.data[0],e.data[1]))},4,n)}function Qa(e,t){t||={};var n=Ma();n.p(e);var r=Na(e,t,t.dictionary?6:2,4);return qa(r,t),Ka(r,r.length-4,n.d()),r}function $a(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[za,Ha,function(){return[eo]}],function(e){return Ua(eo(e.data[0],Wa(e.data[1])))},5,n)}function eo(e,t){return ba(e.subarray(Ja(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var to=typeof TextDecoder<`u`&&new TextDecoder;try{to.decode(Aa,{stream:!0})}catch{}var no=`modern-font`;function ro(e,t){if(!e)throw Error(`[${no}] ${t}`)}function io(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 ao(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function oo(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 so(e){e=oo(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 co(e){return new TextDecoder().decode(Uint8Array.from(e))}function lo(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 uo={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},fo=class extends DataView{constructor(e,t,n,r){super(io(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+=uo[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+=uo[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=ao(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}},po=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=po.get(e);a||(a={columns:[],byteLength:0},po.set(e,a));let o={...t,name:i,byteLength:n*uo[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+uo[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 mo=class{view;constructor(e,t,n,r){this.view=new fo(e,t,n,r)}},ho=class extends mo{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)}},go=Object.defineProperty,_o=(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&&go(t,n,i),i},vo=class e extends ho{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=so(r.fontFamily||``),a=i.length,o=so(r.fontSubFamily||``),s=o.length,c=so(r.version||``),l=c.length,u=so(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}};_o([J(`uint32`)],vo.prototype,`EOTSize`),_o([J(`uint32`)],vo.prototype,`FontDataSize`),_o([J(`uint32`)],vo.prototype,`Version`),_o([J(`uint32`)],vo.prototype,`Flags`),_o([J({type:`uint8`,size:10})],vo.prototype,`FontPANOSE`),_o([J(`uint8`)],vo.prototype,`Charset`),_o([J(`uint8`)],vo.prototype,`Italic`),_o([J(`uint32`)],vo.prototype,`Weight`),_o([J(`uint16`)],vo.prototype,`fsType`),_o([J(`uint16`)],vo.prototype,`MagicNumber`),_o([J({type:`uint32`,size:4})],vo.prototype,`UnicodeRange`),_o([J({type:`uint8`,size:8})],vo.prototype,`CodePageRange`),_o([J(`uint32`)],vo.prototype,`CheckSumAdjustment`),_o([J({type:`uint8`,size:16})],vo.prototype,`Reserved`),_o([J(`uint16`)],vo.prototype,`Padding1`);var yo=`AAEAAAAKAIAAAwAgT1MvMl9CWIkAAACsAAAAYGNtYXAADAAmAAABDAAAACRnbHlmA74GaAAAATAAAAAkaGVhZGEnQtkAAAFUAAAANmhoZWEFegHiAAABjAAAACRobXR4AlgAUAAAAbAAAAAEbG9jYQAAABIAAAG0AAAABG1heHAAAwAGAAABuAAAACBuYW1lAu8GwwAAAdgAAAAucG9zdP+fADIAAAIIAAAAIAADAlgBkAAFAAACigK8AAAAAAKKArwAAAHgADIBLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOT05FAEAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAAACvAAAACAAAAAAAAEAAwABAAAADAAEABgAAAACAAIAAAAA//8AAP//AAEAAAABAFAAAAIIArwAAwAAAQEBAQBQAbgAAP5IAAAAAAK8AAAAAAABAAAAAQAACGtGkV8PPPUACwPoAAAAAAAAAAAAAAAAAAAAAAAA/zgCCAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAJYAFAAUAIIAAEAAAAAAAAAAAAAAAAAAAABAlgAUAAAABIAAQAAAAEABAABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAEAEgADAAEECQABABwAAABNAG8AZABlAHIAbgBGAGEAbABsAGIAYQBjAGsAAAADAAAAAAAA/5wAMgAAAAAAAAAAAAAAAAAAAAAAAAAA`;function bo(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}var xo=Object.defineProperty,So=(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&&xo(t,n,i),i},Co=class extends mo{constructor(e,t){super(e,t,16)}};So([J({type:`char`,size:4})],Co.prototype,`tag`),So([J(`uint32`)],Co.prototype,`checkSum`),So([J(`uint32`)],Co.prototype,`offset`),So([J(`uint32`)],Co.prototype,`length`);var wo=`................................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(`.`),To=`................................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(`.`),Eo=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 Do(this.getPathCommands(e,t,n,r,i),a)}};function Do(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 Oo=class extends Eo{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=wo[h.pop()],i=wo[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)}},ko=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}},Ao=class extends ko{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Oo({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},jo=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&&jo(t,n,i),i},No=class extends mo{_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)}};Mo([J(`uint16`)],No.prototype,`count`),Mo([J(`uint8`)],No.prototype,`offsetSize`);var Po=class extends No{_isString=!1},Fo=class extends No{_isString=!0},Io=`.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(`,`),Lo=`.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(`,`),Ro=`.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(`,`),zo=`.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 Bo(e,t){return t<=390?Io[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 Vo=class extends mo{_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?Bo(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},Ho=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&&Ho(t,n,i),i},Wo=class extends Vo{};Uo([Y(19)],Wo.prototype,`subrs`),Uo([Y(20)],Wo.prototype,`defaultWidthX`),Uo([Y(21)],Wo.prototype,`nominalWidthX`);var Go=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&&Go(t,n,i),i},Z=class extends Vo{};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 Ko(e,t=e){return n=>{qo.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(qo.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var qo=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,i=r.indexOf(n[e.codePointAt(0)]);t=i>=0?i:void 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 Do(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}},Jo=class extends mo{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},Yo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Zo=(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&&Yo(t,n,i),i},Qo=class extends Jo{_glyphs;get glyphs(){return this._glyphs??=new Ao(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 Fo(e,n),this.topDictIndex=new Po(e,this.nameIndex.endOffset),this.stringIndex=new Fo(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Po(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 Wo(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Po(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new Po(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Lo:this.topDict.charset===1?this.charset=Ro:this.topDict.charset===2?this.charset=zo:this.charset=this._readCharset(this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=wo:this.topDict.encoding===1?this.encoding=To:this.encoding=this._readEncoding(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(Bo(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(Bo(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(Bo(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}};Zo([J(`uint8`)],Qo.prototype,`majorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`minorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`headerSize`,2),Zo([J(`uint8`)],Qo.prototype,`offsetSize`,2),Qo=Zo([Ko(`CFF `,`cff`)],Qo);var $o=Object.defineProperty,es=(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},ts=class e extends mo{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}};es([J(`uint16`)],ts.prototype,`format`),es([J(`uint16`)],ts.prototype,`length`),es([J(`uint16`)],ts.prototype,`language`),es([J({type:`uint8`,size:256})],ts.prototype,`glyphIndexArray`);var ns=ts,rs=Object.defineProperty,is=(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},as=class extends mo{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}};is([J(`uint16`)],as.prototype,`format`),is([J(`uint16`)],as.prototype,`length`),is([J(`uint16`)],as.prototype,`language`);function os(e){return e>32767?e-65536:e<-32767?e+65536:e}function ss(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:os(e-a)}):(i.start=Number(a),i.startId=e,i.delta=os(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var cs=Object.defineProperty,ls=(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&&cs(t,n,i),i},us=class e extends mo{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=ss(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}};ls([J(`uint16`)],us.prototype,`format`),ls([J(`uint16`)],us.prototype,`length`),ls([J(`uint16`)],us.prototype,`language`),ls([J(`uint16`)],us.prototype,`segCountX2`),ls([J(`uint16`)],us.prototype,`searchRange`),ls([J(`uint16`)],us.prototype,`entrySelector`),ls([J(`uint16`)],us.prototype,`rangeShift`);var ds=us,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 extends mo{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}};ps([J(`uint16`)],ms.prototype,`format`),ps([J(`uint16`)],ms.prototype,`length`),ps([J(`uint16`)],ms.prototype,`language`),ps([J(`uint16`)],ms.prototype,`firstCode`),ps([J(`uint16`)],ms.prototype,`entryCount`);var hs=Object.defineProperty,gs=(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&&hs(t,n,i),i},_s=class e extends mo{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=ss(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}};gs([J(`uint16`)],_s.prototype,`format`),gs([J(`uint16`)],_s.prototype,`reserved`),gs([J(`uint32`)],_s.prototype,`length`),gs([J(`uint32`)],_s.prototype,`language`),gs([J(`uint32`)],_s.prototype,`nGroups`);var vs=_s,ys=Object.defineProperty,bs=(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&&ys(t,n,i),i},xs=class extends mo{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}};bs([J(`uint16`)],xs.prototype,`format`),bs([J(`uint32`)],xs.prototype,`length`),bs([J(`uint32`)],xs.prototype,`numVarSelectorRecords`);var 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 Jo{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=ds.from(e),r=ns.from(e),i=t?vs.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 Ts(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 ns(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new as(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new ds(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new ms(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new vs(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new xs(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()??[]])}};ws([J(`uint16`)],Ts.prototype,`version`,2),ws([J(`uint16`)],Ts.prototype,`numberSubtables`,2),Ts=ws([Ko(`cmap`)],Ts);var Es=class extends Eo{_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 ro(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();ro(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;ro(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(ro(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{ro(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}},Ds=class extends ko{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new Es({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Os=Object.getOwnPropertyDescriptor,ks=(e,t,n,r)=>{for(var i=r>1?void 0:r?Os(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},As=class extends Jo{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new As(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new Ds(this._sfnt)}};As=ks([Ko(`glyf`)],As);function js(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ms(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(js(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 Ns(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 Ps(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 Fs(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 Is(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Ls(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 Rs=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Bs=(e,t,n,r)=>{for(var i=r>1?void 0:r?zs(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&&Rs(t,n,i),i},Vs=class extends Jo{_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=Ls(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ms(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=Ns(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=Ps(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+Is(a)+Is(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=Ls(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:Fs(n,e+n.readUint16(e+8)),classDef2:Fs(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Is(a)+Is(o),valueFormat1:a})}};Bs([J(`uint16`)],Vs.prototype,`majorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`minorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`scriptListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`featureListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`lookupListOffset`,2),Vs=Bs([Ko(`GPOS`,`gpos`)],Vs);var Hs=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,Ws=(e,t,n,r)=>{for(var i=r>1?void 0:r?Us(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&&Hs(t,n,i),i},Gs=class extends Jo{_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}};Ws([J(`uint16`)],Gs.prototype,`majorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`minorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`scriptListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`featureListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`lookupListOffset`,2),Gs=Ws([Ko(`GSUB`,`gsub`)],Gs);var Ks=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,Js=(e,t,n,r)=>{for(var i=r>1?void 0:r?qs(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&&Ks(t,n,i),i},Ys=class extends Jo{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};Js([J(`fixed`)],Ys.prototype,`version`,2),Js([J(`fixed`)],Ys.prototype,`fontRevision`,2),Js([J(`uint32`)],Ys.prototype,`checkSumAdjustment`,2),Js([J(`uint32`)],Ys.prototype,`magickNumber`,2),Js([J(`uint16`)],Ys.prototype,`flags`,2),Js([J(`uint16`)],Ys.prototype,`unitsPerEm`,2),Js([J({type:`longDateTime`})],Ys.prototype,`created`,2),Js([J({type:`longDateTime`})],Ys.prototype,`modified`,2),Js([J(`int16`)],Ys.prototype,`xMin`,2),Js([J(`int16`)],Ys.prototype,`yMin`,2),Js([J(`int16`)],Ys.prototype,`xMax`,2),Js([J(`int16`)],Ys.prototype,`yMax`,2),Js([J(`uint16`)],Ys.prototype,`macStyle`,2),Js([J(`uint16`)],Ys.prototype,`lowestRecPPEM`,2),Js([J(`int16`)],Ys.prototype,`fontDirectionHint`,2),Js([J(`int16`)],Ys.prototype,`indexToLocFormat`,2),Js([J(`int16`)],Ys.prototype,`glyphDataFormat`,2),Ys=Js([Ko(`head`)],Ys);var Xs=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(e,t,n,r)=>{for(var i=r>1?void 0:r?Zs(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&&Xs(t,n,i),i},$s=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Qs([J(`fixed`)],$s.prototype,`version`,2),Qs([J(`int16`)],$s.prototype,`ascent`,2),Qs([J(`int16`)],$s.prototype,`descent`,2),Qs([J(`int16`)],$s.prototype,`lineGap`,2),Qs([J(`uint16`)],$s.prototype,`advanceWidthMax`,2),Qs([J(`int16`)],$s.prototype,`minLeftSideBearing`,2),Qs([J(`int16`)],$s.prototype,`minRightSideBearing`,2),Qs([J(`int16`)],$s.prototype,`xMaxExtent`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRise`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRun`,2),Qs([J(`int16`)],$s.prototype,`caretOffset`,2),Qs([J({type:`int16`,size:4})],$s.prototype,`reserved`,2),Qs([J(`int16`)],$s.prototype,`metricDataFormat`,2),Qs([J(`uint16`)],$s.prototype,`numOfLongHorMetrics`,2),$s=Qs([Ko(`hhea`)],$s);var ec=Object.getOwnPropertyDescriptor,tc=(e,t,n,r)=>{for(var i=r>1?void 0:r?ec(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},nc=class extends Jo{static from(e){let t=e.length*4,n=new nc(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()}))}};nc=tc([Ko(`hmtx`)],nc);var rc=Object.getOwnPropertyDescriptor,ic=(e,t,n,r)=>{for(var i=r>1?void 0:r?rc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ac=class extends Jo{_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}};ac=ic([Ko(`kern`,`kern`)],ac);var oc=Object.getOwnPropertyDescriptor,sc=(e,t,n,r)=>{for(var i=r>1?void 0:r?oc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},cc=class extends Jo{static from(e,t=1){let n=e.length*(t?4:2),r=new cc(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)}};cc=sc([Ko(`loca`)],cc);var lc=Object.defineProperty,uc=Object.getOwnPropertyDescriptor,dc=(e,t,n,r)=>{for(var i=r>1?void 0:r?uc(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&&lc(t,n,i),i},fc=class extends Jo{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};dc([J(`fixed`)],fc.prototype,`version`,2),dc([J(`uint16`)],fc.prototype,`numGlyphs`,2),dc([J(`uint16`)],fc.prototype,`maxPoints`,2),dc([J(`uint16`)],fc.prototype,`maxContours`,2),dc([J(`uint16`)],fc.prototype,`maxComponentPoints`,2),dc([J(`uint16`)],fc.prototype,`maxComponentContours`,2),dc([J(`uint16`)],fc.prototype,`maxZones`,2),dc([J(`uint16`)],fc.prototype,`maxTwilightPoints`,2),dc([J(`uint16`)],fc.prototype,`maxStorage`,2),dc([J(`uint16`)],fc.prototype,`maxFunctionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxInstructionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxStackElements`,2),dc([J(`uint16`)],fc.prototype,`maxSizeOfInstructions`,2),dc([J(`uint16`)],fc.prototype,`maxComponentElements`,2),dc([J(`uint16`)],fc.prototype,`maxComponentDepth`,2),fc=dc([Ko(`maxp`)],fc);var pc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,hc=(e,t,n,r)=>{for(var i=r>1?void 0:r?mc(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&&pc(t,n,i),i},gc={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`},_c={Macintosh:1,Microsoft:3},vc={Default:0},yc={UCS2:1},bc=class extends Jo{_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=_c.Macintosh,i=vc.Default,a=0;t.some(e=>e.platform===_c.Microsoft&&e.encoding===yc.UCS2&&e.language===1033)&&(r=_c.Microsoft,i=yc.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&&gc[e.nameId]&&(o[gc[e.nameId]]=a===0?co(e.name):lo(e.name))}return o}};hc([J(`uint16`)],bc.prototype,`format`,2),hc([J(`uint16`)],bc.prototype,`count`,2),hc([J(`uint16`)],bc.prototype,`stringOffset`,2),bc=hc([Ko(`name`)],bc);var xc=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?Sc(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&&xc(t,n,i),i},$=class extends Jo{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([Ko(`OS/2`,`os2`)],$);var Cc=`.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(`,`),wc=Object.defineProperty,Tc=Object.getOwnPropertyDescriptor,Ec=(e,t,n,r)=>{for(var i=r>1?void 0:r?Tc(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&&wc(t,n,i),i},Dc=class extends Jo{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return Cc.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?Cc[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Ec([J(`fixed`)],Dc.prototype,`format`,2),Ec([J(`fixed`)],Dc.prototype,`italicAngle`,2),Ec([J(`int16`)],Dc.prototype,`underlinePosition`,2),Ec([J(`int16`)],Dc.prototype,`underlineThickness`,2),Ec([J(`uint32`)],Dc.prototype,`isFixedPitch`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType1`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType1`,2),Dc=Ec([Ko(`post`)],Dc);var Oc=Object.defineProperty,kc=Object.getOwnPropertyDescriptor,Ac=(e,t,n,r)=>{for(var i=r>1?void 0:r?kc(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&&Oc(t,n,i),i},jc=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Ac([J(`fixed`)],jc.prototype,`version`,2),Ac([J(`int16`)],jc.prototype,`vertTypoAscender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoDescender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoLineGap`,2),Ac([J(`int16`)],jc.prototype,`advanceHeightMax`,2),Ac([J(`int16`)],jc.prototype,`minTopSideBearing`,2),Ac([J(`int16`)],jc.prototype,`minBottomSideBearing`,2),Ac([J(`int16`)],jc.prototype,`yMaxExtent`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRise`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRun`,2),Ac([J(`int16`)],jc.prototype,`caretOffset`,2),Ac([J({type:`int16`,size:4})],jc.prototype,`reserved`,2),Ac([J(`int16`)],jc.prototype,`metricDataFormat`,2),Ac([J(`int16`)],jc.prototype,`numOfLongVerMetrics`,2),jc=Ac([Ko(`vhea`)],jc);var Mc=Object.getOwnPropertyDescriptor,Nc=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Pc=class extends Jo{static from(e){let t=e.length*4,n=new Pc(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()}))}};Pc=Nc([Ko(`vmtx`)],Pc);var Fc=Object.defineProperty,Ic=(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&&Fc(t,n,i),i},Lc=class extends ho{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(ao(e).getUint32(0))}static checksum(e){let t=ao(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 Co(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new qo(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ic([J(`uint32`)],Lc.prototype,`scalerType`),Ic([J(`uint16`)],Lc.prototype,`numTables`),Ic([J(`uint16`)],Lc.prototype,`searchRange`),Ic([J(`uint16`)],Lc.prototype,`entrySelector`),Ic([J(`uint16`)],Lc.prototype,`rangeShift`);var Rc=class extends Lc{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},zc=class{static signature=1953784678;static is(e){let t=ao(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=ao(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 `)?Rc.from(e):Lc.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 qo(i)}},Bc=Object.defineProperty,Vc=(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&&Bc(t,n,i),i},Hc=class extends mo{constructor(e,t){super(e,t,20)}};Vc([J({type:`char`,size:4})],Hc.prototype,`tag`),Vc([J(`uint32`)],Hc.prototype,`offset`),Vc([J(`uint32`)],Hc.prototype,`compLength`),Vc([J(`uint32`)],Hc.prototype,`origLength`),Vc([J(`uint32`)],Hc.prototype,`origChecksum`);var Uc=Object.defineProperty,Wc=(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&&Uc(t,n,i),i};function Gc(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Kc(e){return new Promise((t,n)=>{Za(e,(e,r)=>e?n(e):t(r))})}function qc(e){return new Promise((t,n)=>{$a(e,(e,r)=>e?n(e):t(r))})}var Jc=class e extends ho{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Lc.is(this.flavor)?`TrueType`:Rc.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(ao(e).getUint32(0))}static checkSum(e){let t=ao(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,ao(Qa(Gc(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,ao(await Kc(Gc(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 Hc(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=eo(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 qo(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 qc(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new qo(new Map(e))}};Wc([J(`uint32`)],Jc.prototype,`signature`),Wc([J(`uint32`)],Jc.prototype,`flavor`),Wc([J(`uint32`)],Jc.prototype,`length`),Wc([J(`uint16`)],Jc.prototype,`numTables`),Wc([J(`uint16`)],Jc.prototype,`reserved`),Wc([J(`uint32`)],Jc.prototype,`totalSFNTSize`),Wc([J(`uint16`)],Jc.prototype,`majorVersion`),Wc([J(`uint16`)],Jc.prototype,`minorVersion`),Wc([J(`uint32`)],Jc.prototype,`metaOffset`),Wc([J(`uint32`)],Jc.prototype,`metaLength`),Wc([J(`uint32`)],Jc.prototype,`metaOrigLength`),Wc([J(`uint32`)],Jc.prototype,`privOffset`),Wc([J(`uint32`)],Jc.prototype,`privLength`);var Yc=Jc;function Xc(e,t=!0){if(Lc.is(e))return new Lc(e);if(Rc.is(e))return new Rc(e);if(Yc.is(e))return new Yc(e);if(zc.is(e)){let t=new zc(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function Zc(e,t=!0){let n=Xc(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var Qc=new class e{static defaultRequestInit={cache:`force-cache`};loading=new Map;loaded=new Map;familyToUrl=new Map;_loadListeners=new Set;on(e,t){return e===`load`&&this._loadListeners.add(t),this}off(e,t){return e===`load`&&this._loadListeners.delete(t),this}_emitLoad(e){this._loadListeners.forEach(t=>t(e))}_fallbackFont;get fallbackFont(){return this._fallbackFont}set fallbackFont(e){this._fallbackFont=e,e&&this._emitLoad(e)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){if(e!=null){this.fallbackFont=await this.load(e,t);return}let n=await this._loadSystemFallbackFont().catch(()=>void 0);this.fallbackFont=n??this._loadEmbeddedFallbackFont()}async _loadSystemFallbackFont(){let e=globalThis?.queryLocalFonts;if(typeof e!=`function`)return;let t=await e();if(!t?.length)return;let n=[`Arial`,`Helvetica`,`Helvetica Neue`,`Roboto`,`Segoe UI`,`Microsoft YaHei`,`PingFang SC`,`Noto Sans`],r=t.find(e=>n.includes(e.family))??t[0],i=await(await r.blob()).arrayBuffer(),a=r.family??r.fullName??r.postscriptName??`system-fallback`;return this._createLoadedFont(`local-font:${a}`,[a],i)}_loadEmbeddedFallbackFont(){let e=bo(yo);return this._createLoadedFont(`modern-font:embedded-fallback`,[`ModernFallback`],e)}_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 {
32
32
  font-family: "${e}";
33
33
  src: url(${t});
34
34
  }`)),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=this._createLoadedFont(o,c,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(()=>(this._emitLoad(n),n))}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return this._createLoadedFont(o,c);throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}}_createLoadedFont(e,t,n=new ArrayBuffer(0)){let r;function i(){return r||=n.byteLength?Zc(n,!1):void 0,r}function a(){let e=i();if(e instanceof Lc||e instanceof Yc)return e.sfnt}return{src:e,family:t.length===1?t[0]:t,buffer:n,familySet:new Set(t),getFont:i,getSFNT:a}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},$c=new Set([`©`,`®`,`÷`]),el=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),tl={1:`italic`,32:`bold`},nl={1:`italic`,2:`bold`},rl={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},il=4096,al=new Map;function ol(e,t){al.set(e,t),al.size>il&&al.delete(al.keys().next().value)}var sl=0,cl=new WeakMap;function ll(e){let t=cl.get(e);return t===void 0&&(t=++sl,cl.set(e,t)),t}var ul=256,dl=new Map;function fl(e,t){let n=`${ll(e)}|${t}`,r=dl.get(n);if(r)return r;let{hhea:i,os2:a,post:o,head:s}=e,c=s.unitsPerEm,l=i.ascent,u=i.descent,d=c/t,f=(l+Math.abs(u))/d,p=l/d,m={sfnt:e,unitsPerEm:c,advanceHeight:f,baseline:p,ascender:l/d,descender:u/d,underlinePosition:(l-o.underlinePosition)/d,underlineThickness:o.underlineThickness/d,strikeoutPosition:(l-a.yStrikeoutPosition)/d,strikeoutSize:a.yStrikeoutSize/d,typoAscender:a.sTypoAscender/d,typoDescender:a.sTypoDescender/d,typoLineGap:a.sTypoLineGap/d,winAscent:a.usWinAscent/d,winDescent:a.usWinDescent/d,xHeight:a.version>1?a.sxHeight/d:0,capHeight:a.version>1?a.sCapHeight/d:0,centerDiviation:f/2-p,fontStyle:tl[a.fsSelection]??nl[s.macStyle]};return dl.size>=ul&&dl.delete(dl.keys().next().value),dl.set(n,m),m}var pl=class{content;index;parent;_path;_lazyPath;get path(){if(this._path)return this._path;let e=this._lazyPath;if(e){let{x:t,y:n}=e,r=e.tmpl.path.clone().setMeta(this);return r.applyTransform(e=>{e.x+=t,e.y+=n}),r.style=e.style,this._path=r,this._lazyPath=void 0,r}let t=new Mi().setMeta(this);return this._path=t,t}set path(e){this._path=e,this._lazyPath=void 0}inlineBox=new W;get lineBox(){let e=this.inlineBox,t=this.fontHeight;return this.isVertical?new W(e.left+(e.width-t)/2,e.top,t,e.height):new W(e.left,e.top+(e.height-t)/2,e.width,t)}glyphBox;advanceWidth=0;kerningBefore=0;_glyphIndex;_metrics;get advanceHeight(){return this._metrics?.advanceHeight??0}get baseline(){return this._metrics?.baseline??0}get ascender(){return this._metrics?.ascender??0}get descender(){return this._metrics?.descender??0}get underlinePosition(){return this._metrics?.underlinePosition??0}get underlineThickness(){return this._metrics?.underlineThickness??0}get strikeoutPosition(){return this._metrics?.strikeoutPosition??0}get strikeoutSize(){return this._metrics?.strikeoutSize??0}get typoAscender(){return this._metrics?.typoAscender??0}get typoDescender(){return this._metrics?.typoDescender??0}get typoLineGap(){return this._metrics?.typoLineGap??0}get winAscent(){return this._metrics?.winAscent??0}get winDescent(){return this._metrics?.winDescent??0}get xHeight(){return this._metrics?.xHeight??0}get capHeight(){return this._metrics?.capHeight??0}get centerDiviation(){return this._metrics?.centerDiviation??0}get fontStyle(){return this._metrics?.fontStyle}translateY(e){e&&(this.inlineBox.top+=e,this.glyphBox&&(this.glyphBox.top+=e),this._lazyPath?this._lazyPath.y+=e:this._path&&this._path.applyTransform(t=>{t.y+=e}))}get compatibleGlyphBox(){if(this.glyphBox)return this.glyphBox;let e=this.computedStyle.fontSize*.8,t=this.lineBox;return this.isVertical?new W(t.left+t.width/2-e/2,t.top,e,t.height):new W(t.left,t.top+t.height/2-e/2,t.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??Qc,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{content:t,computedStyle:n}=this,r=n.fontSize;return this._metrics=fl(e,r),this.advanceWidth=e.getAdvanceWidth(t,r),this._glyphIndex=e.textToGlyphIndexes(t)[0],this}computeKerningBefore(e){let t=this._metrics;if(!e||!t||e._metrics?.sfnt!==t.sfnt||e._glyphIndex===void 0||this._glyphIndex===void 0)return 0;let n=t.sfnt.getKerningValue(e._glyphIndex,this._glyphIndex);return n?n*this.computedStyle.fontSize/t.unitsPerEm:0}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let n=this.computedStyle,r=n.fontStyle===`italic`&&this.fontStyle!==`italic`;if(!this.isVertical&&!r&&!n.textStrokeWidth)return this._updateFromCache(t,n),this;let{isVertical:i,content:a,baseline:o,inlineBox:s,ascender:c,descender:l,typoAscender:u,fontStyle:d,advanceWidth:f,advanceHeight:p}=this,{left:m,top:h}=s,g=m,_=h+o,v,y=new Mi().setMeta(this);if(i&&(g+=(p-f)/2,Math.abs(f-p)>.1&&(_-=(c-u)/(c+Math.abs(l))*p),v=void 0),i&&!$c.has(a)&&(a.codePointAt(0)<=256||el.has(a))){y.addCommands(t.getPathCommands(a,g,h+o-(p-f)/2,n.fontSize));let e={y:h-(p-f)/2+p/2,x:g+f/2};r&&this._italic(y,{x:e.x,y:h-(p-f)/2+o}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(a,g,_,n.fontSize)),r&&this._italic(y,i?{x:g+p/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,n.fontSize)),r&&this._italic(y,i?{x:g+f/2,y:h+u/(c+Math.abs(l))*p}:void 0));let b=n.fontWeight??400;return b in rl&&(b===700||b===`bold`)&&d!==`bold`&&y.bold(rl[b]*n.fontSize*.05),y.style=B({fill:n.color,fillRule:`nonzero`,stroke:n.textStrokeWidth?n.textStrokeColor:void 0,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_updateFromCache(e,t){let n=this.content,r=t.fontSize,i=this.inlineBox.left,a=this.inlineBox.top+this.baseline,o=t.fontWeight??400,s=o in rl&&(o===700||o===`bold`)&&this.fontStyle!==`bold`?rl[o]*r*.05:0,c=`${n}|${ll(e)}|${r}|${s}`,l=al.get(c);if(!l){let t=new Mi;t.addCommands(e.getPathCommands(n,0,0,r)),s&&t.bold(s);let i;if(t.curves[0]?.curves.length){let{min:e,max:n}=t.getMinMax(void 0,void 0,!0);i=new W(e.x,e.y,n.x-e.x,n.y-e.y)}l={path:t,glyphBox:i},ol(c,l)}this._path=void 0,this._lazyPath={tmpl:l,x:i,y:a,style:B({fill:t.color,fillRule:`nonzero`})},this.glyphBox=l.glyphBox?new W(l.glyphBox.left+i,l.glyphBox.top+a,l.glyphBox.width,l.glyphBox.height):void 0}_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===void 0&&this._lazyPath!==void 0){let n=this.glyphBox;if(!n)return;let r=new U(n.left,n.top),i=new U(n.left+n.width,n.top+n.height),a=e??new U(2**53-1,2**53-1),o=t??new U(-(2**53-1),-(2**53-1));return a.clampMin(r,i),o.clampMax(r,i),{min:a,max:o}}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)}},ml=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,...B(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?B(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?B(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new pl(n,t++,this));return this.characters=e,this}},hl=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;_layoutDirty=!0;_layoutTop=0;_layoutHeight=0;_layoutRight=0;_glyphBox;_layoutValid=!1;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...B(this.parent.computedStyle),...B(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?B(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?B(t):void 0,this}};function gl(e){return e}function _l(e,t,n){return e[`${t}${n}`]??e[t]??0}var vl=class{measure(e,t,n,r){let i=r??Qc;for(let t of e)if(t._layoutDirty)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)||this._applyKerning(e),t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:_l(e,`padding`,`Top`),right:_l(e,`padding`,`Right`),bottom:_l(e,`padding`,`Bottom`),left:_l(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.width-n.left-n.right:1/0,o=n.top,s=n.left;for(let t of e){let e=t.computedStyle,r=t.style,i=_l(r,`margin`,`Top`),c=_l(r,`margin`,`Bottom`),l=_l(r,`margin`,`Left`),u=_l(r,`margin`,`Right`),d=_l(r,`padding`,`Top`),f=_l(r,`padding`,`Bottom`),p=_l(r,`padding`,`Left`),m=_l(r,`padding`,`Right`),h=n.left+l+p,g=a===1/0?1/0:a-l-u-p-m;o+=i+d;let _=o,v=h;if(!t._layoutDirty){let e=_-t._layoutTop;if(e){for(let n of t.fragments){for(let t of n.characters)t.translateY(e);n.inlineBox.top+=e}t.lineBox.top+=e,t._glyphBox&&(t._glyphBox.top+=e)}t._layoutTop=_,v=t._layoutRight,o=_+t.lineBox.height,v>s&&(s=v),o+=f+c;continue}let y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0,S=!1,C=!1;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,a=0,s=!0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),s||(a+=e.kerningBefore),s=!1,a+=this._advance(e);let c=h+r;if(g!==1/0){let e=g-r-a;b===`center`?c+=e/2:(b===`end`||b===`right`)&&(c+=e)}let l=!0;for(let e of n){S=!0,e.advanceWidth>0&&(C=!0),l||(c+=e.kerningBefore),l=!1;let t=e.advanceWidth,n=e.advanceHeight;e.inlineBox.left=c,e.inlineBox.top=o+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,c+=this._advance(e)}c>v&&(v=c),o+=i}v>s&&(s=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=o-_,t._layoutTop=_,t._layoutHeight=t.lineBox.height,t._layoutRight=v,t._glyphBox=void 0,t._layoutValid=!S||C,o+=f+c}let c=o+n.bottom,l=r?t.width:s+n.right,u=typeof t.height==`number`?t.height:c;if(typeof t.height==`number`){let n=u-c,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,l,u)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.height-n.top-n.bottom:1/0,o=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,a)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);o.push({chars:n,thickness:t})}}let s=o.reduce((e,t)=>e+t.thickness,0),c=typeof t.width==`number`,l=c?Math.max(t.width-n.left-n.right,s):s,u=n.left+l,d=n.top;for(let e of o){u-=e.thickness;let t=u,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,r+=this._advance(n)}r>d&&(d=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,c?t.width:l+n.left+n.right,r?t.height:d+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===`
35
- `||e.content===`\r`){a();continue}let n=r.length>0?e.kerningBefore:0;t!==1/0&&r.length>0&&i+n+e.advanceWidth>t&&a(),r.length>0&&(i+=e.kerningBefore),r.push(e),i+=this._advance(e)}return a(),n}_applyKerning(e){for(let t of e){if(!t._layoutDirty)continue;let e;for(let n of t.fragments)for(let t of n.characters)t.kerningBefore=t.computeKerningBefore(e),e=t}}_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}}}dispose(){}};function yl(){let e=new Ni,t=Pi(),n=Fi(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(L(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=zi(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 jr;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;L(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Ni([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function bl(e,t){let{x:n,y:r}=t;if(e instanceof Di){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 Di(t,e,o),new Di(o.clone(),r,a)]}}}else if(e instanceof wi){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 wi(t,e,s,c),new wi(c.clone(),l,u,o)]}}else if(e instanceof Si){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 Si(t,new U(n,r)),new Si(new U(n,r),i)]}return[e]}var xl=class{autoWidth=!1;_contentBox;get boundingBox(){if(!this.autoWidth)return this.text.lineBox;if(!this._contentBox){let e=this.characters.map(e=>e.glyphBox).filter(Boolean),t=this.text.lineBox;this._contentBox=e.length?W.from(...e):new W(t.left,t.top,t.width,t.height)}return this._contentBox}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,autoWidth:r=!1}){this.text=e,this.autoWidth=r,this.intensities=t.map(e=>e/100),this.lineHeight=this._maxFontSize()||n||100}_maxFontSize(){let e=0;return this.characters.forEach(t=>{t.glyphBox&&(e=Math.max(e,t.fontSize))}),e}_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=>bl(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Di&&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 Si&&e.getLength()>this.lineHeight*.05){let{p1:t,p2:n}=e,r=new Di(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()})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},Sl=class extends xl{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)}},Cl=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()}},wl=class extends Cl{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)}},Tl=class extends Cl{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()}},El=class extends Cl{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))}},Dl=class extends Cl{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)}},Ol=class extends wl{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 El(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new El(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new El(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 Tl(l,u),m=new Tl(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]}},kl=class extends wl{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 Tl(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]}},Al=class extends wl{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 Tl(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]}},jl=class extends xl{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=0,n=0]=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)}},Ml=class extends xl{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]}},Nl=new Map;function Pl(e,t){Nl.set(e,t)}function Fl(e){Nl.delete(e)}function Il(){return[...Nl.keys()]}function Ll(){return gl({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(L(n)||!n)return;let r=Nl.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize,autoWidth:!0},a;switch(r.engine){case`ffd`:a=new jl(i,r);break;case`bend`:a=new Sl(i,r);break;case`curve`:case`offset`:a=new Ml(i,r);break}e.forEachCharacter(t=>t.update(e.fonts)),a.deform();let o=e.getGlyphBox(),s=o.left,c=o.top;if(s||c){let t=e.plugins.get(`highlight`);for(let t of e.characters)t.glyphBox&&=(t.path.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)}),t.getGlyphBoundingBox());t?.pathSet?.paths?.forEach(e=>{e.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)})}),o=e.getGlyphBox()}e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Rl(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 zl(){let e=new Ni,t=[],n=Pi(),r=Fi(n);return gl({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}=Rl(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=Rl(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(L(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vi(o.image,r)&&Vi(o.colormap,s)&&Vi(o.line,c)&&Vi(o.size,l)&&Vi(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}=Rl(c),x=Ri(b,{fontSize:m,total:s.width})/s.width,S=zi(_),{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 O=Math.floor(D.width),k=O;y!==`cover`&&(k=Ri(y,{fontSize:m,total:s.width})||O,D.width=k);let A=!L(g)&&L(v);if(A)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(L(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 j=new jr;if(j.translate(-T.x,-T.y),j.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;A||j.translate(-e,-t),j.rotate(Math.PI/2),A||j.translate(t,e)}j.translate(D.x,D.y);for(let n=0;n<Math.ceil(O/k);n++){let r=j.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),O!==k&&(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 Ni([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Bl(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
35
+ `||e.content===`\r`){r.push(e),a();continue}let n=r.length>0?e.kerningBefore:0;t!==1/0&&r.length>0&&i+n+e.advanceWidth>t&&a(),r.length>0&&(i+=e.kerningBefore),r.push(e),i+=this._advance(e)}return(r.length>0||n.length===0)&&a(),n}_applyKerning(e){for(let t of e){if(!t._layoutDirty)continue;let e;for(let n of t.fragments)for(let t of n.characters)t.kerningBefore=t.computeKerningBefore(e),e=t}}_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}}}dispose(){}};function yl(){let e=new Ni,t=Pi(),n=Fi(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(L(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=zi(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 jr;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;L(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Ni([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function bl(e,t){let{x:n,y:r}=t;if(e instanceof Di){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 Di(t,e,o),new Di(o.clone(),r,a)]}}}else if(e instanceof wi){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 wi(t,e,s,c),new wi(c.clone(),l,u,o)]}}else if(e instanceof Si){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 Si(t,new U(n,r)),new Si(new U(n,r),i)]}return[e]}var xl=class{autoWidth=!1;_contentBox;get boundingBox(){if(!this.autoWidth)return this.text.lineBox;if(!this._contentBox){let e=this.characters.map(e=>e.glyphBox).filter(Boolean),t=this.text.lineBox;this._contentBox=e.length?W.from(...e):new W(t.left,t.top,t.width,t.height)}return this._contentBox}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,autoWidth:r=!1}){this.text=e,this.autoWidth=r,this.intensities=t.map(e=>e/100),this.lineHeight=this._maxFontSize()||n||100}_maxFontSize(){let e=0;return this.characters.forEach(t=>{t.glyphBox&&(e=Math.max(e,t.fontSize))}),e}_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=>bl(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Di&&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 Si&&e.getLength()>this.lineHeight*.05){let{p1:t,p2:n}=e,r=new Di(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()})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},Sl=class extends xl{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)}},Cl=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()}},wl=class extends Cl{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)}},Tl=class extends Cl{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()}},El=class extends Cl{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))}},Dl=class extends Cl{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)}},Ol=class extends wl{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 El(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new El(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new El(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 Tl(l,u),m=new Tl(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]}},kl=class extends wl{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 Tl(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]}},Al=class extends wl{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 Tl(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]}},jl=class extends xl{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=0,n=0]=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)}},Ml=class extends xl{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]}},Nl=new Map;function Pl(e,t){Nl.set(e,t)}function Fl(e){Nl.delete(e)}function Il(){return[...Nl.keys()]}function Ll(){return gl({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(L(n)||!n)return;let r=Nl.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize,autoWidth:!0},a;switch(r.engine){case`ffd`:a=new jl(i,r);break;case`bend`:a=new Sl(i,r);break;case`curve`:case`offset`:a=new Ml(i,r);break}e.forEachCharacter(t=>t.update(e.fonts)),a.deform();let o=e.getGlyphBox(),s=o.left,c=o.top;if(s||c){let t=e.plugins.get(`highlight`);for(let t of e.characters)t.glyphBox&&=(t.path.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)}),t.getGlyphBoundingBox());t?.pathSet?.paths?.forEach(e=>{e.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)})}),o=e.getGlyphBox()}e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Rl(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 zl(){let e=new Ni,t=[],n=Pi(),r=Fi(n);return gl({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}=Rl(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=Rl(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(L(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vi(o.image,r)&&Vi(o.colormap,s)&&Vi(o.line,c)&&Vi(o.size,l)&&Vi(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}=Rl(c),x=Ri(b,{fontSize:m,total:s.width})/s.width,S=zi(_),{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 O=Math.floor(D.width),k=O;y!==`cover`&&(k=Ri(y,{fontSize:m,total:s.width})||O,D.width=k);let A=!L(g)&&L(v);if(A)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(L(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 j=new jr;if(j.translate(-T.x,-T.y),j.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;A||j.translate(-e,-t),j.rotate(Math.PI/2),A||j.translate(t,e)}j.translate(D.x,D.y);for(let n=0;n<Math.ceil(O/k);n++){let r=j.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),O!==k&&(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 Ni([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Bl(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
36
36
  <circle cx="${e}" cy="${e}" r="${e}" fill="${t}" />
37
37
  </svg>`}function Vl(){let e=new Ni;return gl({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=zi(c),f=l,p;if(!L(s))p=s;else if(!L(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Bl(e,String(o));break}}if(!p)return;let m=ci(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Ri(f,{total:i,fontSize:i})/i,y=new jr;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 Hl(){return{name:`outline`}}function Ul(){let e=new Ni,t=[],n=[];return Object.defineProperty(e,"paths",{configurable:!0,enumerable:!0,get(){return n===null&&(n=t.map(e=>e.path)),n},set(e){n=e}}),gl({name:`render`,pathSet:e,update:r=>{let i=[],{paragraphs:a}=r;a.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{i.push(e)})})}),t=i,n=null,e._lazyCount=i.length},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Ii(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 Wl(){let e=new Ni;return gl({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(L(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 Mi([{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 Mi([{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 Gl(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Kl(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 ql=pt(),Jl=class extends he{needsUpdate=!0;computedStyle={...ql};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new vl;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;incrementalLayout=!0;_prevParagraphs=[];_prevContentKeys=[];_prevStyleKey=``;_prevFonts;_prevFontsSet=!1;_prevFontSig=``;_pendingFontSig=``;_pendingContentKeys=[];_pendingStyleKey=``;_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}=St(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(yl()).use(Hl()).use(Vl()).use(Wl()).use(zl()).use(Ul()).use(Ll()),(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();let[e]=await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))]);e>0&&(this._prevParagraphs=[])}async _decodeFonts(){let e=this.fonts??Qc,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}return t.add(e.fallbackFont),(await Promise.all(Array.from(t,async e=>{let t=e?.getFont();return t&&typeof t.createSFNTAsync==`function`&&!t._sfnt?(t._sfnt=await t.createSFNTAsync(),1):0}))).reduce((e,t)=>e+t,0)}_normalizeComputedStyle(e){let t=e;for(let e in ql){let n=ql[e];if(typeof n!=`number`)continue;let r=t[e];if(typeof r==`number`)Number.isFinite(r)||(t[e]=n);else{let i=Number.parseFloat(r);t[e]=Number.isFinite(i)?i:n}}return e}_buildParagraph(e,t){let{fragments:n,fill:r,outline:i,...a}=e,o=new hl(a,t,this);return o.fill=r,o.outline=i,n.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&o.fragments.push(new ml(n,a,r,i,t,o))}),o}_computeFontSig(){let e=this.fonts;if(!e?.get)return``;let t=new Set,n=this.computedStyle?.fontFamily;n&&t.add(String(n));for(let e of this.content){let n=e?.fontFamily;n&&t.add(String(n));let r=e?.fragments;if(Array.isArray(r))for(let e of r){let n=e?.fontFamily;n&&t.add(String(n))}}let r=`*fallback#${e.fallbackFont?.src??``};`;for(let n of t)r+=`${n}#${e.get(n)?.src??``};`;return r}_canReuseLayout(e,t){if(!this.incrementalLayout||!this._prevParagraphs.length||e!==this._prevStyleKey||!this._prevFontsSet||this.fonts!==this._prevFonts||t!==this._prevFontSig)return!1;let n=this.computedStyle;return!(n.writingMode.includes(`vertical`)||typeof n.height==`number`&&(n.verticalAlign===`middle`||n.verticalAlign===`bottom`))}_update(){this.computedStyle=this._normalizeComputedStyle({...ql,...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=JSON.stringify([this.style,this.fill,this.outline,this.effects,this.deformation]),t=this._computeFontSig();this._pendingFontSig=t;let n=this._canReuseLayout(e,t),r=this.content,i=Array.from({length:r.length}),a=Array.from({length:r.length});for(let e=0;e<r.length;e++){let t=JSON.stringify(r[e]);i[e]=t;let o=this._prevParagraphs[e];if(n&&o&&o._layoutValid&&this._prevContentKeys[e]===t)o._layoutDirty=!1,a[e]=o;else{let t=this._buildParagraph(r[e],e);t._layoutDirty=!0,a[e]=t}}return this.paragraphs=a,this._pendingContentKeys=i,this._pendingStyleKey=e,this}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.paragraphs;for(let e=0;e<r.length;e++){let t=r[e];if(t._layoutDirty)for(let e of t.fragments){let t=e.characters;for(let e=0;e<t.length;e++)t[e].update(this.fonts)}}let i=this._computeGlyphBox();this.rawGlyphBox=i,this.glyphBox=i,this._prevParagraphs=this.paragraphs,this._prevContentKeys=this._pendingContentKeys,this._prevStyleKey=this._pendingStyleKey,this._prevFonts=this.fonts,this._prevFontsSet=!0,this._prevFontSig=this._pendingFontSig;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].pathSet,n=t?._lazyCount??t?.paths.length;t&&n&&this.pathSets.push(t)}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)}_paragraphGlyphBox(e){let t=U.MAX,n=U.MIN,r=e.fragments;for(let e=0;e<r.length;e++){let i=r[e].characters;for(let e=0;e<i.length;e++){let r=i[e];if(r.getGlyphMinMax(t,n))continue;let{left:a,top:o,width:s,height:c}=r.inlineBox;t.clampMin(new U(a,o),new U(a+s,o+c)),n.clampMax(new U(a,o),new U(a+s,o+c))}}if(!(!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(n.x)||!Number.isFinite(n.y)))return new W(t.x,t.y,n.x-t.x,n.y-t.y)}_computeGlyphBox(){let e=this.paragraphs,t=[];for(let n=0;n<e.length;n++){let r=e[n],i=r._glyphBox;(r._layoutDirty||!i)&&(i=this._paragraphGlyphBox(r),r._glyphBox=i),i&&t.push(i)}return t.length?W.from(...t):new W(0,0,0,0)}_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 Hi(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.region=e.region,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(``)}};Kl([me({internal:!0}),Gl(`design:type`,Boolean)],Jl.prototype,`debug`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`content`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`style`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`effects`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`fill`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`outline`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`deformation`,void 0),Kl([me({internal:!0}),Gl(`design:type`,typeof HTMLElement>`u`?Object:HTMLElement)],Jl.prototype,`measureDom`,void 0),Kl([me({internal:!0}),Gl(`design:type`,Object)],Jl.prototype,`fonts`,void 0);function Yl(e,t){let n=new Jl(e);return t?n.load().then(()=>n.measure()):n.measure()}function Xl(e,t){let n=new Jl(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Hi,e.Character=pl,e.CircleCurve=El,e.EllipseCurve=Dl,e.Fragment=ml,e.HeartCurve=Ol,e.Measurer=vl,e.Paragraph=hl,e.PolygonCurve=kl,e.RectangularCurve=Al,e.Text=Jl,e.backgroundPlugin=yl,e.createSvgLoader=Pi,e.createSvgParser=Fi,e.defineDeformation=Pl,e.definePlugin=gl,e.deformationPlugin=Ll,e.getDeformationNames=Il,e.getEffectTransform2D=Ii,e.getHighlightStyle=Rl,e.highlightPlugin=zl,e.isEqualObject=Bi,e.isEqualValue=Vi,e.listStylePlugin=Vl,e.measureText=Yl,e.outlinePlugin=Hl,e.parseColormap=zi,e.parseTransformOrigin=Li,e.parseValueNumber=Ri,e.removeDeformation=Fl,e.renderPlugin=Ul,e.renderText=Xl,e.textDecorationPlugin=Wl,e.textDefaultStyle=ql});
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Text } from './shared/modern-text.DxwBc1JI.mjs';
2
- export { C as Canvas2DRenderer, a as Character, F as Fragment, M as Measurer, P as Paragraph, b as backgroundPlugin, c as createSvgLoader, d as createSvgParser, g as getEffectTransform2D, e as getHighlightStyle, h as highlightPlugin, i as isEqualObject, f as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, j as parseTransformOrigin, k as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, m as textDefaultStyle } from './shared/modern-text.DxwBc1JI.mjs';
1
+ import { T as Text } from './shared/modern-text.Dd6yqc4a.mjs';
2
+ export { C as Canvas2DRenderer, a as Character, F as Fragment, M as Measurer, P as Paragraph, b as backgroundPlugin, c as createSvgLoader, d as createSvgParser, g as getEffectTransform2D, e as getHighlightStyle, h as highlightPlugin, i as isEqualObject, f as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, j as parseTransformOrigin, k as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, m as textDefaultStyle } from './shared/modern-text.Dd6yqc4a.mjs';
3
3
  export { d as defineDeformation, a as definePlugin, b as deformationPlugin, g as getDeformationNames, r as removeDeformation } from './shared/modern-text.C0w4dLp7.mjs';
4
4
  export { C as CircleCurve, E as EllipseCurve, H as HeartCurve, P as PolygonCurve, R as RectangularCurve } from './shared/modern-text.fT17R5HY.mjs';
5
5
  import 'modern-font';
@@ -1,5 +1,5 @@
1
1
  import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
- import { C as Character } from './modern-text.Byk6gnkH.js';
2
+ import { C as Character } from './modern-text.DzKfafj6.js';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -1,5 +1,5 @@
1
1
  import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
- import { C as Character } from './modern-text.Byk6gnkH.mjs';
2
+ import { C as Character } from './modern-text.DzKfafj6.mjs';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -1,5 +1,5 @@
1
1
  import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
- import { C as Character } from './modern-text.Byk6gnkH.cjs';
2
+ import { C as Character } from './modern-text.DzKfafj6.cjs';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -172,7 +172,8 @@ class Canvas2DRenderer {
172
172
  this.uploadColor(this.text.glyphBox, {
173
173
  style: this.text.computedStyle,
174
174
  fill: this.text.computedFill,
175
- outline: this.text.computedOutline
175
+ outline: this.text.computedOutline,
176
+ effects: this.text.computedEffects
176
177
  });
177
178
  this.text.paragraphs.forEach((paragraph) => {
178
179
  this.uploadColor(paragraph.lineBox, {
@@ -236,7 +237,7 @@ class Canvas2DRenderer {
236
237
  "textStrokeColor"
237
238
  ];
238
239
  uploadColor = (box, ctx) => {
239
- const { style, fill, outline } = ctx;
240
+ const { style, fill, outline, effects } = ctx;
240
241
  if (style) {
241
242
  this._uploadedStyles.forEach((key) => {
242
243
  style[key] = this._parseColor(style[key], box);
@@ -258,6 +259,20 @@ class Canvas2DRenderer {
258
259
  }, box);
259
260
  }
260
261
  }
262
+ effects?.forEach((effect) => {
263
+ if (effect.fill?.enabled && effect.fill.linearGradient) {
264
+ effect.fill._linearGradient = this._parseColor({
265
+ type: "linear-gradient",
266
+ ...effect.fill.linearGradient
267
+ }, box);
268
+ }
269
+ if (effect.outline?.enabled && effect.outline.linearGradient) {
270
+ effect.outline._linearGradient = this._parseColor({
271
+ type: "linear-gradient",
272
+ ...effect.outline.linearGradient
273
+ }, box);
274
+ }
275
+ });
261
276
  };
262
277
  _mergePathStyle(path, style) {
263
278
  const pathStyle = path.style;
@@ -291,13 +306,14 @@ class Canvas2DRenderer {
291
306
  if (effect.fill?.enabled) {
292
307
  style = {
293
308
  ...style,
294
- fill: effect.fill.color
309
+ // 优先用已解析的渐变(_linearGradient,见 uploadColor),无渐变才回退纯色
310
+ fill: effect.fill._linearGradient ?? effect.fill.color
295
311
  };
296
312
  }
297
313
  if (effect.outline?.enabled) {
298
314
  style = {
299
315
  ...style,
300
- stroke: effect.outline.color,
316
+ stroke: effect.outline._linearGradient ?? effect.outline.color,
301
317
  strokeWidth: (effect.outline.width ?? 0) * fontSize
302
318
  };
303
319
  }
@@ -1175,6 +1191,7 @@ class Measurer {
1175
1191
  for (const fragment of paragraph.fragments) {
1176
1192
  for (const c of fragment.characters) {
1177
1193
  if (c.content === "\n" || c.content === "\r") {
1194
+ current.push(c);
1178
1195
  flush();
1179
1196
  continue;
1180
1197
  }
@@ -1189,7 +1206,9 @@ class Measurer {
1189
1206
  width += this._advance(c);
1190
1207
  }
1191
1208
  }
1192
- flush();
1209
+ if (current.length > 0 || lines.length === 0) {
1210
+ flush();
1211
+ }
1193
1212
  return lines;
1194
1213
  }
1195
1214
  // 横排:为每段(仅 dirty 段)填充相邻字形的字偶距。clean 段沿用上次结果(kern 是行内水平量,
@@ -174,7 +174,8 @@ class Canvas2DRenderer {
174
174
  this.uploadColor(this.text.glyphBox, {
175
175
  style: this.text.computedStyle,
176
176
  fill: this.text.computedFill,
177
- outline: this.text.computedOutline
177
+ outline: this.text.computedOutline,
178
+ effects: this.text.computedEffects
178
179
  });
179
180
  this.text.paragraphs.forEach((paragraph) => {
180
181
  this.uploadColor(paragraph.lineBox, {
@@ -238,7 +239,7 @@ class Canvas2DRenderer {
238
239
  "textStrokeColor"
239
240
  ];
240
241
  uploadColor = (box, ctx) => {
241
- const { style, fill, outline } = ctx;
242
+ const { style, fill, outline, effects } = ctx;
242
243
  if (style) {
243
244
  this._uploadedStyles.forEach((key) => {
244
245
  style[key] = this._parseColor(style[key], box);
@@ -260,6 +261,20 @@ class Canvas2DRenderer {
260
261
  }, box);
261
262
  }
262
263
  }
264
+ effects?.forEach((effect) => {
265
+ if (effect.fill?.enabled && effect.fill.linearGradient) {
266
+ effect.fill._linearGradient = this._parseColor({
267
+ type: "linear-gradient",
268
+ ...effect.fill.linearGradient
269
+ }, box);
270
+ }
271
+ if (effect.outline?.enabled && effect.outline.linearGradient) {
272
+ effect.outline._linearGradient = this._parseColor({
273
+ type: "linear-gradient",
274
+ ...effect.outline.linearGradient
275
+ }, box);
276
+ }
277
+ });
263
278
  };
264
279
  _mergePathStyle(path, style) {
265
280
  const pathStyle = path.style;
@@ -293,13 +308,14 @@ class Canvas2DRenderer {
293
308
  if (effect.fill?.enabled) {
294
309
  style = {
295
310
  ...style,
296
- fill: effect.fill.color
311
+ // 优先用已解析的渐变(_linearGradient,见 uploadColor),无渐变才回退纯色
312
+ fill: effect.fill._linearGradient ?? effect.fill.color
297
313
  };
298
314
  }
299
315
  if (effect.outline?.enabled) {
300
316
  style = {
301
317
  ...style,
302
- stroke: effect.outline.color,
318
+ stroke: effect.outline._linearGradient ?? effect.outline.color,
303
319
  strokeWidth: (effect.outline.width ?? 0) * fontSize
304
320
  };
305
321
  }
@@ -1177,6 +1193,7 @@ class Measurer {
1177
1193
  for (const fragment of paragraph.fragments) {
1178
1194
  for (const c of fragment.characters) {
1179
1195
  if (c.content === "\n" || c.content === "\r") {
1196
+ current.push(c);
1180
1197
  flush();
1181
1198
  continue;
1182
1199
  }
@@ -1191,7 +1208,9 @@ class Measurer {
1191
1208
  width += this._advance(c);
1192
1209
  }
1193
1210
  }
1194
- flush();
1211
+ if (current.length > 0 || lines.length === 0) {
1212
+ flush();
1213
+ }
1195
1214
  return lines;
1196
1215
  }
1197
1216
  // 横排:为每段(仅 dirty 段)填充相邻字形的字偶距。clean 段沿用上次结果(kern 是行内水平量,
@@ -137,6 +137,7 @@ declare class Canvas2DRenderer {
137
137
  style?: NormalizedStyle;
138
138
  fill?: NormalizedFill;
139
139
  outline?: NormalizedOutline;
140
+ effects?: NormalizedEffect[];
140
141
  }) => void;
141
142
  protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
143
  drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
@@ -137,6 +137,7 @@ declare class Canvas2DRenderer {
137
137
  style?: NormalizedStyle;
138
138
  fill?: NormalizedFill;
139
139
  outline?: NormalizedOutline;
140
+ effects?: NormalizedEffect[];
140
141
  }) => void;
141
142
  protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
143
  drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
@@ -137,6 +137,7 @@ declare class Canvas2DRenderer {
137
137
  style?: NormalizedStyle;
138
138
  fill?: NormalizedFill;
139
139
  outline?: NormalizedOutline;
140
+ effects?: NormalizedEffect[];
140
141
  }) => void;
141
142
  protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
143
  drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
@@ -2,7 +2,7 @@
2
2
 
3
3
  const diff = require('diff');
4
4
  const modernIdoc = require('modern-idoc');
5
- const Text = require('../shared/modern-text.BcZoLKzl.cjs');
5
+ const Text = require('../shared/modern-text.DoajDfJ6.cjs');
6
6
  require('modern-font');
7
7
  require('modern-path2d');
8
8
  require('../shared/modern-text.NnJOuHzn.cjs');
@@ -1,5 +1,5 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { c as Text } from '../shared/modern-text.Byk6gnkH.cjs';
2
+ import { c as Text } from '../shared/modern-text.DzKfafj6.cjs';
3
3
  import 'modern-font';
4
4
  import 'modern-path2d';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { c as Text } from '../shared/modern-text.Byk6gnkH.mjs';
2
+ import { c as Text } from '../shared/modern-text.DzKfafj6.mjs';
3
3
  import 'modern-font';
4
4
  import 'modern-path2d';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { c as Text } from '../shared/modern-text.Byk6gnkH.js';
2
+ import { c as Text } from '../shared/modern-text.DzKfafj6.js';
3
3
  import 'modern-font';
4
4
  import 'modern-path2d';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { diffChars } from 'diff';
2
2
  import { isCRLF, textContentToString, normalizeCRLF, normalizeTextContent, property } from 'modern-idoc';
3
- import { T as Text } from '../shared/modern-text.DxwBc1JI.mjs';
3
+ import { T as Text } from '../shared/modern-text.Dd6yqc4a.mjs';
4
4
  import 'modern-font';
5
5
  import 'modern-path2d';
6
6
  import '../shared/modern-text.C0w4dLp7.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "2.2.0",
4
+ "version": "2.2.2",
5
5
  "packageManager": "pnpm@10.18.1",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",