@thorvg/webcanvas 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/index.js +0 -0
- package/dist/thorvg.wasm +0 -0
- package/dist/webcanvas.cjs.js +2 -0
- package/dist/webcanvas.cjs.js.map +1 -0
- package/dist/webcanvas.d.ts +2344 -0
- package/dist/webcanvas.esm.js +2 -0
- package/dist/webcanvas.esm.js.map +1 -0
- package/dist/webcanvas.js +2 -0
- package/dist/webcanvas.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ThorVG={})}(this,function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;function r(){const e=globalThis.__ThorVGModule;if(!e)throw new Error("ThorVG module not initialized. Call ThorVG.init() first.");return e}function n(){return!!globalThis.__ThorVGModule}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function(e){return e[e.Success=0]="Success",e[e.InvalidArguments=1]="InvalidArguments",e[e.InsufficientCondition=2]="InsufficientCondition",e[e.FailedAllocation=3]="FailedAllocation",e[e.MemoryCorruption=4]="MemoryCorruption",e[e.NotSupported=5]="NotSupported",e[e.Unknown=6]="Unknown",e}({});class i extends Error{static fromCode(e,t){return new i(`TVGERR - ${t} failed: ${{0:"Success",1:"Invalid arguments",2:"Insufficient condition",3:"Failed allocation",4:"Memory corruption",5:"Not supported",6:"Unknown error"}[e]??"Unknown error"}`,e,t)}constructor(e,t,r){super(e),a(this,"code",void 0),a(this,"operation",void 0),this.name="ThorVGError",this.code=t,this.operation=r,Error.captureStackTrace&&Error.captureStackTrace(this,i)}}let s;function u(e,t){if(0===e)return;const r=i.fromCode(e,t);if(!s)throw r;s(r,{operation:t})}function l(e,t){const r=new Error(`ERROR - ${t}: ${e}`);if(!s)throw r;s(r,{operation:t})}function c(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function d(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,c(e,t,"get"))}function f(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function p(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,c(e,t,"set"),r),r}var m=new WeakMap,h=new WeakMap;class g{get ptr(){return d(this,h)?(l("Object has been disposed","ptr getter"),0):d(this,m)}set ptr(e){p(this,m,e)}dispose(){d(this,h)||(this._cleanup(d(this,m)),p(this,h,!0))}get isDisposed(){return d(this,h)}constructor(e,t){f(this,m,{writable:!0,value:0}),f(this,h,{writable:!0,value:!1}),p(this,m,e),t&&t.register(this,{ptr:e,cleanup:this._cleanup.bind(this)})}}class _ extends g{_cleanup(e){r()._tvg_paint_unref(e,1)}translate(e,t){return r()._tvg_paint_translate(this.ptr,e,t),this}rotate(e){return r()._tvg_paint_rotate(this.ptr,e),this}scale(e,t=e){return r()._tvg_paint_scale(this.ptr,e,t),this}origin(e,t){return u(r()._tvg_picture_set_origin(this.ptr,e,t),"origin"),this}blend(e){return u(r()._tvg_paint_set_blend_method(this.ptr,e),"blend"),this}opacity(e){const t=r();return void 0!==e?(t._tvg_paint_set_opacity(this.ptr,e),this):t._tvg_paint_get_opacity(this.ptr)}visible(e){const t=r();return void 0!==e?(t._tvg_paint_set_visible(this.ptr,e?1:0),this):Boolean(t._tvg_paint_get_visible(this.ptr))}bounds(e){const t=r();if(e?.oriented){const e=t._malloc(32);try{if(0!==t._tvg_paint_get_obb(this.ptr,e))return[];const r=new Float32Array(t.HEAPF32.buffer,e,8);return[{x:r[0],y:r[1]},{x:r[2],y:r[3]},{x:r[4],y:r[5]},{x:r[6],y:r[7]}]}finally{t._free(e)}}else{const e=t._malloc(16);try{t._tvg_paint_get_aabb(this.ptr,e,e+4,e+8,e+12);const r=new Float32Array(t.HEAPF32.buffer,e,4);return{x:r[0],y:r[1],width:r[2],height:r[3]}}finally{t._free(e)}}}duplicate(){const e=r()._tvg_paint_duplicate(this.ptr);return this._createInstance(e)}transform(e){const t=r(),n=t._malloc(36);try{const r=new Float32Array(t.HEAPF32.buffer,n,9);r[0]=e.e11,r[1]=e.e12,r[2]=e.e13,r[3]=e.e21,r[4]=e.e22,r[5]=e.e23,r[6]=e.e31,r[7]=e.e32,r[8]=e.e33,u(t._tvg_paint_set_transform(this.ptr,n),"transform")}finally{t._free(n)}return this}clip(e){return u(r()._tvg_paint_set_clip(this.ptr,e.ptr),"clip"),this}mask(e,t){return u(r()._tvg_paint_set_mask_method(this.ptr,e.ptr,t),"mask"),this}intersects(e,t,n,a){const o=r();return Boolean(o._tvg_paint_intersects(this.ptr,e,t,n,a))}}const v=new FinalizationRegistry(e=>{e.ptr&&n()&&e.cleanup(e.ptr)}),b=new FinalizationRegistry(e=>{e.ptr&&n()&&e.cleanup(e.ptr)}),w=new FinalizationRegistry(e=>{e.ptr&&n()&&e.cleanup(e.ptr)}),y=new FinalizationRegistry(e=>{e.ptr&&n()&&e.cleanup(e.ptr)}),x=new FinalizationRegistry(e=>{e.ptr&&n()&&e.cleanup(e.ptr)});"undefined"!=typeof window&&window.addEventListener("beforeunload",()=>{n()&&r().term()}),"undefined"!=typeof process&&process.on&&process.on("exit",()=>{n()&&r().term()});class E extends _{_createInstance(e){return new E(e)}add(e){return u(r()._tvg_scene_add(this.ptr,e.ptr),"add"),this}remove(e){const t=r();return e?u(t._tvg_scene_remove(this.ptr,e.ptr),"remove"):u(t._tvg_scene_remove(this.ptr,0),"remove (all)"),this}clear(){return this.remove()}resetEffects(){return u(r()._tvg_scene_clear_effects(this.ptr),"resetEffects"),this}gaussianBlur(e,t=0,n=0,a=75){return u(r()._tvg_scene_add_effect_gaussian_blur(this.ptr,e,t,n,a),"gaussianBlur"),this}dropShadow(e,t,n,a,o,i,s,l=60){return u(r()._tvg_scene_add_effect_drop_shadow(this.ptr,e,t,n,a,o,i,s,l),"dropShadow"),this}fillEffect(e,t,n,a){return u(r()._tvg_scene_add_effect_fill(this.ptr,e,t,n,a),"fillEffect"),this}tint(e,t,n,a,o,i,s){return u(r()._tvg_scene_add_effect_tint(this.ptr,e,t,n,a,o,i,s),"tint"),this}tritone(e,t,n,a,o,i,s,l,c,d){return u(r()._tvg_scene_add_effect_tritone(this.ptr,e,t,n,a,o,i,s,l,c,d),"tritone"),this}constructor(e){const t=r();e||(e=t._tvg_scene_new()),super(e,b)}}function k(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function S(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,k(e,t,"get"))}function T(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function B(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,k(e,t,"set"),r),r}var C=new WeakMap,P=new WeakMap,A=new WeakMap,F=new WeakMap,O=new WeakMap,j=new WeakMap,I=new WeakMap,$=new WeakMap,L=new WeakMap,D=new WeakMap;class M{add(e){return S(this,j)?(S(this,j).add(e),B(this,D,!0),this):(l("Main scene not initialized","add"),this)}remove(e){return S(this,j)?(e?S(this,j).remove(e):S(this,j).remove(),B(this,D,!0),this):(l("Main scene not initialized","remove"),this)}clear(){if(!S(this,P)||!S(this,j))return this;const e=r();return S(this,j).clear(),e._tvg_canvas_draw(S(this,C),1),e._tvg_canvas_sync(S(this,C)),"sw"===S(this,A)&&S(this,F)&&S(this,F).getContext("2d").clearRect(0,0,S(this,F).width,S(this,F).height),this}update(){return u(r()._tvg_canvas_update(S(this,C)),"update"),this}render(){if(!S(this,P)||!S(this,F)||!S(this,j))return this;const e=r();if(S(this,D)&&(e._tvg_canvas_update(S(this,C)),B(this,D,!1)),S(this,O)){const e=this._calculateDPR();if(e!==S(this,L)){B(this,L,e);const t={e11:e,e12:0,e13:0,e21:0,e22:e,e23:0,e31:0,e32:0,e33:1};S(this,j).transform(t)}const t=S(this,I)*e,r=S(this,$)*e;S(this,F).width===t&&S(this,F).height===r||(S(this,F).width=t,S(this,F).height=r,S(this,P).resize(t,r))}return e._tvg_canvas_draw(S(this,C),1),e._tvg_canvas_sync(S(this,C)),"sw"===S(this,A)&&this._updateHTMLCanvas(),this}_calculateDPR(){return 1+.75*(window.devicePixelRatio-1)}_updateHTMLCanvas(){if(!S(this,P)||!S(this,F))return;const e=S(this,P).render(),t=S(this,P).size(),r=S(this,F).getContext("2d"),n=new ImageData(new Uint8ClampedArray(e),t.width,t.height);r.putImageData(n,0,0)}resize(e,t){if(B(this,I,e),B(this,$,t),S(this,F)){S(this,F).style.width=`${e}px`,S(this,F).style.height=`${t}px`;const r=S(this,O)?S(this,L):1,n=e*r,a=t*r;S(this,F).width=n,S(this,F).height=a,S(this,P)&&S(this,P).resize(n,a)}return this}viewport(e,t,n,a){return u(r()._tvg_canvas_set_viewport(S(this,C),e,t,n,a),"viewport"),this}destroy(){if(S(this,j)&&(S(this,j).clear(),S(this,j).dispose(),B(this,j,null)),this.clear(),S(this,C)&&B(this,C,0),S(this,P)&&(S(this,P).delete(),B(this,P,null)),S(this,F)&&"sw"===S(this,A)){const e=S(this,F).getContext("2d");e&&e.clearRect(0,0,S(this,F).width,S(this,F).height)}}get renderer(){return S(this,A)}get dpr(){return S(this,L)}constructor(e,t={}){T(this,C,{writable:!0,value:0}),T(this,P,{writable:!0,value:null}),T(this,A,{writable:!0,value:void 0}),T(this,F,{writable:!0,value:null}),T(this,O,{writable:!0,value:void 0}),T(this,j,{writable:!0,value:null}),T(this,I,{writable:!0,value:0}),T(this,$,{writable:!0,value:0}),T(this,L,{writable:!0,value:1}),T(this,D,{writable:!0,value:!1});const{width:n=800,height:a=600,enableDevicePixelRatio:o=!0}=t;B(this,I,n),B(this,$,a),B(this,O,o);const i=Te();B(this,A,i);const s=r(),c=o?this._calculateDPR():1;B(this,L,c);const d=n*c,f=a*c;B(this,P,new s.TvgCanvas(i,e,d,f));const p=S(this,P).error();"None"===p?(B(this,C,S(this,P).ptr()),0!==S(this,C)?(B(this,F,document.querySelector(e)),S(this,F)?(S(this,F).style.width=`${n}px`,S(this,F).style.height=`${a}px`,S(this,F).width=d,S(this,F).height=f,B(this,j,new E),o&&S(this,j).scale(c,c),u(s._tvg_canvas_add(S(this,C),S(this,j).ptr),"add main scene")):l(`Failed to create canvas with ${i} renderer: HTML canvas element not found`,"Canvas constructor")):l(`Failed to create canvas with ${i} renderer: engine pointer is 0`,"Canvas constructor")):l(`Failed to create canvas with ${i} renderer: ${p}`,"Canvas constructor")}}class R extends g{_cleanup(e){r()._tvg_gradient_del(e)}addStop(e,t){return this._stops.push({offset:e,color:t}),this}clearStops(){return this._stops=[],this}setStops(...e){this._stops=[];for(const[t,r]of e)this._stops.push({offset:t,color:r});return this}_applyStops(){if(0===this._stops.length)return;const e=r(),t=this._stops.length,n=e._malloc(8*t);try{const r=new DataView(e.HEAPU8.buffer,n,8*t);for(let e=0;e<t;e++){const t=this._stops[e],n=8*e;r.setFloat32(n,t.offset,!0),r.setUint8(n+4,t.color[0]),r.setUint8(n+5,t.color[1]),r.setUint8(n+6,t.color[2]),r.setUint8(n+7,t.color[3])}e._tvg_gradient_set_color_stops(this.ptr,n,t)}finally{e._free(n),this._stops=[]}}spread(e){return r()._tvg_gradient_set_spread(this.ptr,e),this}constructor(...e){var t,r;super(...e),r=[],(t="_stops")in this?Object.defineProperty(this,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[t]=r}}class V extends _{_createInstance(e){return new V(e)}moveTo(e,t){return u(r()._tvg_shape_move_to(this.ptr,e,t),"moveTo"),this}lineTo(e,t){return u(r()._tvg_shape_line_to(this.ptr,e,t),"lineTo"),this}cubicTo(e,t,n,a,o,i){return u(r()._tvg_shape_cubic_to(this.ptr,e,t,n,a,o,i),"cubicTo"),this}close(){return u(r()._tvg_shape_close(this.ptr),"close"),this}appendRect(e,t,n,a,o={}){const i=r(),{rx:s=0,ry:l=0,clockwise:c=!0}=o;return u(i._tvg_shape_append_rect(this.ptr,e,t,n,a,s,l,c?1:0),"appendRect"),this}appendCircle(e,t,n,a=n,o=!0){return u(r()._tvg_shape_append_circle(this.ptr,e,t,n,a,o?1:0),"appendCircle"),this}fillRule(e){return u(r()._tvg_shape_set_fill_rule(this.ptr,e),"fillRule"),this}trimPath(e,t,n=!0){return u(r()._tvg_shape_set_trimpath(this.ptr,e,t,n?1:0),"trimPath"),this}fill(e,t,n,a=255){const o=r();if(e instanceof R)e._applyStops(),u(o._tvg_shape_set_gradient(this.ptr,e.ptr),"fill (gradient)");else{if("number"!=typeof e||void 0===t||void 0===n)throw new TypeError("Invalid fill arguments");u(o._tvg_shape_set_fill_color(this.ptr,e,t,n,a),"fill (color)")}return this}stroke(e){const t=r();if("number"==typeof e)u(t._tvg_shape_set_stroke_width(this.ptr,e),"stroke (width)");else{const{width:r,color:n,cap:a,join:o,gradient:i,miterLimit:s,dash:l,dashOffset:c}=e;if(void 0!==r&&u(t._tvg_shape_set_stroke_width(this.ptr,r),"stroke (width)"),n){const[e,r,a,o=255]=n;u(t._tvg_shape_set_stroke_color(this.ptr,e,r,a,o),"stroke (color)")}if(i&&(i._applyStops(),u(t._tvg_shape_set_stroke_gradient(this.ptr,i.ptr),"stroke (gradient)")),void 0!==a&&u(t._tvg_shape_set_stroke_cap(this.ptr,a),"stroke (cap)"),void 0!==o&&u(t._tvg_shape_set_stroke_join(this.ptr,o),"stroke (join)"),void 0!==s&&u(t._tvg_shape_set_stroke_miterlimit(this.ptr,s),"stroke (miterLimit)"),void 0!==l||void 0!==c){let e=l,r=c??0;if(void 0===e&&void 0!==c){const r=t._malloc(4),n=t._malloc(4),a=t._malloc(4);try{if(0===t._tvg_shape_get_stroke_dash(this.ptr,a,r,n)){const n=t.HEAPU32[r/4];if(n>0){const r=t.HEAPU32[a/4];e=[];for(let a=0;a<n;a++)e.push(t.HEAPF32[r/4+a])}}}finally{t._free(r),t._free(n),t._free(a)}}if(void 0!==e)if(0===e.length)u(t._tvg_shape_set_stroke_dash(this.ptr,0,0,0),"stroke (dash reset)");else{const n=t._malloc(4*e.length);try{for(let r=0;r<e.length;r++)t.HEAPF32[n/4+r]=e[r];u(t._tvg_shape_set_stroke_dash(this.ptr,n,e.length,r),"stroke (dash)")}finally{t._free(n)}}}}return this}reset(){return u(r()._tvg_shape_reset(this.ptr),"reset"),this}constructor(e){const t=r();e||(e=t._tvg_shape_new()),super(e,v)}}var W=function(e){return e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e[e.Add=16]="Add",e[e.Composition=255]="Composition",e}({}),U=function(e){return e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Square=2]="Square",e}({}),z=function(e){return e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel",e}({}),G=function(e){return e[e.Winding=0]="Winding",e[e.EvenOdd=1]="EvenOdd",e}({}),N=function(e){return e[e.Pad=0]="Pad",e[e.Reflect=1]="Reflect",e[e.Repeat=2]="Repeat",e}({}),J=function(e){return e[e.None=0]="None",e[e.ClipPath=1]="ClipPath",e[e.AlphaMask=2]="AlphaMask",e[e.InvAlphaMask=3]="InvAlphaMask",e[e.LumaMask=4]="LumaMask",e[e.InvLumaMask=5]="InvLumaMask",e}({}),H=function(e){return e[e.None=0]="None",e[e.Alpha=1]="Alpha",e[e.InvAlpha=2]="InvAlpha",e[e.Luma=3]="Luma",e[e.InvLuma=4]="InvLuma",e[e.Add=5]="Add",e[e.Subtract=6]="Subtract",e[e.Intersect=7]="Intersect",e[e.Difference=8]="Difference",e[e.Lighten=9]="Lighten",e[e.Darken=10]="Darken",e}({}),q=function(e){return e[e.ClearAll=0]="ClearAll",e[e.GaussianBlur=1]="GaussianBlur",e[e.DropShadow=2]="DropShadow",e[e.Fill=3]="Fill",e[e.Tint=4]="Tint",e[e.Tritone=5]="Tritone",e}({}),X=function(e){return e[e.None=0]="None",e[e.Character=1]="Character",e[e.Word=2]="Word",e[e.Smart=3]="Smart",e[e.Ellipsis=4]="Ellipsis",e}({}),Q=function(e){return e[e.ABGR8888=0]="ABGR8888",e[e.ARGB8888=1]="ARGB8888",e[e.ABGR8888S=2]="ABGR8888S",e[e.ARGB8888S=3]="ARGB8888S",e[e.Grayscale8=4]="Grayscale8",e[e.Unknown=255]="Unknown",e}({}),K=Object.freeze({__proto__:null,BlendMethod:W,ColorSpace:Q,CompositeMethod:J,FillRule:G,GradientSpread:N,MaskMethod:H,SceneEffect:q,StrokeCap:U,StrokeJoin:z,TextWrapMode:X});class Z extends _{_createInstance(e){return new Z(e)}load(e,t={}){const n=r(),{type:a="svg",width:o,height:i,colorSpace:s=Q.ARGB8888}=t,c="string"==typeof e?(new TextEncoder).encode(e):e;if("raw"===a){if(!o||!i)return l("Width and height are required for raw image format","load"),this;const e=n._malloc(c.length);n.HEAPU8.set(c,e);try{u(n._tvg_picture_load_raw(this.ptr,e,o,i,s,1),"load")}finally{n._free(e)}return this}const d=n._malloc(c.length);n.HEAPU8.set(c,d);try{u(n._tvg_picture_load_data(this.ptr,d,c.length,a,"",1),"load")}finally{n._free(d)}return this}size(e,t){const n=r();if(void 0!==e&&void 0!==t)return u(n._tvg_picture_set_size(this.ptr,e,t),"size (set)"),this;const a=n._malloc(8);try{n._tvg_picture_get_size(this.ptr,a,a+4);const e=new Float32Array(n.HEAPF32.buffer,a,2);return{width:e[0],height:e[1]}}finally{n._free(a)}}constructor(e,t=!1){const n=r();e||(e=n._tvg_picture_new()),super(e,t?void 0:w)}}class Y extends _{_createInstance(e){return new Y(e)}font(e){const t=r(),n=t._malloc(e.length+1);t.HEAPU8.set((new TextEncoder).encode(e),n),t.HEAPU8[n+e.length]=0;try{u(t._tvg_text_set_font(this.ptr,n),"font")}finally{t._free(n)}return this}text(e){const t=r(),n=(new TextEncoder).encode(e),a=t._malloc(n.length+1);t.HEAPU8.set(n,a),t.HEAPU8[a+n.length]=0;try{u(t._tvg_text_set_text(this.ptr,a),"text")}finally{t._free(a)}return this}fontSize(e){return u(r()._tvg_text_set_size(this.ptr,e),"fontSize"),this}fill(e,t,n){const a=r();if(e instanceof R)e._applyStops(),u(a._tvg_text_set_gradient(this.ptr,e.ptr),"fill (gradient)");else{if("number"!=typeof e||void 0===t||void 0===n)throw new TypeError("Invalid fill arguments");u(a._tvg_text_set_color(this.ptr,e,t,n),"fill (color)")}return this}align(e,t){return u(r()._tvg_text_align(this.ptr,e,t),"align"),this}layout(e,t=0){return u(r()._tvg_text_layout(this.ptr,e,t),"layout"),this}wrap(e){return u(r()._tvg_text_wrap_mode(this.ptr,e),"wrap"),this}spacing(e,t){return u(r()._tvg_text_spacing(this.ptr,e,t),"spacing"),this}italic(e=.18){return u(r()._tvg_text_set_italic(this.ptr,e),"italic"),this}outline(e,t,n,a){return u(r()._tvg_text_set_outline(this.ptr,e,t,n,a),"outline"),this}constructor(e){const t=r();e||(e=t._tvg_text_new()),super(e,y)}}function ee(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function te(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function re(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,te(e,t,"get"))}function ne(e,t,r){ee(e,t),t.set(e,r)}function ae(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,te(e,t,"set"),r),r}var oe=new WeakMap,ie=new WeakMap,se=new WeakMap,ue=new WeakMap,le=new WeakMap,ce=new WeakMap,de=new WeakMap,fe=new WeakMap,pe=new WeakMap,me=new WeakMap,he=new WeakSet;class ge{get ptr(){return re(this,oe)}get picture(){if(!re(this,ie)&&re(this,oe)){const e=r()._tvg_animation_get_picture(re(this,oe));e&&ae(this,ie,new Z(e,!0))}return re(this,ie)}load(e){const t=this.picture;return t?(t.load(e,{type:"lot"}),function(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,he,_e).call(this),this):(l("Failed to get picture from animation","load"),this)}info(){return re(this,se)}frame(e){const t=r();return void 0!==e?(ae(this,le,e),u(t._tvg_animation_set_frame(re(this,oe),e),"frame (set)"),this):re(this,le)}segment(e){return u(r()._tvg_animation_set_segment(re(this,oe),e),"segment"),this}play(e){return re(this,ue)?this:re(this,se)?(ae(this,ue,!0),ae(this,fe,e),ae(this,de,0),re(this,me).call(this,performance.now()),this):(l("No animation loaded","play"),this)}pause(){return ae(this,ue,!1),null!==re(this,ce)&&(cancelAnimationFrame(re(this,ce)),ae(this,ce,null)),this}stop(){return this.pause(),this.frame(0),this}isPlaying(){return re(this,ue)}setLoop(e){return ae(this,pe,e),this}getLoop(){return re(this,pe)}seek(e){if(!re(this,se))return l("No animation loaded","seek"),this;const t=e/re(this,se).duration*re(this,se).totalFrames;return this.frame(Math.max(0,Math.min(re(this,se).totalFrames-1,t))),this}getCurrentTime(){return re(this,se)?re(this,le)/re(this,se).totalFrames*re(this,se).duration:0}dispose(){this.pause(),re(this,oe)&&(r()._tvg_animation_del(re(this,oe)),ae(this,oe,0),ae(this,ie,null),ae(this,se,null))}constructor(){var e;ee(this,e=he),e.add(this),ne(this,oe,{writable:!0,value:void 0}),ne(this,ie,{writable:!0,value:null}),ne(this,se,{writable:!0,value:null}),ne(this,ue,{writable:!0,value:!1}),ne(this,le,{writable:!0,value:0}),ne(this,ce,{writable:!0,value:null}),ne(this,de,{writable:!0,value:0}),ne(this,fe,{writable:!0,value:void 0}),ne(this,pe,{writable:!0,value:!0}),ne(this,me,{writable:!0,value:e=>{if(!re(this,ue)||!re(this,se))return;0===re(this,de)&&ae(this,de,e);const t=(e-re(this,de))/1e3;ae(this,de,e);const n=re(this,se).fps*t;if(ae(this,le,re(this,le)+n),re(this,le)>=re(this,se).totalFrames){if(!re(this,pe))return ae(this,le,re(this,se).totalFrames-1),void this.pause();ae(this,le,re(this,le)%re(this,se).totalFrames)}r()._tvg_animation_set_frame(re(this,oe),re(this,le)),re(this,fe)&&re(this,fe).call(this,re(this,le)),ae(this,ce,requestAnimationFrame(re(this,me)))}});const t=r();ae(this,oe,t._tvg_animation_new()),re(this,oe)||(l("Failed to create animation","Animation constructor"),ae(this,oe,0))}}function _e(){const e=r(),t=e._malloc(4),n=e._malloc(4);try{e._tvg_animation_get_total_frame(re(this,oe),t),e._tvg_animation_get_duration(re(this,oe),n);const r=new Float32Array(e.HEAPF32.buffer,t,1)[0],a=new Float32Array(e.HEAPF32.buffer,n,1)[0];ae(this,se,{totalFrames:r,duration:a,fps:r/a})}finally{e._free(t),e._free(n)}}class ve extends R{build(){return this._applyStops(),this}constructor(e,t,n,a){const o=r(),i=o._tvg_linear_gradient_new();super(i,x),o._tvg_linear_gradient_set(i,e,t,n,a)}}class be extends R{build(){return this._applyStops(),this}constructor(e,t,n,a=e,o=t,i=0){const s=r(),u=s._tvg_radial_gradient_new();super(u,x),s._tvg_radial_gradient_set(u,e,t,n,a,o,i)}}class we{static load(e,t,n={}){const a=r(),{type:o="ttf"}=n,i=a._malloc(e.length+1);a.HEAPU8.set((new TextEncoder).encode(e),i),a.HEAPU8[i+e.length]=0;const s=a._malloc(t.length);a.HEAPU8.set(t,s);const l=a._malloc(o.length+1);a.HEAPU8.set((new TextEncoder).encode(o),l),a.HEAPU8[l+o.length]=0;try{u(a._tvg_font_load_data(i,s,t.length,l,1),`Font.load("${e}")`)}finally{a._free(i),a._free(s),a._free(l)}}static unload(e){const t=r(),n=t._malloc(e.length+1);t.HEAPU8.set((new TextEncoder).encode(e),n),t.HEAPU8[n+e.length]=0;try{u(t._tvg_font_unload(n),`Font.unload("${e}")`)}finally{t._free(n)}}}function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}async function xe(e={}){var r=e,n=!!globalThis.window,a=!!globalThis.WorkerGlobalScope,o=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(o){const{createRequire:e}=await import("module");var i=e("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("webcanvas.js",document.baseURI).href)}var s,u,l=(e,t)=>{throw t},c="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("webcanvas.js",document.baseURI).href,d="";if(o){var f=i("fs");c.startsWith("file:")&&(d=i("path").dirname(i("url").fileURLToPath(c))+"/"),u=e=>(e=F(e)?new URL(e):e,f.readFileSync(e)),s=async(e,t=!0)=>(e=F(e)?new URL(e):e,f.readFileSync(e,t?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),l=(e,t)=>{throw process.exitCode=e,t}}else if(n||a){try{d=new URL(".",c).href}catch{}a&&(u=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),s=async e=>{if(F(e))return new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)}}var p,m,h,g,_,v,b,w,y,x,E,k,S,T,B,C=function(){}.bind(),P=function(){}.bind(),A=!1,F=e=>e.startsWith("file://"),O=!1;function j(){var e=Wr.buffer;_=new Int8Array(e),b=new Int16Array(e),r.HEAPU8=v=new Uint8Array(e),w=new Uint16Array(e),y=new Int32Array(e),x=new Uint32Array(e),r.HEAPF32=E=new Float32Array(e),k=new Float64Array(e),S=new BigInt64Array(e),T=new BigUint64Array(e)}function I(e){r.onAbort?.(e),P(e="Aborted("+e+")"),A=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw g?.(t),t}class ${constructor(e){ye(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var L=e=>{for(;e.length>0;)e.shift()(r)},D=[],M=e=>D.push(e),R=[],V=e=>R.push(e),W=!0,U=e=>$r(e),z=()=>Dr(),G=new TextDecoder,N=(e,t,r,n)=>{var a=t+r;if(n)return a;for(;e[t]&&!(t>=a);)++t;return t},J=(e,t,r)=>{if(!e)return"";var n=N(v,e,t,r);return G.decode(v.subarray(e,n))},H=0;class q{set_type(e){x[this.ptr+4>>2]=e}get_type(){return x[this.ptr+4>>2]}set_destructor(e){x[this.ptr+8>>2]=e}get_destructor(){return x[this.ptr+8>>2]}set_caught(e){_[this.ptr+12]=e=e?1:0}get_caught(){return 0!=_[this.ptr+12]}set_rethrown(e){_[this.ptr+13]=e=e?1:0}get_rethrown(){return 0!=_[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){x[this.ptr+16>>2]=e}get_adjusted_ptr(){return x[this.ptr+16>>2]}constructor(e){this.excPtr=e,this.ptr=e-24}}var X=e=>Ir(e),Q=e=>{var t=H;if(!t)return X(0),0;var r=new q(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return X(0),t;for(var a of e){if(0===a||a===n)break;if(Rr(a,n,r.ptr+16))return X(a),t}return X(n),t},K=e=>{for(var t="";;){var r=v[e++];if(!r)return t;t+=String.fromCharCode(r)}},Z={},Y={},ee={},te=class extends Error{constructor(e){super(e),this.name="BindingError"}},re=e=>{throw new te(e)};function ne(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||re(`type "${n}" must have a positive integer typeid pointer`),Y.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;re(`Cannot register type '${n}' twice`)}if(Y[e]=t,delete ee[e],Z.hasOwnProperty(e)){var a=Z[e];delete Z[e],a.forEach(e=>e())}}(e,t,r)}var ae=(e,t,r)=>{switch(t){case 1:return r?e=>_[e]:e=>v[e];case 2:return r?e=>b[e>>1]:e=>w[e>>1];case 4:return r?e=>y[e>>2]:e=>x[e>>2];case 8:return r?e=>S[e>>3]:e=>T[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},oe=e=>{re(e.$$.ptrType.registeredClass.name+" instance already deleted")},ie=!1,se=e=>{},ue=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},le=e=>globalThis.FinalizationRegistry?(ie=new FinalizationRegistry(e=>{ue(e.$$)}),le=e=>{var t=e.$$;return!t.smartPtr||ie.register(e,{$$:t},e),e},se=e=>ie.unregister(e),le(e)):(le=e=>e,e);function ce(){}var de=(e,t)=>Object.defineProperty(t,"name",{value:e}),fe={},pe=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||re(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},me=(e,t,n)=>{r.hasOwnProperty(e)?((void 0===n||void 0!==r[e].overloadTable&&void 0!==r[e].overloadTable[n])&&re(`Cannot register public name '${e}' twice`),pe(r,e,e),r[e].overloadTable.hasOwnProperty(n)&&re(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),r[e].overloadTable[n]=t):(r[e]=t,r[e].argCount=n)};function he(e,t,r,n,a,o,i,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}var ge=(e,t,r)=>{for(;t!==r;)t.upcast||re(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},_e=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function ve(e,t){return null===t?(this.isReference&&re(`null is not a valid ${this.name}`),0):(t.$$||re(`Cannot pass "${_e(t)}" as a ${this.name}`),t.$$.ptr||re(`Cannot pass deleted object as a pointer of type ${this.name}`),ge(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass))}function be(e,t){var r;if(null===t)return this.isReference&&re(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;if(t&&t.$$||re(`Cannot pass "${_e(t)}" as a ${this.name}`),t.$$.ptr||re(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&re(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`),r=ge(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&re("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:re(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Je.toHandle(()=>n.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:re("Unsupporting sharing policy")}return r}function we(e,t){return null===t?(this.isReference&&re(`null is not a valid ${this.name}`),0):(t.$$||re(`Cannot pass "${_e(t)}" as a ${this.name}`),t.$$.ptr||re(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&re(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`),ge(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass))}function xe(e){return this.fromWireType(x[e>>2])}var Ee=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=Ee(e,t,r.baseClass);return null===n?null:r.downcast(n)},ke={},Se=class extends Error{constructor(e){super(e),this.name="InternalError"}},Te=e=>{throw new Se(e)},Be=(e,t)=>(t.ptrType&&t.ptr||Te("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Te("Both smartPtrType and smartPtr must be specified"),t.count={value:1},le(Object.create(e,{$$:{value:t,writable:!0}})));function Ce(e,t,r,n,a,o,i,s,u,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=be:n?(this.toWireType=ve,this.destructorFunction=null):(this.toWireType=we,this.destructorFunction=null)}var Pe=(e,t,n)=>{r.hasOwnProperty(e)||Te("Replacing nonexistent public symbol"),void 0!==r[e].overloadTable&&void 0!==n?r[e].overloadTable[n]=t:(r[e]=t,r[e].argCount=n)},Ae=e=>Ur.get(e),Fe=(e,t,r=!1)=>{e=K(e);var n=Ae(t);return"function"!=typeof n&&re(`unknown function pointer with signature ${e}: ${t}`),n};class Oe extends Error{}var je=e=>{var t=ir(e),r=K(t);return ar(t),r},Ie=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||Y[t]||(ee[t]?ee[t].forEach(e):(r.push(t),n[t]=!0))}),new Oe(`${e}: `+r.map(je).join([", "]))},$e=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&Te("Mismatched type converter count");for(var a=0;a<e.length;++a)ne(e[a],n[a])}e.forEach(e=>ee[e]=t);var a=new Array(t.length),o=[],i=0;for(let[e,r]of t.entries())Y.hasOwnProperty(r)?a[e]=Y[r]:(o.push(r),Z.hasOwnProperty(r)||(Z[r]=[]),Z[r].push(()=>{a[e]=Y[r],++i===o.length&&n(a)}));0===o.length&&n(a)},Le=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(x[t+4*n>>2]);return r},De=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Me(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Re(e,t,r,n,a,o){var i=t.length;i<2&&re("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=Me(t),l=!t[0].isVoid,c=t[0],d=t[1],f=[e,re,n,a,De,c.fromWireType.bind(c),d?.toWireType.bind(d)],p=2;p<i;++p){var m=t[p];f.push(m.toWireType.bind(m))}if(!u)for(p=s?1:2;p<t.length;++p)null!==t[p].destructorFunction&&f.push(t[p].destructorFunction);let h=function(e,t,r,n){var a=Me(e),o=e.length-2,i=[],s=["fn"];t&&s.push("thisWired");for(var u=0;u<o;++u)i.push(`arg${u}`),s.push(`arg${u}Wired`);i=i.join(","),s=s.join(",");var l=`return function (${i}) {\n`;a&&(l+="var destructors = [];\n");var c=a?"destructors":"null",d=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(t&&(l+=`var thisWired = toClassParamWire(${c}, this);\n`),u=0;u<o;++u){var f=`toArg${u}Wire`;l+=`var arg${u}Wired = ${f}(${c}, arg${u});\n`,d.push(f)}if(l+=(r||n?"var rv = ":"")+`invoker(${s});\n`,a)l+="runDestructors(destructors);\n";else for(u=t?1:2;u<e.length;++u){var p=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(l+=`${p}_dtor(${p});\n`,d.push(`${p}_dtor`))}return r&&(l+="var ret = fromRetWire(rv);\nreturn ret;\n"),l+="}\n",new Function(d,l)}(t,s,l,o);var g=h(...f);return de(e,g)}var Ve,We,Ue=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},ze=[],Ge=[0,1,,1,null,1,!0,1,!1,1],Ne=e=>{e>9&&0===--Ge[e+1]&&(Ge[e]=void 0,ze.push(e))},Je={toValue:e=>(e||re(`Cannot use deleted val. handle = ${e}`),Ge[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ze.pop()||Ge.length;return Ge[t]=e,Ge[t+1]=1,t}}}},He={name:"emscripten::val",fromWireType:e=>{var t=Je.toValue(e);return Ne(e),t},toWireType:(e,t)=>Je.toHandle(t),readValueFromPointer:xe,destructorFunction:null},qe=e=>ne(e,He),Xe=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(E[e>>2])};case 8:return function(e){return this.fromWireType(k[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Qe=(e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,o=r+n-1,i=0;i<e.length;++i){var s=e.codePointAt(i);if(s<=127){if(r>=o)break;t[r++]=s}else if(s<=2047){if(r+1>=o)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=o)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s,i++}}return t[r]=0,r-a},Ke=(e,t,r)=>Qe(e,v,t,r),Ze=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},Ye=new TextDecoder("utf-16le"),et=(e,t,r)=>{var n=e>>1,a=N(w,n,t/2,r);return Ye.decode(w.subarray(n,a))},tt=(e,t,r)=>{if(r??(r=2147483647),r<2)return 0;for(var n=t,a=(r-=2)<2*e.length?r/2:e.length,o=0;o<a;++o){var i=e.charCodeAt(o);b[t>>1]=i,t+=2}return b[t>>1]=0,t-n},rt=e=>2*e.length,nt=(e,t,r)=>{for(var n="",a=e>>2,o=0;!(o>=t/4);o++){var i=x[a+o];if(!i&&!r)break;n+=String.fromCodePoint(i)}return n},at=(e,t,r)=>{if(r??(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,o=0;o<e.length;++o){var i=e.codePointAt(o);if(i>65535&&o++,y[t>>2]=i,(t+=4)+4>a)break}return y[t>>2]=0,t-n},ot=e=>{for(var t=0,r=0;r<e.length;++r)e.codePointAt(r)>65535&&r++,t+=4;return t},it=0,st=[],ut=(e,t)=>{var r=Y[e];return void 0===r&&re(`${t} has unknown type ${je(e)}`),r},lt=(e,t,r)=>{var n=[],a=e(n,r);return n.length&&(x[t>>2]=Je.toHandle(n)),a},ct={},dt=e=>{var t=ct[e];return void 0===t?K(e):t},ft={},pt=e=>{if(e instanceof $||"unwind"==e)return m;l(1,e)},mt=()=>W||it>0,ht=e=>{m=e,mt()||(r.onExit?.(e),A=!0),l(e,new $(e))},gt=e=>{if(!A)try{e(),(()=>{if(!mt())try{m=e=m,ht(e)}catch(e){pt(e)}var e})()}catch(e){pt(e)}},_t=(e,t)=>Math.ceil(e/t)*t,vt=e=>{var t=(e-Wr.buffer.byteLength+65535)/65536|0;try{return Wr.grow(t),j(),1}catch(e){}},bt=e=>{var t=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_conservative_depth","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","NV_shader_noperspective_interpolation","WEBGL_clip_cull_distance","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"];return(e.getSupportedExtensions()||[]).filter(e=>t.includes(e))},wt={counter:1,buffers:[],mappedBuffers:{},programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],byteSizeByTypeRoot:5120,byteSizeByType:[1,1,2,2,4,4,4,2,3,4,8],stringCache:{},stringiCache:{},unpackAlignment:4,unpackRowLength:0,recordError:e=>{wt.lastError||(wt.lastError=e)},getNewId:e=>{for(var t=wt.counter++,r=e.length;r<t;r++)e[r]=null;for(;e[t];)t=wt.counter++;return t},genObject:(e,t,r,n)=>{for(var a=0;a<e;a++){var o=Ve[r](),i=o&&wt.getNewId(n);o?(o.name=i,n[i]=o):wt.recordError(1282),y[t+4*a>>2]=i}},MAX_TEMP_BUFFER_SIZE:2097152,numTempVertexBuffersPerSize:64,log2ceilLookup:e=>32-Math.clz32(0===e?0:e-1),generateTempBuffers:(e,t)=>{var r=wt.log2ceilLookup(wt.MAX_TEMP_BUFFER_SIZE);t.tempVertexBufferCounters1=[],t.tempVertexBufferCounters2=[],t.tempVertexBufferCounters1.length=t.tempVertexBufferCounters2.length=r+1,t.tempVertexBuffers1=[],t.tempVertexBuffers2=[],t.tempVertexBuffers1.length=t.tempVertexBuffers2.length=r+1,t.tempIndexBuffers=[],t.tempIndexBuffers.length=r+1;for(var n=0;n<=r;++n){t.tempIndexBuffers[n]=null,t.tempVertexBufferCounters1[n]=t.tempVertexBufferCounters2[n]=0;var a=wt.numTempVertexBuffersPerSize;t.tempVertexBuffers1[n]=[],t.tempVertexBuffers2[n]=[];var o=t.tempVertexBuffers1[n],i=t.tempVertexBuffers2[n];o.length=i.length=a;for(var s=0;s<a;++s)o[s]=i[s]=null}if(e){t.tempQuadIndexBuffer=Ve.createBuffer(),t.GLctx.bindBuffer(34963,t.tempQuadIndexBuffer);for(var u=wt.MAX_TEMP_BUFFER_SIZE>>1,l=new Uint16Array(u),c=(n=0,0);l[n++]=c,!(n>=u||(l[n++]=c+1,n>=u)||(l[n++]=c+2,n>=u)||(l[n++]=c,n>=u)||(l[n++]=c+2,n>=u)||(l[n++]=c+3,n>=u));)c+=4;t.GLctx.bufferData(34963,l,35044),t.GLctx.bindBuffer(34963,null)}},getTempVertexBuffer:e=>{var t=wt.log2ceilLookup(e),r=wt.currentContext.tempVertexBuffers1[t],n=wt.currentContext.tempVertexBufferCounters1[t];wt.currentContext.tempVertexBufferCounters1[t]=wt.currentContext.tempVertexBufferCounters1[t]+1&wt.numTempVertexBuffersPerSize-1;var a=r[n];if(a)return a;var o=Ve.getParameter(34964);return r[n]=Ve.createBuffer(),Ve.bindBuffer(34962,r[n]),Ve.bufferData(34962,1<<t,35048),Ve.bindBuffer(34962,o),r[n]},getTempIndexBuffer:e=>{var t=wt.log2ceilLookup(e),r=wt.currentContext.tempIndexBuffers[t];if(r)return r;var n=Ve.getParameter(34965);return wt.currentContext.tempIndexBuffers[t]=Ve.createBuffer(),Ve.bindBuffer(34963,wt.currentContext.tempIndexBuffers[t]),Ve.bufferData(34963,1<<t,35048),Ve.bindBuffer(34963,n),wt.currentContext.tempIndexBuffers[t]},newRenderingFrameStarted:()=>{if(wt.currentContext){var e=wt.currentContext.tempVertexBuffers1;wt.currentContext.tempVertexBuffers1=wt.currentContext.tempVertexBuffers2,wt.currentContext.tempVertexBuffers2=e,e=wt.currentContext.tempVertexBufferCounters1,wt.currentContext.tempVertexBufferCounters1=wt.currentContext.tempVertexBufferCounters2,wt.currentContext.tempVertexBufferCounters2=e;for(var t=wt.log2ceilLookup(wt.MAX_TEMP_BUFFER_SIZE),r=0;r<=t;++r)wt.currentContext.tempVertexBufferCounters1[r]=0}},getSource:(e,t,r,n)=>{for(var a="",o=0;o<t;++o)a+=J(x[r+4*o>>2],n?x[n+4*o>>2]:void 0);return a},calcBufLength:(e,t,r,n)=>r>0?n*r:e*wt.byteSizeByType[t-wt.byteSizeByTypeRoot]*n,usedTempBuffers:[],preDrawHandleClientVertexAttribBindings:e=>{wt.resetBufferBinding=!1;for(var t=0;t<wt.currentContext.maxVertexAttribs;++t){var r=wt.currentContext.clientBuffers[t];if(r.clientside&&r.enabled){wt.resetBufferBinding=!0;var n=wt.calcBufLength(r.size,r.type,r.stride,e),a=wt.getTempVertexBuffer(n);Ve.bindBuffer(34962,a),Ve.bufferSubData(34962,0,v.subarray(r.ptr,r.ptr+n)),r.vertexAttribPointerAdaptor.call(Ve,t,r.size,r.type,r.normalized,r.stride,0)}}},postDrawHandleClientVertexAttribBindings:()=>{wt.resetBufferBinding&&Ve.bindBuffer(34962,wt.buffers[Ve.currentArrayBufferBinding])},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){function n(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null}e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=n}var r=e.getContext(t.majorVersion>1?"webgl2":"webgl",t);return r?wt.registerContext(r,t):0},registerContext:(e,t)=>{var r=wt.getNewId(wt.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};e.canvas&&(e.canvas.GLctxObject=n),wt.contexts[r]=n,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&wt.initExtensions(n),n.maxVertexAttribs=n.GLctx.getParameter(34921),n.clientBuffers=[];for(var a=0;a<n.maxVertexAttribs;a++)n.clientBuffers[a]={enabled:!1,clientside:!1,size:0,type:0,normalized:0,stride:0,ptr:0,vertexAttribPointerAdaptor:null};return wt.generateTempBuffers(!1,n),r},makeContextCurrent:e=>(wt.currentContext=wt.contexts[e],r.ctx=Ve=wt.currentContext?.GLctx,!(e&&!Ve)),getContext:e=>wt.contexts[e],deleteContext:e=>{wt.currentContext===wt.contexts[e]&&(wt.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(wt.contexts[e].GLctx.canvas),wt.contexts[e]?.GLctx.canvas&&(wt.contexts[e].GLctx.canvas.GLctxObject=void 0),wt.contexts[e]=null},initExtensions:e=>{if(e||(e=wt.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t,r=e.GLctx;for(var n of((t=r).multiDrawWebgl=t.getExtension("WEBGL_multi_draw"),(e=>{e.extPolygonOffsetClamp=e.getExtension("EXT_polygon_offset_clamp")})(r),(e=>{e.extClipControl=e.getExtension("EXT_clip_control")})(r),(e=>{e.webglPolygonMode=e.getExtension("WEBGL_polygon_mode")})(r),(e=>{var t=e.getExtension("ANGLE_instanced_arrays");t&&(e.vertexAttribDivisor=(e,r)=>t.vertexAttribDivisorANGLE(e,r),e.drawArraysInstanced=(e,r,n,a)=>t.drawArraysInstancedANGLE(e,r,n,a),e.drawElementsInstanced=(e,r,n,a,o)=>t.drawElementsInstancedANGLE(e,r,n,a,o))})(r),(e=>{var t=e.getExtension("OES_vertex_array_object");t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e))})(r),(e=>{var t=e.getExtension("WEBGL_draw_buffers");t&&(e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r))})(r),(e=>{e.dibvbi=e.getExtension("WEBGL_draw_instanced_base_vertex_base_instance")})(r),(e=>{e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")})(r),e.version>=2&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query_webgl2")),(e.version<2||!r.disjointTimerQueryExt)&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query")),bt(r)))n.includes("lose_context")||n.includes("debug")||r.getExtension(n)}}},yt=["default","low-power","high-performance"],xt=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],Et=e=>{var t;return e=(t=e)>2?J(t):t,xt[e]||("undefined"!=typeof document?document.querySelector(e):null)},kt=e=>{var t=Ze(e)+1,r=Lr(t);return Ke(e,r,t),r},St={Internals:{jsObjects:[],jsObjectInsert:(e,t)=>{St.Internals.jsObjects[e>>>=0]=t},bufferOnUnmaps:[],futures:[],futureInsert:(e,t)=>{}},getJsObject:e=>{if(e)return St.Internals.jsObjects[e>>>=0]},importJsAdapter:(e,t=0)=>{var r=Er(t);return St.Internals.jsObjects[r]=e,r},importJsBindGroup:(e,t=0)=>{var r=sr(t);return St.Internals.jsObjects[r]=e,r},importJsBindGroupLayout:(e,t=0)=>{var r=ur(t);return St.Internals.jsObjects[r]=e,r},importJsBuffer:(e,t=0)=>{"pending"!=e.mapState||I(void 0);var r=kr(t,"mapped"==e.mapState?3:1);return St.Internals.jsObjectInsert(r,e),"mapped"==e.mapState&&(St.Internals.bufferOnUnmaps[r]=[]),r},importJsCommandBuffer:(e,t=0)=>{var r=lr(t);return St.Internals.jsObjects[r]=e,r},importJsCommandEncoder:(e,t=0)=>{var r=cr(t);return St.Internals.jsObjects[r]=e,r},importJsComputePassEncoder:(e,t=0)=>{var r=dr(t);return St.Internals.jsObjects[r]=e,r},importJsComputePipeline:(e,t=0)=>{var r=fr(t);return St.Internals.jsObjects[r]=e,r},importJsDevice:(e,t=0)=>{var r=Tr(t),n=Sr(t,r);return St.Internals.jsObjectInsert(r,e.queue),St.Internals.jsObjectInsert(n,e),n},importJsPipelineLayout:(e,t=0)=>{var r=pr(t);return St.Internals.jsObjects[r]=e,r},importJsQuerySet:(e,t=0)=>{var r=mr(t);return St.Internals.jsObjects[r]=e,r},importJsQueue:(e,t=0)=>{var r=Tr(t);return St.Internals.jsObjects[r]=e,r},importJsRenderBundle:(e,t=0)=>{var r=hr(t);return St.Internals.jsObjects[r]=e,r},importJsRenderBundleEncoder:(e,t=0)=>{var r=gr(t);return St.Internals.jsObjects[r]=e,r},importJsRenderPassEncoder:(e,t=0)=>{var r=_r(t);return St.Internals.jsObjects[r]=e,r},importJsRenderPipeline:(e,t=0)=>{var r=vr(t);return St.Internals.jsObjects[r]=e,r},importJsSampler:(e,t=0)=>{var r=br(t);return St.Internals.jsObjects[r]=e,r},importJsShaderModule:(e,t=0)=>{var r=Br(t);return St.Internals.jsObjects[r]=e,r},importJsSurface:(e,t=0)=>{var r=wr(t);return St.Internals.jsObjects[r]=e,r},importJsTexture:(e,t=0)=>{var r=yr(t);return St.Internals.jsObjects[r]=e,r},importJsTextureView:(e,t=0)=>{var r=xr(t);return St.Internals.jsObjects[r]=e,r},errorCallback:(e,t,r,n)=>{var a=z(),o=kt(r);Ae(e)(t,o,n),U(a)},setStringView:(e,t,r)=>{x[e>>2]=t,x[e+4>>2]=r},makeStringFromStringView:e=>J(x[e>>2],x[e+4>>2]),makeStringFromOptionalStringView:e=>{var t=x[e>>2],r=x[e+4>>2];return t?J(t,r):0===r?"":void 0},makeColor:e=>({r:k[e>>3],g:k[e+8>>3],b:k[e+16>>3],a:k[e+24>>3]}),makeExtent3D:e=>({width:x[e>>2],height:x[e+4>>2],depthOrArrayLayers:x[e+8>>2]}),makeOrigin3D:e=>({x:x[e>>2],y:x[e+4>>2],z:x[e+8>>2]}),makeTexelCopyTextureInfo:e=>({texture:St.getJsObject(x[e>>2]),mipLevel:x[e+4>>2],origin:St.makeOrigin3D(e+8),aspect:St.TextureAspect[x[e+20>>2]]}),makeTexelCopyBufferLayout:e=>{var t=x[e+8>>2],r=x[e+12>>2];return{offset:4294967296*x[e+4>>2]+x[e>>2],bytesPerRow:4294967295===t?void 0:t,rowsPerImage:4294967295===r?void 0:r}},makeTexelCopyBufferInfo:e=>{var t=St.makeTexelCopyBufferLayout(e+0);return t.buffer=St.getJsObject(x[e+16>>2]),t},makePassTimestampWrites:e=>{if(0!==e)return{querySet:St.getJsObject(x[e+4>>2]),beginningOfPassWriteIndex:x[e+8>>2],endOfPassWriteIndex:x[e+12>>2]}},makePipelineConstants:(e,t)=>{if(e){for(var r={},n=0;n<e;++n){var a=t+24*n;r[St.makeStringFromStringView(a+4)]=k[a+16>>3]}return r}},makePipelineLayout:e=>e?St.getJsObject(e):"auto",makeComputeState:e=>{if(e)return{module:St.getJsObject(x[e+4>>2]),constants:St.makePipelineConstants(x[e+16>>2],x[e+20>>2]),entryPoint:St.makeStringFromOptionalStringView(e+8)}},makeComputePipelineDesc:e=>({label:St.makeStringFromOptionalStringView(e+4),layout:St.makePipelineLayout(x[e+12>>2]),compute:St.makeComputeState(e+16)}),makeRenderPipelineDesc:e=>{function t(e){if(e)return{operation:St.BlendOperation[x[e>>2]],srcFactor:St.BlendFactor[x[e+4>>2]],dstFactor:St.BlendFactor[x[e+8>>2]]}}function r(e){if(e)return{alpha:t(e+12),color:t(e+0)}}function n(e){var t=x[e+4>>2];return 0===t?void 0:{format:St.TextureFormat[t],blend:r(x[e+8>>2]),writeMask:x[e+16>>2]}}function a(e,t){for(var r=[],a=0;a<e;++a)r.push(n(t+24*a));return r}function o(e){return{compare:St.CompareFunction[x[e>>2]],failOp:St.StencilOperation[x[e+4>>2]],depthFailOp:St.StencilOperation[x[e+8>>2]],passOp:St.StencilOperation[x[e+12>>2]]}}function i(e){return{format:St.VertexFormat[x[e+4>>2]],offset:4294967296*x[e+4+8>>2]+x[e+8>>2],shaderLocation:x[e+16>>2]}}function s(e,t){for(var r=[],n=0;n<e;++n)r.push(i(t+24*n));return r}function u(e){if(e){var t=x[e+4>>2],r=x[e+16>>2];return 0===t&&0===r?null:{arrayStride:4294967296*x[e+4+8>>2]+x[e+8>>2],stepMode:St.VertexStepMode[t],attributes:s(r,x[e+20>>2])}}}function l(e,t){if(e){for(var r=[],n=0;n<e;++n)r.push(u(t+24*n));return r}}return{label:St.makeStringFromOptionalStringView(e+4),layout:St.makePipelineLayout(x[e+12>>2]),vertex:function(e){if(e)return{module:St.getJsObject(x[e+4>>2]),constants:St.makePipelineConstants(x[e+16>>2],x[e+20>>2]),buffers:l(x[e+24>>2],x[e+28>>2]),entryPoint:St.makeStringFromOptionalStringView(e+8)}}(e+16),primitive:function(e){if(e)return{topology:St.PrimitiveTopology[x[e+4>>2]],stripIndexFormat:St.IndexFormat[x[e+8>>2]],frontFace:St.FrontFace[x[e+12>>2]],cullMode:St.CullMode[x[e+16>>2]],unclippedDepth:!!x[e+20>>2]}}(e+48),depthStencil:function(e){if(e)return{format:St.TextureFormat[x[e+4>>2]],depthWriteEnabled:!!x[e+8>>2],depthCompare:St.CompareFunction[x[e+12>>2]],stencilFront:o(e+16),stencilBack:o(e+32),stencilReadMask:x[e+48>>2],stencilWriteMask:x[e+52>>2],depthBias:y[e+56>>2],depthBiasSlopeScale:E[e+60>>2],depthBiasClamp:E[e+64>>2]}}(x[e+72>>2]),multisample:function(e){if(e)return{count:x[e+4>>2],mask:x[e+8>>2],alphaToCoverageEnabled:!!x[e+12>>2]}}(e+76),fragment:function(e){if(e)return{module:St.getJsObject(x[e+4>>2]),constants:St.makePipelineConstants(x[e+16>>2],x[e+20>>2]),targets:a(x[e+24>>2],x[e+28>>2]),entryPoint:St.makeStringFromOptionalStringView(e+8)}}(x[e+92>>2])}},fillLimitStruct:(e,t)=>{function r(r,n){y[t+n>>2]=e[r]}function n(r,n){S[t+n>>3]=BigInt(e[r])}r("maxTextureDimension1D",4),r("maxTextureDimension2D",8),r("maxTextureDimension3D",12),r("maxTextureArrayLayers",16),r("maxBindGroups",20),r("maxBindGroupsPlusVertexBuffers",24),r("maxBindingsPerBindGroup",28),r("maxDynamicUniformBuffersPerPipelineLayout",32),r("maxDynamicStorageBuffersPerPipelineLayout",36),r("maxSampledTexturesPerShaderStage",40),r("maxSamplersPerShaderStage",44),r("maxStorageBuffersPerShaderStage",48),r("maxStorageTexturesPerShaderStage",52),r("maxUniformBuffersPerShaderStage",56),r("minUniformBufferOffsetAlignment",80),r("minStorageBufferOffsetAlignment",84),n("maxUniformBufferBindingSize",64),n("maxStorageBufferBindingSize",72),r("maxVertexBuffers",88),n("maxBufferSize",96),r("maxVertexAttributes",104),r("maxVertexBufferArrayStride",108),r("maxInterStageShaderVariables",112),r("maxColorAttachments",116),r("maxColorAttachmentBytesPerSample",120),r("maxComputeWorkgroupStorageSize",124),r("maxComputeInvocationsPerWorkgroup",128),r("maxComputeWorkgroupSizeX",132),r("maxComputeWorkgroupSizeY",136),r("maxComputeWorkgroupSizeZ",140),r("maxComputeWorkgroupsPerDimension",144),void 0!==e.maxImmediateSize&&r("maxImmediateSize",148)},fillAdapterInfoStruct:(e,t)=>{y[t+52>>2]=e.subgroupMinSize,y[t+56>>2]=e.subgroupMaxSize;var r,n,a,o=(n=Ze(r=e.vendor+e.architecture+e.device+e.description)+1,(a=or(n))&&Ke(r,a,n),a),i=Ze(e.vendor);St.setStringView(t+4,o,i),o+=i;var s=Ze(e.architecture);St.setStringView(t+12,o,s),o+=s;var u=Ze(e.device);St.setStringView(t+20,o,u),o+=u;var l=Ze(e.description);St.setStringView(t+28,o,l),o+=l,y[t+36>>2]=2,y[t+40>>2]=e.isFallbackAdapter?3:4,y[t+44>>2]=0,y[t+48>>2]=0},AddressMode:[,"clamp-to-edge","repeat","mirror-repeat"],BlendFactor:[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1alpha","one-minus-src1alpha"],BlendOperation:[,"add","subtract","reverse-subtract","min","max"],BufferBindingType:["binding-not-used",,"uniform","storage","read-only-storage"],BufferMapState:[,"unmapped","pending","mapped"],CompareFunction:[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],CompilationInfoRequestStatus:[,"success","callback-cancelled"],CompositeAlphaMode:[,"opaque","premultiplied","unpremultiplied","inherit"],CullMode:[,"none","front","back"],ErrorFilter:[,"validation","out-of-memory","internal"],FeatureLevel:[,"compatibility","core"],FeatureName:{1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",327692:"chromium-experimental-unorm16-texture-formats",327693:"chromium-experimental-snorm16-texture-formats",327732:"chromium-experimental-multi-draw-indirect"},FilterMode:[,"nearest","linear"],FrontFace:[,"ccw","cw"],IndexFormat:[,"uint16","uint32"],InstanceFeatureName:[,"timed-wait-any","shader-source-spirv","multiple-devices-per-adapter"],LoadOp:[,"load","clear"],MipmapFilterMode:[,"nearest","linear"],OptionalBool:["false","true"],PowerPreference:[,"low-power","high-performance"],PredefinedColorSpace:[,"srgb","display-p3"],PrimitiveTopology:[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],QueryType:[,"occlusion","timestamp"],SamplerBindingType:["binding-not-used",,"filtering","non-filtering","comparison"],Status:[,"success","error"],StencilOperation:[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],StorageTextureAccess:["binding-not-used",,"write-only","read-only","read-write"],StoreOp:[,"store","discard"],SurfaceGetCurrentTextureStatus:[,"success-optimal","success-suboptimal","timeout","outdated","lost","error"],TextureAspect:[,"all","stencil-only","depth-only"],TextureDimension:[,"1d","2d","3d"],TextureFormat:[,"r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32float","r32uint","r32sint","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rgb9e5ufloat","rg32float","rg32uint","rg32sint","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32float","rgba32uint","rgba32sint","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],TextureSampleType:["binding-not-used",,"float","unfilterable-float","depth","sint","uint"],TextureViewDimension:[,"1d","2d","2d-array","cube","cube-array","3d"],ToneMappingMode:[,"standard","extended"],VertexFormat:[,"uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],VertexStepMode:[,"vertex","instance"],WGSLLanguageFeatureName:[,"readonly_and_readwrite_storage_textures","packed_4x8_integer_dot_product","unrestricted_pointer_parameters","pointer_composite_access"]},Tt={undefined:1,unknown:1,destroyed:2},Bt=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),Ct={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=Ct.isAbs(e),r="/"===e.slice(-1);return(e=Ct.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=Ct.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.slice(0,-1)),r+n):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>Ct.normalize(e.join("/")),join2:(e,t)=>Ct.normalize(e+"/"+t)},Pt=e=>{(Pt=(()=>{if(o){var e=i("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},At={resolve:(...e)=>{for(var t="",r=!1,n=e.length-1;n>=-1&&!r;n--){var a=n>=0?e[n]:Nt.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";t=a+"/"+t,r=Ct.isAbs(a)}return(r?"/":"")+(t=Ct.normalizeArray(t.split("/").filter(e=>!!e),!r).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=At.resolve(e).slice(1),t=At.resolve(t).slice(1);for(var n=r(e.split("/")),a=r(t.split("/")),o=Math.min(n.length,a.length),i=o,s=0;s<o;s++)if(n[s]!==a[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(a.slice(i))).join("/")}},Ft=(e,t=0,r,n)=>{var a=N(e,t,r,n);return G.decode(e.buffer?e.subarray(t,a):new Uint8Array(e.slice(t,a)))},Ot=[],jt=(e,t,r)=>{var n=Ze(e)+1,a=new Array(n),o=Qe(e,a,0,a.length);return a.length=o,a},It={ttys:[],init(){},shutdown(){},register(e,t){It.ttys[e]={input:[],output:[],ops:t},Nt.registerDevice(e,It.stream_ops)},stream_ops:{open(e){var t=It.ttys[e.node.rdev];if(!t)throw new Nt.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,n,a){if(!e.tty||!e.tty.ops.get_char)throw new Nt.ErrnoError(60);for(var o=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new Nt.ErrnoError(29)}if(void 0===s&&0===o)throw new Nt.ErrnoError(6);if(null==s)break;o++,t[r+i]=s}return o&&(e.node.atime=Date.now()),o},write(e,t,r,n,a){if(!e.tty||!e.tty.ops.put_char)throw new Nt.ErrnoError(60);try{for(var o=0;o<n;o++)e.tty.ops.put_char(e.tty,t[r+o])}catch(e){throw new Nt.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),o}},default_tty_ops:{get_char:e=>(()=>{if(!Ot.length){var e=null;if(o){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=f.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}r>0&&(e=t.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;Ot=jt(e)}return Ot.shift()})(),put_char(e,t){null===t||10===t?(C(Ft(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(C(Ft(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(P(Ft(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(P(Ft(e.output)),e.output=[])}}},$t=e=>{I()},Lt={ops_table:null,mount:e=>Lt.createNode(null,"/",16895,0),createNode(e,t,r,n){var a;if(Nt.isBlkdev(r)||Nt.isFIFO(r))throw new Nt.ErrnoError(63);(a=Lt).ops_table||(a.ops_table={dir:{node:{getattr:Lt.node_ops.getattr,setattr:Lt.node_ops.setattr,lookup:Lt.node_ops.lookup,mknod:Lt.node_ops.mknod,rename:Lt.node_ops.rename,unlink:Lt.node_ops.unlink,rmdir:Lt.node_ops.rmdir,readdir:Lt.node_ops.readdir,symlink:Lt.node_ops.symlink},stream:{llseek:Lt.stream_ops.llseek}},file:{node:{getattr:Lt.node_ops.getattr,setattr:Lt.node_ops.setattr},stream:{llseek:Lt.stream_ops.llseek,read:Lt.stream_ops.read,write:Lt.stream_ops.write,mmap:Lt.stream_ops.mmap,msync:Lt.stream_ops.msync}},link:{node:{getattr:Lt.node_ops.getattr,setattr:Lt.node_ops.setattr,readlink:Lt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Lt.node_ops.getattr,setattr:Lt.node_ops.setattr},stream:Nt.chrdev_stream_ops}});var o=Nt.createNode(e,t,r,n);return Nt.isDir(o.mode)?(o.node_ops=Lt.ops_table.dir.node,o.stream_ops=Lt.ops_table.dir.stream,o.contents={}):Nt.isFile(o.mode)?(o.node_ops=Lt.ops_table.file.node,o.stream_ops=Lt.ops_table.file.stream,o.usedBytes=0,o.contents=null):Nt.isLink(o.mode)?(o.node_ops=Lt.ops_table.link.node,o.stream_ops=Lt.ops_table.link.stream):Nt.isChrdev(o.mode)&&(o.node_ops=Lt.ops_table.chrdev.node,o.stream_ops=Lt.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[t]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Nt.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=Nt.isDir(e.mode)?4096:Nt.isFile(e.mode)?e.usedBytes:Nt.isLink(e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(const r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&Lt.resizeFileStorage(e,t.size)},lookup(e,t){throw Lt.doesNotExistError||(Lt.doesNotExistError=new Nt.ErrnoError(44),Lt.doesNotExistError.stack="<generic error, no stack>"),Lt.doesNotExistError},mknod:(e,t,r,n)=>Lt.createNode(e,t,r,n),rename(e,t,r){var n;try{n=Nt.lookupNode(t,r)}catch(e){}if(n){if(Nt.isDir(e.mode))for(var a in n.contents)throw new Nt.ErrnoError(55);Nt.hashRemoveNode(n)}delete e.parent.contents[e.name],t.contents[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r=Nt.lookupNode(e,t);for(var n in r.contents)throw new Nt.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,t,r){var n=Lt.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Nt.isLink(e.mode))throw new Nt.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,a){var o=e.node.contents;if(a>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-a,n);if(i>8&&o.subarray)t.set(o.subarray(a,a+i),r);else for(var s=0;s<i;s++)t[r+s]=o[a+s];return i},write(e,t,r,n,a,o){if(t.buffer===_.buffer&&(o=!1),!n)return 0;var i=e.node;if(i.mtime=i.ctime=Date.now(),t.subarray&&(!i.contents||i.contents.subarray)){if(o)return i.contents=t.subarray(r,r+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===a)return i.contents=t.slice(r,r+n),i.usedBytes=n,n;if(a+n<=i.usedBytes)return i.contents.set(t.subarray(r,r+n),a),n}if(Lt.expandFileStorage(i,a+n),i.contents.subarray&&t.subarray)i.contents.set(t.subarray(r,r+n),a);else for(var s=0;s<n;s++)i.contents[a+s]=t[r+s];return i.usedBytes=Math.max(i.usedBytes,a+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Nt.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Nt.ErrnoError(28);return n},mmap(e,t,r,n,a){if(!Nt.isFile(e.node.mode))throw new Nt.ErrnoError(43);var o,i,s=e.node.contents;if(2&a||!s||s.buffer!==_.buffer){if(i=!0,!(o=$t()))throw new Nt.ErrnoError(48);s&&((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),_.set(s,o))}else i=!1,o=s.byteOffset;return{ptr:o,allocated:i}},msync:(e,t,r,n,a)=>(Lt.stream_ops.write(e,t,0,n,r,!1),0)}},Dt=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Mt=(...e)=>Nt.createDataFile(...e),Rt=0,Vt=null,Wt=e=>{if(Rt--,r.monitorRunDependencies?.(Rt),0==Rt&&Vt){var t=Vt;Vt=null,t()}},Ut=e=>{Rt++,r.monitorRunDependencies?.(Rt)},zt=[],Gt=async(e,t,r,n,a,o,i,u)=>{var l=t?At.resolve(Ct.join2(e,t)):e;Ut();try{var c=r;"string"==typeof r&&(c=await(async e=>{var t=await s(e);return new Uint8Array(t)})(r)),c=await(async(e,t)=>{for(var r of("undefined"!=typeof Browser&&Browser.init(),zt))if(r.canHandle(t))return r.handle(e,t);return e})(c,l),u?.(),o||Mt(e,t,c,n,a,i)}finally{Wt()}},Nt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{constructor(e){ye(this,"name","ErrnoError"),this.errno=e}},FSStream:class{get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}constructor(){ye(this,"shared",{})}},FSNode:class{get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Nt.isDir(this.mode)}get isDevice(){return Nt.isChrdev(this.mode)}constructor(e,t,r,n){ye(this,"node_ops",{}),ye(this,"stream_ops",{}),ye(this,"readMode",365),ye(this,"writeMode",146),ye(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=Nt.nextInode++,this.name=t,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}},lookupPath(e,t={}){var r;if(!e)throw new Nt.ErrnoError(44);(r=t).follow_mount??(r.follow_mount=!0),Ct.isAbs(e)||(e=Nt.cwd()+"/"+e);e:for(var n=0;n<40;n++){for(var a=e.split("/").filter(e=>!!e),o=Nt.root,i="/",s=0;s<a.length;s++){var u=s===a.length-1;if(u&&t.parent)break;if("."!==a[s])if(".."!==a[s]){i=Ct.join2(i,a[s]);try{o=Nt.lookupNode(o,a[s])}catch(e){if(44===e?.errno&&u&&t.noent_okay)return{path:i};throw e}if(!Nt.isMountpoint(o)||u&&!t.follow_mount||(o=o.mounted.root),Nt.isLink(o.mode)&&(!u||t.follow)){if(!o.node_ops.readlink)throw new Nt.ErrnoError(52);var l=o.node_ops.readlink(o);Ct.isAbs(l)||(l=Ct.dirname(i)+"/"+l),e=l+"/"+a.slice(s+1).join("/");continue e}}else{if(i=Ct.dirname(i),Nt.isRoot(o)){e=i+"/"+a.slice(s+1).join("/"),n--;continue e}o=o.parent}}return{path:i,node:o}}throw new Nt.ErrnoError(32)},getPath(e){for(var t;;){if(Nt.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Nt.nameTable.length},hashAddNode(e){var t=Nt.hashName(e.parent.id,e.name);e.name_next=Nt.nameTable[t],Nt.nameTable[t]=e},hashRemoveNode(e){var t=Nt.hashName(e.parent.id,e.name);if(Nt.nameTable[t]===e)Nt.nameTable[t]=e.name_next;else for(var r=Nt.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Nt.mayLookup(e);if(r)throw new Nt.ErrnoError(r);for(var n=Nt.hashName(e.id,t),a=Nt.nameTable[n];a;a=a.name_next)if(a.parent.id===e.id&&a.name===t)return a;return Nt.lookup(e,t)},createNode(e,t,r,n){var a=new Nt.FSNode(e,t,r,n);return Nt.hashAddNode(a),a},destroyNode(e){Nt.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Nt.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>Nt.isDir(e.mode)?Nt.nodePermissions(e,"x")||(e.node_ops.lookup?0:2):54,mayCreate(e,t){if(!Nt.isDir(e.mode))return 54;try{return Nt.lookupNode(e,t),20}catch(e){}return Nt.nodePermissions(e,"wx")},mayDelete(e,t,r){var n;try{n=Nt.lookupNode(e,t)}catch(e){return e.errno}var a=Nt.nodePermissions(e,"wx");if(a)return a;if(r){if(!Nt.isDir(n.mode))return 54;if(Nt.isRoot(n)||Nt.getPath(n)===Nt.cwd())return 10}else if(Nt.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?Nt.isLink(e.mode)?32:Nt.isDir(e.mode)&&("r"!==Nt.flagsToPermissionString(t)||576&t)?31:Nt.nodePermissions(e,Nt.flagsToPermissionString(t)):44,checkOpExists(e,t){if(!e)throw new Nt.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Nt.MAX_OPEN_FDS;e++)if(!Nt.streams[e])return e;throw new Nt.ErrnoError(33)},getStreamChecked(e){var t=Nt.getStream(e);if(!t)throw new Nt.ErrnoError(8);return t},getStream:e=>Nt.streams[e],createStream:(e,t=-1)=>(e=Object.assign(new Nt.FSStream,e),-1==t&&(t=Nt.nextfd()),e.fd=t,Nt.streams[t]=e,e),closeStream(e){Nt.streams[e]=null},dupStream(e,t=-1){var r=Nt.createStream(e,t);return r.stream_ops?.dup?.(r),r},doSetAttr(e,t,r){var n=e?.stream_ops.setattr,a=n?e:t;n??(n=t.node_ops.setattr),Nt.checkOpExists(n,63),n(a,r)},chrdev_stream_ops:{open(e){var t=Nt.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Nt.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Nt.devices[e]={stream_ops:t}},getDevice:e=>Nt.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push(...n.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Nt.syncFSRequests++,Nt.syncFSRequests>1&&P(`warning: ${Nt.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Nt.getMounts(Nt.root.mount),n=0;function a(e){return Nt.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,a(e));++n>=r.length&&a(null)}for(var i of r)i.type.syncfs?i.type.syncfs(i,e,o):o(null)},mount(e,t,r){var n,a="/"===r,o=!r;if(a&&Nt.root)throw new Nt.ErrnoError(10);if(!a&&!o){var i=Nt.lookupPath(r,{follow_mount:!1});if(r=i.path,Nt.isMountpoint(n=i.node))throw new Nt.ErrnoError(10);if(!Nt.isDir(n.mode))throw new Nt.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,a?Nt.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var t=Nt.lookupPath(e,{follow_mount:!1});if(!Nt.isMountpoint(t.node))throw new Nt.ErrnoError(28);var r=t.node,n=r.mounted,a=Nt.getMounts(n);for(var[o,i]of Object.entries(Nt.nameTable))for(;i;){var s=i.name_next;a.includes(i.mount)&&Nt.destroyNode(i),i=s}r.mounted=null;var u=r.mount.mounts.indexOf(n);r.mount.mounts.splice(u,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Nt.lookupPath(e,{parent:!0}).node,a=Ct.basename(e);if(!a)throw new Nt.ErrnoError(28);if("."===a||".."===a)throw new Nt.ErrnoError(20);var o=Nt.mayCreate(n,a);if(o)throw new Nt.ErrnoError(o);if(!n.node_ops.mknod)throw new Nt.ErrnoError(63);return n.node_ops.mknod(n,a,t,r)},statfs:e=>Nt.statfsNode(Nt.lookupPath(e,{follow:!0}).node),statfsStream:e=>Nt.statfsNode(e.node),statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Nt.nextInode,ffree:Nt.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create:(e,t=438)=>(t&=4095,Nt.mknod(e,t|=32768,0)),mkdir:(e,t=511)=>(t&=1023,Nt.mknod(e,t|=16384,0)),mkdirTree(e,t){var r=e.split("/"),n="";for(var a of r)if(a){(n||Ct.isAbs(e))&&(n+="/"),n+=a;try{Nt.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),Nt.mknod(e,t|=8192,r)),symlink(e,t){if(!At.resolve(e))throw new Nt.ErrnoError(44);var r=Nt.lookupPath(t,{parent:!0}).node;if(!r)throw new Nt.ErrnoError(44);var n=Ct.basename(t),a=Nt.mayCreate(r,n);if(a)throw new Nt.ErrnoError(a);if(!r.node_ops.symlink)throw new Nt.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,a=Ct.dirname(e),o=Ct.dirname(t),i=Ct.basename(e),s=Ct.basename(t);if(r=Nt.lookupPath(e,{parent:!0}).node,n=Nt.lookupPath(t,{parent:!0}).node,!r||!n)throw new Nt.ErrnoError(44);if(r.mount!==n.mount)throw new Nt.ErrnoError(75);var u,l=Nt.lookupNode(r,i),c=At.relative(e,o);if("."!==c.charAt(0))throw new Nt.ErrnoError(28);if("."!==(c=At.relative(t,a)).charAt(0))throw new Nt.ErrnoError(55);try{u=Nt.lookupNode(n,s)}catch(e){}if(l!==u){var d=Nt.isDir(l.mode),f=Nt.mayDelete(r,i,d);if(f)throw new Nt.ErrnoError(f);if(f=u?Nt.mayDelete(n,s,d):Nt.mayCreate(n,s))throw new Nt.ErrnoError(f);if(!r.node_ops.rename)throw new Nt.ErrnoError(63);if(Nt.isMountpoint(l)||u&&Nt.isMountpoint(u))throw new Nt.ErrnoError(10);if(n!==r&&(f=Nt.nodePermissions(r,"w")))throw new Nt.ErrnoError(f);Nt.hashRemoveNode(l);try{r.node_ops.rename(l,n,s),l.parent=n}catch(e){throw e}finally{Nt.hashAddNode(l)}}},rmdir(e){var t=Nt.lookupPath(e,{parent:!0}).node,r=Ct.basename(e),n=Nt.lookupNode(t,r),a=Nt.mayDelete(t,r,!0);if(a)throw new Nt.ErrnoError(a);if(!t.node_ops.rmdir)throw new Nt.ErrnoError(63);if(Nt.isMountpoint(n))throw new Nt.ErrnoError(10);t.node_ops.rmdir(t,r),Nt.destroyNode(n)},readdir(e){var t=Nt.lookupPath(e,{follow:!0}).node;return Nt.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Nt.lookupPath(e,{parent:!0}).node;if(!t)throw new Nt.ErrnoError(44);var r=Ct.basename(e),n=Nt.lookupNode(t,r),a=Nt.mayDelete(t,r,!1);if(a)throw new Nt.ErrnoError(a);if(!t.node_ops.unlink)throw new Nt.ErrnoError(63);if(Nt.isMountpoint(n))throw new Nt.ErrnoError(10);t.node_ops.unlink(t,r),Nt.destroyNode(n)},readlink(e){var t=Nt.lookupPath(e).node;if(!t)throw new Nt.ErrnoError(44);if(!t.node_ops.readlink)throw new Nt.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var r=Nt.lookupPath(e,{follow:!t}).node;return Nt.checkOpExists(r.node_ops.getattr,63)(r)},fstat(e){var t=Nt.getStreamChecked(e),r=t.node,n=t.stream_ops.getattr,a=n?t:r;return n??(n=r.node_ops.getattr),Nt.checkOpExists(n,63),n(a)},lstat:e=>Nt.stat(e,!0),doChmod(e,t,r,n){Nt.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:n})},chmod(e,t,r){var n;n="string"==typeof e?Nt.lookupPath(e,{follow:!r}).node:e,Nt.doChmod(null,n,t,r)},lchmod(e,t){Nt.chmod(e,t,!0)},fchmod(e,t){var r=Nt.getStreamChecked(e);Nt.doChmod(r,r.node,t,!1)},doChown(e,t,r){Nt.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:r})},chown(e,t,r,n){var a;a="string"==typeof e?Nt.lookupPath(e,{follow:!n}).node:e,Nt.doChown(null,a,n)},lchown(e,t,r){Nt.chown(e,t,r,!0)},fchown(e,t,r){var n=Nt.getStreamChecked(e);Nt.doChown(n,n.node,!1)},doTruncate(e,t,r){if(Nt.isDir(t.mode))throw new Nt.ErrnoError(31);if(!Nt.isFile(t.mode))throw new Nt.ErrnoError(28);var n=Nt.nodePermissions(t,"w");if(n)throw new Nt.ErrnoError(n);Nt.doSetAttr(e,t,{size:r,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Nt.ErrnoError(28);var r;r="string"==typeof e?Nt.lookupPath(e,{follow:!0}).node:e,Nt.doTruncate(null,r,t)},ftruncate(e,t){var r=Nt.getStreamChecked(e);if(t<0||!(2097155&r.flags))throw new Nt.ErrnoError(28);Nt.doTruncate(r,r.node,t)},utime(e,t,r){var n=Nt.lookupPath(e,{follow:!0}).node;Nt.checkOpExists(n.node_ops.setattr,63)(n,{atime:t,mtime:r})},open(e,t,n=438){if(""===e)throw new Nt.ErrnoError(44);var a,o;if(n=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&n|32768:0,"object"==typeof e)a=e;else{o=e.endsWith("/");var i=Nt.lookupPath(e,{follow:!(131072&t),noent_okay:!0});a=i.node,e=i.path}var s=!1;if(64&t)if(a){if(128&t)throw new Nt.ErrnoError(20)}else{if(o)throw new Nt.ErrnoError(31);a=Nt.mknod(e,511|n,0),s=!0}if(!a)throw new Nt.ErrnoError(44);if(Nt.isChrdev(a.mode)&&(t&=-513),65536&t&&!Nt.isDir(a.mode))throw new Nt.ErrnoError(54);if(!s){var u=Nt.mayOpen(a,t);if(u)throw new Nt.ErrnoError(u)}512&t&&!s&&Nt.truncate(a,0),t&=-131713;var l=Nt.createStream({node:a,path:Nt.getPath(a),flags:t,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),s&&Nt.chmod(a,511&n),!r.logReadFiles||1&t||e in Nt.readFiles||(Nt.readFiles[e]=1),l},close(e){if(Nt.isClosed(e))throw new Nt.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Nt.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Nt.isClosed(e))throw new Nt.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Nt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Nt.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,n,a){if(n<0||a<0)throw new Nt.ErrnoError(28);if(Nt.isClosed(e))throw new Nt.ErrnoError(8);if(1==(2097155&e.flags))throw new Nt.ErrnoError(8);if(Nt.isDir(e.node.mode))throw new Nt.ErrnoError(31);if(!e.stream_ops.read)throw new Nt.ErrnoError(28);var o=void 0!==a;if(o){if(!e.seekable)throw new Nt.ErrnoError(70)}else a=e.position;var i=e.stream_ops.read(e,t,r,n,a);return o||(e.position+=i),i},write(e,t,r,n,a,o){if(n<0||a<0)throw new Nt.ErrnoError(28);if(Nt.isClosed(e))throw new Nt.ErrnoError(8);if(!(2097155&e.flags))throw new Nt.ErrnoError(8);if(Nt.isDir(e.node.mode))throw new Nt.ErrnoError(31);if(!e.stream_ops.write)throw new Nt.ErrnoError(28);e.seekable&&1024&e.flags&&Nt.llseek(e,0,2);var i=void 0!==a;if(i){if(!e.seekable)throw new Nt.ErrnoError(70)}else a=e.position;var s=e.stream_ops.write(e,t,r,n,a,o);return i||(e.position+=s),s},mmap(e,t,r,n,a){if(2&n&&!(2&a)&&2!=(2097155&e.flags))throw new Nt.ErrnoError(2);if(1==(2097155&e.flags))throw new Nt.ErrnoError(2);if(!e.stream_ops.mmap)throw new Nt.ErrnoError(43);if(!t)throw new Nt.ErrnoError(28);return e.stream_ops.mmap(e,t,r,n,a)},msync:(e,t,r,n,a)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,a):0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Nt.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding&&I(`Invalid encoding type "${t.encoding}"`);var r=Nt.open(e,t.flags),n=Nt.stat(e).size,a=new Uint8Array(n);return Nt.read(r,a,0,n,0),"utf8"===t.encoding&&(a=Ft(a)),Nt.close(r),a},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Nt.open(e,r.flags,r.mode);"string"==typeof t&&(t=new Uint8Array(jt(t))),ArrayBuffer.isView(t)?Nt.write(n,t,0,t.byteLength,void 0,r.canOwn):I("Unsupported data type"),Nt.close(n)},cwd:()=>Nt.currentPath,chdir(e){var t=Nt.lookupPath(e,{follow:!0});if(null===t.node)throw new Nt.ErrnoError(44);if(!Nt.isDir(t.node.mode))throw new Nt.ErrnoError(54);var r=Nt.nodePermissions(t.node,"x");if(r)throw new Nt.ErrnoError(r);Nt.currentPath=t.path},createDefaultDirectories(){Nt.mkdir("/tmp"),Nt.mkdir("/home"),Nt.mkdir("/home/web_user")},createDefaultDevices(){Nt.mkdir("/dev"),Nt.registerDevice(Nt.makedev(1,3),{read:()=>0,write:(e,t,r,n,a)=>n,llseek:()=>0}),Nt.mkdev("/dev/null",Nt.makedev(1,3)),It.register(Nt.makedev(5,0),It.default_tty_ops),It.register(Nt.makedev(6,0),It.default_tty1_ops),Nt.mkdev("/dev/tty",Nt.makedev(5,0)),Nt.mkdev("/dev/tty1",Nt.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(Pt(e),t=e.byteLength),e[--t]);Nt.createDevice("/dev","random",r),Nt.createDevice("/dev","urandom",r),Nt.mkdir("/dev/shm"),Nt.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Nt.mkdir("/proc");var e=Nt.mkdir("/proc/self");Nt.mkdir("/proc/self/fd"),Nt.mount({mount(){var t=Nt.createNode(e,"fd",16895,73);return t.stream_ops={llseek:Lt.stream_ops.llseek},t.node_ops={lookup(e,t){var r=+t,n=Nt.getStreamChecked(r),a={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:r+1};return a.parent=a,a},readdir:()=>Array.from(Nt.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())},t}},{},"/proc/self/fd")},createStandardStreams(e,t,r){e?Nt.createDevice("/dev","stdin",e):Nt.symlink("/dev/tty","/dev/stdin"),t?Nt.createDevice("/dev","stdout",null,t):Nt.symlink("/dev/tty","/dev/stdout"),r?Nt.createDevice("/dev","stderr",null,r):Nt.symlink("/dev/tty1","/dev/stderr"),Nt.open("/dev/stdin",0),Nt.open("/dev/stdout",1),Nt.open("/dev/stderr",1)},staticInit(){Nt.nameTable=new Array(4096),Nt.mount(Lt,{},"/"),Nt.createDefaultDirectories(),Nt.createDefaultDevices(),Nt.createSpecialDirectories(),Nt.filesystems={MEMFS:Lt}},init(e,t,n){Nt.initialized=!0,e??(e=r.stdin),t??(t=r.stdout),n??(n=r.stderr),Nt.createStandardStreams(e,t,n)},quit(){for(var e of(Nt.initialized=!1,Nt.streams))e&&Nt.close(e)},findObject(e,t){var r=Nt.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(n=Nt.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Nt.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=Ct.basename(e),n=Nt.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Nt.getPath(e);for(var a=t.split("/").reverse();a.length;){var o=a.pop();if(o){var i=Ct.join2(e,o);try{Nt.mkdir(i)}catch(e){if(20!=e.errno)throw e}e=i}}return i},createFile(e,t,r,n,a){var o=Ct.join2("string"==typeof e?e:Nt.getPath(e),t),i=Dt(n,a);return Nt.create(o,i)},createDataFile(e,t,r,n,a,o){var i=t;e&&(e="string"==typeof e?e:Nt.getPath(e),i=t?Ct.join2(e,t):e);var s=Dt(n,a),u=Nt.create(i,s);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,d=r.length;c<d;++c)l[c]=r.charCodeAt(c);r=l}Nt.chmod(u,146|s);var f=Nt.open(u,577);Nt.write(f,r,0,r.length,0,o),Nt.close(f),Nt.chmod(u,s)}},createDevice(e,t,r,n){var a,o=Ct.join2("string"==typeof e?e:Nt.getPath(e),t),i=Dt(!!r,!!n);(a=Nt.createDevice).major??(a.major=64);var s=Nt.makedev(Nt.createDevice.major++,0);return Nt.registerDevice(s,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,a,o){for(var i=0,s=0;s<a;s++){var u;try{u=r()}catch(e){throw new Nt.ErrnoError(29)}if(void 0===u&&0===i)throw new Nt.ErrnoError(6);if(null==u)break;i++,t[n+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,t,r,a,o){for(var i=0;i<a;i++)try{n(t[r+i])}catch(e){throw new Nt.ErrnoError(29)}return a&&(e.node.mtime=e.node.ctime=Date.now()),i}}),Nt.mkdev(o,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)I("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=u(e.url)}catch(e){throw new Nt.ErrnoError(29)}},createLazyFile(e,t,r,n,o){class i{get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize;return this.getter(e/this.chunkSize|0)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open("HEAD",r,!1),e.send(null),e.status>=200&&e.status<300||304===e.status||I("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),a=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,o=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,i=1048576;a||(i=n);var s=this;s.setDataGetter(e=>{var t=e*i,a=(e+1)*i-1;return a=Math.min(a,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{e>t&&I("invalid range ("+e+", "+t+") or no bytes requested!"),t>n-1&&I("only "+n+" bytes available! programmer error!");var a=new XMLHttpRequest;return a.open("GET",r,!1),n!==i&&a.setRequestHeader("Range","bytes="+e+"-"+t),a.responseType="arraybuffer",a.overrideMimeType&&a.overrideMimeType("text/plain; charset=x-user-defined"),a.send(null),a.status>=200&&a.status<300||304===a.status||I("Couldn't load "+r+". Status: "+a.status),void 0!==a.response?new Uint8Array(a.response||[]):jt(a.responseText||"")})(t,a)),void 0===s.chunks[e]&&I("doXHR failed!"),s.chunks[e]}),!o&&n||(i=n=1,n=this.getter(0).length,i=n,C("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}constructor(){ye(this,"lengthKnown",!1),ye(this,"chunks",[])}}if(globalThis.XMLHttpRequest){a||I("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s={isDevice:!1,contents:new i}}else s={isDevice:!1,url:r};var u=Nt.createFile(e,t,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(const[e,t]of Object.entries(u.stream_ops))l[e]=(...e)=>(Nt.forceLoadFile(u),t(...e));function c(e,t,r,n,a){var o=e.node.contents;if(a>=o.length)return 0;var i=Math.min(o.length-a,n);if(o.slice)for(var s=0;s<i;s++)t[r+s]=o[a+s];else for(s=0;s<i;s++)t[r+s]=o.get(a+s);return i}return l.read=(e,t,r,n,a)=>(Nt.forceLoadFile(u),c(e,t,r,n,a)),l.mmap=(e,t,r,n,a)=>{Nt.forceLoadFile(u);var o=$t();if(!o)throw new Nt.ErrnoError(48);return c(e,_,o,t,r),{ptr:o,allocated:!0}},u.stream_ops=l,u}},Jt={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(Ct.isAbs(t))return t;var n;if(n=-100===e?Nt.cwd():Jt.getStreamFromFD(e).path,0==t.length){if(!r)throw new Nt.ErrnoError(44);return n}return n+"/"+t},writeStat(e,t){x[e>>2]=t.dev,x[e+4>>2]=t.mode,x[e+8>>2]=t.nlink,x[e+12>>2]=t.uid,x[e+16>>2]=t.gid,x[e+20>>2]=t.rdev,S[e+24>>3]=BigInt(t.size),y[e+32>>2]=4096,y[e+36>>2]=t.blocks;var r=t.atime.getTime(),n=t.mtime.getTime(),a=t.ctime.getTime();return S[e+40>>3]=BigInt(Math.floor(r/1e3)),x[e+48>>2]=r%1e3*1e3*1e3,S[e+56>>3]=BigInt(Math.floor(n/1e3)),x[e+64>>2]=n%1e3*1e3*1e3,S[e+72>>3]=BigInt(Math.floor(a/1e3)),x[e+80>>2]=a%1e3*1e3*1e3,S[e+88>>3]=BigInt(t.ino),0},writeStatFs(e,t){x[e+4>>2]=t.bsize,x[e+60>>2]=t.bsize,S[e+8>>3]=BigInt(t.blocks),S[e+16>>3]=BigInt(t.bfree),S[e+24>>3]=BigInt(t.bavail),S[e+32>>3]=BigInt(t.files),S[e+40>>3]=BigInt(t.ffree),x[e+48>>2]=t.fsid,x[e+64>>2]=t.flags,x[e+56>>2]=t.namelen},doMsync(e,t,r,n,a){if(!Nt.isFile(t.node.mode))throw new Nt.ErrnoError(43);if(2&n)return 0;var o=v.slice(e,e+r);Nt.msync(t,o,a,r,n)},getStreamFromFD:e=>Nt.getStreamChecked(e),varargs:void 0,getStr:e=>J(e)},Ht=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),qt=[],Xt=e=>0==(e-=5120)?_:1==e?v:2==e?b:4==e?y:6==e?E:5==e||28922==e||28520==e||30779==e||30782==e?x:w,Qt=(e,t)=>e>>>31-Math.clz32(t.BYTES_PER_ELEMENT),Kt=e=>{var t=Ve.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=Ve.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}wt.recordError(1282)},Zt=[],Yt=[],er=(e,t)=>Ur.set(e,t),tr=e=>{const t=e.length;return[t%128|128,t>>7,...e]},rr={i:127,p:127,j:126,f:125,d:124,e:111},nr=e=>tr(Array.from(e,e=>rr[e]));(()=>{let e=ce.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof ce))return!1;if(!(e instanceof ce))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||oe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=le(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||oe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&re("Object already scheduled for deletion"),se(this),ue(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||oe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&re("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(Ce.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:xe,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&re("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(this.registeredClass,t),ke[t]))(0,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return Be(this.registeredClass.instancePrototype,this.isSmartPointer?{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}:{ptrType:this,ptr:e})}var o,i=this.registeredClass.getActualType(t),s=fe[i];if(!s)return a.call(this);var u=Ee(t,this.registeredClass,(o=this.isConst?s.constPointerType:s.pointerType).registeredClass);return null===u?a.call(this):Be(o.registeredClass.instancePrototype,this.isSmartPointer?{ptrType:o,ptr:u,smartPtrType:this,smartPtr:e}:{ptrType:o,ptr:u})}}),"undefined"!=typeof MainLoop&&MainLoop.preMainLoop.push(()=>wt.newRenderingFrameStarted()),Nt.createPreloadedFile=(e,t,r,n,a,o,i,s,u,l)=>{Gt(e,t,r,n,a,s,u,l).then(o).catch(i)},Nt.preloadFile=Gt,Nt.staticInit();for(let e=0;e<32;++e)qt.push(new Array(e));for(var ar,or,ir,sr,ur,lr,cr,dr,fr,pr,mr,hr,gr,_r,vr,br,wr,yr,xr,Er,kr,Sr,Tr,Br,Cr,Pr,Ar,Fr,Or,jr,Ir,$r,Lr,Dr,Mr,Rr,Vr,Wr,Ur,zr=new Int32Array(288),Gr=0;Gr<=288;++Gr)Zt[Gr]=zr.subarray(0,Gr);if(r.noExitRuntime&&(W=r.noExitRuntime),r.preloadPlugins&&(zt=r.preloadPlugins),r.print&&(C=r.print),r.printErr&&(P=r.printErr),r.wasmBinary&&(p=r.wasmBinary),r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();r.addRunDependency=Ut,r.removeRunDependency=Wt,r.addFunction=(e,t)=>{var r=(e=>(We||(We=new WeakMap,((e,t)=>{if(We)for(var r=0;r<0+t;r++){var n=Ae(r);n&&We.set(n,r)}})(0,Ur.length)),We.get(e)||0))(e);if(r)return r;var n=Yt.length?Yt.pop():Ur.grow(1);try{er(n,e)}catch(r){if(!(r instanceof TypeError))throw r;var a=((e,t)=>{var r=Uint8Array.of(0,97,115,109,1,0,0,0,1,...tr([1,96,...nr(t.slice(1)),...nr("v"===t[0]?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),n=new WebAssembly.Module(r);return new WebAssembly.Instance(n,{e:{f:e}}).exports.f})(e,t);er(n,a)}return We.set(e,n),n},r.removeFunction=e=>{We.delete(Ae(e)),er(e,null),Yt.push(e)},r.FS_preloadFile=Gt,r.FS_unlink=(...e)=>Nt.unlink(...e),r.FS_createPath=(...e)=>Nt.createPath(...e),r.FS_createDevice=(...e)=>Nt.createDevice(...e),r.FS_createDataFile=Mt,r.FS_createLazyFile=(...e)=>Nt.createLazyFile(...e);var Nr,Jr={a:(e,t,r,n)=>I(`Assertion failed: ${J(e)}, at: `+[t?J(t):"unknown filename",r,n?J(n):"unknown function"]),ub:e=>{var t=new q(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),Mr(e),Vr(e)},ra:()=>Q([]),ob:e=>Q([e]),P:(e,t,r)=>{throw new q(e).init(t,r),H=e},qa:e=>{throw H||(H=e),H},zb:()=>I(""),oa:(e,t,r,n,a)=>{t=K(t);const o=0n===n;let i=e=>e;if(o){const e=8*r;i=t=>BigInt.asUintN(e,t),a=i(a)}ne(e,{name:t,fromWireType:i,toWireType:(e,t)=>("number"==typeof t&&(t=BigInt(t)),t),readValueFromPointer:ae(t,r,!o),destructorFunction:null})},lb:(e,t,r,n)=>{ne(e,{name:t=K(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},readValueFromPointer:function(e){return this.fromWireType(v[e])},destructorFunction:null})},kb:(e,t,r,n,a,o,i,s,u,l,c,d,f)=>{c=K(c),o=Fe(a,o),s&&(s=Fe(i,s)),l&&(l=Fe(u,l)),f=Fe(d,f);var p=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);me(p,function(){Ie(`Cannot construct ${c} due to unbound types`,[n])}),$e([e,t,r],n?[n]:[],t=>{var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:ce.prototype;var i=de(c,function(...e){if(Object.getPrototypeOf(this)!==u)throw new te(`Use 'new' to construct ${c}`);if(void 0===m.constructor_body)throw new te(`${c} has no accessible constructor`);var t=m.constructor_body[e.length];if(void 0===t)throw new te(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),u=Object.create(a,{constructor:{value:i}});i.prototype=u;var d,m=new he(c,i,u,f,r,o,s,l);m.baseClass&&((d=m.baseClass).__derivedClasses??(d.__derivedClasses=[]),m.baseClass.__derivedClasses.push(m));var h=new Ce(c,m,!0,!1,!1),g=new Ce(c+"*",m,!1,!1,!1),_=new Ce(c+" const*",m,!1,!0,!1);return fe[e]={pointerType:g,constPointerType:_},Pe(p,i),[h,g,_]})},gb:(e,t,r,n,a,o)=>{var i=Le(t,r);a=Fe(n,a),$e([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new te(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Ie(`Cannot construct ${e.name} due to unbound types`,i)},$e([],i,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Re(r,n,null,a,o),[])),[]})},F:(e,t,r,n,a,o,i,s,u,l)=>{var c=Le(r,n);t=K(t),t=Ue(t),o=Fe(a,o,u),$e([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function a(){Ie(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(a.argCount=r-2,a.className=e.name,l[t]=a):(pe(l,t,n),l[t].overloadTable[r-2]=a),$e([],c,a=>{var s=Re(n,a,e,o,i,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]}),[]})},ib:qe,na:(e,t,r)=>{ne(e,{name:t=K(t),fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:Xe(t,r),destructorFunction:null})},Aa:(e,t,r,n,a,o,i,s)=>{var u=Le(t,r);e=K(e),e=Ue(e),a=Fe(n,a,i),me(e,function(){Ie(`Cannot call ${e} due to unbound types`,u)},t-1),$e([],u,r=>{var n=[r[0],null].concat(r.slice(1));return Pe(e,Re(e,n,null,a,o,i),t-1),[]})},y:(e,t,r,n,a)=>{t=K(t);let o=e=>e;if(0===n){var i=32-8*r;o=e=>e<<i>>>i,a=o(a)}ne(e,{name:t,fromWireType:o,toWireType:(e,t)=>t,readValueFromPointer:ae(t,r,0!==n),destructorFunction:null})},p:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function a(e){return new n(_.buffer,x[e+4>>2],x[e>>2])}ne(e,{name:r=K(r),fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},jb:(e,t)=>{ne(e,{name:t=K(t),fromWireType(e){var t;return t=J(e+4,x[e>>2],!0),ar(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||re("Cannot pass non-string to std::string"),r=n?Ze(t):t.length;var a=or(4+r+1),o=a+4;return x[a>>2]=r,n?Ke(t,o,r+1):v.set(t,o),null!==e&&e.push(ar,a),a},readValueFromPointer:xe,destructorFunction(e){ar(e)}})},Q:(e,t,r)=>{var n,a,o;r=K(r),2===t?(n=et,a=tt,o=rt):(n=nt,a=at,o=ot),ne(e,{name:r,fromWireType:e=>{var r=n(e+4,x[e>>2]*t,!0);return ar(e),r},toWireType:(e,n)=>{"string"!=typeof n&&re(`Cannot pass non-string to C++ string type ${r}`);var i=o(n),s=or(4+i+t);return x[s>>2]=i/t,a(n,s+4,i+t),null!==e&&e.push(ar,s),s},readValueFromPointer:xe,destructorFunction(e){ar(e)}})},Tb:(e,t)=>{qe(e)},mb:(e,t)=>{ne(e,{isVoid:!0,name:t=K(t),fromWireType:()=>{},toWireType:(e,t)=>{}})},sb:()=>{W=!1,it=0},qb:()=>{throw 1/0},ga:(e,t,r)=>{var[n,...a]=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=ut(x[t+4*n>>2],`parameter ${n}`);return r})(e,t),o=n.toWireType.bind(n),i=a.map(e=>e.readValueFromPointer.bind(e));e--;var s,u={toValue:Je.toValue},l=i.map((e,t)=>{var r=`argFromPtr${t}`;return u[r]=e,`${r}(args${t?"+"+8*t:""})`});switch(r){case 0:s="toValue(handle)";break;case 2:s="new (toValue(handle))";break;case 3:s="";break;case 1:u.getStringOrSymbol=dt,s="toValue(handle)[getStringOrSymbol(methodName)]"}s+=`(${l})`,n.isVoid||(u.toReturnWire=o,u.emval_returnValue=lt,s=`return emval_returnValue(toReturnWire, destructorsRef, ${s})`),s=`return function (handle, methodName, destructorsRef, args) {\n ${s}\n }`;var c,d,f=new Function(Object.keys(u),s)(...Object.values(u)),p=`methodCaller<(${a.map(e=>e.name)}) => ${n.name}>`;return c=de(p,f),d=st.length,st.push(c),d},Fa:Ne,Ka:e=>{e>9&&(Ge[e+1]+=1)},ca:(e,t,r,n,a)=>st[e](t,r,n,a),nb:e=>Je.toHandle(dt(e)),pb:()=>Je.toHandle({}),Ra:e=>{var t=Je.toValue(e);De(t),Ne(e)},pa:(e,t,r)=>{e=Je.toValue(e),t=Je.toValue(t),r=Je.toValue(r),e[t]=r},tb:(e,t)=>{if(ft[e]&&(clearTimeout(ft[e].id),delete ft[e]),!t)return 0;var r=setTimeout(()=>{delete ft[e],gt(()=>Or(e,performance.now()))},t);return ft[e]={id:r,timeout_ms:t},0},vb:e=>{var t=v.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var a=t*(1+.2/n);a=Math.min(a,e+100663296);var o=Math.min(r,_t(Math.max(e,a),65536));if(vt(o))return!0}return!1},Mb:(e,t)=>{var r=t>>2,n={alpha:!!_[t+0],depth:!!_[t+1],stencil:!!_[t+2],antialias:!!_[t+3],premultipliedAlpha:!!_[t+4],preserveDrawingBuffer:!!_[t+5],powerPreference:yt[y[r+2]],failIfMajorPerformanceCaveat:!!_[t+12],majorVersion:y[r+4],minorVersion:y[r+5],enableExtensionsByDefault:_[t+24],explicitSwapControl:_[t+25],proxyContextToMainThread:y[r+7],renderViaOffscreenBackBuffer:_[t+32]},a=Et(e);return a?n.explicitSwapControl?0:wt.createContext(a,n):0},Sb:e=>{wt.currentContext==e&&(wt.currentContext=0),wt.deleteContext(e)},hb:()=>wt.currentContext?wt.currentContext.handle:0,va:e=>wt.makeContextCurrent(e)?0:-5,Eb:function(e,t,r,n,a,o){t=Bt(t),r=Bt(r);var i=St.getJsObject(e),s={};if(o){var u=x[o+12>>2];if(u){var l=x[o+16>>2];s.requiredFeatures=Array.from(x.subarray(l>>2,l+4*u>>2),e=>St.FeatureName[e])}var c=x[o+20>>2];if(c){var d={};function m(e,t,r=!1){var n=x[c+t>>2];4294967295==n||r&&0==n||(d[e]=n)}function h(e,t){var r=c+t;4294967295==x[r>>2]&&4294967295==x[r+4>>2]||(d[e]=4294967296*x[r+4>>2]+x[r>>2])}m("maxTextureDimension1D",4),m("maxTextureDimension2D",8),m("maxTextureDimension3D",12),m("maxTextureArrayLayers",16),m("maxBindGroups",20),m("maxBindGroupsPlusVertexBuffers",24),m("maxDynamicUniformBuffersPerPipelineLayout",32),m("maxDynamicStorageBuffersPerPipelineLayout",36),m("maxSampledTexturesPerShaderStage",40),m("maxSamplersPerShaderStage",44),m("maxStorageBuffersPerShaderStage",48),m("maxStorageTexturesPerShaderStage",52),m("maxUniformBuffersPerShaderStage",56),m("minUniformBufferOffsetAlignment",80),m("minStorageBufferOffsetAlignment",84),h("maxUniformBufferBindingSize",64),h("maxStorageBufferBindingSize",72),m("maxVertexBuffers",88),h("maxBufferSize",96),m("maxVertexAttributes",104),m("maxVertexBufferArrayStride",108),m("maxInterStageShaderVariables",112),m("maxColorAttachments",116),m("maxColorAttachmentBytesPerSample",120),m("maxComputeWorkgroupStorageSize",124),m("maxComputeInvocationsPerWorkgroup",128),m("maxComputeWorkgroupSizeX",132),m("maxComputeWorkgroupSizeY",136),m("maxComputeWorkgroupSizeZ",140),m("maxComputeWorkgroupsPerDimension",144),m("maxImmediateSize",148,!0),s.requiredLimits=d}var f=x[o+24>>2];if(f){var p={label:St.makeStringFromOptionalStringView(f+4)};s.defaultQueue=p}s.label=St.makeStringFromOptionalStringView(o+4)}St.Internals.futureInsert(t,i.requestDevice(s).then(e=>{gt(()=>{St.Internals.jsObjectInsert(a,e.queue),St.Internals.jsObjectInsert(n,e),St.Internals.futureInsert(r,e.lost.then(t=>{gt(()=>{e.onuncapturederror=e=>{};var n=z(),a=kt(t.message);Cr(r,Tt[t.reason],a),U(n)})})),e.onuncapturederror=e=>{var t=5;e.error instanceof GPUValidationError?t=2:e.error instanceof GPUOutOfMemoryError?t=3:e.error instanceof GPUInternalError&&(t=4);var r=z(),a=kt(e.error.message);Fr(n,t,a),U(r)},Ar(t,1,n,0)})},e=>{gt(()=>{var a=z(),o=kt(e.message);Ar(t,3,n,o),r&&Cr(r,4,o),U(a)})}))},Gb:e=>{var t=St.getJsObject(e),r=St.Internals.bufferOnUnmaps[e];if(r){for(var n=0;n<r.length;++n)r[n]();delete St.Internals.bufferOnUnmaps[e]}t.destroy()},h:e=>{delete St.Internals.jsObjects[e]},Db:(e,t,r)=>{var n,a=!!x[t+32>>2],o={label:St.makeStringFromOptionalStringView(t+4),usage:x[t+16>>2],size:4294967296*x[t+4+24>>2]+x[t+24>>2],mappedAtCreation:a},i=St.getJsObject(e);try{n=i.createBuffer(o)}catch(e){return!1}return St.Internals.jsObjectInsert(r,n),a&&(St.Internals.bufferOnUnmaps[r]=[]),!0},Bb:(e,t,r)=>{var n=x[t>>2],a=x[n+4>>2],o={label:St.makeStringFromOptionalStringView(t+4),code:""};2===a&&(o.code=St.makeStringFromStringView(n+8));var i=St.getJsObject(e);St.Internals.jsObjectInsert(r,i.createShaderModule(o))},Fb:e=>{const t=St.getJsObject(e);t.onuncapturederror=null,t.destroy()},Ab:function(e,t,r,n){var a;if(t=Bt(t),r){a={featureLevel:St.FeatureLevel[x[r+4>>2]],powerPreference:St.PowerPreference[x[r+8>>2]],forceFallbackAdapter:!!x[r+12>>2]};var o=x[r>>2];0!==o&&(a.xrCompatible=!!x[o+8>>2])}if(!("gpu"in navigator)){var i=z(),s=kt("WebGPU not available on this browser (navigator.gpu is not available)");return Pr(t,3,n,s),void U(i)}St.Internals.futureInsert(t,navigator.gpu.requestAdapter(a).then(e=>{gt(()=>{if(e)St.Internals.jsObjectInsert(n,e),Pr(t,1,n,0);else{var r=z(),a=kt("WebGPU not available on this browser (requestAdapter returned null)");Pr(t,3,n,a),U(r)}})},e=>{gt(()=>{var r=z(),a=kt(e.message);Pr(t,4,n,a),U(r)})}))},xb:function(e){try{var t=Jt.getStreamFromFD(e);return Nt.close(t),0}catch(e){if(void 0===Nt||"ErrnoError"!==e.name)throw e;return e.errno}},wb:function(e,t,r,n){t=Bt(t);try{if(isNaN(t))return 61;var a=Jt.getStreamFromFD(e);return Nt.llseek(a,t,r),S[n>>3]=BigInt(a.position),a.getdents&&0===t&&0===r&&(a.getdents=null),0}catch(e){if(void 0===Nt||"ErrnoError"!==e.name)throw e;return e.errno}},yb:function(e,t,r,n){try{var a=((e,t,r)=>{for(var n=0,a=0;a<r;a++){var o=x[t>>2],i=x[t+4>>2];t+=8;var s=Nt.write(e,_,o,i,void 0);if(s<0)return-1;if(n+=s,s<i)break}return n})(Jt.getStreamFromFD(e),t,r);return x[n>>2]=a,0}catch(e){if(void 0===Nt||"ErrnoError"!==e.name)throw e;return e.errno}},Pa:e=>Ve.activeTexture(e),ja:(e,t)=>{Ve.attachShader(wt.programs[e],wt.shaders[t])},w:(e,t)=>{if(t&&!wt.buffers[t]){var r=Ve.createBuffer();r.name=t,wt.buffers[t]=r}34962==e?Ve.currentArrayBufferBinding=t:34963==e&&(Ve.currentElementArrayBufferBinding=t),35051==e?Ve.currentPixelPackBufferBinding=t:35052==e&&(Ve.currentPixelUnpackBufferBinding=t),Ve.bindBuffer(e,wt.buffers[t])},Na:(e,t,r,n,a)=>{Ve.bindBufferRange(e,t,wt.buffers[r],n,a)},f:(e,t)=>{Ve.bindFramebuffer(e,wt.framebuffers[t])},O:(e,t)=>{Ve.bindRenderbuffer(e,wt.renderbuffers[t])},I:(e,t)=>{Ve.bindTexture(e,wt.textures[t])},ka:e=>{Ve.bindVertexArray(wt.vaos[e]);var t=Ve.getParameter(34965);Ve.currentElementArrayBufferBinding=t?0|t.name:0},A:(e,t)=>Ve.blendFunc(e,t),v:(e,t,r,n,a,o,i,s,u,l)=>Ve.blitFramebuffer(e,t,r,n,a,o,i,s,u,l),la:(e,t,r,n)=>{wt.currentContext.version>=2?r&&t?Ve.bufferData(e,v,n,r,t):Ve.bufferData(e,t,n):Ve.bufferData(e,r?v.subarray(r,r+t):t,n)},X:e=>Ve.clear(e),Y:(e,t,r,n)=>Ve.clearColor(e,t,r,n),Ia:e=>Ve.clearDepth(e),Ja:e=>Ve.clearStencil(e),C:(e,t,r,n)=>{Ve.colorMask(!!e,!!t,!!r,!!n)},Da:e=>{Ve.compileShader(wt.shaders[e])},ab:()=>{var e=wt.getNewId(wt.programs),t=Ve.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,wt.programs[e]=t,e},Ga:e=>{var t=wt.getNewId(wt.shaders);return wt.shaders[t]=Ve.createShader(e),t},Xa:e=>Ve.cullFace(e),eb:(e,t)=>{for(var r=0;r<e;r++){var n=y[t+4*r>>2],a=wt.buffers[n];a&&(Ve.deleteBuffer(a),a.name=0,wt.buffers[n]=null,n==Ve.currentArrayBufferBinding&&(Ve.currentArrayBufferBinding=0),n==Ve.currentElementArrayBufferBinding&&(Ve.currentElementArrayBufferBinding=0),n==Ve.currentPixelPackBufferBinding&&(Ve.currentPixelPackBufferBinding=0),n==Ve.currentPixelUnpackBufferBinding&&(Ve.currentPixelUnpackBufferBinding=0))}},_:(e,t)=>{for(var r=0;r<e;++r){var n=y[t+4*r>>2],a=wt.framebuffers[n];a&&(Ve.deleteFramebuffer(a),a.name=0,wt.framebuffers[n]=null)}},ha:e=>{if(e){var t=wt.programs[e];t?(Ve.deleteProgram(t),t.name=0,wt.programs[e]=null):wt.recordError(1281)}},Z:(e,t)=>{for(var r=0;r<e;r++){var n=y[t+4*r>>2],a=wt.renderbuffers[n];a&&(Ve.deleteRenderbuffer(a),a.name=0,wt.renderbuffers[n]=null)}},N:e=>{if(e){var t=wt.shaders[e];t?(Ve.deleteShader(t),wt.shaders[e]=null):wt.recordError(1281)}},ma:(e,t)=>{for(var r=0;r<e;r++){var n=y[t+4*r>>2],a=wt.textures[n];a&&(Ve.deleteTexture(a),a.name=0,wt.textures[n]=null)}},cb:(e,t)=>{for(var r=0;r<e;r++){var n=y[t+4*r>>2];Ve.deleteVertexArray(wt.vaos[n]),wt.vaos[n]=null}},Va:e=>Ve.depthFunc(e),K:e=>{Ve.depthMask(!!e)},x:e=>Ve.disable(e),La:e=>{wt.currentContext.clientBuffers[e].enabled=!1,Ve.disableVertexAttribArray(e)},Ma:(e,t,r,n)=>{var a,o=0;if(!Ve.currentElementArrayBufferBinding){var i=wt.calcBufLength(1,r,0,t);if(a=wt.getTempIndexBuffer(i),Ve.bindBuffer(34963,a),Ve.bufferSubData(34963,0,v.subarray(n,n+i)),t>0)for(var s=0;s<wt.currentContext.maxVertexAttribs;++s){var u=wt.currentContext.clientBuffers[s];if(u.clientside&&u.enabled){let e;switch(r){case 5121:e=Uint8Array;break;case 5123:e=Uint16Array;break;case 5125:e=Uint32Array;break;default:return void wt.recordError(1282)}o=new e(v.buffer,n,t).reduce((e,t)=>Math.max(e,t))+1;break}}n=0}wt.preDrawHandleClientVertexAttribBindings(o),Ve.drawElements(e,t,r,n),wt.postDrawHandleClientVertexAttribBindings(t),Ve.currentElementArrayBufferBinding||Ve.bindBuffer(34963,null)},s:e=>Ve.enable(e),Sa:e=>{wt.currentContext.clientBuffers[e].enabled=!0,Ve.enableVertexAttribArray(e)},$:(e,t,r,n)=>{Ve.framebufferRenderbuffer(e,t,r,wt.renderbuffers[n])},Ua:(e,t,r,n,a)=>{Ve.framebufferTexture2D(e,t,r,wt.textures[n],a)},Wa:e=>Ve.frontFace(e),fb:(e,t)=>{wt.genObject(e,t,"createBuffer",wt.buffers)},da:(e,t)=>{wt.genObject(e,t,"createFramebuffer",wt.framebuffers)},ba:(e,t)=>{wt.genObject(e,t,"createRenderbuffer",wt.renderbuffers)},fa:(e,t)=>{wt.genObject(e,t,"createTexture",wt.textures)},db:(e,t)=>{wt.genObject(e,t,"createVertexArray",wt.vaos)},bb:(e,t)=>((e,t)=>{if(t){var r,n=void 0;switch(e){case 36346:n=1;break;case 36344:return;case 34814:case 36345:n=0;break;case 34466:var a=Ve.getParameter(34467);n=a?a.length:0;break;case 33309:if(wt.currentContext.version<2)return void wt.recordError(1282);n=(r=bt(Ve),r.concat(r.map(e=>"GL_"+e))).length;break;case 33307:case 33308:if(wt.currentContext.version<2)return void wt.recordError(1280);n=33307==e?3:0}if(void 0===n){var o=Ve.getParameter(e);switch(typeof o){case"number":n=o;break;case"boolean":n=o?1:0;break;case"string":return void wt.recordError(1280);case"object":if(null===o)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void wt.recordError(1280)}else{if(o instanceof Float32Array||o instanceof Uint32Array||o instanceof Int32Array||o instanceof Array){for(var i=0;i<o.length;++i)y[t+4*i>>2]=o[i];return}try{n=0|o.name}catch(t){return wt.recordError(1280),void P(`GL_INVALID_ENUM in glGet0v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return wt.recordError(1280),void P(`GL_INVALID_ENUM in glGet0v: Native code calling glGet0v(${e}) and it returns ${o} of type ${typeof o}!`)}}y[t>>2]=n}else wt.recordError(1281)})(e,t),_a:(e,t,r,n)=>{var a=Ve.getProgramInfoLog(wt.programs[e]);null===a&&(a="(unknown error)");var o=t>0&&n?Ke(a,n,t):0;r&&(y[r>>2]=o)},ia:(e,t,r)=>{if(r)if(e>=wt.counter)wt.recordError(1281);else if(e=wt.programs[e],35716==t){var n=Ve.getProgramInfoLog(e);null===n&&(n="(unknown error)"),y[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var a=Ve.getProgramParameter(e,35718),o=0;o<a;++o)e.maxUniformLength=Math.max(e.maxUniformLength,Ve.getActiveUniform(e,o).name.length+1);y[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength){var i=Ve.getProgramParameter(e,35721);for(o=0;o<i;++o)e.maxAttributeLength=Math.max(e.maxAttributeLength,Ve.getActiveAttrib(e,o).name.length+1)}y[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength){var s=Ve.getProgramParameter(e,35382);for(o=0;o<s;++o)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,Ve.getActiveUniformBlockName(e,o).length+1)}y[r>>2]=e.maxUniformBlockNameLength}else y[r>>2]=Ve.getProgramParameter(e,t);else wt.recordError(1281)},Ca:(e,t,r,n)=>{var a=Ve.getShaderInfoLog(wt.shaders[e]);null===a&&(a="(unknown error)");var o=t>0&&n?Ke(a,n,t):0;r&&(y[r>>2]=o)},W:(e,t,r)=>{if(r)if(35716==t){var n=Ve.getShaderInfoLog(wt.shaders[e]);null===n&&(n="(unknown error)"),y[r>>2]=n?n.length+1:0}else if(35720==t){var a=Ve.getShaderSource(wt.shaders[e]);y[r>>2]=a?a.length+1:0}else y[r>>2]=Ve.getShaderParameter(wt.shaders[e],t);else wt.recordError(1281)},l:(e,t)=>Ve.getUniformBlockIndex(wt.programs[e],J(t)),o:(e,t)=>{if(t=J(t),e=wt.programs[e]){(e=>{var t,r,n=e.uniformLocsById,a=e.uniformSizeAndIdsByName;if(!n){e.uniformLocsById=n={},e.uniformArrayNamesById={};var o=Ve.getProgramParameter(e,35718);for(t=0;t<o;++t){var i=Ve.getActiveUniform(e,t),s=i.name,u=i.size,l=Ht(s),c=l>0?s.slice(0,l):s,d=e.uniformIdCounter;for(e.uniformIdCounter+=u,a[c]=[u,d],r=0;r<u;++r)n[d]=r,e.uniformArrayNamesById[d++]=c}}})(e);var r=e.uniformLocsById,n=0,a=t,o=Ht(t);o>0&&(s=t.slice(o+1),n=parseInt(s)>>>0,a=t.slice(0,o));var i=e.uniformSizeAndIdsByName[a];if(i&&n<i[0]&&(r[n+=i[1]]=r[n]||Ve.getUniformLocation(e,t)))return n}else wt.recordError(1281);var s;return-1},Ha:(e,t,r)=>{for(var n=qt[t],a=0;a<t;a++)n[a]=y[r+4*a>>2];Ve.invalidateFramebuffer(e,n)},$a:e=>{Ve.linkProgram(e=wt.programs[e]),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},aa:(e,t,r,n,a)=>Ve.renderbufferStorageMultisample(e,t,r,n,a),r:(e,t,r,n)=>Ve.scissor(e,t,r,n),Ea:(e,t,r,n)=>{var a=wt.getSource(e,t,r,n);Ve.shaderSource(wt.shaders[e],a)},M:(e,t,r)=>Ve.stencilFunc(e,t,r),E:(e,t,r,n)=>Ve.stencilFuncSeparate(e,t,r,n),L:(e,t,r)=>Ve.stencilOp(e,t,r),D:(e,t,r,n)=>Ve.stencilOpSeparate(e,t,r,n),ea:(e,t,r,n,a,o,i,s,u)=>{if(wt.currentContext.version>=2){if(Ve.currentPixelUnpackBufferBinding)return void Ve.texImage2D(e,t,r,n,a,o,i,s,u);if(u){var l=Xt(s),c=Qt(u,l);return void Ve.texImage2D(e,t,r,n,a,o,i,s,l,c)}}var d=u?((e,t,r,n,a)=>{var o=Xt(e),i=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*o.BYTES_PER_ELEMENT,s=((e,t,r)=>{var n;return t*(e*r+(n=wt.unpackAlignment)-1&-n)})(r,n,i);return o.subarray(Qt(a,o),Qt(a+s,o))})(s,i,n,a,u):null;Ve.texImage2D(e,t,r,n,a,o,i,s,d)},z:(e,t,r)=>Ve.texParameteri(e,t,r),Ta:(e,t)=>{Ve.uniform1f(Kt(e),t)},Ya:(e,t,r)=>{if(wt.currentContext.version>=2)t&&Ve.uniform1iv(Kt(e),y,r>>2,t);else{if(t<=288)for(var n=Zt[t],a=0;a<t;++a)n[a]=y[r+4*a>>2];else n=y.subarray(r>>2,r+4*t>>2);Ve.uniform1iv(Kt(e),n)}},Oa:(e,t,r)=>{Ve.uniformBlockBinding(e=wt.programs[e],t,r)},Za:e=>{Ve.useProgram(e=wt.programs[e]),Ve.currentProgram=e},Qa:(e,t,r,n,a,o)=>{var i=wt.currentContext.clientBuffers[e];if(!Ve.currentArrayBufferBinding)return i.size=t,i.type=r,i.normalized=n,i.stride=a,i.ptr=o,i.clientside=!0,void(i.vertexAttribPointerAdaptor=function(e,t,r,n,a,o){this.vertexAttribPointer(e,t,r,n,a,o)});i.clientside=!1,Ve.vertexAttribPointer(e,t,r,!!n,a,o)},q:(e,t,r,n)=>Ve.viewport(e,t,r,n),t:function(e,t){var r=z();try{return Ae(e)(t)}catch(e){if(U(r),e!==e+0)throw e;jr(1,0)}},j:function(e,t,r){var n=z();try{return Ae(e)(t,r)}catch(e){if(U(n),e!==e+0)throw e;jr(1,0)}},g:function(e,t,r,n){var a=z();try{return Ae(e)(t,r,n)}catch(e){if(U(a),e!==e+0)throw e;jr(1,0)}},sa:function(e,t,r,n,a,o){var i=z();try{return Ae(e)(t,r,n,a,o)}catch(e){if(U(i),e!==e+0)throw e;jr(1,0)}},R:function(e){var t=z();try{Ae(e)()}catch(e){if(U(t),e!==e+0)throw e;jr(1,0)}},b:function(e,t){var r=z();try{Ae(e)(t)}catch(e){if(U(r),e!==e+0)throw e;jr(1,0)}},c:function(e,t,r){var n=z();try{Ae(e)(t,r)}catch(e){if(U(n),e!==e+0)throw e;jr(1,0)}},n:function(e,t,r,n){var a=z();try{Ae(e)(t,r,n)}catch(e){if(U(a),e!==e+0)throw e;jr(1,0)}},B:function(e,t,r,n,a){var o=z();try{Ae(e)(t,r,n,a)}catch(e){if(U(o),e!==e+0)throw e;jr(1,0)}},rb:ht,J:function(e){var t=St.getJsObject(e).size;return BigInt(t)},T:(e,t)=>{function r(e){var t=x[e+4>>2];if(0!==t){var r=y[e+8>>2];-1==r&&(r=void 0);var n=x[e+16>>2],a=x[e+20>>2],o=St.makeColor(e+24);return{view:St.getJsObject(t),depthSlice:r,resolveTarget:St.getJsObject(x[e+12>>2]),clearValue:o,loadOp:St.LoadOp[n],storeOp:St.StoreOp[a]}}}function n(e,t){for(var n=[],a=0;a<e;++a)n.push(r(t+56*a));return n}function a(e){if(0!==e)return{view:St.getJsObject(x[e+4>>2]),depthClearValue:E[e+16>>2],depthLoadOp:St.LoadOp[x[e+8>>2]],depthStoreOp:St.StoreOp[x[e+12>>2]],depthReadOnly:!!x[e+20>>2],stencilClearValue:x[e+32>>2],stencilLoadOp:St.LoadOp[x[e+24>>2]],stencilStoreOp:St.StoreOp[x[e+28>>2]],stencilReadOnly:!!x[e+36>>2]}}var o=function(e){var t=x[e>>2],r=void 0;return 0!==t&&(r=4294967296*x[t+4+8>>2]+x[t+8>>2]),{label:St.makeStringFromOptionalStringView(e+4),colorAttachments:n(x[e+12>>2],x[e+16>>2]),depthStencilAttachment:a(x[e+20>>2]),occlusionQuerySet:St.getJsObject(x[e+24>>2]),timestampWrites:St.makePassTimestampWrites(x[e+28>>2]),maxDrawCount:r}}(t),i=St.getJsObject(e),s=_r(0);return St.Internals.jsObjectInsert(s,i.beginRenderPass(o)),s},Kb:(e,t,r,n)=>{var a=St.getJsObject(e),o=St.makeExtent3D(n);a.copyTextureToTexture(St.makeTexelCopyTextureInfo(t),St.makeTexelCopyTextureInfo(r),o)},Nb:(e,t)=>{var r=St.getJsObject(e),n=lr(0);return St.Internals.jsObjectInsert(n,r.finish()),n},H:(e,t)=>{function r(e){var t=x[e+8>>2],r=x[e+32>>2],n=x[e+36>>2],a=x[e+4>>2];if(t){var o=(e=>x[e>>2]+4294967296*y[e+4>>2])(e+24);return-1==o&&(o=void 0),{binding:a,resource:{buffer:St.getJsObject(t),offset:4294967296*x[e+4+16>>2]+x[e+16>>2],size:o}}}return r?{binding:a,resource:St.getJsObject(r)}:{binding:a,resource:St.getJsObject(n)}}var n={label:St.makeStringFromOptionalStringView(t+4),layout:St.getJsObject(x[t+12>>2]),entries:function(e,t){for(var n=[],a=0;a<e;++a)n.push(r(t+40*a));return n}(x[t+16>>2],x[t+20>>2])},a=St.getJsObject(e),o=sr(0);return St.Internals.jsObjectInsert(o,a.createBindGroup(n)),o},u:(e,t)=>{function r(e){var t=x[e+4>>2];if(t)return{type:St.BufferBindingType[t],hasDynamicOffset:!!x[e+8>>2],minBindingSize:4294967296*x[e+4+16>>2]+x[e+16>>2]}}function n(e){var t=x[e+4>>2];if(t)return{type:St.SamplerBindingType[t]}}function a(e){var t=x[e+4>>2];if(t)return{sampleType:St.TextureSampleType[t],viewDimension:St.TextureViewDimension[x[e+8>>2]],multisampled:!!x[e+12>>2]}}function o(e){var t=x[e+4>>2];if(t)return{access:St.StorageTextureAccess[t],format:St.TextureFormat[x[e+8>>2]],viewDimension:St.TextureViewDimension[x[e+12>>2]]}}function i(e){return{binding:x[e+4>>2],visibility:x[e+8>>2],buffer:r(e+24),sampler:n(e+48),texture:a(e+56),storageTexture:o(e+72)}}var s={label:St.makeStringFromOptionalStringView(t+4),entries:function(e,t){for(var r=[],n=0;n<e;++n)r.push(i(t+88*n));return r}(x[t+12>>2],x[t+16>>2])},u=St.getJsObject(e),l=ur(0);return St.Internals.jsObjectInsert(l,u.createBindGroupLayout(s)),l},Ob:(e,t)=>{var r;t&&(r={label:St.makeStringFromOptionalStringView(t+4)});var n=St.getJsObject(e),a=cr(0);return St.Internals.jsObjectInsert(a,n.createCommandEncoder(r)),a},Lb:(e,t)=>{for(var r=x[t+12>>2],n=x[t+16>>2],a=[],o=0;o<r;++o)a.push(St.getJsObject(x[n+4*o>>2]));var i={label:St.makeStringFromOptionalStringView(t+4),bindGroupLayouts:a},s=St.getJsObject(e),u=pr(0);return St.Internals.jsObjectInsert(u,s.createPipelineLayout(i)),u},k:(e,t)=>{var r=St.makeRenderPipelineDesc(t),n=St.getJsObject(e),a=vr(0);return St.Internals.jsObjectInsert(a,n.createRenderPipeline(r)),a},Ba:(e,t)=>{var r;t&&(r={label:St.makeStringFromOptionalStringView(t+4),addressModeU:St.AddressMode[x[t+12>>2]],addressModeV:St.AddressMode[x[t+16>>2]],addressModeW:St.AddressMode[x[t+20>>2]],magFilter:St.FilterMode[x[t+24>>2]],minFilter:St.FilterMode[x[t+28>>2]],mipmapFilter:St.MipmapFilterMode[x[t+32>>2]],lodMinClamp:E[t+36>>2],lodMaxClamp:E[t+40>>2],compare:St.CompareFunction[x[t+44>>2]],maxAnisotropy:w[t+48>>1]});var n=St.getJsObject(e),a=br(0);return St.Internals.jsObjectInsert(a,n.createSampler(r)),a},U:(e,t)=>{var r={label:St.makeStringFromOptionalStringView(t+4),size:St.makeExtent3D(t+28),mipLevelCount:x[t+44>>2],sampleCount:x[t+48>>2],dimension:St.TextureDimension[x[t+24>>2]],format:St.TextureFormat[x[t+40>>2]],usage:x[t+16>>2]},n=x[t+52>>2];if(n){var a=x[t+56>>2];r.viewFormats=Array.from(y.subarray(a>>2,a+4*n>>2),e=>St.TextureFormat[e])}var o=St.getJsObject(e),i=yr(0);return St.Internals.jsObjectInsert(i,o.createTexture(r)),i},Cb:(e,t)=>{var r=Et(x[x[t>>2]+8>>2]).getContext("webgpu");if(!r)return 0;r.surfaceLabelWebGPU=St.makeStringFromOptionalStringView(t+4);var n=wr(0);return St.Internals.jsObjectInsert(n,r),n},xa:(e,t,r)=>{var n=St.getJsObject(e),a=Array.from(y.subarray(r>>2,r+4*t>>2),e=>St.getJsObject(e));n.submit(a)},G:function(e,t,r,n,a){r=Bt(r);var o=St.getJsObject(e),i=St.getJsObject(t),s=v.subarray(n,n+a);o.writeBuffer(i,r,s,0,a)},ya:(e,t,r,n,a,o)=>{var i=St.getJsObject(e),s=St.makeTexelCopyTextureInfo(t),u=St.makeTexelCopyBufferLayout(a),l=St.makeExtent3D(o),c=v.subarray(r,r+n);i.writeTexture(s,c,u,l)},ta:(e,t,r,n,a,o)=>{n>>>=0,o>>>=0,St.getJsObject(e).drawIndexed(t,r,n,a,o)},wa:e=>{St.getJsObject(e).end()},d:(e,t,r,n,a)=>{var o=St.getJsObject(e),i=St.getJsObject(r);0==n?o.setBindGroup(t,i):o.setBindGroup(t,i,x,a>>2,n)},ua:function(e,t,r,n,a){n=Bt(n),a=Bt(a);var o=St.getJsObject(e),i=St.getJsObject(t);-1==a&&(a=void 0),o.setIndexBuffer(i,St.IndexFormat[r],n,a)},e:(e,t)=>{var r=St.getJsObject(e),n=St.getJsObject(t);r.setPipeline(n)},m:(e,t,r,n,a)=>{St.getJsObject(e).setScissorRect(t,r,n,a)},i:(e,t)=>{t>>>=0,St.getJsObject(e).setStencilReference(t)},S:function(e,t,r,n,a){n=Bt(n),a=Bt(a);var o=St.getJsObject(e),i=St.getJsObject(r);-1==a&&(a=void 0),o.setVertexBuffer(t,i,n,a)},Ib:(e,t)=>{var r=x[t+4>>2],n=St.getJsObject(e),a=[x[t+24>>2],x[t+28>>2]];0!==a[0]&&(n.canvas.width=a[0]),0!==a[1]&&(n.canvas.height=a[1]);var o={device:St.getJsObject(r),format:St.TextureFormat[x[t+8>>2]],usage:x[t+16>>2],alphaMode:St.CompositeAlphaMode[x[t+40>>2]]},i=x[t+32>>2];if(i){var s=x[t+36>>2];o.viewFormats=Array.from(y.subarray(s>>2,s+4*i>>2),e=>St.TextureFormat[e])}var u=x[t>>2];if(0!==u){var l=u;o.colorSpace=St.PredefinedColorSpace[x[l+8>>2]],o.toneMapping={mode:St.ToneMappingMode[x[l+12>>2]]}}n.configure(o)},Hb:(e,t)=>{var r=St.getJsObject(e);try{var n=yr(0);St.Internals.jsObjectInsert(n,r.getCurrentTexture()),x[t+4>>2]=n,y[t+8>>2]=1}catch(e){x[t+4>>2]=0,y[t+8>>2]=6}},Jb:e=>{St.getJsObject(e).unconfigure()},Qb:(e,t)=>{var r;if(t){var n=x[t+24>>2],a=x[t+32>>2];r={label:St.makeStringFromOptionalStringView(t+4),format:St.TextureFormat[x[t+12>>2]],dimension:St.TextureViewDimension[x[t+16>>2]],baseMipLevel:x[t+20>>2],mipLevelCount:4294967295===n?void 0:n,baseArrayLayer:x[t+28>>2],arrayLayerCount:4294967295===a?void 0:a,aspect:St.TextureAspect[x[t+36>>2]]}}var o=St.getJsObject(e),i=xr(0);return St.Internals.jsObjectInsert(i,o.createView(r)),i},Pb:e=>{St.getJsObject(e).destroy()},Rb:e=>{var t=St.getJsObject(e);return St.TextureFormat.indexOf(t.format)},za:e=>St.getJsObject(e).height,V:e=>St.getJsObject(e).width};return Nr=await async function(){function e(e,t){return function(e){ar=r._free=e.Wb,or=r._malloc=e.Xb,ir=e.Yb,r._tvg_engine_init=e.Zb,r._tvg_engine_term=e._b,r._tvg_swcanvas_create=e.$b,r._tvg_glcanvas_create=e.ac,r._tvg_wgcanvas_create=e.bc,r._tvg_canvas_destroy=e.cc,r._tvg_swcanvas_set_target=e.dc,r._tvg_canvas_add=e.ec,r._tvg_canvas_insert=e.fc,r._tvg_canvas_remove=e.gc,r._tvg_canvas_update=e.hc,r._tvg_canvas_draw=e.ic,r._tvg_canvas_sync=e.jc,r._tvg_canvas_set_viewport=e.kc,r._tvg_paint_rel=e.lc,r._tvg_paint_set_visible=e.mc,r._tvg_paint_get_visible=e.nc,r._tvg_paint_ref=e.oc,r._tvg_paint_unref=e.pc,r._tvg_paint_get_ref=e.qc,r._tvg_paint_scale=e.rc,r._tvg_paint_rotate=e.sc,r._tvg_paint_translate=e.tc,r._tvg_paint_set_transform=e.uc,r._tvg_paint_get_transform=e.vc,r._tvg_paint_duplicate=e.wc,r._tvg_paint_intersects=e.xc,r._tvg_paint_set_opacity=e.yc,r._tvg_paint_get_opacity=e.zc,r._tvg_paint_get_aabb=e.Ac,r._tvg_paint_get_obb=e.Bc,r._tvg_paint_set_mask_method=e.Cc,r._tvg_paint_set_blend_method=e.Dc,r._tvg_paint_get_type=e.Ec,r._tvg_paint_set_clip=e.Fc,r._tvg_paint_get_clip=e.Gc,r._tvg_shape_new=e.Hc,r._tvg_shape_reset=e.Ic,r._tvg_shape_move_to=e.Jc,r._tvg_shape_line_to=e.Kc,r._tvg_shape_cubic_to=e.Lc,r._tvg_shape_close=e.Mc,r._tvg_shape_append_rect=e.Nc,r._tvg_shape_append_circle=e.Oc,r._tvg_shape_append_path=e.Pc,r._tvg_shape_get_path=e.Qc,r._tvg_shape_set_stroke_width=e.Rc,r._tvg_shape_get_stroke_width=e.Sc,r._tvg_shape_set_stroke_color=e.Tc,r._tvg_shape_get_stroke_color=e.Uc,r._tvg_shape_set_stroke_gradient=e.Vc,r._tvg_shape_get_stroke_gradient=e.Wc,r._tvg_shape_set_stroke_dash=e.Xc,r._tvg_shape_get_stroke_dash=e.Yc,r._tvg_shape_set_stroke_cap=e.Zc,r._tvg_shape_get_stroke_cap=e._c,r._tvg_shape_set_stroke_join=e.$c,r._tvg_shape_get_stroke_join=e.ad,r._tvg_shape_set_stroke_miterlimit=e.bd,r._tvg_shape_set_trimpath=e.cd,r._tvg_shape_set_fill_color=e.dd,r._tvg_shape_get_fill_color=e.ed,r._tvg_shape_set_fill_rule=e.fd,r._tvg_shape_get_fill_rule=e.gd,r._tvg_shape_set_gradient=e.hd,r._tvg_shape_get_gradient=e.id,r._tvg_picture_new=e.jd,r._tvg_picture_load=e.kd,r._tvg_picture_load_raw=e.ld,r._tvg_picture_load_data=e.md,r._tvg_picture_set_size=e.nd,r._tvg_picture_get_size=e.od,r._tvg_picture_set_origin=e.pd,r._tvg_picture_get_origin=e.qd,r._tvg_linear_gradient_new=e.rd,r._tvg_radial_gradient_new=e.sd,r._tvg_gradient_del=e.td,r._tvg_linear_gradient_set=e.ud,r._tvg_linear_gradient_get=e.vd,r._tvg_radial_gradient_set=e.wd,r._tvg_radial_gradient_get=e.xd,r._tvg_gradient_set_color_stops=e.yd,r._tvg_gradient_get_color_stops=e.zd,r._tvg_gradient_set_spread=e.Ad,r._tvg_gradient_get_spread=e.Bd,r._tvg_scene_new=e.Cd,r._tvg_scene_add=e.Dd,r._tvg_scene_insert=e.Ed,r._tvg_scene_remove=e.Fd,r._tvg_scene_clear_effects=e.Gd,r._tvg_scene_add_effect_drop_shadow=e.Hd,r._tvg_scene_add_effect_gaussian_blur=e.Id,r._tvg_scene_add_effect_fill=e.Jd,r._tvg_scene_add_effect_tint=e.Kd,r._tvg_scene_add_effect_tritone=e.Ld,r._tvg_text_new=e.Md,r._tvg_text_set_font=e.Nd,r._tvg_text_set_size=e.Od,r._tvg_text_set_text=e.Pd,r._tvg_text_align=e.Qd,r._tvg_text_layout=e.Rd,r._tvg_text_set_outline=e.Sd,r._tvg_text_set_color=e.Td,r._tvg_text_set_italic=e.Ud,r._tvg_text_set_gradient=e.Vd,r._tvg_text_wrap_mode=e.Wd,r._tvg_text_spacing=e.Xd,r._tvg_font_load=e.Yd,r._tvg_font_load_data=e.Zd,r._tvg_font_unload=e._d,r._tvg_animation_new=e.$d,r._tvg_animation_set_frame=e.ae,r._tvg_animation_get_frame=e.be,r._tvg_animation_get_total_frame=e.ce,r._tvg_animation_get_picture=e.de,r._tvg_animation_get_duration=e.ee,r._tvg_animation_set_segment=e.fe,r._tvg_animation_get_segment=e.ge,r._tvg_animation_del=e.he,r._tvg_accessor_new=e.ie,r._tvg_accessor_del=e.je,r._tvg_accessor_set=e.ke,sr=e.le,ur=e.me,lr=e.ne,cr=e.oe,dr=e.pe,fr=e.qe,pr=e.re,mr=e.se,hr=e.te,gr=e.ue,_r=e.ve,vr=e.we,br=e.xe,wr=e.ye,yr=e.ze,xr=e.Ae,Er=e.Be,kr=e.Ce,Sr=e.De,Tr=e.Ee,Br=e.Fe,Cr=e.Ge,Pr=e.He,Ar=e.Ie,Fr=e.Je,Or=e.Le,jr=e.Me,Ir=e.Ne,$r=e.Oe,Lr=e.Pe,Dr=e.Qe,Mr=e.Re,Rr=e.Se,Vr=e.Te,Wr=e.Ub,Ur=e.Ke}(Nr=e.exports),j(),Nr}var n,a={a:Jr};return r.instantiateWasm?new Promise((t,n)=>{r.instantiateWasm(a,(r,n)=>{t(e(r))})}):(B??(B=r.locateFile?(n="thorvg.wasm",r.locateFile?r.locateFile(n,d):d+n):new URL("thorvg.wasm","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("webcanvas.js",document.baseURI).href).href),e((await async function(e,t,r){if(!e&&!F(t)&&!o)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(e){P(`wasm streaming compile failed: ${e}`),P("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await async function(e){if(!p)try{var t=await s(e);return new Uint8Array(t)}catch{}return function(e){if(e==B&&p)return new Uint8Array(p);if(u)return u(e);throw"both async and sync fetching of the wasm failed"}(e)}(e);return await WebAssembly.instantiate(r,t)}catch(e){P(`failed to asynchronously prepare wasm: ${e}`),I(e)}}(t,r)}(p,B,a)).instance))}(),function e(){function t(){r.calledRun=!0,A||(O=!0,r.noFSInit||Nt.initialized||Nt.init(),Nr.Vb(),Nt.ignorePermissions=!1,h?.(r),r.onRuntimeInitialized?.(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)M(r.postRun.shift());L(D)}())}Rt>0?Vt=e:(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)V(r.preRun.shift());L(R)}(),Rt>0?Vt=e:r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),t()},1)):t())}(),O?r:new Promise((e,t)=>{h=e,g=t})}let Ee=null,ke=!1,Se="gl";function Te(){return Se}async function Be(e={}){if(ke)return Pe();const{locateFile:t,renderer:r="gl",onError:n}=e;return Se=r,s=n,Ee=await xe({locateFile:t??(e=>e)}),globalThis.__ThorVGModule=Ee,ke=!0,await async function(e="gl"){if(!Ee)return void l("ThorVG module not loaded. Call init() first.","initEngine");if("wg"!==e)return;let t,r=0;do{t=Ee.init(),2===t&&(await new Promise(e=>setTimeout(e,100)),r++)}while(2===t&&r<50);1!==t||l("ThorVG WebGPU initialization failed","initEngine")}(r),Pe()}function Ce(){ke&&Ee&&(Ee.term(),globalThis.__ThorVGModule&&delete globalThis.__ThorVGModule,Ee=null,ke=!1)}function Pe(){return{Canvas:M,Shape:V,Scene:E,Picture:Z,Text:Y,Animation:ge,LinearGradient:ve,RadialGradient:be,Font:we,BlendMethod:W,StrokeCap:U,StrokeJoin:z,FillRule:G,GradientSpread:N,CompositeMethod:J,MaskMethod:H,SceneEffect:q,TextWrapMode:X,ColorSpace:Q,term:Ce}}const Ae={init:Be};e.Animation=ge,e.Canvas=M,e.Font=we,e.LinearGradient=ve,e.Picture=Z,e.RadialGradient=be,e.Scene=E,e.Shape=V,e.Text=Y,e.ThorVGError=i,e.ThorVGResultCode=o,e.constants=K,e.default=Ae,e.getGlobalRenderer=Te,e.init=Be,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=webcanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webcanvas.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thorvg/webcanvas",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A TypeScript WebCanvas API for ThorVG - High-performance vector graphics rendering",
|
|
5
|
+
"main": "./dist/webcanvas.cjs.js",
|
|
6
|
+
"module": "./dist/webcanvas.esm.js",
|
|
7
|
+
"types": "./dist/webcanvas.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/webcanvas.d.ts",
|
|
11
|
+
"import": "./dist/webcanvas.esm.js",
|
|
12
|
+
"require": "./dist/webcanvas.cjs.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/",
|
|
20
|
+
"!dist/thorvg.d.ts",
|
|
21
|
+
"!dist/**/thorvg.js"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/thorvg/thorvg.web.git",
|
|
26
|
+
"directory": "packages/webcanvas"
|
|
27
|
+
},
|
|
28
|
+
"author": "Jinny You <jinny@lottiefiles.com>",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/thorvg/thorvg.web/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://thorvg.org",
|
|
34
|
+
"keywords": [
|
|
35
|
+
"thorvg",
|
|
36
|
+
"canvas",
|
|
37
|
+
"vector graphics",
|
|
38
|
+
"webgpu",
|
|
39
|
+
"webgl",
|
|
40
|
+
"wasm",
|
|
41
|
+
"2d graphics"
|
|
42
|
+
],
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
45
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
46
|
+
"@swc/core": "^1.3.99",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
48
|
+
"eslint": "^8.0.1",
|
|
49
|
+
"rollup": "^4.46.2",
|
|
50
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
51
|
+
"rollup-plugin-swc3": "^0.10.4",
|
|
52
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
53
|
+
"typedoc": "^0.28.15",
|
|
54
|
+
"typedoc-plugin-missing-exports": "^4.1.2",
|
|
55
|
+
"typescript": "*"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "npm run clean && sh ./wasm_wcanvas_setup.sh && rollup -c --bundleConfigAsCjs",
|
|
59
|
+
"build:watch": "npm run clean && sh ./wasm_wcanvas_setup.sh && rollup -c --bundleConfigAsCjs --watch",
|
|
60
|
+
"clean": "rm -rf dist && mkdir dist && touch dist/index.js",
|
|
61
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
62
|
+
"lint": "eslint ./src --ext .ts",
|
|
63
|
+
"lint:fix": "eslint ./src --ext .ts --fix",
|
|
64
|
+
"docs": "typedoc && node ./tools/docs/generate.js",
|
|
65
|
+
"docs:watch": "typedoc --watch",
|
|
66
|
+
"docs:serve": "typedoc --watch --serve",
|
|
67
|
+
"version": "sed -n -e 4p ../../thorvg/meson.build | sed 's/..$//' | sed -r 's/.{19}//'"
|
|
68
|
+
}
|
|
69
|
+
}
|