@unmade/text-renderer 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var nn=0,lr=-3;function Je(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function ms(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new Je,this.dtree=new Je}var ur=new Je,cr=new Je,rn=new Uint8Array(30),sn=new Uint16Array(30),pr=new Uint8Array(30),hr=new Uint16Array(30),ys=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bn=new Je,de=new Uint8Array(320);function fr(e,t,n,r){var s,o;for(s=0;s<n;++s)e[s]=0;for(s=0;s<30-n;++s)e[s+n]=s/n|0;for(o=r,s=0;s<30;++s)t[s]=o,o+=1<<e[s]}function vs(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n}var Sn=new Uint16Array(16);function Pt(e,t,n,r){var s,o;for(s=0;s<16;++s)e.table[s]=0;for(s=0;s<r;++s)e.table[t[n+s]]++;for(e.table[0]=0,o=0,s=0;s<16;++s)Sn[s]=o,o+=e.table[s];for(s=0;s<r;++s)t[n+s]&&(e.trans[Sn[t[n+s]]++]=s)}function bs(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=e.tag&1;return e.tag>>>=1,t}function me(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,r+n}function Wt(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,r=0,s=0,o=e.tag;do r=2*r+(o&1),o>>>=1,++s,n+=t.table[s],r-=t.table[s];while(r>=0);return e.tag=o,e.bitcount-=s,t.trans[n+r]}function Ss(e,t,n){var r,s,o,a,i,l;for(r=me(e,5,257),s=me(e,5,1),o=me(e,4,4),a=0;a<19;++a)de[a]=0;for(a=0;a<o;++a){var c=me(e,3,0);de[ys[a]]=c}for(Pt(bn,de,0,19),i=0;i<r+s;){var u=Wt(e,bn);switch(u){case 16:var h=de[i-1];for(l=me(e,2,3);l;--l)de[i++]=h;break;case 17:for(l=me(e,3,3);l;--l)de[i++]=0;break;case 18:for(l=me(e,7,11);l;--l)de[i++]=0;break;default:de[i++]=u;break}}Pt(t,de,0,r),Pt(n,de,r,s)}function xn(e,t,n){for(;;){var r=Wt(e,t);if(r===256)return nn;if(r<256)e.dest[e.destLen++]=r;else{var s,o,a,i;for(r-=257,s=me(e,rn[r],sn[r]),o=Wt(e,n),a=e.destLen-me(e,pr[o],hr[o]),i=a;i<a+s;++i)e.dest[e.destLen++]=e.dest[i]}}}function xs(e){for(var t,n,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],n=e.source[e.sourceIndex+3],n=256*n+e.source[e.sourceIndex+2],t!==(~n&65535))return lr;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,nn}function dr(e,t){var n=new ms(e,t),r,s,o;do{switch(r=bs(n),s=me(n,2,0),s){case 0:o=xs(n);break;case 1:o=xn(n,ur,cr);break;case 2:Ss(n,n.ltree,n.dtree),o=xn(n,n.ltree,n.dtree);break;default:o=lr}if(o!==nn)throw new Error("Data error")}while(!r);return n.destLen<n.dest.length?typeof n.dest.slice=="function"?n.dest.slice(0,n.destLen):n.dest.subarray(0,n.destLen):n.dest}vs(ur,cr);fr(rn,sn,4,3);fr(pr,hr,2,1);rn[28]=0;sn[28]=258;function _e(e,t,n,r,s){return Math.pow(1-s,3)*e+3*Math.pow(1-s,2)*s*t+3*(1-s)*Math.pow(s,2)*n+Math.pow(s,3)*r}function Ne(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Ne.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)};Ne.prototype.addPoint=function(e,t){typeof e=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),typeof t=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))};Ne.prototype.addX=function(e){this.addPoint(e,null)};Ne.prototype.addY=function(e){this.addPoint(null,e)};Ne.prototype.addBezier=function(e,t,n,r,s,o,a,i){const l=[e,t],c=[n,r],u=[s,o],h=[a,i];this.addPoint(e,t),this.addPoint(a,i);for(let p=0;p<=1;p++){const d=6*l[p]-12*c[p]+6*u[p],f=-3*l[p]+9*c[p]-9*u[p]+3*h[p],g=3*c[p]-3*l[p];if(f===0){if(d===0)continue;const I=-g/d;0<I&&I<1&&(p===0&&this.addX(_e(l[p],c[p],u[p],h[p],I)),p===1&&this.addY(_e(l[p],c[p],u[p],h[p],I)));continue}const y=Math.pow(d,2)-4*g*f;if(y<0)continue;const T=(-d+Math.sqrt(y))/(2*f);0<T&&T<1&&(p===0&&this.addX(_e(l[p],c[p],u[p],h[p],T)),p===1&&this.addY(_e(l[p],c[p],u[p],h[p],T)));const R=(-d-Math.sqrt(y))/(2*f);0<R&&R<1&&(p===0&&this.addX(_e(l[p],c[p],u[p],h[p],R)),p===1&&this.addY(_e(l[p],c[p],u[p],h[p],R)))}};Ne.prototype.addQuad=function(e,t,n,r,s,o){const a=e+.6666666666666666*(n-e),i=t+2/3*(r-t),l=a+1/3*(s-e),c=i+1/3*(o-t);this.addBezier(e,t,a,i,l,c,s,o)};var gr=Ne;function V(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var Ke={};function mr(e,t){const n=Math.floor(e),r=e-n;if(Ke[t]||(Ke[t]={}),Ke[t][r]!==void 0){const o=Ke[t][r];return n+o}const s=+(Math.round(r+"e+"+t)+"e-"+t);return Ke[t][r]=s,n+s}function yr(e){let t=[[]],n=0,r=0;for(let s=0;s<e.length;s+=1){const o=t[t.length-1],a=e[s],i=o[0],l=o[1],c=o[o.length-1],u=e[s+1];o.push(a),a.type==="M"?(n=a.x,r=a.y):a.type==="L"&&(!u||u.command==="Z")?Math.abs(a.x-n)>1||Math.abs(a.y-r)>1||o.pop():a.type==="L"&&c&&c.x===a.x&&c.y===a.y?o.pop():a.type==="Z"&&(i&&l&&c&&i.type==="M"&&l.type==="L"&&c.type==="L"&&c.x===i.x&&c.y===i.y&&(o.shift(),o[0].type="M"),s+1<e.length&&t.push([]))}return e=[].concat.apply([],t),e}function Ts(e){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},e)}function ks(e){return parseInt(e)===e&&(e={decimalPlaces:e,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},e)}V.prototype.fromSVG=function(e,t={}){typeof SVGPathElement<"u"&&e instanceof SVGPathElement&&(e=e.getAttribute("d")),t=Ts(t),this.commands=[];const n="0123456789",r="MmLlQqCcZzHhVv",s="SsTtAa",o="-+";let a={},i=[""],l=!1;function c(f){return f.filter(g=>g.length).map(g=>{let y=parseFloat(g);return(t.decimalPlaces||t.decimalPlaces===0)&&(y=mr(y,t.decimalPlaces)),y})}function u(f){if(!this.commands.length)return f;const g=this.commands[this.commands.length-1];for(let y=0;y<f.length;y++)f[y]+=g[y&1?"y":"x"];return f}function h(){if(a.type===void 0)return;const f=a.type.toUpperCase(),g=f!=="Z"&&a.type.toUpperCase()!==a.type;let y=c(i);if(i=[""],!y.length&&f!=="Z")return;g&&f!=="H"&&f!=="V"&&(y=u.apply(this,[y]));const T=this.commands.length&&this.commands[this.commands.length-1].x||0,R=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(f){case"M":this.moveTo(...y);break;case"L":this.lineTo(...y);break;case"V":for(let I=0;I<y.length;I++){let C=0;g&&(C=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(T,y[I]+C)}break;case"H":for(let I=0;I<y.length;I++){let C=0;g&&(C=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(y[I]+C,R)}break;case"C":this.bezierCurveTo(...y);break;case"Q":this.quadraticCurveTo(...y);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(const I in this.commands[this.commands.length-1])this.commands[this.commands.length-1][I]===void 0&&(this.commands[this.commands.length-1][I]=0)}for(let f=0;f<e.length;f++){const g=e.charAt(f),y=i[i.length-1];if(n.indexOf(g)>-1)i[i.length-1]+=g;else if(o.indexOf(g)>-1)if(!a.type&&!this.commands.length&&(a.type="L"),g==="-")!a.type||y.indexOf("-")>0?l=!0:y.length?i.push("-"):i[i.length-1]=g;else if(!a.type||y.length>0)l=!0;else continue;else if(r.indexOf(g)>-1)a.type?(h.apply(this),a={type:g}):a.type=g;else{if(s.indexOf(g)>-1)throw new Error("Unsupported path command: "+g+". Currently supported commands are "+r.split("").join(", ")+".");` ,
2
- \r\f\v`.indexOf(g)>-1?i.push(""):g==="."?!a.type||y.indexOf(g)>-1?l=!0:i[i.length-1]+=g:l=!0}if(l)throw new Error("Unexpected character: "+g+" at offset "+f)}h.apply(this),t.optimize&&(this.commands=yr(this.commands));const p=t.flipY;let d=t.flipYBase;if(p===!0&&t.flipYBase===void 0){const f=this.getBoundingBox();d=f.y1+f.y2}for(const f in this.commands){const g=this.commands[f];for(const y in g)["x","x1","x2"].includes(y)?this.commands[f][y]=t.x+g[y]*t.scale:["y","y1","y2"].includes(y)&&(this.commands[f][y]=t.y+(p?d-g[y]:g[y])*t.scale)}return this};V.fromSVG=function(e,t){return new V().fromSVG(e,t)};V.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})};V.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})};V.prototype.curveTo=V.prototype.bezierCurveTo=function(e,t,n,r,s,o){this.commands.push({type:"C",x1:e,y1:t,x2:n,y2:r,x:s,y:o})};V.prototype.quadTo=V.prototype.quadraticCurveTo=function(e,t,n,r){this.commands.push({type:"Q",x1:e,y1:t,x:n,y:r})};V.prototype.close=V.prototype.closePath=function(){this.commands.push({type:"Z"})};V.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof gr){const t=e;this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),this.close();return}Array.prototype.push.apply(this.commands,e)};V.prototype.getBoundingBox=function(){const e=new gr;let t=0,n=0,r=0,s=0;for(let o=0;o<this.commands.length;o++){const a=this.commands[o];switch(a.type){case"M":e.addPoint(a.x,a.y),t=r=a.x,n=s=a.y;break;case"L":e.addPoint(a.x,a.y),r=a.x,s=a.y;break;case"Q":e.addQuad(r,s,a.x1,a.y1,a.x,a.y),r=a.x,s=a.y;break;case"C":e.addBezier(r,s,a.x1,a.y1,a.x2,a.y2,a.x,a.y),r=a.x,s=a.y;break;case"Z":r=t,s=n;break;default:throw new Error("Unexpected path command "+a.type)}}return e.isEmpty()&&e.addPoint(0,0),e};V.prototype.draw=function(e){const t=this._layers;if(t&&t.length){for(let r=0;r<t.length;r++)this.draw.call(t[r],e);return}const n=this._image;if(n){e.drawImage(n.image,n.x,n.y,n.width,n.height);return}e.beginPath();for(let r=0;r<this.commands.length;r+=1){const s=this.commands[r];s.type==="M"?e.moveTo(s.x,s.y):s.type==="L"?e.lineTo(s.x,s.y):s.type==="C"?e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y):s.type==="Q"?e.quadraticCurveTo(s.x1,s.y1,s.x,s.y):s.type==="Z"&&this.stroke&&this.strokeWidth&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())};V.prototype.toPathData=function(e){e=ks(e);function t(i){const l=mr(i,e.decimalPlaces);return Math.round(i)===l?""+l:l.toFixed(e.decimalPlaces)}function n(){let i="";for(let l=0;l<arguments.length;l+=1){const c=arguments[l];c>=0&&l>0&&(i+=" "),i+=t(c)}return i}let r=this.commands;e.optimize&&(r=JSON.parse(JSON.stringify(this.commands)),r=yr(r));const s=e.flipY;let o=e.flipYBase;if(s===!0&&o===void 0){const i=new V;i.extend(r);const l=i.getBoundingBox();o=l.y1+l.y2}let a="";for(let i=0;i<r.length;i+=1){const l=r[i];l.type==="M"?a+="M"+n(l.x,s?o-l.y:l.y):l.type==="L"?a+="L"+n(l.x,s?o-l.y:l.y):l.type==="C"?a+="C"+n(l.x1,s?o-l.y1:l.y1,l.x2,s?o-l.y2:l.y2,l.x,s?o-l.y:l.y):l.type==="Q"?a+="Q"+n(l.x1,s?o-l.y1:l.y1,l.x,s?o-l.y:l.y):l.type==="Z"&&(a+="Z")}return a};V.prototype.toSVG=function(e,t){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),t||(t=this.toPathData(e));let n='<path d="';return n+=t,n+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?n+=' fill="none"':n+=' fill="'+this.fill+'"'),this.stroke&&(n+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),n+="/>",n};V.prototype.toDOMElement=function(e,t){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),t||(t=this.toPathData(e));const n=t,r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",n),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?r.setAttribute("fill","none"):r.setAttribute("fill",this.fill)),this.stroke&&(r.setAttribute("stroke",this.stroke),r.setAttribute("stroke-width",this.strokeWidth)),r};var We=V;function vr(e){throw new Error(e)}function Tn(e,t){e||vr(t)}var O={fail:vr,argument:Tn,assert:Tn},kn=32768,On=2147483648,Os=-32768,Rs=32767+1/65536,je={},b={},w={};function he(e){return function(){return e}}b.BYTE=function(e){return O.argument(e>=0&&e<=255,"Byte value should be between 0 and 255."),[e]};w.BYTE=he(1);b.CHAR=function(e){return[e.charCodeAt(0)]};w.CHAR=he(1);b.CHARARRAY=function(e){(e===null||typeof e>"u")&&(e="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));const t=[];for(let n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t};w.CHARARRAY=function(e){return typeof e>"u"?0:e.length};b.USHORT=function(e){return[e>>8&255,e&255]};w.USHORT=he(2);b.SHORT=function(e){return e>=kn&&(e=-(2*kn-e)),[e>>8&255,e&255]};w.SHORT=he(2);b.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]};w.UINT24=he(3);b.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]};w.ULONG=he(4);b.LONG=function(e){return e>=On&&(e=-(2*On-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]};w.LONG=he(4);b.FLOAT=function(e){if(e>Rs||e<Os)throw new Error(`Value ${e} is outside the range of representable values in 16.16 format`);const t=Math.round(e*65536)<<0;return b.ULONG(t)};w.FLOAT=w.ULONG;b.FIXED=b.ULONG;w.FIXED=w.ULONG;b.FWORD=b.SHORT;w.FWORD=w.SHORT;b.UFWORD=b.USHORT;w.UFWORD=w.USHORT;b.F2DOT14=function(e){return b.USHORT(e*16384)};w.F2DOT14=w.USHORT;b.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]};w.LONGDATETIME=he(8);b.TAG=function(e){return O.argument(e.length===4,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]};w.TAG=he(4);b.Card8=b.BYTE;w.Card8=w.BYTE;b.Card16=b.USHORT;w.Card16=w.USHORT;b.OffSize=b.BYTE;w.OffSize=w.BYTE;b.SID=b.USHORT;w.SID=w.USHORT;b.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?(e=e-108,[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e<=32767?b.NUMBER16(e):b.NUMBER32(e)};w.NUMBER=function(e){return b.NUMBER(e).length};b.NUMBER16=function(e){return[28,e>>8&255,e&255]};w.NUMBER16=he(3);b.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]};w.NUMBER32=he(5);b.REAL=function(e){let t=e.toString();const n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(n){const o=parseFloat("1e"+((n[2]?+n[2]:0)+n[1].length));t=(Math.round(e*o)/o).toString()}let r="";for(let o=0,a=t.length;o<a;o+=1){const i=t[o];i==="e"?r+=t[++o]==="-"?"c":"b":i==="."?r+="a":i==="-"?r+="e":r+=i}r+=r.length&1?"f":"ff";const s=[30];for(let o=0,a=r.length;o<a;o+=2)s.push(parseInt(r.substr(o,2),16));return s};w.REAL=function(e){return b.REAL(e).length};b.NAME=b.CHARARRAY;w.NAME=w.CHARARRAY;b.STRING=b.CHARARRAY;w.STRING=w.CHARARRAY;je.UTF8=function(e,t,n){const r=[],s=n;for(let o=0;o<s;o++,t+=1)r[o]=e.getUint8(t);return String.fromCharCode.apply(null,r)};je.UTF16=function(e,t,n){const r=[],s=n/2;for(let o=0;o<s;o++,t+=2)r[o]=e.getUint16(t);return String.fromCharCode.apply(null,r)};b.UTF16=function(e){const t=[];for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t[t.length]=r>>8&255,t[t.length]=r&255}return t};w.UTF16=function(e){return e.length*2};var bt={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};je.MACSTRING=function(e,t,n,r){const s=bt[r];if(s===void 0)return;let o="";for(let a=0;a<n;a++){const i=e.getUint8(t+a);i<=127?o+=String.fromCharCode(i):o+=s[i&127]}return o};var ct=typeof WeakMap=="function"&&new WeakMap,pt,Us=function(e){if(!pt){pt={};for(let s in bt)pt[s]=new String(s)}const t=pt[e];if(t===void 0)return;if(ct){const s=ct.get(t);if(s!==void 0)return s}const n=bt[e];if(n===void 0)return;const r={};for(let s=0;s<n.length;s++)r[n.charCodeAt(s)]=s+128;return ct&&ct.set(t,r),r};b.MACSTRING=function(e,t){const n=Us(t);if(n===void 0)return;const r=[];for(let s=0;s<e.length;s++){let o=e.charCodeAt(s);if(o>=128&&(o=n[o],o===void 0))return;r[s]=o}return r};w.MACSTRING=function(e,t){const n=b.MACSTRING(e,t);return n!==void 0?n.length:0};function jt(e){return e>=-128&&e<=127}function Is(e,t,n){let r=0;const s=e.length;for(;t<s&&r<64&&e[t]===0;)++t,++r;return n.push(128|r-1),t}function ws(e,t,n){let r=0;const s=e.length;let o=t;for(;o<s&&r<64;){const a=e[o];if(!jt(a)||a===0&&o+1<s&&e[o+1]===0)break;++o,++r}n.push(r-1);for(let a=t;a<o;++a)n.push(e[a]+256&255);return o}function Ls(e,t,n){let r=0;const s=e.length;let o=t;for(;o<s&&r<64;){const a=e[o];if(a===0||jt(a)&&o+1<s&&jt(e[o+1]))break;++o,++r}n.push(64|r-1);for(let a=t;a<o;++a){const i=e[a];n.push(i+65536>>8&255,i+256&255)}return o}b.VARDELTAS=function(e){let t=0;const n=[];for(;t<e.length;){const r=e[t];r===0?t=Is(e,t,n):r>=-128&&r<=127?t=ws(e,t,n):t=Ls(e,t,n)}return n};b.INDEX=function(e){let t=1;const n=[t],r=[];for(let i=0;i<e.length;i+=1){const l=b.OBJECT(e[i]);Array.prototype.push.apply(r,l),t+=l.length,n.push(t)}if(r.length===0)return[0,0];const s=[],o=1+Math.floor(Math.log(t)/Math.log(2))/8|0,a=[void 0,b.BYTE,b.USHORT,b.UINT24,b.ULONG][o];for(let i=0;i<n.length;i+=1){const l=a(n[i]);Array.prototype.push.apply(s,l)}return Array.prototype.concat(b.Card16(e.length),b.OffSize(o),s,r)};w.INDEX=function(e){return b.INDEX(e).length};b.DICT=function(e){let t=[];const n=Object.keys(e),r=n.length;for(let s=0;s<r;s+=1){const o=parseInt(n[s],0),a=e[o],i=b.OPERAND(a.value,a.type),l=b.OPERATOR(o);for(let c=0;c<i.length;c++)t.push(i[c]);for(let c=0;c<l.length;c++)t.push(l[c])}return t};w.DICT=function(e){return b.DICT(e).length};b.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]};b.OPERAND=function(e,t){let n=[];if(Array.isArray(t))for(let r=0;r<t.length;r+=1){O.argument(e.length===t.length,"Not enough arguments given for type"+t);const s=b.OPERAND(e[r],t[r]);for(let o=0;o<s.length;o++)n.push(s[o])}else if(t==="SID"){const r=b.NUMBER(e);for(let s=0;s<r.length;s++)n.push(r[s])}else if(t==="offset"){const r=b.NUMBER32(e);for(let s=0;s<r.length;s++)n.push(r[s])}else if(t==="number"){const r=b.NUMBER(e);for(let s=0;s<r.length;s++)n.push(r[s])}else if(t==="real"){const r=b.REAL(e);for(let s=0;s<r.length;s++)n.push(r[s])}else throw new Error("Unknown operand type "+t);return n};b.OP=b.BYTE;w.OP=w.BYTE;var ht=typeof WeakMap=="function"&&new WeakMap;b.CHARSTRING=function(e){if(ht){const r=ht.get(e);if(r!==void 0)return r}let t=[];const n=e.length;for(let r=0;r<n;r+=1){const s=e[r],o=b[s.type](s.value);for(let a=0;a<o.length;a++)t.push(o[a])}return ht&&ht.set(e,t),t};w.CHARSTRING=function(e){return b.CHARSTRING(e).length};b.OBJECT=function(e){const t=b[e.type];return O.argument(t!==void 0,"No encoding function for type "+e.type),t(e.value)};w.OBJECT=function(e){const t=w[e.type];return O.argument(t!==void 0,"No sizeOf function for type "+e.type),t(e.value)};b.TABLE=function(e){let t=[];const n=(e.fields||[]).length,r=[],s=[];for(let o=0;o<n;o+=1){const a=e.fields[o],i=b[a.type];O.argument(i!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");let l=e[a.name];l===void 0&&(l=a.value);const c=i(l);if(a.type==="TABLE")l.fields!==null&&(s.push(t.length),r.push(c)),t.push(0,0);else for(let u=0;u<c.length;u++)t.push(c[u])}for(let o=0;o<r.length;o+=1){const a=s[o],i=t.length;O.argument(i<65536,"Table "+e.tableName+" too big."),t[a]=i>>8,t[a+1]=i&255;for(let l=0;l<r[o].length;l++)t.push(r[o][l])}return t};w.TABLE=function(e){let t=0;const n=(e.fields||[]).length;for(let r=0;r<n;r+=1){const s=e.fields[r],o=w[s.type];O.argument(o!==void 0,"No sizeOf function for field type "+s.type+" ("+s.name+")");let a=e[s.name];a===void 0&&(a=s.value),t+=o(a),s.type==="TABLE"&&(t+=2)}return t};b.RECORD=b.TABLE;w.RECORD=w.TABLE;b.LITERAL=function(e){return e};w.LITERAL=function(e){return e.length};function _(e,t,n){if(t&&t.length)for(let r=0;r<t.length;r+=1){const s=t[r];this[s.name]=s.value}if(this.tableName=e,this.fields=t,n){const r=Object.keys(n);for(let s=0;s<r.length;s+=1){const o=r[s],a=n[o];this[o]!==void 0&&(this[o]=a)}}}_.prototype.encode=function(){return b.TABLE(this)};_.prototype.sizeOf=function(){return w.TABLE(this)};function $e(e,t,n){n===void 0&&(n=t.length);const r=new Array(t.length+1);r[0]={name:e+"Count",type:"USHORT",value:n};for(let s=0;s<t.length;s++)r[s+1]={name:e+s,type:"USHORT",value:t[s]};return r}function $t(e,t,n){const r=t.length,s=new Array(r+1);s[0]={name:e+"Count",type:"USHORT",value:r};for(let o=0;o<r;o++)s[o+1]={name:e+o,type:"TABLE",value:n(t[o],o)};return s}function Ye(e,t,n){const r=t.length;let s=[];s[0]={name:e+"Count",type:"USHORT",value:r};for(let o=0;o<r;o++)s=s.concat(n(t[o],o));return s}function St(e){e.format===1?_.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat($e("glyph",e.glyphs))):e.format===2?_.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ye("rangeRecord",e.ranges,function(t,n){return[{name:"startGlyphID"+n,type:"USHORT",value:t.start},{name:"endGlyphID"+n,type:"USHORT",value:t.end},{name:"startCoverageIndex"+n,type:"USHORT",value:t.index}]}))):O.assert(!1,"Coverage format must be 1 or 2.")}St.prototype=Object.create(_.prototype);St.prototype.constructor=St;function xt(e){_.call(this,"scriptListTable",Ye("scriptRecord",e,function(t,n){const r=t.script;let s=r.defaultLangSys;return O.assert(!!s,"Unable to write GSUB: script "+t.tag+" has no default language system."),[{name:"scriptTag"+n,type:"TAG",value:t.tag},{name:"script"+n,type:"TABLE",value:new _("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new _("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat($e("featureIndex",s.featureIndexes)))}].concat(Ye("langSys",r.langSysRecords,function(o,a){const i=o.langSys;return[{name:"langSysTag"+a,type:"TAG",value:o.tag},{name:"langSys"+a,type:"TABLE",value:new _("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:i.reqFeatureIndex}].concat($e("featureIndex",i.featureIndexes)))}]})))}]}))}xt.prototype=Object.create(_.prototype);xt.prototype.constructor=xt;function Tt(e){_.call(this,"featureListTable",Ye("featureRecord",e,function(t,n){const r=t.feature;return[{name:"featureTag"+n,type:"TAG",value:t.tag},{name:"feature"+n,type:"TABLE",value:new _("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat($e("lookupListIndex",r.lookupListIndexes)))}]}))}Tt.prototype=Object.create(_.prototype);Tt.prototype.constructor=Tt;function kt(e,t){_.call(this,"lookupListTable",$t("lookup",e,function(n){let r=t[n.lookupType];return O.assert(!!r,"Unable to write GSUB lookup type "+n.lookupType+" tables."),new _("lookupTable",[{name:"lookupType",type:"USHORT",value:n.lookupType},{name:"lookupFlag",type:"USHORT",value:n.lookupFlag}].concat($t("subtable",n.subtables,r)))}))}kt.prototype=Object.create(_.prototype);kt.prototype.constructor=kt;function Ot(e){e.format===1?_.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:e.startGlyph}].concat($e("glyph",e.classes))):e.format===2?_.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Ye("rangeRecord",e.ranges,function(t,n){return[{name:"startGlyphID"+n,type:"USHORT",value:t.start},{name:"endGlyphID"+n,type:"USHORT",value:t.end},{name:"class"+n,type:"USHORT",value:t.classId}]}))):O.assert(!1,"Class format must be 1 or 2.")}Ot.prototype=Object.create(_.prototype);Ot.prototype.constructor=Ot;var v={Table:_,Record:_,Coverage:St,ClassDef:Ot,ScriptList:xt,FeatureList:Tt,LookupList:kt,ushortList:$e,tableList:$t,recordList:Ye};function Rn(e,t){return e.getUint8(t)}function Rt(e,t){return e.getUint16(t,!1)}function Cs(e,t){return e.getInt16(t,!1)}function br(e,t){return(e.getUint16(t)<<8)+e.getUint8(t+2)}function on(e,t){return e.getUint32(t,!1)}function Es(e,t){return e.getInt32(t,!1)}function Sr(e,t){const n=e.getInt16(t,!1),r=e.getUint16(t+2,!1);return n+r/65535}function Ds(e,t){let n="";for(let r=t;r<t+4;r+=1)n+=String.fromCharCode(e.getInt8(r));return n}function Ms(e,t,n){let r=0;for(let s=0;s<n;s+=1)r<<=8,r+=e.getUint8(t+s);return r}function As(e,t,n){const r=[];for(let s=t;s<n;s+=1)r.push(e.getUint8(s));return r}function Ns(e){let t="";for(let n=0;n<e.length;n+=1)t+=String.fromCharCode(e[n]);return t}var Ps={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},W={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function m(e,t){this.data=e,this.offset=t,this.relativeOffset=0}m.prototype.parseByte=function(){const e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e};m.prototype.parseChar=function(){const e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e};m.prototype.parseCard8=m.prototype.parseByte;m.prototype.parseUShort=function(){const e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e};m.prototype.parseCard16=m.prototype.parseUShort;m.prototype.parseSID=m.prototype.parseUShort;m.prototype.parseOffset16=m.prototype.parseUShort;m.prototype.parseShort=function(){const e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e};m.prototype.parseF2Dot14=function(){const e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e};m.prototype.parseUInt24=function(){const e=br(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,e};m.prototype.parseULong=function(){const e=on(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e};m.prototype.parseLong=function(){const e=Es(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e};m.prototype.parseOffset32=m.prototype.parseULong;m.prototype.parseFixed=function(){const e=Sr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e};m.prototype.parseString=function(e){const t=this.data,n=this.offset+this.relativeOffset;let r="";this.relativeOffset+=e;for(let s=0;s<e;s++)r+=String.fromCharCode(t.getUint8(n+s));return r};m.prototype.parseTag=function(){return this.parseString(4)};m.prototype.parseLongDateTime=function(){let e=on(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e};m.prototype.parseVersion=function(e){const t=Rt(this.data,this.offset+this.relativeOffset),n=Rt(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,e===void 0&&(e=4096),t+n/e/10};m.prototype.skip=function(e,t){t===void 0&&(t=1),this.relativeOffset+=Ps[e]*t};m.prototype.parseULongList=function(e){e===void 0&&(e=this.parseULong());const t=new Array(e),n=this.data;let r=this.offset+this.relativeOffset;for(let s=0;s<e;s++)t[s]=n.getUint32(r),r+=4;return this.relativeOffset+=e*4,t};m.prototype.parseOffset16List=m.prototype.parseUShortList=function(e){e===void 0&&(e=this.parseUShort());const t=new Array(e),n=this.data;let r=this.offset+this.relativeOffset;for(let s=0;s<e;s++)t[s]=n.getUint16(r),r+=2;return this.relativeOffset+=e*2,t};m.prototype.parseShortList=function(e){const t=new Array(e),n=this.data;let r=this.offset+this.relativeOffset;for(let s=0;s<e;s++)t[s]=n.getInt16(r),r+=2;return this.relativeOffset+=e*2,t};m.prototype.parseByteList=function(e){const t=new Array(e),n=this.data;let r=this.offset+this.relativeOffset;for(let s=0;s<e;s++)t[s]=n.getUint8(r++);return this.relativeOffset+=e,t};m.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.call(this);return n};m.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.call(this);return n};m.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());const n=new Array(e),r=Object.keys(t);for(let s=0;s<e;s++){const o={};for(let a=0;a<r.length;a++){const i=r[a],l=t[i];o[i]=l.call(this)}n[s]=o}return n};m.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());const n=new Array(e),r=Object.keys(t);for(let s=0;s<e;s++){const o={};for(let a=0;a<r.length;a++){const i=r[a],l=t[i];o[i]=l.call(this)}n[s]=o}return n};m.prototype.parseTupleRecords=function(e,t){let n=[];for(let r=0;r<e;r++){let s=[];for(let o=0;o<t;o++)s.push(this.parseF2Dot14());n.push(s)}return n};m.prototype.parseStruct=function(e){if(typeof e=="function")return e.call(this);{const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const s=t[r],o=e[s];n[s]=o.call(this)}return n}};m.prototype.parseValueRecord=function(e){if(e===void 0&&(e=this.parseUShort()),e===0)return;const t={};return e&1&&(t.xPlacement=this.parseShort()),e&2&&(t.yPlacement=this.parseShort()),e&4&&(t.xAdvance=this.parseShort()),e&8&&(t.yAdvance=this.parseShort()),e&16&&(t.xPlaDevice=void 0,this.parseShort()),e&32&&(t.yPlaDevice=void 0,this.parseShort()),e&64&&(t.xAdvDevice=void 0,this.parseShort()),e&128&&(t.yAdvDevice=void 0,this.parseShort()),t};m.prototype.parseValueRecordList=function(){const e=this.parseUShort(),t=this.parseUShort(),n=new Array(t);for(let r=0;r<t;r++)n[r]=this.parseValueRecord(e);return n};m.prototype.parsePointer=function(e){const t=this.parseOffset16();if(t>0)return new m(this.data,this.offset+t).parseStruct(e)};m.prototype.parsePointer32=function(e){const t=this.parseOffset32();if(t>0)return new m(this.data,this.offset+t).parseStruct(e)};m.prototype.parseListOfLists=function(e){const t=this.parseOffset16List(),n=t.length,r=this.relativeOffset,s=new Array(n);for(let o=0;o<n;o++){const a=t[o];if(a===0){s[o]=void 0;continue}if(this.relativeOffset=a,e){const i=this.parseOffset16List(),l=new Array(i.length);for(let c=0;c<i.length;c++)this.relativeOffset=a+i[c],l[c]=e.call(this);s[o]=l}else s[o]=this.parseUShortList()}return this.relativeOffset=r,s};m.prototype.parseCoverage=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort(),n=this.parseUShort();if(t===1)return{format:1,glyphs:this.parseUShortList(n)};if(t===2){const r=new Array(n);for(let s=0;s<n;s++)r[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:r}}throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.")};m.prototype.parseClassDef=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();return t===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:t===2?{format:2,ranges:this.parseRecordList({start:m.uShort,end:m.uShort,classId:m.uShort})}:(console.warn(`0x${e.toString(16)}: This font file uses an invalid ClassDef format of ${t}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:t})};m.list=function(e,t){return function(){return this.parseList(e,t)}};m.list32=function(e,t){return function(){return this.parseList32(e,t)}};m.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}};m.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}};m.pointer=function(e){return function(){return this.parsePointer(e)}};m.pointer32=function(e){return function(){return this.parsePointer32(e)}};m.tag=m.prototype.parseTag;m.byte=m.prototype.parseByte;m.uShort=m.offset16=m.prototype.parseUShort;m.uShortList=m.prototype.parseUShortList;m.uInt24=m.prototype.parseUInt24;m.uLong=m.offset32=m.prototype.parseULong;m.uLongList=m.prototype.parseULongList;m.fixed=m.prototype.parseFixed;m.f2Dot14=m.prototype.parseF2Dot14;m.struct=m.prototype.parseStruct;m.coverage=m.prototype.parseCoverage;m.classDef=m.prototype.parseClassDef;var Un={reserved:m.uShort,reqFeatureIndex:m.uShort,featureIndexes:m.uShortList};m.prototype.parseScriptList=function(){return this.parsePointer(m.recordList({tag:m.tag,script:m.pointer({defaultLangSys:m.pointer(Un),langSysRecords:m.recordList({tag:m.tag,langSys:m.pointer(Un)})})}))||[]};m.prototype.parseFeatureList=function(){return this.parsePointer(m.recordList({tag:m.tag,feature:m.pointer({featureParams:m.offset16,lookupListIndexes:m.uShortList})}))||[]};m.prototype.parseLookupList=function(e){return this.parsePointer(m.list(m.pointer(function(){const t=this.parseUShort();O.argument(1<=t&&t<=9,"GPOS/GSUB lookup type "+t+" unknown.");const n=this.parseUShort(),r=n&16;return{lookupType:t,lookupFlag:n,subtables:this.parseList(m.pointer(e[t])),markFilteringSet:r?this.parseUShort():void 0}})))||[]};m.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){const e=this.parseUShort(),t=this.parseUShort();return O.argument(e===1&&t<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:m.offset32,featureTableSubstitutionOffset:m.offset32})})||[]};m.prototype.parseVariationStore=function(){const e=this.relativeOffset,t=this.parseUShort(),n={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=e+t+2,n};m.prototype.parseItemVariationStore=function(){const e=this.relativeOffset,t={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},n=this.parseOffset32(),r=this.parseUShort(),s=this.parseULongList(r);this.relativeOffset=e+n,t.variationRegions=this.parseVariationRegionList();for(let o=0;o<r;o++){const a=s[o];this.relativeOffset=e+a,t.itemVariationSubtables.push(this.parseItemVariationSubtable())}return t};m.prototype.parseVariationRegionList=function(){const e=this.parseUShort(),t=this.parseUShort();return this.parseRecordList(t,{regionAxes:m.recordList(e,{startCoord:m.f2Dot14,peakCoord:m.f2Dot14,endCoord:m.f2Dot14})})};m.prototype.parseItemVariationSubtable=function(){const e=this.parseUShort(),t=this.parseUShort(),n=this.parseUShortList(),r=n.length;return{regionIndexes:n,deltaSets:e&&r?this.parseDeltaSets(e,t,r):[]}};m.prototype.parseDeltaSetIndexMap=function(){const e=this.parseByte(),t=this.parseByte(),n=[];let r=0;switch(e){case 0:r=this.parseUShort();break;case 1:r=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${e}`)}if(!r)return{format:e,entryFormat:t};const s=(t&W.INNER_INDEX_BIT_COUNT_MASK)+1,o=((t&W.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let a=0;a<r;a++){let i;if(o===1)i=this.parseByte();else if(o===2)i=this.parseUShort();else if(o===3)i=this.parseUInt24();else if(o===4)i=this.getULong();else throw new Error(`Invalid entry size of ${o}`);const l=i>>s,c=i&(1<<s)-1;n.push({outerIndex:l,innerIndex:c})}return{format:e,entryFormat:t,map:n}};m.prototype.parseDeltaSets=function(e,t,n){const r=Array.from({length:e},()=>[]),s=t&W.LONG_WORDS,o=t&W.WORD_DELTA_COUNT_MASK;if(o>n)throw Error("wordCount must be less than or equal to regionIndexCount");const a=(s?this.parseLong:this.parseShort).bind(this),i=(s?this.parseShort:this.parseChar).bind(this);for(let l=0;l<e;l++)for(let c=0;c<n;c++)c<o?r[l].push(a()):r[l].push(i());return r};m.prototype.parseTupleVariationStoreList=function(e,t,n){const r=this.parseUShort(),s=this.parseUShort()&1,o=this.parseOffset32(),a=(s?this.parseULong:this.parseUShort).bind(this),i={};let l=a();s||(l*=2);let c;for(let u=0;u<r;u++){c=a(),s||(c*=2);const h=c-l;i[u]=h?this.parseTupleVariationStore(o+l,e,t,n,u):void 0,l=c}return i};m.prototype.parseTupleVariationStore=function(e,t,n,r,s){const o=this.relativeOffset;this.relativeOffset=e,n==="cvar"&&(this.relativeOffset+=4);const a=this.parseUShort(),i=!!(a&W.SHARED_POINT_NUMBERS),l=a&W.COUNT_MASK;let c=this.parseOffset16();const u=[];let h=[];for(let f=0;f<l;f++){const g=this.parseTupleVariationHeader(t,n);u.push(g)}this.relativeOffset!==e+c&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${e+c}, actually ${this.relativeOffset}`),this.relativeOffset=e+c),i&&(h=this.parsePackedPointNumbers());let p=this.relativeOffset;for(let f=0;f<l;f++){const g=u[f];g.privatePoints=[],this.relativeOffset=p,n==="cvar"&&!g.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),g.flags.privatePointNumbers&&(g.privatePoints=this.parsePackedPointNumbers()),delete g.flags;const y=this.offset,T=this.relativeOffset,R=I=>{let C,P;const G=()=>{let A=0;if(n==="gvar"){if(A=g.privatePoints.length||h.length,!A){const $=r.get(s);$.path,A=$.points.length,A+=4}}else n==="cvar"&&(A=r.length);this.offset=y,this.relativeOffset=T,C=this.parsePackedDeltas(A),n==="gvar"&&(P=this.parsePackedDeltas(A))};return{configurable:!0,get:function(){return C===void 0&&G(),I==="deltasY"?P:C},set:function(A){C===void 0&&G(),I==="deltasY"?P=A:C=A}}};Object.defineProperty(g,"deltas",R.call(this,"deltas")),n==="gvar"&&Object.defineProperty(g,"deltasY",R.call(this,"deltasY")),p+=g.variationDataSize,delete g.variationDataSize}this.relativeOffset=o;const d={headers:u};return d.sharedPoints=h,d};m.prototype.parseTupleVariationHeader=function(e,t){const n=this.parseUShort(),r=this.parseUShort(),s=!!(r&W.EMBEDDED_PEAK_TUPLE),o=!!(r&W.INTERMEDIATE_REGION),a=!!(r&W.PRIVATE_POINT_NUMBERS),i=s?void 0:r&W.TUPLE_INDEX_MASK,l=s?this.parseTupleRecords(1,e)[0]:void 0,c=o?this.parseTupleRecords(1,e)[0]:void 0,u=o?this.parseTupleRecords(1,e)[0]:void 0,h={variationDataSize:n,peakTuple:l,intermediateStartTuple:c,intermediateEndTuple:u,flags:{embeddedPeakTuple:s,intermediateRegion:o,privatePointNumbers:a}};return t==="gvar"&&(h.sharedTupleRecordsIndex=i),h};m.prototype.parsePackedPointNumbers=function(){const e=this.parseByte(),t=[];let n=e;if(e>=128){const s=this.parseByte();n=(e&W.POINT_RUN_COUNT_MASK)<<8|s}let r=0;for(;t.length<n;){const s=this.parseByte(),o=!!(s&W.POINTS_ARE_WORDS);let a=(s&W.POINT_RUN_COUNT_MASK)+1;for(let i=0;i<a&&t.length<n;i++){let l;o?l=this.parseUShort():l=this.parseByte(),r=r+l,t.push(r)}}return t};m.prototype.parsePackedDeltas=function(e){const t=[];for(;t.length<e;){const n=this.parseByte(),r=!!(n&W.DELTAS_ARE_ZERO),s=!!(n&W.DELTAS_ARE_WORDS),o=(n&W.DELTA_RUN_COUNT_MASK)+1;for(let a=0;a<o&&t.length<e;a++)r?t.push(0):s?t.push(this.parseShort()):t.push(this.parseChar())}return t};var S={getByte:Rn,getCard8:Rn,getUShort:Rt,getCard16:Rt,getShort:Cs,getUInt24:br,getULong:on,getFixed:Sr,getTag:Ds,getOffset:Ms,getBytes:As,bytesToString:Ns,Parser:m},Ut=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],xr={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},Fs={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Tr={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Gs(e,t,n){switch(e){case 0:if(t===65535)return"und";if(n)return n[t];break;case 1:return xr[t];case 3:return Tr[t]}}var Yt="utf-16",Bs={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Hs={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function an(e,t,n){switch(e){case 0:return Yt;case 1:return Hs[n]||Bs[t];case 3:if(t===1||t===10)return Yt;break}}var kr={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function _s(e){return kr[e]}function zs(e,t,n){const r={},s=new S.Parser(e,t),o=s.parseUShort(),a=s.parseUShort(),i=s.offset+s.parseUShort();for(let l=0;l<a;l++){const c=s.parseUShort(),u=s.parseUShort(),h=s.parseUShort(),p=s.parseUShort(),d=Ut[p]||p,f=s.parseUShort(),g=s.parseUShort(),y=Gs(c,h,n),T=an(c,u,h),R=_s(c);if(T!==void 0&&y!==void 0&&R!==void 0){let I;if(T===Yt?I=je.UTF16(e,i+g,f):I=je.MACSTRING(e,i+g,f,T),I){let C=r[R];C===void 0&&(C=r[R]={});let P=C[d];P===void 0&&(P=C[d]={}),P[y]=I}}}return o===1&&s.parseUShort(),r}function ft(e){const t={};for(let n in e)t[e[n]]=parseInt(n);return t}function In(e,t,n,r,s,o){return new v.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:t},{name:"languageID",type:"USHORT",value:n},{name:"nameID",type:"USHORT",value:r},{name:"length",type:"USHORT",value:s},{name:"offset",type:"USHORT",value:o}])}function Vs(e,t){const n=e.length,r=t.length-n+1;e:for(let s=0;s<r;s++)for(;s<r;s++){for(let o=0;o<n;o++)if(t[s+o]!==e[o])continue e;return s}return-1}function wn(e,t){let n=Vs(e,t);if(n<0){n=t.length;let r=0;const s=e.length;for(;r<s;++r)t.push(e[r])}return n}function qs(e,t){const n=ft(kr),r=ft(xr),s=ft(Tr),o=[],a=[];for(let l in e){let c;const u=[],h={},p=ft(Ut),d=n[l];for(let f in e[l]){let g=p[f];if(g===void 0&&(g=f),c=parseInt(g),isNaN(c))throw new Error('Name table entry "'+f+'" does not exist, see nameTableNames for complete list.');h[c]=e[l][f],u.push(c)}for(let f=0;f<u.length;f++){c=u[f];const g=h[c];for(let y in g){const T=g[y];if(d===1||d===0){let R=r[y],I=Fs[R];const C=an(d,I,R);let P=b.MACSTRING(T,C);if(d===0&&(R=t.indexOf(y),R<0&&(R=t.length,t.push(y)),I=4,P=b.UTF16(T)),P!==void 0){const G=wn(P,a);o.push(In(d,I,R,c,P.length,G))}}if(d===3){const R=s[y];if(R!==void 0){const I=b.UTF16(T),C=wn(I,a);o.push(In(3,1,R,c,I.length,C))}}}}}o.sort(function(l,c){return l.platformID-c.platformID||l.encodingID-c.encodingID||l.languageID-c.languageID||l.nameID-c.nameID});const i=new v.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:o.length},{name:"stringOffset",type:"USHORT",value:6+o.length*12}]);for(let l=0;l<o.length;l++)i.fields.push({name:"record_"+l,type:"RECORD",value:o[l]});return i.fields.push({name:"strings",type:"LITERAL",value:a}),i}function It(e,t,n=[]){if(t<256&&t in Ut){if(n.length&&!n.includes(parseInt(t)))return;t=Ut[t]}for(let r in e)for(let s in e[r])if(s===t||parseInt(s)===t)return e[r][s]}var Or={parse:zs,make:qs,getNameByID:It};function Ws(e,t,n,r){e.length=t.parseUShort(),e.language=t.parseUShort()-1;const s=t.parseByteList(e.length),o=Object.assign({},s),a=an(n,r,e.language),i=bt[a];for(let l=0;l<i.length;l++)o[i.charCodeAt(l)]=s[128+l];e.glyphIndexMap=o}function js(e,t,n){t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong();let r;e.groupCount=r=t.parseULong(),e.glyphIndexMap={};for(let s=0;s<r;s+=1){const o=t.parseULong(),a=t.parseULong();let i=t.parseULong();for(let l=o;l<=a;l+=1)e.glyphIndexMap[l]=i,n===12&&i++}}function $s(e,t,n,r,s){e.length=t.parseUShort(),e.language=t.parseUShort();let o;e.segCount=o=t.parseUShort()>>1,t.skip("uShort",3),e.glyphIndexMap={};const a=new S.Parser(n,r+s+14),i=new S.Parser(n,r+s+16+o*2),l=new S.Parser(n,r+s+16+o*4),c=new S.Parser(n,r+s+16+o*6);let u=r+s+16+o*8;for(let h=0;h<o-1;h+=1){let p;const d=a.parseUShort(),f=i.parseUShort(),g=l.parseShort(),y=c.parseUShort();for(let T=f;T<=d;T+=1)y!==0?(u=c.offset+c.relativeOffset-2,u+=y,u+=(T-f)*2,p=S.getUShort(n,u),p!==0&&(p=p+g&65535)):p=T+g&65535,e.glyphIndexMap[T]=p}}function Ys(e,t){const n={};t.skip("uLong");const r=t.parseULong();for(let s=0;s<r;s+=1){const o=t.parseUInt24(),a={varSelector:o},i=t.parseOffset32(),l=t.parseOffset32(),c=t.relativeOffset;i&&(t.relativeOffset=i,a.defaultUVS=t.parseStruct({ranges:function(){return t.parseRecordList32({startUnicodeValue:t.parseUInt24,additionalCount:t.parseByte})}})),l&&(t.relativeOffset=l,a.nonDefaultUVS=t.parseStruct({uvsMappings:function(){const u={},h=t.parseRecordList32({unicodeValue:t.parseUInt24,glyphID:t.parseUShort});for(let p=0;p<h.length;p+=1)u[h[p].unicodeValue]=h[p];return u}})),n[o]=a,t.relativeOffset=c}e.varSelectorList=n}function Xs(e,t){const n={};n.version=S.getUShort(e,t),O.argument(n.version===0,"cmap table version should be 0."),n.numTables=S.getUShort(e,t+2);let r=null,s=-1,o=-1,a=null,i=null;const l=[0,1,2,3,4,6],c=[0,1,10];for(let h=n.numTables-1;h>=0;h-=1)if(a=S.getUShort(e,t+4+h*8),i=S.getUShort(e,t+4+h*8+2),a===3&&c.includes(i)||a===0&&l.includes(i)||a===1&&i===0){if(o>0)continue;if(o=S.getULong(e,t+4+h*8+4),r)break}else if(a===0&&i===5){if(s=S.getULong(e,t+4+h*8+4),r=new S.Parser(e,t+s),r.parseUShort()!==14)s=-1,r=null;else if(o>0)break}if(o===-1)throw new Error("No valid cmap sub-tables found.");const u=new S.Parser(e,t+o);if(n.format=u.parseUShort(),n.format===0)Ws(n,u,a,i);else if(n.format===12||n.format===13)js(n,u,n.format);else if(n.format===4)$s(n,u,e,t,o);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+n.format+", platformId "+a+", encodingId "+i+").");return r&&Ys(n,r),n}function Zs(e,t,n){e.segments.push({end:t,start:t,delta:-(t-n),offset:0,glyphIndex:n})}function Ks(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function Qs(e){let t=!0,n;for(n=e.length-1;n>0;n-=1)if(e.get(n).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),t=!1;break}let r=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:t?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:t?12:20}];t||r.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),r.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});const s=new v.Table("cmap",r);for(s.segments=[],n=0;n<e.length;n+=1){const d=e.get(n);for(let f=0;f<d.unicodes.length;f+=1)Zs(s,d.unicodes[f],n)}s.segments.sort(function(d,f){return d.start-f.start}),Ks(s);const o=s.segments.length;let a=0,i=[],l=[],c=[],u=[],h=[],p=[];for(n=0;n<o;n+=1){const d=s.segments[n];d.end<=65535&&d.start<=65535?(i.push({name:"end_"+n,type:"USHORT",value:d.end}),l.push({name:"start_"+n,type:"USHORT",value:d.start}),c.push({name:"idDelta_"+n,type:"SHORT",value:d.delta}),u.push({name:"idRangeOffset_"+n,type:"USHORT",value:d.offset}),d.glyphId!==void 0&&h.push({name:"glyph_"+n,type:"USHORT",value:d.glyphId})):a+=1,!t&&d.glyphIndex!==void 0&&(p.push({name:"cmap12Start_"+n,type:"ULONG",value:d.start}),p.push({name:"cmap12End_"+n,type:"ULONG",value:d.end}),p.push({name:"cmap12Glyph_"+n,type:"ULONG",value:d.glyphIndex}))}s.segCountX2=(o-a)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(o-a)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange;for(let d=0;d<i.length;d++)s.fields.push(i[d]);s.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let d=0;d<l.length;d++)s.fields.push(l[d]);for(let d=0;d<c.length;d++)s.fields.push(c[d]);for(let d=0;d<u.length;d++)s.fields.push(u[d]);for(let d=0;d<h.length;d++)s.fields.push(h[d]);if(s.cmap4Length=14+i.length*2+2+l.length*2+c.length*2+u.length*2+h.length*2,!t){const d=16+p.length*4;s.cmap12Offset=20+s.cmap4Length,s.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:d},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:p.length/3});for(let f=0;f<p.length;f++)s.fields.push(p[f])}return s}var Rr={parse:Xs,make:Qs},gt=[".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"],Js=[".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"],eo=[".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"],to=[".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"],Xt=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],no=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Me=[".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"];function Ur(e){this.font=e}Ur.prototype.charToGlyphIndex=function(e){const t=e.codePointAt(0),n=this.font.glyphs;if(n)for(let r=0;r<n.length;r+=1){const s=n.get(r);for(let o=0;o<s.unicodes.length;o+=1)if(s.unicodes[o]===t)return r}return null};function Ir(e){this.cmap=e}Ir.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0};function wr(e,t){this.encoding=e,this.charset=t}wr.prototype.charToGlyphIndex=function(e){const t=e.codePointAt(0),n=this.encoding[t];return this.charset.indexOf(n)};function ln(e){switch(e.version){case 1:this.names=Me.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(let t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<Me.length?this.names[t]=Me[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-Me.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(let t=0;t<e.numberOfGlyphs;t++)this.names[t]=Me[t+e.glyphNameIndex[t]];break;case 3:this.names=[];break;default:this.names=[];break}}ln.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)};ln.prototype.glyphIndexToName=function(e){return this.names[e]};function ro(e){let t;const n=e.tables.cmap.glyphIndexMap,r=Object.keys(n);for(let s=0;s<r.length;s+=1){const o=r[s],a=n[o];t=e.glyphs.get(a),t.addUnicode(parseInt(o))}for(let s=0;s<e.glyphs.length;s+=1)t=e.glyphs.get(s),e.cffEncoding?t.name=e.cffEncoding.charset[s]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(s))}function so(e){e._IndexToUnicodeMap={};const t=e.tables.cmap.glyphIndexMap,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const s=n[r];let o=t[s];e._IndexToUnicodeMap[o]===void 0?e._IndexToUnicodeMap[o]={unicodes:[parseInt(s)]}:e._IndexToUnicodeMap[o].unicodes.push(parseInt(s))}}function oo(e,t){t.lowMemory?so(e):ro(e)}function ao(e,t,n,r,s){e.beginPath(),e.moveTo(t,n),e.lineTo(r,s),e.stroke()}var De={line:ao};function io(e,t){const n=new m(e,t),r=n.parseShort();r!==0&&console.warn("Only CPALv0 is currently fully supported.");const s=n.parseShort(),o=n.parseShort(),a=n.parseShort(),i=n.parseOffset32(),l=n.parseUShortList(o);n.relativeOffset=i;const c=n.parseULongList(a);return n.relativeOffset=i,{version:r,numPaletteEntries:s,colorRecords:c,colorRecordIndices:l}}function lo({version:e=0,numPaletteEntries:t=0,colorRecords:n=[],colorRecordIndices:r=[0]}){return O.argument(e===0,"Only CPALv0 are supported."),O.argument(n.length,"No colorRecords given."),O.argument(r.length,"No colorRecordIndices given."),r.length>1&&O.argument(t,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new v.Table("CPAL",[{name:"version",type:"USHORT",value:e},{name:"numPaletteEntries",type:"USHORT",value:t||n.length},{name:"numPalettes",type:"USHORT",value:r.length},{name:"numColorRecords",type:"USHORT",value:n.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*r.length},...r.map((s,o)=>({name:"colorRecordIndices_"+o,type:"USHORT",value:s})),...n.map((s,o)=>({name:"colorRecords_"+o,type:"ULONG",value:s}))])}function Lr(e){var t=(e&4278190080)>>24,n=(e&16711680)>>16,r=(e&65280)>>8,s=e&255;return t=t+256&255,n=n+256&255,r=r+256&255,s=(s+256&255)/255,{b:t,g:n,r,a:s}}function un(e,t,n=0,r="hexa"){if(t==65535)return"currentColor";const s=e&&e.tables&&e.tables.cpal;if(!s)return"currentColor";if(n>s.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${s.colorRecordIndices.length}, index: ${t})`);if(t>s.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${s.numPaletteEntries}, index: ${t})`);const o=s.colorRecordIndices[n]+t;if(o>s.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${s.colorRecords.length}, lookupIndex: ${o})`);const a=Lr(s.colorRecords[o]);return r==="bgra"?a:Xe(a,r)}function ue(e){return("0"+parseInt(e).toString(16)).slice(-2)}function uo(e){const t=e.r/255,n=e.g/255,r=e.b/255,s=Math.max(t,n,r),o=Math.min(t,n,r);let a,i,l=(s+o)/2;if(s===o)a=i=0;else{const c=s-o;switch(i=l>.5?c/(2-s-o):c/(s+o),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;case r:a=(t-n)/c+4;break}a/=6}return{h:a*360,s:i*100,l:l*100}}function co(e){let{h:t,s:n,l:r,a:s}=e;t=t%360,n/=100,r/=100;const o=(1-Math.abs(2*r-1))*n,a=o*(1-Math.abs(t/60%2-1)),i=r-o/2;let l=0,c=0,u=0;return 0<=t&&t<60?(l=o,c=a,u=0):60<=t&&t<120?(l=a,c=o,u=0):120<=t&&t<180?(l=0,c=o,u=a):180<=t&&t<240?(l=0,c=a,u=o):240<=t&&t<300?(l=a,c=0,u=o):300<=t&&t<=360&&(l=o,c=0,u=a),{r:Math.round((l+i)*255),g:Math.round((c+i)*255),b:Math.round((u+i)*255),a:s}}function Cr(e){return parseInt(`0x${ue(e.b)}${ue(e.g)}${ue(e.r)}${ue(e.a*255)}`,16)}function wt(e,t="hexa"){const n=t=="raw"||t=="cpal",r=Number.isInteger(e);let s=!0;if(r&&n||e==="currentColor")return e;if(typeof e=="object"){if(t=="bgra")return e;if(n)return Cr(e)}else if(!r&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(e.trim())){switch(e=e.trim().substring(1),e.length){case 3:e={r:parseInt(e[0].repeat(2),16),g:parseInt(e[1].repeat(2),16),b:parseInt(e[2].repeat(2),16),a:1};break;case 4:e={r:parseInt(e[0].repeat(2),16),g:parseInt(e[1].repeat(2),16),b:parseInt(e[2].repeat(2),16),a:parseInt(e[3].repeat(2),16)/255};break;case 6:e={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16),a:1};break;case 8:e={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16),a:parseInt(e[6]+e[7],16)/255};break}if(t=="bgra")return e}else if(typeof document<"u"&&/^[a-z]+$/i.test(e)){const o=document.createElement("canvas").getContext("2d");o.fillStyle=e;const a=Xe(o.fillStyle,"hexa");a==="#000000ff"&&e.toLowerCase()!=="black"?s=!1:e=a}else{e=e.trim();const o=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(o.test(e)){const a=e.match(o).filter(i=>typeof i<"u");e={r:Math.round(parseFloat(a[1])/(a[2]?100/255:1)),g:Math.round(parseFloat(a[3])/(a[4]?100/255:1)),b:Math.round(parseFloat(a[5])/(a[6]?100/255:1)),a:a[7]?parseFloat(a[7])/(a[8]?100:1):1}}else{const a=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(a.test(e)){const i=e.match(a).filter(l=>typeof l<"u");e=co({h:parseFloat(i[1])*(i[2]==="turn"?360:1),s:parseFloat(i[3]),l:parseFloat(i[4]),a:i[5]?parseFloat(i[5])/(i[6]?100:1):1})}else s=!1}}if(!s)throw new Error(`Invalid color format: ${e}`);return Xe(e,t)}function Xe(e,t="hexa"){if(e==="currentColor")return e;if(Number.isInteger(e)){if(t=="raw"||t=="cpal")return e;e=Lr(e)}else typeof e!="object"&&(e=wt(e,"bgra"));let n=["hsl","hsla"].includes(t)?uo(e):null;switch(t){case"rgba":return`rgba(${e.r}, ${e.g}, ${e.b}, ${parseFloat(e.a.toFixed(3))})`;case"rgb":return`rgb(${e.r}, ${e.g}, ${e.b})`;case"hex":case"hex6":case"hex-6":return`#${ue(e.r)}${ue(e.g)}${ue(e.b)}`;case"hexa":case"hex8":case"hex-8":return`#${ue(e.r)}${ue(e.g)}${ue(e.b)}${ue(e.a*255)}`;case"hsl":return`hsl(${n.h.toFixed(2)}, ${n.s.toFixed(2)}%, ${n.l.toFixed(2)}%)`;case"hsla":return`hsla(${n.h.toFixed(2)}, ${n.s.toFixed(2)}%, ${n.l.toFixed(2)}%, ${parseFloat(e.a.toFixed(3))})`;case"bgra":return e;case"raw":case"cpal":return Cr(e);default:throw new Error("Unknown color format: "+t)}}var Er={parse:io,make:lo,getPaletteColor:un,parseColor:wt,formatColor:Xe};function po(e,t){let n=t||new We;return{configurable:!0,get:function(){return typeof n=="function"&&(n=n()),n},set:function(r){n=r}}}function j(e){this.bindConstructorValues(e)}j.prototype.bindConstructorValues=function(e){if(this.index=e.index||0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name||null,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),"xMin"in e&&(this.xMin=e.xMin),"yMin"in e&&(this.yMin=e.yMin),"xMax"in e&&(this.xMax=e.xMax),"yMax"in e&&(this.yMax=e.yMax),"advanceWidth"in e&&(this.advanceWidth=e.advanceWidth),"leftSideBearing"in e&&(this.leftSideBearing=e.leftSideBearing),"points"in e&&(this.points=e.points),Object.defineProperty(this,"path",po(this,e.path))};j.prototype.addUnicode=function(e){this.unicodes.length===0&&(this.unicode=e),this.unicodes.push(e)};j.prototype.getBoundingBox=function(){return this.path.getBoundingBox()};j.prototype.getPath=function(e,t,n,r,s){e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:72,r=Object.assign({},s&&s.defaultRenderOptions,r);let o,a,i=r.xScale,l=r.yScale;const c=1/(this.path.unitsPerEm||1e3)*n;let u=this;s&&s.variation&&(u=s.variation.getTransform(this,r.variation),o=u.path.commands),r.hinting&&s&&s.hinting&&(a=u.path&&s.hinting.exec(u,n,r)),a?(o=s.hinting.getCommands(a),e=Math.round(e),t=Math.round(t),i=l=1):(o=u.path.commands,i===void 0&&(i=c),l===void 0&&(l=c));const h=new We;if(r.drawSVG){const p=this.getSvgImage(s);if(p){const d=new We;return d._image={image:p.image,x:e+p.leftSideBearing*c,y:t-p.baseline*c,width:p.image.width*c,height:p.image.height*c},h._layers=[d],h}}if(r.drawLayers){const p=this.getLayers(s);if(p&&p.length){h._layers=[];for(let d=0;d<p.length;d+=1){const f=p[d];let g=un(s,f.paletteIndex,r.usePalette);g==="currentColor"?g=r.fill||"black":g=Xe(g,r.colorFormat||"rgba"),r=Object.assign({},r,{fill:g}),h._layers.push(this.getPath.call(f.glyph,e,t,n,r,s))}return h}}h.fill=r.fill||this.path.fill,h.stroke=this.path.stroke,h.strokeWidth=this.path.strokeWidth*c;for(let p=0;p<o.length;p+=1){const d=o[p];d.type==="M"?h.moveTo(e+d.x*i,t+-d.y*l):d.type==="L"?h.lineTo(e+d.x*i,t+-d.y*l):d.type==="Q"?h.quadraticCurveTo(e+d.x1*i,t+-d.y1*l,e+d.x*i,t+-d.y*l):d.type==="C"?h.curveTo(e+d.x1*i,t+-d.y1*l,e+d.x2*i,t+-d.y2*l,e+d.x*i,t+-d.y*l):d.type==="Z"&&h.stroke&&h.strokeWidth&&h.closePath()}return h};j.prototype.getLayers=function(e){if(!e)throw Error("The font object is required to read the colr/cpal tables in order to get the layers.");return e.layers.get(this.index)};j.prototype.getSvgImage=function(e){if(!e)throw Error("The font object is required to read the svg table in order to get the image.");return e.svgImages.get(this.index)};j.prototype.getContours=function(e=null){if(this.points===void 0&&!e)return[];const t=[];let n=[],r=e||this.points;for(let s=0;s<r.length;s+=1){const o=r[s];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return O.argument(n.length===0,"There are still points left in the current contour."),t};j.prototype.getMetrics=function(){const e=this.path.commands,t=[],n=[];for(let s=0;s<e.length;s+=1){const o=e[s];o.type!=="Z"&&(t.push(o.x),n.push(o.y)),(o.type==="Q"||o.type==="C")&&(t.push(o.x1),n.push(o.y1)),o.type==="C"&&(t.push(o.x2),n.push(o.y2))}const r={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,n),leftSideBearing:this.leftSideBearing};return isFinite(r.xMin)||(r.xMin=0),isFinite(r.xMax)||(r.xMax=this.advanceWidth),isFinite(r.yMin)||(r.yMin=0),isFinite(r.yMax)||(r.yMax=0),r.rightSideBearing=this.advanceWidth-r.leftSideBearing-(r.xMax-r.xMin),r};j.prototype.draw=function(e,t,n,r,s,o){s=Object.assign({},o.defaultRenderOptions,s),this.getPath(t,n,r,s,o).draw(e)};j.prototype.drawPoints=function(e,t,n,r,s,o){if(s=Object.assign({},o&&o.defaultRenderOptions,s),s.drawLayers){const h=this.getLayers(o);if(h&&h.length){for(let p=0;p<h.length;p+=1)h[p].glyph.index!==this.index&&this.drawPoints.call(h[p].glyph,e,t,n,r);return}}function a(h,p,d,f){e.beginPath();for(let g=0;g<h.length;g+=1)e.moveTo(p+h[g].x*f,d+h[g].y*f),e.arc(p+h[g].x*f,d+h[g].y*f,2,0,Math.PI*2,!1);e.fill()}t=t!==void 0?t:0,n=n!==void 0?n:0,r=r!==void 0?r:24;const i=1/this.path.unitsPerEm*r,l=[],c=[];let u=this.path.commands;o&&o.variation&&(u=o.variation.getTransform(this,s.variation).path.commands);for(let h=0;h<u.length;h+=1){const p=u[h];p.x!==void 0&&l.push({x:p.x,y:-p.y}),p.x1!==void 0&&c.push({x:p.x1,y:-p.y1}),p.x2!==void 0&&c.push({x:p.x2,y:-p.y2})}e.fillStyle="blue",a(l,t,n,i),e.fillStyle="red",a(c,t,n,i)};j.prototype.drawMetrics=function(e,t,n,r){let s;t=t!==void 0?t:0,n=n!==void 0?n:0,r=r!==void 0?r:24,s=1/this.path.unitsPerEm*r,e.lineWidth=1,e.strokeStyle="black",De.line(e,t,-1e4,t,1e4),De.line(e,-1e4,n,1e4,n);const o=this.xMin||0;let a=this.yMin||0;const i=this.xMax||0;let l=this.yMax||0;const c=this.advanceWidth||0;e.strokeStyle="blue",De.line(e,t+o*s,-1e4,t+o*s,1e4),De.line(e,t+i*s,-1e4,t+i*s,1e4),De.line(e,-1e4,n+-a*s,1e4,n+-a*s),De.line(e,-1e4,n+-l*s,1e4,n+-l*s),e.strokeStyle="green",De.line(e,t+c*s,-1e4,t+c*s,1e4)};j.prototype.toPathData=function(e,t){e=Object.assign({},{variation:t&&t.defaultRenderOptions.variation},e);let n=this;t&&t.variation&&(n=t.variation.getTransform(this,e.variation));let r=n.points&&e.pointsTransform?e.pointsTransform(n.points):n.path;return e.pathTramsform&&(r=e.pathTramsform(r)),r.toPathData(e)};j.prototype.fromSVG=function(e,t={}){return this.path.fromSVG(e,t)};j.prototype.toSVG=function(e,t){const n=this.toPathData.apply(this,[e,t]);return this.path.toSVG(e,n)};j.prototype.toDOMElement=function(e,t){e=Object.assign({},{variation:t&&t.defaultRenderOptions.variation},e);let n=this.path;return t&&t.variation&&(n=t.variation.getTransform(this,e.variation).path),n.toDOMElement(e)};var et=j;function ze(e,t,n){Object.defineProperty(e,t,{get:function(){return typeof e[n]>"u"&&e.path,e[n]},set:function(r){e[n]=r},enumerable:!0,configurable:!0})}function Ct(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(let n=0;n<t.length;n++){const r=t[n];r.path.unitsPerEm=e.unitsPerEm,this.glyphs[n]=r}this.length=t&&t.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Ct.prototype[Symbol.iterator]=function(){let e=-1;return{next:(function(){e++;const t=e>=this.length-1;return{value:this.get(e),done:t}}).bind(this)}});Ct.prototype.get=function(e){if(this.font._push&&this.glyphs[e]===void 0){this.font._push(e),typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());let t=this.glyphs[e],n=this.font._IndexToUnicodeMap[e];if(n)for(let r=0;r<n.unicodes.length;r++)t.addUnicode(n.unicodes[r]);this.font.cffEncoding?t.name=this.font.cffEncoding.charset[e]:this.font.glyphNames.names&&(t.name=this.font.glyphNames.glyphIndexToName(e)),this.glyphs[e].advanceWidth=this.font._hmtxTableData[e].advanceWidth,this.glyphs[e].leftSideBearing=this.font._hmtxTableData[e].leftSideBearing}else typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());return this.glyphs[e]};Ct.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};function ho(e,t){return new et({index:t,font:e})}function fo(e,t,n,r,s,o){return function(){const a=new et({index:t,font:e});return a.path=function(){n(a,r,s);const i=o(e.glyphs,a);return i.unitsPerEm=e.unitsPerEm,i},ze(a,"numberOfContours","_numberOfContours"),ze(a,"xMin","_xMin"),ze(a,"xMax","_xMax"),ze(a,"yMin","_yMin"),ze(a,"yMax","_yMax"),ze(a,"points","_points"),a}}function go(e,t,n,r,s){return function(){const o=new et({index:t,font:e});return o.path=function(){const a=n(e,o,r,s);return a.unitsPerEm=e.unitsPerEm,a},o}}var ve={GlyphSet:Ct,glyphLoader:ho,ttfGlyphLoader:fo,cffGlyphLoader:go};function Dr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Dr(e[n],t[n]))return!1;return!0}else return!1}function Lt(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}function ge(e,t,n,r){const s=[],o=[],a=r>1?S.getULong(e,t):S.getCard16(e,t),i=r>1?4:2;let l,c;if(a!==0){const u=S.getByte(e,t+i);l=t+(a+1)*u+i;let h=t+i+1;for(let p=0;p<a+1;p+=1)s.push(S.getOffset(e,h,u)),h+=u;c=l+s[a]}else c=t+i;for(let u=0;u<s.length-1;u+=1){let h=S.getBytes(e,l+s[u],l+s[u+1]);n&&(h=n(h,e,t,r)),o.push(h)}return{objects:o,startOffset:t,endOffset:c}}function mo(e,t,n){const r=[],s=n>1?S.getULong(e,t):S.getCard16(e,t),o=n>1?4:2;let a,i;if(s!==0){const l=S.getByte(e,t+o);a=t+(s+1)*l+o;let c=t+o+1;for(let u=0;u<s+1;u+=1)r.push(S.getOffset(e,c,l)),c+=l;i=a+r[s]}else i=t+o;return{offsets:r,startOffset:t,endOffset:i}}function yo(e,t,n,r,s,o){const a=o>1?S.getULong(n,r):S.getCard16(n,r),i=o>1?4:2;let l=0;if(a!==0){const c=S.getByte(n,r+i);l=r+(a+1)*c+i}return S.getBytes(n,l+t[e],l+t[e+1])}function vo(e){let t="";const n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const r=e.parseByte(),s=r>>4,o=r&15;if(s===15||(t+=n[s],o===15))break;t+=n[o]}return parseFloat(t)}function bo(e,t){let n,r,s,o;if(t===28)return n=e.parseByte(),r=e.parseByte(),n<<8|r;if(t===29)return n=e.parseByte(),r=e.parseByte(),s=e.parseByte(),o=e.parseByte(),n<<24|r<<16|s<<8|o;if(t===30)return vo(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=e.parseByte(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=e.parseByte(),-(t-251)*256-n-108;throw new Error("Invalid b0 "+t)}function So(e){const t={};for(let n=0;n<e.length;n+=1){const r=e[n][0],s=e[n][1];let o;if(s.length===1?o=s[0]:o=s,Object.prototype.hasOwnProperty.call(t,r)&&!isNaN(t[r]))throw new Error("Object "+t+" already has key "+r);t[r]=o}return t}function cn(e,t,n,r){t=t!==void 0?t:0;const s=new S.Parser(e,t),o=[];let a=[];n=n!==void 0?n:e.byteLength;let i=r<2?22:28;for(;s.relativeOffset<n;){let l=s.parseByte();if(l<i){if(l===12&&(l=1200+s.parseByte()),r>1&&l===23){Co(a);continue}o.push([l,a]),a=[]}else a.push(bo(s,l))}return So(o)}function Qe(e,t){return t<=390?t=gt[t]:e?t=e[t-391]:t=void 0,t}function pn(e,t,n){const r={};let s;for(let o=0;o<t.length;o+=1){const a=t[o];if(Array.isArray(a.type)){const i=[];i.length=a.type.length;for(let l=0;l<a.type.length;l++)s=e[a.op]!==void 0?e[a.op][l]:void 0,s===void 0&&(s=a.value!==void 0&&a.value[l]!==void 0?a.value[l]:null),a.type[l]==="SID"&&(s=Qe(n,s)),i[l]=s;r[a.name]=i}else s=e[a.op],s===void 0&&(s=a.value!==void 0?a.value:null),a.type==="SID"&&(s=Qe(n,s)),r[a.name]=s}return r}function xo(e,t){const n={};if(n.formatMajor=S.getCard8(e,t),n.formatMinor=S.getCard8(e,t+1),n.formatMajor>2)throw new Error(`Unsupported CFF table version ${n.formatMajor}.${n.formatMinor}`);return n.size=S.getCard8(e,t+2),n.formatMajor<2?(n.offsetSize=S.getCard8(e,t+3),n.startOffset=t,n.endOffset=t+4):(n.topDictLength=S.getCard16(e,t+3),n.endOffset=t+8),n}var Mr=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],To=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],Ar=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],ko=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],Oo=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Ro(e,t,n,r){const s=cn(e,t,e.byteLength,r);return pn(s,r>1?To:Mr,n)}function hn(e,t,n,r,s){const o=cn(e,t,n,s);return pn(o,s>1?ko:Ar,r)}function Uo(e,t,n){const r=cn(e,t,void 0,n);return pn(r,Oo)}function Io(e,t,n){const r=[];for(let s=0;s<n.length;s++){const o=new DataView(new Uint8Array(n[s]).buffer),a=Uo(o,0,2),i=a.private[0],l=a.private[1];if(i!==0&&l!==0){const c=hn(e,l+t,i,[],2);if(c.subrs){const u=l+c.subrs,h=ge(e,u+t,void 0,2);a._subrs=h.objects,a._subrsBias=Lt(a._subrs)}a._privateDict=c}r.push(a)}return r}function Ft(e,t,n,r,s){const o=[];for(let a=0;a<n.length;a+=1){const i=new DataView(new Uint8Array(n[a]).buffer),l=Ro(i,0,r,s);l._subrs=[],l._subrsBias=0,l._defaultWidthX=0,l._nominalWidthX=0;const c=s<2?l.private[0]:0,u=s<2?l.private[1]:0;if(c!==0&&u!==0){const h=hn(e,u+t,c,r,s);if(l._defaultWidthX=h.defaultWidthX,l._nominalWidthX=h.nominalWidthX,h.subrs!==0){const p=u+h.subrs,d=ge(e,p+t,void 0,s);l._subrs=d.objects,l._subrsBias=Lt(l._subrs)}l._privateDict=h}o.push(l)}return o}function wo(e,t,n,r,s){let o,a;const i=new S.Parser(e,t);n-=1;const l=[".notdef"],c=i.parseCard8();if(c===0)for(let u=0;u<n;u+=1)o=i.parseSID(),s?l.push(o):l.push(Qe(r,o)||o);else if(c===1)for(;l.length<=n;){o=i.parseSID(),a=i.parseCard8();for(let u=0;u<=a;u+=1)s?l.push("cid"+("00000"+o).slice(-5)):l.push(Qe(r,o)||o),o+=1}else if(c===2)for(;l.length<=n;){o=i.parseSID(),a=i.parseCard16();for(let u=0;u<=a;u+=1)s?l.push("cid"+("00000"+o).slice(-5)):l.push(Qe(r,o)||o),o+=1}else throw new Error("Unknown charset format "+c);return l}function Lo(e,t){let n;const r={},s=new S.Parser(e,t),o=s.parseCard8();if(o===0){const a=s.parseCard8();for(let i=0;i<a;i+=1)n=s.parseCard8(),r[n]=i}else if(o===1){const a=s.parseCard8();n=1;for(let i=0;i<a;i+=1){const l=s.parseCard8(),c=s.parseCard8();for(let u=l;u<=l+c;u+=1)r[u]=n,n+=1}}else throw new Error("Unknown encoding format "+o);return r}function Co(e){let t=e.pop();for(;e.length>t;)e.pop()}function Nr(e,t){const n=e.tables.cff&&e.tables.cff.topDict&&e.tables.cff.topDict.paintType||0;return n===2&&(t.fill=null,t.stroke="black",t.strokeWidth=e.tables.cff.topDict.strokeWidth||0),n}function Zt(e,t,n,r,s){let o,a,i,l;const c=new We,u=[];let h=0,p=!1,d=!1,f=0,g=0,y,T,R,I,C=0,P=[],G;const A=e.tables.cff2||e.tables.cff;if(R=A.topDict._defaultWidthX,I=A.topDict._nominalWidthX,s=s||e.variation&&e.variation.get(),t.getBlendPath||(t.getBlendPath=function(D){return Zt(e,t,n,r,D)}),e.isCIDFont||r>1){const D=A.topDict._fdSelect?A.topDict._fdSelect[t.index]:0,x=A.topDict._fdArray[D];y=x._subrs,T=x._subrsBias,r>1?(P=A.topDict._vstore.itemVariationStore,C=x._privateDict.vsindex):(R=x._defaultWidthX,I=x._nominalWidthX)}else y=A.topDict._subrs,T=A.topDict._subrsBias;const $=Nr(e,c);let K=R;function E(D,x){d&&$!==2&&c.closePath(),c.moveTo(D,x),d=!0}function z(){let D;D=(u.length&1)!==0,D&&!p&&(K=u.shift()+I),h+=u.length>>1,u.length=0,p=!0}function ee(D){let x,L,U,be,Ge,Se,q,te,Q,Y,X,ne,B=0;for(;B<D.length;){let ae=D[B];switch(B+=1,ae){case 1:z();break;case 3:z();break;case 4:u.length>1&&!p&&(K=u.shift()+I,p=!0),g+=u.pop(),E(f,g);break;case 5:for(;u.length>0;)f+=u.shift(),g+=u.shift(),c.lineTo(f,g);break;case 6:for(;u.length>0&&(f+=u.shift(),c.lineTo(f,g),u.length!==0);)g+=u.shift(),c.lineTo(f,g);break;case 7:for(;u.length>0&&(g+=u.shift(),c.lineTo(f,g),u.length!==0);)f+=u.shift(),c.lineTo(f,g);break;case 8:for(;u.length>0;)o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l+u.shift(),c.curveTo(o,a,i,l,f,g);break;case 10:Ge=u.pop()+T,Se=y[Ge],Se&&ee(Se);break;case 11:if(r>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(ae=D[B],B+=1,ae){case 35:o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),q=i+u.shift(),te=l+u.shift(),Q=q+u.shift(),Y=te+u.shift(),X=Q+u.shift(),ne=Y+u.shift(),f=X+u.shift(),g=ne+u.shift(),u.shift(),c.curveTo(o,a,i,l,q,te),c.curveTo(Q,Y,X,ne,f,g);break;case 34:o=f+u.shift(),a=g,i=o+u.shift(),l=a+u.shift(),q=i+u.shift(),te=l,Q=q+u.shift(),Y=l,X=Q+u.shift(),ne=g,f=X+u.shift(),c.curveTo(o,a,i,l,q,te),c.curveTo(Q,Y,X,ne,f,g);break;case 36:o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),q=i+u.shift(),te=l,Q=q+u.shift(),Y=l,X=Q+u.shift(),ne=Y+u.shift(),f=X+u.shift(),c.curveTo(o,a,i,l,q,te),c.curveTo(Q,Y,X,ne,f,g);break;case 37:o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),q=i+u.shift(),te=l+u.shift(),Q=q+u.shift(),Y=te+u.shift(),X=Q+u.shift(),ne=Y+u.shift(),Math.abs(X-f)>Math.abs(ne-g)?f=X+u.shift():g=ne+u.shift(),c.curveTo(o,a,i,l,q,te),c.curveTo(Q,Y,X,ne,f,g);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+ae),u.length=0}break;case 14:if(r>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(u.length>=4){const Ee=Xt[u.pop()],He=Xt[u.pop()],lt=u.pop(),ut=u.pop();if(Ee&&He){t.isComposite=!0,t.components=[];const yn=e.cffEncoding.charset.indexOf(Ee),vn=e.cffEncoding.charset.indexOf(He);t.components.push({glyphIndex:vn,dx:0,dy:0}),t.components.push({glyphIndex:yn,dx:ut,dy:lt}),c.extend(e.glyphs.get(vn).path);const gs=e.glyphs.get(yn),At=JSON.parse(JSON.stringify(gs.path.commands));for(let Nt=0;Nt<At.length;Nt+=1){const fe=At[Nt];fe.type!=="Z"&&(fe.x+=ut,fe.y+=lt),(fe.type==="Q"||fe.type==="C")&&(fe.x1+=ut,fe.y1+=lt),fe.type==="C"&&(fe.x2+=ut,fe.y2+=lt)}c.extend(At)}}else u.length>0&&!p&&(K=u.shift()+I,p=!0);d&&$!==2&&(c.closePath(),d=!1);break;case 15:if(r<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}C=u.pop();break;case 16:if(r<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}G||(G=e.variation&&s&&e.variation.process.getBlendVector(P,C,s));var Be=u.pop(),F=G?G.length:P.itemVariationSubtables[C].regionIndexes.length,J=Be*F,oe=u.length-J,le=oe-Be;if(G)for(let Ee=0;Ee<Be;Ee++){var xe=u[le+Ee];for(let He=0;He<F;He++)xe+=G[He]*u[oe++];u[le+Ee]=xe}for(;J--;)u.pop();break;case 18:z();break;case 19:case 20:z(),B+=h+7>>3;break;case 21:u.length>2&&!p&&(K=u.shift()+I,p=!0),g+=u.pop(),f+=u.pop(),E(f,g);break;case 22:u.length>1&&!p&&(K=u.shift()+I,p=!0),f+=u.pop(),E(f,g);break;case 23:z();break;case 24:for(;u.length>2;)o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l+u.shift(),c.curveTo(o,a,i,l,f,g);f+=u.shift(),g+=u.shift(),c.lineTo(f,g);break;case 25:for(;u.length>6;)f+=u.shift(),g+=u.shift(),c.lineTo(f,g);o=f+u.shift(),a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l+u.shift(),c.curveTo(o,a,i,l,f,g);break;case 26:for(u.length&1&&(f+=u.shift());u.length>0;)o=f,a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i,g=l+u.shift(),c.curveTo(o,a,i,l,f,g);break;case 27:for(u.length&1&&(g+=u.shift());u.length>0;)o=f+u.shift(),a=g,i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l,c.curveTo(o,a,i,l,f,g);break;case 28:x=D[B],L=D[B+1],u.push((x<<24|L<<16)>>16),B+=2;break;case 29:Ge=u.pop()+e.gsubrsBias,Se=e.gsubrs[Ge],Se&&ee(Se);break;case 30:for(;u.length>0&&(o=f,a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l+(u.length===1?u.shift():0),c.curveTo(o,a,i,l,f,g),u.length!==0);)o=f+u.shift(),a=g,i=o+u.shift(),l=a+u.shift(),g=l+u.shift(),f=i+(u.length===1?u.shift():0),c.curveTo(o,a,i,l,f,g);break;case 31:for(;u.length>0&&(o=f+u.shift(),a=g,i=o+u.shift(),l=a+u.shift(),g=l+u.shift(),f=i+(u.length===1?u.shift():0),c.curveTo(o,a,i,l,f,g),u.length!==0);)o=f,a=g+u.shift(),i=o+u.shift(),l=a+u.shift(),f=i+u.shift(),g=l+(u.length===1?u.shift():0),c.curveTo(o,a,i,l,f,g);break;default:ae<32?console.log("Glyph "+t.index+": unknown operator "+ae):ae<247?u.push(ae-139):ae<251?(x=D[B],B+=1,u.push((ae-247)*256+x+108)):ae<255?(x=D[B],B+=1,u.push(-(ae-251)*256-x-108)):(x=D[B],L=D[B+1],U=D[B+2],be=D[B+3],B+=4,u.push((x<<24|L<<16|U<<8|be)/65536))}}}return ee(n),e.variation&&s&&(c.commands=c.commands.map(D=>{const x=Object.keys(D);for(let L=0;L<x.length;L++){const U=x[L];U!=="type"&&(D[U]=Math.round(D[U]))}return D})),p&&(t.advanceWidth=K),c}function Ln(e,t,n,r,s){const o=[];let a;const i=new S.Parser(e,t),l=i.parseCard8();if(l===0)for(let c=0;c<n;c++){if(a=i.parseCard8(),a>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+r+")");o.push(a)}else if(l===3||s>1&&l===4){const c=l===4?i.parseULong():i.parseCard16();let u=l===4?i.parseULong():i.parseCard16();if(u!==0)throw new Error(`CFF Table CID Font FDSelect format ${l} range has bad initial GID ${u}`);let h;for(let p=0;p<c;p++){if(a=l===4?i.parseUShort():i.parseCard8(),h=l===4?i.parseULong():i.parseCard16(),a>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+r+")");if(h>n)throw new Error(`CFF Table CID Font FDSelect format ${s} range has bad GID ${h}`);for(;u<h;u++)o.push(a);u=h}if(h!==n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+h)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+l);return o}function Eo(e,t,n,r){let s;const o=xo(e,t);o.formatMajor===2?s=n.tables.cff2={}:s=n.tables.cff={};const a=o.formatMajor>1?null:ge(e,o.endOffset,S.bytesToString),i=o.formatMajor>1?null:ge(e,a.endOffset),l=o.formatMajor>1?null:ge(e,i.endOffset,S.bytesToString),c=ge(e,o.formatMajor>1?t+o.size+o.topDictLength:l.endOffset,void 0,o.formatMajor);n.gsubrs=c.objects,n.gsubrsBias=Lt(n.gsubrs);let u;if(o.formatMajor>1){const p=t+o.size,d=S.getBytes(e,p,p+o.topDictLength);u=Ft(e,0,[d],void 0,o.formatMajor)[0]}else{const p=Ft(e,t,i.objects,l.objects,o.formatMajor);if(p.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+p.length);u=p[0]}if(s.topDict=u,u._privateDict&&(n.defaultWidthX=u._privateDict.defaultWidthX,n.nominalWidthX=u._privateDict.nominalWidthX),o.formatMajor<2&&u.ros[0]!==void 0&&u.ros[1]!==void 0&&(n.isCIDFont=!0),o.formatMajor>1){let p=u.fdArray,d=u.fdSelect;if(!p)throw new Error("This is a CFF2 font, but FDArray information is missing");const f=ge(e,t+p,null,o.formatMajor),g=Io(e,t,f.objects);u._fdArray=g,d&&(u._fdSelect=Ln(e,t+d,n.numGlyphs,g.length,o.formatMajor))}else if(n.isCIDFont){let p=u.fdArray,d=u.fdSelect;if(p===0||d===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");p+=t;const f=ge(e,p),g=Ft(e,t,f.objects,l.objects,o.formatMajor);u._fdArray=g,d+=t,u._fdSelect=Ln(e,d,n.numGlyphs,g.length,o.formatMajor)}if(o.formatMajor<2){const p=t+u.private[1],d=hn(e,p,u.private[0],l.objects,o.formatMajor);if(n.defaultWidthX=d.defaultWidthX,n.nominalWidthX=d.nominalWidthX,d.subrs!==0){const f=p+d.subrs,g=ge(e,f);n.subrs=g.objects,n.subrsBias=Lt(n.subrs)}else n.subrs=[],n.subrsBias=0}let h;if(r.lowMemory?(h=mo(e,t+u.charStrings,o.formatMajor),n.nGlyphs=h.offsets.length-(o.formatMajor>1?1:0)):(h=ge(e,t+u.charStrings,null,o.formatMajor),n.nGlyphs=h.objects.length),o.formatMajor>1&&n.tables.maxp&&n.nGlyphs!==n.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${n.nGlyphs}) must correspond to the glyph count in the maxp table (${n.tables.maxp.numGlyphs})`),o.formatMajor<2){let p=[],d=[];u.charset===0?p=Js:u.charset===1?p=eo:u.charset===2?p=to:p=wo(e,t+u.charset,n.nGlyphs,l.objects,n.isCIDFont),u.encoding===0?d=Xt:u.encoding===1?d=no:d=Lo(e,t+u.encoding),n.cffEncoding=new wr(d,p),n.encoding=n.encoding||n.cffEncoding}if(n.glyphs=new ve.GlyphSet(n),r.lowMemory)n._push=function(p){const d=yo(p,h.offsets,e,t+u.charStrings,void 0,o.formatMajor);n.glyphs.push(p,ve.cffGlyphLoader(n,p,Zt,d,o.formatMajor))};else for(let p=0;p<n.nGlyphs;p+=1){const d=h.objects[p];n.glyphs.push(p,ve.cffGlyphLoader(n,p,Zt,d,o.formatMajor))}if(u.vstore){const p=new S.Parser(e,t+u.vstore);u._vstore=p.parseVariationStore()}}function Pr(e,t){let n,r=gt.indexOf(e);return r>=0&&(n=r),r=t.indexOf(e),r>=0?n=r+gt.length:(n=gt.length+t.length,t.push(e)),n}function Do(){return new v.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Mo(e){const t=new v.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(let n=0;n<e.length;n+=1)t.names.push({name:"name_"+n,type:"NAME",value:e[n]});return t}function Fr(e,t,n){const r={};for(let s=0;s<e.length;s+=1){const o=e[s];let a=t[o.name];a!==void 0&&!Dr(a,o.value)&&(o.type==="SID"&&(a=Pr(a,n)),r[o.op]={name:o.name,type:o.type,value:a})}return r}function Cn(e,t,n){const r=new v.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=Fr(Mr,e,t),r}function En(e){const t=new v.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return t.topDicts=[{name:"topDict_0",type:"TABLE",value:e}],t}function Ao(e){const t=new v.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);t.strings=[];for(let n=0;n<e.length;n+=1)t.strings.push({name:"string_"+n,type:"STRING",value:e[n]});return t}function No(){return new v.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Po(e,t){const n=new v.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let r=0;r<e.length;r+=1){const s=e[r],o=Pr(s,t);n.fields.push({name:"glyph_"+r,type:"SID",value:o})}return n}function Fo(e,t){const n=[],r=e.path;n.push({name:"width",type:"NUMBER",value:e.advanceWidth});let s=0,o=0;for(let a=0;a<r.commands.length;a+=1){let i,l,c=r.commands[a];if(c.type==="Q"){const u=.3333333333333333,h=2/3;c={type:"C",x:c.x,y:c.y,x1:Math.round(u*s+h*c.x1),y1:Math.round(u*o+h*c.y1),x2:Math.round(u*c.x+h*c.x1),y2:Math.round(u*c.y+h*c.y1)}}if(c.type==="M")i=Math.round(c.x-s),l=Math.round(c.y-o),n.push({name:"dx",type:"NUMBER",value:i}),n.push({name:"dy",type:"NUMBER",value:l}),n.push({name:"rmoveto",type:"OP",value:21}),s=Math.round(c.x),o=Math.round(c.y);else if(c.type==="L")i=Math.round(c.x-s),l=Math.round(c.y-o),n.push({name:"dx",type:"NUMBER",value:i}),n.push({name:"dy",type:"NUMBER",value:l}),n.push({name:"rlineto",type:"OP",value:5}),s=Math.round(c.x),o=Math.round(c.y);else if(c.type==="C"){const u=Math.round(c.x1-s),h=Math.round(c.y1-o),p=Math.round(c.x2-c.x1),d=Math.round(c.y2-c.y1);i=Math.round(c.x-c.x2),l=Math.round(c.y-c.y2),n.push({name:"dx1",type:"NUMBER",value:u}),n.push({name:"dy1",type:"NUMBER",value:h}),n.push({name:"dx2",type:"NUMBER",value:p}),n.push({name:"dy2",type:"NUMBER",value:d}),n.push({name:"dx",type:"NUMBER",value:i}),n.push({name:"dy",type:"NUMBER",value:l}),n.push({name:"rrcurveto",type:"OP",value:8}),s=Math.round(c.x),o=Math.round(c.y)}}return n.push({name:"endchar",type:"OP",value:14}),n}function Go(e,t){const n=new v.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let r=0;r<e.length;r+=1){const s=e.get(r),o=Fo(s);n.charStrings.push({name:s.name,type:"CHARSTRING",value:o})}return n}function Bo(e,t,n){const r=new v.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=Fr(Ar,e,t),r}function Ho(e,t){const n=new v.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),r=1/t.unitsPerEm,s={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[r,0,0,r,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},o=t&&t.topDict||{};o.paintType&&(s.paintType=o.paintType,s.strokeWidth=o.strokeWidth||0);const a={},i=[];let l;for(let p=1;p<e.length;p+=1)l=e.get(p),i.push(l.name);const c=[];n.header=Do(),n.nameIndex=Mo([t.postScriptName]);let u=Cn(s,c);n.topDictIndex=En(u),n.globalSubrIndex=No(),n.charsets=Po(i,c),n.charStringsIndex=Go(e),n.privateDict=Bo(a,c),n.stringIndex=Ao(c);const h=n.header.sizeOf()+n.nameIndex.sizeOf()+n.topDictIndex.sizeOf()+n.stringIndex.sizeOf()+n.globalSubrIndex.sizeOf();return s.charset=h,s.encoding=0,s.charStrings=s.charset+n.charsets.sizeOf(),s.private[1]=s.charStrings+n.charStringsIndex.sizeOf(),u=Cn(s,c),n.topDictIndex=En(u),n}var Kt={parse:Eo,make:Ho};function _o(e,t){const n={},r=new S.Parser(e,t);return n.version=r.parseVersion(),n.fontRevision=Math.round(r.parseFixed()*1e3)/1e3,n.checkSumAdjustment=r.parseULong(),n.magicNumber=r.parseULong(),O.argument(n.magicNumber===1594834165,"Font header has wrong magic number."),n.flags=r.parseUShort(),n.unitsPerEm=r.parseUShort(),n.created=r.parseLongDateTime(),n.modified=r.parseLongDateTime(),n.xMin=r.parseShort(),n.yMin=r.parseShort(),n.xMax=r.parseShort(),n.yMax=r.parseShort(),n.macStyle=r.parseUShort(),n.lowestRecPPEM=r.parseUShort(),n.fontDirectionHint=r.parseShort(),n.indexToLocFormat=r.parseShort(),n.glyphDataFormat=r.parseShort(),n}function zo(e){const t=Math.round(new Date().getTime()/1e3)+2082844800;let n=t,r=e.macStyle||0;return e.createdTimestamp&&(n=e.createdTimestamp+2082844800),new v.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:n},{name:"modified",type:"LONGDATETIME",value:t},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:r},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)}var Gr={parse:_o,make:zo};function Vo(e,t){const n={},r=new S.Parser(e,t);return n.version=r.parseVersion(),n.ascender=r.parseShort(),n.descender=r.parseShort(),n.lineGap=r.parseShort(),n.advanceWidthMax=r.parseUShort(),n.minLeftSideBearing=r.parseShort(),n.minRightSideBearing=r.parseShort(),n.xMaxExtent=r.parseShort(),n.caretSlopeRise=r.parseShort(),n.caretSlopeRun=r.parseShort(),n.caretOffset=r.parseShort(),r.relativeOffset+=8,n.metricDataFormat=r.parseShort(),n.numberOfHMetrics=r.parseUShort(),n}function qo(e){return new v.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)}var Br={parse:Vo,make:qo};function Wo(e,t,n,r,s){let o,a;const i=new S.Parser(e,t);for(let l=0;l<r;l+=1){l<n&&(o=i.parseUShort(),a=i.parseShort());const c=s.get(l);c.advanceWidth=o,c.leftSideBearing=a}}function jo(e,t,n,r,s){e._hmtxTableData={};let o,a;const i=new S.Parser(t,n);for(let l=0;l<s;l+=1)l<r&&(o=i.parseUShort(),a=i.parseShort()),e._hmtxTableData[l]={advanceWidth:o,leftSideBearing:a}}function $o(e,t,n,r,s,o,a){a.lowMemory?jo(e,t,n,r,s):Wo(t,n,r,s,o)}function Yo(e){const t=new v.Table("hmtx",[]);for(let n=0;n<e.length;n+=1){const r=e.get(n),s=r.advanceWidth||0,o=r.leftSideBearing||0;t.fields.push({name:"advanceWidth_"+n,type:"USHORT",value:s}),t.fields.push({name:"leftSideBearing_"+n,type:"SHORT",value:o})}return t}var Hr={parse:$o,make:Yo};function Xo(e){const t=new v.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]);let n="";const r=12+e.length*4;for(let s=0;s<e.length;++s){let o=n.indexOf(e[s]);o<0&&(o=n.length,n+=e[s]),t.fields.push({name:"offset "+s,type:"USHORT",value:r+o}),t.fields.push({name:"length "+s,type:"USHORT",value:e[s].length})}return t.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),t}function Zo(e,t){const n=new S.Parser(e,t),r=n.parseULong();O.argument(r===1,"Unsupported ltag table version."),n.skip("uLong",1);const s=n.parseULong(),o=[];for(let a=0;a<s;a++){let i="";const l=t+n.parseUShort(),c=n.parseUShort();for(let u=l;u<l+c;++u)i+=String.fromCharCode(e.getInt8(u));o.push(i)}return o}var _r={make:Xo,parse:Zo};function Ko(e,t){const n={},r=new S.Parser(e,t);return n.version=r.parseVersion(),n.numGlyphs=r.parseUShort(),n.version===1&&(n.maxPoints=r.parseUShort(),n.maxContours=r.parseUShort(),n.maxCompositePoints=r.parseUShort(),n.maxCompositeContours=r.parseUShort(),n.maxZones=r.parseUShort(),n.maxTwilightPoints=r.parseUShort(),n.maxStorage=r.parseUShort(),n.maxFunctionDefs=r.parseUShort(),n.maxInstructionDefs=r.parseUShort(),n.maxStackElements=r.parseUShort(),n.maxSizeOfInstructions=r.parseUShort(),n.maxComponentElements=r.parseUShort(),n.maxComponentDepth=r.parseUShort()),n}function Qo(e){return new v.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])}var zr={parse:Ko,make:Qo},Qt=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function Jo(e){for(let t=0;t<Qt.length;t+=1){const n=Qt[t];if(e>=n.begin&&e<n.end)return t}return-1}function ea(e,t){const n={},r=new S.Parser(e,t);n.version=r.parseUShort(),n.xAvgCharWidth=r.parseShort(),n.usWeightClass=r.parseUShort(),n.usWidthClass=r.parseUShort(),n.fsType=r.parseUShort(),n.ySubscriptXSize=r.parseShort(),n.ySubscriptYSize=r.parseShort(),n.ySubscriptXOffset=r.parseShort(),n.ySubscriptYOffset=r.parseShort(),n.ySuperscriptXSize=r.parseShort(),n.ySuperscriptYSize=r.parseShort(),n.ySuperscriptXOffset=r.parseShort(),n.ySuperscriptYOffset=r.parseShort(),n.yStrikeoutSize=r.parseShort(),n.yStrikeoutPosition=r.parseShort(),n.sFamilyClass=r.parseShort(),n.panose=[];for(let s=0;s<10;s++)n.panose[s]=r.parseByte();return n.ulUnicodeRange1=r.parseULong(),n.ulUnicodeRange2=r.parseULong(),n.ulUnicodeRange3=r.parseULong(),n.ulUnicodeRange4=r.parseULong(),n.achVendID=String.fromCharCode(r.parseByte(),r.parseByte(),r.parseByte(),r.parseByte()),n.fsSelection=r.parseUShort(),n.usFirstCharIndex=r.parseUShort(),n.usLastCharIndex=r.parseUShort(),n.sTypoAscender=r.parseShort(),n.sTypoDescender=r.parseShort(),n.sTypoLineGap=r.parseShort(),n.usWinAscent=r.parseUShort(),n.usWinDescent=r.parseUShort(),n.version>=1&&(n.ulCodePageRange1=r.parseULong(),n.ulCodePageRange2=r.parseULong()),n.version>=2&&(n.sxHeight=r.parseShort(),n.sCapHeight=r.parseShort(),n.usDefaultChar=r.parseUShort(),n.usBreakChar=r.parseUShort(),n.usMaxContent=r.parseUShort()),n}function ta(e){return new v.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],e)}var Jt={parse:ea,make:ta,unicodeRanges:Qt,getUnicodeRange:Jo};function na(e,t){const n={},r=new S.Parser(e,t);switch(n.version=r.parseVersion(),n.italicAngle=r.parseFixed(),n.underlinePosition=r.parseShort(),n.underlineThickness=r.parseShort(),n.isFixedPitch=r.parseULong(),n.minMemType42=r.parseULong(),n.maxMemType42=r.parseULong(),n.minMemType1=r.parseULong(),n.maxMemType1=r.parseULong(),n.version){case 1:n.names=Me.slice();break;case 2:n.numberOfGlyphs=r.parseUShort(),n.glyphNameIndex=new Array(n.numberOfGlyphs);for(let s=0;s<n.numberOfGlyphs;s++)n.glyphNameIndex[s]=r.parseUShort();n.names=[];for(let s=0;s<n.numberOfGlyphs;s++)if(n.glyphNameIndex[s]>=Me.length){const o=r.parseChar();n.names.push(r.parseString(o))}break;case 2.5:n.numberOfGlyphs=r.parseUShort(),n.offset=new Array(n.numberOfGlyphs);for(let s=0;s<n.numberOfGlyphs;s++)n.offset[s]=r.parseChar();break}return n}function ra(e){const{italicAngle:t=Math.round((e.italicAngle||0)*65536),underlinePosition:n=0,underlineThickness:r=0,isFixedPitch:s=0,minMemType42:o=0,maxMemType42:a=0,minMemType1:i=0,maxMemType1:l=0}=e.tables.post||{};return new v.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:t},{name:"underlinePosition",type:"FWORD",value:n},{name:"underlineThickness",type:"FWORD",value:r},{name:"isFixedPitch",type:"ULONG",value:s},{name:"minMemType42",type:"ULONG",value:o},{name:"maxMemType42",type:"ULONG",value:a},{name:"minMemType1",type:"ULONG",value:i},{name:"maxMemType1",type:"ULONG",value:l}])}var Vr={parse:na,make:ra},ce=new Array(9);ce[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(m.coverage),deltaGlyphId:this.parseShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(m.coverage),substitute:this.parseOffset16List()};O.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")};ce[2]=function(){const e=this.parseUShort();return O.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(m.coverage),sequences:this.parseListOfLists()}};ce[3]=function(){const e=this.parseUShort();return O.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(m.coverage),alternateSets:this.parseListOfLists()}};ce[4]=function(){const e=this.parseUShort();return O.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(m.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var qe={sequenceIndex:m.uShort,lookupListIndex:m.uShort};ce[5]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(m.coverage),ruleSets:this.parseListOfLists(function(){const n=this.parseUShort(),r=this.parseUShort();return{input:this.parseUShortList(n-1),lookupRecords:this.parseRecordList(r,qe)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(m.coverage),classDef:this.parsePointer(m.classDef),classSets:this.parseListOfLists(function(){const n=this.parseUShort(),r=this.parseUShort();return{classes:this.parseUShortList(n-1),lookupRecords:this.parseRecordList(r,qe)}})};if(t===3){const n=this.parseUShort(),r=this.parseUShort();return{substFormat:t,coverages:this.parseList(n,m.pointer(m.coverage)),lookupRecords:this.parseRecordList(r,qe)}}O.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")};ce[6]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(m.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(qe)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(m.coverage),backtrackClassDef:this.parsePointer(m.classDef),inputClassDef:this.parsePointer(m.classDef),lookaheadClassDef:this.parsePointer(m.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(qe)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(m.pointer(m.coverage)),inputCoverage:this.parseList(m.pointer(m.coverage)),lookaheadCoverage:this.parseList(m.pointer(m.coverage)),lookupRecords:this.parseRecordList(qe)};O.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")};ce[7]=function(){const e=this.parseUShort();O.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");const t=this.parseUShort(),n=new m(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:ce[t].call(n)}};ce[8]=function(){const e=this.parseUShort();return O.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(m.coverage),backtrackCoverage:this.parseList(m.pointer(m.coverage)),lookaheadCoverage:this.parseList(m.pointer(m.coverage)),substitutes:this.parseUShortList()}};function sa(e,t){t=t||0;const n=new m(e,t),r=n.parseVersion(1);return O.argument(r===1||r===1.1,"Unsupported GSUB table version."),r===1?{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(ce)}:{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(ce),variations:n.parseFeatureVariationsList()}}var Pe=new Array(9);Pe[1]=function(e){if(e.substFormat===1)return new v.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)},{name:"deltaGlyphID",type:"SHORT",value:e.deltaGlyphId}]);if(e.substFormat===2)return new v.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.ushortList("substitute",e.substitute)));O.fail("Lookup type 1 substFormat must be 1 or 2.")};Pe[2]=function(e){return O.assert(e.substFormat===1,"Lookup type 2 substFormat must be 1."),new v.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.tableList("seqSet",e.sequences,function(t){return new v.Table("sequenceSetTable",v.ushortList("sequence",t))})))};Pe[3]=function(e){return O.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new v.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.tableList("altSet",e.alternateSets,function(t){return new v.Table("alternateSetTable",v.ushortList("alternate",t))})))};Pe[4]=function(e){return O.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new v.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.tableList("ligSet",e.ligatureSets,function(t){return new v.Table("ligatureSetTable",v.tableList("ligature",t,function(n){return new v.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:n.ligGlyph}].concat(v.ushortList("component",n.components,n.components.length+1)))}))})))};Pe[5]=function(e){if(e.substFormat===1)return new v.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.tableList("sequenceRuleSet",e.ruleSets,function(t){return t?new v.Table("sequenceRuleSetTable",v.tableList("sequenceRule",t,function(n){let r=v.ushortList("seqLookup",[],n.lookupRecords.length).concat(v.ushortList("inputSequence",n.input,n.input.length+1));[r[0],r[1]]=[r[1],r[0]];for(let s=0;s<n.lookupRecords.length;s++){const o=n.lookupRecords[s];r=r.concat({name:"sequenceIndex"+s,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:o.lookupListIndex})}return new v.Table("sequenceRuleTable",r)})):new v.Table("NULL",null)})));if(e.substFormat===2)return new v.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)},{name:"classDef",type:"TABLE",value:new v.ClassDef(e.classDef)}].concat(v.tableList("classSeqRuleSet",e.classSets,function(t){return t?new v.Table("classSeqRuleSetTable",v.tableList("classSeqRule",t,function(n){let r=v.ushortList("classes",n.classes,n.classes.length+1).concat(v.ushortList("seqLookupCount",[],n.lookupRecords.length));for(let s=0;s<n.lookupRecords.length;s++){const o=n.lookupRecords[s];r=r.concat({name:"sequenceIndex"+s,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:o.lookupListIndex})}return new v.Table("classSeqRuleTable",r)})):new v.Table("NULL",null)})));if(e.substFormat===3){let t=[{name:"substFormat",type:"USHORT",value:e.substFormat}];t.push({name:"inputGlyphCount",type:"USHORT",value:e.coverages.length}),t.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length});for(let n=0;n<e.coverages.length;n++){const r=e.coverages[n];t.push({name:"inputCoverage"+n,type:"TABLE",value:new v.Coverage(r)})}for(let n=0;n<e.lookupRecords.length;n++){const r=e.lookupRecords[n];t=t.concat({name:"sequenceIndex"+n,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+n,type:"USHORT",value:r.lookupListIndex})}return new v.Table("contextualSubstitutionTable",t)}O.assert(!1,"lookup type 5 format must be 1, 2 or 3.")};Pe[6]=function(e){if(e.substFormat===1)return new v.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new v.Coverage(e.coverage)}].concat(v.tableList("chainRuleSet",e.chainRuleSets,function(t){return new v.Table("chainRuleSetTable",v.tableList("chainRule",t,function(n){let r=v.ushortList("backtrackGlyph",n.backtrack,n.backtrack.length).concat(v.ushortList("inputGlyph",n.input,n.input.length+1)).concat(v.ushortList("lookaheadGlyph",n.lookahead,n.lookahead.length)).concat(v.ushortList("substitution",[],n.lookupRecords.length));for(let s=0;s<n.lookupRecords.length;s++){const o=n.lookupRecords[s];r=r.concat({name:"sequenceIndex"+s,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:o.lookupListIndex})}return new v.Table("chainRuleTable",r)}))})));if(e.substFormat===2)O.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(e.substFormat===3){let t=[{name:"substFormat",type:"USHORT",value:e.substFormat}];t.push({name:"backtrackGlyphCount",type:"USHORT",value:e.backtrackCoverage.length});for(let n=0;n<e.backtrackCoverage.length;n++){const r=e.backtrackCoverage[n];t.push({name:"backtrackCoverage"+n,type:"TABLE",value:new v.Coverage(r)})}t.push({name:"inputGlyphCount",type:"USHORT",value:e.inputCoverage.length});for(let n=0;n<e.inputCoverage.length;n++){const r=e.inputCoverage[n];t.push({name:"inputCoverage"+n,type:"TABLE",value:new v.Coverage(r)})}t.push({name:"lookaheadGlyphCount",type:"USHORT",value:e.lookaheadCoverage.length});for(let n=0;n<e.lookaheadCoverage.length;n++){const r=e.lookaheadCoverage[n];t.push({name:"lookaheadCoverage"+n,type:"TABLE",value:new v.Coverage(r)})}t.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length});for(let n=0;n<e.lookupRecords.length;n++){const r=e.lookupRecords[n];t=t.concat({name:"sequenceIndex"+n,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+n,type:"USHORT",value:r.lookupListIndex})}return new v.Table("chainContextTable",t)}O.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function oa(e){return new v.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new v.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new v.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new v.LookupList(e.lookups,Pe)}])}var qr={parse:sa,make:oa};function aa(e,t){const n=new S.Parser(e,t),r=n.parseULong();O.argument(r===1,"Unsupported META table version."),n.parseULong(),n.parseULong();const s=n.parseULong(),o={};for(let a=0;a<s;a++){const i=n.parseTag(),l=n.parseULong(),c=n.parseULong();if(i==="appl"||i==="bild")continue;const u=je.UTF8(e,t+l,c);o[i]=u}return o}function ia(e){const t=Object.keys(e).length;let n="";const r=16+t*12,s=new v.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:r},{name:"numTags",type:"ULONG",value:t}]);for(let o in e){const a=n.length;n+=e[o],s.fields.push({name:"tag "+o,type:"TAG",value:o}),s.fields.push({name:"offset "+o,type:"ULONG",value:r+a}),s.fields.push({name:"length "+o,type:"ULONG",value:e[o].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),s}var Wr={parse:aa,make:ia};function la(e,t){const n=new m(e,t),r=n.parseUShort();r!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");const s=n.parseUShort(),o=n.parseOffset32(),a=n.parseOffset32(),i=n.parseUShort();n.relativeOffset=o;const l=n.parseRecordList(s,{glyphID:m.uShort,firstLayerIndex:m.uShort,numLayers:m.uShort});n.relativeOffset=a;const c=n.parseRecordList(i,{glyphID:m.uShort,paletteIndex:m.uShort});return{version:r,baseGlyphRecords:l,layerRecords:c}}function ua({version:e=0,baseGlyphRecords:t=[],layerRecords:n=[]}){O.argument(e===0,"Only COLRv0 supported.");const r=14,s=r+t.length*6;return new v.Table("COLR",[{name:"version",type:"USHORT",value:e},{name:"numBaseGlyphRecords",type:"USHORT",value:t.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:r},{name:"layerRecordsOffset",type:"ULONG",value:s},{name:"numLayerRecords",type:"USHORT",value:n.length},...t.map((o,a)=>[{name:"glyphID_"+a,type:"USHORT",value:o.glyphID},{name:"firstLayerIndex_"+a,type:"USHORT",value:o.firstLayerIndex},{name:"numLayers_"+a,type:"USHORT",value:o.numLayers}]).flat(),...n.map((o,a)=>[{name:"LayerGlyphID_"+a,type:"USHORT",value:o.glyphID},{name:"paletteIndex_"+a,type:"USHORT",value:o.paletteIndex}]).flat()])}var jr={parse:la,make:ua};function ca(e,t){return[{name:"tag_"+e,type:"TAG",value:t.tag},{name:"minValue_"+e,type:"FIXED",value:t.minValue<<16},{name:"defaultValue_"+e,type:"FIXED",value:t.defaultValue<<16},{name:"maxValue_"+e,type:"FIXED",value:t.maxValue<<16},{name:"flags_"+e,type:"USHORT",value:0},{name:"nameID_"+e,type:"USHORT",value:t.axisNameID}]}function pa(e,t,n){const r={},s=new S.Parser(e,t);r.tag=s.parseTag(),r.minValue=s.parseFixed(),r.defaultValue=s.parseFixed(),r.maxValue=s.parseFixed(),s.skip("uShort",1);const o=s.parseUShort();return r.axisNameID=o,r.name=It(n,o),r}function ha(e,t,n,r={}){const s=[{name:"nameID_"+e,type:"USHORT",value:t.subfamilyNameID},{name:"flags_"+e,type:"USHORT",value:0}];for(let o=0;o<n.length;++o){const a=n[o].tag;s.push({name:"axis_"+e+" "+a,type:"FIXED",value:t.coordinates[a]<<16})}return r&&r.postScriptNameID&&s.push({name:"postScriptNameID_",type:"USHORT",value:t.postScriptNameID!==void 0?t.postScriptNameID:65535}),s}function fa(e,t,n,r,s){const o={},a=new S.Parser(e,t),i=a.parseUShort();o.subfamilyNameID=i,o.name=It(r,i,[2,17]),a.skip("uShort",1),o.coordinates={};for(let c=0;c<n.length;++c)o.coordinates[n[c].tag]=a.parseFixed();if(a.relativeOffset===s)return o.postScriptNameID=void 0,o.postScriptName=void 0,o;const l=a.parseUShort();return o.postScriptNameID=l==65535?void 0:l,o.postScriptName=o.postScriptNameID!==void 0?It(r,l,[6]):"",o}function da(e,t){const n=new v.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:e.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:e.instances.length},{name:"instanceSize",type:"USHORT",value:4+e.axes.length*4}]);n.offsetToData=n.sizeOf();for(let s=0;s<e.axes.length;s++)n.fields=n.fields.concat(ca(s,e.axes[s]));const r={};for(let s=0;s<e.instances.length;s++)if(e.instances[s].postScriptNameID!==void 0){n.instanceSize+=2,r.postScriptNameID=!0;break}for(let s=0;s<e.instances.length;s++)n.fields=n.fields.concat(ha(s,e.instances[s],e.axes,r));return n}function ga(e,t,n){const r=new S.Parser(e,t),s=r.parseULong();O.argument(s===65536,"Unsupported fvar table version.");const o=r.parseOffset16();r.skip("uShort",1);const a=r.parseUShort(),i=r.parseUShort(),l=r.parseUShort(),c=r.parseUShort(),u=[];for(let d=0;d<a;d++)u.push(pa(e,t+o+d*i,n));const h=[],p=t+o+a*i;for(let d=0;d<l;d++)h.push(fa(e,p+d*c,u,n,c));return{axes:u,instances:h}}var $r={make:da,parse:ga},ma={tag:m.tag,nameID:m.uShort,ordering:m.uShort},nt=new Array(5);nt[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}};nt[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}};nt[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}};nt[4]=function(){const e=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(e,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function ya(){const e=this.parseUShort(),t=nt[e],n={format:e};return t===void 0?(console.warn(`Unknown axis value table format ${e}`),n):Object.assign(n,this.parseStruct(t.bind(this)))}function va(e,t,n){t||(t=0);const r=new S.Parser(e,t),s=r.parseUShort(),o=r.parseUShort();s!==1&&console.warn(`Unsupported STAT table version ${s}.${o}`);const a=[s,o],i=r.parseUShort(),l=r.parseUShort(),c=r.parseOffset32(),u=r.parseUShort(),h=r.parseOffset32(),p=s>1||o>0?r.parseUShort():void 0;n!==void 0&&O.argument(l>=n.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),u>0&&O.argument(l>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");const d=[];for(let y=0;y<l;y++)r.offset=t+c,r.relativeOffset=y*i,d.push(r.parseStruct(ma));r.offset=t,r.relativeOffset=h;const f=r.parseUShortList(u),g=[];for(let y=0;y<u;y++)r.offset=t+h,r.relativeOffset=f[y],g.push(ya.apply(r));return{version:a,axes:d,values:g,elidedFallbackNameID:p}}var rt=new Array(5);rt[1]=function(e,t){return[{name:`format${e}`,type:"USHORT",value:1},{name:`axisIndex${e}`,type:"USHORT",value:t.axisIndex},{name:`flags${e}`,type:"USHORT",value:t.flags},{name:`valueNameID${e}`,type:"USHORT",value:t.valueNameID},{name:`value${e}`,type:"FLOAT",value:t.value}]};rt[2]=function(e,t){return[{name:`format${e}`,type:"USHORT",value:2},{name:`axisIndex${e}`,type:"USHORT",value:t.axisIndex},{name:`flags${e}`,type:"USHORT",value:t.flags},{name:`valueNameID${e}`,type:"USHORT",value:t.valueNameID},{name:`nominalValue${e}`,type:"FLOAT",value:t.nominalValue},{name:`rangeMinValue${e}`,type:"FLOAT",value:t.rangeMinValue},{name:`rangeMaxValue${e}`,type:"FLOAT",value:t.rangeMaxValue}]};rt[3]=function(e,t){return[{name:`format${e}`,type:"USHORT",value:3},{name:`axisIndex${e}`,type:"USHORT",value:t.axisIndex},{name:`flags${e}`,type:"USHORT",value:t.flags},{name:`valueNameID${e}`,type:"USHORT",value:t.valueNameID},{name:`value${e}`,type:"FLOAT",value:t.value},{name:`linkedValue${e}`,type:"FLOAT",value:t.linkedValue}]};rt[4]=function(e,t){let n=[{name:`format${e}`,type:"USHORT",value:4},{name:`axisCount${e}`,type:"USHORT",value:t.axisValues.length},{name:`flags${e}`,type:"USHORT",value:t.flags},{name:`valueNameID${e}`,type:"USHORT",value:t.valueNameID}];for(let r=0;r<t.axisValues.length;r++)n=n.concat([{name:`format${e}axisIndex${r}`,type:"USHORT",value:t.axisValues[r].axisIndex},{name:`format${e}value${r}`,type:"FLOAT",value:t.axisValues[r].value}]);return n};function ba(e,t){return new v.Record("axisRecord_"+e,[{name:"axisTag_"+e,type:"TAG",value:t.tag},{name:"axisNameID_"+e,type:"USHORT",value:t.nameID},{name:"axisOrdering_"+e,type:"USHORT",value:t.ordering}])}function Sa(e,t){const n=t.format,r=rt[n];O.argument(r!==void 0,`Unknown axis value table format ${n}`);const s=r(e,t);return new v.Table("axisValueTable_"+e,s)}function xa(e){const t=new v.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:e.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:e.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:e.elidedFallbackNameID}]);t.designAxesOffset=t.offsetToAxisValueOffsets=t.sizeOf();for(let o=0;o<e.axes.length;o++){const a=ba(o,e.axes[o]);t.offsetToAxisValueOffsets+=a.sizeOf(),t.fields=t.fields.concat(a.fields)}const n=[];let r=[],s=e.values.length*2;for(let o=0;o<e.values.length;o++){const a=Sa(o,e.values[o]);n.push({name:"offset_"+o,type:"USHORT",value:s}),s+=a.sizeOf(),r=r.concat(a.fields)}return t.fields=t.fields.concat(n),t.fields=t.fields.concat(r),t}var Yr={make:xa,parse:va};function Ta(e,t){return new v.Record("axisValueMap_"+e,[{name:"fromCoordinate_"+e,type:"F2DOT14",value:t.fromCoordinate},{name:"toCoordinate_"+e,type:"F2DOT14",value:t.toCoordinate}])}function ka(e,t){const n=new v.Record("segmentMap_"+e,[{name:"positionMapCount_"+e,type:"USHORT",value:t.axisValueMaps.length}]);let r=[];for(let s=0;s<t.axisValueMaps.length;s++){const o=Ta(`${e}_${s}`,t.axisValueMaps[s]);r=r.concat(o.fields)}return n.fields=n.fields.concat(r),n}function Oa(e,t){O.argument(e.axisSegmentMaps.length===t.axes.length,"avar axis count must correspond to fvar axis count");const n=new v.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:e.axisSegmentMaps.length}]);for(let r=0;r<e.axisSegmentMaps.length;r++){const s=ka(r,e.axisSegmentMaps[r]);n.fields=n.fields.concat(s.fields)}return n}function Ra(e,t,n){t||(t=0);const r=new m(e,t),s=r.parseUShort(),o=r.parseUShort();s!==1&&console.warn(`Unsupported avar table version ${s}.${o}`),r.skip("uShort",1);const a=r.parseUShort();O.argument(a===n.axes.length,"avar axis count must correspond to fvar axis count");const i=[];for(let l=0;l<a;l++){const c=[],u=r.parseUShort();for(let h=0;h<u;h++){const p=r.parseF2Dot14(),d=r.parseF2Dot14();c.push({fromCoordinate:p,toCoordinate:d})}i.push({axisValueMaps:c})}return{version:[s,o],axisSegmentMaps:i}}var Xr={make:Oa,parse:Ra};function Ua(e,t,n,r){const s=new S.Parser(e,t),o=s.parseTupleVariationStore(s.relativeOffset,n.axes.length,"cvar",r),a=s.parseUShort(),i=s.parseUShort();return a!==1&&console.warn(`Unsupported cvar table version ${a}.${i}`),{version:[a,i],...o}}function Ia(){console.warn("Writing of cvar tables is not yet supported.")}var Zr={make:Ia,parse:Ua};function wa(e,t,n,r){const s=new S.Parser(e,t),o=s.parseUShort(),a=s.parseUShort();o!==1&&console.warn(`Unsupported gvar table version ${o}.${a}`);const i=s.parseUShort();i!==n.axes.length&&console.warn(`axisCount ${i} in gvar table does not match the number of axes ${n.axes.length} in the fvar table!`);const l=s.parseUShort(),c=s.parsePointer32(function(){return this.parseTupleRecords(l,i)}),u=s.parseTupleVariationStoreList(i,"gvar",r);return{version:[o,a],sharedTuples:c,glyphVariations:u}}function La(){console.warn("Writing of gvar tables is not yet supported.")}var Kr={make:La,parse:wa};function Ca(e,t){const n={},r=new S.Parser(e,t);n.version=r.parseUShort(),O.argument(n.version<=1,"Unsupported gasp table version."),n.numRanges=r.parseUShort(),n.gaspRanges=[];for(let s=0;s<n.numRanges;s++)n.gaspRanges[s]={rangeMaxPPEM:r.parseUShort(),rangeGaspBehavior:r.parseUShort()};return n}function Ea(e){const t=new v.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:e.numRanges}]);for(let n in e.gaspRanges)t.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:e.gaspRanges[n].rangeMaxPPEM}),t.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:e.gaspRanges[n].rangeGaspBehavior});return t}var Qr={parse:Ca,make:Ea};function Da(e,t){const n=new Map,r=e.buffer,s=new m(e,t);if(s.parseUShort()!==0)return n;s.relativeOffset=s.parseOffset32();const o=e.byteOffset+t+s.relativeOffset,a=s.parseUShort(),i=new Map;for(let l=0;l<a;l++){const c=s.parseUShort(),u=s.parseUShort(),h=o+s.parseOffset32(),p=s.parseULong();let d=i.get(h);d===void 0&&(d=new Uint8Array(r,h,p),i.set(h,d));for(let f=c;f<=u;f++)n.set(f,d)}return n}function Ma(e){const t=Array.from(e.keys()).sort(),n=[],r=[],s=new Map;let o=0,a={endGlyphID:null};for(let p=0,d=t.length;p<d;p++){const f=t[p],g=e.get(f);let y=s.get(g);y===void 0&&(y=o,r.push(g),s.set(g,y),o+=g.byteLength),f-1===a.endGlyphID&&y===a.svgDocOffset?a.endGlyphID=f:(a={startGlyphID:f,endGlyphID:f,svgDocOffset:y,svgDocLength:g.byteLength},n.push(a))}const i=n.length,l=r.length,c=2+i*12,u=new Array(4+i*4+l);let h=0;u[h++]={name:"version",type:"USHORT",value:0},u[h++]={name:"svgDocumentListOffset",type:"ULONG",value:10},u[h++]={name:"reserved",type:"ULONG",value:0},u[h++]={name:"numEntries",type:"USHORT",value:i};for(let p=0;p<i;p++){const d="documentRecord_"+p,{startGlyphID:f,endGlyphID:g,svgDocOffset:y,svgDocLength:T}=n[p];u[h++]={name:d+"_startGlyphID",type:"USHORT",value:f},u[h++]={name:d+"_endGlyphID",type:"USHORT",value:g},u[h++]={name:d+"_svgDocOffset",type:"ULONG",value:c+y},u[h++]={name:d+"_svgDocLength",type:"ULONG",value:T}}for(let p=0;p<l;p++)u[h++]={name:"svgDoc_"+p,type:"LITERAL",value:r[p]};return new v.Table("SVG ",u)}var Jr={make:Ma,parse:Da};function Dn(e){return Math.log(e)/Math.log(2)|0}function fn(e){for(;e.length%4!==0;)e.push(0);let t=0;for(let n=0;n<e.length;n+=4)t+=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];return t%=Math.pow(2,32),t}function Mn(e,t,n,r){return new v.Record("Table Record",[{name:"tag",type:"TAG",value:e!==void 0?e:""},{name:"checkSum",type:"ULONG",value:t!==void 0?t:0},{name:"offset",type:"ULONG",value:n!==void 0?n:0},{name:"length",type:"ULONG",value:r!==void 0?r:0}])}function es(e){const t=new v.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);t.tables=e,t.numTables=e.length;const n=Math.pow(2,Dn(t.numTables));t.searchRange=16*n,t.entrySelector=Dn(n),t.rangeShift=t.numTables*16-t.searchRange;const r=[],s=[];let o=t.sizeOf()+Mn().sizeOf()*t.numTables;for(;o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0});for(let a=0;a<e.length;a+=1){const i=e[a];O.argument(i.tableName.length===4,"Table name"+i.tableName+" is invalid.");const l=i.sizeOf(),c=Mn(i.tableName,fn(i.encode()),o,l);for(r.push({name:c.tag+" Table Record",type:"RECORD",value:c}),s.push({name:i.tableName+" table",type:"RECORD",value:i}),o+=l,O.argument(!isNaN(o),"Something went wrong calculating the offset.");o%4!==0;)o+=1,s.push({name:"padding",type:"BYTE",value:0})}return r.sort(function(a,i){return a.value.tag>i.value.tag?1:-1}),t.fields=t.fields.concat(r),t.fields=t.fields.concat(s),t}function An(e,t,n){for(let r=0;r<t.length;r+=1){const s=e.charToGlyphIndex(t[r]);if(s>0)return e.glyphs.get(s).getMetrics()}return n}function Aa(e){let t=0;for(let n=0;n<e.length;n+=1)t+=e[n];return t/e.length}function Na(e){const t=[],n=[],r=[],s=[],o=[],a=[],i=[];let l,c=0,u=0,h=0,p=0,d=0;for(let F=0;F<e.glyphs.length;F+=1){const J=e.glyphs.get(F),oe=J.unicode|0;if(isNaN(J.advanceWidth))throw new Error("Glyph "+J.name+" ("+F+"): advanceWidth is not a number.");(l>oe||l===void 0)&&oe>0&&(l=oe),c<oe&&(c=oe);const le=Jt.getUnicodeRange(oe);if(le<32)u|=1<<le;else if(le<64)h|=1<<le-32;else if(le<96)p|=1<<le-64;else if(le<123)d|=1<<le-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(J.name===".notdef")continue;const xe=J.getMetrics();t.push(xe.xMin),n.push(xe.yMin),r.push(xe.xMax),s.push(xe.yMax),a.push(xe.leftSideBearing),i.push(xe.rightSideBearing),o.push(J.advanceWidth)}const f={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,r),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:Aa(o),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,i)};f.ascender=e.ascender,f.descender=e.descender;let g=0;e.weightClass>=600&&(g|=e.macStyleValues.BOLD),e.italicAngle<0&&(g|=e.macStyleValues.ITALIC);const y=Gr.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:f.xMin,yMin:f.yMin,xMax:f.xMax,yMax:f.yMax,lowestRecPPEM:3,macStyle:g,createdTimestamp:e.createdTimestamp}),T=Br.make({ascender:f.ascender,descender:f.descender,advanceWidthMax:f.advanceWidthMax,minLeftSideBearing:f.minLeftSideBearing,minRightSideBearing:f.minRightSideBearing,xMaxExtent:f.maxLeftSideBearing+(f.xMax-f.xMin),numberOfHMetrics:e.glyphs.length}),R=zr.make(e.glyphs.length),I=Jt.make(Object.assign({xAvgCharWidth:Math.round(f.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:c,ulUnicodeRange1:u,ulUnicodeRange2:h,ulUnicodeRange3:p,ulUnicodeRange4:d,sTypoAscender:f.ascender,sTypoDescender:f.descender,sTypoLineGap:0,usWinAscent:f.yMax,usWinDescent:Math.abs(f.yMin),ulCodePageRange1:1,sxHeight:An(e,"xyvw",{yMax:Math.round(f.ascender/2)}).yMax,sCapHeight:An(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",f).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0},e.tables.os2)),C=Hr.make(e.glyphs),P=Rr.make(e.glyphs),G=e.getEnglishName("fontFamily"),A=e.getEnglishName("fontSubfamily"),$=G+" "+A;let K=e.getEnglishName("postScriptName");K||(K=G.replace(/\s/g,"")+"-"+A);const E={};for(let F in e.names)E[F]=e.names[F];E.unicode=E.unicode||{},E.macintosh=E.macintosh||{},E.windows=E.windows||{};const z=e.names.unicode||{},ee=e.names.macintosh||{},D=e.names.windows||{};for(const F in E){if(E[F]=E[F]||{},!E[F].uniqueID){const J=e.getEnglishName("manufacturer")||"";E[F].uniqueID={en:`${J}: ${$}`}}E[F].postScriptName||(E[F].postScriptName={en:K})}E.unicode.preferredFamily||(E.unicode.preferredFamily=z.fontFamily||ee.fontFamily||D.fontFamily),E.macintosh.preferredFamily||(E.macintosh.preferredFamily=ee.fontFamily||z.fontFamily||D.fontFamily),E.windows.preferredFamily||(E.windows.preferredFamily=D.fontFamily||z.fontFamily||ee.fontFamily),E.unicode.preferredSubfamily||(E.unicode.preferredSubfamily=z.fontSubfamily||ee.fontSubfamily||D.fontSubfamily),E.macintosh.preferredSubfamily||(E.macintosh.preferredSubfamily=ee.fontSubfamily||z.fontSubfamily||D.fontSubfamily),E.windows.preferredSubfamily||(E.windows.preferredSubfamily=D.fontSubfamily||z.fontSubfamily||ee.fontSubfamily);const x=[],L=Or.make(E,x),U=x.length>0?_r.make(x):void 0,be=Vr.make(e),Ge=Kt.make(e.glyphs,{version:e.getEnglishName("version"),fullName:$,familyName:G,weightName:A,postScriptName:K,unitsPerEm:e.unitsPerEm,fontBBox:[0,f.yMin,f.ascender,f.advanceWidthMax],topDict:e.tables.cff&&e.tables.cff.topDict||{}}),Se=e.metas&&Object.keys(e.metas).length>0?Wr.make(e.metas):void 0,q=[y,T,R,I,L,P,be,Ge,C];U&&q.push(U);const te={gsub:qr,cpal:Er,colr:jr,stat:Yr,avar:Xr,cvar:Zr,fvar:$r,gvar:Kr,gasp:Qr,svg:Jr},Q={avar:[e.tables.fvar],fvar:[e.names]};for(let F in te){const J=e.tables[F];if(J){const oe=te[F].make.call(e,J,...Q[F]||[]);oe&&q.push(oe)}}Se&&q.push(Se);const Y=es(q),X=Y.encode(),ne=fn(X),B=Y.fields;let Be=!1;for(let F=0;F<B.length;F+=1)if(B[F].name==="head table"){B[F].value.checkSumAdjustment=2981146554-ne,Be=!0;break}if(!Be)throw new Error("Could not find head table with checkSum to adjust.");return Y}var Pa={make:es,fontToTable:Na,computeCheckSum:fn};function Gt(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=n+r>>>1,o=e[s].tag;if(o===t)return s;o<t?n=s+1:r=s-1}return-n-1}function Nn(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=n+r>>>1,o=e[s];if(o===t)return s;o<t?n=s+1:r=s-1}return-n-1}function Pn(e,t){let n,r=0,s=e.length-1;for(;r<=s;){const o=r+s>>>1;n=e[o];const a=n.start;if(a===t)return n;a<t?r=o+1:s=o-1}if(r>0)return n=e[r-1],t>n.end?0:n}function ts(e,t){this.font=e,this.tableName=t}ts.prototype={searchTag:Gt,binSearch:Nn,getTable:function(e){let t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){let e=this.getTable();return e?e.scripts.map(function(t){return t.tag}):[]},getDefaultScriptName:function(){let e=this.getTable();if(!e)return;let t=!1;for(let n=0;n<e.scripts.length;n++){const r=e.scripts[n].tag;if(r==="DFLT")return r;r==="latn"&&(t=!0)}if(t)return"latn"},getScriptTable:function(e,t){const n=this.getTable(t);if(n){e=e||"DFLT";const r=n.scripts,s=Gt(n.scripts,e);if(s>=0)return r[s].script;if(t){const o={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return r.splice(-1-s,0,o),o.script}}},getLangSysTable:function(e,t,n){const r=this.getScriptTable(e,n);if(r){if(!t||t==="dflt"||t==="DFLT")return r.defaultLangSys;const s=Gt(r.langSysRecords,t);if(s>=0)return r.langSysRecords[s].langSys;if(n){const o={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return r.langSysRecords.splice(-1-s,0,o),o.langSys}}},getFeatureTable:function(e,t,n,r){const s=this.getLangSysTable(e,t,r);if(s){let o;const a=s.featureIndexes,i=this.font.tables[this.tableName].features;for(let l=0;l<a.length;l++)if(o=i[a[l]],o.tag===n)return o.feature;if(r){const l=i.length;return O.assert(l===0||n>=i[l-1].tag,"Features must be added in alphabetical order."),o={tag:n,feature:{params:0,lookupListIndexes:[]}},i.push(o),a.push(l),o.feature}}},getLookupTables:function(e,t,n,r,s){const o=this.getFeatureTable(e,t,n,s),a=[];if(o){let i;const l=o.lookupListIndexes,c=this.font.tables[this.tableName].lookups;for(let u=0;u<l.length;u++)i=c[l[u]],i.lookupType===r&&a.push(i);if(a.length===0&&s){i={lookupType:r,lookupFlag:0,subtables:[],markFilteringSet:void 0};const u=c.length;return c.push(i),l.push(u),[i]}}return a},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:{const n=Pn(e.ranges,t);return n?n.classId:0}}},getCoverageIndex:function(e,t){switch(e.format){case 1:{const n=Nn(e.glyphs,t);return n>=0?n:-1}case 2:{const n=Pn(e.ranges,t);return n?n.index+t-n.start:-1}}},expandCoverage:function(e){if(e.format===1)return e.glyphs;{const t=[],n=e.ranges;for(let r=0;r<n.length;r++){const s=n[r],o=s.start,a=s.end;for(let i=o;i<=a;i++)t.push(i)}return t}}};var Et=ts;function st(e){Et.call(this,e,"gpos")}st.prototype=Et.prototype;st.prototype.init=function(){const e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)};st.prototype.getKerningValue=function(e,t,n){for(let r=0;r<e.length;r++){const s=e[r].subtables;for(let o=0;o<s.length;o++){const a=s[o],i=this.getCoverageIndex(a.coverage,t);if(!(i<0))switch(a.posFormat){case 1:{let l=a.pairSets[i];for(let c=0;c<l.length;c++){let u=l[c];if(u.secondGlyph===n)return u.value1&&u.value1.xAdvance||0}break}case 2:{const l=this.getGlyphClass(a.classDef1,t),c=this.getGlyphClass(a.classDef2,n),u=a.classRecords[l][c];return u.value1&&u.value1.xAdvance||0}}}}return 0};st.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,"kern",2)};var Fa=st;function Ga(e,t){const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Ba(e,t,n){let r=0,s=e.length-1,o=null;for(;r<=s;){const a=Math.floor((r+s)/2),i=e[a],l=i[t];if(l<n)r=a+1;else if(l>n)s=a-1;else{o=i;break}}return o}function Ha(e,t,n){let r=0,s=e.length-1;for(;r<=s;){const o=Math.floor((r+s)/2),a=e[o];if(a[t]<n)r=o+1;else if(a[t]>n)s=o-1;else return o}return-1}function _a(e,t,n){let r=0,s=e.length;const o=(a,i)=>a[t]-i[t];for(;r<s;){const a=r+s>>>1;o(e[a],n)<0?r=a+1:s=a}return e.splice(r,0,n),r}function ns(e){return e[0]===31&&e[1]===139&&e[2]===8}function za(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let n=10;const r=e.byteLength-8,s=t.getInt8(3);if(s&4&&(n+=2+t.getUint16(n,!0)),s&8)for(;n<r&&e[n++]!==0;);if(s&16)for(;n<r&&e[n++]!==0;);if(s&2&&(n+=2),n>=r)throw new Error("Can't find compressed blocks");const o=t.getUint32(t.byteLength-4,!0);return dr(e.subarray(n,r),new Uint8Array(o))}function Fn(e){return{x:e.x,y:e.y,onCurve:e.onCurve,lastPointOfContour:e.lastPointOfContour}}function Va(e){return{glyphIndex:e.glyphIndex,xScale:e.xScale,scale01:e.scale01,scale10:e.scale10,yScale:e.yScale,dx:e.dx,dy:e.dy}}function re(e){Et.call(this,e,"gsub")}function dn(e,t,n){const r=e.subtables;for(let s=0;s<r.length;s++){const o=r[s];if(o.substFormat===t)return o}if(n)return r.push(n),n}re.prototype=Et.prototype;re.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}};re.prototype.getSingle=function(e,t,n){const r=[],s=this.getLookupTables(t,n,e,1);for(let o=0;o<s.length;o++){const a=s[o].subtables;for(let i=0;i<a.length;i++){const l=a[i],c=this.expandCoverage(l.coverage);let u;if(l.substFormat===1){const h=l.deltaGlyphId;for(u=0;u<c.length;u++){const p=c[u];r.push({sub:p,by:p+h})}}else{const h=l.substitute;for(u=0;u<c.length;u++)r.push({sub:c[u],by:h[u]})}}}return r};re.prototype.getMultiple=function(e,t,n){const r=[],s=this.getLookupTables(t,n,e,2);for(let o=0;o<s.length;o++){const a=s[o].subtables;for(let i=0;i<a.length;i++){const l=a[i],c=this.expandCoverage(l.coverage);let u;for(u=0;u<c.length;u++){const h=c[u],p=l.sequences[u];r.push({sub:h,by:p})}}}return r};re.prototype.getAlternates=function(e,t,n){const r=[],s=this.getLookupTables(t,n,e,3);for(let o=0;o<s.length;o++){const a=s[o].subtables;for(let i=0;i<a.length;i++){const l=a[i],c=this.expandCoverage(l.coverage),u=l.alternateSets;for(let h=0;h<c.length;h++)r.push({sub:c[h],by:u[h]})}}return r};re.prototype.getLigatures=function(e,t,n){const r=[],s=this.getLookupTables(t,n,e,4);for(let o=0;o<s.length;o++){const a=s[o].subtables;for(let i=0;i<a.length;i++){const l=a[i],c=this.expandCoverage(l.coverage),u=l.ligatureSets;for(let h=0;h<c.length;h++){const p=c[h],d=u[h];for(let f=0;f<d.length;f++){const g=d[f];r.push({sub:[p].concat(g.components),by:g.ligGlyph})}}}}return r};re.prototype.addSingle=function(e,t,n,r){const s=this.getLookupTables(n,r,e,1,!0)[0],o=dn(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});O.assert(o.coverage.format===1,"Single: unable to modify coverage table format "+o.coverage.format);const a=t.sub;let i=this.binSearch(o.coverage.glyphs,a);i<0&&(i=-1-i,o.coverage.glyphs.splice(i,0,a),o.substitute.splice(i,0,0)),o.substitute[i]=t.by};re.prototype.addMultiple=function(e,t,n,r){O.assert(t.by instanceof Array&&t.by.length>1,'Multiple: "by" must be an array of two or more ids');const s=this.getLookupTables(n,r,e,2,!0)[0],o=dn(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});O.assert(o.coverage.format===1,"Multiple: unable to modify coverage table format "+o.coverage.format);const a=t.sub;let i=this.binSearch(o.coverage.glyphs,a);i<0&&(i=-1-i,o.coverage.glyphs.splice(i,0,a),o.sequences.splice(i,0,0)),o.sequences[i]=t.by};re.prototype.addAlternate=function(e,t,n,r){const s=this.getLookupTables(n,r,e,3,!0)[0],o=dn(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});O.assert(o.coverage.format===1,"Alternate: unable to modify coverage table format "+o.coverage.format);const a=t.sub;let i=this.binSearch(o.coverage.glyphs,a);i<0&&(i=-1-i,o.coverage.glyphs.splice(i,0,a),o.alternateSets.splice(i,0,0)),o.alternateSets[i]=t.by};re.prototype.addLigature=function(e,t,n,r){const s=this.getLookupTables(n,r,e,4,!0)[0];let o=s.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=o),O.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);const a=t.sub[0],i=t.sub.slice(1),l={ligGlyph:t.by,components:i};let c=this.binSearch(o.coverage.glyphs,a);if(c>=0){const u=o.ligatureSets[c];for(let h=0;h<u.length;h++)if(Ga(u[h].components,i))return;u.push(l)}else c=-1-c,o.coverage.glyphs.splice(c,0,a),o.ligatureSets.splice(c,0,[l])};re.prototype.getFeature=function(e,t,n){if(/ss\d\d/.test(e))return this.getSingle(e,t,n);switch(e){case"aalt":case"salt":return this.getSingle(e,t,n).concat(this.getAlternates(e,t,n));case"dlig":case"liga":case"rlig":return this.getLigatures(e,t,n);case"ccmp":return this.getMultiple(e,t,n).concat(this.getLigatures(e,t,n));case"stch":return this.getMultiple(e,t,n)}};re.prototype.add=function(e,t,n,r){if(/ss\d\d/.test(e))return this.addSingle(e,t,n,r);switch(e){case"aalt":case"salt":return typeof t.by=="number"?this.addSingle(e,t,n,r):this.addAlternate(e,t,n,r);case"dlig":case"liga":case"rlig":return this.addLigature(e,t,n,r);case"ccmp":return t.by instanceof Array?this.addMultiple(e,t,n,r):this.addLigature(e,t,n,r)}};var qa=re,rs=class{constructor(e){this.defaultValue=255,this.font=e}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(e){const t=[],n=this.cpal();if(!n)return t;for(let r=0;r<n.colorRecordIndices.length;r++){const s=n.colorRecordIndices[r],o=[];for(let a=s;a<s+n.numPaletteEntries;a++)o.push(Xe(n.colorRecords[a],e||"hexa"));t.push(o)}return t}toCPALcolor(e){return Array.isArray(e)?e.map(t=>wt(t,"raw")):wt(e,"raw")}fillPalette(e,t=[],n=this.cpal().numPaletteEntries){return e=Number.isInteger(e)?this.get(e,"raw"):e,Object.assign(Array(n).fill(this.defaultValue),this.toCPALcolor(e).concat(this.toCPALcolor(t)))}extend(e){if(this.ensureCPAL(Array(e).fill(this.defaultValue)))return;const t=this.cpal(),n=t.numPaletteEntries+e,r=this.getAll().map(s=>this.fillPalette(s,[],n));t.numPaletteEntries=n,t.colorRecords=this.toCPALcolor(r.flat()),this.updateIndices()}get(e,t="hexa"){return this.getAll(t)[e]||null}getColor(e,t=0,n="hexa"){return un(this.font,e,t,n)}setColor(e,t,n=0){e=parseInt(e),n=parseInt(n);let r=this.getAll("raw"),s=r[n];if(!s)throw Error(`paletteIndex ${n} out of range`);const o=this.cpal(),a=o.numPaletteEntries;Array.isArray(t)||(t=[t]),t.length+e>a&&(this.extend(t.length+e-a),r=this.getAll("raw"),s=r[n]);for(let i=0;i<t.length;i++)s[i+e]=this.toCPALcolor(t[i]);o.colorRecords=r.flat(),this.updateIndices()}add(e){if(this.ensureCPAL(e))return;const t=this.cpal(),n=t.numPaletteEntries;e&&e.length?(e=this.toCPALcolor(e),e.length>n?this.extend(e.length-n):e.length<n&&(e=this.fillPalette(e)),t.colorRecordIndices.push(t.colorRecords.length),t.colorRecords.push(...e)):(t.colorRecordIndices.push(t.colorRecords.length),t.colorRecords.push(...Array(n).fill(this.defaultValue)))}delete(e){const t=this.getAll("raw");delete t[e];const n=this.cpal();n.colorRecordIndices.pop(),n.colorRecords=t.flat()}deleteColor(e,t){if(e===t)throw Error("replacementIndex cannot be the same as colorIndex");const n=this.cpal(),r=this.getAll("raw"),s=[];if(t>n.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${n.numPaletteEntries-1}, replacementIndex: ${t})`);for(let i=0;i<r.length;i++){const l=r[i].filter((c,u)=>u!==e);s.push(l)}const o=this.font.tables.colr;if(o){const i=o.layerRecords;for(let l=0;l<i.length;l++){const c=i[l].paletteIndex;if(c>e)i[l].paletteIndex-=1;else if(c===e){let u=0;for(let h=0;h<r.length;h++)if(t>e&&t<=e+r[h].length){u++;break}i[l].paletteIndex=t-u}}this.font.tables.colr={...o,layerRecords:i}}const a=s.flat();for(let i=0;i<r.length;i++)n.colorRecordIndices[i]-=i;n.numPaletteEntries=Math.max(0,n.numPaletteEntries-1),n.colorRecords=this.toCPALcolor(a)}ensureCPAL(e){return this.cpal()?!1:(!e||!e.length?e=[this.defaultValue]:e=this.toCPALcolor(e),this.font.tables.cpal={version:0,numPaletteEntries:e.length,colorRecords:e,colorRecordIndices:[0]},!0)}updateIndices(){const e=this.cpal(),t=Math.ceil(e.colorRecords.length/e.numPaletteEntries);e.colorRecordIndices=[];for(let n=0;n<t;n++)e.colorRecordIndices.push(n*e.numPaletteEntries)}},Wa=class{constructor(e){this.font=e}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(e){const t=this.font,n=[],r=t.tables.colr,s=t.tables.cpal;if(!r||!s)return n;const o=Ba(r.baseGlyphRecords,"glyphID",e);if(!o)return n;const a=o.firstLayerIndex,i=o.numLayers;for(let l=0;l<i;l++){const c=r.layerRecords[a+l];n.push({glyph:t.glyphs.get(c.glyphID),paletteIndex:c.paletteIndex})}return n}add(e,t,n){const r=this.get(e);t=Array.isArray(t)?t:[t],n===void 0||n===1/0||n>r.length?n=r.length:n<0&&(n=r.length+1+n%(r.length+1),n>=r.length+1&&(n-=r.length+1));const s=[];for(let o=0;o<n;o++){const a=Number.isInteger(r[o].glyph)?r[o].glyph:r[o].glyph.index;s.push({glyphID:a,paletteIndex:r[o].paletteIndex})}for(const o of t){const a=Number.isInteger(o.glyph)?o.glyph:o.glyph.index;s.push({glyphID:a,paletteIndex:o.paletteIndex})}for(let o=n;o<r.length;o++){const a=Number.isInteger(r[o].glyph)?r[o].glyph:r[o].glyph.index;s.push({glyphID:a,paletteIndex:r[o].paletteIndex})}this.updateColrTable(e,s)}setPaletteIndex(e,t,n){let r=this.get(e);r[t]?(r=r.map((s,o)=>({glyphID:s.glyph.index,paletteIndex:o===t?n:s.paletteIndex})),this.updateColrTable(e,r)):console.error("Invalid layer index")}remove(e,t,n=t){let r=this.get(e);r=r.map(s=>({glyphID:s.glyph.index,paletteIndex:s.paletteIndex})),r.splice(t,n-t+1),this.updateColrTable(e,r)}updateColrTable(e,t){this.ensureCOLR();const n=this.font.tables.colr;let r=Ha(n.baseGlyphRecords,"glyphID",e);if(r===-1){const l={glyphID:e,firstLayerIndex:n.layerRecords.length,numLayers:0};r=_a(n.baseGlyphRecords,"glyphID",l)}const s=n.baseGlyphRecords[r],o=s.numLayers,a=t.length,i=a-o;if(i>0){const l=t.slice(o).map(c=>({glyphID:c.glyphID,paletteIndex:c.paletteIndex}));n.layerRecords.splice(s.firstLayerIndex+o,0,...l)}else i<0&&n.layerRecords.splice(s.firstLayerIndex+a,-i);for(let l=0;l<Math.min(o,a);l++)n.layerRecords[s.firstLayerIndex+l]={glyphID:t[l].glyphID,paletteIndex:t[l].paletteIndex};if(s.numLayers=a,i!==0)for(let l=0;l<n.baseGlyphRecords.length;l++){const c=n.baseGlyphRecords[l];l===r||c.firstLayerIndex<s.firstLayerIndex||(n.baseGlyphRecords[l].firstLayerIndex+=i)}}},ja=class{constructor(e){this.font=e,this.cache=new WeakMap}get(e){const t=this.getOrCreateSvgImageCacheEntry(e);return t&&t.image}getAsync(e){const t=this.getOrCreateSvgImageCacheEntry(e);return t&&t.promise}getOrCreateSvgImageCacheEntry(e){const t=this.font.tables.svg;if(t===void 0)return;const n=t.get(e);if(n===void 0)return;let r=this.cache.get(n);r===void 0&&(r=$a(n),this.cache.set(n,r));let s=r.images.get(e);return s===void 0&&(s=Ya(this.font,r.template,e),s.promise.then(o=>{if(s.image=o,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(e)}catch(a){console.error("font.onGlyphUpdated",e,a)}}),r.images.set(e,s)),s}};function $a(e){return{template:Xa(e).then(Qa),images:new Map}}function Ya(e,t,n){return{promise:t.then(r=>{let s;typeof r=="string"?s=r:(r[4]=n,s=r.join(""));const o=Ja(s,e.unitsPerEm);return o.image.decode().then(()=>o)}),image:void 0}}var Xa=typeof DecompressionStream=="function"?Ka:Za;function Za(e){try{return Promise.resolve(new TextDecoder().decode(ns(e)?za(e):e))}catch(t){return Promise.reject(t)}}function Ka(e){if(ns(e))return new Response(new Response(e).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(e))}catch(t){return Promise.reject(t)}}function Qa(e){const t=e.indexOf("<svg"),n=e.indexOf(">",t+4)+1;if(/ id=['"]glyph\d+['"]/.test(e.substring(t,n)))return e;const r=e.lastIndexOf("</svg>");return[e.substring(0,n),"<defs>",e.substring(n,r),'</defs><use href="#glyph',"",'"/>',e.substring(r)]}function Ja(e,t){const n=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,r=n.viewBox.baseVal,s=n.width.baseVal,o=n.height.baseVal;let a=1,i=1;r.width>0&&r.height>0&&(s.unitType===1?(a=s.valueInSpecifiedUnits/r.width,i=o.unitType===1?o.valueInSpecifiedUnits/r.height:a):o.unitType===1?(i=o.valueInSpecifiedUnits/r.height,a=i):t&&(a=t/r.width,i=t/r.height));const l=document.createElement("div");l.style.position="fixed",l.style.visibility="hidden",l.appendChild(n),document.body.appendChild(l);const c=n.getBBox();document.body.removeChild(l);const u=(c.x-r.x)*a,h=(r.y-c.y)*i,p=c.width*a,d=c.height*i;n.setAttribute("viewBox",[c.x,c.y,c.width,c.height].join(" ")),a!==1&&n.setAttribute("width",p),i!==1&&n.setAttribute("height",d);const f=new Image(p,d);return f.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(n.outerHTML),{leftSideBearing:u,baseline:h,image:f}}function Gn(e,t,n,r,s){let o;return(t&r)>0?(o=e.parseByte(),(t&s)===0&&(o=-o),o=n+o):(t&s)>0?o=n:o=n+e.parseShort(),o}function ss(e,t,n){const r=new S.Parser(t,n);e._numberOfContours=r.parseShort(),e._xMin=r.parseShort(),e._yMin=r.parseShort(),e._xMax=r.parseShort(),e._yMax=r.parseShort();let s,o;if(e._numberOfContours>0){const a=e.endPointIndices=[];for(let l=0;l<e._numberOfContours;l+=1)a.push(r.parseUShort());e.instructionLength=r.parseUShort(),e.instructions=[];for(let l=0;l<e.instructionLength;l+=1)e.instructions.push(r.parseByte());const i=a[a.length-1]+1;s=[];for(let l=0;l<i;l+=1)if(o=r.parseByte(),s.push(o),(o&8)>0){const c=r.parseByte();for(let u=0;u<c;u+=1)s.push(o),l+=1}if(O.argument(s.length===i,"Bad flags."),a.length>0){const l=[];let c;if(i>0){for(let p=0;p<i;p+=1)o=s[p],c={},c.onCurve=!!(o&1),c.lastPointOfContour=a.indexOf(p)>=0,l.push(c);let u=0;for(let p=0;p<i;p+=1)o=s[p],c=l[p],c.x=Gn(r,o,u,2,16),u=c.x;let h=0;for(let p=0;p<i;p+=1)o=s[p],c=l[p],c.y=Gn(r,o,h,4,32),h=c.y}e.points=l}else e.points=[]}else if(e.numberOfContours===0)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];let a=!0;for(;a;){s=r.parseUShort();const i={glyphIndex:r.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(i.dx=r.parseShort(),i.dy=r.parseShort()):i.matchedPoints=[r.parseUShort(),r.parseUShort()]:(s&2)>0?(i.dx=r.parseChar(),i.dy=r.parseChar()):i.matchedPoints=[r.parseByte(),r.parseByte()],(s&8)>0?i.xScale=i.yScale=r.parseF2Dot14():(s&64)>0?(i.xScale=r.parseF2Dot14(),i.yScale=r.parseF2Dot14()):(s&128)>0&&(i.xScale=r.parseF2Dot14(),i.scale01=r.parseF2Dot14(),i.scale10=r.parseF2Dot14(),i.yScale=r.parseF2Dot14()),e.components.push(i),a=!!(s&32)}if(s&256){e.instructionLength=r.parseUShort(),e.instructions=[];for(let i=0;i<e.instructionLength;i+=1)e.instructions.push(r.parseByte())}}}function mt(e,t){const n=[];for(let r=0;r<e.length;r+=1){const s=e[r],o={x:t.xScale*s.x+t.scale10*s.y+t.dx,y:t.scale01*s.x+t.yScale*s.y+t.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}function ei(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const s=e[r];n.push(s),s.lastPointOfContour&&(t.push(n),n=[])}return O.argument(n.length===0,"There are still points left in the current contour."),t}function gn(e){const t=new We;if(!e)return t;const n=ei(e);for(let r=0;r<n.length;++r){const s=n[r];let o=s[s.length-1],a=s[0];if(o.onCurve)t.moveTo(o.x,o.y);else if(a.onCurve)t.moveTo(a.x,a.y);else{const i={x:(o.x+a.x)*.5,y:(o.y+a.y)*.5};t.moveTo(i.x,i.y)}for(let i=0;i<s.length;++i)if(o=a,a=s[(i+1)%s.length],o.onCurve)t.lineTo(o.x,o.y);else{let l=a;a.onCurve||(l={x:(o.x+a.x)*.5,y:(o.y+a.y)*.5}),t.quadraticCurveTo(o.x,o.y,l.x,l.y)}t.closePath()}return t}function os(e,t){if(t.isComposite)for(let n=0;n<t.components.length;n+=1){const r=t.components[n],s=e.get(r.glyphIndex);if(s.getPath(),s.points){let o;if(r.matchedPoints===void 0)o=mt(s.points,r);else{if(r.matchedPoints[0]>t.points.length-1||r.matchedPoints[1]>s.points.length-1)throw Error("Matched points out of range in "+t.name);const a=t.points[r.matchedPoints[0]];let i=s.points[r.matchedPoints[1]];const l={xScale:r.xScale,scale01:r.scale01,scale10:r.scale10,yScale:r.yScale,dx:0,dy:0};i=mt([i],l)[0],l.dx=a.x-i.x,l.dy=a.y-i.y,o=mt(s.points,l)}t.points=t.points.concat(o)}}return gn(t.points)}function ti(e,t,n,r){const s=new ve.GlyphSet(r);for(let o=0;o<n.length-1;o+=1){const a=n[o],i=n[o+1];a!==i?s.push(o,ve.ttfGlyphLoader(r,o,ss,e,t+a,os)):s.push(o,ve.glyphLoader(r,o))}return s}function ni(e,t,n,r){const s=new ve.GlyphSet(r);return r._push=function(o){const a=n[o],i=n[o+1];a!==i?s.push(o,ve.ttfGlyphLoader(r,o,ss,e,t+a,os)):s.push(o,ve.glyphLoader(r,o))},s}function ri(e,t,n,r,s){return s.lowMemory?ni(e,t,n,r):ti(e,t,n,r)}var as={getPath:gn,parse:ri},si=class{constructor(e){this.font=e}normalizeCoordTags(e){for(const t in e)if(t.length<4){const n=t.padEnd(4," ");e[n]===void 0&&(e[n]=e[t]),delete e[t]}}getNormalizedCoords(e){e||(e=this.font.variation.get());let t=[];this.normalizeCoordTags(e);for(let n=0;n<this.fvar().axes.length;n++){const r=this.fvar().axes[n];let s=e[r.tag];s===void 0&&(s=r.defaultValue),s<r.defaultValue?t.push((s-r.defaultValue+Number.EPSILON)/(r.defaultValue-r.minValue+Number.EPSILON)):t.push((s-r.defaultValue+Number.EPSILON)/(r.maxValue-r.defaultValue+Number.EPSILON))}if(this.avar())for(let n=0;n<this.avar().axisSegmentMaps.length;n++){let r=this.avar().axisSegmentMaps[n];for(let s=0;s<r.axisValueMaps.length;s++){let o=r.axisValueMaps[s];if(s>=1&&t[n]<o.fromCoordinate){let a=r.axisValueMaps[s-1];t[n]=((t[n]-a.fromCoordinate)*(o.toCoordinate-a.toCoordinate)+Number.EPSILON)/(o.fromCoordinate-a.fromCoordinate+Number.EPSILON)+a.toCoordinate;break}}}return t}interpolatePoints(e,t,n){if(e.length===0)return;let r=0;for(;r<e.length;){let s=r,o=r,a=e[o];for(;!a.lastPointOfContour;)a=e[++o];for(;r<=o&&!n[r];)r++;if(r>o)continue;let i=r,l=r;for(r++;r<=o;)n[r]&&(this.deltaInterpolate(l+1,r-1,l,r,t,e),l=r),r++;l===i?this.deltaShift(s,o,l,t,e):(this.deltaInterpolate(l+1,o,l,i,t,e),i>0&&this.deltaInterpolate(s,i-1,l,i,t,e)),r=o+1}}deltaInterpolate(e,t,n,r,s,o){if(e>t)return;let a=["x","y"];for(let l=0;l<a.length;l++){let c=a[l];if(s[n][c]>s[r][c]){var i=n;n=r,r=i}let u=s[n][c],h=s[r][c],p=o[n][c],d=o[r][c];if(u!==h||p===d){let f=u===h?0:(d-p)/(h-u);for(let g=e;g<=t;g++){let y=s[g][c];y<=u?y+=p-u:y>=h?y+=d-h:y=p+(y-u)*f,o[g][c]=y}}}}deltaShift(e,t,n,r,s){let o=s[n].x-r[n].x,a=s[n].y-r[n].y;if(!(o===0&&a===0))for(let i=e;i<=t;i++)i!==n&&(s[i].x+=o,s[i].y+=a)}transformComponents(e,t,n,r,s,o){let a=0;for(let i=0;i<e.components.length;i++){const l=e.components[i],c=this.font.glyphs.get(l.glyphIndex),u=Va(l),h=r.indexOf(i);h>-1&&(u.dx+=Math.round(s.deltas[h]*o),u.dy+=Math.round(s.deltasY[h]*o));const p=mt(this.getTransform(c,n).points,u);t.splice(a,p.length,...p),a+=c.points.length}}applyTupleVariationStore(e,t,n,r="gvar",s={}){n||(n=this.font.variation.get());const o=this.getNormalizedCoords(n),{headers:a,sharedPoints:i}=e,l=this.fvar().axes.length;let c;r==="gvar"?c=t.map(Fn):r==="cvar"&&(c=[...t]);for(let u=0;u<a.length;u++){const h=a[u];let p=1;for(let f=0;f<l;f++){let g=[0];switch(r){case"gvar":g=h.peakTuple?h.peakTuple:this.gvar().sharedTuples[h.sharedTupleRecordsIndex];break;case"cvar":g=h.peakTuple;break}if(g[f]!==0){if(o[f]===0){p=0;break}if(h.intermediateStartTuple)if(o[f]<h.intermediateStartTuple[f]||o[f]>h.intermediateEndTuple[f]){p=0;break}else o[f]<g[f]?p=p*(o[f]-h.intermediateStartTuple[f]+Number.EPSILON)/(g[f]-h.intermediateStartTuple[f]+Number.EPSILON):p=p*(h.intermediateEndTuple[f]-o[f]+Number.EPSILON)/(h.intermediateEndTuple[f]-g[f]+Number.EPSILON);else{if(o[f]<Math.min(0,g[f])||o[f]>Math.max(0,g[f])){p=0;break}p=(p*o[f]+Number.EPSILON)/(g[f]+Number.EPSILON)}}}if(p===0)continue;const d=h.privatePoints.length?h.privatePoints:i;if(r==="gvar"&&s.glyph&&s.glyph.isComposite)this.transformComponents(s.glyph,c,n,d,h,p);else if(d.length===0)for(let f=0;f<c.length;f++){const g=c[f];r==="gvar"?c[f]={x:Math.round(g.x+h.deltas[f]*p),y:Math.round(g.y+h.deltasY[f]*p),onCurve:g.onCurve,lastPointOfContour:g.lastPointOfContour}:r==="cvar"&&(c[f]=Math.round(g+h.deltas[f]*p))}else{let f;r==="gvar"?f=c.map(Fn):r==="cvar"&&(f=c);const g=Array(t.length).fill(!1);for(let y=0;y<d.length;y++){let T=d[y];if(T<t.length){let R=f[T];r==="gvar"?(g[T]=!0,R.x+=h.deltas[y]*p,R.y+=h.deltasY[y]*p):r==="cvar"&&(c[T]=Math.round(R+h.deltas[y]*p))}}if(r==="gvar"){this.interpolatePoints(f,c,g);for(let y=0;y<t.length;y++){let T=f[y].x-c[y].x,R=f[y].y-c[y].y;c[y].x=Math.round(c[y].x+T),c[y].y=Math.round(c[y].y+R)}}}}return c}getTransform(e,t){Number.isInteger(e)&&(e=this.font.glyphs.get(e));const n=e.getBlendPath,r=!!(e.points&&e.points.length);let s=e;if(n||r){if(t||(t=this.font.variation.get()),r){const o=this.gvar()&&this.gvar().glyphVariations[e.index];if(o){const a=e.points;let i=this.applyTupleVariationStore(o,a,t,"gvar",{glyph:e});s=new et(Object.assign({},e,{points:i,path:gn(i)}))}}else if(n){const o=e.getBlendPath(t);s=new et(Object.assign({},e,{path:o}))}}return this.font.tables.hvar&&(e._advanceWidth=typeof e._advanceWidth<"u"?e._advanceWidth:e.advanceWidth,e.advanceWidth=s.advanceWidth=Math.round(e._advanceWidth+this.getVariableAdjustment(s.index,"hvar","advanceWidth",t)),e._leftSideBearing=typeof e._leftSideBearing<"u"?e._leftSideBearing:e.leftSideBearing,e.leftSideBearing=s.leftSideBearing=Math.round(e._leftSideBearing+this.getVariableAdjustment(s.index,"hvar","lsb",t))),s}getCvarTransform(e){const t=this.font.tables.cvt,n=this.cvar();return!t||!t.length||!n||!n.headers.length?t:this.applyTupleVariationStore(n,t,e,"cvar")}getVariableAdjustment(e,t,n,r){r=r||this.font.variation.get();let s,o;const a=this.font.tables[t];if(!a)throw Error(`trying to get variation adjustment from non-existent table "${a}"`);if(!a.itemVariationStore)throw Error(`trying to get variation adjustment from table "${a}" which does not have an itemVariationStore`);const i=a[n]&&a[n].map.length;if(i){let l=e;l>=i&&(l=i-1),{outerIndex:s,innerIndex:o}=a[n].map[l]}else s=0,o=e;return this.getDelta(a.itemVariationStore,s,o,r)}getDelta(e,t,n,r){if(t>=e.itemVariationSubtables.length)return 0;let s=e.itemVariationSubtables[t];if(n>=s.deltaSets.length)return 0;let o=s.deltaSets[n],a=this.getBlendVector(e,t,r),i=0;for(let l=0;l<s.regionIndexes.length;l++)i+=o[l]*a[l];return i}getBlendVector(e,t,n){n||(n=this.font.variation.get());let r=e.itemVariationSubtables[t];const s=this.getNormalizedCoords(n);let o=[];for(let a=0;a<r.regionIndexes.length;a++){let i=1,l=r.regionIndexes[a],c=e.variationRegions[l].regionAxes;for(let u=0;u<c.length;u++){let h=c[u],p;h.startCoord>h.peakCoord||h.peakCoord>h.endCoord||h.startCoord<0&&h.endCoord>0&&h.peakCoord!==0||h.peakCoord===0?p=1:s[u]<h.startCoord||s[u]>h.endCoord?p=0:s[u]===h.peakCoord?p=1:s[u]<h.peakCoord?p=(s[u]-h.startCoord+Number.EPSILON)/(h.peakCoord-h.startCoord+Number.EPSILON):p=(h.endCoord-s[u]+Number.EPSILON)/(h.endCoord-h.peakCoord+Number.EPSILON),i*=p}o[a]=i}return o}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},oi=class{constructor(e){this.font=e,this.process=new si(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){const e=this.getDefaultInstanceIndex();e>-1?this.set(e):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((e,t)=>(e[t.tag]=t.defaultValue,e),{})}getDefaultInstanceIndex(){const e=this.getDefaultCoordinates();let t=this.getInstanceIndex(e);return t<0&&(t=this.fvar().instances.findIndex(n=>n.name&&n.name.en==="Regular")),t}getInstanceIndex(e){return this.fvar().instances.findIndex(t=>Object.keys(e).every(n=>t.coordinates[n]===e[n]))}getInstance(e){return this.fvar().instances&&this.fvar().instances[e]}set(e){let t;if(Number.isInteger(e)){const n=this.getInstance(e);if(!n)throw Error(`Invalid instance index ${e}`);t={...n.coordinates}}else t=e,this.process.normalizeCoordTags(t);t=Object.assign({},this.font.defaultRenderOptions.variation,t),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:t})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},is,Ae,ls,en;function us(e){this.font=e,this.getCommands=function(t){return as.getPath(t).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function ai(e){return e}function cs(e){return Math.sign(e)*Math.round(Math.abs(e))}function ii(e){return Math.sign(e)*Math.round(Math.abs(e*2))/2}function li(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function ui(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function ci(e){return Math.sign(e)*Math.floor(Math.abs(e))}var ps=function(e){const t=this.srPeriod;let n=this.srPhase;const r=this.srThreshold;let s=1;return e<0&&(e=-e,s=-1),e+=r-n,e=Math.trunc(e/t)*t,e+=n,e<0?n*s:e*s},ye={x:1,y:0,axis:"x",distance:function(e,t,n,r){return(n?e.xo:e.x)-(r?t.xo:t.x)},interpolate:function(e,t,n,r){let s,o,a,i,l,c,u;if(!r||r===this){if(s=e.xo-t.xo,o=e.xo-n.xo,l=t.x-t.xo,c=n.x-n.xo,a=Math.abs(s),i=Math.abs(o),u=a+i,u===0){e.x=e.xo+(l+c)/2;return}e.x=e.xo+(l*i+c*a)/u;return}if(s=r.distance(e,t,!0,!0),o=r.distance(e,n,!0,!0),l=r.distance(t,t,!1,!0),c=r.distance(n,n,!1,!0),a=Math.abs(s),i=Math.abs(o),u=a+i,u===0){ye.setRelative(e,e,(l+c)/2,r,!0);return}ye.setRelative(e,e,(l*i+c*a)/u,r,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,n,r,s){if(!r||r===this){e.x=(s?t.xo:t.x)+n;return}const o=s?t.xo:t.x,a=s?t.yo:t.y,i=o+n*r.x,l=a+n*r.y;e.x=i+(e.y-l)/r.normalSlope},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},Te={x:0,y:1,axis:"y",distance:function(e,t,n,r){return(n?e.yo:e.y)-(r?t.yo:t.y)},interpolate:function(e,t,n,r){let s,o,a,i,l,c,u;if(!r||r===this){if(s=e.yo-t.yo,o=e.yo-n.yo,l=t.y-t.yo,c=n.y-n.yo,a=Math.abs(s),i=Math.abs(o),u=a+i,u===0){e.y=e.yo+(l+c)/2;return}e.y=e.yo+(l*i+c*a)/u;return}if(s=r.distance(e,t,!0,!0),o=r.distance(e,n,!0,!0),l=r.distance(t,t,!1,!0),c=r.distance(n,n,!1,!0),a=Math.abs(s),i=Math.abs(o),u=a+i,u===0){Te.setRelative(e,e,(l+c)/2,r,!0);return}Te.setRelative(e,e,(l*i+c*a)/u,r,!0)},normalSlope:0,setRelative:function(e,t,n,r,s){if(!r||r===this){e.y=(s?t.yo:t.y)+n;return}const o=s?t.xo:t.x,a=s?t.yo:t.y,i=o+n*r.x,l=a+n*r.y;e.y=l+r.normalSlope*(e.x-i)},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};Object.freeze(ye);Object.freeze(Te);function ot(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}ot.prototype.distance=function(e,t,n,r){return this.x*ye.distance(e,t,n,r)+this.y*Te.distance(e,t,n,r)};ot.prototype.interpolate=function(e,t,n,r){let s,o,a,i,l,c,u;if(a=r.distance(e,t,!0,!0),i=r.distance(e,n,!0,!0),s=r.distance(t,t,!1,!0),o=r.distance(n,n,!1,!0),l=Math.abs(a),c=Math.abs(i),u=l+c,u===0){this.setRelative(e,e,(s+o)/2,r,!0);return}this.setRelative(e,e,(s*c+o*l)/u,r,!0)};ot.prototype.setRelative=function(e,t,n,r,s){r=r||this;const o=s?t.xo:t.x,a=s?t.yo:t.y,i=o+n*r.x,l=a+n*r.y,c=r.normalSlope,u=this.slope,h=e.x,p=e.y;e.x=(u*h-c*i+l-p)/(u-c),e.y=u*(e.x-h)+p};ot.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0};function at(e,t){const n=Math.sqrt(e*e+t*t);return e/=n,t/=n,e===1&&t===0?ye:e===0&&t===1?Te:new ot(e,t)}function ke(e,t,n,r){this.x=this.xo=Math.round(e*64)/64,this.y=this.yo=Math.round(t*64)/64,this.lastPointOfContour=n,this.onCurve=r,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}ke.prototype.nextTouched=function(e){let t=this.nextPointOnContour;for(;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t};ke.prototype.prevTouched=function(e){let t=this.prevPointOnContour;for(;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var tt=Object.freeze(new ke(0,0)),pi={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function we(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=ye,this.round=cs}}us.prototype.exec=function(e,t){if(typeof t!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;const n=this.font;let r=this._prepState;if(!r||r.ppem!==t){let s=this._fpgmState;if(!s){we.prototype=pi,s=this._fpgmState=new we("fpgm",n.tables.fpgm),s.funcs=[],s.font=n;try{Ae(s)}catch(a){console.log("Hinting error in FPGM:"+a),this._errorState=3;return}}we.prototype=s,r=this._prepState=new we("prep",n.tables.prep),r.ppem=t;const o=n.variation&&n.variation.process.getCvarTransform()||n.tables.cvt;if(o){const a=r.cvt=new Array(o.length),i=t/n.unitsPerEm;for(let l=0;l<o.length;l++)a[l]=o[l]*i}else r.cvt=[];try{Ae(r)}catch(a){this._errorState<2&&console.log("Hinting error in PREP:"+a),this._errorState=2}}if(!(this._errorState>1))try{return ls(e,r)}catch(s){this._errorState<1&&(console.log("Hinting error:"+s),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}};ls=function(e,t){const n=t.ppem/t.font.unitsPerEm,r=n;let s=e.components,o,a,i;if(we.prototype=t,!s)i=new we("glyf",e.instructions),en(e,i,n,r),a=i.gZone;else{const l=t.font;a=[],o=[];for(let c=0;c<s.length;c++){const u=s[c],h=l.glyphs.get(u.glyphIndex);i=new we("glyf",h.instructions),en(h,i,n,r);const p=Math.round(u.dx*n),d=Math.round(u.dy*r),f=i.gZone,g=i.contours;for(let T=0;T<f.length;T++){const R=f[T];R.xTouched=R.yTouched=!1,R.xo=R.x=R.x+p,R.yo=R.y=R.y+d}const y=a.length;a.push.apply(a,f);for(let T=0;T<g.length;T++)o.push(g[T]+y)}e.instructions&&!i.inhibitGridFit&&(i=new we("glyf",e.instructions),i.gZone=i.z0=i.z1=i.z2=a,i.contours=o,a.push(new ke(0,0),new ke(Math.round(e.advanceWidth*n),0)),Ae(i),a.length-=2)}return a};en=function(e,t,n,r){const s=e.points||[],o=s.length,a=t.gZone=t.z0=t.z1=t.z2=[],i=t.contours=[];let l;for(let h=0;h<o;h++)l=s[h],a[h]=new ke(l.x*n,l.y*r,l.lastPointOfContour,l.onCurve);let c,u;for(let h=0;h<o;h++)l=a[h],c||(c=l,i.push(h)),l.lastPointOfContour?(l.nextPointOnContour=c,c.prevPointOnContour=l,c=void 0):(u=a[h+1],l.nextPointOnContour=u,u.prevPointOnContour=l);t.inhibitGridFit||(a.push(new ke(0,0),new ke(Math.round(e.advanceWidth*n),0)),Ae(t),a.length-=2)};Ae=function(e){let t=e.prog;if(!t)return;const n=t.length;let r;for(e.ip=0;e.ip<n;e.ip++){if(r=is[t[e.ip]],!r)throw new Error("unknown instruction: 0x"+Number(t[e.ip]).toString(16));r(e)}};function Dt(e){const t=e.tZone=new Array(e.gZone.length);for(let n=0;n<t.length;n++)t[n]=new ke(0,0)}function hs(e,t){const n=e.prog;let r=e.ip,s=1,o;do if(o=n[++r],o===88)s++;else if(o===89)s--;else if(o===64)r+=n[r+1]+1;else if(o===65)r+=2*n[r+1]+1;else if(o>=176&&o<=183)r+=o-176+1;else if(o>=184&&o<=191)r+=(o-184+1)*2;else if(t&&s===1&&o===27)break;while(s>0);e.ip=r}function Bn(e,t){t.fv=t.pv=t.dpv=e}function Hn(e,t){t.pv=t.dpv=e}function _n(e,t){t.fv=e}function zn(e,t){const n=t.stack,r=n.pop(),s=n.pop(),o=t.z2[r],a=t.z1[s];let i,l;e?(i=o.y-a.y,l=a.x-o.x):(i=a.x-o.x,l=a.y-o.y),t.pv=t.dpv=at(i,l)}function Vn(e,t){const n=t.stack,r=n.pop(),s=n.pop(),o=t.z2[r],a=t.z1[s];let i,l;e?(i=o.y-a.y,l=a.x-o.x):(i=a.x-o.x,l=a.y-o.y),t.fv=at(i,l)}function hi(e){const t=e.stack,n=t.pop(),r=t.pop();e.pv=e.dpv=at(r,n)}function fi(e){const t=e.stack,n=t.pop(),r=t.pop();e.fv=at(r,n)}function di(e){const t=e.stack,n=e.pv;t.push(n.x*16384),t.push(n.y*16384)}function gi(e){const t=e.stack,n=e.fv;t.push(n.x*16384),t.push(n.y*16384)}function mi(e){e.fv=e.pv}function yi(e){const t=e.stack,n=t.pop(),r=t.pop(),s=t.pop(),o=t.pop(),a=t.pop(),i=e.z0,l=e.z1,c=i[n],u=i[r],h=l[s],p=l[o],d=e.z2[a],f=c.x,g=c.y,y=u.x,T=u.y,R=h.x,I=h.y,C=p.x,P=p.y,G=(f-y)*(I-P)-(g-T)*(R-C),A=f*T-g*y,$=R*P-I*C;d.x=(A*(R-C)-$*(f-y))/G,d.y=(A*(I-P)-$*(g-T))/G}function vi(e){e.rp0=e.stack.pop()}function bi(e){e.rp1=e.stack.pop()}function Si(e){e.rp2=e.stack.pop()}function xi(e){const t=e.stack.pop();switch(e.zp0=t,t){case 0:e.tZone||Dt(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ti(e){const t=e.stack.pop();switch(e.zp1=t,t){case 0:e.tZone||Dt(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function ki(e){const t=e.stack.pop();switch(e.zp2=t,t){case 0:e.tZone||Dt(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Oi(e){const t=e.stack.pop();switch(e.zp0=e.zp1=e.zp2=t,t){case 0:e.tZone||Dt(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ri(e){e.loop=e.stack.pop()}function Ui(e){e.round=cs}function Ii(e){e.round=li}function wi(e){const t=e.stack.pop();e.minDis=t/64}function Li(e){hs(e,!1)}function Ci(e){const t=e.stack.pop();e.ip+=t-1}function Ei(e){const t=e.stack.pop();e.cvCutIn=t/64}function Di(e){const t=e.stack;t.push(t[t.length-1])}function Bt(e){e.stack.pop()}function Mi(e){e.stack.length=0}function Ai(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(n),t.push(r)}function Ni(e){const t=e.stack;t.push(t.length)}function Pi(e){const t=e.stack,n=t.pop(),r=t.pop(),s=e.ip,o=e.prog;e.prog=e.funcs[n];for(let a=0;a<r;a++)Ae(e);e.ip=s,e.prog=o}function Fi(e){const t=e.stack.pop(),n=e.ip,r=e.prog;e.prog=e.funcs[t],Ae(e),e.ip=n,e.prog=r}function Gi(e){const t=e.stack,n=t.pop();t.push(t[t.length-n])}function Bi(e){const t=e.stack,n=t.pop();t.push(t.splice(t.length-n,1)[0])}function Hi(e){if(e.env!=="fpgm")throw new Error("FDEF not allowed here");const t=e.stack,n=e.prog;let r=e.ip;const s=t.pop(),o=r;for(;n[++r]!==45;);e.ip=r,e.funcs[s]=n.slice(o+1,r)}function qn(e,t){const n=t.stack.pop(),r=t.z0[n],s=t.fv,o=t.pv;let a=o.distance(r,tt);e&&(a=t.round(a)),s.setRelative(r,tt,a,o),s.touch(r),t.rp0=t.rp1=n}function Wn(e,t){const n=t.z2,r=n.length-2;let s,o,a;for(let i=0;i<r;i++)s=n[i],!e.touched(s)&&(o=s.prevTouched(e),o!==s&&(a=s.nextTouched(e),o===a&&e.setRelative(s,s,e.distance(o,o,!1,!0),e,!0),e.interpolate(s,o,a,e)))}function jn(e,t){const n=t.stack,r=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[r],o=t.fv,a=t.pv;let i=t.loop;const l=t.z2;for(;i--;){const c=n.pop(),u=l[c],h=a.distance(s,s,!1,!0);o.setRelative(u,u,h,a),o.touch(u)}t.loop=1}function $n(e,t){const n=t.stack,r=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[r],o=t.fv,a=t.pv,i=n.pop(),l=t.z2[t.contours[i]];let c=l;const u=a.distance(s,s,!1,!0);do c!==s&&o.setRelative(c,c,u,a),c=c.nextPointOnContour;while(c!==l)}function Yn(e,t){const n=t.stack,r=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[r],o=t.fv,a=t.pv,i=n.pop();let l;switch(i){case 0:l=t.tZone;break;case 1:l=t.gZone;break;default:throw new Error("Invalid zone")}let c;const u=a.distance(s,s,!1,!0),h=l.length-2;for(let p=0;p<h;p++)c=l[p],o.setRelative(c,c,u,a)}function _i(e){const t=e.stack;let n=e.loop;const r=e.fv,s=t.pop()/64,o=e.z2;for(;n--;){const a=t.pop(),i=o[a];r.setRelative(i,i,s),r.touch(i)}e.loop=1}function zi(e){const t=e.stack,n=e.rp1,r=e.rp2;let s=e.loop;const o=e.z0[n],a=e.z1[r],i=e.fv,l=e.dpv,c=e.z2;for(;s--;){const u=t.pop(),h=c[u];i.interpolate(h,o,a,l),i.touch(h)}e.loop=1}function Xn(e,t){const n=t.stack,r=n.pop()/64,s=n.pop(),o=t.z1[s],a=t.z0[t.rp0],i=t.fv,l=t.pv;i.setRelative(o,a,r,l),i.touch(o),t.rp1=t.rp0,t.rp2=s,e&&(t.rp0=s)}function Vi(e){const t=e.stack,n=e.rp0,r=e.z0[n];let s=e.loop;const o=e.fv,a=e.pv,i=e.z1;for(;s--;){const l=t.pop(),c=i[l];o.setRelative(c,r,0,a),o.touch(c)}e.loop=1}function qi(e){e.round=ii}function Zn(e,t){const n=t.stack,r=n.pop(),s=n.pop(),o=t.z0[s],a=t.fv,i=t.pv;let l=t.cvt[r],c=i.distance(o,tt);e&&(Math.abs(c-l)<t.cvCutIn&&(c=l),c=t.round(c)),a.setRelative(o,tt,c,i),t.zp0===0&&(o.xo=o.x,o.yo=o.y),a.touch(o),t.rp0=t.rp1=s}function Wi(e){const t=e.prog;let n=e.ip;const r=e.stack,s=t[++n];for(let o=0;o<s;o++)r.push(t[++n]);e.ip=n}function ji(e){let t=e.ip;const n=e.prog,r=e.stack,s=n[++t];for(let o=0;o<s;o++){let a=n[++t]<<8|n[++t];a&32768&&(a=-((a^65535)+1)),r.push(a)}e.ip=t}function $i(e){const t=e.stack;let n=e.store;n||(n=e.store=[]);const r=t.pop(),s=t.pop();n[s]=r}function Yi(e){const t=e.stack,n=e.store,r=t.pop(),s=n&&n[r]||0;t.push(s)}function Xi(e){const t=e.stack,n=t.pop(),r=t.pop();e.cvt[r]=n/64}function Zi(e){const t=e.stack,n=t.pop();t.push(e.cvt[n]*64)}function Kn(e,t){const n=t.stack,r=n.pop(),s=t.z2[r];n.push(t.dpv.distance(s,tt,e,!1)*64)}function Qn(e,t){const n=t.stack,r=n.pop(),s=n.pop(),o=t.z1[r],a=t.z0[s],i=t.dpv.distance(a,o,e,e);t.stack.push(Math.round(i*64))}function Ki(e){e.stack.push(e.ppem)}function Qi(e){e.autoFlip=!0}function Ji(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r<n?1:0)}function el(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r<=n?1:0)}function tl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r>n?1:0)}function nl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r>=n?1:0)}function rl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(n===r?1:0)}function sl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(n!==r?1:0)}function ol(e){const t=e.stack,n=t.pop();t.push(Math.trunc(n)&1?1:0)}function al(e){const t=e.stack,n=t.pop();t.push(Math.trunc(n)&1?0:1)}function il(e){e.stack.pop()||hs(e,!0)}function ll(e){}function ul(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(n&&r?1:0)}function cl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(n||r?1:0)}function pl(e){const t=e.stack,n=t.pop();t.push(n?0:1)}function Ht(e,t){const n=t.stack,r=n.pop(),s=t.fv,o=t.pv,a=t.ppem,i=t.deltaBase+(e-1)*16,l=t.deltaShift,c=t.z0;for(let u=0;u<r;u++){const h=n.pop(),p=n.pop();if(i+((p&240)>>4)!==a)continue;let d=(p&15)-8;d>=0&&d++;const f=c[h];s.setRelative(f,f,d*l,o)}}function hl(e){const t=e.stack.pop();e.deltaBase=t}function fl(e){const t=e.stack.pop();e.deltaShift=Math.pow(.5,t)}function dl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r+n)}function gl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r-n)}function ml(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r*64/n)}function yl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(r*n/64)}function vl(e){const t=e.stack,n=t.pop();t.push(Math.abs(n))}function bl(e){const t=e.stack;let n=t.pop();t.push(-n)}function Sl(e){const t=e.stack,n=t.pop();t.push(Math.floor(n/64)*64)}function xl(e){const t=e.stack,n=t.pop();t.push(Math.ceil(n/64)*64)}function dt(e,t){const n=t.stack,r=n.pop();n.push(t.round(r/64)*64)}function Tl(e){const t=e.stack,n=t.pop(),r=t.pop();e.cvt[r]=n*e.ppem/e.font.unitsPerEm}function _t(e,t){const n=t.stack,r=n.pop(),s=t.ppem,o=t.deltaBase+(e-1)*16,a=t.deltaShift;for(let i=0;i<r;i++){const l=n.pop(),c=n.pop();if(o+((c&240)>>4)!==s)continue;let u=(c&15)-8;u>=0&&u++;const h=u*a;t.cvt[l]+=h}}function kl(e){let t=e.stack.pop();e.round=ps;let n;switch(t&192){case 0:n=.5;break;case 64:n=1;break;case 128:n=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=n,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid SROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*n}function Ol(e){let t=e.stack.pop();e.round=ps;let n;switch(t&192){case 0:n=Math.sqrt(2)/2;break;case 64:n=Math.sqrt(2);break;case 128:n=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=n,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid S45ROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*n}function Rl(e){e.round=ai}function Ul(e){e.round=ui}function Il(e){e.round=ci}function wl(e){e.stack.pop()}function Jn(e,t){const n=t.stack,r=n.pop(),s=n.pop(),o=t.z2[r],a=t.z1[s];let i,l;e?(i=o.y-a.y,l=a.x-o.x):(i=a.x-o.x,l=a.y-o.y),t.dpv=at(i,l)}function Ll(e){const t=e.stack,n=t.pop();let r=0;n&1&&(r=35),n&32&&(r|=4096),t.push(r)}function Cl(e){const t=e.stack,n=t.pop(),r=t.pop(),s=t.pop();t.push(r),t.push(n),t.push(s)}function El(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(Math.max(r,n))}function Dl(e){const t=e.stack,n=t.pop(),r=t.pop();t.push(Math.min(r,n))}function Ml(e){e.stack.pop()}function Al(e){const t=e.stack.pop();let n=e.stack.pop();switch(t){case 1:e.inhibitGridFit=!!n;return;case 2:e.ignoreCvt=!!n;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Re(e,t){const n=t.stack,r=t.prog;let s=t.ip;for(let o=0;o<e;o++)n.push(r[++s]);t.ip=s}function Ue(e,t){let n=t.ip;const r=t.prog,s=t.stack;for(let o=0;o<e;o++){let a=r[++n]<<8|r[++n];a&32768&&(a=-((a^65535)+1)),s.push(a)}t.ip=n}function k(e,t,n,r,s,o){const a=o.stack,i=e&&a.pop(),l=a.pop(),c=o.rp0,u=o.z0[c],h=o.z1[l],p=o.minDis,d=o.fv,f=o.dpv;let g,y,T;g=f.distance(h,u,!0,!0),y=g>=0?1:-1,g=Math.abs(g),e&&(T=o.cvt[i],r&&Math.abs(g-T)<o.cvCutIn&&(g=T)),n&&g<p&&(g=p),r&&(g=o.round(g)),d.setRelative(h,u,y*g,f),d.touch(h),o.rp1=o.rp0,o.rp2=l,t&&(o.rp0=l)}is=[Bn.bind(void 0,Te),Bn.bind(void 0,ye),Hn.bind(void 0,Te),Hn.bind(void 0,ye),_n.bind(void 0,Te),_n.bind(void 0,ye),zn.bind(void 0,0),zn.bind(void 0,1),Vn.bind(void 0,0),Vn.bind(void 0,1),hi,fi,di,gi,mi,yi,vi,bi,Si,xi,Ti,ki,Oi,Ri,Ui,Ii,wi,Li,Ci,Ei,void 0,void 0,Di,Bt,Mi,Ai,Ni,Gi,Bi,void 0,void 0,void 0,Pi,Fi,Hi,void 0,qn.bind(void 0,0),qn.bind(void 0,1),Wn.bind(void 0,Te),Wn.bind(void 0,ye),jn.bind(void 0,0),jn.bind(void 0,1),$n.bind(void 0,0),$n.bind(void 0,1),Yn.bind(void 0,0),Yn.bind(void 0,1),_i,zi,Xn.bind(void 0,0),Xn.bind(void 0,1),Vi,qi,Zn.bind(void 0,0),Zn.bind(void 0,1),Wi,ji,$i,Yi,Xi,Zi,Kn.bind(void 0,0),Kn.bind(void 0,1),void 0,Qn.bind(void 0,0),Qn.bind(void 0,1),Ki,void 0,Qi,void 0,void 0,Ji,el,tl,nl,rl,sl,ol,al,il,ll,ul,cl,pl,Ht.bind(void 0,1),hl,fl,dl,gl,ml,yl,vl,bl,Sl,xl,dt.bind(void 0,0),dt.bind(void 0,1),dt.bind(void 0,2),dt.bind(void 0,3),void 0,void 0,void 0,void 0,Tl,Ht.bind(void 0,2),Ht.bind(void 0,3),_t.bind(void 0,1),_t.bind(void 0,2),_t.bind(void 0,3),kl,Ol,void 0,void 0,Rl,void 0,Ul,Il,Bt,Bt,void 0,void 0,void 0,void 0,void 0,wl,Jn.bind(void 0,0),Jn.bind(void 0,1),Ll,void 0,Cl,El,Dl,Ml,Al,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Re.bind(void 0,1),Re.bind(void 0,2),Re.bind(void 0,3),Re.bind(void 0,4),Re.bind(void 0,5),Re.bind(void 0,6),Re.bind(void 0,7),Re.bind(void 0,8),Ue.bind(void 0,1),Ue.bind(void 0,2),Ue.bind(void 0,3),Ue.bind(void 0,4),Ue.bind(void 0,5),Ue.bind(void 0,6),Ue.bind(void 0,7),Ue.bind(void 0,8),k.bind(void 0,0,0,0,0,0),k.bind(void 0,0,0,0,0,1),k.bind(void 0,0,0,0,0,2),k.bind(void 0,0,0,0,0,3),k.bind(void 0,0,0,0,1,0),k.bind(void 0,0,0,0,1,1),k.bind(void 0,0,0,0,1,2),k.bind(void 0,0,0,0,1,3),k.bind(void 0,0,0,1,0,0),k.bind(void 0,0,0,1,0,1),k.bind(void 0,0,0,1,0,2),k.bind(void 0,0,0,1,0,3),k.bind(void 0,0,0,1,1,0),k.bind(void 0,0,0,1,1,1),k.bind(void 0,0,0,1,1,2),k.bind(void 0,0,0,1,1,3),k.bind(void 0,0,1,0,0,0),k.bind(void 0,0,1,0,0,1),k.bind(void 0,0,1,0,0,2),k.bind(void 0,0,1,0,0,3),k.bind(void 0,0,1,0,1,0),k.bind(void 0,0,1,0,1,1),k.bind(void 0,0,1,0,1,2),k.bind(void 0,0,1,0,1,3),k.bind(void 0,0,1,1,0,0),k.bind(void 0,0,1,1,0,1),k.bind(void 0,0,1,1,0,2),k.bind(void 0,0,1,1,0,3),k.bind(void 0,0,1,1,1,0),k.bind(void 0,0,1,1,1,1),k.bind(void 0,0,1,1,1,2),k.bind(void 0,0,1,1,1,3),k.bind(void 0,1,0,0,0,0),k.bind(void 0,1,0,0,0,1),k.bind(void 0,1,0,0,0,2),k.bind(void 0,1,0,0,0,3),k.bind(void 0,1,0,0,1,0),k.bind(void 0,1,0,0,1,1),k.bind(void 0,1,0,0,1,2),k.bind(void 0,1,0,0,1,3),k.bind(void 0,1,0,1,0,0),k.bind(void 0,1,0,1,0,1),k.bind(void 0,1,0,1,0,2),k.bind(void 0,1,0,1,0,3),k.bind(void 0,1,0,1,1,0),k.bind(void 0,1,0,1,1,1),k.bind(void 0,1,0,1,1,2),k.bind(void 0,1,0,1,1,3),k.bind(void 0,1,1,0,0,0),k.bind(void 0,1,1,0,0,1),k.bind(void 0,1,1,0,0,2),k.bind(void 0,1,1,0,0,3),k.bind(void 0,1,1,0,1,0),k.bind(void 0,1,1,0,1,1),k.bind(void 0,1,1,0,1,2),k.bind(void 0,1,1,0,1,3),k.bind(void 0,1,1,1,0,0),k.bind(void 0,1,1,1,0,1),k.bind(void 0,1,1,1,0,2),k.bind(void 0,1,1,1,0,3),k.bind(void 0,1,1,1,1,0),k.bind(void 0,1,1,1,1,1),k.bind(void 0,1,1,1,1,2),k.bind(void 0,1,1,1,1,3)];var Nl=us;function Ze(e){this.char=e,this.state={},this.activeState=null}function mn(e,t,n){this.contextName=n,this.startIndex=e,this.endOffset=t}function Pl(e,t,n){this.contextName=e,this.openRange=null,this.ranges=[],this.checkStart=t,this.checkEnd=n}function Z(e,t){this.context=e,this.index=t,this.length=e.length,this.current=e[t],this.backtrack=e.slice(0,t),this.lookahead=e.slice(t+1)}function Mt(e){this.eventId=e,this.subscribers=[]}function Fl(e){const t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let r=0;r<t.length;r++){const s=t[r];Object.defineProperty(this.events,s,{value:new Mt(s)})}if(e)for(let r=0;r<t.length;r++){const s=t[r],o=e[s];typeof o=="function"&&this.events[s].subscribe(o)}const n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let r=0;r<n.length;r++){const s=n[r];this.events[s].subscribe(this.updateContextsRanges)}}function H(e){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Fl.call(this,e)}Ze.prototype.setState=function(e,t){return this.state[e]=t,this.activeState={key:e,value:this.state[e]},this.activeState};Ze.prototype.getState=function(e){return this.state[e]||null};H.prototype.inboundIndex=function(e){return e>=0&&e<this.tokens.length};H.prototype.composeRUD=function(e){const t=e.map(r=>this[r[0]].apply(this,r.slice(1).concat(!0))),n=r=>typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,"FAIL");if(t.every(n))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:t.filter(n)};this.dispatch("composeRUD",[t.filter(r=>!n(r))])};H.prototype.replaceRange=function(e,t,n,r){t=t!==null?t:this.tokens.length;const s=n.every(o=>o instanceof Ze);if(!isNaN(e)&&this.inboundIndex(e)&&s){const o=this.tokens.splice.apply(this.tokens,[e,t].concat(n));return r||this.dispatch("replaceToken",[e,t,n]),[o,n]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}};H.prototype.replaceToken=function(e,t,n){if(!isNaN(e)&&this.inboundIndex(e)&&t instanceof Ze){const r=this.tokens.splice(e,1,t);return n||this.dispatch("replaceToken",[e,t]),[r[0],t]}else return{FAIL:"replaceToken: invalid token or index."}};H.prototype.removeRange=function(e,t,n){t=isNaN(t)?this.tokens.length:t;const r=this.tokens.splice(e,t);return n||this.dispatch("removeRange",[r,e,t]),r};H.prototype.removeToken=function(e,t){if(!isNaN(e)&&this.inboundIndex(e)){const n=this.tokens.splice(e,1);return t||this.dispatch("removeToken",[n,e]),n}else return{FAIL:"removeToken: invalid token index."}};H.prototype.insertToken=function(e,t,n){return e.every(r=>r instanceof Ze)?(this.tokens.splice.apply(this.tokens,[t,0].concat(e)),n||this.dispatch("insertToken",[e,t]),e):{FAIL:"insertToken: invalid token(s)."}};H.prototype.registerModifier=function(e,t,n){this.events.newToken.subscribe(function(r,s){const o=[r,s],a=t===null||t.apply(this,o)===!0,i=[r,s];if(a){let l=n.apply(this,i);r.setState(e,l)}}),this.registeredModifiers.push(e)};Mt.prototype.subscribe=function(e){return typeof e=="function"?this.subscribers.push(e)-1:{FAIL:`invalid '${this.eventId}' event handler`}};Mt.prototype.unsubscribe=function(e){this.subscribers.splice(e,1)};Z.prototype.setCurrentIndex=function(e){this.index=e,this.current=this.context[e],this.backtrack=this.context.slice(0,e),this.lookahead=this.context.slice(e+1)};Z.prototype.get=function(e){switch(!0){case e===0:return this.current;case(e<0&&Math.abs(e)<=this.backtrack.length):return this.backtrack.slice(e)[0];case(e>0&&e<=this.lookahead.length):return this.lookahead[e-1];default:return null}};H.prototype.rangeToText=function(e){if(e instanceof mn)return this.getRangeTokens(e).map(t=>t.char).join("")};H.prototype.getText=function(){return this.tokens.map(e=>e.char).join("")};H.prototype.getContext=function(e){return this.registeredContexts[e]||null};H.prototype.on=function(e,t){const n=this.events[e];return n?n.subscribe(t):null};H.prototype.dispatch=function(e,t){const n=this.events[e];if(n instanceof Mt)for(let r=0;r<n.subscribers.length;r++)n.subscribers[r].apply(this,t||[])};H.prototype.registerContextChecker=function(e,t,n){if(this.getContext(e))return{FAIL:`context name '${e}' is already registered.`};if(typeof t!="function")return{FAIL:"missing context start check."};if(typeof n!="function")return{FAIL:"missing context end check."};const r=new Pl(e,t,n);return this.registeredContexts[e]=r,this.contextCheckers.push(r),r};H.prototype.getRangeTokens=function(e){const t=e.startIndex+e.endOffset;return[].concat(this.tokens.slice(e.startIndex,t))};H.prototype.getContextRanges=function(e){const t=this.getContext(e);return t?t.ranges:{FAIL:`context checker '${e}' is not registered.`}};H.prototype.resetContextsRanges=function(){const e=this.registeredContexts;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];n.ranges=[]}};H.prototype.updateContextsRanges=function(){this.resetContextsRanges();const e=this.tokens.map(t=>t.char);for(let t=0;t<e.length;t++){const n=new Z(e,t);this.runContextCheck(n)}this.dispatch("updateContextsRanges",[this.registeredContexts])};H.prototype.setEndOffset=function(e,t){const n=this.getContext(t).openRange.startIndex;let r=new mn(n,e,t);const s=this.getContext(t).ranges;return r.rangeId=`${t}.${s.length}`,s.push(r),this.getContext(t).openRange=null,r};H.prototype.runContextCheck=function(e){const t=e.index;for(let n=0;n<this.contextCheckers.length;n++){const r=this.contextCheckers[n];let s=r.contextName,o=this.getContext(s).openRange;if(!o&&r.checkStart(e)&&(o=new mn(t,null,s),this.getContext(s).openRange=o,this.dispatch("contextStart",[s,t])),o&&r.checkEnd(e)){const a=t-o.startIndex+1,i=this.setEndOffset(a,s);this.dispatch("contextEnd",[s,i])}}};H.prototype.tokenize=function(e){this.tokens=[],this.resetContextsRanges();let t=Array.from(e);this.dispatch("start");for(let n=0;n<t.length;n++){const r=t[n],s=new Z(t,n);this.dispatch("next",[s]),this.runContextCheck(s);let o=new Ze(r);this.tokens.push(o),this.dispatch("newToken",[o,s])}return this.dispatch("end",[this.tokens]),this.tokens};var Gl=H;function Le(e){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(e)}function fs(e){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(e)}function Ce(e){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(e)}function yt(e){return/[\u0E00-\u0E7F]/.test(e)}function vt(e){return/[A-z]/.test(e)}function Bl(e){return/\s/.test(e)}function se(e){this.font=e,this.features={}}function Ie(e){this.id=e.id,this.tag=e.tag,this.substitution=e.substitution}function Oe(e,t){if(!e)return-1;switch(t.format){case 1:return t.glyphs.indexOf(e);case 2:{let n=t.ranges;for(let r=0;r<n.length;r++){const s=n[r];if(e>=s.start&&e<=s.end){let o=e-s.start;return s.index+o}}break}default:return-1}return-1}function Hl(e,t){return Oe(e,t.coverage)===-1?null:e+t.deltaGlyphId}function _l(e,t){let n=Oe(e,t.coverage);return n===-1?null:t.substitute[n]}function zt(e,t){let n=[];for(let r=0;r<e.length;r++){const s=e[r];let o=t.current;o=Array.isArray(o)?o[0]:o;const a=Oe(o,s);a!==-1&&n.push(a)}return n.length!==e.length?-1:n}function zl(e,t){const n=t.inputCoverage.length+t.lookaheadCoverage.length+t.backtrackCoverage.length;if(e.context.length<n)return[];let r=zt(t.inputCoverage,e);if(r===-1)return[];const s=t.inputCoverage.length-1;if(e.lookahead.length<t.lookaheadCoverage.length)return[];let o=e.lookahead.slice(s);for(;o.length&&Ce(o[0].char);)o.shift();const a=new Z(o,0);let i=zt(t.lookaheadCoverage,a),l=[].concat(e.backtrack);for(l.reverse();l.length&&Ce(l[0].char);)l.shift();if(l.length<t.backtrackCoverage.length)return[];const c=new Z(l,0);let u=zt(t.backtrackCoverage,c);const h=r.length===t.inputCoverage.length&&i.length===t.lookaheadCoverage.length&&u.length===t.backtrackCoverage.length;let p=[];if(h)for(let d=0;d<t.lookupRecords.length;d++){const f=t.lookupRecords[d].lookupListIndex,g=this.getLookupByIndex(f);for(let y=0;y<g.subtables.length;y++){let T=g.subtables[y],R,I=this.getSubstitutionType(g,T);if(I==="71"?(I=this.getSubstitutionType(T,T.extension),R=this.getLookupMethod(T,T.extension),T=T.extension):R=this.getLookupMethod(g,T),I==="12")for(let C=0;C<r.length;C++){const P=e.get(C),G=R(P);G&&p.push(G)}else throw new Error(`Substitution type ${I} is not supported in chaining substitution`)}}return p}function Vl(e,t){let n=e.current,r=Oe(n,t.coverage);if(r===-1)return null;let s,o=t.ligatureSets[r];for(let a=0;a<o.length;a++){s=o[a];for(let i=0;i<s.components.length;i++){const l=e.lookahead[i],c=s.components[i];if(l!==c)break;if(i===s.components.length-1)return s}}return null}function ql(e,t){let n=e.current;if(Oe(n,t.coverage)===-1)return null;for(const r of t.ruleSets)for(const s of r){let o=!0;for(let a=0;a<s.input.length;a++)if(e.lookahead[a]!==s.input[a]){o=!1;break}if(o){let a=[];a.push(n);for(let l=0;l<s.input.length;l++)a.push(s.input[l]);const i=(l,c)=>{const{lookupListIndex:u,sequenceIndex:h}=c,{subtables:p}=this.getLookupByIndex(u);for(const d of p)Oe(l[h],d.coverage)!==-1&&(l[h]=d.deltaGlyphId)};for(let l=0;l<s.lookupRecords.length;l++){const c=s.lookupRecords[l];i(a,c)}return a}}return null}function Wl(e,t){let n=[];for(let r=0;r<t.coverages.length;r++){const s=t.lookupRecords[r],o=t.coverages[r];let a=e.context[e.index+s.sequenceIndex];if(Oe(a,o)===-1)return null;let i=this.font.tables.gsub.lookups[s.lookupListIndex];for(let l=0;l<i.subtables.length;l++){let c=i.subtables[l],u=Oe(a,c.coverage);if(u===-1)return null;switch(i.lookupType){case 1:{let h=c.substitute[u];n.push(h);break}case 2:{let h=c.sequences[u];n.push(h);break}}}}return n}function jl(e,t){let n=Oe(e,t.coverage);return n===-1?null:t.sequences[n]}se.prototype.getDefaultScriptFeaturesIndexes=function(){const e=this.font.tables.gsub.scripts;for(let t=0;t<e.length;t++){const n=e[t];if(n.tag==="DFLT")return n.script.defaultLangSys.featureIndexes}return[]};se.prototype.getScriptFeaturesIndexes=function(e){if(!this.font.tables.gsub)return[];if(!e)return this.getDefaultScriptFeaturesIndexes();const t=this.font.tables.gsub.scripts;for(let n=0;n<t.length;n++){const r=t[n];if(r.tag===e&&r.script.defaultLangSys)return r.script.defaultLangSys.featureIndexes;{let s=r.langSysRecords;if(s)for(let o=0;o<s.length;o++){const a=s[o];if(a.tag===e)return a.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()};se.prototype.mapTagsToFeatures=function(e,t){let n={};for(let r=0;r<e.length;r++){const s=e[r].tag,o=e[r].feature;n[s]=o}this.features[t].tags=n};se.prototype.getScriptFeatures=function(e){let t=this.features[e];if(Object.prototype.hasOwnProperty.call(this.features,e))return t;const n=this.getScriptFeaturesIndexes(e);if(!n)return null;const r=this.font.tables.gsub;return t=n.map(s=>r.features[s]),this.features[e]=t,this.mapTagsToFeatures(t,e),t};se.prototype.getSubstitutionType=function(e,t){const n=e.lookupType.toString(),r=t.substFormat.toString();return n+r};se.prototype.getLookupMethod=function(e,t){let n=this.getSubstitutionType(e,t);switch(n){case"11":return r=>Hl.apply(this,[r,t]);case"12":return r=>_l.apply(this,[r,t]);case"63":return r=>zl.apply(this,[r,t]);case"41":return r=>Vl.apply(this,[r,t]);case"21":return r=>jl.apply(this,[r,t]);case"51":return r=>ql.apply(this,[r,t]);case"53":return r=>Wl.apply(this,[r,t]);default:throw new Error(`substitutionType : ${n} lookupType: ${e.lookupType} - substFormat: ${t.substFormat} is not yet supported`)}};se.prototype.lookupFeature=function(e){let t=e.contextParams,n=t.index;const r=this.getFeature({tag:e.tag,script:e.script});if(!r)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${e.tag}' for script '${e.script}'.`);const s=this.getFeatureLookups(r),o=[].concat(t.context);for(let a=0;a<s.length;a++){const i=s[a],l=this.getLookupSubtables(i);for(let c=0;c<l.length;c++){let u=l[c],h=this.getSubstitutionType(i,u),p;h==="71"?(h=this.getSubstitutionType(u,u.extension),p=this.getLookupMethod(u,u.extension),u=u.extension):p=this.getLookupMethod(i,u);let d;switch(h){case"11":d=p(t.current),d&&o.splice(n,1,new Ie({id:11,tag:e.tag,substitution:d}));break;case"12":d=p(t.current),d&&o.splice(n,1,new Ie({id:12,tag:e.tag,substitution:d}));break;case"63":d=p(t),Array.isArray(d)&&d.length&&o.splice(n,1,new Ie({id:63,tag:e.tag,substitution:d}));break;case"41":d=p(t),d&&o.splice(n,1,new Ie({id:41,tag:e.tag,substitution:d}));break;case"21":d=p(t.current),d&&o.splice(n,1,new Ie({id:21,tag:e.tag,substitution:d}));break;case"51":case"53":d=p(t),Array.isArray(d)&&d.length&&o.splice(n,1,new Ie({id:parseInt(h),tag:e.tag,substitution:d}));break}t=new Z(o,n),!(Array.isArray(d)&&!d.length)&&(d=null)}}return o.length?o:null};se.prototype.supports=function(e){if(!e.script)return!1;this.getScriptFeatures(e.script);const t=Object.prototype.hasOwnProperty.call(this.features,e.script);if(!e.tag)return t;const n=this.features[e.script].some(r=>r.tag===e.tag);return t&&n};se.prototype.getLookupSubtables=function(e){return e.subtables||null};se.prototype.getLookupByIndex=function(e){return this.font.tables.gsub.lookups[e]||null};se.prototype.getFeatureLookups=function(e){return e.lookupListIndexes.map(this.getLookupByIndex.bind(this))};se.prototype.getFeature=function(e){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,e.script)||this.getScriptFeatures(e.script);const t=this.features[e.script];return t?t.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:`No feature for script ${e.script}`}};var $l=se;function Yl(e){const t=e.current,n=e.get(-1);return n===null&&Le(t)||!Le(n)&&Le(t)}function Xl(e){const t=e.get(1);return t===null||!Le(t)}var Zl={startCheck:Yl,endCheck:Xl};function Kl(e){const t=e.current,n=e.get(-1);return(Le(t)||Ce(t))&&!Le(n)}function Ql(e){const t=e.get(1);switch(!0){case t===null:return!0;case(!Le(t)&&!Ce(t)):{const n=Bl(t);if(!n)return!0;if(n){let r=!1;if(r=e.lookahead.some(s=>Le(s)||Ce(s)),!r)return!0}break}default:return!1}}var Jl={startCheck:Kl,endCheck:Ql};function eu(e,t,n){t[n].setState(e.tag,e.substitution)}function tu(e,t,n){t[n].setState(e.tag,e.substitution)}function Vt(e,t,n){for(let r=0;r<e.substitution.length;r++){const s=e.substitution[r],o=t[n+r];if(Array.isArray(s)){s.length?o.setState(e.tag,s[0]):o.setState("deleted",!0);continue}o.setState(e.tag,s)}}function nu(e,t,n){let r=t[n];r.setState(e.tag,e.substitution.ligGlyph);const s=e.substitution.components.length;for(let o=0;o<s;o++)r=t[n+o+1],r.setState("deleted",!0)}var er={11:eu,12:tu,63:Vt,41:nu,51:Vt,53:Vt};function ru(e,t,n){e instanceof Ie&&er[e.id]&&er[e.id](e,t,n)}var Fe=ru;function su(e){let t=[].concat(e.backtrack);for(let n=t.length-1;n>=0;n--){const r=t[n],s=fs(r),o=Ce(r);if(!s&&!o)return!0;if(s)return!1}return!1}function ou(e){if(fs(e.current))return!1;for(let t=0;t<e.lookahead.length;t++){const n=e.lookahead[t];if(!Ce(n))return!0}return!1}function au(e){const t="arab",n=this.featuresTags[t],r=this.tokenizer.getRangeTokens(e);if(r.length===1)return;let s=new Z(r.map(a=>a.getState("glyphIndex")),0);const o=new Z(r.map(a=>a.char),0);for(let a=0;a<r.length;a++){const i=r[a];if(Ce(i.char))continue;s.setCurrentIndex(a),o.setCurrentIndex(a);let l=0;su(o)&&(l|=1),ou(o)&&(l|=2);let c;switch(l){case 1:c="fina";break;case 2:c="init";break;case 3:c="medi";break}if(n.indexOf(c)===-1)continue;let u=this.query.lookupFeature({tag:c,script:t,contextParams:s});if(u instanceof Error){console.info(u.message);continue}for(let h=0;h<u.length;h++){const p=u[h];p instanceof Ie&&(Fe(p,r,h),s.context[h]=p.substitution)}}}var iu=au;function tr(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,0)}function lu(e){const t="arab";let n=this.tokenizer.getRangeTokens(e),r=tr(n);for(let s=0;s<r.context.length;s++){r.setCurrentIndex(s);let o=this.query.lookupFeature({tag:"rlig",script:t,contextParams:r});if(o.length){for(let a=0;a<o.length;a++){const i=o[a];Fe(i,n,s)}r=tr(n)}}}var uu=lu;function cu(e){return e.index===0&&e.context.length>1}function pu(e){return e.index===e.context.length-1}var hu={startCheck:cu,endCheck:pu};function nr(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,0)}function fu(e){const t="delf",n="ccmp";let r=this.tokenizer.getRangeTokens(e),s=nr(r);for(let o=0;o<s.context.length;o++){if(!this.query.getFeature({tag:n,script:t,contextParams:s}))continue;s.setCurrentIndex(o);let a=this.query.lookupFeature({tag:n,script:t,contextParams:s});if(a.length){for(let i=0;i<a.length;i++){const l=a[i];Fe(l,r,o)}s=nr(r)}}}var du=fu;function gu(e){const t=e.current,n=e.get(-1);return n===null&&vt(t)||!vt(n)&&vt(t)}function mu(e){const t=e.get(1);return t===null||!vt(t)}var yu={startCheck:gu,endCheck:mu};function rr(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,0)}function vu(e){const t="latn";let n=this.tokenizer.getRangeTokens(e),r=rr(n);for(let s=0;s<r.context.length;s++){r.setCurrentIndex(s);let o=this.query.lookupFeature({tag:"liga",script:t,contextParams:r});if(o.length){for(let a=0;a<o.length;a++){const i=o[a];Fe(i,n,s)}r=rr(n)}}}var bu=vu;function Su(e){const t=e.current,n=e.get(-1);return n===null&&yt(t)||!yt(n)&&yt(t)}function xu(e){const t=e.get(1);return t===null||!yt(t)}var Tu={startCheck:Su,endCheck:xu};function sr(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,t||0)}function ku(e){const t="thai";let n=this.tokenizer.getRangeTokens(e),r=sr(n,0);for(let s=0;s<r.context.length;s++){r.setCurrentIndex(s);let o=this.query.lookupFeature({tag:"ccmp",script:t,contextParams:r});if(o.length){for(let a=0;a<o.length;a++){const i=o[a];Fe(i,n,s)}r=sr(n,s)}}}var Ou=ku;function or(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,t||0)}function Ru(e){const t="thai";let n=this.tokenizer.getRangeTokens(e),r=or(n,0);for(let s=0;s<r.context.length;s++){r.setCurrentIndex(s);let o=this.query.lookupFeature({tag:"liga",script:t,contextParams:r});if(o.length){for(let a=0;a<o.length;a++){const i=o[a];Fe(i,n,s)}r=or(n,s)}}}var Uu=Ru;function ar(e,t){const n=e.map(r=>r.activeState.value);return new Z(n,t||0)}function Iu(e){const t="thai";let n=this.tokenizer.getRangeTokens(e),r=ar(n,0);for(let s=0;s<r.context.length;s++){r.setCurrentIndex(s);let o=this.query.lookupFeature({tag:"rlig",script:t,contextParams:r});if(o.length){for(let a=0;a<o.length;a++){const i=o[a];Fe(i,n,s)}r=ar(n,s)}}}var wu=Iu;function tn(e){if(e===null)return!1;const t=e.codePointAt(0);return t>=6155&&t<=6157||t>=65024&&t<=65039||t>=917760&&t<=917999}function Lu(e){const t=e.current,n=e.get(1);return n===null&&tn(t)||tn(n)}function Cu(e){const t=e.get(1);return t===null||!tn(t)}var Eu={startCheck:Lu,endCheck:Cu};function Du(e){const t=this.query.font,n=this.tokenizer.getRangeTokens(e);if(n[1].setState("deleted",!0),t.tables.cmap&&t.tables.cmap.varSelectorList){const r=n[0].char.codePointAt(0),s=n[1].char.codePointAt(0),o=t.tables.cmap.varSelectorList[s];if(o!==void 0&&o.nonDefaultUVS){const a=o.nonDefaultUVS.uvsMappings;if(a[r]){const i=a[r].glyphID;t.glyphs.glyphs[i]!==void 0&&n[0].setState("glyphIndex",i)}}}}var Mu=Du;function ie(e){this.baseDir=e||"ltr",this.tokenizer=new Gl,this.featuresTags={}}ie.prototype.setText=function(e){this.text=e};ie.prototype.contextChecks={ccmpReplacementCheck:hu,latinWordCheck:yu,arabicWordCheck:Zl,arabicSentenceCheck:Jl,thaiWordCheck:Tu,unicodeVariationSequenceCheck:Eu};function Ve(e){const t=this.contextChecks[`${e}Check`];return this.tokenizer.registerContextChecker(e,t.startCheck,t.endCheck)}function Au(){return Ve.call(this,"ccmpReplacement"),Ve.call(this,"latinWord"),Ve.call(this,"arabicWord"),Ve.call(this,"arabicSentence"),Ve.call(this,"thaiWord"),Ve.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function Nu(){const e=this.tokenizer.getContextRanges("arabicSentence");for(let t=0;t<e.length;t++){const n=e[t];let r=this.tokenizer.getRangeTokens(n);this.tokenizer.replaceRange(n.startIndex,n.endOffset,r.reverse())}}ie.prototype.registerFeatures=function(e,t){const n=t.filter(r=>this.query.supports({script:e,tag:r}));Object.prototype.hasOwnProperty.call(this.featuresTags,e)?this.featuresTags[e]=this.featuresTags[e].concat(n):this.featuresTags[e]=n};ie.prototype.applyFeatures=function(e,t){if(!e)throw new Error("No valid font was provided to apply features");this.query||(this.query=new $l(e));for(let n=0;n<t.length;n++){const r=t[n];this.query.supports({script:r.script})&&this.registerFeatures(r.script,r.tags)}};ie.prototype.registerModifier=function(e,t,n){this.tokenizer.registerModifier(e,t,n)};function it(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Pu(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;it.call(this);const e=this.tokenizer.getContextRanges("arabicWord");for(let t=0;t<e.length;t++){const n=e[t];iu.call(this,n)}}function Fu(){it.call(this);const e=this.tokenizer.getContextRanges("ccmpReplacement");for(let t=0;t<e.length;t++){const n=e[t];du.call(this,n)}}function Gu(){if(!this.hasFeatureEnabled("arab","rlig"))return;it.call(this);const e=this.tokenizer.getContextRanges("arabicWord");for(let t=0;t<e.length;t++){const n=e[t];uu.call(this,n)}}function Bu(){if(!this.hasFeatureEnabled("latn","liga"))return;it.call(this);const e=this.tokenizer.getContextRanges("latinWord");for(let t=0;t<e.length;t++){const n=e[t];bu.call(this,n)}}function Hu(){const e=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let t=0;t<e.length;t++){const n=e[t];Mu.call(this,n)}}function _u(){it.call(this);const e=this.tokenizer.getContextRanges("thaiWord");for(let t=0;t<e.length;t++){const n=e[t];this.hasFeatureEnabled("thai","liga")&&Uu.call(this,n),this.hasFeatureEnabled("thai","rlig")&&wu.call(this,n),this.hasFeatureEnabled("thai","ccmp")&&Ou.call(this,n)}}ie.prototype.checkContextReady=function(e){return!!this.tokenizer.getContext(e)};ie.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&Fu.call(this),this.checkContextReady("arabicWord")&&(Pu.call(this),Gu.call(this)),this.checkContextReady("latinWord")&&Bu.call(this),this.checkContextReady("arabicSentence")&&Nu.call(this),this.checkContextReady("thaiWord")&&_u.call(this),this.checkContextReady("unicodeVariationSequence")&&Hu.call(this)};ie.prototype.hasFeatureEnabled=function(e,t){return(this.featuresTags[e]||[]).indexOf(t)!==-1};ie.prototype.processText=function(e){(!this.text||this.text!==e)&&(this.setText(e),Au.call(this),this.applyFeaturesToContexts())};ie.prototype.getBidiText=function(e){return this.processText(e),this.tokenizer.getText()};ie.prototype.getTextGlyphs=function(e){this.processText(e);let t=[];for(let n=0;n<this.tokenizer.tokens.length;n++){const r=this.tokenizer.tokens[n];if(r.state.deleted)continue;const s=r.activeState.value;t.push(Array.isArray(s)?s[0]:s)}return t};var zu=ie;function qt(e){return{fontFamily:{en:e.familyName||" "},fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\s/g,"")},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}}}function N(e){if(e=e||{},e.tables=e.tables||{},!e.empty){if(!e.familyName)throw"When creating a new Font object, familyName is required.";if(!e.styleName)throw"When creating a new Font object, styleName is required.";if(!e.unitsPerEm)throw"When creating a new Font object, unitsPerEm is required.";if(!e.ascender)throw"When creating a new Font object, ascender is required.";if(e.descender>0)throw"When creating a new Font object, negative descender value is required.";this.names={},this.names.unicode=qt(e),this.names.macintosh=qt(e),this.names.windows=qt(e),this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.italicAngle=e.italicAngle||0,this.weightClass=e.weightClass||0;let t=0;e.fsSelection?t=e.fsSelection:(this.italicAngle<0?t|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(t|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(t|=this.fsSelectionValues.BOLD),t==0&&(t=this.fsSelectionValues.REGULAR)),(!e.panose||!Array.isArray(e.panose))&&(e.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(e.tables,{os2:Object.assign({usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:e.panose[0]||0,bSerifStyle:e.panose[1]||0,bWeight:e.panose[2]||0,bProportion:e.panose[3]||0,bContrast:e.panose[4]||0,bStrokeVariation:e.panose[5]||0,bArmStyle:e.panose[6]||0,bLetterform:e.panose[7]||0,bMidline:e.panose[8]||0,bXHeight:e.panose[9]||0,fsSelection:t},e.tables.os2)})}this.supported=!0,this.glyphs=new ve.GlyphSet(this,e.glyphs||[]),this.encoding=new Ur(this),this.position=new Fa(this),this.substitution=new qa(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(t,n,r)=>(t[n]=r,t.fvar&&(t.gvar||t.cff2)&&!this.variation&&(this.variation=new oi(this)),!0)}),this.palettes=new rs(this),this.layers=new Wa(this),this.svgImages=new ja(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new Nl(this):null}})}N.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)>0};N.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)};N.prototype.charToGlyph=function(e){const t=this.charToGlyphIndex(e);let n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n};N.prototype.updateFeatures=function(e){return this.defaultRenderOptions.features.map(t=>t.script==="latn"?{script:"latn",tags:t.tags.filter(n=>e[n])}:t)};N.prototype.stringToGlyphIndexes=function(e,t){const n=new zu,r=o=>this.charToGlyphIndex(o.char);n.registerModifier("glyphIndex",null,r);let s=t?this.updateFeatures(t.features):this.defaultRenderOptions.features;return n.applyFeatures(this,s),n.getTextGlyphs(e)};N.prototype.stringToGlyphs=function(e,t){const n=this.stringToGlyphIndexes(e,t);let r=n.length;const s=new Array(r),o=this.glyphs.get(0);for(let a=0;a<r;a+=1)s[a]=this.glyphs.get(n[a])||o;return s};N.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)};N.prototype.nameToGlyph=function(e){const t=this.nameToGlyphIndex(e);let n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n};N.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""};N.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;const n=this.position.defaultKerningTables;return n?this.position.getKerningValue(n,e,t):this.kerningPairs[e+","+t]||0};N.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0};N.prototype.forEachGlyph=function(e,t,n,r,s,o){t=t!==void 0?t:0,n=n!==void 0?n:0,r=r!==void 0?r:72,s=Object.assign({},this.defaultRenderOptions,s);const a=1/this.unitsPerEm*r,i=this.stringToGlyphs(e,s);let l;if(s.kerning){const c=s.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(c,s.language)}for(let c=0;c<i.length;c+=1){const u=i[c];if(o.call(this,u,t,n,r,s),u.advanceWidth&&(t+=u.advanceWidth*a),s.kerning&&c<i.length-1){const h=l?this.position.getKerningValue(l,u.index,i[c+1].index):this.getKerningValue(u,i[c+1]);t+=h*a}s.letterSpacing?t+=s.letterSpacing*r:s.tracking&&(t+=s.tracking/1e3*r)}return t};N.prototype.getPath=function(e,t,n,r,s){s=Object.assign({},this.defaultRenderOptions,s);const o=new We;if(o._layers=[],Nr(this,o),o.stroke){const a=1/(o.unitsPerEm||1e3)*r;o.strokeWidth*=a}return this.forEachGlyph(e,t,n,r,s,(a,i,l,c)=>{const u=a.getPath(i,l,c,s,this);if(s.drawSVG||s.drawLayers){const h=u._layers;if(h&&h.length){for(let p=0;p<h.length;p++){const d=h[p];o._layers.push(d)}return}}o.extend(u)}),o};N.prototype.getPaths=function(e,t,n,r,s){s=Object.assign({},this.defaultRenderOptions,s);const o=[];return this.forEachGlyph(e,t,n,r,s,function(a,i,l,c){const u=a.getPath(i,l,c,s,this);o.push(u)}),o};N.prototype.getAdvanceWidth=function(e,t,n){return n=Object.assign({},this.defaultRenderOptions,n),this.forEachGlyph(e,0,0,t,n,function(){})};N.prototype.draw=function(e,t,n,r,s,o){this.getPath(t,n,r,s,o).draw(e)};N.prototype.drawPoints=function(e,t,n,r,s,o){o=Object.assign({},this.defaultRenderOptions,o),this.forEachGlyph(t,n,r,s,o,function(a,i,l,c){a.drawPoints(e,i,l,c,o,this)})};N.prototype.drawMetrics=function(e,t,n,r,s,o){o=Object.assign({},this.defaultRenderOptions,o),this.forEachGlyph(t,n,r,s,o,function(a,i,l,c){a.drawMetrics(e,i,l,c)})};N.prototype.getEnglishName=function(e){const t=(this.names.unicode||this.names.macintosh||this.names.windows)[e];if(t)return t.en};N.prototype.validate=function(){const e=[],t=this;function n(s,o){s||(console.warn(`[opentype.js] ${o}`),e.push(o))}function r(s){const o=t.getEnglishName(s);n(o&&o.trim().length>0,"No English "+s+" specified.")}if(r("fontFamily"),r("weightName"),r("manufacturer"),r("copyright"),r("version"),n(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){const s=this.tables.colr.baseGlyphRecords;let o=-1;for(let a=0;a<s.length;a++){const i=s[a].glyphID;if(n(o<s[a].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${i} comes after ${o}`),o>s[a].glyphID)break;o=i}}return e};N.prototype.toTables=function(){return Pa.fontToTable(this)};N.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};N.prototype.toArrayBuffer=function(){const e=this.toTables().encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let r=0;r<e.length;r++)n[r]=e[r];return t};N.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")};N.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512};N.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64};N.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9};N.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Vu=N;function qu(e,t){const n=new S.Parser(e,t),r=n.parseUShort(),s=n.parseUShort();r!==1&&console.warn(`Unsupported hvar table version ${r}.${s}`);const o=[r,s],a=n.parsePointer32(function(){return this.parseItemVariationStore()}),i=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),l=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),c=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:o,itemVariationStore:a,advanceWidth:i,lsb:l,rsb:c}}function Wu(){console.warn("Writing of hvar tables is not yet supported.")}var ju={make:Wu,parse:qu},$u=function(){return{coverage:this.parsePointer(m.coverage),attachPoints:this.parseList(m.pointer(m.uShortList))}},Yu=function(){var e=this.parseUShort();if(O.argument(e===1||e===2||e===3,"Unsupported CaretValue table version."),e===1)return{coordinate:this.parseShort()};if(e===2)return{pointindex:this.parseShort()};if(e===3)return{coordinate:this.parseShort()}},Xu=function(){return this.parseList(m.pointer(Yu))},Zu=function(){return{coverage:this.parsePointer(m.coverage),ligGlyphs:this.parseList(m.pointer(Xu))}},Ku=function(){return this.parseUShort(),this.parseList(m.pointer(m.coverage))};function Qu(e,t){t=t||0;const n=new m(e,t),r=n.parseVersion(1);O.argument(r===1||r===1.2||r===1.3,"Unsupported GDEF table version.");var s={version:r,classDef:n.parsePointer(m.classDef),attachList:n.parsePointer($u),ligCaretList:n.parsePointer(Zu),markAttachClassDef:n.parsePointer(m.classDef)};return r>=1.2&&(s.markGlyphSets=n.parsePointer(Ku)),s}var Ju={parse:Qu},pe=new Array(10);pe[1]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(m.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(m.coverage),values:this.parseValueRecordList()};O.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};pe[2]=function(){const e=this.offset+this.relativeOffset,t=this.parseUShort();O.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");const n=this.parsePointer(m.coverage),r=this.parseUShort(),s=this.parseUShort();if(t===1)return{posFormat:t,coverage:n,valueFormat1:r,valueFormat2:s,pairSets:this.parseList(m.pointer(m.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(r),value2:this.parseValueRecord(s)}})))};if(t===2){const o=this.parsePointer(m.classDef),a=this.parsePointer(m.classDef),i=this.parseUShort(),l=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:r,valueFormat2:s,classDef1:o,classDef2:a,class1Count:i,class2Count:l,classRecords:this.parseList(i,m.list(l,function(){return{value1:this.parseValueRecord(r),value2:this.parseValueRecord(s)}}))}}};pe[3]=function(){return{error:"GPOS Lookup 3 not supported"}};pe[4]=function(){return{error:"GPOS Lookup 4 not supported"}};pe[5]=function(){return{error:"GPOS Lookup 5 not supported"}};pe[6]=function(){return{error:"GPOS Lookup 6 not supported"}};pe[7]=function(){return{error:"GPOS Lookup 7 not supported"}};pe[8]=function(){return{error:"GPOS Lookup 8 not supported"}};pe[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function ec(e,t){t=t||0;const n=new m(e,t),r=n.parseVersion(1);return O.argument(r===1||r===1.1,"Unsupported GPOS table version "+r),r===1?{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(pe)}:{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(pe),variations:n.parseFeatureVariationsList()}}var tc=new Array(10);function nc(e){return new v.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new v.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new v.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new v.LookupList(e.lookups,tc)}])}var rc={parse:ec,make:nc};function sc(e){const t={};e.skip("uShort");const n=e.parseUShort();O.argument(n===0,"Unsupported kern sub-table version."),e.skip("uShort",2);const r=e.parseUShort();e.skip("uShort",3);for(let s=0;s<r;s+=1){const o=e.parseUShort(),a=e.parseUShort(),i=e.parseShort();t[o+","+a]=i}return t}function oc(e){const t={};e.skip("uShort"),e.parseULong()>1&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");const n=e.parseUShort()&255;if(e.skip("uShort"),n===0){const r=e.parseUShort();e.skip("uShort",3);for(let s=0;s<r;s+=1){const o=e.parseUShort(),a=e.parseUShort(),i=e.parseShort();t[o+","+a]=i}}return t}function ac(e,t){const n=new S.Parser(e,t),r=n.parseUShort();if(r===0)return sc(n);if(r===1)return oc(n);throw new Error("Unsupported kern table version ("+r+").")}var ic={parse:ac};function lc(e,t,n,r){const s=new S.Parser(e,t),o=r?s.parseUShort:s.parseULong,a=[];for(let i=0;i<n+1;i+=1){let l=o.call(s);r&&(l*=2),a.push(l)}return a}var uc={parse:lc};function ir(e,t){const n=[];let r=12;for(let s=0;s<t;s+=1){const o=S.getTag(e,r),a=S.getULong(e,r+4),i=S.getULong(e,r+8),l=S.getULong(e,r+12);n.push({tag:o,checksum:a,offset:i,length:l,compression:!1}),r+=16}return n}function cc(e,t){const n=[];let r=44;for(let s=0;s<t;s+=1){const o=S.getTag(e,r),a=S.getULong(e,r+4),i=S.getULong(e,r+8),l=S.getULong(e,r+12);let c;i<l?c="WOFF":c=!1,n.push({tag:o,offset:a,compression:c,compressedLength:i,length:l}),r+=20}return n}function M(e,t){if(t.compression==="WOFF"){const n=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),r=new Uint8Array(t.length);if(dr(n,r),r.byteLength!==t.length)throw new Error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length");return{data:new DataView(r.buffer,0),offset:0}}else return{data:e,offset:t.offset}}function pc(e,t={}){let n,r;const s=new Vu({empty:!0});e.constructor!==ArrayBuffer&&(e=new Uint8Array(e).buffer);const o=new DataView(e,0);let a,i=[];const l=S.getTag(o,0);if(l==="\0\0\0"||l==="true"||l==="typ1")s.outlinesFormat="truetype",a=S.getUShort(o,4),i=ir(o,a);else if(l==="OTTO")s.outlinesFormat="cff",a=S.getUShort(o,4),i=ir(o,a);else if(l==="wOFF"){const x=S.getTag(o,4);if(x==="\0\0\0")s.outlinesFormat="truetype";else if(x==="OTTO")s.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);a=S.getUShort(o,12),i=cc(o,a)}else if(l==="wOF2"){var c="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+c)}else throw new Error("Unsupported OpenType signature "+l);let u,h,p,d,f,g,y,T,R,I,C,P,G,A,$,K,E,z;for(let x=0;x<a;x+=1){const L=i[x];let U;switch(L.tag){case"avar":y=L;break;case"cmap":U=M(o,L),s.tables.cmap=Rr.parse(U.data,U.offset),s.encoding=new Ir(s.tables.cmap);break;case"cvt ":U=M(o,L),z=new S.Parser(U.data,U.offset),s.tables.cvt=z.parseShortList(L.length/2);break;case"fvar":p=L;break;case"STAT":d=L;break;case"gvar":f=L;break;case"cvar":g=L;break;case"fpgm":U=M(o,L),z=new S.Parser(U.data,U.offset),s.tables.fpgm=z.parseByteList(L.length);break;case"head":U=M(o,L),s.tables.head=Gr.parse(U.data,U.offset),s.unitsPerEm=s.tables.head.unitsPerEm,n=s.tables.head.indexToLocFormat;break;case"hhea":U=M(o,L),s.tables.hhea=Br.parse(U.data,U.offset),s.ascender=s.tables.hhea.ascender,s.descender=s.tables.hhea.descender,s.numberOfHMetrics=s.tables.hhea.numberOfHMetrics;break;case"HVAR":G=L;break;case"hmtx":P=L;break;case"ltag":U=M(o,L),r=_r.parse(U.data,U.offset);break;case"COLR":U=M(o,L),s.tables.colr=jr.parse(U.data,U.offset);break;case"CPAL":U=M(o,L),s.tables.cpal=Er.parse(U.data,U.offset);break;case"maxp":U=M(o,L),s.tables.maxp=zr.parse(U.data,U.offset),s.numGlyphs=s.tables.maxp.numGlyphs;break;case"name":K=L;break;case"OS/2":U=M(o,L),s.tables.os2=Jt.parse(U.data,U.offset);break;case"post":U=M(o,L),s.tables.post=Vr.parse(U.data,U.offset),s.glyphNames=new ln(s.tables.post);break;case"prep":U=M(o,L),z=new S.Parser(U.data,U.offset),s.tables.prep=z.parseByteList(L.length);break;case"glyf":T=L;break;case"loca":$=L;break;case"CFF ":u=L;break;case"CFF2":h=L;break;case"kern":A=L;break;case"GDEF":R=L;break;case"GPOS":I=L;break;case"GSUB":C=L;break;case"meta":E=L;break;case"gasp":try{U=M(o,L),s.tables.gasp=Qr.parse(U.data,U.offset)}catch(be){console.warn("Failed to parse gasp table, skipping."),console.warn(be)}break;case"SVG ":U=M(o,L),s.tables.svg=Jr.parse(U.data,U.offset);break}}const ee=M(o,K);if(s.tables.name=Or.parse(ee.data,ee.offset,r),s.names=s.tables.name,T&&$){const x=n===0,L=M(o,$),U=uc.parse(L.data,L.offset,s.numGlyphs,x),be=M(o,T);s.glyphs=as.parse(be.data,be.offset,U,s,t)}else if(u){const x=M(o,u);Kt.parse(x.data,x.offset,s,t)}else if(h){const x=M(o,h);Kt.parse(x.data,x.offset,s,t)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");const D=M(o,P);if(Hr.parse(s,D.data,D.offset,s.numberOfHMetrics,s.numGlyphs,s.glyphs,t),oo(s,t),A){const x=M(o,A);s.kerningPairs=ic.parse(x.data,x.offset)}else s.kerningPairs={};if(R){const x=M(o,R);s.tables.gdef=Ju.parse(x.data,x.offset)}if(I){const x=M(o,I);s.tables.gpos=rc.parse(x.data,x.offset),s.position.init()}if(C){const x=M(o,C);s.tables.gsub=qr.parse(x.data,x.offset)}if(p){const x=M(o,p);s.tables.fvar=$r.parse(x.data,x.offset,s.names)}if(d){const x=M(o,d);s.tables.stat=Yr.parse(x.data,x.offset,s.tables.fvar)}if(f){p||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),T||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");const x=M(o,f);s.tables.gvar=Kr.parse(x.data,x.offset,s.tables.fvar,s.glyphs)}if(g){p||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),s.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),T||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");const x=M(o,g);s.tables.cvar=Zr.parse(x.data,x.offset,s.tables.fvar,s.tables.cvt||[])}if(y){p||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");const x=M(o,y);s.tables.avar=Xr.parse(x.data,x.offset,s.tables.fvar)}if(G){p||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),P||console.warn("This font provides an HVAR table, but no hmtx table to vary.");const x=M(o,G);s.tables.hvar=ju.parse(x.data,x.offset,s.tables.fvar)}if(E){const x=M(o,E);s.tables.meta=Wr.parse(x.data,x.offset),s.metas=s.tables.meta}return s.palettes=new rs(s),s}function ds(e){const t=e.tables?.svg,n=new Map;if(!t)return n;for(const[r,s]of t.entries()){const o=e.glyphs.get(r).getBoundingBox();n.set(r,{svg:new TextDecoder("utf-8").decode(s),viewbox:`${o.x1} ${-o.y2} ${o.x2-o.x1} ${o.y2-o.y1}`})}return n}async function hc(e){const t=await pc(e);return ds(t)}exports.extractSVGGlyphs=hc;exports.extractSVGGlyphsFromFont=ds;