@mlightcad/mtext-renderer 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -12
- package/dist/index.umd.cjs +1 -1
- package/dist/mtext-renderer-worker.js +14 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9832,18 +9832,20 @@ class Mh extends Ma {
|
|
|
9832
9832
|
this.data.glyphs[e] = r;
|
|
9833
9833
|
return;
|
|
9834
9834
|
}
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9835
|
+
if (this.opentypeFont.charToGlyphIndex(e) > 0) {
|
|
9836
|
+
const n = this.opentypeFont.charToGlyph(e);
|
|
9837
|
+
if (!n || !n.path) return;
|
|
9838
|
+
const a = Math.round, i = {
|
|
9839
|
+
ha: a(n.advanceWidth ?? 0),
|
|
9840
|
+
x_min: a(n.xMin ?? 0),
|
|
9841
|
+
x_max: a(n.xMax ?? 0),
|
|
9842
|
+
o: ""
|
|
9843
|
+
};
|
|
9844
|
+
n.path.commands.forEach((s) => {
|
|
9845
|
+
let o = s.type.toLowerCase();
|
|
9846
|
+
o === "c" && (o = "b"), i.o += o + " ", s.x !== void 0 && s.y !== void 0 && (i.o += a(s.x) + " " + a(s.y) + " "), s.x1 !== void 0 && s.y1 !== void 0 && (i.o += a(s.x1) + " " + a(s.y1) + " "), s.x2 !== void 0 && s.y2 !== void 0 && (i.o += a(s.x2) + " " + a(s.y2) + " ");
|
|
9847
|
+
}), this.data.glyphs[e] = i, this.glyphCache.set(e, i);
|
|
9848
|
+
}
|
|
9847
9849
|
}
|
|
9848
9850
|
/**
|
|
9849
9851
|
* Generates shapes for a text string
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(U,re){typeof exports=="object"&&typeof module<"u"?re(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],re):(U=typeof globalThis<"u"?globalThis:U||self,re(U.MTextRenderer={},U.THREE))})(this,function(U,re){"use strict";function Di(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const N=Di(re);class nr{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(r=>r!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...r){for(const n of this.listeners)n.call(null,e,...r)}}class _i{constructor(){this.cache=new Map}hasGeometry(e,r){const n=this.generateKey(e,r);return this.cache.has(n)}getGeometry(e,r){const n=this.generateKey(e,r);if(this.cache.has(n))return this.cache.get(n)}setGeometry(e,r,n){const a=this.generateKey(e,r);this.cache.set(a,n)}dispose(){for(const e of this.cache.values())e.dispose();this.cache.clear()}generateKey(e,r){return`${e}_${r}`}}class ar{constructor(e){this.names=new Set,this.unsupportedChars={},this.encoding=e.encoding,e.alias.forEach(r=>this.names.add(r)),this.cache=new _i}addUnsupportedChar(e){this.unsupportedChars[e]||(this.unsupportedChars[e]=0),this.unsupportedChars[e]++}}class ir extends N.Shape{constructor(){super(...arguments),this.width=0}}const sr=(t,e)=>e.some(r=>t instanceof r);let vn,yn;function Pi(){return vn||(vn=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ni(){return yn||(yn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const or=new WeakMap,cr=new WeakMap,Ot=new WeakMap;function Gi(t){const e=new Promise((r,n)=>{const a=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{r(Ze(t.result)),a()},s=()=>{n(t.error),a()};t.addEventListener("success",i),t.addEventListener("error",s)});return Ot.set(e,t),e}function Hi(t){if(or.has(t))return;const e=new Promise((r,n)=>{const a=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{r(),a()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)});or.set(t,e)}let ur={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return or.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ze(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function mn(t){ur=t(ur)}function zi(t){return Ni().includes(t)?function(...e){return t.apply(hr(this),e),Ze(this.request)}:function(...e){return Ze(t.apply(hr(this),e))}}function Wi(t){return typeof t=="function"?zi(t):(t instanceof IDBTransaction&&Hi(t),sr(t,Pi())?new Proxy(t,ur):t)}function Ze(t){if(t instanceof IDBRequest)return Gi(t);if(cr.has(t))return cr.get(t);const e=Wi(t);return e!==t&&(cr.set(t,e),Ot.set(e,t)),e}const hr=t=>Ot.get(t);function qi(t,e,{blocked:r,upgrade:n,blocking:a,terminated:i}={}){const s=indexedDB.open(t,e),o=Ze(s);return n&&s.addEventListener("upgradeneeded",c=>{n(Ze(s.result),c.oldVersion,c.newVersion,Ze(s.transaction),c)}),r&&s.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),o.then(c=>{i&&c.addEventListener("close",()=>i()),a&&c.addEventListener("versionchange",u=>a(u.oldVersion,u.newVersion,u))}).catch(()=>{}),o}const Vi=["get","getKey","getAll","getAllKeys","count"],Xi=["put","add","delete","clear"],lr=new Map;function bn(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(lr.get(e))return lr.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,a=Xi.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(a||Vi.includes(r)))return;const i=async function(s,...o){const c=this.transaction(s,a?"readwrite":"readonly");let u=c.store;return n&&(u=u.index(o.shift())),(await Promise.all([u[r](...o),a&&c.done]))[0]};return lr.set(e,i),i}mn(t=>({...t,get:(e,r,n)=>bn(e,r)||t.get(e,r,n),has:(e,r)=>!!bn(e,r)||t.has(e,r)}));const ji=["continue","continuePrimaryKey","advance"],xn={},fr=new WeakMap,Sn=new WeakMap,Yi={get(t,e){if(!ji.includes(e))return t[e];let r=xn[e];return r||(r=xn[e]=function(...n){fr.set(this,Sn.get(this)[e](...n))}),r}};async function*Zi(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,Yi);for(Sn.set(r,e),Ot.set(r,hr(e));e;)yield r,e=await(fr.get(r)||e.continue()),fr.delete(r)}function wn(t,e){return e===Symbol.asyncIterator&&sr(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&sr(t,[IDBIndex,IDBObjectStore])}mn(t=>({...t,get(e,r,n){return wn(e,r)?Zi:t.get(e,r,n)},has(e,r){return wn(e,r)||t.has(e,r)}}));const $e={fonts:"fonts"},pr=[{version:1,stores:[{name:$e.fonts,keyPath:"name"}]},{version:2,stores:[{name:$e.fonts,keyPath:"name"}]}],ye=class ye{constructor(){this.isClosing=!1,typeof window<"u"&&window.addEventListener("unload",()=>{this.close()})}static get instance(){return ye._instance||(ye._instance=new ye),ye._instance}async set(e,r){await(await this.getDatabase()).put($e.fonts,{...r,name:e})}async get(e){return await(await this.getDatabase()).get($e.fonts,e)}async delete(e){await(await this.getDatabase()).delete($e.fonts,e)}async getAll(){return await(await this.getDatabase()).getAll($e.fonts)}async clear(){await(await this.getDatabase()).clear($e.fonts)}async has(e){return await this.get(e)!==void 0}close(){if(!this.isClosing){this.isClosing=!0;try{this.db&&(this.db.close(),this.db=void 0)}finally{this.isClosing=!1}}}async destroy(){this.close(),await indexedDB.deleteDatabase(ye.DATABASE_NAME),ye._instance=void 0}async getDatabase(){if(this.isClosing)throw new Error("Cannot perform operation while database is closing");return this.db?this.db:(this.db=await qi(ye.DATABASE_NAME,ye.DATABASE_VERSION,{upgrade:(e,r,n)=>this.handleUpgrade(e,r,n),blocked(){console.warn("Database upgrade blocked - please close other tabs using the application")},blocking(){console.warn("Database blocking newer version - closing connection"),ye.instance.close()}}),this.db)}handleUpgrade(e,r,n){const a=pr.filter(i=>i.version>r&&(!n||i.version<=n));for(const i of a)this.applySchemaVersion(e,i)}applySchemaVersion(e,r){for(const n of r.stores)e.objectStoreNames.contains(n.name)||e.createObjectStore(n.name,{keyPath:n.keyPath})}};ye.DATABASE_NAME="mlightcad",ye.DATABASE_VERSION=pr[pr.length-1].version;let pt=ye;const Fn=t=>t.split("/").pop(),kn=t=>{const e=Fn(t);if(e){const r=e.lastIndexOf(".");return r===-1?e:e.substring(0,r)}return t},$i=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],Ki=t=>$i[t];/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var t=function(){try{var r={},n=Object.defineProperty,a=n(r,r,r)&&n}catch{}return a}(),e=function(r){if(this==null)throw TypeError();var n=String(this),a=n.length,i=r?Number(r):0;if(i!=i&&(i=0),!(i<0||i>=a)){var s=n.charCodeAt(i),o;return s>=55296&&s<=56319&&a>i+1&&(o=n.charCodeAt(i+1),o>=56320&&o<=57343)?(s-55296)*1024+o-56320+65536:s}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();var dr=0,Tn=-3;function dt(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Qi(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new dt,this.dtree=new dt}var Cn=new dt,En=new dt,gr=new Uint8Array(30),vr=new Uint16Array(30),Un=new Uint8Array(30),An=new Uint16Array(30),Ji=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bn=new dt,Be=new Uint8Array(320);function Ln(t,e,r,n){var a,i;for(a=0;a<r;++a)t[a]=0;for(a=0;a<30-r;++a)t[a+r]=a/r|0;for(i=n,a=0;a<30;++a)e[a]=i,i+=1<<t[a]}function es(t,e){var r;for(r=0;r<7;++r)t.table[r]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,r=0;r<24;++r)t.trans[r]=256+r;for(r=0;r<144;++r)t.trans[24+r]=r;for(r=0;r<8;++r)t.trans[168+r]=280+r;for(r=0;r<112;++r)t.trans[176+r]=144+r;for(r=0;r<5;++r)e.table[r]=0;for(e.table[5]=32,r=0;r<32;++r)e.trans[r]=r}var On=new Uint16Array(16);function yr(t,e,r,n){var a,i;for(a=0;a<16;++a)t.table[a]=0;for(a=0;a<n;++a)t.table[e[r+a]]++;for(t.table[0]=0,i=0,a=0;a<16;++a)On[a]=i,i+=t.table[a];for(a=0;a<n;++a)e[r+a]&&(t.trans[On[e[r+a]]++]=a)}function ts(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=t.tag&1;return t.tag>>>=1,e}function Le(t,e,r){if(!e)return r;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,n+r}function mr(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,a=0,i=t.tag;do n=2*n+(i&1),i>>>=1,++a,r+=e.table[a],n-=e.table[a];while(n>=0);return t.tag=i,t.bitcount-=a,e.trans[r+n]}function rs(t,e,r){var n,a,i,s,o,c;for(n=Le(t,5,257),a=Le(t,5,1),i=Le(t,4,4),s=0;s<19;++s)Be[s]=0;for(s=0;s<i;++s){var u=Le(t,3,0);Be[Ji[s]]=u}for(yr(Bn,Be,0,19),o=0;o<n+a;){var h=mr(t,Bn);switch(h){case 16:var d=Be[o-1];for(c=Le(t,2,3);c;--c)Be[o++]=d;break;case 17:for(c=Le(t,3,3);c;--c)Be[o++]=0;break;case 18:for(c=Le(t,7,11);c;--c)Be[o++]=0;break;default:Be[o++]=h;break}}yr(e,Be,0,n),yr(r,Be,n,a)}function Mn(t,e,r){for(;;){var n=mr(t,e);if(n===256)return dr;if(n<256)t.dest[t.destLen++]=n;else{var a,i,s,o;for(n-=257,a=Le(t,gr[n],vr[n]),i=mr(t,r),s=t.destLen-Le(t,Un[i],An[i]),o=s;o<s+a;++o)t.dest[t.destLen++]=t.dest[o]}}}function ns(t){for(var e,r,n;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if(e=t.source[t.sourceIndex+1],e=256*e+t.source[t.sourceIndex],r=t.source[t.sourceIndex+3],r=256*r+t.source[t.sourceIndex+2],e!==(~r&65535))return Tn;for(t.sourceIndex+=4,n=e;n;--n)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,dr}function as(t,e){var r=new Qi(t,e),n,a,i;do{switch(n=ts(r),a=Le(r,2,0),a){case 0:i=ns(r);break;case 1:i=Mn(r,Cn,En);break;case 2:rs(r,r.ltree,r.dtree),i=Mn(r,r.ltree,r.dtree);break;default:i=Tn}if(i!==dr)throw new Error("Data error")}while(!n);return r.destLen<r.dest.length?typeof r.dest.slice=="function"?r.dest.slice(0,r.destLen):r.dest.subarray(0,r.destLen):r.dest}es(Cn,En),Ln(gr,vr,4,3),Ln(Un,An,2,1),gr[28]=0,vr[28]=258;var is=as;function rt(t,e,r,n,a){return Math.pow(1-a,3)*t+3*Math.pow(1-a,2)*a*e+3*(1-a)*Math.pow(a,2)*r+Math.pow(a,3)*n}function Ge(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Ge.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Ge.prototype.addPoint=function(t,e){typeof t=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},Ge.prototype.addX=function(t){this.addPoint(t,null)},Ge.prototype.addY=function(t){this.addPoint(null,t)},Ge.prototype.addBezier=function(t,e,r,n,a,i,s,o){var c=[t,e],u=[r,n],h=[a,i],d=[s,o];this.addPoint(t,e),this.addPoint(s,o);for(var p=0;p<=1;p++){var g=6*c[p]-12*u[p]+6*h[p],x=-3*c[p]+9*u[p]-9*h[p]+3*d[p],v=3*u[p]-3*c[p];if(x===0){if(g===0)continue;var F=-v/g;0<F&&F<1&&(p===0&&this.addX(rt(c[p],u[p],h[p],d[p],F)),p===1&&this.addY(rt(c[p],u[p],h[p],d[p],F)));continue}var m=Math.pow(g,2)-4*v*x;if(!(m<0)){var S=(-g+Math.sqrt(m))/(2*x);0<S&&S<1&&(p===0&&this.addX(rt(c[p],u[p],h[p],d[p],S)),p===1&&this.addY(rt(c[p],u[p],h[p],d[p],S)));var w=(-g-Math.sqrt(m))/(2*x);0<w&&w<1&&(p===0&&this.addX(rt(c[p],u[p],h[p],d[p],w)),p===1&&this.addY(rt(c[p],u[p],h[p],d[p],w)))}}},Ge.prototype.addQuad=function(t,e,r,n,a,i){var s=t+.6666666666666666*(r-t),o=e+2/3*(n-e),c=s+1/3*(a-t),u=o+1/3*(i-e);this.addBezier(t,e,s,o,c,u,a,i)};function se(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}se.prototype.moveTo=function(t,e){this.commands.push({type:"M",x:t,y:e})},se.prototype.lineTo=function(t,e){this.commands.push({type:"L",x:t,y:e})},se.prototype.curveTo=se.prototype.bezierCurveTo=function(t,e,r,n,a,i){this.commands.push({type:"C",x1:t,y1:e,x2:r,y2:n,x:a,y:i})},se.prototype.quadTo=se.prototype.quadraticCurveTo=function(t,e,r,n){this.commands.push({type:"Q",x1:t,y1:e,x:r,y:n})},se.prototype.close=se.prototype.closePath=function(){this.commands.push({type:"Z"})},se.prototype.extend=function(t){if(t.commands)t=t.commands;else if(t instanceof Ge){var e=t;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,t)},se.prototype.getBoundingBox=function(){for(var t=new Ge,e=0,r=0,n=0,a=0,i=0;i<this.commands.length;i++){var s=this.commands[i];switch(s.type){case"M":t.addPoint(s.x,s.y),e=n=s.x,r=a=s.y;break;case"L":t.addPoint(s.x,s.y),n=s.x,a=s.y;break;case"Q":t.addQuad(n,a,s.x1,s.y1,s.x,s.y),n=s.x,a=s.y;break;case"C":t.addBezier(n,a,s.x1,s.y1,s.x2,s.y2,s.x,s.y),n=s.x,a=s.y;break;case"Z":n=e,a=r;break;default:throw new Error("Unexpected path command "+s.type)}}return t.isEmpty()&&t.addPoint(0,0),t},se.prototype.draw=function(t){t.beginPath();for(var e=0;e<this.commands.length;e+=1){var r=this.commands[e];r.type==="M"?t.moveTo(r.x,r.y):r.type==="L"?t.lineTo(r.x,r.y):r.type==="C"?t.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):r.type==="Q"?t.quadraticCurveTo(r.x1,r.y1,r.x,r.y):r.type==="Z"&&t.closePath()}this.fill&&(t.fillStyle=this.fill,t.fill()),this.stroke&&(t.strokeStyle=this.stroke,t.lineWidth=this.strokeWidth,t.stroke())},se.prototype.toPathData=function(t){t=t!==void 0?t:2;function e(s){return Math.round(s)===s?""+Math.round(s):s.toFixed(t)}function r(){for(var s=arguments,o="",c=0;c<arguments.length;c+=1){var u=s[c];u>=0&&c>0&&(o+=" "),o+=e(u)}return o}for(var n="",a=0;a<this.commands.length;a+=1){var i=this.commands[a];i.type==="M"?n+="M"+r(i.x,i.y):i.type==="L"?n+="L"+r(i.x,i.y):i.type==="C"?n+="C"+r(i.x1,i.y1,i.x2,i.y2,i.x,i.y):i.type==="Q"?n+="Q"+r(i.x1,i.y1,i.x,i.y):i.type==="Z"&&(n+="Z")}return n},se.prototype.toSVG=function(t){var e='<path d="';return e+=this.toPathData(t),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},se.prototype.toDOMElement=function(t){var e=this.toPathData(t),r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),r};function Rn(t){throw new Error(t)}function In(t,e){t||Rn(e)}var P={fail:Rn,argument:In,assert:In},Dn=32768,_n=2147483648,nt={},L={},G={};function Fe(t){return function(){return t}}L.BYTE=function(t){return P.argument(t>=0&&t<=255,"Byte value should be between 0 and 255."),[t]},G.BYTE=Fe(1),L.CHAR=function(t){return[t.charCodeAt(0)]},G.CHAR=Fe(1),L.CHARARRAY=function(t){typeof t>"u"&&(t="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],r=0;r<t.length;r+=1)e[r]=t.charCodeAt(r);return e},G.CHARARRAY=function(t){return typeof t>"u"?0:t.length},L.USHORT=function(t){return[t>>8&255,t&255]},G.USHORT=Fe(2),L.SHORT=function(t){return t>=Dn&&(t=-(2*Dn-t)),[t>>8&255,t&255]},G.SHORT=Fe(2),L.UINT24=function(t){return[t>>16&255,t>>8&255,t&255]},G.UINT24=Fe(3),L.ULONG=function(t){return[t>>24&255,t>>16&255,t>>8&255,t&255]},G.ULONG=Fe(4),L.LONG=function(t){return t>=_n&&(t=-(2*_n-t)),[t>>24&255,t>>16&255,t>>8&255,t&255]},G.LONG=Fe(4),L.FIXED=L.ULONG,G.FIXED=G.ULONG,L.FWORD=L.SHORT,G.FWORD=G.SHORT,L.UFWORD=L.USHORT,G.UFWORD=G.USHORT,L.LONGDATETIME=function(t){return[0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&255]},G.LONGDATETIME=Fe(8),L.TAG=function(t){return P.argument(t.length===4,"Tag should be exactly 4 ASCII characters."),[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]},G.TAG=Fe(4),L.Card8=L.BYTE,G.Card8=G.BYTE,L.Card16=L.USHORT,G.Card16=G.USHORT,L.OffSize=L.BYTE,G.OffSize=G.BYTE,L.SID=L.USHORT,G.SID=G.USHORT,L.NUMBER=function(t){return t>=-107&&t<=107?[t+139]:t>=108&&t<=1131?(t=t-108,[(t>>8)+247,t&255]):t>=-1131&&t<=-108?(t=-t-108,[(t>>8)+251,t&255]):t>=-32768&&t<=32767?L.NUMBER16(t):L.NUMBER32(t)},G.NUMBER=function(t){return L.NUMBER(t).length},L.NUMBER16=function(t){return[28,t>>8&255,t&255]},G.NUMBER16=Fe(3),L.NUMBER32=function(t){return[29,t>>24&255,t>>16&255,t>>8&255,t&255]},G.NUMBER32=Fe(5),L.REAL=function(t){var e=t.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(r){var n=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length));e=(Math.round(t*n)/n).toString()}for(var a="",i=0,s=e.length;i<s;i+=1){var o=e[i];o==="e"?a+=e[++i]==="-"?"c":"b":o==="."?a+="a":o==="-"?a+="e":a+=o}a+=a.length&1?"f":"ff";for(var c=[30],u=0,h=a.length;u<h;u+=2)c.push(parseInt(a.substr(u,2),16));return c},G.REAL=function(t){return L.REAL(t).length},L.NAME=L.CHARARRAY,G.NAME=G.CHARARRAY,L.STRING=L.CHARARRAY,G.STRING=G.CHARARRAY,nt.UTF8=function(t,e,r){for(var n=[],a=r,i=0;i<a;i++,e+=1)n[i]=t.getUint8(e);return String.fromCharCode.apply(null,n)},nt.UTF16=function(t,e,r){for(var n=[],a=r/2,i=0;i<a;i++,e+=2)n[i]=t.getUint16(e);return String.fromCharCode.apply(null,n)},L.UTF16=function(t){for(var e=[],r=0;r<t.length;r+=1){var n=t.charCodeAt(r);e[e.length]=n>>8&255,e[e.length]=n&255}return e},G.UTF16=function(t){return t.length*2};var br={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};nt.MACSTRING=function(t,e,r,n){var a=br[n];if(a!==void 0){for(var i="",s=0;s<r;s++){var o=t.getUint8(e+s);o<=127?i+=String.fromCharCode(o):i+=a[o&127]}return i}};var Mt=typeof WeakMap=="function"&&new WeakMap,Rt,ss=function(t){if(!Rt){Rt={};for(var e in br)Rt[e]=new String(e)}var r=Rt[t];if(r!==void 0){if(Mt){var n=Mt.get(r);if(n!==void 0)return n}var a=br[t];if(a!==void 0){for(var i={},s=0;s<a.length;s++)i[a.charCodeAt(s)]=s+128;return Mt&&Mt.set(r,i),i}}};L.MACSTRING=function(t,e){var r=ss(e);if(r!==void 0){for(var n=[],a=0;a<t.length;a++){var i=t.charCodeAt(a);if(i>=128&&(i=r[i],i===void 0))return;n[a]=i}return n}},G.MACSTRING=function(t,e){var r=L.MACSTRING(t,e);return r!==void 0?r.length:0};function xr(t){return t>=-128&&t<=127}function os(t,e,r){for(var n=0,a=t.length;e<a&&n<64&&t[e]===0;)++e,++n;return r.push(128|n-1),e}function cs(t,e,r){for(var n=0,a=t.length,i=e;i<a&&n<64;){var s=t[i];if(!xr(s)||s===0&&i+1<a&&t[i+1]===0)break;++i,++n}r.push(n-1);for(var o=e;o<i;++o)r.push(t[o]+256&255);return i}function us(t,e,r){for(var n=0,a=t.length,i=e;i<a&&n<64;){var s=t[i];if(s===0||xr(s)&&i+1<a&&xr(t[i+1]))break;++i,++n}r.push(64|n-1);for(var o=e;o<i;++o){var c=t[o];r.push(c+65536>>8&255,c+256&255)}return i}L.VARDELTAS=function(t){for(var e=0,r=[];e<t.length;){var n=t[e];n===0?e=os(t,e,r):n>=-128&&n<=127?e=cs(t,e,r):e=us(t,e,r)}return r},L.INDEX=function(t){for(var e=1,r=[e],n=[],a=0;a<t.length;a+=1){var i=L.OBJECT(t[a]);Array.prototype.push.apply(n,i),e+=i.length,r.push(e)}if(n.length===0)return[0,0];for(var s=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,c=[void 0,L.BYTE,L.USHORT,L.UINT24,L.ULONG][o],u=0;u<r.length;u+=1){var h=c(r[u]);Array.prototype.push.apply(s,h)}return Array.prototype.concat(L.Card16(t.length),L.OffSize(o),s,n)},G.INDEX=function(t){return L.INDEX(t).length},L.DICT=function(t){for(var e=[],r=Object.keys(t),n=r.length,a=0;a<n;a+=1){var i=parseInt(r[a],0),s=t[i];e=e.concat(L.OPERAND(s.value,s.type)),e=e.concat(L.OPERATOR(i))}return e},G.DICT=function(t){return L.DICT(t).length},L.OPERATOR=function(t){return t<1200?[t]:[12,t-1200]},L.OPERAND=function(t,e){var r=[];if(Array.isArray(e))for(var n=0;n<e.length;n+=1)P.argument(t.length===e.length,"Not enough arguments given for type"+e),r=r.concat(L.OPERAND(t[n],e[n]));else if(e==="SID")r=r.concat(L.NUMBER(t));else if(e==="offset")r=r.concat(L.NUMBER32(t));else if(e==="number")r=r.concat(L.NUMBER(t));else if(e==="real")r=r.concat(L.REAL(t));else throw new Error("Unknown operand type "+e);return r},L.OP=L.BYTE,G.OP=G.BYTE;var It=typeof WeakMap=="function"&&new WeakMap;L.CHARSTRING=function(t){if(It){var e=It.get(t);if(e!==void 0)return e}for(var r=[],n=t.length,a=0;a<n;a+=1){var i=t[a];r=r.concat(L[i.type](i.value))}return It&&It.set(t,r),r},G.CHARSTRING=function(t){return L.CHARSTRING(t).length},L.OBJECT=function(t){var e=L[t.type];return P.argument(e!==void 0,"No encoding function for type "+t.type),e(t.value)},G.OBJECT=function(t){var e=G[t.type];return P.argument(e!==void 0,"No sizeOf function for type "+t.type),e(t.value)},L.TABLE=function(t){for(var e=[],r=t.fields.length,n=[],a=[],i=0;i<r;i+=1){var s=t.fields[i],o=L[s.type];P.argument(o!==void 0,"No encoding function for field type "+s.type+" ("+s.name+")");var c=t[s.name];c===void 0&&(c=s.value);var u=o(c);s.type==="TABLE"?(a.push(e.length),e=e.concat([0,0]),n.push(u)):e=e.concat(u)}for(var h=0;h<n.length;h+=1){var d=a[h],p=e.length;P.argument(p<65536,"Table "+t.tableName+" too big."),e[d]=p>>8,e[d+1]=p&255,e=e.concat(n[h])}return e},G.TABLE=function(t){for(var e=0,r=t.fields.length,n=0;n<r;n+=1){var a=t.fields[n],i=G[a.type];P.argument(i!==void 0,"No sizeOf function for field type "+a.type+" ("+a.name+")");var s=t[a.name];s===void 0&&(s=a.value),e+=i(s),a.type==="TABLE"&&(e+=2)}return e},L.RECORD=L.TABLE,G.RECORD=G.TABLE,L.LITERAL=function(t){return t},G.LITERAL=function(t){return t.length};function ue(t,e,r){if(e.length&&(e[0].name!=="coverageFormat"||e[0].value===1))for(var n=0;n<e.length;n+=1){var a=e[n];this[a.name]=a.value}if(this.tableName=t,this.fields=e,r)for(var i=Object.keys(r),s=0;s<i.length;s+=1){var o=i[s],c=r[o];this[o]!==void 0&&(this[o]=c)}}ue.prototype.encode=function(){return L.TABLE(this)},ue.prototype.sizeOf=function(){return G.TABLE(this)};function gt(t,e,r){r===void 0&&(r=e.length);var n=new Array(e.length+1);n[0]={name:t+"Count",type:"USHORT",value:r};for(var a=0;a<e.length;a++)n[a+1]={name:t+a,type:"USHORT",value:e[a]};return n}function Sr(t,e,r){var n=e.length,a=new Array(n+1);a[0]={name:t+"Count",type:"USHORT",value:n};for(var i=0;i<n;i++)a[i+1]={name:t+i,type:"TABLE",value:r(e[i],i)};return a}function vt(t,e,r){var n=e.length,a=[];a[0]={name:t+"Count",type:"USHORT",value:n};for(var i=0;i<n;i++)a=a.concat(r(e[i],i));return a}function Dt(t){t.format===1?ue.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(gt("glyph",t.glyphs))):t.format===2?ue.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(vt("rangeRecord",t.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):P.assert(!1,"Coverage format must be 1 or 2.")}Dt.prototype=Object.create(ue.prototype),Dt.prototype.constructor=Dt;function _t(t){ue.call(this,"scriptListTable",vt("scriptRecord",t,function(e,r){var n=e.script,a=n.defaultLangSys;return P.assert(!!a,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+r,type:"TAG",value:e.tag},{name:"script"+r,type:"TABLE",value:new ue("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new ue("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat(gt("featureIndex",a.featureIndexes)))}].concat(vt("langSys",n.langSysRecords,function(i,s){var o=i.langSys;return[{name:"langSysTag"+s,type:"TAG",value:i.tag},{name:"langSys"+s,type:"TABLE",value:new ue("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(gt("featureIndex",o.featureIndexes)))}]})))}]}))}_t.prototype=Object.create(ue.prototype),_t.prototype.constructor=_t;function Pt(t){ue.call(this,"featureListTable",vt("featureRecord",t,function(e,r){var n=e.feature;return[{name:"featureTag"+r,type:"TAG",value:e.tag},{name:"feature"+r,type:"TABLE",value:new ue("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(gt("lookupListIndex",n.lookupListIndexes)))}]}))}Pt.prototype=Object.create(ue.prototype),Pt.prototype.constructor=Pt;function Nt(t,e){ue.call(this,"lookupListTable",Sr("lookup",t,function(r){var n=e[r.lookupType];return P.assert(!!n,"Unable to write GSUB lookup type "+r.lookupType+" tables."),new ue("lookupTable",[{name:"lookupType",type:"USHORT",value:r.lookupType},{name:"lookupFlag",type:"USHORT",value:r.lookupFlag}].concat(Sr("subtable",r.subtables,n)))}))}Nt.prototype=Object.create(ue.prototype),Nt.prototype.constructor=Nt;var I={Table:ue,Record:ue,Coverage:Dt,ScriptList:_t,FeatureList:Pt,LookupList:Nt,ushortList:gt,tableList:Sr,recordList:vt};function Pn(t,e){return t.getUint8(e)}function Gt(t,e){return t.getUint16(e,!1)}function hs(t,e){return t.getInt16(e,!1)}function wr(t,e){return t.getUint32(e,!1)}function Nn(t,e){var r=t.getInt16(e,!1),n=t.getUint16(e+2,!1);return r+n/65535}function ls(t,e){for(var r="",n=e;n<e+4;n+=1)r+=String.fromCharCode(t.getInt8(n));return r}function fs(t,e,r){for(var n=0,a=0;a<r;a+=1)n<<=8,n+=t.getUint8(e+a);return n}function ps(t,e,r){for(var n=[],a=e;a<r;a+=1)n.push(t.getUint8(a));return n}function ds(t){for(var e="",r=0;r<t.length;r+=1)e+=String.fromCharCode(t[r]);return e}var gs={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function E(t,e){this.data=t,this.offset=e,this.relativeOffset=0}E.prototype.parseByte=function(){var t=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},E.prototype.parseChar=function(){var t=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},E.prototype.parseCard8=E.prototype.parseByte,E.prototype.parseUShort=function(){var t=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},E.prototype.parseCard16=E.prototype.parseUShort,E.prototype.parseSID=E.prototype.parseUShort,E.prototype.parseOffset16=E.prototype.parseUShort,E.prototype.parseShort=function(){var t=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},E.prototype.parseF2Dot14=function(){var t=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,t},E.prototype.parseULong=function(){var t=wr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},E.prototype.parseOffset32=E.prototype.parseULong,E.prototype.parseFixed=function(){var t=Nn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},E.prototype.parseString=function(t){var e=this.data,r=this.offset+this.relativeOffset,n="";this.relativeOffset+=t;for(var a=0;a<t;a++)n+=String.fromCharCode(e.getUint8(r+a));return n},E.prototype.parseTag=function(){return this.parseString(4)},E.prototype.parseLongDateTime=function(){var t=wr(this.data,this.offset+this.relativeOffset+4);return t-=2082844800,this.relativeOffset+=8,t},E.prototype.parseVersion=function(t){var e=Gt(this.data,this.offset+this.relativeOffset),r=Gt(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,t===void 0&&(t=4096),e+r/t/10},E.prototype.skip=function(t,e){e===void 0&&(e=1),this.relativeOffset+=gs[t]*e},E.prototype.parseULongList=function(t){t===void 0&&(t=this.parseULong());for(var e=new Array(t),r=this.data,n=this.offset+this.relativeOffset,a=0;a<t;a++)e[a]=r.getUint32(n),n+=4;return this.relativeOffset+=t*4,e},E.prototype.parseOffset16List=E.prototype.parseUShortList=function(t){t===void 0&&(t=this.parseUShort());for(var e=new Array(t),r=this.data,n=this.offset+this.relativeOffset,a=0;a<t;a++)e[a]=r.getUint16(n),n+=2;return this.relativeOffset+=t*2,e},E.prototype.parseShortList=function(t){for(var e=new Array(t),r=this.data,n=this.offset+this.relativeOffset,a=0;a<t;a++)e[a]=r.getInt16(n),n+=2;return this.relativeOffset+=t*2,e},E.prototype.parseByteList=function(t){for(var e=new Array(t),r=this.data,n=this.offset+this.relativeOffset,a=0;a<t;a++)e[a]=r.getUint8(n++);return this.relativeOffset+=t,e},E.prototype.parseList=function(t,e){e||(e=t,t=this.parseUShort());for(var r=new Array(t),n=0;n<t;n++)r[n]=e.call(this);return r},E.prototype.parseList32=function(t,e){e||(e=t,t=this.parseULong());for(var r=new Array(t),n=0;n<t;n++)r[n]=e.call(this);return r},E.prototype.parseRecordList=function(t,e){e||(e=t,t=this.parseUShort());for(var r=new Array(t),n=Object.keys(e),a=0;a<t;a++){for(var i={},s=0;s<n.length;s++){var o=n[s],c=e[o];i[o]=c.call(this)}r[a]=i}return r},E.prototype.parseRecordList32=function(t,e){e||(e=t,t=this.parseULong());for(var r=new Array(t),n=Object.keys(e),a=0;a<t;a++){for(var i={},s=0;s<n.length;s++){var o=n[s],c=e[o];i[o]=c.call(this)}r[a]=i}return r},E.prototype.parseStruct=function(t){if(typeof t=="function")return t.call(this);for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var a=e[n],i=t[a];r[a]=i.call(this)}return r},E.prototype.parseValueRecord=function(t){if(t===void 0&&(t=this.parseUShort()),t!==0){var e={};return t&1&&(e.xPlacement=this.parseShort()),t&2&&(e.yPlacement=this.parseShort()),t&4&&(e.xAdvance=this.parseShort()),t&8&&(e.yAdvance=this.parseShort()),t&16&&(e.xPlaDevice=void 0,this.parseShort()),t&32&&(e.yPlaDevice=void 0,this.parseShort()),t&64&&(e.xAdvDevice=void 0,this.parseShort()),t&128&&(e.yAdvDevice=void 0,this.parseShort()),e}},E.prototype.parseValueRecordList=function(){for(var t=this.parseUShort(),e=this.parseUShort(),r=new Array(e),n=0;n<e;n++)r[n]=this.parseValueRecord(t);return r},E.prototype.parsePointer=function(t){var e=this.parseOffset16();if(e>0)return new E(this.data,this.offset+e).parseStruct(t)},E.prototype.parsePointer32=function(t){var e=this.parseOffset32();if(e>0)return new E(this.data,this.offset+e).parseStruct(t)},E.prototype.parseListOfLists=function(t){for(var e=this.parseOffset16List(),r=e.length,n=this.relativeOffset,a=new Array(r),i=0;i<r;i++){var s=e[i];if(s===0){a[i]=void 0;continue}if(this.relativeOffset=s,t){for(var o=this.parseOffset16List(),c=new Array(o.length),u=0;u<o.length;u++)this.relativeOffset=s+o[u],c[u]=t.call(this);a[i]=c}else a[i]=this.parseUShortList()}return this.relativeOffset=n,a},E.prototype.parseCoverage=function(){var t=this.offset+this.relativeOffset,e=this.parseUShort(),r=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(r)};if(e===2){for(var n=new Array(r),a=0;a<r;a++)n[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:n}}throw new Error("0x"+t.toString(16)+": Coverage format must be 1 or 2.")},E.prototype.parseClassDef=function(){var t=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:E.uShort,end:E.uShort,classId:E.uShort})};throw new Error("0x"+t.toString(16)+": ClassDef format must be 1 or 2.")},E.list=function(t,e){return function(){return this.parseList(t,e)}},E.list32=function(t,e){return function(){return this.parseList32(t,e)}},E.recordList=function(t,e){return function(){return this.parseRecordList(t,e)}},E.recordList32=function(t,e){return function(){return this.parseRecordList32(t,e)}},E.pointer=function(t){return function(){return this.parsePointer(t)}},E.pointer32=function(t){return function(){return this.parsePointer32(t)}},E.tag=E.prototype.parseTag,E.byte=E.prototype.parseByte,E.uShort=E.offset16=E.prototype.parseUShort,E.uShortList=E.prototype.parseUShortList,E.uLong=E.offset32=E.prototype.parseULong,E.uLongList=E.prototype.parseULongList,E.struct=E.prototype.parseStruct,E.coverage=E.prototype.parseCoverage,E.classDef=E.prototype.parseClassDef;var Gn={reserved:E.uShort,reqFeatureIndex:E.uShort,featureIndexes:E.uShortList};E.prototype.parseScriptList=function(){return this.parsePointer(E.recordList({tag:E.tag,script:E.pointer({defaultLangSys:E.pointer(Gn),langSysRecords:E.recordList({tag:E.tag,langSys:E.pointer(Gn)})})}))||[]},E.prototype.parseFeatureList=function(){return this.parsePointer(E.recordList({tag:E.tag,feature:E.pointer({featureParams:E.offset16,lookupListIndexes:E.uShortList})}))||[]},E.prototype.parseLookupList=function(t){return this.parsePointer(E.list(E.pointer(function(){var e=this.parseUShort();P.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");var r=this.parseUShort(),n=r&16;return{lookupType:e,lookupFlag:r,subtables:this.parseList(E.pointer(t[e])),markFilteringSet:n?this.parseUShort():void 0}})))||[]},E.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var t=this.parseUShort(),e=this.parseUShort();P.argument(t===1&&e<1,"GPOS/GSUB feature variations table unknown.");var r=this.parseRecordList32({conditionSetOffset:E.offset32,featureTableSubstitutionOffset:E.offset32});return r})||[]};var _={getByte:Pn,getCard8:Pn,getUShort:Gt,getCard16:Gt,getShort:hs,getULong:wr,getFixed:Nn,getTag:ls,getOffset:fs,getBytes:ps,bytesToString:ds,Parser:E};function vs(t,e){e.parseUShort(),t.length=e.parseULong(),t.language=e.parseULong();var r;t.groupCount=r=e.parseULong(),t.glyphIndexMap={};for(var n=0;n<r;n+=1)for(var a=e.parseULong(),i=e.parseULong(),s=e.parseULong(),o=a;o<=i;o+=1)t.glyphIndexMap[o]=s,s++}function ys(t,e,r,n,a){t.length=e.parseUShort(),t.language=e.parseUShort();var i;t.segCount=i=e.parseUShort()>>1,e.skip("uShort",3),t.glyphIndexMap={};for(var s=new _.Parser(r,n+a+14),o=new _.Parser(r,n+a+16+i*2),c=new _.Parser(r,n+a+16+i*4),u=new _.Parser(r,n+a+16+i*6),h=n+a+16+i*8,d=0;d<i-1;d+=1)for(var p=void 0,g=s.parseUShort(),x=o.parseUShort(),v=c.parseShort(),F=u.parseUShort(),m=x;m<=g;m+=1)F!==0?(h=u.offset+u.relativeOffset-2,h+=F,h+=(m-x)*2,p=_.getUShort(r,h),p!==0&&(p=p+v&65535)):p=m+v&65535,t.glyphIndexMap[m]=p}function ms(t,e){var r={};r.version=_.getUShort(t,e),P.argument(r.version===0,"cmap table version should be 0."),r.numTables=_.getUShort(t,e+2);for(var n=-1,a=r.numTables-1;a>=0;a-=1){var i=_.getUShort(t,e+4+a*8),s=_.getUShort(t,e+4+a*8+2);if(i===3&&(s===0||s===1||s===10)||i===0&&(s===0||s===1||s===2||s===3||s===4)){n=_.getULong(t,e+4+a*8+4);break}}if(n===-1)throw new Error("No valid cmap sub-tables found.");var o=new _.Parser(t,e+n);if(r.format=o.parseUShort(),r.format===12)vs(r,o);else if(r.format===4)ys(r,o,t,e,n);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+r.format+").");return r}function bs(t,e,r){t.segments.push({end:e,start:e,delta:-(e-r),offset:0,glyphIndex:r})}function xs(t){t.segments.push({end:65535,start:65535,delta:1,offset:0})}function Ss(t){var e=!0,r;for(r=t.length-1;r>0;r-=1){var n=t.get(r);if(n.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var a=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(a=a.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),a=a.concat([{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}]);var i=new I.Table("cmap",a);for(i.segments=[],r=0;r<t.length;r+=1){for(var s=t.get(r),o=0;o<s.unicodes.length;o+=1)bs(i,s.unicodes[o],r);i.segments=i.segments.sort(function(S,w){return S.start-w.start})}xs(i);var c=i.segments.length,u=0,h=[],d=[],p=[],g=[],x=[],v=[];for(r=0;r<c;r+=1){var F=i.segments[r];F.end<=65535&&F.start<=65535?(h=h.concat({name:"end_"+r,type:"USHORT",value:F.end}),d=d.concat({name:"start_"+r,type:"USHORT",value:F.start}),p=p.concat({name:"idDelta_"+r,type:"SHORT",value:F.delta}),g=g.concat({name:"idRangeOffset_"+r,type:"USHORT",value:F.offset}),F.glyphId!==void 0&&(x=x.concat({name:"glyph_"+r,type:"USHORT",value:F.glyphId}))):u+=1,!e&&F.glyphIndex!==void 0&&(v=v.concat({name:"cmap12Start_"+r,type:"ULONG",value:F.start}),v=v.concat({name:"cmap12End_"+r,type:"ULONG",value:F.end}),v=v.concat({name:"cmap12Glyph_"+r,type:"ULONG",value:F.glyphIndex}))}if(i.segCountX2=(c-u)*2,i.searchRange=Math.pow(2,Math.floor(Math.log(c-u)/Math.log(2)))*2,i.entrySelector=Math.log(i.searchRange/2)/Math.log(2),i.rangeShift=i.segCountX2-i.searchRange,i.fields=i.fields.concat(h),i.fields.push({name:"reservedPad",type:"USHORT",value:0}),i.fields=i.fields.concat(d),i.fields=i.fields.concat(p),i.fields=i.fields.concat(g),i.fields=i.fields.concat(x),i.cmap4Length=14+h.length*2+2+d.length*2+p.length*2+g.length*2+x.length*2,!e){var m=16+v.length*4;i.cmap12Offset=12+2*2+4+i.cmap4Length,i.fields=i.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:m},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:v.length/3}]),i.fields=i.fields.concat(v)}return i}var Hn={parse:ms,make:Ss},Ht=[".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"],ws=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Fs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ke=[".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 zn(t){this.font=t}zn.prototype.charToGlyphIndex=function(t){var e=t.codePointAt(0),r=this.font.glyphs;if(r){for(var n=0;n<r.length;n+=1)for(var a=r.get(n),i=0;i<a.unicodes.length;i+=1)if(a.unicodes[i]===e)return n}return null};function Wn(t){this.cmap=t}Wn.prototype.charToGlyphIndex=function(t){return this.cmap.glyphIndexMap[t.codePointAt(0)]||0};function zt(t,e){this.encoding=t,this.charset=e}zt.prototype.charToGlyphIndex=function(t){var e=t.codePointAt(0),r=this.encoding[e];return this.charset.indexOf(r)};function Fr(t){switch(t.version){case 1:this.names=Ke.slice();break;case 2:this.names=new Array(t.numberOfGlyphs);for(var e=0;e<t.numberOfGlyphs;e++)t.glyphNameIndex[e]<Ke.length?this.names[e]=Ke[t.glyphNameIndex[e]]:this.names[e]=t.names[t.glyphNameIndex[e]-Ke.length];break;case 2.5:this.names=new Array(t.numberOfGlyphs);for(var r=0;r<t.numberOfGlyphs;r++)this.names[r]=Ke[r+t.glyphNameIndex[r]];break;case 3:this.names=[];break;default:this.names=[];break}}Fr.prototype.nameToGlyphIndex=function(t){return this.names.indexOf(t)},Fr.prototype.glyphIndexToName=function(t){return this.names[t]};function ks(t){for(var e,r=t.tables.cmap.glyphIndexMap,n=Object.keys(r),a=0;a<n.length;a+=1){var i=n[a],s=r[i];e=t.glyphs.get(s),e.addUnicode(parseInt(i))}for(var o=0;o<t.glyphs.length;o+=1)e=t.glyphs.get(o),t.cffEncoding?t.isCIDFont?e.name="gid"+o:e.name=t.cffEncoding.charset[o]:t.glyphNames.names&&(e.name=t.glyphNames.glyphIndexToName(o))}function Ts(t){t._IndexToUnicodeMap={};for(var e=t.tables.cmap.glyphIndexMap,r=Object.keys(e),n=0;n<r.length;n+=1){var a=r[n],i=e[a];t._IndexToUnicodeMap[i]===void 0?t._IndexToUnicodeMap[i]={unicodes:[parseInt(a)]}:t._IndexToUnicodeMap[i].unicodes.push(parseInt(a))}}function Cs(t,e){e.lowMemory?Ts(t):ks(t)}function Es(t,e,r,n,a){t.beginPath(),t.moveTo(e,r),t.lineTo(n,a),t.stroke()}var Qe={line:Es};function Us(t,e){var r=e||new se;return{configurable:!0,get:function(){return typeof r=="function"&&(r=r()),r},set:function(n){r=n}}}function me(t){this.bindConstructorValues(t)}me.prototype.bindConstructorValues=function(t){this.index=t.index||0,this.name=t.name||null,this.unicode=t.unicode||void 0,this.unicodes=t.unicodes||t.unicode!==void 0?[t.unicode]:[],"xMin"in t&&(this.xMin=t.xMin),"yMin"in t&&(this.yMin=t.yMin),"xMax"in t&&(this.xMax=t.xMax),"yMax"in t&&(this.yMax=t.yMax),"advanceWidth"in t&&(this.advanceWidth=t.advanceWidth),Object.defineProperty(this,"path",Us(this,t.path))},me.prototype.addUnicode=function(t){this.unicodes.length===0&&(this.unicode=t),this.unicodes.push(t)},me.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},me.prototype.getPath=function(t,e,r,n,a){t=t!==void 0?t:0,e=e!==void 0?e:0,r=r!==void 0?r:72;var i,s;n||(n={});var o=n.xScale,c=n.yScale;if(n.hinting&&a&&a.hinting&&(s=this.path&&a.hinting.exec(this,r)),s)i=a.hinting.getCommands(s),t=Math.round(t),e=Math.round(e),o=c=1;else{i=this.path.commands;var u=1/(this.path.unitsPerEm||1e3)*r;o===void 0&&(o=u),c===void 0&&(c=u)}for(var h=new se,d=0;d<i.length;d+=1){var p=i[d];p.type==="M"?h.moveTo(t+p.x*o,e+-p.y*c):p.type==="L"?h.lineTo(t+p.x*o,e+-p.y*c):p.type==="Q"?h.quadraticCurveTo(t+p.x1*o,e+-p.y1*c,t+p.x*o,e+-p.y*c):p.type==="C"?h.curveTo(t+p.x1*o,e+-p.y1*c,t+p.x2*o,e+-p.y2*c,t+p.x*o,e+-p.y*c):p.type==="Z"&&h.closePath()}return h},me.prototype.getContours=function(){if(this.points===void 0)return[];for(var t=[],e=[],r=0;r<this.points.length;r+=1){var n=this.points[r];e.push(n),n.lastPointOfContour&&(t.push(e),e=[])}return P.argument(e.length===0,"There are still points left in the current contour."),t},me.prototype.getMetrics=function(){for(var t=this.path.commands,e=[],r=[],n=0;n<t.length;n+=1){var a=t[n];a.type!=="Z"&&(e.push(a.x),r.push(a.y)),(a.type==="Q"||a.type==="C")&&(e.push(a.x1),r.push(a.y1)),a.type==="C"&&(e.push(a.x2),r.push(a.y2))}var i={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,r),leftSideBearing:this.leftSideBearing};return isFinite(i.xMin)||(i.xMin=0),isFinite(i.xMax)||(i.xMax=this.advanceWidth),isFinite(i.yMin)||(i.yMin=0),isFinite(i.yMax)||(i.yMax=0),i.rightSideBearing=this.advanceWidth-i.leftSideBearing-(i.xMax-i.xMin),i},me.prototype.draw=function(t,e,r,n,a){this.getPath(e,r,n,a).draw(t)},me.prototype.drawPoints=function(t,e,r,n){function a(d,p,g,x){t.beginPath();for(var v=0;v<d.length;v+=1)t.moveTo(p+d[v].x*x,g+d[v].y*x),t.arc(p+d[v].x*x,g+d[v].y*x,2,0,Math.PI*2,!1);t.closePath(),t.fill()}e=e!==void 0?e:0,r=r!==void 0?r:0,n=n!==void 0?n:24;for(var i=1/this.path.unitsPerEm*n,s=[],o=[],c=this.path,u=0;u<c.commands.length;u+=1){var h=c.commands[u];h.x!==void 0&&s.push({x:h.x,y:-h.y}),h.x1!==void 0&&o.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&o.push({x:h.x2,y:-h.y2})}t.fillStyle="blue",a(s,e,r,i),t.fillStyle="red",a(o,e,r,i)},me.prototype.drawMetrics=function(t,e,r,n){var a;e=e!==void 0?e:0,r=r!==void 0?r:0,n=n!==void 0?n:24,a=1/this.path.unitsPerEm*n,t.lineWidth=1,t.strokeStyle="black",Qe.line(t,e,-1e4,e,1e4),Qe.line(t,-1e4,r,1e4,r);var i=this.xMin||0,s=this.yMin||0,o=this.xMax||0,c=this.yMax||0,u=this.advanceWidth||0;t.strokeStyle="blue",Qe.line(t,e+i*a,-1e4,e+i*a,1e4),Qe.line(t,e+o*a,-1e4,e+o*a,1e4),Qe.line(t,-1e4,r+-s*a,1e4,r+-s*a),Qe.line(t,-1e4,r+-c*a,1e4,r+-c*a),t.strokeStyle="green",Qe.line(t,e+u*a,-1e4,e+u*a,1e4)};function Wt(t,e,r){Object.defineProperty(t,e,{get:function(){return t.path,t[r]},set:function(n){t[r]=n},enumerable:!0,configurable:!0})}function kr(t,e){if(this.font=t,this.glyphs={},Array.isArray(e))for(var r=0;r<e.length;r++){var n=e[r];n.path.unitsPerEm=t.unitsPerEm,this.glyphs[r]=n}this.length=e&&e.length||0}kr.prototype.get=function(t){if(this.glyphs[t]===void 0){this.font._push(t),typeof this.glyphs[t]=="function"&&(this.glyphs[t]=this.glyphs[t]());var e=this.glyphs[t],r=this.font._IndexToUnicodeMap[t];if(r)for(var n=0;n<r.unicodes.length;n++)e.addUnicode(r.unicodes[n]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+t:e.name=this.font.cffEncoding.charset[t]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(t)),this.glyphs[t].advanceWidth=this.font._hmtxTableData[t].advanceWidth,this.glyphs[t].leftSideBearing=this.font._hmtxTableData[t].leftSideBearing}else typeof this.glyphs[t]=="function"&&(this.glyphs[t]=this.glyphs[t]());return this.glyphs[t]},kr.prototype.push=function(t,e){this.glyphs[t]=e,this.length++};function As(t,e){return new me({index:e,font:t})}function Bs(t,e,r,n,a,i){return function(){var s=new me({index:e,font:t});return s.path=function(){r(s,n,a);var o=i(t.glyphs,s);return o.unitsPerEm=t.unitsPerEm,o},Wt(s,"xMin","_xMin"),Wt(s,"xMax","_xMax"),Wt(s,"yMin","_yMin"),Wt(s,"yMax","_yMax"),s}}function Ls(t,e,r,n){return function(){var a=new me({index:e,font:t});return a.path=function(){var i=r(t,a,n);return i.unitsPerEm=t.unitsPerEm,i},a}}var Oe={GlyphSet:kr,glyphLoader:As,ttfGlyphLoader:Bs,cffGlyphLoader:Ls};function qn(t,e){if(t===e)return!0;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r+=1)if(!qn(t[r],e[r]))return!1;return!0}else return!1}function Tr(t){var e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}function He(t,e,r){var n=[],a=[],i=_.getCard16(t,e),s,o;if(i!==0){var c=_.getByte(t,e+2);s=e+(i+1)*c+2;for(var u=e+3,h=0;h<i+1;h+=1)n.push(_.getOffset(t,u,c)),u+=c;o=s+n[i]}else o=e+2;for(var d=0;d<n.length-1;d+=1){var p=_.getBytes(t,s+n[d],s+n[d+1]);r&&(p=r(p)),a.push(p)}return{objects:a,startOffset:e,endOffset:o}}function Os(t,e){var r=[],n=_.getCard16(t,e),a,i;if(n!==0){var s=_.getByte(t,e+2);a=e+(n+1)*s+2;for(var o=e+3,c=0;c<n+1;c+=1)r.push(_.getOffset(t,o,s)),o+=s;i=a+r[n]}else i=e+2;return{offsets:r,startOffset:e,endOffset:i}}function Ms(t,e,r,n,a){var i=_.getCard16(r,n),s=0;if(i!==0){var o=_.getByte(r,n+2);s=n+(i+1)*o+2}var c=_.getBytes(r,s+e[t],s+e[t+1]);return c}function Rs(t){for(var e="",r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var a=t.parseByte(),i=a>>4,s=a&15;if(i===r||(e+=n[i],s===r))break;e+=n[s]}return parseFloat(e)}function Is(t,e){var r,n,a,i;if(e===28)return r=t.parseByte(),n=t.parseByte(),r<<8|n;if(e===29)return r=t.parseByte(),n=t.parseByte(),a=t.parseByte(),i=t.parseByte(),r<<24|n<<16|a<<8|i;if(e===30)return Rs(t);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return r=t.parseByte(),(e-247)*256+r+108;if(e>=251&&e<=254)return r=t.parseByte(),-(e-251)*256-r-108;throw new Error("Invalid b0 "+e)}function Ds(t){for(var e={},r=0;r<t.length;r+=1){var n=t[r][0],a=t[r][1],i=void 0;if(a.length===1?i=a[0]:i=a,e.hasOwnProperty(n)&&!isNaN(e[n]))throw new Error("Object "+e+" already has key "+n);e[n]=i}return e}function Vn(t,e,r){e=e!==void 0?e:0;var n=new _.Parser(t,e),a=[],i=[];for(r=r!==void 0?r:t.length;n.relativeOffset<r;){var s=n.parseByte();s<=21?(s===12&&(s=1200+n.parseByte()),a.push([s,i]),i=[]):i.push(Is(n,s))}return Ds(a)}function yt(t,e){return e<=390?e=Ht[e]:e=t[e-391],e}function Xn(t,e,r){for(var n={},a,i=0;i<e.length;i+=1){var s=e[i];if(Array.isArray(s.type)){var o=[];o.length=s.type.length;for(var c=0;c<s.type.length;c++)a=t[s.op]!==void 0?t[s.op][c]:void 0,a===void 0&&(a=s.value!==void 0&&s.value[c]!==void 0?s.value[c]:null),s.type[c]==="SID"&&(a=yt(r,a)),o[c]=a;n[s.name]=o}else a=t[s.op],a===void 0&&(a=s.value!==void 0?s.value:null),s.type==="SID"&&(a=yt(r,a)),n[s.name]=a}return n}function _s(t,e){var r={};return r.formatMajor=_.getCard8(t,e),r.formatMinor=_.getCard8(t,e+1),r.size=_.getCard8(t,e+2),r.offsetSize=_.getCard8(t,e+3),r.startOffset=e,r.endOffset=e+4,r}var jn=[{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"}],Yn=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Ps(t,e){var r=Vn(t,0,t.byteLength);return Xn(r,jn,e)}function Zn(t,e,r,n){var a=Vn(t,e,r);return Xn(a,Yn,n)}function $n(t,e,r,n){for(var a=[],i=0;i<r.length;i+=1){var s=new DataView(new Uint8Array(r[i]).buffer),o=Ps(s,n);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var c=o.private[0],u=o.private[1];if(c!==0&&u!==0){var h=Zn(t,u+e,c,n);if(o._defaultWidthX=h.defaultWidthX,o._nominalWidthX=h.nominalWidthX,h.subrs!==0){var d=u+h.subrs,p=He(t,d+e);o._subrs=p.objects,o._subrsBias=Tr(o._subrs)}o._privateDict=h}a.push(o)}return a}function Ns(t,e,r,n){var a,i,s=new _.Parser(t,e);r-=1;var o=[".notdef"],c=s.parseCard8();if(c===0)for(var u=0;u<r;u+=1)a=s.parseSID(),o.push(yt(n,a));else if(c===1)for(;o.length<=r;){a=s.parseSID(),i=s.parseCard8();for(var h=0;h<=i;h+=1)o.push(yt(n,a)),a+=1}else if(c===2)for(;o.length<=r;){a=s.parseSID(),i=s.parseCard16();for(var d=0;d<=i;d+=1)o.push(yt(n,a)),a+=1}else throw new Error("Unknown charset format "+c);return o}function Gs(t,e,r){var n,a={},i=new _.Parser(t,e),s=i.parseCard8();if(s===0)for(var o=i.parseCard8(),c=0;c<o;c+=1)n=i.parseCard8(),a[n]=c;else if(s===1){var u=i.parseCard8();n=1;for(var h=0;h<u;h+=1)for(var d=i.parseCard8(),p=i.parseCard8(),g=d;g<=d+p;g+=1)a[g]=n,n+=1}else throw new Error("Unknown encoding format "+s);return new zt(a,r)}function Kn(t,e,r){var n,a,i,s,o=new se,c=[],u=0,h=!1,d=!1,p=0,g=0,x,v,F,m;if(t.isCIDFont){var S=t.tables.cff.topDict._fdSelect[e.index],w=t.tables.cff.topDict._fdArray[S];x=w._subrs,v=w._subrsBias,F=w._defaultWidthX,m=w._nominalWidthX}else x=t.tables.cff.topDict._subrs,v=t.tables.cff.topDict._subrsBias,F=t.tables.cff.topDict._defaultWidthX,m=t.tables.cff.topDict._nominalWidthX;var k=F;function T(O,z){d&&o.closePath(),o.moveTo(O,z),d=!0}function R(){var O;O=c.length%2!==0,O&&!h&&(k=c.shift()+m),u+=c.length>>1,c.length=0,h=!0}function M(O){for(var z,V,ee,le,oe,Y,Z,$,ae,ce,ie,he,H=0;H<O.length;){var q=O[H];switch(H+=1,q){case 1:R();break;case 3:R();break;case 4:c.length>1&&!h&&(k=c.shift()+m,h=!0),g+=c.pop(),T(p,g);break;case 5:for(;c.length>0;)p+=c.shift(),g+=c.shift(),o.lineTo(p,g);break;case 6:for(;c.length>0&&(p+=c.shift(),o.lineTo(p,g),c.length!==0);)g+=c.shift(),o.lineTo(p,g);break;case 7:for(;c.length>0&&(g+=c.shift(),o.lineTo(p,g),c.length!==0);)p+=c.shift(),o.lineTo(p,g);break;case 8:for(;c.length>0;)n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s+c.shift(),o.curveTo(n,a,i,s,p,g);break;case 10:oe=c.pop()+v,Y=x[oe],Y&&M(Y);break;case 11:return;case 12:switch(q=O[H],H+=1,q){case 35:n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),Z=i+c.shift(),$=s+c.shift(),ae=Z+c.shift(),ce=$+c.shift(),ie=ae+c.shift(),he=ce+c.shift(),p=ie+c.shift(),g=he+c.shift(),c.shift(),o.curveTo(n,a,i,s,Z,$),o.curveTo(ae,ce,ie,he,p,g);break;case 34:n=p+c.shift(),a=g,i=n+c.shift(),s=a+c.shift(),Z=i+c.shift(),$=s,ae=Z+c.shift(),ce=s,ie=ae+c.shift(),he=g,p=ie+c.shift(),o.curveTo(n,a,i,s,Z,$),o.curveTo(ae,ce,ie,he,p,g);break;case 36:n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),Z=i+c.shift(),$=s,ae=Z+c.shift(),ce=s,ie=ae+c.shift(),he=ce+c.shift(),p=ie+c.shift(),o.curveTo(n,a,i,s,Z,$),o.curveTo(ae,ce,ie,he,p,g);break;case 37:n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),Z=i+c.shift(),$=s+c.shift(),ae=Z+c.shift(),ce=$+c.shift(),ie=ae+c.shift(),he=ce+c.shift(),Math.abs(ie-p)>Math.abs(he-g)?p=ie+c.shift():g=he+c.shift(),o.curveTo(n,a,i,s,Z,$),o.curveTo(ae,ce,ie,he,p,g);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+q),c.length=0}break;case 14:c.length>0&&!h&&(k=c.shift()+m,h=!0),d&&(o.closePath(),d=!1);break;case 18:R();break;case 19:case 20:R(),H+=u+7>>3;break;case 21:c.length>2&&!h&&(k=c.shift()+m,h=!0),g+=c.pop(),p+=c.pop(),T(p,g);break;case 22:c.length>1&&!h&&(k=c.shift()+m,h=!0),p+=c.pop(),T(p,g);break;case 23:R();break;case 24:for(;c.length>2;)n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s+c.shift(),o.curveTo(n,a,i,s,p,g);p+=c.shift(),g+=c.shift(),o.lineTo(p,g);break;case 25:for(;c.length>6;)p+=c.shift(),g+=c.shift(),o.lineTo(p,g);n=p+c.shift(),a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s+c.shift(),o.curveTo(n,a,i,s,p,g);break;case 26:for(c.length%2&&(p+=c.shift());c.length>0;)n=p,a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i,g=s+c.shift(),o.curveTo(n,a,i,s,p,g);break;case 27:for(c.length%2&&(g+=c.shift());c.length>0;)n=p+c.shift(),a=g,i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s,o.curveTo(n,a,i,s,p,g);break;case 28:z=O[H],V=O[H+1],c.push((z<<24|V<<16)>>16),H+=2;break;case 29:oe=c.pop()+t.gsubrsBias,Y=t.gsubrs[oe],Y&&M(Y);break;case 30:for(;c.length>0&&(n=p,a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s+(c.length===1?c.shift():0),o.curveTo(n,a,i,s,p,g),c.length!==0);)n=p+c.shift(),a=g,i=n+c.shift(),s=a+c.shift(),g=s+c.shift(),p=i+(c.length===1?c.shift():0),o.curveTo(n,a,i,s,p,g);break;case 31:for(;c.length>0&&(n=p+c.shift(),a=g,i=n+c.shift(),s=a+c.shift(),g=s+c.shift(),p=i+(c.length===1?c.shift():0),o.curveTo(n,a,i,s,p,g),c.length!==0);)n=p,a=g+c.shift(),i=n+c.shift(),s=a+c.shift(),p=i+c.shift(),g=s+(c.length===1?c.shift():0),o.curveTo(n,a,i,s,p,g);break;default:q<32?console.log("Glyph "+e.index+": unknown operator "+q):q<247?c.push(q-139):q<251?(z=O[H],H+=1,c.push((q-247)*256+z+108)):q<255?(z=O[H],H+=1,c.push(-(q-251)*256-z-108)):(z=O[H],V=O[H+1],ee=O[H+2],le=O[H+3],H+=4,c.push((z<<24|V<<16|ee<<8|le)/65536))}}}return M(r),e.advanceWidth=k,o}function Hs(t,e,r,n){var a=[],i,s=new _.Parser(t,e),o=s.parseCard8();if(o===0)for(var c=0;c<r;c++){if(i=s.parseCard8(),i>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+i+" (FD count "+n+")");a.push(i)}else if(o===3){var u=s.parseCard16(),h=s.parseCard16();if(h!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+h);for(var d,p=0;p<u;p++){if(i=s.parseCard8(),d=s.parseCard16(),i>=n)throw new Error("CFF table CID Font FDSelect has bad FD index value "+i+" (FD count "+n+")");if(d>r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+d);for(;h<d;h++)a.push(i);h=d}if(d!==r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+d)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return a}function zs(t,e,r,n){r.tables.cff={};var a=_s(t,e),i=He(t,a.endOffset,_.bytesToString),s=He(t,i.endOffset),o=He(t,s.endOffset,_.bytesToString),c=He(t,o.endOffset);r.gsubrs=c.objects,r.gsubrsBias=Tr(r.gsubrs);var u=$n(t,e,s.objects,o.objects);if(u.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+u.length);var h=u[0];if(r.tables.cff.topDict=h,h._privateDict&&(r.defaultWidthX=h._privateDict.defaultWidthX,r.nominalWidthX=h._privateDict.nominalWidthX),h.ros[0]!==void 0&&h.ros[1]!==void 0&&(r.isCIDFont=!0),r.isCIDFont){var d=h.fdArray,p=h.fdSelect;if(d===0||p===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");d+=e;var g=He(t,d),x=$n(t,e,g.objects,o.objects);h._fdArray=x,p+=e,h._fdSelect=Hs(t,p,r.numGlyphs,x.length)}var v=e+h.private[1],F=Zn(t,v,h.private[0],o.objects);if(r.defaultWidthX=F.defaultWidthX,r.nominalWidthX=F.nominalWidthX,F.subrs!==0){var m=v+F.subrs,S=He(t,m);r.subrs=S.objects,r.subrsBias=Tr(r.subrs)}else r.subrs=[],r.subrsBias=0;var w;n.lowMemory?(w=Os(t,e+h.charStrings),r.nGlyphs=w.offsets.length):(w=He(t,e+h.charStrings),r.nGlyphs=w.objects.length);var k=Ns(t,e+h.charset,r.nGlyphs,o.objects);if(h.encoding===0?r.cffEncoding=new zt(ws,k):h.encoding===1?r.cffEncoding=new zt(Fs,k):r.cffEncoding=Gs(t,e+h.encoding,k),r.encoding=r.encoding||r.cffEncoding,r.glyphs=new Oe.GlyphSet(r),n.lowMemory)r._push=function(M){var O=Ms(M,w.offsets,t,e+h.charStrings);r.glyphs.push(M,Oe.cffGlyphLoader(r,M,Kn,O))};else for(var T=0;T<r.nGlyphs;T+=1){var R=w.objects[T];r.glyphs.push(T,Oe.cffGlyphLoader(r,T,Kn,R))}}function Qn(t,e){var r,n=Ht.indexOf(t);return n>=0&&(r=n),n=e.indexOf(t),n>=0?r=n+Ht.length:(r=Ht.length+e.length,e.push(t)),r}function Ws(){return new I.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 qs(t){var e=new I.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var r=0;r<t.length;r+=1)e.names.push({name:"name_"+r,type:"NAME",value:t[r]});return e}function Jn(t,e,r){for(var n={},a=0;a<t.length;a+=1){var i=t[a],s=e[i.name];s!==void 0&&!qn(s,i.value)&&(i.type==="SID"&&(s=Qn(s,r)),n[i.op]={name:i.name,type:i.type,value:s})}return n}function ea(t,e){var r=new I.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=Jn(jn,t,e),r}function ta(t){var e=new I.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:t}],e}function Vs(t){var e=new I.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(var r=0;r<t.length;r+=1)e.strings.push({name:"string_"+r,type:"STRING",value:t[r]});return e}function Xs(){return new I.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function js(t,e){for(var r=new I.Record("Charsets",[{name:"format",type:"Card8",value:0}]),n=0;n<t.length;n+=1){var a=t[n],i=Qn(a,e);r.fields.push({name:"glyph_"+n,type:"SID",value:i})}return r}function Ys(t){var e=[],r=t.path;e.push({name:"width",type:"NUMBER",value:t.advanceWidth});for(var n=0,a=0,i=0;i<r.commands.length;i+=1){var s=void 0,o=void 0,c=r.commands[i];if(c.type==="Q"){var u=.3333333333333333,h=2/3;c={type:"C",x:c.x,y:c.y,x1:Math.round(u*n+h*c.x1),y1:Math.round(u*a+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")s=Math.round(c.x-n),o=Math.round(c.y-a),e.push({name:"dx",type:"NUMBER",value:s}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rmoveto",type:"OP",value:21}),n=Math.round(c.x),a=Math.round(c.y);else if(c.type==="L")s=Math.round(c.x-n),o=Math.round(c.y-a),e.push({name:"dx",type:"NUMBER",value:s}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rlineto",type:"OP",value:5}),n=Math.round(c.x),a=Math.round(c.y);else if(c.type==="C"){var d=Math.round(c.x1-n),p=Math.round(c.y1-a),g=Math.round(c.x2-c.x1),x=Math.round(c.y2-c.y1);s=Math.round(c.x-c.x2),o=Math.round(c.y-c.y2),e.push({name:"dx1",type:"NUMBER",value:d}),e.push({name:"dy1",type:"NUMBER",value:p}),e.push({name:"dx2",type:"NUMBER",value:g}),e.push({name:"dy2",type:"NUMBER",value:x}),e.push({name:"dx",type:"NUMBER",value:s}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rrcurveto",type:"OP",value:8}),n=Math.round(c.x),a=Math.round(c.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function Zs(t){for(var e=new I.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),r=0;r<t.length;r+=1){var n=t.get(r),a=Ys(n);e.charStrings.push({name:n.name,type:"CHARSTRING",value:a})}return e}function $s(t,e){var r=new I.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=Jn(Yn,t,e),r}function Ks(t,e){for(var r=new I.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"}]),n=1/e.unitsPerEm,a={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[n,0,0,n,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},i={},s=[],o,c=1;c<t.length;c+=1)o=t.get(c),s.push(o.name);var u=[];r.header=Ws(),r.nameIndex=qs([e.postScriptName]);var h=ea(a,u);r.topDictIndex=ta(h),r.globalSubrIndex=Xs(),r.charsets=js(s,u),r.charStringsIndex=Zs(t),r.privateDict=$s(i,u),r.stringIndex=Vs(u);var d=r.header.sizeOf()+r.nameIndex.sizeOf()+r.topDictIndex.sizeOf()+r.stringIndex.sizeOf()+r.globalSubrIndex.sizeOf();return a.charset=d,a.encoding=0,a.charStrings=a.charset+r.charsets.sizeOf(),a.private[1]=a.charStrings+r.charStringsIndex.sizeOf(),h=ea(a,u),r.topDictIndex=ta(h),r}var ra={parse:zs,make:Ks};function Qs(t,e){var r={},n=new _.Parser(t,e);return r.version=n.parseVersion(),r.fontRevision=Math.round(n.parseFixed()*1e3)/1e3,r.checkSumAdjustment=n.parseULong(),r.magicNumber=n.parseULong(),P.argument(r.magicNumber===1594834165,"Font header has wrong magic number."),r.flags=n.parseUShort(),r.unitsPerEm=n.parseUShort(),r.created=n.parseLongDateTime(),r.modified=n.parseLongDateTime(),r.xMin=n.parseShort(),r.yMin=n.parseShort(),r.xMax=n.parseShort(),r.yMax=n.parseShort(),r.macStyle=n.parseUShort(),r.lowestRecPPEM=n.parseUShort(),r.fontDirectionHint=n.parseShort(),r.indexToLocFormat=n.parseShort(),r.glyphDataFormat=n.parseShort(),r}function Js(t){var e=Math.round(new Date().getTime()/1e3)+2082844800,r=e;return t.createdTimestamp&&(r=t.createdTimestamp+2082844800),new I.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:r},{name:"modified",type:"LONGDATETIME",value:e},{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:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],t)}var na={parse:Qs,make:Js};function eo(t,e){var r={},n=new _.Parser(t,e);return r.version=n.parseVersion(),r.ascender=n.parseShort(),r.descender=n.parseShort(),r.lineGap=n.parseShort(),r.advanceWidthMax=n.parseUShort(),r.minLeftSideBearing=n.parseShort(),r.minRightSideBearing=n.parseShort(),r.xMaxExtent=n.parseShort(),r.caretSlopeRise=n.parseShort(),r.caretSlopeRun=n.parseShort(),r.caretOffset=n.parseShort(),n.relativeOffset+=8,r.metricDataFormat=n.parseShort(),r.numberOfHMetrics=n.parseUShort(),r}function to(t){return new I.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}],t)}var aa={parse:eo,make:to};function ro(t,e,r,n,a){for(var i,s,o=new _.Parser(t,e),c=0;c<n;c+=1){c<r&&(i=o.parseUShort(),s=o.parseShort());var u=a.get(c);u.advanceWidth=i,u.leftSideBearing=s}}function no(t,e,r,n,a){t._hmtxTableData={};for(var i,s,o=new _.Parser(e,r),c=0;c<a;c+=1)c<n&&(i=o.parseUShort(),s=o.parseShort()),t._hmtxTableData[c]={advanceWidth:i,leftSideBearing:s}}function ao(t,e,r,n,a,i,s){s.lowMemory?no(t,e,r,n,a):ro(e,r,n,a,i)}function io(t){for(var e=new I.Table("hmtx",[]),r=0;r<t.length;r+=1){var n=t.get(r),a=n.advanceWidth||0,i=n.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+r,type:"USHORT",value:a}),e.fields.push({name:"leftSideBearing_"+r,type:"SHORT",value:i})}return e}var ia={parse:ao,make:io};function so(t){for(var e=new I.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:t.length}]),r="",n=12+t.length*4,a=0;a<t.length;++a){var i=r.indexOf(t[a]);i<0&&(i=r.length,r+=t[a]),e.fields.push({name:"offset "+a,type:"USHORT",value:n+i}),e.fields.push({name:"length "+a,type:"USHORT",value:t[a].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),e}function oo(t,e){var r=new _.Parser(t,e),n=r.parseULong();P.argument(n===1,"Unsupported ltag table version."),r.skip("uLong",1);for(var a=r.parseULong(),i=[],s=0;s<a;s++){for(var o="",c=e+r.parseUShort(),u=r.parseUShort(),h=c;h<c+u;++h)o+=String.fromCharCode(t.getInt8(h));i.push(o)}return i}var sa={make:so,parse:oo};function co(t,e){var r={},n=new _.Parser(t,e);return r.version=n.parseVersion(),r.numGlyphs=n.parseUShort(),r.version===1&&(r.maxPoints=n.parseUShort(),r.maxContours=n.parseUShort(),r.maxCompositePoints=n.parseUShort(),r.maxCompositeContours=n.parseUShort(),r.maxZones=n.parseUShort(),r.maxTwilightPoints=n.parseUShort(),r.maxStorage=n.parseUShort(),r.maxFunctionDefs=n.parseUShort(),r.maxInstructionDefs=n.parseUShort(),r.maxStackElements=n.parseUShort(),r.maxSizeOfInstructions=n.parseUShort(),r.maxComponentElements=n.parseUShort(),r.maxComponentDepth=n.parseUShort()),r}function uo(t){return new I.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:t}])}var oa={parse:co,make:uo},ca=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],ua={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"},ho={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},ha={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 lo(t,e,r){switch(t){case 0:if(e===65535)return"und";if(r)return r[e];break;case 1:return ua[e];case 3:return ha[e]}}var Cr="utf-16",fo={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"},po={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 la(t,e,r){switch(t){case 0:return Cr;case 1:return po[r]||fo[e];case 3:if(e===1||e===10)return Cr;break}}function go(t,e,r){for(var n={},a=new _.Parser(t,e),i=a.parseUShort(),s=a.parseUShort(),o=a.offset+a.parseUShort(),c=0;c<s;c++){var u=a.parseUShort(),h=a.parseUShort(),d=a.parseUShort(),p=a.parseUShort(),g=ca[p]||p,x=a.parseUShort(),v=a.parseUShort(),F=lo(u,d,r),m=la(u,h,d);if(m!==void 0&&F!==void 0){var S=void 0;if(m===Cr?S=nt.UTF16(t,o+v,x):S=nt.MACSTRING(t,o+v,x,m),S){var w=n[g];w===void 0&&(w=n[g]={}),w[F]=S}}}return i===1&&a.parseUShort(),n}function Er(t){var e={};for(var r in t)e[t[r]]=parseInt(r);return e}function fa(t,e,r,n,a,i){return new I.Record("NameRecord",[{name:"platformID",type:"USHORT",value:t},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:r},{name:"nameID",type:"USHORT",value:n},{name:"length",type:"USHORT",value:a},{name:"offset",type:"USHORT",value:i}])}function vo(t,e){var r=t.length,n=e.length-r+1;e:for(var a=0;a<n;a++)for(;a<n;a++){for(var i=0;i<r;i++)if(e[a+i]!==t[i])continue e;return a}return-1}function pa(t,e){var r=vo(t,e);if(r<0){r=e.length;for(var n=0,a=t.length;n<a;++n)e.push(t[n])}return r}function yo(t,e){var r,n=[],a={},i=Er(ca);for(var s in t){var o=i[s];if(o===void 0&&(o=s),r=parseInt(o),isNaN(r))throw new Error('Name table entry "'+s+'" does not exist, see nameTableNames for complete list.');a[r]=t[s],n.push(r)}for(var c=Er(ua),u=Er(ha),h=[],d=[],p=0;p<n.length;p++){r=n[p];var g=a[r];for(var x in g){var v=g[x],F=1,m=c[x],S=ho[m],w=la(F,S,m),k=L.MACSTRING(v,w);k===void 0&&(F=0,m=e.indexOf(x),m<0&&(m=e.length,e.push(x)),S=4,k=L.UTF16(v));var T=pa(k,d);h.push(fa(F,S,m,r,k.length,T));var R=u[x];if(R!==void 0){var M=L.UTF16(v),O=pa(M,d);h.push(fa(3,1,R,r,M.length,O))}}}h.sort(function(ee,le){return ee.platformID-le.platformID||ee.encodingID-le.encodingID||ee.languageID-le.languageID||ee.nameID-le.nameID});for(var z=new I.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:h.length},{name:"stringOffset",type:"USHORT",value:6+h.length*12}]),V=0;V<h.length;V++)z.fields.push({name:"record_"+V,type:"RECORD",value:h[V]});return z.fields.push({name:"strings",type:"LITERAL",value:d}),z}var da={parse:go,make:yo},Ur=[{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 mo(t){for(var e=0;e<Ur.length;e+=1){var r=Ur[e];if(t>=r.begin&&t<r.end)return e}return-1}function bo(t,e){var r={},n=new _.Parser(t,e);r.version=n.parseUShort(),r.xAvgCharWidth=n.parseShort(),r.usWeightClass=n.parseUShort(),r.usWidthClass=n.parseUShort(),r.fsType=n.parseUShort(),r.ySubscriptXSize=n.parseShort(),r.ySubscriptYSize=n.parseShort(),r.ySubscriptXOffset=n.parseShort(),r.ySubscriptYOffset=n.parseShort(),r.ySuperscriptXSize=n.parseShort(),r.ySuperscriptYSize=n.parseShort(),r.ySuperscriptXOffset=n.parseShort(),r.ySuperscriptYOffset=n.parseShort(),r.yStrikeoutSize=n.parseShort(),r.yStrikeoutPosition=n.parseShort(),r.sFamilyClass=n.parseShort(),r.panose=[];for(var a=0;a<10;a++)r.panose[a]=n.parseByte();return r.ulUnicodeRange1=n.parseULong(),r.ulUnicodeRange2=n.parseULong(),r.ulUnicodeRange3=n.parseULong(),r.ulUnicodeRange4=n.parseULong(),r.achVendID=String.fromCharCode(n.parseByte(),n.parseByte(),n.parseByte(),n.parseByte()),r.fsSelection=n.parseUShort(),r.usFirstCharIndex=n.parseUShort(),r.usLastCharIndex=n.parseUShort(),r.sTypoAscender=n.parseShort(),r.sTypoDescender=n.parseShort(),r.sTypoLineGap=n.parseShort(),r.usWinAscent=n.parseUShort(),r.usWinDescent=n.parseUShort(),r.version>=1&&(r.ulCodePageRange1=n.parseULong(),r.ulCodePageRange2=n.parseULong()),r.version>=2&&(r.sxHeight=n.parseShort(),r.sCapHeight=n.parseShort(),r.usDefaultChar=n.parseUShort(),r.usBreakChar=n.parseUShort(),r.usMaxContent=n.parseUShort()),r}function xo(t){return new I.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}],t)}var Ar={parse:bo,make:xo,unicodeRanges:Ur,getUnicodeRange:mo};function So(t,e){var r={},n=new _.Parser(t,e);switch(r.version=n.parseVersion(),r.italicAngle=n.parseFixed(),r.underlinePosition=n.parseShort(),r.underlineThickness=n.parseShort(),r.isFixedPitch=n.parseULong(),r.minMemType42=n.parseULong(),r.maxMemType42=n.parseULong(),r.minMemType1=n.parseULong(),r.maxMemType1=n.parseULong(),r.version){case 1:r.names=Ke.slice();break;case 2:r.numberOfGlyphs=n.parseUShort(),r.glyphNameIndex=new Array(r.numberOfGlyphs);for(var a=0;a<r.numberOfGlyphs;a++)r.glyphNameIndex[a]=n.parseUShort();r.names=[];for(var i=0;i<r.numberOfGlyphs;i++)if(r.glyphNameIndex[i]>=Ke.length){var s=n.parseChar();r.names.push(n.parseString(s))}break;case 2.5:r.numberOfGlyphs=n.parseUShort(),r.offset=new Array(r.numberOfGlyphs);for(var o=0;o<r.numberOfGlyphs;o++)r.offset[o]=n.parseChar();break}return r}function wo(){return new I.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var ga={parse:So,make:wo},ke=new Array(9);ke[1]=function(){var e=this.offset+this.relativeOffset,r=this.parseUShort();if(r===1)return{substFormat:1,coverage:this.parsePointer(E.coverage),deltaGlyphId:this.parseUShort()};if(r===2)return{substFormat:2,coverage:this.parsePointer(E.coverage),substitute:this.parseOffset16List()};P.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},ke[2]=function(){var e=this.parseUShort();return P.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(E.coverage),sequences:this.parseListOfLists()}},ke[3]=function(){var e=this.parseUShort();return P.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(E.coverage),alternateSets:this.parseListOfLists()}},ke[4]=function(){var e=this.parseUShort();return P.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(E.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var at={sequenceIndex:E.uShort,lookupListIndex:E.uShort};ke[5]=function(){var e=this.offset+this.relativeOffset,r=this.parseUShort();if(r===1)return{substFormat:r,coverage:this.parsePointer(E.coverage),ruleSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{input:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,at)}})};if(r===2)return{substFormat:r,coverage:this.parsePointer(E.coverage),classDef:this.parsePointer(E.classDef),classSets:this.parseListOfLists(function(){var i=this.parseUShort(),s=this.parseUShort();return{classes:this.parseUShortList(i-1),lookupRecords:this.parseRecordList(s,at)}})};if(r===3){var n=this.parseUShort(),a=this.parseUShort();return{substFormat:r,coverages:this.parseList(n,E.pointer(E.coverage)),lookupRecords:this.parseRecordList(a,at)}}P.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},ke[6]=function(){var e=this.offset+this.relativeOffset,r=this.parseUShort();if(r===1)return{substFormat:1,coverage:this.parsePointer(E.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(at)}})};if(r===2)return{substFormat:2,coverage:this.parsePointer(E.coverage),backtrackClassDef:this.parsePointer(E.classDef),inputClassDef:this.parsePointer(E.classDef),lookaheadClassDef:this.parsePointer(E.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(at)}})};if(r===3)return{substFormat:3,backtrackCoverage:this.parseList(E.pointer(E.coverage)),inputCoverage:this.parseList(E.pointer(E.coverage)),lookaheadCoverage:this.parseList(E.pointer(E.coverage)),lookupRecords:this.parseRecordList(at)};P.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},ke[7]=function(){var e=this.parseUShort();P.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");var r=this.parseUShort(),n=new E(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:r,extension:ke[r].call(n)}},ke[8]=function(){var e=this.parseUShort();return P.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(E.coverage),backtrackCoverage:this.parseList(E.pointer(E.coverage)),lookaheadCoverage:this.parseList(E.pointer(E.coverage)),substitutes:this.parseUShortList()}};function Fo(t,e){e=e||0;var r=new E(t,e),n=r.parseVersion(1);return P.argument(n===1||n===1.1,"Unsupported GSUB table version."),n===1?{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(ke)}:{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(ke),variations:r.parseFeatureVariationsList()}}var it=new Array(9);it[1]=function(e){return e.substFormat===1?new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)}].concat(I.ushortList("substitute",e.substitute)))},it[2]=function(e){return P.assert(e.substFormat===1,"Lookup type 2 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)}].concat(I.tableList("seqSet",e.sequences,function(r){return new I.Table("sequenceSetTable",I.ushortList("sequence",r))})))},it[3]=function(e){return P.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)}].concat(I.tableList("altSet",e.alternateSets,function(r){return new I.Table("alternateSetTable",I.ushortList("alternate",r))})))},it[4]=function(e){return P.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)}].concat(I.tableList("ligSet",e.ligatureSets,function(r){return new I.Table("ligatureSetTable",I.tableList("ligature",r,function(n){return new I.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:n.ligGlyph}].concat(I.ushortList("component",n.components,n.components.length+1)))}))})))},it[6]=function(e){if(e.substFormat===1){var r=new I.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new I.Coverage(e.coverage)}].concat(I.tableList("chainRuleSet",e.chainRuleSets,function(i){return new I.Table("chainRuleSetTable",I.tableList("chainRule",i,function(s){var o=I.ushortList("backtrackGlyph",s.backtrack,s.backtrack.length).concat(I.ushortList("inputGlyph",s.input,s.input.length+1)).concat(I.ushortList("lookaheadGlyph",s.lookahead,s.lookahead.length)).concat(I.ushortList("substitution",[],s.lookupRecords.length));return s.lookupRecords.forEach(function(c,u){o=o.concat({name:"sequenceIndex"+u,type:"USHORT",value:c.sequenceIndex}).concat({name:"lookupListIndex"+u,type:"USHORT",value:c.lookupListIndex})}),new I.Table("chainRuleTable",o)}))})));return r}else if(e.substFormat===2)P.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(e.substFormat===3){var n=[{name:"substFormat",type:"USHORT",value:e.substFormat}];n.push({name:"backtrackGlyphCount",type:"USHORT",value:e.backtrackCoverage.length}),e.backtrackCoverage.forEach(function(i,s){n.push({name:"backtrackCoverage"+s,type:"TABLE",value:new I.Coverage(i)})}),n.push({name:"inputGlyphCount",type:"USHORT",value:e.inputCoverage.length}),e.inputCoverage.forEach(function(i,s){n.push({name:"inputCoverage"+s,type:"TABLE",value:new I.Coverage(i)})}),n.push({name:"lookaheadGlyphCount",type:"USHORT",value:e.lookaheadCoverage.length}),e.lookaheadCoverage.forEach(function(i,s){n.push({name:"lookaheadCoverage"+s,type:"TABLE",value:new I.Coverage(i)})}),n.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length}),e.lookupRecords.forEach(function(i,s){n=n.concat({name:"sequenceIndex"+s,type:"USHORT",value:i.sequenceIndex}).concat({name:"lookupListIndex"+s,type:"USHORT",value:i.lookupListIndex})});var a=new I.Table("chainContextTable",n);return a}P.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function ko(t){return new I.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new I.ScriptList(t.scripts)},{name:"features",type:"TABLE",value:new I.FeatureList(t.features)},{name:"lookups",type:"TABLE",value:new I.LookupList(t.lookups,it)}])}var va={parse:Fo,make:ko};function To(t,e){var r=new _.Parser(t,e),n=r.parseULong();P.argument(n===1,"Unsupported META table version."),r.parseULong(),r.parseULong();for(var a=r.parseULong(),i={},s=0;s<a;s++){var o=r.parseTag(),c=r.parseULong(),u=r.parseULong(),h=nt.UTF8(t,e+c,u);i[o]=h}return i}function Co(t){var e=Object.keys(t).length,r="",n=16+e*12,a=new I.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:n},{name:"numTags",type:"ULONG",value:e}]);for(var i in t){var s=r.length;r+=t[i],a.fields.push({name:"tag "+i,type:"TAG",value:i}),a.fields.push({name:"offset "+i,type:"ULONG",value:n+s}),a.fields.push({name:"length "+i,type:"ULONG",value:t[i].length})}return a.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),a}var ya={parse:To,make:Co};function ma(t){return Math.log(t)/Math.log(2)|0}function Br(t){for(;t.length%4!==0;)t.push(0);for(var e=0,r=0;r<t.length;r+=4)e+=(t[r]<<24)+(t[r+1]<<16)+(t[r+2]<<8)+t[r+3];return e%=Math.pow(2,32),e}function ba(t,e,r,n){return new I.Record("Table Record",[{name:"tag",type:"TAG",value:t!==void 0?t:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:r!==void 0?r:0},{name:"length",type:"ULONG",value:n!==void 0?n:0}])}function xa(t){var e=new I.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}]);e.tables=t,e.numTables=t.length;var r=Math.pow(2,ma(e.numTables));e.searchRange=16*r,e.entrySelector=ma(r),e.rangeShift=e.numTables*16-e.searchRange;for(var n=[],a=[],i=e.sizeOf()+ba().sizeOf()*e.numTables;i%4!==0;)i+=1,a.push({name:"padding",type:"BYTE",value:0});for(var s=0;s<t.length;s+=1){var o=t[s];P.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var c=o.sizeOf(),u=ba(o.tableName,Br(o.encode()),i,c);for(n.push({name:u.tag+" Table Record",type:"RECORD",value:u}),a.push({name:o.tableName+" table",type:"RECORD",value:o}),i+=c,P.argument(!isNaN(i),"Something went wrong calculating the offset.");i%4!==0;)i+=1,a.push({name:"padding",type:"BYTE",value:0})}return n.sort(function(h,d){return h.value.tag>d.value.tag?1:-1}),e.fields=e.fields.concat(n),e.fields=e.fields.concat(a),e}function Sa(t,e,r){for(var n=0;n<e.length;n+=1){var a=t.charToGlyphIndex(e[n]);if(a>0){var i=t.glyphs.get(a);return i.getMetrics()}}return r}function Eo(t){for(var e=0,r=0;r<t.length;r+=1)e+=t[r];return e/t.length}function Uo(t){for(var e=[],r=[],n=[],a=[],i=[],s=[],o=[],c,u=0,h=0,d=0,p=0,g=0,x=0;x<t.glyphs.length;x+=1){var v=t.glyphs.get(x),F=v.unicode|0;if(isNaN(v.advanceWidth))throw new Error("Glyph "+v.name+" ("+x+"): advanceWidth is not a number.");(c>F||c===void 0)&&F>0&&(c=F),u<F&&(u=F);var m=Ar.getUnicodeRange(F);if(m<32)h|=1<<m;else if(m<64)d|=1<<m-32;else if(m<96)p|=1<<m-64;else if(m<123)g|=1<<m-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(v.name!==".notdef"){var S=v.getMetrics();e.push(S.xMin),r.push(S.yMin),n.push(S.xMax),a.push(S.yMax),s.push(S.leftSideBearing),o.push(S.rightSideBearing),i.push(v.advanceWidth)}}var w={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,n),yMax:Math.max.apply(null,a),advanceWidthMax:Math.max.apply(null,i),advanceWidthAvg:Eo(i),minLeftSideBearing:Math.min.apply(null,s),maxLeftSideBearing:Math.max.apply(null,s),minRightSideBearing:Math.min.apply(null,o)};w.ascender=t.ascender,w.descender=t.descender;var k=na.make({flags:3,unitsPerEm:t.unitsPerEm,xMin:w.xMin,yMin:w.yMin,xMax:w.xMax,yMax:w.yMax,lowestRecPPEM:3,createdTimestamp:t.createdTimestamp}),T=aa.make({ascender:w.ascender,descender:w.descender,advanceWidthMax:w.advanceWidthMax,minLeftSideBearing:w.minLeftSideBearing,minRightSideBearing:w.minRightSideBearing,xMaxExtent:w.maxLeftSideBearing+(w.xMax-w.xMin),numberOfHMetrics:t.glyphs.length}),R=oa.make(t.glyphs.length),M=Ar.make(Object.assign({xAvgCharWidth:Math.round(w.advanceWidthAvg),usFirstCharIndex:c,usLastCharIndex:u,ulUnicodeRange1:h,ulUnicodeRange2:d,ulUnicodeRange3:p,ulUnicodeRange4:g,sTypoAscender:w.ascender,sTypoDescender:w.descender,sTypoLineGap:0,usWinAscent:w.yMax,usWinDescent:Math.abs(w.yMin),ulCodePageRange1:1,sxHeight:Sa(t,"xyvw",{yMax:Math.round(w.ascender/2)}).yMax,sCapHeight:Sa(t,"HIKLEFJMNTZBDPRAGOQSUVWXY",w).yMax,usDefaultChar:t.hasChar(" ")?32:0,usBreakChar:t.hasChar(" ")?32:0},t.tables.os2)),O=ia.make(t.glyphs),z=Hn.make(t.glyphs),V=t.getEnglishName("fontFamily"),ee=t.getEnglishName("fontSubfamily"),le=V+" "+ee,oe=t.getEnglishName("postScriptName");oe||(oe=V.replace(/\s/g,"")+"-"+ee);var Y={};for(var Z in t.names)Y[Z]=t.names[Z];Y.uniqueID||(Y.uniqueID={en:t.getEnglishName("manufacturer")+":"+le}),Y.postScriptName||(Y.postScriptName={en:oe}),Y.preferredFamily||(Y.preferredFamily=t.names.fontFamily),Y.preferredSubfamily||(Y.preferredSubfamily=t.names.fontSubfamily);var $=[],ae=da.make(Y,$),ce=$.length>0?sa.make($):void 0,ie=ga.make(),he=ra.make(t.glyphs,{version:t.getEnglishName("version"),fullName:le,familyName:V,weightName:ee,postScriptName:oe,unitsPerEm:t.unitsPerEm,fontBBox:[0,w.yMin,w.ascender,w.advanceWidthMax]}),H=t.metas&&Object.keys(t.metas).length>0?ya.make(t.metas):void 0,q=[k,T,R,M,ae,z,ie,he,O];ce&&q.push(ce),t.tables.gsub&&q.push(va.make(t.tables.gsub)),H&&q.push(H);for(var ft=xa(q),Qt=ft.encode(),Jt=Br(Qt),Lt=ft.fields,er=!1,Ye=0;Ye<Lt.length;Ye+=1)if(Lt[Ye].name==="head table"){Lt[Ye].value.checkSumAdjustment=2981146554-Jt,er=!0;break}if(!er)throw new Error("Could not find head table with checkSum to adjust.");return ft}var Ao={make:xa,fontToTable:Uo,computeCheckSum:Br};function Lr(t,e){for(var r=0,n=t.length-1;r<=n;){var a=r+n>>>1,i=t[a].tag;if(i===e)return a;i<e?r=a+1:n=a-1}return-r-1}function wa(t,e){for(var r=0,n=t.length-1;r<=n;){var a=r+n>>>1,i=t[a];if(i===e)return a;i<e?r=a+1:n=a-1}return-r-1}function Fa(t,e){for(var r,n=0,a=t.length-1;n<=a;){var i=n+a>>>1;r=t[i];var s=r.start;if(s===e)return r;s<e?n=i+1:a=i-1}if(n>0)return r=t[n-1],e>r.end?0:r}function mt(t,e){this.font=t,this.tableName=e}mt.prototype={searchTag:Lr,binSearch:wa,getTable:function(t){var e=this.font.tables[this.tableName];return!e&&t&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var t=this.getTable();return t?t.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var t=this.getTable();if(t){for(var e=!1,r=0;r<t.scripts.length;r++){var n=t.scripts[r].tag;if(n==="DFLT")return n;n==="latn"&&(e=!0)}if(e)return"latn"}},getScriptTable:function(t,e){var r=this.getTable(e);if(r){t=t||"DFLT";var n=r.scripts,a=Lr(r.scripts,t);if(a>=0)return n[a].script;if(e){var i={tag:t,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return n.splice(-1-a,0,i),i.script}}},getLangSysTable:function(t,e,r){var n=this.getScriptTable(t,r);if(n){if(!e||e==="dflt"||e==="DFLT")return n.defaultLangSys;var a=Lr(n.langSysRecords,e);if(a>=0)return n.langSysRecords[a].langSys;if(r){var i={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return n.langSysRecords.splice(-1-a,0,i),i.langSys}}},getFeatureTable:function(t,e,r,n){var a=this.getLangSysTable(t,e,n);if(a){for(var i,s=a.featureIndexes,o=this.font.tables[this.tableName].features,c=0;c<s.length;c++)if(i=o[s[c]],i.tag===r)return i.feature;if(n){var u=o.length;return P.assert(u===0||r>=o[u-1].tag,"Features must be added in alphabetical order."),i={tag:r,feature:{params:0,lookupListIndexes:[]}},o.push(i),s.push(u),i.feature}}},getLookupTables:function(t,e,r,n,a){var i=this.getFeatureTable(t,e,r,a),s=[];if(i){for(var o,c=i.lookupListIndexes,u=this.font.tables[this.tableName].lookups,h=0;h<c.length;h++)o=u[c[h]],o.lookupType===n&&s.push(o);if(s.length===0&&a){o={lookupType:n,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=u.length;return u.push(o),c.push(d),[o]}}return s},getGlyphClass:function(t,e){switch(t.format){case 1:return t.startGlyph<=e&&e<t.startGlyph+t.classes.length?t.classes[e-t.startGlyph]:0;case 2:var r=Fa(t.ranges,e);return r?r.classId:0}},getCoverageIndex:function(t,e){switch(t.format){case 1:var r=wa(t.glyphs,e);return r>=0?r:-1;case 2:var n=Fa(t.ranges,e);return n?n.index+e-n.start:-1}},expandCoverage:function(t){if(t.format===1)return t.glyphs;for(var e=[],r=t.ranges,n=0;n<r.length;n++)for(var a=r[n],i=a.start,s=a.end,o=i;o<=s;o++)e.push(o);return e}};function bt(t){mt.call(this,t,"gpos")}bt.prototype=mt.prototype,bt.prototype.init=function(){var t=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(t)},bt.prototype.getKerningValue=function(t,e,r){for(var n=0;n<t.length;n++)for(var a=t[n].subtables,i=0;i<a.length;i++){var s=a[i],o=this.getCoverageIndex(s.coverage,e);if(!(o<0))switch(s.posFormat){case 1:for(var c=s.pairSets[o],u=0;u<c.length;u++){var h=c[u];if(h.secondGlyph===r)return h.value1&&h.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(s.classDef1,e),p=this.getGlyphClass(s.classDef2,r),g=s.classRecords[d][p];return g.value1&&g.value1.xAdvance||0}}return 0},bt.prototype.getKerningTables=function(t,e){if(this.font.tables.gpos)return this.getLookupTables(t,e,"kern",2)};function ge(t){mt.call(this,t,"gsub")}function Bo(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Or(t,e,r){for(var n=t.subtables,a=0;a<n.length;a++){var i=n[a];if(i.substFormat===e)return i}if(r)return n.push(r),r}ge.prototype=mt.prototype,ge.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},ge.prototype.getSingle=function(t,e,r){for(var n=[],a=this.getLookupTables(e,r,t,1),i=0;i<a.length;i++)for(var s=a[i].subtables,o=0;o<s.length;o++){var c=s[o],u=this.expandCoverage(c.coverage),h=void 0;if(c.substFormat===1){var d=c.deltaGlyphId;for(h=0;h<u.length;h++){var p=u[h];n.push({sub:p,by:p+d})}}else{var g=c.substitute;for(h=0;h<u.length;h++)n.push({sub:u[h],by:g[h]})}}return n},ge.prototype.getMultiple=function(t,e,r){for(var n=[],a=this.getLookupTables(e,r,t,2),i=0;i<a.length;i++)for(var s=a[i].subtables,o=0;o<s.length;o++){var c=s[o],u=this.expandCoverage(c.coverage),h=void 0;for(h=0;h<u.length;h++){var d=u[h],p=c.sequences[h];n.push({sub:d,by:p})}}return n},ge.prototype.getAlternates=function(t,e,r){for(var n=[],a=this.getLookupTables(e,r,t,3),i=0;i<a.length;i++)for(var s=a[i].subtables,o=0;o<s.length;o++)for(var c=s[o],u=this.expandCoverage(c.coverage),h=c.alternateSets,d=0;d<u.length;d++)n.push({sub:u[d],by:h[d]});return n},ge.prototype.getLigatures=function(t,e,r){for(var n=[],a=this.getLookupTables(e,r,t,4),i=0;i<a.length;i++)for(var s=a[i].subtables,o=0;o<s.length;o++)for(var c=s[o],u=this.expandCoverage(c.coverage),h=c.ligatureSets,d=0;d<u.length;d++)for(var p=u[d],g=h[d],x=0;x<g.length;x++){var v=g[x];n.push({sub:[p].concat(v.components),by:v.ligGlyph})}return n},ge.prototype.addSingle=function(t,e,r,n){var a=this.getLookupTables(r,n,t,1,!0)[0],i=Or(a,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});P.assert(i.coverage.format===1,"Single: unable to modify coverage table format "+i.coverage.format);var s=e.sub,o=this.binSearch(i.coverage.glyphs,s);o<0&&(o=-1-o,i.coverage.glyphs.splice(o,0,s),i.substitute.splice(o,0,0)),i.substitute[o]=e.by},ge.prototype.addMultiple=function(t,e,r,n){P.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');var a=this.getLookupTables(r,n,t,2,!0)[0],i=Or(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});P.assert(i.coverage.format===1,"Multiple: unable to modify coverage table format "+i.coverage.format);var s=e.sub,o=this.binSearch(i.coverage.glyphs,s);o<0&&(o=-1-o,i.coverage.glyphs.splice(o,0,s),i.sequences.splice(o,0,0)),i.sequences[o]=e.by},ge.prototype.addAlternate=function(t,e,r,n){var a=this.getLookupTables(r,n,t,3,!0)[0],i=Or(a,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});P.assert(i.coverage.format===1,"Alternate: unable to modify coverage table format "+i.coverage.format);var s=e.sub,o=this.binSearch(i.coverage.glyphs,s);o<0&&(o=-1-o,i.coverage.glyphs.splice(o,0,s),i.alternateSets.splice(o,0,0)),i.alternateSets[o]=e.by},ge.prototype.addLigature=function(t,e,r,n){var a=this.getLookupTables(r,n,t,4,!0)[0],i=a.subtables[0];i||(i={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},a.subtables[0]=i),P.assert(i.coverage.format===1,"Ligature: unable to modify coverage table format "+i.coverage.format);var s=e.sub[0],o=e.sub.slice(1),c={ligGlyph:e.by,components:o},u=this.binSearch(i.coverage.glyphs,s);if(u>=0){for(var h=i.ligatureSets[u],d=0;d<h.length;d++)if(Bo(h[d].components,o))return;h.push(c)}else u=-1-u,i.coverage.glyphs.splice(u,0,s),i.ligatureSets.splice(u,0,[c])},ge.prototype.getFeature=function(t,e,r){if(/ss\d\d/.test(t))return this.getSingle(t,e,r);switch(t){case"aalt":case"salt":return this.getSingle(t,e,r).concat(this.getAlternates(t,e,r));case"dlig":case"liga":case"rlig":return this.getLigatures(t,e,r);case"ccmp":return this.getMultiple(t,e,r).concat(this.getLigatures(t,e,r));case"stch":return this.getMultiple(t,e,r)}},ge.prototype.add=function(t,e,r,n){if(/ss\d\d/.test(t))return this.addSingle(t,e,r,n);switch(t){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(t,e,r,n):this.addAlternate(t,e,r,n);case"dlig":case"liga":case"rlig":return this.addLigature(t,e,r,n);case"ccmp":return e.by instanceof Array?this.addMultiple(t,e,r,n):this.addLigature(t,e,r,n)}};function Lo(){return typeof window<"u"}function Oo(t){for(var e=new Buffer(t.byteLength),r=new Uint8Array(t),n=0;n<e.length;++n)e[n]=r[n];return e}function xt(t,e){if(!t)throw e}function ka(t,e,r,n,a){var i;return(e&n)>0?(i=t.parseByte(),e&a||(i=-i),i=r+i):(e&a)>0?i=r:i=r+t.parseShort(),i}function Ta(t,e,r){var n=new _.Parser(e,r);t.numberOfContours=n.parseShort(),t._xMin=n.parseShort(),t._yMin=n.parseShort(),t._xMax=n.parseShort(),t._yMax=n.parseShort();var a,i;if(t.numberOfContours>0){for(var s=t.endPointIndices=[],o=0;o<t.numberOfContours;o+=1)s.push(n.parseUShort());t.instructionLength=n.parseUShort(),t.instructions=[];for(var c=0;c<t.instructionLength;c+=1)t.instructions.push(n.parseByte());var u=s[s.length-1]+1;a=[];for(var h=0;h<u;h+=1)if(i=n.parseByte(),a.push(i),(i&8)>0)for(var d=n.parseByte(),p=0;p<d;p+=1)a.push(i),h+=1;if(P.argument(a.length===u,"Bad flags."),s.length>0){var g=[],x;if(u>0){for(var v=0;v<u;v+=1)i=a[v],x={},x.onCurve=!!(i&1),x.lastPointOfContour=s.indexOf(v)>=0,g.push(x);for(var F=0,m=0;m<u;m+=1)i=a[m],x=g[m],x.x=ka(n,i,F,2,16),F=x.x;for(var S=0,w=0;w<u;w+=1)i=a[w],x=g[w],x.y=ka(n,i,S,4,32),S=x.y}t.points=g}else t.points=[]}else if(t.numberOfContours===0)t.points=[];else{t.isComposite=!0,t.points=[],t.components=[];for(var k=!0;k;){a=n.parseUShort();var T={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(T.dx=n.parseShort(),T.dy=n.parseShort()):T.matchedPoints=[n.parseUShort(),n.parseUShort()]:(a&2)>0?(T.dx=n.parseChar(),T.dy=n.parseChar()):T.matchedPoints=[n.parseByte(),n.parseByte()],(a&8)>0?T.xScale=T.yScale=n.parseF2Dot14():(a&64)>0?(T.xScale=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()):(a&128)>0&&(T.xScale=n.parseF2Dot14(),T.scale01=n.parseF2Dot14(),T.scale10=n.parseF2Dot14(),T.yScale=n.parseF2Dot14()),t.components.push(T),k=!!(a&32)}if(a&256){t.instructionLength=n.parseUShort(),t.instructions=[];for(var R=0;R<t.instructionLength;R+=1)t.instructions.push(n.parseByte())}}}function Mr(t,e){for(var r=[],n=0;n<t.length;n+=1){var a=t[n],i={x:e.xScale*a.x+e.scale01*a.y+e.dx,y:e.scale10*a.x+e.yScale*a.y+e.dy,onCurve:a.onCurve,lastPointOfContour:a.lastPointOfContour};r.push(i)}return r}function Mo(t){for(var e=[],r=[],n=0;n<t.length;n+=1){var a=t[n];r.push(a),a.lastPointOfContour&&(e.push(r),r=[])}return P.argument(r.length===0,"There are still points left in the current contour."),e}function Ca(t){var e=new se;if(!t)return e;for(var r=Mo(t),n=0;n<r.length;++n){var a=r[n],i=null,s=a[a.length-1],o=a[0];if(s.onCurve)e.moveTo(s.x,s.y);else if(o.onCurve)e.moveTo(o.x,o.y);else{var c={x:(s.x+o.x)*.5,y:(s.y+o.y)*.5};e.moveTo(c.x,c.y)}for(var u=0;u<a.length;++u)if(i=s,s=o,o=a[(u+1)%a.length],s.onCurve)e.lineTo(s.x,s.y);else{var h=o;i.onCurve||((s.x+i.x)*.5,(s.y+i.y)*.5),o.onCurve||(h={x:(s.x+o.x)*.5,y:(s.y+o.y)*.5}),e.quadraticCurveTo(s.x,s.y,h.x,h.y)}e.closePath()}return e}function Ea(t,e){if(e.isComposite)for(var r=0;r<e.components.length;r+=1){var n=e.components[r],a=t.get(n.glyphIndex);if(a.getPath(),a.points){var i=void 0;if(n.matchedPoints===void 0)i=Mr(a.points,n);else{if(n.matchedPoints[0]>e.points.length-1||n.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+e.name);var s=e.points[n.matchedPoints[0]],o=a.points[n.matchedPoints[1]],c={xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:0,dy:0};o=Mr([o],c)[0],c.dx=s.x-o.x,c.dy=s.y-o.y,i=Mr(a.points,c)}e.points=e.points.concat(i)}}return Ca(e.points)}function Ro(t,e,r,n){for(var a=new Oe.GlyphSet(n),i=0;i<r.length-1;i+=1){var s=r[i],o=r[i+1];s!==o?a.push(i,Oe.ttfGlyphLoader(n,i,Ta,t,e+s,Ea)):a.push(i,Oe.glyphLoader(n,i))}return a}function Io(t,e,r,n){var a=new Oe.GlyphSet(n);return n._push=function(i){var s=r[i],o=r[i+1];s!==o?a.push(i,Oe.ttfGlyphLoader(n,i,Ta,t,e+s,Ea)):a.push(i,Oe.glyphLoader(n,i))},a}function Do(t,e,r,n,a){return a.lowMemory?Io(t,e,r,n):Ro(t,e,r,n)}var Ua={getPath:Ca,parse:Do},Aa,Je,Ba,Rr;function La(t){this.font=t,this.getCommands=function(e){return Ua.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function _o(t){return t}function Oa(t){return Math.sign(t)*Math.round(Math.abs(t))}function Po(t){return Math.sign(t)*Math.round(Math.abs(t*2))/2}function No(t){return Math.sign(t)*(Math.round(Math.abs(t)+.5)-.5)}function Go(t){return Math.sign(t)*Math.ceil(Math.abs(t))}function Ho(t){return Math.sign(t)*Math.floor(Math.abs(t))}var Ma=function(t){var e=this.srPeriod,r=this.srPhase,n=this.srThreshold,a=1;return t<0&&(t=-t,a=-1),t+=n-r,t=Math.trunc(t/e)*e,t+=r,t<0?r*a:t*a},Me={x:1,y:0,axis:"x",distance:function(t,e,r,n){return(r?t.xo:t.x)-(n?e.xo:e.x)},interpolate:function(t,e,r,n){var a,i,s,o,c,u,h;if(!n||n===this){if(a=t.xo-e.xo,i=t.xo-r.xo,c=e.x-e.xo,u=r.x-r.xo,s=Math.abs(a),o=Math.abs(i),h=s+o,h===0){t.x=t.xo+(c+u)/2;return}t.x=t.xo+(c*o+u*s)/h;return}if(a=n.distance(t,e,!0,!0),i=n.distance(t,r,!0,!0),c=n.distance(e,e,!1,!0),u=n.distance(r,r,!1,!0),s=Math.abs(a),o=Math.abs(i),h=s+o,h===0){Me.setRelative(t,t,(c+u)/2,n,!0);return}Me.setRelative(t,t,(c*o+u*s)/h,n,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(t,e,r,n,a){if(!n||n===this){t.x=(a?e.xo:e.x)+r;return}var i=a?e.xo:e.x,s=a?e.yo:e.y,o=i+r*n.x,c=s+r*n.y;t.x=o+(t.y-c)/n.normalSlope},slope:0,touch:function(t){t.xTouched=!0},touched:function(t){return t.xTouched},untouch:function(t){t.xTouched=!1}},De={x:0,y:1,axis:"y",distance:function(t,e,r,n){return(r?t.yo:t.y)-(n?e.yo:e.y)},interpolate:function(t,e,r,n){var a,i,s,o,c,u,h;if(!n||n===this){if(a=t.yo-e.yo,i=t.yo-r.yo,c=e.y-e.yo,u=r.y-r.yo,s=Math.abs(a),o=Math.abs(i),h=s+o,h===0){t.y=t.yo+(c+u)/2;return}t.y=t.yo+(c*o+u*s)/h;return}if(a=n.distance(t,e,!0,!0),i=n.distance(t,r,!0,!0),c=n.distance(e,e,!1,!0),u=n.distance(r,r,!1,!0),s=Math.abs(a),o=Math.abs(i),h=s+o,h===0){De.setRelative(t,t,(c+u)/2,n,!0);return}De.setRelative(t,t,(c*o+u*s)/h,n,!0)},normalSlope:0,setRelative:function(t,e,r,n,a){if(!n||n===this){t.y=(a?e.yo:e.y)+r;return}var i=a?e.xo:e.x,s=a?e.yo:e.y,o=i+r*n.x,c=s+r*n.y;t.y=c+n.normalSlope*(t.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(t){t.yTouched=!0},touched:function(t){return t.yTouched},untouch:function(t){t.yTouched=!1}};Object.freeze(Me),Object.freeze(De);function St(t,e){this.x=t,this.y=e,this.axis=void 0,this.slope=e/t,this.normalSlope=-t/e,Object.freeze(this)}St.prototype.distance=function(t,e,r,n){return this.x*Me.distance(t,e,r,n)+this.y*De.distance(t,e,r,n)},St.prototype.interpolate=function(t,e,r,n){var a,i,s,o,c,u,h;if(s=n.distance(t,e,!0,!0),o=n.distance(t,r,!0,!0),a=n.distance(e,e,!1,!0),i=n.distance(r,r,!1,!0),c=Math.abs(s),u=Math.abs(o),h=c+u,h===0){this.setRelative(t,t,(a+i)/2,n,!0);return}this.setRelative(t,t,(a*u+i*c)/h,n,!0)},St.prototype.setRelative=function(t,e,r,n,a){n=n||this;var i=a?e.xo:e.x,s=a?e.yo:e.y,o=i+r*n.x,c=s+r*n.y,u=n.normalSlope,h=this.slope,d=t.x,p=t.y;t.x=(h*d-u*o+c-p)/(h-u),t.y=h*(t.x-d)+p},St.prototype.touch=function(t){t.xTouched=!0,t.yTouched=!0};function wt(t,e){var r=Math.sqrt(t*t+e*e);return t/=r,e/=r,t===1&&e===0?Me:t===0&&e===1?De:new St(t,e)}function _e(t,e,r,n){this.x=this.xo=Math.round(t*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=r,this.onCurve=n,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}_e.prototype.nextTouched=function(t){for(var e=this.nextPointOnContour;!t.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},_e.prototype.prevTouched=function(t){for(var e=this.prevPointOnContour;!t.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};var Ft=Object.freeze(new _e(0,0)),zo={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function ze(t,e){switch(this.env=t,this.stack=[],this.prog=e,t){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Me,this.round=Oa}}La.prototype.exec=function(t,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var r=this.font,n=this._prepState;if(!n||n.ppem!==e){var a=this._fpgmState;if(!a){ze.prototype=zo,a=this._fpgmState=new ze("fpgm",r.tables.fpgm),a.funcs=[],a.font=r,U.DEBUG&&(console.log("---EXEC FPGM---"),a.step=-1);try{Je(a)}catch(u){console.log("Hinting error in FPGM:"+u),this._errorState=3;return}}ze.prototype=a,n=this._prepState=new ze("prep",r.tables.prep),n.ppem=e;var i=r.tables.cvt;if(i)for(var s=n.cvt=new Array(i.length),o=e/r.unitsPerEm,c=0;c<i.length;c++)s[c]=i[c]*o;else n.cvt=[];U.DEBUG&&(console.log("---EXEC PREP---"),n.step=-1);try{Je(n)}catch(u){this._errorState<2&&console.log("Hinting error in PREP:"+u),this._errorState=2}}if(!(this._errorState>1))try{return Ba(t,n)}catch(u){this._errorState<1&&(console.log("Hinting error:"+u),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},Ba=function(t,e){var r=e.ppem/e.font.unitsPerEm,n=r,a=t.components,i,s,o;if(ze.prototype=e,!a)o=new ze("glyf",t.instructions),U.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),Rr(t,o,r,n),s=o.gZone;else{var c=e.font;s=[],i=[];for(var u=0;u<a.length;u++){var h=a[u],d=c.glyphs.get(h.glyphIndex);o=new ze("glyf",d.instructions),U.DEBUG&&(console.log("---EXEC COMP "+u+"---"),o.step=-1),Rr(d,o,r,n);for(var p=Math.round(h.dx*r),g=Math.round(h.dy*n),x=o.gZone,v=o.contours,F=0;F<x.length;F++){var m=x[F];m.xTouched=m.yTouched=!1,m.xo=m.x=m.x+p,m.yo=m.y=m.y+g}var S=s.length;s.push.apply(s,x);for(var w=0;w<v.length;w++)i.push(v[w]+S)}t.instructions&&!o.inhibitGridFit&&(o=new ze("glyf",t.instructions),o.gZone=o.z0=o.z1=o.z2=s,o.contours=i,s.push(new _e(0,0),new _e(Math.round(t.advanceWidth*r),0)),U.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),Je(o),s.length-=2)}return s},Rr=function(t,e,r,n){for(var a=t.points||[],i=a.length,s=e.gZone=e.z0=e.z1=e.z2=[],o=e.contours=[],c,u=0;u<i;u++)c=a[u],s[u]=new _e(c.x*r,c.y*n,c.lastPointOfContour,c.onCurve);for(var h,d,p=0;p<i;p++)c=s[p],h||(h=c,o.push(p)),c.lastPointOfContour?(c.nextPointOnContour=h,h.prevPointOnContour=c,h=void 0):(d=s[p+1],c.nextPointOnContour=d,d.prevPointOnContour=c);if(!e.inhibitGridFit){if(U.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(var g=0;g<i;g++)console.log(g,s[g].x,s[g].y)}if(s.push(new _e(0,0),new _e(Math.round(t.advanceWidth*r),0)),Je(e),s.length-=2,U.DEBUG){console.log("FINISHED GLYPH",e.stack);for(var x=0;x<i;x++)console.log(x,s[x].x,s[x].y)}}},Je=function(t){var e=t.prog;if(e){var r=e.length,n;for(t.ip=0;t.ip<r;t.ip++){if(U.DEBUG&&t.step++,n=Aa[e[t.ip]],!n)throw new Error("unknown instruction: 0x"+Number(e[t.ip]).toString(16));n(t)}}};function qt(t){for(var e=t.tZone=new Array(t.gZone.length),r=0;r<e.length;r++)e[r]=new _e(0,0)}function Ra(t,e){var r=t.prog,n=t.ip,a=1,i;do if(i=r[++n],i===88)a++;else if(i===89)a--;else if(i===64)n+=r[n+1]+1;else if(i===65)n+=2*r[n+1]+1;else if(i>=176&&i<=183)n+=i-176+1;else if(i>=184&&i<=191)n+=(i-184+1)*2;else if(e&&a===1&&i===27)break;while(a>0);t.ip=n}function Ia(t,e){U.DEBUG&&console.log(e.step,"SVTCA["+t.axis+"]"),e.fv=e.pv=e.dpv=t}function Da(t,e){U.DEBUG&&console.log(e.step,"SPVTCA["+t.axis+"]"),e.pv=e.dpv=t}function _a(t,e){U.DEBUG&&console.log(e.step,"SFVTCA["+t.axis+"]"),e.fv=t}function Pa(t,e){var r=e.stack,n=r.pop(),a=r.pop(),i=e.z2[n],s=e.z1[a];U.DEBUG&&console.log("SPVTL["+t+"]",n,a);var o,c;t?(o=i.y-s.y,c=s.x-i.x):(o=s.x-i.x,c=s.y-i.y),e.pv=e.dpv=wt(o,c)}function Na(t,e){var r=e.stack,n=r.pop(),a=r.pop(),i=e.z2[n],s=e.z1[a];U.DEBUG&&console.log("SFVTL["+t+"]",n,a);var o,c;t?(o=i.y-s.y,c=s.x-i.x):(o=s.x-i.x,c=s.y-i.y),e.fv=wt(o,c)}function Wo(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"SPVFS[]",r,n),t.pv=t.dpv=wt(n,r)}function qo(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"SPVFS[]",r,n),t.fv=wt(n,r)}function Vo(t){var e=t.stack,r=t.pv;U.DEBUG&&console.log(t.step,"GPV[]"),e.push(r.x*16384),e.push(r.y*16384)}function Xo(t){var e=t.stack,r=t.fv;U.DEBUG&&console.log(t.step,"GFV[]"),e.push(r.x*16384),e.push(r.y*16384)}function jo(t){t.fv=t.pv,U.DEBUG&&console.log(t.step,"SFVTPV[]")}function Yo(t){var e=t.stack,r=e.pop(),n=e.pop(),a=e.pop(),i=e.pop(),s=e.pop(),o=t.z0,c=t.z1,u=o[r],h=o[n],d=c[a],p=c[i],g=t.z2[s];U.DEBUG&&console.log("ISECT[], ",r,n,a,i,s);var x=u.x,v=u.y,F=h.x,m=h.y,S=d.x,w=d.y,k=p.x,T=p.y,R=(x-F)*(w-T)-(v-m)*(S-k),M=x*m-v*F,O=S*T-w*k;g.x=(M*(S-k)-O*(x-F))/R,g.y=(M*(w-T)-O*(v-m))/R}function Zo(t){t.rp0=t.stack.pop(),U.DEBUG&&console.log(t.step,"SRP0[]",t.rp0)}function $o(t){t.rp1=t.stack.pop(),U.DEBUG&&console.log(t.step,"SRP1[]",t.rp1)}function Ko(t){t.rp2=t.stack.pop(),U.DEBUG&&console.log(t.step,"SRP2[]",t.rp2)}function Qo(t){var e=t.stack.pop();switch(U.DEBUG&&console.log(t.step,"SZP0[]",e),t.zp0=e,e){case 0:t.tZone||qt(t),t.z0=t.tZone;break;case 1:t.z0=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function Jo(t){var e=t.stack.pop();switch(U.DEBUG&&console.log(t.step,"SZP1[]",e),t.zp1=e,e){case 0:t.tZone||qt(t),t.z1=t.tZone;break;case 1:t.z1=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function ec(t){var e=t.stack.pop();switch(U.DEBUG&&console.log(t.step,"SZP2[]",e),t.zp2=e,e){case 0:t.tZone||qt(t),t.z2=t.tZone;break;case 1:t.z2=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function tc(t){var e=t.stack.pop();switch(U.DEBUG&&console.log(t.step,"SZPS[]",e),t.zp0=t.zp1=t.zp2=e,e){case 0:t.tZone||qt(t),t.z0=t.z1=t.z2=t.tZone;break;case 1:t.z0=t.z1=t.z2=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function rc(t){t.loop=t.stack.pop(),U.DEBUG&&console.log(t.step,"SLOOP[]",t.loop)}function nc(t){U.DEBUG&&console.log(t.step,"RTG[]"),t.round=Oa}function ac(t){U.DEBUG&&console.log(t.step,"RTHG[]"),t.round=No}function ic(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"SMD[]",e),t.minDis=e/64}function sc(t){U.DEBUG&&console.log(t.step,"ELSE[]"),Ra(t,!1)}function oc(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"JMPR[]",e),t.ip+=e-1}function cc(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"SCVTCI[]",e),t.cvCutIn=e/64}function uc(t){var e=t.stack;U.DEBUG&&console.log(t.step,"DUP[]"),e.push(e[e.length-1])}function Ir(t){U.DEBUG&&console.log(t.step,"POP[]"),t.stack.pop()}function hc(t){U.DEBUG&&console.log(t.step,"CLEAR[]"),t.stack.length=0}function lc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"SWAP[]"),e.push(r),e.push(n)}function fc(t){var e=t.stack;U.DEBUG&&console.log(t.step,"DEPTH[]"),e.push(e.length)}function pc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"LOOPCALL[]",r,n);var a=t.ip,i=t.prog;t.prog=t.funcs[r];for(var s=0;s<n;s++)Je(t),U.DEBUG&&console.log(++t.step,s+1<n?"next loopcall":"done loopcall",s);t.ip=a,t.prog=i}function dc(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"CALL[]",e);var r=t.ip,n=t.prog;t.prog=t.funcs[e],Je(t),t.ip=r,t.prog=n,U.DEBUG&&console.log(++t.step,"returning from",e)}function gc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"CINDEX[]",r),e.push(e[e.length-r])}function vc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"MINDEX[]",r),e.push(e.splice(e.length-r,1)[0])}function yc(t){if(t.env!=="fpgm")throw new Error("FDEF not allowed here");var e=t.stack,r=t.prog,n=t.ip,a=e.pop(),i=n;for(U.DEBUG&&console.log(t.step,"FDEF[]",a);r[++n]!==45;);t.ip=n,t.funcs[a]=r.slice(i+1,n)}function Ga(t,e){var r=e.stack.pop(),n=e.z0[r],a=e.fv,i=e.pv;U.DEBUG&&console.log(e.step,"MDAP["+t+"]",r);var s=i.distance(n,Ft);t&&(s=e.round(s)),a.setRelative(n,Ft,s,i),a.touch(n),e.rp0=e.rp1=r}function Ha(t,e){var r=e.z2,n=r.length-2,a,i,s;U.DEBUG&&console.log(e.step,"IUP["+t.axis+"]");for(var o=0;o<n;o++)a=r[o],!t.touched(a)&&(i=a.prevTouched(t),i!==a&&(s=a.nextTouched(t),i===s&&t.setRelative(a,a,t.distance(i,i,!1,!0),t,!0),t.interpolate(a,i,s,t)))}function za(t,e){for(var r=e.stack,n=t?e.rp1:e.rp2,a=(t?e.z0:e.z1)[n],i=e.fv,s=e.pv,o=e.loop,c=e.z2;o--;){var u=r.pop(),h=c[u],d=s.distance(a,a,!1,!0);i.setRelative(h,h,d,s),i.touch(h),U.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-o)+": ":"")+"SHP["+(t?"rp1":"rp2")+"]",u)}e.loop=1}function Wa(t,e){var r=e.stack,n=t?e.rp1:e.rp2,a=(t?e.z0:e.z1)[n],i=e.fv,s=e.pv,o=r.pop(),c=e.z2[e.contours[o]],u=c;U.DEBUG&&console.log(e.step,"SHC["+t+"]",o);var h=s.distance(a,a,!1,!0);do u!==a&&i.setRelative(u,u,h,s),u=u.nextPointOnContour;while(u!==c)}function qa(t,e){var r=e.stack,n=t?e.rp1:e.rp2,a=(t?e.z0:e.z1)[n],i=e.fv,s=e.pv,o=r.pop();U.DEBUG&&console.log(e.step,"SHZ["+t+"]",o);var c;switch(o){case 0:c=e.tZone;break;case 1:c=e.gZone;break;default:throw new Error("Invalid zone")}for(var u,h=s.distance(a,a,!1,!0),d=c.length-2,p=0;p<d;p++)u=c[p],i.setRelative(u,u,h,s)}function mc(t){for(var e=t.stack,r=t.loop,n=t.fv,a=e.pop()/64,i=t.z2;r--;){var s=e.pop(),o=i[s];U.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-r)+": ":"")+"SHPIX[]",s,a),n.setRelative(o,o,a),n.touch(o)}t.loop=1}function bc(t){for(var e=t.stack,r=t.rp1,n=t.rp2,a=t.loop,i=t.z0[r],s=t.z1[n],o=t.fv,c=t.dpv,u=t.z2;a--;){var h=e.pop(),d=u[h];U.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-a)+": ":"")+"IP[]",h,r,"<->",n),o.interpolate(d,i,s,c),o.touch(d)}t.loop=1}function Va(t,e){var r=e.stack,n=r.pop()/64,a=r.pop(),i=e.z1[a],s=e.z0[e.rp0],o=e.fv,c=e.pv;o.setRelative(i,s,n,c),o.touch(i),U.DEBUG&&console.log(e.step,"MSIRP["+t+"]",n,a),e.rp1=e.rp0,e.rp2=a,t&&(e.rp0=a)}function xc(t){for(var e=t.stack,r=t.rp0,n=t.z0[r],a=t.loop,i=t.fv,s=t.pv,o=t.z1;a--;){var c=e.pop(),u=o[c];U.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-a)+": ":"")+"ALIGNRP[]",c),i.setRelative(u,n,0,s),i.touch(u)}t.loop=1}function Sc(t){U.DEBUG&&console.log(t.step,"RTDG[]"),t.round=Po}function Xa(t,e){var r=e.stack,n=r.pop(),a=r.pop(),i=e.z0[a],s=e.fv,o=e.pv,c=e.cvt[n];U.DEBUG&&console.log(e.step,"MIAP["+t+"]",n,"(",c,")",a);var u=o.distance(i,Ft);t&&(Math.abs(u-c)<e.cvCutIn&&(u=c),u=e.round(u)),s.setRelative(i,Ft,u,o),e.zp0===0&&(i.xo=i.x,i.yo=i.y),s.touch(i),e.rp0=e.rp1=a}function wc(t){var e=t.prog,r=t.ip,n=t.stack,a=e[++r];U.DEBUG&&console.log(t.step,"NPUSHB[]",a);for(var i=0;i<a;i++)n.push(e[++r]);t.ip=r}function Fc(t){var e=t.ip,r=t.prog,n=t.stack,a=r[++e];U.DEBUG&&console.log(t.step,"NPUSHW[]",a);for(var i=0;i<a;i++){var s=r[++e]<<8|r[++e];s&32768&&(s=-((s^65535)+1)),n.push(s)}t.ip=e}function kc(t){var e=t.stack,r=t.store;r||(r=t.store=[]);var n=e.pop(),a=e.pop();U.DEBUG&&console.log(t.step,"WS",n,a),r[a]=n}function Tc(t){var e=t.stack,r=t.store,n=e.pop();U.DEBUG&&console.log(t.step,"RS",n);var a=r&&r[n]||0;e.push(a)}function Cc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"WCVTP",r,n),t.cvt[n]=r/64}function Ec(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"RCVT",r),e.push(t.cvt[r]*64)}function ja(t,e){var r=e.stack,n=r.pop(),a=e.z2[n];U.DEBUG&&console.log(e.step,"GC["+t+"]",n),r.push(e.dpv.distance(a,Ft,t,!1)*64)}function Ya(t,e){var r=e.stack,n=r.pop(),a=r.pop(),i=e.z1[n],s=e.z0[a],o=e.dpv.distance(s,i,t,t);U.DEBUG&&console.log(e.step,"MD["+t+"]",n,a,"->",o),e.stack.push(Math.round(o*64))}function Uc(t){U.DEBUG&&console.log(t.step,"MPPEM[]"),t.stack.push(t.ppem)}function Ac(t){U.DEBUG&&console.log(t.step,"FLIPON[]"),t.autoFlip=!0}function Bc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"LT[]",r,n),e.push(n<r?1:0)}function Lc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"LTEQ[]",r,n),e.push(n<=r?1:0)}function Oc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"GT[]",r,n),e.push(n>r?1:0)}function Mc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"GTEQ[]",r,n),e.push(n>=r?1:0)}function Rc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"EQ[]",r,n),e.push(r===n?1:0)}function Ic(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"NEQ[]",r,n),e.push(r!==n?1:0)}function Dc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"ODD[]",r),e.push(Math.trunc(r)%2?1:0)}function _c(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"EVEN[]",r),e.push(Math.trunc(r)%2?0:1)}function Pc(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"IF[]",e),e||(Ra(t,!0),U.DEBUG&&console.log(t.step,"EIF[]"))}function Nc(t){U.DEBUG&&console.log(t.step,"EIF[]")}function Gc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"AND[]",r,n),e.push(r&&n?1:0)}function Hc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"OR[]",r,n),e.push(r||n?1:0)}function zc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"NOT[]",r),e.push(r?0:1)}function Dr(t,e){var r=e.stack,n=r.pop(),a=e.fv,i=e.pv,s=e.ppem,o=e.deltaBase+(t-1)*16,c=e.deltaShift,u=e.z0;U.DEBUG&&console.log(e.step,"DELTAP["+t+"]",n,r);for(var h=0;h<n;h++){var d=r.pop(),p=r.pop(),g=o+((p&240)>>4);if(g===s){var x=(p&15)-8;x>=0&&x++,U.DEBUG&&console.log(e.step,"DELTAPFIX",d,"by",x*c);var v=u[d];a.setRelative(v,v,x*c,i)}}}function Wc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"SDB[]",r),t.deltaBase=r}function qc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"SDS[]",r),t.deltaShift=Math.pow(.5,r)}function Vc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"ADD[]",r,n),e.push(n+r)}function Xc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"SUB[]",r,n),e.push(n-r)}function jc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"DIV[]",r,n),e.push(n*64/r)}function Yc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"MUL[]",r,n),e.push(n*r/64)}function Zc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"ABS[]",r),e.push(Math.abs(r))}function $c(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"NEG[]",r),e.push(-r)}function Kc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"FLOOR[]",r),e.push(Math.floor(r/64)*64)}function Qc(t){var e=t.stack,r=e.pop();U.DEBUG&&console.log(t.step,"CEILING[]",r),e.push(Math.ceil(r/64)*64)}function Vt(t,e){var r=e.stack,n=r.pop();U.DEBUG&&console.log(e.step,"ROUND[]"),r.push(e.round(n/64)*64)}function Jc(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"WCVTF[]",r,n),t.cvt[n]=r*t.ppem/t.font.unitsPerEm}function _r(t,e){var r=e.stack,n=r.pop(),a=e.ppem,i=e.deltaBase+(t-1)*16,s=e.deltaShift;U.DEBUG&&console.log(e.step,"DELTAC["+t+"]",n,r);for(var o=0;o<n;o++){var c=r.pop(),u=r.pop(),h=i+((u&240)>>4);if(h===a){var d=(u&15)-8;d>=0&&d++;var p=d*s;U.DEBUG&&console.log(e.step,"DELTACFIX",c,"by",p),e.cvt[c]+=p}}}function eu(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"SROUND[]",e),t.round=Ma;var r;switch(e&192){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw new Error("invalid SROUND value")}switch(t.srPeriod=r,e&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*r;break;case 32:t.srPhase=.5*r;break;case 48:t.srPhase=.75*r;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?t.srThreshold=0:t.srThreshold=(e/8-.5)*r}function tu(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"S45ROUND[]",e),t.round=Ma;var r;switch(e&192){case 0:r=Math.sqrt(2)/2;break;case 64:r=Math.sqrt(2);break;case 128:r=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(t.srPeriod=r,e&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*r;break;case 32:t.srPhase=.5*r;break;case 48:t.srPhase=.75*r;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?t.srThreshold=0:t.srThreshold=(e/8-.5)*r}function ru(t){U.DEBUG&&console.log(t.step,"ROFF[]"),t.round=_o}function nu(t){U.DEBUG&&console.log(t.step,"RUTG[]"),t.round=Go}function au(t){U.DEBUG&&console.log(t.step,"RDTG[]"),t.round=Ho}function iu(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"SCANCTRL[]",e)}function Za(t,e){var r=e.stack,n=r.pop(),a=r.pop(),i=e.z2[n],s=e.z1[a];U.DEBUG&&console.log(e.step,"SDPVTL["+t+"]",n,a);var o,c;t?(o=i.y-s.y,c=s.x-i.x):(o=s.x-i.x,c=s.y-i.y),e.dpv=wt(o,c)}function su(t){var e=t.stack,r=e.pop(),n=0;U.DEBUG&&console.log(t.step,"GETINFO[]",r),r&1&&(n=35),r&32&&(n|=4096),e.push(n)}function ou(t){var e=t.stack,r=e.pop(),n=e.pop(),a=e.pop();U.DEBUG&&console.log(t.step,"ROLL[]"),e.push(n),e.push(r),e.push(a)}function cu(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"MAX[]",r,n),e.push(Math.max(n,r))}function uu(t){var e=t.stack,r=e.pop(),n=e.pop();U.DEBUG&&console.log(t.step,"MIN[]",r,n),e.push(Math.min(n,r))}function hu(t){var e=t.stack.pop();U.DEBUG&&console.log(t.step,"SCANTYPE[]",e)}function lu(t){var e=t.stack.pop(),r=t.stack.pop();switch(U.DEBUG&&console.log(t.step,"INSTCTRL[]",e,r),e){case 1:t.inhibitGridFit=!!r;return;case 2:t.ignoreCvt=!!r;return;default:throw new Error("invalid INSTCTRL[] selector")}}function We(t,e){var r=e.stack,n=e.prog,a=e.ip;U.DEBUG&&console.log(e.step,"PUSHB["+t+"]");for(var i=0;i<t;i++)r.push(n[++a]);e.ip=a}function qe(t,e){var r=e.ip,n=e.prog,a=e.stack;U.DEBUG&&console.log(e.ip,"PUSHW["+t+"]");for(var i=0;i<t;i++){var s=n[++r]<<8|n[++r];s&32768&&(s=-((s^65535)+1)),a.push(s)}e.ip=r}function D(t,e,r,n,a,i){var s=i.stack,o=t&&s.pop(),c=s.pop(),u=i.rp0,h=i.z0[u],d=i.z1[c],p=i.minDis,g=i.fv,x=i.dpv,v,F,m,S;F=v=x.distance(d,h,!0,!0),m=F>=0?1:-1,F=Math.abs(F),t&&(S=i.cvt[o],n&&Math.abs(F-S)<i.cvCutIn&&(F=S)),r&&F<p&&(F=p),n&&(F=i.round(F)),g.setRelative(d,h,m*F,x),g.touch(d),U.DEBUG&&console.log(i.step,(t?"MIRP[":"MDRP[")+(e?"M":"m")+(r?">":"_")+(n?"R":"_")+(a===0?"Gr":a===1?"Bl":a===2?"Wh":"")+"]",t?o+"("+i.cvt[o]+","+S+")":"",c,"(d =",v,"->",m*F,")"),i.rp1=i.rp0,i.rp2=c,e&&(i.rp0=c)}Aa=[Ia.bind(void 0,De),Ia.bind(void 0,Me),Da.bind(void 0,De),Da.bind(void 0,Me),_a.bind(void 0,De),_a.bind(void 0,Me),Pa.bind(void 0,0),Pa.bind(void 0,1),Na.bind(void 0,0),Na.bind(void 0,1),Wo,qo,Vo,Xo,jo,Yo,Zo,$o,Ko,Qo,Jo,ec,tc,rc,nc,ac,ic,sc,oc,cc,void 0,void 0,uc,Ir,hc,lc,fc,gc,vc,void 0,void 0,void 0,pc,dc,yc,void 0,Ga.bind(void 0,0),Ga.bind(void 0,1),Ha.bind(void 0,De),Ha.bind(void 0,Me),za.bind(void 0,0),za.bind(void 0,1),Wa.bind(void 0,0),Wa.bind(void 0,1),qa.bind(void 0,0),qa.bind(void 0,1),mc,bc,Va.bind(void 0,0),Va.bind(void 0,1),xc,Sc,Xa.bind(void 0,0),Xa.bind(void 0,1),wc,Fc,kc,Tc,Cc,Ec,ja.bind(void 0,0),ja.bind(void 0,1),void 0,Ya.bind(void 0,0),Ya.bind(void 0,1),Uc,void 0,Ac,void 0,void 0,Bc,Lc,Oc,Mc,Rc,Ic,Dc,_c,Pc,Nc,Gc,Hc,zc,Dr.bind(void 0,1),Wc,qc,Vc,Xc,jc,Yc,Zc,$c,Kc,Qc,Vt.bind(void 0,0),Vt.bind(void 0,1),Vt.bind(void 0,2),Vt.bind(void 0,3),void 0,void 0,void 0,void 0,Jc,Dr.bind(void 0,2),Dr.bind(void 0,3),_r.bind(void 0,1),_r.bind(void 0,2),_r.bind(void 0,3),eu,tu,void 0,void 0,ru,void 0,nu,au,Ir,Ir,void 0,void 0,void 0,void 0,void 0,iu,Za.bind(void 0,0),Za.bind(void 0,1),su,void 0,ou,cu,uu,hu,lu,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,We.bind(void 0,1),We.bind(void 0,2),We.bind(void 0,3),We.bind(void 0,4),We.bind(void 0,5),We.bind(void 0,6),We.bind(void 0,7),We.bind(void 0,8),qe.bind(void 0,1),qe.bind(void 0,2),qe.bind(void 0,3),qe.bind(void 0,4),qe.bind(void 0,5),qe.bind(void 0,6),qe.bind(void 0,7),qe.bind(void 0,8),D.bind(void 0,0,0,0,0,0),D.bind(void 0,0,0,0,0,1),D.bind(void 0,0,0,0,0,2),D.bind(void 0,0,0,0,0,3),D.bind(void 0,0,0,0,1,0),D.bind(void 0,0,0,0,1,1),D.bind(void 0,0,0,0,1,2),D.bind(void 0,0,0,0,1,3),D.bind(void 0,0,0,1,0,0),D.bind(void 0,0,0,1,0,1),D.bind(void 0,0,0,1,0,2),D.bind(void 0,0,0,1,0,3),D.bind(void 0,0,0,1,1,0),D.bind(void 0,0,0,1,1,1),D.bind(void 0,0,0,1,1,2),D.bind(void 0,0,0,1,1,3),D.bind(void 0,0,1,0,0,0),D.bind(void 0,0,1,0,0,1),D.bind(void 0,0,1,0,0,2),D.bind(void 0,0,1,0,0,3),D.bind(void 0,0,1,0,1,0),D.bind(void 0,0,1,0,1,1),D.bind(void 0,0,1,0,1,2),D.bind(void 0,0,1,0,1,3),D.bind(void 0,0,1,1,0,0),D.bind(void 0,0,1,1,0,1),D.bind(void 0,0,1,1,0,2),D.bind(void 0,0,1,1,0,3),D.bind(void 0,0,1,1,1,0),D.bind(void 0,0,1,1,1,1),D.bind(void 0,0,1,1,1,2),D.bind(void 0,0,1,1,1,3),D.bind(void 0,1,0,0,0,0),D.bind(void 0,1,0,0,0,1),D.bind(void 0,1,0,0,0,2),D.bind(void 0,1,0,0,0,3),D.bind(void 0,1,0,0,1,0),D.bind(void 0,1,0,0,1,1),D.bind(void 0,1,0,0,1,2),D.bind(void 0,1,0,0,1,3),D.bind(void 0,1,0,1,0,0),D.bind(void 0,1,0,1,0,1),D.bind(void 0,1,0,1,0,2),D.bind(void 0,1,0,1,0,3),D.bind(void 0,1,0,1,1,0),D.bind(void 0,1,0,1,1,1),D.bind(void 0,1,0,1,1,2),D.bind(void 0,1,0,1,1,3),D.bind(void 0,1,1,0,0,0),D.bind(void 0,1,1,0,0,1),D.bind(void 0,1,1,0,0,2),D.bind(void 0,1,1,0,0,3),D.bind(void 0,1,1,0,1,0),D.bind(void 0,1,1,0,1,1),D.bind(void 0,1,1,0,1,2),D.bind(void 0,1,1,0,1,3),D.bind(void 0,1,1,1,0,0),D.bind(void 0,1,1,1,0,1),D.bind(void 0,1,1,1,0,2),D.bind(void 0,1,1,1,0,3),D.bind(void 0,1,1,1,1,0),D.bind(void 0,1,1,1,1,1),D.bind(void 0,1,1,1,1,2),D.bind(void 0,1,1,1,1,3)];function st(t){this.char=t,this.state={},this.activeState=null}function Pr(t,e,r){this.contextName=r,this.startIndex=t,this.endOffset=e}function fu(t,e,r){this.contextName=t,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=r}function Te(t,e){this.context=t,this.index=e,this.length=t.length,this.current=t[e],this.backtrack=t.slice(0,e),this.lookahead=t.slice(e+1)}function Xt(t){this.eventId=t,this.subscribers=[]}function pu(t){var e=this,r=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];r.forEach(function(a){Object.defineProperty(e.events,a,{value:new Xt(a)})}),t&&r.forEach(function(a){var i=t[a];typeof i=="function"&&e.events[a].subscribe(i)});var n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];n.forEach(function(a){e.events[a].subscribe(e.updateContextsRanges)})}function Q(t){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],pu.call(this,t)}st.prototype.setState=function(t,e){return this.state[t]=e,this.activeState={key:t,value:this.state[t]},this.activeState},st.prototype.getState=function(t){return this.state[t]||null},Q.prototype.inboundIndex=function(t){return t>=0&&t<this.tokens.length},Q.prototype.composeRUD=function(t){var e=this,r=!0,n=t.map(function(i){return e[i[0]].apply(e,i.slice(1).concat(r))}),a=function(i){return typeof i=="object"&&i.hasOwnProperty("FAIL")};if(n.every(a))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:n.filter(a)};this.dispatch("composeRUD",[n.filter(function(i){return!a(i)})])},Q.prototype.replaceRange=function(t,e,r,n){e=e!==null?e:this.tokens.length;var a=r.every(function(s){return s instanceof st});if(!isNaN(t)&&this.inboundIndex(t)&&a){var i=this.tokens.splice.apply(this.tokens,[t,e].concat(r));return n||this.dispatch("replaceToken",[t,e,r]),[i,r]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},Q.prototype.replaceToken=function(t,e,r){if(!isNaN(t)&&this.inboundIndex(t)&&e instanceof st){var n=this.tokens.splice(t,1,e);return r||this.dispatch("replaceToken",[t,e]),[n[0],e]}else return{FAIL:"replaceToken: invalid token or index."}},Q.prototype.removeRange=function(t,e,r){e=isNaN(e)?this.tokens.length:e;var n=this.tokens.splice(t,e);return r||this.dispatch("removeRange",[n,t,e]),n},Q.prototype.removeToken=function(t,e){if(!isNaN(t)&&this.inboundIndex(t)){var r=this.tokens.splice(t,1);return e||this.dispatch("removeToken",[r,t]),r}else return{FAIL:"removeToken: invalid token index."}},Q.prototype.insertToken=function(t,e,r){var n=t.every(function(a){return a instanceof st});return n?(this.tokens.splice.apply(this.tokens,[e,0].concat(t)),r||this.dispatch("insertToken",[t,e]),t):{FAIL:"insertToken: invalid token(s)."}},Q.prototype.registerModifier=function(t,e,r){this.events.newToken.subscribe(function(n,a){var i=[n,a],s=e===null||e.apply(this,i)===!0,o=[n,a];if(s){var c=r.apply(this,o);n.setState(t,c)}}),this.registeredModifiers.push(t)},Xt.prototype.subscribe=function(t){return typeof t=="function"?this.subscribers.push(t)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}},Xt.prototype.unsubscribe=function(t){this.subscribers.splice(t,1)},Te.prototype.setCurrentIndex=function(t){this.index=t,this.current=this.context[t],this.backtrack=this.context.slice(0,t),this.lookahead=this.context.slice(t+1)},Te.prototype.get=function(t){switch(!0){case t===0:return this.current;case(t<0&&Math.abs(t)<=this.backtrack.length):return this.backtrack.slice(t)[0];case(t>0&&t<=this.lookahead.length):return this.lookahead[t-1];default:return null}},Q.prototype.rangeToText=function(t){if(t instanceof Pr)return this.getRangeTokens(t).map(function(e){return e.char}).join("")},Q.prototype.getText=function(){return this.tokens.map(function(t){return t.char}).join("")},Q.prototype.getContext=function(t){var e=this.registeredContexts[t];return e||null},Q.prototype.on=function(t,e){var r=this.events[t];return r?r.subscribe(e):null},Q.prototype.dispatch=function(t,e){var r=this,n=this.events[t];n instanceof Xt&&n.subscribers.forEach(function(a){a.apply(r,e||[])})},Q.prototype.registerContextChecker=function(t,e,r){if(this.getContext(t))return{FAIL:"context name '"+t+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof r!="function")return{FAIL:"missing context end check."};var n=new fu(t,e,r);return this.registeredContexts[t]=n,this.contextCheckers.push(n),n},Q.prototype.getRangeTokens=function(t){var e=t.startIndex+t.endOffset;return[].concat(this.tokens.slice(t.startIndex,e))},Q.prototype.getContextRanges=function(t){var e=this.getContext(t);return e?e.ranges:{FAIL:"context checker '"+t+"' is not registered."}},Q.prototype.resetContextsRanges=function(){var t=this.registeredContexts;for(var e in t)if(t.hasOwnProperty(e)){var r=t[e];r.ranges=[]}},Q.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var t=this.tokens.map(function(n){return n.char}),e=0;e<t.length;e++){var r=new Te(t,e);this.runContextCheck(r)}this.dispatch("updateContextsRanges",[this.registeredContexts])},Q.prototype.setEndOffset=function(t,e){var r=this.getContext(e).openRange.startIndex,n=new Pr(r,t,e),a=this.getContext(e).ranges;return n.rangeId=e+"."+a.length,a.push(n),this.getContext(e).openRange=null,n},Q.prototype.runContextCheck=function(t){var e=this,r=t.index;this.contextCheckers.forEach(function(n){var a=n.contextName,i=e.getContext(a).openRange;if(!i&&n.checkStart(t)&&(i=new Pr(r,null,a),e.getContext(a).openRange=i,e.dispatch("contextStart",[a,r])),i&&n.checkEnd(t)){var s=r-i.startIndex+1,o=e.setEndOffset(s,a);e.dispatch("contextEnd",[a,o])}})},Q.prototype.tokenize=function(t){this.tokens=[],this.resetContextsRanges();var e=Array.from(t);this.dispatch("start");for(var r=0;r<e.length;r++){var n=e[r],a=new Te(e,r);this.dispatch("next",[a]),this.runContextCheck(a);var i=new st(n);this.tokens.push(i),this.dispatch("newToken",[i,a])}return this.dispatch("end",[this.tokens]),this.tokens};function Ve(t){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(t)}function $a(t){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(t)}function Xe(t){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(t)}function jt(t){return/[A-z]/.test(t)}function du(t){return/\s/.test(t)}function ve(t){this.font=t,this.features={}}function et(t){this.id=t.id,this.tag=t.tag,this.substitution=t.substitution}function kt(t,e){if(!t)return-1;switch(e.format){case 1:return e.glyphs.indexOf(t);case 2:for(var r=e.ranges,n=0;n<r.length;n++){var a=r[n];if(t>=a.start&&t<=a.end){var i=t-a.start;return a.index+i}}break;default:return-1}return-1}function gu(t,e){var r=kt(t,e.coverage);return r===-1?null:t+e.deltaGlyphId}function vu(t,e){var r=kt(t,e.coverage);return r===-1?null:e.substitute[r]}function Nr(t,e){for(var r=[],n=0;n<t.length;n++){var a=t[n],i=e.current;i=Array.isArray(i)?i[0]:i;var s=kt(i,a);s!==-1&&r.push(s)}return r.length!==t.length?-1:r}function yu(t,e){var r=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(t.context.length<r)return[];var n=Nr(e.inputCoverage,t);if(n===-1)return[];var a=e.inputCoverage.length-1;if(t.lookahead.length<e.lookaheadCoverage.length)return[];for(var i=t.lookahead.slice(a);i.length&&Xe(i[0].char);)i.shift();var s=new Te(i,0),o=Nr(e.lookaheadCoverage,s),c=[].concat(t.backtrack);for(c.reverse();c.length&&Xe(c[0].char);)c.shift();if(c.length<e.backtrackCoverage.length)return[];var u=new Te(c,0),h=Nr(e.backtrackCoverage,u),d=n.length===e.inputCoverage.length&&o.length===e.lookaheadCoverage.length&&h.length===e.backtrackCoverage.length,p=[];if(d)for(var g=0;g<e.lookupRecords.length;g++)for(var x=e.lookupRecords[g],v=x.lookupListIndex,F=this.getLookupByIndex(v),m=0;m<F.subtables.length;m++){var S=F.subtables[m],w=this.getLookupMethod(F,S),k=this.getSubstitutionType(F,S);if(k==="12")for(var T=0;T<n.length;T++){var R=t.get(T),M=w(R);M&&p.push(M)}}return p}function mu(t,e){var r=t.current,n=kt(r,e.coverage);if(n===-1)return null;for(var a,i=e.ligatureSets[n],s=0;s<i.length;s++){a=i[s];for(var o=0;o<a.components.length;o++){var c=t.lookahead[o],u=a.components[o];if(c!==u)break;if(o===a.components.length-1)return a}}return null}function bu(t,e){var r=kt(t,e.coverage);return r===-1?null:e.sequences[r]}ve.prototype.getDefaultScriptFeaturesIndexes=function(){for(var t=this.font.tables.gsub.scripts,e=0;e<t.length;e++){var r=t[e];if(r.tag==="DFLT")return r.script.defaultLangSys.featureIndexes}return[]},ve.prototype.getScriptFeaturesIndexes=function(t){var e=this.font.tables;if(!e.gsub)return[];if(!t)return this.getDefaultScriptFeaturesIndexes();for(var r=this.font.tables.gsub.scripts,n=0;n<r.length;n++){var a=r[n];if(a.tag===t&&a.script.defaultLangSys)return a.script.defaultLangSys.featureIndexes;var i=a.langSysRecords;if(i)for(var s=0;s<i.length;s++){var o=i[s];if(o.tag===t){var c=o.langSys;return c.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},ve.prototype.mapTagsToFeatures=function(t,e){for(var r={},n=0;n<t.length;n++){var a=t[n].tag,i=t[n].feature;r[a]=i}this.features[e].tags=r},ve.prototype.getScriptFeatures=function(t){var e=this.features[t];if(this.features.hasOwnProperty(t))return e;var r=this.getScriptFeaturesIndexes(t);if(!r)return null;var n=this.font.tables.gsub;return e=r.map(function(a){return n.features[a]}),this.features[t]=e,this.mapTagsToFeatures(e,t),e},ve.prototype.getSubstitutionType=function(t,e){var r=t.lookupType.toString(),n=e.substFormat.toString();return r+n},ve.prototype.getLookupMethod=function(t,e){var r=this,n=this.getSubstitutionType(t,e);switch(n){case"11":return function(a){return gu.apply(r,[a,e])};case"12":return function(a){return vu.apply(r,[a,e])};case"63":return function(a){return yu.apply(r,[a,e])};case"41":return function(a){return mu.apply(r,[a,e])};case"21":return function(a){return bu.apply(r,[a,e])};default:throw new Error("lookupType: "+t.lookupType+" - substFormat: "+e.substFormat+" is not yet supported")}},ve.prototype.lookupFeature=function(t){var e=t.contextParams,r=e.index,n=this.getFeature({tag:t.tag,script:t.script});if(!n)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+t.tag+"' for script '"+t.script+"'.");for(var a=this.getFeatureLookups(n),i=[].concat(e.context),s=0;s<a.length;s++)for(var o=a[s],c=this.getLookupSubtables(o),u=0;u<c.length;u++){var h=c[u],d=this.getSubstitutionType(o,h),p=this.getLookupMethod(o,h),g=void 0;switch(d){case"11":g=p(e.current),g&&i.splice(r,1,new et({id:11,tag:t.tag,substitution:g}));break;case"12":g=p(e.current),g&&i.splice(r,1,new et({id:12,tag:t.tag,substitution:g}));break;case"63":g=p(e),Array.isArray(g)&&g.length&&i.splice(r,1,new et({id:63,tag:t.tag,substitution:g}));break;case"41":g=p(e),g&&i.splice(r,1,new et({id:41,tag:t.tag,substitution:g}));break;case"21":g=p(e.current),g&&i.splice(r,1,new et({id:21,tag:t.tag,substitution:g}));break}e=new Te(i,r),!(Array.isArray(g)&&!g.length)&&(g=null)}return i.length?i:null},ve.prototype.supports=function(t){if(!t.script)return!1;this.getScriptFeatures(t.script);var e=this.features.hasOwnProperty(t.script);if(!t.tag)return e;var r=this.features[t.script].some(function(n){return n.tag===t.tag});return e&&r},ve.prototype.getLookupSubtables=function(t){return t.subtables||null},ve.prototype.getLookupByIndex=function(t){var e=this.font.tables.gsub.lookups;return e[t]||null},ve.prototype.getFeatureLookups=function(t){return t.lookupListIndexes.map(this.getLookupByIndex.bind(this))},ve.prototype.getFeature=function(e){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(e.script)||this.getScriptFeatures(e.script);var r=this.features[e.script];return r?r.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:"No feature for script "+e.script}};function xu(t){var e=t.current,r=t.get(-1);return r===null&&Ve(e)||!Ve(r)&&Ve(e)}function Su(t){var e=t.get(1);return e===null||!Ve(e)}var wu={startCheck:xu,endCheck:Su};function Fu(t){var e=t.current,r=t.get(-1);return(Ve(e)||Xe(e))&&!Ve(r)}function ku(t){var e=t.get(1);switch(!0){case e===null:return!0;case(!Ve(e)&&!Xe(e)):var r=du(e);if(!r)return!0;if(r){var n=!1;if(n=t.lookahead.some(function(a){return Ve(a)||Xe(a)}),!n)return!0}break;default:return!1}}var Tu={startCheck:Fu,endCheck:ku};function Cu(t,e,r){e[r].setState(t.tag,t.substitution)}function Eu(t,e,r){e[r].setState(t.tag,t.substitution)}function Uu(t,e,r){t.substitution.forEach(function(n,a){var i=e[r+a];i.setState(t.tag,n)})}function Au(t,e,r){var n=e[r];n.setState(t.tag,t.substitution.ligGlyph);for(var a=t.substitution.components.length,i=0;i<a;i++)n=e[r+i+1],n.setState("deleted",!0)}var Ka={11:Cu,12:Eu,63:Uu,41:Au};function Gr(t,e,r){t instanceof et&&Ka[t.id]&&Ka[t.id](t,e,r)}function Bu(t){for(var e=[].concat(t.backtrack),r=e.length-1;r>=0;r--){var n=e[r],a=$a(n),i=Xe(n);if(!a&&!i)return!0;if(a)return!1}return!1}function Lu(t){if($a(t.current))return!1;for(var e=0;e<t.lookahead.length;e++){var r=t.lookahead[e],n=Xe(r);if(!n)return!0}return!1}function Ou(t){var e=this,r="arab",n=this.featuresTags[r],a=this.tokenizer.getRangeTokens(t);if(a.length!==1){var i=new Te(a.map(function(o){return o.getState("glyphIndex")}),0),s=new Te(a.map(function(o){return o.char}),0);a.forEach(function(o,c){if(!Xe(o.char)){i.setCurrentIndex(c),s.setCurrentIndex(c);var u=0;Bu(s)&&(u|=1),Lu(s)&&(u|=2);var h;switch(u){case 1:h="fina";break;case 2:h="init";break;case 3:h="medi";break}if(n.indexOf(h)!==-1){var d=e.query.lookupFeature({tag:h,script:r,contextParams:i});if(d instanceof Error)return console.info(d.message);d.forEach(function(p,g){p instanceof et&&(Gr(p,a,g),i.context[g]=p.substitution)})}}})}}function Qa(t,e){var r=t.map(function(n){return n.activeState.value});return new Te(r,0)}function Mu(t){var e=this,r="arab",n=this.tokenizer.getRangeTokens(t),a=Qa(n);a.context.forEach(function(i,s){a.setCurrentIndex(s);var o=e.query.lookupFeature({tag:"rlig",script:r,contextParams:a});o.length&&(o.forEach(function(c){return Gr(c,n,s)}),a=Qa(n))})}function Ru(t){var e=t.current,r=t.get(-1);return r===null&&jt(e)||!jt(r)&&jt(e)}function Iu(t){var e=t.get(1);return e===null||!jt(e)}var Du={startCheck:Ru,endCheck:Iu};function Ja(t,e){var r=t.map(function(n){return n.activeState.value});return new Te(r,0)}function _u(t){var e=this,r="latn",n=this.tokenizer.getRangeTokens(t),a=Ja(n);a.context.forEach(function(i,s){a.setCurrentIndex(s);var o=e.query.lookupFeature({tag:"liga",script:r,contextParams:a});o.length&&(o.forEach(function(c){return Gr(c,n,s)}),a=Ja(n))})}function Ce(t){this.baseDir=t||"ltr",this.tokenizer=new Q,this.featuresTags={}}Ce.prototype.setText=function(t){this.text=t},Ce.prototype.contextChecks={latinWordCheck:Du,arabicWordCheck:wu,arabicSentenceCheck:Tu};function Hr(t){var e=this.contextChecks[t+"Check"];return this.tokenizer.registerContextChecker(t,e.startCheck,e.endCheck)}function Pu(){return Hr.call(this,"latinWord"),Hr.call(this,"arabicWord"),Hr.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function Nu(){var t=this,e=this.tokenizer.getContextRanges("arabicSentence");e.forEach(function(r){var n=t.tokenizer.getRangeTokens(r);t.tokenizer.replaceRange(r.startIndex,r.endOffset,n.reverse())})}Ce.prototype.registerFeatures=function(t,e){var r=this,n=e.filter(function(a){return r.query.supports({script:t,tag:a})});this.featuresTags.hasOwnProperty(t)?this.featuresTags[t]=this.featuresTags[t].concat(n):this.featuresTags[t]=n},Ce.prototype.applyFeatures=function(t,e){if(!t)throw new Error("No valid font was provided to apply features");this.query||(this.query=new ve(t));for(var r=0;r<e.length;r++){var n=e[r];this.query.supports({script:n.script})&&this.registerFeatures(n.script,n.tags)}},Ce.prototype.registerModifier=function(t,e,r){this.tokenizer.registerModifier(t,e,r)};function zr(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Gu(){var t=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){zr.call(this);var r=this.tokenizer.getContextRanges("arabicWord");r.forEach(function(n){Ou.call(t,n)})}}function Hu(){var t=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){var r=this.featuresTags[e];if(r.indexOf("rlig")!==-1){zr.call(this);var n=this.tokenizer.getContextRanges("arabicWord");n.forEach(function(a){Mu.call(t,a)})}}}function zu(){var t=this,e="latn";if(this.featuresTags.hasOwnProperty(e)){var r=this.featuresTags[e];if(r.indexOf("liga")!==-1){zr.call(this);var n=this.tokenizer.getContextRanges("latinWord");n.forEach(function(a){_u.call(t,a)})}}}Ce.prototype.checkContextReady=function(t){return!!this.tokenizer.getContext(t)},Ce.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(Gu.call(this),Hu.call(this)),this.checkContextReady("latinWord")&&zu.call(this),this.checkContextReady("arabicSentence")&&Nu.call(this)},Ce.prototype.processText=function(t){(!this.text||this.text!==t)&&(this.setText(t),Pu.call(this),this.applyFeaturesToContexts())},Ce.prototype.getBidiText=function(t){return this.processText(t),this.tokenizer.getText()},Ce.prototype.getTextGlyphs=function(t){this.processText(t);for(var e=[],r=0;r<this.tokenizer.tokens.length;r++){var n=this.tokenizer.tokens[r];if(!n.state.deleted){var a=n.activeState.value;e.push(Array.isArray(a)?a[0]:a)}}return e};function X(t){t=t||{},t.tables=t.tables||{},t.empty||(xt(t.familyName,"When creating a new Font object, familyName is required."),xt(t.styleName,"When creating a new Font object, styleName is required."),xt(t.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),xt(t.ascender,"When creating a new Font object, ascender is required."),xt(t.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:t.familyName||" "},fontSubfamily:{en:t.styleName||" "},fullName:{en:t.fullName||t.familyName+" "+t.styleName},postScriptName:{en:t.postScriptName||(t.familyName+t.styleName).replace(/\s/g,"")},designer:{en:t.designer||" "},designerURL:{en:t.designerURL||" "},manufacturer:{en:t.manufacturer||" "},manufacturerURL:{en:t.manufacturerURL||" "},license:{en:t.license||" "},licenseURL:{en:t.licenseURL||" "},version:{en:t.version||"Version 0.1"},description:{en:t.description||" "},copyright:{en:t.copyright||" "},trademark:{en:t.trademark||" "}},this.unitsPerEm=t.unitsPerEm||1e3,this.ascender=t.ascender,this.descender=t.descender,this.createdTimestamp=t.createdTimestamp,this.tables=Object.assign(t.tables,{os2:Object.assign({usWeightClass:t.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:t.widthClass||this.usWidthClasses.MEDIUM,fsSelection:t.fsSelection||this.fsSelectionValues.REGULAR},t.tables.os2)})),this.supported=!0,this.glyphs=new Oe.GlyphSet(this,t.glyphs||[]),this.encoding=new zn(this),this.position=new bt(this),this.substitution=new ge(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new La(this)}})}X.prototype.hasChar=function(t){return this.encoding.charToGlyphIndex(t)!==null},X.prototype.charToGlyphIndex=function(t){return this.encoding.charToGlyphIndex(t)},X.prototype.charToGlyph=function(t){var e=this.charToGlyphIndex(t),r=this.glyphs.get(e);return r||(r=this.glyphs.get(0)),r},X.prototype.updateFeatures=function(t){return this.defaultRenderOptions.features.map(function(e){return e.script==="latn"?{script:"latn",tags:e.tags.filter(function(r){return t[r]})}:e})},X.prototype.stringToGlyphs=function(t,e){var r=this,n=new Ce,a=function(d){return r.charToGlyphIndex(d.char)};n.registerModifier("glyphIndex",null,a);var i=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;n.applyFeatures(this,i);for(var s=n.getTextGlyphs(t),o=s.length,c=new Array(o),u=this.glyphs.get(0),h=0;h<o;h+=1)c[h]=this.glyphs.get(s[h])||u;return c},X.prototype.nameToGlyphIndex=function(t){return this.glyphNames.nameToGlyphIndex(t)},X.prototype.nameToGlyph=function(t){var e=this.nameToGlyphIndex(t),r=this.glyphs.get(e);return r||(r=this.glyphs.get(0)),r},X.prototype.glyphIndexToName=function(t){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(t):""},X.prototype.getKerningValue=function(t,e){t=t.index||t,e=e.index||e;var r=this.position.defaultKerningTables;return r?this.position.getKerningValue(r,t,e):this.kerningPairs[t+","+e]||0},X.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]},X.prototype.forEachGlyph=function(t,e,r,n,a,i){e=e!==void 0?e:0,r=r!==void 0?r:0,n=n!==void 0?n:72,a=Object.assign({},this.defaultRenderOptions,a);var s=1/this.unitsPerEm*n,o=this.stringToGlyphs(t,a),c;if(a.kerning){var u=a.script||this.position.getDefaultScriptName();c=this.position.getKerningTables(u,a.language)}for(var h=0;h<o.length;h+=1){var d=o[h];if(i.call(this,d,e,r,n,a),d.advanceWidth&&(e+=d.advanceWidth*s),a.kerning&&h<o.length-1){var p=c?this.position.getKerningValue(c,d.index,o[h+1].index):this.getKerningValue(d,o[h+1]);e+=p*s}a.letterSpacing?e+=a.letterSpacing*n:a.tracking&&(e+=a.tracking/1e3*n)}return e},X.prototype.getPath=function(t,e,r,n,a){var i=new se;return this.forEachGlyph(t,e,r,n,a,function(s,o,c,u){var h=s.getPath(o,c,u,a,this);i.extend(h)}),i},X.prototype.getPaths=function(t,e,r,n,a){var i=[];return this.forEachGlyph(t,e,r,n,a,function(s,o,c,u){var h=s.getPath(o,c,u,a,this);i.push(h)}),i},X.prototype.getAdvanceWidth=function(t,e,r){return this.forEachGlyph(t,0,0,e,r,function(){})},X.prototype.draw=function(t,e,r,n,a,i){this.getPath(e,r,n,a,i).draw(t)},X.prototype.drawPoints=function(t,e,r,n,a,i){this.forEachGlyph(e,r,n,a,i,function(s,o,c,u){s.drawPoints(t,o,c,u)})},X.prototype.drawMetrics=function(t,e,r,n,a,i){this.forEachGlyph(e,r,n,a,i,function(s,o,c,u){s.drawMetrics(t,o,c,u)})},X.prototype.getEnglishName=function(t){var e=this.names[t];if(e)return e.en},X.prototype.validate=function(){var t=this;function e(n,a){}function r(n){var a=t.getEnglishName(n);a&&a.trim().length>0}r("fontFamily"),r("weightName"),r("manufacturer"),r("copyright"),r("version"),this.unitsPerEm>0},X.prototype.toTables=function(){return Ao.fontToTable(this)},X.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},X.prototype.toArrayBuffer=function(){for(var t=this.toTables(),e=t.encode(),r=new ArrayBuffer(e.length),n=new Uint8Array(r),a=0;a<e.length;a++)n[a]=e[a];return r},X.prototype.download=function(t){var e=this.getEnglishName("fontFamily"),r=this.getEnglishName("fontSubfamily");t=t||e.replace(/\s/g,"")+"-"+r+".otf";var n=this.toArrayBuffer();if(Lo())if(window.URL=window.URL||window.webkitURL,window.URL){var a=new DataView(n),i=new Blob([a],{type:"font/opentype"}),s=document.createElement("a");s.href=window.URL.createObjectURL(i),s.download=t;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),s.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var c=require("fs"),u=Oo(n);c.writeFileSync(t,u)}},X.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},X.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},X.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function ei(t,e){var r=JSON.stringify(t),n=256;for(var a in e){var i=parseInt(a);if(!(!i||i<256)){if(JSON.stringify(e[a])===r)return i;n<=i&&(n=i+1)}}return e[n]=t,n}function Wu(t,e,r){var n=ei(e.name,r);return[{name:"tag_"+t,type:"TAG",value:e.tag},{name:"minValue_"+t,type:"FIXED",value:e.minValue<<16},{name:"defaultValue_"+t,type:"FIXED",value:e.defaultValue<<16},{name:"maxValue_"+t,type:"FIXED",value:e.maxValue<<16},{name:"flags_"+t,type:"USHORT",value:0},{name:"nameID_"+t,type:"USHORT",value:n}]}function qu(t,e,r){var n={},a=new _.Parser(t,e);return n.tag=a.parseTag(),n.minValue=a.parseFixed(),n.defaultValue=a.parseFixed(),n.maxValue=a.parseFixed(),a.skip("uShort",1),n.name=r[a.parseUShort()]||{},n}function Vu(t,e,r,n){for(var a=ei(e.name,n),i=[{name:"nameID_"+t,type:"USHORT",value:a},{name:"flags_"+t,type:"USHORT",value:0}],s=0;s<r.length;++s){var o=r[s].tag;i.push({name:"axis_"+t+" "+o,type:"FIXED",value:e.coordinates[o]<<16})}return i}function Xu(t,e,r,n){var a={},i=new _.Parser(t,e);a.name=n[i.parseUShort()]||{},i.skip("uShort",1),a.coordinates={};for(var s=0;s<r.length;++s)a.coordinates[r[s].tag]=i.parseFixed();return a}function ju(t,e){var r=new I.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:t.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:t.instances.length},{name:"instanceSize",type:"USHORT",value:4+t.axes.length*4}]);r.offsetToData=r.sizeOf();for(var n=0;n<t.axes.length;n++)r.fields=r.fields.concat(Wu(n,t.axes[n],e));for(var a=0;a<t.instances.length;a++)r.fields=r.fields.concat(Vu(a,t.instances[a],t.axes,e));return r}function Yu(t,e,r){var n=new _.Parser(t,e),a=n.parseULong();P.argument(a===65536,"Unsupported fvar table version.");var i=n.parseOffset16();n.skip("uShort",1);for(var s=n.parseUShort(),o=n.parseUShort(),c=n.parseUShort(),u=n.parseUShort(),h=[],d=0;d<s;d++)h.push(qu(t,e+i+d*o,r));for(var p=[],g=e+i+s*o,x=0;x<c;x++)p.push(Xu(t,g+x*u,h,r));return{axes:h,instances:p}}var Zu={make:ju,parse:Yu},$u=function(){return{coverage:this.parsePointer(E.coverage),attachPoints:this.parseList(E.pointer(E.uShortList))}},Ku=function(){var t=this.parseUShort();if(P.argument(t===1||t===2||t===3,"Unsupported CaretValue table version."),t===1)return{coordinate:this.parseShort()};if(t===2)return{pointindex:this.parseShort()};if(t===3)return{coordinate:this.parseShort()}},Qu=function(){return this.parseList(E.pointer(Ku))},Ju=function(){return{coverage:this.parsePointer(E.coverage),ligGlyphs:this.parseList(E.pointer(Qu))}},eh=function(){return this.parseUShort(),this.parseList(E.pointer(E.coverage))};function th(t,e){e=e||0;var r=new E(t,e),n=r.parseVersion(1);P.argument(n===1||n===1.2||n===1.3,"Unsupported GDEF table version.");var a={version:n,classDef:r.parsePointer(E.classDef),attachList:r.parsePointer($u),ligCaretList:r.parsePointer(Ju),markAttachClassDef:r.parsePointer(E.classDef)};return n>=1.2&&(a.markGlyphSets=r.parsePointer(eh)),a}var rh={parse:th},Ee=new Array(10);Ee[1]=function(){var e=this.offset+this.relativeOffset,r=this.parseUShort();if(r===1)return{posFormat:1,coverage:this.parsePointer(E.coverage),value:this.parseValueRecord()};if(r===2)return{posFormat:2,coverage:this.parsePointer(E.coverage),values:this.parseValueRecordList()};P.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Ee[2]=function(){var e=this.offset+this.relativeOffset,r=this.parseUShort();P.assert(r===1||r===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var n=this.parsePointer(E.coverage),a=this.parseUShort(),i=this.parseUShort();if(r===1)return{posFormat:r,coverage:n,valueFormat1:a,valueFormat2:i,pairSets:this.parseList(E.pointer(E.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(a),value2:this.parseValueRecord(i)}})))};if(r===2){var s=this.parsePointer(E.classDef),o=this.parsePointer(E.classDef),c=this.parseUShort(),u=this.parseUShort();return{posFormat:r,coverage:n,valueFormat1:a,valueFormat2:i,classDef1:s,classDef2:o,class1Count:c,class2Count:u,classRecords:this.parseList(c,E.list(u,function(){return{value1:this.parseValueRecord(a),value2:this.parseValueRecord(i)}}))}}},Ee[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Ee[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Ee[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Ee[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Ee[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Ee[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Ee[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function nh(t,e){e=e||0;var r=new E(t,e),n=r.parseVersion(1);return P.argument(n===1||n===1.1,"Unsupported GPOS table version "+n),n===1?{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(Ee)}:{version:n,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(Ee),variations:r.parseFeatureVariationsList()}}var ah=new Array(10);function ih(t){return new I.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new I.ScriptList(t.scripts)},{name:"features",type:"TABLE",value:new I.FeatureList(t.features)},{name:"lookups",type:"TABLE",value:new I.LookupList(t.lookups,ah)}])}var sh={parse:nh,make:ih};function oh(t){var e={};t.skip("uShort");var r=t.parseUShort();P.argument(r===0,"Unsupported kern sub-table version."),t.skip("uShort",2);var n=t.parseUShort();t.skip("uShort",3);for(var a=0;a<n;a+=1){var i=t.parseUShort(),s=t.parseUShort(),o=t.parseShort();e[i+","+s]=o}return e}function ch(t){var e={};t.skip("uShort");var r=t.parseULong();r>1&&console.warn("Only the first kern subtable is supported."),t.skip("uLong");var n=t.parseUShort(),a=n&255;if(t.skip("uShort"),a===0){var i=t.parseUShort();t.skip("uShort",3);for(var s=0;s<i;s+=1){var o=t.parseUShort(),c=t.parseUShort(),u=t.parseShort();e[o+","+c]=u}}return e}function uh(t,e){var r=new _.Parser(t,e),n=r.parseUShort();if(n===0)return oh(r);if(n===1)return ch(r);throw new Error("Unsupported kern table version ("+n+").")}var hh={parse:uh};function lh(t,e,r,n){for(var a=new _.Parser(t,e),i=n?a.parseUShort:a.parseULong,s=[],o=0;o<r+1;o+=1){var c=i.call(a);n&&(c*=2),s.push(c)}return s}var fh={parse:lh};function ti(t,e){for(var r=[],n=12,a=0;a<e;a+=1){var i=_.getTag(t,n),s=_.getULong(t,n+4),o=_.getULong(t,n+8),c=_.getULong(t,n+12);r.push({tag:i,checksum:s,offset:o,length:c,compression:!1}),n+=16}return r}function ph(t,e){for(var r=[],n=44,a=0;a<e;a+=1){var i=_.getTag(t,n),s=_.getULong(t,n+4),o=_.getULong(t,n+8),c=_.getULong(t,n+12),u=void 0;o<c?u="WOFF":u=!1,r.push({tag:i,offset:s,compression:u,compressedLength:o,length:c}),n+=20}return r}function ne(t,e){if(e.compression==="WOFF"){var r=new Uint8Array(t.buffer,e.offset+2,e.compressedLength-2),n=new Uint8Array(e.length);if(is(r,n),n.byteLength!==e.length)throw new Error("Decompression error: "+e.tag+" decompressed length doesn't match recorded length");var a=new DataView(n.buffer,0);return{data:a,offset:0}}else return{data:t,offset:e.offset}}function dh(t,e){e=e??{};var r,n,a=new X({empty:!0}),i=new DataView(t,0),s,o=[],c=_.getTag(i,0);if(c==="\0\0\0"||c==="true"||c==="typ1")a.outlinesFormat="truetype",s=_.getUShort(i,4),o=ti(i,s);else if(c==="OTTO")a.outlinesFormat="cff",s=_.getUShort(i,4),o=ti(i,s);else if(c==="wOFF"){var u=_.getTag(i,4);if(u==="\0\0\0")a.outlinesFormat="truetype";else if(u==="OTTO")a.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+c);s=_.getUShort(i,12),o=ph(i,s)}else throw new Error("Unsupported OpenType signature "+c);for(var h,d,p,g,x,v,F,m,S,w,k,T,R=0;R<s;R+=1){var M=o[R],O=void 0;switch(M.tag){case"cmap":O=ne(i,M),a.tables.cmap=Hn.parse(O.data,O.offset),a.encoding=new Wn(a.tables.cmap);break;case"cvt ":O=ne(i,M),T=new _.Parser(O.data,O.offset),a.tables.cvt=T.parseShortList(M.length/2);break;case"fvar":d=M;break;case"fpgm":O=ne(i,M),T=new _.Parser(O.data,O.offset),a.tables.fpgm=T.parseByteList(M.length);break;case"head":O=ne(i,M),a.tables.head=na.parse(O.data,O.offset),a.unitsPerEm=a.tables.head.unitsPerEm,r=a.tables.head.indexToLocFormat;break;case"hhea":O=ne(i,M),a.tables.hhea=aa.parse(O.data,O.offset),a.ascender=a.tables.hhea.ascender,a.descender=a.tables.hhea.descender,a.numberOfHMetrics=a.tables.hhea.numberOfHMetrics;break;case"hmtx":F=M;break;case"ltag":O=ne(i,M),n=sa.parse(O.data,O.offset);break;case"maxp":O=ne(i,M),a.tables.maxp=oa.parse(O.data,O.offset),a.numGlyphs=a.tables.maxp.numGlyphs;break;case"name":w=M;break;case"OS/2":O=ne(i,M),a.tables.os2=Ar.parse(O.data,O.offset);break;case"post":O=ne(i,M),a.tables.post=ga.parse(O.data,O.offset),a.glyphNames=new Fr(a.tables.post);break;case"prep":O=ne(i,M),T=new _.Parser(O.data,O.offset),a.tables.prep=T.parseByteList(M.length);break;case"glyf":p=M;break;case"loca":S=M;break;case"CFF ":h=M;break;case"kern":m=M;break;case"GDEF":g=M;break;case"GPOS":x=M;break;case"GSUB":v=M;break;case"meta":k=M;break}}var z=ne(i,w);if(a.tables.name=da.parse(z.data,z.offset,n),a.names=a.tables.name,p&&S){var V=r===0,ee=ne(i,S),le=fh.parse(ee.data,ee.offset,a.numGlyphs,V),oe=ne(i,p);a.glyphs=Ua.parse(oe.data,oe.offset,le,a,e)}else if(h){var Y=ne(i,h);ra.parse(Y.data,Y.offset,a,e)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");var Z=ne(i,F);if(ia.parse(a,Z.data,Z.offset,a.numberOfHMetrics,a.numGlyphs,a.glyphs,e),Cs(a,e),m){var $=ne(i,m);a.kerningPairs=hh.parse($.data,$.offset)}else a.kerningPairs={};if(g){var ae=ne(i,g);a.tables.gdef=rh.parse(ae.data,ae.offset)}if(x){var ce=ne(i,x);a.tables.gpos=sh.parse(ce.data,ce.offset),a.position.init()}if(v){var ie=ne(i,v);a.tables.gsub=va.parse(ie.data,ie.offset)}if(d){var he=ne(i,d);a.tables.fvar=Zu.parse(he.data,he.offset,a.names)}if(k){var H=ne(i,k);a.tables.meta=ya.parse(H.data,H.offset),a.metas=a.tables.meta}return a}function ri(t,e=!1){const r=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),i={},s={},o=t[0].morphTargetsRelative,c=new re.BufferGeometry;let u=0;for(let h=0;h<t.length;++h){const d=t[h];let p=0;if(r!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const g in d.attributes){if(!n.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+g+'" attribute exists among all geometries, or in none of them.'),null;i[g]===void 0&&(i[g]=[]),i[g].push(d.attributes[g]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const g in d.morphAttributes){if(!a.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;s[g]===void 0&&(s[g]=[]),s[g].push(d.morphAttributes[g])}if(e){let g;if(r)g=d.index.count;else if(d.attributes.position!==void 0)g=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(u,g,h),u+=g}}if(r){let h=0;const d=[];for(let p=0;p<t.length;++p){const g=t[p].index;for(let x=0;x<g.count;++x)d.push(g.getX(x)+h);h+=t[p].attributes.position.count}c.setIndex(d)}for(const h in i){const d=ni(i[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;c.setAttribute(h,d)}for(const h in s){const d=s[h][0].length;if(d===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[h]=[];for(let p=0;p<d;++p){const g=[];for(let v=0;v<s[h].length;++v)g.push(s[h][v][p]);const x=ni(g);if(!x)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;c.morphAttributes[h].push(x)}}return c}function ni(t){let e,r,n,a=-1,i=0;for(let u=0;u<t.length;++u){const h=t[u];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=h.itemSize),r!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(a===-1&&(a=h.gpuType),a!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;i+=h.count*r}const s=new e(i),o=new re.BufferAttribute(s,r,n);let c=0;for(let u=0;u<t.length;++u){const h=t[u];if(h.isInterleavedBufferAttribute){const d=c/r;for(let p=0,g=h.count;p<g;p++)for(let x=0;x<r;x++){const v=h.getComponent(p,x);o.setComponent(p+d,x,v)}}else s.set(h.array,c);c+=h.count*r}return a!==void 0&&(o.gpuType=a),o}function gh(t,e=1e-4){e=Math.max(e,Number.EPSILON);const r={},n=t.getIndex(),a=t.getAttribute("position"),i=n?n.count:a.count;let s=0;const o=Object.keys(t.attributes),c={},u={},h=[],d=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let S=0,w=o.length;S<w;S++){const k=o[S],T=t.attributes[k];c[k]=new T.constructor(new T.array.constructor(T.count*T.itemSize),T.itemSize,T.normalized);const R=t.morphAttributes[k];R&&(u[k]||(u[k]=[]),R.forEach((M,O)=>{const z=new M.array.constructor(M.count*M.itemSize);u[k][O]=new M.constructor(z,M.itemSize,M.normalized)}))}const g=e*.5,x=Math.log10(1/e),v=Math.pow(10,x),F=g*v;for(let S=0;S<i;S++){const w=n?n.getX(S):S;let k="";for(let T=0,R=o.length;T<R;T++){const M=o[T],O=t.getAttribute(M),z=O.itemSize;for(let V=0;V<z;V++)k+=`${~~(O[d[V]](w)*v+F)},`}if(k in r)h.push(r[k]);else{for(let T=0,R=o.length;T<R;T++){const M=o[T],O=t.getAttribute(M),z=t.morphAttributes[M],V=O.itemSize,ee=c[M],le=u[M];for(let oe=0;oe<V;oe++){const Y=d[oe],Z=p[oe];if(ee[Z](s,O[Y](w)),z)for(let $=0,ae=z.length;$<ae;$++)le[$][Z](s,z[$][Y](w))}}r[k]=s,h.push(s),s++}}const m=t.clone();for(const S in t.attributes){const w=c[S];if(m.setAttribute(S,new w.constructor(w.array.slice(0,s*w.itemSize),w.itemSize,w.normalized)),S in u)for(let k=0;k<u[S].length;k++){const T=u[S][k];m.morphAttributes[S][k]=new T.constructor(T.array.slice(0,s*T.itemSize),T.itemSize,T.normalized)}}return m.setIndex(h),m}new N.Vector2;class ai extends ir{constructor(e,r,n){super(),this.isFound=!1,this.char=e,this.fontSize=r,this.font=n,this.width=this.getCharWidth(e,r,n)}toGeometry(){let e=this.font.cache.getGeometry(this.char.charCodeAt(0),this.fontSize);if(e==null){const r=this.font.generateShapes(this.char,this.fontSize);return e=new N.ShapeGeometry(r,4),e.hasAttribute("uv")&&e.deleteAttribute("uv"),e.hasAttribute("normal")&&e.deleteAttribute("normal"),gh(e,1e-6)}return e}getCharWidth(e,r,n){const a=n.data.glyphs[e];return a?(this.isFound=!0,a.ha*r/n.data.resolution):(this.isFound=!1,0)}}class vh{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,r=100){const n=[],a=yh(e,r,this.data);for(let i=0,s=a.length;i<s;i++)n.push(...a[i].toShapes());return n}}function yh(t,e,r){const n=Array.from(t),a=e/r.resolution,i=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,s=[];let o=0,c=0;for(let u=0;u<n.length;u++){const h=n[u];if(h===`
|
|
2
2
|
`)o=0,c-=i;else{const d=mh(h,a,o,c,r);o+=d.offsetX,s.push(d.path)}}return s}function mh(t,e,r,n,a){const i=a.glyphs[t]||a.glyphs["?"];if(!i){console.error('THREE.Font: character "'+t+'" does not exists in font family '+a.familyName+".");return}const s=new re.ShapePath;let o,c,u,h,d,p,g,x;if(i.o){const v=i._cachedOutline||(i._cachedOutline=i.o.split(" "));for(let F=0,m=v.length;F<m;)switch(v[F++]){case"m":o=v[F++]*e+r,c=v[F++]*e+n,s.moveTo(o,c);break;case"l":o=v[F++]*e+r,c=v[F++]*e+n,s.lineTo(o,c);break;case"q":u=v[F++]*e+r,h=v[F++]*e+n,d=v[F++]*e+r,p=v[F++]*e+n,s.quadraticCurveTo(d,p,u,h);break;case"b":u=v[F++]*e+r,h=v[F++]*e+n,d=v[F++]*e+r,p=v[F++]*e+n,g=v[F++]*e+r,x=v[F++]*e+n,s.bezierCurveTo(d,p,g,x,u,h);break}}return{offsetX:i.ha*e,path:s}}class bh extends vh{generateShapes(e,r=100,n="ltr"){const a=[];return xh(e,r,this.data,n).forEach(s=>{a.push(...Eh(s))}),a}}function xh(t,e,r,n="ltr"){const a=Array.from(t),i=e/r.resolution,s=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*i,o=[];let c=0,u=0;(n==="rtl"||n==="tb")&&a.reverse();for(const h of a)if(h===`
|
|
3
|
-
`)c=0,u-=s;else{const d=Sh(h,i,c,u,r);if(!d)continue;n==="tb"?(c=0,u+=r.ascender*i):c+=d.offsetX,o.push(d.path)}return o}function Sh(t,e,r,n,a){const i=a.glyphs[t]||a.glyphs["?"];if(!i){console.error(`THREE.Font: character "${t}" does not exist in font family ${a.familyName}.`);return}const s=new re.ShapePath;if(i.o){const o=i.o.split(" ");let c=0;for(;c<o.length;){const u=o[c++];let h,d,p,g,x,v,F,m;switch(u){case"m":h=parseFloat(o[c++])*e+r,d=parseFloat(o[c++])*e+n,s.moveTo(h,d);break;case"l":h=parseFloat(o[c++])*e+r,d=parseFloat(o[c++])*e+n,s.lineTo(h,d);break;case"q":p=parseFloat(o[c++])*e+r,g=parseFloat(o[c++])*e+n,x=parseFloat(o[c++])*e+r,v=parseFloat(o[c++])*e+n,s.quadraticCurveTo(x,v,p,g);break;case"b":p=parseFloat(o[c++])*e+r,g=parseFloat(o[c++])*e+n,x=parseFloat(o[c++])*e+r,v=parseFloat(o[c++])*e+n,F=parseFloat(o[c++])*e+r,m=parseFloat(o[c++])*e+n,s.bezierCurveTo(x,v,F,m,p,g);break}}}return{offsetX:i.ha*e,path:s}}function wh(t,e){let r=!1;const{x:n,y:a}=t,i=e.length;for(let s=0,o=i-1;s<i;o=s++){const c=e[s].x,u=e[s].y,h=e[o].x,d=e[o].y;u>a!=d>a&&n<(h-c)*(a-u)/(d-u)+c&&(r=!r)}return r}function Fh(t){const e=t.length,r=Array(e).fill(null);for(let n=0;n<e;n++){let a=null,i=1/0;for(let s=0;s<e;s++)if(n!==s&&t[n].every(o=>wh(o,t[s]))){const o=Math.abs(re.ShapeUtils.area(t[s]));o<i&&(i=o,a=s)}r[n]=a}return r}function kh(t){const e=t.length,r=Array.from({length:e},()=>[]);for(let n=0;n<e;n++){const a=t[n];a!==null&&r[a].push(n)}return r}function Th(t){return t.map((e,r)=>e===null?r:-1).filter(e=>e>=0)}function Ch(t){const e=[];for(let r=t.length-1;r>=0;r--){const n=t[r];if(n instanceof re.LineCurve)e.push(new re.LineCurve(n.v2.clone(),n.v1.clone()));else if(n instanceof re.QuadraticBezierCurve)e.push(new re.QuadraticBezierCurve(n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof re.CubicBezierCurve)e.push(new re.CubicBezierCurve(n.v3.clone(),n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof re.EllipseCurve)e.push(new re.EllipseCurve(n.aX,n.aY,n.xRadius,n.yRadius,n.aEndAngle,n.aStartAngle,!n.aClockwise,n.aRotation));else if(typeof n.getPoints=="function"){const a=n.getPoints(8);for(let i=a.length-1;i>0;i--)e.push(new re.LineCurve(a[i].clone(),a[i-1].clone()))}}return e}function ii(t,e){const r=re.ShapeUtils.area(t.getPoints(32))>0,n=e===r?t.curves.slice():Ch(t.curves),a=new re.Shape;return a.curves.push(...n),a}function Eh(t,e=32){const r=t.subPaths;if(!r||r.length===0)return[];const n=r.map(g=>g.getPoints(e)),a=Fh(n),i=kh(a),s=Th(a),o=r.length,c=Array(o).fill(-1),u=Array(o).fill(-1);for(const g of s){const x=[{idx:g,d:0}];for(;x.length;){const v=x.pop();c[v.idx]=v.d,u[v.idx]=g;for(const F of i[v.idx])x.push({idx:F,d:v.d+1})}}const h=[],d=new Set;function p(g){const x=ii(r[g],!0);d.add(g);for(const v of i[g])if(!d.has(v)&&c[v]===c[g]+1){const F=ii(r[v],!1);x.holes.push(F),d.add(v)}h.push(x)}for(const g of s)p(g);for(let g=0;g<o;g++)d.has(g)||p(g);return h}class Uh{constructor(e=512){this.maxSize=e,this.map=new Map}get(e){const r=this.map.get(e);return r&&(this.map.delete(e),this.map.set(e,r)),r}set(e,r){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,r)}has(e){return this.map.has(e)}clear(){this.map.clear()}}class Ah extends ar{constructor(e){super(e),this.type="mesh",this.glyphCache=new Uh(512);const r=e.data;if(r instanceof ArrayBuffer){const n=this.parseMeshFont(r);this.data=n.data,this.opentypeFont=n.font}else throw new Error("Invalid font cache data. Please remove font cache database named 'mlightcad' in IndexedDB and try again!");this.font=new bh(this.data)}parseMeshFont(e){const r=dh(e),n=Math.round,a=r.charToGlyph("A"),i=a?r.unitsPerEm/(a.yMax||r.unitsPerEm):1,s={glyphs:{},familyName:r.getEnglishName("fullName"),ascender:n(r.ascender),descender:n(r.descender),underlinePosition:r.tables.post.underlinePosition,underlineThickness:r.tables.post.underlineThickness,boundingBox:{xMin:r.tables.head.xMin,xMax:r.tables.head.xMax,yMin:r.tables.head.yMin,yMax:r.tables.head.yMax},resolution:r.unitsPerEm||1e3,scaleFactor:i,original_font_information:r.tables.name};return{font:r,data:s}}hasChar(e){return this.opentypeFont.hasChar(e)}hasCode(e){return this.hasChar(String.fromCodePoint(e))}_loadGlyphIfNeeded(e){if(this.data.glyphs[e]||!this.opentypeFont)return;const r=this.glyphCache.get(e);if(r){this.data.glyphs[e]=r;return}const n=this.opentypeFont.charToGlyph(e);if(!n||!n.path)return;const a=Math.round,i={ha:a(n.advanceWidth??0),x_min:a(n.xMin??0),x_max:a(n.xMax??0),o:""};n.path.commands.forEach(s=>{let o=s.type.toLowerCase();o==="c"&&(o="b"),i.o+=o+" ",s.x!==void 0&&s.y!==void 0&&(i.o+=a(s.x)+" "+a(s.y)+" "),s.x1!==void 0&&s.y1!==void 0&&(i.o+=a(s.x1)+" "+a(s.y1)+" "),s.x2!==void 0&&s.y2!==void 0&&(i.o+=a(s.x2)+" "+a(s.y2)+" ")}),this.data.glyphs[e]=i,this.glyphCache.set(e,i)}generateShapes(e,r){for(const n of e)this._loadGlyphIfNeeded(n);return this.font.generateShapes(e,r)}getCharShape(e,r){if(this._loadGlyphIfNeeded(e),!this.data.glyphs[e]){this.addUnsupportedChar(e);return}return new ai(e,r,this)}getCodeShape(e,r){return this.getCharShape(String.fromCodePoint(e),r)}getScaleFactor(){return this.scaleFactor==null?(this.scaleFactor=this.data.scaleFactor,this.scaleFactor):this.scaleFactor}getNotFoundTextShape(e){return new ai("?",e,this)}}class pe{static byteToSByte(e){return(e&127)-(e&128?128:0)}constructor(e){this.position=0,this.data=new DataView(e)}readBytes(e=1){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e);const r=new Uint8Array(this.data.buffer,this.position,e);return this.position+=e,r}skip(e){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e),this.position+=e}readUint8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getUint8(this.position);return this.position+=1,e}readInt8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getInt8(this.position);return this.position+=1,e}readUint16(e=!0){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const r=this.data.getUint16(this.position,e);return this.position+=2,r}readInt16(){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const e=this.data.getInt16(this.position,!0);return this.position+=2,e}readUint32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getUint32(this.position,!0);return this.position+=4,e}readInt32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getInt32(this.position,!0);return this.position+=4,e}readFloat32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getFloat32(this.position,!0);return this.position+=4,e}readFloat64(){this.data.byteLength<this.position+8&&this.throwOutOfRangeError(this.position+8);const e=this.data.getFloat64(this.position,!0);return this.position+=8,e}setPosition(e){this.data.byteLength<e&&this.throwOutOfRangeError(e),this.position=e}isEnd(){return this.position===this.data.byteLength-1}get currentPosition(){return this.position}get length(){return this.data.byteLength}throwOutOfRangeError(e){throw new Error(`Position ${e} is out of range for the data length ${this.data.byteLength}!`)}}var de=(t=>(t.SHAPES="shapes",t.BIGFONT="bigfont",t.UNIFONT="unifont",t))(de||{});class Bh{parse(e){const r=this.parseHeader(e).split(" "),n=r[1].toLocaleLowerCase();if(!Object.values(de).includes(n))throw new Error(`Invalid font type: ${n}`);return{fileHeader:r[0],fontType:n,fileVersion:r[2]}}parseHeader(e){let r="",n=0;for(;e.currentPosition<e.length-2&&n<1024;){const a=e.readUint8();if(a===13){const i=e.currentPosition,s=e.readUint8(),o=e.readUint8();if(s===10&&o===26)break;e.setPosition(i),r+=String.fromCharCode(a)}else r+=String.fromCharCode(a);n++}return r.trim()}}const be=10,Lh=[13,10,0];class Oh{parse(e){try{e.readBytes(4);const r=e.readInt16();if(r<=0)throw new Error("Invalid shape count in font file");const n=[];for(let s=0;s<r;s++){const o=e.readUint16(),c=e.readUint16();c>0&&n.push({code:o,length:c})}const a={};for(const s of n)try{const o=e.readBytes(s.length);o.length===s.length&&(a[s.code]=o)}catch{console.warn(`Failed to read shape data for code ${s.code}`)}const i={data:a,info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};if(0 in a){const s=a[0];try{const o=new TextDecoder().decode(s);let c=s.findIndex(u=>Lh.includes(u));c>=0&&(i.info=o.substring(0,c),c+3<s.length&&(i.baseUp=s[c+1],i.baseDown=s[c+2],i.height=i.baseDown+i.baseUp,i.width=i.height,i.orientation=s[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse font info block")}}return i}catch(r){return console.error("Error parsing shape font:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}}class Mh{parse(e){try{e.readInt16();const r=e.readInt16(),n=e.readInt16();if(r<=0)throw new Error("Invalid character count in font file");e.skip(n*4);const a=[];for(let o=0;o<r;o++){const c=e.readUint16(),u=e.readUint16(),h=e.readUint32();(c!==0||u!==0||h!==0)&&a.push({code:c,length:u,offset:h})}const i={};for(const o of a)try{e.setPosition(o.offset);const c=e.readBytes(o.length);c.length===o.length&&(i[o.code]=c)}catch{console.warn(`Failed to read bigfont data for code ${o.code}`)}const s={data:i,info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};if(0 in i){const o=i[0];try{const c=this.utf8ArrayToStr(o);let u=c.pos;u>=0&&(s.info=c.text,u++,u+3<o.length&&(o.length-u>4?(s.height=o[u++],u++,s.orientation=o[u++]===0?"horizontal":"vertical",s.width=o[u++],s.baseUp=s.height,s.baseDown=0,s.isExtended=!0):(s.baseUp=o[u++],s.baseDown=o[u++],s.height=s.baseDown+s.baseUp,s.width=s.height,s.orientation=o[u]===0?"horizontal":"vertical")))}catch{console.warn("Failed to parse bigfont info block")}}return s}catch(r){return console.error("Error parsing big font:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}utf8ArrayToStr(e){let r="",n=0;for(;n<e.length;){const a=e[n];switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(a);break;case 12:case 13:{const i=e[n++];r+=String.fromCharCode((a&31)<<6|i&63);break}case 14:{const i=e[n++],s=e[n++];r+=String.fromCharCode((a&15)<<12|(i&63)<<6|(s&63)<<0);break}}if(r.charCodeAt(r.length-1)===0)break;n++}return{text:r,pos:n}}}let Rh=class{parse(e){try{const r=e.readInt32();if(r<=0)throw new Error("Invalid character count in font file");const n=e.readInt16(),a=e.readBytes(n),i={data:{},info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};try{const o=new TextDecoder().decode(a);let c=o.indexOf("\0");c>=0&&(i.info=o.substring(0,c),c+3<a.length&&(i.baseUp=a[c+1],i.baseDown=a[c+2],i.height=i.baseUp+i.baseDown,i.width=i.height,i.orientation=a[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse unifont info block")}const s={};for(let o=0;o<r-1;o++)try{const c=e.readUint16(),u=e.readUint16();if(u>0){const h=e.readBytes(u);if(h.length===u){const d=h.indexOf(0);let p=0;d>=0&&d<h.length&&(p=d+1),p<h.length&&(s[c]=h.subarray(p))}}}catch{console.warn("Failed to read unifont character data");break}return i.data=s,i}catch(r){return console.error("Error parsing unifont:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}},Ih=class{static createParser(e){switch(e){case de.SHAPES:return new Oh;case de.BIGFONT:return new Mh;case de.UNIFONT:return new Rh;default:throw new Error(`Unsupported font type: ${e}`)}}};class J{constructor(e=0,r=0){this.x=e,this.y=r}set(e,r){return this.x=e,this.y=r,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}clone(){return new J(this.x,this.y)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e,this.y*=e,this}divide(e){return e!==0&&(this.x/=e,this.y/=e),this}multiplyScalars(e,r){return this.x*=e,this.y*=r,this}divideScalars(e,r){return e!==0&&(this.x/=e),r!==0&&(this.y/=r),this}distanceTo(e){const r=this.x-e.x,n=this.y-e.y;return Math.sqrt(r*r+n*n)}}const si=Math.PI/4;class Tt{static fromBulge(e,r,n){const a=Math.max(-1,Math.min(1,n));return new Tt({start:e,end:r,bulge:a})}static fromOctant(e,r,n,a,i){return new Tt({center:e,radius:r,startOctant:n,octantCount:a,isClockwise:i})}constructor(e){if(e.start&&e.end&&e.bulge!==void 0){this.start=e.start.clone(),this.end=e.end.clone(),this.bulge=e.bulge,this.isClockwise=e.bulge<0;const r=this.end.clone().subtract(this.start),n=r.length();if(Math.abs(this.bulge)*n/2===0){this.radius=0,this.center=this.start.clone(),this.startAngle=Math.atan2(r.y,r.x),this.endAngle=this.startAngle;return}const a=4*Math.atan(Math.abs(this.bulge));this.radius=n/(2*Math.sin(a/2));const i=this.start.clone().add(r.clone().divide(2)),s=new J(-r.y,r.x);s.normalize(),s.multiply(Math.abs(this.radius*Math.cos(a/2))),this.center=i.clone(),this.isClockwise?this.center.subtract(s):this.center.add(s),this.startAngle=Math.atan2(this.start.y-this.center.y,this.start.x-this.center.x),this.endAngle=Math.atan2(this.end.y-this.center.y,this.end.x-this.center.x),this.isClockwise?this.endAngle>=this.startAngle&&(this.endAngle-=2*Math.PI):this.endAngle<=this.startAngle&&(this.endAngle+=2*Math.PI)}else if(e.center&&e.radius!==void 0&&e.startOctant!==void 0&&e.octantCount!==void 0&&e.isClockwise!==void 0){this.center=e.center.clone(),this.radius=e.radius,this.isClockwise=e.isClockwise,this.startAngle=e.startOctant*si;const r=(e.octantCount===0?8:e.octantCount)*si;this.endAngle=this.startAngle+(this.isClockwise?-r:r),this.start=this.center.clone().add(new J(this.radius*Math.cos(this.startAngle),this.radius*Math.sin(this.startAngle))),this.end=this.center.clone().add(new J(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))}else throw new Error("Invalid arc parameters")}tessellate(e=Math.PI/18){if(this.radius===0)return[this.start.clone(),this.end.clone()];const r=[this.start.clone()],n=Math.abs(this.endAngle-this.startAngle),a=Math.max(1,Math.floor(n/e));for(let i=1;i<a;i++){const s=i/a,o=this.isClockwise?this.startAngle-s*n:this.startAngle+s*n;r.push(this.center.clone().add(new J(this.radius*Math.cos(o),this.radius*Math.sin(o))))}return r.push(this.end?this.end.clone():this.center.clone().add(new J(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))),r}}class Ct{constructor(e,r=[]){this.lastPoint=e,this.polylines=r}get bbox(){if(this._bbox)return this._bbox;let e=1/0,r=-1/0,n=1/0,a=-1/0;return this.polylines.forEach(i=>{i.forEach(s=>{e=Math.min(e,s.x),r=Math.max(r,s.x),n=Math.min(n,s.y),a=Math.max(a,s.y)})}),this._bbox={minX:e,minY:n,maxX:r,maxY:a},this._bbox}offset(e,r=!0){var n,a;return r?new Ct((n=this.lastPoint)==null?void 0:n.clone().add(e),this.polylines.map(i=>i.map(s=>s.clone().add(e)))):((a=this.lastPoint)==null||a.add(e),this.polylines.forEach(i=>i.forEach(s=>s.add(e))),this._bbox&&(this._bbox.maxX+=e.x,this._bbox.minX+=e.x,this._bbox.maxY+=e.y,this._bbox.minY+=e.y),this)}normalizeToOrigin(e=!1){const r=this.bbox;return this.offset(new J(-r.minX,-r.minY),e)}toSVG(e={}){const{strokeWidth:r="0.5%",strokeColor:n="black",isAutoFit:a=!1}=e;let i,s;if(a){const o=this.bbox,c=.2,u=o.maxX-o.minX,h=o.maxY-o.minY,d=u===0?h:u,p=h===0?u:h,g=o.minX-d*c,x=o.maxX+d*c,v=o.minY-p*c,F=o.maxY+p*c;s=this.polylines.map(m=>{let S="";return m.forEach((w,k)=>{const T=w.x,R=-w.y;S+=k===0?`M ${T} ${R} `:`L ${T} ${R} `}),`<path d="${S}" stroke="${n}" stroke-width="${r}" fill="none"/>`}).join(""),i=`${g} ${-F} ${x-g} ${F-v}`}else i="0 0 20 20",s=this.polylines.map(o=>{let c="";return o.forEach((u,h)=>{const d=u.x+5,p=-u.y+15;c+=h===0?`M ${d} ${p} `:`L ${d} ${p} `}),`<path d="${c}" stroke="${n}" stroke-width="${r}" fill="none"/>`}).join("");return`<svg width="100%" height="100%" viewBox="${i}" preserveAspectRatio="xMidYMid meet">${s}</svg>`}}const Dh=Math.PI/18;class _h{constructor(e){this.shapeCache=new Map,this.shapeData=new Map,this.fontData=e}release(){this.shapeCache.clear(),this.shapeData.clear()}getCharShape(e,r){const n=r/this.fontData.content.height;return this.parseAndScale(e,{factor:n})}parseAndScale(e,r){if(e===0)return;let n;if(this.shapeCache.has(e))n=this.shapeCache.get(e);else{const a=this.fontData.content.data;if(a[e]){const i=a[e];n=this.parseShape(i),this.shapeData.set(e,n),this.shapeCache.set(e,n)}}if(n){if(r.factor!==void 0)return this.scaleShapeByFactor(n,r.factor);if(r.height!==void 0){const a=r.width??r.height;return this.scaleShapeByHeightAndWidth(n,r.height,a)}else return n}}scaleShapeByFactor(e,r){var n;return new Ct((n=e.lastPoint)==null?void 0:n.clone().multiply(r),e.polylines.map(a=>a.map(i=>i.clone().multiply(r))))}scaleShapeByHeightAndWidth(e,r,n){var a;const i=e.bbox,s=i.maxY-i.minY,o=i.maxX-i.minX,c=s>0?r/s:1,u=o>0?n/o:1,h=(a=e.lastPoint)==null?void 0:a.clone();h&&(h.x*=u,h.y*=c);const d=e.polylines.map(p=>p.map(g=>{const x=g.clone();return x.x*=u,x.y*=c,x}));return new Ct(h,d)}parseShape(e){const r={currentPoint:new J,polylines:[],currentPolyline:[],sp:[],isPenDown:!1,scale:1};for(let n=0;n<e.length;n++){const a=e[n];a<=15?n=this.handleSpecialCommand(a,e,n,r):this.handleVectorCommand(a,r)}return new Ct(r.currentPoint,r.polylines)}handleSpecialCommand(e,r,n,a){let i=n;switch(e){case 0:a.currentPolyline=[],a.isPenDown=!1;break;case 1:a.isPenDown=!0,a.currentPolyline.push(a.currentPoint.clone());break;case 2:a.isPenDown=!1,a.currentPolyline.length>1&&a.polylines.push(a.currentPolyline.slice()),a.currentPolyline=[];break;case 3:i++,a.scale/=r[i];break;case 4:i++,a.scale*=r[i];break;case 5:if(a.sp.length===4)throw new Error("The position stack is only four locations deep");a.sp.push(a.currentPoint.clone());break;case 6:a.currentPoint=a.sp.pop()??a.currentPoint;break;case 7:i=this.handleSubshapeCommand(r,i,a);break;case 8:i=this.handleXYDisplacement(r,i,a);break;case 9:i=this.handleMultipleXYDisplacements(r,i,a);break;case 10:i=this.handleOctantArc(r,i,a);break;case 11:i=this.handleFractionalArc(r,i,a);break;case 12:i=this.handleBulgeArc(r,i,a);break;case 13:i=this.handleMultipleBulgeArcs(r,i,a);break;case 14:i=this.skipCode(r,++i);break}return i}handleVectorCommand(e,r){const n=(e&240)>>4,a=e&15,i=this.getVectorForDirection(a);r.currentPoint.add(i.multiply(n*r.scale)),r.isPenDown&&r.currentPolyline.push(r.currentPoint.clone())}getVectorForDirection(e){const r=new J;switch(e){case 0:r.x=1;break;case 1:r.x=1,r.y=.5;break;case 2:r.x=1,r.y=1;break;case 3:r.x=.5,r.y=1;break;case 4:r.y=1;break;case 5:r.x=-.5,r.y=1;break;case 6:r.x=-1,r.y=1;break;case 7:r.x=-1,r.y=.5;break;case 8:r.x=-1;break;case 9:r.x=-1,r.y=-.5;break;case 10:r.x=-1,r.y=-1;break;case 11:r.x=-.5,r.y=-1;break;case 12:r.y=-1;break;case 13:r.x=.5,r.y=-1;break;case 14:r.x=1,r.y=-1;break;case 15:r.x=1,r.y=-.5;break}return r}handleSubshapeCommand(e,r,n){let a=r,i=0,s,o=n.scale*this.fontData.content.height,c=o;const u=n.currentPoint.clone();switch(n.currentPolyline.length>1&&(n.polylines.push(n.currentPolyline.slice()),n.currentPolyline=[]),this.fontData.header.fontType){case de.SHAPES:a++,i=e[a];break;case de.BIGFONT:a++,i=e[a],i===0&&(a++,i=e[a++]<<8|e[a++],u.x=pe.byteToSByte(e[a++])*n.scale,u.y=pe.byteToSByte(e[a++])*n.scale,this.fontData.content.isExtended&&(c=e[a++]*n.scale),o=e[a]*n.scale);break;case de.UNIFONT:a++,i=e[a++]<<8|e[a++];break}return i!==0&&(s=this.getScaledSubshapeAtInsertPoint(i,c,o,u),s&&n.polylines.push(...s.polylines.slice())),n.currentPolyline=[],a}handleXYDisplacement(e,r,n){let a=r;const i=new J;return i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),n.currentPoint.add(i.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone()),a}handleMultipleXYDisplacements(e,r,n){let a=r;for(;;){const i=new J;if(i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),i.x===0&&i.y===0)break;n.currentPoint.add(i.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone())}return a}handleOctantArc(e,r,n){var a;let i=r;const s=e[++i]*n.scale,o=pe.byteToSByte(e[++i]),c=(o&112)>>4;let u=o&7;const h=o<0,d=Math.PI/4*c,p=n.currentPoint.clone().subtract(new J(Math.cos(d)*s,Math.sin(d)*s)),g=Tt.fromOctant(p,s,c,u,h);if(n.isPenDown){const x=g.tessellate();n.currentPolyline.pop(),n.currentPolyline.push(...x.slice())}return n.currentPoint=(a=g.tessellate().pop())==null?void 0:a.clone(),i}handleFractionalArc(e,r,n){let a=r;const i=e[++a],s=e[++a],o=e[++a],c=e[++a],u=(o*255+c)*n.scale,h=pe.byteToSByte(e[++a]),d=(h&112)>>4;let p=h&7;p===0&&(p=8),s!==0&&p--;const g=Math.PI/4;let x=g*p,v=Dh,F=1;h<0&&(v=-v,x=-x,F=-1);let m=g*d,S=m+x;m+=g*i/256*F,S+=g*s/256*F;const w=n.currentPoint.clone().subtract(new J(u*Math.cos(m),u*Math.sin(m)));if(n.currentPoint=w.clone().add(new J(u*Math.cos(S),u*Math.sin(S))),n.isPenDown){let k=m;const T=[];if(T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k)))),v>0)for(;k+v<S;)k+=v,T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k))));else for(;k+v>S;)k+=v,T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k))));T.push(w.clone().add(new J(u*Math.cos(S),u*Math.sin(S)))),n.currentPolyline.push(...T)}return a}handleBulgeArc(e,r,n){let a=r;const i=new J;i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]);const s=pe.byteToSByte(e[++a]);return n.currentPoint=this.handleArcSegment(n.currentPoint,i,s,n.scale,n.isPenDown,n.currentPolyline),a}handleMultipleBulgeArcs(e,r,n){let a=r;for(;;){const i=new J;if(i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),i.x===0&&i.y===0)break;const s=pe.byteToSByte(e[++a]);n.currentPoint=this.handleArcSegment(n.currentPoint,i,s,n.scale,n.isPenDown,n.currentPolyline)}return a}skipCode(e,r){switch(e[r]){case 0:break;case 1:break;case 2:break;case 3:case 4:r++;break;case 5:break;case 6:break;case 7:switch(this.fontData.header.fontType){case de.SHAPES:r++;break;case de.BIGFONT:r++,e[r]===0&&(r+=this.fontData.content.isExtended?6:5);break;case de.UNIFONT:r+=2;break}break;case 8:r+=2;break;case 9:for(;;){const n=e[++r],a=e[++r];if(n===0&&a===0)break}break;case 10:r+=2;break;case 11:r+=5;break;case 12:r+=3;break;case 13:for(;;){const n=e[++r],a=e[++r];if(n===0&&a===0)break;r++}break}return r}getScaledSubshapeAtInsertPoint(e,r,n,a){let i=this.shapeCache.get(e);if(!i){const o=this.fontData.content.data[e];if(!o)return;i=this.parseShape(o),this.shapeData.set(e,i),this.shapeCache.set(e,i)}const s=i.normalizeToOrigin(!0);return this.scaleShapeByHeightAndWidth(s,n,r).offset(a,!1)}handleArcSegment(e,r,n,a,i,s){r.x*=a,r.y*=a,n<-127&&(n=-127);const o=e.clone();if(i)if(n===0)s.push(o.clone().add(r));else{const c=o.clone().add(r),u=Tt.fromBulge(o,c,n/127).tessellate();s.push(...u.slice(1))}return o.add(r),o}}let Ph=class{constructor(e){if(e instanceof ArrayBuffer){const r=new pe(e),n=new Bh().parse(r),a=Ih.createParser(n.fontType).parse(r);this.fontData={header:n,content:a}}else this.fontData=e;this.shapeParser=new _h(this.fontData)}hasChar(e){return this.fontData.content.data[e]!==void 0}getCharShape(e,r){let n=this.shapeParser.getCharShape(e,r);return n&&this.fontData.header.fontType===de.BIGFONT&&(n=n.normalizeToOrigin()),n}release(){this.shapeParser.release()}};function Nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Gh(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var oi={exports:{}},Wr={},Yt={};Yt.byteLength=Wh,Yt.toByteArray=Vh,Yt.fromByteArray=Yh;for(var Re=[],xe=[],Hh=typeof Uint8Array<"u"?Uint8Array:Array,qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=0,zh=qr.length;ot<zh;++ot)Re[ot]=qr[ot],xe[qr.charCodeAt(ot)]=ot;xe[45]=62,xe[95]=63;function ci(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Wh(t){var e=ci(t),r=e[0],n=e[1];return(r+n)*3/4-n}function qh(t,e,r){return(e+r)*3/4-r}function Vh(t){var e,r=ci(t),n=r[0],a=r[1],i=new Hh(qh(t,n,a)),s=0,o=a>0?n-4:n,c;for(c=0;c<o;c+=4)e=xe[t.charCodeAt(c)]<<18|xe[t.charCodeAt(c+1)]<<12|xe[t.charCodeAt(c+2)]<<6|xe[t.charCodeAt(c+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=e&255;return a===2&&(e=xe[t.charCodeAt(c)]<<2|xe[t.charCodeAt(c+1)]>>4,i[s++]=e&255),a===1&&(e=xe[t.charCodeAt(c)]<<10|xe[t.charCodeAt(c+1)]<<4|xe[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function Xh(t){return Re[t>>18&63]+Re[t>>12&63]+Re[t>>6&63]+Re[t&63]}function jh(t,e,r){for(var n,a=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),a.push(Xh(n));return a.join("")}function Yh(t){for(var e,r=t.length,n=r%3,a=[],i=16383,s=0,o=r-n;s<o;s+=i)a.push(jh(t,s,s+i>o?o:s+i));return n===1?(e=t[r-1],a.push(Re[e>>2]+Re[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],a.push(Re[e>>10]+Re[e>>4&63]+Re[e<<2&63]+"=")),a.join("")}var Vr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Vr.read=function(t,e,r,n,a){var i,s,o=a*8-n-1,c=(1<<o)-1,u=c>>1,h=-7,d=r?a-1:0,p=r?-1:1,g=t[e+d];for(d+=p,i=g&(1<<-h)-1,g>>=-h,h+=o;h>0;i=i*256+t[e+d],d+=p,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=s*256+t[e+d],d+=p,h-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(g?-1:1)*s*Math.pow(2,i-n)},Vr.write=function(t,e,r,n,a,i){var s,o,c,u=i*8-a-1,h=(1<<u)-1,d=h>>1,p=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,x=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?e+=p/c:e+=p*Math.pow(2,1-d),e*c>=2&&(s++,c/=2),s+d>=h?(o=0,s=h):s+d>=1?(o=(e*c-1)*Math.pow(2,a),s=s+d):(o=e*Math.pow(2,d-1)*Math.pow(2,a),s=0));a>=8;t[r+g]=o&255,g+=x,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;t[r+g]=s&255,g+=x,s/=256,u-=8);t[r+g-x]|=v*128};/*!
|
|
3
|
+
`)c=0,u-=s;else{const d=Sh(h,i,c,u,r);if(!d)continue;n==="tb"?(c=0,u+=r.ascender*i):c+=d.offsetX,o.push(d.path)}return o}function Sh(t,e,r,n,a){const i=a.glyphs[t]||a.glyphs["?"];if(!i){console.error(`THREE.Font: character "${t}" does not exist in font family ${a.familyName}.`);return}const s=new re.ShapePath;if(i.o){const o=i.o.split(" ");let c=0;for(;c<o.length;){const u=o[c++];let h,d,p,g,x,v,F,m;switch(u){case"m":h=parseFloat(o[c++])*e+r,d=parseFloat(o[c++])*e+n,s.moveTo(h,d);break;case"l":h=parseFloat(o[c++])*e+r,d=parseFloat(o[c++])*e+n,s.lineTo(h,d);break;case"q":p=parseFloat(o[c++])*e+r,g=parseFloat(o[c++])*e+n,x=parseFloat(o[c++])*e+r,v=parseFloat(o[c++])*e+n,s.quadraticCurveTo(x,v,p,g);break;case"b":p=parseFloat(o[c++])*e+r,g=parseFloat(o[c++])*e+n,x=parseFloat(o[c++])*e+r,v=parseFloat(o[c++])*e+n,F=parseFloat(o[c++])*e+r,m=parseFloat(o[c++])*e+n,s.bezierCurveTo(x,v,F,m,p,g);break}}}return{offsetX:i.ha*e,path:s}}function wh(t,e){let r=!1;const{x:n,y:a}=t,i=e.length;for(let s=0,o=i-1;s<i;o=s++){const c=e[s].x,u=e[s].y,h=e[o].x,d=e[o].y;u>a!=d>a&&n<(h-c)*(a-u)/(d-u)+c&&(r=!r)}return r}function Fh(t){const e=t.length,r=Array(e).fill(null);for(let n=0;n<e;n++){let a=null,i=1/0;for(let s=0;s<e;s++)if(n!==s&&t[n].every(o=>wh(o,t[s]))){const o=Math.abs(re.ShapeUtils.area(t[s]));o<i&&(i=o,a=s)}r[n]=a}return r}function kh(t){const e=t.length,r=Array.from({length:e},()=>[]);for(let n=0;n<e;n++){const a=t[n];a!==null&&r[a].push(n)}return r}function Th(t){return t.map((e,r)=>e===null?r:-1).filter(e=>e>=0)}function Ch(t){const e=[];for(let r=t.length-1;r>=0;r--){const n=t[r];if(n instanceof re.LineCurve)e.push(new re.LineCurve(n.v2.clone(),n.v1.clone()));else if(n instanceof re.QuadraticBezierCurve)e.push(new re.QuadraticBezierCurve(n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof re.CubicBezierCurve)e.push(new re.CubicBezierCurve(n.v3.clone(),n.v2.clone(),n.v1.clone(),n.v0.clone()));else if(n instanceof re.EllipseCurve)e.push(new re.EllipseCurve(n.aX,n.aY,n.xRadius,n.yRadius,n.aEndAngle,n.aStartAngle,!n.aClockwise,n.aRotation));else if(typeof n.getPoints=="function"){const a=n.getPoints(8);for(let i=a.length-1;i>0;i--)e.push(new re.LineCurve(a[i].clone(),a[i-1].clone()))}}return e}function ii(t,e){const r=re.ShapeUtils.area(t.getPoints(32))>0,n=e===r?t.curves.slice():Ch(t.curves),a=new re.Shape;return a.curves.push(...n),a}function Eh(t,e=32){const r=t.subPaths;if(!r||r.length===0)return[];const n=r.map(g=>g.getPoints(e)),a=Fh(n),i=kh(a),s=Th(a),o=r.length,c=Array(o).fill(-1),u=Array(o).fill(-1);for(const g of s){const x=[{idx:g,d:0}];for(;x.length;){const v=x.pop();c[v.idx]=v.d,u[v.idx]=g;for(const F of i[v.idx])x.push({idx:F,d:v.d+1})}}const h=[],d=new Set;function p(g){const x=ii(r[g],!0);d.add(g);for(const v of i[g])if(!d.has(v)&&c[v]===c[g]+1){const F=ii(r[v],!1);x.holes.push(F),d.add(v)}h.push(x)}for(const g of s)p(g);for(let g=0;g<o;g++)d.has(g)||p(g);return h}class Uh{constructor(e=512){this.maxSize=e,this.map=new Map}get(e){const r=this.map.get(e);return r&&(this.map.delete(e),this.map.set(e,r)),r}set(e,r){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxSize){const n=this.map.keys().next().value;n!==void 0&&this.map.delete(n)}this.map.set(e,r)}has(e){return this.map.has(e)}clear(){this.map.clear()}}class Ah extends ar{constructor(e){super(e),this.type="mesh",this.glyphCache=new Uh(512);const r=e.data;if(r instanceof ArrayBuffer){const n=this.parseMeshFont(r);this.data=n.data,this.opentypeFont=n.font}else throw new Error("Invalid font cache data. Please remove font cache database named 'mlightcad' in IndexedDB and try again!");this.font=new bh(this.data)}parseMeshFont(e){const r=dh(e),n=Math.round,a=r.charToGlyph("A"),i=a?r.unitsPerEm/(a.yMax||r.unitsPerEm):1,s={glyphs:{},familyName:r.getEnglishName("fullName"),ascender:n(r.ascender),descender:n(r.descender),underlinePosition:r.tables.post.underlinePosition,underlineThickness:r.tables.post.underlineThickness,boundingBox:{xMin:r.tables.head.xMin,xMax:r.tables.head.xMax,yMin:r.tables.head.yMin,yMax:r.tables.head.yMax},resolution:r.unitsPerEm||1e3,scaleFactor:i,original_font_information:r.tables.name};return{font:r,data:s}}hasChar(e){return this.opentypeFont.hasChar(e)}hasCode(e){return this.hasChar(String.fromCodePoint(e))}_loadGlyphIfNeeded(e){if(this.data.glyphs[e]||!this.opentypeFont)return;const r=this.glyphCache.get(e);if(r){this.data.glyphs[e]=r;return}if(this.opentypeFont.charToGlyphIndex(e)>0){const n=this.opentypeFont.charToGlyph(e);if(!n||!n.path)return;const a=Math.round,i={ha:a(n.advanceWidth??0),x_min:a(n.xMin??0),x_max:a(n.xMax??0),o:""};n.path.commands.forEach(s=>{let o=s.type.toLowerCase();o==="c"&&(o="b"),i.o+=o+" ",s.x!==void 0&&s.y!==void 0&&(i.o+=a(s.x)+" "+a(s.y)+" "),s.x1!==void 0&&s.y1!==void 0&&(i.o+=a(s.x1)+" "+a(s.y1)+" "),s.x2!==void 0&&s.y2!==void 0&&(i.o+=a(s.x2)+" "+a(s.y2)+" ")}),this.data.glyphs[e]=i,this.glyphCache.set(e,i)}}generateShapes(e,r){for(const n of e)this._loadGlyphIfNeeded(n);return this.font.generateShapes(e,r)}getCharShape(e,r){if(this._loadGlyphIfNeeded(e),!this.data.glyphs[e]){this.addUnsupportedChar(e);return}return new ai(e,r,this)}getCodeShape(e,r){return this.getCharShape(String.fromCodePoint(e),r)}getScaleFactor(){return this.scaleFactor==null?(this.scaleFactor=this.data.scaleFactor,this.scaleFactor):this.scaleFactor}getNotFoundTextShape(e){return new ai("?",e,this)}}class pe{static byteToSByte(e){return(e&127)-(e&128?128:0)}constructor(e){this.position=0,this.data=new DataView(e)}readBytes(e=1){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e);const r=new Uint8Array(this.data.buffer,this.position,e);return this.position+=e,r}skip(e){this.data.byteLength<this.position+e&&this.throwOutOfRangeError(this.position+e),this.position+=e}readUint8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getUint8(this.position);return this.position+=1,e}readInt8(){this.data.byteLength<this.position+1&&this.throwOutOfRangeError(this.position+1);const e=this.data.getInt8(this.position);return this.position+=1,e}readUint16(e=!0){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const r=this.data.getUint16(this.position,e);return this.position+=2,r}readInt16(){this.data.byteLength<this.position+2&&this.throwOutOfRangeError(this.position+2);const e=this.data.getInt16(this.position,!0);return this.position+=2,e}readUint32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getUint32(this.position,!0);return this.position+=4,e}readInt32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getInt32(this.position,!0);return this.position+=4,e}readFloat32(){this.data.byteLength<this.position+4&&this.throwOutOfRangeError(this.position+4);const e=this.data.getFloat32(this.position,!0);return this.position+=4,e}readFloat64(){this.data.byteLength<this.position+8&&this.throwOutOfRangeError(this.position+8);const e=this.data.getFloat64(this.position,!0);return this.position+=8,e}setPosition(e){this.data.byteLength<e&&this.throwOutOfRangeError(e),this.position=e}isEnd(){return this.position===this.data.byteLength-1}get currentPosition(){return this.position}get length(){return this.data.byteLength}throwOutOfRangeError(e){throw new Error(`Position ${e} is out of range for the data length ${this.data.byteLength}!`)}}var de=(t=>(t.SHAPES="shapes",t.BIGFONT="bigfont",t.UNIFONT="unifont",t))(de||{});class Bh{parse(e){const r=this.parseHeader(e).split(" "),n=r[1].toLocaleLowerCase();if(!Object.values(de).includes(n))throw new Error(`Invalid font type: ${n}`);return{fileHeader:r[0],fontType:n,fileVersion:r[2]}}parseHeader(e){let r="",n=0;for(;e.currentPosition<e.length-2&&n<1024;){const a=e.readUint8();if(a===13){const i=e.currentPosition,s=e.readUint8(),o=e.readUint8();if(s===10&&o===26)break;e.setPosition(i),r+=String.fromCharCode(a)}else r+=String.fromCharCode(a);n++}return r.trim()}}const be=10,Lh=[13,10,0];class Oh{parse(e){try{e.readBytes(4);const r=e.readInt16();if(r<=0)throw new Error("Invalid shape count in font file");const n=[];for(let s=0;s<r;s++){const o=e.readUint16(),c=e.readUint16();c>0&&n.push({code:o,length:c})}const a={};for(const s of n)try{const o=e.readBytes(s.length);o.length===s.length&&(a[s.code]=o)}catch{console.warn(`Failed to read shape data for code ${s.code}`)}const i={data:a,info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};if(0 in a){const s=a[0];try{const o=new TextDecoder().decode(s);let c=s.findIndex(u=>Lh.includes(u));c>=0&&(i.info=o.substring(0,c),c+3<s.length&&(i.baseUp=s[c+1],i.baseDown=s[c+2],i.height=i.baseDown+i.baseUp,i.width=i.height,i.orientation=s[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse font info block")}}return i}catch(r){return console.error("Error parsing shape font:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}}class Mh{parse(e){try{e.readInt16();const r=e.readInt16(),n=e.readInt16();if(r<=0)throw new Error("Invalid character count in font file");e.skip(n*4);const a=[];for(let o=0;o<r;o++){const c=e.readUint16(),u=e.readUint16(),h=e.readUint32();(c!==0||u!==0||h!==0)&&a.push({code:c,length:u,offset:h})}const i={};for(const o of a)try{e.setPosition(o.offset);const c=e.readBytes(o.length);c.length===o.length&&(i[o.code]=c)}catch{console.warn(`Failed to read bigfont data for code ${o.code}`)}const s={data:i,info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};if(0 in i){const o=i[0];try{const c=this.utf8ArrayToStr(o);let u=c.pos;u>=0&&(s.info=c.text,u++,u+3<o.length&&(o.length-u>4?(s.height=o[u++],u++,s.orientation=o[u++]===0?"horizontal":"vertical",s.width=o[u++],s.baseUp=s.height,s.baseDown=0,s.isExtended=!0):(s.baseUp=o[u++],s.baseDown=o[u++],s.height=s.baseDown+s.baseUp,s.width=s.height,s.orientation=o[u]===0?"horizontal":"vertical")))}catch{console.warn("Failed to parse bigfont info block")}}return s}catch(r){return console.error("Error parsing big font:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}utf8ArrayToStr(e){let r="",n=0;for(;n<e.length;){const a=e[n];switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(a);break;case 12:case 13:{const i=e[n++];r+=String.fromCharCode((a&31)<<6|i&63);break}case 14:{const i=e[n++],s=e[n++];r+=String.fromCharCode((a&15)<<12|(i&63)<<6|(s&63)<<0);break}}if(r.charCodeAt(r.length-1)===0)break;n++}return{text:r,pos:n}}}let Rh=class{parse(e){try{const r=e.readInt32();if(r<=0)throw new Error("Invalid character count in font file");const n=e.readInt16(),a=e.readBytes(n),i={data:{},info:"",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1};try{const o=new TextDecoder().decode(a);let c=o.indexOf("\0");c>=0&&(i.info=o.substring(0,c),c+3<a.length&&(i.baseUp=a[c+1],i.baseDown=a[c+2],i.height=i.baseUp+i.baseDown,i.width=i.height,i.orientation=a[c+3]===0?"horizontal":"vertical"))}catch{console.warn("Failed to parse unifont info block")}const s={};for(let o=0;o<r-1;o++)try{const c=e.readUint16(),u=e.readUint16();if(u>0){const h=e.readBytes(u);if(h.length===u){const d=h.indexOf(0);let p=0;d>=0&&d<h.length&&(p=d+1),p<h.length&&(s[c]=h.subarray(p))}}}catch{console.warn("Failed to read unifont character data");break}return i.data=s,i}catch(r){return console.error("Error parsing unifont:",r),{data:{},info:"Failed to parse font file",baseUp:8,baseDown:2,height:be,width:be,orientation:"horizontal",isExtended:!1}}}},Ih=class{static createParser(e){switch(e){case de.SHAPES:return new Oh;case de.BIGFONT:return new Mh;case de.UNIFONT:return new Rh;default:throw new Error(`Unsupported font type: ${e}`)}}};class J{constructor(e=0,r=0){this.x=e,this.y=r}set(e,r){return this.x=e,this.y=r,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}clone(){return new J(this.x,this.y)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e,this.y*=e,this}divide(e){return e!==0&&(this.x/=e,this.y/=e),this}multiplyScalars(e,r){return this.x*=e,this.y*=r,this}divideScalars(e,r){return e!==0&&(this.x/=e),r!==0&&(this.y/=r),this}distanceTo(e){const r=this.x-e.x,n=this.y-e.y;return Math.sqrt(r*r+n*n)}}const si=Math.PI/4;class Tt{static fromBulge(e,r,n){const a=Math.max(-1,Math.min(1,n));return new Tt({start:e,end:r,bulge:a})}static fromOctant(e,r,n,a,i){return new Tt({center:e,radius:r,startOctant:n,octantCount:a,isClockwise:i})}constructor(e){if(e.start&&e.end&&e.bulge!==void 0){this.start=e.start.clone(),this.end=e.end.clone(),this.bulge=e.bulge,this.isClockwise=e.bulge<0;const r=this.end.clone().subtract(this.start),n=r.length();if(Math.abs(this.bulge)*n/2===0){this.radius=0,this.center=this.start.clone(),this.startAngle=Math.atan2(r.y,r.x),this.endAngle=this.startAngle;return}const a=4*Math.atan(Math.abs(this.bulge));this.radius=n/(2*Math.sin(a/2));const i=this.start.clone().add(r.clone().divide(2)),s=new J(-r.y,r.x);s.normalize(),s.multiply(Math.abs(this.radius*Math.cos(a/2))),this.center=i.clone(),this.isClockwise?this.center.subtract(s):this.center.add(s),this.startAngle=Math.atan2(this.start.y-this.center.y,this.start.x-this.center.x),this.endAngle=Math.atan2(this.end.y-this.center.y,this.end.x-this.center.x),this.isClockwise?this.endAngle>=this.startAngle&&(this.endAngle-=2*Math.PI):this.endAngle<=this.startAngle&&(this.endAngle+=2*Math.PI)}else if(e.center&&e.radius!==void 0&&e.startOctant!==void 0&&e.octantCount!==void 0&&e.isClockwise!==void 0){this.center=e.center.clone(),this.radius=e.radius,this.isClockwise=e.isClockwise,this.startAngle=e.startOctant*si;const r=(e.octantCount===0?8:e.octantCount)*si;this.endAngle=this.startAngle+(this.isClockwise?-r:r),this.start=this.center.clone().add(new J(this.radius*Math.cos(this.startAngle),this.radius*Math.sin(this.startAngle))),this.end=this.center.clone().add(new J(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))}else throw new Error("Invalid arc parameters")}tessellate(e=Math.PI/18){if(this.radius===0)return[this.start.clone(),this.end.clone()];const r=[this.start.clone()],n=Math.abs(this.endAngle-this.startAngle),a=Math.max(1,Math.floor(n/e));for(let i=1;i<a;i++){const s=i/a,o=this.isClockwise?this.startAngle-s*n:this.startAngle+s*n;r.push(this.center.clone().add(new J(this.radius*Math.cos(o),this.radius*Math.sin(o))))}return r.push(this.end?this.end.clone():this.center.clone().add(new J(this.radius*Math.cos(this.endAngle),this.radius*Math.sin(this.endAngle)))),r}}class Ct{constructor(e,r=[]){this.lastPoint=e,this.polylines=r}get bbox(){if(this._bbox)return this._bbox;let e=1/0,r=-1/0,n=1/0,a=-1/0;return this.polylines.forEach(i=>{i.forEach(s=>{e=Math.min(e,s.x),r=Math.max(r,s.x),n=Math.min(n,s.y),a=Math.max(a,s.y)})}),this._bbox={minX:e,minY:n,maxX:r,maxY:a},this._bbox}offset(e,r=!0){var n,a;return r?new Ct((n=this.lastPoint)==null?void 0:n.clone().add(e),this.polylines.map(i=>i.map(s=>s.clone().add(e)))):((a=this.lastPoint)==null||a.add(e),this.polylines.forEach(i=>i.forEach(s=>s.add(e))),this._bbox&&(this._bbox.maxX+=e.x,this._bbox.minX+=e.x,this._bbox.maxY+=e.y,this._bbox.minY+=e.y),this)}normalizeToOrigin(e=!1){const r=this.bbox;return this.offset(new J(-r.minX,-r.minY),e)}toSVG(e={}){const{strokeWidth:r="0.5%",strokeColor:n="black",isAutoFit:a=!1}=e;let i,s;if(a){const o=this.bbox,c=.2,u=o.maxX-o.minX,h=o.maxY-o.minY,d=u===0?h:u,p=h===0?u:h,g=o.minX-d*c,x=o.maxX+d*c,v=o.minY-p*c,F=o.maxY+p*c;s=this.polylines.map(m=>{let S="";return m.forEach((w,k)=>{const T=w.x,R=-w.y;S+=k===0?`M ${T} ${R} `:`L ${T} ${R} `}),`<path d="${S}" stroke="${n}" stroke-width="${r}" fill="none"/>`}).join(""),i=`${g} ${-F} ${x-g} ${F-v}`}else i="0 0 20 20",s=this.polylines.map(o=>{let c="";return o.forEach((u,h)=>{const d=u.x+5,p=-u.y+15;c+=h===0?`M ${d} ${p} `:`L ${d} ${p} `}),`<path d="${c}" stroke="${n}" stroke-width="${r}" fill="none"/>`}).join("");return`<svg width="100%" height="100%" viewBox="${i}" preserveAspectRatio="xMidYMid meet">${s}</svg>`}}const Dh=Math.PI/18;class _h{constructor(e){this.shapeCache=new Map,this.shapeData=new Map,this.fontData=e}release(){this.shapeCache.clear(),this.shapeData.clear()}getCharShape(e,r){const n=r/this.fontData.content.height;return this.parseAndScale(e,{factor:n})}parseAndScale(e,r){if(e===0)return;let n;if(this.shapeCache.has(e))n=this.shapeCache.get(e);else{const a=this.fontData.content.data;if(a[e]){const i=a[e];n=this.parseShape(i),this.shapeData.set(e,n),this.shapeCache.set(e,n)}}if(n){if(r.factor!==void 0)return this.scaleShapeByFactor(n,r.factor);if(r.height!==void 0){const a=r.width??r.height;return this.scaleShapeByHeightAndWidth(n,r.height,a)}else return n}}scaleShapeByFactor(e,r){var n;return new Ct((n=e.lastPoint)==null?void 0:n.clone().multiply(r),e.polylines.map(a=>a.map(i=>i.clone().multiply(r))))}scaleShapeByHeightAndWidth(e,r,n){var a;const i=e.bbox,s=i.maxY-i.minY,o=i.maxX-i.minX,c=s>0?r/s:1,u=o>0?n/o:1,h=(a=e.lastPoint)==null?void 0:a.clone();h&&(h.x*=u,h.y*=c);const d=e.polylines.map(p=>p.map(g=>{const x=g.clone();return x.x*=u,x.y*=c,x}));return new Ct(h,d)}parseShape(e){const r={currentPoint:new J,polylines:[],currentPolyline:[],sp:[],isPenDown:!1,scale:1};for(let n=0;n<e.length;n++){const a=e[n];a<=15?n=this.handleSpecialCommand(a,e,n,r):this.handleVectorCommand(a,r)}return new Ct(r.currentPoint,r.polylines)}handleSpecialCommand(e,r,n,a){let i=n;switch(e){case 0:a.currentPolyline=[],a.isPenDown=!1;break;case 1:a.isPenDown=!0,a.currentPolyline.push(a.currentPoint.clone());break;case 2:a.isPenDown=!1,a.currentPolyline.length>1&&a.polylines.push(a.currentPolyline.slice()),a.currentPolyline=[];break;case 3:i++,a.scale/=r[i];break;case 4:i++,a.scale*=r[i];break;case 5:if(a.sp.length===4)throw new Error("The position stack is only four locations deep");a.sp.push(a.currentPoint.clone());break;case 6:a.currentPoint=a.sp.pop()??a.currentPoint;break;case 7:i=this.handleSubshapeCommand(r,i,a);break;case 8:i=this.handleXYDisplacement(r,i,a);break;case 9:i=this.handleMultipleXYDisplacements(r,i,a);break;case 10:i=this.handleOctantArc(r,i,a);break;case 11:i=this.handleFractionalArc(r,i,a);break;case 12:i=this.handleBulgeArc(r,i,a);break;case 13:i=this.handleMultipleBulgeArcs(r,i,a);break;case 14:i=this.skipCode(r,++i);break}return i}handleVectorCommand(e,r){const n=(e&240)>>4,a=e&15,i=this.getVectorForDirection(a);r.currentPoint.add(i.multiply(n*r.scale)),r.isPenDown&&r.currentPolyline.push(r.currentPoint.clone())}getVectorForDirection(e){const r=new J;switch(e){case 0:r.x=1;break;case 1:r.x=1,r.y=.5;break;case 2:r.x=1,r.y=1;break;case 3:r.x=.5,r.y=1;break;case 4:r.y=1;break;case 5:r.x=-.5,r.y=1;break;case 6:r.x=-1,r.y=1;break;case 7:r.x=-1,r.y=.5;break;case 8:r.x=-1;break;case 9:r.x=-1,r.y=-.5;break;case 10:r.x=-1,r.y=-1;break;case 11:r.x=-.5,r.y=-1;break;case 12:r.y=-1;break;case 13:r.x=.5,r.y=-1;break;case 14:r.x=1,r.y=-1;break;case 15:r.x=1,r.y=-.5;break}return r}handleSubshapeCommand(e,r,n){let a=r,i=0,s,o=n.scale*this.fontData.content.height,c=o;const u=n.currentPoint.clone();switch(n.currentPolyline.length>1&&(n.polylines.push(n.currentPolyline.slice()),n.currentPolyline=[]),this.fontData.header.fontType){case de.SHAPES:a++,i=e[a];break;case de.BIGFONT:a++,i=e[a],i===0&&(a++,i=e[a++]<<8|e[a++],u.x=pe.byteToSByte(e[a++])*n.scale,u.y=pe.byteToSByte(e[a++])*n.scale,this.fontData.content.isExtended&&(c=e[a++]*n.scale),o=e[a]*n.scale);break;case de.UNIFONT:a++,i=e[a++]<<8|e[a++];break}return i!==0&&(s=this.getScaledSubshapeAtInsertPoint(i,c,o,u),s&&n.polylines.push(...s.polylines.slice())),n.currentPolyline=[],a}handleXYDisplacement(e,r,n){let a=r;const i=new J;return i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),n.currentPoint.add(i.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone()),a}handleMultipleXYDisplacements(e,r,n){let a=r;for(;;){const i=new J;if(i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),i.x===0&&i.y===0)break;n.currentPoint.add(i.multiply(n.scale)),n.isPenDown&&n.currentPolyline.push(n.currentPoint.clone())}return a}handleOctantArc(e,r,n){var a;let i=r;const s=e[++i]*n.scale,o=pe.byteToSByte(e[++i]),c=(o&112)>>4;let u=o&7;const h=o<0,d=Math.PI/4*c,p=n.currentPoint.clone().subtract(new J(Math.cos(d)*s,Math.sin(d)*s)),g=Tt.fromOctant(p,s,c,u,h);if(n.isPenDown){const x=g.tessellate();n.currentPolyline.pop(),n.currentPolyline.push(...x.slice())}return n.currentPoint=(a=g.tessellate().pop())==null?void 0:a.clone(),i}handleFractionalArc(e,r,n){let a=r;const i=e[++a],s=e[++a],o=e[++a],c=e[++a],u=(o*255+c)*n.scale,h=pe.byteToSByte(e[++a]),d=(h&112)>>4;let p=h&7;p===0&&(p=8),s!==0&&p--;const g=Math.PI/4;let x=g*p,v=Dh,F=1;h<0&&(v=-v,x=-x,F=-1);let m=g*d,S=m+x;m+=g*i/256*F,S+=g*s/256*F;const w=n.currentPoint.clone().subtract(new J(u*Math.cos(m),u*Math.sin(m)));if(n.currentPoint=w.clone().add(new J(u*Math.cos(S),u*Math.sin(S))),n.isPenDown){let k=m;const T=[];if(T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k)))),v>0)for(;k+v<S;)k+=v,T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k))));else for(;k+v>S;)k+=v,T.push(w.clone().add(new J(u*Math.cos(k),u*Math.sin(k))));T.push(w.clone().add(new J(u*Math.cos(S),u*Math.sin(S)))),n.currentPolyline.push(...T)}return a}handleBulgeArc(e,r,n){let a=r;const i=new J;i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]);const s=pe.byteToSByte(e[++a]);return n.currentPoint=this.handleArcSegment(n.currentPoint,i,s,n.scale,n.isPenDown,n.currentPolyline),a}handleMultipleBulgeArcs(e,r,n){let a=r;for(;;){const i=new J;if(i.x=pe.byteToSByte(e[++a]),i.y=pe.byteToSByte(e[++a]),i.x===0&&i.y===0)break;const s=pe.byteToSByte(e[++a]);n.currentPoint=this.handleArcSegment(n.currentPoint,i,s,n.scale,n.isPenDown,n.currentPolyline)}return a}skipCode(e,r){switch(e[r]){case 0:break;case 1:break;case 2:break;case 3:case 4:r++;break;case 5:break;case 6:break;case 7:switch(this.fontData.header.fontType){case de.SHAPES:r++;break;case de.BIGFONT:r++,e[r]===0&&(r+=this.fontData.content.isExtended?6:5);break;case de.UNIFONT:r+=2;break}break;case 8:r+=2;break;case 9:for(;;){const n=e[++r],a=e[++r];if(n===0&&a===0)break}break;case 10:r+=2;break;case 11:r+=5;break;case 12:r+=3;break;case 13:for(;;){const n=e[++r],a=e[++r];if(n===0&&a===0)break;r++}break}return r}getScaledSubshapeAtInsertPoint(e,r,n,a){let i=this.shapeCache.get(e);if(!i){const o=this.fontData.content.data[e];if(!o)return;i=this.parseShape(o),this.shapeData.set(e,i),this.shapeCache.set(e,i)}const s=i.normalizeToOrigin(!0);return this.scaleShapeByHeightAndWidth(s,n,r).offset(a,!1)}handleArcSegment(e,r,n,a,i,s){r.x*=a,r.y*=a,n<-127&&(n=-127);const o=e.clone();if(i)if(n===0)s.push(o.clone().add(r));else{const c=o.clone().add(r),u=Tt.fromBulge(o,c,n/127).tessellate();s.push(...u.slice(1))}return o.add(r),o}}let Ph=class{constructor(e){if(e instanceof ArrayBuffer){const r=new pe(e),n=new Bh().parse(r),a=Ih.createParser(n.fontType).parse(r);this.fontData={header:n,content:a}}else this.fontData=e;this.shapeParser=new _h(this.fontData)}hasChar(e){return this.fontData.content.data[e]!==void 0}getCharShape(e,r){let n=this.shapeParser.getCharShape(e,r);return n&&this.fontData.header.fontType===de.BIGFONT&&(n=n.normalizeToOrigin()),n}release(){this.shapeParser.release()}};function Nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Gh(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var oi={exports:{}},Wr={},Yt={};Yt.byteLength=Wh,Yt.toByteArray=Vh,Yt.fromByteArray=Yh;for(var Re=[],xe=[],Hh=typeof Uint8Array<"u"?Uint8Array:Array,qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=0,zh=qr.length;ot<zh;++ot)Re[ot]=qr[ot],xe[qr.charCodeAt(ot)]=ot;xe[45]=62,xe[95]=63;function ci(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Wh(t){var e=ci(t),r=e[0],n=e[1];return(r+n)*3/4-n}function qh(t,e,r){return(e+r)*3/4-r}function Vh(t){var e,r=ci(t),n=r[0],a=r[1],i=new Hh(qh(t,n,a)),s=0,o=a>0?n-4:n,c;for(c=0;c<o;c+=4)e=xe[t.charCodeAt(c)]<<18|xe[t.charCodeAt(c+1)]<<12|xe[t.charCodeAt(c+2)]<<6|xe[t.charCodeAt(c+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=e&255;return a===2&&(e=xe[t.charCodeAt(c)]<<2|xe[t.charCodeAt(c+1)]>>4,i[s++]=e&255),a===1&&(e=xe[t.charCodeAt(c)]<<10|xe[t.charCodeAt(c+1)]<<4|xe[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function Xh(t){return Re[t>>18&63]+Re[t>>12&63]+Re[t>>6&63]+Re[t&63]}function jh(t,e,r){for(var n,a=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),a.push(Xh(n));return a.join("")}function Yh(t){for(var e,r=t.length,n=r%3,a=[],i=16383,s=0,o=r-n;s<o;s+=i)a.push(jh(t,s,s+i>o?o:s+i));return n===1?(e=t[r-1],a.push(Re[e>>2]+Re[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],a.push(Re[e>>10]+Re[e>>4&63]+Re[e<<2&63]+"=")),a.join("")}var Vr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Vr.read=function(t,e,r,n,a){var i,s,o=a*8-n-1,c=(1<<o)-1,u=c>>1,h=-7,d=r?a-1:0,p=r?-1:1,g=t[e+d];for(d+=p,i=g&(1<<-h)-1,g>>=-h,h+=o;h>0;i=i*256+t[e+d],d+=p,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=s*256+t[e+d],d+=p,h-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(g?-1:1)*s*Math.pow(2,i-n)},Vr.write=function(t,e,r,n,a,i){var s,o,c,u=i*8-a-1,h=(1<<u)-1,d=h>>1,p=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,x=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?e+=p/c:e+=p*Math.pow(2,1-d),e*c>=2&&(s++,c/=2),s+d>=h?(o=0,s=h):s+d>=1?(o=(e*c-1)*Math.pow(2,a),s=s+d):(o=e*Math.pow(2,d-1)*Math.pow(2,a),s=0));a>=8;t[r+g]=o&255,g+=x,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;t[r+g]=s&255,g+=x,s/=256,u-=8);t[r+g-x]|=v*128};/*!
|
|
4
4
|
* The buffer module from node.js, for the browser.
|
|
5
5
|
*
|
|
6
6
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
@@ -14994,18 +14994,20 @@ var $d = Zh((O) => {
|
|
|
14994
14994
|
this.data.glyphs[e] = t;
|
|
14995
14995
|
return;
|
|
14996
14996
|
}
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
14997
|
+
if (this.opentypeFont.charToGlyphIndex(e) > 0) {
|
|
14998
|
+
const r = this.opentypeFont.charToGlyph(e);
|
|
14999
|
+
if (!r || !r.path) return;
|
|
15000
|
+
const i = Math.round, s = {
|
|
15001
|
+
ha: i(r.advanceWidth ?? 0),
|
|
15002
|
+
x_min: i(r.xMin ?? 0),
|
|
15003
|
+
x_max: i(r.xMax ?? 0),
|
|
15004
|
+
o: ""
|
|
15005
|
+
};
|
|
15006
|
+
r.path.commands.forEach((a) => {
|
|
15007
|
+
let o = a.type.toLowerCase();
|
|
15008
|
+
o === "c" && (o = "b"), s.o += o + " ", a.x !== void 0 && a.y !== void 0 && (s.o += i(a.x) + " " + i(a.y) + " "), a.x1 !== void 0 && a.y1 !== void 0 && (s.o += i(a.x1) + " " + i(a.y1) + " "), a.x2 !== void 0 && a.y2 !== void 0 && (s.o += i(a.x2) + " " + i(a.y2) + " ");
|
|
15009
|
+
}), this.data.glyphs[e] = s, this.glyphCache.set(e, s);
|
|
15010
|
+
}
|
|
15009
15011
|
}
|
|
15010
15012
|
/**
|
|
15011
15013
|
* Generates shapes for a text string
|