@needle-tools/engine 4.13.0-next.266306a → 4.13.0-next.e86f701

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.
@@ -0,0 +1,90 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./three-BW2s1Yl-.umd.cjs");require("./three-examples-Bpfu6ke_.umd.cjs");var jI=(function(){var l=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(l=l||__filename),(function(w){w=w||{};var E=typeof w<"u"?w:{},R,s;E.ready=new Promise(function(A,I){R=A,s=I}),E.expectedDataFileDownloads||(E.expectedDataFileDownloads=0),E.expectedDataFileDownloads++,(function(){var A=function(I){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 g="../../bin/JsMaterialXGenShader.data",B="JsMaterialXGenShader.data";typeof E.locateFilePackage=="function"&&!E.locateFile&&(E.locateFile=E.locateFilePackage,hA("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var Q=E.locateFile?E.locateFile(B,""):B,G=I.remote_package_size;function i(Y,a,k,N){var b=new XMLHttpRequest;b.open("GET",Y,!0),b.responseType="arraybuffer",b.onprogress=function(W){var V=Y,P=a;if(W.total&&(P=W.total),W.loaded){b.addedTotal?E.dataFileDownloads[V].loaded=W.loaded:(b.addedTotal=!0,E.dataFileDownloads||(E.dataFileDownloads={}),E.dataFileDownloads[V]={loaded:W.loaded,total:P});var Z=0,J=0,v=0;for(var L in E.dataFileDownloads){var f=E.dataFileDownloads[L];Z+=f.total,J+=f.loaded,v++}Z=Math.ceil(Z*E.expectedDataFileDownloads/v),E.setStatus&&E.setStatus("Downloading data... ("+J+"/"+Z+")")}else E.dataFileDownloads||E.setStatus&&E.setStatus("Downloading data...")},b.onerror=function(W){throw new Error("NetworkError for: "+Y)},b.onload=function(W){if(b.status==200||b.status==304||b.status==206||b.status==0&&b.response){var V=b.response;k(V)}else throw new Error(b.statusText+" : "+b.responseURL)},b.send(null)}var D=null,h=E.getPreloadedPackage?E.getPreloadedPackage(Q,G):null;h||i(Q,G,function(Y){D?(D(Y),D=null):h=Y});function o(){function Y(W,V){if(!W)throw V+new Error().stack}E.FS_createPath("/","libraries",!0,!0),E.FS_createPath("/libraries","lights",!0,!0),E.FS_createPath("/libraries/lights","genmsl",!0,!0),E.FS_createPath("/libraries/lights","genglsl",!0,!0),E.FS_createPath("/libraries","stdlib",!0,!0),E.FS_createPath("/libraries/stdlib","genmsl",!0,!0),E.FS_createPath("/libraries/stdlib/genmsl","lib",!0,!0),E.FS_createPath("/libraries/stdlib","genglsl",!0,!0),E.FS_createPath("/libraries/stdlib/genglsl","lib",!0,!0),E.FS_createPath("/libraries/stdlib","genosl",!0,!0),E.FS_createPath("/libraries/stdlib/genosl","include",!0,!0),E.FS_createPath("/libraries/stdlib/genosl","lib",!0,!0),E.FS_createPath("/libraries/stdlib","genmdl",!0,!0),E.FS_createPath("/libraries","targets",!0,!0),E.FS_createPath("/libraries","pbrlib",!0,!0),E.FS_createPath("/libraries/pbrlib","genmsl",!0,!0),E.FS_createPath("/libraries/pbrlib","genglsl",!0,!0),E.FS_createPath("/libraries/pbrlib/genglsl","lib",!0,!0),E.FS_createPath("/libraries/pbrlib","genosl",!0,!0),E.FS_createPath("/libraries/pbrlib/genosl","lib",!0,!0),E.FS_createPath("/libraries/pbrlib","genmdl",!0,!0),E.FS_createPath("/libraries","bxdf",!0,!0),E.FS_createPath("/libraries/bxdf","lama",!0,!0),E.FS_createPath("/libraries/bxdf","translation",!0,!0),E.FS_createPath("/libraries","cmlib",!0,!0),E.FS_createPath("/libraries","nprlib",!0,!0),E.FS_createPath("/libraries/nprlib","genmsl",!0,!0),E.FS_createPath("/libraries/nprlib","genglsl",!0,!0),E.FS_createPath("/libraries/nprlib","genosl",!0,!0),E.FS_createPath("/libraries/nprlib","genmdl",!0,!0);function a(W,V,P){this.start=W,this.end=V,this.audio=P}a.prototype={requests:{},open:function(W,V){this.name=V,this.requests[V]=this,E.addRunDependency("fp "+this.name)},send:function(){},onload:function(){var W=this.byteArray.subarray(this.start,this.end);this.finish(W)},finish:function(W){var V=this;E.FS_createDataFile(this.name,null,W,!0,!0,!0),E.removeRunDependency("fp "+V.name),this.requests[this.name]=null}};for(var k=I.files,N=0;N<k.length;++N)new a(k[N].start,k[N].end,k[N].audio).open("GET",k[N].filename);function b(W){Y(W,"Loading data file failed."),Y(W instanceof ArrayBuffer,"bad input to processPackageData");var V=new Uint8Array(W);a.prototype.byteArray=V;for(var P=I.files,Z=0;Z<P.length;++Z)a.prototype.requests[P[Z].filename].onload();E.removeRunDependency("datafile_../../bin/JsMaterialXGenShader.data")}E.addRunDependency("datafile_../../bin/JsMaterialXGenShader.data"),E.preloadResults||(E.preloadResults={}),E.preloadResults[g]={fromCache:!1},h?(b(h),h=null):D=b}E.calledRun?o():(E.preRun||(E.preRun=[]),E.preRun.push(o))};A({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 M={},F;for(F in E)E.hasOwnProperty(F)&&(M[F]=E[F]);var j="./this.program",U=!1,m=!1,K=!1,gA=!1;U=typeof window=="object",m=typeof importScripts=="function",K=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",gA=!U&&!K&&!m;var e="";function _(A){return E.locateFile?E.locateFile(A,e):e+A}var t,oA,cA,jA,rA;K?(m?e=require("path").dirname(e)+"/":e=__dirname+"/",t=function(I,g){return jA||(jA=require("fs")),rA||(rA=require("path")),I=rA.normalize(I),jA.readFileSync(I,g?null:"utf8")},cA=function(I){var g=t(I,!0);return g.buffer||(g=new Uint8Array(g)),nI(g.buffer),g},process.argv.length>1&&(j=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(A){if(!(A instanceof SE))throw A}),process.on("unhandledRejection",EA),E.inspect=function(){return"[Emscripten Module object]"}):gA?(typeof read<"u"&&(t=function(I){return read(I)}),cA=function(I){var g;return typeof readbuffer=="function"?new Uint8Array(readbuffer(I)):(g=read(I,"binary"),nI(typeof g=="object"),g)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(U||m)&&(m?e=self.location.href:typeof document<"u"&&document.currentScript&&(e=document.currentScript.src),l&&(e=l),e.indexOf("blob:")!==0?e=e.substr(0,e.lastIndexOf("/")+1):e="",t=function(A){var I=new XMLHttpRequest;return I.open("GET",A,!1),I.send(null),I.responseText},m&&(cA=function(A){var I=new XMLHttpRequest;return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response)}),oA=function(A,I,g){var B=new XMLHttpRequest;B.open("GET",A,!0),B.responseType="arraybuffer",B.onload=function(){if(B.status==200||B.status==0&&B.response){I(B.response);return}g()},B.onerror=g,B.send(null)});var uA=E.print||console.log.bind(console),hA=E.printErr||console.warn.bind(console);for(F in M)M.hasOwnProperty(F)&&(E[F]=M[F]);M=null,E.arguments&&E.arguments,E.thisProgram&&(j=E.thisProgram),E.quit&&E.quit;function aB(A,I){return Math.ceil(A/I)*I}var Zg=0,NA=function(A){Zg=A},ZB=function(){return Zg},_A;E.wasmBinary&&(_A=E.wasmBinary),E.noExitRuntime,typeof WebAssembly!="object"&&EA("no native wasm support detected");var oI,Ng=!1;function nI(A,I){A||EA("Assertion failed: "+I)}var Rg=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function qA(A,I,g){for(var B=I+g,Q=I;A[Q]&&!(Q>=B);)++Q;if(Q-I>16&&A.subarray&&Rg)return Rg.decode(A.subarray(I,Q));for(var G="";I<Q;){var i=A[I++];if(!(i&128)){G+=String.fromCharCode(i);continue}var D=A[I++]&63;if((i&224)==192){G+=String.fromCharCode((i&31)<<6|D);continue}var h=A[I++]&63;if((i&240)==224?i=(i&15)<<12|D<<6|h:i=(i&7)<<18|D<<12|h<<6|A[I++]&63,i<65536)G+=String.fromCharCode(i);else{var o=i-65536;G+=String.fromCharCode(55296|o>>10,56320|o&1023)}}return G}function VA(A,I){return A?qA(YA,A,I):""}function zI(A,I,g,B){if(!(B>0))return 0;for(var Q=g,G=g+B-1,i=0;i<A.length;++i){var D=A.charCodeAt(i);if(D>=55296&&D<=57343){var h=A.charCodeAt(++i);D=65536+((D&1023)<<10)|h&1023}if(D<=127){if(g>=G)break;I[g++]=D}else if(D<=2047){if(g+1>=G)break;I[g++]=192|D>>6,I[g++]=128|D&63}else if(D<=65535){if(g+2>=G)break;I[g++]=224|D>>12,I[g++]=128|D>>6&63,I[g++]=128|D&63}else{if(g+3>=G)break;I[g++]=240|D>>18,I[g++]=128|D>>12&63,I[g++]=128|D>>6&63,I[g++]=128|D&63}}return I[g]=0,g-Q}function fI(A,I,g){return zI(A,YA,I,g)}function YI(A){for(var I=0,g=0;g<A.length;++g){var B=A.charCodeAt(g);B>=55296&&B<=57343&&(B=65536+((B&1023)<<10)|A.charCodeAt(++g)&1023),B<=127?++I:B<=2047?I+=2:B<=65535?I+=3:I+=4}return I}var Fg=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function NB(A,I){for(var g=A,B=g>>1,Q=B+I/2;!(B>=Q)&&$A[B];)++B;if(g=B<<1,g-A>32&&Fg)return Fg.decode(YA.subarray(A,g));for(var G="",i=0;!(i>=I/2);++i){var D=yA[A+i*2>>1];if(D==0)break;G+=String.fromCharCode(D)}return G}function RB(A,I,g){if(g===void 0&&(g=2147483647),g<2)return 0;g-=2;for(var B=I,Q=g<A.length*2?g/2:A.length,G=0;G<Q;++G){var i=A.charCodeAt(G);yA[I>>1]=i,I+=2}return yA[I>>1]=0,I-B}function FB(A){return A.length*2}function bB(A,I){for(var g=0,B="";!(g>=I/4);){var Q=S[A+g*4>>2];if(Q==0)break;if(++g,Q>=65536){var G=Q-65536;B+=String.fromCharCode(55296|G>>10,56320|G&1023)}else B+=String.fromCharCode(Q)}return B}function lB(A,I,g){if(g===void 0&&(g=2147483647),g<4)return 0;for(var B=I,Q=B+g-4,G=0;G<A.length;++G){var i=A.charCodeAt(G);if(i>=55296&&i<=57343){var D=A.charCodeAt(++G);i=65536+((i&1023)<<10)|D&1023}if(S[I>>2]=i,I+=4,I+4>Q)break}return S[I>>2]=0,I-B}function SB(A){for(var I=0,g=0;g<A.length;++g){var B=A.charCodeAt(g);B>=55296&&B<=57343&&++g,I+=4}return I}function JB(A,I){iA.set(A,I)}function MB(A,I,g){for(var B=0;B<A.length;++B)iA[I++>>0]=A.charCodeAt(B);iA[I>>0]=0}function UB(A,I){return A%I>0&&(A+=I-A%I),A}var wI,iA,YA,yA,$A,S,SA,bg,OI;function lg(A){wI=A,E.HEAP8=iA=new Int8Array(A),E.HEAP16=yA=new Int16Array(A),E.HEAP32=S=new Int32Array(A),E.HEAPU8=YA=new Uint8Array(A),E.HEAPU16=$A=new Uint16Array(A),E.HEAPU32=SA=new Uint32Array(A),E.HEAPF32=bg=new Float32Array(A),E.HEAPF64=OI=new Float64Array(A)}E.INITIAL_MEMORY;var p,Sg=[],Jg=[],Mg=[];function cB(){if(E.preRun)for(typeof E.preRun=="function"&&(E.preRun=[E.preRun]);E.preRun.length;)dB(E.preRun.shift());rI(Sg)}function yB(){!E.noFSInit&&!C.init.initialized&&C.init(),rI(Jg)}function WB(){if(E.postRun)for(typeof E.postRun=="function"&&(E.postRun=[E.postRun]);E.postRun.length;)sB(E.postRun.shift());rI(Mg)}function dB(A){Sg.unshift(A)}function HB(A){Jg.unshift(A)}function sB(A){Mg.unshift(A)}var PA=0,AI=null;function eI(A){PA++,E.monitorRunDependencies&&E.monitorRunDependencies(PA)}function kI(A){if(PA--,E.monitorRunDependencies&&E.monitorRunDependencies(PA),PA==0&&AI){var I=AI;AI=null,I()}}E.preloadedImages={},E.preloadedAudios={};function EA(A){E.onAbort&&E.onAbort(A),A+="",hA(A),Ng=!0,A="abort("+A+"). Build with -s ASSERTIONS=1 for more info.";var I=new WebAssembly.RuntimeError(A);throw s(I),I}var mB="data:application/octet-stream;base64,";function Ug(A){return A.startsWith(mB)}function cg(A){return A.startsWith("file://")}var RA="JsMaterialXGenShader.wasm";Ug(RA)||(RA=_(RA));function yg(A){try{if(A==RA&&_A)return new Uint8Array(_A);if(cA)return cA(A);throw"both async and sync fetching of the wasm failed"}catch(I){EA(I)}}function KB(){if(!_A&&(U||m)){if(typeof fetch=="function"&&!cg(RA))return fetch(RA,{credentials:"same-origin"}).then(function(A){if(!A.ok)throw"failed to load wasm binary file at '"+RA+"'";return A.arrayBuffer()}).catch(function(){return yg(RA)});if(oA)return new Promise(function(A,I){oA(RA,function(g){A(new Uint8Array(g))},I)})}return Promise.resolve().then(function(){return yg(RA)})}function XB(){var A={a:xC};function I(i,D){var h=i.exports;E.asm=h,oI=E.asm.Xa,lg(oI.buffer),p=E.asm._a,HB(E.asm.Ya),kI()}eI();function g(i){I(i.instance)}function B(i){return KB().then(function(D){var h=WebAssembly.instantiate(D,A);return h}).then(i,function(D){hA("failed to asynchronously prepare wasm: "+D),EA(D)})}function Q(){return!_A&&typeof WebAssembly.instantiateStreaming=="function"&&!Ug(RA)&&!cg(RA)&&typeof fetch=="function"?fetch(RA,{credentials:"same-origin"}).then(function(i){var D=WebAssembly.instantiateStreaming(i,A);return D.then(g,function(h){return hA("wasm streaming compile failed: "+h),hA("falling back to ArrayBuffer instantiation"),B(g)})}):B(g)}if(E.instantiateWasm)try{var G=E.instantiateWasm(A,I);return G}catch(i){return hA("Module.instantiateWasm callback failed with error: "+i),!1}return Q().catch(s),{}}var AA,kA,VB={218952:function(){E.TreeIterator.prototype[Symbol.iterator]=function(){return this}},219036:function(){E.GraphIterator.prototype[Symbol.iterator]=function(){return this}},219121:function(){E.InheritanceIterator.prototype[Symbol.iterator]=function(){return this}}};function rI(A){for(;A.length>0;){var I=A.shift();if(typeof I=="function"){I(E);continue}var g=I.func;typeof g=="number"?I.arg===void 0?p.get(g)():p.get(g)(I.arg):g(I.arg===void 0?null:I.arg)}}function PB(A,I,g,B){EA("Assertion failed: "+VA(A)+", at: "+[I?VA(I):"unknown filename",g,B?VA(B):"unknown function"])}var wA={DESTRUCTOR_OFFSET:0,REFCOUNT_OFFSET:4,TYPE_OFFSET:8,CAUGHT_OFFSET:12,RETHROWN_OFFSET:13,SIZE:16};function TB(A){return OA(A+wA.SIZE)+wA.SIZE}function vA(A){this.excPtr=A,this.ptr=A-wA.SIZE,this.set_type=function(I){S[this.ptr+wA.TYPE_OFFSET>>2]=I},this.get_type=function(){return S[this.ptr+wA.TYPE_OFFSET>>2]},this.set_destructor=function(I){S[this.ptr+wA.DESTRUCTOR_OFFSET>>2]=I},this.get_destructor=function(){return S[this.ptr+wA.DESTRUCTOR_OFFSET>>2]},this.set_refcount=function(I){S[this.ptr+wA.REFCOUNT_OFFSET>>2]=I},this.set_caught=function(I){I=I?1:0,iA[this.ptr+wA.CAUGHT_OFFSET>>0]=I},this.get_caught=function(){return iA[this.ptr+wA.CAUGHT_OFFSET>>0]!=0},this.set_rethrown=function(I){I=I?1:0,iA[this.ptr+wA.RETHROWN_OFFSET>>0]=I},this.get_rethrown=function(){return iA[this.ptr+wA.RETHROWN_OFFSET>>0]!=0},this.init=function(I,g){this.set_type(I),this.set_destructor(g),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var I=S[this.ptr+wA.REFCOUNT_OFFSET>>2];S[this.ptr+wA.REFCOUNT_OFFSET>>2]=I+1},this.release_ref=function(){var I=S[this.ptr+wA.REFCOUNT_OFFSET>>2];return S[this.ptr+wA.REFCOUNT_OFFSET>>2]=I-1,I===1}}function II(A){this.free=function(){lA(this.ptr),this.ptr=0},this.set_base_ptr=function(I){S[this.ptr>>2]=I},this.get_base_ptr=function(){return S[this.ptr>>2]},this.set_adjusted_ptr=function(I){var g=4;S[this.ptr+g>>2]=I},this.get_adjusted_ptr=function(){var I=4;return S[this.ptr+I>>2]},this.get_exception_ptr=function(){var I=ng(this.get_exception_info().get_type());if(I)return S[this.get_base_ptr()>>2];var g=this.get_adjusted_ptr();return g!==0?g:this.get_base_ptr()},this.get_exception_info=function(){return new vA(this.get_base_ptr())},A===void 0?(this.ptr=OA(8),this.set_adjusted_ptr(0)):this.ptr=A}var aI=[];function pB(A){A.add_ref()}var ZI=0;function LB(A){var I=new II(A),g=I.get_exception_info();return g.get_caught()||(g.set_caught(!0),ZI--),g.set_rethrown(!1),aI.push(I),pB(g),I.get_exception_ptr()}var sA=0;function Wg(A){return lA(new vA(A).ptr)}function xB(A){if(A.release_ref()&&!A.get_rethrown()){var I=A.get_destructor();I&&p.get(I)(A.excPtr),Wg(A.excPtr)}}function jB(){z(0);var A=aI.pop();xB(A.get_exception_info()),A.free(),sA=0}function uB(A){var I=new II(A),g=I.get_base_ptr();throw sA||(sA=g),I.free(),g}function qB(){var A=sA;if(!A)return NA(0),0;var I=new vA(A),g=I.get_type(),B=new II;if(B.set_base_ptr(A),!g)return NA(0),B.ptr|0;var Q=Array.prototype.slice.call(arguments),G=u(),i=XI(4);S[i>>2]=A;for(var D=0;D<Q.length;D++){var h=Q[D];if(h===0||h===g)break;if(VI(h,g,i)){var o=S[i>>2];return A!==o&&B.set_adjusted_ptr(o),NA(h),B.ptr|0}}return q(G),NA(g),B.ptr|0}function vB(){var A=sA;if(!A)return NA(0),0;var I=new vA(A),g=I.get_type(),B=new II;if(B.set_base_ptr(A),!g)return NA(0),B.ptr|0;var Q=Array.prototype.slice.call(arguments),G=u(),i=XI(4);S[i>>2]=A;for(var D=0;D<Q.length;D++){var h=Q[D];if(h===0||h===g)break;if(VI(h,g,i)){var o=S[i>>2];return A!==o&&B.set_adjusted_ptr(o),NA(h),B.ptr|0}}return q(G),NA(g),B.ptr|0}function tB(){var A=sA;if(!A)return NA(0),0;var I=new vA(A),g=I.get_type(),B=new II;if(B.set_base_ptr(A),!g)return NA(0),B.ptr|0;var Q=Array.prototype.slice.call(arguments),G=u(),i=XI(4);S[i>>2]=A;for(var D=0;D<Q.length;D++){var h=Q[D];if(h===0||h===g)break;if(VI(h,g,i)){var o=S[i>>2];return A!==o&&B.set_adjusted_ptr(o),NA(h),B.ptr|0}}return q(G),NA(g),B.ptr|0}function nB(){var A=aI.pop();A||EA("no exception to throw");var I=A.get_exception_info(),g=A.get_base_ptr();throw I.get_rethrown()?A.free():(aI.push(A),I.set_rethrown(!0),I.set_caught(!1),ZI++),sA=g,g}function zB(A,I,g){var B=new vA(A);throw B.init(I,g),sA=A,ZI++,A}function fB(){return ZI}function OB(A){return S[vg()>>2]=A,A}var $={splitPath:function(A){var I=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return I.exec(A).slice(1)},normalizeArray:function(A,I){for(var g=0,B=A.length-1;B>=0;B--){var Q=A[B];Q==="."?A.splice(B,1):Q===".."?(A.splice(B,1),g++):g&&(A.splice(B,1),g--)}if(I)for(;g;g--)A.unshift("..");return A},normalize:function(A){var I=A.charAt(0)==="/",g=A.substr(-1)==="/";return A=$.normalizeArray(A.split("/").filter(function(B){return!!B}),!I).join("/"),!A&&!I&&(A="."),A&&g&&(A+="/"),(I?"/":"")+A},dirname:function(A){var I=$.splitPath(A),g=I[0],B=I[1];return!g&&!B?".":(B&&(B=B.substr(0,B.length-1)),g+B)},basename:function(A){if(A==="/")return"/";A=$.normalize(A),A=A.replace(/\/$/,"");var I=A.lastIndexOf("/");return I===-1?A:A.substr(I+1)},extname:function(A){return $.splitPath(A)[3]},join:function(){var A=Array.prototype.slice.call(arguments,0);return $.normalize(A.join("/"))},join2:function(A,I){return $.normalize(A+"/"+I)}};function eB(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var A=new Uint8Array(1);return function(){return crypto.getRandomValues(A),A[0]}}else if(K)try{var I=require("crypto");return function(){return I.randomBytes(1)[0]}}catch{}return function(){EA("randomDevice")}}var WA={resolve:function(){for(var A="",I=!1,g=arguments.length-1;g>=-1&&!I;g--){var B=g>=0?arguments[g]:C.cwd();if(typeof B!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!B)return"";A=B+"/"+A,I=B.charAt(0)==="/"}return A=$.normalizeArray(A.split("/").filter(function(Q){return!!Q}),!I).join("/"),(I?"/":"")+A||"."},relative:function(A,I){A=WA.resolve(A).substr(1),I=WA.resolve(I).substr(1);function g(o){for(var Y=0;Y<o.length&&o[Y]==="";Y++);for(var a=o.length-1;a>=0&&o[a]==="";a--);return Y>a?[]:o.slice(Y,a-Y+1)}for(var B=g(A.split("/")),Q=g(I.split("/")),G=Math.min(B.length,Q.length),i=G,D=0;D<G;D++)if(B[D]!==Q[D]){i=D;break}for(var h=[],D=i;D<B.length;D++)h.push("..");return h=h.concat(Q.slice(i)),h.join("/")}},TA={ttys:[],init:function(){},shutdown:function(){},register:function(A,I){TA.ttys[A]={input:[],output:[],ops:I},C.registerDevice(A,TA.stream_ops)},stream_ops:{open:function(A){var I=TA.ttys[A.node.rdev];if(!I)throw new C.ErrnoError(43);A.tty=I,A.seekable=!1},close:function(A){A.tty.ops.flush(A.tty)},flush:function(A){A.tty.ops.flush(A.tty)},read:function(A,I,g,B,Q){if(!A.tty||!A.tty.ops.get_char)throw new C.ErrnoError(60);for(var G=0,i=0;i<B;i++){var D;try{D=A.tty.ops.get_char(A.tty)}catch{throw new C.ErrnoError(29)}if(D===void 0&&G===0)throw new C.ErrnoError(6);if(D==null)break;G++,I[g+i]=D}return G&&(A.node.timestamp=Date.now()),G},write:function(A,I,g,B,Q){if(!A.tty||!A.tty.ops.put_char)throw new C.ErrnoError(60);try{for(var G=0;G<B;G++)A.tty.ops.put_char(A.tty,I[g+G])}catch{throw new C.ErrnoError(29)}return B&&(A.node.timestamp=Date.now()),G}},default_tty_ops:{get_char:function(A){if(!A.input.length){var I=null;if(K){var g=256,B=Buffer.alloc?Buffer.alloc(g):new Buffer(g),Q=0;try{Q=jA.readSync(process.stdin.fd,B,0,g,null)}catch(G){if(G.toString().includes("EOF"))Q=0;else throw G}Q>0?I=B.slice(0,Q).toString("utf-8"):I=null}else typeof window<"u"&&typeof window.prompt=="function"?(I=window.prompt("Input: "),I!==null&&(I+=`
2
+ `)):typeof readline=="function"&&(I=readline(),I!==null&&(I+=`
3
+ `));if(!I)return null;A.input=KI(I,!0)}return A.input.shift()},put_char:function(A,I){I===null||I===10?(uA(qA(A.output,0)),A.output=[]):I!=0&&A.output.push(I)},flush:function(A){A.output&&A.output.length>0&&(uA(qA(A.output,0)),A.output=[])}},default_tty1_ops:{put_char:function(A,I){I===null||I===10?(hA(qA(A.output,0)),A.output=[]):I!=0&&A.output.push(I)},flush:function(A){A.output&&A.output.length>0&&(hA(qA(A.output,0)),A.output=[])}}};function rB(A){for(var I=aB(A,65536),g=OA(I);A<I;)iA[g+A++]=0;return g}var T={ops_table:null,mount:function(A){return T.createNode(null,"/",16895,0)},createNode:function(A,I,g,B){if(C.isBlkdev(g)||C.isFIFO(g))throw new C.ErrnoError(63);T.ops_table||(T.ops_table={dir:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,lookup:T.node_ops.lookup,mknod:T.node_ops.mknod,rename:T.node_ops.rename,unlink:T.node_ops.unlink,rmdir:T.node_ops.rmdir,readdir:T.node_ops.readdir,symlink:T.node_ops.symlink},stream:{llseek:T.stream_ops.llseek}},file:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:{llseek:T.stream_ops.llseek,read:T.stream_ops.read,write:T.stream_ops.write,allocate:T.stream_ops.allocate,mmap:T.stream_ops.mmap,msync:T.stream_ops.msync}},link:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,readlink:T.node_ops.readlink},stream:{}},chrdev:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:C.chrdev_stream_ops}});var Q=C.createNode(A,I,g,B);return C.isDir(Q.mode)?(Q.node_ops=T.ops_table.dir.node,Q.stream_ops=T.ops_table.dir.stream,Q.contents={}):C.isFile(Q.mode)?(Q.node_ops=T.ops_table.file.node,Q.stream_ops=T.ops_table.file.stream,Q.usedBytes=0,Q.contents=null):C.isLink(Q.mode)?(Q.node_ops=T.ops_table.link.node,Q.stream_ops=T.ops_table.link.stream):C.isChrdev(Q.mode)&&(Q.node_ops=T.ops_table.chrdev.node,Q.stream_ops=T.ops_table.chrdev.stream),Q.timestamp=Date.now(),A&&(A.contents[I]=Q,A.timestamp=Q.timestamp),Q},getFileDataAsTypedArray:function(A){return A.contents?A.contents.subarray?A.contents.subarray(0,A.usedBytes):new Uint8Array(A.contents):new Uint8Array(0)},expandFileStorage:function(A,I){var g=A.contents?A.contents.length:0;if(!(g>=I)){var B=1024*1024;I=Math.max(I,g*(g<B?2:1.125)>>>0),g!=0&&(I=Math.max(I,256));var Q=A.contents;A.contents=new Uint8Array(I),A.usedBytes>0&&A.contents.set(Q.subarray(0,A.usedBytes),0)}},resizeFileStorage:function(A,I){if(A.usedBytes!=I)if(I==0)A.contents=null,A.usedBytes=0;else{var g=A.contents;A.contents=new Uint8Array(I),g&&A.contents.set(g.subarray(0,Math.min(I,A.usedBytes))),A.usedBytes=I}},node_ops:{getattr:function(A){var I={};return I.dev=C.isChrdev(A.mode)?A.id:1,I.ino=A.id,I.mode=A.mode,I.nlink=1,I.uid=0,I.gid=0,I.rdev=A.rdev,C.isDir(A.mode)?I.size=4096:C.isFile(A.mode)?I.size=A.usedBytes:C.isLink(A.mode)?I.size=A.link.length:I.size=0,I.atime=new Date(A.timestamp),I.mtime=new Date(A.timestamp),I.ctime=new Date(A.timestamp),I.blksize=4096,I.blocks=Math.ceil(I.size/I.blksize),I},setattr:function(A,I){I.mode!==void 0&&(A.mode=I.mode),I.timestamp!==void 0&&(A.timestamp=I.timestamp),I.size!==void 0&&T.resizeFileStorage(A,I.size)},lookup:function(A,I){throw C.genericErrors[44]},mknod:function(A,I,g,B){return T.createNode(A,I,g,B)},rename:function(A,I,g){if(C.isDir(A.mode)){var B;try{B=C.lookupNode(I,g)}catch{}if(B)for(var Q in B.contents)throw new C.ErrnoError(55)}delete A.parent.contents[A.name],A.parent.timestamp=Date.now(),A.name=g,I.contents[g]=A,I.timestamp=A.parent.timestamp,A.parent=I},unlink:function(A,I){delete A.contents[I],A.timestamp=Date.now()},rmdir:function(A,I){var g=C.lookupNode(A,I);for(var B in g.contents)throw new C.ErrnoError(55);delete A.contents[I],A.timestamp=Date.now()},readdir:function(A){var I=[".",".."];for(var g in A.contents)A.contents.hasOwnProperty(g)&&I.push(g);return I},symlink:function(A,I,g){var B=T.createNode(A,I,41471,0);return B.link=g,B},readlink:function(A){if(!C.isLink(A.mode))throw new C.ErrnoError(28);return A.link}},stream_ops:{read:function(A,I,g,B,Q){var G=A.node.contents;if(Q>=A.node.usedBytes)return 0;var i=Math.min(A.node.usedBytes-Q,B);if(i>8&&G.subarray)I.set(G.subarray(Q,Q+i),g);else for(var D=0;D<i;D++)I[g+D]=G[Q+D];return i},write:function(A,I,g,B,Q,G){if(I.buffer===iA.buffer&&(G=!1),!B)return 0;var i=A.node;if(i.timestamp=Date.now(),I.subarray&&(!i.contents||i.contents.subarray)){if(G)return i.contents=I.subarray(g,g+B),i.usedBytes=B,B;if(i.usedBytes===0&&Q===0)return i.contents=I.slice(g,g+B),i.usedBytes=B,B;if(Q+B<=i.usedBytes)return i.contents.set(I.subarray(g,g+B),Q),B}if(T.expandFileStorage(i,Q+B),i.contents.subarray&&I.subarray)i.contents.set(I.subarray(g,g+B),Q);else for(var D=0;D<B;D++)i.contents[Q+D]=I[g+D];return i.usedBytes=Math.max(i.usedBytes,Q+B),B},llseek:function(A,I,g){var B=I;if(g===1?B+=A.position:g===2&&C.isFile(A.node.mode)&&(B+=A.node.usedBytes),B<0)throw new C.ErrnoError(28);return B},allocate:function(A,I,g){T.expandFileStorage(A.node,I+g),A.node.usedBytes=Math.max(A.node.usedBytes,I+g)},mmap:function(A,I,g,B,Q,G){if(I!==0)throw new C.ErrnoError(28);if(!C.isFile(A.node.mode))throw new C.ErrnoError(43);var i,D,h=A.node.contents;if(!(G&2)&&h.buffer===wI)D=!1,i=h.byteOffset;else{if((B>0||B+g<h.length)&&(h.subarray?h=h.subarray(B,B+g):h=Array.prototype.slice.call(h,B,B+g)),D=!0,i=rB(g),!i)throw new C.ErrnoError(48);iA.set(h,i)}return{ptr:i,allocated:D}},msync:function(A,I,g,B,Q){if(!C.isFile(A.node.mode))throw new C.ErrnoError(43);return Q&2||T.stream_ops.write(A,I,0,B,g,!1),0}}},C={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(A,I){if(A=WA.resolve(C.cwd(),A),I=I||{},!A)return{path:"",node:null};var g={follow_mount:!0,recurse_count:0};for(var B in g)I[B]===void 0&&(I[B]=g[B]);if(I.recurse_count>8)throw new C.ErrnoError(32);for(var Q=$.normalizeArray(A.split("/").filter(function(k){return!!k}),!1),G=C.root,i="/",D=0;D<Q.length;D++){var h=D===Q.length-1;if(h&&I.parent)break;if(G=C.lookupNode(G,Q[D]),i=$.join2(i,Q[D]),C.isMountpoint(G)&&(!h||h&&I.follow_mount)&&(G=G.mounted.root),!h||I.follow)for(var o=0;C.isLink(G.mode);){var Y=C.readlink(i);i=WA.resolve($.dirname(i),Y);var a=C.lookupPath(i,{recurse_count:I.recurse_count});if(G=a.node,o++>40)throw new C.ErrnoError(32)}}return{path:i,node:G}},getPath:function(A){for(var I;;){if(C.isRoot(A)){var g=A.mount.mountpoint;return I?g[g.length-1]!=="/"?g+"/"+I:g+I:g}I=I?A.name+"/"+I:A.name,A=A.parent}},hashName:function(A,I){for(var g=0,B=0;B<I.length;B++)g=(g<<5)-g+I.charCodeAt(B)|0;return(A+g>>>0)%C.nameTable.length},hashAddNode:function(A){var I=C.hashName(A.parent.id,A.name);A.name_next=C.nameTable[I],C.nameTable[I]=A},hashRemoveNode:function(A){var I=C.hashName(A.parent.id,A.name);if(C.nameTable[I]===A)C.nameTable[I]=A.name_next;else for(var g=C.nameTable[I];g;){if(g.name_next===A){g.name_next=A.name_next;break}g=g.name_next}},lookupNode:function(A,I){var g=C.mayLookup(A);if(g)throw new C.ErrnoError(g,A);for(var B=C.hashName(A.id,I),Q=C.nameTable[B];Q;Q=Q.name_next){var G=Q.name;if(Q.parent.id===A.id&&G===I)return Q}return C.lookup(A,I)},createNode:function(A,I,g,B){var Q=new C.FSNode(A,I,g,B);return C.hashAddNode(Q),Q},destroyNode:function(A){C.hashRemoveNode(A)},isRoot:function(A){return A===A.parent},isMountpoint:function(A){return!!A.mounted},isFile:function(A){return(A&61440)===32768},isDir:function(A){return(A&61440)===16384},isLink:function(A){return(A&61440)===40960},isChrdev:function(A){return(A&61440)===8192},isBlkdev:function(A){return(A&61440)===24576},isFIFO:function(A){return(A&61440)===4096},isSocket:function(A){return(A&49152)===49152},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(A){var I=C.flagModes[A];if(typeof I>"u")throw new Error("Unknown file open mode: "+A);return I},flagsToPermissionString:function(A){var I=["r","w","rw"][A&3];return A&512&&(I+="w"),I},nodePermissions:function(A,I){return 0},mayLookup:function(A){var I=C.nodePermissions(A,"x");return I||(A.node_ops.lookup?0:2)},mayCreate:function(A,I){try{var g=C.lookupNode(A,I);return 20}catch{}return C.nodePermissions(A,"wx")},mayDelete:function(A,I,g){var B;try{B=C.lookupNode(A,I)}catch(G){return G.errno}var Q=C.nodePermissions(A,"wx");if(Q)return Q;if(g){if(!C.isDir(B.mode))return 54;if(C.isRoot(B)||C.getPath(B)===C.cwd())return 10}else if(C.isDir(B.mode))return 31;return 0},mayOpen:function(A,I){return A?C.isLink(A.mode)?32:C.isDir(A.mode)&&(C.flagsToPermissionString(I)!=="r"||I&512)?31:C.nodePermissions(A,C.flagsToPermissionString(I)):44},MAX_OPEN_FDS:4096,nextfd:function(A,I){A=A||0,I=I||C.MAX_OPEN_FDS;for(var g=A;g<=I;g++)if(!C.streams[g])return g;throw new C.ErrnoError(33)},getStream:function(A){return C.streams[A]},createStream:function(A,I,g){C.FSStream||(C.FSStream=function(){},C.FSStream.prototype={object:{get:function(){return this.node},set:function(i){this.node=i}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}});var B=new C.FSStream;for(var Q in A)B[Q]=A[Q];A=B;var G=C.nextfd(I,g);return A.fd=G,C.streams[G]=A,A},closeStream:function(A){C.streams[A]=null},chrdev_stream_ops:{open:function(A){var I=C.getDevice(A.node.rdev);A.stream_ops=I.stream_ops,A.stream_ops.open&&A.stream_ops.open(A)},llseek:function(){throw new C.ErrnoError(70)}},major:function(A){return A>>8},minor:function(A){return A&255},makedev:function(A,I){return A<<8|I},registerDevice:function(A,I){C.devices[A]={stream_ops:I}},getDevice:function(A){return C.devices[A]},getMounts:function(A){for(var I=[],g=[A];g.length;){var B=g.pop();I.push(B),g.push.apply(g,B.mounts)}return I},syncfs:function(A,I){typeof A=="function"&&(I=A,A=!1),C.syncFSRequests++,C.syncFSRequests>1&&hA("warning: "+C.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var g=C.getMounts(C.root.mount),B=0;function Q(i){return C.syncFSRequests--,I(i)}function G(i){if(i)return G.errored?void 0:(G.errored=!0,Q(i));++B>=g.length&&Q(null)}g.forEach(function(i){if(!i.type.syncfs)return G(null);i.type.syncfs(i,A,G)})},mount:function(A,I,g){var B=g==="/",Q=!g,G;if(B&&C.root)throw new C.ErrnoError(10);if(!B&&!Q){var i=C.lookupPath(g,{follow_mount:!1});if(g=i.path,G=i.node,C.isMountpoint(G))throw new C.ErrnoError(10);if(!C.isDir(G.mode))throw new C.ErrnoError(54)}var D={type:A,opts:I,mountpoint:g,mounts:[]},h=A.mount(D);return h.mount=D,D.root=h,B?C.root=h:G&&(G.mounted=D,G.mount&&G.mount.mounts.push(D)),h},unmount:function(A){var I=C.lookupPath(A,{follow_mount:!1});if(!C.isMountpoint(I.node))throw new C.ErrnoError(28);var g=I.node,B=g.mounted,Q=C.getMounts(B);Object.keys(C.nameTable).forEach(function(i){for(var D=C.nameTable[i];D;){var h=D.name_next;Q.includes(D.mount)&&C.destroyNode(D),D=h}}),g.mounted=null;var G=g.mount.mounts.indexOf(B);g.mount.mounts.splice(G,1)},lookup:function(A,I){return A.node_ops.lookup(A,I)},mknod:function(A,I,g){var B=C.lookupPath(A,{parent:!0}),Q=B.node,G=$.basename(A);if(!G||G==="."||G==="..")throw new C.ErrnoError(28);var i=C.mayCreate(Q,G);if(i)throw new C.ErrnoError(i);if(!Q.node_ops.mknod)throw new C.ErrnoError(63);return Q.node_ops.mknod(Q,G,I,g)},create:function(A,I){return I=I!==void 0?I:438,I&=4095,I|=32768,C.mknod(A,I,0)},mkdir:function(A,I){return I=I!==void 0?I:511,I&=1023,I|=16384,C.mknod(A,I,0)},mkdirTree:function(A,I){for(var g=A.split("/"),B="",Q=0;Q<g.length;++Q)if(g[Q]){B+="/"+g[Q];try{C.mkdir(B,I)}catch(G){if(G.errno!=20)throw G}}},mkdev:function(A,I,g){return typeof g>"u"&&(g=I,I=438),I|=8192,C.mknod(A,I,g)},symlink:function(A,I){if(!WA.resolve(A))throw new C.ErrnoError(44);var g=C.lookupPath(I,{parent:!0}),B=g.node;if(!B)throw new C.ErrnoError(44);var Q=$.basename(I),G=C.mayCreate(B,Q);if(G)throw new C.ErrnoError(G);if(!B.node_ops.symlink)throw new C.ErrnoError(63);return B.node_ops.symlink(B,Q,A)},rename:function(A,I){var g=$.dirname(A),B=$.dirname(I),Q=$.basename(A),G=$.basename(I),i,D,h;if(i=C.lookupPath(A,{parent:!0}),D=i.node,i=C.lookupPath(I,{parent:!0}),h=i.node,!D||!h)throw new C.ErrnoError(44);if(D.mount!==h.mount)throw new C.ErrnoError(75);var o=C.lookupNode(D,Q),Y=WA.relative(A,B);if(Y.charAt(0)!==".")throw new C.ErrnoError(28);if(Y=WA.relative(I,g),Y.charAt(0)!==".")throw new C.ErrnoError(55);var a;try{a=C.lookupNode(h,G)}catch{}if(o!==a){var k=C.isDir(o.mode),N=C.mayDelete(D,Q,k);if(N)throw new C.ErrnoError(N);if(N=a?C.mayDelete(h,G,k):C.mayCreate(h,G),N)throw new C.ErrnoError(N);if(!D.node_ops.rename)throw new C.ErrnoError(63);if(C.isMountpoint(o)||a&&C.isMountpoint(a))throw new C.ErrnoError(10);if(h!==D&&(N=C.nodePermissions(D,"w"),N))throw new C.ErrnoError(N);try{C.trackingDelegate.willMovePath&&C.trackingDelegate.willMovePath(A,I)}catch(b){hA("FS.trackingDelegate['willMovePath']('"+A+"', '"+I+"') threw an exception: "+b.message)}C.hashRemoveNode(o);try{D.node_ops.rename(o,h,G)}catch(b){throw b}finally{C.hashAddNode(o)}try{C.trackingDelegate.onMovePath&&C.trackingDelegate.onMovePath(A,I)}catch(b){hA("FS.trackingDelegate['onMovePath']('"+A+"', '"+I+"') threw an exception: "+b.message)}}},rmdir:function(A){var I=C.lookupPath(A,{parent:!0}),g=I.node,B=$.basename(A),Q=C.lookupNode(g,B),G=C.mayDelete(g,B,!0);if(G)throw new C.ErrnoError(G);if(!g.node_ops.rmdir)throw new C.ErrnoError(63);if(C.isMountpoint(Q))throw new C.ErrnoError(10);try{C.trackingDelegate.willDeletePath&&C.trackingDelegate.willDeletePath(A)}catch(i){hA("FS.trackingDelegate['willDeletePath']('"+A+"') threw an exception: "+i.message)}g.node_ops.rmdir(g,B),C.destroyNode(Q);try{C.trackingDelegate.onDeletePath&&C.trackingDelegate.onDeletePath(A)}catch(i){hA("FS.trackingDelegate['onDeletePath']('"+A+"') threw an exception: "+i.message)}},readdir:function(A){var I=C.lookupPath(A,{follow:!0}),g=I.node;if(!g.node_ops.readdir)throw new C.ErrnoError(54);return g.node_ops.readdir(g)},unlink:function(A){var I=C.lookupPath(A,{parent:!0}),g=I.node,B=$.basename(A),Q=C.lookupNode(g,B),G=C.mayDelete(g,B,!1);if(G)throw new C.ErrnoError(G);if(!g.node_ops.unlink)throw new C.ErrnoError(63);if(C.isMountpoint(Q))throw new C.ErrnoError(10);try{C.trackingDelegate.willDeletePath&&C.trackingDelegate.willDeletePath(A)}catch(i){hA("FS.trackingDelegate['willDeletePath']('"+A+"') threw an exception: "+i.message)}g.node_ops.unlink(g,B),C.destroyNode(Q);try{C.trackingDelegate.onDeletePath&&C.trackingDelegate.onDeletePath(A)}catch(i){hA("FS.trackingDelegate['onDeletePath']('"+A+"') threw an exception: "+i.message)}},readlink:function(A){var I=C.lookupPath(A),g=I.node;if(!g)throw new C.ErrnoError(44);if(!g.node_ops.readlink)throw new C.ErrnoError(28);return WA.resolve(C.getPath(g.parent),g.node_ops.readlink(g))},stat:function(A,I){var g=C.lookupPath(A,{follow:!I}),B=g.node;if(!B)throw new C.ErrnoError(44);if(!B.node_ops.getattr)throw new C.ErrnoError(63);return B.node_ops.getattr(B)},lstat:function(A){return C.stat(A,!0)},chmod:function(A,I,g){var B;if(typeof A=="string"){var Q=C.lookupPath(A,{follow:!g});B=Q.node}else B=A;if(!B.node_ops.setattr)throw new C.ErrnoError(63);B.node_ops.setattr(B,{mode:I&4095|B.mode&-4096,timestamp:Date.now()})},lchmod:function(A,I){C.chmod(A,I,!0)},fchmod:function(A,I){var g=C.getStream(A);if(!g)throw new C.ErrnoError(8);C.chmod(g.node,I)},chown:function(A,I,g,B){var Q;if(typeof A=="string"){var G=C.lookupPath(A,{follow:!B});Q=G.node}else Q=A;if(!Q.node_ops.setattr)throw new C.ErrnoError(63);Q.node_ops.setattr(Q,{timestamp:Date.now()})},lchown:function(A,I,g){C.chown(A,I,g,!0)},fchown:function(A,I,g){var B=C.getStream(A);if(!B)throw new C.ErrnoError(8);C.chown(B.node,I,g)},truncate:function(A,I){if(I<0)throw new C.ErrnoError(28);var g;if(typeof A=="string"){var B=C.lookupPath(A,{follow:!0});g=B.node}else g=A;if(!g.node_ops.setattr)throw new C.ErrnoError(63);if(C.isDir(g.mode))throw new C.ErrnoError(31);if(!C.isFile(g.mode))throw new C.ErrnoError(28);var Q=C.nodePermissions(g,"w");if(Q)throw new C.ErrnoError(Q);g.node_ops.setattr(g,{size:I,timestamp:Date.now()})},ftruncate:function(A,I){var g=C.getStream(A);if(!g)throw new C.ErrnoError(8);if((g.flags&2097155)===0)throw new C.ErrnoError(28);C.truncate(g.node,I)},utime:function(A,I,g){var B=C.lookupPath(A,{follow:!0}),Q=B.node;Q.node_ops.setattr(Q,{timestamp:Math.max(I,g)})},open:function(A,I,g,B,Q){if(A==="")throw new C.ErrnoError(44);I=typeof I=="string"?C.modeStringToFlags(I):I,g=typeof g>"u"?438:g,I&64?g=g&4095|32768:g=0;var G;if(typeof A=="object")G=A;else{A=$.normalize(A);try{var i=C.lookupPath(A,{follow:!(I&131072)});G=i.node}catch{}}var D=!1;if(I&64)if(G){if(I&128)throw new C.ErrnoError(20)}else G=C.mknod(A,g,0),D=!0;if(!G)throw new C.ErrnoError(44);if(C.isChrdev(G.mode)&&(I&=-513),I&65536&&!C.isDir(G.mode))throw new C.ErrnoError(54);if(!D){var h=C.mayOpen(G,I);if(h)throw new C.ErrnoError(h)}I&512&&C.truncate(G,0),I&=-131713;var o=C.createStream({node:G,path:C.getPath(G),flags:I,seekable:!0,position:0,stream_ops:G.stream_ops,ungotten:[],error:!1},B,Q);o.stream_ops.open&&o.stream_ops.open(o),E.logReadFiles&&!(I&1)&&(C.readFiles||(C.readFiles={}),A in C.readFiles||(C.readFiles[A]=1,hA("FS.trackingDelegate error on read file: "+A)));try{if(C.trackingDelegate.onOpenFile){var Y=0;(I&2097155)!==1&&(Y|=C.tracking.openFlags.READ),(I&2097155)!==0&&(Y|=C.tracking.openFlags.WRITE),C.trackingDelegate.onOpenFile(A,Y)}}catch(a){hA("FS.trackingDelegate['onOpenFile']('"+A+"', flags) threw an exception: "+a.message)}return o},close:function(A){if(C.isClosed(A))throw new C.ErrnoError(8);A.getdents&&(A.getdents=null);try{A.stream_ops.close&&A.stream_ops.close(A)}catch(I){throw I}finally{C.closeStream(A.fd)}A.fd=null},isClosed:function(A){return A.fd===null},llseek:function(A,I,g){if(C.isClosed(A))throw new C.ErrnoError(8);if(!A.seekable||!A.stream_ops.llseek)throw new C.ErrnoError(70);if(g!=0&&g!=1&&g!=2)throw new C.ErrnoError(28);return A.position=A.stream_ops.llseek(A,I,g),A.ungotten=[],A.position},read:function(A,I,g,B,Q){if(B<0||Q<0)throw new C.ErrnoError(28);if(C.isClosed(A))throw new C.ErrnoError(8);if((A.flags&2097155)===1)throw new C.ErrnoError(8);if(C.isDir(A.node.mode))throw new C.ErrnoError(31);if(!A.stream_ops.read)throw new C.ErrnoError(28);var G=typeof Q<"u";if(!G)Q=A.position;else if(!A.seekable)throw new C.ErrnoError(70);var i=A.stream_ops.read(A,I,g,B,Q);return G||(A.position+=i),i},write:function(A,I,g,B,Q,G){if(B<0||Q<0)throw new C.ErrnoError(28);if(C.isClosed(A))throw new C.ErrnoError(8);if((A.flags&2097155)===0)throw new C.ErrnoError(8);if(C.isDir(A.node.mode))throw new C.ErrnoError(31);if(!A.stream_ops.write)throw new C.ErrnoError(28);A.seekable&&A.flags&1024&&C.llseek(A,0,2);var i=typeof Q<"u";if(!i)Q=A.position;else if(!A.seekable)throw new C.ErrnoError(70);var D=A.stream_ops.write(A,I,g,B,Q,G);i||(A.position+=D);try{A.path&&C.trackingDelegate.onWriteToFile&&C.trackingDelegate.onWriteToFile(A.path)}catch(h){hA("FS.trackingDelegate['onWriteToFile']('"+A.path+"') threw an exception: "+h.message)}return D},allocate:function(A,I,g){if(C.isClosed(A))throw new C.ErrnoError(8);if(I<0||g<=0)throw new C.ErrnoError(28);if((A.flags&2097155)===0)throw new C.ErrnoError(8);if(!C.isFile(A.node.mode)&&!C.isDir(A.node.mode))throw new C.ErrnoError(43);if(!A.stream_ops.allocate)throw new C.ErrnoError(138);A.stream_ops.allocate(A,I,g)},mmap:function(A,I,g,B,Q,G){if((Q&2)!==0&&(G&2)===0&&(A.flags&2097155)!==2)throw new C.ErrnoError(2);if((A.flags&2097155)===1)throw new C.ErrnoError(2);if(!A.stream_ops.mmap)throw new C.ErrnoError(43);return A.stream_ops.mmap(A,I,g,B,Q,G)},msync:function(A,I,g,B,Q){return!A||!A.stream_ops.msync?0:A.stream_ops.msync(A,I,g,B,Q)},munmap:function(A){return 0},ioctl:function(A,I,g){if(!A.stream_ops.ioctl)throw new C.ErrnoError(59);return A.stream_ops.ioctl(A,I,g)},readFile:function(A,I){if(I=I||{},I.flags=I.flags||0,I.encoding=I.encoding||"binary",I.encoding!=="utf8"&&I.encoding!=="binary")throw new Error('Invalid encoding type "'+I.encoding+'"');var g,B=C.open(A,I.flags),Q=C.stat(A),G=Q.size,i=new Uint8Array(G);return C.read(B,i,0,G,0),I.encoding==="utf8"?g=qA(i,0):I.encoding==="binary"&&(g=i),C.close(B),g},writeFile:function(A,I,g){g=g||{},g.flags=g.flags||577;var B=C.open(A,g.flags,g.mode);if(typeof I=="string"){var Q=new Uint8Array(YI(I)+1),G=zI(I,Q,0,Q.length);C.write(B,Q,0,G,void 0,g.canOwn)}else if(ArrayBuffer.isView(I))C.write(B,I,0,I.byteLength,void 0,g.canOwn);else throw new Error("Unsupported data type");C.close(B)},cwd:function(){return C.currentPath},chdir:function(A){var I=C.lookupPath(A,{follow:!0});if(I.node===null)throw new C.ErrnoError(44);if(!C.isDir(I.node.mode))throw new C.ErrnoError(54);var g=C.nodePermissions(I.node,"x");if(g)throw new C.ErrnoError(g);C.currentPath=I.path},createDefaultDirectories:function(){C.mkdir("/tmp"),C.mkdir("/home"),C.mkdir("/home/web_user")},createDefaultDevices:function(){C.mkdir("/dev"),C.registerDevice(C.makedev(1,3),{read:function(){return 0},write:function(I,g,B,Q,G){return Q}}),C.mkdev("/dev/null",C.makedev(1,3)),TA.register(C.makedev(5,0),TA.default_tty_ops),TA.register(C.makedev(6,0),TA.default_tty1_ops),C.mkdev("/dev/tty",C.makedev(5,0)),C.mkdev("/dev/tty1",C.makedev(6,0));var A=eB();C.createDevice("/dev","random",A),C.createDevice("/dev","urandom",A),C.mkdir("/dev/shm"),C.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){C.mkdir("/proc");var A=C.mkdir("/proc/self");C.mkdir("/proc/self/fd"),C.mount({mount:function(){var I=C.createNode(A,"fd",16895,73);return I.node_ops={lookup:function(g,B){var Q=+B,G=C.getStream(Q);if(!G)throw new C.ErrnoError(8);var i={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return G.path}}};return i.parent=i,i}},I}},{},"/proc/self/fd")},createStandardStreams:function(){E.stdin?C.createDevice("/dev","stdin",E.stdin):C.symlink("/dev/tty","/dev/stdin"),E.stdout?C.createDevice("/dev","stdout",null,E.stdout):C.symlink("/dev/tty","/dev/stdout"),E.stderr?C.createDevice("/dev","stderr",null,E.stderr):C.symlink("/dev/tty1","/dev/stderr"),C.open("/dev/stdin",0),C.open("/dev/stdout",1),C.open("/dev/stderr",1)},ensureErrnoError:function(){C.ErrnoError||(C.ErrnoError=function(I,g){this.node=g,this.setErrno=function(B){this.errno=B},this.setErrno(I),this.message="FS error"},C.ErrnoError.prototype=new Error,C.ErrnoError.prototype.constructor=C.ErrnoError,[44].forEach(function(A){C.genericErrors[A]=new C.ErrnoError(A),C.genericErrors[A].stack="<generic error, no stack>"}))},staticInit:function(){C.ensureErrnoError(),C.nameTable=new Array(4096),C.mount(T,{},"/"),C.createDefaultDirectories(),C.createDefaultDevices(),C.createSpecialDirectories(),C.filesystems={MEMFS:T}},init:function(A,I,g){C.init.initialized=!0,C.ensureErrnoError(),E.stdin=A||E.stdin,E.stdout=I||E.stdout,E.stderr=g||E.stderr,C.createStandardStreams()},quit:function(){C.init.initialized=!1;var A=E._fflush;A&&A(0);for(var I=0;I<C.streams.length;I++){var g=C.streams[I];g&&C.close(g)}},getMode:function(A,I){var g=0;return A&&(g|=365),I&&(g|=146),g},findObject:function(A,I){var g=C.analyzePath(A,I);return g.exists?g.object:null},analyzePath:function(A,I){try{var g=C.lookupPath(A,{follow:!I});A=g.path}catch{}var B={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var g=C.lookupPath(A,{parent:!0});B.parentExists=!0,B.parentPath=g.path,B.parentObject=g.node,B.name=$.basename(A),g=C.lookupPath(A,{follow:!I}),B.exists=!0,B.path=g.path,B.object=g.node,B.name=g.node.name,B.isRoot=g.path==="/"}catch(Q){B.error=Q.errno}return B},createPath:function(A,I,g,B){A=typeof A=="string"?A:C.getPath(A);for(var Q=I.split("/").reverse();Q.length;){var G=Q.pop();if(G){var i=$.join2(A,G);try{C.mkdir(i)}catch{}A=i}}return i},createFile:function(A,I,g,B,Q){var G=$.join2(typeof A=="string"?A:C.getPath(A),I),i=C.getMode(B,Q);return C.create(G,i)},createDataFile:function(A,I,g,B,Q,G){var i=I?$.join2(typeof A=="string"?A:C.getPath(A),I):A,D=C.getMode(B,Q),h=C.create(i,D);if(g){if(typeof g=="string"){for(var o=new Array(g.length),Y=0,a=g.length;Y<a;++Y)o[Y]=g.charCodeAt(Y);g=o}C.chmod(h,D|146);var k=C.open(h,577);C.write(k,g,0,g.length,0,G),C.close(k),C.chmod(h,D)}return h},createDevice:function(A,I,g,B){var Q=$.join2(typeof A=="string"?A:C.getPath(A),I),G=C.getMode(!!g,!!B);C.createDevice.major||(C.createDevice.major=64);var i=C.makedev(C.createDevice.major++,0);return C.registerDevice(i,{open:function(D){D.seekable=!1},close:function(D){B&&B.buffer&&B.buffer.length&&B(10)},read:function(D,h,o,Y,a){for(var k=0,N=0;N<Y;N++){var b;try{b=g()}catch{throw new C.ErrnoError(29)}if(b===void 0&&k===0)throw new C.ErrnoError(6);if(b==null)break;k++,h[o+N]=b}return k&&(D.node.timestamp=Date.now()),k},write:function(D,h,o,Y,a){for(var k=0;k<Y;k++)try{B(h[o+k])}catch{throw new C.ErrnoError(29)}return Y&&(D.node.timestamp=Date.now()),k}}),C.mkdev(Q,G,i)},forceLoadFile:function(A){if(A.isDevice||A.isFolder||A.link||A.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(t)try{A.contents=KI(t(A.url),!0),A.usedBytes=A.contents.length}catch{throw new C.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:function(A,I,g,B,Q){function G(){this.lengthKnown=!1,this.chunks=[]}if(G.prototype.get=function(k){if(!(k>this.length-1||k<0)){var N=k%this.chunkSize,b=k/this.chunkSize|0;return this.getter(b)[N]}},G.prototype.setDataGetter=function(k){this.getter=k},G.prototype.cacheLength=function(){var k=new XMLHttpRequest;if(k.open("HEAD",g,!1),k.send(null),!(k.status>=200&&k.status<300||k.status===304))throw new Error("Couldn't load "+g+". Status: "+k.status);var N=Number(k.getResponseHeader("Content-length")),b,W=(b=k.getResponseHeader("Accept-Ranges"))&&b==="bytes",V=(b=k.getResponseHeader("Content-Encoding"))&&b==="gzip",P=1024*1024;W||(P=N);var Z=function(v,L){if(v>L)throw new Error("invalid range ("+v+", "+L+") or no bytes requested!");if(L>N-1)throw new Error("only "+N+" bytes available! programmer error!");var f=new XMLHttpRequest;if(f.open("GET",g,!1),N!==P&&f.setRequestHeader("Range","bytes="+v+"-"+L),typeof Uint8Array<"u"&&(f.responseType="arraybuffer"),f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.send(null),!(f.status>=200&&f.status<300||f.status===304))throw new Error("Couldn't load "+g+". Status: "+f.status);return f.response!==void 0?new Uint8Array(f.response||[]):KI(f.responseText||"",!0)},J=this;J.setDataGetter(function(v){var L=v*P,f=(v+1)*P-1;if(f=Math.min(f,N-1),typeof J.chunks[v]>"u"&&(J.chunks[v]=Z(L,f)),typeof J.chunks[v]>"u")throw new Error("doXHR failed!");return J.chunks[v]}),(V||!N)&&(P=N=1,N=this.getter(0).length,P=N,uA("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=N,this._chunkSize=P,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!m)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i=new G;Object.defineProperties(i,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var D={isDevice:!1,contents:i}}else var D={isDevice:!1,url:g};var h=C.createFile(A,I,D,B,Q);D.contents?h.contents=D.contents:D.url&&(h.contents=null,h.url=D.url),Object.defineProperties(h,{usedBytes:{get:function(){return this.contents.length}}});var o={},Y=Object.keys(h.stream_ops);return Y.forEach(function(a){var k=h.stream_ops[a];o[a]=function(){return C.forceLoadFile(h),k.apply(null,arguments)}}),o.read=function(k,N,b,W,V){C.forceLoadFile(h);var P=k.node.contents;if(V>=P.length)return 0;var Z=Math.min(P.length-V,W);if(P.slice)for(var J=0;J<Z;J++)N[b+J]=P[V+J];else for(var J=0;J<Z;J++)N[b+J]=P.get(V+J);return Z},h.stream_ops=o,h},createPreloadedFile:function(A,I,g,B,Q,G,i,D,h,o){Browser.init();var Y=I?WA.resolve($.join2(A,I)):A;function a(k){function N(W){o&&o(),D||C.createDataFile(A,I,W,B,Q,h),G&&G(),kI()}var b=!1;E.preloadPlugins.forEach(function(W){b||W.canHandle(Y)&&(W.handle(k,Y,N,function(){i&&i(),kI()}),b=!0)}),b||N(k)}eI(),typeof g=="string"?Browser.asyncLoad(g,function(k){a(k)},i):a(g)},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(A,I,g){I=I||function(){},g=g||function(){};var B=C.indexedDB();try{var Q=B.open(C.DB_NAME(),C.DB_VERSION)}catch(G){return g(G)}Q.onupgradeneeded=function(){uA("creating db");var i=Q.result;i.createObjectStore(C.DB_STORE_NAME)},Q.onsuccess=function(){var i=Q.result,D=i.transaction([C.DB_STORE_NAME],"readwrite"),h=D.objectStore(C.DB_STORE_NAME),o=0,Y=0,a=A.length;function k(){Y==0?I():g()}A.forEach(function(N){var b=h.put(C.analyzePath(N).object.contents,N);b.onsuccess=function(){o++,o+Y==a&&k()},b.onerror=function(){Y++,o+Y==a&&k()}}),D.onerror=g},Q.onerror=g},loadFilesFromDB:function(A,I,g){I=I||function(){},g=g||function(){};var B=C.indexedDB();try{var Q=B.open(C.DB_NAME(),C.DB_VERSION)}catch(G){return g(G)}Q.onupgradeneeded=g,Q.onsuccess=function(){var i=Q.result;try{var D=i.transaction([C.DB_STORE_NAME],"readonly")}catch(N){g(N);return}var h=D.objectStore(C.DB_STORE_NAME),o=0,Y=0,a=A.length;function k(){Y==0?I():g()}A.forEach(function(N){var b=h.get(N);b.onsuccess=function(){C.analyzePath(N).exists&&C.unlink(N),C.createDataFile($.dirname(N),$.basename(N),b.result,!0,!0,!0),o++,o+Y==a&&k()},b.onerror=function(){Y++,o+Y==a&&k()}}),D.onerror=g},Q.onerror=g}},BA={mappings:{},DEFAULT_POLLMASK:5,umask:511,calculateAt:function(A,I,g){if(I[0]==="/")return I;var B;if(A===-100)B=C.cwd();else{var Q=C.getStream(A);if(!Q)throw new C.ErrnoError(8);B=Q.path}if(I.length==0){if(!g)throw new C.ErrnoError(44);return B}return $.join2(B,I)},doStat:function(A,I,g){try{var B=A(I)}catch(Q){if(Q&&Q.node&&$.normalize(I)!==$.normalize(C.getPath(Q.node)))return-54;throw Q}return S[g>>2]=B.dev,S[g+4>>2]=0,S[g+8>>2]=B.ino,S[g+12>>2]=B.mode,S[g+16>>2]=B.nlink,S[g+20>>2]=B.uid,S[g+24>>2]=B.gid,S[g+28>>2]=B.rdev,S[g+32>>2]=0,kA=[B.size>>>0,(AA=B.size,+Math.abs(AA)>=1?AA>0?(Math.min(+Math.floor(AA/4294967296),4294967295)|0)>>>0:~~+Math.ceil((AA-+(~~AA>>>0))/4294967296)>>>0:0)],S[g+40>>2]=kA[0],S[g+44>>2]=kA[1],S[g+48>>2]=4096,S[g+52>>2]=B.blocks,S[g+56>>2]=B.atime.getTime()/1e3|0,S[g+60>>2]=0,S[g+64>>2]=B.mtime.getTime()/1e3|0,S[g+68>>2]=0,S[g+72>>2]=B.ctime.getTime()/1e3|0,S[g+76>>2]=0,kA=[B.ino>>>0,(AA=B.ino,+Math.abs(AA)>=1?AA>0?(Math.min(+Math.floor(AA/4294967296),4294967295)|0)>>>0:~~+Math.ceil((AA-+(~~AA>>>0))/4294967296)>>>0:0)],S[g+80>>2]=kA[0],S[g+84>>2]=kA[1],0},doMsync:function(A,I,g,B,Q){var G=YA.slice(A,A+g);C.msync(I,G,Q,g,B)},doMkdir:function(A,I){return A=$.normalize(A),A[A.length-1]==="/"&&(A=A.substr(0,A.length-1)),C.mkdir(A,I,0),0},doMknod:function(A,I,g){switch(I&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return C.mknod(A,I,g),0},doReadlink:function(A,I,g){if(g<=0)return-28;var B=C.readlink(A),Q=Math.min(g,YI(B)),G=iA[I+Q];return fI(B,I,g+1),iA[I+Q]=G,Q},doAccess:function(A,I){if(I&-8)return-28;var g,B=C.lookupPath(A,{follow:!0});if(g=B.node,!g)return-44;var Q="";return I&4&&(Q+="r"),I&2&&(Q+="w"),I&1&&(Q+="x"),Q&&C.nodePermissions(g,Q)?-2:0},doDup:function(A,I,g){var B=C.getStream(g);return B&&C.close(B),C.open(A,I,0,g,g).fd},doReadv:function(A,I,g,B){for(var Q=0,G=0;G<g;G++){var i=S[I+G*8>>2],D=S[I+(G*8+4)>>2],h=C.read(A,iA,i,D,B);if(h<0)return-1;if(Q+=h,h<D)break}return Q},doWritev:function(A,I,g,B){for(var Q=0,G=0;G<g;G++){var i=S[I+G*8>>2],D=S[I+(G*8+4)>>2],h=C.write(A,iA,i,D,B);if(h<0)return-1;Q+=h}return Q},varargs:void 0,get:function(){BA.varargs+=4;var A=S[BA.varargs-4>>2];return A},getStr:function(A){var I=VA(A);return I},getStreamFromFD:function(A){var I=C.getStream(A);if(!I)throw new C.ErrnoError(8);return I},get64:function(A,I){return A}};function _B(A,I,g){BA.varargs=g;try{var B=BA.getStreamFromFD(A);switch(I){case 0:{var Q=BA.get();if(Q<0)return-28;var G;return G=C.open(B.path,B.flags,0,Q),G.fd}case 1:case 2:return 0;case 3:return B.flags;case 4:{var Q=BA.get();return B.flags|=Q,0}case 12:{var Q=BA.get(),i=0;return yA[Q+i>>1]=2,0}case 13:case 14:return 0;case 16:case 8:return-28;case 9:return OB(28),-1;default:return-28}}catch(D){return(typeof C>"u"||!(D instanceof C.ErrnoError))&&EA(D),-D.errno}}function $B(A,I,g){try{var B=BA.getStreamFromFD(A);B.getdents||(B.getdents=C.readdir(B.path));for(var Q=280,G=0,i=C.llseek(B,0,1),D=Math.floor(i/Q);D<B.getdents.length&&G+Q<=g;){var h,o,Y=B.getdents[D];if(Y[0]===".")h=1,o=4;else{var a=C.lookupNode(B.node,Y);h=a.id,o=C.isChrdev(a.mode)?2:C.isDir(a.mode)?4:C.isLink(a.mode)?10:8}kA=[h>>>0,(AA=h,+Math.abs(AA)>=1?AA>0?(Math.min(+Math.floor(AA/4294967296),4294967295)|0)>>>0:~~+Math.ceil((AA-+(~~AA>>>0))/4294967296)>>>0:0)],S[I+G>>2]=kA[0],S[I+G+4>>2]=kA[1],kA=[(D+1)*Q>>>0,(AA=(D+1)*Q,+Math.abs(AA)>=1?AA>0?(Math.min(+Math.floor(AA/4294967296),4294967295)|0)>>>0:~~+Math.ceil((AA-+(~~AA>>>0))/4294967296)>>>0:0)],S[I+G+8>>2]=kA[0],S[I+G+12>>2]=kA[1],yA[I+G+16>>1]=280,iA[I+G+18>>0]=o,fI(Y,I+G+19,256),G+=Q,D+=1}return C.llseek(B,D*Q,0),G}catch(k){return(typeof C>"u"||!(k instanceof C.ErrnoError))&&EA(k),-k.errno}}function AQ(A,I,g){BA.varargs=g;try{var B=BA.getStreamFromFD(A);switch(I){case 21509:case 21505:return B.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return B.tty?0:-59;case 21519:{if(!B.tty)return-59;var Q=BA.get();return S[Q>>2]=0,0}case 21520:return B.tty?-28:-59;case 21531:{var Q=BA.get();return C.ioctl(B,I,Q)}case 21523:return B.tty?0:-59;case 21524:return B.tty?0:-59;default:EA("bad ioctl syscall "+I)}}catch(G){return(typeof C>"u"||!(G instanceof C.ErrnoError))&&EA(G),-G.errno}}function IQ(A,I,g){BA.varargs=g;try{var B=BA.getStr(A),Q=g?BA.get():0,G=C.open(B,I,Q);return G.fd}catch(i){return(typeof C>"u"||!(i instanceof C.ErrnoError))&&EA(i),-i.errno}}function gQ(A,I){try{return A=BA.getStr(A),BA.doStat(C.stat,A,I)}catch(g){return(typeof C>"u"||!(g instanceof C.ErrnoError))&&EA(g),-g.errno}}var NI={};function tA(A){for(;A.length;){var I=A.pop(),g=A.pop();g(I)}}function gI(A){return this.fromWireType(SA[A>>2])}var nA={},pA={},RI={},BQ=48,QQ=57;function FI(A){if(A===void 0)return"_unknown";A=A.replace(/[^a-zA-Z0-9_]/g,"$");var I=A.charCodeAt(0);return I>=BQ&&I<=QQ?"_"+A:A}function bI(A,I){return A=FI(A),new Function("body","return function "+A+`() {
4
+ "use strict"; return body.apply(this, arguments);
5
+ };
6
+ `)(I)}function _I(A,I){var g=bI(I,function(B){this.name=I,this.message=B;var Q=new Error(B).stack;Q!==void 0&&(this.stack=this.toString()+`
7
+ `+Q.replace(/^Error(:[^\n]*)?\n/,""))});return g.prototype=Object.create(A.prototype),g.prototype.constructor=g,g.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},g}var dg=void 0;function lI(A){throw new dg(A)}function aA(A,I,g){A.forEach(function(D){RI[D]=I});function B(D){var h=g(D);h.length!==A.length&&lI("Mismatched type converter count");for(var o=0;o<A.length;++o)JA(A[o],h[o])}var Q=new Array(I.length),G=[],i=0;I.forEach(function(D,h){pA.hasOwnProperty(D)?Q[h]=pA[D]:(G.push(D),nA.hasOwnProperty(D)||(nA[D]=[]),nA[D].push(function(){Q[h]=pA[D],++i,i===G.length&&B(Q)}))}),G.length===0&&B(Q)}function CQ(A){var I=NI[A];delete NI[A];var g=I.elements,B=g.length,Q=g.map(function(D){return D.getterReturnType}).concat(g.map(function(D){return D.setterArgumentType})),G=I.rawConstructor,i=I.rawDestructor;aA([A],Q,function(D){return g.forEach(function(h,o){var Y=D[o],a=h.getter,k=h.getterContext,N=D[o+B],b=h.setter,W=h.setterContext;h.read=function(V){return Y.fromWireType(a(k,V))},h.write=function(V,P){var Z=[];b(W,V,N.toWireType(Z,P)),tA(Z)}}),[{name:I.name,fromWireType:function(h){for(var o=new Array(B),Y=0;Y<B;++Y)o[Y]=g[Y].read(h);return i(h),o},toWireType:function(h,o){if(B!==o.length)throw new TypeError("Incorrect number of tuple elements for "+I.name+": expected="+B+", actual="+o.length);for(var Y=G(),a=0;a<B;++a)g[a].write(Y,o[a]);return h!==null&&h.push(i,Y),Y},argPackAdvance:8,readValueFromPointer:gI,destructorFunction:i}]})}function EQ(A,I,g,B,Q){}function SI(A){switch(A){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+A)}}function GQ(){for(var A=new Array(256),I=0;I<256;++I)A[I]=String.fromCharCode(I);Hg=A}var Hg=void 0;function CA(A){for(var I="",g=A;YA[g];)I+=Hg[YA[g++]];return I}var zA=void 0;function n(A){throw new zA(A)}function JA(A,I,g){if(g=g||{},!("argPackAdvance"in I))throw new TypeError("registerType registeredInstance requires argPackAdvance");var B=I.name;if(A||n('type "'+B+'" must have a positive integer typeid pointer'),pA.hasOwnProperty(A)){if(g.ignoreDuplicateRegistrations)return;n("Cannot register type '"+B+"' twice")}if(pA[A]=I,delete RI[A],nA.hasOwnProperty(A)){var Q=nA[A];delete nA[A],Q.forEach(function(G){G()})}}function iQ(A,I,g,B,Q){var G=SI(g);I=CA(I),JA(A,{name:I,fromWireType:function(i){return!!i},toWireType:function(i,D){return D?B:Q},argPackAdvance:8,readValueFromPointer:function(i){var D;if(g===1)D=iA;else if(g===2)D=yA;else if(g===4)D=S;else throw new TypeError("Unknown boolean type size: "+I);return this.fromWireType(D[i>>G])},destructorFunction:null})}function DQ(A){if(!(this instanceof mA)||!(A instanceof mA))return!1;for(var I=this.$$.ptrType.registeredClass,g=this.$$.ptr,B=A.$$.ptrType.registeredClass,Q=A.$$.ptr;I.baseClass;)g=I.upcast(g),I=I.baseClass;for(;B.baseClass;)Q=B.upcast(Q),B=B.baseClass;return I===B&&g===Q}function hQ(A){return{count:A.count,deleteScheduled:A.deleteScheduled,preservePointerOnDelete:A.preservePointerOnDelete,ptr:A.ptr,ptrType:A.ptrType,smartPtr:A.smartPtr,smartPtrType:A.smartPtrType}}function $I(A){function I(g){return g.$$.ptrType.registeredClass.name}n(I(A)+" instance already deleted")}var Ag=!1;function sg(A){}function oQ(A){A.smartPtr?A.smartPtrType.rawDestructor(A.smartPtr):A.ptrType.registeredClass.rawDestructor(A.ptr)}function mg(A){A.count.value-=1;var I=A.count.value===0;I&&oQ(A)}function BI(A){return typeof FinalizationGroup>"u"?(BI=function(I){return I},A):(Ag=new FinalizationGroup(function(I){for(var g=I.next();!g.done;g=I.next()){var B=g.value;B.ptr?mg(B):console.warn("object already deleted: "+B.ptr)}}),BI=function(I){return Ag.register(I,I.$$,I.$$),I},sg=function(I){Ag.unregister(I.$$)},BI(A))}function YQ(){if(this.$$.ptr||$I(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var A=BI(Object.create(Object.getPrototypeOf(this),{$$:{value:hQ(this.$$)}}));return A.$$.count.value+=1,A.$$.deleteScheduled=!1,A}function wQ(){this.$$.ptr||$I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&n("Object already scheduled for deletion"),sg(this),mg(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function kQ(){return!this.$$.ptr}var QI=void 0,CI=[];function Ig(){for(;CI.length;){var A=CI.pop();A.$$.deleteScheduled=!1,A.delete()}}function aQ(){return this.$$.ptr||$I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&n("Object already scheduled for deletion"),CI.push(this),CI.length===1&&QI&&QI(Ig),this.$$.deleteScheduled=!0,this}function ZQ(){mA.prototype.isAliasOf=DQ,mA.prototype.clone=YQ,mA.prototype.delete=wQ,mA.prototype.isDeleted=kQ,mA.prototype.deleteLater=aQ}function mA(){}var Kg={};function gg(A,I,g){if(A[I].overloadTable===void 0){var B=A[I];A[I]=function(){return A[I].overloadTable.hasOwnProperty(arguments.length)||n("Function '"+g+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+A[I].overloadTable+")!"),A[I].overloadTable[arguments.length].apply(this,arguments)},A[I].overloadTable=[],A[I].overloadTable[B.argCount]=B}}function Bg(A,I,g){E.hasOwnProperty(A)?((g===void 0||E[A].overloadTable!==void 0&&E[A].overloadTable[g]!==void 0)&&n("Cannot register public name '"+A+"' twice"),gg(E,A,A),E.hasOwnProperty(g)&&n("Cannot register multiple overloads of a function with the same number of arguments ("+g+")!"),E[A].overloadTable[g]=I):(E[A]=I,g!==void 0&&(E[A].numArguments=g))}function NQ(A,I,g,B,Q,G,i,D){this.name=A,this.constructor=I,this.instancePrototype=g,this.rawDestructor=B,this.baseClass=Q,this.getActualType=G,this.upcast=i,this.downcast=D,this.pureVirtualFunctions=[]}function JI(A,I,g){for(;I!==g;)I.upcast||n("Expected null or instance of "+g.name+", got an instance of "+I.name),A=I.upcast(A),I=I.baseClass;return A}function RQ(A,I){if(I===null)return this.isReference&&n("null is not a valid "+this.name),0;I.$$||n('Cannot pass "'+fA(I)+'" as a '+this.name),I.$$.ptr||n("Cannot pass deleted object as a pointer of type "+this.name);var g=I.$$.ptrType.registeredClass,B=JI(I.$$.ptr,g,this.registeredClass);return B}function FQ(A,I){var g;if(I===null)return this.isReference&&n("null is not a valid "+this.name),this.isSmartPointer?(g=this.rawConstructor(),A!==null&&A.push(this.rawDestructor,g),g):0;I.$$||n('Cannot pass "'+fA(I)+'" as a '+this.name),I.$$.ptr||n("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&I.$$.ptrType.isConst&&n("Cannot convert argument of type "+(I.$$.smartPtrType?I.$$.smartPtrType.name:I.$$.ptrType.name)+" to parameter type "+this.name);var B=I.$$.ptrType.registeredClass;if(g=JI(I.$$.ptr,B,this.registeredClass),this.isSmartPointer)switch(I.$$.smartPtr===void 0&&n("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:I.$$.smartPtrType===this?g=I.$$.smartPtr:n("Cannot convert argument of type "+(I.$$.smartPtrType?I.$$.smartPtrType.name:I.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:g=I.$$.smartPtr;break;case 2:if(I.$$.smartPtrType===this)g=I.$$.smartPtr;else{var Q=I.clone();g=this.rawShare(g,UA(function(){Q.delete()})),A!==null&&A.push(this.rawDestructor,g)}break;default:n("Unsupporting sharing policy")}return g}function bQ(A,I){if(I===null)return this.isReference&&n("null is not a valid "+this.name),0;I.$$||n('Cannot pass "'+fA(I)+'" as a '+this.name),I.$$.ptr||n("Cannot pass deleted object as a pointer of type "+this.name),I.$$.ptrType.isConst&&n("Cannot convert argument of type "+I.$$.ptrType.name+" to parameter type "+this.name);var g=I.$$.ptrType.registeredClass,B=JI(I.$$.ptr,g,this.registeredClass);return B}function lQ(A){return this.rawGetPointee&&(A=this.rawGetPointee(A)),A}function SQ(A){this.rawDestructor&&this.rawDestructor(A)}function JQ(A){A!==null&&A.delete()}function Xg(A,I,g){if(I===g)return A;if(g.baseClass===void 0)return null;var B=Xg(A,I,g.baseClass);return B===null?null:g.downcast(B)}function MQ(){return Object.keys(EI).length}function UQ(){var A=[];for(var I in EI)EI.hasOwnProperty(I)&&A.push(EI[I]);return A}function cQ(A){QI=A,CI.length&&QI&&QI(Ig)}function yQ(){E.getInheritedInstanceCount=MQ,E.getLiveInheritedInstances=UQ,E.flushPendingDeletes=Ig,E.setDelayFunction=cQ}var EI={};function WQ(A,I){for(I===void 0&&n("ptr should not be undefined");A.baseClass;)I=A.upcast(I),A=A.baseClass;return I}function dQ(A,I){return I=WQ(A,I),EI[I]}function MI(A,I){(!I.ptrType||!I.ptr)&&lI("makeClassHandle requires ptr and ptrType");var g=!!I.smartPtrType,B=!!I.smartPtr;return g!==B&&lI("Both smartPtrType and smartPtr must be specified"),I.count={value:1},BI(Object.create(A,{$$:{value:I}}))}function HQ(A){var I=this.getPointee(A);if(!I)return this.destructor(A),null;var g=dQ(this.registeredClass,I);if(g!==void 0){if(g.$$.count.value===0)return g.$$.ptr=I,g.$$.smartPtr=A,g.clone();var B=g.clone();return this.destructor(A),B}function Q(){return this.isSmartPointer?MI(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:I,smartPtrType:this,smartPtr:A}):MI(this.registeredClass.instancePrototype,{ptrType:this,ptr:A})}var G=this.registeredClass.getActualType(I),i=Kg[G];if(!i)return Q.call(this);var D;this.isConst?D=i.constPointerType:D=i.pointerType;var h=Xg(I,this.registeredClass,D.registeredClass);return h===null?Q.call(this):this.isSmartPointer?MI(D.registeredClass.instancePrototype,{ptrType:D,ptr:h,smartPtrType:this,smartPtr:A}):MI(D.registeredClass.instancePrototype,{ptrType:D,ptr:h})}function sQ(){MA.prototype.getPointee=lQ,MA.prototype.destructor=SQ,MA.prototype.argPackAdvance=8,MA.prototype.readValueFromPointer=gI,MA.prototype.deleteObject=JQ,MA.prototype.fromWireType=HQ}function MA(A,I,g,B,Q,G,i,D,h,o,Y){this.name=A,this.registeredClass=I,this.isReference=g,this.isConst=B,this.isSmartPointer=Q,this.pointeeType=G,this.sharingPolicy=i,this.rawGetPointee=D,this.rawConstructor=h,this.rawShare=o,this.rawDestructor=Y,!Q&&I.baseClass===void 0?B?(this.toWireType=RQ,this.destructorFunction=null):(this.toWireType=bQ,this.destructorFunction=null):this.toWireType=FQ}function Vg(A,I,g){E.hasOwnProperty(A)||lI("Replacing nonexistant public symbol"),E[A].overloadTable!==void 0&&g!==void 0?E[A].overloadTable[g]=I:(E[A]=I,E[A].argCount=g)}function mQ(A,I,g){var B=E["dynCall_"+A];return g&&g.length?B.apply(null,[I].concat(g)):B.call(null,I)}function KQ(A,I,g){return A.includes("j")?mQ(A,I,g):p.get(I).apply(null,g)}function XQ(A,I){var g=[];return function(){g.length=arguments.length;for(var B=0;B<arguments.length;B++)g[B]=arguments[B];return KQ(A,I,g)}}function GA(A,I){A=CA(A);function g(){return A.includes("j")?XQ(A,I):p.get(I)}var B=g();return typeof B!="function"&&n("unknown function pointer with signature "+A+": "+I),B}var Pg=void 0;function Tg(A){var I=tg(A),g=CA(I);return lA(I),g}function dA(A,I){var g=[],B={};function Q(G){if(!B[G]&&!pA[G]){if(RI[G]){RI[G].forEach(Q);return}g.push(G),B[G]=!0}}throw I.forEach(Q),new Pg(A+": "+g.map(Tg).join([", "]))}function VQ(A,I,g,B,Q,G,i,D,h,o,Y,a,k){Y=CA(Y),G=GA(Q,G),D&&(D=GA(i,D)),o&&(o=GA(h,o)),k=GA(a,k);var N=FI(Y);Bg(N,function(){dA("Cannot construct "+Y+" due to unbound types",[B])}),aA([A,I,g],B?[B]:[],function(b){b=b[0];var W,V;B?(W=b.registeredClass,V=W.instancePrototype):V=mA.prototype;var P=bI(N,function(){if(Object.getPrototypeOf(this)!==Z)throw new zA("Use 'new' to construct "+Y);if(J.constructor_body===void 0)throw new zA(Y+" has no accessible constructor");var d=J.constructor_body[arguments.length];if(d===void 0)throw new zA("Tried to invoke ctor of "+Y+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(J.constructor_body).toString()+") parameters instead!");return d.apply(this,arguments)}),Z=Object.create(V,{constructor:{value:P}});P.prototype=Z;var J=new NQ(Y,P,Z,k,W,G,D,o),v=new MA(Y,J,!0,!1,!1),L=new MA(Y+"*",J,!1,!1,!1),f=new MA(Y+" const*",J,!1,!0,!1);return Kg[A]={pointerType:L,constPointerType:f},Vg(N,P),[v,L,f]})}function pg(A,I){if(!(A instanceof Function))throw new TypeError("new_ called with constructor type "+typeof A+" which is not a function");var g=bI(A.name||"unknownFunctionName",function(){});g.prototype=A.prototype;var B=new g,Q=A.apply(B,I);return Q instanceof Object?Q:B}function Qg(A,I,g,B,Q){var G=I.length;G<2&&n("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var i=I[1]!==null&&g!==null,D=!1,h=1;h<I.length;++h)if(I[h]!==null&&I[h].destructorFunction===void 0){D=!0;break}for(var o=I[0].name!=="void",Y="",a="",h=0;h<G-2;++h)Y+=(h!==0?", ":"")+"arg"+h,a+=(h!==0?", ":"")+"arg"+h+"Wired";var k="return function "+FI(A)+"("+Y+`) {
8
+ if (arguments.length !== `+(G-2)+`) {
9
+ throwBindingError('function `+A+" called with ' + arguments.length + ' arguments, expected "+(G-2)+` args!');
10
+ }
11
+ `;D&&(k+=`var destructors = [];
12
+ `);var N=D?"destructors":"null",b=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],W=[n,B,Q,tA,I[0],I[1]];i&&(k+="var thisWired = classParam.toWireType("+N+`, this);
13
+ `);for(var h=0;h<G-2;++h)k+="var arg"+h+"Wired = argType"+h+".toWireType("+N+", arg"+h+"); // "+I[h+2].name+`
14
+ `,b.push("argType"+h),W.push(I[h+2]);if(i&&(a="thisWired"+(a.length>0?", ":"")+a),k+=(o?"var rv = ":"")+"invoker(fn"+(a.length>0?", ":"")+a+`);
15
+ `,D)k+=`runDestructors(destructors);
16
+ `;else for(var h=i?1:2;h<I.length;++h){var V=h===1?"thisWired":"arg"+(h-2)+"Wired";I[h].destructorFunction!==null&&(k+=V+"_dtor("+V+"); // "+I[h].name+`
17
+ `,b.push(V+"_dtor"),W.push(I[h].destructorFunction))}o&&(k+=`var ret = retType.fromWireType(rv);
18
+ return ret;
19
+ `),k+=`}
20
+ `,b.push(k);var P=pg(Function,b).apply(null,W);return P}function UI(A,I){for(var g=[],B=0;B<A;B++)g.push(S[(I>>2)+B]);return g}function PQ(A,I,g,B,Q,G,i){var D=UI(g,B);I=CA(I),G=GA(Q,G),aA([],[A],function(h){h=h[0];var o=h.name+"."+I;function Y(){dA("Cannot call "+o+" due to unbound types",D)}var a=h.registeredClass.constructor;return a[I]===void 0?(Y.argCount=g-1,a[I]=Y):(gg(a,I,o),a[I].overloadTable[g-1]=Y),aA([],D,function(k){var N=[k[0],null].concat(k.slice(1)),b=Qg(o,N,null,G,i);return a[I].overloadTable===void 0?(b.argCount=g-1,a[I]=b):a[I].overloadTable[g-1]=b,[]}),[]})}function Lg(A,I,g){return A instanceof Object||n(g+' with invalid "this": '+A),A instanceof I.registeredClass.constructor||n(g+' incompatible with "this" of type '+A.constructor.name),A.$$.ptr||n("cannot call emscripten binding method "+g+" on deleted object"),JI(A.$$.ptr,A.$$.ptrType.registeredClass,I.registeredClass)}function TQ(A,I,g,B,Q,G,i,D){I=CA(I),G=GA(Q,G),aA([],[A],function(h){h=h[0];var o=h.name+"."+I,Y={get:function(){dA("Cannot access "+o+" due to unbound types",[g])},enumerable:!0,configurable:!0};return D?Y.set=function(){dA("Cannot access "+o+" due to unbound types",[g])}:Y.set=function(a){n(o+" is a read-only property")},Object.defineProperty(h.registeredClass.constructor,I,Y),aA([],[g],function(a){a=a[0];var k={get:function(){return a.fromWireType(G(B))},enumerable:!0};return D&&(D=GA(i,D),k.set=function(N){var b=[];D(B,a.toWireType(b,N)),tA(b)}),Object.defineProperty(h.registeredClass.constructor,I,k),[]}),[]})}function pQ(A,I,g,B,Q,G){nI(I>0);var i=UI(I,g);Q=GA(B,Q);var D=[G],h=[];aA([],[A],function(o){o=o[0];var Y="constructor "+o.name;if(o.registeredClass.constructor_body===void 0&&(o.registeredClass.constructor_body=[]),o.registeredClass.constructor_body[I-1]!==void 0)throw new zA("Cannot register multiple constructors with identical number of parameters ("+(I-1)+") for class '"+o.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return o.registeredClass.constructor_body[I-1]=function(){dA("Cannot construct "+o.name+" due to unbound types",i)},aA([],i,function(a){return o.registeredClass.constructor_body[I-1]=function(){arguments.length!==I-1&&n(Y+" called with "+arguments.length+" arguments, expected "+(I-1)),h.length=0,D.length=I;for(var N=1;N<I;++N)D[N]=a[N].toWireType(h,arguments[N-1]);var b=Q.apply(null,D);return tA(h),a[0].fromWireType(b)},[]}),[]})}function LQ(A,I,g,B,Q,G,i,D){var h=UI(g,B);I=CA(I),G=GA(Q,G),aA([],[A],function(o){o=o[0];var Y=o.name+"."+I;D&&o.registeredClass.pureVirtualFunctions.push(I);function a(){dA("Cannot call "+Y+" due to unbound types",h)}var k=o.registeredClass.instancePrototype,N=k[I];return N===void 0||N.overloadTable===void 0&&N.className!==o.name&&N.argCount===g-2?(a.argCount=g-2,a.className=o.name,k[I]=a):(gg(k,I,Y),k[I].overloadTable[g-2]=a),aA([],h,function(b){var W=Qg(Y,b,o,G,i);return k[I].overloadTable===void 0?(W.argCount=g-2,k[I]=W):k[I].overloadTable[g-2]=W,[]}),[]})}function xQ(A,I,g,B,Q,G,i,D,h,o){I=CA(I),Q=GA(B,Q),aA([],[A],function(Y){Y=Y[0];var a=Y.name+"."+I,k={get:function(){dA("Cannot access "+a+" due to unbound types",[g,i])},enumerable:!0,configurable:!0};return h?k.set=function(){dA("Cannot access "+a+" due to unbound types",[g,i])}:k.set=function(N){n(a+" is a read-only property")},Object.defineProperty(Y.registeredClass.instancePrototype,I,k),aA([],h?[g,i]:[g],function(N){var b=N[0],W={get:function(){var P=Lg(this,Y,a+" getter");return b.fromWireType(Q(G,P))},enumerable:!0};if(h){h=GA(D,h);var V=N[1];W.set=function(P){var Z=Lg(this,Y,a+" setter"),J=[];h(o,Z,V.toWireType(J,P)),tA(J)}}return Object.defineProperty(Y.registeredClass.instancePrototype,I,W),[]}),[]})}function jQ(A,I,g){A=CA(A),aA([],[I],function(B){return B=B[0],E[A]=B.fromWireType(g),[]})}var Cg=[],FA=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Eg(A){A>4&&--FA[A].refcount===0&&(FA[A]=void 0,Cg.push(A))}function uQ(){for(var A=0,I=5;I<FA.length;++I)FA[I]!==void 0&&++A;return A}function qQ(){for(var A=5;A<FA.length;++A)if(FA[A]!==void 0)return FA[A];return null}function vQ(){E.count_emval_handles=uQ,E.get_first_emval=qQ}function UA(A){switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var I=Cg.length?Cg.pop():FA.length;return FA[I]={refcount:1,value:A},I}}}function tQ(A,I){I=CA(I),JA(A,{name:I,fromWireType:function(g){var B=FA[g].value;return Eg(g),B},toWireType:function(g,B){return UA(B)},argPackAdvance:8,readValueFromPointer:gI,destructorFunction:null})}function nQ(A,I,g){switch(I){case 0:return function(B){var Q=g?iA:YA;return this.fromWireType(Q[B])};case 1:return function(B){var Q=g?yA:$A;return this.fromWireType(Q[B>>1])};case 2:return function(B){var Q=g?S:SA;return this.fromWireType(Q[B>>2])};default:throw new TypeError("Unknown integer type: "+A)}}function zQ(A,I,g,B){var Q=SI(g);I=CA(I);function G(){}G.values={},JA(A,{name:I,constructor:G,fromWireType:function(i){return this.constructor.values[i]},toWireType:function(i,D){return D.value},argPackAdvance:8,readValueFromPointer:nQ(I,Q,B),destructorFunction:null}),Bg(I,G)}function cI(A,I){var g=pA[A];return g===void 0&&n(I+" has unknown type "+Tg(A)),g}function fQ(A,I,g){var B=cI(A,"enum");I=CA(I);var Q=B.constructor,G=Object.create(B.constructor.prototype,{value:{value:g},constructor:{value:bI(B.name+"_"+I,function(){})}});Q.values[g]=G,Q[I]=G}function fA(A){if(A===null)return"null";var I=typeof A;return I==="object"||I==="array"||I==="function"?A.toString():""+A}function OQ(A,I){switch(I){case 2:return function(g){return this.fromWireType(bg[g>>2])};case 3:return function(g){return this.fromWireType(OI[g>>3])};default:throw new TypeError("Unknown float type: "+A)}}function eQ(A,I,g){var B=SI(g);I=CA(I),JA(A,{name:I,fromWireType:function(Q){return Q},toWireType:function(Q,G){if(typeof G!="number"&&typeof G!="boolean")throw new TypeError('Cannot convert "'+fA(G)+'" to '+this.name);return G},argPackAdvance:8,readValueFromPointer:OQ(I,B),destructorFunction:null})}function rQ(A,I,g,B,Q,G){var i=UI(I,g);A=CA(A),Q=GA(B,Q),Bg(A,function(){dA("Cannot call "+A+" due to unbound types",i)},I-1),aA([],i,function(D){var h=[D[0],null].concat(D.slice(1));return Vg(A,Qg(A,h,null,Q,G),I-1),[]})}function _Q(A,I,g){switch(I){case 0:return g?function(Q){return iA[Q]}:function(Q){return YA[Q]};case 1:return g?function(Q){return yA[Q>>1]}:function(Q){return $A[Q>>1]};case 2:return g?function(Q){return S[Q>>2]}:function(Q){return SA[Q>>2]};default:throw new TypeError("Unknown integer type: "+A)}}function $Q(A,I,g,B,Q){I=CA(I),Q===-1&&(Q=4294967295);var G=SI(g),i=function(o){return o};if(B===0){var D=32-8*g;i=function(o){return o<<D>>>D}}var h=I.includes("unsigned");JA(A,{name:I,fromWireType:i,toWireType:function(o,Y){if(typeof Y!="number"&&typeof Y!="boolean")throw new TypeError('Cannot convert "'+fA(Y)+'" to '+this.name);if(Y<B||Y>Q)throw new TypeError('Passing a number "'+fA(Y)+'" from JS side to C/C++ side to an argument of type "'+I+'", which is outside the valid range ['+B+", "+Q+"]!");return h?Y>>>0:Y|0},argPackAdvance:8,readValueFromPointer:_Q(I,G,B!==0),destructorFunction:null})}function AC(A,I,g){var B=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Q=B[I];function G(i){i=i>>2;var D=SA,h=D[i],o=D[i+1];return new Q(wI,o,h)}g=CA(g),JA(A,{name:g,fromWireType:G,argPackAdvance:8,readValueFromPointer:G},{ignoreDuplicateRegistrations:!0})}function IC(A,I,g,B,Q,G,i,D,h,o,Y,a){g=CA(g),G=GA(Q,G),D=GA(i,D),o=GA(h,o),a=GA(Y,a),aA([A],[I],function(k){k=k[0];var N=new MA(g,k.registeredClass,!1,!1,!0,k,B,G,D,o,a);return[N]})}function gC(A,I){I=CA(I);var g=I==="std::string";JA(A,{name:I,fromWireType:function(B){var Q=SA[B>>2],G;if(g)for(var i=B+4,D=0;D<=Q;++D){var h=B+4+D;if(D==Q||YA[h]==0){var o=h-i,Y=VA(i,o);G===void 0?G=Y:(G+="\0",G+=Y),i=h+1}}else{for(var a=new Array(Q),D=0;D<Q;++D)a[D]=String.fromCharCode(YA[B+4+D]);G=a.join("")}return lA(B),G},toWireType:function(B,Q){Q instanceof ArrayBuffer&&(Q=new Uint8Array(Q));var G,i=typeof Q=="string";i||Q instanceof Uint8Array||Q instanceof Uint8ClampedArray||Q instanceof Int8Array||n("Cannot pass non-string to std::string"),g&&i?G=function(){return YI(Q)}:G=function(){return Q.length};var D=G(),h=OA(4+D+1);if(SA[h>>2]=D,g&&i)fI(Q,h+4,D+1);else if(i)for(var o=0;o<D;++o){var Y=Q.charCodeAt(o);Y>255&&(lA(h),n("String has UTF-16 code units that do not fit in 8 bits")),YA[h+4+o]=Y}else for(var o=0;o<D;++o)YA[h+4+o]=Q[o];return B!==null&&B.push(lA,h),h},argPackAdvance:8,readValueFromPointer:gI,destructorFunction:function(B){lA(B)}})}function BC(A,I,g){g=CA(g);var B,Q,G,i,D;I===2?(B=NB,Q=RB,i=FB,G=function(){return $A},D=1):I===4&&(B=bB,Q=lB,i=SB,G=function(){return SA},D=2),JA(A,{name:g,fromWireType:function(h){for(var o=SA[h>>2],Y=G(),a,k=h+4,N=0;N<=o;++N){var b=h+4+N*I;if(N==o||Y[b>>D]==0){var W=b-k,V=B(k,W);a===void 0?a=V:(a+="\0",a+=V),k=b+I}}return lA(h),a},toWireType:function(h,o){typeof o!="string"&&n("Cannot pass non-string to C++ string type "+g);var Y=i(o),a=OA(4+Y+I);return SA[a>>2]=Y>>D,Q(o,a+4,Y+I),h!==null&&h.push(lA,a),a},argPackAdvance:8,readValueFromPointer:gI,destructorFunction:function(h){lA(h)}})}function QC(A,I,g,B,Q,G){NI[A]={name:CA(I),rawConstructor:GA(g,B),rawDestructor:GA(Q,G),elements:[]}}function CC(A,I,g,B,Q,G,i,D,h){NI[A].elements.push({getterReturnType:I,getter:GA(g,B),getterContext:Q,setterArgumentType:G,setter:GA(i,D),setterContext:h})}function EC(A,I){I=CA(I),JA(A,{isVoid:!0,name:I,argPackAdvance:0,fromWireType:function(){},toWireType:function(g,B){}})}function HA(A){return A||n("Cannot use deleted val. handle = "+A),FA[A].value}function GC(A,I,g){A=HA(A),I=cI(I,"emval::as");var B=[],Q=UA(B);return S[g>>2]=Q,I.toWireType(B,A)}function xg(A,I){for(var g=new Array(A),B=0;B<A;++B)g[B]=cI(S[(I>>2)+B],"parameter "+B);return g}function iC(A,I,g,B){A=HA(A);for(var Q=xg(I,g),G=new Array(I),i=0;i<I;++i){var D=Q[i];G[i]=D.readValueFromPointer(B),B+=D.argPackAdvance}var h=A.apply(void 0,G);return UA(h)}var DC={};function jg(A){var I=DC[A];return I===void 0?CA(A):I}var Gg=[];function hC(A,I,g,B){A=Gg[A],I=HA(I),g=jg(g),A(I,g,null,B)}function oC(A){var I=Gg.length;return Gg.push(A),I}function YC(A,I){for(var g=xg(A,I),B=g[0],Q=B.name+"_$"+g.slice(1).map(function(N){return N.name}).join("_")+"$",G=["retType"],i=[B],D="",h=0;h<A-1;++h)D+=(h!==0?", ":"")+"arg"+h,G.push("argType"+h),i.push(g[1+h]);for(var o=FI("methodCaller_"+Q),Y="return function "+o+`(handle, name, destructors, args) {
21
+ `,a=0,h=0;h<A-1;++h)Y+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(a?"+"+a:"")+`);
22
+ `,a+=g[h+1].argPackAdvance;Y+=" var rv = handle[name]("+D+`);
23
+ `;for(var h=0;h<A-1;++h)g[h+1].deleteObject&&(Y+=" argType"+h+".deleteObject(arg"+h+`);
24
+ `);B.isVoid||(Y+=` return retType.toWireType(destructors, rv);
25
+ `),Y+=`};
26
+ `,G.push(Y);var k=pg(Function,G).apply(null,i);return oC(k)}function wC(A,I){return A=HA(A),I=HA(I),UA(A[I])}function kC(A){A>4&&(FA[A].refcount+=1)}function aC(){return UA([])}function ZC(A){return UA(jg(A))}function NC(){return UA({})}function RC(A){var I=FA[A].value;tA(I),Eg(A)}function FC(A,I,g){A=HA(A),I=HA(I),g=HA(g),A[I]=g}function bC(A,I){A=cI(A,"_emval_take_value");var g=A.readValueFromPointer(I);return UA(g)}function lC(A){return A=HA(A),UA(typeof A)}function SC(){EA()}var ig=[];function JC(A,I){ig.length=0;var g;for(I>>=2;g=YA[A++];){var B=g<105;B&&I&1&&I++,ig.push(B?OI[I++>>1]:S[I]),++I}return ig}function MC(A,I,g){var B=JC(I,g);return VB[A].apply(null,B)}function UC(A,I,g){YA.copyWithin(A,I,I+g)}function cC(A){try{return oI.grow(A-wI.byteLength+65535>>>16),lg(oI.buffer),1}catch{}}function yC(A){var I=YA.length;A=A>>>0;var g=2147483648;if(A>g)return!1;for(var B=1;B<=4;B*=2){var Q=I+33554432/B,G=Math.min(g,UB(Math.max(A,Q),65536)),i=cC(G);if(i)return!0}return!1}var ug={};function WC(){return j||"./this.program"}function GI(){if(!GI.strings){var A=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",I={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:A,_:WC()};for(var g in ug)I[g]=ug[g];var B=[];for(var g in I)B.push(g+"="+I[g]);GI.strings=B}return GI.strings}function dC(A,I){try{var g=0;return GI().forEach(function(B,Q){var G=I+g;S[A+Q*4>>2]=G,MB(B,G),g+=B.length+1}),0}catch(B){return(typeof C>"u"||!(B instanceof C.ErrnoError))&&EA(B),B.errno}}function HC(A,I){try{var g=GI();S[A>>2]=g.length;var B=0;return g.forEach(function(Q){B+=Q.length+1}),S[I>>2]=B,0}catch(Q){return(typeof C>"u"||!(Q instanceof C.ErrnoError))&&EA(Q),Q.errno}}function sC(A){try{var I=BA.getStreamFromFD(A);return C.close(I),0}catch(g){return(typeof C>"u"||!(g instanceof C.ErrnoError))&&EA(g),g.errno}}function mC(A,I,g,B){try{var Q=BA.getStreamFromFD(A),G=BA.doReadv(Q,I,g);return S[B>>2]=G,0}catch(i){return(typeof C>"u"||!(i instanceof C.ErrnoError))&&EA(i),i.errno}}function KC(A,I,g,B,Q){try{var G=BA.getStreamFromFD(A),i=4294967296,D=g*i+(I>>>0),h=9007199254740992;return D<=-h||D>=h?-61:(C.llseek(G,D,B),kA=[G.position>>>0,(AA=G.position,+Math.abs(AA)>=1?AA>0?(Math.min(+Math.floor(AA/4294967296),4294967295)|0)>>>0:~~+Math.ceil((AA-+(~~AA>>>0))/4294967296)>>>0:0)],S[Q>>2]=kA[0],S[Q+4>>2]=kA[1],G.getdents&&D===0&&B===0&&(G.getdents=null),0)}catch(o){return(typeof C>"u"||!(o instanceof C.ErrnoError))&&EA(o),o.errno}}function XC(A,I,g,B){try{var Q=BA.getStreamFromFD(A),G=BA.doWritev(Q,I,g);return S[B>>2]=G,0}catch(i){return(typeof C>"u"||!(i instanceof C.ErrnoError))&&EA(i),i.errno}}function VC(){return ZB()}function PC(A){return A}function TC(A){NA(A)}function yI(A){return A%4===0&&(A%100!==0||A%400===0)}function Dg(A,I){for(var g=0,B=0;B<=I;g+=A[B++]);return g}var WI=[31,29,31,30,31,30,31,31,30,31,30,31],dI=[31,28,31,30,31,30,31,31,30,31,30,31];function HI(A,I){for(var g=new Date(A.getTime());I>0;){var B=yI(g.getFullYear()),Q=g.getMonth(),G=(B?WI:dI)[Q];if(I>G-g.getDate())I-=G-g.getDate()+1,g.setDate(1),Q<11?g.setMonth(Q+1):(g.setMonth(0),g.setFullYear(g.getFullYear()+1));else return g.setDate(g.getDate()+I),g}return g}function pC(A,I,g,B){var Q=S[B+40>>2],G={tm_sec:S[B>>2],tm_min:S[B+4>>2],tm_hour:S[B+8>>2],tm_mday:S[B+12>>2],tm_mon:S[B+16>>2],tm_year:S[B+20>>2],tm_wday:S[B+24>>2],tm_yday:S[B+28>>2],tm_isdst:S[B+32>>2],tm_gmtoff:S[B+36>>2],tm_zone:Q?VA(Q):""},i=VA(g),D={"%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 h in D)i=i.replace(new RegExp(h,"g"),D[h]);var o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Y=["January","February","March","April","May","June","July","August","September","October","November","December"];function a(Z,J,v){for(var L=typeof Z=="number"?Z.toString():Z||"";L.length<J;)L=v[0]+L;return L}function k(Z,J){return a(Z,J,"0")}function N(Z,J){function v(f){return f<0?-1:f>0?1:0}var L;return(L=v(Z.getFullYear()-J.getFullYear()))===0&&(L=v(Z.getMonth()-J.getMonth()))===0&&(L=v(Z.getDate()-J.getDate())),L}function b(Z){switch(Z.getDay()){case 0:return new Date(Z.getFullYear()-1,11,29);case 1:return Z;case 2:return new Date(Z.getFullYear(),0,3);case 3:return new Date(Z.getFullYear(),0,2);case 4:return new Date(Z.getFullYear(),0,1);case 5:return new Date(Z.getFullYear()-1,11,31);case 6:return new Date(Z.getFullYear()-1,11,30)}}function W(Z){var J=HI(new Date(Z.tm_year+1900,0,1),Z.tm_yday),v=new Date(J.getFullYear(),0,4),L=new Date(J.getFullYear()+1,0,4),f=b(v),d=b(L);return N(f,J)<=0?N(d,J)<=0?J.getFullYear()+1:J.getFullYear():J.getFullYear()-1}var V={"%a":function(Z){return o[Z.tm_wday].substring(0,3)},"%A":function(Z){return o[Z.tm_wday]},"%b":function(Z){return Y[Z.tm_mon].substring(0,3)},"%B":function(Z){return Y[Z.tm_mon]},"%C":function(Z){var J=Z.tm_year+1900;return k(J/100|0,2)},"%d":function(Z){return k(Z.tm_mday,2)},"%e":function(Z){return a(Z.tm_mday,2," ")},"%g":function(Z){return W(Z).toString().substring(2)},"%G":function(Z){return W(Z)},"%H":function(Z){return k(Z.tm_hour,2)},"%I":function(Z){var J=Z.tm_hour;return J==0?J=12:J>12&&(J-=12),k(J,2)},"%j":function(Z){return k(Z.tm_mday+Dg(yI(Z.tm_year+1900)?WI:dI,Z.tm_mon-1),3)},"%m":function(Z){return k(Z.tm_mon+1,2)},"%M":function(Z){return k(Z.tm_min,2)},"%n":function(){return`
27
+ `},"%p":function(Z){return Z.tm_hour>=0&&Z.tm_hour<12?"AM":"PM"},"%S":function(Z){return k(Z.tm_sec,2)},"%t":function(){return" "},"%u":function(Z){return Z.tm_wday||7},"%U":function(Z){var J=new Date(Z.tm_year+1900,0,1),v=J.getDay()===0?J:HI(J,7-J.getDay()),L=new Date(Z.tm_year+1900,Z.tm_mon,Z.tm_mday);if(N(v,L)<0){var f=Dg(yI(L.getFullYear())?WI:dI,L.getMonth()-1)-31,d=31-v.getDate(),c=d+f+L.getDate();return k(Math.ceil(c/7),2)}return N(v,J)===0?"01":"00"},"%V":function(Z){var J=new Date(Z.tm_year+1900,0,4),v=new Date(Z.tm_year+1901,0,4),L=b(J),f=b(v),d=HI(new Date(Z.tm_year+1900,0,1),Z.tm_yday);if(N(d,L)<0)return"53";if(N(f,d)<=0)return"01";var c;return L.getFullYear()<Z.tm_year+1900?c=Z.tm_yday+32-L.getDate():c=Z.tm_yday+1-L.getDate(),k(Math.ceil(c/7),2)},"%w":function(Z){return Z.tm_wday},"%W":function(Z){var J=new Date(Z.tm_year,0,1),v=J.getDay()===1?J:HI(J,J.getDay()===0?1:7-J.getDay()+1),L=new Date(Z.tm_year+1900,Z.tm_mon,Z.tm_mday);if(N(v,L)<0){var f=Dg(yI(L.getFullYear())?WI:dI,L.getMonth()-1)-31,d=31-v.getDate(),c=d+f+L.getDate();return k(Math.ceil(c/7),2)}return N(v,J)===0?"01":"00"},"%y":function(Z){return(Z.tm_year+1900).toString().substring(2)},"%Y":function(Z){return Z.tm_year+1900},"%z":function(Z){var J=Z.tm_gmtoff,v=J>=0;return J=Math.abs(J)/60,J=J/60*100+J%60,(v?"+":"-")+("0000"+J).slice(-4)},"%Z":function(Z){return Z.tm_zone},"%%":function(){return"%"}};for(var h in V)i.includes(h)&&(i=i.replace(new RegExp(h,"g"),V[h](G)));var P=KI(i,!1);return P.length>I?0:(JB(P,A),P.length-1)}function LC(A,I,g,B){return pC(A,I,g,B)}var qg=function(A,I,g,B){A||(A=this),this.parent=A,this.mount=A.mount,this.mounted=null,this.id=C.nextInode++,this.name=I,this.mode=g,this.node_ops={},this.stream_ops={},this.rdev=B},sI=365,mI=146;Object.defineProperties(qg.prototype,{read:{get:function(){return(this.mode&sI)===sI},set:function(A){A?this.mode|=sI:this.mode&=~sI}},write:{get:function(){return(this.mode&mI)===mI},set:function(A){A?this.mode|=mI:this.mode&=~mI}},isFolder:{get:function(){return C.isDir(this.mode)}},isDevice:{get:function(){return C.isChrdev(this.mode)}}}),C.FSNode=qg,C.staticInit(),E.FS_createPath=C.createPath,E.FS_createDataFile=C.createDataFile,E.FS_createPreloadedFile=C.createPreloadedFile,E.FS_createLazyFile=C.createLazyFile,E.FS_createDevice=C.createDevice,E.FS_unlink=C.unlink,dg=E.InternalError=_I(Error,"InternalError"),GQ(),zA=E.BindingError=_I(Error,"BindingError"),ZQ(),sQ(),yQ(),Pg=E.UnboundTypeError=_I(Error,"UnboundTypeError"),vQ();function KI(A,I,g){var B=YI(A)+1,Q=new Array(B),G=zI(A,Q,0,Q.length);return I&&(Q.length=G),Q}var xC={B:PB,o:TB,q:LB,A:jB,b:qB,h:vB,Ka:tB,p:Wg,fa:nB,M:zB,ua:fB,e:uB,ha:_B,Da:$B,Ba:AQ,ja:IQ,Ca:gQ,Qa:CQ,Va:EQ,Fa:iQ,u:VQ,y:PQ,r:TQ,z:pQ,j:LQ,H:xQ,U:jQ,Ea:tQ,T:zQ,S:fQ,ka:eQ,G:rQ,O:$Q,N:AC,s:IC,la:gC,ba:BC,pa:QC,$:CC,Ga:EC,Q:GC,Ra:iC,_:hC,ia:Eg,Z:YC,Pa:wC,ma:kC,Ta:aC,Oa:ZC,La:NC,Na:RC,Sa:FC,C:bC,Ma:lC,wa:SC,ea:MC,ta:UC,aa:yC,xa:dC,ya:HC,X:sC,Aa:mC,Ua:KC,za:XC,a:VC,Ha:EE,da:CE,Ja:IE,ra:NE,oa:oE,x:eC,g:jC,Ia:BE,L:gE,na:YE,Y:iE,c:tC,i:zC,v:vC,ga:RE,t:_C,K:QE,F:hE,I:aE,W:FE,l:$C,m:OC,sa:ZE,P:AE,f:qC,qa:lE,d:uC,k:nC,ca:wE,n:fC,w:rC,D:DE,J:kE,R:GE,V:bE,E:PC,Wa:TC,va:LC};XB(),E.___wasm_call_ctors=function(){return(E.___wasm_call_ctors=E.asm.Ya).apply(null,arguments)};var OA=E._malloc=function(){return(OA=E._malloc=E.asm.Za).apply(null,arguments)},vg=E.___errno_location=function(){return(vg=E.___errno_location=E.asm.$a).apply(null,arguments)},lA=E._free=function(){return(lA=E._free=E.asm.ab).apply(null,arguments)},tg=E.___getTypeName=function(){return(tg=E.___getTypeName=E.asm.bb).apply(null,arguments)};E.___embind_register_native_and_builtin_types=function(){return(E.___embind_register_native_and_builtin_types=E.asm.cb).apply(null,arguments)};var u=E.stackSave=function(){return(u=E.stackSave=E.asm.db).apply(null,arguments)},q=E.stackRestore=function(){return(q=E.stackRestore=E.asm.eb).apply(null,arguments)},XI=E.stackAlloc=function(){return(XI=E.stackAlloc=E.asm.fb).apply(null,arguments)},z=E._setThrew=function(){return(z=E._setThrew=E.asm.gb).apply(null,arguments)},VI=E.___cxa_can_catch=function(){return(VI=E.___cxa_can_catch=E.asm.hb).apply(null,arguments)},ng=E.___cxa_is_pointer_type=function(){return(ng=E.___cxa_is_pointer_type=E.asm.ib).apply(null,arguments)};E.dynCall_viijii=function(){return(E.dynCall_viijii=E.asm.jb).apply(null,arguments)},E.dynCall_jiji=function(){return(E.dynCall_jiji=E.asm.kb).apply(null,arguments)},E.dynCall_iiiiij=function(){return(E.dynCall_iiiiij=E.asm.lb).apply(null,arguments)},E.dynCall_iiiiijj=function(){return(E.dynCall_iiiiijj=E.asm.mb).apply(null,arguments)},E.dynCall_iiiiiijj=function(){return(E.dynCall_iiiiiijj=E.asm.nb).apply(null,arguments)};function jC(A,I){var g=u();try{return p.get(A)(I)}catch(B){if(q(g),B!==B+0&&B!=="longjmp")throw B;z(1,0)}}function uC(A,I,g,B){var Q=u();try{p.get(A)(I,g,B)}catch(G){if(q(Q),G!==G+0&&G!=="longjmp")throw G;z(1,0)}}function qC(A,I,g){var B=u();try{p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function vC(A,I,g,B,Q){var G=u();try{return p.get(A)(I,g,B,Q)}catch(i){if(q(G),i!==i+0&&i!=="longjmp")throw i;z(1,0)}}function tC(A,I,g){var B=u();try{return p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function nC(A,I,g,B,Q){var G=u();try{p.get(A)(I,g,B,Q)}catch(i){if(q(G),i!==i+0&&i!=="longjmp")throw i;z(1,0)}}function zC(A,I,g,B){var Q=u();try{return p.get(A)(I,g,B)}catch(G){if(q(Q),G!==G+0&&G!=="longjmp")throw G;z(1,0)}}function fC(A,I,g,B,Q,G){var i=u();try{p.get(A)(I,g,B,Q,G)}catch(D){if(q(i),D!==D+0&&D!=="longjmp")throw D;z(1,0)}}function OC(A,I){var g=u();try{p.get(A)(I)}catch(B){if(q(g),B!==B+0&&B!=="longjmp")throw B;z(1,0)}}function eC(A){var I=u();try{return p.get(A)()}catch(g){if(q(I),g!==g+0&&g!=="longjmp")throw g;z(1,0)}}function rC(A,I,g,B,Q,G,i){var D=u();try{p.get(A)(I,g,B,Q,G,i)}catch(h){if(q(D),h!==h+0&&h!=="longjmp")throw h;z(1,0)}}function _C(A,I,g,B,Q,G){var i=u();try{return p.get(A)(I,g,B,Q,G)}catch(D){if(q(i),D!==D+0&&D!=="longjmp")throw D;z(1,0)}}function $C(A){var I=u();try{p.get(A)()}catch(g){if(q(I),g!==g+0&&g!=="longjmp")throw g;z(1,0)}}function AE(A,I,g){var B=u();try{p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function IE(A,I,g,B,Q){var G=u();try{return p.get(A)(I,g,B,Q)}catch(i){if(q(G),i!==i+0&&i!=="longjmp")throw i;z(1,0)}}function gE(A,I,g){var B=u();try{return p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function BE(A,I,g){var B=u();try{return p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function QE(A,I,g,B,Q,G,i){var D=u();try{return p.get(A)(I,g,B,Q,G,i)}catch(h){if(q(D),h!==h+0&&h!=="longjmp")throw h;z(1,0)}}function CE(A,I){var g=u();try{return p.get(A)(I)}catch(B){if(q(g),B!==B+0&&B!=="longjmp")throw B;z(1,0)}}function EE(A,I){var g=u();try{return p.get(A)(I)}catch(B){if(q(g),B!==B+0&&B!=="longjmp")throw B;z(1,0)}}function GE(A,I,g,B,Q,G,i,D,h,o,Y){var a=u();try{p.get(A)(I,g,B,Q,G,i,D,h,o,Y)}catch(k){if(q(a),k!==k+0&&k!=="longjmp")throw k;z(1,0)}}function iE(A,I,g,B,Q){var G=u();try{return p.get(A)(I,g,B,Q)}catch(i){if(q(G),i!==i+0&&i!=="longjmp")throw i;z(1,0)}}function DE(A,I,g,B,Q,G,i,D){var h=u();try{p.get(A)(I,g,B,Q,G,i,D)}catch(o){if(q(h),o!==o+0&&o!=="longjmp")throw o;z(1,0)}}function hE(A,I,g,B,Q,G,i,D){var h=u();try{return p.get(A)(I,g,B,Q,G,i,D)}catch(o){if(q(h),o!==o+0&&o!=="longjmp")throw o;z(1,0)}}function oE(A,I,g,B){var Q=u();try{return p.get(A)(I,g,B)}catch(G){if(q(Q),G!==G+0&&G!=="longjmp")throw G;z(1,0)}}function YE(A,I,g,B){var Q=u();try{return p.get(A)(I,g,B)}catch(G){if(q(Q),G!==G+0&&G!=="longjmp")throw G;z(1,0)}}function wE(A,I,g,B,Q,G,i,D,h,o,Y){var a=u();try{p.get(A)(I,g,B,Q,G,i,D,h,o,Y)}catch(k){if(q(a),k!==k+0&&k!=="longjmp")throw k;z(1,0)}}function kE(A,I,g,B,Q,G,i,D,h){var o=u();try{p.get(A)(I,g,B,Q,G,i,D,h)}catch(Y){if(q(o),Y!==Y+0&&Y!=="longjmp")throw Y;z(1,0)}}function aE(A,I,g,B,Q,G,i,D,h){var o=u();try{return p.get(A)(I,g,B,Q,G,i,D,h)}catch(Y){if(q(o),Y!==Y+0&&Y!=="longjmp")throw Y;z(1,0)}}function ZE(A,I,g){var B=u();try{p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function NE(A,I,g){var B=u();try{return p.get(A)(I,g)}catch(Q){if(q(B),Q!==Q+0&&Q!=="longjmp")throw Q;z(1,0)}}function RE(A,I,g,B,Q,G){var i=u();try{return p.get(A)(I,g,B,Q,G)}catch(D){if(q(i),D!==D+0&&D!=="longjmp")throw D;z(1,0)}}function FE(A,I,g,B,Q,G,i,D,h,o,Y,a){var k=u();try{return p.get(A)(I,g,B,Q,G,i,D,h,o,Y,a)}catch(N){if(q(k),N!==N+0&&N!=="longjmp")throw N;z(1,0)}}function bE(A,I,g,B,Q,G,i,D,h,o,Y,a,k,N,b,W){var V=u();try{p.get(A)(I,g,B,Q,G,i,D,h,o,Y,a,k,N,b,W)}catch(P){if(q(V),P!==P+0&&P!=="longjmp")throw P;z(1,0)}}function lE(A,I,g,B){var Q=u();try{p.get(A)(I,g,B)}catch(G){if(q(Q),G!==G+0&&G!=="longjmp")throw G;z(1,0)}}E.addRunDependency=eI,E.removeRunDependency=kI,E.FS_createPath=C.createPath,E.FS_createDataFile=C.createDataFile,E.FS_createPreloadedFile=C.createPreloadedFile,E.FS_createLazyFile=C.createLazyFile,E.FS_createDevice=C.createDevice,E.FS_unlink=C.unlink;var PI;function SE(A){this.name="ExitStatus",this.message="Program terminated with exit("+A+")",this.status=A}AI=function A(){PI||hg(),PI||(AI=A)};function hg(A){if(PA>0||(cB(),PA>0))return;function I(){PI||(PI=!0,E.calledRun=!0,!Ng&&(yB(),R(E),E.onRuntimeInitialized&&E.onRuntimeInitialized(),WB()))}E.setStatus?(E.setStatus("Running..."),setTimeout(function(){setTimeout(function(){E.setStatus("")},1),I()},1)):I()}if(E.run=hg,E.preInit)for(typeof E.preInit=="function"&&(E.preInit=[E.preInit]);E.preInit.length>0;)E.preInit.pop()();hg();var zg=[];function JE(A){zg.push(A)}return E.onRuntimeInitialized=function(){for(var A of zg)A()},(function(){var A,I,g,B,Q="/",G,i,D=";",h=0,o=99999;function Y(d){var c={};return d.filter(function(H){return c.hasOwnProperty(H)?!1:c[H]=!0})}function a(d,c,H=B){var X=c.endsWith(H),x=d.startsWith(H),QA;return X||x?X&&x?QA=c.substring(0,c.length-1)+d:QA=c+d:QA=c+H+d,QA}function k(d,c){var H=0;function X(){var x=a(d,c[H++]);return fetch(x).then(function(QA){if(QA.status===200)return QA.text().then(function(DA){var IA=new URL(QA.url),ZA=IA.pathname.substring(1);return ZA=ZA.replace(new RegExp(B,"g"),Q),{data:DA,filePath:ZA,fullPath:IA.origin+IA.pathname}});if(H<c.length)return X();throw new Error("MaterialX file not found: "+d)})}return X()}function N(d,c){var H=0;function X(){var x=a(d,c[H++]);return x=I.resolve(x),new Promise(function(QA,DA){A.readFile(x,"utf8",function(IA,ZA){if(IA)H<c.length?QA(X()):DA(new Error("MaterialX file not found: "+d));else{var KA=I.parse(x),bA=x.substring(KA.root.length),iI=B==="\\"?"\\\\":B;bA=bA.replace(new RegExp(iI,"g"),Q),QA({data:ZA,filePath:bA,fullPath:x})}})})}return X()}function b(d){for(var c=d.concat(D,E.getEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR)),H=["."+B].concat(c.split(D)),X=H.length-1;X;)H[X].trim()===""&&H.splice(X,1),--X;return Y(H)}function W(d,c){var H=d;typeof d=="string"&&(H=d.split(D));for(var X=0;X<H.length;++X){var x=H[X];if(i){if(I.isAbsolute(x)){var QA=I.parse(x);x=c+Q+QA.dir.substring(QA.root.length)}var DA=B==="\\"?"\\\\":B;x.replace(new RegExp(DA,"g"),Q)}else if(G){var IA=document.createElement("a");IA.href=x,IA.origin+IA.pathname+IA.search+IA.hash===x&&(x=c+IA.pathname)}else throw new Error("Unknown environment!");H[X]=x}return typeof d=="string"?H.join(E.PATH_LIST_SEPARATOR):H}function V(d,c){var H=d.split(D);return W(H,c),H.push(L(c)),H=Y(H),H=H.join(E.PATH_LIST_SEPARATOR),H}function P(d){var c=/<xi:include href="(.*)"\s*\/>/g,H=d.matchAll(c),X=[];for(var x of H)X.push(x[1]);return X}function Z(d,c){var H;if(G)H=k(d,c);else if(i)H=N(d,c);else throw new Error("Unknown environment!");return H}function J(d,c,H=!1){H?(c.files||(c.files=[]),c.files.push(d)):(c.folders||(c.folders=[]),c.folders.splice(0,0,d))}function v(d,c,H,X,x=!0){var QA;x?QA=d.substring(1,d.lastIndexOf(Q)).split(Q):QA=d.substring(X.length).split(Q);for(var DA=X,IA=1;IA<QA.length;++IA){DA+=Q+QA[IA];var ZA;try{var KA=C.stat(DA);ZA=C.isDir(KA.mode)}catch{ZA=!1}if(!ZA)try{C.mkdir(DA),J(DA,H)}catch{throw new Error("Failed to create folder in WASM FS.")}}if(x)try{C.writeFile(d,c),J(d,H,!0)}catch{throw new Error("Failed to store file in WASM FS.")}}function L(d){if(i){var c=g.cwd(),H=I.parse(c),X=d+Q+c.substring(H.root.length),x=B==="\\"?"\\\\":B;return X.replace(new RegExp(x,"g"),Q)}else if(G){var c=window.location.pathname;return c=c.substring(0,c.lastIndexOf(B)),a(c,d,Q)}else throw new Error("Unknown environment!")}function f(d,c){if(i)try{A.writeFileSync(d,c)}catch(x){throw new Error("Failed to write file '"+d+"': "+x.message)}else if(G){var H=d.lastIndexOf(B);d=d.substring(H>-1?H+1:0);var X=document.createElement("a");X.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(c)),X.setAttribute("download",d),X.style.display="none",document.body.appendChild(X),X.click(),document.body.removeChild(X)}}JE(function(){G=typeof window=="object",i=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",G&&(B="/"),i&&(A=require("fs"),I=require("path"),g=require("process"),B=I.sep);function d(c,H,X,x,QA=[],DA=""){var IA="/readFromXml"+h++%o,ZA=b(X);try{C.mkdir(IA)}catch{throw new Error("Failed to create folder in WASM FS.")}var KA=[];(!x||x.readXIncludes)&&(KA=P(H));var bA={files:[],folders:[]},iI=L(IA),DI=iI+"/ChosenToHopefullyNotClashWithAnyOtherFile123";if(DA){var ME=B==="\\"?"\\\\":B;DI=DA.replace(new RegExp(ME,"g"),Q),DI=a(DI,IA,Q),v(iI,null,bA,IA,!1)}v(DI,H,bA,IA);function fg(TI,eA,og){var pI=[Promise.resolve()];for(var Yg of eA){var LA=TI.slice(),LI=og.slice(),UE=Z(Yg,LI).then(function(XA){if(LA.includes(XA.fullPath))throw new Error(`Cycle detected!
28
+ `+LA.join(`
29
+ -> `)+`
30
+ -> `+XA.fullPath);LA.push(XA.fullPath);var Og=XA.fullPath.lastIndexOf(B),eg=XA.fullPath.substring(0,Og>-1?Og:0);LI.includes(eg)||LI.splice(0,0,eg);var cE=P(XA.data),rg=a(XA.filePath,IA,Q);return bA.files.includes(rg)||v(rg,XA.data,bA,IA),fg(LA,cE,LI)});pI.push(UE)}return Promise.all(pI)}return fg(QA,KA,ZA).then(function(){var TI=V(X,IA);C.chdir(iI);try{var eA=E.getEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR);if(eA){var og=W(eA,IA);E.setEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR,og)}E._readFromXmlFile(c,DI,TI,x),eA&&E.setEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR,eA)}catch(LA){throw new Error("Failed to read MaterialX files from WASM FS: "+E.getExceptionMessage(LA))}try{for(var pI of bA.files)C.unlink(pI);C.chdir("/");for(var Yg of bA.folders)C.rmdir(Yg);C.rmdir(IA)}catch{throw new Error("Failed to delete temporary files from WASM FS.")}})}E.readFromXmlString=function(c,H,X="",x=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 d(c,H,X,x)},E.readFromXmlFile=function(c,H,X="",x=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 QA=b(X);return Z(H,QA).then(function(DA){var IA=[DA.fullPath],ZA=DA.fullPath.lastIndexOf(B),KA=DA.fullPath.substring(0,ZA>-1?ZA:0);return X=X.concat(D,KA),d(c,DA.data,X,x,IA,DA.filePath)})},E.writeToXmlFile=function(c,H,X=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 x=E.writeToXmlString(c,X);f(H,x)},E.exportToXmlFile=function(c,H,X=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 x=E.exportToXmlString(c,X);f(H,x)}})})(),w.ready})})();typeof exports=="object"&&typeof module=="object"?module.exports=jI:typeof define=="function"&&define.amd?define([],function(){return jI}):typeof exports=="object"&&(exports.MaterialX=jI);function DB(l){const E=new URLSearchParams(window.location.search).get(l);return E==null||E==="0"||E==="false"?!1:E===""?!0:E}const O=DB("debugmaterialx"),yE=O==="update";let hB=0;function _g(){return hB}let oB=0;function $g(){return oB}const WE=window.performance||window.webkitPerformance||window.mozPerformance;function YB(){hB=WE.now()/1e3,oB++,window.requestAnimationFrame(YB)}window.requestAnimationFrame(YB);async function dE(){return typeof requestIdleCallback<"u"?new Promise(l=>requestIdleCallback(l)):(console.debug("[MaterialX] Can not wait for network idle, using fallback"),new Promise(l=>setTimeout(l,100)))}function HE(){return window.location.hostname==="localhost"||/^\d{1,3}(\.\d{1,3}){3}$/.test(window.location.hostname)}const sE=DB("debugmaterialx"),uI=new y.Texture;uI.needsUpdate=!0;uI.image=new Image;uI.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";function AB(l,w,E=0,R=1024,s=512,M){let F;M?F=M:w.image?F=w.image.height/4:F=256;const j=Math.log2(F)-2,U=F,m=3*Math.max(Math.pow(2,j),112),K=new y.WebGLRenderTarget(R,s,{format:y.RGBAFormat,type:y.FloatType,minFilter:y.LinearMipMapLinearFilter,magFilter:y.LinearFilter,generateMipmaps:!0,wrapS:y.RepeatWrapping,anisotropy:l.capabilities.getMaxAnisotropy()}),gA=new y.PlaneGeometry(2,2),e=new y.OrthographicCamera(-1,1,1,-1,0,1),_=new y.ShaderMaterial({defines:{USE_ENVMAP:"",ENVMAP_TYPE_CUBE_UV:"",CUBEUV_TEXEL_WIDTH:1/m,CUBEUV_TEXEL_HEIGHT:1/U,CUBEUV_MAX_MIP:j+0+".0"},uniforms:{envMap:{value:w},roughness:{value:E}},vertexShader:`
31
+ varying vec2 vUv;
32
+
33
+ void main() {
34
+ vUv = uv;
35
+ gl_Position = vec4(position.xy, 0.0, 1.0);
36
+ }
37
+ `,fragmentShader:`
38
+ uniform sampler2D envMap;
39
+ uniform float roughness;
40
+ varying vec2 vUv;
41
+
42
+ #include <common>
43
+ #include <cube_uv_reflection_fragment>
44
+
45
+ void main() {
46
+ // Convert UV coordinates to equirectangular direction
47
+ vec2 uv = vUv;
48
+
49
+ // Map UV (0,1) to spherical coordinates
50
+ // Longitude: -π to π, Latitude: 0 to π
51
+ float phi = uv.x * 2.0 * PI - PI; // Longitude (-π to π)
52
+ float theta = uv.y * PI; // Latitude (0 to π)
53
+ // Rotate 90° around Y
54
+ phi -= PI / 2.0; // Adjust to match Three.js convention
55
+
56
+ // Convert spherical to cartesian coordinates
57
+ vec3 direction = vec3(
58
+ sin(theta) * cos(phi), // x
59
+ cos(theta), // y
60
+ sin(theta) * sin(phi) // z
61
+ );
62
+
63
+ // Sample the PMREM cube texture using the direction and roughness
64
+ #ifdef ENVMAP_TYPE_CUBE_UV
65
+ vec4 envColor = textureCubeUV(envMap, direction, roughness);
66
+ #else
67
+ vec4 envColor = vec4(1.0, 0.0, 1.0, 1.0); // Magenta fallback
68
+ #endif
69
+
70
+ gl_FragColor = vec4(envColor.rgb, 1.0);
71
+ }
72
+ `}),t=new y.Scene,oA=new y.Mesh(gA,_);t.add(oA);const cA=l.getRenderTarget(),jA=l.autoClear,rA=l.xr.enabled,uA=l.shadowMap.enabled;K.texture.generateMipmaps=!0;try{l.xr.enabled=!1,l.shadowMap.enabled=!1,l.autoClear=!0,l.setRenderTarget(K),l.clear(),l.render(t,e)}finally{l.setRenderTarget(cA),l.autoClear=jA,l.xr.enabled=rA,l.shadowMap.enabled=uA,gA.dispose(),_.dispose(),t.remove(oA)}return K.texture.name="PMREM_Equirectangular_Texture_"+E.toFixed(2),K.texture.mapping=y.EquirectangularReflectionMapping,sE&&console.log("[MaterialX] PMREM to Equirect Render Target:",{width:K.width,height:K.height,mipmaps:K.texture.mipmaps?.length,roughness:E}),K}const qI="_",IB=qI+"uaddressmode",gB=qI+"vaddressmode",BB=qI+"filtertype",mE="/";function wg(l,w){let E;if(l)E=[...l.data()];else{E=[];for(let R=0;R<w;++R)E.push(0)}return E}function QB(l,w){const E=new Array(w);if(l)for(let R=0;R<l.numRows();++R)for(let s=0;s<l.numColumns();++s)E.push(l.getItem(R,s));else for(let R=0;R<w;++R)E.push(0);return E}const vI=new y.Texture;vI.needsUpdate=!0;vI.image=new Image;vI.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";const tI=new y.Texture;tI.needsUpdate=!0;tI.image=new Image;tI.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAABJQTFRFgYH4gIH4gYH3gIH3gIH5gID4m94ORAAAADFJREFUeJxjZBBkfMdo9P/BB0aBj/8FGB0ufghgFGT4r8wo+P8rD2Pgo3sMjIz8jAwAMLoN0ZjS5hgAAAAASUVORK5CYII=";function KE(l){const w=y.Cache.enabled;y.Cache.enabled=!0;const E=y.Cache.get(l);return y.Cache.enabled=w,E}function XE(l,w){const E=y.Cache.enabled;y.Cache.enabled=!0,y.Cache.add(l,w),y.Cache.enabled=E,O&&console.log("[MaterialX] Added to cache:",l,w)}function VE(l,w,E,R,s,M){const F=new y.Uniform$1(null);switch(w){case"float":case"integer":case"boolean":F.value=E;break;case"vector2":F.value=wg(E,2);break;case"vector3":case"color3":F.value=wg(E,3);break;case"vector4":case"color4":F.value=wg(E,4);break;case"matrix33":F.value=QB(E,9);break;case"matrix44":F.value=QB(E,16);break;case"filename":if(E){let U=!0,m=M+mE+E;E.startsWith("blob:")||E.startsWith("data:")?(m=E,U=!1):E.startsWith("http")&&(m=E,U=!0);const K=s.cacheKey?.length?`${s.cacheKey}-${m}`:m,gA=U?KE(K):null;if(gA)O&&console.log("[MaterialX] Use cached texture: ",K,gA),gA instanceof Promise?gA.then(e=>{e?F.value=e:console.warn(`[MaterialX] Failed to load texture ${R} '${m}'`)}):F.value=gA;else{O&&console.log("[MaterialX] Load texture:",m),R.toLowerCase().includes("normal")?F.value=tI:F.value=vI;const e=F.value,_=s.getTexture(m)?.then(t=>(t&&(t=t.clone(),t.colorSpace=y.LinearSRGBColorSpace,PE(t,R,l)),t)).catch(t=>(console.error(`[MaterialX] Failed to load texture ${R} '${m}'`,t),e));U&&XE(K,_),_?.then(t=>{t?F.value=t:console.warn(`[MaterialX] Failed to load texture ${R} '${m}'`)})}}break;case"samplerCube":case"string":break;default:const j=w+":"+R;CB.has(j)||(CB.set(j,!0),(O||HE())&&console.warn(`MaterialX: Unsupported uniform '${R}': ${w}`));break}return F}const CB=new Map;function EB(l){let w;switch(l){case 1:w=y.ClampToEdgeWrapping;break;case 2:w=y.RepeatWrapping;break;case 3:w=y.MirroredRepeatWrapping;break;default:w=y.RepeatWrapping;break}return w}function PE(l,w,E,R=!0){const s=w.lastIndexOf(qI),M=w.substring(0,s)||w;if(E.find(M+IB)){const U=E.find(M+IB).getValue().getData();l.wrapS=EB(U)}if(E.find(M+gB)){const U=E.find(M+gB).getValue().getData();l.wrapT=EB(U)}const F=E.find(M+BB)?E.get(M+BB).value:-1;let j=R?y.LinearMipMapLinearFilter:y.LinearFilter;F===0&&(j=R?y.NearestMipMapNearestFilter:y.NearestFilter),l.minFilter=j}function TE(l){let w=new Array;for(let E of l.getNodes())E.getType()==="lightshader"&&w.push(E);return w}let xA={};async function pE(l,w){xA={};const E=w.getOptions().hwMaxActiveLightSources;l.HwShaderGenerator.unbindLightShaders(w);let R=1;const s=`<?xml version="1.0"?>
73
+ <materialx version="1.39">
74
+ <directional_light name="default_directional_light" type="lightshader">
75
+ </directional_light>
76
+ <point_light name="default_point_light" type="lightshader">
77
+ </point_light>
78
+ <spot_light name="default_spot_light" type="lightshader">
79
+ </spot_light>
80
+ <!--
81
+ <area_light name="default_area_light" type="lightshader">
82
+ </area_light>
83
+ -->
84
+ </materialx>`,M=l.createDocument();await l.readFromXmlString(M,s,"");const F=l.createDocument(),j=l.loadStandardLibraries(w);F.setDataLibrary(j),F.importLibrary(M);const U=TE(F);O&&console.log("Default lights in MaterialX document",U),w.getOptions().hwMaxActiveLightSources=E;for(let m of U){const K=m.getNodeDef();if(O&&console.log("Default light node definition",K),!K)continue;const gA=K.getName();O&&console.log("Registering default light",{lightName:gA,lightDef:K}),xA[gA]||(O&&console.log("Bind light shader for node",{lightName:gA,lightId:R,lightDef:K}),xA[gA]=R,l.HwShaderGenerator.bindLightShader(K,R++,w))}O&&console.log("Light types bound in MaterialX context",xA)}const GB={};function LE(l){switch(l){case"PointLight":return"ND_point_light";case"DirectionalLight":return"ND_directional_light";case"SpotLight":return"ND_spot_light";default:return GB[l]||(GB[l]=!0,console.warn("MaterialX: Unsupported light type: "+l)),null}}function xE(l,w){const E=new Array,R=w.getOptions().hwMaxActiveLightSources;for(let M of l){if(!M?.isLight)continue;const F=LE(M.type);if(!F)continue;xA[F]||O&&console.error("MaterialX: Light type not registered in context. Make sure to register light types before using them.",F);const j=M.getWorldPosition(new y.Vector3),U=M.getWorldQuaternion(new y.Quaternion),m=new y.Vector3(0,0,-1).applyQuaternion(U),K=M.angle,gA=K*(1-M.penumbra),e=Math.cos(gA),_=Math.cos(K);E.push({type:xA[F],position:j.clone(),direction:m.clone(),color:new y.Color().fromArray(M.color.toArray()),intensity:M.intensity*(M.isPointLight||M.isSpotLight?683/3.1415:1),decay_rate:2,inner_angle:e,outer_angle:_})}const s=E.length;for(;E.length<R;){const M={type:0,position:new y.Vector3(0,0,0),direction:new y.Vector3(0,0,-1),color:new y.Color(0,0,0),intensity:0,decay_rate:2,inner_angle:0,outer_angle:0};E.push(M)}return yE&&console.log("Registered lights in MaterialX context",xA,E),{lightData:E,lightCount:s}}function iB(l,w,E){const R={},s=l.getUniformBlocks();for(const[M,F]of Object.entries(s))if(M!=="LightData"&&!F.empty())for(let j=0;j<F.size();++j){const U=F.get(j),m=U.getValue()?.getData(),K=U.getVariable(),gA=U.getType().getName();R[K]=VE(F,gA,m,K,w,E),O&&console.log("Adding uniform",{path:U.getPath(),type:gA,name:K,value:R[K]})}return R}function xI(l,w){const E=w.getUniformBlocks();for(const[R,s]of Object.entries(E))if(R!=="LightData"&&!s.empty())for(let M=0;M<s.size();++M){const F=s.get(M),j=F.getVariable();let U=F.getPath().split("/").pop();switch(U){case"_Color":U="color";break;case"_Roughness":U="roughness";break;case"_Metallic":U="metalness";break}U&&(l.hasOwnProperty(U)?O&&console.warn(`[MaterialX] Uniform ${j} already exists in material as property ${U}, skipping.`):Object.defineProperty(l,U,{get:function(){return this.uniforms?.[j].value},set:function(m){const K=this.uniforms;if(!K||!K[j]){console.warn(`[MaterialX] Uniform ${j} not found in ${this.name} uniforms`);return}this.uniforms[j].value=m,this.uniformsNeedUpdate=!0}}))}}async function jE(l){if(l==="immediately")return hI();if(l==="network_idle")return dE().then(hI)}const r=new class{materialXModule=null;materialXGenerator=null;materialXGenContext=null;materialXStdLib=null;materialXInitPromise=null};async function hI(){return r.materialXInitPromise?r.materialXInitPromise:r.materialXInitPromise=(async()=>{if(!r.materialXModule){O&&console.log("[MaterialX] Initializing WASM module...");try{const w="1.4.0";let E;E=[`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXCore.wasm`,`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXGenShader.wasm`,`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXGenShader.data.txt`];const[R,s,M]=E,F=await jI({locateFile:(U,m)=>(O&&console.debug("[MaterialX] locateFile called:",{path:U,scriptDirectory:m}),U.includes("JsMaterialXCore.wasm")?R:U.includes("JsMaterialXGenShader.wasm")?s:U.includes("JsMaterialXGenShader.data")?M:m+U)});O&&console.log("[MaterialX] module loaded",F),r.materialXModule=F,r.materialXGenerator=F.EsslShaderGenerator.create(),r.materialXGenContext=new F.GenContext(r.materialXGenerator);const j=F.createDocument();r.materialXStdLib=F.loadStandardLibraries(r.materialXGenContext),j.setDataLibrary(r.materialXStdLib),r.materialXGenContext.getOptions().shaderInterfaceType=r.materialXModule.ShaderInterfaceType.SHADER_INTERFACE_COMPLETE,r.materialXGenContext.getOptions().hwSpecularEnvironmentMethod=r.materialXModule.HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_FIS,r.materialXGenContext.getOptions().hwSrgbEncodeOutput=!1,r.materialXGenContext.getOptions().hwMaxActiveLightSources=4,await pE(r.materialXModule,r.materialXGenContext),O&&console.log("[MaterialX] Generator initialized successfully")}catch(l){throw console.error("[MaterialX] Failed to load MaterialX module:",l),l}}})()}class kg{static get(w){return this.getEnvironment(w)}static _environments=new Map;static getEnvironment(w){if(this._environments.has(w))return this._environments.get(w);const E=new kg(w);return this._environments.set(w,E),E}_lights=[];_lightData=null;_lightCount=0;_initializePromise=null;_isInitialized=!1;_lastUpdateFrame=-1;constructor(w){this._scene=w,O&&console.log("[MaterialX] Environment created")}async initialize(w){return this._initializePromise?this._initializePromise:(this._initializePromise=this._initialize(w),this._initializePromise)}update(w,E,R){if(!this._initializePromise){this.initialize(R);return}if(this._isInitialized&&this._lastUpdateFrame!==w&&(this._lastUpdateFrame=w,this.updateLighting(!1),O&&!this._debug)){const s=this._getTextures(E.environment);this._debug=!0;const M=new y.MeshBasicMaterial;M.side=2;const F=M.clone();F.map=s.radianceTexture;const j=new y.PlaneGeometry(1,1,1,1),U=new y.Mesh(j,F),m=M.clone();m.map=s.irradianceTexture;const K=new y.Mesh(j,m);E.add(U),E.add(K),U.name="MaterialXRadianceCube",U.position.set(.8,1,.01),U.scale.set(1.5,1,1),K.name="MaterialXIrradianceCube",K.position.set(-.8,1,-.01),K.scale.set(1.5,.98,1),console.log("[MaterialX] environment initialized from Needle context",{textures:s,radianceCube:U,irradianceCube:K})}}reset(){O&&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 w of this._texturesCache.values())w.radianceTexture?.dispose(),w.irradianceTexture?.dispose();this._texturesCache.clear()}get lights(){return this._lights}get lightData(){return this._lightData}get lightCount(){return this._lightCount||0}getTextures(w){if(w.envMap)return this._getTextures(w.envMap);const E=this._scene.environment||this._scene.background;return E instanceof y.Texture?this._getTextures(E):this._getTextures(null)}_pmremGenerator=null;_renderer=null;_texturesCache=new Map;async _initialize(w){return this._isInitialized=!1,this._pmremGenerator=new y.PMREMGenerator$1(w),this._renderer=w,this.updateLighting(!0),this._isInitialized=!0,!0}_getTextures(w){w||(w=uI);let E=this._texturesCache.get(w||null);if(E)return E;if(this._scene&&this._pmremGenerator&&this._renderer&&w){O&&console.log("[MaterialX] Generating environment textures",w.name);const R=this._pmremGenerator.fromEquirectangular(w),s=AB(this._renderer,R.texture,0,1024,512,R.height),M=AB(this._renderer,R.texture,1,32,16,R.height);R.dispose(),E={radianceTexture:s.texture,irradianceTexture:M.texture}}else E={radianceTexture:null,irradianceTexture:null};return this._texturesCache.set(w||null,E),E}updateLighting=(w=!1)=>{if(this._scene){if(w){const E=new Array;this._scene.traverse(R=>{R.isLight&&R.visible&&E.push(R)}),this._lights=E}if(r.materialXGenContext){const{lightData:E,lightCount:R}=xE(this._lights,r.materialXGenContext);this._lightData=E,this._lightCount=R}}}}const uE=new y.Matrix3;class ag extends y.ShaderMaterial{shaderName=null;copy(w){return super.copy(w),this._context=w._context,this._shader=w._shader,this.uniforms=y.cloneUniforms(w.uniforms),this.uniformsGroups=y.cloneUniformsGroups(w.uniformsGroups),this.envMapIntensity=w.envMapIntensity,this.envMap=w.envMap,xI(this,this._shader.getStage("pixel")),xI(this,this._shader.getStage("vertex")),this.needsUpdate=!0,this}_context=null;_shader=null;_needsTangents=!1;constructor(w){if(!w){super();return}let E=w.shader.getSourceCode("vertex"),R=w.shader.getSourceCode("pixel");E=E.replace(/^#version.*$/gm,"").trim(),R=R.replace(/^#version.*$/gm,"").trim(),E=E.replace(/\bi_position\b/g,"position"),E=E.replace(/\bi_normal\b/g,"normal"),E=E.replace(/\bi_texcoord_0\b/g,"uv"),E=E.replace(/\bi_texcoord_1\b/g,"uv1"),E=E.replace(/\bi_texcoord_2\b/g,"uv2"),E=E.replace(/\bi_texcoord_3\b/g,"uv3"),E=E.replace(/\bi_tangent\b/g,"tangent"),E=E.replace(/\bi_color_0\b/g,"color");const s=w.parameters?.precision||"highp";E=E.replace(/precision mediump float;/g,`precision ${s} float;`),E=E.replace(/#define M_FLOAT_EPS 1e-8/g,s==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),R=R.replace(/precision mediump float;/g,`precision ${s} float;`),R=R.replace(/#define M_FLOAT_EPS 1e-8/g,s==="highp"?"#define M_FLOAT_EPS 1e-8":"#define M_FLOAT_EPS 1e-3"),R=R.replace(/\bi_position\b/g,"position"),R=R.replace(/\bi_normal\b/g,"normal"),R=R.replace(/\bi_texcoord_0\b/g,"uv"),R=R.replace(/\bi_texcoord_1\b/g,"uv1"),R=R.replace(/\bi_texcoord_2\b/g,"uv2"),R=R.replace(/\bi_texcoord_3\b/g,"uv3"),R=R.replace(/\bi_tangent\b/g,"tangent"),R=R.replace(/\bi_color_0\b/g,"color");const M=E.includes("in vec2 uv;"),F=E.includes("in vec2 uv1;"),j=E.includes("in vec2 uv2;"),U=E.includes("in vec2 uv3;");E=E.replace(/in\s+vec3\s+position;/g,""),E=E.replace(/in\s+vec3\s+normal;/g,""),E=E.replace(/in\s+vec2\s+uv;/g,""),E=E.replace(/in\s+vec3\s+uv;/g,"");var m=E.includes("in vec3 uv1;");E=E.replace(/in\s+vec3\s+uv1;/g,"");var K=E.includes("in vec3 uv2;");E=E.replace(/in\s+vec3\s+uv2;/g,"");var gA=E.includes("in vec3 uv3;");E=E.replace(/in\s+vec3\s+uv3;/g,"");var e=E.includes("in vec4 tangent;");E=E.replace(/in\s+vec4\s+tangent;/g,"");var _=E.includes("in vec4 color;");E=E.replace(/in\s+vec4\s+color;/g,""),M||(E=E.replace(/texcoord_0 = uv;/g,"texcoord_0 = vec3(uv, 0.0);")),F||(E=E.replace(/texcoord_1 = uv1;/g,"texcoord_1 = vec3(uv1, 0.0);")),j||(E=E.replace(/texcoord_2 = uv2;/g,"texcoord_2 = vec3(uv2, 0.0);")),U||(E=E.replace(/texcoord_3 = uv3;/g,"texcoord_3 = vec3(uv3, 0.0);")),R=R.replace(/result\.direction\s*=\s*light\.position\s*-\s*position;/g,"result.direction = (light.position - position) * 10.0 / 1.0;"),R=R.replace(/out\s+vec4\s+out1;/,`layout(location = 0) out vec4 pc_fragColor;
85
+ #define gl_FragColor pc_fragColor`),R=R.replace(/^\s*out1\s*=\s*vec4\((.*)\);/gm,`
86
+ gl_FragColor = vec4($1);
87
+ #include <tonemapping_fragment>
88
+ #include <colorspace_fragment>`);const t={};m&&(t.USE_UV1=""),K&&(t.USE_UV2=""),gA&&(t.USE_UV3=""),e&&(t.USE_TANGENT=""),_&&(t.USE_COLOR="");const oA="",cA=w.parameters?.transparent??!1;super({name:w.name,uniforms:{},vertexShader:E,fragmentShader:R,glslVersion:y.GLSL3,depthTest:!0,depthWrite:!cA,defines:t,...w.parameters}),this.shaderName=w.shaderName||null,this._context=w.context,this._shader=w.shader,this._needsTangents=E.includes("in vec4 tangent;")||E.includes("in vec3 tangent;"),Object.assign(this.uniforms,{...iB(w.shader.getStage("vertex"),w.loaders,oA),...iB(w.shader.getStage("pixel"),w.loaders,oA),u_worldMatrix:{value:new y.Matrix4},u_viewProjectionMatrix:{value:new y.Matrix4},u_viewPosition:{value:new y.Vector3},u_worldInverseTransposeMatrix:{value:new y.Matrix4},u_envMatrix:{value:new y.Matrix4},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}}),xI(this,w.shader.getStage("pixel")),xI(this,w.shader.getStage("vertex")),(O||w.debug)&&(console.group("[MaterialX]: ",this.name),console.log(`Vertex shader length: ${E.length}
89
+ `,E),console.log(`Fragment shader length: ${R.length}
90
+ `,R),console.groupEnd())}_missingTangentsWarned=!1;onBeforeRender(w,E,R,s,M,F){this._needsTangents&&!s.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 j=this._context?.getTime?.()||_g(),U=this._context?.getFrame?.()||$g(),m=kg.get(E);m&&(m.update(U,E,w),this.updateEnvironmentUniforms(m)),this.updateUniforms(w,M,R,j,U)}envMapIntensity=1;envMap=null;updateUniforms=(w,E,R,s,M)=>{const F=this.uniforms;F.u_worldMatrix&&(F.u_worldMatrix.value.copy(E.matrixWorld),F.u_worldMatrix.needsUpdate=!0),F.u_viewPosition&&(F.u_viewPosition.value.setFromMatrixPosition(R.matrixWorld),F.u_viewPosition.needsUpdate=!0),F.u_viewProjectionMatrix&&(F.u_viewProjectionMatrix.value.multiplyMatrices(R.projectionMatrix,R.matrixWorldInverse),F.u_viewProjectionMatrix.needsUpdate=!0),F.u_worldInverseTransposeMatrix&&(F.u_worldInverseTransposeMatrix.value.setFromMatrix3(uE.getNormalMatrix(E.matrixWorld)),F.u_worldInverseTransposeMatrix.needsUpdate=!0),F.u_time&&(s===void 0&&(s=_g()),F.u_time.value=s),F.u_frame&&(M===void 0&&(M=$g()),F.u_frame.value=M),this.uniformsNeedUpdate=!0};updateEnvironmentUniforms=w=>{const E=this.uniforms,R=w.lightData||null,s=w.lightCount||0,M=w.getTextures(this)||null;if(E.u_numActiveLightSources&&s>=0&&(E.u_numActiveLightSources.value=s),R?.length&&(E.u_lightData.value=R,"needsUpdate"in E.u_lightData&&E.u_lightData.needsUpdate===!1&&(O&&console.debug(`[MaterialX] LightData assigned (${this.name}, ${this.uuid})`,R),E.u_lightData.needsUpdate=void 0)),E.u_envRadiance){const F=E.u_envRadiance.value;E.u_envRadiance.value=M.radianceTexture,F!=M.radianceTexture&&(E.u_envRadiance.needsUpdate=!0)}if(E.u_envRadianceMips&&(E.u_envRadianceMips.value=Math.trunc(Math.log2(Math.max(M.radianceTexture?.source.data.width??0,M.radianceTexture?.source.data.height??0)))+1),E.u_envIrradiance){const F=E.u_envIrradiance.value;E.u_envIrradiance.value=M.irradianceTexture,F!=M.irradianceTexture&&(E.u_envIrradiance.needsUpdate=!0)}this.uniformsNeedUpdate=!0}}class wB{name="NEEDLE_materials_mtlx";_generatedMaterials=[];_documentReadyPromise=null;get materialX_root_data(){const w=this.parser.json.extensions?.[this.name];if(!w)return null;let E=null;return"documents"in w&&Array.isArray(w.documents)?E=w.documents:E=[w],E}get materials(){return this._generatedMaterials}constructor(w,E,R){this.parser=w,this.options=E,this.context=R,O&&console.log("MaterialXLoader created for parser"),this.materialX_root_data&&hI()}loadMaterial(w){return this.parser.json.materials?.[w]?.extensions?.[this.name]?this._loadMaterialAsync(w):null}async _loadMaterialAsync(w){const E=this.parser.json.materials?.[w];O&&console.debug("[MaterialX] extension found in material:",E.extensions?.[this.name]);const R=E.extensions?.[this.name],s=R.document||0,M=this.materialX_root_data?.[s],F=M.mtlx||null;if(R&&F){const U={...this.options};return U.parameters||(U.parameters={}),U.parameters?.side===void 0&&E.doubleSided!==void 0&&(U.parameters.side=E.doubleSided?y.DoubleSide:y.FrontSide),kB(F,R.name,{cacheKey:this.options.cacheKey||"",getTexture:async m=>{const K=m.split("/").pop()?.split(".").shift()||"";if(M){const gA=M.textures||[];let e=-1;for(const _ of gA)if(_.name===K){const t=_.pointer,oA=t.substring(10);if(e=parseInt(oA),isNaN(e)||e<0){console.error("[MaterialX] Invalid texture index in pointer:",t);return}else O&&console.log("[MaterialX] Texture index found:",e,"for",K)}if(e<0){console.error("[MaterialX] Texture not found in parser:",K,this.parser.json);return}return this.parser.getDependency("texture",e)}return null}},U,this.context).then(m=>(m instanceof ag&&this._generatedMaterials.push(m),m))}const j=new y.MeshStandardMaterial;return j.name="MaterialX_Fallback",j}}function qE(l,w,E){l.register(R=>new wB(R,w||{},E||{}))}async function vE(l){if(await hI(),!r.materialXModule)throw new Error("[MaterialX] module failed to initialize");const w=r.materialXModule.createDocument();return w.setDataLibrary(r.materialXStdLib),await r.materialXModule.readFromXmlString(w,l,""),O&&console.log("[MaterialX] root document parsed successfully"),w}async function kB(l,w,E,R,s){try{O&&console.log(`Creating MaterialX material: ${w}`);const M=await vE(l);if(!r.materialXModule||!r.materialXGenerator||!r.materialXGenContext){console.warn("[MaterialX] WASM module not ready, returning fallback material");const _=new y.MeshStandardMaterial;return _.name=`MaterialX_Fallback_${w}`,_}let F=null,j=!1;O&&console.log("[MaterialX] document",M);const U=M.getMaterialNodes();O&&console.log(`[MaterialX] Found ${U.length} material nodes in document`,U);for(let _=0;_<U.length;++_){const t=U[_];if(t){const oA=t.getNamePath();if(O&&console.log(`[MaterialX] Scan material[${_}]: ${oA}`),U.length===1||oA==w||_===w){w=oA,F=t,j=!0,O&&console.log(`[MaterialX] Use material node: '${oA}'`);break}}}if(F){if(typeof w=="number"){console.warn(`[MaterialX] Material node not found by index (${w}), using first renderable element: ${F.getNamePath()}`);const _=new y.MeshStandardMaterial;return _.color.set(16711935),_.name=`MaterialX_NodeNotFound_${w}`,_}}else{console.warn(`[MaterialX] No renderable element found in MaterialX document (${w}) → Please provide a name or index. Options: ${U.map(t=>t.getNamePath()).join(", ")}`);const _=new y.MeshStandardMaterial;return _.color.set(16711935),_.name=`MaterialX_NoRenderable_${w}`,_}O&&console.log("[MaterialX] Using renderable element for shader generation");const m=r.materialXModule.isTransparentSurface(F,r.materialXGenerator.getTarget());r.materialXGenContext.getOptions().hwTransparency=m,O&&console.log("[MaterialX] Generating MaterialX shaders...");const K=F.getNamePath?F.getNamePath():F.getName(),gA=r.materialXGenerator.generate(K,F,r.materialXGenContext),e=new ag({name:w,shaderName:null,shader:gA,context:s||{},parameters:{transparent:m,...R?.parameters},loaders:E});return O&&console.log("[MaterialX] material created:",e.name),e}catch(M){console.error(`[MaterialX] Error creating MaterialX material (${w}):`,M);const F=new y.MeshStandardMaterial;return F.color.set(16711935),F.name=`MaterialX_Error_${w}`,F}}const tE={createMaterialXMaterial:kB};exports.Experimental_API=tE;exports.MaterialXLoader=wB;exports.MaterialXMaterial=ag;exports.preloadWasm=jE;exports.ready=hI;exports.useNeedleMaterialX=qE;