modern-canvas 0.12.4 → 0.12.5
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.cjs +12 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +12 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6250,9 +6250,12 @@ exports.Node = class Node extends CoreObject {
|
|
|
6250
6250
|
}
|
|
6251
6251
|
findOne(callbackfn) {
|
|
6252
6252
|
for (const child of this._children.default) {
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6253
|
+
if (callbackfn(child)) {
|
|
6254
|
+
return child;
|
|
6255
|
+
}
|
|
6256
|
+
const res = child.findOne(callbackfn);
|
|
6257
|
+
if (res) {
|
|
6258
|
+
return res;
|
|
6256
6259
|
}
|
|
6257
6260
|
}
|
|
6258
6261
|
return void 0;
|
|
@@ -6260,9 +6263,8 @@ exports.Node = class Node extends CoreObject {
|
|
|
6260
6263
|
findAll(callbackfn) {
|
|
6261
6264
|
const items = [];
|
|
6262
6265
|
for (const child of this._children.default) {
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
items.push(value);
|
|
6266
|
+
if (callbackfn(child)) {
|
|
6267
|
+
items.push(child);
|
|
6266
6268
|
}
|
|
6267
6269
|
items.push(...child.findAll(callbackfn));
|
|
6268
6270
|
}
|
|
@@ -6271,7 +6273,10 @@ exports.Node = class Node extends CoreObject {
|
|
|
6271
6273
|
findAncestor(callbackfn) {
|
|
6272
6274
|
const parent = this._parent;
|
|
6273
6275
|
if (parent) {
|
|
6274
|
-
|
|
6276
|
+
if (callbackfn(parent)) {
|
|
6277
|
+
return parent;
|
|
6278
|
+
}
|
|
6279
|
+
const value = parent.findAncestor(callbackfn);
|
|
6275
6280
|
if (value) {
|
|
6276
6281
|
return value;
|
|
6277
6282
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1757,7 +1757,7 @@ declare class Node extends CoreObject {
|
|
|
1757
1757
|
remove(): void;
|
|
1758
1758
|
findOne<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1759
1759
|
findAll<T extends Node = Node>(callbackfn: (value: Node) => boolean): T[];
|
|
1760
|
-
findAncestor<T extends Node = Node>(callbackfn: (value: Node) =>
|
|
1760
|
+
findAncestor<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1761
1761
|
/** override */
|
|
1762
1762
|
protected _ready(): void;
|
|
1763
1763
|
protected _treeEnter(tree: SceneTree): void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1757,7 +1757,7 @@ declare class Node extends CoreObject {
|
|
|
1757
1757
|
remove(): void;
|
|
1758
1758
|
findOne<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1759
1759
|
findAll<T extends Node = Node>(callbackfn: (value: Node) => boolean): T[];
|
|
1760
|
-
findAncestor<T extends Node = Node>(callbackfn: (value: Node) =>
|
|
1760
|
+
findAncestor<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1761
1761
|
/** override */
|
|
1762
1762
|
protected _ready(): void;
|
|
1763
1763
|
protected _treeEnter(tree: SceneTree): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1757,7 +1757,7 @@ declare class Node extends CoreObject {
|
|
|
1757
1757
|
remove(): void;
|
|
1758
1758
|
findOne<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1759
1759
|
findAll<T extends Node = Node>(callbackfn: (value: Node) => boolean): T[];
|
|
1760
|
-
findAncestor<T extends Node = Node>(callbackfn: (value: Node) =>
|
|
1760
|
+
findAncestor<T extends Node = Node>(callbackfn: (value: Node) => boolean): T | undefined;
|
|
1761
1761
|
/** override */
|
|
1762
1762
|
protected _ready(): void;
|
|
1763
1763
|
protected _treeEnter(tree: SceneTree): void;
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ uniform sampler2D sampler;
|
|
|
145
145
|
uniform vec4 tint;
|
|
146
146
|
void main(void) {
|
|
147
147
|
gl_FragColor = texture2D(sampler, vUv) * tint;
|
|
148
|
-
}`,uniforms:{sampler:0,projectionMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),modelViewMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),tint:new Float32Array([1,1,1,1])}})}}class Q extends Ii{static _instance;static get instance(){return this._instance??=new this}static draw(e,t=$r.instance,r){this.instance.draw(e,t,r)}constructor(){super({vertexAttributes:{position:new Ge({buffer:new St({data:new Float32Array([-1,-1,1,-1,1,1,-1,1]),dynamic:!1}),size:2,normalized:!1,type:"float"}),uv:new Ge({buffer:new St({data:new Float32Array([0,0,1,0,1,1,0,1]),dynamic:!1}),size:2,normalized:!1,type:"float"})},indexBuffer:new dr({data:new Uint16Array([0,1,2,0,2,3]),dynamic:!1})})}}class tf extends Ii{positionBuffer;uvBuffer;constructor(){const e=new St({data:new Float32Array,dynamic:!0}),t=new St({data:new Float32Array,dynamic:!0});super({vertexAttributes:{position:new Ge({buffer:e,size:2,normalized:!1,type:"float"}),uv:new Ge({buffer:t,size:2,normalized:!1,type:"float"})},indexBuffer:new dr({data:new Uint16Array,dynamic:!0})}),this.positionBuffer=e,this.uvBuffer=t}}var rf=Object.defineProperty,pr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&rf(e,t,i),i};class le extends Pt{static get EMPTY(){return new this({width:1,height:1,pixels:null})}static get WHITE(){return new this({width:1,height:1,pixels:new Uint8Array([255,255,255,255])})}static get BLACK(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,0,255])})}static get RED(){return new this({width:1,height:1,pixels:new Uint8Array([255,0,0,255])})}static get GREEN(){return new this({width:1,height:1,pixels:new Uint8Array([0,255,0,255])})}static get BLUE(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,255,255])})}_isPowerOfTwo=!1;_needsUpload=!1;get realWidth(){return Math.round(this.width*this.pixelRatio)}get realHeight(){return Math.round(this.height*this.pixelRatio)}constructor(e){super(),this.source=e,this._updateSize()}isValid(){return!!(this.width&&this.height)}_glTextureOptions(e,t){let r=this.wrapMode;return e.version===1&&!this._isPowerOfTwo&&(r="clamp_to_edge"),{value:this.source,target:"texture_2d",location:0,filterMode:this.filterMode,wrapMode:r,...t}}_glTexture(e,t){return e.getRelated(this,()=>e.texture.create(this._glTextureOptions(e,t)))}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"width":case"height":this._updatePOT();break;case"source":this._updateSize();break;case"filterMode":case"wrapMode":case"pixelRatio":this.requestUpload();break}}_updatePOT(){this._isPowerOfTwo=Ts(this.realWidth)&&Ts(this.realHeight),this.requestUpload()}_updateSize(){const e=this.source;"pixels"in e?(this.width=e.width/this.pixelRatio,this.height=e.height/this.pixelRatio):(this.width=Number(e.naturalWidth||e.videoWidth||e.width||0)/this.pixelRatio,this.height=Number(e.naturalHeight||e.videoHeight||e.height||0)/this.pixelRatio),this.requestUpload()}requestUpload(){this._needsUpload=!0}upload(e,t){return this._needsUpload&&this.isValid()?(this._needsUpload=!1,e.texture.update(this._glTexture(e,t),this._glTextureOptions(e,t)),!0):!1}activate(e,t=0){return this.isValid()?(e.texture.bind({target:"texture_2d",value:this._glTexture(e,{location:t}),location:t}),this.upload(e,{location:t}),!0):!1}inactivate(e){e.texture.unbind(this._glTexture(e))}destroy(){Ao&&this.source instanceof ImageBitmap&&this.source.close()}}pr([_({internal:!0})],le.prototype,"source"),pr([_({fallback:0})],le.prototype,"width"),pr([_({fallback:0})],le.prototype,"height"),pr([_({fallback:"linear"})],le.prototype,"filterMode"),pr([_({fallback:"clamp_to_edge"})],le.prototype,"wrapMode"),pr([_({fallback:1})],le.prototype,"pixelRatio");class Ri extends Pt{frames;frameIndex=0;get currentFrame(){return this.frames[this.frameIndex]}constructor(e){super();let t;if(Array.isArray(e))t=e;else if(e instanceof le)t=[{texture:e,duration:0}];else throw new TypeError("Failed new AnimatedTexture");this.frames=t,this.updateDuration()}updateDuration(){return this.duration=this.frames.reduce((e,t)=>t.duration+e,0),this}destroy(){this.frames.forEach(e=>{e.texture.destroy()})}}var sf=Object.defineProperty,nf=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&sf(e,t,i),i};class Ui extends le{constructor(e=document.createElement("canvas")){super(e)}_updateProperty(e,t,r){switch(e){case"width":this.source.width=Math.max(1,Math.ceil(t*this.pixelRatio));break;case"height":this.source.height=Math.max(1,Math.ceil(t*this.pixelRatio));break}super._updateProperty(e,t,r)}}nf([_({fallback:2})],Ui.prototype,"pixelRatio");class of extends le{static _cached=new Map;static get(e){const t=new Qe(e),r=t.toHex();let i=this._cached.get(r);return i||(i=new le({width:1,height:1,pixels:new Uint8Array([t.r8,t.g8,t.b8,t.a8])}),this._cached.set(r,i)),i}constructor(e){const t=new Qe(e);super({width:1,height:1,pixels:new Uint8Array([t.r8,t.g8,t.b8,t.a8])})}}class zr extends le{static test(e){return Ar(e)}static linearGradient(e,t,r){t=t||1,r=r||1;const i=document.createElement("canvas");i.width=t,i.height=r;const n=i.getContext("2d");if(!n)throw new Error("Failed to parse linear gradient, get canvas context is null.");const{angle:o=0,stops:a}=e,l=t,c=r,h=l/2,u=c/2,d=(o+90)*Math.PI/180,g=Math.sin(d),p=-Math.cos(d),y=Math.abs(l*Math.sin(d))+Math.abs(c*Math.cos(d)),m=h-g*(y/2),P=u-p*(y/2),E=h+g*(y/2),b=u+p*(y/2),S=n.createLinearGradient(m,P,E,b);for(const x of a)S.addColorStop(x.offset,x.color);n.fillStyle=S,n.fillRect(0,0,l,c);const w=n.getImageData(0,0,i.width,i.height);return{width:w.width,height:w.height,pixels:new Uint8Array(w.data.buffer)}}constructor(e,t,r){super(zr.linearGradient(e,t,r))}}function af(s){return{autoLoad:!!(s?.autoLoad??!0),useBitmap:!!(s?.useBitmap??!0)&&Es,crossorigin:s?.crossorigin??null}}class lf extends le{bitmap;useBitmap;preserveBitmap=!1;_loadSource;_loadBitmap;constructor(e,t){const r=af(t);super(e);const i=e.src,n=i.includes(".svg")||i.startsWith("data:image/svg+xml");this.useBitmap=r.useBitmap&&!n,r.autoLoad&&this.load()}async load(){return this._loadSource||(this._loadSource=new Promise(e=>{this._loadSource=void 0;const t=this.source,r=()=>{t.onload=null,t.onerror=null},i=()=>{r(),this.requestUpload(),this.useBitmap?this.genBitmap().finally(()=>e(this)):e(this)},n=o=>{r(),console.warn(`Failed to load ImageTexture, src: ${t.src}`,o),this.emit("error",o),e(this)};t.complete&&t.src?i():(t.onload=i,t.onerror=n)})),this._loadSource}genBitmap(){if(this._loadBitmap)return this._loadBitmap;if(this.bitmap||!Es)return Promise.resolve(this);const e=this.source,t=!e.crossOrigin||e.crossOrigin==="anonymous";return this._loadBitmap=fetch(e.src,{mode:t?"cors":"no-cors"}).then(r=>r.blob()).then(r=>createImageBitmap(r,0,0,e.width,e.height,{premultiplyAlpha:"premultiply"})).then(r=>(this.bitmap=r,this.requestUpload(),this._loadBitmap=void 0,this)).catch(r=>(console.warn("Failed to genBitmap",r),this)),this._loadBitmap}_glTextureOptions(e){return{...super._glTextureOptions(e),value:this.bitmap??this.source}}upload(e){if(this.useBitmap){if(!this.bitmap)return this.genBitmap(),!1}else{const r=this.source;if(Dr&&r instanceof HTMLImageElement&&(!r.complete||r.naturalWidth===0))return!1}const t=super.upload(e);return this.preserveBitmap&&this.bitmap&&(this.bitmap.close(),this.bitmap=void 0),t}}class Zs extends le{constructor(e,t=1,r=1){const i={width:t,height:r,pixels:null};e&&(ArrayBuffer.isView(e)?i.pixels=new Uint8Array(e.buffer):i.pixels=new Uint8Array(e)),super(i)}_updateProperty(e,t,r){switch(e){case"width":this.source.width=Math.round(this.width*this.pixelRatio);break;case"height":this.source.height=Math.round(this.height*this.pixelRatio);break;case"pixelRatio":this.source.width=Math.round(this.width*this.pixelRatio),this.source.height=Math.round(this.height*this.pixelRatio);break}super._updateProperty(e,t,r)}}var cf=Object.defineProperty,za=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&cf(e,t,i),i};function hf(s){return{autoLoad:!!(s?.autoLoad??!0),autoPlay:!!(s?.autoPlay??!1),fps:Number(s?.fps??0),crossorigin:s?.crossorigin??null,loop:!!(s?.loop??!1),muted:!!(s?.muted??!1),playsinline:!!(s?.playsinline??!0)}}const Js=class gc extends le{static mimeTypes=new Map(Object.entries({ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"}));get isReady(){return this.source.readyState>2}get isPlaying(){return!this.source.paused&&!this.source.ended&&this.isReady}get duration(){return this.source.duration}get seeking(){return this.source.seeking}get currentTime(){return this.source.currentTime}set currentTime(e){this.source.currentTime=e}_spf=0;_autoPlay=!1;_sourceLoad;_nextTime=0;_connected=!1;_requestId;_resolve;_reject;constructor(e,t){const r=hf(t);if(!Uo(e)){typeof e=="string"&&(e=[e]);const i=e[0].src||e[0],n=document.createElement("video");r.autoLoad&&n.setAttribute("preload","auto"),r.playsinline&&(n.setAttribute("webkit-playsinline",""),n.setAttribute("playsinline","")),r.muted&&(n.setAttribute("muted",""),n.muted=!0),r.loop&&n.setAttribute("loop",""),r.autoPlay&&n.setAttribute("autoplay",""),$o(n,i,r.crossorigin);for(let o=0;o<e.length;++o){let{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),u=h.slice(h.lastIndexOf(".")+1);l=l||gc.mimeTypes.get(u)||`video/${u}`}const c=document.createElement("source");c.src=a,l&&(c.type=l),n.appendChild(c)}e=n}super(e),this.fps=r.fps,this._autoPlay=r.autoPlay,r.autoPlay&&this.load(),this._setupAutoUpdate()}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"fps":this._spf=t?Math.floor(1e3/t):0,this._setupAutoUpdate();break;case"autoUpdate":this._setupAutoUpdate();break}}_onPlayStart=()=>{this.isValid()||this._onCanPlay(),this._setupAutoUpdate()};_onPlayStop=()=>{this._setupAutoUpdate()};_onCanPlay=()=>{const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.isValid();this._nextTime=0,this._updateSize(),this.requestUpload(),this._nextTime=0,!t&&this._resolve&&(this._resolve(this),this._sourceLoad=void 0,this._resolve=void 0,this._reject=void 0),this.isPlaying?this._onPlayStart():this._autoPlay&&e.play()};_onError=e=>{this.source.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=void 0,this._resolve=void 0)};_onSeeked=()=>{this.autoUpdate&&!this.isPlaying&&(this._nextTime=0,this.requestUpload(),this._nextTime=0)};_setupAutoUpdate(){this.autoUpdate&&this.isPlaying?!this.fps&&this.source.requestVideoFrameCallback?(this._connected&&(Ce.off(this.requestUpload),this._connected=!1,this._nextTime=0),this._requestId===void 0&&(this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected||(Ce.on(this.requestUpload),this._connected=!0,this._nextTime=0)):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected&&(Ce.off(this.requestUpload),this._connected=!1,this._nextTime=0))}_videoFrameRequestCallback=()=>{this.requestUpload(),this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)};requestUpload=()=>{const e=Math.floor(Ce.elapsed*this.source.playbackRate);this._nextTime-=e,(!this._spf||this._nextTime<=0)&&(super.requestUpload(),this._nextTime=this._spf||0)};async load(){if(!this._sourceLoad){const e=this.source;(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this.isReady?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._sourceLoad=new Promise((t,r)=>{this.isValid()?(this._sourceLoad=void 0,t(this)):(this._resolve=t,this._reject=r,e.load())})}return this._sourceLoad}destroy(){this._setupAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load())}};za([_({internal:!0,fallback:!0})],Js.prototype,"autoUpdate"),za([_({internal:!0,fallback:0})],Js.prototype,"fps");let Va=Js;class Qs extends Zs{}class Ga extends ge{fillStyle;strokeStyle;strokeAlignment;lineCap;lineJoin;lineWidth;miterLimit;uvTransform;vertTransform;_draws=[];_parseDrawStyle(e){return e?e instanceof le?{texture:e}:{backgroundColor:new Qe(e).toInt8Array()}:{}}stroke(e){if(!this.curves.length)return;let t=this.strokeStyle;if(!t&&this.style.stroke)switch(typeof this.style.stroke){case"string":t=this.style.stroke;break;case"object":xs(this.style.stroke)&&(t=this.style.stroke.color);break}this._draws.push({...e,...this._parseDrawStyle(t),type:"stroke",path:new ge(this),uvTransform:this.uvTransform,vertTransform:this.vertTransform,lineStyle:{alignment:this.strokeAlignment??.5,cap:this.lineCap??"butt",join:this.lineJoin??"miter",width:this.lineWidth??1,miterLimit:this.miterLimit??10}}),this.resetStatus()}fillRect(e,t,r,i){this.rect(e,t,r,i).fill()}strokeRect(e,t,r,i){this.rect(e,t,r,i).stroke()}fill(e){if(!this.curves.length)return;let t=this.fillStyle;if(!t&&this.style.fill)switch(typeof this.style.fill){case"string":t=this.style.fill;break;case"object":xs(this.style.fill)&&(t=this.style.fill.color);break}this._draws.push({...e,...this._parseDrawStyle(t),type:"fill",path:new ge(this),uvTransform:this.uvTransform,vertTransform:this.vertTransform}),this.resetStatus()}copy(e){return super.copy(e),this.strokeStyle=e.strokeStyle,this.fillStyle=e.fillStyle,this.uvTransform=e.uvTransform,this.vertTransform=e.vertTransform,this.strokeAlignment=e.strokeAlignment,this.lineCap=e.lineCap,this.lineJoin=e.lineJoin,this.lineWidth=e.lineWidth,this.miterLimit=e.miterLimit,this._draws=e._draws.slice(),this}resetStatus(){super.reset(),this.strokeStyle=void 0,this.fillStyle=void 0,this.uvTransform=void 0,this.vertTransform=void 0,this.strokeAlignment=void 0,this.lineCap=void 0,this.lineJoin=void 0,this.lineWidth=void 0,this.miterLimit=void 0}reset(){return this.resetStatus(),this._draws.length=0,this}buildUvs(e,t,r,i,n){if(i){const o=i.width,a=i.height;for(let l=t.length,c=e;c<l;c+=2){const h=t[c],u=t[c+1];let d,g;n?[d,g]=n.apply({x:h,y:u}).toArray():[d,g]=[h/o,u/a],r.push(d,g)}}else for(let o=t.length,a=e;a<o;a+=2)r.push(0,0)}toBatchables(){const e=[];for(let t=this._draws.length,r=0;r<t;r++){const i=this._draws[r],n=[],o=[],a=[];i.type==="fill"?i.path.fillTriangulate({vertices:n,indices:o}):i.path.strokeTriangulate({vertices:n,indices:o,lineStyle:i.lineStyle,flipAlignment:!1,closed:!0}),i.texture&&this.buildUvs(0,n,a,i.texture,i.uvTransform);const l=i.path.getBoundingBox();e.push({vertices:new Float32Array(n),indices:new Float32Array(o),uvs:new Float32Array(a),texture:i.texture,backgroundColor:i.backgroundColor,type:i.type,disableWrapMode:i.disableWrapMode,uvTransform:i.uvTransform,vertTransform:i.vertTransform,dimension:new Float32Array([l.width,l.height])})}return e}}class uf{front=[];default=[];back=[];get internal(){return this.getInternal()}constructor(...e){this.set(e)}set(e){return this.front.length=0,this.default.length=0,this.back.length=0,e.forEach(t=>{switch(t.internalMode){case"front":this.front.push(t);break;case"default":this.default.push(t);break;case"back":this.back.push(t);break}}),this}getInternal(e){if(e)switch(e){case"front":return this.front;case"default":return this.default;case"back":return this.back;default:throw new Error(`Unknown internal mode: ${e}`)}else return[...this.front,...this.default,...this.back]}toJSON(){return[...this.default]}}class ja extends xt{constructor(e){return super(),this.parent=e,new Proxy(this,{get:(t,r,i)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.get(t,r,i):t.getProperty(String(r)),set:(t,r,i,n)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.set(t,r,i,n):(t.setProperty(String(r),i),!0),deleteProperty:(t,r)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.deleteProperty(t,r):(t.setProperty(String(r),void 0),!0)})}getPropertyDeclarations(){const e=new Map;return this._properties.forEach((t,r)=>{e.set(r,{internalKey:`____${r}`})}),e}getPropertyDeclaration(e){return{internalKey:`____${e}`}}}var ff=Object.defineProperty,df=Object.getOwnPropertyDescriptor,Et=(s,e,t,r)=>{for(var i=r>1?void 0:r?df(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ff(e,t,i),i};const Wa={};function pf(s){let e=Wa[s]??0;return e++,Wa[s]=e,e}f.Node=class extends xt{_meta=new ja(this);get meta(){return this._meta}set meta(e){this._meta.resetProperties().setProperties(e)}_readyed=!1;constructor(e,t=[]){super(),this._onTreeEnter=this._onTreeEnter.bind(this),this._onTreeExit=this._onTreeExit.bind(this),this._onParented=this._onParented.bind(this),this._onUnparented=this._onUnparented.bind(this),this._onReady=this._onReady.bind(this),this._onProcess=this._onProcess.bind(this),this.setProperties({name:`${this.is}:${pf(this.is)}`,...e}).append(t),this.on("treeEnter",this._onTreeEnter).on("treeExit",this._onTreeExit).on("parented",this._onParented).on("unparented",this._onUnparented).on("ready",this._onReady).on("process",this._onProcess)}setProperties(e){if(e){const{meta:t,...r}=e;t&&(this.meta=t),super.setProperties(r)}return this}getName(){return this.name}setName(e){return this.name=e,this}_tree;get tree(){return this.getTree()}set tree(e){this.setTree(e)}getTree(){return this._tree}getViewport(){return this.parent?.getViewport()??this.getWindow()}getWindow(){return this._tree?.root}isInsideTree(){return!!this._tree}setTree(e){const t=this._tree;if(!e?.equal(t)){t&&this.emit("treeExit",t),this._tree=e,e&&this.emit("treeEnter",e);const r=this._children.internal;for(let i=r.length,n=0;n<i;n++){const o=r[n];!e&&this.emit("childExitingTree",o),o.setTree(e),e&&this.emit("childEnteredTree",o)}e&&(this.emit("treePostEnter",e),this._readyed||(this._readyed=!0,this.emit("ready")))}return this}_parent;get parent(){return this._parent}set parent(e){this.setParent(e)}hasParent(){return!!this._parent}getParent(){return this._parent}setParent(e){if(!this._parent?.equal(e)){const t=this._parent;t&&this.emit("unparented",t),this._parent=e,e&&this.emit("parented",e),this.setTree(e?._tree)}return this}_children=new uf;get children(){return this._children.default}set children(e){this._children.set(e)}getChildren(e="default"){return this._children.getInternal(e===!0?void 0:e)}getChild(e=0){return this.children[e]}get siblingIndex(){return this.getIndex()}set siblingIndex(e){this._parent?.moveChild(this,e)}get previousSibling(){return this._parent?.children[this.getIndex()-1]}get nextSibling(){return this._parent?.children[this.getIndex()+1]}get firstSibling(){return this._parent?.children[0]}get lastSibling(){const e=this._parent?.children;return e?e[e.length-1]:void 0}canProcess(){if(!this._tree)return!1;switch(this.processMode){case"inherit":return this._parent?.canProcess()??!0;case"pausable":return!this._tree.processPaused;case"when_paused":return this._tree.processPaused;case"always":return!0;case"disabled":default:return!1}}canInput(){if(!this._tree)return!1;switch(this.inputMode){case"inherit":return this._parent?.canInput()??!0;case"always":return!0;case"disabled":default:return!1}}canRender(){if(!this._tree)return!1;switch(this.renderMode){case"inherit":return this._parent?.canRender()??!0;case"always":return!0;case"disabled":default:return!1}}_onTreeEnter(e){this._treeEnter(e),this.emit("treeEntered",e)}_onTreeExit(e){this.emit("treeExiting",e),this._treeExit(e),this.emit("treeExited",e)}_onParented(e){this._parented(e)}_onUnparented(e){this._unparented(e)}_onReady(){this._ready()}_onProcess(e=0){const t=this._tree,r=this.canRender(),i=this.canProcess(),n=[],o=[];this._children.internal.forEach(l=>{switch(l.processSortMode){case"default":o.push(l);break;case"parent_before":n.push(l);break}}),n.forEach(l=>{l.emit("process",e)}),i&&(t?.emit("nodeProcessing",this),this.emit("processing",e),this._process(e));let a;if(r){const l=t.renderStack.push(this);a=t.renderStack.currentCall,t.renderStack.currentCall=l}if(this.mask instanceof f.Node)this.getNode("__$mask")||(this.mask.processMode="disabled",this.appendChild(this.mask,"front"));else{const l=this.getNode("__$mask");l&&this.removeChild(l)}o.forEach(l=>{l.emit("process",e)}),r&&(t.renderStack.currentCall=a),i&&(this.emit("processed",e),t?.emit("nodeProcessed",this))}render(e,t){const r=this.mask;r&&(e.flush(),e.mask.push(this,r)),this._render(e),t?.(),r&&(e.flush(),e.mask.pop(this))}input(e,t){if(e.propagationStopped)return;const r=this._children.internal;for(let i=r.length-1;i>=0;i--)r[i].input(e,t);e.propagationStopped||this.canInput()&&this._input(e,t)}getIndex(){return this._parent?.getChildren(this.internalMode).indexOf(this)??0}getNode(e){return this._children.internal.find(t=>t.name===e)}removeNode(e){this.getNode(e)?.remove()}addSibling(e){return this.equal(e)||!this.hasParent()||e.hasParent()?this:(e.internalMode=this.internalMode,this._parent.moveChild(e,this.getIndex()+1),this)}prepend(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this.moveChild(r,0)})}append(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this.appendChild(r)})}before(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this._parent?.moveChild(r,this.getIndex())})}after(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this._parent?.moveChild(r,this.getIndex()+1)})}insertBefore(e,t){return!t.hasParent()||!this.equal(t.parent)||this.moveChild(e,t.getIndex()),e}appendChild(e,t=e.internalMode){if(this.equal(e)||e.hasParent())return e;switch(t){case"front":this._children.front.push(e);break;case"default":this._children.default.push(e);break;case"back":this._children.back.push(e);break}return e.internalMode!==t&&(e.internalMode=t),e.setParent(this),this.emit("appendChild",e),e}moveChild(e,t,r=e.internalMode){if(this.equal(e)||e.hasParent()&&!this.equal(e.parent))return this;const i=this._children.getInternal(e.internalMode),n=i.indexOf(e),o=this._children.getInternal(r);return(e.internalMode!==r||t!==n)&&(n>-1&&i.splice(n,1),e.setParent(this),t>-1&&t<o.length?o.splice(t,0,e):o.push(e),n>-1?this.emit("moveChild",e,t,n):this.emit("appendChild",e)),e.internalMode!==r&&(e.internalMode=r),this}removeChild(e){const t=e.getIndex();return this.equal(e.parent)&&t>-1&&(this.getChildren(e.internalMode).splice(t,1),e.setParent(void 0),this.emit("removeChild",e,t)),e}removeChildren(){this.children.forEach(e=>this.removeChild(e))}remove(){this._parent?.removeChild(this)}findOne(e){for(const t of this._children.default){const r=e(t)||t.findOne(e);if(r)return r}}findAll(e){const t=[];for(const r of this._children.default){const i=e(r);i&&t.push(i),t.push(...r.findAll(e))}return t}findAncestor(e){const t=this._parent;if(t){const r=e(t)??t.findAncestor(e);if(r)return r}}_ready(){}_treeEnter(e){}_treeExit(e){}_parented(e){}_unparented(e){}_process(e){}_input(e,t){}_render(e){}destroy(){super.destroy(),this._children.internal.forEach(e=>this.removeChild(e))}clone(){return new this.constructor(this.toJSON(),this._children.internal)}toJSON(){return Ve({...super.toJSON(),children:this.children.length?[...this.children.map(e=>e.toJSON())]:void 0,meta:{...this.meta.toJSON(),inCanvasIs:this.is}})}static parse(e){if(Array.isArray(e))return e.map(l=>this.parse(l));const{meta:t={},children:r,...i}=e,{inCanvasIs:n="Node"}=t,o=xi.get(n)??f.Node,a=new o({...i,meta:t});return r?.forEach(l=>a.appendChild(this.parse(l))),a}},Et([_({fallback:bo()})],f.Node.prototype,"id",2),Et([_({fallback:bo()})],f.Node.prototype,"name",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"processMode",2),Et([_({internal:!0,fallback:"default"})],f.Node.prototype,"processSortMode",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"renderMode",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"inputMode",2),Et([_({internal:!0,fallback:"default"})],f.Node.prototype,"internalMode",2),Et([_({internal:!0})],f.Node.prototype,"mask",2),f.Node=Et([X("Node")],f.Node);var gf=Object.defineProperty,mf=Object.getOwnPropertyDescriptor,gr=(s,e,t,r)=>{for(var i=r>1?void 0:r?mf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&gf(e,t,i),i};f.TimelineNode=class extends f.Node{constructor(e,t=[]){super(),this.setProperties(e).append(t)}computedDuration=0;_currentTime=0;_startTime=0;get timeline(){return this._tree?.timeline}get timelineCurrentTime(){return this.timeline?.currentTime??0}get parentStartTime(){return this._parent?.startTime??0}get currentTime(){return ut(this._currentTime,0,this.computedDuration)}get startTime(){return this._startTime}set startTime(e){this.delay=e-this.parentStartTime,this._updateCurrentTime(!0)}get endTime(){return this._startTime+this.computedDuration}get currentTimeProgress(){return this.computedDuration?ut(this._currentTime/this.computedDuration,0,1):0}isInsideTimeRange(){const e=this._currentTime;return this.computedDuration?e>=0&&e<=this.computedDuration:e>=0}_updateCurrentTime(e=!1){if(e||!this.paused){const t=this._parent,r=this.delay+this.parentStartTime,i=t?.computedDuration?Math.min(r+this.duration,t.endTime)-r:this.duration;let n=this.timelineCurrentTime-r;this.loop&&(n=n%i),this._startTime=r,this._currentTime=n,this.computedDuration=i,this.emit("updateCurrentTime",this._currentTime),this.insideTimeRange=this.isInsideTimeRange()}}_process(e){super._process(e),this._updateCurrentTime()}},gr([_({fallback:!1})],f.TimelineNode.prototype,"loop",2),gr([_({fallback:0})],f.TimelineNode.prototype,"delay",2),gr([_({fallback:0})],f.TimelineNode.prototype,"duration",2),gr([_({fallback:!1})],f.TimelineNode.prototype,"paused",2),gr([_({internal:!0,fallback:!1})],f.TimelineNode.prototype,"insideTimeRange",2),f.TimelineNode=gr([X("TimelineNode")],f.TimelineNode);var yf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,Vr=(s,e,t,r)=>{for(var i=r>1?void 0:r?vf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&yf(e,t,i),i};f.CanvasItem=class extends f.TimelineNode{_parentGlobalVisible;_globalVisible;get globalVisible(){return this._globalVisible??!0}_parentGlobalOpacity;_globalOpacity;get globalOpacity(){return this._globalOpacity??1}_modulate=new Qe(4294967295);context=new Ga;_resetContext=!0;_redrawing=!0;_relayouting=!1;_repainting=!1;_originalBatchables=[];_layoutedBatchables=[];_batchables=[];constructor(e,t=[]){super(),this.setProperties(e).append(t)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"modulate":this._modulate.value=t,this.requestRepaint();break;case"blendMode":this.requestRepaint();break;case"opacity":this._updateGlobalOpacity();break;case"visible":case"insideTimeRange":this._updateGlobalVisible();break}}show(){this.visible=!0}hide(){this.visible=!1}isVisibleInTree(){return this.globalOpacity>0&&this.globalVisible}canRender(){return super.canRender()&&this.isVisibleInTree()}requestRedraw(){this._redrawing=!0}requestRelayout(){this._relayouting=!0}requestRepaint(){this._repainting=!0}_updateGlobalVisible(){this._parentGlobalVisible=this.getParent()?.globalVisible,this._globalVisible=(this._parentGlobalVisible??!0)&&this.visible&&this.insideTimeRange}_updateGlobalOpacity(){this._parentGlobalOpacity=this.getParent()?.opacity;const e=ut(this.opacity,0,1)*(this._parentGlobalOpacity??1);this._globalOpacity!==e&&(this._globalOpacity=e,this.requestRepaint())}_draw(){this.emit("draw")}_redraw(){return this._tree?.log(this.name,"drawing"),this._draw(),this.context.toBatchables()}_relayout(e){return this._tree?.log(this.name,"layouting"),e}_repaint(e){this._tree?.log(this.name,"painting");const t=this.globalOpacity;return e.map(r=>({...r,modulate:this._modulate.toInt8Array().map(i=>i*t),blendMode:this.blendMode}))}_process(e){super._process(e);const t=this.getParent();this._parentGlobalVisible!==t?.globalVisible&&this._updateGlobalVisible(),this._parentGlobalOpacity!==t?.globalOpacity&&this._updateGlobalOpacity()}_updateBatchables(){const e=this._redrawing;let t=this._relayouting,r=this._repainting,i;e&&(this._originalBatchables=this._redraw(),t=!0),t&&(this._layoutedBatchables=this._relayout(this._originalBatchables),r=!0),r&&(i=this._repaint(this._layoutedBatchables)),e&&this._resetContext&&this.context.reset(),i&&(this._batchables=i,this._redrawing=!1,this._relayouting=!1,this._repainting=!1)}_render(e){this._updateBatchables(),this._batchables.forEach(t=>{t.texture?.upload(e),e.batch2D.render({...t,texture:t.texture?._glTexture(e)})}),super._render(e)}},Vr([_()],f.CanvasItem.prototype,"modulate",2),Vr([_()],f.CanvasItem.prototype,"blendMode",2),Vr([_({internal:!0,fallback:!0})],f.CanvasItem.prototype,"visible",2),Vr([_({internal:!0,fallback:1})],f.CanvasItem.prototype,"opacity",2),f.CanvasItem=Vr([X("CanvasItem")],f.CanvasItem);var _f=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,mr=(s,e,t,r)=>{for(var i=r>1?void 0:r?bf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_f(e,t,i),i};f.Viewport=class extends f.Node{constructor(e=!1){super(),this.flipY=e,this.projection.flipY(e)}projection=new Yo;canvasTransform=new ke;_framebufferIndex=0;_framebuffers=[{texture:new Qs,needsUpload:!1},{texture:new Qs,needsUpload:!1}];get valid(){return!!(this.width&&this.height)}get framebuffer(){return this._framebuffers[this._framebufferIndex]}get texture(){return this.framebuffer.texture}getViewport(){return this}_glFramebufferOptions(e){const{width:t,height:r}=this,{pixelRatio:i}=e;return this._framebuffers.forEach(n=>{const o=n.texture;o.width=t,o.height=r,o.pixelRatio=i,o.upload(e)}),{width:t,height:r,msaa:this.msaa,colorTextures:[this.texture._glTexture(e)]}}_glFramebuffer(e){return e.getRelated(this.framebuffer,()=>e.framebuffer.create(this._glFramebufferOptions(e)))}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"x":case"y":this.requestUpload(),this.projection.translate(this.x,this.y),this.emit("updateRect");break;case"width":case"height":this.requestUpload(),this.projection.resize(this.width,this.height),this.emit("updateRect");break;case"msaa":this.requestUpload();break}}requestUpload(){this._framebuffers.forEach(e=>e.needsUpload=!0)}resize(e,t){this.width=e,this.height=t}upload(e){const t=this.framebuffer;return t.needsUpload&&this.valid?(t.needsUpload=!1,e.framebuffer.update(this._glFramebuffer(e),this._glFramebufferOptions(e)),!0):!1}activate(e){return this.valid?(e.flush(),this._tree?.setCurrentViewport(this),this.upload(e),e.framebuffer.bind(this._glFramebuffer(e)),!0):!1}redraw(e,t){if(this.valid){e.flush();const r=this.framebuffer.texture;return this._framebufferIndex=(this._framebufferIndex+1)%this._framebuffers.length,this.activate(e),e.clear(),r.activate(e,0),t(),!0}return!1}activateWithCopy(e,t){this.resize(t.width,t.height),this.activate(e)&&(e.clear(),t.texture.activate(e,0),Q.draw(e,$r.instance,{sampler:0}))}render(e,t){const r=this._tree?.getCurrentViewport();e.program.uniforms.projectionMatrix=this.projection.toArray(!0),e.program.uniforms.viewMatrix=this.canvasTransform.toArray(!0),this.activate(e),e.clear(),super.render(e,t),e.flush(),r?r.activate(e):(e.framebuffer.bind(null),this._tree?.setCurrentViewport(void 0))}getRect(){return new It(this.x,this.y,this.width,this.height)}toCanvasGlobal(e,t){return this.canvasTransform.applyAffineInverse(e,t)}toCanvasScreen(e,t){return this.canvasTransform.apply(e,t)}},mr([_({fallback:0})],f.Viewport.prototype,"x",2),mr([_({fallback:0})],f.Viewport.prototype,"y",2),mr([_({fallback:0})],f.Viewport.prototype,"width",2),mr([_({fallback:0})],f.Viewport.prototype,"height",2),mr([_({internal:!0,fallback:!1})],f.Viewport.prototype,"msaa",2),f.Viewport=mr([X("Viewport")],f.Viewport);var wf=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,Gr=(s,e,t,r)=>{for(var i=r>1?void 0:r?xf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&wf(e,t,i),i};f.Effect=class extends f.TimelineNode{material;get _effectMode(){return this.effectMode??"parent"}viewport1=new f.Viewport;viewport2=new f.Viewport;_renderId=0;_renderViewport;_previousSibling;_nextSibling;constructor(e,t=[]){super(),this._onProcessing=this._onProcessing.bind(this),this._onNodeProcessed=this._onNodeProcessed.bind(this),this.setProperties(e).append(t)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"glsl":{const i=new Nr(t);!this.effectMode&&i.has.transition&&(this.effectMode="transition"),this.material=i;break}case"glslSrc":{t?Ke.text.load(t).then(i=>this.glsl=i):this.glsl="";break}}}_treeEnter(e){e.on("processing",this._onProcessing),e.on("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(e),this.viewport2.setTree(e)}_treeExit(e){e.off("processing",this._onProcessing),e.off("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(void 0),this.viewport2.setTree(void 0)}_onProcessing(){if(this.canProcess())switch(this._updateCurrentTime(),this._effectMode){case"transition":this._previousSibling=this.previousSibling,this._nextSibling=this.nextSibling;break;default:this._previousSibling=void 0,this._nextSibling=void 0;break}}_onNodeProcessed(e){if(!this.canProcess()||!this.isInsideTimeRange())return;const t=this._tree?.renderStack;if(t)switch(this._effectMode){case"transition":e.equal(this._previousSibling)?(this._previousSibling=void 0,t.push(this)):e.equal(this._nextSibling)&&(this._nextSibling=void 0,t.push(this));break}}_processParent(){const e=this._tree?.renderStack;if(!e)return;const t=e.currentCall?.parentCall;if(!t)return;const r=t.calls;let i,n;r.forEach((o,a)=>{(o.renderable.equal(this._parent)||o.renderable.parent?.equal(this._parent))&&(i=i??a,n=a)}),!(i===void 0||n===void 0)&&(r.splice(n+1,0,e.createCall(this)),r.splice(i,0,e.createCall(this)))}_processChildren(){this.children.length&&(super.emit("process"),this._tree?.renderStack.push(this))}_onProcess(e=0){if(this.canProcess())switch(this._renderId=0,this._effectMode){case"before":super._onProcess(e);break;case"parent":this._processParent();break;case"children":this._processChildren();break}}_renderBefore(e){const t=this._tree?.getCurrentViewport();t&&this.apply(e,t,{redraw:!0})}_renderTransition(e){if(this._renderId%2===0)this._renderViewport=this._tree?.getCurrentViewport(),this._renderViewport&&(this.viewport1.activateWithCopy(e,this._renderViewport),this.viewport2.resize(this._renderViewport.width,this._renderViewport.height)),this.viewport2.activate(e),e.clear();else{const t=this._renderViewport;this._renderViewport=void 0,t&&(t.activate(e),e.clear(),this.viewport1.texture.activate(e,0),this.viewport2.texture.activate(e,1),this.apply(e,t,{from:this.viewport1,to:this.viewport2}),e.texture.unbind(0),e.texture.unbind(1))}}_renderParentOrChildren(e){if(this._renderId%2===0)this._renderViewport=this._tree?.getCurrentViewport(),this._renderViewport&&this.viewport1.resize(this._renderViewport.width,this._renderViewport.height),this.viewport1.activate(e),e.clear();else{const t=this._renderViewport;this._renderViewport=void 0,t&&(this.viewport1.activate(e),this.apply(e,this.viewport1,{redraw:!0,target:this._effectMode==="parent"?this._parent??void 0:void 0,targetArea:this._parseTargetArea()}),t.activate(e),this.viewport1.texture.activate(e,0),Q.draw(e))}}_parseTargetArea(){if(this._effectMode==="parent"&&this._parent&&"getRect"in this._parent){const e=this._parent.getRect();if(e)return[e.left/this.viewport1.width,e.top/this.viewport1.height,e.width/this.viewport1.width,e.height/this.viewport1.height]}}_render(e){switch(this._effectMode){case"before":this._renderBefore(e);break;case"transition":this._renderTransition(e);break;case"parent":case"children":default:this._renderParentOrChildren(e);break}this._renderId++}apply(e,t,r){this.material&&(r?.redraw?t.redraw(e,()=>{Q.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:t.width/t.height})}):Q.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:r?.from?r.from.width/r.from.height:0}))}},Gr([_({internal:!0})],f.Effect.prototype,"material",2),Gr([_()],f.Effect.prototype,"effectMode",2),Gr([_()],f.Effect.prototype,"glsl",2),Gr([_()],f.Effect.prototype,"glslSrc",2),f.Effect=Gr([X("Effect")],f.Effect);var Te=Uint8Array,je=Uint16Array,en=Int32Array,Bi=new Te([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Li=new Te([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),tn=new Te([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qa=function(s,e){for(var t=new je(31),r=0;r<31;++r)t[r]=e+=1<<s[r-1];for(var i=new en(t[30]),r=1;r<30;++r)for(var n=t[r];n<t[r+1];++n)i[n]=n-t[r]<<5|r;return{b:t,r:i}},Xa=qa(Bi,2),Ha=Xa.b,rn=Xa.r;Ha[28]=258,rn[258]=28;for(var Ya=qa(Li,0),Pf=Ya.b,Ka=Ya.r,sn=new je(32768),te=0;te<32768;++te){var Ut=(te&43690)>>1|(te&21845)<<1;Ut=(Ut&52428)>>2|(Ut&13107)<<2,Ut=(Ut&61680)>>4|(Ut&3855)<<4,sn[te]=((Ut&65280)>>8|(Ut&255)<<8)>>1}for(var pt=(function(s,e,t){for(var r=s.length,i=0,n=new je(e);i<r;++i)s[i]&&++n[s[i]-1];var o=new je(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var a;if(t){a=new je(1<<e);var l=15-e;for(i=0;i<r;++i)if(s[i])for(var c=i<<4|s[i],h=e-s[i],u=o[s[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[sn[u]>>l]=c}else for(a=new je(r),i=0;i<r;++i)s[i]&&(a[i]=sn[o[s[i]-1]++]>>15-s[i]);return a}),Bt=new Te(288),te=0;te<144;++te)Bt[te]=8;for(var te=144;te<256;++te)Bt[te]=9;for(var te=256;te<280;++te)Bt[te]=7;for(var te=280;te<288;++te)Bt[te]=8;for(var jr=new Te(32),te=0;te<32;++te)jr[te]=5;var Cf=pt(Bt,9,0),Tf=pt(Bt,9,1),Sf=pt(jr,5,0),Ef=pt(jr,5,1),nn=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},tt=function(s,e,t){var r=e/8|0;return(s[r]|s[r+1]<<8)>>(e&7)&t},on=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},an=function(s){return(s+7)/8|0},Za=function(s,e,t){return(t==null||t>s.length)&&(t=s.length),new Te(s.subarray(e,t))},Mf=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],rt=function(s,e,t){var r=new Error(e||Mf[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,rt),!t)throw r;return r},Af=function(s,e,t,r){var i=s.length,n=0;if(!i||e.f&&!e.l)return t||new Te(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new Te(i*3));var c=function(Be){var $e=t.length;if(Be>$e){var Pe=new Te(Math.max($e*2,Be));Pe.set(t),t=Pe}},h=e.f||0,u=e.p||0,d=e.b||0,g=e.l,p=e.d,y=e.m,m=e.n,P=i*8;do{if(!g){h=tt(s,u,1);var E=tt(s,u+1,3);if(u+=3,E)if(E==1)g=Tf,p=Ef,y=9,m=5;else if(E==2){var x=tt(s,u,31)+257,T=tt(s,u+10,15)+4,C=x+tt(s,u+5,31)+1;u+=14;for(var L=new Te(C),G=new Te(19),U=0;U<T;++U)G[tn[U]]=tt(s,u+U*3,7);u+=T*3;for(var R=nn(G),z=(1<<R)-1,B=pt(G,R,1),U=0;U<C;){var D=B[tt(s,u,z)];u+=D&15;var b=D>>4;if(b<16)L[U++]=b;else{var H=0,I=0;for(b==16?(I=3+tt(s,u,3),u+=2,H=L[U-1]):b==17?(I=3+tt(s,u,7),u+=3):b==18&&(I=11+tt(s,u,127),u+=7);I--;)L[U++]=H}}var F=L.subarray(0,x),j=L.subarray(x);y=nn(F),m=nn(j),g=pt(F,y,1),p=pt(j,m,1)}else rt(1);else{var b=an(u)+4,S=s[b-4]|s[b-3]<<8,w=b+S;if(w>i){l&&rt(0);break}a&&c(d+S),t.set(s.subarray(b,w),d),e.b=d+=S,e.p=u=w*8,e.f=h;continue}if(u>P){l&&rt(0);break}}a&&c(d+131072);for(var O=(1<<y)-1,$=(1<<m)-1,A=u;;A=u){var H=g[on(s,u)&O],M=H>>4;if(u+=H&15,u>P){l&&rt(0);break}if(H||rt(2),M<256)t[d++]=M;else if(M==256){A=u,g=null;break}else{var N=M-254;if(M>264){var U=M-257,V=Bi[U];N=tt(s,u,(1<<V)-1)+Ha[U],u+=V}var Y=p[on(s,u)&$],J=Y>>4;Y||rt(3),u+=Y&15;var j=Pf[J];if(J>3){var V=Li[J];j+=on(s,u)&(1<<V)-1,u+=V}if(u>P){l&&rt(0);break}a&&c(d+131072);var oe=d+N;if(d<j){var _t=n-j,Ze=Math.min(j,oe);for(_t+d<0&&rt(3);d<Ze;++d)t[d]=r[_t+d]}for(;d<oe;++d)t[d]=t[d-j]}}e.l=g,e.p=A,e.b=d,e.f=h,g&&(h=1,e.m=y,e.d=p,e.n=m)}while(!h);return d!=t.length&&o?Za(t,0,d):t.subarray(0,d)},Mt=function(s,e,t){t<<=e&7;var r=e/8|0;s[r]|=t,s[r+1]|=t>>8},Wr=function(s,e,t){t<<=e&7;var r=e/8|0;s[r]|=t,s[r+1]|=t>>8,s[r+2]|=t>>16},ln=function(s,e){for(var t=[],r=0;r<s.length;++r)s[r]&&t.push({s:r,f:s[r]});var i=t.length,n=t.slice();if(!i)return{t:tl,l:0};if(i==1){var o=new Te(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(w,x){return w.f-x.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,h=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=t[t[c].f<t[u].f?c++:u++],l=t[c!=h&&t[c].f<t[u].f?c++:u++],t[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var g=new je(d+1),p=cn(t[h-1],g,0);if(p>e){var r=0,y=0,m=p-e,P=1<<m;for(n.sort(function(x,T){return g[T.s]-g[x.s]||x.f-T.f});r<i;++r){var E=n[r].s;if(g[E]>e)y+=P-(1<<p-g[E]),g[E]=e;else break}for(y>>=m;y>0;){var b=n[r].s;g[b]<e?y-=1<<e-g[b]++-1:++r}for(;r>=0&&y;--r){var S=n[r].s;g[S]==e&&(--g[S],++y)}p=e}return{t:new Te(g),l:p}},cn=function(s,e,t){return s.s==-1?Math.max(cn(s.l,e,t+1),cn(s.r,e,t+1)):e[s.s]=t},Ja=function(s){for(var e=s.length;e&&!s[--e];);for(var t=new je(++e),r=0,i=s[0],n=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(s[a]==i&&a!=e)++n;else{if(!i&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(i),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(i);n=1,i=s[a]}return{c:t.subarray(0,r),n:e}},qr=function(s,e){for(var t=0,r=0;r<e.length;++r)t+=s[r]*e[r];return t},Qa=function(s,e,t){var r=t.length,i=an(e+2);s[i]=r&255,s[i+1]=r>>8,s[i+2]=s[i]^255,s[i+3]=s[i+1]^255;for(var n=0;n<r;++n)s[i+n+4]=t[n];return(i+4+r)*8},el=function(s,e,t,r,i,n,o,a,l,c,h){Mt(e,h++,t),++i[256];for(var u=ln(i,15),d=u.t,g=u.l,p=ln(n,15),y=p.t,m=p.l,P=Ja(d),E=P.c,b=P.n,S=Ja(y),w=S.c,x=S.n,T=new je(19),C=0;C<E.length;++C)++T[E[C]&31];for(var C=0;C<w.length;++C)++T[w[C]&31];for(var L=ln(T,7),G=L.t,U=L.l,R=19;R>4&&!G[tn[R-1]];--R);var z=c+5<<3,B=qr(i,Bt)+qr(n,jr)+o,D=qr(i,d)+qr(n,y)+o+14+3*R+qr(T,G)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&z<=B&&z<=D)return Qa(e,h,s.subarray(l,l+c));var H,I,F,j;if(Mt(e,h,1+(D<B)),h+=2,D<B){H=pt(d,g,0),I=d,F=pt(y,m,0),j=y;var O=pt(G,U,0);Mt(e,h,b-257),Mt(e,h+5,x-1),Mt(e,h+10,R-4),h+=14;for(var C=0;C<R;++C)Mt(e,h+3*C,G[tn[C]]);h+=3*R;for(var $=[E,w],A=0;A<2;++A)for(var M=$[A],C=0;C<M.length;++C){var N=M[C]&31;Mt(e,h,O[N]),h+=G[N],N>15&&(Mt(e,h,M[C]>>5&127),h+=M[C]>>12)}}else H=Cf,I=Bt,F=Sf,j=jr;for(var C=0;C<a;++C){var V=r[C];if(V>255){var N=V>>18&31;Wr(e,h,H[N+257]),h+=I[N+257],N>7&&(Mt(e,h,V>>23&31),h+=Bi[N]);var Y=V&31;Wr(e,h,F[Y]),h+=j[Y],Y>3&&(Wr(e,h,V>>5&8191),h+=Li[Y])}else Wr(e,h,H[V]),h+=I[V]}return Wr(e,h,H[256]),h+I[256]},Of=new en([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tl=new Te(0),kf=function(s,e,t,r,i,n){var o=n.z||s.length,a=new Te(r+o+5*(1+Math.ceil(o/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(e){h&&(l[0]=n.r>>3);for(var u=Of[e-1],d=u>>13,g=u&8191,p=(1<<t)-1,y=n.p||new je(32768),m=n.h||new je(p+1),P=Math.ceil(t/3),E=2*P,b=function(ze){return(s[ze]^s[ze+1]<<P^s[ze+2]<<E)&p},S=new en(25e3),w=new je(288),x=new je(32),T=0,C=0,L=n.i||0,G=0,U=n.w||0,R=0;L+2<o;++L){var z=b(L),B=L&32767,D=m[z];if(y[B]=D,m[z]=B,U<=L){var H=o-L;if((T>7e3||G>24576)&&(H>423||!c)){h=el(s,l,0,S,w,x,C,G,R,L-R,h),G=T=C=0,R=L;for(var I=0;I<286;++I)w[I]=0;for(var I=0;I<30;++I)x[I]=0}var F=2,j=0,O=g,$=B-D&32767;if(H>2&&z==b(L-$))for(var A=Math.min(d,H)-1,M=Math.min(32767,L),N=Math.min(258,H);$<=M&&--O&&B!=D;){if(s[L+F]==s[L+F-$]){for(var V=0;V<N&&s[L+V]==s[L+V-$];++V);if(V>F){if(F=V,j=$,V>A)break;for(var Y=Math.min($,V-2),J=0,I=0;I<Y;++I){var oe=L-$+I&32767,_t=y[oe],Ze=oe-_t&32767;Ze>J&&(J=Ze,D=oe)}}}B=D,D=y[B],$+=B-D&32767}if(j){S[G++]=268435456|rn[F]<<18|Ka[j];var Be=rn[F]&31,$e=Ka[j]&31;C+=Bi[Be]+Li[$e],++w[257+Be],++x[$e],U=L+F,++T}else S[G++]=s[L],++w[s[L]]}}for(L=Math.max(L,U);L<o;++L)S[G++]=s[L],++w[s[L]];h=el(s,l,c,S,w,x,C,G,R,L-R,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=m,n.p=y,n.i=L,n.w=U)}else{for(var L=n.w||0;L<o+c;L+=65535){var Pe=L+65535;Pe>=o&&(l[h/8|0]=c,Pe=o),h=Qa(l,h+1,s.subarray(L,Pe))}n.i=o}return Za(a,0,r+an(h)+i)},rl=function(){var s=1,e=0;return{p:function(t){for(var r=s,i=e,n=t.length|0,o=0;o!=n;){for(var a=Math.min(o+2655,n);o<a;++o)i+=r+=t[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}s=r,e=i},d:function(){return s%=65521,e%=65521,(s&255)<<24|(s&65280)<<8|(e&255)<<8|e>>8}}},Df=function(s,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new Te(n.length+s.length);o.set(n),o.set(s,n.length),s=o,i.w=n.length}return kf(s,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+e.mem,t,r,i)},il=function(s,e,t){for(;t;++e)s[e]=t,t>>>=8},If=function(s,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(s[0]=120,s[1]=r<<6|(e.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,e.dictionary){var i=rl();i.p(e.dictionary),il(s,2,i.d())}},Rf=function(s,e){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&rt(6,"invalid zlib data"),(s[1]>>5&1)==1&&rt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Uf(s,e){e||(e={});var t=rl();t.p(s);var r=Df(s,e,e.dictionary?6:2,4);return If(r,e),il(r,r.length-4,t.d()),r}function Bf(s,e){return Af(s.subarray(Rf(s),-4),{i:2},e,e)}var Lf=typeof TextDecoder<"u"&&new TextDecoder,Ff=0;try{Lf.decode(tl,{stream:!0}),Ff=1}catch{}const Nf="modern-font";function Xr(s,e){if(!s)throw new Error(`[${Nf}] ${e}`)}function $f(s){if("buffer"in s){const e=s.buffer;return s.byteOffset>0||s.byteLength<s.buffer.byteLength?e.slice(s.byteOffset,s.byteOffset+s.byteLength):e}else return s}function yr(s){return"buffer"in s?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}function zf(s){let e="";for(let t=0,r=s.length,i;t<r;t++)i=s.charCodeAt(t),i!==0&&(e+=String.fromCharCode(i));return e}function Fi(s){s=zf(s);const e=[];for(let t=0,r=s.length,i;t<r;t++)i=s.charCodeAt(t),e.push(i>>8),e.push(i&255);return e}function Vf(s){let e="";for(let t=0,r=s.length;t<r;t++)s[t]<127?e+=String.fromCharCode(s[t]):e+=`%${(256+s[t]).toString(16).slice(1)}`;return unescape(e)}function Gf(s){let e="";for(let t=0,r=s.length;t<r;t+=2)e+=String.fromCharCode((s[t]<<8)+s[t+1]);return e}var jf=Object.defineProperty,Se=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&jf(e,t,i),i};const Hr={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function Ee(){return function(s,e){Object.defineProperty(s.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class me extends DataView{constructor(e,t,r,i){super($f(e),t,r),this.littleEndian=i}cursor=0;readColumn(e){if(e.size){const t=Array.from({length:e.size},(r,i)=>this.read(e.type,e.offset+i));switch(e.type){case"char":return t.join("");default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(r,i)=>{this.write(e.type,t[i],e.offset+i)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,r=this.littleEndian){switch(e){case"char":return this.readChar(t);case"fixed":return this.readFixed(t,r);case"longDateTime":return this.readLongDateTime(t,r)}const i=`get${e.replace(/^\S/,l=>l.toUpperCase())}`,n=this,a=n[i]?.bind(n)?.(t,r);return this.cursor+=Hr[e],a}readUint24(e=this.cursor){const[t,r,i]=this.readBytes(e,3);return(t<<16)+(r<<8)+i}readBytes(e,t){t==null&&(t=e,e=this.cursor);const r=[];for(let i=0;i<t;++i)r.push(this.getUint8(e+i));return this.cursor=e+t,r}readString(e,t){const r=this.readBytes(e,t);let i="";for(let n=0,o=r.length;n<o;n++)i+=String.fromCharCode(r[n]);return i}readFixed(e,t){const r=this.readInt32(e,t)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(e=this.cursor,t){const r=this.readUint32(e+4,t),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(e){return this.readString(e,1)}write(e,t,r=this.cursor,i=this.littleEndian){switch(e){case"char":return this.writeChar(t,r);case"fixed":return this.writeFixed(t,r);case"longDateTime":return this.writeLongDateTime(t,r)}const n=`set${e.replace(/^\S/,c=>c.toUpperCase())}`,o=this,l=o[n]?.bind(o)?.(r,t,i);return this.cursor+=Hr[e.toLowerCase()],l}writeString(e="",t=this.cursor){const r=e.replace(/[^\x00-\xFF]/g,"11").length;this.seek(t);for(let i=0,n=e.length,o;i<n;++i)o=e.charCodeAt(i)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){typeof e>"u"?e=-20775456e5:typeof e.getTime=="function"?e=e.getTime():/^\d+$/.test(e)?e=+e:e=Date.parse(e);const i=Math.round((e- -20775456e5)/1e3);return this.writeUint32(0,t),this.writeUint32(i,t+4),this}writeBytes(e,t=this.cursor){let r;if(Array.isArray(e)){r=e.length;for(let i=0;i<r;++i)this.setUint8(t+i,e[i])}else{const i=yr(e);r=i.byteLength;for(let n=0;n<r;++n)this.setUint8(t+n,i.getUint8(n))}return this.cursor=t+r,this}seek(e){return this.cursor=e,this}}Se([Ee()],me.prototype,"readInt8"),Se([Ee()],me.prototype,"readInt16"),Se([Ee()],me.prototype,"readInt32"),Se([Ee()],me.prototype,"readUint8"),Se([Ee()],me.prototype,"readUint16"),Se([Ee()],me.prototype,"readUint32"),Se([Ee()],me.prototype,"readFloat32"),Se([Ee()],me.prototype,"readFloat64"),Se([Ee()],me.prototype,"writeInt8"),Se([Ee()],me.prototype,"writeInt16"),Se([Ee()],me.prototype,"writeInt32"),Se([Ee()],me.prototype,"writeUint8"),Se([Ee()],me.prototype,"writeUint16"),Se([Ee()],me.prototype,"writeUint32"),Se([Ee()],me.prototype,"writeFloat32"),Se([Ee()],me.prototype,"writeFloat64");const sl=new WeakMap;function v(s){const e=typeof s=="object"?s:{type:s},{size:t=1,type:r}=e;return(i,n)=>{if(typeof n!="string")return;let o=sl.get(i);o||(o={columns:[],byteLength:0},sl.set(i,o));const a={...e,name:n,byteLength:t*Hr[r],offset:e.offset??o.columns.reduce((l,c)=>l+c.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((l,c)=>l+Hr[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,n,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class We{view;constructor(e,t,r,i){this.view=new me(e,t,r,i)}}class Ni extends We{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Wf=Object.defineProperty,De=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Wf(e,t,i),i};const Ie=class mc extends Ni{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(e){const t=e.sfnt,i=t.name.names,n=Fi(i.fontFamily||""),o=n.length,a=Fi(i.fontStyle||""),l=a.length,c=Fi(i.version||""),h=c.length,u=Fi(i.fullName||""),d=u.length,g=86+o+4+l+4+h+4+d+2+e.view.byteLength,p=new mc(new ArrayBuffer(g),0,g,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=e.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=t.head.checkSumAdjustment;const y=t.os2;return y&&(p.FontPANOSE=y.fontPANOSE,p.Italic=y.fsSelection,p.Weight=y.usWeightClass,p.fsType=y.fsType,p.UnicodeRange=y.ulUnicodeRange,p.CodePageRange=y.ulCodePageRange),p.view.writeUint16(o),p.view.writeBytes(n),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(a),p.view.writeUint16(0),p.view.writeUint16(h),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(e.view),p}};De([v("uint32")],Ie.prototype,"EOTSize"),De([v("uint32")],Ie.prototype,"FontDataSize"),De([v("uint32")],Ie.prototype,"Version"),De([v("uint32")],Ie.prototype,"Flags"),De([v({type:"uint8",size:10})],Ie.prototype,"FontPANOSE"),De([v("uint8")],Ie.prototype,"Charset"),De([v("uint8")],Ie.prototype,"Italic"),De([v("uint32")],Ie.prototype,"Weight"),De([v("uint16")],Ie.prototype,"fsType"),De([v("uint16")],Ie.prototype,"MagicNumber"),De([v({type:"uint8",size:16})],Ie.prototype,"UnicodeRange"),De([v({type:"uint8",size:8})],Ie.prototype,"CodePageRange"),De([v("uint32")],Ie.prototype,"CheckSumAdjustment"),De([v({type:"uint8",size:16})],Ie.prototype,"Reserved"),De([v("uint16")],Ie.prototype,"Padding1");var qf=Object.defineProperty,$i=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&qf(e,t,i),i};class vr extends We{constructor(e,t){super(e,t,16)}}$i([v({type:"char",size:4})],vr.prototype,"tag"),$i([v("uint32")],vr.prototype,"checkSum"),$i([v("uint32")],vr.prototype,"offset"),$i([v("uint32")],vr.prototype,"length");const hn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Xf=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class un{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,r=72,i={},n){const o=1/(n?.unitsPerEm??1e3)*r,{xScale:a=o,yScale:l=o}=i,c=this.pathCommands,h=[];for(let u=0,d=c.length;u<d;u+=1){const g=c[u];g.type==="M"?h.push({type:"M",x:e+g.x*a,y:t+-g.y*l}):g.type==="L"?h.push({type:"L",x:e+g.x*a,y:t+-g.y*l}):g.type==="Q"?h.push({type:"Q",x1:e+g.x1*a,y1:t+-g.y1*l,x:e+g.x*a,y:t+-g.y*l}):g.type==="C"?h.push({type:"C",x1:e+g.x1*a,y1:t+-g.y1*l,x2:e+g.x2*a,y2:t+-g.y2*l,x:e+g.x*a,y:t+-g.y*l}):g.type==="Z"&&h.push({type:"Z"})}return h}}class Hf extends un{parse(e,t,r){const i=this,{nominalWidthX:n,defaultWidthX:o,gsubrsBias:a,subrsBias:l}=e,c=e.topDict.paintType,h=this.index;let u,d,g,p;const y=[],m=[];let P=0,E=!1,b=!1,S=o,w=0,x=0;function T(B,D){y.push({type:"L",x:B,y:D})}function C(B,D,H,I,F,j){y.push({type:"C",x1:B,y1:D,x2:H,y2:I,x:F,y:j})}function L(B,D){b&&c!==2&&G(),b=!0,y.push({type:"M",x:B,y:D})}function G(){y.push({type:"Z"})}function U(B){y.push(...B)}function R(){m.length%2!==0&&!E&&(S=m.shift()+n),P+=m.length>>1,m.length=0,E=!0}function z(B){let D,H,I,F,j,O,$,A,M,N,V,Y,J=0;for(;J<B.length;){let oe=B[J++];switch(oe){case 1:R();break;case 3:R();break;case 4:m.length>1&&!E&&(S=m.shift()+n,E=!0),x+=m.pop(),L(w,x);break;case 5:for(;m.length>0;)w+=m.shift(),x+=m.shift(),T(w,x);break;case 6:for(;m.length>0&&(w+=m.shift(),T(w,x),m.length!==0);)x+=m.shift(),T(w,x);break;case 7:for(;m.length>0&&(x+=m.shift(),T(w,x),m.length!==0);)w+=m.shift(),T(w,x);break;case 8:for(;m.length>0;)u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);break;case 10:j=m.pop()+l,O=e.subrs[j],O&&z(O);break;case 11:return;case 12:switch(oe=B[J],J+=1,oe){case 35:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p+m.shift(),M=$+m.shift(),N=A+m.shift(),V=M+m.shift(),Y=N+m.shift(),w=V+m.shift(),x=Y+m.shift(),m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 34:u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p,M=$+m.shift(),N=p,V=M+m.shift(),Y=x,w=V+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 36:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p,M=$+m.shift(),N=p,V=M+m.shift(),Y=N+m.shift(),w=V+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 37:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p+m.shift(),M=$+m.shift(),N=A+m.shift(),V=M+m.shift(),Y=N+m.shift(),Math.abs(V-w)>Math.abs(Y-x)?w=V+m.shift():x=Y+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;default:console.warn(`Glyph ${h}: unknown operator ${1200+oe}`),m.length=0}break;case 14:if(m.length>=4){const _t=hn[m.pop()],Ze=hn[m.pop()],Be=m.pop(),$e=m.pop();if(_t&&Ze){i.isComposite=!0,i.components=[];const Pe=e.charset.indexOf(_t),ze=e.charset.indexOf(Ze);i.components.push({glyphIndex:ze,dx:0,dy:0}),i.components.push({glyphIndex:Pe,dx:$e,dy:Be}),U(r.get(ze).pathCommands);const ot=JSON.parse(JSON.stringify(r.get(Pe).pathCommands));for(let at=0;at<ot.length;at+=1){const Je=ot[at];Je.type!=="Z"&&(Je.x+=$e,Je.y+=Be),(Je.type==="Q"||Je.type==="C")&&(Je.x1+=$e,Je.y1+=Be),Je.type==="C"&&(Je.x2+=$e,Je.y2+=Be)}U(ot)}}else m.length>0&&!E&&(S=m.shift()+n,E=!0);b&&c!==2&&(G(),b=!1);break;case 18:R();break;case 19:case 20:R(),J+=P+7>>3;break;case 21:m.length>2&&!E&&(S=m.shift()+n,E=!0),x+=m.pop(),w+=m.pop(),L(w,x);break;case 22:m.length>1&&!E&&(S=m.shift()+n,E=!0),w+=m.pop(),L(w,x);break;case 23:R();break;case 24:for(;m.length>2;)u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);w+=m.shift(),x+=m.shift(),T(w,x);break;case 25:for(;m.length>6;)w+=m.shift(),x+=m.shift(),T(w,x);u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);break;case 26:for(m.length%2&&(w+=m.shift());m.length>0;)u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g,x=p+m.shift(),C(u,d,g,p,w,x);break;case 27:for(m.length%2&&(x+=m.shift());m.length>0;)u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p,C(u,d,g,p,w,x);break;case 28:D=B[J],H=B[J+1],m.push((D<<24|H<<16)>>16),J+=2;break;case 29:j=m.pop()+a,O=e.gsubrs[j],O&&z(O);break;case 30:for(;m.length>0&&(u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+(m.length===1?m.shift():0),C(u,d,g,p,w,x),m.length!==0);)u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),x=p+m.shift(),w=g+(m.length===1?m.shift():0),C(u,d,g,p,w,x);break;case 31:for(;m.length>0&&(u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),x=p+m.shift(),w=g+(m.length===1?m.shift():0),C(u,d,g,p,w,x),m.length!==0);)u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+(m.length===1?m.shift():0),C(u,d,g,p,w,x);break;default:oe<32?console.warn(`Glyph ${h}: unknown operator ${oe}`):oe<247?m.push(oe-139):oe<251?(D=B[J],J+=1,m.push((oe-247)*256+D+108)):oe<255?(D=B[J],J+=1,m.push(-(oe-251)*256-D-108)):(D=B[J],H=B[J+1],I=B[J+2],F=B[J+3],J+=4,m.push((D<<24|H<<16|I<<8|F)/65536))}}}z(t),this.pathCommands=y,E&&(this.advanceWidth=S)}}class fn{constructor(e){this._sfnt=e}_items=[];get(e){const t=this._items[e];let r;if(t)r=t;else{r=this._get(e);const i=this._sfnt.hmtx.metrics[e];i&&(r.advanceWidth=r.advanceWidth||i.advanceWidth,r.leftSideBearing=r.leftSideBearing||i.leftSideBearing);const n=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);n&&(r.unicode??=n[0],r.unicodes??=n),this._items[e]=r}return r}}class Yf extends fn{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,r=new Hf({index:e});return r.parse(t,t.charStringsIndex.get(e),this),r.name=t.charset[e],r}}var Kf=Object.defineProperty,nl=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Kf(e,t,i),i};class zi extends We{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,r,i){super(e,t,r,i),this._init()}_init(){const e=this.view,t=this.count,r=this.offsetSize;this.objectOffset=(t+1)*r+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){const e=this.view,t=this.count,r=this.offsetSize;e.seek(3);const i=[];for(let n=0,o=t+1;n<o;n++){const a=this.view;let l=0;for(let c=0;c<r;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const e=[];for(let t=0,r=this.count;t<r;t++)e.push(this.get(t));return e}get(e){const t=this.offsets,r=this.objectOffset,i=r+t[e],o=r+t[e+1]-i;return this._isString?this.view.readString(i,o):this.view.readBytes(i,o)}}nl([v("uint16")],zi.prototype,"count"),nl([v("uint8")],zi.prototype,"offsetSize");class Vi extends zi{_isString=!1}class ol extends zi{_isString=!0}const Zf=[".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"],Jf=[".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"],Qf=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ed=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function Gi(s,e){return e<=390?Zf[e]:s[e-391]}function ie(s,e="number",t){return(r,i)=>{if(typeof i!="string")return;const n={type:e,operator:s,default:t??e==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(n)},set(o){this._setProp(n,o)},configurable:!0,enumerable:!0})}}class al extends We{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){const e=this.view;let t="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const n=e.readUint8(),o=n>>4,a=n&15;if(o===r||(t+=i[o],a===r))break;t+=i[a]}return Number.parseFloat(t)}_readOperand(e){const t=this.view;let r,i,n,o;if(e===28)return r=t.readUint8(),i=t.readUint8(),r<<8|i;if(e===29)return r=t.readUint8(),i=t.readUint8(),n=t.readUint8(),o=t.readUint8(),r<<24|i<<16|n<<8|o;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return r=t.readUint8(),(e-247)*256+r+108;if(e>=251&&e<=254)return r=t.readUint8(),-(e-251)*256-r-108;throw new Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){const e=this.view;e.seek(0);let t=[];const r=e.cursor+e.byteLength,i={};for(;e.cursor<r;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),i[n]=t,t=[]):t.push(this._readOperand(n))}return i}_getProp(e){const t=this.dict[e.operator]??e.default;switch(e.type){case"number":return t[0];case"string":return Gi(this._stringIndex?.objects??[],t[0]);case"number[]":return t}return t}_setProp(e,t){}}var td=Object.defineProperty,dn=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&td(e,t,i),i};class ji extends al{}dn([ie(19)],ji.prototype,"subrs"),dn([ie(20)],ji.prototype,"defaultWidthX"),dn([ie(21)],ji.prototype,"nominalWidthX");var rd=Object.defineProperty,ce=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&rd(e,t,i),i};class ne extends al{}ce([ie(0,"string")],ne.prototype,"version"),ce([ie(1,"string")],ne.prototype,"notice"),ce([ie(1200,"string")],ne.prototype,"copyright"),ce([ie(2,"string")],ne.prototype,"fullName"),ce([ie(3,"string")],ne.prototype,"familyName"),ce([ie(4,"string")],ne.prototype,"weight"),ce([ie(1201)],ne.prototype,"isFixedPitch"),ce([ie(1202)],ne.prototype,"italicAngle"),ce([ie(1203,"number",-100)],ne.prototype,"underlinePosition"),ce([ie(1204,"number",50)],ne.prototype,"underlineThickness"),ce([ie(1205)],ne.prototype,"paintType"),ce([ie(1206,"number",2)],ne.prototype,"charstringType"),ce([ie(1207,"number[]",[.001,0,0,.001,0,0])],ne.prototype,"fontMatrix"),ce([ie(13)],ne.prototype,"uniqueId"),ce([ie(5,"number[]",[0,0,0,0])],ne.prototype,"fontBBox"),ce([ie(1208)],ne.prototype,"strokeWidth"),ce([ie(14)],ne.prototype,"xuid"),ce([ie(15)],ne.prototype,"charset"),ce([ie(16)],ne.prototype,"encoding"),ce([ie(17)],ne.prototype,"charStrings"),ce([ie(18,"number[]",[0,0])],ne.prototype,"private");function be(s,e=s){return t=>{gt.tableDefinitions.set(s,{tag:s,prop:e,class:t}),Object.defineProperty(gt.prototype,e,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}class gt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:r,charset:i}=this.cff;t=i.indexOf(r[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const r of e)t.push(this.charToGlyphIndex(r));return t}textToGlyphs(e){const t=this.glyphs,r=this.textToGlyphIndexes(e),i=r.length,n=Array.from({length:i}),o=t.get(0);for(let a=0;a<i;a+=1)n[a]=t.get(r[a])||o;return n}getPathCommands(e,t,r,i,n){const o=[];return this.forEachGlyph(e,t,r,i,n,(a,l,c,h,u)=>{o.push(...a.getPathCommands(l,c,h,u,this))}),o}getAdvanceWidth(e,t,r){return this.forEachGlyph(e,0,0,t,r,()=>{})}forEachGlyph(e,t=0,r=0,i=72,n={},o){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(e);for(let c=0;c<l.length;c+=1){const h=l[c];o.call(this,h,t,r,i,n),h.advanceWidth&&(t+=h.advanceWidth*a),n.letterSpacing?t+=n.letterSpacing*i:n.tracking&&(t+=n.tracking/1e3*i)}return t}constructor(e){(e instanceof Map?e:new Map(Object.entries(e))).forEach((r,i)=>{this.tableViews.set(i,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}clone(){return new gt(this.tableViews)}delete(e){const t=gt.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const r=gt.tableDefinitions.get(e);return r&&this.tables.set(r.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=gt.tableDefinitions.get(e);if(!t)return;let r=this.tables.get(t.prop);if(!r){const i=t.class;if(i){const n=this.tableViews.get(e);if(!n)return;r=new i(n.buffer,n.byteOffset,n.byteLength).setSFNT(this),this.tables.set(t.prop,r)}}return r}}class Me extends We{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var id=Object.defineProperty,sd=Object.getOwnPropertyDescriptor,Yr=(s,e,t,r)=>{for(var i=r>1?void 0:r?sd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&id(e,t,i),i};let Yt=class extends Me{_glyphs;get glyphs(){return this._glyphs??=new Yf(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(s,e,t,r){super(s,e,t,r),this._init()}_init(){const s=this.view,{buffer:e,byteOffset:t}=s,r=t+4;this.nameIndex=new ol(e,r),this.topDictIndex=new Vi(e,this.nameIndex.endOffset),this.stringIndex=new ol(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Vi(e,this.stringIndex.endOffset),this.topDict=new ne(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],n=this.topDict.private[1];i&&(this.privateDict=new ji(e,t+n,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Vi(e,t+n+this.privateDict.subrs))),this.charStringsIndex=new Vi(e,t+this.topDict.charStrings);const o=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Jf:this.topDict.charset===1?this.charset=Qf:this.topDict.charset===2?this.charset=ed:this.charset=this._readCharset(t+this.topDict.charset,o,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=hn:this.topDict.encoding===1?this.encoding=Xf:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(s,e,t){const r=this.view;r.seek(s);let i,n,o;e-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(i=0;i<e;i+=1)n=r.readUint16(),a.push(Gi(t,n));else if(l===1)for(;a.length<=e;)for(n=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)a.push(Gi(t,n)),n+=1;else if(l===2)for(;a.length<=e;)for(n=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)a.push(Gi(t,n)),n+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const e=this.view;e.seek(s);let t,r;const i={},n=e.readUint8();if(n===0){const o=e.readUint8();for(t=0;t<o;t+=1)r=e.readUint8(),i[r]=t}else if(n===1){const o=e.readUint8();for(r=1,t=0;t<o;t+=1){const a=e.readUint8(),l=e.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${n}`);return i}_calcSubroutineBias(s){let e;return s.length<1240?e=107:s.length<33900?e=1131:e=32768,e}};Yr([v("uint8")],Yt.prototype,"majorVersion",2),Yr([v("uint8")],Yt.prototype,"minorVersion",2),Yr([v("uint8")],Yt.prototype,"headerSize",2),Yr([v("uint8")],Yt.prototype,"offsetSize",2),Yt=Yr([be("CFF ","cff")],Yt);var nd=Object.defineProperty,Wi=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&nd(e,t,i),i};const Kr=class yc extends We{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new yc;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((r,i)=>{i<256&&r<256&&t.view.writeUint8(r,6+i)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,r)=>{e.set(r,t)}),e}};Wi([v("uint16")],Kr.prototype,"format"),Wi([v("uint16")],Kr.prototype,"length"),Wi([v("uint16")],Kr.prototype,"language"),Wi([v({type:"uint8",size:256})],Kr.prototype,"glyphIndexArray");let pn=Kr;var od=Object.defineProperty,gn=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&od(e,t,i),i};class Zr extends We{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-r)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const r=(this.view.byteLength-t)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,r=this.subHeaderKeys,i=this.maxSubHeaderKey,n=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(r[c]===0)c>=a||c<n[0].firstCode||c>=n[0].firstCode+n[0].entryCount||n[0].idRangeOffset+(c-n[0].firstCode)>=o.length?l=0:(l=o[n[0].idRangeOffset+(c-n[0].firstCode)],l!==0&&(l=l+n[0].idDelta)),l!==0&&l<e&&t.set(c,l);else{const h=r[c];for(let u=0,d=n[h].entryCount;u<d;u++)if(n[h].idRangeOffset+u>=o.length?l=0:(l=o[n[h].idRangeOffset+u],l!==0&&(l=l+n[h].idDelta)),l!==0&&l<e){const g=(c<<8|u+n[h].firstCode)%65535;t.set(g,l)}}return t}}gn([v("uint16")],Zr.prototype,"format"),gn([v("uint16")],Zr.prototype,"length"),gn([v("uint16")],Zr.prototype,"language");function ll(s){return s>32767?s-65536:s<-32767?s+65536:s}function mn(s,e){let t;const r=[];let i={};return s.forEach((n,o)=>{e&&o>e||((!t||o!==t.unicode+1||n!==t.glyphIndex+1)&&(t?(i.end=t.unicode,r.push(i),i={start:o,startId:n,delta:ll(n-o)}):(i.start=Number(o),i.startId=n,i.delta=ll(n-o))),t={unicode:o,glyphIndex:n})}),t&&(i.end=t.unicode,r.push(i)),r}var ad=Object.defineProperty,Kt=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&ad(e,t,i),i};const Lt=class vc extends We{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=mn(e,65535),r=t.length+1,i=Math.floor(Math.log(r)/Math.LN2),n=2*2**i,o=new vc(new ArrayBuffer(24+t.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=n,o.entrySelector=i,o.rangeShift=2*r-n,o.endCode=[...t.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...t.map(a=>a.start),65535],o.idDelta=[...t.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,n=this.endCode,o=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<t;++c)for(let h=i[c],u=n[c];h<=u;++h)if(o[c]===0)e.set(h,(h+a[c])%65536);else{const d=c+o[c]/2+(h-i[c])-r,g=l[d];g!==0?e.set(h,(g+a[c])%65536):e.set(h,0)}return e.delete(65535),e}};Kt([v("uint16")],Lt.prototype,"format"),Kt([v("uint16")],Lt.prototype,"length"),Kt([v("uint16")],Lt.prototype,"language"),Kt([v("uint16")],Lt.prototype,"segCountX2"),Kt([v("uint16")],Lt.prototype,"searchRange"),Kt([v("uint16")],Lt.prototype,"entrySelector"),Kt([v("uint16")],Lt.prototype,"rangeShift");let yn=Lt;var ld=Object.defineProperty,Jr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&ld(e,t,i),i};class Zt extends We{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((r,i)=>{t.set(i,r)}),t}}Jr([v("uint16")],Zt.prototype,"format"),Jr([v("uint16")],Zt.prototype,"length"),Jr([v("uint16")],Zt.prototype,"language"),Jr([v("uint16")],Zt.prototype,"firstCode"),Jr([v("uint16")],Zt.prototype,"entryCount");var cd=Object.defineProperty,Qr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&cd(e,t,i),i};const _r=class _c extends We{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=mn(e),r=new _c(new ArrayBuffer(16+t.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=t.length,t.forEach(i=>{r.view.writeUint32(i.start),r.view.writeUint32(i.end),r.view.writeUint32(i.startId)}),r}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let r=0,i=t.length;r<i;r++){const n=t[r];let o=n.startGlyphCode,a=n.startCharCode;const l=n.endCharCode;for(;a<=l;)e.set(a++,o++)}return e}};Qr([v("uint16")],_r.prototype,"format"),Qr([v("uint16")],_r.prototype,"reserved"),Qr([v("uint32")],_r.prototype,"length"),Qr([v("uint32")],_r.prototype,"language"),Qr([v("uint32")],_r.prototype,"nGroups");let vn=_r;var hd=Object.defineProperty,_n=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&hd(e,t,i),i};class ei extends We{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const r=this.view.readUint32();t.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const r=this.view.readUint32();t.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let r=0,i=t.length;r<i;r++){const{uVSMappings:n}=t[r];n.forEach(o=>{e.set(o.unicodeValue,o.glyphID)})}return e}}_n([v("uint16")],ei.prototype,"format"),_n([v("uint32")],ei.prototype,"length"),_n([v("uint32")],ei.prototype,"numVarSelectorRecords");var ud=Object.defineProperty,fd=Object.getOwnPropertyDescriptor,bn=(s,e,t,r)=>{for(var i=r>1?void 0:r?fd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ud(e,t,i),i};let br=class extends Me{static from(s){const e=Array.from(s.keys()).some(h=>h>65535),t=yn.from(s),r=pn.from(s),i=e?vn.from(s):void 0,n=4+(i?32:24),o=n+t.view.byteLength,a=o+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:n},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:n},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new br(new ArrayBuffer(4+8*l.length+t.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(h=>{c.view.writeUint16(h.platformID),c.view.writeUint16(h.platformSpecificID),c.view.writeUint32(h.offset)}),c.view.writeBytes(t.view,n),c.view.writeBytes(r.view,o),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,e=this.unicodeToGlyphIndexMap,t=Array.from(e.keys());for(let r=0,i=t.length;r<i;r++){const n=t[r],o=e.get(n);s.has(o)?s.get(o).push(n):s.set(o,[n])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const t=this.view.readUint16();let r;switch(t){case 0:r=new pn(this.view.buffer,e.offset);break;case 2:r=new Zr(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new yn(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new Zt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new vn(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new ei(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:t,view:r}})}readunicodeToGlyphIndexMap(){const s=this.readSubtables(),e=s.find(o=>o.format===0)?.view,t=s.find(o=>o.platformID===3&&o.platformSpecificID===3&&o.format===2)?.view,r=s.find(o=>o.platformID===3&&o.platformSpecificID===1&&o.format===4)?.view,i=s.find(o=>o.platformID===3&&o.platformSpecificID===10&&o.format===12)?.view,n=s.find(o=>o.platformID===0&&o.platformSpecificID===5&&o.format===14)?.view;return new Map([...e?.getUnicodeToGlyphIndexMap()??[],...t?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap()??[]])}};bn([v("uint16")],br.prototype,"version",2),bn([v("uint16")],br.prototype,"numberSubtables",2),br=bn([be("cmap")],br);class dd extends un{_parseContours(e){const t=[];let r=[];for(let i=0;i<e.length;i+=1){const n=e[i];r.push(n),n.lastPointOfContour&&(t.push(r),r=[])}return Xr(r.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const r=[];for(let i=0;i<e.length;i+=1){const n=e[i],o={x:t.xScale*n.x+t.scale10*n.y+t.dx,y:t.scale01*n.x+t.yScale*n.y+t.dy,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(e,t,r,i,n){let o;return(t&i)>0?(o=e.view.readUint8(),(t&n)===0&&(o=-o),o=r+o):(t&n)>0?o=r:o=r+e.view.readInt16(),o}parse(e,t,r){e.view.seek(t);const i=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Xr(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(e.view.readUint8());const h=e.view.byteOffset,u=a[a.length-1]+1;Xr(u<2e4,`Bad numberOfCoordinates:${h}`);const d=[];let g,p=0;for(;p<u;)if(g=e.view.readUint8(),d.push(g),p++,g&8&&p<u){const y=e.view.readUint8();for(let m=0;m<y;m++)d.push(g),p++}if(Xr(d.length===u,`Bad flags length: ${d.length}, numberOfCoordinates: ${u}`),a.length>0){const y=[];let m;if(u>0){for(let b=0;b<u;b+=1)g=d[b],m={},m.onCurve=!!(g&1),m.lastPointOfContour=a.includes(b),y.push(m);let P=0;for(let b=0;b<u;b+=1)g=d[b],m=y[b],m.x=this._parseGlyphCoordinate(e,g,P,2,16),P=m.x;let E=0;for(let b=0;b<u;b+=1)g=d[b],m=y[b],m.y=this._parseGlyphCoordinate(e,g,E,4,32),E=m.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const c={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=e.view.readInt16(),c.dy=e.view.readInt16()):c.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(c.dx=e.view.readInt8(),c.dy=e.view.readInt8()):c.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?c.xScale=c.yScale=e.view.readInt16()/16384:(a&64)>0?(c.xScale=e.view.readInt16()/16384,c.yScale=e.view.readInt16()/16384):(a&128)>0&&(c.xScale=e.view.readInt16()/16384,c.scale01=e.view.readInt16()/16384,c.scale10=e.view.readInt16()/16384,c.yScale=e.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=r.get(l.glyphIndex);if(c.getPathCommands(),c.points){let h;if(l.matchedPoints===void 0)h=this._transformPoints(c.points,l);else{Xr(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let d=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};d=this._transformPoints([d],g)[0],g.dx=u.x-d.x,g.dy=u.y-d.y,h=this._transformPoints(c.points,g)}this.points=this.points.concat(h)}}const n=[],o=this._parseContours(this.points);for(let a=0,l=o.length;a<l;++a){const c=o[a];let h=c[c.length-1],u=c[0];h.onCurve?n.push({type:"M",x:h.x,y:h.y}):u.onCurve?n.push({type:"M",x:u.x,y:u.y}):n.push({type:"M",x:(h.x+u.x)*.5,y:(h.y+u.y)*.5});for(let d=0,g=c.length;d<g;++d)if(h=u,u=c[(d+1)%g],h.onCurve)n.push({type:"L",x:h.x,y:h.y});else{let p=u;u.onCurve||(p={x:(h.x+u.x)*.5,y:(h.y+u.y)*.5}),n.push({type:"Q",x1:h.x,y1:h.y,x:p.x,y:p.y})}n.push({type:"Z"})}this.pathCommands=n}}class pd extends fn{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,r=t[e],i=new dd({index:e});return r!==t[e+1]&&i.parse(this._sfnt.glyf,r,this),i}}var gd=Object.getOwnPropertyDescriptor,md=(s,e,t,r)=>{for(var i=r>1?void 0:r?gd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let qi=class extends Me{static from(s){const e=s.reduce((r,i)=>r+i.byteLength,0),t=new qi(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeBytes(r)}),t}_glyphs;get glyphs(){return this._glyphs??=new pd(this._sfnt)}};qi=md([be("glyf")],qi);var yd=Object.getOwnPropertyDescriptor,vd=(s,e,t,r)=>{for(var i=r>1?void 0:r?yd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let wn=class extends Me{};wn=vd([be("GPOS","gpos")],wn);var _d=Object.defineProperty,bd=Object.getOwnPropertyDescriptor,Jt=(s,e,t,r)=>{for(var i=r>1?void 0:r?bd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_d(e,t,i),i};let At=class extends Me{};Jt([v("uint16")],At.prototype,"majorVersion",2),Jt([v("uint16")],At.prototype,"minorVersion",2),Jt([v("uint16")],At.prototype,"scriptListOffset",2),Jt([v("uint16")],At.prototype,"featureListOffset",2),Jt([v("uint16")],At.prototype,"lookupListOffset",2),Jt([v("uint16")],At.prototype,"featureVariationsOffset",2),At=Jt([be("GSUB","gsub")],At);var wd=Object.defineProperty,xd=Object.getOwnPropertyDescriptor,ye=(s,e,t,r)=>{for(var i=r>1?void 0:r?xd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&wd(e,t,i),i};let ue=class extends Me{constructor(s=new ArrayBuffer(54),e){super(s,e,Math.min(54,s.byteLength-(e??0)))}};ye([v("fixed")],ue.prototype,"version",2),ye([v("fixed")],ue.prototype,"fontRevision",2),ye([v("uint32")],ue.prototype,"checkSumAdjustment",2),ye([v("uint32")],ue.prototype,"magickNumber",2),ye([v("uint16")],ue.prototype,"flags",2),ye([v("uint16")],ue.prototype,"unitsPerEm",2),ye([v({type:"longDateTime"})],ue.prototype,"created",2),ye([v({type:"longDateTime"})],ue.prototype,"modified",2),ye([v("int16")],ue.prototype,"xMin",2),ye([v("int16")],ue.prototype,"yMin",2),ye([v("int16")],ue.prototype,"xMax",2),ye([v("int16")],ue.prototype,"yMax",2),ye([v("uint16")],ue.prototype,"macStyle",2),ye([v("uint16")],ue.prototype,"lowestRecPPEM",2),ye([v("int16")],ue.prototype,"fontDirectionHint",2),ye([v("int16")],ue.prototype,"indexToLocFormat",2),ye([v("int16")],ue.prototype,"glyphDataFormat",2),ue=ye([be("head")],ue);var Pd=Object.defineProperty,Cd=Object.getOwnPropertyDescriptor,Re=(s,e,t,r)=>{for(var i=r>1?void 0:r?Cd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Pd(e,t,i),i};let we=class extends Me{constructor(s=new ArrayBuffer(36),e){super(s,e,Math.min(36,s.byteLength-(e??0)))}};Re([v("fixed")],we.prototype,"version",2),Re([v("int16")],we.prototype,"ascent",2),Re([v("int16")],we.prototype,"descent",2),Re([v("int16")],we.prototype,"lineGap",2),Re([v("uint16")],we.prototype,"advanceWidthMax",2),Re([v("int16")],we.prototype,"minLeftSideBearing",2),Re([v("int16")],we.prototype,"minRightSideBearing",2),Re([v("int16")],we.prototype,"xMaxExtent",2),Re([v("int16")],we.prototype,"caretSlopeRise",2),Re([v("int16")],we.prototype,"caretSlopeRun",2),Re([v("int16")],we.prototype,"caretOffset",2),Re([v({type:"int16",size:4})],we.prototype,"reserved",2),Re([v("int16")],we.prototype,"metricDataFormat",2),Re([v("uint16")],we.prototype,"numOfLongHorMetrics",2),we=Re([be("hhea")],we);var Td=Object.getOwnPropertyDescriptor,Sd=(s,e,t,r)=>{for(var i=r>1?void 0:r?Td(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Xi=class extends Me{static from(s){const e=s.length*4,t=new Xi(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeUint16(r.advanceWidth),t.view.writeUint16(r.leftSideBearing)}),t}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let t=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((i,n)=>(n<e&&(t=r.readUint16()),{advanceWidth:t,leftSideBearing:r.readUint16()}))}};Xi=Sd([be("hmtx")],Xi);var Ed=Object.getOwnPropertyDescriptor,Md=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ed(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let xn=class extends Me{};xn=Md([be("kern","kern")],xn);var Ad=Object.getOwnPropertyDescriptor,Od=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ad(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Hi=class extends Me{static from(s,e=1){const t=s.length*(e?4:2),r=new Hi(new ArrayBuffer(t));return s.forEach(i=>{e?r.view.writeUint32(i):r.view.writeUint16(i/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,t=this.view;return t.seek(0),Array.from({length:s}).map(()=>e?t.readUint32():t.readUint16()*2)}};Hi=Od([be("loca")],Hi);var kd=Object.defineProperty,Dd=Object.getOwnPropertyDescriptor,Ae=(s,e,t,r)=>{for(var i=r>1?void 0:r?Dd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&kd(e,t,i),i};let ve=class extends Me{constructor(s=new ArrayBuffer(32),e){super(s,e,Math.min(32,s.byteLength-(e??0)))}};Ae([v("fixed")],ve.prototype,"version",2),Ae([v("uint16")],ve.prototype,"numGlyphs",2),Ae([v("uint16")],ve.prototype,"maxPoints",2),Ae([v("uint16")],ve.prototype,"maxContours",2),Ae([v("uint16")],ve.prototype,"maxComponentPoints",2),Ae([v("uint16")],ve.prototype,"maxComponentContours",2),Ae([v("uint16")],ve.prototype,"maxZones",2),Ae([v("uint16")],ve.prototype,"maxTwilightPoints",2),Ae([v("uint16")],ve.prototype,"maxStorage",2),Ae([v("uint16")],ve.prototype,"maxFunctionDefs",2),Ae([v("uint16")],ve.prototype,"maxInstructionDefs",2),Ae([v("uint16")],ve.prototype,"maxStackElements",2),Ae([v("uint16")],ve.prototype,"maxSizeOfInstructions",2),Ae([v("uint16")],ve.prototype,"maxComponentElements",2),Ae([v("uint16")],ve.prototype,"maxComponentDepth",2),ve=Ae([be("maxp")],ve);var Id=Object.defineProperty,Rd=Object.getOwnPropertyDescriptor,Yi=(s,e,t,r)=>{for(var i=r>1?void 0:r?Rd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Id(e,t,i),i};const cl={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},Pn={Macintosh:1,Microsoft:3},Ud={Default:0},hl={UCS2:1};let wr=class extends Me{_names;get names(){return this._names??=this.readNames()}readNames(){const s=this.count;this.view.seek(6);const e=[];for(let a=0;a<s;++a)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const t=this.stringOffset;for(let a=0;a<s;++a){const l=e[a];l.name=this.view.readBytes(t+l.offset,l.length)}let r=Pn.Macintosh,i=Ud.Default,n=0;e.some(a=>a.platform===Pn.Microsoft&&a.encoding===hl.UCS2&&a.language===1033)&&(r=Pn.Microsoft,i=hl.UCS2,n=1033);const o={};for(let a=0;a<s;++a){const l=e[a];l.platform===r&&l.encoding===i&&l.language===n&&cl[l.nameId]&&(o[cl[l.nameId]]=n===0?Vf(l.name):Gf(l.name))}return o}};Yi([v("uint16")],wr.prototype,"format",2),Yi([v("uint16")],wr.prototype,"count",2),Yi([v("uint16")],wr.prototype,"stringOffset",2),wr=Yi([be("name")],wr);var Bd=Object.defineProperty,Ld=Object.getOwnPropertyDescriptor,q=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ld(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Bd(e,t,i),i};let W=class extends Me{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};q([v("uint16")],W.prototype,"version",2),q([v("int16")],W.prototype,"xAvgCharWidth",2),q([v("uint16")],W.prototype,"usWeightClass",2),q([v("uint16")],W.prototype,"usWidthClass",2),q([v("uint16")],W.prototype,"fsType",2),q([v("uint16")],W.prototype,"ySubscriptXSize",2),q([v("uint16")],W.prototype,"ySubscriptYSize",2),q([v("uint16")],W.prototype,"ySubscriptXOffset",2),q([v("uint16")],W.prototype,"ySubscriptYOffset",2),q([v("uint16")],W.prototype,"ySuperscriptXSize",2),q([v("uint16")],W.prototype,"ySuperscriptYSize",2),q([v("uint16")],W.prototype,"ySuperscriptXOffset",2),q([v("uint16")],W.prototype,"ySuperscriptYOffset",2),q([v("uint16")],W.prototype,"yStrikeoutSize",2),q([v("uint16")],W.prototype,"yStrikeoutPosition",2),q([v("uint16")],W.prototype,"sFamilyClass",2),q([v({type:"uint8"})],W.prototype,"bFamilyType",2),q([v({type:"uint8"})],W.prototype,"bSerifStyle",2),q([v({type:"uint8"})],W.prototype,"bWeight",2),q([v({type:"uint8"})],W.prototype,"bProportion",2),q([v({type:"uint8"})],W.prototype,"bContrast",2),q([v({type:"uint8"})],W.prototype,"bStrokeVariation",2),q([v({type:"uint8"})],W.prototype,"bArmStyle",2),q([v({type:"uint8"})],W.prototype,"bLetterform",2),q([v({type:"uint8"})],W.prototype,"bMidline",2),q([v({type:"uint8"})],W.prototype,"bXHeight",2),q([v({type:"uint8",size:16})],W.prototype,"ulUnicodeRange",2),q([v({type:"char",size:4})],W.prototype,"achVendID",2),q([v("uint16")],W.prototype,"fsSelection",2),q([v("uint16")],W.prototype,"usFirstCharIndex",2),q([v("uint16")],W.prototype,"usLastCharIndex",2),q([v("int16")],W.prototype,"sTypoAscender",2),q([v("int16")],W.prototype,"sTypoDescender",2),q([v("int16")],W.prototype,"sTypoLineGap",2),q([v("uint16")],W.prototype,"usWinAscent",2),q([v("uint16")],W.prototype,"usWinDescent",2),q([v({offset:72,type:"uint8",size:8})],W.prototype,"ulCodePageRange",2),q([v({offset:72,type:"int16"})],W.prototype,"sxHeight",2),q([v("int16")],W.prototype,"sCapHeight",2),q([v("uint16")],W.prototype,"usDefaultChar",2),q([v("uint16")],W.prototype,"usBreakChar",2),q([v("uint16")],W.prototype,"usMaxContext",2),W=q([be("OS/2","os2")],W);var Fd=Object.defineProperty,Nd=Object.getOwnPropertyDescriptor,mt=(s,e,t,r)=>{for(var i=r>1?void 0:r?Nd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Fd(e,t,i),i};let Ye=class extends Me{constructor(s=new ArrayBuffer(32),e,t){super(s,e,t)}};mt([v("fixed")],Ye.prototype,"format",2),mt([v("fixed")],Ye.prototype,"italicAngle",2),mt([v("int16")],Ye.prototype,"underlinePosition",2),mt([v("int16")],Ye.prototype,"underlineThickness",2),mt([v("uint32")],Ye.prototype,"isFixedPitch",2),mt([v("uint32")],Ye.prototype,"minMemType42",2),mt([v("uint32")],Ye.prototype,"maxMemType42",2),mt([v("uint32")],Ye.prototype,"minMemType1",2),mt([v("uint32")],Ye.prototype,"maxMemType1",2),Ye=mt([be("post")],Ye);var $d=Object.defineProperty,zd=Object.getOwnPropertyDescriptor,Ue=(s,e,t,r)=>{for(var i=r>1?void 0:r?zd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&$d(e,t,i),i};let xe=class extends Me{constructor(s=new ArrayBuffer(36),e){super(s,e,Math.min(36,s.byteLength-(e??0)))}};Ue([v("fixed")],xe.prototype,"version",2),Ue([v("int16")],xe.prototype,"vertTypoAscender",2),Ue([v("int16")],xe.prototype,"vertTypoDescender",2),Ue([v("int16")],xe.prototype,"vertTypoLineGap",2),Ue([v("int16")],xe.prototype,"advanceHeightMax",2),Ue([v("int16")],xe.prototype,"minTopSideBearing",2),Ue([v("int16")],xe.prototype,"minBottomSideBearing",2),Ue([v("int16")],xe.prototype,"yMaxExtent",2),Ue([v("int16")],xe.prototype,"caretSlopeRise",2),Ue([v("int16")],xe.prototype,"caretSlopeRun",2),Ue([v("int16")],xe.prototype,"caretOffset",2),Ue([v({type:"int16",size:4})],xe.prototype,"reserved",2),Ue([v("int16")],xe.prototype,"metricDataFormat",2),Ue([v("int16")],xe.prototype,"numOfLongVerMetrics",2),xe=Ue([be("vhea")],xe);var Vd=Object.getOwnPropertyDescriptor,Gd=(s,e,t,r)=>{for(var i=r>1?void 0:r?Vd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Ki=class extends Me{static from(s){const e=s.length*4,t=new Ki(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeUint16(r.advanceHeight),t.view.writeInt16(r.topSideBearing)}),t}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.vhea?.numOfLongVerMetrics??0,t=this.view;t.seek(0);let r=0;return Array.from({length:s}).map((i,n)=>(n<e&&(r=t.readUint16()),{advanceHeight:r,topSideBearing:t.readUint8()}))}};Ki=Gd([be("vmtx")],Ki);var jd=Object.defineProperty,ti=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&jd(e,t,i),i};class it extends Ni{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e=="number"?this.signature.has(e):this.signature.has(yr(e).getUint32(0))}static checksum(e){const t=yr(e);let r=t.byteLength;for(;r%4;)r++;let i=0;for(let n=0,o=r/4;n<o;n+=4)n*4<r-4&&(i+=t.getUint32(n*4,!1));return i&4294967295}static from(e){const t=u=>u+3&-4,r=e.tableViews.size,i=Array.from(e.tableViews.values()).reduce((u,d)=>u+t(d.byteLength),0),n=new this(new ArrayBuffer(12+r*16+i));n.scalerType=65536,n.numTables=r;const o=Math.log(2);n.searchRange=Math.floor(Math.log(r)/o)*16,n.entrySelector=Math.floor(n.searchRange/o),n.rangeShift=r*16-n.searchRange;let a=12+r*16,l=0;const c=n.getDirectories();e.tableViews.forEach((u,d)=>{const g=c[l++];g.tag=d,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,n.view.writeBytes(u,a),a+=t(g.length)});const h=n.createSFNT().head;return h.checkSumAdjustment=0,h.checkSumAdjustment=2981146554-this.checksum(n.view),n}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const t=new vr(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new gt(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}}ti([v("uint32")],it.prototype,"scalerType"),ti([v("uint16")],it.prototype,"numTables"),ti([v("uint16")],it.prototype,"searchRange"),ti([v("uint16")],it.prototype,"entrySelector"),ti([v("uint16")],it.prototype,"rangeShift");class Cn extends it{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(e){return super.from(e)}}var Wd=Object.defineProperty,ri=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Wd(e,t,i),i};class Qt extends We{constructor(e,t){super(e,t,20)}}ri([v({type:"char",size:4})],Qt.prototype,"tag"),ri([v("uint32")],Qt.prototype,"offset"),ri([v("uint32")],Qt.prototype,"compLength"),ri([v("uint32")],Qt.prototype,"origLength"),ri([v("uint32")],Qt.prototype,"origChecksum");var qd=Object.defineProperty,qe=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&qd(e,t,i),i};const Ne=class Qn extends Ni{format="WOFF";mimeType="font/woff";get subfontFormat(){return it.is(this.flavor)?"TrueType":Cn.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e=="number"?this.signature.has(e):this.signature.has(yr(e).getUint32(0))}static checkSum(e){const t=yr(e),r=t.byteLength,i=Math.floor(r/4);let n=0,o=0;for(;o<i;)n+=t.getUint32(4*o++,!1);let a=r-i*4;if(a){let l=i*4;for(;a>0;)n+=t.getUint8(l)<<a*8,l++,a--}return n%4294967296}static from(e,t=new ArrayBuffer(0)){const r=u=>u+3&-4,i=[];e.tableViews.forEach((u,d)=>{const g=yr(Uf(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:d,view:g.byteLength<u.byteLength?g:u,rawView:u})});const n=i.length,o=i.reduce((u,d)=>u+r(d.view.byteLength),0),a=new Qn(new ArrayBuffer(44+20*n+o+t.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=n,a.totalSFNTSize=12+16*n+i.reduce((u,d)=>u+r(d.rawView.byteLength),0);let l=44+n*20,c=0;const h=a.getDirectories();return i.forEach(u=>{const d=h[c++];d.tag=u.tag,d.offset=l,d.compLength=u.view.byteLength,d.origChecksum=Qn.checkSum(u.rawView),d.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(d.compLength)}),a.view.writeBytes(t),a}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{const t=new Qt(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new gt(this.getDirectories().reduce((e,t)=>{const r=t.tag,i=this.view.byteOffset+t.offset,n=t.compLength,o=t.origLength,a=i+n;return e[r]=n>=o?new DataView(this.view.buffer,i,n):new DataView(Bf(new Uint8Array(this.view.buffer.slice(i,a))).buffer),e},{}))}};qe([v("uint32")],Ne.prototype,"signature"),qe([v("uint32")],Ne.prototype,"flavor"),qe([v("uint32")],Ne.prototype,"length"),qe([v("uint16")],Ne.prototype,"numTables"),qe([v("uint16")],Ne.prototype,"reserved"),qe([v("uint32")],Ne.prototype,"totalSFNTSize"),qe([v("uint16")],Ne.prototype,"majorVersion"),qe([v("uint16")],Ne.prototype,"minorVersion"),qe([v("uint32")],Ne.prototype,"metaOffset"),qe([v("uint32")],Ne.prototype,"metaLength"),qe([v("uint32")],Ne.prototype,"metaOrigLength"),qe([v("uint32")],Ne.prototype,"privOffset"),qe([v("uint32")],Ne.prototype,"privLength");let Zi=Ne;function ul(s,e=!0){if(it.is(s))return new it(s);if(Cn.is(s))return new Cn(s);if(Zi.is(s))return new Zi(s);if(e)throw new Error("Failed to parseFont")}function fl(s,e=!0){const t=ul(s,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}class Ji{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const r=new AbortController;return{url:e,when:fetch(e,{...Ji.defaultRequestInit,...t,signal:r.signal}).then(i=>i.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(e,t){return document.fonts.check(`14px ${e}`)||document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const r=CSS.escape(e);if(!document.querySelector(`style[data-family="${r}"]`)){const i=document.createElement("style");i.type="text/css",i.dataset.family=e,i.appendChild(document.createTextNode(`@font-face {
|
|
148
|
+
}`,uniforms:{sampler:0,projectionMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),modelViewMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),tint:new Float32Array([1,1,1,1])}})}}class Q extends Ii{static _instance;static get instance(){return this._instance??=new this}static draw(e,t=$r.instance,r){this.instance.draw(e,t,r)}constructor(){super({vertexAttributes:{position:new Ge({buffer:new St({data:new Float32Array([-1,-1,1,-1,1,1,-1,1]),dynamic:!1}),size:2,normalized:!1,type:"float"}),uv:new Ge({buffer:new St({data:new Float32Array([0,0,1,0,1,1,0,1]),dynamic:!1}),size:2,normalized:!1,type:"float"})},indexBuffer:new dr({data:new Uint16Array([0,1,2,0,2,3]),dynamic:!1})})}}class tf extends Ii{positionBuffer;uvBuffer;constructor(){const e=new St({data:new Float32Array,dynamic:!0}),t=new St({data:new Float32Array,dynamic:!0});super({vertexAttributes:{position:new Ge({buffer:e,size:2,normalized:!1,type:"float"}),uv:new Ge({buffer:t,size:2,normalized:!1,type:"float"})},indexBuffer:new dr({data:new Uint16Array,dynamic:!0})}),this.positionBuffer=e,this.uvBuffer=t}}var rf=Object.defineProperty,pr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&rf(e,t,i),i};class le extends Pt{static get EMPTY(){return new this({width:1,height:1,pixels:null})}static get WHITE(){return new this({width:1,height:1,pixels:new Uint8Array([255,255,255,255])})}static get BLACK(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,0,255])})}static get RED(){return new this({width:1,height:1,pixels:new Uint8Array([255,0,0,255])})}static get GREEN(){return new this({width:1,height:1,pixels:new Uint8Array([0,255,0,255])})}static get BLUE(){return new this({width:1,height:1,pixels:new Uint8Array([0,0,255,255])})}_isPowerOfTwo=!1;_needsUpload=!1;get realWidth(){return Math.round(this.width*this.pixelRatio)}get realHeight(){return Math.round(this.height*this.pixelRatio)}constructor(e){super(),this.source=e,this._updateSize()}isValid(){return!!(this.width&&this.height)}_glTextureOptions(e,t){let r=this.wrapMode;return e.version===1&&!this._isPowerOfTwo&&(r="clamp_to_edge"),{value:this.source,target:"texture_2d",location:0,filterMode:this.filterMode,wrapMode:r,...t}}_glTexture(e,t){return e.getRelated(this,()=>e.texture.create(this._glTextureOptions(e,t)))}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"width":case"height":this._updatePOT();break;case"source":this._updateSize();break;case"filterMode":case"wrapMode":case"pixelRatio":this.requestUpload();break}}_updatePOT(){this._isPowerOfTwo=Ts(this.realWidth)&&Ts(this.realHeight),this.requestUpload()}_updateSize(){const e=this.source;"pixels"in e?(this.width=e.width/this.pixelRatio,this.height=e.height/this.pixelRatio):(this.width=Number(e.naturalWidth||e.videoWidth||e.width||0)/this.pixelRatio,this.height=Number(e.naturalHeight||e.videoHeight||e.height||0)/this.pixelRatio),this.requestUpload()}requestUpload(){this._needsUpload=!0}upload(e,t){return this._needsUpload&&this.isValid()?(this._needsUpload=!1,e.texture.update(this._glTexture(e,t),this._glTextureOptions(e,t)),!0):!1}activate(e,t=0){return this.isValid()?(e.texture.bind({target:"texture_2d",value:this._glTexture(e,{location:t}),location:t}),this.upload(e,{location:t}),!0):!1}inactivate(e){e.texture.unbind(this._glTexture(e))}destroy(){Ao&&this.source instanceof ImageBitmap&&this.source.close()}}pr([_({internal:!0})],le.prototype,"source"),pr([_({fallback:0})],le.prototype,"width"),pr([_({fallback:0})],le.prototype,"height"),pr([_({fallback:"linear"})],le.prototype,"filterMode"),pr([_({fallback:"clamp_to_edge"})],le.prototype,"wrapMode"),pr([_({fallback:1})],le.prototype,"pixelRatio");class Ri extends Pt{frames;frameIndex=0;get currentFrame(){return this.frames[this.frameIndex]}constructor(e){super();let t;if(Array.isArray(e))t=e;else if(e instanceof le)t=[{texture:e,duration:0}];else throw new TypeError("Failed new AnimatedTexture");this.frames=t,this.updateDuration()}updateDuration(){return this.duration=this.frames.reduce((e,t)=>t.duration+e,0),this}destroy(){this.frames.forEach(e=>{e.texture.destroy()})}}var sf=Object.defineProperty,nf=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&sf(e,t,i),i};class Ui extends le{constructor(e=document.createElement("canvas")){super(e)}_updateProperty(e,t,r){switch(e){case"width":this.source.width=Math.max(1,Math.ceil(t*this.pixelRatio));break;case"height":this.source.height=Math.max(1,Math.ceil(t*this.pixelRatio));break}super._updateProperty(e,t,r)}}nf([_({fallback:2})],Ui.prototype,"pixelRatio");class of extends le{static _cached=new Map;static get(e){const t=new Qe(e),r=t.toHex();let i=this._cached.get(r);return i||(i=new le({width:1,height:1,pixels:new Uint8Array([t.r8,t.g8,t.b8,t.a8])}),this._cached.set(r,i)),i}constructor(e){const t=new Qe(e);super({width:1,height:1,pixels:new Uint8Array([t.r8,t.g8,t.b8,t.a8])})}}class zr extends le{static test(e){return Ar(e)}static linearGradient(e,t,r){t=t||1,r=r||1;const i=document.createElement("canvas");i.width=t,i.height=r;const n=i.getContext("2d");if(!n)throw new Error("Failed to parse linear gradient, get canvas context is null.");const{angle:o=0,stops:a}=e,l=t,c=r,h=l/2,u=c/2,d=(o+90)*Math.PI/180,g=Math.sin(d),p=-Math.cos(d),y=Math.abs(l*Math.sin(d))+Math.abs(c*Math.cos(d)),m=h-g*(y/2),P=u-p*(y/2),E=h+g*(y/2),b=u+p*(y/2),S=n.createLinearGradient(m,P,E,b);for(const x of a)S.addColorStop(x.offset,x.color);n.fillStyle=S,n.fillRect(0,0,l,c);const w=n.getImageData(0,0,i.width,i.height);return{width:w.width,height:w.height,pixels:new Uint8Array(w.data.buffer)}}constructor(e,t,r){super(zr.linearGradient(e,t,r))}}function af(s){return{autoLoad:!!(s?.autoLoad??!0),useBitmap:!!(s?.useBitmap??!0)&&Es,crossorigin:s?.crossorigin??null}}class lf extends le{bitmap;useBitmap;preserveBitmap=!1;_loadSource;_loadBitmap;constructor(e,t){const r=af(t);super(e);const i=e.src,n=i.includes(".svg")||i.startsWith("data:image/svg+xml");this.useBitmap=r.useBitmap&&!n,r.autoLoad&&this.load()}async load(){return this._loadSource||(this._loadSource=new Promise(e=>{this._loadSource=void 0;const t=this.source,r=()=>{t.onload=null,t.onerror=null},i=()=>{r(),this.requestUpload(),this.useBitmap?this.genBitmap().finally(()=>e(this)):e(this)},n=o=>{r(),console.warn(`Failed to load ImageTexture, src: ${t.src}`,o),this.emit("error",o),e(this)};t.complete&&t.src?i():(t.onload=i,t.onerror=n)})),this._loadSource}genBitmap(){if(this._loadBitmap)return this._loadBitmap;if(this.bitmap||!Es)return Promise.resolve(this);const e=this.source,t=!e.crossOrigin||e.crossOrigin==="anonymous";return this._loadBitmap=fetch(e.src,{mode:t?"cors":"no-cors"}).then(r=>r.blob()).then(r=>createImageBitmap(r,0,0,e.width,e.height,{premultiplyAlpha:"premultiply"})).then(r=>(this.bitmap=r,this.requestUpload(),this._loadBitmap=void 0,this)).catch(r=>(console.warn("Failed to genBitmap",r),this)),this._loadBitmap}_glTextureOptions(e){return{...super._glTextureOptions(e),value:this.bitmap??this.source}}upload(e){if(this.useBitmap){if(!this.bitmap)return this.genBitmap(),!1}else{const r=this.source;if(Dr&&r instanceof HTMLImageElement&&(!r.complete||r.naturalWidth===0))return!1}const t=super.upload(e);return this.preserveBitmap&&this.bitmap&&(this.bitmap.close(),this.bitmap=void 0),t}}class Zs extends le{constructor(e,t=1,r=1){const i={width:t,height:r,pixels:null};e&&(ArrayBuffer.isView(e)?i.pixels=new Uint8Array(e.buffer):i.pixels=new Uint8Array(e)),super(i)}_updateProperty(e,t,r){switch(e){case"width":this.source.width=Math.round(this.width*this.pixelRatio);break;case"height":this.source.height=Math.round(this.height*this.pixelRatio);break;case"pixelRatio":this.source.width=Math.round(this.width*this.pixelRatio),this.source.height=Math.round(this.height*this.pixelRatio);break}super._updateProperty(e,t,r)}}var cf=Object.defineProperty,za=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&cf(e,t,i),i};function hf(s){return{autoLoad:!!(s?.autoLoad??!0),autoPlay:!!(s?.autoPlay??!1),fps:Number(s?.fps??0),crossorigin:s?.crossorigin??null,loop:!!(s?.loop??!1),muted:!!(s?.muted??!1),playsinline:!!(s?.playsinline??!0)}}const Js=class gc extends le{static mimeTypes=new Map(Object.entries({ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"}));get isReady(){return this.source.readyState>2}get isPlaying(){return!this.source.paused&&!this.source.ended&&this.isReady}get duration(){return this.source.duration}get seeking(){return this.source.seeking}get currentTime(){return this.source.currentTime}set currentTime(e){this.source.currentTime=e}_spf=0;_autoPlay=!1;_sourceLoad;_nextTime=0;_connected=!1;_requestId;_resolve;_reject;constructor(e,t){const r=hf(t);if(!Uo(e)){typeof e=="string"&&(e=[e]);const i=e[0].src||e[0],n=document.createElement("video");r.autoLoad&&n.setAttribute("preload","auto"),r.playsinline&&(n.setAttribute("webkit-playsinline",""),n.setAttribute("playsinline","")),r.muted&&(n.setAttribute("muted",""),n.muted=!0),r.loop&&n.setAttribute("loop",""),r.autoPlay&&n.setAttribute("autoplay",""),$o(n,i,r.crossorigin);for(let o=0;o<e.length;++o){let{src:a,mime:l}=e[o];if(a=a||e[o],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),u=h.slice(h.lastIndexOf(".")+1);l=l||gc.mimeTypes.get(u)||`video/${u}`}const c=document.createElement("source");c.src=a,l&&(c.type=l),n.appendChild(c)}e=n}super(e),this.fps=r.fps,this._autoPlay=r.autoPlay,r.autoPlay&&this.load(),this._setupAutoUpdate()}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"fps":this._spf=t?Math.floor(1e3/t):0,this._setupAutoUpdate();break;case"autoUpdate":this._setupAutoUpdate();break}}_onPlayStart=()=>{this.isValid()||this._onCanPlay(),this._setupAutoUpdate()};_onPlayStop=()=>{this._setupAutoUpdate()};_onCanPlay=()=>{const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.isValid();this._nextTime=0,this._updateSize(),this.requestUpload(),this._nextTime=0,!t&&this._resolve&&(this._resolve(this),this._sourceLoad=void 0,this._resolve=void 0,this._reject=void 0),this.isPlaying?this._onPlayStart():this._autoPlay&&e.play()};_onError=e=>{this.source.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=void 0,this._resolve=void 0)};_onSeeked=()=>{this.autoUpdate&&!this.isPlaying&&(this._nextTime=0,this.requestUpload(),this._nextTime=0)};_setupAutoUpdate(){this.autoUpdate&&this.isPlaying?!this.fps&&this.source.requestVideoFrameCallback?(this._connected&&(Ce.off(this.requestUpload),this._connected=!1,this._nextTime=0),this._requestId===void 0&&(this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected||(Ce.on(this.requestUpload),this._connected=!0,this._nextTime=0)):(this._requestId!==void 0&&(this.source.cancelVideoFrameCallback(this._requestId),this._requestId=void 0),this._connected&&(Ce.off(this.requestUpload),this._connected=!1,this._nextTime=0))}_videoFrameRequestCallback=()=>{this.requestUpload(),this._requestId=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)};requestUpload=()=>{const e=Math.floor(Ce.elapsed*this.source.playbackRate);this._nextTime-=e,(!this._spf||this._nextTime<=0)&&(super.requestUpload(),this._nextTime=this._spf||0)};async load(){if(!this._sourceLoad){const e=this.source;(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this.isReady?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._sourceLoad=new Promise((t,r)=>{this.isValid()?(this._sourceLoad=void 0,t(this)):(this._resolve=t,this._reject=r,e.load())})}return this._sourceLoad}destroy(){this._setupAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load())}};za([_({internal:!0,fallback:!0})],Js.prototype,"autoUpdate"),za([_({internal:!0,fallback:0})],Js.prototype,"fps");let Va=Js;class Qs extends Zs{}class Ga extends ge{fillStyle;strokeStyle;strokeAlignment;lineCap;lineJoin;lineWidth;miterLimit;uvTransform;vertTransform;_draws=[];_parseDrawStyle(e){return e?e instanceof le?{texture:e}:{backgroundColor:new Qe(e).toInt8Array()}:{}}stroke(e){if(!this.curves.length)return;let t=this.strokeStyle;if(!t&&this.style.stroke)switch(typeof this.style.stroke){case"string":t=this.style.stroke;break;case"object":xs(this.style.stroke)&&(t=this.style.stroke.color);break}this._draws.push({...e,...this._parseDrawStyle(t),type:"stroke",path:new ge(this),uvTransform:this.uvTransform,vertTransform:this.vertTransform,lineStyle:{alignment:this.strokeAlignment??.5,cap:this.lineCap??"butt",join:this.lineJoin??"miter",width:this.lineWidth??1,miterLimit:this.miterLimit??10}}),this.resetStatus()}fillRect(e,t,r,i){this.rect(e,t,r,i).fill()}strokeRect(e,t,r,i){this.rect(e,t,r,i).stroke()}fill(e){if(!this.curves.length)return;let t=this.fillStyle;if(!t&&this.style.fill)switch(typeof this.style.fill){case"string":t=this.style.fill;break;case"object":xs(this.style.fill)&&(t=this.style.fill.color);break}this._draws.push({...e,...this._parseDrawStyle(t),type:"fill",path:new ge(this),uvTransform:this.uvTransform,vertTransform:this.vertTransform}),this.resetStatus()}copy(e){return super.copy(e),this.strokeStyle=e.strokeStyle,this.fillStyle=e.fillStyle,this.uvTransform=e.uvTransform,this.vertTransform=e.vertTransform,this.strokeAlignment=e.strokeAlignment,this.lineCap=e.lineCap,this.lineJoin=e.lineJoin,this.lineWidth=e.lineWidth,this.miterLimit=e.miterLimit,this._draws=e._draws.slice(),this}resetStatus(){super.reset(),this.strokeStyle=void 0,this.fillStyle=void 0,this.uvTransform=void 0,this.vertTransform=void 0,this.strokeAlignment=void 0,this.lineCap=void 0,this.lineJoin=void 0,this.lineWidth=void 0,this.miterLimit=void 0}reset(){return this.resetStatus(),this._draws.length=0,this}buildUvs(e,t,r,i,n){if(i){const o=i.width,a=i.height;for(let l=t.length,c=e;c<l;c+=2){const h=t[c],u=t[c+1];let d,g;n?[d,g]=n.apply({x:h,y:u}).toArray():[d,g]=[h/o,u/a],r.push(d,g)}}else for(let o=t.length,a=e;a<o;a+=2)r.push(0,0)}toBatchables(){const e=[];for(let t=this._draws.length,r=0;r<t;r++){const i=this._draws[r],n=[],o=[],a=[];i.type==="fill"?i.path.fillTriangulate({vertices:n,indices:o}):i.path.strokeTriangulate({vertices:n,indices:o,lineStyle:i.lineStyle,flipAlignment:!1,closed:!0}),i.texture&&this.buildUvs(0,n,a,i.texture,i.uvTransform);const l=i.path.getBoundingBox();e.push({vertices:new Float32Array(n),indices:new Float32Array(o),uvs:new Float32Array(a),texture:i.texture,backgroundColor:i.backgroundColor,type:i.type,disableWrapMode:i.disableWrapMode,uvTransform:i.uvTransform,vertTransform:i.vertTransform,dimension:new Float32Array([l.width,l.height])})}return e}}class uf{front=[];default=[];back=[];get internal(){return this.getInternal()}constructor(...e){this.set(e)}set(e){return this.front.length=0,this.default.length=0,this.back.length=0,e.forEach(t=>{switch(t.internalMode){case"front":this.front.push(t);break;case"default":this.default.push(t);break;case"back":this.back.push(t);break}}),this}getInternal(e){if(e)switch(e){case"front":return this.front;case"default":return this.default;case"back":return this.back;default:throw new Error(`Unknown internal mode: ${e}`)}else return[...this.front,...this.default,...this.back]}toJSON(){return[...this.default]}}class ja extends xt{constructor(e){return super(),this.parent=e,new Proxy(this,{get:(t,r,i)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.get(t,r,i):t.getProperty(String(r)),set:(t,r,i,n)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.set(t,r,i,n):(t.setProperty(String(r),i),!0),deleteProperty:(t,r)=>Reflect.has(t,r)||String(r).startsWith("_")?Reflect.deleteProperty(t,r):(t.setProperty(String(r),void 0),!0)})}getPropertyDeclarations(){const e=new Map;return this._properties.forEach((t,r)=>{e.set(r,{internalKey:`____${r}`})}),e}getPropertyDeclaration(e){return{internalKey:`____${e}`}}}var ff=Object.defineProperty,df=Object.getOwnPropertyDescriptor,Et=(s,e,t,r)=>{for(var i=r>1?void 0:r?df(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ff(e,t,i),i};const Wa={};function pf(s){let e=Wa[s]??0;return e++,Wa[s]=e,e}f.Node=class extends xt{_meta=new ja(this);get meta(){return this._meta}set meta(e){this._meta.resetProperties().setProperties(e)}_readyed=!1;constructor(e,t=[]){super(),this._onTreeEnter=this._onTreeEnter.bind(this),this._onTreeExit=this._onTreeExit.bind(this),this._onParented=this._onParented.bind(this),this._onUnparented=this._onUnparented.bind(this),this._onReady=this._onReady.bind(this),this._onProcess=this._onProcess.bind(this),this.setProperties({name:`${this.is}:${pf(this.is)}`,...e}).append(t),this.on("treeEnter",this._onTreeEnter).on("treeExit",this._onTreeExit).on("parented",this._onParented).on("unparented",this._onUnparented).on("ready",this._onReady).on("process",this._onProcess)}setProperties(e){if(e){const{meta:t,...r}=e;t&&(this.meta=t),super.setProperties(r)}return this}getName(){return this.name}setName(e){return this.name=e,this}_tree;get tree(){return this.getTree()}set tree(e){this.setTree(e)}getTree(){return this._tree}getViewport(){return this.parent?.getViewport()??this.getWindow()}getWindow(){return this._tree?.root}isInsideTree(){return!!this._tree}setTree(e){const t=this._tree;if(!e?.equal(t)){t&&this.emit("treeExit",t),this._tree=e,e&&this.emit("treeEnter",e);const r=this._children.internal;for(let i=r.length,n=0;n<i;n++){const o=r[n];!e&&this.emit("childExitingTree",o),o.setTree(e),e&&this.emit("childEnteredTree",o)}e&&(this.emit("treePostEnter",e),this._readyed||(this._readyed=!0,this.emit("ready")))}return this}_parent;get parent(){return this._parent}set parent(e){this.setParent(e)}hasParent(){return!!this._parent}getParent(){return this._parent}setParent(e){if(!this._parent?.equal(e)){const t=this._parent;t&&this.emit("unparented",t),this._parent=e,e&&this.emit("parented",e),this.setTree(e?._tree)}return this}_children=new uf;get children(){return this._children.default}set children(e){this._children.set(e)}getChildren(e="default"){return this._children.getInternal(e===!0?void 0:e)}getChild(e=0){return this.children[e]}get siblingIndex(){return this.getIndex()}set siblingIndex(e){this._parent?.moveChild(this,e)}get previousSibling(){return this._parent?.children[this.getIndex()-1]}get nextSibling(){return this._parent?.children[this.getIndex()+1]}get firstSibling(){return this._parent?.children[0]}get lastSibling(){const e=this._parent?.children;return e?e[e.length-1]:void 0}canProcess(){if(!this._tree)return!1;switch(this.processMode){case"inherit":return this._parent?.canProcess()??!0;case"pausable":return!this._tree.processPaused;case"when_paused":return this._tree.processPaused;case"always":return!0;case"disabled":default:return!1}}canInput(){if(!this._tree)return!1;switch(this.inputMode){case"inherit":return this._parent?.canInput()??!0;case"always":return!0;case"disabled":default:return!1}}canRender(){if(!this._tree)return!1;switch(this.renderMode){case"inherit":return this._parent?.canRender()??!0;case"always":return!0;case"disabled":default:return!1}}_onTreeEnter(e){this._treeEnter(e),this.emit("treeEntered",e)}_onTreeExit(e){this.emit("treeExiting",e),this._treeExit(e),this.emit("treeExited",e)}_onParented(e){this._parented(e)}_onUnparented(e){this._unparented(e)}_onReady(){this._ready()}_onProcess(e=0){const t=this._tree,r=this.canRender(),i=this.canProcess(),n=[],o=[];this._children.internal.forEach(l=>{switch(l.processSortMode){case"default":o.push(l);break;case"parent_before":n.push(l);break}}),n.forEach(l=>{l.emit("process",e)}),i&&(t?.emit("nodeProcessing",this),this.emit("processing",e),this._process(e));let a;if(r){const l=t.renderStack.push(this);a=t.renderStack.currentCall,t.renderStack.currentCall=l}if(this.mask instanceof f.Node)this.getNode("__$mask")||(this.mask.processMode="disabled",this.appendChild(this.mask,"front"));else{const l=this.getNode("__$mask");l&&this.removeChild(l)}o.forEach(l=>{l.emit("process",e)}),r&&(t.renderStack.currentCall=a),i&&(this.emit("processed",e),t?.emit("nodeProcessed",this))}render(e,t){const r=this.mask;r&&(e.flush(),e.mask.push(this,r)),this._render(e),t?.(),r&&(e.flush(),e.mask.pop(this))}input(e,t){if(e.propagationStopped)return;const r=this._children.internal;for(let i=r.length-1;i>=0;i--)r[i].input(e,t);e.propagationStopped||this.canInput()&&this._input(e,t)}getIndex(){return this._parent?.getChildren(this.internalMode).indexOf(this)??0}getNode(e){return this._children.internal.find(t=>t.name===e)}removeNode(e){this.getNode(e)?.remove()}addSibling(e){return this.equal(e)||!this.hasParent()||e.hasParent()?this:(e.internalMode=this.internalMode,this._parent.moveChild(e,this.getIndex()+1),this)}prepend(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this.moveChild(r,0)})}append(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this.appendChild(r)})}before(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this._parent?.moveChild(r,this.getIndex())})}after(...e){let t;Array.isArray(e[0])?t=e[0]:t=e,t.forEach(r=>{this._parent?.moveChild(r,this.getIndex()+1)})}insertBefore(e,t){return!t.hasParent()||!this.equal(t.parent)||this.moveChild(e,t.getIndex()),e}appendChild(e,t=e.internalMode){if(this.equal(e)||e.hasParent())return e;switch(t){case"front":this._children.front.push(e);break;case"default":this._children.default.push(e);break;case"back":this._children.back.push(e);break}return e.internalMode!==t&&(e.internalMode=t),e.setParent(this),this.emit("appendChild",e),e}moveChild(e,t,r=e.internalMode){if(this.equal(e)||e.hasParent()&&!this.equal(e.parent))return this;const i=this._children.getInternal(e.internalMode),n=i.indexOf(e),o=this._children.getInternal(r);return(e.internalMode!==r||t!==n)&&(n>-1&&i.splice(n,1),e.setParent(this),t>-1&&t<o.length?o.splice(t,0,e):o.push(e),n>-1?this.emit("moveChild",e,t,n):this.emit("appendChild",e)),e.internalMode!==r&&(e.internalMode=r),this}removeChild(e){const t=e.getIndex();return this.equal(e.parent)&&t>-1&&(this.getChildren(e.internalMode).splice(t,1),e.setParent(void 0),this.emit("removeChild",e,t)),e}removeChildren(){this.children.forEach(e=>this.removeChild(e))}remove(){this._parent?.removeChild(this)}findOne(e){for(const t of this._children.default){if(e(t))return t;const r=t.findOne(e);if(r)return r}}findAll(e){const t=[];for(const r of this._children.default)e(r)&&t.push(r),t.push(...r.findAll(e));return t}findAncestor(e){const t=this._parent;if(t){if(e(t))return t;const r=t.findAncestor(e);if(r)return r}}_ready(){}_treeEnter(e){}_treeExit(e){}_parented(e){}_unparented(e){}_process(e){}_input(e,t){}_render(e){}destroy(){super.destroy(),this._children.internal.forEach(e=>this.removeChild(e))}clone(){return new this.constructor(this.toJSON(),this._children.internal)}toJSON(){return Ve({...super.toJSON(),children:this.children.length?[...this.children.map(e=>e.toJSON())]:void 0,meta:{...this.meta.toJSON(),inCanvasIs:this.is}})}static parse(e){if(Array.isArray(e))return e.map(l=>this.parse(l));const{meta:t={},children:r,...i}=e,{inCanvasIs:n="Node"}=t,o=xi.get(n)??f.Node,a=new o({...i,meta:t});return r?.forEach(l=>a.appendChild(this.parse(l))),a}},Et([_({fallback:bo()})],f.Node.prototype,"id",2),Et([_({fallback:bo()})],f.Node.prototype,"name",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"processMode",2),Et([_({internal:!0,fallback:"default"})],f.Node.prototype,"processSortMode",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"renderMode",2),Et([_({internal:!0,fallback:"inherit"})],f.Node.prototype,"inputMode",2),Et([_({internal:!0,fallback:"default"})],f.Node.prototype,"internalMode",2),Et([_({internal:!0})],f.Node.prototype,"mask",2),f.Node=Et([X("Node")],f.Node);var gf=Object.defineProperty,mf=Object.getOwnPropertyDescriptor,gr=(s,e,t,r)=>{for(var i=r>1?void 0:r?mf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&gf(e,t,i),i};f.TimelineNode=class extends f.Node{constructor(e,t=[]){super(),this.setProperties(e).append(t)}computedDuration=0;_currentTime=0;_startTime=0;get timeline(){return this._tree?.timeline}get timelineCurrentTime(){return this.timeline?.currentTime??0}get parentStartTime(){return this._parent?.startTime??0}get currentTime(){return ut(this._currentTime,0,this.computedDuration)}get startTime(){return this._startTime}set startTime(e){this.delay=e-this.parentStartTime,this._updateCurrentTime(!0)}get endTime(){return this._startTime+this.computedDuration}get currentTimeProgress(){return this.computedDuration?ut(this._currentTime/this.computedDuration,0,1):0}isInsideTimeRange(){const e=this._currentTime;return this.computedDuration?e>=0&&e<=this.computedDuration:e>=0}_updateCurrentTime(e=!1){if(e||!this.paused){const t=this._parent,r=this.delay+this.parentStartTime,i=t?.computedDuration?Math.min(r+this.duration,t.endTime)-r:this.duration;let n=this.timelineCurrentTime-r;this.loop&&(n=n%i),this._startTime=r,this._currentTime=n,this.computedDuration=i,this.emit("updateCurrentTime",this._currentTime),this.insideTimeRange=this.isInsideTimeRange()}}_process(e){super._process(e),this._updateCurrentTime()}},gr([_({fallback:!1})],f.TimelineNode.prototype,"loop",2),gr([_({fallback:0})],f.TimelineNode.prototype,"delay",2),gr([_({fallback:0})],f.TimelineNode.prototype,"duration",2),gr([_({fallback:!1})],f.TimelineNode.prototype,"paused",2),gr([_({internal:!0,fallback:!1})],f.TimelineNode.prototype,"insideTimeRange",2),f.TimelineNode=gr([X("TimelineNode")],f.TimelineNode);var yf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,Vr=(s,e,t,r)=>{for(var i=r>1?void 0:r?vf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&yf(e,t,i),i};f.CanvasItem=class extends f.TimelineNode{_parentGlobalVisible;_globalVisible;get globalVisible(){return this._globalVisible??!0}_parentGlobalOpacity;_globalOpacity;get globalOpacity(){return this._globalOpacity??1}_modulate=new Qe(4294967295);context=new Ga;_resetContext=!0;_redrawing=!0;_relayouting=!1;_repainting=!1;_originalBatchables=[];_layoutedBatchables=[];_batchables=[];constructor(e,t=[]){super(),this.setProperties(e).append(t)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"modulate":this._modulate.value=t,this.requestRepaint();break;case"blendMode":this.requestRepaint();break;case"opacity":this._updateGlobalOpacity();break;case"visible":case"insideTimeRange":this._updateGlobalVisible();break}}show(){this.visible=!0}hide(){this.visible=!1}isVisibleInTree(){return this.globalOpacity>0&&this.globalVisible}canRender(){return super.canRender()&&this.isVisibleInTree()}requestRedraw(){this._redrawing=!0}requestRelayout(){this._relayouting=!0}requestRepaint(){this._repainting=!0}_updateGlobalVisible(){this._parentGlobalVisible=this.getParent()?.globalVisible,this._globalVisible=(this._parentGlobalVisible??!0)&&this.visible&&this.insideTimeRange}_updateGlobalOpacity(){this._parentGlobalOpacity=this.getParent()?.opacity;const e=ut(this.opacity,0,1)*(this._parentGlobalOpacity??1);this._globalOpacity!==e&&(this._globalOpacity=e,this.requestRepaint())}_draw(){this.emit("draw")}_redraw(){return this._tree?.log(this.name,"drawing"),this._draw(),this.context.toBatchables()}_relayout(e){return this._tree?.log(this.name,"layouting"),e}_repaint(e){this._tree?.log(this.name,"painting");const t=this.globalOpacity;return e.map(r=>({...r,modulate:this._modulate.toInt8Array().map(i=>i*t),blendMode:this.blendMode}))}_process(e){super._process(e);const t=this.getParent();this._parentGlobalVisible!==t?.globalVisible&&this._updateGlobalVisible(),this._parentGlobalOpacity!==t?.globalOpacity&&this._updateGlobalOpacity()}_updateBatchables(){const e=this._redrawing;let t=this._relayouting,r=this._repainting,i;e&&(this._originalBatchables=this._redraw(),t=!0),t&&(this._layoutedBatchables=this._relayout(this._originalBatchables),r=!0),r&&(i=this._repaint(this._layoutedBatchables)),e&&this._resetContext&&this.context.reset(),i&&(this._batchables=i,this._redrawing=!1,this._relayouting=!1,this._repainting=!1)}_render(e){this._updateBatchables(),this._batchables.forEach(t=>{t.texture?.upload(e),e.batch2D.render({...t,texture:t.texture?._glTexture(e)})}),super._render(e)}},Vr([_()],f.CanvasItem.prototype,"modulate",2),Vr([_()],f.CanvasItem.prototype,"blendMode",2),Vr([_({internal:!0,fallback:!0})],f.CanvasItem.prototype,"visible",2),Vr([_({internal:!0,fallback:1})],f.CanvasItem.prototype,"opacity",2),f.CanvasItem=Vr([X("CanvasItem")],f.CanvasItem);var _f=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,mr=(s,e,t,r)=>{for(var i=r>1?void 0:r?bf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_f(e,t,i),i};f.Viewport=class extends f.Node{constructor(e=!1){super(),this.flipY=e,this.projection.flipY(e)}projection=new Yo;canvasTransform=new ke;_framebufferIndex=0;_framebuffers=[{texture:new Qs,needsUpload:!1},{texture:new Qs,needsUpload:!1}];get valid(){return!!(this.width&&this.height)}get framebuffer(){return this._framebuffers[this._framebufferIndex]}get texture(){return this.framebuffer.texture}getViewport(){return this}_glFramebufferOptions(e){const{width:t,height:r}=this,{pixelRatio:i}=e;return this._framebuffers.forEach(n=>{const o=n.texture;o.width=t,o.height=r,o.pixelRatio=i,o.upload(e)}),{width:t,height:r,msaa:this.msaa,colorTextures:[this.texture._glTexture(e)]}}_glFramebuffer(e){return e.getRelated(this.framebuffer,()=>e.framebuffer.create(this._glFramebufferOptions(e)))}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"x":case"y":this.requestUpload(),this.projection.translate(this.x,this.y),this.emit("updateRect");break;case"width":case"height":this.requestUpload(),this.projection.resize(this.width,this.height),this.emit("updateRect");break;case"msaa":this.requestUpload();break}}requestUpload(){this._framebuffers.forEach(e=>e.needsUpload=!0)}resize(e,t){this.width=e,this.height=t}upload(e){const t=this.framebuffer;return t.needsUpload&&this.valid?(t.needsUpload=!1,e.framebuffer.update(this._glFramebuffer(e),this._glFramebufferOptions(e)),!0):!1}activate(e){return this.valid?(e.flush(),this._tree?.setCurrentViewport(this),this.upload(e),e.framebuffer.bind(this._glFramebuffer(e)),!0):!1}redraw(e,t){if(this.valid){e.flush();const r=this.framebuffer.texture;return this._framebufferIndex=(this._framebufferIndex+1)%this._framebuffers.length,this.activate(e),e.clear(),r.activate(e,0),t(),!0}return!1}activateWithCopy(e,t){this.resize(t.width,t.height),this.activate(e)&&(e.clear(),t.texture.activate(e,0),Q.draw(e,$r.instance,{sampler:0}))}render(e,t){const r=this._tree?.getCurrentViewport();e.program.uniforms.projectionMatrix=this.projection.toArray(!0),e.program.uniforms.viewMatrix=this.canvasTransform.toArray(!0),this.activate(e),e.clear(),super.render(e,t),e.flush(),r?r.activate(e):(e.framebuffer.bind(null),this._tree?.setCurrentViewport(void 0))}getRect(){return new It(this.x,this.y,this.width,this.height)}toCanvasGlobal(e,t){return this.canvasTransform.applyAffineInverse(e,t)}toCanvasScreen(e,t){return this.canvasTransform.apply(e,t)}},mr([_({fallback:0})],f.Viewport.prototype,"x",2),mr([_({fallback:0})],f.Viewport.prototype,"y",2),mr([_({fallback:0})],f.Viewport.prototype,"width",2),mr([_({fallback:0})],f.Viewport.prototype,"height",2),mr([_({internal:!0,fallback:!1})],f.Viewport.prototype,"msaa",2),f.Viewport=mr([X("Viewport")],f.Viewport);var wf=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,Gr=(s,e,t,r)=>{for(var i=r>1?void 0:r?xf(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&wf(e,t,i),i};f.Effect=class extends f.TimelineNode{material;get _effectMode(){return this.effectMode??"parent"}viewport1=new f.Viewport;viewport2=new f.Viewport;_renderId=0;_renderViewport;_previousSibling;_nextSibling;constructor(e,t=[]){super(),this._onProcessing=this._onProcessing.bind(this),this._onNodeProcessed=this._onNodeProcessed.bind(this),this.setProperties(e).append(t)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"glsl":{const i=new Nr(t);!this.effectMode&&i.has.transition&&(this.effectMode="transition"),this.material=i;break}case"glslSrc":{t?Ke.text.load(t).then(i=>this.glsl=i):this.glsl="";break}}}_treeEnter(e){e.on("processing",this._onProcessing),e.on("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(e),this.viewport2.setTree(e)}_treeExit(e){e.off("processing",this._onProcessing),e.off("nodeProcessed",this._onNodeProcessed),this.viewport1.setTree(void 0),this.viewport2.setTree(void 0)}_onProcessing(){if(this.canProcess())switch(this._updateCurrentTime(),this._effectMode){case"transition":this._previousSibling=this.previousSibling,this._nextSibling=this.nextSibling;break;default:this._previousSibling=void 0,this._nextSibling=void 0;break}}_onNodeProcessed(e){if(!this.canProcess()||!this.isInsideTimeRange())return;const t=this._tree?.renderStack;if(t)switch(this._effectMode){case"transition":e.equal(this._previousSibling)?(this._previousSibling=void 0,t.push(this)):e.equal(this._nextSibling)&&(this._nextSibling=void 0,t.push(this));break}}_processParent(){const e=this._tree?.renderStack;if(!e)return;const t=e.currentCall?.parentCall;if(!t)return;const r=t.calls;let i,n;r.forEach((o,a)=>{(o.renderable.equal(this._parent)||o.renderable.parent?.equal(this._parent))&&(i=i??a,n=a)}),!(i===void 0||n===void 0)&&(r.splice(n+1,0,e.createCall(this)),r.splice(i,0,e.createCall(this)))}_processChildren(){this.children.length&&(super.emit("process"),this._tree?.renderStack.push(this))}_onProcess(e=0){if(this.canProcess())switch(this._renderId=0,this._effectMode){case"before":super._onProcess(e);break;case"parent":this._processParent();break;case"children":this._processChildren();break}}_renderBefore(e){const t=this._tree?.getCurrentViewport();t&&this.apply(e,t,{redraw:!0})}_renderTransition(e){if(this._renderId%2===0)this._renderViewport=this._tree?.getCurrentViewport(),this._renderViewport&&(this.viewport1.activateWithCopy(e,this._renderViewport),this.viewport2.resize(this._renderViewport.width,this._renderViewport.height)),this.viewport2.activate(e),e.clear();else{const t=this._renderViewport;this._renderViewport=void 0,t&&(t.activate(e),e.clear(),this.viewport1.texture.activate(e,0),this.viewport2.texture.activate(e,1),this.apply(e,t,{from:this.viewport1,to:this.viewport2}),e.texture.unbind(0),e.texture.unbind(1))}}_renderParentOrChildren(e){if(this._renderId%2===0)this._renderViewport=this._tree?.getCurrentViewport(),this._renderViewport&&this.viewport1.resize(this._renderViewport.width,this._renderViewport.height),this.viewport1.activate(e),e.clear();else{const t=this._renderViewport;this._renderViewport=void 0,t&&(this.viewport1.activate(e),this.apply(e,this.viewport1,{redraw:!0,target:this._effectMode==="parent"?this._parent??void 0:void 0,targetArea:this._parseTargetArea()}),t.activate(e),this.viewport1.texture.activate(e,0),Q.draw(e))}}_parseTargetArea(){if(this._effectMode==="parent"&&this._parent&&"getRect"in this._parent){const e=this._parent.getRect();if(e)return[e.left/this.viewport1.width,e.top/this.viewport1.height,e.width/this.viewport1.width,e.height/this.viewport1.height]}}_render(e){switch(this._effectMode){case"before":this._renderBefore(e);break;case"transition":this._renderTransition(e);break;case"parent":case"children":default:this._renderParentOrChildren(e);break}this._renderId++}apply(e,t,r){this.material&&(r?.redraw?t.redraw(e,()=>{Q.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:t.width/t.height})}):Q.draw(e,this.material,{from:0,to:1,progress:this.currentTimeProgress,ratio:r?.from?r.from.width/r.from.height:0}))}},Gr([_({internal:!0})],f.Effect.prototype,"material",2),Gr([_()],f.Effect.prototype,"effectMode",2),Gr([_()],f.Effect.prototype,"glsl",2),Gr([_()],f.Effect.prototype,"glslSrc",2),f.Effect=Gr([X("Effect")],f.Effect);var Te=Uint8Array,je=Uint16Array,en=Int32Array,Bi=new Te([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Li=new Te([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),tn=new Te([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qa=function(s,e){for(var t=new je(31),r=0;r<31;++r)t[r]=e+=1<<s[r-1];for(var i=new en(t[30]),r=1;r<30;++r)for(var n=t[r];n<t[r+1];++n)i[n]=n-t[r]<<5|r;return{b:t,r:i}},Xa=qa(Bi,2),Ha=Xa.b,rn=Xa.r;Ha[28]=258,rn[258]=28;for(var Ya=qa(Li,0),Pf=Ya.b,Ka=Ya.r,sn=new je(32768),te=0;te<32768;++te){var Ut=(te&43690)>>1|(te&21845)<<1;Ut=(Ut&52428)>>2|(Ut&13107)<<2,Ut=(Ut&61680)>>4|(Ut&3855)<<4,sn[te]=((Ut&65280)>>8|(Ut&255)<<8)>>1}for(var pt=(function(s,e,t){for(var r=s.length,i=0,n=new je(e);i<r;++i)s[i]&&++n[s[i]-1];var o=new je(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var a;if(t){a=new je(1<<e);var l=15-e;for(i=0;i<r;++i)if(s[i])for(var c=i<<4|s[i],h=e-s[i],u=o[s[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[sn[u]>>l]=c}else for(a=new je(r),i=0;i<r;++i)s[i]&&(a[i]=sn[o[s[i]-1]++]>>15-s[i]);return a}),Bt=new Te(288),te=0;te<144;++te)Bt[te]=8;for(var te=144;te<256;++te)Bt[te]=9;for(var te=256;te<280;++te)Bt[te]=7;for(var te=280;te<288;++te)Bt[te]=8;for(var jr=new Te(32),te=0;te<32;++te)jr[te]=5;var Cf=pt(Bt,9,0),Tf=pt(Bt,9,1),Sf=pt(jr,5,0),Ef=pt(jr,5,1),nn=function(s){for(var e=s[0],t=1;t<s.length;++t)s[t]>e&&(e=s[t]);return e},tt=function(s,e,t){var r=e/8|0;return(s[r]|s[r+1]<<8)>>(e&7)&t},on=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},an=function(s){return(s+7)/8|0},Za=function(s,e,t){return(t==null||t>s.length)&&(t=s.length),new Te(s.subarray(e,t))},Mf=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],rt=function(s,e,t){var r=new Error(e||Mf[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,rt),!t)throw r;return r},Af=function(s,e,t,r){var i=s.length,n=0;if(!i||e.f&&!e.l)return t||new Te(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new Te(i*3));var c=function(Be){var $e=t.length;if(Be>$e){var Pe=new Te(Math.max($e*2,Be));Pe.set(t),t=Pe}},h=e.f||0,u=e.p||0,d=e.b||0,g=e.l,p=e.d,y=e.m,m=e.n,P=i*8;do{if(!g){h=tt(s,u,1);var E=tt(s,u+1,3);if(u+=3,E)if(E==1)g=Tf,p=Ef,y=9,m=5;else if(E==2){var x=tt(s,u,31)+257,T=tt(s,u+10,15)+4,C=x+tt(s,u+5,31)+1;u+=14;for(var L=new Te(C),G=new Te(19),U=0;U<T;++U)G[tn[U]]=tt(s,u+U*3,7);u+=T*3;for(var R=nn(G),z=(1<<R)-1,B=pt(G,R,1),U=0;U<C;){var D=B[tt(s,u,z)];u+=D&15;var b=D>>4;if(b<16)L[U++]=b;else{var H=0,I=0;for(b==16?(I=3+tt(s,u,3),u+=2,H=L[U-1]):b==17?(I=3+tt(s,u,7),u+=3):b==18&&(I=11+tt(s,u,127),u+=7);I--;)L[U++]=H}}var F=L.subarray(0,x),j=L.subarray(x);y=nn(F),m=nn(j),g=pt(F,y,1),p=pt(j,m,1)}else rt(1);else{var b=an(u)+4,S=s[b-4]|s[b-3]<<8,w=b+S;if(w>i){l&&rt(0);break}a&&c(d+S),t.set(s.subarray(b,w),d),e.b=d+=S,e.p=u=w*8,e.f=h;continue}if(u>P){l&&rt(0);break}}a&&c(d+131072);for(var O=(1<<y)-1,$=(1<<m)-1,A=u;;A=u){var H=g[on(s,u)&O],M=H>>4;if(u+=H&15,u>P){l&&rt(0);break}if(H||rt(2),M<256)t[d++]=M;else if(M==256){A=u,g=null;break}else{var N=M-254;if(M>264){var U=M-257,V=Bi[U];N=tt(s,u,(1<<V)-1)+Ha[U],u+=V}var Y=p[on(s,u)&$],J=Y>>4;Y||rt(3),u+=Y&15;var j=Pf[J];if(J>3){var V=Li[J];j+=on(s,u)&(1<<V)-1,u+=V}if(u>P){l&&rt(0);break}a&&c(d+131072);var oe=d+N;if(d<j){var _t=n-j,Ze=Math.min(j,oe);for(_t+d<0&&rt(3);d<Ze;++d)t[d]=r[_t+d]}for(;d<oe;++d)t[d]=t[d-j]}}e.l=g,e.p=A,e.b=d,e.f=h,g&&(h=1,e.m=y,e.d=p,e.n=m)}while(!h);return d!=t.length&&o?Za(t,0,d):t.subarray(0,d)},Mt=function(s,e,t){t<<=e&7;var r=e/8|0;s[r]|=t,s[r+1]|=t>>8},Wr=function(s,e,t){t<<=e&7;var r=e/8|0;s[r]|=t,s[r+1]|=t>>8,s[r+2]|=t>>16},ln=function(s,e){for(var t=[],r=0;r<s.length;++r)s[r]&&t.push({s:r,f:s[r]});var i=t.length,n=t.slice();if(!i)return{t:tl,l:0};if(i==1){var o=new Te(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(w,x){return w.f-x.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,h=1,u=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=t[t[c].f<t[u].f?c++:u++],l=t[c!=h&&t[c].f<t[u].f?c++:u++],t[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var g=new je(d+1),p=cn(t[h-1],g,0);if(p>e){var r=0,y=0,m=p-e,P=1<<m;for(n.sort(function(x,T){return g[T.s]-g[x.s]||x.f-T.f});r<i;++r){var E=n[r].s;if(g[E]>e)y+=P-(1<<p-g[E]),g[E]=e;else break}for(y>>=m;y>0;){var b=n[r].s;g[b]<e?y-=1<<e-g[b]++-1:++r}for(;r>=0&&y;--r){var S=n[r].s;g[S]==e&&(--g[S],++y)}p=e}return{t:new Te(g),l:p}},cn=function(s,e,t){return s.s==-1?Math.max(cn(s.l,e,t+1),cn(s.r,e,t+1)):e[s.s]=t},Ja=function(s){for(var e=s.length;e&&!s[--e];);for(var t=new je(++e),r=0,i=s[0],n=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(s[a]==i&&a!=e)++n;else{if(!i&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(i),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(i);n=1,i=s[a]}return{c:t.subarray(0,r),n:e}},qr=function(s,e){for(var t=0,r=0;r<e.length;++r)t+=s[r]*e[r];return t},Qa=function(s,e,t){var r=t.length,i=an(e+2);s[i]=r&255,s[i+1]=r>>8,s[i+2]=s[i]^255,s[i+3]=s[i+1]^255;for(var n=0;n<r;++n)s[i+n+4]=t[n];return(i+4+r)*8},el=function(s,e,t,r,i,n,o,a,l,c,h){Mt(e,h++,t),++i[256];for(var u=ln(i,15),d=u.t,g=u.l,p=ln(n,15),y=p.t,m=p.l,P=Ja(d),E=P.c,b=P.n,S=Ja(y),w=S.c,x=S.n,T=new je(19),C=0;C<E.length;++C)++T[E[C]&31];for(var C=0;C<w.length;++C)++T[w[C]&31];for(var L=ln(T,7),G=L.t,U=L.l,R=19;R>4&&!G[tn[R-1]];--R);var z=c+5<<3,B=qr(i,Bt)+qr(n,jr)+o,D=qr(i,d)+qr(n,y)+o+14+3*R+qr(T,G)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&z<=B&&z<=D)return Qa(e,h,s.subarray(l,l+c));var H,I,F,j;if(Mt(e,h,1+(D<B)),h+=2,D<B){H=pt(d,g,0),I=d,F=pt(y,m,0),j=y;var O=pt(G,U,0);Mt(e,h,b-257),Mt(e,h+5,x-1),Mt(e,h+10,R-4),h+=14;for(var C=0;C<R;++C)Mt(e,h+3*C,G[tn[C]]);h+=3*R;for(var $=[E,w],A=0;A<2;++A)for(var M=$[A],C=0;C<M.length;++C){var N=M[C]&31;Mt(e,h,O[N]),h+=G[N],N>15&&(Mt(e,h,M[C]>>5&127),h+=M[C]>>12)}}else H=Cf,I=Bt,F=Sf,j=jr;for(var C=0;C<a;++C){var V=r[C];if(V>255){var N=V>>18&31;Wr(e,h,H[N+257]),h+=I[N+257],N>7&&(Mt(e,h,V>>23&31),h+=Bi[N]);var Y=V&31;Wr(e,h,F[Y]),h+=j[Y],Y>3&&(Wr(e,h,V>>5&8191),h+=Li[Y])}else Wr(e,h,H[V]),h+=I[V]}return Wr(e,h,H[256]),h+I[256]},Of=new en([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tl=new Te(0),kf=function(s,e,t,r,i,n){var o=n.z||s.length,a=new Te(r+o+5*(1+Math.ceil(o/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(e){h&&(l[0]=n.r>>3);for(var u=Of[e-1],d=u>>13,g=u&8191,p=(1<<t)-1,y=n.p||new je(32768),m=n.h||new je(p+1),P=Math.ceil(t/3),E=2*P,b=function(ze){return(s[ze]^s[ze+1]<<P^s[ze+2]<<E)&p},S=new en(25e3),w=new je(288),x=new je(32),T=0,C=0,L=n.i||0,G=0,U=n.w||0,R=0;L+2<o;++L){var z=b(L),B=L&32767,D=m[z];if(y[B]=D,m[z]=B,U<=L){var H=o-L;if((T>7e3||G>24576)&&(H>423||!c)){h=el(s,l,0,S,w,x,C,G,R,L-R,h),G=T=C=0,R=L;for(var I=0;I<286;++I)w[I]=0;for(var I=0;I<30;++I)x[I]=0}var F=2,j=0,O=g,$=B-D&32767;if(H>2&&z==b(L-$))for(var A=Math.min(d,H)-1,M=Math.min(32767,L),N=Math.min(258,H);$<=M&&--O&&B!=D;){if(s[L+F]==s[L+F-$]){for(var V=0;V<N&&s[L+V]==s[L+V-$];++V);if(V>F){if(F=V,j=$,V>A)break;for(var Y=Math.min($,V-2),J=0,I=0;I<Y;++I){var oe=L-$+I&32767,_t=y[oe],Ze=oe-_t&32767;Ze>J&&(J=Ze,D=oe)}}}B=D,D=y[B],$+=B-D&32767}if(j){S[G++]=268435456|rn[F]<<18|Ka[j];var Be=rn[F]&31,$e=Ka[j]&31;C+=Bi[Be]+Li[$e],++w[257+Be],++x[$e],U=L+F,++T}else S[G++]=s[L],++w[s[L]]}}for(L=Math.max(L,U);L<o;++L)S[G++]=s[L],++w[s[L]];h=el(s,l,c,S,w,x,C,G,R,L-R,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=m,n.p=y,n.i=L,n.w=U)}else{for(var L=n.w||0;L<o+c;L+=65535){var Pe=L+65535;Pe>=o&&(l[h/8|0]=c,Pe=o),h=Qa(l,h+1,s.subarray(L,Pe))}n.i=o}return Za(a,0,r+an(h)+i)},rl=function(){var s=1,e=0;return{p:function(t){for(var r=s,i=e,n=t.length|0,o=0;o!=n;){for(var a=Math.min(o+2655,n);o<a;++o)i+=r+=t[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}s=r,e=i},d:function(){return s%=65521,e%=65521,(s&255)<<24|(s&65280)<<8|(e&255)<<8|e>>8}}},Df=function(s,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new Te(n.length+s.length);o.set(n),o.set(s,n.length),s=o,i.w=n.length}return kf(s,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+e.mem,t,r,i)},il=function(s,e,t){for(;t;++e)s[e]=t,t>>>=8},If=function(s,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(s[0]=120,s[1]=r<<6|(e.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,e.dictionary){var i=rl();i.p(e.dictionary),il(s,2,i.d())}},Rf=function(s,e){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&rt(6,"invalid zlib data"),(s[1]>>5&1)==1&&rt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function Uf(s,e){e||(e={});var t=rl();t.p(s);var r=Df(s,e,e.dictionary?6:2,4);return If(r,e),il(r,r.length-4,t.d()),r}function Bf(s,e){return Af(s.subarray(Rf(s),-4),{i:2},e,e)}var Lf=typeof TextDecoder<"u"&&new TextDecoder,Ff=0;try{Lf.decode(tl,{stream:!0}),Ff=1}catch{}const Nf="modern-font";function Xr(s,e){if(!s)throw new Error(`[${Nf}] ${e}`)}function $f(s){if("buffer"in s){const e=s.buffer;return s.byteOffset>0||s.byteLength<s.buffer.byteLength?e.slice(s.byteOffset,s.byteOffset+s.byteLength):e}else return s}function yr(s){return"buffer"in s?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}function zf(s){let e="";for(let t=0,r=s.length,i;t<r;t++)i=s.charCodeAt(t),i!==0&&(e+=String.fromCharCode(i));return e}function Fi(s){s=zf(s);const e=[];for(let t=0,r=s.length,i;t<r;t++)i=s.charCodeAt(t),e.push(i>>8),e.push(i&255);return e}function Vf(s){let e="";for(let t=0,r=s.length;t<r;t++)s[t]<127?e+=String.fromCharCode(s[t]):e+=`%${(256+s[t]).toString(16).slice(1)}`;return unescape(e)}function Gf(s){let e="";for(let t=0,r=s.length;t<r;t+=2)e+=String.fromCharCode((s[t]<<8)+s[t+1]);return e}var jf=Object.defineProperty,Se=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&jf(e,t,i),i};const Hr={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function Ee(){return function(s,e){Object.defineProperty(s.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class me extends DataView{constructor(e,t,r,i){super($f(e),t,r),this.littleEndian=i}cursor=0;readColumn(e){if(e.size){const t=Array.from({length:e.size},(r,i)=>this.read(e.type,e.offset+i));switch(e.type){case"char":return t.join("");default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(r,i)=>{this.write(e.type,t[i],e.offset+i)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,r=this.littleEndian){switch(e){case"char":return this.readChar(t);case"fixed":return this.readFixed(t,r);case"longDateTime":return this.readLongDateTime(t,r)}const i=`get${e.replace(/^\S/,l=>l.toUpperCase())}`,n=this,a=n[i]?.bind(n)?.(t,r);return this.cursor+=Hr[e],a}readUint24(e=this.cursor){const[t,r,i]=this.readBytes(e,3);return(t<<16)+(r<<8)+i}readBytes(e,t){t==null&&(t=e,e=this.cursor);const r=[];for(let i=0;i<t;++i)r.push(this.getUint8(e+i));return this.cursor=e+t,r}readString(e,t){const r=this.readBytes(e,t);let i="";for(let n=0,o=r.length;n<o;n++)i+=String.fromCharCode(r[n]);return i}readFixed(e,t){const r=this.readInt32(e,t)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(e=this.cursor,t){const r=this.readUint32(e+4,t),i=new Date;return i.setTime(r*1e3+-20775456e5),i}readChar(e){return this.readString(e,1)}write(e,t,r=this.cursor,i=this.littleEndian){switch(e){case"char":return this.writeChar(t,r);case"fixed":return this.writeFixed(t,r);case"longDateTime":return this.writeLongDateTime(t,r)}const n=`set${e.replace(/^\S/,c=>c.toUpperCase())}`,o=this,l=o[n]?.bind(o)?.(r,t,i);return this.cursor+=Hr[e.toLowerCase()],l}writeString(e="",t=this.cursor){const r=e.replace(/[^\x00-\xFF]/g,"11").length;this.seek(t);for(let i=0,n=e.length,o;i<n;++i)o=e.charCodeAt(i)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){typeof e>"u"?e=-20775456e5:typeof e.getTime=="function"?e=e.getTime():/^\d+$/.test(e)?e=+e:e=Date.parse(e);const i=Math.round((e- -20775456e5)/1e3);return this.writeUint32(0,t),this.writeUint32(i,t+4),this}writeBytes(e,t=this.cursor){let r;if(Array.isArray(e)){r=e.length;for(let i=0;i<r;++i)this.setUint8(t+i,e[i])}else{const i=yr(e);r=i.byteLength;for(let n=0;n<r;++n)this.setUint8(t+n,i.getUint8(n))}return this.cursor=t+r,this}seek(e){return this.cursor=e,this}}Se([Ee()],me.prototype,"readInt8"),Se([Ee()],me.prototype,"readInt16"),Se([Ee()],me.prototype,"readInt32"),Se([Ee()],me.prototype,"readUint8"),Se([Ee()],me.prototype,"readUint16"),Se([Ee()],me.prototype,"readUint32"),Se([Ee()],me.prototype,"readFloat32"),Se([Ee()],me.prototype,"readFloat64"),Se([Ee()],me.prototype,"writeInt8"),Se([Ee()],me.prototype,"writeInt16"),Se([Ee()],me.prototype,"writeInt32"),Se([Ee()],me.prototype,"writeUint8"),Se([Ee()],me.prototype,"writeUint16"),Se([Ee()],me.prototype,"writeUint32"),Se([Ee()],me.prototype,"writeFloat32"),Se([Ee()],me.prototype,"writeFloat64");const sl=new WeakMap;function v(s){const e=typeof s=="object"?s:{type:s},{size:t=1,type:r}=e;return(i,n)=>{if(typeof n!="string")return;let o=sl.get(i);o||(o={columns:[],byteLength:0},sl.set(i,o));const a={...e,name:n,byteLength:t*Hr[r],offset:e.offset??o.columns.reduce((l,c)=>l+c.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((l,c)=>l+Hr[c.type]*(c.size??1),0),Object.defineProperty(i.constructor.prototype,n,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class We{view;constructor(e,t,r,i){this.view=new me(e,t,r,i)}}class Ni extends We{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Wf=Object.defineProperty,De=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Wf(e,t,i),i};const Ie=class mc extends Ni{format="EmbeddedOpenType";mimeType="application/vnd.ms-fontobject";static from(e){const t=e.sfnt,i=t.name.names,n=Fi(i.fontFamily||""),o=n.length,a=Fi(i.fontStyle||""),l=a.length,c=Fi(i.version||""),h=c.length,u=Fi(i.fullName||""),d=u.length,g=86+o+4+l+4+h+4+d+2+e.view.byteLength,p=new mc(new ArrayBuffer(g),0,g,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=e.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=t.head.checkSumAdjustment;const y=t.os2;return y&&(p.FontPANOSE=y.fontPANOSE,p.Italic=y.fsSelection,p.Weight=y.usWeightClass,p.fsType=y.fsType,p.UnicodeRange=y.ulUnicodeRange,p.CodePageRange=y.ulCodePageRange),p.view.writeUint16(o),p.view.writeBytes(n),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(a),p.view.writeUint16(0),p.view.writeUint16(h),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(e.view),p}};De([v("uint32")],Ie.prototype,"EOTSize"),De([v("uint32")],Ie.prototype,"FontDataSize"),De([v("uint32")],Ie.prototype,"Version"),De([v("uint32")],Ie.prototype,"Flags"),De([v({type:"uint8",size:10})],Ie.prototype,"FontPANOSE"),De([v("uint8")],Ie.prototype,"Charset"),De([v("uint8")],Ie.prototype,"Italic"),De([v("uint32")],Ie.prototype,"Weight"),De([v("uint16")],Ie.prototype,"fsType"),De([v("uint16")],Ie.prototype,"MagicNumber"),De([v({type:"uint8",size:16})],Ie.prototype,"UnicodeRange"),De([v({type:"uint8",size:8})],Ie.prototype,"CodePageRange"),De([v("uint32")],Ie.prototype,"CheckSumAdjustment"),De([v({type:"uint8",size:16})],Ie.prototype,"Reserved"),De([v("uint16")],Ie.prototype,"Padding1");var qf=Object.defineProperty,$i=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&qf(e,t,i),i};class vr extends We{constructor(e,t){super(e,t,16)}}$i([v({type:"char",size:4})],vr.prototype,"tag"),$i([v("uint32")],vr.prototype,"checkSum"),$i([v("uint32")],vr.prototype,"offset"),$i([v("uint32")],vr.prototype,"length");const hn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Xf=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class un{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,r=72,i={},n){const o=1/(n?.unitsPerEm??1e3)*r,{xScale:a=o,yScale:l=o}=i,c=this.pathCommands,h=[];for(let u=0,d=c.length;u<d;u+=1){const g=c[u];g.type==="M"?h.push({type:"M",x:e+g.x*a,y:t+-g.y*l}):g.type==="L"?h.push({type:"L",x:e+g.x*a,y:t+-g.y*l}):g.type==="Q"?h.push({type:"Q",x1:e+g.x1*a,y1:t+-g.y1*l,x:e+g.x*a,y:t+-g.y*l}):g.type==="C"?h.push({type:"C",x1:e+g.x1*a,y1:t+-g.y1*l,x2:e+g.x2*a,y2:t+-g.y2*l,x:e+g.x*a,y:t+-g.y*l}):g.type==="Z"&&h.push({type:"Z"})}return h}}class Hf extends un{parse(e,t,r){const i=this,{nominalWidthX:n,defaultWidthX:o,gsubrsBias:a,subrsBias:l}=e,c=e.topDict.paintType,h=this.index;let u,d,g,p;const y=[],m=[];let P=0,E=!1,b=!1,S=o,w=0,x=0;function T(B,D){y.push({type:"L",x:B,y:D})}function C(B,D,H,I,F,j){y.push({type:"C",x1:B,y1:D,x2:H,y2:I,x:F,y:j})}function L(B,D){b&&c!==2&&G(),b=!0,y.push({type:"M",x:B,y:D})}function G(){y.push({type:"Z"})}function U(B){y.push(...B)}function R(){m.length%2!==0&&!E&&(S=m.shift()+n),P+=m.length>>1,m.length=0,E=!0}function z(B){let D,H,I,F,j,O,$,A,M,N,V,Y,J=0;for(;J<B.length;){let oe=B[J++];switch(oe){case 1:R();break;case 3:R();break;case 4:m.length>1&&!E&&(S=m.shift()+n,E=!0),x+=m.pop(),L(w,x);break;case 5:for(;m.length>0;)w+=m.shift(),x+=m.shift(),T(w,x);break;case 6:for(;m.length>0&&(w+=m.shift(),T(w,x),m.length!==0);)x+=m.shift(),T(w,x);break;case 7:for(;m.length>0&&(x+=m.shift(),T(w,x),m.length!==0);)w+=m.shift(),T(w,x);break;case 8:for(;m.length>0;)u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);break;case 10:j=m.pop()+l,O=e.subrs[j],O&&z(O);break;case 11:return;case 12:switch(oe=B[J],J+=1,oe){case 35:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p+m.shift(),M=$+m.shift(),N=A+m.shift(),V=M+m.shift(),Y=N+m.shift(),w=V+m.shift(),x=Y+m.shift(),m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 34:u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p,M=$+m.shift(),N=p,V=M+m.shift(),Y=x,w=V+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 36:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p,M=$+m.shift(),N=p,V=M+m.shift(),Y=N+m.shift(),w=V+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;case 37:u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),$=g+m.shift(),A=p+m.shift(),M=$+m.shift(),N=A+m.shift(),V=M+m.shift(),Y=N+m.shift(),Math.abs(V-w)>Math.abs(Y-x)?w=V+m.shift():x=Y+m.shift(),C(u,d,g,p,$,A),C(M,N,V,Y,w,x);break;default:console.warn(`Glyph ${h}: unknown operator ${1200+oe}`),m.length=0}break;case 14:if(m.length>=4){const _t=hn[m.pop()],Ze=hn[m.pop()],Be=m.pop(),$e=m.pop();if(_t&&Ze){i.isComposite=!0,i.components=[];const Pe=e.charset.indexOf(_t),ze=e.charset.indexOf(Ze);i.components.push({glyphIndex:ze,dx:0,dy:0}),i.components.push({glyphIndex:Pe,dx:$e,dy:Be}),U(r.get(ze).pathCommands);const ot=JSON.parse(JSON.stringify(r.get(Pe).pathCommands));for(let at=0;at<ot.length;at+=1){const Je=ot[at];Je.type!=="Z"&&(Je.x+=$e,Je.y+=Be),(Je.type==="Q"||Je.type==="C")&&(Je.x1+=$e,Je.y1+=Be),Je.type==="C"&&(Je.x2+=$e,Je.y2+=Be)}U(ot)}}else m.length>0&&!E&&(S=m.shift()+n,E=!0);b&&c!==2&&(G(),b=!1);break;case 18:R();break;case 19:case 20:R(),J+=P+7>>3;break;case 21:m.length>2&&!E&&(S=m.shift()+n,E=!0),x+=m.pop(),w+=m.pop(),L(w,x);break;case 22:m.length>1&&!E&&(S=m.shift()+n,E=!0),w+=m.pop(),L(w,x);break;case 23:R();break;case 24:for(;m.length>2;)u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);w+=m.shift(),x+=m.shift(),T(w,x);break;case 25:for(;m.length>6;)w+=m.shift(),x+=m.shift(),T(w,x);u=w+m.shift(),d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+m.shift(),C(u,d,g,p,w,x);break;case 26:for(m.length%2&&(w+=m.shift());m.length>0;)u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g,x=p+m.shift(),C(u,d,g,p,w,x);break;case 27:for(m.length%2&&(x+=m.shift());m.length>0;)u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p,C(u,d,g,p,w,x);break;case 28:D=B[J],H=B[J+1],m.push((D<<24|H<<16)>>16),J+=2;break;case 29:j=m.pop()+a,O=e.gsubrs[j],O&&z(O);break;case 30:for(;m.length>0&&(u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+(m.length===1?m.shift():0),C(u,d,g,p,w,x),m.length!==0);)u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),x=p+m.shift(),w=g+(m.length===1?m.shift():0),C(u,d,g,p,w,x);break;case 31:for(;m.length>0&&(u=w+m.shift(),d=x,g=u+m.shift(),p=d+m.shift(),x=p+m.shift(),w=g+(m.length===1?m.shift():0),C(u,d,g,p,w,x),m.length!==0);)u=w,d=x+m.shift(),g=u+m.shift(),p=d+m.shift(),w=g+m.shift(),x=p+(m.length===1?m.shift():0),C(u,d,g,p,w,x);break;default:oe<32?console.warn(`Glyph ${h}: unknown operator ${oe}`):oe<247?m.push(oe-139):oe<251?(D=B[J],J+=1,m.push((oe-247)*256+D+108)):oe<255?(D=B[J],J+=1,m.push(-(oe-251)*256-D-108)):(D=B[J],H=B[J+1],I=B[J+2],F=B[J+3],J+=4,m.push((D<<24|H<<16|I<<8|F)/65536))}}}z(t),this.pathCommands=y,E&&(this.advanceWidth=S)}}class fn{constructor(e){this._sfnt=e}_items=[];get(e){const t=this._items[e];let r;if(t)r=t;else{r=this._get(e);const i=this._sfnt.hmtx.metrics[e];i&&(r.advanceWidth=r.advanceWidth||i.advanceWidth,r.leftSideBearing=r.leftSideBearing||i.leftSideBearing);const n=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);n&&(r.unicode??=n[0],r.unicodes??=n),this._items[e]=r}return r}}class Yf extends fn{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,r=new Hf({index:e});return r.parse(t,t.charStringsIndex.get(e),this),r.name=t.charset[e],r}}var Kf=Object.defineProperty,nl=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Kf(e,t,i),i};class zi extends We{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,r,i){super(e,t,r,i),this._init()}_init(){const e=this.view,t=this.count,r=this.offsetSize;this.objectOffset=(t+1)*r+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){const e=this.view,t=this.count,r=this.offsetSize;e.seek(3);const i=[];for(let n=0,o=t+1;n<o;n++){const a=this.view;let l=0;for(let c=0;c<r;c++)l<<=8,l+=a.readUint8();i.push(l)}return i}readObjects(){const e=[];for(let t=0,r=this.count;t<r;t++)e.push(this.get(t));return e}get(e){const t=this.offsets,r=this.objectOffset,i=r+t[e],o=r+t[e+1]-i;return this._isString?this.view.readString(i,o):this.view.readBytes(i,o)}}nl([v("uint16")],zi.prototype,"count"),nl([v("uint8")],zi.prototype,"offsetSize");class Vi extends zi{_isString=!1}class ol extends zi{_isString=!0}const Zf=[".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"],Jf=[".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"],Qf=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ed=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function Gi(s,e){return e<=390?Zf[e]:s[e-391]}function ie(s,e="number",t){return(r,i)=>{if(typeof i!="string")return;const n={type:e,operator:s,default:t??e==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(n)},set(o){this._setProp(n,o)},configurable:!0,enumerable:!0})}}class al extends We{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){const e=this.view;let t="";const r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const n=e.readUint8(),o=n>>4,a=n&15;if(o===r||(t+=i[o],a===r))break;t+=i[a]}return Number.parseFloat(t)}_readOperand(e){const t=this.view;let r,i,n,o;if(e===28)return r=t.readUint8(),i=t.readUint8(),r<<8|i;if(e===29)return r=t.readUint8(),i=t.readUint8(),n=t.readUint8(),o=t.readUint8(),r<<24|i<<16|n<<8|o;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return r=t.readUint8(),(e-247)*256+r+108;if(e>=251&&e<=254)return r=t.readUint8(),-(e-251)*256-r-108;throw new Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){const e=this.view;e.seek(0);let t=[];const r=e.cursor+e.byteLength,i={};for(;e.cursor<r;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),i[n]=t,t=[]):t.push(this._readOperand(n))}return i}_getProp(e){const t=this.dict[e.operator]??e.default;switch(e.type){case"number":return t[0];case"string":return Gi(this._stringIndex?.objects??[],t[0]);case"number[]":return t}return t}_setProp(e,t){}}var td=Object.defineProperty,dn=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&td(e,t,i),i};class ji extends al{}dn([ie(19)],ji.prototype,"subrs"),dn([ie(20)],ji.prototype,"defaultWidthX"),dn([ie(21)],ji.prototype,"nominalWidthX");var rd=Object.defineProperty,ce=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&rd(e,t,i),i};class ne extends al{}ce([ie(0,"string")],ne.prototype,"version"),ce([ie(1,"string")],ne.prototype,"notice"),ce([ie(1200,"string")],ne.prototype,"copyright"),ce([ie(2,"string")],ne.prototype,"fullName"),ce([ie(3,"string")],ne.prototype,"familyName"),ce([ie(4,"string")],ne.prototype,"weight"),ce([ie(1201)],ne.prototype,"isFixedPitch"),ce([ie(1202)],ne.prototype,"italicAngle"),ce([ie(1203,"number",-100)],ne.prototype,"underlinePosition"),ce([ie(1204,"number",50)],ne.prototype,"underlineThickness"),ce([ie(1205)],ne.prototype,"paintType"),ce([ie(1206,"number",2)],ne.prototype,"charstringType"),ce([ie(1207,"number[]",[.001,0,0,.001,0,0])],ne.prototype,"fontMatrix"),ce([ie(13)],ne.prototype,"uniqueId"),ce([ie(5,"number[]",[0,0,0,0])],ne.prototype,"fontBBox"),ce([ie(1208)],ne.prototype,"strokeWidth"),ce([ie(14)],ne.prototype,"xuid"),ce([ie(15)],ne.prototype,"charset"),ce([ie(16)],ne.prototype,"encoding"),ce([ie(17)],ne.prototype,"charStrings"),ce([ie(18,"number[]",[0,0])],ne.prototype,"private");function be(s,e=s){return t=>{gt.tableDefinitions.set(s,{tag:s,prop:e,class:t}),Object.defineProperty(gt.prototype,e,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}class gt{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:r,charset:i}=this.cff;t=i.indexOf(r[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const r of e)t.push(this.charToGlyphIndex(r));return t}textToGlyphs(e){const t=this.glyphs,r=this.textToGlyphIndexes(e),i=r.length,n=Array.from({length:i}),o=t.get(0);for(let a=0;a<i;a+=1)n[a]=t.get(r[a])||o;return n}getPathCommands(e,t,r,i,n){const o=[];return this.forEachGlyph(e,t,r,i,n,(a,l,c,h,u)=>{o.push(...a.getPathCommands(l,c,h,u,this))}),o}getAdvanceWidth(e,t,r){return this.forEachGlyph(e,0,0,t,r,()=>{})}forEachGlyph(e,t=0,r=0,i=72,n={},o){const a=1/this.unitsPerEm*i,l=this.textToGlyphs(e);for(let c=0;c<l.length;c+=1){const h=l[c];o.call(this,h,t,r,i,n),h.advanceWidth&&(t+=h.advanceWidth*a),n.letterSpacing?t+=n.letterSpacing*i:n.tracking&&(t+=n.tracking/1e3*i)}return t}constructor(e){(e instanceof Map?e:new Map(Object.entries(e))).forEach((r,i)=>{this.tableViews.set(i,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)))})}clone(){return new gt(this.tableViews)}delete(e){const t=gt.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const r=gt.tableDefinitions.get(e);return r&&this.tables.set(r.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=gt.tableDefinitions.get(e);if(!t)return;let r=this.tables.get(t.prop);if(!r){const i=t.class;if(i){const n=this.tableViews.get(e);if(!n)return;r=new i(n.buffer,n.byteOffset,n.byteLength).setSFNT(this),this.tables.set(t.prop,r)}}return r}}class Me extends We{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var id=Object.defineProperty,sd=Object.getOwnPropertyDescriptor,Yr=(s,e,t,r)=>{for(var i=r>1?void 0:r?sd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&id(e,t,i),i};let Yt=class extends Me{_glyphs;get glyphs(){return this._glyphs??=new Yf(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(s,e,t,r){super(s,e,t,r),this._init()}_init(){const s=this.view,{buffer:e,byteOffset:t}=s,r=t+4;this.nameIndex=new ol(e,r),this.topDictIndex=new Vi(e,this.nameIndex.endOffset),this.stringIndex=new ol(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Vi(e,this.stringIndex.endOffset),this.topDict=new ne(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],n=this.topDict.private[1];i&&(this.privateDict=new ji(e,t+n,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Vi(e,t+n+this.privateDict.subrs))),this.charStringsIndex=new Vi(e,t+this.topDict.charStrings);const o=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Jf:this.topDict.charset===1?this.charset=Qf:this.topDict.charset===2?this.charset=ed:this.charset=this._readCharset(t+this.topDict.charset,o,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=hn:this.topDict.encoding===1?this.encoding=Xf:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(s,e,t){const r=this.view;r.seek(s);let i,n,o;e-=1;const a=[".notdef"],l=r.readUint8();if(l===0)for(i=0;i<e;i+=1)n=r.readUint16(),a.push(Gi(t,n));else if(l===1)for(;a.length<=e;)for(n=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)a.push(Gi(t,n)),n+=1;else if(l===2)for(;a.length<=e;)for(n=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)a.push(Gi(t,n)),n+=1;else throw new Error(`Unknown charset format ${l}`);return a}_readEncoding(s){const e=this.view;e.seek(s);let t,r;const i={},n=e.readUint8();if(n===0){const o=e.readUint8();for(t=0;t<o;t+=1)r=e.readUint8(),i[r]=t}else if(n===1){const o=e.readUint8();for(r=1,t=0;t<o;t+=1){const a=e.readUint8(),l=e.readUint8();for(let c=a;c<=a+l;c+=1)i[c]=r,r+=1}}else console.warn(`unknown encoding format:${n}`);return i}_calcSubroutineBias(s){let e;return s.length<1240?e=107:s.length<33900?e=1131:e=32768,e}};Yr([v("uint8")],Yt.prototype,"majorVersion",2),Yr([v("uint8")],Yt.prototype,"minorVersion",2),Yr([v("uint8")],Yt.prototype,"headerSize",2),Yr([v("uint8")],Yt.prototype,"offsetSize",2),Yt=Yr([be("CFF ","cff")],Yt);var nd=Object.defineProperty,Wi=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&nd(e,t,i),i};const Kr=class yc extends We{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new yc;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((r,i)=>{i<256&&r<256&&t.view.writeUint8(r,6+i)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,r)=>{e.set(r,t)}),e}};Wi([v("uint16")],Kr.prototype,"format"),Wi([v("uint16")],Kr.prototype,"length"),Wi([v("uint16")],Kr.prototype,"language"),Wi([v({type:"uint8",size:256})],Kr.prototype,"glyphIndexArray");let pn=Kr;var od=Object.defineProperty,gn=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&od(e,t,i),i};class Zr extends We{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-r)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const r=(this.view.byteLength-t)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,r=this.subHeaderKeys,i=this.maxSubHeaderKey,n=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(c=>c===i);let l=0;for(let c=0;c<256;c++)if(r[c]===0)c>=a||c<n[0].firstCode||c>=n[0].firstCode+n[0].entryCount||n[0].idRangeOffset+(c-n[0].firstCode)>=o.length?l=0:(l=o[n[0].idRangeOffset+(c-n[0].firstCode)],l!==0&&(l=l+n[0].idDelta)),l!==0&&l<e&&t.set(c,l);else{const h=r[c];for(let u=0,d=n[h].entryCount;u<d;u++)if(n[h].idRangeOffset+u>=o.length?l=0:(l=o[n[h].idRangeOffset+u],l!==0&&(l=l+n[h].idDelta)),l!==0&&l<e){const g=(c<<8|u+n[h].firstCode)%65535;t.set(g,l)}}return t}}gn([v("uint16")],Zr.prototype,"format"),gn([v("uint16")],Zr.prototype,"length"),gn([v("uint16")],Zr.prototype,"language");function ll(s){return s>32767?s-65536:s<-32767?s+65536:s}function mn(s,e){let t;const r=[];let i={};return s.forEach((n,o)=>{e&&o>e||((!t||o!==t.unicode+1||n!==t.glyphIndex+1)&&(t?(i.end=t.unicode,r.push(i),i={start:o,startId:n,delta:ll(n-o)}):(i.start=Number(o),i.startId=n,i.delta=ll(n-o))),t={unicode:o,glyphIndex:n})}),t&&(i.end=t.unicode,r.push(i)),r}var ad=Object.defineProperty,Kt=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&ad(e,t,i),i};const Lt=class vc extends We{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=mn(e,65535),r=t.length+1,i=Math.floor(Math.log(r)/Math.LN2),n=2*2**i,o=new vc(new ArrayBuffer(24+t.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=n,o.entrySelector=i,o.rangeShift=2*r-n,o.endCode=[...t.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...t.map(a=>a.start),65535],o.idDelta=[...t.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,i=this.startCode,n=this.endCode,o=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let c=0;c<t;++c)for(let h=i[c],u=n[c];h<=u;++h)if(o[c]===0)e.set(h,(h+a[c])%65536);else{const d=c+o[c]/2+(h-i[c])-r,g=l[d];g!==0?e.set(h,(g+a[c])%65536):e.set(h,0)}return e.delete(65535),e}};Kt([v("uint16")],Lt.prototype,"format"),Kt([v("uint16")],Lt.prototype,"length"),Kt([v("uint16")],Lt.prototype,"language"),Kt([v("uint16")],Lt.prototype,"segCountX2"),Kt([v("uint16")],Lt.prototype,"searchRange"),Kt([v("uint16")],Lt.prototype,"entrySelector"),Kt([v("uint16")],Lt.prototype,"rangeShift");let yn=Lt;var ld=Object.defineProperty,Jr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&ld(e,t,i),i};class Zt extends We{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((r,i)=>{t.set(i,r)}),t}}Jr([v("uint16")],Zt.prototype,"format"),Jr([v("uint16")],Zt.prototype,"length"),Jr([v("uint16")],Zt.prototype,"language"),Jr([v("uint16")],Zt.prototype,"firstCode"),Jr([v("uint16")],Zt.prototype,"entryCount");var cd=Object.defineProperty,Qr=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&cd(e,t,i),i};const _r=class _c extends We{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=mn(e),r=new _c(new ArrayBuffer(16+t.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=t.length,t.forEach(i=>{r.view.writeUint32(i.start),r.view.writeUint32(i.end),r.view.writeUint32(i.startId)}),r}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let r=0,i=t.length;r<i;r++){const n=t[r];let o=n.startGlyphCode,a=n.startCharCode;const l=n.endCharCode;for(;a<=l;)e.set(a++,o++)}return e}};Qr([v("uint16")],_r.prototype,"format"),Qr([v("uint16")],_r.prototype,"reserved"),Qr([v("uint32")],_r.prototype,"length"),Qr([v("uint32")],_r.prototype,"language"),Qr([v("uint32")],_r.prototype,"nGroups");let vn=_r;var hd=Object.defineProperty,_n=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&hd(e,t,i),i};class ei extends We{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const r=this.view.readUint32();t.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const r=this.view.readUint32();t.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let r=0,i=t.length;r<i;r++){const{uVSMappings:n}=t[r];n.forEach(o=>{e.set(o.unicodeValue,o.glyphID)})}return e}}_n([v("uint16")],ei.prototype,"format"),_n([v("uint32")],ei.prototype,"length"),_n([v("uint32")],ei.prototype,"numVarSelectorRecords");var ud=Object.defineProperty,fd=Object.getOwnPropertyDescriptor,bn=(s,e,t,r)=>{for(var i=r>1?void 0:r?fd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ud(e,t,i),i};let br=class extends Me{static from(s){const e=Array.from(s.keys()).some(h=>h>65535),t=yn.from(s),r=pn.from(s),i=e?vn.from(s):void 0,n=4+(i?32:24),o=n+t.view.byteLength,a=o+r.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:n},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:n},i&&{platformID:3,platformSpecificID:10,offset:a}].filter(Boolean),c=new br(new ArrayBuffer(4+8*l.length+t.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return c.numberSubtables=l.length,c.view.seek(4),l.forEach(h=>{c.view.writeUint16(h.platformID),c.view.writeUint16(h.platformSpecificID),c.view.writeUint32(h.offset)}),c.view.writeBytes(t.view,n),c.view.writeBytes(r.view,o),i&&c.view.writeBytes(i.view,a),c}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const s=new Map,e=this.unicodeToGlyphIndexMap,t=Array.from(e.keys());for(let r=0,i=t.length;r<i;r++){const n=t[r],o=e.get(n);s.has(o)?s.get(o).push(n):s.set(o,[n])}this._glyphIndexToUnicodesMap=s}return this._glyphIndexToUnicodesMap}readSubtables(){const s=this.numberSubtables;return this.view.seek(4),Array.from({length:s},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const t=this.view.readUint16();let r;switch(t){case 0:r=new pn(this.view.buffer,e.offset);break;case 2:r=new Zr(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new yn(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new Zt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new vn(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new ei(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:t,view:r}})}readunicodeToGlyphIndexMap(){const s=this.readSubtables(),e=s.find(o=>o.format===0)?.view,t=s.find(o=>o.platformID===3&&o.platformSpecificID===3&&o.format===2)?.view,r=s.find(o=>o.platformID===3&&o.platformSpecificID===1&&o.format===4)?.view,i=s.find(o=>o.platformID===3&&o.platformSpecificID===10&&o.format===12)?.view,n=s.find(o=>o.platformID===0&&o.platformSpecificID===5&&o.format===14)?.view;return new Map([...e?.getUnicodeToGlyphIndexMap()??[],...t?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap()??[]])}};bn([v("uint16")],br.prototype,"version",2),bn([v("uint16")],br.prototype,"numberSubtables",2),br=bn([be("cmap")],br);class dd extends un{_parseContours(e){const t=[];let r=[];for(let i=0;i<e.length;i+=1){const n=e[i];r.push(n),n.lastPointOfContour&&(t.push(r),r=[])}return Xr(r.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const r=[];for(let i=0;i<e.length;i+=1){const n=e[i],o={x:t.xScale*n.x+t.scale10*n.y+t.dx,y:t.scale01*n.x+t.yScale*n.y+t.dy,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(e,t,r,i,n){let o;return(t&i)>0?(o=e.view.readUint8(),(t&n)===0&&(o=-o),o=r+o):(t&n)>0?o=r:o=r+e.view.readInt16(),o}parse(e,t,r){e.view.seek(t);const i=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),i>0){const a=this.endPointIndices=[];for(let y=0;y<i;y++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Xr(l<5e3,`Bad instructionLength:${l}`);const c=this.instructions=[];for(let y=0;y<l;++y)c.push(e.view.readUint8());const h=e.view.byteOffset,u=a[a.length-1]+1;Xr(u<2e4,`Bad numberOfCoordinates:${h}`);const d=[];let g,p=0;for(;p<u;)if(g=e.view.readUint8(),d.push(g),p++,g&8&&p<u){const y=e.view.readUint8();for(let m=0;m<y;m++)d.push(g),p++}if(Xr(d.length===u,`Bad flags length: ${d.length}, numberOfCoordinates: ${u}`),a.length>0){const y=[];let m;if(u>0){for(let b=0;b<u;b+=1)g=d[b],m={},m.onCurve=!!(g&1),m.lastPointOfContour=a.includes(b),y.push(m);let P=0;for(let b=0;b<u;b+=1)g=d[b],m=y[b],m.x=this._parseGlyphCoordinate(e,g,P,2,16),P=m.x;let E=0;for(let b=0;b<u;b+=1)g=d[b],m=y[b],m.y=this._parseGlyphCoordinate(e,g,E,4,32),E=m.y}this.points=y}else this.points=[]}else if(i===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const c={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(c.dx=e.view.readInt16(),c.dy=e.view.readInt16()):c.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(c.dx=e.view.readInt8(),c.dy=e.view.readInt8()):c.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?c.xScale=c.yScale=e.view.readInt16()/16384:(a&64)>0?(c.xScale=e.view.readInt16()/16384,c.yScale=e.view.readInt16()/16384):(a&128)>0&&(c.xScale=e.view.readInt16()/16384,c.scale01=e.view.readInt16()/16384,c.scale10=e.view.readInt16()/16384,c.yScale=e.view.readInt16()/16384),this.components.push(c),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let c=0;c<this.instructionLength;c+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],c=r.get(l.glyphIndex);if(c.getPathCommands(),c.points){let h;if(l.matchedPoints===void 0)h=this._transformPoints(c.points,l);else{Xr(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>c.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[l.matchedPoints[0]];let d=c.points[l.matchedPoints[1]];const g={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};d=this._transformPoints([d],g)[0],g.dx=u.x-d.x,g.dy=u.y-d.y,h=this._transformPoints(c.points,g)}this.points=this.points.concat(h)}}const n=[],o=this._parseContours(this.points);for(let a=0,l=o.length;a<l;++a){const c=o[a];let h=c[c.length-1],u=c[0];h.onCurve?n.push({type:"M",x:h.x,y:h.y}):u.onCurve?n.push({type:"M",x:u.x,y:u.y}):n.push({type:"M",x:(h.x+u.x)*.5,y:(h.y+u.y)*.5});for(let d=0,g=c.length;d<g;++d)if(h=u,u=c[(d+1)%g],h.onCurve)n.push({type:"L",x:h.x,y:h.y});else{let p=u;u.onCurve||(p={x:(h.x+u.x)*.5,y:(h.y+u.y)*.5}),n.push({type:"Q",x1:h.x,y1:h.y,x:p.x,y:p.y})}n.push({type:"Z"})}this.pathCommands=n}}class pd extends fn{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,r=t[e],i=new dd({index:e});return r!==t[e+1]&&i.parse(this._sfnt.glyf,r,this),i}}var gd=Object.getOwnPropertyDescriptor,md=(s,e,t,r)=>{for(var i=r>1?void 0:r?gd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let qi=class extends Me{static from(s){const e=s.reduce((r,i)=>r+i.byteLength,0),t=new qi(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeBytes(r)}),t}_glyphs;get glyphs(){return this._glyphs??=new pd(this._sfnt)}};qi=md([be("glyf")],qi);var yd=Object.getOwnPropertyDescriptor,vd=(s,e,t,r)=>{for(var i=r>1?void 0:r?yd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let wn=class extends Me{};wn=vd([be("GPOS","gpos")],wn);var _d=Object.defineProperty,bd=Object.getOwnPropertyDescriptor,Jt=(s,e,t,r)=>{for(var i=r>1?void 0:r?bd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&_d(e,t,i),i};let At=class extends Me{};Jt([v("uint16")],At.prototype,"majorVersion",2),Jt([v("uint16")],At.prototype,"minorVersion",2),Jt([v("uint16")],At.prototype,"scriptListOffset",2),Jt([v("uint16")],At.prototype,"featureListOffset",2),Jt([v("uint16")],At.prototype,"lookupListOffset",2),Jt([v("uint16")],At.prototype,"featureVariationsOffset",2),At=Jt([be("GSUB","gsub")],At);var wd=Object.defineProperty,xd=Object.getOwnPropertyDescriptor,ye=(s,e,t,r)=>{for(var i=r>1?void 0:r?xd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&wd(e,t,i),i};let ue=class extends Me{constructor(s=new ArrayBuffer(54),e){super(s,e,Math.min(54,s.byteLength-(e??0)))}};ye([v("fixed")],ue.prototype,"version",2),ye([v("fixed")],ue.prototype,"fontRevision",2),ye([v("uint32")],ue.prototype,"checkSumAdjustment",2),ye([v("uint32")],ue.prototype,"magickNumber",2),ye([v("uint16")],ue.prototype,"flags",2),ye([v("uint16")],ue.prototype,"unitsPerEm",2),ye([v({type:"longDateTime"})],ue.prototype,"created",2),ye([v({type:"longDateTime"})],ue.prototype,"modified",2),ye([v("int16")],ue.prototype,"xMin",2),ye([v("int16")],ue.prototype,"yMin",2),ye([v("int16")],ue.prototype,"xMax",2),ye([v("int16")],ue.prototype,"yMax",2),ye([v("uint16")],ue.prototype,"macStyle",2),ye([v("uint16")],ue.prototype,"lowestRecPPEM",2),ye([v("int16")],ue.prototype,"fontDirectionHint",2),ye([v("int16")],ue.prototype,"indexToLocFormat",2),ye([v("int16")],ue.prototype,"glyphDataFormat",2),ue=ye([be("head")],ue);var Pd=Object.defineProperty,Cd=Object.getOwnPropertyDescriptor,Re=(s,e,t,r)=>{for(var i=r>1?void 0:r?Cd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Pd(e,t,i),i};let we=class extends Me{constructor(s=new ArrayBuffer(36),e){super(s,e,Math.min(36,s.byteLength-(e??0)))}};Re([v("fixed")],we.prototype,"version",2),Re([v("int16")],we.prototype,"ascent",2),Re([v("int16")],we.prototype,"descent",2),Re([v("int16")],we.prototype,"lineGap",2),Re([v("uint16")],we.prototype,"advanceWidthMax",2),Re([v("int16")],we.prototype,"minLeftSideBearing",2),Re([v("int16")],we.prototype,"minRightSideBearing",2),Re([v("int16")],we.prototype,"xMaxExtent",2),Re([v("int16")],we.prototype,"caretSlopeRise",2),Re([v("int16")],we.prototype,"caretSlopeRun",2),Re([v("int16")],we.prototype,"caretOffset",2),Re([v({type:"int16",size:4})],we.prototype,"reserved",2),Re([v("int16")],we.prototype,"metricDataFormat",2),Re([v("uint16")],we.prototype,"numOfLongHorMetrics",2),we=Re([be("hhea")],we);var Td=Object.getOwnPropertyDescriptor,Sd=(s,e,t,r)=>{for(var i=r>1?void 0:r?Td(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Xi=class extends Me{static from(s){const e=s.length*4,t=new Xi(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeUint16(r.advanceWidth),t.view.writeUint16(r.leftSideBearing)}),t}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let t=0;const r=this.view;return r.seek(0),Array.from({length:s}).map((i,n)=>(n<e&&(t=r.readUint16()),{advanceWidth:t,leftSideBearing:r.readUint16()}))}};Xi=Sd([be("hmtx")],Xi);var Ed=Object.getOwnPropertyDescriptor,Md=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ed(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let xn=class extends Me{};xn=Md([be("kern","kern")],xn);var Ad=Object.getOwnPropertyDescriptor,Od=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ad(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Hi=class extends Me{static from(s,e=1){const t=s.length*(e?4:2),r=new Hi(new ArrayBuffer(t));return s.forEach(i=>{e?r.view.writeUint32(i):r.view.writeUint16(i/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,t=this.view;return t.seek(0),Array.from({length:s}).map(()=>e?t.readUint32():t.readUint16()*2)}};Hi=Od([be("loca")],Hi);var kd=Object.defineProperty,Dd=Object.getOwnPropertyDescriptor,Ae=(s,e,t,r)=>{for(var i=r>1?void 0:r?Dd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&kd(e,t,i),i};let ve=class extends Me{constructor(s=new ArrayBuffer(32),e){super(s,e,Math.min(32,s.byteLength-(e??0)))}};Ae([v("fixed")],ve.prototype,"version",2),Ae([v("uint16")],ve.prototype,"numGlyphs",2),Ae([v("uint16")],ve.prototype,"maxPoints",2),Ae([v("uint16")],ve.prototype,"maxContours",2),Ae([v("uint16")],ve.prototype,"maxComponentPoints",2),Ae([v("uint16")],ve.prototype,"maxComponentContours",2),Ae([v("uint16")],ve.prototype,"maxZones",2),Ae([v("uint16")],ve.prototype,"maxTwilightPoints",2),Ae([v("uint16")],ve.prototype,"maxStorage",2),Ae([v("uint16")],ve.prototype,"maxFunctionDefs",2),Ae([v("uint16")],ve.prototype,"maxInstructionDefs",2),Ae([v("uint16")],ve.prototype,"maxStackElements",2),Ae([v("uint16")],ve.prototype,"maxSizeOfInstructions",2),Ae([v("uint16")],ve.prototype,"maxComponentElements",2),Ae([v("uint16")],ve.prototype,"maxComponentDepth",2),ve=Ae([be("maxp")],ve);var Id=Object.defineProperty,Rd=Object.getOwnPropertyDescriptor,Yi=(s,e,t,r)=>{for(var i=r>1?void 0:r?Rd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Id(e,t,i),i};const cl={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},Pn={Macintosh:1,Microsoft:3},Ud={Default:0},hl={UCS2:1};let wr=class extends Me{_names;get names(){return this._names??=this.readNames()}readNames(){const s=this.count;this.view.seek(6);const e=[];for(let a=0;a<s;++a)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const t=this.stringOffset;for(let a=0;a<s;++a){const l=e[a];l.name=this.view.readBytes(t+l.offset,l.length)}let r=Pn.Macintosh,i=Ud.Default,n=0;e.some(a=>a.platform===Pn.Microsoft&&a.encoding===hl.UCS2&&a.language===1033)&&(r=Pn.Microsoft,i=hl.UCS2,n=1033);const o={};for(let a=0;a<s;++a){const l=e[a];l.platform===r&&l.encoding===i&&l.language===n&&cl[l.nameId]&&(o[cl[l.nameId]]=n===0?Vf(l.name):Gf(l.name))}return o}};Yi([v("uint16")],wr.prototype,"format",2),Yi([v("uint16")],wr.prototype,"count",2),Yi([v("uint16")],wr.prototype,"stringOffset",2),wr=Yi([be("name")],wr);var Bd=Object.defineProperty,Ld=Object.getOwnPropertyDescriptor,q=(s,e,t,r)=>{for(var i=r>1?void 0:r?Ld(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Bd(e,t,i),i};let W=class extends Me{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};q([v("uint16")],W.prototype,"version",2),q([v("int16")],W.prototype,"xAvgCharWidth",2),q([v("uint16")],W.prototype,"usWeightClass",2),q([v("uint16")],W.prototype,"usWidthClass",2),q([v("uint16")],W.prototype,"fsType",2),q([v("uint16")],W.prototype,"ySubscriptXSize",2),q([v("uint16")],W.prototype,"ySubscriptYSize",2),q([v("uint16")],W.prototype,"ySubscriptXOffset",2),q([v("uint16")],W.prototype,"ySubscriptYOffset",2),q([v("uint16")],W.prototype,"ySuperscriptXSize",2),q([v("uint16")],W.prototype,"ySuperscriptYSize",2),q([v("uint16")],W.prototype,"ySuperscriptXOffset",2),q([v("uint16")],W.prototype,"ySuperscriptYOffset",2),q([v("uint16")],W.prototype,"yStrikeoutSize",2),q([v("uint16")],W.prototype,"yStrikeoutPosition",2),q([v("uint16")],W.prototype,"sFamilyClass",2),q([v({type:"uint8"})],W.prototype,"bFamilyType",2),q([v({type:"uint8"})],W.prototype,"bSerifStyle",2),q([v({type:"uint8"})],W.prototype,"bWeight",2),q([v({type:"uint8"})],W.prototype,"bProportion",2),q([v({type:"uint8"})],W.prototype,"bContrast",2),q([v({type:"uint8"})],W.prototype,"bStrokeVariation",2),q([v({type:"uint8"})],W.prototype,"bArmStyle",2),q([v({type:"uint8"})],W.prototype,"bLetterform",2),q([v({type:"uint8"})],W.prototype,"bMidline",2),q([v({type:"uint8"})],W.prototype,"bXHeight",2),q([v({type:"uint8",size:16})],W.prototype,"ulUnicodeRange",2),q([v({type:"char",size:4})],W.prototype,"achVendID",2),q([v("uint16")],W.prototype,"fsSelection",2),q([v("uint16")],W.prototype,"usFirstCharIndex",2),q([v("uint16")],W.prototype,"usLastCharIndex",2),q([v("int16")],W.prototype,"sTypoAscender",2),q([v("int16")],W.prototype,"sTypoDescender",2),q([v("int16")],W.prototype,"sTypoLineGap",2),q([v("uint16")],W.prototype,"usWinAscent",2),q([v("uint16")],W.prototype,"usWinDescent",2),q([v({offset:72,type:"uint8",size:8})],W.prototype,"ulCodePageRange",2),q([v({offset:72,type:"int16"})],W.prototype,"sxHeight",2),q([v("int16")],W.prototype,"sCapHeight",2),q([v("uint16")],W.prototype,"usDefaultChar",2),q([v("uint16")],W.prototype,"usBreakChar",2),q([v("uint16")],W.prototype,"usMaxContext",2),W=q([be("OS/2","os2")],W);var Fd=Object.defineProperty,Nd=Object.getOwnPropertyDescriptor,mt=(s,e,t,r)=>{for(var i=r>1?void 0:r?Nd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Fd(e,t,i),i};let Ye=class extends Me{constructor(s=new ArrayBuffer(32),e,t){super(s,e,t)}};mt([v("fixed")],Ye.prototype,"format",2),mt([v("fixed")],Ye.prototype,"italicAngle",2),mt([v("int16")],Ye.prototype,"underlinePosition",2),mt([v("int16")],Ye.prototype,"underlineThickness",2),mt([v("uint32")],Ye.prototype,"isFixedPitch",2),mt([v("uint32")],Ye.prototype,"minMemType42",2),mt([v("uint32")],Ye.prototype,"maxMemType42",2),mt([v("uint32")],Ye.prototype,"minMemType1",2),mt([v("uint32")],Ye.prototype,"maxMemType1",2),Ye=mt([be("post")],Ye);var $d=Object.defineProperty,zd=Object.getOwnPropertyDescriptor,Ue=(s,e,t,r)=>{for(var i=r>1?void 0:r?zd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&$d(e,t,i),i};let xe=class extends Me{constructor(s=new ArrayBuffer(36),e){super(s,e,Math.min(36,s.byteLength-(e??0)))}};Ue([v("fixed")],xe.prototype,"version",2),Ue([v("int16")],xe.prototype,"vertTypoAscender",2),Ue([v("int16")],xe.prototype,"vertTypoDescender",2),Ue([v("int16")],xe.prototype,"vertTypoLineGap",2),Ue([v("int16")],xe.prototype,"advanceHeightMax",2),Ue([v("int16")],xe.prototype,"minTopSideBearing",2),Ue([v("int16")],xe.prototype,"minBottomSideBearing",2),Ue([v("int16")],xe.prototype,"yMaxExtent",2),Ue([v("int16")],xe.prototype,"caretSlopeRise",2),Ue([v("int16")],xe.prototype,"caretSlopeRun",2),Ue([v("int16")],xe.prototype,"caretOffset",2),Ue([v({type:"int16",size:4})],xe.prototype,"reserved",2),Ue([v("int16")],xe.prototype,"metricDataFormat",2),Ue([v("int16")],xe.prototype,"numOfLongVerMetrics",2),xe=Ue([be("vhea")],xe);var Vd=Object.getOwnPropertyDescriptor,Gd=(s,e,t,r)=>{for(var i=r>1?void 0:r?Vd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};let Ki=class extends Me{static from(s){const e=s.length*4,t=new Ki(new ArrayBuffer(e));return s.forEach(r=>{t.view.writeUint16(r.advanceHeight),t.view.writeInt16(r.topSideBearing)}),t}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){const s=this._sfnt.maxp.numGlyphs,e=this._sfnt.vhea?.numOfLongVerMetrics??0,t=this.view;t.seek(0);let r=0;return Array.from({length:s}).map((i,n)=>(n<e&&(r=t.readUint16()),{advanceHeight:r,topSideBearing:t.readUint8()}))}};Ki=Gd([be("vmtx")],Ki);var jd=Object.defineProperty,ti=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&jd(e,t,i),i};class it extends Ni{format="TrueType";mimeType="font/ttf";_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e=="number"?this.signature.has(e):this.signature.has(yr(e).getUint32(0))}static checksum(e){const t=yr(e);let r=t.byteLength;for(;r%4;)r++;let i=0;for(let n=0,o=r/4;n<o;n+=4)n*4<r-4&&(i+=t.getUint32(n*4,!1));return i&4294967295}static from(e){const t=u=>u+3&-4,r=e.tableViews.size,i=Array.from(e.tableViews.values()).reduce((u,d)=>u+t(d.byteLength),0),n=new this(new ArrayBuffer(12+r*16+i));n.scalerType=65536,n.numTables=r;const o=Math.log(2);n.searchRange=Math.floor(Math.log(r)/o)*16,n.entrySelector=Math.floor(n.searchRange/o),n.rangeShift=r*16-n.searchRange;let a=12+r*16,l=0;const c=n.getDirectories();e.tableViews.forEach((u,d)=>{const g=c[l++];g.tag=d,g.checkSum=this.checksum(u),g.offset=a,g.length=u.byteLength,n.view.writeBytes(u,a),a+=t(g.length)});const h=n.createSFNT().head;return h.checkSumAdjustment=0,h.checkSumAdjustment=2981146554-this.checksum(n.view),n}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const t=new vr(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new gt(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}}ti([v("uint32")],it.prototype,"scalerType"),ti([v("uint16")],it.prototype,"numTables"),ti([v("uint16")],it.prototype,"searchRange"),ti([v("uint16")],it.prototype,"entrySelector"),ti([v("uint16")],it.prototype,"rangeShift");class Cn extends it{format="OpenType";mimeType="font/otf";static signature=new Set([1330926671]);static from(e){return super.from(e)}}var Wd=Object.defineProperty,ri=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Wd(e,t,i),i};class Qt extends We{constructor(e,t){super(e,t,20)}}ri([v({type:"char",size:4})],Qt.prototype,"tag"),ri([v("uint32")],Qt.prototype,"offset"),ri([v("uint32")],Qt.prototype,"compLength"),ri([v("uint32")],Qt.prototype,"origLength"),ri([v("uint32")],Qt.prototype,"origChecksum");var qd=Object.defineProperty,qe=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&qd(e,t,i),i};const Ne=class Qn extends Ni{format="WOFF";mimeType="font/woff";get subfontFormat(){return it.is(this.flavor)?"TrueType":Cn.is(this.flavor)?"OpenType":"Open"}_sfnt;get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e=="number"?this.signature.has(e):this.signature.has(yr(e).getUint32(0))}static checkSum(e){const t=yr(e),r=t.byteLength,i=Math.floor(r/4);let n=0,o=0;for(;o<i;)n+=t.getUint32(4*o++,!1);let a=r-i*4;if(a){let l=i*4;for(;a>0;)n+=t.getUint8(l)<<a*8,l++,a--}return n%4294967296}static from(e,t=new ArrayBuffer(0)){const r=u=>u+3&-4,i=[];e.tableViews.forEach((u,d)=>{const g=yr(Uf(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));i.push({tag:d,view:g.byteLength<u.byteLength?g:u,rawView:u})});const n=i.length,o=i.reduce((u,d)=>u+r(d.view.byteLength),0),a=new Qn(new ArrayBuffer(44+20*n+o+t.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=n,a.totalSFNTSize=12+16*n+i.reduce((u,d)=>u+r(d.rawView.byteLength),0);let l=44+n*20,c=0;const h=a.getDirectories();return i.forEach(u=>{const d=h[c++];d.tag=u.tag,d.offset=l,d.compLength=u.view.byteLength,d.origChecksum=Qn.checkSum(u.rawView),d.origLength=u.rawView.byteLength,a.view.writeBytes(u.view,l),l+=r(d.compLength)}),a.view.writeBytes(t),a}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{const t=new Qt(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new gt(this.getDirectories().reduce((e,t)=>{const r=t.tag,i=this.view.byteOffset+t.offset,n=t.compLength,o=t.origLength,a=i+n;return e[r]=n>=o?new DataView(this.view.buffer,i,n):new DataView(Bf(new Uint8Array(this.view.buffer.slice(i,a))).buffer),e},{}))}};qe([v("uint32")],Ne.prototype,"signature"),qe([v("uint32")],Ne.prototype,"flavor"),qe([v("uint32")],Ne.prototype,"length"),qe([v("uint16")],Ne.prototype,"numTables"),qe([v("uint16")],Ne.prototype,"reserved"),qe([v("uint32")],Ne.prototype,"totalSFNTSize"),qe([v("uint16")],Ne.prototype,"majorVersion"),qe([v("uint16")],Ne.prototype,"minorVersion"),qe([v("uint32")],Ne.prototype,"metaOffset"),qe([v("uint32")],Ne.prototype,"metaLength"),qe([v("uint32")],Ne.prototype,"metaOrigLength"),qe([v("uint32")],Ne.prototype,"privOffset"),qe([v("uint32")],Ne.prototype,"privLength");let Zi=Ne;function ul(s,e=!0){if(it.is(s))return new it(s);if(Cn.is(s))return new Cn(s);if(Zi.is(s))return new Zi(s);if(e)throw new Error("Failed to parseFont")}function fl(s,e=!0){const t=ul(s,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}class Ji{static defaultRequestInit={cache:"force-cache"};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(e,t){const r=new AbortController;return{url:e,when:fetch(e,{...Ji.defaultRequestInit,...t,signal:r.signal}).then(i=>i.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(e,t){return document.fonts.check(`14px ${e}`)||document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const r=CSS.escape(e);if(!document.querySelector(`style[data-family="${r}"]`)){const i=document.createElement("style");i.type="text/css",i.dataset.family=e,i.appendChild(document.createTextNode(`@font-face {
|
|
149
149
|
font-family: "${e}";
|
|
150
150
|
src: url(${t});
|
|
151
151
|
}`)),document.head.appendChild(i)}return this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(r=>this.familyToUrl.get(r.trim())??this.familyToUrl.get(r)??r)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((i,n)=>i||this.loaded.get(n),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",").map(r=>r.trim())):[]}async load(e,t={}){const{cancelOther:r,injectFontFace:i=!0,injectStyleTag:n=!0,...o}=t;let a,l;typeof e=="string"?a=e:{src:a,family:l}=e;const c=this._parseFamilies(l);if(this.loaded.has(a))return r&&(this.loading.forEach(g=>g.cancel()),this.loading.clear()),u(this.loaded.get(a));let h=this.loading.get(a);return h||(h=this._createRequest(a,o),this.loading.set(a,h)),r&&this.loading.forEach((g,p)=>{g!==h&&(g.cancel(),this.loading.delete(p))}),h.when.then(g=>{let p;return this.loaded.has(a)?p=u(this.loaded.get(a)):(p=d(g),t.noAdd||this.loaded.set(a,p)),Promise.all(Array.from(p.familySet).map(y=>(this.familyToUrl.set(y,a),typeof document<"u"&&(i&&this.injectFontFace(y,g),n&&this.injectStyleTag(y,a),i||n)?document.fonts.load(`14px ${y}`):Promise.resolve()))).then(()=>p)}).catch(g=>{if(g instanceof DOMException&&g.message==="The user aborted a request.")return d();throw g}).finally(()=>{this.loading.delete(a)});function u(g){return c.forEach(p=>{g.familySet.add(p)}),g}function d(g=new ArrayBuffer(0)){let p;function y(){return p||(p=g.byteLength?fl(g,!1):void 0),p}function m(){const P=y();if(P instanceof it||P instanceof Zi)return P.sfnt}return{src:a,family:l,buffer:g,familySet:new Set(c),getFont:y,getSFNT:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}}const Tn=new Ji,Xd=Object.freeze(Object.defineProperty({__proto__:null,BaseFont:Ni,get Cff(){return Yt},get Cmap(){return br},CmapSubtableFormat0:pn,CmapSubtableFormat12:vn,CmapSubtableFormat14:ei,CmapSubtableFormat2:Zr,CmapSubtableFormat4:yn,CmapSubtableFormat6:Zt,FontDataObject:We,FontDataView:me,Fonts:Ji,get Glyf(){return qi},Glyph:un,GlyphSet:fn,get Gpos(){return wn},get Gsub(){return At},get Head(){return ue},get Hhea(){return we},get Hmtx(){return Xi},get Kern(){return xn},get Loca(){return Hi},get Maxp(){return ve},get Name(){return wr},get Os2(){return W},get Post(){return Ye},SFNT:gt,TTF:it,TableDirectory:vr,get Vhea(){return xe},get Vmtx(){return Ki},WOFF:Zi,WOFFTableDirectoryEntry:Qt,createCmapSegments:mn,dataTypeToByteLength:Hr,defineColumn:v,defineSFNTTable:be,fonts:Tn,parseFont:fl,parseSFNTFont:ul},Symbol.toStringTag,{value:"Module"}));class Hd{currentCall;calls=[];createCall(e){return{renderable:e,parentCall:this.currentCall,fn:e.render.bind(e),calls:[]}}push(e){const t=this.createCall(e);return(this.currentCall?.calls??this.calls).push(t),t}render(e){this.calls.forEach(function t(r){r.fn(e,()=>{r.calls.forEach(t)})}),this.calls=[]}}var Yd=Object.defineProperty,Kd=Object.getOwnPropertyDescriptor,ii=(s,e,t,r)=>{for(var i=r>1?void 0:r?Kd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Yd(e,t,i),i};f.Timeline=class extends f.Node{static from(e,t=!1){const[r,i]=e?Array.isArray(e)?e:[0,e]:[];return new f.Timeline({startTime:r,endTime:i,loop:t})}constructor(e){super(),this.setProperties(e)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"startTime":this.startTime=Math.min(t,this.endTime);break;case"endTime":this.endTime=t||Number.MAX_SAFE_INTEGER;break}}addTime(e){const t=this.startTime,r=this.endTime;let i=this.currentTime;return i=i+e,this.loop&&i>r&&(i=t+i%r),i=ut(i,t,r),this.currentTime=i,this.emit("updateCurrentTime",i,e),this}_process(e){super._process(e),this.addTime(e)}},ii([_({fallback:0})],f.Timeline.prototype,"startTime",2),ii([_({fallback:0})],f.Timeline.prototype,"currentTime",2),ii([_({fallback:Number.MAX_SAFE_INTEGER})],f.Timeline.prototype,"endTime",2),ii([_({fallback:!1})],f.Timeline.prototype,"loop",2),f.Timeline=ii([X("Timeline")],f.Timeline);var Zd=Object.defineProperty,Jd=Object.getOwnPropertyDescriptor,dl=(s,e,t,r)=>{for(var i=r>1?void 0:r?Jd(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&Zd(e,t,i),i};f.Window=class extends f.Viewport{},dl([_({fallback:!1})],f.Window.prototype,"msaa",2),f.Window=dl([X("Window")],f.Window);var Qd=Object.defineProperty,si=(s,e,t,r)=>{for(var i=void 0,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(e,t,i)||i);return i&&Qd(e,t,i),i};class er extends Ci{input=new jo;renderStack=new Hd;root=new f.Window(!0).setTree(this);_backgroundColor=new Qe;_currentViewport;getCurrentViewport(){return this._currentViewport}setCurrentViewport(e){this._currentViewport=e}constructor(e){super(),this.setProperties(e)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"backgroundColor":this._backgroundColor.value=t;break;case"timeline":this.timeline.setTree(this);break}}log(...e){this.debug&&console.log(`[modern-canvas][${performance.now().toFixed(4)}ms]`,...e)}_process(e=0){this.timeline.emit("process",e),this.emit("processing"),this.root.emit("process",e),this.emit("processed")}_render(e){this.emit("rendering"),this.renderStack.render(e),this._renderScreen(e),this.emit("rendered")}_renderScreen(e){this.root.msaa&&e.framebuffer.finishRenderPass(this.root._glFramebuffer(e)),e.state.reset(),e.framebuffer.bind(null),e.gl.bindFramebuffer(e.gl.FRAMEBUFFER,null),e.viewport.bind({x:0,y:0,width:this.root.width*e.pixelRatio,height:this.root.height*e.pixelRatio}),this.backgroundColor&&e.gl.clearColor(...this._backgroundColor.toArray()),e.clear(),this.backgroundColor&&e.gl.clearColor(0,0,0,0);const t=this.root.texture;t.activate(e,0),Q.draw(e),e.texture.unbind(t)}destroy(){this.root.destroy(),this.input.destroy(),super.destroy()}}si([_()],er.prototype,"backgroundColor"),si([_({internal:!0,fallback:!1})],er.prototype,"debug"),si([_({internal:!0,fallback:!1})],er.prototype,"processPaused"),si([_({internal:!0,default:()=>Tn})],er.prototype,"fonts"),si([_({internal:!0,default:()=>new f.Timeline})],er.prototype,"timeline");var ep=Object.getOwnPropertyDescriptor,tp=(s,e,t,r)=>{for(var i=r>1?void 0:r?ep(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=o(i)||i);return i};f.Transition=class extends f.Effect{constructor(e,t=[]){super(),this.setProperties(e).append(t)}},f.Transition=tp([X("Transition",{effectMode:"transition",processMode:"pausable",duration:2e3})],f.Transition);var rp=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,Sn=(s,e,t,r)=>{for(var i=r>1?void 0:r?ip(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&rp(e,t,i),i};f.Node2D=class extends f.CanvasItem{position=new de().on("update",()=>this.updateGlobalTransform());scale=new de(1,1).on("update",()=>this.updateGlobalTransform());skew=new de().on("update",()=>this.updateGlobalTransform());transform=new ke;globalPosition=new de;globalScale=new de;globalSkew=new de;globalTransform=new ke;_parentTransformDirtyId;constructor(e,t=[]){super(),this.setProperties(e).append(t)}_updateProperty(e,t,r){switch(super._updateProperty(e,t,r),e){case"rotation":this.updateGlobalTransform();break}}getTransformOrigin(){return new de(0,0)}updateTransform(e){const t=this.getTransformOrigin(),r=this.transform.identity().translate(-t.x,-t.y).scale(this.scale.x,this.scale.y).skew(this.skew.x,this.skew.y).rotate(this.rotation);e?.(r),r.translate(this.position.x,this.position.y).translate(t.x,t.y)}updateGlobalTransform(){this.updateTransform();const e=this.getParent();if(e?.globalTransform){const{globalPosition:t,globalScale:r,globalSkew:i,globalTransform:n,globalRotation:o}=e;this._parentTransformDirtyId=n.dirtyId,this.globalPosition.set(t.x+this.position.x,t.y+this.position.y),this.globalScale.set(r.x*this.scale.x,r.y*this.scale.y),this.globalSkew.set(i.x*this.skew.x,i.y*this.skew.y),this.globalRotation=o+this.rotation,e.globalTransform.multiply(this.transform,this.globalTransform)}else this.globalPosition.copy(this.position),this.globalScale.copy(this.scale),this.globalSkew.copy(this.skew),this.globalRotation=this.rotation,this.globalTransform.copy(this.transform);this.requestRelayout()}_transformVertices(e,t){let r,i,n,o,a,l;if(t){const h=this.globalTransform.clone();h.multiply(t),[r,i,n,o,a,l]=h.toArray()}else[r,i,n,o,a,l]=this.globalTransform.toArray();const c=e.slice();for(let h=e.length,u=0;u<h;u+=2){const d=e[u],g=e[u+1];c[u]=r*d+i*g+n,c[u+1]=o*d+a*g+l}return c}_relayout(e){return e=super._relayout(e),this.updateGlobalTransform(),e.map(t=>({...t,vertices:this._transformVertices(t.vertices,t.vertTransform)}))}_process(e){super._process(e);const t=this.getParent();t?.globalTransform&&this._parentTransformDirtyId!==t?.globalTransform?.dirtyId&&this.requestRelayout()}toLocal(e,t){return this.globalTransform.applyAffineInverse(e,t)}toGlobal(e,t){return this.globalTransform.apply(e,t)}},Sn([_({internal:!0,fallback:0})],f.Node2D.prototype,"rotation",2),Sn([_({internal:!0,fallback:0})],f.Node2D.prototype,"globalRotation",2),f.Node2D=Sn([X("Node2D")],f.Node2D);var sp=Object.defineProperty,np=Object.getOwnPropertyDescriptor,Qi=(s,e,t,r)=>{for(var i=r>1?void 0:r?np(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&sp(e,t,i),i};f.Camera2D=class extends f.Node2D{_screenOffset={x:0,y:0};_zoom=new de(1,1).on("update",()=>this.updateCanvasTransform());get zoom(){return this._zoom}set zoom(e){this._zoom.set(e.x,e.y)}_minZoom=new de(.02,.02);get minZoom(){return this._minZoom}set minZoom(e){this._minZoom.set(e.x,e.y)}_maxZoom=new de(256,256);get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom.set(e.x,e.y)}constructor(e,t=[]){super(),this.setProperties(e).append(t)}setProperties(e){if(e){const{zoom:t,minZoom:r,maxZoom:i,...n}=e;t&&(this.zoom=t),r&&(this.minZoom=r),i&&(this.maxZoom=i),super.setProperties(n)}return this}addZoom(e,t=e){return this.setZoom(this._zoom.x+e,this._zoom.y+t)}setZoom(e,t=e){return this._zoom.set(ut(e,this._minZoom.x,this._maxZoom.x),ut(t,this._minZoom.y,this._maxZoom.y)),this}_input(e,t){if(super._input(e,t),t==="keydown"){const r=e;!this.spaceKey&&r.code==="Space"&&(r.cursor="grab",this.spaceKey=!0)}else if(t==="keyup"){const r=e;r.code==="Space"&&(r.cursor="default",this.spaceKey=!1,this.grabbing=!1)}else if(t==="pointerdown"){const r=e;!this.grabbing&&(this.spaceKey||r.button===1)&&(this.grabbing=!0,r.cursor="grabbing",this._screenOffset={x:r.screenX,y:r.screenY})}else if(t==="pointermove"){const r=e;this.grabbing&&(this.position.add(-(this._screenOffset.x-r.screenX),-(this._screenOffset.y-r.screenY)),this._screenOffset={x:r.screenX,y:r.screenY})}else if(t==="pointerup"){const r=e;this.grabbing&&(this.grabbing=!1,this.spaceKey?r.cursor="grab":r.cursor="default")}else t==="wheel"&&this._onWheel(e)}_onWheel(e){if(e.ctrlKey){if(!(e.wheelDeltaY?Math.abs(Math.abs(e.wheelDeltaY)-Math.abs(3*e.deltaY))<3:e.deltaMode===0)){e.preventDefault();const r=this._zoom.x;this.zoomWithWheel(e.deltaY);const i=1-this._zoom.x/r;this.position.add((e.screenX-this.position.x)*i,(e.screenY-this.position.y)*i)}}else e.preventDefault(),this.position.add(-e.deltaX,-e.deltaY)}zoomWithWheel(e){const t=Math.log(this._zoom.x),r=-e*this.wheelSensitivity,i=t+r;this.setZoom(Math.exp(i))}updateTransform(){super.updateTransform(),this.updateCanvasTransform()}updateCanvasTransform(){const e=this.getViewport();e&&(e.canvasTransform.identity().scale(this._zoom.x,this._zoom.y).translate(this.position.x,this.position.y),this.emit("updateCanvasTransform"))}toGlobal(e,t){const r=this.getViewport();if(!r)throw new Error("Failed to toGlobal, viewport is empty");return r.toCanvasGlobal(e,t)}toScreen(e,t){const r=this.getViewport();if(!r)throw new Error("Failed to toScreen, viewport is empty");return r.toCanvasScreen(e,t)}toJSON(){return{zoom:this._zoom.toJSON(),minZoom:this._minZoom.toJSON(),maxZoom:this._maxZoom.toJSON(),...super.toJSON()}}},Qi([_({fallback:.02})],f.Camera2D.prototype,"wheelSensitivity",2),Qi([_({internal:!0,fallback:!1})],f.Camera2D.prototype,"spaceKey",2),Qi([_({internal:!0,fallback:!1})],f.Camera2D.prototype,"grabbing",2),f.Camera2D=Qi([X("Camera2D",{processMode:"disabled",renderMode:"disabled"})],f.Camera2D);const pl={brightness:1,contrast:1,grayscale:0,"hue-rotate":0,invert:0,opacity:1,saturate:1,sepia:0};function op(s){const e=new Us;if(s==="none")return e;const t=kr(s).reduce((r,{name:i,args:n})=>(r[i]=n[0].normalizedIntValue,r),{});Object.keys(pl).forEach(r=>{t[r]=t[r]??pl[r]});for(const r in t){const i=t[r];switch(r){case"hue-rotate":e.hueRotate(i*Fe);break;case"saturate":e.saturate(i);break;case"brightness":e.brightness(i);break;case"contrast":e.contrast(i);break;case"invert":e.invert(i);break;case"sepia":e.sepia(i);break;case"opacity":e.opacity(i);break;case"grayscale":e.grayscale(i);break}}return e}function gl(s,e,t,r=new ke){return s=!s||s==="none"?"":s,kr(s,{width:e,height:t}).reverse().forEach(({name:i,args:n})=>{const o=n.map(a=>a.normalizedIntValue);switch(i){case"translate":r.translate(o[0]*e,(o[1]??o[0])*t);break;case"translateX":r.translateX(o[0]*e);break;case"translateY":r.translateY(o[0]*t);break;case"translateZ":r.translateZ(o[0]);break;case"translate3d":r.translate3d(o[0]*e,(o[1]??o[0])*t,o[2]??o[1]??o[0]);break;case"scale":r.scale(o[0],o[1]??o[0]);break;case"scaleX":r.scaleX(o[0]);break;case"scaleY":r.scaleY(o[0]);break;case"scale3d":r.scale3d(o[0],o[1]??o[0],o[2]??o[1]??o[0]);break;case"rotate":r.rotate(o[0]*Fe);break;case"rotateX":r.rotateX(o[0]*Fe);break;case"rotateY":r.rotateY(o[0]*Fe);break;case"rotateZ":r.rotateZ(o[0]*Fe);break;case"rotate3d":r.rotate3d(o[0]*Fe,(o[1]??o[0])*Fe,(o[2]??o[1]??o[0])*Fe,(o[3]??o[2]??o[1]??o[0])*Fe);break;case"skew":r.skew(o[0],o[0]??o[1]);break;case"skewX":r.skewX(o[0]);break;case"skewY":r.skewY(o[0]);break;case"matrix":r.set(o);break}}),r}function ml(s){const[e,t=e]=s.split(" ");return[e,t].map(r=>{switch(r=r.trim(),r){case"left":case"top":return 0;case"center":return .5;case"right":case"bottom":return 1;default:return Number(r)}})}var yl=Object.defineProperty,ap=Object.getOwnPropertyDescriptor,lp=(s,e,t)=>e in s?yl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Ot=(s,e,t,r)=>{for(var i=r>1?void 0:r?ap(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&yl(e,t,i),i},cp=(s,e,t)=>lp(s,e+"",t);f.ColorAdjustEffect=class extends f.Effect{constructor(e,t=[]){super(),this.setProperties(e).append(t)}apply(e,t){t.redraw(e,()=>{Q.draw(e,f.ColorAdjustEffect.material,{sampler:0,saturation:this.saturation,contrast:this.contrast,brightness:this.brightness,red:this.red,green:this.green,blue:this.blue,alpha:this.alpha,gamma:Math.max(this.gamma??1,1e-4)})})}},cp(f.ColorAdjustEffect,"material",new re({vert:`precision mediump float;
|
package/dist/index.mjs
CHANGED
|
@@ -6244,9 +6244,12 @@ let Node = class extends CoreObject {
|
|
|
6244
6244
|
}
|
|
6245
6245
|
findOne(callbackfn) {
|
|
6246
6246
|
for (const child of this._children.default) {
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6247
|
+
if (callbackfn(child)) {
|
|
6248
|
+
return child;
|
|
6249
|
+
}
|
|
6250
|
+
const res = child.findOne(callbackfn);
|
|
6251
|
+
if (res) {
|
|
6252
|
+
return res;
|
|
6250
6253
|
}
|
|
6251
6254
|
}
|
|
6252
6255
|
return void 0;
|
|
@@ -6254,9 +6257,8 @@ let Node = class extends CoreObject {
|
|
|
6254
6257
|
findAll(callbackfn) {
|
|
6255
6258
|
const items = [];
|
|
6256
6259
|
for (const child of this._children.default) {
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
items.push(value);
|
|
6260
|
+
if (callbackfn(child)) {
|
|
6261
|
+
items.push(child);
|
|
6260
6262
|
}
|
|
6261
6263
|
items.push(...child.findAll(callbackfn));
|
|
6262
6264
|
}
|
|
@@ -6265,7 +6267,10 @@ let Node = class extends CoreObject {
|
|
|
6265
6267
|
findAncestor(callbackfn) {
|
|
6266
6268
|
const parent = this._parent;
|
|
6267
6269
|
if (parent) {
|
|
6268
|
-
|
|
6270
|
+
if (callbackfn(parent)) {
|
|
6271
|
+
return parent;
|
|
6272
|
+
}
|
|
6273
|
+
const value = parent.findAncestor(callbackfn);
|
|
6269
6274
|
if (value) {
|
|
6270
6275
|
return value;
|
|
6271
6276
|
}
|