@needle-tools/engine 4.13.0-next.e6dcd1c → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import{Texture as Wt,WebGLRenderTarget as zo,RepeatWrapping as br,LinearFilter as an,LinearMipMapLinearFilter as on,FloatType as Wo,RGBAFormat as Go,PlaneGeometry as sn,OrthographicCamera as Bo,ShaderMaterial as ln,Scene as Ho,Mesh as _r,EquirectangularReflectionMapping as Vo,Uniform$1 as qo,LinearSRGBColorSpace as Qo,Vector3 as ct,Quaternion as Jo,Color as un,Cache as je,MirroredRepeatWrapping as Yo,ClampToEdgeWrapping as Ko,NearestMipMapNearestFilter as Zo,NearestFilter as Ao,MeshBasicMaterial as Io,PMREMGenerator$1 as es,cloneUniforms as ts,cloneUniformsGroups as rs,GLSL3 as ns,Matrix4 as Gt,Matrix3 as as,MeshStandardMaterial as dt,DoubleSide as is,FrontSide as os}from"./three-I__hSXzr.min.js";import"./three-examples-D8zAE_7t.min.js";var Bt=function(){var y=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(y=y||__filename),function(f){f=f||{};var o=typeof f<"u"?f:{},b,R;o.ready=new Promise(function(e,t){b=e,R=t}),o.expectedDataFileDownloads||(o.expectedDataFileDownloads=0),o.expectedDataFileDownloads++,function(){var e=function(t){if(typeof window=="object")window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/");else if(typeof location<"u")encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");else throw"using preloaded data can only be done on a web page or in a web worker";var r="../../bin/JsMaterialXGenShader.data",n="JsMaterialXGenShader.data";typeof o.locateFilePackage=="function"&&!o.locateFile&&(o.locateFile=o.locateFilePackage,ue("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var a=o.locateFile?o.locateFile(n,""):n,s=t.remote_package_size;function l(m,g,p,v){var E=new XMLHttpRequest;E.open("GET",m,!0),E.responseType="arraybuffer",E.onprogress=function(T){var C=m,H=g;if(T.total&&(H=T.total),T.loaded){E.addedTotal?o.dataFileDownloads[C].loaded=T.loaded:(E.addedTotal=!0,o.dataFileDownloads||(o.dataFileDownloads={}),o.dataFileDownloads[C]={loaded:T.loaded,total:H});var h=0,F=0,q=0;for(var D in o.dataFileDownloads){var se=o.dataFileDownloads[D];h+=se.total,F+=se.loaded,q++}h=Math.ceil(h*o.expectedDataFileDownloads/q),o.setStatus&&o.setStatus("Downloading data... ("+F+"/"+h+")")}else o.dataFileDownloads||o.setStatus&&o.setStatus("Downloading data...")},E.onerror=function(T){throw new Error("NetworkError for: "+m)},E.onload=function(T){if(E.status==200||E.status==304||E.status==206||E.status==0&&E.response){var C=E.response;p(C)}else throw new Error(E.statusText+" : "+E.responseURL)},E.send(null)}var u=null,c=o.getPreloadedPackage?o.getPreloadedPackage(a,s):null;c||l(a,s,function(m){u?(u(m),u=null):c=m});function d(){function m(T,C){if(!T)throw C+new Error().stack}o.FS_createPath("/","libraries",!0,!0),o.FS_createPath("/libraries","lights",!0,!0),o.FS_createPath("/libraries/lights","genmsl",!0,!0),o.FS_createPath("/libraries/lights","genglsl",!0,!0),o.FS_createPath("/libraries","stdlib",!0,!0),o.FS_createPath("/libraries/stdlib","genmsl",!0,!0),o.FS_createPath("/libraries/stdlib/genmsl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genglsl",!0,!0),o.FS_createPath("/libraries/stdlib/genglsl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genosl",!0,!0),o.FS_createPath("/libraries/stdlib/genosl","include",!0,!0),o.FS_createPath("/libraries/stdlib/genosl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genmdl",!0,!0),o.FS_createPath("/libraries","targets",!0,!0),o.FS_createPath("/libraries","pbrlib",!0,!0),o.FS_createPath("/libraries/pbrlib","genmsl",!0,!0),o.FS_createPath("/libraries/pbrlib","genglsl",!0,!0),o.FS_createPath("/libraries/pbrlib/genglsl","lib",!0,!0),o.FS_createPath("/libraries/pbrlib","genosl",!0,!0),o.FS_createPath("/libraries/pbrlib/genosl","lib",!0,!0),o.FS_createPath("/libraries/pbrlib","genmdl",!0,!0),o.FS_createPath("/libraries","bxdf",!0,!0),o.FS_createPath("/libraries/bxdf","lama",!0,!0),o.FS_createPath("/libraries/bxdf","translation",!0,!0),o.FS_createPath("/libraries","cmlib",!0,!0),o.FS_createPath("/libraries","nprlib",!0,!0),o.FS_createPath("/libraries/nprlib","genmsl",!0,!0),o.FS_createPath("/libraries/nprlib","genglsl",!0,!0),o.FS_createPath("/libraries/nprlib","genosl",!0,!0),o.FS_createPath("/libraries/nprlib","genmdl",!0,!0);function g(T,C,H){this.start=T,this.end=C,this.audio=H}g.prototype={requests:{},open:function(T,C){this.name=C,this.requests[C]=this,o.addRunDependency("fp "+this.name)},send:function(){},onload:function(){var T=this.byteArray.subarray(this.start,this.end);this.finish(T)},finish:function(T){var C=this;o.FS_createDataFile(this.name,null,T,!0,!0,!0),o.removeRunDependency("fp "+C.name),this.requests[this.name]=null}};for(var p=t.files,v=0;v<p.length;++v)new g(p[v].start,p[v].end,p[v].audio).open("GET",p[v].filename);function E(T){m(T,"Loading data file failed."),m(T instanceof ArrayBuffer,"bad input to processPackageData");var C=new Uint8Array(T);g.prototype.byteArray=C;for(var H=t.files,h=0;h<H.length;++h)g.prototype.requests[H[h].filename].onload();o.removeRunDependency("datafile_../../bin/JsMaterialXGenShader.data")}o.addRunDependency("datafile_../../bin/JsMaterialXGenShader.data"),o.preloadResults||(o.preloadResults={}),o.preloadResults[r]={fromCache:!1},c?(E(c),c=null):u=E}o.calledRun?d():(o.preRun||(o.preRun=[]),o.preRun.push(d))};e({files:[{filename:"/libraries/README.md",start:0,end:4904,audio:0},{filename:"/libraries/CMakeLists.txt",start:4904,end:6827,audio:0},{filename:"/libraries/lights/lights_defs.mtlx",start:6827,end:9239,audio:0},{filename:"/libraries/lights/genmsl/mx_point_light.metal",start:9239,end:9615,audio:0},{filename:"/libraries/lights/genmsl/mx_spot_light.metal",start:9615,end:10245,audio:0},{filename:"/libraries/lights/genmsl/mx_directional_light.metal",start:10245,end:10432,audio:0},{filename:"/libraries/lights/genmsl/lights_genmsl_impl.mtlx",start:10432,end:11033,audio:0},{filename:"/libraries/lights/genglsl/lights_genglsl_impl.mtlx",start:11033,end:11637,audio:0},{filename:"/libraries/lights/genglsl/mx_spot_light.glsl",start:11637,end:12261,audio:0},{filename:"/libraries/lights/genglsl/mx_directional_light.glsl",start:12261,end:12442,audio:0},{filename:"/libraries/lights/genglsl/mx_point_light.glsl",start:12442,end:12812,audio:0},{filename:"/libraries/stdlib/stdlib_defs.mtlx",start:12812,end:290021,audio:0},{filename:"/libraries/stdlib/stdlib_ng.mtlx",start:290021,end:611027,audio:0},{filename:"/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx",start:611027,end:621322,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_sampling.metal",start:621322,end:623725,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_matscalaroperators.metal",start:623725,end:624734,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_math.metal",start:624734,end:629023,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_texture.metal",start:629023,end:629761,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector2.glsl",start:629761,end:629972,audio:0},{filename:"/libraries/stdlib/genglsl/mx_smoothstep_float.glsl",start:629972,end:630197,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_float.glsl",start:630197,end:630390,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector3.glsl",start:630390,end:631209,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector3.glsl",start:631209,end:631401,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_color3.glsl",start:631401,end:631686,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_float.glsl",start:631686,end:631908,audio:0},{filename:"/libraries/stdlib/genglsl/mx_disjointover_color4.glsl",start:631908,end:632502,audio:0},{filename:"/libraries/stdlib/genglsl/mx_premult_color4.glsl",start:632502,end:632599,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector2.glsl",start:632599,end:632869,audio:0},{filename:"/libraries/stdlib/genglsl/mx_normalmap.glsl",start:632869,end:633367,audio:0},{filename:"/libraries/stdlib/genglsl/mx_cellnoise3d_float.glsl",start:633367,end:633504,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_float.glsl",start:633504,end:633714,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector4.glsl",start:633714,end:633984,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl",start:633984,end:634268,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector2.glsl",start:634268,end:634460,audio:0},{filename:"/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx",start:634460,end:711835,audio:0},{filename:"/libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl",start:711835,end:711977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector3.glsl",start:711977,end:712185,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector3.glsl",start:712185,end:712377,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector2.glsl",start:712377,end:712527,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector2.glsl",start:712527,end:712738,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector4.glsl",start:712738,end:713008,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_float.glsl",start:713008,end:713823,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector3.glsl",start:713823,end:713973,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rgbtohsv_color3.glsl",start:713973,end:714087,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector2.glsl",start:714087,end:714237,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector3.glsl",start:714237,end:714445,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl",start:714445,end:714652,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rotate_vector3.glsl",start:714652,end:715553,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector3.glsl",start:715553,end:715703,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hextilednormalmap.glsl",start:715703,end:718676,audio:0},{filename:"/libraries/stdlib/genglsl/mx_luminance_color3.glsl",start:718676,end:718790,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl",start:718790,end:718919,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_vector2.glsl",start:718919,end:719103,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_color4.glsl",start:719103,end:719912,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_vector3.glsl",start:719912,end:720096,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector4.glsl",start:720096,end:720375,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_color3.glsl",start:720375,end:721192,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_float.glsl",start:721192,end:721415,audio:0},{filename:"/libraries/stdlib/genglsl/mx_cellnoise2d_float.glsl",start:721415,end:721552,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_float.glsl",start:721552,end:721736,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector2.glsl",start:721736,end:722553,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hextiledimage.glsl",start:722553,end:726619,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_float.glsl",start:726619,end:726829,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_color4.glsl",start:726829,end:727178,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector4.glsl",start:727178,end:727328,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector2.glsl",start:727328,end:727520,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector4.glsl",start:727520,end:727712,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_float.glsl",start:727712,end:727863,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hsvtorgb_color3.glsl",start:727863,end:727977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_transformmatrix_vector2M3.glsl",start:727977,end:728118,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_float.glsl",start:728118,end:728311,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector4.glsl",start:728311,end:729122,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector3.glsl",start:729122,end:729392,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_float.glsl",start:729392,end:729576,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector2.glsl",start:729576,end:729846,audio:0},{filename:"/libraries/stdlib/genglsl/mx_luminance_color4.glsl",start:729846,end:729977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl",start:729977,end:730106,audio:0},{filename:"/libraries/stdlib/genglsl/mx_unpremult_color4.glsl",start:730106,end:730205,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector3.glsl",start:730205,end:730475,audio:0},{filename:"/libraries/stdlib/genglsl/mx_aastep.glsl",start:730475,end:730675,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector4.glsl",start:730675,end:730867,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_vector2.glsl",start:730867,end:731051,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_float.glsl",start:731051,end:731202,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_float.glsl",start:731202,end:731474,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector4.glsl",start:731474,end:731624,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_color4.glsl",start:731624,end:731965,audio:0},{filename:"/libraries/stdlib/genglsl/mx_mix_surfaceshader.glsl",start:731965,end:732199,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_color3.glsl",start:732199,end:732489,audio:0},{filename:"/libraries/stdlib/genglsl/mx_heighttonormal_vector3.glsl",start:732489,end:733442,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_float.glsl",start:733442,end:733714,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_vector3.glsl",start:733714,end:733898,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl",start:733898,end:734174,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector4.glsl",start:734174,end:734449,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rotate_vector2.glsl",start:734449,end:734707,audio:0},{filename:"/libraries/stdlib/genglsl/mx_surface_unlit.glsl",start:734707,end:734999,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_sampling.glsl",start:734999,end:737366,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_transform_uv_vflip.glsl",start:737366,end:737502,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_math.glsl",start:737502,end:738137,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_noise.glsl",start:738137,end:761076,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_transform_uv.glsl",start:761076,end:761192,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_hextile.glsl",start:761192,end:765693,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_geometry.glsl",start:765693,end:767054,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_hsv.glsl",start:767054,end:770533,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_vector2.osl",start:770533,end:770698,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_string.osl",start:770698,end:770854,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector3.osl",start:770854,end:771038,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_float.osl",start:771038,end:771197,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_vector3.osl",start:771197,end:771362,audio:0},{filename:"/libraries/stdlib/genosl/mx_luminance_color4.osl",start:771362,end:771494,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_float.osl",start:771494,end:771725,audio:0},{filename:"/libraries/stdlib/genosl/mx_frame_float.osl",start:771725,end:771894,audio:0},{filename:"/libraries/stdlib/genosl/mx_hsvtorgb_color3.osl",start:771894,end:771999,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector4.osl",start:771999,end:772317,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_color3.osl",start:772317,end:773262,audio:0},{filename:"/libraries/stdlib/genosl/mx_luminance_color3.osl",start:773262,end:773374,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_float.osl",start:773374,end:773591,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_boolean.osl",start:773591,end:773742,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector2.osl",start:773742,end:773996,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector3.osl",start:773996,end:774247,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector2.osl",start:774247,end:775162,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_vector2.osl",start:775162,end:775328,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_vector3.osl",start:775328,end:775492,audio:0},{filename:"/libraries/stdlib/genosl/mx_time_float.osl",start:775492,end:775670,audio:0},{filename:"/libraries/stdlib/genosl/mx_rotate_vector3.osl",start:775670,end:776740,audio:0},{filename:"/libraries/stdlib/genosl/mx_premult_color4.osl",start:776740,end:776842,audio:0},{filename:"/libraries/stdlib/genosl/mx_surface_unlit.osl",start:776842,end:777256,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector4.osl",start:777256,end:777461,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector4.osl",start:777461,end:777715,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_float.osl",start:777715,end:777909,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_integer.osl",start:777909,end:778060,audio:0},{filename:"/libraries/stdlib/genosl/mx_cellnoise3d_float.osl",start:778060,end:778162,audio:0},{filename:"/libraries/stdlib/genosl/mx_unpremult_color4.osl",start:778162,end:778266,audio:0},{filename:"/libraries/stdlib/genosl/mx_rotate_vector2.osl",start:778266,end:778527,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector3.osl",start:778527,end:778763,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector4.osl",start:778763,end:778953,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_float.osl",start:778953,end:779160,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector2.osl",start:779160,end:779399,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector3.osl",start:779399,end:779555,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_float.osl",start:779555,end:779729,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_float.osl",start:779729,end:779975,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_color3.osl",start:779975,end:780128,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector2.osl",start:780128,end:780318,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_color3.osl",start:780318,end:780576,audio:0},{filename:"/libraries/stdlib/genosl/mx_rgbtohsv_color3.osl",start:780576,end:780681,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_float.osl",start:780681,end:780841,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_float.osl",start:780841,end:781020,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector2.osl",start:781020,end:781286,audio:0},{filename:"/libraries/stdlib/genosl/mx_transformmatrix_vector2M3.osl",start:781286,end:781472,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_color4.osl",start:781472,end:781840,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector3.osl",start:781840,end:782039,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_color4.osl",start:782039,end:782386,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_color4.osl",start:782386,end:783509,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_color3.osl",start:783509,end:783762,audio:0},{filename:"/libraries/stdlib/genosl/mx_creatematrix.osl",start:783762,end:784667,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_color4.osl",start:784667,end:784898,audio:0},{filename:"/libraries/stdlib/genosl/mx_hsvtorgb_color4.osl",start:784898,end:785020,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_float.osl",start:785020,end:785883,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_color4.osl",start:785883,end:786221,audio:0},{filename:"/libraries/stdlib/genosl/mx_heighttonormal_vector3.osl",start:786221,end:787195,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector2.osl",start:787195,end:787400,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector3.osl",start:787400,end:788218,audio:0},{filename:"/libraries/stdlib/genosl/mx_rgbtohsv_color4.osl",start:788218,end:788340,audio:0},{filename:"/libraries/stdlib/genosl/mx_cellnoise2d_float.osl",start:788340,end:788457,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_color3.osl",start:788457,end:788553,audio:0},{filename:"/libraries/stdlib/genosl/mx_normalmap.osl",start:788553,end:789465,audio:0},{filename:"/libraries/stdlib/genosl/mx_disjointover_color4.osl",start:789465,end:790043,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector4.osl",start:790043,end:791086,audio:0},{filename:"/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx",start:791086,end:868641,audio:0},{filename:"/libraries/stdlib/genosl/mx_mix_surfaceshader.osl",start:868641,end:868883,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector4.osl",start:868883,end:869122,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_float.osl",start:869122,end:869217,audio:0},{filename:"/libraries/stdlib/genosl/include/color4.h",start:869217,end:875055,audio:0},{filename:"/libraries/stdlib/genosl/include/vector2.h",start:875055,end:880721,audio:0},{filename:"/libraries/stdlib/genosl/include/vector4.h",start:880721,end:889719,audio:0},{filename:"/libraries/stdlib/genosl/include/mx_funcs.h",start:889719,end:911510,audio:0},{filename:"/libraries/stdlib/genosl/include/matrix33.h",start:911510,end:914130,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_transform_uv_vflip.osl",start:914130,end:914226,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_transform_uv.osl",start:914226,end:914293,audio:0},{filename:"/libraries/stdlib/genosl/lib/vector4_extra_ops.osl",start:914293,end:915167,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_sampling.osl",start:915167,end:920626,audio:0},{filename:"/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx",start:920626,end:1015485,audio:0},{filename:"/libraries/targets/genmsl.mtlx",start:1015485,end:1015955,audio:0},{filename:"/libraries/targets/essl.mtlx",start:1015955,end:1016417,audio:0},{filename:"/libraries/targets/genosl.mtlx",start:1016417,end:1016869,audio:0},{filename:"/libraries/targets/genglsl.mtlx",start:1016869,end:1017322,audio:0},{filename:"/libraries/targets/genmdl.mtlx",start:1017322,end:1017774,audio:0},{filename:"/libraries/pbrlib/pbrlib_ng.mtlx",start:1017774,end:1018568,audio:0},{filename:"/libraries/pbrlib/pbrlib_defs.mtlx",start:1018568,end:1042886,audio:0},{filename:"/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx",start:1042886,end:1043153,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_subsurface_bsdf.glsl",start:1043153,end:1044206,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_displacement_vector3.glsl",start:1044206,end:1044346,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_anisotropic_vdf.glsl",start:1044346,end:1044574,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_generalized_schlick_bsdf.glsl",start:1044574,end:1047743,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_edf_color3.glsl",start:1047743,end:1047896,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_displacement_float.glsl",start:1047896,end:1048041,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_chiang_hair_bsdf.glsl",start:1048041,end:1057049,audio:0},{filename:"/libraries/pbrlib/genglsl/pbrlib_genglsl_impl.mtlx",start:1057049,end:1063154,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_edf_float.glsl",start:1063154,end:1063307,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_burley_diffuse_bsdf.glsl",start:1063307,end:1064354,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_layer_bsdf.glsl",start:1064354,end:1064604,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_translucent_bsdf.glsl",start:1064604,end:1065330,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_artistic_ior.glsl",start:1065330,end:1065903,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_layer_vdf.glsl",start:1065903,end:1066135,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_bsdf_float.glsl",start:1066135,end:1066393,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_uniform_edf.glsl",start:1066393,end:1066601,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_conductor_bsdf.glsl",start:1066601,end:1068358,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_roughness_dual.glsl",start:1068358,end:1068626,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_add_edf.glsl",start:1068626,end:1068766,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_bsdf_color3.glsl",start:1068766,end:1069019,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_dielectric_bsdf.glsl",start:1069019,end:1071661,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_mix_bsdf.glsl",start:1071661,end:1071927,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_roughness_anisotropy.glsl",start:1071927,end:1072372,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_blackbody.glsl",start:1072372,end:1074108,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_add_bsdf.glsl",start:1074108,end:1074690,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_oren_nayar_diffuse_bsdf.glsl",start:1074690,end:1076065,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_sheen_bsdf.glsl",start:1076065,end:1078151,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_generalized_schlick_edf.glsl",start:1078151,end:1078663,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_mix_edf.glsl",start:1078663,end:1078829,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl",start:1078829,end:1081502,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_none.glsl",start:1081502,end:1081737,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl",start:1081737,end:1083141,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_generate_albedo_table.glsl",start:1083141,end:1083513,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet.glsl",start:1083513,end:1086505,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_sheen.glsl",start:1086505,end:1093258,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_closure_type.glsl",start:1093258,end:1093675,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_transmission_opacity.glsl",start:1093675,end:1093846,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl",start:1093846,end:1101310,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_fis.glsl",start:1101310,end:1104407,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_shadow.glsl",start:1104407,end:1105163,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl",start:1105163,end:1105674,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl",start:1105674,end:1122447,audio:0},{filename:"/libraries/pbrlib/genosl/pbrlib_genosl_impl.mtlx",start:1122447,end:1128292,audio:0},{filename:"/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl",start:1128292,end:1128620,audio:0},{filename:"/libraries/pbrlib/genosl/mx_anisotropic_vdf.osl",start:1128620,end:1128991,audio:0},{filename:"/libraries/pbrlib/genosl/mx_surface.osl",start:1128991,end:1129192,audio:0},{filename:"/libraries/pbrlib/genosl/mx_artistic_ior.osl",start:1129192,end:1129784,audio:0},{filename:"/libraries/pbrlib/genosl/mx_dielectric_bsdf.osl",start:1129784,end:1130334,audio:0},{filename:"/libraries/pbrlib/genosl/mx_chiang_hair_roughness.osl",start:1130334,end:1130691,audio:0},{filename:"/libraries/pbrlib/genosl/mx_roughness_dual.osl",start:1130691,end:1130987,audio:0},{filename:"/libraries/pbrlib/genosl/mx_chiang_hair_bsdf.osl",start:1130987,end:1131679,audio:0},{filename:"/libraries/pbrlib/genosl/mx_blackbody.osl",start:1131679,end:1133451,audio:0},{filename:"/libraries/pbrlib/genosl/mx_generalized_schlick_edf.osl",start:1133451,end:1133721,audio:0},{filename:"/libraries/pbrlib/genosl/mx_generalized_schlick_bsdf.osl",start:1133721,end:1134360,audio:0},{filename:"/libraries/pbrlib/genosl/mx_roughness_anisotropy.osl",start:1134360,end:1134811,audio:0},{filename:"/libraries/pbrlib/genosl/lib/mx_microfacet.osl",start:1134811,end:1136543,audio:0},{filename:"/libraries/pbrlib/genmdl/pbrlib_genmdl_impl.mtlx",start:1136543,end:1147928,audio:0},{filename:"/libraries/bxdf/disney_principled.mtlx",start:1147928,end:1155236,audio:0},{filename:"/libraries/bxdf/usd_preview_surface.mtlx",start:1155236,end:1178228,audio:0},{filename:"/libraries/bxdf/gltf_pbr.mtlx",start:1178228,end:1223121,audio:0},{filename:"/libraries/bxdf/standard_surface.mtlx",start:1223121,end:1251204,audio:0},{filename:"/libraries/bxdf/open_pbr_surface.mtlx",start:1251204,end:1293074,audio:0},{filename:"/libraries/bxdf/lama/lama_dielectric.mtlx",start:1293074,end:1303993,audio:0},{filename:"/libraries/bxdf/lama/lama_diffuse.mtlx",start:1303993,end:1306939,audio:0},{filename:"/libraries/bxdf/lama/lama_conductor.mtlx",start:1306939,end:1314939,audio:0},{filename:"/libraries/bxdf/lama/lama_iridescence.mtlx",start:1314939,end:1320902,audio:0},{filename:"/libraries/bxdf/lama/lama_translucent.mtlx",start:1320902,end:1322539,audio:0},{filename:"/libraries/bxdf/lama/lama_sss.mtlx",start:1322539,end:1329314,audio:0},{filename:"/libraries/bxdf/lama/lama_surface.mtlx",start:1329314,end:1330982,audio:0},{filename:"/libraries/bxdf/lama/lama_sheen.mtlx",start:1330982,end:1333105,audio:0},{filename:"/libraries/bxdf/lama/lama_add.mtlx",start:1333105,end:1335759,audio:0},{filename:"/libraries/bxdf/lama/lama_layer.mtlx",start:1335759,end:1337503,audio:0},{filename:"/libraries/bxdf/lama/lama_generalized_schlick.mtlx",start:1337503,end:1349357,audio:0},{filename:"/libraries/bxdf/lama/lama_emission.mtlx",start:1349357,end:1350106,audio:0},{filename:"/libraries/bxdf/lama/lama_mix.mtlx",start:1350106,end:1352193,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_usd.mtlx",start:1352193,end:1358074,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_gltf_pbr.mtlx",start:1358074,end:1365969,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx",start:1365969,end:1381078,audio:0},{filename:"/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx",start:1381078,end:1398545,audio:0},{filename:"/libraries/cmlib/cmlib_defs.mtlx",start:1398545,end:1403391,audio:0},{filename:"/libraries/cmlib/cmlib_ng.mtlx",start:1403391,end:1420866,audio:0},{filename:"/libraries/nprlib/nprlib_ng.mtlx",start:1420866,end:1425715,audio:0},{filename:"/libraries/nprlib/nprlib_defs.mtlx",start:1425715,end:1428350,audio:0},{filename:"/libraries/nprlib/genmsl/nprlib_genmsl_impl.mtlx",start:1428350,end:1429011,audio:0},{filename:"/libraries/nprlib/genglsl/nprlib_genglsl_impl.mtlx",start:1429011,end:1429675,audio:0},{filename:"/libraries/nprlib/genosl/nprlib_genosl_impl.mtlx",start:1429675,end:1430373,audio:0},{filename:"/libraries/nprlib/genmdl/nprlib_genmdl_impl.mtlx",start:1430373,end:1431135,audio:0}],remote_package_size:1431135})}();var x={},_;for(_ in o)o.hasOwnProperty(_)&&(x[_]=o[_]);var X="./this.program",S=!1,$=!1,O=!1,ee=!1;S=typeof window=="object",$=typeof importScripts=="function",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",ee=!S&&!O&&!$;var J="";function K(e){return o.locateFile?o.locateFile(e,J):J+e}var G,ce,Pe,ze,Ze;O?($?J=require("path").dirname(J)+"/":J=__dirname+"/",G=function(e,t){return ze||(ze=require("fs")),Ze||(Ze=require("path")),e=Ze.normalize(e),ze.readFileSync(e,t?null:"utf8")},Pe=function(e){var t=G(e,!0);return t.buffer||(t=new Uint8Array(t)),Yt(t.buffer),t},process.argv.length>1&&(X=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof $o))throw e}),process.on("unhandledRejection",ae),o.inspect=function(){return"[Emscripten Module object]"}):ee?(typeof read<"u"&&(G=function(e){return read(e)}),Pe=function(e){var t;return typeof readbuffer=="function"?new Uint8Array(readbuffer(e)):(t=read(e,"binary"),Yt(typeof t=="object"),t)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(S||$)&&($?J=self.location.href:typeof document<"u"&&document.currentScript&&(J=document.currentScript.src),y&&(J=y),J.indexOf("blob:")!==0?J=J.substr(0,J.lastIndexOf("/")+1):J="",G=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},$&&(Pe=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),ce=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){if(n.status==200||n.status==0&&n.response){t(n.response);return}r()},n.onerror=r,n.send(null)});var We=o.print||console.log.bind(console),ue=o.printErr||console.warn.bind(console);for(_ in x)x.hasOwnProperty(_)&&(o[_]=x[_]);x=null,o.arguments&&o.arguments,o.thisProgram&&(X=o.thisProgram),o.quit&&o.quit;function Mn(e,t){return Math.ceil(e/t)*t}var xr=0,he=function(e){xr=e},Tn=function(){return xr},Ae;o.wasmBinary&&(Ae=o.wasmBinary),o.noExitRuntime,typeof WebAssembly!="object"&&ae("no native wasm support detected");var mt,Er=!1;function Yt(e,t){e||ae("Assertion failed: "+t)}var Fr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ge(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&Fr)return Fr.decode(e.subarray(t,a));for(var s="";t<a;){var l=e[t++];if(!(l&128)){s+=String.fromCharCode(l);continue}var u=e[t++]&63;if((l&224)==192){s+=String.fromCharCode((l&31)<<6|u);continue}var c=e[t++]&63;if((l&240)==224?l=(l&15)<<12|u<<6|c:l=(l&7)<<18|u<<12|c<<6|e[t++]&63,l<65536)s+=String.fromCharCode(l);else{var d=l-65536;s+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return s}function $e(e,t){return e?Ge(de,e,t):""}function Kt(e,t,r,n){if(!(n>0))return 0;for(var a=r,s=r+n-1,l=0;l<e.length;++l){var u=e.charCodeAt(l);if(u>=55296&&u<=57343){var c=e.charCodeAt(++l);u=65536+((u&1023)<<10)|c&1023}if(u<=127){if(r>=s)break;t[r++]=u}else if(u<=2047){if(r+1>=s)break;t[r++]=192|u>>6,t[r++]=128|u&63}else if(u<=65535){if(r+2>=s)break;t[r++]=224|u>>12,t[r++]=128|u>>6&63,t[r++]=128|u&63}else{if(r+3>=s)break;t[r++]=240|u>>18,t[r++]=128|u>>12&63,t[r++]=128|u>>6&63,t[r++]=128|u&63}}return t[r]=0,r-a}function Zt(e,t,r){return Kt(e,de,t,r)}function gt(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++r)&1023),n<=127?++t:n<=2047?t+=2:n<=65535?t+=3:t+=4}return t}var Pr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function kn(e,t){for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&Ie[n];)++n;if(r=n<<1,r-e>32&&Pr)return Pr.decode(de.subarray(e,r));for(var s="",l=0;!(l>=t/2);++l){var u=Se[e+l*2>>1];if(u==0)break;s+=String.fromCharCode(u)}return s}function Cn(e,t,r){if(r===void 0&&(r=2147483647),r<2)return 0;r-=2;for(var n=t,a=r<e.length*2?r/2:e.length,s=0;s<a;++s){var l=e.charCodeAt(s);Se[t>>1]=l,t+=2}return Se[t>>1]=0,t-n}function Dn(e){return e.length*2}function Rn(e,t){for(var r=0,n="";!(r>=t/4);){var a=w[e+r*4>>2];if(a==0)break;if(++r,a>=65536){var s=a-65536;n+=String.fromCharCode(55296|s>>10,56320|s&1023)}else n+=String.fromCharCode(a)}return n}function On(e,t,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var u=e.charCodeAt(++s);l=65536+((l&1023)<<10)|u&1023}if(w[t>>2]=l,t+=4,t+4>a)break}return w[t>>2]=0,t-n}function jn(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function $n(e,t){oe.set(e,t)}function Xn(e,t,r){for(var n=0;n<e.length;++n)oe[t++>>0]=e.charCodeAt(n);oe[t>>0]=0}function Un(e,t){return e%t>0&&(e+=t-e%t),e}var pt,oe,de,Se,Ie,w,ye,Sr,At;function Mr(e){pt=e,o.HEAP8=oe=new Int8Array(e),o.HEAP16=Se=new Int16Array(e),o.HEAP32=w=new Int32Array(e),o.HEAPU8=de=new Uint8Array(e),o.HEAPU16=Ie=new Uint16Array(e),o.HEAPU32=ye=new Uint32Array(e),o.HEAPF32=Sr=new Float32Array(e),o.HEAPF64=At=new Float64Array(e)}o.INITIAL_MEMORY;var L,Tr=[],kr=[],Cr=[];function Ln(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Wn(o.preRun.shift());er(Tr)}function Nn(){!o.noFSInit&&!i.init.initialized&&i.init(),er(kr)}function zn(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)Bn(o.postRun.shift());er(Cr)}function Wn(e){Tr.unshift(e)}function Gn(e){kr.unshift(e)}function Bn(e){Cr.unshift(e)}var Xe=0,et=null;function It(e){Xe++,o.monitorRunDependencies&&o.monitorRunDependencies(Xe)}function ht(e){if(Xe--,o.monitorRunDependencies&&o.monitorRunDependencies(Xe),Xe==0&&et){var t=et;et=null,t()}}o.preloadedImages={},o.preloadedAudios={};function ae(e){o.onAbort&&o.onAbort(e),e+="",ue(e),Er=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw R(t),t}var Hn="data:application/octet-stream;base64,";function Dr(e){return e.startsWith(Hn)}function Rr(e){return e.startsWith("file://")}var be="JsMaterialXGenShader.wasm";Dr(be)||(be=K(be));function Or(e){try{if(e==be&&Ae)return new Uint8Array(Ae);if(Pe)return Pe(e);throw"both async and sync fetching of the wasm failed"}catch(t){ae(t)}}function Vn(){if(!Ae&&(S||$)){if(typeof fetch=="function"&&!Rr(be))return fetch(be,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+be+"'";return e.arrayBuffer()}).catch(function(){return Or(be)});if(ce)return new Promise(function(e,t){ce(be,function(r){e(new Uint8Array(r))},t)})}return Promise.resolve().then(function(){return Or(be)})}function qn(){var e={a:Ai};function t(l,u){var c=l.exports;o.asm=c,mt=o.asm.Xa,Mr(mt.buffer),L=o.asm._a,Gn(o.asm.Ya),ht()}It();function r(l){t(l.instance)}function n(l){return Vn().then(function(u){var c=WebAssembly.instantiate(u,e);return c}).then(l,function(u){ue("failed to asynchronously prepare wasm: "+u),ae(u)})}function a(){return!Ae&&typeof WebAssembly.instantiateStreaming=="function"&&!Dr(be)&&!Rr(be)&&typeof fetch=="function"?fetch(be,{credentials:"same-origin"}).then(function(l){var u=WebAssembly.instantiateStreaming(l,e);return u.then(r,function(c){return ue("wasm streaming compile failed: "+c),ue("falling back to ArrayBuffer instantiation"),n(r)})}):n(r)}if(o.instantiateWasm)try{var s=o.instantiateWasm(e,t);return s}catch(l){return ue("Module.instantiateWasm callback failed with error: "+l),!1}return a().catch(R),{}}var A,me,Qn={218952:function(){o.TreeIterator.prototype[Symbol.iterator]=function(){return this}},219036:function(){o.GraphIterator.prototype[Symbol.iterator]=function(){return this}},219121:function(){o.InheritanceIterator.prototype[Symbol.iterator]=function(){return this}}};function er(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(o);continue}var r=t.func;typeof r=="number"?t.arg===void 0?L.get(r)():L.get(r)(t.arg):r(t.arg===void 0?null:t.arg)}}function Jn(e,t,r,n){ae("Assertion failed: "+$e(e)+", at: "+[t?$e(t):"unknown filename",r,n?$e(n):"unknown function"])}var fe={DESTRUCTOR_OFFSET:0,REFCOUNT_OFFSET:4,TYPE_OFFSET:8,CAUGHT_OFFSET:12,RETHROWN_OFFSET:13,SIZE:16};function Yn(e){return Je(e+fe.SIZE)+fe.SIZE}function Be(e){this.excPtr=e,this.ptr=e-fe.SIZE,this.set_type=function(t){w[this.ptr+fe.TYPE_OFFSET>>2]=t},this.get_type=function(){return w[this.ptr+fe.TYPE_OFFSET>>2]},this.set_destructor=function(t){w[this.ptr+fe.DESTRUCTOR_OFFSET>>2]=t},this.get_destructor=function(){return w[this.ptr+fe.DESTRUCTOR_OFFSET>>2]},this.set_refcount=function(t){w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t},this.set_caught=function(t){t=t?1:0,oe[this.ptr+fe.CAUGHT_OFFSET>>0]=t},this.get_caught=function(){return oe[this.ptr+fe.CAUGHT_OFFSET>>0]!=0},this.set_rethrown=function(t){t=t?1:0,oe[this.ptr+fe.RETHROWN_OFFSET>>0]=t},this.get_rethrown=function(){return oe[this.ptr+fe.RETHROWN_OFFSET>>0]!=0},this.init=function(t,r){this.set_type(t),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=w[this.ptr+fe.REFCOUNT_OFFSET>>2];w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t+1},this.release_ref=function(){var t=w[this.ptr+fe.REFCOUNT_OFFSET>>2];return w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t-1,t===1}}function tt(e){this.free=function(){ve(this.ptr),this.ptr=0},this.set_base_ptr=function(t){w[this.ptr>>2]=t},this.get_base_ptr=function(){return w[this.ptr>>2]},this.set_adjusted_ptr=function(t){var r=4;w[this.ptr+r>>2]=t},this.get_adjusted_ptr=function(){var t=4;return w[this.ptr+t>>2]},this.get_exception_ptr=function(){var t=Ar(this.get_exception_info().get_type());if(t)return w[this.get_base_ptr()>>2];var r=this.get_adjusted_ptr();return r!==0?r:this.get_base_ptr()},this.get_exception_info=function(){return new Be(this.get_base_ptr())},e===void 0?(this.ptr=Je(8),this.set_adjusted_ptr(0)):this.ptr=e}var bt=[];function Kn(e){e.add_ref()}var _t=0;function Zn(e){var t=new tt(e),r=t.get_exception_info();return r.get_caught()||(r.set_caught(!0),_t--),r.set_rethrown(!1),bt.push(t),Kn(r),t.get_exception_ptr()}var Ce=0;function jr(e){return ve(new Be(e).ptr)}function An(e){if(e.release_ref()&&!e.get_rethrown()){var t=e.get_destructor();t&&L.get(t)(e.excPtr),jr(e.excPtr)}}function In(){V(0);var e=bt.pop();An(e.get_exception_info()),e.free(),Ce=0}function ea(e){var t=new tt(e),r=t.get_base_ptr();throw Ce||(Ce=r),t.free(),r}function ta(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=Xt(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Ut(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function ra(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=Xt(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Ut(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function na(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=Xt(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Ut(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function aa(){var e=bt.pop();e||ae("no exception to throw");var t=e.get_exception_info(),r=e.get_base_ptr();throw t.get_rethrown()?e.free():(bt.push(e),t.set_rethrown(!0),t.set_caught(!1),_t++),Ce=r,r}function ia(e,t,r){var n=new Be(e);throw n.init(t,r),Ce=e,_t++,e}function oa(){return _t}function sa(e){return w[Kr()>>2]=e,e}var Z={splitPath:function(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:function(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:function(e){var t=e.charAt(0)==="/",r=e.substr(-1)==="/";return e=Z.normalizeArray(e.split("/").filter(function(n){return!!n}),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=Z.splitPath(e),r=t[0],n=t[1];return!r&&!n?".":(n&&(n=n.substr(0,n.length-1)),r+n)},basename:function(e){if(e==="/")return"/";e=Z.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},extname:function(e){return Z.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return Z.normalize(e.join("/"))},join2:function(e,t){return Z.normalize(e+"/"+t)}};function la(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}else if(O)try{var t=require("crypto");return function(){return t.randomBytes(1)[0]}}catch{}return function(){ae("randomDevice")}}var Me={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:i.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=n.charAt(0)==="/"}return e=Z.normalizeArray(e.split("/").filter(function(a){return!!a}),!t).join("/"),(t?"/":"")+e||"."},relative:function(e,t){e=Me.resolve(e).substr(1),t=Me.resolve(t).substr(1);function r(d){for(var m=0;m<d.length&&d[m]==="";m++);for(var g=d.length-1;g>=0&&d[g]==="";g--);return m>g?[]:d.slice(m,g-m+1)}for(var n=r(e.split("/")),a=r(t.split("/")),s=Math.min(n.length,a.length),l=s,u=0;u<s;u++)if(n[u]!==a[u]){l=u;break}for(var c=[],u=l;u<n.length;u++)c.push("..");return c=c.concat(a.slice(l)),c.join("/")}},Ue={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){Ue.ttys[e]={input:[],output:[],ops:t},i.registerDevice(e,Ue.stream_ops)},stream_ops:{open:function(e){var t=Ue.ttys[e.node.rdev];if(!t)throw new i.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.get_char)throw new i.ErrnoError(60);for(var s=0,l=0;l<n;l++){var u;try{u=e.tty.ops.get_char(e.tty)}catch{throw new i.ErrnoError(29)}if(u===void 0&&s===0)throw new i.ErrnoError(6);if(u==null)break;s++,t[r+l]=u}return s&&(e.node.timestamp=Date.now()),s},write:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var s=0;s<n;s++)e.tty.ops.put_char(e.tty,t[r+s])}catch{throw new i.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),s}},default_tty_ops:{get_char:function(e){if(!e.input.length){var t=null;if(O){var r=256,n=Buffer.alloc?Buffer.alloc(r):new Buffer(r),a=0;try{a=ze.readSync(process.stdin.fd,n,0,r,null)}catch(s){if(s.toString().includes("EOF"))a=0;else throw s}a>0?t=n.slice(0,a).toString("utf-8"):t=null}else typeof window<"u"&&typeof window.prompt=="function"?(t=window.prompt("Input: "),t!==null&&(t+=`
1
+ import{Texture as zt,WebGLRenderTarget as zo,RepeatWrapping as br,LinearFilter as an,LinearMipMapLinearFilter as on,FloatType as Wo,RGBAFormat as Go,PlaneGeometry as sn,OrthographicCamera as Bo,ShaderMaterial as ln,Scene as Ho,Mesh as _r,EquirectangularReflectionMapping as Vo,Uniform$1 as qo,LinearSRGBColorSpace as Qo,Vector3 as ct,Quaternion as Jo,Color as un,Cache as je,MirroredRepeatWrapping as Yo,ClampToEdgeWrapping as Ao,NearestMipMapNearestFilter as Ko,NearestFilter as Zo,MeshBasicMaterial as Io,PMREMGenerator$1 as es,cloneUniforms as ts,cloneUniformsGroups as rs,GLSL3 as ns,Matrix4 as Wt,Matrix3 as as,MeshStandardMaterial as Gt,DoubleSide as is,FrontSide as os}from"./three-I__hSXzr.min.js";import"./three-examples-D8zAE_7t.min.js";var Bt=function(){var y=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(y=y||__filename),function(m){m=m||{};var o=typeof m<"u"?m:{},b,R;o.ready=new Promise(function(e,t){b=e,R=t}),o.expectedDataFileDownloads||(o.expectedDataFileDownloads=0),o.expectedDataFileDownloads++,function(){var e=function(t){if(typeof window=="object")window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/");else if(typeof location<"u")encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");else throw"using preloaded data can only be done on a web page or in a web worker";var r="../../bin/JsMaterialXGenShader.data",n="JsMaterialXGenShader.data";typeof o.locateFilePackage=="function"&&!o.locateFile&&(o.locateFile=o.locateFilePackage,ue("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var a=o.locateFile?o.locateFile(n,""):n,s=t.remote_package_size;function l(f,g,p,v){var E=new XMLHttpRequest;E.open("GET",f,!0),E.responseType="arraybuffer",E.onprogress=function(T){var C=f,H=g;if(T.total&&(H=T.total),T.loaded){E.addedTotal?o.dataFileDownloads[C].loaded=T.loaded:(E.addedTotal=!0,o.dataFileDownloads||(o.dataFileDownloads={}),o.dataFileDownloads[C]={loaded:T.loaded,total:H});var h=0,F=0,q=0;for(var D in o.dataFileDownloads){var se=o.dataFileDownloads[D];h+=se.total,F+=se.loaded,q++}h=Math.ceil(h*o.expectedDataFileDownloads/q),o.setStatus&&o.setStatus("Downloading data... ("+F+"/"+h+")")}else o.dataFileDownloads||o.setStatus&&o.setStatus("Downloading data...")},E.onerror=function(T){throw new Error("NetworkError for: "+f)},E.onload=function(T){if(E.status==200||E.status==304||E.status==206||E.status==0&&E.response){var C=E.response;p(C)}else throw new Error(E.statusText+" : "+E.responseURL)},E.send(null)}var u=null,c=o.getPreloadedPackage?o.getPreloadedPackage(a,s):null;c||l(a,s,function(f){u?(u(f),u=null):c=f});function d(){function f(T,C){if(!T)throw C+new Error().stack}o.FS_createPath("/","libraries",!0,!0),o.FS_createPath("/libraries","lights",!0,!0),o.FS_createPath("/libraries/lights","genmsl",!0,!0),o.FS_createPath("/libraries/lights","genglsl",!0,!0),o.FS_createPath("/libraries","stdlib",!0,!0),o.FS_createPath("/libraries/stdlib","genmsl",!0,!0),o.FS_createPath("/libraries/stdlib/genmsl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genglsl",!0,!0),o.FS_createPath("/libraries/stdlib/genglsl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genosl",!0,!0),o.FS_createPath("/libraries/stdlib/genosl","include",!0,!0),o.FS_createPath("/libraries/stdlib/genosl","lib",!0,!0),o.FS_createPath("/libraries/stdlib","genmdl",!0,!0),o.FS_createPath("/libraries","targets",!0,!0),o.FS_createPath("/libraries","pbrlib",!0,!0),o.FS_createPath("/libraries/pbrlib","genmsl",!0,!0),o.FS_createPath("/libraries/pbrlib","genglsl",!0,!0),o.FS_createPath("/libraries/pbrlib/genglsl","lib",!0,!0),o.FS_createPath("/libraries/pbrlib","genosl",!0,!0),o.FS_createPath("/libraries/pbrlib/genosl","lib",!0,!0),o.FS_createPath("/libraries/pbrlib","genmdl",!0,!0),o.FS_createPath("/libraries","bxdf",!0,!0),o.FS_createPath("/libraries/bxdf","lama",!0,!0),o.FS_createPath("/libraries/bxdf","translation",!0,!0),o.FS_createPath("/libraries","cmlib",!0,!0),o.FS_createPath("/libraries","nprlib",!0,!0),o.FS_createPath("/libraries/nprlib","genmsl",!0,!0),o.FS_createPath("/libraries/nprlib","genglsl",!0,!0),o.FS_createPath("/libraries/nprlib","genosl",!0,!0),o.FS_createPath("/libraries/nprlib","genmdl",!0,!0);function g(T,C,H){this.start=T,this.end=C,this.audio=H}g.prototype={requests:{},open:function(T,C){this.name=C,this.requests[C]=this,o.addRunDependency("fp "+this.name)},send:function(){},onload:function(){var T=this.byteArray.subarray(this.start,this.end);this.finish(T)},finish:function(T){var C=this;o.FS_createDataFile(this.name,null,T,!0,!0,!0),o.removeRunDependency("fp "+C.name),this.requests[this.name]=null}};for(var p=t.files,v=0;v<p.length;++v)new g(p[v].start,p[v].end,p[v].audio).open("GET",p[v].filename);function E(T){f(T,"Loading data file failed."),f(T instanceof ArrayBuffer,"bad input to processPackageData");var C=new Uint8Array(T);g.prototype.byteArray=C;for(var H=t.files,h=0;h<H.length;++h)g.prototype.requests[H[h].filename].onload();o.removeRunDependency("datafile_../../bin/JsMaterialXGenShader.data")}o.addRunDependency("datafile_../../bin/JsMaterialXGenShader.data"),o.preloadResults||(o.preloadResults={}),o.preloadResults[r]={fromCache:!1},c?(E(c),c=null):u=E}o.calledRun?d():(o.preRun||(o.preRun=[]),o.preRun.push(d))};e({files:[{filename:"/libraries/README.md",start:0,end:4904,audio:0},{filename:"/libraries/CMakeLists.txt",start:4904,end:6827,audio:0},{filename:"/libraries/lights/lights_defs.mtlx",start:6827,end:9239,audio:0},{filename:"/libraries/lights/genmsl/mx_point_light.metal",start:9239,end:9615,audio:0},{filename:"/libraries/lights/genmsl/mx_spot_light.metal",start:9615,end:10245,audio:0},{filename:"/libraries/lights/genmsl/mx_directional_light.metal",start:10245,end:10432,audio:0},{filename:"/libraries/lights/genmsl/lights_genmsl_impl.mtlx",start:10432,end:11033,audio:0},{filename:"/libraries/lights/genglsl/lights_genglsl_impl.mtlx",start:11033,end:11637,audio:0},{filename:"/libraries/lights/genglsl/mx_spot_light.glsl",start:11637,end:12261,audio:0},{filename:"/libraries/lights/genglsl/mx_directional_light.glsl",start:12261,end:12442,audio:0},{filename:"/libraries/lights/genglsl/mx_point_light.glsl",start:12442,end:12812,audio:0},{filename:"/libraries/stdlib/stdlib_defs.mtlx",start:12812,end:290021,audio:0},{filename:"/libraries/stdlib/stdlib_ng.mtlx",start:290021,end:611027,audio:0},{filename:"/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx",start:611027,end:621322,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_sampling.metal",start:621322,end:623725,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_matscalaroperators.metal",start:623725,end:624734,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_math.metal",start:624734,end:629023,audio:0},{filename:"/libraries/stdlib/genmsl/lib/mx_texture.metal",start:629023,end:629761,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector2.glsl",start:629761,end:629972,audio:0},{filename:"/libraries/stdlib/genglsl/mx_smoothstep_float.glsl",start:629972,end:630197,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_float.glsl",start:630197,end:630390,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector3.glsl",start:630390,end:631209,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector3.glsl",start:631209,end:631401,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_color3.glsl",start:631401,end:631686,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_float.glsl",start:631686,end:631908,audio:0},{filename:"/libraries/stdlib/genglsl/mx_disjointover_color4.glsl",start:631908,end:632502,audio:0},{filename:"/libraries/stdlib/genglsl/mx_premult_color4.glsl",start:632502,end:632599,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector2.glsl",start:632599,end:632869,audio:0},{filename:"/libraries/stdlib/genglsl/mx_normalmap.glsl",start:632869,end:633367,audio:0},{filename:"/libraries/stdlib/genglsl/mx_cellnoise3d_float.glsl",start:633367,end:633504,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_float.glsl",start:633504,end:633714,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector4.glsl",start:633714,end:633984,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl",start:633984,end:634268,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector2.glsl",start:634268,end:634460,audio:0},{filename:"/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx",start:634460,end:711835,audio:0},{filename:"/libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl",start:711835,end:711977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector3.glsl",start:711977,end:712185,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector3.glsl",start:712185,end:712377,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector2.glsl",start:712377,end:712527,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector2.glsl",start:712527,end:712738,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector4.glsl",start:712738,end:713008,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_float.glsl",start:713008,end:713823,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector3.glsl",start:713823,end:713973,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rgbtohsv_color3.glsl",start:713973,end:714087,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector2.glsl",start:714087,end:714237,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector3.glsl",start:714237,end:714445,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl",start:714445,end:714652,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rotate_vector3.glsl",start:714652,end:715553,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector3.glsl",start:715553,end:715703,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hextilednormalmap.glsl",start:715703,end:718676,audio:0},{filename:"/libraries/stdlib/genglsl/mx_luminance_color3.glsl",start:718676,end:718790,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl",start:718790,end:718919,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_vector2.glsl",start:718919,end:719103,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_color4.glsl",start:719103,end:719912,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_vector3.glsl",start:719912,end:720096,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise3d_vector4.glsl",start:720096,end:720375,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_color3.glsl",start:720375,end:721192,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_float.glsl",start:721192,end:721415,audio:0},{filename:"/libraries/stdlib/genglsl/mx_cellnoise2d_float.glsl",start:721415,end:721552,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_float.glsl",start:721552,end:721736,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector2.glsl",start:721736,end:722553,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hextiledimage.glsl",start:722553,end:726619,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_float.glsl",start:726619,end:726829,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_color4.glsl",start:726829,end:727178,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_vector4.glsl",start:727178,end:727328,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector2.glsl",start:727328,end:727520,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_vector4.glsl",start:727520,end:727712,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramptb_float.glsl",start:727712,end:727863,audio:0},{filename:"/libraries/stdlib/genglsl/mx_hsvtorgb_color3.glsl",start:727863,end:727977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_transformmatrix_vector2M3.glsl",start:727977,end:728118,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splitlr_float.glsl",start:728118,end:728311,audio:0},{filename:"/libraries/stdlib/genglsl/mx_image_vector4.glsl",start:728311,end:729122,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_vector3.glsl",start:729122,end:729392,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_float.glsl",start:729392,end:729576,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector2.glsl",start:729576,end:729846,audio:0},{filename:"/libraries/stdlib/genglsl/mx_luminance_color4.glsl",start:729846,end:729977,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl",start:729977,end:730106,audio:0},{filename:"/libraries/stdlib/genglsl/mx_unpremult_color4.glsl",start:730106,end:730205,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_vector3.glsl",start:730205,end:730475,audio:0},{filename:"/libraries/stdlib/genglsl/mx_aastep.glsl",start:730475,end:730675,audio:0},{filename:"/libraries/stdlib/genglsl/mx_splittb_vector4.glsl",start:730675,end:730867,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise2d_vector2.glsl",start:730867,end:731051,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_float.glsl",start:731051,end:731202,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal3d_float.glsl",start:731202,end:731474,audio:0},{filename:"/libraries/stdlib/genglsl/mx_ramplr_vector4.glsl",start:731474,end:731624,audio:0},{filename:"/libraries/stdlib/genglsl/mx_burn_color4.glsl",start:731624,end:731965,audio:0},{filename:"/libraries/stdlib/genglsl/mx_mix_surfaceshader.glsl",start:731965,end:732199,audio:0},{filename:"/libraries/stdlib/genglsl/mx_dodge_color3.glsl",start:732199,end:732489,audio:0},{filename:"/libraries/stdlib/genglsl/mx_heighttonormal_vector3.glsl",start:732489,end:733442,audio:0},{filename:"/libraries/stdlib/genglsl/mx_fractal2d_float.glsl",start:733442,end:733714,audio:0},{filename:"/libraries/stdlib/genglsl/mx_worleynoise3d_vector3.glsl",start:733714,end:733898,audio:0},{filename:"/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl",start:733898,end:734174,audio:0},{filename:"/libraries/stdlib/genglsl/mx_noise2d_vector4.glsl",start:734174,end:734449,audio:0},{filename:"/libraries/stdlib/genglsl/mx_rotate_vector2.glsl",start:734449,end:734707,audio:0},{filename:"/libraries/stdlib/genglsl/mx_surface_unlit.glsl",start:734707,end:734999,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_sampling.glsl",start:734999,end:737366,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_transform_uv_vflip.glsl",start:737366,end:737502,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_math.glsl",start:737502,end:738137,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_noise.glsl",start:738137,end:761076,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_transform_uv.glsl",start:761076,end:761192,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_hextile.glsl",start:761192,end:765693,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_geometry.glsl",start:765693,end:767054,audio:0},{filename:"/libraries/stdlib/genglsl/lib/mx_hsv.glsl",start:767054,end:770533,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_vector2.osl",start:770533,end:770698,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_string.osl",start:770698,end:770854,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector3.osl",start:770854,end:771038,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_float.osl",start:771038,end:771197,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_vector3.osl",start:771197,end:771362,audio:0},{filename:"/libraries/stdlib/genosl/mx_luminance_color4.osl",start:771362,end:771494,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_float.osl",start:771494,end:771725,audio:0},{filename:"/libraries/stdlib/genosl/mx_frame_float.osl",start:771725,end:771894,audio:0},{filename:"/libraries/stdlib/genosl/mx_hsvtorgb_color3.osl",start:771894,end:771999,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector4.osl",start:771999,end:772317,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_color3.osl",start:772317,end:773262,audio:0},{filename:"/libraries/stdlib/genosl/mx_luminance_color3.osl",start:773262,end:773374,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_float.osl",start:773374,end:773591,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_boolean.osl",start:773591,end:773742,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector2.osl",start:773742,end:773996,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector3.osl",start:773996,end:774247,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector2.osl",start:774247,end:775162,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_vector2.osl",start:775162,end:775328,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise3d_vector3.osl",start:775328,end:775492,audio:0},{filename:"/libraries/stdlib/genosl/mx_time_float.osl",start:775492,end:775670,audio:0},{filename:"/libraries/stdlib/genosl/mx_rotate_vector3.osl",start:775670,end:776740,audio:0},{filename:"/libraries/stdlib/genosl/mx_premult_color4.osl",start:776740,end:776842,audio:0},{filename:"/libraries/stdlib/genosl/mx_surface_unlit.osl",start:776842,end:777256,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector4.osl",start:777256,end:777461,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_vector4.osl",start:777461,end:777715,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_float.osl",start:777715,end:777909,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_integer.osl",start:777909,end:778060,audio:0},{filename:"/libraries/stdlib/genosl/mx_cellnoise3d_float.osl",start:778060,end:778162,audio:0},{filename:"/libraries/stdlib/genosl/mx_unpremult_color4.osl",start:778162,end:778266,audio:0},{filename:"/libraries/stdlib/genosl/mx_rotate_vector2.osl",start:778266,end:778527,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector3.osl",start:778527,end:778763,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector4.osl",start:778763,end:778953,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_float.osl",start:778953,end:779160,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector2.osl",start:779160,end:779399,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector3.osl",start:779399,end:779555,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_float.osl",start:779555,end:779729,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal2d_float.osl",start:779729,end:779975,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_color3.osl",start:779975,end:780128,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_vector2.osl",start:780128,end:780318,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_color3.osl",start:780318,end:780576,audio:0},{filename:"/libraries/stdlib/genosl/mx_rgbtohsv_color3.osl",start:780576,end:780681,audio:0},{filename:"/libraries/stdlib/genosl/mx_worleynoise2d_float.osl",start:780681,end:780841,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise3d_float.osl",start:780841,end:781020,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_vector2.osl",start:781020,end:781286,audio:0},{filename:"/libraries/stdlib/genosl/mx_transformmatrix_vector2M3.osl",start:781286,end:781472,audio:0},{filename:"/libraries/stdlib/genosl/mx_geompropvalue_color4.osl",start:781472,end:781840,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector3.osl",start:781840,end:782039,audio:0},{filename:"/libraries/stdlib/genosl/mx_dodge_color4.osl",start:782039,end:782386,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_color4.osl",start:782386,end:783509,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_color3.osl",start:783509,end:783762,audio:0},{filename:"/libraries/stdlib/genosl/mx_creatematrix.osl",start:783762,end:784667,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_color4.osl",start:784667,end:784898,audio:0},{filename:"/libraries/stdlib/genosl/mx_hsvtorgb_color4.osl",start:784898,end:785020,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_float.osl",start:785020,end:785883,audio:0},{filename:"/libraries/stdlib/genosl/mx_burn_color4.osl",start:785883,end:786221,audio:0},{filename:"/libraries/stdlib/genosl/mx_heighttonormal_vector3.osl",start:786221,end:787195,audio:0},{filename:"/libraries/stdlib/genosl/mx_noise2d_vector2.osl",start:787195,end:787400,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector3.osl",start:787400,end:788218,audio:0},{filename:"/libraries/stdlib/genosl/mx_rgbtohsv_color4.osl",start:788218,end:788340,audio:0},{filename:"/libraries/stdlib/genosl/mx_cellnoise2d_float.osl",start:788340,end:788457,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_color3.osl",start:788457,end:788553,audio:0},{filename:"/libraries/stdlib/genosl/mx_normalmap.osl",start:788553,end:789465,audio:0},{filename:"/libraries/stdlib/genosl/mx_disjointover_color4.osl",start:789465,end:790043,audio:0},{filename:"/libraries/stdlib/genosl/mx_image_vector4.osl",start:790043,end:791086,audio:0},{filename:"/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx",start:791086,end:868641,audio:0},{filename:"/libraries/stdlib/genosl/mx_mix_surfaceshader.osl",start:868641,end:868883,audio:0},{filename:"/libraries/stdlib/genosl/mx_fractal3d_vector4.osl",start:868883,end:869122,audio:0},{filename:"/libraries/stdlib/genosl/mx_geomcolor_float.osl",start:869122,end:869217,audio:0},{filename:"/libraries/stdlib/genosl/include/color4.h",start:869217,end:875055,audio:0},{filename:"/libraries/stdlib/genosl/include/vector2.h",start:875055,end:880721,audio:0},{filename:"/libraries/stdlib/genosl/include/vector4.h",start:880721,end:889719,audio:0},{filename:"/libraries/stdlib/genosl/include/mx_funcs.h",start:889719,end:911510,audio:0},{filename:"/libraries/stdlib/genosl/include/matrix33.h",start:911510,end:914130,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_transform_uv_vflip.osl",start:914130,end:914226,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_transform_uv.osl",start:914226,end:914293,audio:0},{filename:"/libraries/stdlib/genosl/lib/vector4_extra_ops.osl",start:914293,end:915167,audio:0},{filename:"/libraries/stdlib/genosl/lib/mx_sampling.osl",start:915167,end:920626,audio:0},{filename:"/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx",start:920626,end:1015485,audio:0},{filename:"/libraries/targets/genmsl.mtlx",start:1015485,end:1015955,audio:0},{filename:"/libraries/targets/essl.mtlx",start:1015955,end:1016417,audio:0},{filename:"/libraries/targets/genosl.mtlx",start:1016417,end:1016869,audio:0},{filename:"/libraries/targets/genglsl.mtlx",start:1016869,end:1017322,audio:0},{filename:"/libraries/targets/genmdl.mtlx",start:1017322,end:1017774,audio:0},{filename:"/libraries/pbrlib/pbrlib_ng.mtlx",start:1017774,end:1018568,audio:0},{filename:"/libraries/pbrlib/pbrlib_defs.mtlx",start:1018568,end:1042886,audio:0},{filename:"/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx",start:1042886,end:1043153,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_subsurface_bsdf.glsl",start:1043153,end:1044206,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_displacement_vector3.glsl",start:1044206,end:1044346,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_anisotropic_vdf.glsl",start:1044346,end:1044574,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_generalized_schlick_bsdf.glsl",start:1044574,end:1047743,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_edf_color3.glsl",start:1047743,end:1047896,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_displacement_float.glsl",start:1047896,end:1048041,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_chiang_hair_bsdf.glsl",start:1048041,end:1057049,audio:0},{filename:"/libraries/pbrlib/genglsl/pbrlib_genglsl_impl.mtlx",start:1057049,end:1063154,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_edf_float.glsl",start:1063154,end:1063307,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_burley_diffuse_bsdf.glsl",start:1063307,end:1064354,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_layer_bsdf.glsl",start:1064354,end:1064604,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_translucent_bsdf.glsl",start:1064604,end:1065330,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_artistic_ior.glsl",start:1065330,end:1065903,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_layer_vdf.glsl",start:1065903,end:1066135,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_bsdf_float.glsl",start:1066135,end:1066393,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_uniform_edf.glsl",start:1066393,end:1066601,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_conductor_bsdf.glsl",start:1066601,end:1068358,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_roughness_dual.glsl",start:1068358,end:1068626,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_add_edf.glsl",start:1068626,end:1068766,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_multiply_bsdf_color3.glsl",start:1068766,end:1069019,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_dielectric_bsdf.glsl",start:1069019,end:1071661,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_mix_bsdf.glsl",start:1071661,end:1071927,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_roughness_anisotropy.glsl",start:1071927,end:1072372,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_blackbody.glsl",start:1072372,end:1074108,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_add_bsdf.glsl",start:1074108,end:1074690,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_oren_nayar_diffuse_bsdf.glsl",start:1074690,end:1076065,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_sheen_bsdf.glsl",start:1076065,end:1078151,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_generalized_schlick_edf.glsl",start:1078151,end:1078663,audio:0},{filename:"/libraries/pbrlib/genglsl/mx_mix_edf.glsl",start:1078663,end:1078829,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl",start:1078829,end:1081502,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_none.glsl",start:1081502,end:1081737,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl",start:1081737,end:1083141,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_generate_albedo_table.glsl",start:1083141,end:1083513,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet.glsl",start:1083513,end:1086505,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_sheen.glsl",start:1086505,end:1093258,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_closure_type.glsl",start:1093258,end:1093675,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_transmission_opacity.glsl",start:1093675,end:1093846,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl",start:1093846,end:1101310,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_environment_fis.glsl",start:1101310,end:1104407,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_shadow.glsl",start:1104407,end:1105163,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl",start:1105163,end:1105674,audio:0},{filename:"/libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl",start:1105674,end:1122447,audio:0},{filename:"/libraries/pbrlib/genosl/pbrlib_genosl_impl.mtlx",start:1122447,end:1128292,audio:0},{filename:"/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl",start:1128292,end:1128620,audio:0},{filename:"/libraries/pbrlib/genosl/mx_anisotropic_vdf.osl",start:1128620,end:1128991,audio:0},{filename:"/libraries/pbrlib/genosl/mx_surface.osl",start:1128991,end:1129192,audio:0},{filename:"/libraries/pbrlib/genosl/mx_artistic_ior.osl",start:1129192,end:1129784,audio:0},{filename:"/libraries/pbrlib/genosl/mx_dielectric_bsdf.osl",start:1129784,end:1130334,audio:0},{filename:"/libraries/pbrlib/genosl/mx_chiang_hair_roughness.osl",start:1130334,end:1130691,audio:0},{filename:"/libraries/pbrlib/genosl/mx_roughness_dual.osl",start:1130691,end:1130987,audio:0},{filename:"/libraries/pbrlib/genosl/mx_chiang_hair_bsdf.osl",start:1130987,end:1131679,audio:0},{filename:"/libraries/pbrlib/genosl/mx_blackbody.osl",start:1131679,end:1133451,audio:0},{filename:"/libraries/pbrlib/genosl/mx_generalized_schlick_edf.osl",start:1133451,end:1133721,audio:0},{filename:"/libraries/pbrlib/genosl/mx_generalized_schlick_bsdf.osl",start:1133721,end:1134360,audio:0},{filename:"/libraries/pbrlib/genosl/mx_roughness_anisotropy.osl",start:1134360,end:1134811,audio:0},{filename:"/libraries/pbrlib/genosl/lib/mx_microfacet.osl",start:1134811,end:1136543,audio:0},{filename:"/libraries/pbrlib/genmdl/pbrlib_genmdl_impl.mtlx",start:1136543,end:1147928,audio:0},{filename:"/libraries/bxdf/disney_principled.mtlx",start:1147928,end:1155236,audio:0},{filename:"/libraries/bxdf/usd_preview_surface.mtlx",start:1155236,end:1178228,audio:0},{filename:"/libraries/bxdf/gltf_pbr.mtlx",start:1178228,end:1223121,audio:0},{filename:"/libraries/bxdf/standard_surface.mtlx",start:1223121,end:1251204,audio:0},{filename:"/libraries/bxdf/open_pbr_surface.mtlx",start:1251204,end:1293074,audio:0},{filename:"/libraries/bxdf/lama/lama_dielectric.mtlx",start:1293074,end:1303993,audio:0},{filename:"/libraries/bxdf/lama/lama_diffuse.mtlx",start:1303993,end:1306939,audio:0},{filename:"/libraries/bxdf/lama/lama_conductor.mtlx",start:1306939,end:1314939,audio:0},{filename:"/libraries/bxdf/lama/lama_iridescence.mtlx",start:1314939,end:1320902,audio:0},{filename:"/libraries/bxdf/lama/lama_translucent.mtlx",start:1320902,end:1322539,audio:0},{filename:"/libraries/bxdf/lama/lama_sss.mtlx",start:1322539,end:1329314,audio:0},{filename:"/libraries/bxdf/lama/lama_surface.mtlx",start:1329314,end:1330982,audio:0},{filename:"/libraries/bxdf/lama/lama_sheen.mtlx",start:1330982,end:1333105,audio:0},{filename:"/libraries/bxdf/lama/lama_add.mtlx",start:1333105,end:1335759,audio:0},{filename:"/libraries/bxdf/lama/lama_layer.mtlx",start:1335759,end:1337503,audio:0},{filename:"/libraries/bxdf/lama/lama_generalized_schlick.mtlx",start:1337503,end:1349357,audio:0},{filename:"/libraries/bxdf/lama/lama_emission.mtlx",start:1349357,end:1350106,audio:0},{filename:"/libraries/bxdf/lama/lama_mix.mtlx",start:1350106,end:1352193,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_usd.mtlx",start:1352193,end:1358074,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_gltf_pbr.mtlx",start:1358074,end:1365969,audio:0},{filename:"/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx",start:1365969,end:1381078,audio:0},{filename:"/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx",start:1381078,end:1398545,audio:0},{filename:"/libraries/cmlib/cmlib_defs.mtlx",start:1398545,end:1403391,audio:0},{filename:"/libraries/cmlib/cmlib_ng.mtlx",start:1403391,end:1420866,audio:0},{filename:"/libraries/nprlib/nprlib_ng.mtlx",start:1420866,end:1425715,audio:0},{filename:"/libraries/nprlib/nprlib_defs.mtlx",start:1425715,end:1428350,audio:0},{filename:"/libraries/nprlib/genmsl/nprlib_genmsl_impl.mtlx",start:1428350,end:1429011,audio:0},{filename:"/libraries/nprlib/genglsl/nprlib_genglsl_impl.mtlx",start:1429011,end:1429675,audio:0},{filename:"/libraries/nprlib/genosl/nprlib_genosl_impl.mtlx",start:1429675,end:1430373,audio:0},{filename:"/libraries/nprlib/genmdl/nprlib_genmdl_impl.mtlx",start:1430373,end:1431135,audio:0}],remote_package_size:1431135})}();var x={},_;for(_ in o)o.hasOwnProperty(_)&&(x[_]=o[_]);var X="./this.program",P=!1,$=!1,O=!1,I=!1;P=typeof window=="object",$=typeof importScripts=="function",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",I=!P&&!O&&!$;var J="";function ee(e){return o.locateFile?o.locateFile(e,J):J+e}var G,ce,Se,ze,Ke;O?($?J=require("path").dirname(J)+"/":J=__dirname+"/",G=function(e,t){return ze||(ze=require("fs")),Ke||(Ke=require("path")),e=Ke.normalize(e),ze.readFileSync(e,t?null:"utf8")},Se=function(e){var t=G(e,!0);return t.buffer||(t=new Uint8Array(t)),Yt(t.buffer),t},process.argv.length>1&&(X=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof $o))throw e}),process.on("unhandledRejection",ae),o.inspect=function(){return"[Emscripten Module object]"}):I?(typeof read<"u"&&(G=function(e){return read(e)}),Se=function(e){var t;return typeof readbuffer=="function"?new Uint8Array(readbuffer(e)):(t=read(e,"binary"),Yt(typeof t=="object"),t)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(P||$)&&($?J=self.location.href:typeof document<"u"&&document.currentScript&&(J=document.currentScript.src),y&&(J=y),J.indexOf("blob:")!==0?J=J.substr(0,J.lastIndexOf("/")+1):J="",G=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},$&&(Se=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),ce=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){if(n.status==200||n.status==0&&n.response){t(n.response);return}r()},n.onerror=r,n.send(null)});var We=o.print||console.log.bind(console),ue=o.printErr||console.warn.bind(console);for(_ in x)x.hasOwnProperty(_)&&(o[_]=x[_]);x=null,o.arguments&&o.arguments,o.thisProgram&&(X=o.thisProgram),o.quit&&o.quit;function Mn(e,t){return Math.ceil(e/t)*t}var xr=0,he=function(e){xr=e},Tn=function(){return xr},Ze;o.wasmBinary&&(Ze=o.wasmBinary),o.noExitRuntime,typeof WebAssembly!="object"&&ae("no native wasm support detected");var ft,Er=!1;function Yt(e,t){e||ae("Assertion failed: "+t)}var Fr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ge(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&Fr)return Fr.decode(e.subarray(t,a));for(var s="";t<a;){var l=e[t++];if(!(l&128)){s+=String.fromCharCode(l);continue}var u=e[t++]&63;if((l&224)==192){s+=String.fromCharCode((l&31)<<6|u);continue}var c=e[t++]&63;if((l&240)==224?l=(l&15)<<12|u<<6|c:l=(l&7)<<18|u<<12|c<<6|e[t++]&63,l<65536)s+=String.fromCharCode(l);else{var d=l-65536;s+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return s}function $e(e,t){return e?Ge(de,e,t):""}function At(e,t,r,n){if(!(n>0))return 0;for(var a=r,s=r+n-1,l=0;l<e.length;++l){var u=e.charCodeAt(l);if(u>=55296&&u<=57343){var c=e.charCodeAt(++l);u=65536+((u&1023)<<10)|c&1023}if(u<=127){if(r>=s)break;t[r++]=u}else if(u<=2047){if(r+1>=s)break;t[r++]=192|u>>6,t[r++]=128|u&63}else if(u<=65535){if(r+2>=s)break;t[r++]=224|u>>12,t[r++]=128|u>>6&63,t[r++]=128|u&63}else{if(r+3>=s)break;t[r++]=240|u>>18,t[r++]=128|u>>12&63,t[r++]=128|u>>6&63,t[r++]=128|u&63}}return t[r]=0,r-a}function Kt(e,t,r){return At(e,de,t,r)}function mt(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++r)&1023),n<=127?++t:n<=2047?t+=2:n<=65535?t+=3:t+=4}return t}var Sr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function kn(e,t){for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&Ie[n];)++n;if(r=n<<1,r-e>32&&Sr)return Sr.decode(de.subarray(e,r));for(var s="",l=0;!(l>=t/2);++l){var u=Pe[e+l*2>>1];if(u==0)break;s+=String.fromCharCode(u)}return s}function Cn(e,t,r){if(r===void 0&&(r=2147483647),r<2)return 0;r-=2;for(var n=t,a=r<e.length*2?r/2:e.length,s=0;s<a;++s){var l=e.charCodeAt(s);Pe[t>>1]=l,t+=2}return Pe[t>>1]=0,t-n}function Dn(e){return e.length*2}function Rn(e,t){for(var r=0,n="";!(r>=t/4);){var a=w[e+r*4>>2];if(a==0)break;if(++r,a>=65536){var s=a-65536;n+=String.fromCharCode(55296|s>>10,56320|s&1023)}else n+=String.fromCharCode(a)}return n}function On(e,t,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var u=e.charCodeAt(++s);l=65536+((l&1023)<<10)|u&1023}if(w[t>>2]=l,t+=4,t+4>a)break}return w[t>>2]=0,t-n}function jn(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function $n(e,t){oe.set(e,t)}function Xn(e,t,r){for(var n=0;n<e.length;++n)oe[t++>>0]=e.charCodeAt(n);oe[t>>0]=0}function Un(e,t){return e%t>0&&(e+=t-e%t),e}var gt,oe,de,Pe,Ie,w,ye,Pr,Zt;function Mr(e){gt=e,o.HEAP8=oe=new Int8Array(e),o.HEAP16=Pe=new Int16Array(e),o.HEAP32=w=new Int32Array(e),o.HEAPU8=de=new Uint8Array(e),o.HEAPU16=Ie=new Uint16Array(e),o.HEAPU32=ye=new Uint32Array(e),o.HEAPF32=Pr=new Float32Array(e),o.HEAPF64=Zt=new Float64Array(e)}o.INITIAL_MEMORY;var N,Tr=[],kr=[],Cr=[];function Nn(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Wn(o.preRun.shift());er(Tr)}function Ln(){!o.noFSInit&&!i.init.initialized&&i.init(),er(kr)}function zn(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)Bn(o.postRun.shift());er(Cr)}function Wn(e){Tr.unshift(e)}function Gn(e){kr.unshift(e)}function Bn(e){Cr.unshift(e)}var Xe=0,et=null;function It(e){Xe++,o.monitorRunDependencies&&o.monitorRunDependencies(Xe)}function pt(e){if(Xe--,o.monitorRunDependencies&&o.monitorRunDependencies(Xe),Xe==0&&et){var t=et;et=null,t()}}o.preloadedImages={},o.preloadedAudios={};function ae(e){o.onAbort&&o.onAbort(e),e+="",ue(e),Er=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw R(t),t}var Hn="data:application/octet-stream;base64,";function Dr(e){return e.startsWith(Hn)}function Rr(e){return e.startsWith("file://")}var be="JsMaterialXGenShader.wasm";Dr(be)||(be=ee(be));function Or(e){try{if(e==be&&Ze)return new Uint8Array(Ze);if(Se)return Se(e);throw"both async and sync fetching of the wasm failed"}catch(t){ae(t)}}function Vn(){if(!Ze&&(P||$)){if(typeof fetch=="function"&&!Rr(be))return fetch(be,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+be+"'";return e.arrayBuffer()}).catch(function(){return Or(be)});if(ce)return new Promise(function(e,t){ce(be,function(r){e(new Uint8Array(r))},t)})}return Promise.resolve().then(function(){return Or(be)})}function qn(){var e={a:Zi};function t(l,u){var c=l.exports;o.asm=c,ft=o.asm.Xa,Mr(ft.buffer),N=o.asm._a,Gn(o.asm.Ya),pt()}It();function r(l){t(l.instance)}function n(l){return Vn().then(function(u){var c=WebAssembly.instantiate(u,e);return c}).then(l,function(u){ue("failed to asynchronously prepare wasm: "+u),ae(u)})}function a(){return!Ze&&typeof WebAssembly.instantiateStreaming=="function"&&!Dr(be)&&!Rr(be)&&typeof fetch=="function"?fetch(be,{credentials:"same-origin"}).then(function(l){var u=WebAssembly.instantiateStreaming(l,e);return u.then(r,function(c){return ue("wasm streaming compile failed: "+c),ue("falling back to ArrayBuffer instantiation"),n(r)})}):n(r)}if(o.instantiateWasm)try{var s=o.instantiateWasm(e,t);return s}catch(l){return ue("Module.instantiateWasm callback failed with error: "+l),!1}return a().catch(R),{}}var K,me,Qn={218952:function(){o.TreeIterator.prototype[Symbol.iterator]=function(){return this}},219036:function(){o.GraphIterator.prototype[Symbol.iterator]=function(){return this}},219121:function(){o.InheritanceIterator.prototype[Symbol.iterator]=function(){return this}}};function er(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(o);continue}var r=t.func;typeof r=="number"?t.arg===void 0?N.get(r)():N.get(r)(t.arg):r(t.arg===void 0?null:t.arg)}}function Jn(e,t,r,n){ae("Assertion failed: "+$e(e)+", at: "+[t?$e(t):"unknown filename",r,n?$e(n):"unknown function"])}var fe={DESTRUCTOR_OFFSET:0,REFCOUNT_OFFSET:4,TYPE_OFFSET:8,CAUGHT_OFFSET:12,RETHROWN_OFFSET:13,SIZE:16};function Yn(e){return Je(e+fe.SIZE)+fe.SIZE}function Be(e){this.excPtr=e,this.ptr=e-fe.SIZE,this.set_type=function(t){w[this.ptr+fe.TYPE_OFFSET>>2]=t},this.get_type=function(){return w[this.ptr+fe.TYPE_OFFSET>>2]},this.set_destructor=function(t){w[this.ptr+fe.DESTRUCTOR_OFFSET>>2]=t},this.get_destructor=function(){return w[this.ptr+fe.DESTRUCTOR_OFFSET>>2]},this.set_refcount=function(t){w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t},this.set_caught=function(t){t=t?1:0,oe[this.ptr+fe.CAUGHT_OFFSET>>0]=t},this.get_caught=function(){return oe[this.ptr+fe.CAUGHT_OFFSET>>0]!=0},this.set_rethrown=function(t){t=t?1:0,oe[this.ptr+fe.RETHROWN_OFFSET>>0]=t},this.get_rethrown=function(){return oe[this.ptr+fe.RETHROWN_OFFSET>>0]!=0},this.init=function(t,r){this.set_type(t),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=w[this.ptr+fe.REFCOUNT_OFFSET>>2];w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t+1},this.release_ref=function(){var t=w[this.ptr+fe.REFCOUNT_OFFSET>>2];return w[this.ptr+fe.REFCOUNT_OFFSET>>2]=t-1,t===1}}function tt(e){this.free=function(){ve(this.ptr),this.ptr=0},this.set_base_ptr=function(t){w[this.ptr>>2]=t},this.get_base_ptr=function(){return w[this.ptr>>2]},this.set_adjusted_ptr=function(t){var r=4;w[this.ptr+r>>2]=t},this.get_adjusted_ptr=function(){var t=4;return w[this.ptr+t>>2]},this.get_exception_ptr=function(){var t=Zr(this.get_exception_info().get_type());if(t)return w[this.get_base_ptr()>>2];var r=this.get_adjusted_ptr();return r!==0?r:this.get_base_ptr()},this.get_exception_info=function(){return new Be(this.get_base_ptr())},e===void 0?(this.ptr=Je(8),this.set_adjusted_ptr(0)):this.ptr=e}var ht=[];function An(e){e.add_ref()}var bt=0;function Kn(e){var t=new tt(e),r=t.get_exception_info();return r.get_caught()||(r.set_caught(!0),bt--),r.set_rethrown(!1),ht.push(t),An(r),t.get_exception_ptr()}var Ce=0;function jr(e){return ve(new Be(e).ptr)}function Zn(e){if(e.release_ref()&&!e.get_rethrown()){var t=e.get_destructor();t&&N.get(t)(e.excPtr),jr(e.excPtr)}}function In(){V(0);var e=ht.pop();Zn(e.get_exception_info()),e.free(),Ce=0}function ea(e){var t=new tt(e),r=t.get_base_ptr();throw Ce||(Ce=r),t.free(),r}function ta(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=$t(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Xt(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function ra(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=$t(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Xt(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function na(){var e=Ce;if(!e)return he(0),0;var t=new Be(e),r=t.get_type(),n=new tt;if(n.set_base_ptr(e),!r)return he(0),n.ptr|0;var a=Array.prototype.slice.call(arguments),s=z(),l=$t(4);w[l>>2]=e;for(var u=0;u<a.length;u++){var c=a[u];if(c===0||c===r)break;if(Xt(c,r,l)){var d=w[l>>2];return e!==d&&n.set_adjusted_ptr(d),he(c),n.ptr|0}}return W(s),he(r),n.ptr|0}function aa(){var e=ht.pop();e||ae("no exception to throw");var t=e.get_exception_info(),r=e.get_base_ptr();throw t.get_rethrown()?e.free():(ht.push(e),t.set_rethrown(!0),t.set_caught(!1),bt++),Ce=r,r}function ia(e,t,r){var n=new Be(e);throw n.init(t,r),Ce=e,bt++,e}function oa(){return bt}function sa(e){return w[Ar()>>2]=e,e}var A={splitPath:function(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:function(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:function(e){var t=e.charAt(0)==="/",r=e.substr(-1)==="/";return e=A.normalizeArray(e.split("/").filter(function(n){return!!n}),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=A.splitPath(e),r=t[0],n=t[1];return!r&&!n?".":(n&&(n=n.substr(0,n.length-1)),r+n)},basename:function(e){if(e==="/")return"/";e=A.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},extname:function(e){return A.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return A.normalize(e.join("/"))},join2:function(e,t){return A.normalize(e+"/"+t)}};function la(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}else if(O)try{var t=require("crypto");return function(){return t.randomBytes(1)[0]}}catch{}return function(){ae("randomDevice")}}var Me={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:i.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=n.charAt(0)==="/"}return e=A.normalizeArray(e.split("/").filter(function(a){return!!a}),!t).join("/"),(t?"/":"")+e||"."},relative:function(e,t){e=Me.resolve(e).substr(1),t=Me.resolve(t).substr(1);function r(d){for(var f=0;f<d.length&&d[f]==="";f++);for(var g=d.length-1;g>=0&&d[g]==="";g--);return f>g?[]:d.slice(f,g-f+1)}for(var n=r(e.split("/")),a=r(t.split("/")),s=Math.min(n.length,a.length),l=s,u=0;u<s;u++)if(n[u]!==a[u]){l=u;break}for(var c=[],u=l;u<n.length;u++)c.push("..");return c=c.concat(a.slice(l)),c.join("/")}},Ue={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){Ue.ttys[e]={input:[],output:[],ops:t},i.registerDevice(e,Ue.stream_ops)},stream_ops:{open:function(e){var t=Ue.ttys[e.node.rdev];if(!t)throw new i.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.get_char)throw new i.ErrnoError(60);for(var s=0,l=0;l<n;l++){var u;try{u=e.tty.ops.get_char(e.tty)}catch{throw new i.ErrnoError(29)}if(u===void 0&&s===0)throw new i.ErrnoError(6);if(u==null)break;s++,t[r+l]=u}return s&&(e.node.timestamp=Date.now()),s},write:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var s=0;s<n;s++)e.tty.ops.put_char(e.tty,t[r+s])}catch{throw new i.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),s}},default_tty_ops:{get_char:function(e){if(!e.input.length){var t=null;if(O){var r=256,n=Buffer.alloc?Buffer.alloc(r):new Buffer(r),a=0;try{a=ze.readSync(process.stdin.fd,n,0,r,null)}catch(s){if(s.toString().includes("EOF"))a=0;else throw s}a>0?t=n.slice(0,a).toString("utf-8"):t=null}else typeof window<"u"&&typeof window.prompt=="function"?(t=window.prompt("Input: "),t!==null&&(t+=`
2
2
  `)):typeof readline=="function"&&(t=readline(),t!==null&&(t+=`
3
- `));if(!t)return null;e.input=$t(t,!0)}return e.input.shift()},put_char:function(e,t){t===null||t===10?(We(Ge(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(We(Ge(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){t===null||t===10?(ue(Ge(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(ue(Ge(e.output,0)),e.output=[])}}};function ua(e){for(var t=Mn(e,65536),r=Je(t);e<t;)oe[r+e++]=0;return r}var U={ops_table:null,mount:function(e){return U.createNode(null,"/",16895,0)},createNode:function(e,t,r,n){if(i.isBlkdev(r)||i.isFIFO(r))throw new i.ErrnoError(63);U.ops_table||(U.ops_table={dir:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr,lookup:U.node_ops.lookup,mknod:U.node_ops.mknod,rename:U.node_ops.rename,unlink:U.node_ops.unlink,rmdir:U.node_ops.rmdir,readdir:U.node_ops.readdir,symlink:U.node_ops.symlink},stream:{llseek:U.stream_ops.llseek}},file:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr},stream:{llseek:U.stream_ops.llseek,read:U.stream_ops.read,write:U.stream_ops.write,allocate:U.stream_ops.allocate,mmap:U.stream_ops.mmap,msync:U.stream_ops.msync}},link:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr,readlink:U.node_ops.readlink},stream:{}},chrdev:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr},stream:i.chrdev_stream_ops}});var a=i.createNode(e,t,r,n);return i.isDir(a.mode)?(a.node_ops=U.ops_table.dir.node,a.stream_ops=U.ops_table.dir.stream,a.contents={}):i.isFile(a.mode)?(a.node_ops=U.ops_table.file.node,a.stream_ops=U.ops_table.file.stream,a.usedBytes=0,a.contents=null):i.isLink(a.mode)?(a.node_ops=U.ops_table.link.node,a.stream_ops=U.ops_table.link.stream):i.isChrdev(a.mode)&&(a.node_ops=U.ops_table.chrdev.node,a.stream_ops=U.ops_table.chrdev.stream),a.timestamp=Date.now(),e&&(e.contents[t]=a,e.timestamp=a.timestamp),a},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){var n=1048576;t=Math.max(t,r*(r<n?2:1.125)>>>0),r!=0&&(t=Math.max(t,256));var a=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(t==0)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:function(e){var t={};return t.dev=i.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,i.isDir(e.mode)?t.size=4096:i.isFile(e.mode)?t.size=e.usedBytes:i.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&U.resizeFileStorage(e,t.size)},lookup:function(e,t){throw i.genericErrors[44]},mknod:function(e,t,r,n){return U.createNode(e,t,r,n)},rename:function(e,t,r){if(i.isDir(e.mode)){var n;try{n=i.lookupNode(t,r)}catch{}if(n)for(var a in n.contents)throw new i.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=i.lookupNode(e,t);for(var n in r.contents)throw new i.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var n=U.createNode(e,t,41471,0);return n.link=r,n},readlink:function(e){if(!i.isLink(e.mode))throw new i.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,n,a){var s=e.node.contents;if(a>=e.node.usedBytes)return 0;var l=Math.min(e.node.usedBytes-a,n);if(l>8&&s.subarray)t.set(s.subarray(a,a+l),r);else for(var u=0;u<l;u++)t[r+u]=s[a+u];return l},write:function(e,t,r,n,a,s){if(t.buffer===oe.buffer&&(s=!1),!n)return 0;var l=e.node;if(l.timestamp=Date.now(),t.subarray&&(!l.contents||l.contents.subarray)){if(s)return l.contents=t.subarray(r,r+n),l.usedBytes=n,n;if(l.usedBytes===0&&a===0)return l.contents=t.slice(r,r+n),l.usedBytes=n,n;if(a+n<=l.usedBytes)return l.contents.set(t.subarray(r,r+n),a),n}if(U.expandFileStorage(l,a+n),l.contents.subarray&&t.subarray)l.contents.set(t.subarray(r,r+n),a);else for(var u=0;u<n;u++)l.contents[a+u]=t[r+u];return l.usedBytes=Math.max(l.usedBytes,a+n),n},llseek:function(e,t,r){var n=t;if(r===1?n+=e.position:r===2&&i.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate:function(e,t,r){U.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,n,a,s){if(t!==0)throw new i.ErrnoError(28);if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);var l,u,c=e.node.contents;if(!(s&2)&&c.buffer===pt)u=!1,l=c.byteOffset;else{if((n>0||n+r<c.length)&&(c.subarray?c=c.subarray(n,n+r):c=Array.prototype.slice.call(c,n,n+r)),u=!0,l=ua(r),!l)throw new i.ErrnoError(48);oe.set(c,l)}return{ptr:l,allocated:u}},msync:function(e,t,r,n,a){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);return a&2||U.stream_ops.write(e,t,0,n,r,!1),0}}},i={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(e,t){if(e=Me.resolve(i.cwd(),e),t=t||{},!e)return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var n in r)t[n]===void 0&&(t[n]=r[n]);if(t.recurse_count>8)throw new i.ErrnoError(32);for(var a=Z.normalizeArray(e.split("/").filter(function(p){return!!p}),!1),s=i.root,l="/",u=0;u<a.length;u++){var c=u===a.length-1;if(c&&t.parent)break;if(s=i.lookupNode(s,a[u]),l=Z.join2(l,a[u]),i.isMountpoint(s)&&(!c||c&&t.follow_mount)&&(s=s.mounted.root),!c||t.follow)for(var d=0;i.isLink(s.mode);){var m=i.readlink(l);l=Me.resolve(Z.dirname(l),m);var g=i.lookupPath(l,{recurse_count:t.recurse_count});if(s=g.node,d++>40)throw new i.ErrnoError(32)}}return{path:l,node:s}},getPath:function(e){for(var t;;){if(i.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:function(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%i.nameTable.length},hashAddNode:function(e){var t=i.hashName(e.parent.id,e.name);e.name_next=i.nameTable[t],i.nameTable[t]=e},hashRemoveNode:function(e){var t=i.hashName(e.parent.id,e.name);if(i.nameTable[t]===e)i.nameTable[t]=e.name_next;else for(var r=i.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=i.mayLookup(e);if(r)throw new i.ErrnoError(r,e);for(var n=i.hashName(e.id,t),a=i.nameTable[n];a;a=a.name_next){var s=a.name;if(a.parent.id===e.id&&s===t)return a}return i.lookup(e,t)},createNode:function(e,t,r,n){var a=new i.FSNode(e,t,r,n);return i.hashAddNode(a),a},destroyNode:function(e){i.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return(e&61440)===32768},isDir:function(e){return(e&61440)===16384},isLink:function(e){return(e&61440)===40960},isChrdev:function(e){return(e&61440)===8192},isBlkdev:function(e){return(e&61440)===24576},isFIFO:function(e){return(e&61440)===4096},isSocket:function(e){return(e&49152)===49152},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(e){var t=i.flagModes[e];if(typeof t>"u")throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions:function(e,t){return 0},mayLookup:function(e){var t=i.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{var r=i.lookupNode(e,t);return 20}catch{}return i.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var n;try{n=i.lookupNode(e,t)}catch(s){return s.errno}var a=i.nodePermissions(e,"wx");if(a)return a;if(r){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen:function(e,t){return e?i.isLink(e.mode)?32:i.isDir(e.mode)&&(i.flagsToPermissionString(t)!=="r"||t&512)?31:i.nodePermissions(e,i.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||i.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!i.streams[r])return r;throw new i.ErrnoError(33)},getStream:function(e){return i.streams[e]},createStream:function(e,t,r){i.FSStream||(i.FSStream=function(){},i.FSStream.prototype={object:{get:function(){return this.node},set:function(l){this.node=l}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}});var n=new i.FSStream;for(var a in e)n[a]=e[a];e=n;var s=i.nextfd(t,r);return e.fd=s,i.streams[s]=e,e},closeStream:function(e){i.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=i.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new i.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return e&255},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){i.devices[e]={stream_ops:t}},getDevice:function(e){return i.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs:function(e,t){typeof e=="function"&&(t=e,e=!1),i.syncFSRequests++,i.syncFSRequests>1&&ue("warning: "+i.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=i.getMounts(i.root.mount),n=0;function a(l){return i.syncFSRequests--,t(l)}function s(l){if(l)return s.errored?void 0:(s.errored=!0,a(l));++n>=r.length&&a(null)}r.forEach(function(l){if(!l.type.syncfs)return s(null);l.type.syncfs(l,e,s)})},mount:function(e,t,r){var n=r==="/",a=!r,s;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!a){var l=i.lookupPath(r,{follow_mount:!1});if(r=l.path,s=l.node,i.isMountpoint(s))throw new i.ErrnoError(10);if(!i.isDir(s.mode))throw new i.ErrnoError(54)}var u={type:e,opts:t,mountpoint:r,mounts:[]},c=e.mount(u);return c.mount=u,u.root=c,n?i.root=c:s&&(s.mounted=u,s.mount&&s.mount.mounts.push(u)),c},unmount:function(e){var t=i.lookupPath(e,{follow_mount:!1});if(!i.isMountpoint(t.node))throw new i.ErrnoError(28);var r=t.node,n=r.mounted,a=i.getMounts(n);Object.keys(i.nameTable).forEach(function(l){for(var u=i.nameTable[l];u;){var c=u.name_next;a.includes(u.mount)&&i.destroyNode(u),u=c}}),r.mounted=null;var s=r.mount.mounts.indexOf(n);r.mount.mounts.splice(s,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var n=i.lookupPath(e,{parent:!0}),a=n.node,s=Z.basename(e);if(!s||s==="."||s==="..")throw new i.ErrnoError(28);var l=i.mayCreate(a,s);if(l)throw new i.ErrnoError(l);if(!a.node_ops.mknod)throw new i.ErrnoError(63);return a.node_ops.mknod(a,s,t,r)},create:function(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,i.mknod(e,t,0)},mkdir:function(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,i.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),n="",a=0;a<r.length;++a)if(r[a]){n+="/"+r[a];try{i.mkdir(n,t)}catch(s){if(s.errno!=20)throw s}}},mkdev:function(e,t,r){return typeof r>"u"&&(r=t,t=438),t|=8192,i.mknod(e,t,r)},symlink:function(e,t){if(!Me.resolve(e))throw new i.ErrnoError(44);var r=i.lookupPath(t,{parent:!0}),n=r.node;if(!n)throw new i.ErrnoError(44);var a=Z.basename(t),s=i.mayCreate(n,a);if(s)throw new i.ErrnoError(s);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,a,e)},rename:function(e,t){var r=Z.dirname(e),n=Z.dirname(t),a=Z.basename(e),s=Z.basename(t),l,u,c;if(l=i.lookupPath(e,{parent:!0}),u=l.node,l=i.lookupPath(t,{parent:!0}),c=l.node,!u||!c)throw new i.ErrnoError(44);if(u.mount!==c.mount)throw new i.ErrnoError(75);var d=i.lookupNode(u,a),m=Me.relative(e,n);if(m.charAt(0)!==".")throw new i.ErrnoError(28);if(m=Me.relative(t,r),m.charAt(0)!==".")throw new i.ErrnoError(55);var g;try{g=i.lookupNode(c,s)}catch{}if(d!==g){var p=i.isDir(d.mode),v=i.mayDelete(u,a,p);if(v)throw new i.ErrnoError(v);if(v=g?i.mayDelete(c,s,p):i.mayCreate(c,s),v)throw new i.ErrnoError(v);if(!u.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(d)||g&&i.isMountpoint(g))throw new i.ErrnoError(10);if(c!==u&&(v=i.nodePermissions(u,"w"),v))throw new i.ErrnoError(v);try{i.trackingDelegate.willMovePath&&i.trackingDelegate.willMovePath(e,t)}catch(E){ue("FS.trackingDelegate['willMovePath']('"+e+"', '"+t+"') threw an exception: "+E.message)}i.hashRemoveNode(d);try{u.node_ops.rename(d,c,s)}catch(E){throw E}finally{i.hashAddNode(d)}try{i.trackingDelegate.onMovePath&&i.trackingDelegate.onMovePath(e,t)}catch(E){ue("FS.trackingDelegate['onMovePath']('"+e+"', '"+t+"') threw an exception: "+E.message)}}},rmdir:function(e){var t=i.lookupPath(e,{parent:!0}),r=t.node,n=Z.basename(e),a=i.lookupNode(r,n),s=i.mayDelete(r,n,!0);if(s)throw new i.ErrnoError(s);if(!r.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(a))throw new i.ErrnoError(10);try{i.trackingDelegate.willDeletePath&&i.trackingDelegate.willDeletePath(e)}catch(l){ue("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+l.message)}r.node_ops.rmdir(r,n),i.destroyNode(a);try{i.trackingDelegate.onDeletePath&&i.trackingDelegate.onDeletePath(e)}catch(l){ue("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+l.message)}},readdir:function(e){var t=i.lookupPath(e,{follow:!0}),r=t.node;if(!r.node_ops.readdir)throw new i.ErrnoError(54);return r.node_ops.readdir(r)},unlink:function(e){var t=i.lookupPath(e,{parent:!0}),r=t.node,n=Z.basename(e),a=i.lookupNode(r,n),s=i.mayDelete(r,n,!1);if(s)throw new i.ErrnoError(s);if(!r.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(a))throw new i.ErrnoError(10);try{i.trackingDelegate.willDeletePath&&i.trackingDelegate.willDeletePath(e)}catch(l){ue("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+l.message)}r.node_ops.unlink(r,n),i.destroyNode(a);try{i.trackingDelegate.onDeletePath&&i.trackingDelegate.onDeletePath(e)}catch(l){ue("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+l.message)}},readlink:function(e){var t=i.lookupPath(e),r=t.node;if(!r)throw new i.ErrnoError(44);if(!r.node_ops.readlink)throw new i.ErrnoError(28);return Me.resolve(i.getPath(r.parent),r.node_ops.readlink(r))},stat:function(e,t){var r=i.lookupPath(e,{follow:!t}),n=r.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat:function(e){return i.stat(e,!0)},chmod:function(e,t,r){var n;if(typeof e=="string"){var a=i.lookupPath(e,{follow:!r});n=a.node}else n=e;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:t&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:function(e,t){i.chmod(e,t,!0)},fchmod:function(e,t){var r=i.getStream(e);if(!r)throw new i.ErrnoError(8);i.chmod(r.node,t)},chown:function(e,t,r,n){var a;if(typeof e=="string"){var s=i.lookupPath(e,{follow:!n});a=s.node}else a=e;if(!a.node_ops.setattr)throw new i.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown:function(e,t,r){i.chown(e,t,r,!0)},fchown:function(e,t,r){var n=i.getStream(e);if(!n)throw new i.ErrnoError(8);i.chown(n.node,t,r)},truncate:function(e,t){if(t<0)throw new i.ErrnoError(28);var r;if(typeof e=="string"){var n=i.lookupPath(e,{follow:!0});r=n.node}else r=e;if(!r.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(r.mode))throw new i.ErrnoError(31);if(!i.isFile(r.mode))throw new i.ErrnoError(28);var a=i.nodePermissions(r,"w");if(a)throw new i.ErrnoError(a);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:function(e,t){var r=i.getStream(e);if(!r)throw new i.ErrnoError(8);if((r.flags&2097155)===0)throw new i.ErrnoError(28);i.truncate(r.node,t)},utime:function(e,t,r){var n=i.lookupPath(e,{follow:!0}),a=n.node;a.node_ops.setattr(a,{timestamp:Math.max(t,r)})},open:function(e,t,r,n,a){if(e==="")throw new i.ErrnoError(44);t=typeof t=="string"?i.modeStringToFlags(t):t,r=typeof r>"u"?438:r,t&64?r=r&4095|32768:r=0;var s;if(typeof e=="object")s=e;else{e=Z.normalize(e);try{var l=i.lookupPath(e,{follow:!(t&131072)});s=l.node}catch{}}var u=!1;if(t&64)if(s){if(t&128)throw new i.ErrnoError(20)}else s=i.mknod(e,r,0),u=!0;if(!s)throw new i.ErrnoError(44);if(i.isChrdev(s.mode)&&(t&=-513),t&65536&&!i.isDir(s.mode))throw new i.ErrnoError(54);if(!u){var c=i.mayOpen(s,t);if(c)throw new i.ErrnoError(c)}t&512&&i.truncate(s,0),t&=-131713;var d=i.createStream({node:s,path:i.getPath(s),flags:t,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1},n,a);d.stream_ops.open&&d.stream_ops.open(d),o.logReadFiles&&!(t&1)&&(i.readFiles||(i.readFiles={}),e in i.readFiles||(i.readFiles[e]=1,ue("FS.trackingDelegate error on read file: "+e)));try{if(i.trackingDelegate.onOpenFile){var m=0;(t&2097155)!==1&&(m|=i.tracking.openFlags.READ),(t&2097155)!==0&&(m|=i.tracking.openFlags.WRITE),i.trackingDelegate.onOpenFile(e,m)}}catch(g){ue("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+g.message)}return d},close:function(e){if(i.isClosed(e))throw new i.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{i.closeStream(e.fd)}e.fd=null},isClosed:function(e){return e.fd===null},llseek:function(e,t,r){if(i.isClosed(e))throw new i.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new i.ErrnoError(70);if(r!=0&&r!=1&&r!=2)throw new i.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:function(e,t,r,n,a){if(n<0||a<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if((e.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.read)throw new i.ErrnoError(28);var s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var l=e.stream_ops.read(e,t,r,n,a);return s||(e.position+=l),l},write:function(e,t,r,n,a,s){if(n<0||a<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if((e.flags&2097155)===0)throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.write)throw new i.ErrnoError(28);e.seekable&&e.flags&1024&&i.llseek(e,0,2);var l=typeof a<"u";if(!l)a=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var u=e.stream_ops.write(e,t,r,n,a,s);l||(e.position+=u);try{e.path&&i.trackingDelegate.onWriteToFile&&i.trackingDelegate.onWriteToFile(e.path)}catch(c){ue("FS.trackingDelegate['onWriteToFile']('"+e.path+"') threw an exception: "+c.message)}return u},allocate:function(e,t,r){if(i.isClosed(e))throw new i.ErrnoError(8);if(t<0||r<=0)throw new i.ErrnoError(28);if((e.flags&2097155)===0)throw new i.ErrnoError(8);if(!i.isFile(e.node.mode)&&!i.isDir(e.node.mode))throw new i.ErrnoError(43);if(!e.stream_ops.allocate)throw new i.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:function(e,t,r,n,a,s){if((a&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new i.ErrnoError(2);if((e.flags&2097155)===1)throw new i.ErrnoError(2);if(!e.stream_ops.mmap)throw new i.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,a,s)},msync:function(e,t,r,n,a){return!e||!e.stream_ops.msync?0:e.stream_ops.msync(e,t,r,n,a)},munmap:function(e){return 0},ioctl:function(e,t,r){if(!e.stream_ops.ioctl)throw new i.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e,t){if(t=t||{},t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error('Invalid encoding type "'+t.encoding+'"');var r,n=i.open(e,t.flags),a=i.stat(e),s=a.size,l=new Uint8Array(s);return i.read(n,l,0,s,0),t.encoding==="utf8"?r=Ge(l,0):t.encoding==="binary"&&(r=l),i.close(n),r},writeFile:function(e,t,r){r=r||{},r.flags=r.flags||577;var n=i.open(e,r.flags,r.mode);if(typeof t=="string"){var a=new Uint8Array(gt(t)+1),s=Kt(t,a,0,a.length);i.write(n,a,0,s,void 0,r.canOwn)}else if(ArrayBuffer.isView(t))i.write(n,t,0,t.byteLength,void 0,r.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:function(){return i.currentPath},chdir:function(e){var t=i.lookupPath(e,{follow:!0});if(t.node===null)throw new i.ErrnoError(44);if(!i.isDir(t.node.mode))throw new i.ErrnoError(54);var r=i.nodePermissions(t.node,"x");if(r)throw new i.ErrnoError(r);i.currentPath=t.path},createDefaultDirectories:function(){i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices:function(){i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:function(){return 0},write:function(t,r,n,a,s){return a}}),i.mkdev("/dev/null",i.makedev(1,3)),Ue.register(i.makedev(5,0),Ue.default_tty_ops),Ue.register(i.makedev(6,0),Ue.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var e=la();i.createDevice("/dev","random",e),i.createDevice("/dev","urandom",e),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){i.mkdir("/proc");var e=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount:function(){var t=i.createNode(e,"fd",16895,73);return t.node_ops={lookup:function(r,n){var a=+n,s=i.getStream(a);if(!s)throw new i.ErrnoError(8);var l={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return s.path}}};return l.parent=l,l}},t}},{},"/proc/self/fd")},createStandardStreams:function(){o.stdin?i.createDevice("/dev","stdin",o.stdin):i.symlink("/dev/tty","/dev/stdin"),o.stdout?i.createDevice("/dev","stdout",null,o.stdout):i.symlink("/dev/tty","/dev/stdout"),o.stderr?i.createDevice("/dev","stderr",null,o.stderr):i.symlink("/dev/tty1","/dev/stderr"),i.open("/dev/stdin",0),i.open("/dev/stdout",1),i.open("/dev/stderr",1)},ensureErrnoError:function(){i.ErrnoError||(i.ErrnoError=function(e,t){this.node=t,this.setErrno=function(r){this.errno=r},this.setErrno(e),this.message="FS error"},i.ErrnoError.prototype=new Error,i.ErrnoError.prototype.constructor=i.ErrnoError,[44].forEach(function(e){i.genericErrors[e]=new i.ErrnoError(e),i.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:function(){i.ensureErrnoError(),i.nameTable=new Array(4096),i.mount(U,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:U}},init:function(e,t,r){i.init.initialized=!0,i.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=t||o.stdout,o.stderr=r||o.stderr,i.createStandardStreams()},quit:function(){i.init.initialized=!1;var e=o._fflush;e&&e(0);for(var t=0;t<i.streams.length;t++){var r=i.streams[t];r&&i.close(r)}},getMode:function(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:function(e,t){var r=i.analyzePath(e,t);return r.exists?r.object:null},analyzePath:function(e,t){try{var r=i.lookupPath(e,{follow:!t});e=r.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var r=i.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=r.path,n.parentObject=r.node,n.name=Z.basename(e),r=i.lookupPath(e,{follow:!t}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot=r.path==="/"}catch(a){n.error=a.errno}return n},createPath:function(e,t,r,n){e=typeof e=="string"?e:i.getPath(e);for(var a=t.split("/").reverse();a.length;){var s=a.pop();if(s){var l=Z.join2(e,s);try{i.mkdir(l)}catch{}e=l}}return l},createFile:function(e,t,r,n,a){var s=Z.join2(typeof e=="string"?e:i.getPath(e),t),l=i.getMode(n,a);return i.create(s,l)},createDataFile:function(e,t,r,n,a,s){var l=t?Z.join2(typeof e=="string"?e:i.getPath(e),t):e,u=i.getMode(n,a),c=i.create(l,u);if(r){if(typeof r=="string"){for(var d=new Array(r.length),m=0,g=r.length;m<g;++m)d[m]=r.charCodeAt(m);r=d}i.chmod(c,u|146);var p=i.open(c,577);i.write(p,r,0,r.length,0,s),i.close(p),i.chmod(c,u)}return c},createDevice:function(e,t,r,n){var a=Z.join2(typeof e=="string"?e:i.getPath(e),t),s=i.getMode(!!r,!!n);i.createDevice.major||(i.createDevice.major=64);var l=i.makedev(i.createDevice.major++,0);return i.registerDevice(l,{open:function(u){u.seekable=!1},close:function(u){n&&n.buffer&&n.buffer.length&&n(10)},read:function(u,c,d,m,g){for(var p=0,v=0;v<m;v++){var E;try{E=r()}catch{throw new i.ErrnoError(29)}if(E===void 0&&p===0)throw new i.ErrnoError(6);if(E==null)break;p++,c[d+v]=E}return p&&(u.node.timestamp=Date.now()),p},write:function(u,c,d,m,g){for(var p=0;p<m;p++)try{n(c[d+p])}catch{throw new i.ErrnoError(29)}return m&&(u.node.timestamp=Date.now()),p}}),i.mkdev(a,s,l)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("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.");if(G)try{e.contents=$t(G(e.url),!0),e.usedBytes=e.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:function(e,t,r,n,a){function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(g){if(!(g>this.length-1||g<0)){var p=g%this.chunkSize,v=g/this.chunkSize|0;return this.getter(v)[p]}},s.prototype.setDataGetter=function(g){this.getter=g},s.prototype.cacheLength=function(){var g=new XMLHttpRequest;if(g.open("HEAD",r,!1),g.send(null),!(g.status>=200&&g.status<300||g.status===304))throw new Error("Couldn't load "+r+". Status: "+g.status);var p=Number(g.getResponseHeader("Content-length")),v,E=(v=g.getResponseHeader("Accept-Ranges"))&&v==="bytes",T=(v=g.getResponseHeader("Content-Encoding"))&&v==="gzip",C=1024*1024;E||(C=p);var H=function(F,q){if(F>q)throw new Error("invalid range ("+F+", "+q+") or no bytes requested!");if(q>p-1)throw new Error("only "+p+" bytes available! programmer error!");var D=new XMLHttpRequest;if(D.open("GET",r,!1),p!==C&&D.setRequestHeader("Range","bytes="+F+"-"+q),typeof Uint8Array<"u"&&(D.responseType="arraybuffer"),D.overrideMimeType&&D.overrideMimeType("text/plain; charset=x-user-defined"),D.send(null),!(D.status>=200&&D.status<300||D.status===304))throw new Error("Couldn't load "+r+". Status: "+D.status);return D.response!==void 0?new Uint8Array(D.response||[]):$t(D.responseText||"",!0)},h=this;h.setDataGetter(function(F){var q=F*C,D=(F+1)*C-1;if(D=Math.min(D,p-1),typeof h.chunks[F]>"u"&&(h.chunks[F]=H(q,D)),typeof h.chunks[F]>"u")throw new Error("doXHR failed!");return h.chunks[F]}),(T||!p)&&(C=p=1,p=this.getter(0).length,C=p,We("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=p,this._chunkSize=C,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!$)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var l=new s;Object.defineProperties(l,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:l}}else var u={isDevice:!1,url:r};var c=i.createFile(e,t,u,n,a);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var d={},m=Object.keys(c.stream_ops);return m.forEach(function(g){var p=c.stream_ops[g];d[g]=function(){return i.forceLoadFile(c),p.apply(null,arguments)}}),d.read=function(g,p,v,E,T){i.forceLoadFile(c);var C=g.node.contents;if(T>=C.length)return 0;var H=Math.min(C.length-T,E);if(C.slice)for(var h=0;h<H;h++)p[v+h]=C[T+h];else for(var h=0;h<H;h++)p[v+h]=C.get(T+h);return H},c.stream_ops=d,c},createPreloadedFile:function(e,t,r,n,a,s,l,u,c,d){Browser.init();var m=t?Me.resolve(Z.join2(e,t)):e;function g(p){function v(T){d&&d(),u||i.createDataFile(e,t,T,n,a,c),s&&s(),ht()}var E=!1;o.preloadPlugins.forEach(function(T){E||T.canHandle(m)&&(T.handle(p,m,v,function(){l&&l(),ht()}),E=!0)}),E||v(p)}It(),typeof r=="string"?Browser.asyncLoad(r,function(p){g(p)},l):g(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=i.indexedDB();try{var a=n.open(i.DB_NAME(),i.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=function(){We("creating db");var s=a.result;s.createObjectStore(i.DB_STORE_NAME)},a.onsuccess=function(){var s=a.result,l=s.transaction([i.DB_STORE_NAME],"readwrite"),u=l.objectStore(i.DB_STORE_NAME),c=0,d=0,m=e.length;function g(){d==0?t():r()}e.forEach(function(p){var v=u.put(i.analyzePath(p).object.contents,p);v.onsuccess=function(){c++,c+d==m&&g()},v.onerror=function(){d++,c+d==m&&g()}}),l.onerror=r},a.onerror=r},loadFilesFromDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=i.indexedDB();try{var a=n.open(i.DB_NAME(),i.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=r,a.onsuccess=function(){var s=a.result;try{var l=s.transaction([i.DB_STORE_NAME],"readonly")}catch(p){r(p);return}var u=l.objectStore(i.DB_STORE_NAME),c=0,d=0,m=e.length;function g(){d==0?t():r()}e.forEach(function(p){var v=u.get(p);v.onsuccess=function(){i.analyzePath(p).exists&&i.unlink(p),i.createDataFile(Z.dirname(p),Z.basename(p),v.result,!0,!0,!0),c++,c+d==m&&g()},v.onerror=function(){d++,c+d==m&&g()}}),l.onerror=r},a.onerror=r}},te={mappings:{},DEFAULT_POLLMASK:5,umask:511,calculateAt:function(e,t,r){if(t[0]==="/")return t;var n;if(e===-100)n=i.cwd();else{var a=i.getStream(e);if(!a)throw new i.ErrnoError(8);n=a.path}if(t.length==0){if(!r)throw new i.ErrnoError(44);return n}return Z.join2(n,t)},doStat:function(e,t,r){try{var n=e(t)}catch(a){if(a&&a.node&&Z.normalize(t)!==Z.normalize(i.getPath(a.node)))return-54;throw a}return w[r>>2]=n.dev,w[r+4>>2]=0,w[r+8>>2]=n.ino,w[r+12>>2]=n.mode,w[r+16>>2]=n.nlink,w[r+20>>2]=n.uid,w[r+24>>2]=n.gid,w[r+28>>2]=n.rdev,w[r+32>>2]=0,me=[n.size>>>0,(A=n.size,+Math.abs(A)>=1?A>0?(Math.min(+Math.floor(A/4294967296),4294967295)|0)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],w[r+40>>2]=me[0],w[r+44>>2]=me[1],w[r+48>>2]=4096,w[r+52>>2]=n.blocks,w[r+56>>2]=n.atime.getTime()/1e3|0,w[r+60>>2]=0,w[r+64>>2]=n.mtime.getTime()/1e3|0,w[r+68>>2]=0,w[r+72>>2]=n.ctime.getTime()/1e3|0,w[r+76>>2]=0,me=[n.ino>>>0,(A=n.ino,+Math.abs(A)>=1?A>0?(Math.min(+Math.floor(A/4294967296),4294967295)|0)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],w[r+80>>2]=me[0],w[r+84>>2]=me[1],0},doMsync:function(e,t,r,n,a){var s=de.slice(e,e+r);i.msync(t,s,a,r,n)},doMkdir:function(e,t){return e=Z.normalize(e),e[e.length-1]==="/"&&(e=e.substr(0,e.length-1)),i.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(t&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return i.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var n=i.readlink(e),a=Math.min(r,gt(n)),s=oe[t+a];return Zt(n,t,r+1),oe[t+a]=s,a},doAccess:function(e,t){if(t&-8)return-28;var r,n=i.lookupPath(e,{follow:!0});if(r=n.node,!r)return-44;var a="";return t&4&&(a+="r"),t&2&&(a+="w"),t&1&&(a+="x"),a&&i.nodePermissions(r,a)?-2:0},doDup:function(e,t,r){var n=i.getStream(r);return n&&i.close(n),i.open(e,t,0,r,r).fd},doReadv:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var l=w[t+s*8>>2],u=w[t+(s*8+4)>>2],c=i.read(e,oe,l,u,n);if(c<0)return-1;if(a+=c,c<u)break}return a},doWritev:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var l=w[t+s*8>>2],u=w[t+(s*8+4)>>2],c=i.write(e,oe,l,u,n);if(c<0)return-1;a+=c}return a},varargs:void 0,get:function(){te.varargs+=4;var e=w[te.varargs-4>>2];return e},getStr:function(e){var t=$e(e);return t},getStreamFromFD:function(e){var t=i.getStream(e);if(!t)throw new i.ErrnoError(8);return t},get64:function(e,t){return e}};function ca(e,t,r){te.varargs=r;try{var n=te.getStreamFromFD(e);switch(t){case 0:{var a=te.get();if(a<0)return-28;var s;return s=i.open(n.path,n.flags,0,a),s.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var a=te.get();return n.flags|=a,0}case 12:{var a=te.get(),l=0;return Se[a+l>>1]=2,0}case 13:case 14:return 0;case 16:case 8:return-28;case 9:return sa(28),-1;default:return-28}}catch(u){return(typeof i>"u"||!(u instanceof i.ErrnoError))&&ae(u),-u.errno}}function da(e,t,r){try{var n=te.getStreamFromFD(e);n.getdents||(n.getdents=i.readdir(n.path));for(var a=280,s=0,l=i.llseek(n,0,1),u=Math.floor(l/a);u<n.getdents.length&&s+a<=r;){var c,d,m=n.getdents[u];if(m[0]===".")c=1,d=4;else{var g=i.lookupNode(n.node,m);c=g.id,d=i.isChrdev(g.mode)?2:i.isDir(g.mode)?4:i.isLink(g.mode)?10:8}me=[c>>>0,(A=c,+Math.abs(A)>=1?A>0?(Math.min(+Math.floor(A/4294967296),4294967295)|0)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],w[t+s>>2]=me[0],w[t+s+4>>2]=me[1],me=[(u+1)*a>>>0,(A=(u+1)*a,+Math.abs(A)>=1?A>0?(Math.min(+Math.floor(A/4294967296),4294967295)|0)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],w[t+s+8>>2]=me[0],w[t+s+12>>2]=me[1],Se[t+s+16>>1]=280,oe[t+s+18>>0]=d,Zt(m,t+s+19,256),s+=a,u+=1}return i.llseek(n,u*a,0),s}catch(p){return(typeof i>"u"||!(p instanceof i.ErrnoError))&&ae(p),-p.errno}}function fa(e,t,r){te.varargs=r;try{var n=te.getStreamFromFD(e);switch(t){case 21509:case 21505:return n.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return n.tty?0:-59;case 21519:{if(!n.tty)return-59;var a=te.get();return w[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=te.get();return i.ioctl(n,t,a)}case 21523:return n.tty?0:-59;case 21524:return n.tty?0:-59;default:ae("bad ioctl syscall "+t)}}catch(s){return(typeof i>"u"||!(s instanceof i.ErrnoError))&&ae(s),-s.errno}}function ma(e,t,r){te.varargs=r;try{var n=te.getStr(e),a=r?te.get():0,s=i.open(n,t,a);return s.fd}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),-l.errno}}function ga(e,t){try{return e=te.getStr(e),te.doStat(i.stat,e,t)}catch(r){return(typeof i>"u"||!(r instanceof i.ErrnoError))&&ae(r),-r.errno}}var vt={};function He(e){for(;e.length;){var t=e.pop(),r=e.pop();r(t)}}function rt(e){return this.fromWireType(ye[e>>2])}var Ve={},Le={},yt={},pa=48,ha=57;function wt(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=pa&&t<=ha?"_"+e:e}function xt(e,t){return e=wt(e),new Function("body","return function "+e+`() {
3
+ `));if(!t)return null;e.input=jt(t,!0)}return e.input.shift()},put_char:function(e,t){t===null||t===10?(We(Ge(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(We(Ge(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){t===null||t===10?(ue(Ge(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(ue(Ge(e.output,0)),e.output=[])}}};function ua(e){for(var t=Mn(e,65536),r=Je(t);e<t;)oe[r+e++]=0;return r}var U={ops_table:null,mount:function(e){return U.createNode(null,"/",16895,0)},createNode:function(e,t,r,n){if(i.isBlkdev(r)||i.isFIFO(r))throw new i.ErrnoError(63);U.ops_table||(U.ops_table={dir:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr,lookup:U.node_ops.lookup,mknod:U.node_ops.mknod,rename:U.node_ops.rename,unlink:U.node_ops.unlink,rmdir:U.node_ops.rmdir,readdir:U.node_ops.readdir,symlink:U.node_ops.symlink},stream:{llseek:U.stream_ops.llseek}},file:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr},stream:{llseek:U.stream_ops.llseek,read:U.stream_ops.read,write:U.stream_ops.write,allocate:U.stream_ops.allocate,mmap:U.stream_ops.mmap,msync:U.stream_ops.msync}},link:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr,readlink:U.node_ops.readlink},stream:{}},chrdev:{node:{getattr:U.node_ops.getattr,setattr:U.node_ops.setattr},stream:i.chrdev_stream_ops}});var a=i.createNode(e,t,r,n);return i.isDir(a.mode)?(a.node_ops=U.ops_table.dir.node,a.stream_ops=U.ops_table.dir.stream,a.contents={}):i.isFile(a.mode)?(a.node_ops=U.ops_table.file.node,a.stream_ops=U.ops_table.file.stream,a.usedBytes=0,a.contents=null):i.isLink(a.mode)?(a.node_ops=U.ops_table.link.node,a.stream_ops=U.ops_table.link.stream):i.isChrdev(a.mode)&&(a.node_ops=U.ops_table.chrdev.node,a.stream_ops=U.ops_table.chrdev.stream),a.timestamp=Date.now(),e&&(e.contents[t]=a,e.timestamp=a.timestamp),a},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){var n=1048576;t=Math.max(t,r*(r<n?2:1.125)>>>0),r!=0&&(t=Math.max(t,256));var a=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(t==0)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:function(e){var t={};return t.dev=i.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,i.isDir(e.mode)?t.size=4096:i.isFile(e.mode)?t.size=e.usedBytes:i.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&U.resizeFileStorage(e,t.size)},lookup:function(e,t){throw i.genericErrors[44]},mknod:function(e,t,r,n){return U.createNode(e,t,r,n)},rename:function(e,t,r){if(i.isDir(e.mode)){var n;try{n=i.lookupNode(t,r)}catch{}if(n)for(var a in n.contents)throw new i.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=i.lookupNode(e,t);for(var n in r.contents)throw new i.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var n=U.createNode(e,t,41471,0);return n.link=r,n},readlink:function(e){if(!i.isLink(e.mode))throw new i.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,n,a){var s=e.node.contents;if(a>=e.node.usedBytes)return 0;var l=Math.min(e.node.usedBytes-a,n);if(l>8&&s.subarray)t.set(s.subarray(a,a+l),r);else for(var u=0;u<l;u++)t[r+u]=s[a+u];return l},write:function(e,t,r,n,a,s){if(t.buffer===oe.buffer&&(s=!1),!n)return 0;var l=e.node;if(l.timestamp=Date.now(),t.subarray&&(!l.contents||l.contents.subarray)){if(s)return l.contents=t.subarray(r,r+n),l.usedBytes=n,n;if(l.usedBytes===0&&a===0)return l.contents=t.slice(r,r+n),l.usedBytes=n,n;if(a+n<=l.usedBytes)return l.contents.set(t.subarray(r,r+n),a),n}if(U.expandFileStorage(l,a+n),l.contents.subarray&&t.subarray)l.contents.set(t.subarray(r,r+n),a);else for(var u=0;u<n;u++)l.contents[a+u]=t[r+u];return l.usedBytes=Math.max(l.usedBytes,a+n),n},llseek:function(e,t,r){var n=t;if(r===1?n+=e.position:r===2&&i.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate:function(e,t,r){U.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,n,a,s){if(t!==0)throw new i.ErrnoError(28);if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);var l,u,c=e.node.contents;if(!(s&2)&&c.buffer===gt)u=!1,l=c.byteOffset;else{if((n>0||n+r<c.length)&&(c.subarray?c=c.subarray(n,n+r):c=Array.prototype.slice.call(c,n,n+r)),u=!0,l=ua(r),!l)throw new i.ErrnoError(48);oe.set(c,l)}return{ptr:l,allocated:u}},msync:function(e,t,r,n,a){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);return a&2||U.stream_ops.write(e,t,0,n,r,!1),0}}},i={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(e,t){if(e=Me.resolve(i.cwd(),e),t=t||{},!e)return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var n in r)t[n]===void 0&&(t[n]=r[n]);if(t.recurse_count>8)throw new i.ErrnoError(32);for(var a=A.normalizeArray(e.split("/").filter(function(p){return!!p}),!1),s=i.root,l="/",u=0;u<a.length;u++){var c=u===a.length-1;if(c&&t.parent)break;if(s=i.lookupNode(s,a[u]),l=A.join2(l,a[u]),i.isMountpoint(s)&&(!c||c&&t.follow_mount)&&(s=s.mounted.root),!c||t.follow)for(var d=0;i.isLink(s.mode);){var f=i.readlink(l);l=Me.resolve(A.dirname(l),f);var g=i.lookupPath(l,{recurse_count:t.recurse_count});if(s=g.node,d++>40)throw new i.ErrnoError(32)}}return{path:l,node:s}},getPath:function(e){for(var t;;){if(i.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:function(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%i.nameTable.length},hashAddNode:function(e){var t=i.hashName(e.parent.id,e.name);e.name_next=i.nameTable[t],i.nameTable[t]=e},hashRemoveNode:function(e){var t=i.hashName(e.parent.id,e.name);if(i.nameTable[t]===e)i.nameTable[t]=e.name_next;else for(var r=i.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=i.mayLookup(e);if(r)throw new i.ErrnoError(r,e);for(var n=i.hashName(e.id,t),a=i.nameTable[n];a;a=a.name_next){var s=a.name;if(a.parent.id===e.id&&s===t)return a}return i.lookup(e,t)},createNode:function(e,t,r,n){var a=new i.FSNode(e,t,r,n);return i.hashAddNode(a),a},destroyNode:function(e){i.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return(e&61440)===32768},isDir:function(e){return(e&61440)===16384},isLink:function(e){return(e&61440)===40960},isChrdev:function(e){return(e&61440)===8192},isBlkdev:function(e){return(e&61440)===24576},isFIFO:function(e){return(e&61440)===4096},isSocket:function(e){return(e&49152)===49152},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(e){var t=i.flagModes[e];if(typeof t>"u")throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions:function(e,t){return 0},mayLookup:function(e){var t=i.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{var r=i.lookupNode(e,t);return 20}catch{}return i.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var n;try{n=i.lookupNode(e,t)}catch(s){return s.errno}var a=i.nodePermissions(e,"wx");if(a)return a;if(r){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen:function(e,t){return e?i.isLink(e.mode)?32:i.isDir(e.mode)&&(i.flagsToPermissionString(t)!=="r"||t&512)?31:i.nodePermissions(e,i.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||i.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!i.streams[r])return r;throw new i.ErrnoError(33)},getStream:function(e){return i.streams[e]},createStream:function(e,t,r){i.FSStream||(i.FSStream=function(){},i.FSStream.prototype={object:{get:function(){return this.node},set:function(l){this.node=l}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}});var n=new i.FSStream;for(var a in e)n[a]=e[a];e=n;var s=i.nextfd(t,r);return e.fd=s,i.streams[s]=e,e},closeStream:function(e){i.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=i.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new i.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return e&255},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){i.devices[e]={stream_ops:t}},getDevice:function(e){return i.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs:function(e,t){typeof e=="function"&&(t=e,e=!1),i.syncFSRequests++,i.syncFSRequests>1&&ue("warning: "+i.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=i.getMounts(i.root.mount),n=0;function a(l){return i.syncFSRequests--,t(l)}function s(l){if(l)return s.errored?void 0:(s.errored=!0,a(l));++n>=r.length&&a(null)}r.forEach(function(l){if(!l.type.syncfs)return s(null);l.type.syncfs(l,e,s)})},mount:function(e,t,r){var n=r==="/",a=!r,s;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!a){var l=i.lookupPath(r,{follow_mount:!1});if(r=l.path,s=l.node,i.isMountpoint(s))throw new i.ErrnoError(10);if(!i.isDir(s.mode))throw new i.ErrnoError(54)}var u={type:e,opts:t,mountpoint:r,mounts:[]},c=e.mount(u);return c.mount=u,u.root=c,n?i.root=c:s&&(s.mounted=u,s.mount&&s.mount.mounts.push(u)),c},unmount:function(e){var t=i.lookupPath(e,{follow_mount:!1});if(!i.isMountpoint(t.node))throw new i.ErrnoError(28);var r=t.node,n=r.mounted,a=i.getMounts(n);Object.keys(i.nameTable).forEach(function(l){for(var u=i.nameTable[l];u;){var c=u.name_next;a.includes(u.mount)&&i.destroyNode(u),u=c}}),r.mounted=null;var s=r.mount.mounts.indexOf(n);r.mount.mounts.splice(s,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var n=i.lookupPath(e,{parent:!0}),a=n.node,s=A.basename(e);if(!s||s==="."||s==="..")throw new i.ErrnoError(28);var l=i.mayCreate(a,s);if(l)throw new i.ErrnoError(l);if(!a.node_ops.mknod)throw new i.ErrnoError(63);return a.node_ops.mknod(a,s,t,r)},create:function(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,i.mknod(e,t,0)},mkdir:function(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,i.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),n="",a=0;a<r.length;++a)if(r[a]){n+="/"+r[a];try{i.mkdir(n,t)}catch(s){if(s.errno!=20)throw s}}},mkdev:function(e,t,r){return typeof r>"u"&&(r=t,t=438),t|=8192,i.mknod(e,t,r)},symlink:function(e,t){if(!Me.resolve(e))throw new i.ErrnoError(44);var r=i.lookupPath(t,{parent:!0}),n=r.node;if(!n)throw new i.ErrnoError(44);var a=A.basename(t),s=i.mayCreate(n,a);if(s)throw new i.ErrnoError(s);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,a,e)},rename:function(e,t){var r=A.dirname(e),n=A.dirname(t),a=A.basename(e),s=A.basename(t),l,u,c;if(l=i.lookupPath(e,{parent:!0}),u=l.node,l=i.lookupPath(t,{parent:!0}),c=l.node,!u||!c)throw new i.ErrnoError(44);if(u.mount!==c.mount)throw new i.ErrnoError(75);var d=i.lookupNode(u,a),f=Me.relative(e,n);if(f.charAt(0)!==".")throw new i.ErrnoError(28);if(f=Me.relative(t,r),f.charAt(0)!==".")throw new i.ErrnoError(55);var g;try{g=i.lookupNode(c,s)}catch{}if(d!==g){var p=i.isDir(d.mode),v=i.mayDelete(u,a,p);if(v)throw new i.ErrnoError(v);if(v=g?i.mayDelete(c,s,p):i.mayCreate(c,s),v)throw new i.ErrnoError(v);if(!u.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(d)||g&&i.isMountpoint(g))throw new i.ErrnoError(10);if(c!==u&&(v=i.nodePermissions(u,"w"),v))throw new i.ErrnoError(v);try{i.trackingDelegate.willMovePath&&i.trackingDelegate.willMovePath(e,t)}catch(E){ue("FS.trackingDelegate['willMovePath']('"+e+"', '"+t+"') threw an exception: "+E.message)}i.hashRemoveNode(d);try{u.node_ops.rename(d,c,s)}catch(E){throw E}finally{i.hashAddNode(d)}try{i.trackingDelegate.onMovePath&&i.trackingDelegate.onMovePath(e,t)}catch(E){ue("FS.trackingDelegate['onMovePath']('"+e+"', '"+t+"') threw an exception: "+E.message)}}},rmdir:function(e){var t=i.lookupPath(e,{parent:!0}),r=t.node,n=A.basename(e),a=i.lookupNode(r,n),s=i.mayDelete(r,n,!0);if(s)throw new i.ErrnoError(s);if(!r.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(a))throw new i.ErrnoError(10);try{i.trackingDelegate.willDeletePath&&i.trackingDelegate.willDeletePath(e)}catch(l){ue("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+l.message)}r.node_ops.rmdir(r,n),i.destroyNode(a);try{i.trackingDelegate.onDeletePath&&i.trackingDelegate.onDeletePath(e)}catch(l){ue("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+l.message)}},readdir:function(e){var t=i.lookupPath(e,{follow:!0}),r=t.node;if(!r.node_ops.readdir)throw new i.ErrnoError(54);return r.node_ops.readdir(r)},unlink:function(e){var t=i.lookupPath(e,{parent:!0}),r=t.node,n=A.basename(e),a=i.lookupNode(r,n),s=i.mayDelete(r,n,!1);if(s)throw new i.ErrnoError(s);if(!r.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(a))throw new i.ErrnoError(10);try{i.trackingDelegate.willDeletePath&&i.trackingDelegate.willDeletePath(e)}catch(l){ue("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+l.message)}r.node_ops.unlink(r,n),i.destroyNode(a);try{i.trackingDelegate.onDeletePath&&i.trackingDelegate.onDeletePath(e)}catch(l){ue("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+l.message)}},readlink:function(e){var t=i.lookupPath(e),r=t.node;if(!r)throw new i.ErrnoError(44);if(!r.node_ops.readlink)throw new i.ErrnoError(28);return Me.resolve(i.getPath(r.parent),r.node_ops.readlink(r))},stat:function(e,t){var r=i.lookupPath(e,{follow:!t}),n=r.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat:function(e){return i.stat(e,!0)},chmod:function(e,t,r){var n;if(typeof e=="string"){var a=i.lookupPath(e,{follow:!r});n=a.node}else n=e;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:t&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:function(e,t){i.chmod(e,t,!0)},fchmod:function(e,t){var r=i.getStream(e);if(!r)throw new i.ErrnoError(8);i.chmod(r.node,t)},chown:function(e,t,r,n){var a;if(typeof e=="string"){var s=i.lookupPath(e,{follow:!n});a=s.node}else a=e;if(!a.node_ops.setattr)throw new i.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown:function(e,t,r){i.chown(e,t,r,!0)},fchown:function(e,t,r){var n=i.getStream(e);if(!n)throw new i.ErrnoError(8);i.chown(n.node,t,r)},truncate:function(e,t){if(t<0)throw new i.ErrnoError(28);var r;if(typeof e=="string"){var n=i.lookupPath(e,{follow:!0});r=n.node}else r=e;if(!r.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(r.mode))throw new i.ErrnoError(31);if(!i.isFile(r.mode))throw new i.ErrnoError(28);var a=i.nodePermissions(r,"w");if(a)throw new i.ErrnoError(a);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:function(e,t){var r=i.getStream(e);if(!r)throw new i.ErrnoError(8);if((r.flags&2097155)===0)throw new i.ErrnoError(28);i.truncate(r.node,t)},utime:function(e,t,r){var n=i.lookupPath(e,{follow:!0}),a=n.node;a.node_ops.setattr(a,{timestamp:Math.max(t,r)})},open:function(e,t,r,n,a){if(e==="")throw new i.ErrnoError(44);t=typeof t=="string"?i.modeStringToFlags(t):t,r=typeof r>"u"?438:r,t&64?r=r&4095|32768:r=0;var s;if(typeof e=="object")s=e;else{e=A.normalize(e);try{var l=i.lookupPath(e,{follow:!(t&131072)});s=l.node}catch{}}var u=!1;if(t&64)if(s){if(t&128)throw new i.ErrnoError(20)}else s=i.mknod(e,r,0),u=!0;if(!s)throw new i.ErrnoError(44);if(i.isChrdev(s.mode)&&(t&=-513),t&65536&&!i.isDir(s.mode))throw new i.ErrnoError(54);if(!u){var c=i.mayOpen(s,t);if(c)throw new i.ErrnoError(c)}t&512&&i.truncate(s,0),t&=-131713;var d=i.createStream({node:s,path:i.getPath(s),flags:t,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1},n,a);d.stream_ops.open&&d.stream_ops.open(d),o.logReadFiles&&!(t&1)&&(i.readFiles||(i.readFiles={}),e in i.readFiles||(i.readFiles[e]=1,ue("FS.trackingDelegate error on read file: "+e)));try{if(i.trackingDelegate.onOpenFile){var f=0;(t&2097155)!==1&&(f|=i.tracking.openFlags.READ),(t&2097155)!==0&&(f|=i.tracking.openFlags.WRITE),i.trackingDelegate.onOpenFile(e,f)}}catch(g){ue("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+g.message)}return d},close:function(e){if(i.isClosed(e))throw new i.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{i.closeStream(e.fd)}e.fd=null},isClosed:function(e){return e.fd===null},llseek:function(e,t,r){if(i.isClosed(e))throw new i.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new i.ErrnoError(70);if(r!=0&&r!=1&&r!=2)throw new i.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:function(e,t,r,n,a){if(n<0||a<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if((e.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.read)throw new i.ErrnoError(28);var s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var l=e.stream_ops.read(e,t,r,n,a);return s||(e.position+=l),l},write:function(e,t,r,n,a,s){if(n<0||a<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if((e.flags&2097155)===0)throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.write)throw new i.ErrnoError(28);e.seekable&&e.flags&1024&&i.llseek(e,0,2);var l=typeof a<"u";if(!l)a=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var u=e.stream_ops.write(e,t,r,n,a,s);l||(e.position+=u);try{e.path&&i.trackingDelegate.onWriteToFile&&i.trackingDelegate.onWriteToFile(e.path)}catch(c){ue("FS.trackingDelegate['onWriteToFile']('"+e.path+"') threw an exception: "+c.message)}return u},allocate:function(e,t,r){if(i.isClosed(e))throw new i.ErrnoError(8);if(t<0||r<=0)throw new i.ErrnoError(28);if((e.flags&2097155)===0)throw new i.ErrnoError(8);if(!i.isFile(e.node.mode)&&!i.isDir(e.node.mode))throw new i.ErrnoError(43);if(!e.stream_ops.allocate)throw new i.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:function(e,t,r,n,a,s){if((a&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new i.ErrnoError(2);if((e.flags&2097155)===1)throw new i.ErrnoError(2);if(!e.stream_ops.mmap)throw new i.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,a,s)},msync:function(e,t,r,n,a){return!e||!e.stream_ops.msync?0:e.stream_ops.msync(e,t,r,n,a)},munmap:function(e){return 0},ioctl:function(e,t,r){if(!e.stream_ops.ioctl)throw new i.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e,t){if(t=t||{},t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error('Invalid encoding type "'+t.encoding+'"');var r,n=i.open(e,t.flags),a=i.stat(e),s=a.size,l=new Uint8Array(s);return i.read(n,l,0,s,0),t.encoding==="utf8"?r=Ge(l,0):t.encoding==="binary"&&(r=l),i.close(n),r},writeFile:function(e,t,r){r=r||{},r.flags=r.flags||577;var n=i.open(e,r.flags,r.mode);if(typeof t=="string"){var a=new Uint8Array(mt(t)+1),s=At(t,a,0,a.length);i.write(n,a,0,s,void 0,r.canOwn)}else if(ArrayBuffer.isView(t))i.write(n,t,0,t.byteLength,void 0,r.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:function(){return i.currentPath},chdir:function(e){var t=i.lookupPath(e,{follow:!0});if(t.node===null)throw new i.ErrnoError(44);if(!i.isDir(t.node.mode))throw new i.ErrnoError(54);var r=i.nodePermissions(t.node,"x");if(r)throw new i.ErrnoError(r);i.currentPath=t.path},createDefaultDirectories:function(){i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices:function(){i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:function(){return 0},write:function(t,r,n,a,s){return a}}),i.mkdev("/dev/null",i.makedev(1,3)),Ue.register(i.makedev(5,0),Ue.default_tty_ops),Ue.register(i.makedev(6,0),Ue.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var e=la();i.createDevice("/dev","random",e),i.createDevice("/dev","urandom",e),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){i.mkdir("/proc");var e=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount:function(){var t=i.createNode(e,"fd",16895,73);return t.node_ops={lookup:function(r,n){var a=+n,s=i.getStream(a);if(!s)throw new i.ErrnoError(8);var l={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return s.path}}};return l.parent=l,l}},t}},{},"/proc/self/fd")},createStandardStreams:function(){o.stdin?i.createDevice("/dev","stdin",o.stdin):i.symlink("/dev/tty","/dev/stdin"),o.stdout?i.createDevice("/dev","stdout",null,o.stdout):i.symlink("/dev/tty","/dev/stdout"),o.stderr?i.createDevice("/dev","stderr",null,o.stderr):i.symlink("/dev/tty1","/dev/stderr"),i.open("/dev/stdin",0),i.open("/dev/stdout",1),i.open("/dev/stderr",1)},ensureErrnoError:function(){i.ErrnoError||(i.ErrnoError=function(e,t){this.node=t,this.setErrno=function(r){this.errno=r},this.setErrno(e),this.message="FS error"},i.ErrnoError.prototype=new Error,i.ErrnoError.prototype.constructor=i.ErrnoError,[44].forEach(function(e){i.genericErrors[e]=new i.ErrnoError(e),i.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:function(){i.ensureErrnoError(),i.nameTable=new Array(4096),i.mount(U,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:U}},init:function(e,t,r){i.init.initialized=!0,i.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=t||o.stdout,o.stderr=r||o.stderr,i.createStandardStreams()},quit:function(){i.init.initialized=!1;var e=o._fflush;e&&e(0);for(var t=0;t<i.streams.length;t++){var r=i.streams[t];r&&i.close(r)}},getMode:function(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:function(e,t){var r=i.analyzePath(e,t);return r.exists?r.object:null},analyzePath:function(e,t){try{var r=i.lookupPath(e,{follow:!t});e=r.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var r=i.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=r.path,n.parentObject=r.node,n.name=A.basename(e),r=i.lookupPath(e,{follow:!t}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot=r.path==="/"}catch(a){n.error=a.errno}return n},createPath:function(e,t,r,n){e=typeof e=="string"?e:i.getPath(e);for(var a=t.split("/").reverse();a.length;){var s=a.pop();if(s){var l=A.join2(e,s);try{i.mkdir(l)}catch{}e=l}}return l},createFile:function(e,t,r,n,a){var s=A.join2(typeof e=="string"?e:i.getPath(e),t),l=i.getMode(n,a);return i.create(s,l)},createDataFile:function(e,t,r,n,a,s){var l=t?A.join2(typeof e=="string"?e:i.getPath(e),t):e,u=i.getMode(n,a),c=i.create(l,u);if(r){if(typeof r=="string"){for(var d=new Array(r.length),f=0,g=r.length;f<g;++f)d[f]=r.charCodeAt(f);r=d}i.chmod(c,u|146);var p=i.open(c,577);i.write(p,r,0,r.length,0,s),i.close(p),i.chmod(c,u)}return c},createDevice:function(e,t,r,n){var a=A.join2(typeof e=="string"?e:i.getPath(e),t),s=i.getMode(!!r,!!n);i.createDevice.major||(i.createDevice.major=64);var l=i.makedev(i.createDevice.major++,0);return i.registerDevice(l,{open:function(u){u.seekable=!1},close:function(u){n&&n.buffer&&n.buffer.length&&n(10)},read:function(u,c,d,f,g){for(var p=0,v=0;v<f;v++){var E;try{E=r()}catch{throw new i.ErrnoError(29)}if(E===void 0&&p===0)throw new i.ErrnoError(6);if(E==null)break;p++,c[d+v]=E}return p&&(u.node.timestamp=Date.now()),p},write:function(u,c,d,f,g){for(var p=0;p<f;p++)try{n(c[d+p])}catch{throw new i.ErrnoError(29)}return f&&(u.node.timestamp=Date.now()),p}}),i.mkdev(a,s,l)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("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.");if(G)try{e.contents=jt(G(e.url),!0),e.usedBytes=e.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:function(e,t,r,n,a){function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(g){if(!(g>this.length-1||g<0)){var p=g%this.chunkSize,v=g/this.chunkSize|0;return this.getter(v)[p]}},s.prototype.setDataGetter=function(g){this.getter=g},s.prototype.cacheLength=function(){var g=new XMLHttpRequest;if(g.open("HEAD",r,!1),g.send(null),!(g.status>=200&&g.status<300||g.status===304))throw new Error("Couldn't load "+r+". Status: "+g.status);var p=Number(g.getResponseHeader("Content-length")),v,E=(v=g.getResponseHeader("Accept-Ranges"))&&v==="bytes",T=(v=g.getResponseHeader("Content-Encoding"))&&v==="gzip",C=1024*1024;E||(C=p);var H=function(F,q){if(F>q)throw new Error("invalid range ("+F+", "+q+") or no bytes requested!");if(q>p-1)throw new Error("only "+p+" bytes available! programmer error!");var D=new XMLHttpRequest;if(D.open("GET",r,!1),p!==C&&D.setRequestHeader("Range","bytes="+F+"-"+q),typeof Uint8Array<"u"&&(D.responseType="arraybuffer"),D.overrideMimeType&&D.overrideMimeType("text/plain; charset=x-user-defined"),D.send(null),!(D.status>=200&&D.status<300||D.status===304))throw new Error("Couldn't load "+r+". Status: "+D.status);return D.response!==void 0?new Uint8Array(D.response||[]):jt(D.responseText||"",!0)},h=this;h.setDataGetter(function(F){var q=F*C,D=(F+1)*C-1;if(D=Math.min(D,p-1),typeof h.chunks[F]>"u"&&(h.chunks[F]=H(q,D)),typeof h.chunks[F]>"u")throw new Error("doXHR failed!");return h.chunks[F]}),(T||!p)&&(C=p=1,p=this.getter(0).length,C=p,We("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=p,this._chunkSize=C,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!$)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var l=new s;Object.defineProperties(l,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:l}}else var u={isDevice:!1,url:r};var c=i.createFile(e,t,u,n,a);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var d={},f=Object.keys(c.stream_ops);return f.forEach(function(g){var p=c.stream_ops[g];d[g]=function(){return i.forceLoadFile(c),p.apply(null,arguments)}}),d.read=function(g,p,v,E,T){i.forceLoadFile(c);var C=g.node.contents;if(T>=C.length)return 0;var H=Math.min(C.length-T,E);if(C.slice)for(var h=0;h<H;h++)p[v+h]=C[T+h];else for(var h=0;h<H;h++)p[v+h]=C.get(T+h);return H},c.stream_ops=d,c},createPreloadedFile:function(e,t,r,n,a,s,l,u,c,d){Browser.init();var f=t?Me.resolve(A.join2(e,t)):e;function g(p){function v(T){d&&d(),u||i.createDataFile(e,t,T,n,a,c),s&&s(),pt()}var E=!1;o.preloadPlugins.forEach(function(T){E||T.canHandle(f)&&(T.handle(p,f,v,function(){l&&l(),pt()}),E=!0)}),E||v(p)}It(),typeof r=="string"?Browser.asyncLoad(r,function(p){g(p)},l):g(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=i.indexedDB();try{var a=n.open(i.DB_NAME(),i.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=function(){We("creating db");var s=a.result;s.createObjectStore(i.DB_STORE_NAME)},a.onsuccess=function(){var s=a.result,l=s.transaction([i.DB_STORE_NAME],"readwrite"),u=l.objectStore(i.DB_STORE_NAME),c=0,d=0,f=e.length;function g(){d==0?t():r()}e.forEach(function(p){var v=u.put(i.analyzePath(p).object.contents,p);v.onsuccess=function(){c++,c+d==f&&g()},v.onerror=function(){d++,c+d==f&&g()}}),l.onerror=r},a.onerror=r},loadFilesFromDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=i.indexedDB();try{var a=n.open(i.DB_NAME(),i.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=r,a.onsuccess=function(){var s=a.result;try{var l=s.transaction([i.DB_STORE_NAME],"readonly")}catch(p){r(p);return}var u=l.objectStore(i.DB_STORE_NAME),c=0,d=0,f=e.length;function g(){d==0?t():r()}e.forEach(function(p){var v=u.get(p);v.onsuccess=function(){i.analyzePath(p).exists&&i.unlink(p),i.createDataFile(A.dirname(p),A.basename(p),v.result,!0,!0,!0),c++,c+d==f&&g()},v.onerror=function(){d++,c+d==f&&g()}}),l.onerror=r},a.onerror=r}},te={mappings:{},DEFAULT_POLLMASK:5,umask:511,calculateAt:function(e,t,r){if(t[0]==="/")return t;var n;if(e===-100)n=i.cwd();else{var a=i.getStream(e);if(!a)throw new i.ErrnoError(8);n=a.path}if(t.length==0){if(!r)throw new i.ErrnoError(44);return n}return A.join2(n,t)},doStat:function(e,t,r){try{var n=e(t)}catch(a){if(a&&a.node&&A.normalize(t)!==A.normalize(i.getPath(a.node)))return-54;throw a}return w[r>>2]=n.dev,w[r+4>>2]=0,w[r+8>>2]=n.ino,w[r+12>>2]=n.mode,w[r+16>>2]=n.nlink,w[r+20>>2]=n.uid,w[r+24>>2]=n.gid,w[r+28>>2]=n.rdev,w[r+32>>2]=0,me=[n.size>>>0,(K=n.size,+Math.abs(K)>=1?K>0?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],w[r+40>>2]=me[0],w[r+44>>2]=me[1],w[r+48>>2]=4096,w[r+52>>2]=n.blocks,w[r+56>>2]=n.atime.getTime()/1e3|0,w[r+60>>2]=0,w[r+64>>2]=n.mtime.getTime()/1e3|0,w[r+68>>2]=0,w[r+72>>2]=n.ctime.getTime()/1e3|0,w[r+76>>2]=0,me=[n.ino>>>0,(K=n.ino,+Math.abs(K)>=1?K>0?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],w[r+80>>2]=me[0],w[r+84>>2]=me[1],0},doMsync:function(e,t,r,n,a){var s=de.slice(e,e+r);i.msync(t,s,a,r,n)},doMkdir:function(e,t){return e=A.normalize(e),e[e.length-1]==="/"&&(e=e.substr(0,e.length-1)),i.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(t&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return i.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var n=i.readlink(e),a=Math.min(r,mt(n)),s=oe[t+a];return Kt(n,t,r+1),oe[t+a]=s,a},doAccess:function(e,t){if(t&-8)return-28;var r,n=i.lookupPath(e,{follow:!0});if(r=n.node,!r)return-44;var a="";return t&4&&(a+="r"),t&2&&(a+="w"),t&1&&(a+="x"),a&&i.nodePermissions(r,a)?-2:0},doDup:function(e,t,r){var n=i.getStream(r);return n&&i.close(n),i.open(e,t,0,r,r).fd},doReadv:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var l=w[t+s*8>>2],u=w[t+(s*8+4)>>2],c=i.read(e,oe,l,u,n);if(c<0)return-1;if(a+=c,c<u)break}return a},doWritev:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var l=w[t+s*8>>2],u=w[t+(s*8+4)>>2],c=i.write(e,oe,l,u,n);if(c<0)return-1;a+=c}return a},varargs:void 0,get:function(){te.varargs+=4;var e=w[te.varargs-4>>2];return e},getStr:function(e){var t=$e(e);return t},getStreamFromFD:function(e){var t=i.getStream(e);if(!t)throw new i.ErrnoError(8);return t},get64:function(e,t){return e}};function ca(e,t,r){te.varargs=r;try{var n=te.getStreamFromFD(e);switch(t){case 0:{var a=te.get();if(a<0)return-28;var s;return s=i.open(n.path,n.flags,0,a),s.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var a=te.get();return n.flags|=a,0}case 12:{var a=te.get(),l=0;return Pe[a+l>>1]=2,0}case 13:case 14:return 0;case 16:case 8:return-28;case 9:return sa(28),-1;default:return-28}}catch(u){return(typeof i>"u"||!(u instanceof i.ErrnoError))&&ae(u),-u.errno}}function da(e,t,r){try{var n=te.getStreamFromFD(e);n.getdents||(n.getdents=i.readdir(n.path));for(var a=280,s=0,l=i.llseek(n,0,1),u=Math.floor(l/a);u<n.getdents.length&&s+a<=r;){var c,d,f=n.getdents[u];if(f[0]===".")c=1,d=4;else{var g=i.lookupNode(n.node,f);c=g.id,d=i.isChrdev(g.mode)?2:i.isDir(g.mode)?4:i.isLink(g.mode)?10:8}me=[c>>>0,(K=c,+Math.abs(K)>=1?K>0?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],w[t+s>>2]=me[0],w[t+s+4>>2]=me[1],me=[(u+1)*a>>>0,(K=(u+1)*a,+Math.abs(K)>=1?K>0?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],w[t+s+8>>2]=me[0],w[t+s+12>>2]=me[1],Pe[t+s+16>>1]=280,oe[t+s+18>>0]=d,Kt(f,t+s+19,256),s+=a,u+=1}return i.llseek(n,u*a,0),s}catch(p){return(typeof i>"u"||!(p instanceof i.ErrnoError))&&ae(p),-p.errno}}function fa(e,t,r){te.varargs=r;try{var n=te.getStreamFromFD(e);switch(t){case 21509:case 21505:return n.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return n.tty?0:-59;case 21519:{if(!n.tty)return-59;var a=te.get();return w[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=te.get();return i.ioctl(n,t,a)}case 21523:return n.tty?0:-59;case 21524:return n.tty?0:-59;default:ae("bad ioctl syscall "+t)}}catch(s){return(typeof i>"u"||!(s instanceof i.ErrnoError))&&ae(s),-s.errno}}function ma(e,t,r){te.varargs=r;try{var n=te.getStr(e),a=r?te.get():0,s=i.open(n,t,a);return s.fd}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),-l.errno}}function ga(e,t){try{return e=te.getStr(e),te.doStat(i.stat,e,t)}catch(r){return(typeof i>"u"||!(r instanceof i.ErrnoError))&&ae(r),-r.errno}}var _t={};function He(e){for(;e.length;){var t=e.pop(),r=e.pop();r(t)}}function rt(e){return this.fromWireType(ye[e>>2])}var Ve={},Ne={},vt={},pa=48,ha=57;function yt(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=pa&&t<=ha?"_"+e:e}function wt(e,t){return e=yt(e),new Function("body","return function "+e+`() {
4
4
  "use strict"; return body.apply(this, arguments);
5
5
  };
6
- `)(t)}function tr(e,t){var r=xt(t,function(n){this.name=t,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+`
7
- `+a.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var $r=void 0;function Et(e){throw new $r(e)}function ge(e,t,r){e.forEach(function(u){yt[u]=t});function n(u){var c=r(u);c.length!==e.length&&Et("Mismatched type converter count");for(var d=0;d<e.length;++d)we(e[d],c[d])}var a=new Array(t.length),s=[],l=0;t.forEach(function(u,c){Le.hasOwnProperty(u)?a[c]=Le[u]:(s.push(u),Ve.hasOwnProperty(u)||(Ve[u]=[]),Ve[u].push(function(){a[c]=Le[u],++l,l===s.length&&n(a)}))}),s.length===0&&n(a)}function ba(e){var t=vt[e];delete vt[e];var r=t.elements,n=r.length,a=r.map(function(u){return u.getterReturnType}).concat(r.map(function(u){return u.setterArgumentType})),s=t.rawConstructor,l=t.rawDestructor;ge([e],a,function(u){return r.forEach(function(c,d){var m=u[d],g=c.getter,p=c.getterContext,v=u[d+n],E=c.setter,T=c.setterContext;c.read=function(C){return m.fromWireType(g(p,C))},c.write=function(C,H){var h=[];E(T,C,v.toWireType(h,H)),He(h)}}),[{name:t.name,fromWireType:function(c){for(var d=new Array(n),m=0;m<n;++m)d[m]=r[m].read(c);return l(c),d},toWireType:function(c,d){if(n!==d.length)throw new TypeError("Incorrect number of tuple elements for "+t.name+": expected="+n+", actual="+d.length);for(var m=s(),g=0;g<n;++g)r[g].write(m,d[g]);return c!==null&&c.push(l,m),m},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:l}]})}function _a(e,t,r,n,a){}function Ft(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function va(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Xr=e}var Xr=void 0;function ne(e){for(var t="",r=e;de[r];)t+=Xr[de[r++]];return t}var qe=void 0;function B(e){throw new qe(e)}function we(e,t,r){if(r=r||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||B('type "'+n+'" must have a positive integer typeid pointer'),Le.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;B("Cannot register type '"+n+"' twice")}if(Le[e]=t,delete yt[e],Ve.hasOwnProperty(e)){var a=Ve[e];delete Ve[e],a.forEach(function(s){s()})}}function ya(e,t,r,n,a){var s=Ft(r);t=ne(t),we(e,{name:t,fromWireType:function(l){return!!l},toWireType:function(l,u){return u?n:a},argPackAdvance:8,readValueFromPointer:function(l){var u;if(r===1)u=oe;else if(r===2)u=Se;else if(r===4)u=w;else throw new TypeError("Unknown boolean type size: "+t);return this.fromWireType(u[l>>s])},destructorFunction:null})}function wa(e){if(!(this instanceof De)||!(e instanceof De))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,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}function xa(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function rr(e){function t(r){return r.$$.ptrType.registeredClass.name}B(t(e)+" instance already deleted")}var nr=!1;function Ur(e){}function Ea(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Lr(e){e.count.value-=1;var t=e.count.value===0;t&&Ea(e)}function nt(e){return typeof FinalizationGroup>"u"?(nt=function(t){return t},e):(nr=new FinalizationGroup(function(t){for(var r=t.next();!r.done;r=t.next()){var n=r.value;n.ptr?Lr(n):console.warn("object already deleted: "+n.ptr)}}),nt=function(t){return nr.register(t,t.$$,t.$$),t},Ur=function(t){nr.unregister(t.$$)},nt(e))}function Fa(){if(this.$$.ptr||rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=nt(Object.create(Object.getPrototypeOf(this),{$$:{value:xa(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Pa(){this.$$.ptr||rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),Ur(this),Lr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Sa(){return!this.$$.ptr}var at=void 0,it=[];function ar(){for(;it.length;){var e=it.pop();e.$$.deleteScheduled=!1,e.delete()}}function Ma(){return this.$$.ptr||rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),it.push(this),it.length===1&&at&&at(ar),this.$$.deleteScheduled=!0,this}function Ta(){De.prototype.isAliasOf=wa,De.prototype.clone=Fa,De.prototype.delete=Pa,De.prototype.isDeleted=Sa,De.prototype.deleteLater=Ma}function De(){}var Nr={};function ir(e,t,r){if(e[t].overloadTable===void 0){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||B("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function or(e,t,r){o.hasOwnProperty(e)?((r===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[r]!==void 0)&&B("Cannot register public name '"+e+"' twice"),ir(o,e,e),o.hasOwnProperty(r)&&B("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),o[e].overloadTable[r]=t):(o[e]=t,r!==void 0&&(o[e].numArguments=r))}function ka(e,t,r,n,a,s,l,u){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=s,this.upcast=l,this.downcast=u,this.pureVirtualFunctions=[]}function Pt(e,t,r){for(;t!==r;)t.upcast||B("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Ca(e,t){if(t===null)return this.isReference&&B("null is not a valid "+this.name),0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass,n=Pt(t.$$.ptr,r,this.registeredClass);return n}function Da(e,t){var r;if(t===null)return this.isReference&&B("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,r),r):0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&B("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(r=Pt(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&B("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:B("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 a=t.clone();r=this.rawShare(r,Ee(function(){a.delete()})),e!==null&&e.push(this.rawDestructor,r)}break;default:B("Unsupporting sharing policy")}return r}function Ra(e,t){if(t===null)return this.isReference&&B("null is not a valid "+this.name),0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&B("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass,n=Pt(t.$$.ptr,r,this.registeredClass);return n}function Oa(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ja(e){this.rawDestructor&&this.rawDestructor(e)}function $a(e){e!==null&&e.delete()}function zr(e,t,r){if(t===r)return e;if(r.baseClass===void 0)return null;var n=zr(e,t,r.baseClass);return n===null?null:r.downcast(n)}function Xa(){return Object.keys(ot).length}function Ua(){var e=[];for(var t in ot)ot.hasOwnProperty(t)&&e.push(ot[t]);return e}function La(e){at=e,it.length&&at&&at(ar)}function Na(){o.getInheritedInstanceCount=Xa,o.getLiveInheritedInstances=Ua,o.flushPendingDeletes=ar,o.setDelayFunction=La}var ot={};function za(e,t){for(t===void 0&&B("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function Wa(e,t){return t=za(e,t),ot[t]}function St(e,t){(!t.ptrType||!t.ptr)&&Et("makeClassHandle requires ptr and ptrType");var r=!!t.smartPtrType,n=!!t.smartPtr;return r!==n&&Et("Both smartPtrType and smartPtr must be specified"),t.count={value:1},nt(Object.create(e,{$$:{value:t}}))}function Ga(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Wa(this.registeredClass,t);if(r!==void 0){if(r.$$.count.value===0)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?St(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):St(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s=this.registeredClass.getActualType(t),l=Nr[s];if(!l)return a.call(this);var u;this.isConst?u=l.constPointerType:u=l.pointerType;var c=zr(t,this.registeredClass,u.registeredClass);return c===null?a.call(this):this.isSmartPointer?St(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:e}):St(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}function Ba(){xe.prototype.getPointee=Oa,xe.prototype.destructor=ja,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=rt,xe.prototype.deleteObject=$a,xe.prototype.fromWireType=Ga}function xe(e,t,r,n,a,s,l,u,c,d,m){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=s,this.sharingPolicy=l,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=d,this.rawDestructor=m,!a&&t.baseClass===void 0?n?(this.toWireType=Ca,this.destructorFunction=null):(this.toWireType=Ra,this.destructorFunction=null):this.toWireType=Da}function Wr(e,t,r){o.hasOwnProperty(e)||Et("Replacing nonexistant public symbol"),o[e].overloadTable!==void 0&&r!==void 0?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)}function Ha(e,t,r){var n=o["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)}function Va(e,t,r){return e.includes("j")?Ha(e,t,r):L.get(t).apply(null,r)}function qa(e,t){var r=[];return function(){r.length=arguments.length;for(var n=0;n<arguments.length;n++)r[n]=arguments[n];return Va(e,t,r)}}function ie(e,t){e=ne(e);function r(){return e.includes("j")?qa(e,t):L.get(t)}var n=r();return typeof n!="function"&&B("unknown function pointer with signature "+e+": "+t),n}var Gr=void 0;function Br(e){var t=Zr(e),r=ne(t);return ve(t),r}function Te(e,t){var r=[],n={};function a(s){if(!n[s]&&!Le[s]){if(yt[s]){yt[s].forEach(a);return}r.push(s),n[s]=!0}}throw t.forEach(a),new Gr(e+": "+r.map(Br).join([", "]))}function Qa(e,t,r,n,a,s,l,u,c,d,m,g,p){m=ne(m),s=ie(a,s),u&&(u=ie(l,u)),d&&(d=ie(c,d)),p=ie(g,p);var v=wt(m);or(v,function(){Te("Cannot construct "+m+" due to unbound types",[n])}),ge([e,t,r],n?[n]:[],function(E){E=E[0];var T,C;n?(T=E.registeredClass,C=T.instancePrototype):C=De.prototype;var H=xt(v,function(){if(Object.getPrototypeOf(this)!==h)throw new qe("Use 'new' to construct "+m);if(F.constructor_body===void 0)throw new qe(m+" has no accessible constructor");var M=F.constructor_body[arguments.length];if(M===void 0)throw new qe("Tried to invoke ctor of "+m+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(F.constructor_body).toString()+") parameters instead!");return M.apply(this,arguments)}),h=Object.create(C,{constructor:{value:H}});H.prototype=h;var F=new ka(m,H,h,p,T,s,u,d),q=new xe(m,F,!0,!1,!1),D=new xe(m+"*",F,!1,!1,!1),se=new xe(m+" const*",F,!1,!0,!1);return Nr[e]={pointerType:D,constPointerType:se},Wr(v,H),[q,D,se]})}function Hr(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=xt(e.name||"unknownFunctionName",function(){});r.prototype=e.prototype;var n=new r,a=e.apply(n,t);return a instanceof Object?a:n}function sr(e,t,r,n,a){var s=t.length;s<2&&B("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var l=t[1]!==null&&r!==null,u=!1,c=1;c<t.length;++c)if(t[c]!==null&&t[c].destructorFunction===void 0){u=!0;break}for(var d=t[0].name!=="void",m="",g="",c=0;c<s-2;++c)m+=(c!==0?", ":"")+"arg"+c,g+=(c!==0?", ":"")+"arg"+c+"Wired";var p="return function "+wt(e)+"("+m+`) {
6
+ `)(t)}function tr(e,t){var r=wt(t,function(n){this.name=t,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+`
7
+ `+a.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var $r=void 0;function xt(e){throw new $r(e)}function ge(e,t,r){e.forEach(function(u){vt[u]=t});function n(u){var c=r(u);c.length!==e.length&&xt("Mismatched type converter count");for(var d=0;d<e.length;++d)we(e[d],c[d])}var a=new Array(t.length),s=[],l=0;t.forEach(function(u,c){Ne.hasOwnProperty(u)?a[c]=Ne[u]:(s.push(u),Ve.hasOwnProperty(u)||(Ve[u]=[]),Ve[u].push(function(){a[c]=Ne[u],++l,l===s.length&&n(a)}))}),s.length===0&&n(a)}function ba(e){var t=_t[e];delete _t[e];var r=t.elements,n=r.length,a=r.map(function(u){return u.getterReturnType}).concat(r.map(function(u){return u.setterArgumentType})),s=t.rawConstructor,l=t.rawDestructor;ge([e],a,function(u){return r.forEach(function(c,d){var f=u[d],g=c.getter,p=c.getterContext,v=u[d+n],E=c.setter,T=c.setterContext;c.read=function(C){return f.fromWireType(g(p,C))},c.write=function(C,H){var h=[];E(T,C,v.toWireType(h,H)),He(h)}}),[{name:t.name,fromWireType:function(c){for(var d=new Array(n),f=0;f<n;++f)d[f]=r[f].read(c);return l(c),d},toWireType:function(c,d){if(n!==d.length)throw new TypeError("Incorrect number of tuple elements for "+t.name+": expected="+n+", actual="+d.length);for(var f=s(),g=0;g<n;++g)r[g].write(f,d[g]);return c!==null&&c.push(l,f),f},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:l}]})}function _a(e,t,r,n,a){}function Et(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function va(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Xr=e}var Xr=void 0;function ne(e){for(var t="",r=e;de[r];)t+=Xr[de[r++]];return t}var qe=void 0;function B(e){throw new qe(e)}function we(e,t,r){if(r=r||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||B('type "'+n+'" must have a positive integer typeid pointer'),Ne.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;B("Cannot register type '"+n+"' twice")}if(Ne[e]=t,delete vt[e],Ve.hasOwnProperty(e)){var a=Ve[e];delete Ve[e],a.forEach(function(s){s()})}}function ya(e,t,r,n,a){var s=Et(r);t=ne(t),we(e,{name:t,fromWireType:function(l){return!!l},toWireType:function(l,u){return u?n:a},argPackAdvance:8,readValueFromPointer:function(l){var u;if(r===1)u=oe;else if(r===2)u=Pe;else if(r===4)u=w;else throw new TypeError("Unknown boolean type size: "+t);return this.fromWireType(u[l>>s])},destructorFunction:null})}function wa(e){if(!(this instanceof De)||!(e instanceof De))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,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}function xa(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function rr(e){function t(r){return r.$$.ptrType.registeredClass.name}B(t(e)+" instance already deleted")}var nr=!1;function Ur(e){}function Ea(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Nr(e){e.count.value-=1;var t=e.count.value===0;t&&Ea(e)}function nt(e){return typeof FinalizationGroup>"u"?(nt=function(t){return t},e):(nr=new FinalizationGroup(function(t){for(var r=t.next();!r.done;r=t.next()){var n=r.value;n.ptr?Nr(n):console.warn("object already deleted: "+n.ptr)}}),nt=function(t){return nr.register(t,t.$$,t.$$),t},Ur=function(t){nr.unregister(t.$$)},nt(e))}function Fa(){if(this.$$.ptr||rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=nt(Object.create(Object.getPrototypeOf(this),{$$:{value:xa(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Sa(){this.$$.ptr||rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),Ur(this),Nr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Pa(){return!this.$$.ptr}var at=void 0,it=[];function ar(){for(;it.length;){var e=it.pop();e.$$.deleteScheduled=!1,e.delete()}}function Ma(){return this.$$.ptr||rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&B("Object already scheduled for deletion"),it.push(this),it.length===1&&at&&at(ar),this.$$.deleteScheduled=!0,this}function Ta(){De.prototype.isAliasOf=wa,De.prototype.clone=Fa,De.prototype.delete=Sa,De.prototype.isDeleted=Pa,De.prototype.deleteLater=Ma}function De(){}var Lr={};function ir(e,t,r){if(e[t].overloadTable===void 0){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||B("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function or(e,t,r){o.hasOwnProperty(e)?((r===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[r]!==void 0)&&B("Cannot register public name '"+e+"' twice"),ir(o,e,e),o.hasOwnProperty(r)&&B("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),o[e].overloadTable[r]=t):(o[e]=t,r!==void 0&&(o[e].numArguments=r))}function ka(e,t,r,n,a,s,l,u){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=s,this.upcast=l,this.downcast=u,this.pureVirtualFunctions=[]}function Ft(e,t,r){for(;t!==r;)t.upcast||B("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Ca(e,t){if(t===null)return this.isReference&&B("null is not a valid "+this.name),0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass,n=Ft(t.$$.ptr,r,this.registeredClass);return n}function Da(e,t){var r;if(t===null)return this.isReference&&B("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,r),r):0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&B("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(r=Ft(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&B("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:B("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 a=t.clone();r=this.rawShare(r,Ee(function(){a.delete()})),e!==null&&e.push(this.rawDestructor,r)}break;default:B("Unsupporting sharing policy")}return r}function Ra(e,t){if(t===null)return this.isReference&&B("null is not a valid "+this.name),0;t.$$||B('Cannot pass "'+Qe(t)+'" as a '+this.name),t.$$.ptr||B("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&B("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass,n=Ft(t.$$.ptr,r,this.registeredClass);return n}function Oa(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ja(e){this.rawDestructor&&this.rawDestructor(e)}function $a(e){e!==null&&e.delete()}function zr(e,t,r){if(t===r)return e;if(r.baseClass===void 0)return null;var n=zr(e,t,r.baseClass);return n===null?null:r.downcast(n)}function Xa(){return Object.keys(ot).length}function Ua(){var e=[];for(var t in ot)ot.hasOwnProperty(t)&&e.push(ot[t]);return e}function Na(e){at=e,it.length&&at&&at(ar)}function La(){o.getInheritedInstanceCount=Xa,o.getLiveInheritedInstances=Ua,o.flushPendingDeletes=ar,o.setDelayFunction=Na}var ot={};function za(e,t){for(t===void 0&&B("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function Wa(e,t){return t=za(e,t),ot[t]}function St(e,t){(!t.ptrType||!t.ptr)&&xt("makeClassHandle requires ptr and ptrType");var r=!!t.smartPtrType,n=!!t.smartPtr;return r!==n&&xt("Both smartPtrType and smartPtr must be specified"),t.count={value:1},nt(Object.create(e,{$$:{value:t}}))}function Ga(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Wa(this.registeredClass,t);if(r!==void 0){if(r.$$.count.value===0)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?St(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):St(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s=this.registeredClass.getActualType(t),l=Lr[s];if(!l)return a.call(this);var u;this.isConst?u=l.constPointerType:u=l.pointerType;var c=zr(t,this.registeredClass,u.registeredClass);return c===null?a.call(this):this.isSmartPointer?St(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:e}):St(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}function Ba(){xe.prototype.getPointee=Oa,xe.prototype.destructor=ja,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=rt,xe.prototype.deleteObject=$a,xe.prototype.fromWireType=Ga}function xe(e,t,r,n,a,s,l,u,c,d,f){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=s,this.sharingPolicy=l,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=d,this.rawDestructor=f,!a&&t.baseClass===void 0?n?(this.toWireType=Ca,this.destructorFunction=null):(this.toWireType=Ra,this.destructorFunction=null):this.toWireType=Da}function Wr(e,t,r){o.hasOwnProperty(e)||xt("Replacing nonexistant public symbol"),o[e].overloadTable!==void 0&&r!==void 0?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)}function Ha(e,t,r){var n=o["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)}function Va(e,t,r){return e.includes("j")?Ha(e,t,r):N.get(t).apply(null,r)}function qa(e,t){var r=[];return function(){r.length=arguments.length;for(var n=0;n<arguments.length;n++)r[n]=arguments[n];return Va(e,t,r)}}function ie(e,t){e=ne(e);function r(){return e.includes("j")?qa(e,t):N.get(t)}var n=r();return typeof n!="function"&&B("unknown function pointer with signature "+e+": "+t),n}var Gr=void 0;function Br(e){var t=Kr(e),r=ne(t);return ve(t),r}function Te(e,t){var r=[],n={};function a(s){if(!n[s]&&!Ne[s]){if(vt[s]){vt[s].forEach(a);return}r.push(s),n[s]=!0}}throw t.forEach(a),new Gr(e+": "+r.map(Br).join([", "]))}function Qa(e,t,r,n,a,s,l,u,c,d,f,g,p){f=ne(f),s=ie(a,s),u&&(u=ie(l,u)),d&&(d=ie(c,d)),p=ie(g,p);var v=yt(f);or(v,function(){Te("Cannot construct "+f+" due to unbound types",[n])}),ge([e,t,r],n?[n]:[],function(E){E=E[0];var T,C;n?(T=E.registeredClass,C=T.instancePrototype):C=De.prototype;var H=wt(v,function(){if(Object.getPrototypeOf(this)!==h)throw new qe("Use 'new' to construct "+f);if(F.constructor_body===void 0)throw new qe(f+" has no accessible constructor");var M=F.constructor_body[arguments.length];if(M===void 0)throw new qe("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(F.constructor_body).toString()+") parameters instead!");return M.apply(this,arguments)}),h=Object.create(C,{constructor:{value:H}});H.prototype=h;var F=new ka(f,H,h,p,T,s,u,d),q=new xe(f,F,!0,!1,!1),D=new xe(f+"*",F,!1,!1,!1),se=new xe(f+" const*",F,!1,!0,!1);return Lr[e]={pointerType:D,constPointerType:se},Wr(v,H),[q,D,se]})}function Hr(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=wt(e.name||"unknownFunctionName",function(){});r.prototype=e.prototype;var n=new r,a=e.apply(n,t);return a instanceof Object?a:n}function sr(e,t,r,n,a){var s=t.length;s<2&&B("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var l=t[1]!==null&&r!==null,u=!1,c=1;c<t.length;++c)if(t[c]!==null&&t[c].destructorFunction===void 0){u=!0;break}for(var d=t[0].name!=="void",f="",g="",c=0;c<s-2;++c)f+=(c!==0?", ":"")+"arg"+c,g+=(c!==0?", ":"")+"arg"+c+"Wired";var p="return function "+yt(e)+"("+f+`) {
8
8
  if (arguments.length !== `+(s-2)+`) {
9
9
  throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(s-2)+` args!');
10
10
  }
@@ -17,17 +17,17 @@ throwBindingError('function `+e+" called with ' + arguments.length + ' arguments
17
17
  `,E.push(C+"_dtor"),T.push(t[c].destructorFunction))}d&&(p+=`var ret = retType.fromWireType(rv);
18
18
  return ret;
19
19
  `),p+=`}
20
- `,E.push(p);var H=Hr(Function,E).apply(null,T);return H}function Mt(e,t){for(var r=[],n=0;n<e;n++)r.push(w[(t>>2)+n]);return r}function Ja(e,t,r,n,a,s,l){var u=Mt(r,n);t=ne(t),s=ie(a,s),ge([],[e],function(c){c=c[0];var d=c.name+"."+t;function m(){Te("Cannot call "+d+" due to unbound types",u)}var g=c.registeredClass.constructor;return g[t]===void 0?(m.argCount=r-1,g[t]=m):(ir(g,t,d),g[t].overloadTable[r-1]=m),ge([],u,function(p){var v=[p[0],null].concat(p.slice(1)),E=sr(d,v,null,s,l);return g[t].overloadTable===void 0?(E.argCount=r-1,g[t]=E):g[t].overloadTable[r-1]=E,[]}),[]})}function Vr(e,t,r){return e instanceof Object||B(r+' with invalid "this": '+e),e instanceof t.registeredClass.constructor||B(r+' incompatible with "this" of type '+e.constructor.name),e.$$.ptr||B("cannot call emscripten binding method "+r+" on deleted object"),Pt(e.$$.ptr,e.$$.ptrType.registeredClass,t.registeredClass)}function Ya(e,t,r,n,a,s,l,u){t=ne(t),s=ie(a,s),ge([],[e],function(c){c=c[0];var d=c.name+"."+t,m={get:function(){Te("Cannot access "+d+" due to unbound types",[r])},enumerable:!0,configurable:!0};return u?m.set=function(){Te("Cannot access "+d+" due to unbound types",[r])}:m.set=function(g){B(d+" is a read-only property")},Object.defineProperty(c.registeredClass.constructor,t,m),ge([],[r],function(g){g=g[0];var p={get:function(){return g.fromWireType(s(n))},enumerable:!0};return u&&(u=ie(l,u),p.set=function(v){var E=[];u(n,g.toWireType(E,v)),He(E)}),Object.defineProperty(c.registeredClass.constructor,t,p),[]}),[]})}function Ka(e,t,r,n,a,s){Yt(t>0);var l=Mt(t,r);a=ie(n,a);var u=[s],c=[];ge([],[e],function(d){d=d[0];var m="constructor "+d.name;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[t-1]!==void 0)throw new qe("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+d.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return d.registeredClass.constructor_body[t-1]=function(){Te("Cannot construct "+d.name+" due to unbound types",l)},ge([],l,function(g){return d.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&B(m+" called with "+arguments.length+" arguments, expected "+(t-1)),c.length=0,u.length=t;for(var p=1;p<t;++p)u[p]=g[p].toWireType(c,arguments[p-1]);var v=a.apply(null,u);return He(c),g[0].fromWireType(v)},[]}),[]})}function Za(e,t,r,n,a,s,l,u){var c=Mt(r,n);t=ne(t),s=ie(a,s),ge([],[e],function(d){d=d[0];var m=d.name+"."+t;u&&d.registeredClass.pureVirtualFunctions.push(t);function g(){Te("Cannot call "+m+" due to unbound types",c)}var p=d.registeredClass.instancePrototype,v=p[t];return v===void 0||v.overloadTable===void 0&&v.className!==d.name&&v.argCount===r-2?(g.argCount=r-2,g.className=d.name,p[t]=g):(ir(p,t,m),p[t].overloadTable[r-2]=g),ge([],c,function(E){var T=sr(m,E,d,s,l);return p[t].overloadTable===void 0?(T.argCount=r-2,p[t]=T):p[t].overloadTable[r-2]=T,[]}),[]})}function Aa(e,t,r,n,a,s,l,u,c,d){t=ne(t),a=ie(n,a),ge([],[e],function(m){m=m[0];var g=m.name+"."+t,p={get:function(){Te("Cannot access "+g+" due to unbound types",[r,l])},enumerable:!0,configurable:!0};return c?p.set=function(){Te("Cannot access "+g+" due to unbound types",[r,l])}:p.set=function(v){B(g+" is a read-only property")},Object.defineProperty(m.registeredClass.instancePrototype,t,p),ge([],c?[r,l]:[r],function(v){var E=v[0],T={get:function(){var H=Vr(this,m,g+" getter");return E.fromWireType(a(s,H))},enumerable:!0};if(c){c=ie(u,c);var C=v[1];T.set=function(H){var h=Vr(this,m,g+" setter"),F=[];c(d,h,C.toWireType(F,H)),He(F)}}return Object.defineProperty(m.registeredClass.instancePrototype,t,T),[]}),[]})}function Ia(e,t,r){e=ne(e),ge([],[t],function(n){return n=n[0],o[e]=n.fromWireType(r),[]})}var lr=[],_e=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ur(e){e>4&&--_e[e].refcount===0&&(_e[e]=void 0,lr.push(e))}function ei(){for(var e=0,t=5;t<_e.length;++t)_e[t]!==void 0&&++e;return e}function ti(){for(var e=5;e<_e.length;++e)if(_e[e]!==void 0)return _e[e];return null}function ri(){o.count_emval_handles=ei,o.get_first_emval=ti}function Ee(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var t=lr.length?lr.pop():_e.length;return _e[t]={refcount:1,value:e},t}}}function ni(e,t){t=ne(t),we(e,{name:t,fromWireType:function(r){var n=_e[r].value;return ur(r),n},toWireType:function(r,n){return Ee(n)},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:null})}function ai(e,t,r){switch(t){case 0:return function(n){var a=r?oe:de;return this.fromWireType(a[n])};case 1:return function(n){var a=r?Se:Ie;return this.fromWireType(a[n>>1])};case 2:return function(n){var a=r?w:ye;return this.fromWireType(a[n>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function ii(e,t,r,n){var a=Ft(r);t=ne(t);function s(){}s.values={},we(e,{name:t,constructor:s,fromWireType:function(l){return this.constructor.values[l]},toWireType:function(l,u){return u.value},argPackAdvance:8,readValueFromPointer:ai(t,a,n),destructorFunction:null}),or(t,s)}function Tt(e,t){var r=Le[e];return r===void 0&&B(t+" has unknown type "+Br(e)),r}function oi(e,t,r){var n=Tt(e,"enum");t=ne(t);var a=n.constructor,s=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:xt(n.name+"_"+t,function(){})}});a.values[r]=s,a[t]=s}function Qe(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function si(e,t){switch(t){case 2:return function(r){return this.fromWireType(Sr[r>>2])};case 3:return function(r){return this.fromWireType(At[r>>3])};default:throw new TypeError("Unknown float type: "+e)}}function li(e,t,r){var n=Ft(r);t=ne(t),we(e,{name:t,fromWireType:function(a){return a},toWireType:function(a,s){if(typeof s!="number"&&typeof s!="boolean")throw new TypeError('Cannot convert "'+Qe(s)+'" to '+this.name);return s},argPackAdvance:8,readValueFromPointer:si(t,n),destructorFunction:null})}function ui(e,t,r,n,a,s){var l=Mt(t,r);e=ne(e),a=ie(n,a),or(e,function(){Te("Cannot call "+e+" due to unbound types",l)},t-1),ge([],l,function(u){var c=[u[0],null].concat(u.slice(1));return Wr(e,sr(e,c,null,a,s),t-1),[]})}function ci(e,t,r){switch(t){case 0:return r?function(n){return oe[n]}:function(n){return de[n]};case 1:return r?function(n){return Se[n>>1]}:function(n){return Ie[n>>1]};case 2:return r?function(n){return w[n>>2]}:function(n){return ye[n>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function di(e,t,r,n,a){t=ne(t),a===-1&&(a=4294967295);var s=Ft(r),l=function(d){return d};if(n===0){var u=32-8*r;l=function(d){return d<<u>>>u}}var c=t.includes("unsigned");we(e,{name:t,fromWireType:l,toWireType:function(d,m){if(typeof m!="number"&&typeof m!="boolean")throw new TypeError('Cannot convert "'+Qe(m)+'" to '+this.name);if(m<n||m>a)throw new TypeError('Passing a number "'+Qe(m)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+a+"]!");return c?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:ci(t,s,n!==0),destructorFunction:null})}function fi(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[t];function s(l){l=l>>2;var u=ye,c=u[l],d=u[l+1];return new a(pt,d,c)}r=ne(r),we(e,{name:r,fromWireType:s,argPackAdvance:8,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})}function mi(e,t,r,n,a,s,l,u,c,d,m,g){r=ne(r),s=ie(a,s),u=ie(l,u),d=ie(c,d),g=ie(m,g),ge([e],[t],function(p){p=p[0];var v=new xe(r,p.registeredClass,!1,!1,!0,p,n,s,u,d,g);return[v]})}function gi(e,t){t=ne(t);var r=t==="std::string";we(e,{name:t,fromWireType:function(n){var a=ye[n>>2],s;if(r)for(var l=n+4,u=0;u<=a;++u){var c=n+4+u;if(u==a||de[c]==0){var d=c-l,m=$e(l,d);s===void 0?s=m:(s+="\0",s+=m),l=c+1}}else{for(var g=new Array(a),u=0;u<a;++u)g[u]=String.fromCharCode(de[n+4+u]);s=g.join("")}return ve(n),s},toWireType:function(n,a){a instanceof ArrayBuffer&&(a=new Uint8Array(a));var s,l=typeof a=="string";l||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Int8Array||B("Cannot pass non-string to std::string"),r&&l?s=function(){return gt(a)}:s=function(){return a.length};var u=s(),c=Je(4+u+1);if(ye[c>>2]=u,r&&l)Zt(a,c+4,u+1);else if(l)for(var d=0;d<u;++d){var m=a.charCodeAt(d);m>255&&(ve(c),B("String has UTF-16 code units that do not fit in 8 bits")),de[c+4+d]=m}else for(var d=0;d<u;++d)de[c+4+d]=a[d];return n!==null&&n.push(ve,c),c},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(n){ve(n)}})}function pi(e,t,r){r=ne(r);var n,a,s,l,u;t===2?(n=kn,a=Cn,l=Dn,s=function(){return Ie},u=1):t===4&&(n=Rn,a=On,l=jn,s=function(){return ye},u=2),we(e,{name:r,fromWireType:function(c){for(var d=ye[c>>2],m=s(),g,p=c+4,v=0;v<=d;++v){var E=c+4+v*t;if(v==d||m[E>>u]==0){var T=E-p,C=n(p,T);g===void 0?g=C:(g+="\0",g+=C),p=E+t}}return ve(c),g},toWireType:function(c,d){typeof d!="string"&&B("Cannot pass non-string to C++ string type "+r);var m=l(d),g=Je(4+m+t);return ye[g>>2]=m>>u,a(d,g+4,m+t),c!==null&&c.push(ve,g),g},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(c){ve(c)}})}function hi(e,t,r,n,a,s){vt[e]={name:ne(t),rawConstructor:ie(r,n),rawDestructor:ie(a,s),elements:[]}}function bi(e,t,r,n,a,s,l,u,c){vt[e].elements.push({getterReturnType:t,getter:ie(r,n),getterContext:a,setterArgumentType:s,setter:ie(l,u),setterContext:c})}function _i(e,t){t=ne(t),we(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(r,n){}})}function ke(e){return e||B("Cannot use deleted val. handle = "+e),_e[e].value}function vi(e,t,r){e=ke(e),t=Tt(t,"emval::as");var n=[],a=Ee(n);return w[r>>2]=a,t.toWireType(n,e)}function qr(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Tt(w[(t>>2)+n],"parameter "+n);return r}function yi(e,t,r,n){e=ke(e);for(var a=qr(t,r),s=new Array(t),l=0;l<t;++l){var u=a[l];s[l]=u.readValueFromPointer(n),n+=u.argPackAdvance}var c=e.apply(void 0,s);return Ee(c)}var wi={};function Qr(e){var t=wi[e];return t===void 0?ne(e):t}var cr=[];function xi(e,t,r,n){e=cr[e],t=ke(t),r=Qr(r),e(t,r,null,n)}function Ei(e){var t=cr.length;return cr.push(e),t}function Fi(e,t){for(var r=qr(e,t),n=r[0],a=n.name+"_$"+r.slice(1).map(function(v){return v.name}).join("_")+"$",s=["retType"],l=[n],u="",c=0;c<e-1;++c)u+=(c!==0?", ":"")+"arg"+c,s.push("argType"+c),l.push(r[1+c]);for(var d=wt("methodCaller_"+a),m="return function "+d+`(handle, name, destructors, args) {
21
- `,g=0,c=0;c<e-1;++c)m+=" var arg"+c+" = argType"+c+".readValueFromPointer(args"+(g?"+"+g:"")+`);
22
- `,g+=r[c+1].argPackAdvance;m+=" var rv = handle[name]("+u+`);
23
- `;for(var c=0;c<e-1;++c)r[c+1].deleteObject&&(m+=" argType"+c+".deleteObject(arg"+c+`);
24
- `);n.isVoid||(m+=` return retType.toWireType(destructors, rv);
25
- `),m+=`};
26
- `,s.push(m);var p=Hr(Function,s).apply(null,l);return Ei(p)}function Pi(e,t){return e=ke(e),t=ke(t),Ee(e[t])}function Si(e){e>4&&(_e[e].refcount+=1)}function Mi(){return Ee([])}function Ti(e){return Ee(Qr(e))}function ki(){return Ee({})}function Ci(e){var t=_e[e].value;He(t),ur(e)}function Di(e,t,r){e=ke(e),t=ke(t),r=ke(r),e[t]=r}function Ri(e,t){e=Tt(e,"_emval_take_value");var r=e.readValueFromPointer(t);return Ee(r)}function Oi(e){return e=ke(e),Ee(typeof e)}function ji(){ae()}var dr=[];function $i(e,t){dr.length=0;var r;for(t>>=2;r=de[e++];){var n=r<105;n&&t&1&&t++,dr.push(n?At[t++>>1]:w[t]),++t}return dr}function Xi(e,t,r){var n=$i(t,r);return Qn[e].apply(null,n)}function Ui(e,t,r){de.copyWithin(e,t,t+r)}function Li(e){try{return mt.grow(e-pt.byteLength+65535>>>16),Mr(mt.buffer),1}catch{}}function Ni(e){var t=de.length;e=e>>>0;var r=2147483648;if(e>r)return!1;for(var n=1;n<=4;n*=2){var a=t+33554432/n,s=Math.min(r,Un(Math.max(e,a),65536)),l=Li(s);if(l)return!0}return!1}var Jr={};function zi(){return X||"./this.program"}function st(){if(!st.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:zi()};for(var r in Jr)t[r]=Jr[r];var n=[];for(var r in t)n.push(r+"="+t[r]);st.strings=n}return st.strings}function Wi(e,t){try{var r=0;return st().forEach(function(n,a){var s=t+r;w[e+a*4>>2]=s,Xn(n,s),r+=n.length+1}),0}catch(n){return(typeof i>"u"||!(n instanceof i.ErrnoError))&&ae(n),n.errno}}function Gi(e,t){try{var r=st();w[e>>2]=r.length;var n=0;return r.forEach(function(a){n+=a.length+1}),w[t>>2]=n,0}catch(a){return(typeof i>"u"||!(a instanceof i.ErrnoError))&&ae(a),a.errno}}function Bi(e){try{var t=te.getStreamFromFD(e);return i.close(t),0}catch(r){return(typeof i>"u"||!(r instanceof i.ErrnoError))&&ae(r),r.errno}}function Hi(e,t,r,n){try{var a=te.getStreamFromFD(e),s=te.doReadv(a,t,r);return w[n>>2]=s,0}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),l.errno}}function Vi(e,t,r,n,a){try{var s=te.getStreamFromFD(e),l=4294967296,u=r*l+(t>>>0),c=9007199254740992;return u<=-c||u>=c?-61:(i.llseek(s,u,n),me=[s.position>>>0,(A=s.position,+Math.abs(A)>=1?A>0?(Math.min(+Math.floor(A/4294967296),4294967295)|0)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],w[a>>2]=me[0],w[a+4>>2]=me[1],s.getdents&&u===0&&n===0&&(s.getdents=null),0)}catch(d){return(typeof i>"u"||!(d instanceof i.ErrnoError))&&ae(d),d.errno}}function qi(e,t,r,n){try{var a=te.getStreamFromFD(e),s=te.doWritev(a,t,r);return w[n>>2]=s,0}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),l.errno}}function Qi(){return Tn()}function Ji(e){return e}function Yi(e){he(e)}function kt(e){return e%4===0&&(e%100!==0||e%400===0)}function fr(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}var Ct=[31,29,31,30,31,30,31,31,30,31,30,31],Dt=[31,28,31,30,31,30,31,31,30,31,30,31];function Rt(e,t){for(var r=new Date(e.getTime());t>0;){var n=kt(r.getFullYear()),a=r.getMonth(),s=(n?Ct:Dt)[a];if(t>s-r.getDate())t-=s-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1));else return r.setDate(r.getDate()+t),r}return r}function Ki(e,t,r,n){var a=w[n+40>>2],s={tm_sec:w[n>>2],tm_min:w[n+4>>2],tm_hour:w[n+8>>2],tm_mday:w[n+12>>2],tm_mon:w[n+16>>2],tm_year:w[n+20>>2],tm_wday:w[n+24>>2],tm_yday:w[n+28>>2],tm_isdst:w[n+32>>2],tm_gmtoff:w[n+36>>2],tm_zone:a?$e(a):""},l=$e(r),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in u)l=l.replace(new RegExp(c,"g"),u[c]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],m=["January","February","March","April","May","June","July","August","September","October","November","December"];function g(h,F,q){for(var D=typeof h=="number"?h.toString():h||"";D.length<F;)D=q[0]+D;return D}function p(h,F){return g(h,F,"0")}function v(h,F){function q(se){return se<0?-1:se>0?1:0}var D;return(D=q(h.getFullYear()-F.getFullYear()))===0&&(D=q(h.getMonth()-F.getMonth()))===0&&(D=q(h.getDate()-F.getDate())),D}function E(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function T(h){var F=Rt(new Date(h.tm_year+1900,0,1),h.tm_yday),q=new Date(F.getFullYear(),0,4),D=new Date(F.getFullYear()+1,0,4),se=E(q),M=E(D);return v(se,F)<=0?v(M,F)<=0?F.getFullYear()+1:F.getFullYear():F.getFullYear()-1}var C={"%a":function(h){return d[h.tm_wday].substring(0,3)},"%A":function(h){return d[h.tm_wday]},"%b":function(h){return m[h.tm_mon].substring(0,3)},"%B":function(h){return m[h.tm_mon]},"%C":function(h){var F=h.tm_year+1900;return p(F/100|0,2)},"%d":function(h){return p(h.tm_mday,2)},"%e":function(h){return g(h.tm_mday,2," ")},"%g":function(h){return T(h).toString().substring(2)},"%G":function(h){return T(h)},"%H":function(h){return p(h.tm_hour,2)},"%I":function(h){var F=h.tm_hour;return F==0?F=12:F>12&&(F-=12),p(F,2)},"%j":function(h){return p(h.tm_mday+fr(kt(h.tm_year+1900)?Ct:Dt,h.tm_mon-1),3)},"%m":function(h){return p(h.tm_mon+1,2)},"%M":function(h){return p(h.tm_min,2)},"%n":function(){return`
27
- `},"%p":function(h){return h.tm_hour>=0&&h.tm_hour<12?"AM":"PM"},"%S":function(h){return p(h.tm_sec,2)},"%t":function(){return" "},"%u":function(h){return h.tm_wday||7},"%U":function(h){var F=new Date(h.tm_year+1900,0,1),q=F.getDay()===0?F:Rt(F,7-F.getDay()),D=new Date(h.tm_year+1900,h.tm_mon,h.tm_mday);if(v(q,D)<0){var se=fr(kt(D.getFullYear())?Ct:Dt,D.getMonth()-1)-31,M=31-q.getDate(),P=M+se+D.getDate();return p(Math.ceil(P/7),2)}return v(q,F)===0?"01":"00"},"%V":function(h){var F=new Date(h.tm_year+1900,0,4),q=new Date(h.tm_year+1901,0,4),D=E(F),se=E(q),M=Rt(new Date(h.tm_year+1900,0,1),h.tm_yday);if(v(M,D)<0)return"53";if(v(se,M)<=0)return"01";var P;return D.getFullYear()<h.tm_year+1900?P=h.tm_yday+32-D.getDate():P=h.tm_yday+1-D.getDate(),p(Math.ceil(P/7),2)},"%w":function(h){return h.tm_wday},"%W":function(h){var F=new Date(h.tm_year,0,1),q=F.getDay()===1?F:Rt(F,F.getDay()===0?1:7-F.getDay()+1),D=new Date(h.tm_year+1900,h.tm_mon,h.tm_mday);if(v(q,D)<0){var se=fr(kt(D.getFullYear())?Ct:Dt,D.getMonth()-1)-31,M=31-q.getDate(),P=M+se+D.getDate();return p(Math.ceil(P/7),2)}return v(q,F)===0?"01":"00"},"%y":function(h){return(h.tm_year+1900).toString().substring(2)},"%Y":function(h){return h.tm_year+1900},"%z":function(h){var F=h.tm_gmtoff,q=F>=0;return F=Math.abs(F)/60,F=F/60*100+F%60,(q?"+":"-")+("0000"+F).slice(-4)},"%Z":function(h){return h.tm_zone},"%%":function(){return"%"}};for(var c in C)l.includes(c)&&(l=l.replace(new RegExp(c,"g"),C[c](s)));var H=$t(l,!1);return H.length>t?0:($n(H,e),H.length-1)}function Zi(e,t,r,n){return Ki(e,t,r,n)}var Yr=function(e,t,r,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=i.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},Ot=365,jt=146;Object.defineProperties(Yr.prototype,{read:{get:function(){return(this.mode&Ot)===Ot},set:function(e){e?this.mode|=Ot:this.mode&=~Ot}},write:{get:function(){return(this.mode&jt)===jt},set:function(e){e?this.mode|=jt:this.mode&=~jt}},isFolder:{get:function(){return i.isDir(this.mode)}},isDevice:{get:function(){return i.isChrdev(this.mode)}}}),i.FSNode=Yr,i.staticInit(),o.FS_createPath=i.createPath,o.FS_createDataFile=i.createDataFile,o.FS_createPreloadedFile=i.createPreloadedFile,o.FS_createLazyFile=i.createLazyFile,o.FS_createDevice=i.createDevice,o.FS_unlink=i.unlink,$r=o.InternalError=tr(Error,"InternalError"),va(),qe=o.BindingError=tr(Error,"BindingError"),Ta(),Ba(),Na(),Gr=o.UnboundTypeError=tr(Error,"UnboundTypeError"),ri();function $t(e,t,r){var n=gt(e)+1,a=new Array(n),s=Kt(e,a,0,a.length);return t&&(a.length=s),a}var Ai={B:Jn,o:Yn,q:Zn,A:In,b:ta,h:ra,Ka:na,p:jr,fa:aa,M:ia,ua:oa,e:ea,ha:ca,Da:da,Ba:fa,ja:ma,Ca:ga,Qa:ba,Va:_a,Fa:ya,u:Qa,y:Ja,r:Ya,z:Ka,j:Za,H:Aa,U:Ia,Ea:ni,T:ii,S:oi,ka:li,G:ui,O:di,N:fi,s:mi,la:gi,ba:pi,pa:hi,$:bi,Ga:_i,Q:vi,Ra:yi,_:xi,ia:ur,Z:Fi,Pa:Pi,ma:Si,Ta:Mi,Oa:Ti,La:ki,Na:Ci,Sa:Di,C:Ri,Ma:Oi,wa:ji,ea:Xi,ta:Ui,aa:Ni,xa:Wi,ya:Gi,X:Bi,Aa:Hi,Ua:Vi,za:qi,a:Qi,Ha:vo,da:_o,Ja:go,ra:Co,oa:Fo,x:lo,g:Ii,Ia:ho,L:po,na:Po,Y:wo,c:no,i:io,v:ro,ga:Do,t:co,K:bo,F:Eo,I:To,W:Ro,l:fo,m:so,sa:ko,P:mo,f:to,qa:jo,d:eo,k:ao,ca:So,n:oo,w:uo,D:xo,J:Mo,R:yo,V:Oo,E:Ji,Wa:Yi,va:Zi};qn(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.Ya).apply(null,arguments)};var Je=o._malloc=function(){return(Je=o._malloc=o.asm.Za).apply(null,arguments)},Kr=o.___errno_location=function(){return(Kr=o.___errno_location=o.asm.$a).apply(null,arguments)},ve=o._free=function(){return(ve=o._free=o.asm.ab).apply(null,arguments)},Zr=o.___getTypeName=function(){return(Zr=o.___getTypeName=o.asm.bb).apply(null,arguments)};o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.cb).apply(null,arguments)};var z=o.stackSave=function(){return(z=o.stackSave=o.asm.db).apply(null,arguments)},W=o.stackRestore=function(){return(W=o.stackRestore=o.asm.eb).apply(null,arguments)},Xt=o.stackAlloc=function(){return(Xt=o.stackAlloc=o.asm.fb).apply(null,arguments)},V=o._setThrew=function(){return(V=o._setThrew=o.asm.gb).apply(null,arguments)},Ut=o.___cxa_can_catch=function(){return(Ut=o.___cxa_can_catch=o.asm.hb).apply(null,arguments)},Ar=o.___cxa_is_pointer_type=function(){return(Ar=o.___cxa_is_pointer_type=o.asm.ib).apply(null,arguments)};o.dynCall_viijii=function(){return(o.dynCall_viijii=o.asm.jb).apply(null,arguments)},o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.kb).apply(null,arguments)},o.dynCall_iiiiij=function(){return(o.dynCall_iiiiij=o.asm.lb).apply(null,arguments)},o.dynCall_iiiiijj=function(){return(o.dynCall_iiiiijj=o.asm.mb).apply(null,arguments)},o.dynCall_iiiiiijj=function(){return(o.dynCall_iiiiiijj=o.asm.nb).apply(null,arguments)};function Ii(e,t){var r=z();try{return L.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function eo(e,t,r,n){var a=z();try{L.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function to(e,t,r){var n=z();try{L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ro(e,t,r,n,a){var s=z();try{return L.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function no(e,t,r){var n=z();try{return L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ao(e,t,r,n,a){var s=z();try{L.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function io(e,t,r,n){var a=z();try{return L.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function oo(e,t,r,n,a,s){var l=z();try{L.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function so(e,t){var r=z();try{L.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function lo(e){var t=z();try{return L.get(e)()}catch(r){if(W(t),r!==r+0&&r!=="longjmp")throw r;V(1,0)}}function uo(e,t,r,n,a,s,l){var u=z();try{L.get(e)(t,r,n,a,s,l)}catch(c){if(W(u),c!==c+0&&c!=="longjmp")throw c;V(1,0)}}function co(e,t,r,n,a,s){var l=z();try{return L.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function fo(e){var t=z();try{L.get(e)()}catch(r){if(W(t),r!==r+0&&r!=="longjmp")throw r;V(1,0)}}function mo(e,t,r){var n=z();try{L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function go(e,t,r,n,a){var s=z();try{return L.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function po(e,t,r){var n=z();try{return L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ho(e,t,r){var n=z();try{return L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function bo(e,t,r,n,a,s,l){var u=z();try{return L.get(e)(t,r,n,a,s,l)}catch(c){if(W(u),c!==c+0&&c!=="longjmp")throw c;V(1,0)}}function _o(e,t){var r=z();try{return L.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function vo(e,t){var r=z();try{return L.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function yo(e,t,r,n,a,s,l,u,c,d,m){var g=z();try{L.get(e)(t,r,n,a,s,l,u,c,d,m)}catch(p){if(W(g),p!==p+0&&p!=="longjmp")throw p;V(1,0)}}function wo(e,t,r,n,a){var s=z();try{return L.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function xo(e,t,r,n,a,s,l,u){var c=z();try{L.get(e)(t,r,n,a,s,l,u)}catch(d){if(W(c),d!==d+0&&d!=="longjmp")throw d;V(1,0)}}function Eo(e,t,r,n,a,s,l,u){var c=z();try{return L.get(e)(t,r,n,a,s,l,u)}catch(d){if(W(c),d!==d+0&&d!=="longjmp")throw d;V(1,0)}}function Fo(e,t,r,n){var a=z();try{return L.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function Po(e,t,r,n){var a=z();try{return L.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function So(e,t,r,n,a,s,l,u,c,d,m){var g=z();try{L.get(e)(t,r,n,a,s,l,u,c,d,m)}catch(p){if(W(g),p!==p+0&&p!=="longjmp")throw p;V(1,0)}}function Mo(e,t,r,n,a,s,l,u,c){var d=z();try{L.get(e)(t,r,n,a,s,l,u,c)}catch(m){if(W(d),m!==m+0&&m!=="longjmp")throw m;V(1,0)}}function To(e,t,r,n,a,s,l,u,c){var d=z();try{return L.get(e)(t,r,n,a,s,l,u,c)}catch(m){if(W(d),m!==m+0&&m!=="longjmp")throw m;V(1,0)}}function ko(e,t,r){var n=z();try{L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function Co(e,t,r){var n=z();try{return L.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function Do(e,t,r,n,a,s){var l=z();try{return L.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function Ro(e,t,r,n,a,s,l,u,c,d,m,g){var p=z();try{return L.get(e)(t,r,n,a,s,l,u,c,d,m,g)}catch(v){if(W(p),v!==v+0&&v!=="longjmp")throw v;V(1,0)}}function Oo(e,t,r,n,a,s,l,u,c,d,m,g,p,v,E,T){var C=z();try{L.get(e)(t,r,n,a,s,l,u,c,d,m,g,p,v,E,T)}catch(H){if(W(C),H!==H+0&&H!=="longjmp")throw H;V(1,0)}}function jo(e,t,r,n){var a=z();try{L.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}o.addRunDependency=It,o.removeRunDependency=ht,o.FS_createPath=i.createPath,o.FS_createDataFile=i.createDataFile,o.FS_createPreloadedFile=i.createPreloadedFile,o.FS_createLazyFile=i.createLazyFile,o.FS_createDevice=i.createDevice,o.FS_unlink=i.unlink;var Lt;function $o(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}et=function e(){Lt||mr(),Lt||(et=e)};function mr(e){if(Xe>0||(Ln(),Xe>0))return;function t(){Lt||(Lt=!0,o.calledRun=!0,!Er&&(Nn(),b(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),zn()))}o.setStatus?(o.setStatus("Running..."),setTimeout(function(){setTimeout(function(){o.setStatus("")},1),t()},1)):t()}if(o.run=mr,o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();mr();var Ir=[];function Xo(e){Ir.push(e)}return o.onRuntimeInitialized=function(){for(var e of Ir)e()},function(){var e,t,r,n,a="/",s,l,u=";",c=0,d=99999;function m(M){var P={};return M.filter(function(k){return P.hasOwnProperty(k)?!1:P[k]=!0})}function g(M,P,k=n){var j=P.endsWith(k),N=M.startsWith(k),re;return j||N?j&&N?re=P.substring(0,P.length-1)+M:re=P+M:re=P+k+M,re}function p(M,P){var k=0;function j(){var N=g(M,P[k++]);return fetch(N).then(function(re){if(re.status===200)return re.text().then(function(le){var I=new URL(re.url),pe=I.pathname.substring(1);return pe=pe.replace(new RegExp(n,"g"),a),{data:le,filePath:pe,fullPath:I.origin+I.pathname}});if(k<P.length)return j();throw new Error("MaterialX file not found: "+M)})}return j()}function v(M,P){var k=0;function j(){var N=g(M,P[k++]);return N=t.resolve(N),new Promise(function(re,le){e.readFile(N,"utf8",function(I,pe){if(I)k<P.length?re(j()):le(new Error("MaterialX file not found: "+M));else{var Re=t.parse(N),Fe=N.substring(Re.root.length),lt=n==="\\"?"\\\\":n;Fe=Fe.replace(new RegExp(lt,"g"),a),re({data:pe,filePath:Fe,fullPath:N})}})})}return j()}function E(M){for(var P=M.concat(u,o.getEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR)),k=["."+n].concat(P.split(u)),j=k.length-1;j;)k[j].trim()===""&&k.splice(j,1),--j;return m(k)}function T(M,P){var k=M;typeof M=="string"&&(k=M.split(u));for(var j=0;j<k.length;++j){var N=k[j];if(l){if(t.isAbsolute(N)){var re=t.parse(N);N=P+a+re.dir.substring(re.root.length)}var le=n==="\\"?"\\\\":n;N.replace(new RegExp(le,"g"),a)}else if(s){var I=document.createElement("a");I.href=N,I.origin+I.pathname+I.search+I.hash===N&&(N=P+I.pathname)}else throw new Error("Unknown environment!");k[j]=N}return typeof M=="string"?k.join(o.PATH_LIST_SEPARATOR):k}function C(M,P){var k=M.split(u);return T(k,P),k.push(D(P)),k=m(k),k=k.join(o.PATH_LIST_SEPARATOR),k}function H(M){var P=/<xi:include href="(.*)"\s*\/>/g,k=M.matchAll(P),j=[];for(var N of k)j.push(N[1]);return j}function h(M,P){var k;if(s)k=p(M,P);else if(l)k=v(M,P);else throw new Error("Unknown environment!");return k}function F(M,P,k=!1){k?(P.files||(P.files=[]),P.files.push(M)):(P.folders||(P.folders=[]),P.folders.splice(0,0,M))}function q(M,P,k,j,N=!0){var re;N?re=M.substring(1,M.lastIndexOf(a)).split(a):re=M.substring(j.length).split(a);for(var le=j,I=1;I<re.length;++I){le+=a+re[I];var pe;try{var Re=i.stat(le);pe=i.isDir(Re.mode)}catch{pe=!1}if(!pe)try{i.mkdir(le),F(le,k)}catch{throw new Error("Failed to create folder in WASM FS.")}}if(N)try{i.writeFile(M,P),F(M,k,!0)}catch{throw new Error("Failed to store file in WASM FS.")}}function D(M){if(l){var P=r.cwd(),k=t.parse(P),j=M+a+P.substring(k.root.length),N=n==="\\"?"\\\\":n;return j.replace(new RegExp(N,"g"),a)}else if(s){var P=window.location.pathname;return P=P.substring(0,P.lastIndexOf(n)),g(P,M,a)}else throw new Error("Unknown environment!")}function se(M,P){if(l)try{e.writeFileSync(M,P)}catch(N){throw new Error("Failed to write file '"+M+"': "+N.message)}else if(s){var k=M.lastIndexOf(n);M=M.substring(k>-1?k+1:0);var j=document.createElement("a");j.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(P)),j.setAttribute("download",M),j.style.display="none",document.body.appendChild(j),j.click(),document.body.removeChild(j)}}Xo(function(){s=typeof window=="object",l=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",s&&(n="/"),l&&(e=require("fs"),t=require("path"),r=require("process"),n=t.sep);function M(P,k,j,N,re=[],le=""){var I="/readFromXml"+c++%d,pe=E(j);try{i.mkdir(I)}catch{throw new Error("Failed to create folder in WASM FS.")}var Re=[];(!N||N.readXIncludes)&&(Re=H(k));var Fe={files:[],folders:[]},lt=D(I),ut=lt+"/ChosenToHopefullyNotClashWithAnyOtherFile123";if(le){var Uo=n==="\\"?"\\\\":n;ut=le.replace(new RegExp(Uo,"g"),a),ut=g(ut,I,a),q(lt,null,Fe,I,!1)}q(ut,k,Fe,I);function en(gr,Ye,pr){var Nt=[Promise.resolve()];for(var hr of Ye){var Ke=gr.slice(),zt=pr.slice(),Lo=h(hr,zt).then(function(Oe){if(Ke.includes(Oe.fullPath))throw new Error(`Cycle detected!
28
- `+Ke.join(`
20
+ `,E.push(p);var H=Hr(Function,E).apply(null,T);return H}function Pt(e,t){for(var r=[],n=0;n<e;n++)r.push(w[(t>>2)+n]);return r}function Ja(e,t,r,n,a,s,l){var u=Pt(r,n);t=ne(t),s=ie(a,s),ge([],[e],function(c){c=c[0];var d=c.name+"."+t;function f(){Te("Cannot call "+d+" due to unbound types",u)}var g=c.registeredClass.constructor;return g[t]===void 0?(f.argCount=r-1,g[t]=f):(ir(g,t,d),g[t].overloadTable[r-1]=f),ge([],u,function(p){var v=[p[0],null].concat(p.slice(1)),E=sr(d,v,null,s,l);return g[t].overloadTable===void 0?(E.argCount=r-1,g[t]=E):g[t].overloadTable[r-1]=E,[]}),[]})}function Vr(e,t,r){return e instanceof Object||B(r+' with invalid "this": '+e),e instanceof t.registeredClass.constructor||B(r+' incompatible with "this" of type '+e.constructor.name),e.$$.ptr||B("cannot call emscripten binding method "+r+" on deleted object"),Ft(e.$$.ptr,e.$$.ptrType.registeredClass,t.registeredClass)}function Ya(e,t,r,n,a,s,l,u){t=ne(t),s=ie(a,s),ge([],[e],function(c){c=c[0];var d=c.name+"."+t,f={get:function(){Te("Cannot access "+d+" due to unbound types",[r])},enumerable:!0,configurable:!0};return u?f.set=function(){Te("Cannot access "+d+" due to unbound types",[r])}:f.set=function(g){B(d+" is a read-only property")},Object.defineProperty(c.registeredClass.constructor,t,f),ge([],[r],function(g){g=g[0];var p={get:function(){return g.fromWireType(s(n))},enumerable:!0};return u&&(u=ie(l,u),p.set=function(v){var E=[];u(n,g.toWireType(E,v)),He(E)}),Object.defineProperty(c.registeredClass.constructor,t,p),[]}),[]})}function Aa(e,t,r,n,a,s){Yt(t>0);var l=Pt(t,r);a=ie(n,a);var u=[s],c=[];ge([],[e],function(d){d=d[0];var f="constructor "+d.name;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[t-1]!==void 0)throw new qe("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+d.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return d.registeredClass.constructor_body[t-1]=function(){Te("Cannot construct "+d.name+" due to unbound types",l)},ge([],l,function(g){return d.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&B(f+" called with "+arguments.length+" arguments, expected "+(t-1)),c.length=0,u.length=t;for(var p=1;p<t;++p)u[p]=g[p].toWireType(c,arguments[p-1]);var v=a.apply(null,u);return He(c),g[0].fromWireType(v)},[]}),[]})}function Ka(e,t,r,n,a,s,l,u){var c=Pt(r,n);t=ne(t),s=ie(a,s),ge([],[e],function(d){d=d[0];var f=d.name+"."+t;u&&d.registeredClass.pureVirtualFunctions.push(t);function g(){Te("Cannot call "+f+" due to unbound types",c)}var p=d.registeredClass.instancePrototype,v=p[t];return v===void 0||v.overloadTable===void 0&&v.className!==d.name&&v.argCount===r-2?(g.argCount=r-2,g.className=d.name,p[t]=g):(ir(p,t,f),p[t].overloadTable[r-2]=g),ge([],c,function(E){var T=sr(f,E,d,s,l);return p[t].overloadTable===void 0?(T.argCount=r-2,p[t]=T):p[t].overloadTable[r-2]=T,[]}),[]})}function Za(e,t,r,n,a,s,l,u,c,d){t=ne(t),a=ie(n,a),ge([],[e],function(f){f=f[0];var g=f.name+"."+t,p={get:function(){Te("Cannot access "+g+" due to unbound types",[r,l])},enumerable:!0,configurable:!0};return c?p.set=function(){Te("Cannot access "+g+" due to unbound types",[r,l])}:p.set=function(v){B(g+" is a read-only property")},Object.defineProperty(f.registeredClass.instancePrototype,t,p),ge([],c?[r,l]:[r],function(v){var E=v[0],T={get:function(){var H=Vr(this,f,g+" getter");return E.fromWireType(a(s,H))},enumerable:!0};if(c){c=ie(u,c);var C=v[1];T.set=function(H){var h=Vr(this,f,g+" setter"),F=[];c(d,h,C.toWireType(F,H)),He(F)}}return Object.defineProperty(f.registeredClass.instancePrototype,t,T),[]}),[]})}function Ia(e,t,r){e=ne(e),ge([],[t],function(n){return n=n[0],o[e]=n.fromWireType(r),[]})}var lr=[],_e=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ur(e){e>4&&--_e[e].refcount===0&&(_e[e]=void 0,lr.push(e))}function ei(){for(var e=0,t=5;t<_e.length;++t)_e[t]!==void 0&&++e;return e}function ti(){for(var e=5;e<_e.length;++e)if(_e[e]!==void 0)return _e[e];return null}function ri(){o.count_emval_handles=ei,o.get_first_emval=ti}function Ee(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var t=lr.length?lr.pop():_e.length;return _e[t]={refcount:1,value:e},t}}}function ni(e,t){t=ne(t),we(e,{name:t,fromWireType:function(r){var n=_e[r].value;return ur(r),n},toWireType:function(r,n){return Ee(n)},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:null})}function ai(e,t,r){switch(t){case 0:return function(n){var a=r?oe:de;return this.fromWireType(a[n])};case 1:return function(n){var a=r?Pe:Ie;return this.fromWireType(a[n>>1])};case 2:return function(n){var a=r?w:ye;return this.fromWireType(a[n>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function ii(e,t,r,n){var a=Et(r);t=ne(t);function s(){}s.values={},we(e,{name:t,constructor:s,fromWireType:function(l){return this.constructor.values[l]},toWireType:function(l,u){return u.value},argPackAdvance:8,readValueFromPointer:ai(t,a,n),destructorFunction:null}),or(t,s)}function Mt(e,t){var r=Ne[e];return r===void 0&&B(t+" has unknown type "+Br(e)),r}function oi(e,t,r){var n=Mt(e,"enum");t=ne(t);var a=n.constructor,s=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:wt(n.name+"_"+t,function(){})}});a.values[r]=s,a[t]=s}function Qe(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function si(e,t){switch(t){case 2:return function(r){return this.fromWireType(Pr[r>>2])};case 3:return function(r){return this.fromWireType(Zt[r>>3])};default:throw new TypeError("Unknown float type: "+e)}}function li(e,t,r){var n=Et(r);t=ne(t),we(e,{name:t,fromWireType:function(a){return a},toWireType:function(a,s){if(typeof s!="number"&&typeof s!="boolean")throw new TypeError('Cannot convert "'+Qe(s)+'" to '+this.name);return s},argPackAdvance:8,readValueFromPointer:si(t,n),destructorFunction:null})}function ui(e,t,r,n,a,s){var l=Pt(t,r);e=ne(e),a=ie(n,a),or(e,function(){Te("Cannot call "+e+" due to unbound types",l)},t-1),ge([],l,function(u){var c=[u[0],null].concat(u.slice(1));return Wr(e,sr(e,c,null,a,s),t-1),[]})}function ci(e,t,r){switch(t){case 0:return r?function(n){return oe[n]}:function(n){return de[n]};case 1:return r?function(n){return Pe[n>>1]}:function(n){return Ie[n>>1]};case 2:return r?function(n){return w[n>>2]}:function(n){return ye[n>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function di(e,t,r,n,a){t=ne(t),a===-1&&(a=4294967295);var s=Et(r),l=function(d){return d};if(n===0){var u=32-8*r;l=function(d){return d<<u>>>u}}var c=t.includes("unsigned");we(e,{name:t,fromWireType:l,toWireType:function(d,f){if(typeof f!="number"&&typeof f!="boolean")throw new TypeError('Cannot convert "'+Qe(f)+'" to '+this.name);if(f<n||f>a)throw new TypeError('Passing a number "'+Qe(f)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+a+"]!");return c?f>>>0:f|0},argPackAdvance:8,readValueFromPointer:ci(t,s,n!==0),destructorFunction:null})}function fi(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[t];function s(l){l=l>>2;var u=ye,c=u[l],d=u[l+1];return new a(gt,d,c)}r=ne(r),we(e,{name:r,fromWireType:s,argPackAdvance:8,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})}function mi(e,t,r,n,a,s,l,u,c,d,f,g){r=ne(r),s=ie(a,s),u=ie(l,u),d=ie(c,d),g=ie(f,g),ge([e],[t],function(p){p=p[0];var v=new xe(r,p.registeredClass,!1,!1,!0,p,n,s,u,d,g);return[v]})}function gi(e,t){t=ne(t);var r=t==="std::string";we(e,{name:t,fromWireType:function(n){var a=ye[n>>2],s;if(r)for(var l=n+4,u=0;u<=a;++u){var c=n+4+u;if(u==a||de[c]==0){var d=c-l,f=$e(l,d);s===void 0?s=f:(s+="\0",s+=f),l=c+1}}else{for(var g=new Array(a),u=0;u<a;++u)g[u]=String.fromCharCode(de[n+4+u]);s=g.join("")}return ve(n),s},toWireType:function(n,a){a instanceof ArrayBuffer&&(a=new Uint8Array(a));var s,l=typeof a=="string";l||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Int8Array||B("Cannot pass non-string to std::string"),r&&l?s=function(){return mt(a)}:s=function(){return a.length};var u=s(),c=Je(4+u+1);if(ye[c>>2]=u,r&&l)Kt(a,c+4,u+1);else if(l)for(var d=0;d<u;++d){var f=a.charCodeAt(d);f>255&&(ve(c),B("String has UTF-16 code units that do not fit in 8 bits")),de[c+4+d]=f}else for(var d=0;d<u;++d)de[c+4+d]=a[d];return n!==null&&n.push(ve,c),c},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(n){ve(n)}})}function pi(e,t,r){r=ne(r);var n,a,s,l,u;t===2?(n=kn,a=Cn,l=Dn,s=function(){return Ie},u=1):t===4&&(n=Rn,a=On,l=jn,s=function(){return ye},u=2),we(e,{name:r,fromWireType:function(c){for(var d=ye[c>>2],f=s(),g,p=c+4,v=0;v<=d;++v){var E=c+4+v*t;if(v==d||f[E>>u]==0){var T=E-p,C=n(p,T);g===void 0?g=C:(g+="\0",g+=C),p=E+t}}return ve(c),g},toWireType:function(c,d){typeof d!="string"&&B("Cannot pass non-string to C++ string type "+r);var f=l(d),g=Je(4+f+t);return ye[g>>2]=f>>u,a(d,g+4,f+t),c!==null&&c.push(ve,g),g},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(c){ve(c)}})}function hi(e,t,r,n,a,s){_t[e]={name:ne(t),rawConstructor:ie(r,n),rawDestructor:ie(a,s),elements:[]}}function bi(e,t,r,n,a,s,l,u,c){_t[e].elements.push({getterReturnType:t,getter:ie(r,n),getterContext:a,setterArgumentType:s,setter:ie(l,u),setterContext:c})}function _i(e,t){t=ne(t),we(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(r,n){}})}function ke(e){return e||B("Cannot use deleted val. handle = "+e),_e[e].value}function vi(e,t,r){e=ke(e),t=Mt(t,"emval::as");var n=[],a=Ee(n);return w[r>>2]=a,t.toWireType(n,e)}function qr(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Mt(w[(t>>2)+n],"parameter "+n);return r}function yi(e,t,r,n){e=ke(e);for(var a=qr(t,r),s=new Array(t),l=0;l<t;++l){var u=a[l];s[l]=u.readValueFromPointer(n),n+=u.argPackAdvance}var c=e.apply(void 0,s);return Ee(c)}var wi={};function Qr(e){var t=wi[e];return t===void 0?ne(e):t}var cr=[];function xi(e,t,r,n){e=cr[e],t=ke(t),r=Qr(r),e(t,r,null,n)}function Ei(e){var t=cr.length;return cr.push(e),t}function Fi(e,t){for(var r=qr(e,t),n=r[0],a=n.name+"_$"+r.slice(1).map(function(v){return v.name}).join("_")+"$",s=["retType"],l=[n],u="",c=0;c<e-1;++c)u+=(c!==0?", ":"")+"arg"+c,s.push("argType"+c),l.push(r[1+c]);for(var d=yt("methodCaller_"+a),f="return function "+d+`(handle, name, destructors, args) {
21
+ `,g=0,c=0;c<e-1;++c)f+=" var arg"+c+" = argType"+c+".readValueFromPointer(args"+(g?"+"+g:"")+`);
22
+ `,g+=r[c+1].argPackAdvance;f+=" var rv = handle[name]("+u+`);
23
+ `;for(var c=0;c<e-1;++c)r[c+1].deleteObject&&(f+=" argType"+c+".deleteObject(arg"+c+`);
24
+ `);n.isVoid||(f+=` return retType.toWireType(destructors, rv);
25
+ `),f+=`};
26
+ `,s.push(f);var p=Hr(Function,s).apply(null,l);return Ei(p)}function Si(e,t){return e=ke(e),t=ke(t),Ee(e[t])}function Pi(e){e>4&&(_e[e].refcount+=1)}function Mi(){return Ee([])}function Ti(e){return Ee(Qr(e))}function ki(){return Ee({})}function Ci(e){var t=_e[e].value;He(t),ur(e)}function Di(e,t,r){e=ke(e),t=ke(t),r=ke(r),e[t]=r}function Ri(e,t){e=Mt(e,"_emval_take_value");var r=e.readValueFromPointer(t);return Ee(r)}function Oi(e){return e=ke(e),Ee(typeof e)}function ji(){ae()}var dr=[];function $i(e,t){dr.length=0;var r;for(t>>=2;r=de[e++];){var n=r<105;n&&t&1&&t++,dr.push(n?Zt[t++>>1]:w[t]),++t}return dr}function Xi(e,t,r){var n=$i(t,r);return Qn[e].apply(null,n)}function Ui(e,t,r){de.copyWithin(e,t,t+r)}function Ni(e){try{return ft.grow(e-gt.byteLength+65535>>>16),Mr(ft.buffer),1}catch{}}function Li(e){var t=de.length;e=e>>>0;var r=2147483648;if(e>r)return!1;for(var n=1;n<=4;n*=2){var a=t+33554432/n,s=Math.min(r,Un(Math.max(e,a),65536)),l=Ni(s);if(l)return!0}return!1}var Jr={};function zi(){return X||"./this.program"}function st(){if(!st.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:zi()};for(var r in Jr)t[r]=Jr[r];var n=[];for(var r in t)n.push(r+"="+t[r]);st.strings=n}return st.strings}function Wi(e,t){try{var r=0;return st().forEach(function(n,a){var s=t+r;w[e+a*4>>2]=s,Xn(n,s),r+=n.length+1}),0}catch(n){return(typeof i>"u"||!(n instanceof i.ErrnoError))&&ae(n),n.errno}}function Gi(e,t){try{var r=st();w[e>>2]=r.length;var n=0;return r.forEach(function(a){n+=a.length+1}),w[t>>2]=n,0}catch(a){return(typeof i>"u"||!(a instanceof i.ErrnoError))&&ae(a),a.errno}}function Bi(e){try{var t=te.getStreamFromFD(e);return i.close(t),0}catch(r){return(typeof i>"u"||!(r instanceof i.ErrnoError))&&ae(r),r.errno}}function Hi(e,t,r,n){try{var a=te.getStreamFromFD(e),s=te.doReadv(a,t,r);return w[n>>2]=s,0}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),l.errno}}function Vi(e,t,r,n,a){try{var s=te.getStreamFromFD(e),l=4294967296,u=r*l+(t>>>0),c=9007199254740992;return u<=-c||u>=c?-61:(i.llseek(s,u,n),me=[s.position>>>0,(K=s.position,+Math.abs(K)>=1?K>0?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],w[a>>2]=me[0],w[a+4>>2]=me[1],s.getdents&&u===0&&n===0&&(s.getdents=null),0)}catch(d){return(typeof i>"u"||!(d instanceof i.ErrnoError))&&ae(d),d.errno}}function qi(e,t,r,n){try{var a=te.getStreamFromFD(e),s=te.doWritev(a,t,r);return w[n>>2]=s,0}catch(l){return(typeof i>"u"||!(l instanceof i.ErrnoError))&&ae(l),l.errno}}function Qi(){return Tn()}function Ji(e){return e}function Yi(e){he(e)}function Tt(e){return e%4===0&&(e%100!==0||e%400===0)}function fr(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}var kt=[31,29,31,30,31,30,31,31,30,31,30,31],Ct=[31,28,31,30,31,30,31,31,30,31,30,31];function Dt(e,t){for(var r=new Date(e.getTime());t>0;){var n=Tt(r.getFullYear()),a=r.getMonth(),s=(n?kt:Ct)[a];if(t>s-r.getDate())t-=s-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1));else return r.setDate(r.getDate()+t),r}return r}function Ai(e,t,r,n){var a=w[n+40>>2],s={tm_sec:w[n>>2],tm_min:w[n+4>>2],tm_hour:w[n+8>>2],tm_mday:w[n+12>>2],tm_mon:w[n+16>>2],tm_year:w[n+20>>2],tm_wday:w[n+24>>2],tm_yday:w[n+28>>2],tm_isdst:w[n+32>>2],tm_gmtoff:w[n+36>>2],tm_zone:a?$e(a):""},l=$e(r),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in u)l=l.replace(new RegExp(c,"g"),u[c]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"];function g(h,F,q){for(var D=typeof h=="number"?h.toString():h||"";D.length<F;)D=q[0]+D;return D}function p(h,F){return g(h,F,"0")}function v(h,F){function q(se){return se<0?-1:se>0?1:0}var D;return(D=q(h.getFullYear()-F.getFullYear()))===0&&(D=q(h.getMonth()-F.getMonth()))===0&&(D=q(h.getDate()-F.getDate())),D}function E(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function T(h){var F=Dt(new Date(h.tm_year+1900,0,1),h.tm_yday),q=new Date(F.getFullYear(),0,4),D=new Date(F.getFullYear()+1,0,4),se=E(q),M=E(D);return v(se,F)<=0?v(M,F)<=0?F.getFullYear()+1:F.getFullYear():F.getFullYear()-1}var C={"%a":function(h){return d[h.tm_wday].substring(0,3)},"%A":function(h){return d[h.tm_wday]},"%b":function(h){return f[h.tm_mon].substring(0,3)},"%B":function(h){return f[h.tm_mon]},"%C":function(h){var F=h.tm_year+1900;return p(F/100|0,2)},"%d":function(h){return p(h.tm_mday,2)},"%e":function(h){return g(h.tm_mday,2," ")},"%g":function(h){return T(h).toString().substring(2)},"%G":function(h){return T(h)},"%H":function(h){return p(h.tm_hour,2)},"%I":function(h){var F=h.tm_hour;return F==0?F=12:F>12&&(F-=12),p(F,2)},"%j":function(h){return p(h.tm_mday+fr(Tt(h.tm_year+1900)?kt:Ct,h.tm_mon-1),3)},"%m":function(h){return p(h.tm_mon+1,2)},"%M":function(h){return p(h.tm_min,2)},"%n":function(){return`
27
+ `},"%p":function(h){return h.tm_hour>=0&&h.tm_hour<12?"AM":"PM"},"%S":function(h){return p(h.tm_sec,2)},"%t":function(){return" "},"%u":function(h){return h.tm_wday||7},"%U":function(h){var F=new Date(h.tm_year+1900,0,1),q=F.getDay()===0?F:Dt(F,7-F.getDay()),D=new Date(h.tm_year+1900,h.tm_mon,h.tm_mday);if(v(q,D)<0){var se=fr(Tt(D.getFullYear())?kt:Ct,D.getMonth()-1)-31,M=31-q.getDate(),S=M+se+D.getDate();return p(Math.ceil(S/7),2)}return v(q,F)===0?"01":"00"},"%V":function(h){var F=new Date(h.tm_year+1900,0,4),q=new Date(h.tm_year+1901,0,4),D=E(F),se=E(q),M=Dt(new Date(h.tm_year+1900,0,1),h.tm_yday);if(v(M,D)<0)return"53";if(v(se,M)<=0)return"01";var S;return D.getFullYear()<h.tm_year+1900?S=h.tm_yday+32-D.getDate():S=h.tm_yday+1-D.getDate(),p(Math.ceil(S/7),2)},"%w":function(h){return h.tm_wday},"%W":function(h){var F=new Date(h.tm_year,0,1),q=F.getDay()===1?F:Dt(F,F.getDay()===0?1:7-F.getDay()+1),D=new Date(h.tm_year+1900,h.tm_mon,h.tm_mday);if(v(q,D)<0){var se=fr(Tt(D.getFullYear())?kt:Ct,D.getMonth()-1)-31,M=31-q.getDate(),S=M+se+D.getDate();return p(Math.ceil(S/7),2)}return v(q,F)===0?"01":"00"},"%y":function(h){return(h.tm_year+1900).toString().substring(2)},"%Y":function(h){return h.tm_year+1900},"%z":function(h){var F=h.tm_gmtoff,q=F>=0;return F=Math.abs(F)/60,F=F/60*100+F%60,(q?"+":"-")+("0000"+F).slice(-4)},"%Z":function(h){return h.tm_zone},"%%":function(){return"%"}};for(var c in C)l.includes(c)&&(l=l.replace(new RegExp(c,"g"),C[c](s)));var H=jt(l,!1);return H.length>t?0:($n(H,e),H.length-1)}function Ki(e,t,r,n){return Ai(e,t,r,n)}var Yr=function(e,t,r,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=i.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},Rt=365,Ot=146;Object.defineProperties(Yr.prototype,{read:{get:function(){return(this.mode&Rt)===Rt},set:function(e){e?this.mode|=Rt:this.mode&=~Rt}},write:{get:function(){return(this.mode&Ot)===Ot},set:function(e){e?this.mode|=Ot:this.mode&=~Ot}},isFolder:{get:function(){return i.isDir(this.mode)}},isDevice:{get:function(){return i.isChrdev(this.mode)}}}),i.FSNode=Yr,i.staticInit(),o.FS_createPath=i.createPath,o.FS_createDataFile=i.createDataFile,o.FS_createPreloadedFile=i.createPreloadedFile,o.FS_createLazyFile=i.createLazyFile,o.FS_createDevice=i.createDevice,o.FS_unlink=i.unlink,$r=o.InternalError=tr(Error,"InternalError"),va(),qe=o.BindingError=tr(Error,"BindingError"),Ta(),Ba(),La(),Gr=o.UnboundTypeError=tr(Error,"UnboundTypeError"),ri();function jt(e,t,r){var n=mt(e)+1,a=new Array(n),s=At(e,a,0,a.length);return t&&(a.length=s),a}var Zi={B:Jn,o:Yn,q:Kn,A:In,b:ta,h:ra,Ka:na,p:jr,fa:aa,M:ia,ua:oa,e:ea,ha:ca,Da:da,Ba:fa,ja:ma,Ca:ga,Qa:ba,Va:_a,Fa:ya,u:Qa,y:Ja,r:Ya,z:Aa,j:Ka,H:Za,U:Ia,Ea:ni,T:ii,S:oi,ka:li,G:ui,O:di,N:fi,s:mi,la:gi,ba:pi,pa:hi,$:bi,Ga:_i,Q:vi,Ra:yi,_:xi,ia:ur,Z:Fi,Pa:Si,ma:Pi,Ta:Mi,Oa:Ti,La:ki,Na:Ci,Sa:Di,C:Ri,Ma:Oi,wa:ji,ea:Xi,ta:Ui,aa:Li,xa:Wi,ya:Gi,X:Bi,Aa:Hi,Ua:Vi,za:qi,a:Qi,Ha:vo,da:_o,Ja:go,ra:Co,oa:Fo,x:lo,g:Ii,Ia:ho,L:po,na:So,Y:wo,c:no,i:io,v:ro,ga:Do,t:co,K:bo,F:Eo,I:To,W:Ro,l:fo,m:so,sa:ko,P:mo,f:to,qa:jo,d:eo,k:ao,ca:Po,n:oo,w:uo,D:xo,J:Mo,R:yo,V:Oo,E:Ji,Wa:Yi,va:Ki};qn(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.Ya).apply(null,arguments)};var Je=o._malloc=function(){return(Je=o._malloc=o.asm.Za).apply(null,arguments)},Ar=o.___errno_location=function(){return(Ar=o.___errno_location=o.asm.$a).apply(null,arguments)},ve=o._free=function(){return(ve=o._free=o.asm.ab).apply(null,arguments)},Kr=o.___getTypeName=function(){return(Kr=o.___getTypeName=o.asm.bb).apply(null,arguments)};o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.cb).apply(null,arguments)};var z=o.stackSave=function(){return(z=o.stackSave=o.asm.db).apply(null,arguments)},W=o.stackRestore=function(){return(W=o.stackRestore=o.asm.eb).apply(null,arguments)},$t=o.stackAlloc=function(){return($t=o.stackAlloc=o.asm.fb).apply(null,arguments)},V=o._setThrew=function(){return(V=o._setThrew=o.asm.gb).apply(null,arguments)},Xt=o.___cxa_can_catch=function(){return(Xt=o.___cxa_can_catch=o.asm.hb).apply(null,arguments)},Zr=o.___cxa_is_pointer_type=function(){return(Zr=o.___cxa_is_pointer_type=o.asm.ib).apply(null,arguments)};o.dynCall_viijii=function(){return(o.dynCall_viijii=o.asm.jb).apply(null,arguments)},o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.kb).apply(null,arguments)},o.dynCall_iiiiij=function(){return(o.dynCall_iiiiij=o.asm.lb).apply(null,arguments)},o.dynCall_iiiiijj=function(){return(o.dynCall_iiiiijj=o.asm.mb).apply(null,arguments)},o.dynCall_iiiiiijj=function(){return(o.dynCall_iiiiiijj=o.asm.nb).apply(null,arguments)};function Ii(e,t){var r=z();try{return N.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function eo(e,t,r,n){var a=z();try{N.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function to(e,t,r){var n=z();try{N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ro(e,t,r,n,a){var s=z();try{return N.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function no(e,t,r){var n=z();try{return N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ao(e,t,r,n,a){var s=z();try{N.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function io(e,t,r,n){var a=z();try{return N.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function oo(e,t,r,n,a,s){var l=z();try{N.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function so(e,t){var r=z();try{N.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function lo(e){var t=z();try{return N.get(e)()}catch(r){if(W(t),r!==r+0&&r!=="longjmp")throw r;V(1,0)}}function uo(e,t,r,n,a,s,l){var u=z();try{N.get(e)(t,r,n,a,s,l)}catch(c){if(W(u),c!==c+0&&c!=="longjmp")throw c;V(1,0)}}function co(e,t,r,n,a,s){var l=z();try{return N.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function fo(e){var t=z();try{N.get(e)()}catch(r){if(W(t),r!==r+0&&r!=="longjmp")throw r;V(1,0)}}function mo(e,t,r){var n=z();try{N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function go(e,t,r,n,a){var s=z();try{return N.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function po(e,t,r){var n=z();try{return N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function ho(e,t,r){var n=z();try{return N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function bo(e,t,r,n,a,s,l){var u=z();try{return N.get(e)(t,r,n,a,s,l)}catch(c){if(W(u),c!==c+0&&c!=="longjmp")throw c;V(1,0)}}function _o(e,t){var r=z();try{return N.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function vo(e,t){var r=z();try{return N.get(e)(t)}catch(n){if(W(r),n!==n+0&&n!=="longjmp")throw n;V(1,0)}}function yo(e,t,r,n,a,s,l,u,c,d,f){var g=z();try{N.get(e)(t,r,n,a,s,l,u,c,d,f)}catch(p){if(W(g),p!==p+0&&p!=="longjmp")throw p;V(1,0)}}function wo(e,t,r,n,a){var s=z();try{return N.get(e)(t,r,n,a)}catch(l){if(W(s),l!==l+0&&l!=="longjmp")throw l;V(1,0)}}function xo(e,t,r,n,a,s,l,u){var c=z();try{N.get(e)(t,r,n,a,s,l,u)}catch(d){if(W(c),d!==d+0&&d!=="longjmp")throw d;V(1,0)}}function Eo(e,t,r,n,a,s,l,u){var c=z();try{return N.get(e)(t,r,n,a,s,l,u)}catch(d){if(W(c),d!==d+0&&d!=="longjmp")throw d;V(1,0)}}function Fo(e,t,r,n){var a=z();try{return N.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function So(e,t,r,n){var a=z();try{return N.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}function Po(e,t,r,n,a,s,l,u,c,d,f){var g=z();try{N.get(e)(t,r,n,a,s,l,u,c,d,f)}catch(p){if(W(g),p!==p+0&&p!=="longjmp")throw p;V(1,0)}}function Mo(e,t,r,n,a,s,l,u,c){var d=z();try{N.get(e)(t,r,n,a,s,l,u,c)}catch(f){if(W(d),f!==f+0&&f!=="longjmp")throw f;V(1,0)}}function To(e,t,r,n,a,s,l,u,c){var d=z();try{return N.get(e)(t,r,n,a,s,l,u,c)}catch(f){if(W(d),f!==f+0&&f!=="longjmp")throw f;V(1,0)}}function ko(e,t,r){var n=z();try{N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function Co(e,t,r){var n=z();try{return N.get(e)(t,r)}catch(a){if(W(n),a!==a+0&&a!=="longjmp")throw a;V(1,0)}}function Do(e,t,r,n,a,s){var l=z();try{return N.get(e)(t,r,n,a,s)}catch(u){if(W(l),u!==u+0&&u!=="longjmp")throw u;V(1,0)}}function Ro(e,t,r,n,a,s,l,u,c,d,f,g){var p=z();try{return N.get(e)(t,r,n,a,s,l,u,c,d,f,g)}catch(v){if(W(p),v!==v+0&&v!=="longjmp")throw v;V(1,0)}}function Oo(e,t,r,n,a,s,l,u,c,d,f,g,p,v,E,T){var C=z();try{N.get(e)(t,r,n,a,s,l,u,c,d,f,g,p,v,E,T)}catch(H){if(W(C),H!==H+0&&H!=="longjmp")throw H;V(1,0)}}function jo(e,t,r,n){var a=z();try{N.get(e)(t,r,n)}catch(s){if(W(a),s!==s+0&&s!=="longjmp")throw s;V(1,0)}}o.addRunDependency=It,o.removeRunDependency=pt,o.FS_createPath=i.createPath,o.FS_createDataFile=i.createDataFile,o.FS_createPreloadedFile=i.createPreloadedFile,o.FS_createLazyFile=i.createLazyFile,o.FS_createDevice=i.createDevice,o.FS_unlink=i.unlink;var Ut;function $o(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}et=function e(){Ut||mr(),Ut||(et=e)};function mr(e){if(Xe>0||(Nn(),Xe>0))return;function t(){Ut||(Ut=!0,o.calledRun=!0,!Er&&(Ln(),b(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),zn()))}o.setStatus?(o.setStatus("Running..."),setTimeout(function(){setTimeout(function(){o.setStatus("")},1),t()},1)):t()}if(o.run=mr,o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();mr();var Ir=[];function Xo(e){Ir.push(e)}return o.onRuntimeInitialized=function(){for(var e of Ir)e()},function(){var e,t,r,n,a="/",s,l,u=";",c=0,d=99999;function f(M){var S={};return M.filter(function(k){return S.hasOwnProperty(k)?!1:S[k]=!0})}function g(M,S,k=n){var j=S.endsWith(k),L=M.startsWith(k),re;return j||L?j&&L?re=S.substring(0,S.length-1)+M:re=S+M:re=S+k+M,re}function p(M,S){var k=0;function j(){var L=g(M,S[k++]);return fetch(L).then(function(re){if(re.status===200)return re.text().then(function(le){var Z=new URL(re.url),pe=Z.pathname.substring(1);return pe=pe.replace(new RegExp(n,"g"),a),{data:le,filePath:pe,fullPath:Z.origin+Z.pathname}});if(k<S.length)return j();throw new Error("MaterialX file not found: "+M)})}return j()}function v(M,S){var k=0;function j(){var L=g(M,S[k++]);return L=t.resolve(L),new Promise(function(re,le){e.readFile(L,"utf8",function(Z,pe){if(Z)k<S.length?re(j()):le(new Error("MaterialX file not found: "+M));else{var Re=t.parse(L),Fe=L.substring(Re.root.length),lt=n==="\\"?"\\\\":n;Fe=Fe.replace(new RegExp(lt,"g"),a),re({data:pe,filePath:Fe,fullPath:L})}})})}return j()}function E(M){for(var S=M.concat(u,o.getEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR)),k=["."+n].concat(S.split(u)),j=k.length-1;j;)k[j].trim()===""&&k.splice(j,1),--j;return f(k)}function T(M,S){var k=M;typeof M=="string"&&(k=M.split(u));for(var j=0;j<k.length;++j){var L=k[j];if(l){if(t.isAbsolute(L)){var re=t.parse(L);L=S+a+re.dir.substring(re.root.length)}var le=n==="\\"?"\\\\":n;L.replace(new RegExp(le,"g"),a)}else if(s){var Z=document.createElement("a");Z.href=L,Z.origin+Z.pathname+Z.search+Z.hash===L&&(L=S+Z.pathname)}else throw new Error("Unknown environment!");k[j]=L}return typeof M=="string"?k.join(o.PATH_LIST_SEPARATOR):k}function C(M,S){var k=M.split(u);return T(k,S),k.push(D(S)),k=f(k),k=k.join(o.PATH_LIST_SEPARATOR),k}function H(M){var S=/<xi:include href="(.*)"\s*\/>/g,k=M.matchAll(S),j=[];for(var L of k)j.push(L[1]);return j}function h(M,S){var k;if(s)k=p(M,S);else if(l)k=v(M,S);else throw new Error("Unknown environment!");return k}function F(M,S,k=!1){k?(S.files||(S.files=[]),S.files.push(M)):(S.folders||(S.folders=[]),S.folders.splice(0,0,M))}function q(M,S,k,j,L=!0){var re;L?re=M.substring(1,M.lastIndexOf(a)).split(a):re=M.substring(j.length).split(a);for(var le=j,Z=1;Z<re.length;++Z){le+=a+re[Z];var pe;try{var Re=i.stat(le);pe=i.isDir(Re.mode)}catch{pe=!1}if(!pe)try{i.mkdir(le),F(le,k)}catch{throw new Error("Failed to create folder in WASM FS.")}}if(L)try{i.writeFile(M,S),F(M,k,!0)}catch{throw new Error("Failed to store file in WASM FS.")}}function D(M){if(l){var S=r.cwd(),k=t.parse(S),j=M+a+S.substring(k.root.length),L=n==="\\"?"\\\\":n;return j.replace(new RegExp(L,"g"),a)}else if(s){var S=window.location.pathname;return S=S.substring(0,S.lastIndexOf(n)),g(S,M,a)}else throw new Error("Unknown environment!")}function se(M,S){if(l)try{e.writeFileSync(M,S)}catch(L){throw new Error("Failed to write file '"+M+"': "+L.message)}else if(s){var k=M.lastIndexOf(n);M=M.substring(k>-1?k+1:0);var j=document.createElement("a");j.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(S)),j.setAttribute("download",M),j.style.display="none",document.body.appendChild(j),j.click(),document.body.removeChild(j)}}Xo(function(){s=typeof window=="object",l=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",s&&(n="/"),l&&(e=require("fs"),t=require("path"),r=require("process"),n=t.sep);function M(S,k,j,L,re=[],le=""){var Z="/readFromXml"+c++%d,pe=E(j);try{i.mkdir(Z)}catch{throw new Error("Failed to create folder in WASM FS.")}var Re=[];(!L||L.readXIncludes)&&(Re=H(k));var Fe={files:[],folders:[]},lt=D(Z),ut=lt+"/ChosenToHopefullyNotClashWithAnyOtherFile123";if(le){var Uo=n==="\\"?"\\\\":n;ut=le.replace(new RegExp(Uo,"g"),a),ut=g(ut,Z,a),q(lt,null,Fe,Z,!1)}q(ut,k,Fe,Z);function en(gr,Ye,pr){var Nt=[Promise.resolve()];for(var hr of Ye){var Ae=gr.slice(),Lt=pr.slice(),No=h(hr,Lt).then(function(Oe){if(Ae.includes(Oe.fullPath))throw new Error(`Cycle detected!
28
+ `+Ae.join(`
29
29
  -> `)+`
30
- -> `+Oe.fullPath);Ke.push(Oe.fullPath);var tn=Oe.fullPath.lastIndexOf(n),rn=Oe.fullPath.substring(0,tn>-1?tn:0);zt.includes(rn)||zt.splice(0,0,rn);var No=H(Oe.data),nn=g(Oe.filePath,I,a);return Fe.files.includes(nn)||q(nn,Oe.data,Fe,I),en(Ke,No,zt)});Nt.push(Lo)}return Promise.all(Nt)}return en(re,Re,pe).then(function(){var gr=C(j,I);i.chdir(lt);try{var Ye=o.getEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR);if(Ye){var pr=T(Ye,I);o.setEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR,pr)}o._readFromXmlFile(P,ut,gr,N),Ye&&o.setEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR,Ye)}catch(Ke){throw new Error("Failed to read MaterialX files from WASM FS: "+o.getExceptionMessage(Ke))}try{for(var Nt of Fe.files)i.unlink(Nt);i.chdir("/");for(var hr of Fe.folders)i.rmdir(hr);i.rmdir(I)}catch{throw new Error("Failed to delete temporary files from WASM FS.")}})}o.readFromXmlString=function(P,k,j="",N=null){if(arguments.length<2||arguments.length>4)throw new Error("Function readFromXmlString called with an invalid number of arguments ("+arguments.length+") - expects 2 to 4!");return M(P,k,j,N)},o.readFromXmlFile=function(P,k,j="",N=null){if(arguments.length<2||arguments.length>4)throw new Error("Function readFromXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 4!");var re=E(j);return h(k,re).then(function(le){var I=[le.fullPath],pe=le.fullPath.lastIndexOf(n),Re=le.fullPath.substring(0,pe>-1?pe:0);return j=j.concat(u,Re),M(P,le.data,j,N,I,le.filePath)})},o.writeToXmlFile=function(P,k,j=null){if(arguments.length<2||arguments.length>3)throw new Error("Function writeToXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 3!");var N=o.writeToXmlString(P,j);se(k,N)},o.exportToXmlFile=function(P,k,j=null){if(arguments.length<2||arguments.length>3)throw new Error("Function exportToXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 3!");var N=o.exportToXmlString(P,j);se(k,N)}})}(),f.ready}}();typeof exports=="object"&&typeof module=="object"?module.exports=Bt:typeof define=="function"&&define.amd?define([],function(){return Bt}):typeof exports=="object"&&(exports.MaterialX=Bt);function cn(y){const f=new URLSearchParams(window.location.search).get(y);return f==null||f==="0"||f==="false"?!1:f===""?!0:f}const Q=cn("debugmaterialx"),ss=Q==="update";let dn=0;function fn(){return dn}let mn=0;function gn(){return mn}const ls=window.performance||window.webkitPerformance||window.mozPerformance;function pn(){dn=ls.now()/1e3,mn++,window.requestAnimationFrame(pn)}window.requestAnimationFrame(pn);async function us(){return typeof requestIdleCallback<"u"?new Promise(y=>requestIdleCallback(y)):(console.debug("[MaterialX] Can not wait for network idle, using fallback"),new Promise(y=>setTimeout(y,100)))}function cs(){return window.location.hostname==="localhost"||/^\d{1,3}(\.\d{1,3}){3}$/.test(window.location.hostname)}const ds=cn("debugmaterialx"),Ht=new Wt;Ht.needsUpdate=!0,Ht.image=new Image,Ht.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";function hn(y,f,o=0,b=1024,R=512,x){let _;x?_=x:f.image?_=f.image.height/4:_=256;const X=Math.log2(_)-2,S=_,$=3*Math.max(Math.pow(2,X),112),O=new zo(b,R,{format:Go,type:Wo,minFilter:on,magFilter:an,generateMipmaps:!0,wrapS:br,anisotropy:y.capabilities.getMaxAnisotropy()}),ee=new sn(2,2),J=new Bo(-1,1,1,-1,0,1),K=new ln({defines:{USE_ENVMAP:"",ENVMAP_TYPE_CUBE_UV:"",CUBEUV_TEXEL_WIDTH:1/$,CUBEUV_TEXEL_HEIGHT:1/S,CUBEUV_MAX_MIP:X+0+".0"},uniforms:{envMap:{value:f},roughness:{value:o}},vertexShader:`
30
+ -> `+Oe.fullPath);Ae.push(Oe.fullPath);var tn=Oe.fullPath.lastIndexOf(n),rn=Oe.fullPath.substring(0,tn>-1?tn:0);Lt.includes(rn)||Lt.splice(0,0,rn);var Lo=H(Oe.data),nn=g(Oe.filePath,Z,a);return Fe.files.includes(nn)||q(nn,Oe.data,Fe,Z),en(Ae,Lo,Lt)});Nt.push(No)}return Promise.all(Nt)}return en(re,Re,pe).then(function(){var gr=C(j,Z);i.chdir(lt);try{var Ye=o.getEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR);if(Ye){var pr=T(Ye,Z);o.setEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR,pr)}o._readFromXmlFile(S,ut,gr,L),Ye&&o.setEnviron(o.MATERIALX_SEARCH_PATH_ENV_VAR,Ye)}catch(Ae){throw new Error("Failed to read MaterialX files from WASM FS: "+o.getExceptionMessage(Ae))}try{for(var Nt of Fe.files)i.unlink(Nt);i.chdir("/");for(var hr of Fe.folders)i.rmdir(hr);i.rmdir(Z)}catch{throw new Error("Failed to delete temporary files from WASM FS.")}})}o.readFromXmlString=function(S,k,j="",L=null){if(arguments.length<2||arguments.length>4)throw new Error("Function readFromXmlString called with an invalid number of arguments ("+arguments.length+") - expects 2 to 4!");return M(S,k,j,L)},o.readFromXmlFile=function(S,k,j="",L=null){if(arguments.length<2||arguments.length>4)throw new Error("Function readFromXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 4!");var re=E(j);return h(k,re).then(function(le){var Z=[le.fullPath],pe=le.fullPath.lastIndexOf(n),Re=le.fullPath.substring(0,pe>-1?pe:0);return j=j.concat(u,Re),M(S,le.data,j,L,Z,le.filePath)})},o.writeToXmlFile=function(S,k,j=null){if(arguments.length<2||arguments.length>3)throw new Error("Function writeToXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 3!");var L=o.writeToXmlString(S,j);se(k,L)},o.exportToXmlFile=function(S,k,j=null){if(arguments.length<2||arguments.length>3)throw new Error("Function exportToXmlFile called with an invalid number of arguments ("+arguments.length+") - expects 2 to 3!");var L=o.exportToXmlString(S,j);se(k,L)}})}(),m.ready}}();typeof exports=="object"&&typeof module=="object"?module.exports=Bt:typeof define=="function"&&define.amd?define([],function(){return Bt}):typeof exports=="object"&&(exports.MaterialX=Bt);function cn(y){const m=new URLSearchParams(window.location.search).get(y);return m==null||m==="0"||m==="false"?!1:m===""?!0:m}const Q=cn("debugmaterialx"),ss=Q==="update";let dn=0;function fn(){return dn}let mn=0;function gn(){return mn}const ls=window.performance||window.webkitPerformance||window.mozPerformance;function pn(){dn=ls.now()/1e3,mn++,window.requestAnimationFrame(pn)}window.requestAnimationFrame(pn);async function us(){return typeof requestIdleCallback<"u"?new Promise(y=>requestIdleCallback(y)):(console.debug("[MaterialX] Can not wait for network idle, using fallback"),new Promise(y=>setTimeout(y,100)))}function cs(){return window.location.hostname==="localhost"||/^\d{1,3}(\.\d{1,3}){3}$/.test(window.location.hostname)}const ds=cn("debugmaterialx"),Ht=new zt;Ht.needsUpdate=!0,Ht.image=new Image,Ht.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";function hn(y,m,o=0,b=1024,R=512,x){let _;x?_=x:m.image?_=m.image.height/4:_=256;const X=Math.log2(_)-2,P=_,$=3*Math.max(Math.pow(2,X),112),O=new zo(b,R,{format:Go,type:Wo,minFilter:on,magFilter:an,generateMipmaps:!0,wrapS:br,anisotropy:y.capabilities.getMaxAnisotropy()}),I=new sn(2,2),J=new Bo(-1,1,1,-1,0,1),ee=new ln({defines:{USE_ENVMAP:"",ENVMAP_TYPE_CUBE_UV:"",CUBEUV_TEXEL_WIDTH:1/$,CUBEUV_TEXEL_HEIGHT:1/P,CUBEUV_MAX_MIP:X+0+".0"},uniforms:{envMap:{value:m},roughness:{value:o}},vertexShader:`
31
31
  varying vec2 vUv;
32
32
 
33
33
  void main() {
@@ -69,7 +69,7 @@ return ret;
69
69
 
70
70
  gl_FragColor = vec4(envColor.rgb, 1.0);
71
71
  }
72
- `}),G=new Ho,ce=new _r(ee,K);G.add(ce);const Pe=y.getRenderTarget(),ze=y.autoClear,Ze=y.xr.enabled,We=y.shadowMap.enabled;O.texture.generateMipmaps=!0;try{y.xr.enabled=!1,y.shadowMap.enabled=!1,y.autoClear=!0,y.setRenderTarget(O),y.clear(),y.render(G,J)}finally{y.setRenderTarget(Pe),y.autoClear=ze,y.xr.enabled=Ze,y.shadowMap.enabled=We,ee.dispose(),K.dispose(),G.remove(ce)}return O.texture.name="PMREM_Equirectangular_Texture_"+o.toFixed(2),O.texture.mapping=Vo,ds&&console.log("[MaterialX] PMREM to Equirect Render Target:",{width:O.width,height:O.height,mipmaps:O.texture.mipmaps?.length,roughness:o}),O}const Vt="_",bn=Vt+"uaddressmode",_n=Vt+"vaddressmode",vn=Vt+"filtertype",fs="/";function vr(y,f){let o;if(y)o=[...y.data()];else{o=[];for(let b=0;b<f;++b)o.push(0)}return o}function yn(y,f){const o=new Array(f);if(y)for(let b=0;b<y.numRows();++b)for(let R=0;R<y.numColumns();++R)o.push(y.getItem(b,R));else for(let b=0;b<f;++b)o.push(0);return o}const qt=new Wt;qt.needsUpdate=!0,qt.image=new Image,qt.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";const Qt=new Wt;Qt.needsUpdate=!0,Qt.image=new Image,Qt.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAABJQTFRFgYH4gIH4gYH3gIH3gIH5gID4m94ORAAAADFJREFUeJxjZBBkfMdo9P/BB0aBj/8FGB0ufghgFGT4r8wo+P8rD2Pgo3sMjIz8jAwAMLoN0ZjS5hgAAAAASUVORK5CYII=";function ms(y){const f=je.enabled;je.enabled=!0;const o=je.get(y);return je.enabled=f,o}function gs(y,f){const o=je.enabled;je.enabled=!0,je.add(y,f),je.enabled=o,Q&&console.log("[MaterialX] Added to cache:",y,f)}function ps(y,f,o,b,R,x){const _=new qo(null);switch(f){case"float":case"integer":case"boolean":_.value=o;break;case"vector2":_.value=vr(o,2);break;case"vector3":case"color3":_.value=vr(o,3);break;case"vector4":case"color4":_.value=vr(o,4);break;case"matrix33":_.value=yn(o,9);break;case"matrix44":_.value=yn(o,16);break;case"filename":if(o){let S=!0,$=x+fs+o;o.startsWith("blob:")||o.startsWith("data:")?($=o,S=!1):o.startsWith("http")&&($=o,S=!0);const O=R.cacheKey?.length?`${R.cacheKey}-${$}`:$,ee=S?ms(O):null;if(ee)Q&&console.log("[MaterialX] Use cached texture: ",O,ee),ee instanceof Promise?ee.then(J=>{J?_.value=J:console.warn(`[MaterialX] Failed to load texture ${b} '${$}'`)}):_.value=ee;else{Q&&console.log("[MaterialX] Load texture:",$),b.toLowerCase().includes("normal")?_.value=Qt:_.value=qt;const J=_.value,K=R.getTexture($)?.then(G=>(G&&(G=G.clone(),G.colorSpace=Qo,hs(G,b,y)),G)).catch(G=>(console.error(`[MaterialX] Failed to load texture ${b} '${$}'`,G),J));S&&gs(O,K),K?.then(G=>{G?_.value=G:console.warn(`[MaterialX] Failed to load texture ${b} '${$}'`)})}}break;case"samplerCube":case"string":break;default:const X=f+":"+b;wn.has(X)||(wn.set(X,!0),(Q||cs())&&console.warn(`MaterialX: Unsupported uniform '${b}': ${f}`));break}return _}const wn=new Map;function xn(y){let f;switch(y){case 1:f=Ko;break;case 2:f=br;break;case 3:f=Yo;break;default:f=br;break}return f}function hs(y,f,o,b=!0){const R=f.lastIndexOf(Vt),x=f.substring(0,R)||f;if(o.find(x+bn)){const S=o.find(x+bn).getValue().getData();y.wrapS=xn(S)}if(o.find(x+_n)){const S=o.find(x+_n).getValue().getData();y.wrapT=xn(S)}const _=o.find(x+vn)?o.get(x+vn).value:-1;let X=b?on:an;_===0&&(X=b?Zo:Ao),y.minFilter=X}function bs(y){let f=new Array;for(let o of y.getNodes())o.getType()==="lightshader"&&f.push(o);return f}let Ne={};async function _s(y,f){Ne={};const o=f.getOptions().hwMaxActiveLightSources;y.HwShaderGenerator.unbindLightShaders(f);let b=1;const R=`<?xml version="1.0"?>
72
+ `}),G=new Ho,ce=new _r(I,ee);G.add(ce);const Se=y.getRenderTarget(),ze=y.autoClear,Ke=y.xr.enabled,We=y.shadowMap.enabled;O.texture.generateMipmaps=!0;try{y.xr.enabled=!1,y.shadowMap.enabled=!1,y.autoClear=!0,y.setRenderTarget(O),y.clear(),y.render(G,J)}finally{y.setRenderTarget(Se),y.autoClear=ze,y.xr.enabled=Ke,y.shadowMap.enabled=We,I.dispose(),ee.dispose(),G.remove(ce)}return O.texture.name="PMREM_Equirectangular_Texture_"+o.toFixed(2),O.texture.mapping=Vo,ds&&console.log("[MaterialX] PMREM to Equirect Render Target:",{width:O.width,height:O.height,mipmaps:O.texture.mipmaps?.length,roughness:o}),O}const Vt="_",bn=Vt+"uaddressmode",_n=Vt+"vaddressmode",vn=Vt+"filtertype",fs="/";function vr(y,m){let o;if(y)o=[...y.data()];else{o=[];for(let b=0;b<m;++b)o.push(0)}return o}function yn(y,m){const o=new Array(m);if(y)for(let b=0;b<y.numRows();++b)for(let R=0;R<y.numColumns();++R)o.push(y.getItem(b,R));else for(let b=0;b<m;++b)o.push(0);return o}const qt=new zt;qt.needsUpdate=!0,qt.image=new Image,qt.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";const Qt=new zt;Qt.needsUpdate=!0,Qt.image=new Image,Qt.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAABJQTFRFgYH4gIH4gYH3gIH3gIH5gID4m94ORAAAADFJREFUeJxjZBBkfMdo9P/BB0aBj/8FGB0ufghgFGT4r8wo+P8rD2Pgo3sMjIz8jAwAMLoN0ZjS5hgAAAAASUVORK5CYII=";function ms(y){const m=je.enabled;je.enabled=!0;const o=je.get(y);return je.enabled=m,o}function gs(y,m){const o=je.enabled;je.enabled=!0,je.add(y,m),je.enabled=o,Q&&console.log("[MaterialX] Added to cache:",y,m)}function ps(y,m,o,b,R,x){const _=new qo(null);switch(m){case"float":case"integer":case"boolean":_.value=o;break;case"vector2":_.value=vr(o,2);break;case"vector3":case"color3":_.value=vr(o,3);break;case"vector4":case"color4":_.value=vr(o,4);break;case"matrix33":_.value=yn(o,9);break;case"matrix44":_.value=yn(o,16);break;case"filename":if(o){let P=!0,$=x+fs+o;o.startsWith("blob:")||o.startsWith("data:")?($=o,P=!1):o.startsWith("http")&&($=o,P=!0);const O=R.cacheKey?.length?`${R.cacheKey}-${$}`:$,I=P?ms(O):null;if(I)Q&&console.log("[MaterialX] Use cached texture: ",O,I),I instanceof Promise?I.then(J=>{J?_.value=J:console.warn(`[MaterialX] Failed to load texture ${b} '${$}'`)}):_.value=I;else{Q&&console.log("[MaterialX] Load texture:",$),b.toLowerCase().includes("normal")?_.value=Qt:_.value=qt;const J=_.value,ee=R.getTexture($)?.then(G=>(G&&(G=G.clone(),G.colorSpace=Qo,hs(G,b,y)),G)).catch(G=>(console.error(`[MaterialX] Failed to load texture ${b} '${$}'`,G),J));P&&gs(O,ee),ee?.then(G=>{G?_.value=G:console.warn(`[MaterialX] Failed to load texture ${b} '${$}'`)})}}break;case"samplerCube":case"string":break;default:const X=m+":"+b;wn.has(X)||(wn.set(X,!0),(Q||cs())&&console.warn(`MaterialX: Unsupported uniform '${b}': ${m}`));break}return _}const wn=new Map;function xn(y){let m;switch(y){case 1:m=Ao;break;case 2:m=br;break;case 3:m=Yo;break;default:m=br;break}return m}function hs(y,m,o,b=!0){const R=m.lastIndexOf(Vt),x=m.substring(0,R)||m;if(o.find(x+bn)){const P=o.find(x+bn).getValue().getData();y.wrapS=xn(P)}if(o.find(x+_n)){const P=o.find(x+_n).getValue().getData();y.wrapT=xn(P)}const _=o.find(x+vn)?o.get(x+vn).value:-1;let X=b?on:an;_===0&&(X=b?Ko:Zo),y.minFilter=X}function bs(y){let m=new Array;for(let o of y.getNodes())o.getType()==="lightshader"&&m.push(o);return m}let Le={};async function _s(y,m){Le={};const o=m.getOptions().hwMaxActiveLightSources;y.HwShaderGenerator.unbindLightShaders(m);let b=1;const R=`<?xml version="1.0"?>
73
73
  <materialx version="1.39">
74
74
  <directional_light name="default_directional_light" type="lightshader">
75
75
  </directional_light>
@@ -81,10 +81,10 @@ return ret;
81
81
  <area_light name="default_area_light" type="lightshader">
82
82
  </area_light>
83
83
  -->
84
- </materialx>`,x=y.createDocument();await y.readFromXmlString(x,R,"");const _=y.createDocument(),X=y.loadStandardLibraries(f);_.setDataLibrary(X),_.importLibrary(x);const S=bs(_);Q&&console.log("Default lights in MaterialX document",S),f.getOptions().hwMaxActiveLightSources=o;for(let $ of S){const O=$.getNodeDef();if(Q&&console.log("Default light node definition",O),!O)continue;const ee=O.getName();Q&&console.log("Registering default light",{lightName:ee,lightDef:O}),Ne[ee]||(Q&&console.log("Bind light shader for node",{lightName:ee,lightId:b,lightDef:O}),Ne[ee]=b,y.HwShaderGenerator.bindLightShader(O,b++,f))}Q&&console.log("Light types bound in MaterialX context",Ne)}const En={};function vs(y){switch(y){case"PointLight":return"ND_point_light";case"DirectionalLight":return"ND_directional_light";case"SpotLight":return"ND_spot_light";default:return En[y]||(En[y]=!0,console.warn("MaterialX: Unsupported light type: "+y)),null}}function ys(y,f){const o=new Array,b=f.getOptions().hwMaxActiveLightSources;for(let x of y){if(!x?.isLight)continue;const _=vs(x.type);if(!_)continue;Ne[_]||Q&&console.error("MaterialX: Light type not registered in context. Make sure to register light types before using them.",_);const X=x.getWorldPosition(new ct),S=x.getWorldQuaternion(new Jo),$=new ct(0,0,-1).applyQuaternion(S),O=x.angle,ee=O*(1-x.penumbra),J=Math.cos(ee),K=Math.cos(O);o.push({type:Ne[_],position:X.clone(),direction:$.clone(),color:new un().fromArray(x.color.toArray()),intensity:x.intensity*(x.isPointLight||x.isSpotLight?683/3.1415:1),decay_rate:2,inner_angle:J,outer_angle:K})}const R=o.length;for(;o.length<b;){const x={type:0,position:new ct(0,0,0),direction:new ct(0,0,-1),color:new un(0,0,0),intensity:0,decay_rate:2,inner_angle:0,outer_angle:0};o.push(x)}return ss&&console.log("Registered lights in MaterialX context",Ne,o),{lightData:o,lightCount:R}}function Fn(y,f,o){const b={},R=y.getUniformBlocks();for(const[x,_]of Object.entries(R))if(x!=="LightData"&&!_.empty())for(let X=0;X<_.size();++X){const S=_.get(X),$=S.getValue()?.getData(),O=S.getVariable(),ee=S.getType().getName();b[O]=ps(_,ee,$,O,f,o),Q&&console.log("Adding uniform",{path:S.getPath(),type:ee,name:O,value:b[O]})}return b}function Jt(y,f){const o=f.getUniformBlocks();for(const[b,R]of Object.entries(o))if(b!=="LightData"&&!R.empty())for(let x=0;x<R.size();++x){const _=R.get(x),X=_.getVariable();let S=_.getPath().split("/").pop();switch(S){case"_Color":S="color";break;case"_Roughness":S="roughness";break;case"_Metallic":S="metalness";break}S&&(y.hasOwnProperty(S)?Q&&console.warn(`[MaterialX] Uniform ${X} already exists in material as property ${S}, skipping.`):Object.defineProperty(y,S,{get:function(){return this.uniforms?.[X].value},set:function($){const O=this.uniforms;if(!O||!O[X]){console.warn(`[MaterialX] Uniform ${X} not found in ${this.name} uniforms`);return}this.uniforms[X].value=$,this.uniformsNeedUpdate=!0}}))}}async function ws(y){if(y==="immediately")return ft();if(y==="network_idle")return us().then(ft)}const Y=new class{materialXModule=null;materialXGenerator=null;materialXGenContext=null;materialXStdLib=null;materialXInitPromise=null};async function ft(){return Y.materialXInitPromise?Y.materialXInitPromise:Y.materialXInitPromise=(async()=>{if(!Y.materialXModule){Q&&console.log("[MaterialX] Initializing WASM module...");try{const y="1.4.0";let f;f=[`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXCore.wasm`,`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXGenShader.wasm`,`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXGenShader.data.txt`];const[o,b,R]=f,x=await Bt({locateFile:(X,S)=>(Q&&console.debug("[MaterialX] locateFile called:",{path:X,scriptDirectory:S}),X.includes("JsMaterialXCore.wasm")?o:X.includes("JsMaterialXGenShader.wasm")?b:X.includes("JsMaterialXGenShader.data")?R:S+X)});Q&&console.log("[MaterialX] module loaded",x),Y.materialXModule=x,Y.materialXGenerator=x.EsslShaderGenerator.create(),Y.materialXGenContext=new x.GenContext(Y.materialXGenerator);const _=x.createDocument();Y.materialXStdLib=x.loadStandardLibraries(Y.materialXGenContext),_.setDataLibrary(Y.materialXStdLib),Y.materialXGenContext.getOptions().shaderInterfaceType=Y.materialXModule.ShaderInterfaceType.SHADER_INTERFACE_COMPLETE,Y.materialXGenContext.getOptions().hwSpecularEnvironmentMethod=Y.materialXModule.HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_FIS,Y.materialXGenContext.getOptions().hwSrgbEncodeOutput=!1,Y.materialXGenContext.getOptions().hwMaxActiveLightSources=4,await _s(Y.materialXModule,Y.materialXGenContext),Q&&console.log("[MaterialX] Generator initialized successfully")}catch(y){throw console.error("[MaterialX] Failed to load MaterialX module:",y),y}}})()}class wr{static get(f){return this.getEnvironment(f)}static _environments=new Map;static getEnvironment(f){if(this._environments.has(f))return this._environments.get(f);const o=new wr(f);return this._environments.set(f,o),o}_lights=[];_lightData=null;_lightCount=0;_initializePromise=null;_isInitialized=!1;_lastUpdateFrame=-1;constructor(f){this._scene=f,Q&&console.log("[MaterialX] Environment created")}async initialize(f){return this._initializePromise?this._initializePromise:(this._initializePromise=this._initialize(f),this._initializePromise)}update(f,o,b){if(!this._initializePromise){this.initialize(b);return}if(this._isInitialized&&this._lastUpdateFrame!==f&&(this._lastUpdateFrame=f,this.updateLighting(!1),Q&&!this._debug)){const R=this._getTextures(o.environment);this._debug=!0;const x=new Io;x.side=2;const _=x.clone();_.map=R.radianceTexture;const X=new sn(1,1,1,1),S=new _r(X,_),$=x.clone();$.map=R.irradianceTexture;const O=new _r(X,$);o.add(S),o.add(O),S.name="MaterialXRadianceCube",S.position.set(.8,1,.01),S.scale.set(1.5,1,1),O.name="MaterialXIrradianceCube",O.position.set(-.8,1,-.01),O.scale.set(1.5,.98,1),console.log("[MaterialX] environment initialized from Needle context",{textures:R,radianceCube:S,irradianceCube:O})}}reset(){Q&&console.log("[MaterialX] Resetting environment"),this._initializePromise=null,this._isInitialized=!1,this._lastUpdateFrame=-1,this._lights=[],this._lightData=null,this._lightCount=0,this._pmremGenerator?.dispose(),this._pmremGenerator=null,this._renderer=null;for(const f of this._texturesCache.values())f.radianceTexture?.dispose(),f.irradianceTexture?.dispose();this._texturesCache.clear()}get lights(){return this._lights}get lightData(){return this._lightData}get lightCount(){return this._lightCount||0}getTextures(f){if(f.envMap)return this._getTextures(f.envMap);const o=this._scene.environment||this._scene.background;return o instanceof Wt?this._getTextures(o):this._getTextures(null)}_pmremGenerator=null;_renderer=null;_texturesCache=new Map;async _initialize(f){return this._isInitialized=!1,this._pmremGenerator=new es(f),this._renderer=f,this.updateLighting(!0),this._isInitialized=!0,!0}_getTextures(f){f||(f=Ht);let o=this._texturesCache.get(f||null);if(o)return o;if(this._scene&&this._pmremGenerator&&this._renderer&&f){Q&&console.log("[MaterialX] Generating environment textures",f.name);const b=this._pmremGenerator.fromEquirectangular(f),R=hn(this._renderer,b.texture,0,1024,512,b.height),x=hn(this._renderer,b.texture,1,32,16,b.height);b.dispose(),o={radianceTexture:R.texture,irradianceTexture:x.texture}}else o={radianceTexture:null,irradianceTexture:null};return this._texturesCache.set(f||null,o),o}updateLighting=(f=!1)=>{if(this._scene){if(f){const o=new Array;this._scene.traverse(b=>{b.isLight&&b.visible&&o.push(b)}),this._lights=o}if(Y.materialXGenContext){const{lightData:o,lightCount:b}=ys(this._lights,Y.materialXGenContext);this._lightData=o,this._lightCount=b}}}}const xs=new as;class yr extends ln{shaderName=null;copy(f){return super.copy(f),this._context=f._context,this._shader=f._shader,this.uniforms=ts(f.uniforms),this.uniformsGroups=rs(f.uniformsGroups),this.envMapIntensity=f.envMapIntensity,this.envMap=f.envMap,Jt(this,this._shader.getStage("pixel")),Jt(this,this._shader.getStage("vertex")),this.needsUpdate=!0,this}_context=null;_shader=null;_needsTangents=!1;constructor(f){if(!f){super();return}let o=f.shader.getSourceCode("vertex"),b=f.shader.getSourceCode("pixel");o=o.replace(/^#version.*$/gm,"").trim(),b=b.replace(/^#version.*$/gm,"").trim(),o=o.replace(/\bi_position\b/g,"position"),o=o.replace(/\bi_normal\b/g,"normal"),o=o.replace(/\bi_texcoord_0\b/g,"uv"),o=o.replace(/\bi_texcoord_1\b/g,"uv1"),o=o.replace(/\bi_texcoord_2\b/g,"uv2"),o=o.replace(/\bi_texcoord_3\b/g,"uv3"),o=o.replace(/\bi_tangent\b/g,"tangent"),o=o.replace(/\bi_color_0\b/g,"color");const R=f.parameters?.precision||"highp";o=o.replace(/precision mediump float;/g,`precision ${R} float;`),o=o.replace(/#define M_FLOAT_EPS 1e-8/g,R==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),b=b.replace(/precision mediump float;/g,`precision ${R} float;`),b=b.replace(/#define M_FLOAT_EPS 1e-8/g,R==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),b=b.replace(/\bi_position\b/g,"position"),b=b.replace(/\bi_normal\b/g,"normal"),b=b.replace(/\bi_texcoord_0\b/g,"uv"),b=b.replace(/\bi_texcoord_1\b/g,"uv1"),b=b.replace(/\bi_texcoord_2\b/g,"uv2"),b=b.replace(/\bi_texcoord_3\b/g,"uv3"),b=b.replace(/\bi_tangent\b/g,"tangent"),b=b.replace(/\bi_color_0\b/g,"color");const x=o.includes("in vec2 uv;"),_=o.includes("in vec2 uv1;"),X=o.includes("in vec2 uv2;"),S=o.includes("in vec2 uv3;");o=o.replace(/in\s+vec3\s+position;/g,""),o=o.replace(/in\s+vec3\s+normal;/g,""),o=o.replace(/in\s+vec2\s+uv;/g,""),o=o.replace(/in\s+vec3\s+uv;/g,"");var $=o.includes("in vec3 uv1;");o=o.replace(/in\s+vec3\s+uv1;/g,"");var O=o.includes("in vec3 uv2;");o=o.replace(/in\s+vec3\s+uv2;/g,"");var ee=o.includes("in vec3 uv3;");o=o.replace(/in\s+vec3\s+uv3;/g,"");var J=o.includes("in vec4 tangent;");o=o.replace(/in\s+vec4\s+tangent;/g,"");var K=o.includes("in vec4 color;");o=o.replace(/in\s+vec4\s+color;/g,""),x||(o=o.replace(/texcoord_0 = uv;/g,"texcoord_0 = vec3(uv, 0.0);")),_||(o=o.replace(/texcoord_1 = uv1;/g,"texcoord_1 = vec3(uv1, 0.0);")),X||(o=o.replace(/texcoord_2 = uv2;/g,"texcoord_2 = vec3(uv2, 0.0);")),S||(o=o.replace(/texcoord_3 = uv3;/g,"texcoord_3 = vec3(uv3, 0.0);")),b=b.replace(/result\.direction\s*=\s*light\.position\s*-\s*position;/g,"result.direction = (light.position - position) * 10.0 / 1.0;"),b=b.replace(/out\s+vec4\s+out1;/,`layout(location = 0) out vec4 pc_fragColor;
84
+ </materialx>`,x=y.createDocument();await y.readFromXmlString(x,R,"");const _=y.createDocument(),X=y.loadStandardLibraries(m);_.setDataLibrary(X),_.importLibrary(x);const P=bs(_);Q&&console.log("Default lights in MaterialX document",P),m.getOptions().hwMaxActiveLightSources=o;for(let $ of P){const O=$.getNodeDef();if(Q&&console.log("Default light node definition",O),!O)continue;const I=O.getName();Q&&console.log("Registering default light",{lightName:I,lightDef:O}),Le[I]||(Q&&console.log("Bind light shader for node",{lightName:I,lightId:b,lightDef:O}),Le[I]=b,y.HwShaderGenerator.bindLightShader(O,b++,m))}Q&&console.log("Light types bound in MaterialX context",Le)}const En={};function vs(y){switch(y){case"PointLight":return"ND_point_light";case"DirectionalLight":return"ND_directional_light";case"SpotLight":return"ND_spot_light";default:return En[y]||(En[y]=!0,console.warn("MaterialX: Unsupported light type: "+y)),null}}function ys(y,m){const o=new Array,b=m.getOptions().hwMaxActiveLightSources;for(let x of y){if(!x?.isLight)continue;const _=vs(x.type);if(!_)continue;Le[_]||Q&&console.error("MaterialX: Light type not registered in context. Make sure to register light types before using them.",_);const X=x.getWorldPosition(new ct),P=x.getWorldQuaternion(new Jo),$=new ct(0,0,-1).applyQuaternion(P),O=x.angle,I=O*(1-x.penumbra),J=Math.cos(I),ee=Math.cos(O);o.push({type:Le[_],position:X.clone(),direction:$.clone(),color:new un().fromArray(x.color.toArray()),intensity:x.intensity*(x.isPointLight||x.isSpotLight?683/3.1415:1),decay_rate:2,inner_angle:J,outer_angle:ee})}const R=o.length;for(;o.length<b;){const x={type:0,position:new ct(0,0,0),direction:new ct(0,0,-1),color:new un(0,0,0),intensity:0,decay_rate:2,inner_angle:0,outer_angle:0};o.push(x)}return ss&&console.log("Registered lights in MaterialX context",Le,o),{lightData:o,lightCount:R}}function Fn(y,m,o){const b={},R=y.getUniformBlocks();for(const[x,_]of Object.entries(R))if(x!=="LightData"&&!_.empty())for(let X=0;X<_.size();++X){const P=_.get(X),$=P.getValue()?.getData(),O=P.getVariable(),I=P.getType().getName();b[O]=ps(_,I,$,O,m,o),Q&&console.log("Adding uniform",{path:P.getPath(),type:I,name:O,value:b[O]})}return b}function Jt(y,m){const o=m.getUniformBlocks();for(const[b,R]of Object.entries(o))if(b!=="LightData"&&!R.empty())for(let x=0;x<R.size();++x){const _=R.get(x),X=_.getVariable();let P=_.getPath().split("/").pop();switch(P){case"_Color":P="color";break;case"_Roughness":P="roughness";break;case"_Metallic":P="metalness";break}P&&(y.hasOwnProperty(P)?Q&&console.warn(`[MaterialX] Uniform ${X} already exists in material as property ${P}, skipping.`):Object.defineProperty(y,P,{get:function(){return this.uniforms?.[X].value},set:function($){const O=this.uniforms;if(!O||!O[X]){console.warn(`[MaterialX] Uniform ${X} not found in ${this.name} uniforms`);return}this.uniforms[X].value=$,this.uniformsNeedUpdate=!0}}))}}async function ws(y){if(y==="immediately")return dt();if(y==="network_idle")return us().then(dt)}const Y=new class{materialXModule=null;materialXGenerator=null;materialXGenContext=null;materialXStdLib=null;materialXInitPromise=null};async function dt(){return Y.materialXInitPromise?Y.materialXInitPromise:Y.materialXInitPromise=(async()=>{if(!Y.materialXModule){Q&&console.log("[MaterialX] Initializing WASM module...");try{const y="1.4.0";let m;m=[`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXCore.wasm`,`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXGenShader.wasm`,`https://cdn.needle.tools/static/materialx/${y}/JsMaterialXGenShader.data.txt`];const[o,b,R]=m,x=await Bt({locateFile:(X,P)=>(Q&&console.debug("[MaterialX] locateFile called:",{path:X,scriptDirectory:P}),X.includes("JsMaterialXCore.wasm")?o:X.includes("JsMaterialXGenShader.wasm")?b:X.includes("JsMaterialXGenShader.data")?R:P+X)});Q&&console.log("[MaterialX] module loaded",x),Y.materialXModule=x,Y.materialXGenerator=x.EsslShaderGenerator.create(),Y.materialXGenContext=new x.GenContext(Y.materialXGenerator);const _=x.createDocument();Y.materialXStdLib=x.loadStandardLibraries(Y.materialXGenContext),_.setDataLibrary(Y.materialXStdLib),Y.materialXGenContext.getOptions().shaderInterfaceType=Y.materialXModule.ShaderInterfaceType.SHADER_INTERFACE_COMPLETE,Y.materialXGenContext.getOptions().hwSpecularEnvironmentMethod=Y.materialXModule.HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_FIS,Y.materialXGenContext.getOptions().hwSrgbEncodeOutput=!1,Y.materialXGenContext.getOptions().hwMaxActiveLightSources=4,await _s(Y.materialXModule,Y.materialXGenContext),Q&&console.log("[MaterialX] Generator initialized successfully")}catch(y){throw console.error("[MaterialX] Failed to load MaterialX module:",y),y}}})()}class wr{static get(m){return this.getEnvironment(m)}static _environments=new Map;static getEnvironment(m){if(this._environments.has(m))return this._environments.get(m);const o=new wr(m);return this._environments.set(m,o),o}_lights=[];_lightData=null;_lightCount=0;_initializePromise=null;_isInitialized=!1;_lastUpdateFrame=-1;constructor(m){this._scene=m,Q&&console.log("[MaterialX] Environment created")}async initialize(m){return this._initializePromise?this._initializePromise:(this._initializePromise=this._initialize(m),this._initializePromise)}update(m,o,b){if(!this._initializePromise){this.initialize(b);return}if(this._isInitialized&&this._lastUpdateFrame!==m&&(this._lastUpdateFrame=m,this.updateLighting(!1),Q&&!this._debug)){const R=this._getTextures(o.environment);this._debug=!0;const x=new Io;x.side=2;const _=x.clone();_.map=R.radianceTexture;const X=new sn(1,1,1,1),P=new _r(X,_),$=x.clone();$.map=R.irradianceTexture;const O=new _r(X,$);o.add(P),o.add(O),P.name="MaterialXRadianceCube",P.position.set(.8,1,.01),P.scale.set(1.5,1,1),O.name="MaterialXIrradianceCube",O.position.set(-.8,1,-.01),O.scale.set(1.5,.98,1),console.log("[MaterialX] environment initialized from Needle context",{textures:R,radianceCube:P,irradianceCube:O})}}reset(){Q&&console.log("[MaterialX] Resetting environment"),this._initializePromise=null,this._isInitialized=!1,this._lastUpdateFrame=-1,this._lights=[],this._lightData=null,this._lightCount=0,this._pmremGenerator?.dispose(),this._pmremGenerator=null,this._renderer=null;for(const m of this._texturesCache.values())m.radianceTexture?.dispose(),m.irradianceTexture?.dispose();this._texturesCache.clear()}get lights(){return this._lights}get lightData(){return this._lightData}get lightCount(){return this._lightCount||0}getTextures(m){if(m.envMap)return this._getTextures(m.envMap);const o=this._scene.environment||this._scene.background;return o instanceof zt?this._getTextures(o):this._getTextures(null)}_pmremGenerator=null;_renderer=null;_texturesCache=new Map;async _initialize(m){return this._isInitialized=!1,this._pmremGenerator=new es(m),this._renderer=m,this.updateLighting(!0),this._isInitialized=!0,!0}_getTextures(m){m||(m=Ht);let o=this._texturesCache.get(m||null);if(o)return o;if(this._scene&&this._pmremGenerator&&this._renderer&&m){Q&&console.log("[MaterialX] Generating environment textures",m.name);const b=this._pmremGenerator.fromEquirectangular(m),R=hn(this._renderer,b.texture,0,1024,512,b.height),x=hn(this._renderer,b.texture,1,32,16,b.height);b.dispose(),o={radianceTexture:R.texture,irradianceTexture:x.texture}}else o={radianceTexture:null,irradianceTexture:null};return this._texturesCache.set(m||null,o),o}updateLighting=(m=!1)=>{if(this._scene){if(m){const o=new Array;this._scene.traverse(b=>{b.isLight&&b.visible&&o.push(b)}),this._lights=o}if(Y.materialXGenContext){const{lightData:o,lightCount:b}=ys(this._lights,Y.materialXGenContext);this._lightData=o,this._lightCount=b}}}}const xs=new as;class yr extends ln{shaderName=null;copy(m){return super.copy(m),this._context=m._context,this._shader=m._shader,this.uniforms=ts(m.uniforms),this.uniformsGroups=rs(m.uniformsGroups),this.envMapIntensity=m.envMapIntensity,this.envMap=m.envMap,Jt(this,this._shader.getStage("pixel")),Jt(this,this._shader.getStage("vertex")),this.needsUpdate=!0,this}_context=null;_shader=null;_needsTangents=!1;constructor(m){if(!m){super();return}let o=m.shader.getSourceCode("vertex"),b=m.shader.getSourceCode("pixel");o=o.replace(/^#version.*$/gm,"").trim(),b=b.replace(/^#version.*$/gm,"").trim(),o=o.replace(/\bi_position\b/g,"position"),o=o.replace(/\bi_normal\b/g,"normal"),o=o.replace(/\bi_texcoord_0\b/g,"uv"),o=o.replace(/\bi_texcoord_1\b/g,"uv1"),o=o.replace(/\bi_texcoord_2\b/g,"uv2"),o=o.replace(/\bi_texcoord_3\b/g,"uv3"),o=o.replace(/\bi_tangent\b/g,"tangent"),o=o.replace(/\bi_color_0\b/g,"color");const R=m.parameters?.precision||"highp";o=o.replace(/precision mediump float;/g,`precision ${R} float;`),o=o.replace(/#define M_FLOAT_EPS 1e-8/g,R==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),b=b.replace(/precision mediump float;/g,`precision ${R} float;`),b=b.replace(/#define M_FLOAT_EPS 1e-8/g,R==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),b=b.replace(/\bi_position\b/g,"position"),b=b.replace(/\bi_normal\b/g,"normal"),b=b.replace(/\bi_texcoord_0\b/g,"uv"),b=b.replace(/\bi_texcoord_1\b/g,"uv1"),b=b.replace(/\bi_texcoord_2\b/g,"uv2"),b=b.replace(/\bi_texcoord_3\b/g,"uv3"),b=b.replace(/\bi_tangent\b/g,"tangent"),b=b.replace(/\bi_color_0\b/g,"color");const x=o.includes("in vec2 uv;"),_=o.includes("in vec2 uv1;"),X=o.includes("in vec2 uv2;"),P=o.includes("in vec2 uv3;");o=o.replace(/in\s+vec3\s+position;/g,""),o=o.replace(/in\s+vec3\s+normal;/g,""),o=o.replace(/in\s+vec2\s+uv;/g,""),o=o.replace(/in\s+vec3\s+uv;/g,"");var $=o.includes("in vec3 uv1;");o=o.replace(/in\s+vec3\s+uv1;/g,"");var O=o.includes("in vec3 uv2;");o=o.replace(/in\s+vec3\s+uv2;/g,"");var I=o.includes("in vec3 uv3;");o=o.replace(/in\s+vec3\s+uv3;/g,"");var J=o.includes("in vec4 tangent;");o=o.replace(/in\s+vec4\s+tangent;/g,"");var ee=o.includes("in vec4 color;");o=o.replace(/in\s+vec4\s+color;/g,""),x||(o=o.replace(/texcoord_0 = uv;/g,"texcoord_0 = vec3(uv, 0.0);")),_||(o=o.replace(/texcoord_1 = uv1;/g,"texcoord_1 = vec3(uv1, 0.0);")),X||(o=o.replace(/texcoord_2 = uv2;/g,"texcoord_2 = vec3(uv2, 0.0);")),P||(o=o.replace(/texcoord_3 = uv3;/g,"texcoord_3 = vec3(uv3, 0.0);")),b=b.replace(/result\.direction\s*=\s*light\.position\s*-\s*position;/g,"result.direction = (light.position - position) * 10.0 / 1.0;"),b=b.replace(/out\s+vec4\s+out1;/,`layout(location = 0) out vec4 pc_fragColor;
85
85
  #define gl_FragColor pc_fragColor`),b=b.replace(/^\s*out1\s*=\s*vec4\((.*)\);/gm,`
86
86
  gl_FragColor = vec4($1);
87
87
  #include <tonemapping_fragment>
88
- #include <colorspace_fragment>`);const G={};$&&(G.USE_UV1=""),O&&(G.USE_UV2=""),ee&&(G.USE_UV3=""),J&&(G.USE_TANGENT=""),K&&(G.USE_COLOR="");const ce="",Pe=f.parameters?.transparent??!1;super({name:f.name,uniforms:{},vertexShader:o,fragmentShader:b,glslVersion:ns,depthTest:!0,depthWrite:!Pe,defines:G,...f.parameters}),this.shaderName=f.shaderName||null,this._context=f.context,this._shader=f.shader,this._needsTangents=o.includes("in vec4 tangent;")||o.includes("in vec3 tangent;"),Object.assign(this.uniforms,{...Fn(f.shader.getStage("vertex"),f.loaders,ce),...Fn(f.shader.getStage("pixel"),f.loaders,ce),u_worldMatrix:{value:new Gt},u_viewProjectionMatrix:{value:new Gt},u_viewPosition:{value:new ct},u_worldInverseTransposeMatrix:{value:new Gt},u_envMatrix:{value:new Gt},u_envRadiance:{value:null,type:"t"},u_envRadianceMips:{value:8,type:"i"},u_envRadianceSamples:{value:8,type:"i"},u_envIrradiance:{value:null,type:"t"},u_refractionEnv:{value:!0},u_numActiveLightSources:{value:0},u_lightData:{value:[],needsUpdate:!1}}),Jt(this,f.shader.getStage("pixel")),Jt(this,f.shader.getStage("vertex")),(Q||f.debug)&&(console.group("[MaterialX]: ",this.name),console.log(`Vertex shader length: ${o.length}
88
+ #include <colorspace_fragment>`);const G={};$&&(G.USE_UV1=""),O&&(G.USE_UV2=""),I&&(G.USE_UV3=""),J&&(G.USE_TANGENT=""),ee&&(G.USE_COLOR="");const ce="",Se=m.parameters?.transparent??!1;super({name:m.name,uniforms:{},vertexShader:o,fragmentShader:b,glslVersion:ns,depthTest:!0,depthWrite:!Se,defines:G,...m.parameters}),this.shaderName=m.shaderName||null,this._context=m.context,this._shader=m.shader,this._needsTangents=o.includes("in vec4 tangent;")||o.includes("in vec3 tangent;"),Object.assign(this.uniforms,{...Fn(m.shader.getStage("vertex"),m.loaders,ce),...Fn(m.shader.getStage("pixel"),m.loaders,ce),u_worldMatrix:{value:new Wt},u_viewProjectionMatrix:{value:new Wt},u_viewPosition:{value:new ct},u_worldInverseTransposeMatrix:{value:new Wt},u_envMatrix:{value:new Wt},u_envRadiance:{value:null,type:"t"},u_envRadianceMips:{value:8,type:"i"},u_envRadianceSamples:{value:8,type:"i"},u_envIrradiance:{value:null,type:"t"},u_refractionEnv:{value:!0},u_numActiveLightSources:{value:0},u_lightData:{value:[],needsUpdate:!1}}),Jt(this,m.shader.getStage("pixel")),Jt(this,m.shader.getStage("vertex")),(Q||m.debug)&&(console.group("[MaterialX]: ",this.name),console.log(`Vertex shader length: ${o.length}
89
89
  `,o),console.log(`Fragment shader length: ${b.length}
90
- `,b),console.groupEnd())}_missingTangentsWarned=!1;onBeforeRender(f,o,b,R,x,_){this._needsTangents&&!R.attributes.tangent&&(this._missingTangentsWarned||(this._missingTangentsWarned=!0,console.warn(`[MaterialX] Tangents are required for this material (${this.name}) but not present in the geometry.`)));const X=this._context?.getTime?.()||fn(),S=this._context?.getFrame?.()||gn(),$=wr.get(o);$&&($.update(S,o,f),this.updateEnvironmentUniforms($)),this.updateUniforms(f,x,b,X,S)}envMapIntensity=1;envMap=null;updateUniforms=(f,o,b,R,x)=>{const _=this.uniforms;_.u_worldMatrix&&(_.u_worldMatrix.value.copy(o.matrixWorld),_.u_worldMatrix.needsUpdate=!0),_.u_viewPosition&&(_.u_viewPosition.value.setFromMatrixPosition(b.matrixWorld),_.u_viewPosition.needsUpdate=!0),_.u_viewProjectionMatrix&&(_.u_viewProjectionMatrix.value.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),_.u_viewProjectionMatrix.needsUpdate=!0),_.u_worldInverseTransposeMatrix&&(_.u_worldInverseTransposeMatrix.value.setFromMatrix3(xs.getNormalMatrix(o.matrixWorld)),_.u_worldInverseTransposeMatrix.needsUpdate=!0),_.u_time&&(R===void 0&&(R=fn()),_.u_time.value=R),_.u_frame&&(x===void 0&&(x=gn()),_.u_frame.value=x),this.uniformsNeedUpdate=!0};updateEnvironmentUniforms=f=>{const o=this.uniforms,b=f.lightData||null,R=f.lightCount||0,x=f.getTextures(this)||null;if(o.u_numActiveLightSources&&R>=0&&(o.u_numActiveLightSources.value=R),b?.length&&(o.u_lightData.value=b,"needsUpdate"in o.u_lightData&&o.u_lightData.needsUpdate===!1&&(Q&&console.debug(`[MaterialX] LightData assigned (${this.name}, ${this.uuid})`,b),o.u_lightData.needsUpdate=void 0)),o.u_envRadiance){const _=o.u_envRadiance.value;o.u_envRadiance.value=x.radianceTexture,_!=x.radianceTexture&&(o.u_envRadiance.needsUpdate=!0)}if(o.u_envRadianceMips&&(o.u_envRadianceMips.value=Math.trunc(Math.log2(Math.max(x.radianceTexture?.source.data.width??0,x.radianceTexture?.source.data.height??0)))+1),o.u_envIrradiance){const _=o.u_envIrradiance.value;o.u_envIrradiance.value=x.irradianceTexture,_!=x.irradianceTexture&&(o.u_envIrradiance.needsUpdate=!0)}this.uniformsNeedUpdate=!0}}class Pn{name="NEEDLE_materials_mtlx";_generatedMaterials=[];_documentReadyPromise=null;get materialX_root_data(){const f=this.parser.json.extensions?.[this.name];if(!f)return null;let o=null;return"documents"in f&&Array.isArray(f.documents)?o=f.documents:o=[f],o}get materials(){return this._generatedMaterials}constructor(f,o,b){this.parser=f,this.options=o,this.context=b,Q&&console.log("MaterialXLoader created for parser"),this.materialX_root_data&&ft()}loadMaterial(f){return this.parser.json.materials?.[f]?.extensions?.[this.name]?this._loadMaterialAsync(f):null}async _loadMaterialAsync(f){const o=this.parser.json.materials?.[f];Q&&console.debug("[MaterialX] extension found in material:",o.extensions?.[this.name]);const b=o.extensions?.[this.name],R=b.document||0,x=this.materialX_root_data?.[R],_=x.mtlx||null;if(b&&_){const S={...this.options};return S.parameters||(S.parameters={}),S.parameters?.side===void 0&&o.doubleSided!==void 0&&(S.parameters.side=o.doubleSided?is:os),Sn(_,b.name,{cacheKey:this.options.cacheKey||"",getTexture:async $=>{const O=$.split("/").pop()?.split(".").shift()||"";if(x){const ee=x.textures||[];let J=-1;for(const K of ee)if(K.name===O){const G=K.pointer,ce=G.substring(10);if(J=parseInt(ce),isNaN(J)||J<0){console.error("[MaterialX] Invalid texture index in pointer:",G);return}else Q&&console.log("[MaterialX] Texture index found:",J,"for",O)}if(J<0){console.error("[MaterialX] Texture not found in parser:",O,this.parser.json);return}return this.parser.getDependency("texture",J)}return null}},S,this.context).then($=>($ instanceof yr&&this._generatedMaterials.push($),$))}const X=new dt;return X.name="MaterialX_Fallback",X}}function Es(y,f,o){y.register(b=>new Pn(b,f||{},o||{}))}async function Fs(y){if(await ft(),!Y.materialXModule)throw new Error("[MaterialX] module failed to initialize");const f=Y.materialXModule.createDocument();return f.setDataLibrary(Y.materialXStdLib),await Y.materialXModule.readFromXmlString(f,y,""),Q&&console.log("[MaterialX] root document parsed successfully"),f}async function Sn(y,f,o,b,R){try{Q&&console.log(`Creating MaterialX material: ${f}`);const x=await Fs(y);if(!Y.materialXModule||!Y.materialXGenerator||!Y.materialXGenContext){console.warn("[MaterialX] WASM module not ready, returning fallback material");const K=new dt;return K.name=`MaterialX_Fallback_${f}`,K}let _=null,X=!1;Q&&console.log("[MaterialX] document",x);const S=x.getMaterialNodes();Q&&console.log(`[MaterialX] Found ${S.length} material nodes in document`,S);for(let K=0;K<S.length;++K){const G=S[K];if(G){const ce=G.getNamePath();if(Q&&console.log(`[MaterialX] Scan material[${K}]: ${ce}`),S.length===1||ce==f||K===f){f=ce,_=G,X=!0,Q&&console.log(`[MaterialX] Use material node: '${ce}'`);break}}}if(_){if(typeof f=="number"){console.warn(`[MaterialX] Material node not found by index (${f}), using first renderable element: ${_.getNamePath()}`);const K=new dt;return K.color.set(16711935),K.name=`MaterialX_NodeNotFound_${f}`,K}}else{console.warn(`[MaterialX] No renderable element found in MaterialX document (${f}) \u2192 Please provide a name or index. Options: ${S.map(G=>G.getNamePath()).join(", ")}`);const K=new dt;return K.color.set(16711935),K.name=`MaterialX_NoRenderable_${f}`,K}Q&&console.log("[MaterialX] Using renderable element for shader generation");const $=Y.materialXModule.isTransparentSurface(_,Y.materialXGenerator.getTarget());Y.materialXGenContext.getOptions().hwTransparency=$,Q&&console.log("[MaterialX] Generating MaterialX shaders...");const O=_.getNamePath?_.getNamePath():_.getName(),ee=Y.materialXGenerator.generate(O,_,Y.materialXGenContext),J=new yr({name:f,shaderName:null,shader:ee,context:R||{},parameters:{transparent:$,...b?.parameters},loaders:o});return Q&&console.log("[MaterialX] material created:",J.name),J}catch(x){console.error(`[MaterialX] Error creating MaterialX material (${f}):`,x);const _=new dt;return _.color.set(16711935),_.name=`MaterialX_Error_${f}`,_}}const Ps={createMaterialXMaterial:Sn};export{Ps as Experimental_API,Pn as MaterialXLoader,yr as MaterialXMaterial,ws as preloadWasm,ft as ready,Es as useNeedleMaterialX};
90
+ `,b),console.groupEnd())}_missingTangentsWarned=!1;onBeforeRender(m,o,b,R,x,_){this._needsTangents&&!R.attributes.tangent&&(this._missingTangentsWarned||(this._missingTangentsWarned=!0,console.warn(`[MaterialX] Tangents are required for this material (${this.name}) but not present in the geometry.`)));const X=this._context?.getTime?.()||fn(),P=this._context?.getFrame?.()||gn(),$=wr.get(o);$&&($.update(P,o,m),this.updateEnvironmentUniforms($)),this.updateUniforms(m,x,b,X,P)}envMapIntensity=1;envMap=null;updateUniforms=(m,o,b,R,x)=>{const _=this.uniforms;_.u_worldMatrix&&(_.u_worldMatrix.value.copy(o.matrixWorld),_.u_worldMatrix.needsUpdate=!0),_.u_viewPosition&&(_.u_viewPosition.value.setFromMatrixPosition(b.matrixWorld),_.u_viewPosition.needsUpdate=!0),_.u_viewProjectionMatrix&&(_.u_viewProjectionMatrix.value.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),_.u_viewProjectionMatrix.needsUpdate=!0),_.u_worldInverseTransposeMatrix&&(_.u_worldInverseTransposeMatrix.value.setFromMatrix3(xs.getNormalMatrix(o.matrixWorld)),_.u_worldInverseTransposeMatrix.needsUpdate=!0),_.u_time&&(R===void 0&&(R=fn()),_.u_time.value=R),_.u_frame&&(x===void 0&&(x=gn()),_.u_frame.value=x),this.uniformsNeedUpdate=!0};updateEnvironmentUniforms=m=>{const o=this.uniforms,b=m.lightData||null,R=m.lightCount||0,x=m.getTextures(this)||null;if(o.u_numActiveLightSources&&R>=0&&(o.u_numActiveLightSources.value=R),b?.length&&(o.u_lightData.value=b,"needsUpdate"in o.u_lightData&&o.u_lightData.needsUpdate===!1&&(Q&&console.debug(`[MaterialX] LightData assigned (${this.name}, ${this.uuid})`,b),o.u_lightData.needsUpdate=void 0)),o.u_envRadiance){const _=o.u_envRadiance.value;o.u_envRadiance.value=x.radianceTexture,_!=x.radianceTexture&&(o.u_envRadiance.needsUpdate=!0)}if(o.u_envRadianceMips&&(o.u_envRadianceMips.value=Math.trunc(Math.log2(Math.max(x.radianceTexture?.source.data.width??0,x.radianceTexture?.source.data.height??0)))+1),o.u_envIrradiance){const _=o.u_envIrradiance.value;o.u_envIrradiance.value=x.irradianceTexture,_!=x.irradianceTexture&&(o.u_envIrradiance.needsUpdate=!0)}this.uniformsNeedUpdate=!0}}class Sn{name="NEEDLE_materials_mtlx";_generatedMaterials=[];_documentReadyPromise=null;get materialX_root_data(){const m=this.parser.json.extensions?.[this.name];if(!m)return null;let o=null;return"documents"in m&&Array.isArray(m.documents)?o=m.documents:o=[m],o}get materials(){return this._generatedMaterials}constructor(m,o,b){this.parser=m,this.options=o,this.context=b,Q&&console.log("MaterialXLoader created for parser"),this.materialX_root_data&&dt()}loadMaterial(m){return this.parser.json.materials?.[m]?.extensions?.[this.name]?this._loadMaterialAsync(m):null}async _loadMaterialAsync(m){const o=this.parser.json.materials?.[m];Q&&console.debug("[MaterialX] extension found in material:",o.extensions?.[this.name]);const b=o.extensions?.[this.name],R=b.document||0,x=this.materialX_root_data?.[R],_=x.mtlx||null;if(b&&_){const P={...this.options};return P.parameters||(P.parameters={}),P.parameters?.side===void 0&&o.doubleSided!==void 0&&(P.parameters.side=o.doubleSided?is:os),Pn(_,b.name,{cacheKey:this.options.cacheKey||"",getTexture:async $=>{const O=$.split("/").pop()?.split(".").shift()||"";if(x){const I=x.textures||[];let J=-1;for(const ee of I)if(ee.name===O){const G=ee.pointer,ce=G.substring(10);if(J=parseInt(ce),isNaN(J)||J<0){console.error("[MaterialX] Invalid texture index in pointer:",G);return}else Q&&console.log("[MaterialX] Texture index found:",J,"for",O)}if(J<0){console.error("[MaterialX] Texture not found in parser:",O,this.parser.json);return}return this.parser.getDependency("texture",J)}return null}},P,this.context).then($=>($ instanceof yr&&this._generatedMaterials.push($),$))}const X=new Gt;return X.name="MaterialX_Fallback",X}}function Es(y,m,o){y.register(b=>new Sn(b,m||{},o||{}))}async function Fs(y){if(await dt(),!Y.materialXModule)throw new Error("[MaterialX] module failed to initialize");const m=Y.materialXModule.createDocument();return m.setDataLibrary(Y.materialXStdLib),await Y.materialXModule.readFromXmlString(m,y,""),Q&&console.log("[MaterialX] root document parsed successfully"),m}async function Pn(y,m,o,b,R){try{Q&&console.log(`Creating MaterialX material: ${m}`);const x=await Fs(y);if(!Y.materialXModule||!Y.materialXGenerator||!Y.materialXGenContext){console.warn("[MaterialX] WASM module not ready, returning fallback material");const ee=new Gt;return ee.name=`MaterialX_Fallback_${m}`,ee}let _=null,X=!1;Q&&console.log("[MaterialX] document",x);const P=x.getMaterialNodes();Q&&console.log(`[MaterialX] Found ${P.length} material nodes in document`,P);for(let ee=0;ee<P.length;++ee){const G=P[ee];if(G){const ce=G.getNamePath();if(Q&&console.log(`[MaterialX] Scan material[${ee}]: ${ce}`),P.length===1||ce==m||ee===m){m=ce,_=G,X=!0,Q&&console.log(`[MaterialX] Use material node: '${ce}'`);break}}}if(!_){P.length<=0?console.warn("[MaterialX] No material nodes found in MaterialX document."):console.warn(`[MaterialX] No renderable element found in MaterialX document (${m}) \u2192 Please provide a name or index. ${P.length} options: ${P.map(G=>G.getNamePath()).join(", ")}`);const ee=new Gt;return ee.color.set(16711935),ee.name=`MaterialX_NoRenderable_${m}`,ee}Q&&console.log("[MaterialX] Using renderable element for shader generation");const $=Y.materialXModule.isTransparentSurface(_,Y.materialXGenerator.getTarget());Y.materialXGenContext.getOptions().hwTransparency=$,Q&&console.log("[MaterialX] Generating MaterialX shaders...");const O=_.getNamePath?_.getNamePath():_.getName(),I=Y.materialXGenerator.generate(O,_,Y.materialXGenContext),J=new yr({name:m,shaderName:null,shader:I,context:R||{},parameters:{transparent:$,...b?.parameters},loaders:o});return Q&&console.log("[MaterialX] material created:",J.name),J}catch(x){console.error(`[MaterialX] Error creating MaterialX material (${m}):`,x);const _=new Gt;return _.color.set(16711935),_.name=`MaterialX_Error_${m}`,_}}const Ss={createMaterialXMaterial:Pn};export{Ss as Experimental_API,Sn as MaterialXLoader,yr as MaterialXMaterial,ws as preloadWasm,dt as ready,Es as useNeedleMaterialX};