File: /home/dronicaehy/www/TOUR_AYTO_CT/lib/tdvgs.js
import*as i from"three";import{UniformsUtils as mA,UniformsLib as zA,MathUtils as FA}from"three";function sA(C,A){return new Promise(I=>{C.addEventListener("message",function g({data:Q}){Q?.type===A&&(C.removeEventListener("message",g),I(Q))})})}sA(self,"wasm_bindgen_worker_init").then(async({init:C,receiver:A})=>{const I=await Promise.resolve().then(()=>oI);await I.default(C),postMessage({type:"wasm_bindgen_worker_ready"}),I.wbg_rayon_start_worker(A)});async function eA(C,A,I){if(I.numThreads()===0)throw new Error("num_threads must be > 0.");const g={type:"wasm_bindgen_worker_init",init:{module_or_path:C,memory:A},receiver:I.receiver()};await Promise.all(Array.from({length:I.numThreads()},async()=>{const Q=new Worker(new URL(""+new URL("tdvgs/worker0.js",import.meta.url).href,import.meta.url),{type:"module"});return Q.postMessage(g),await sA(Q,"wasm_bindgen_worker_ready"),Q})),I.build()}let B;function T(C){const A=B.__externref_table_alloc();return B.__wbindgen_externrefs.set(A,C),A}function uA(C,A){if(!(C instanceof A))throw new Error(`expected instance of ${A.name}`)}const cA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>C.dtor(C.a,C.b));function RA(C){const A=typeof C;if(A=="number"||A=="boolean"||C==null)return`${C}`;if(A=="string")return`"${C}"`;if(A=="symbol"){const Q=C.description;return Q==null?"Symbol":`Symbol(${Q})`}if(A=="function"){const Q=C.name;return typeof Q=="string"&&Q.length>0?`Function(${Q})`:"Function"}if(Array.isArray(C)){const Q=C.length;let E="[";Q>0&&(E+=RA(C[0]));for(let D=1;D<Q;D++)E+=", "+RA(C[D]);return E+="]",E}const I=/\[object ([^\]]+)\]/.exec(toString.call(C));let g;if(I&&I.length>1)g=I[1];else return toString.call(C);if(g=="Object")try{return"Object("+JSON.stringify(C)+")"}catch{return"Object"}return C instanceof Error?`${C.name}: ${C.message}
${C.stack}`:g}function e(C,A){return C=C>>>0,$A().subarray(C/4,C/4+A)}function vA(C,A){C=C>>>0;const I=s(),g=[];for(let Q=C;Q<C+4*A;Q+=4)g.push(B.__wbindgen_externrefs.get(I.getUint32(Q,!0)));return B.__externref_drop_slice(C,A),g}function _A(C,A){return C=C>>>0,LA().subarray(C/4,C/4+A)}function kA(C,A){return C=C>>>0,j().subarray(C/1,C/1+A)}let u=null;function s(){return(u===null||u.buffer!==B.memory.buffer)&&(u=new DataView(B.memory.buffer)),u}let v=null;function $A(){return(v===null||v.buffer!==B.memory.buffer)&&(v=new Float32Array(B.memory.buffer)),v}function Z(C,A){return C=C>>>0,QI(C,A)}let _=null;function LA(){return(_===null||_.buffer!==B.memory.buffer)&&(_=new Uint32Array(B.memory.buffer)),_}let $=null;function j(){return($===null||$.buffer!==B.memory.buffer)&&($=new Uint8Array(B.memory.buffer)),$}function c(C,A){try{return C.apply(this,A)}catch(I){const g=T(I);B.__wbindgen_exn_store(g)}}function q(C){return C==null}function UA(C,A,I,g){const Q={a:C,b:A,cnt:1,dtor:I},E=(...D)=>{Q.cnt++;const w=Q.a;Q.a=0;try{return g(w,Q.b,...D)}finally{Q.a=w,E._wbg_cb_unref()}};return E._wbg_cb_unref=()=>{--Q.cnt===0&&(Q.dtor(Q.a,Q.b),Q.a=0,cA.unregister(Q))},cA.register(E,Q,Q),E}function AI(C,A){const I=A(C.length*4,4)>>>0;return LA().set(C,I/4),S=C.length,I}function KA(C,A){const I=A(C.length*1,1)>>>0;return j().set(C,I/1),S=C.length,I}function aA(C,A){const I=A(C.length*4,4)>>>0;for(let g=0;g<C.length;g++){const Q=T(C[g]);s().setUint32(I+4*g,Q,!0)}return S=C.length,I}function P(C,A,I){if(I===void 0){const w=IA.encode(C),o=A(w.length,1)>>>0;return j().subarray(o,o+w.length).set(w),S=w.length,o}let g=C.length,Q=A(g,1)>>>0;const E=j();let D=0;for(;D<g;D++){const w=C.charCodeAt(D);if(w>127)break;E[Q+D]=w}if(D!==g){D!==0&&(C=C.slice(D)),Q=I(Q,g,g=D+C.length*3,1)>>>0;const w=j().subarray(Q+D,Q+g),o=IA.encodeInto(C,w);D+=o.written,Q=I(Q,g,D,1)>>>0}return S=D,Q}function II(C){const A=B.__wbindgen_externrefs.get(C);return B.__externref_table_dealloc(C),A}let AA=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):void 0;AA&&AA.decode();const gI=2146435072;let MA=0;function QI(C,A){return MA+=A,MA>=gI&&(AA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),AA.decode(),MA=A),AA.decode(j().slice(C,C+A))}const IA=typeof TextEncoder<"u"?new TextEncoder:void 0;IA&&(IA.encodeInto=function(C,A){const I=IA.encode(C);return A.set(I),{read:C.length,written:I.length}});let S=0;function CI(C,A,I){B.wasm_bindgen__convert__closures_____invoke__hd38df12c1cd6b4f9(C,A,I)}function HA(C,A,I){B.wasm_bindgen__convert__closures_____invoke__h3de469b6e2daf722(C,A,I)}function BI(C,A,I,g){B.wasm_bindgen__convert__closures_____invoke__h0690231fe52a6d69(C,A,I,g)}const qA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>B.__wbg_hit_free(C>>>0,1)),dA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>B.__wbg_point_free(C>>>0,1)),tA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>B.__wbg_sortdata_free(C>>>0,1)),VA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>B.__wbg_splatbuffer_free(C>>>0,1)),xA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(C=>B.__wbg_wbg_rayon_poolbuilder_free(C>>>0,1));class f{static __wrap(A){A=A>>>0;const I=Object.create(f.prototype);return I.__wbg_ptr=A,qA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,qA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_hit_free(A,0)}get point(){const A=B.__wbg_get_hit_point(this.__wbg_ptr);return b.__wrap(A)}set point(A){uA(A,b);var I=A.__destroy_into_raw();B.__wbg_set_hit_point(this.__wbg_ptr,I)}get distance(){return B.__wbg_get_hit_distance(this.__wbg_ptr)}set distance(A){B.__wbg_set_hit_distance(this.__wbg_ptr,A)}get index(){return B.__wbg_get_hit_index(this.__wbg_ptr)>>>0}set index(A){B.__wbg_set_hit_index(this.__wbg_ptr,A)}}Symbol.dispose&&(f.prototype[Symbol.dispose]=f.prototype.free);class b{static __wrap(A){A=A>>>0;const I=Object.create(b.prototype);return I.__wbg_ptr=A,dA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,dA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_point_free(A,0)}get x(){return B.__wbg_get_point_x(this.__wbg_ptr)}set x(A){B.__wbg_set_point_x(this.__wbg_ptr,A)}get y(){return B.__wbg_get_point_y(this.__wbg_ptr)}set y(A){B.__wbg_set_point_y(this.__wbg_ptr,A)}get z(){return B.__wbg_get_point_z(this.__wbg_ptr)}set z(A){B.__wbg_set_point_z(this.__wbg_ptr,A)}}Symbol.dispose&&(b.prototype[Symbol.dispose]=b.prototype.free);class BA{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,tA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_sortdata_free(A,0)}get splat_count(){return B.__wbg_get_sortdata_splat_count(this.__wbg_ptr)>>>0}set splat_count(A){B.__wbg_set_sortdata_splat_count(this.__wbg_ptr,A)}get use_shared_memory(){return B.__wbg_get_sortdata_use_shared_memory(this.__wbg_ptr)!==0}set use_shared_memory(A){B.__wbg_set_sortdata_use_shared_memory(this.__wbg_ptr,A)}get dynamic_mode(){return B.__wbg_get_sortdata_dynamic_mode(this.__wbg_ptr)!==0}set dynamic_mode(A){B.__wbg_set_sortdata_dynamic_mode(this.__wbg_ptr,A)}setPositions(A,I,g){const Q=KA(A,B.__wbindgen_malloc),E=S;B.sortdata_setPositions(this.__wbg_ptr,Q,E,I,g)}setTransform(A,I){B.sortdata_setTransform(this.__wbg_ptr,A,I)}setTransforms(A){const I=aA(A,B.__wbindgen_malloc),g=S;B.sortdata_setTransforms(this.__wbg_ptr,I,g)}getSortedIndices(){const A=B.sortdata_getSortedIndices(this.__wbg_ptr);var I=_A(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getSortedIndicesPtr(){return B.sortdata_getSortedIndicesPtr(this.__wbg_ptr)>>>0}setTransformIndices(A){const I=AI(A,B.__wbindgen_malloc),g=S;B.sortdata_setTransformIndices(this.__wbg_ptr,I,g)}constructor(A,I,g,Q){const E=B.sortdata_new(A,I,g,Q);return this.__wbg_ptr=E>>>0,tA.register(this,this.__wbg_ptr,this),this}sort(A,I){return B.sortdata_sort(this.__wbg_ptr,A,I)>>>0}setBounds(A,I){B.sortdata_setBounds(this.__wbg_ptr,A,I)}}Symbol.dispose&&(BA.prototype[Symbol.dispose]=BA.prototype.free);class m{static __wrap(A){A=A>>>0;const I=Object.create(m.prototype);return I.__wbg_ptr=A,VA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,VA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_splatbuffer_free(A,0)}getMetadata(){let A,I;try{const g=B.splatbuffer_getMetadata(this.__wbg_ptr);return A=g[0],I=g[1],Z(g[0],g[1])}finally{B.__wbindgen_free(A,I,1)}}getSHDegree(){return B.splatbuffer_getSHDegree(this.__wbg_ptr)}getBoundsMax(){const A=B.splatbuffer_getBoundsMax(this.__wbg_ptr);var I=e(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getBoundsMin(){const A=B.splatbuffer_getBoundsMin(this.__wbg_ptr);var I=e(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getSHCBCount(){return B.splatbuffer_getSHCBCount(this.__wbg_ptr)>>>0}getTransform(){const A=B.splatbuffer_getTransform(this.__wbg_ptr);let I;return A[0]!==0&&(I=e(A[0],A[1]).slice(),B.__wbindgen_free(A[0],A[1]*4,4)),I}setTransform(A){B.splatbuffer_setTransform(this.__wbg_ptr,q(A)?0:T(A))}getSceneCenter(){const A=B.splatbuffer_getSceneCenter(this.__wbg_ptr);var I=e(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getCurrentRadius(){return B.splatbuffer_getCurrentRadius(this.__wbg_ptr)}getGaussianCount(){return B.splatbuffer_getGaussianCount(this.__wbg_ptr)>>>0}getMaximumRadius(){return B.splatbuffer_getMaximumRadius(this.__wbg_ptr)}getColorsBufferPtr(){return B.splatbuffer_getColorsBufferPtr(this.__wbg_ptr)>>>0}getCenterRadiusList(){const A=B.splatbuffer_getCenterRadiusList(this.__wbg_ptr);var I=e(A[0],A[1]).slice();return B.__wbindgen_free(A[0],A[1]*4,4),I}getCenterRadiusStep(){return B.splatbuffer_getCenterRadiusStep(this.__wbg_ptr)>>>0}getLoadedColorsCount(){return B.splatbuffer_getLoadedColorsCount(this.__wbg_ptr)>>>0}getShCoeffsBufferPtr(){const A=B.splatbuffer_getShCoeffsBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}computeVisibleIndices(A,I,g){return B.splatbuffer_computeVisibleIndices(this.__wbg_ptr,A,I,g)>>>0}getPositionsBufferPtr(){return B.splatbuffer_getPositionsBufferPtr(this.__wbg_ptr)>>>0}getLoadedShCoeffsCount(){return B.splatbuffer_getLoadedShCoeffsCount(this.__wbg_ptr)>>>0}getShCoeffsCBBufferPtr(){const A=B.splatbuffer_getShCoeffsCBBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}getCovariancesBufferPtr(){return B.splatbuffer_getCovariancesBufferPtr(this.__wbg_ptr)>>>0}getLoadedPositionsCount(){return B.splatbuffer_getLoadedPositionsCount(this.__wbg_ptr)>>>0}getLoadedShCoeffsCBCount(){return B.splatbuffer_getLoadedShCoeffsCBCount(this.__wbg_ptr)>>>0}getLoadedCovariancesCount(){return B.splatbuffer_getLoadedCovariancesCount(this.__wbg_ptr)>>>0}getVisibleIndicesBufferPtr(){return B.splatbuffer_getVisibleIndicesBufferPtr(this.__wbg_ptr)>>>0}getShCoeffsIndicesBufferPtr(){const A=B.splatbuffer_getShCoeffsIndicesBufferPtr(this.__wbg_ptr);return A===4294967297?void 0:A}getLoadedShCoeffsIndicesCount(){return B.splatbuffer_getLoadedShCoeffsIndicesCount(this.__wbg_ptr)>>>0}getDistanceLoadedFromSceneCenter(){return B.splatbuffer_getDistanceLoadedFromSceneCenter(this.__wbg_ptr)}export(A,I,g,Q){const E=P(I,B.__wbindgen_malloc,B.__wbindgen_realloc),D=S;var w=q(g)?0:KA(g,B.__wbindgen_malloc),o=S;const G=B.splatbuffer_export(this.__wbg_ptr,A,E,D,w,o,q(Q)?0:T(Q));if(G[3])throw II(G[2]);var k=kA(G[0],G[1]).slice();return B.__wbindgen_free(G[0],G[1]*1,1),k}raycast(A,I,g,Q){const E=B.splatbuffer_raycast(this.__wbg_ptr,A,I,g,Q);var D=vA(E[0],E[1]).slice();return B.__wbindgen_free(E[0],E[1]*4,4),D}getOctree(){return B.splatbuffer_getOctree(this.__wbg_ptr)}}Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);function TA(){return B.get_bytes_per_color()}function ZA(){return B.get_bytes_per_covariance()}function lA(){return B.get_bytes_per_covariance()}function OA(C){return B.initThreadPool(C)}function pA(){B.init_console_error()}function EA(){return B.is_position_f16()!==0}function WA(C,A,I){const g=P(C,B.__wbindgen_malloc,B.__wbindgen_realloc),Q=S;return B.load_url(g,Q,A,q(I)?0:T(I))}class z{static __wrap(A){A=A>>>0;const I=Object.create(z.prototype);return I.__wbg_ptr=A,xA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,xA.unregister(this),A}free(){const A=this.__destroy_into_raw();B.__wbg_wbg_rayon_poolbuilder_free(A,0)}numThreads(){return B.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr)>>>0}build(){B.wbg_rayon_poolbuilder_build(this.__wbg_ptr)}receiver(){return B.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr)>>>0}}Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);function EI(C){B.wbg_rayon_start_worker(C)}const DI=new Set(["basic","cors","default"]);async function iI(C,A){if(typeof Response=="function"&&C instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(C,A)}catch(g){if(C.ok&&DI.has(C.type)&&C.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",g);else throw g}const I=await C.arrayBuffer();return await WebAssembly.instantiate(I,A)}else{const I=await WebAssembly.instantiate(C,A);return I instanceof WebAssembly.Instance?{instance:I,module:C}:I}}function wI(C){const A={};return A.wbg={},A.wbg.__wbg_Window_925630dd9364b9e7=function(I){return I.Window},A.wbg.__wbg_WorkerGlobalScope_f8a15b453de109c0=function(I){return I.WorkerGlobalScope},A.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(I){const g=I,Q=typeof g=="boolean"?g:void 0;return q(Q)?16777215:Q?1:0},A.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(I,g){const Q=RA(g),E=P(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),D=S;s().setInt32(I+4*1,D,!0),s().setInt32(I+4*0,E,!0)},A.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(I){return typeof I=="function"},A.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(I){return I===void 0},A.wbg.__wbg___wbindgen_memory_a342e963fbcabd68=function(){return B.memory},A.wbg.__wbg___wbindgen_module_967adef62ea6cbf8=function(){return DA.__wbindgen_wasm_module},A.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(I,g){const Q=g,E=typeof Q=="number"?Q:void 0;s().setFloat64(I+8*1,q(E)?0:E,!0),s().setInt32(I+4*0,!q(E),!0)},A.wbg.__wbg___wbindgen_rethrow_78714972834ecdf1=function(I){throw I},A.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(I,g){throw new Error(Z(I,g))},A.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(I){I._wbg_cb_unref()},A.wbg.__wbg_async_bba5a2ac54b734df=function(I){return I.async},A.wbg.__wbg_body_947b901c33f7fe32=function(I){const g=I.body;return q(g)?0:T(g)},A.wbg.__wbg_buffer_063cd102cc769a1c=function(I){return I.buffer},A.wbg.__wbg_call_3020136f7a2d6e44=function(){return c(function(I,g,Q){return I.call(g,Q)},arguments)},A.wbg.__wbg_call_78f94eb02ec7f9b2=function(){return c(function(I,g,Q,E,D){return I.call(g,Q,E,D)},arguments)},A.wbg.__wbg_call_abb4ff46ce38be40=function(){return c(function(I,g){return I.call(g)},arguments)},A.wbg.__wbg_call_c8baa5c5e72d274e=function(){return c(function(I,g,Q,E){return I.call(g,Q,E)},arguments)},A.wbg.__wbg_data_8bf4ae669a78a688=function(I){return I.data},A.wbg.__wbg_elements_a81bc7dfdce748ad=function(I,g){const Q=g.elements,E=aA(Q,B.__wbindgen_malloc),D=S;s().setInt32(I+4*1,D,!0),s().setInt32(I+4*0,E,!0)},A.wbg.__wbg_error_7534b8e9a36f1ab4=function(I,g){let Q,E;try{Q=I,E=g,console.error(Z(I,g))}finally{B.__wbindgen_free(Q,E,1)}},A.wbg.__wbg_fetch_8119fbf8d0e4f4d1=function(I,g){return I.fetch(g)},A.wbg.__wbg_fetch_90447c28cc0b095e=function(I,g){return I.fetch(g)},A.wbg.__wbg_getReader_b6676f6d8b326942=function(I){return I.getReader()},A.wbg.__wbg_get_54490178d7d67e5e=function(){return c(function(I,g,Q,E){const D=g.get(Z(Q,E));var w=q(D)?0:P(D,B.__wbindgen_malloc,B.__wbindgen_realloc),o=S;s().setInt32(I+4*1,o,!0),s().setInt32(I+4*0,w,!0)},arguments)},A.wbg.__wbg_get_af9dab7e9603ea93=function(){return c(function(I,g){return Reflect.get(I,g)},arguments)},A.wbg.__wbg_headers_654c30e1bcccc552=function(I){return I.headers},A.wbg.__wbg_hit_new=function(I){return f.__wrap(I)},A.wbg.__wbg_instanceof_File_8de82c08b7cd5db7=function(I){let g;try{g=I instanceof File}catch{g=!1}return g},A.wbg.__wbg_instanceof_Object_577e21051f7bcb79=function(I){let g;try{g=I instanceof Object}catch{g=!1}return g},A.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b=function(I){let g;try{g=I instanceof Response}catch{g=!1}return g},A.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(I){let g;try{g=I instanceof Uint8Array}catch{g=!1}return g},A.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(I){let g;try{g=I instanceof Window}catch{g=!1}return g},A.wbg.__wbg_length_22ac23eaec9d8053=function(I){return I.length},A.wbg.__wbg_new_111dde64cffa8ba1=function(){return c(function(){return new FileReader},arguments)},A.wbg.__wbg_new_1ba21ce319a06297=function(){return new Object},A.wbg.__wbg_new_25f239778d6112b9=function(){return new Array},A.wbg.__wbg_new_53cb1e86c1ef5d2a=function(){return c(function(I,g){return new Worker(Z(I,g))},arguments)},A.wbg.__wbg_new_6421f6084cc5bc5a=function(I){return new Uint8Array(I)},A.wbg.__wbg_new_79cb6b4c6069a31e=function(){return c(function(I,g){return new URL(Z(I,g))},arguments)},A.wbg.__wbg_new_881a222c65f168fc=function(){return c(function(){return new AbortController},arguments)},A.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},A.wbg.__wbg_new_de1e660b88fc921f=function(I){return new Int32Array(I)},A.wbg.__wbg_new_ff12d2b041fb48f1=function(I,g){try{var Q={a:I,b:g},E=(w,o)=>{const G=Q.a;Q.a=0;try{return BI(G,Q.b,w,o)}finally{Q.a=G}};return new Promise(E)}finally{Q.a=Q.b=0}},A.wbg.__wbg_new_from_slice_f9c22b9153b26992=function(I,g){return new Uint8Array(kA(I,g))},A.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(I,g){return new Function(Z(I,g))},A.wbg.__wbg_new_with_str_and_init_c5748f76f5108934=function(){return c(function(I,g,Q){return new Request(Z(I,g),Q)},arguments)},A.wbg.__wbg_of_7779827fa663eec8=function(I,g,Q){return Array.of(I,g,Q)},A.wbg.__wbg_pathname_891dd78881a6e851=function(I,g){const Q=g.pathname,E=P(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),D=S;s().setInt32(I+4*1,D,!0),s().setInt32(I+4*0,E,!0)},A.wbg.__wbg_postMessage_07504dbe15265d5c=function(){return c(function(I,g){I.postMessage(g)},arguments)},A.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(I,g,Q){Uint8Array.prototype.set.call(kA(I,g),Q)},A.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(I){return I.queueMicrotask},A.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(I){queueMicrotask(I)},A.wbg.__wbg_readAsArrayBuffer_0aca937439be3197=function(){return c(function(I,g){I.readAsArrayBuffer(g)},arguments)},A.wbg.__wbg_read_39c4b35efcd03c25=function(I){return I.read()},A.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(I){return Promise.resolve(I)},A.wbg.__wbg_result_893437a1eaacc4df=function(){return c(function(I){return I.result},arguments)},A.wbg.__wbg_set_3f1d0b984ed272ed=function(I,g,Q){I[g]=Q},A.wbg.__wbg_set_7df433eea03a5c14=function(I,g,Q){I[g>>>0]=Q},A.wbg.__wbg_set_onerror_63939cdd10d24fe8=function(I,g){I.onerror=g},A.wbg.__wbg_set_onload_3ff2f72af5cc911d=function(I,g){I.onload=g},A.wbg.__wbg_set_onmessage_deb94985de696ac7=function(I,g){I.onmessage=g},A.wbg.__wbg_set_signal_e89be862d0091009=function(I,g){I.signal=g},A.wbg.__wbg_signal_3c14fbdc89694b39=function(I){return I.signal},A.wbg.__wbg_size_82fbdb656de23326=function(I){return I.size},A.wbg.__wbg_slice_3518c924243cda3a=function(){return c(function(I,g,Q){return I.slice(g,Q)},arguments)},A.wbg.__wbg_splatbuffer_new=function(I){return m.__wrap(I)},A.wbg.__wbg_stack_0ed75d68575b0f3c=function(I,g){const Q=g.stack,E=P(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),D=S;s().setInt32(I+4*1,D,!0),s().setInt32(I+4*0,E,!0)},A.wbg.__wbg_startWorkers_2ca11761e08ff5d5=function(I,g,Q){return eA(I,g,z.__wrap(Q))},A.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){const I=typeof global>"u"?null:global;return q(I)?0:T(I)},A.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){const I=typeof globalThis>"u"?null:globalThis;return q(I)?0:T(I)},A.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){const I=typeof self>"u"?null:self;return q(I)?0:T(I)},A.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){const I=typeof window>"u"?null:window;return q(I)?0:T(I)},A.wbg.__wbg_status_9bfc680efca4bdfd=function(I){return I.status},A.wbg.__wbg_then_429f7caf1026411d=function(I,g,Q){return I.then(g,Q)},A.wbg.__wbg_then_4f95312d68691235=function(I,g){return I.then(g)},A.wbg.__wbg_value_4cd497eeadba94bd=function(I){return I.value},A.wbg.__wbg_waitAsync_8afec80ffd213eca=function(I,g,Q){return Atomics.waitAsync(I,g>>>0,Q)},A.wbg.__wbg_waitAsync_c186cb97ffacd552=function(){return Atomics.waitAsync},A.wbg.__wbg_x_ee17d5da172d082f=function(I){return I.x},A.wbg.__wbg_y_74842f81d209bef6=function(I){return I.y},A.wbg.__wbg_z_a3f29b8ed2d03d80=function(I){return I.z},A.wbg.__wbindgen_cast_2241b6af4c4b2941=function(I,g){return Z(I,g)},A.wbg.__wbindgen_cast_680aab450cdb72e9=function(I,g){return UA(I,g,B.wasm_bindgen__closure__destroy__h23910dade50dd1bd,HA)},A.wbg.__wbindgen_cast_70dfa8acee24d589=function(I,g){return UA(I,g,B.wasm_bindgen__closure__destroy__h23910dade50dd1bd,HA)},A.wbg.__wbindgen_cast_94db0d3be1d44777=function(I,g){return UA(I,g,B.wasm_bindgen__closure__destroy__hd866ce7b2012c161,CI)},A.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(I){return I},A.wbg.__wbindgen_init_externref_table=function(){const I=B.__wbindgen_externrefs,g=I.grow(4);I.set(0,void 0),I.set(g+0,void 0),I.set(g+1,null),I.set(g+2,!0),I.set(g+3,!1)},A.wbg.__wbindgen_link_203404ece0e9bab9=function(I){const g=`onmessage = function (ev) {
let [ia, index, value] = ev.data;
ia = new Int32Array(ia.buffer);
let result = Atomics.wait(ia, index, value);
postMessage(result);
};
`,Q=typeof URL.createObjectURL>"u"?"data:application/javascript,"+encodeURIComponent(g):URL.createObjectURL(new Blob([g],{type:"text/javascript"})),E=P(Q,B.__wbindgen_malloc,B.__wbindgen_realloc),D=S;s().setInt32(I+4*1,D,!0),s().setInt32(I+4*0,E,!0)},A.wbg.memory=C||new WebAssembly.Memory({initial:24,maximum:65536,shared:!0}),A}function GI(C,A,I){if(B=C.exports,DA.__wbindgen_wasm_module=A,u=null,v=null,_=null,$=null,typeof I<"u"&&(typeof I!="number"||I===0||I%65536!==0))throw"invalid stack size";return B.__wbindgen_start(I),B}async function DA(C,A){if(B!==void 0)return B;let I;typeof C<"u"&&(Object.getPrototypeOf(C)===Object.prototype?{module_or_path:C,memory:A,thread_stack_size:I}=C:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof C>"u"&&(C=new URL("./tdvgs/gslib_bg.wasm",import.meta.url));const g=wI(A);(typeof C=="string"||typeof Request=="function"&&C instanceof Request||typeof URL=="function"&&C instanceof URL)&&(C=fetch(C));const{instance:Q,module:E}=await iI(await C,g);return GI(Q,E,I)}const oI=Object.freeze(Object.defineProperty({__proto__:null,Hit:f,Point:b,SortData:BA,SplatBuffer:m,default:DA,get_bytes_per_color:TA,get_bytes_per_covariance:ZA,get_bytes_per_position:lA,initThreadPool:OA,init_console_error:pA,is_position_f16:EA,load_url:WA,wbg_rayon_PoolBuilder:z,wbg_rayon_start_worker:EI},Symbol.toStringTag,{value:"Module"})),NI=()=>(async C=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(C)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),FI=function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)},RI=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},PA=function(){return/\sVR\s|OculusBrowser|PicoBrowser/i.test(navigator.userAgent)};let iA=!1,yA;async function bA(C){iA||(iA=!0,yA=(await DA(void 0,FI()||PA()?new WebAssembly.Memory({initial:24,maximum:8192,shared:!0}):void 0)).memory,pA(),C>1&&!RI()&&!PA()&&await NI()&&await OA(C))}function kI(){iA&&(yA=void 0,iA=!1)}function r(){return yA}let d;var l=(C=>(C[C.Init=0]="Init",C[C.Positions=1]="Positions",C[C.Bounds=2]="Bounds",C[C.Sort=3]="Sort",C[C.Dispose=4]="Dispose",C))(l||{});onmessage=async function(C){const A=C.data;if(A&&A.method!==void 0){if(A.method!=0&&!d)return;switch(A.method){case 0:await bA(1);const I=A.payload;UI(I),postMessage({method:A.method});break;case 1:const g=A.payload;postMessage({method:A.method,payload:yI(g)});break;case 2:const Q=A.payload;postMessage({method:A.method,payload:hI(Q)});break;case 3:const E=A.payload;postMessage({method:A.method,payload:JI(E)});break;case 4:MI();break;default:console.error("Unknown method:",A.method);break}}};function UI(C){d&&d.free(),d=new BA(C.splatCount,C.dynamicMode,C.useSharedMemory,C.maxScenes)}function MI(){d&&(d.free(),d=void 0),kI()}function yI(C){return d.setPositions(new Uint8Array(C.positions.buffer),C.offset,C.halfPrecision),{offset:C.offset,length:C.positions.length/3}}function hI(C){return d.setBounds(C.min,C.max),{}}function JI(C){let A=performance.now(),I=d.sort(C.cameraPos,C.cameraDir);return{sortedIndices:d.use_shared_memory?new Uint32Array(r().buffer,d.getSortedIndicesPtr(),I):new Uint32Array(d.getSortedIndices().buffer,0,I),renderCount:I,time:performance.now()-A}}function SI(C){return new Worker(""+new URL("tdvgs/worker1.js",import.meta.url).href,{type:"module",name:C?.name})}class hA{static MaxScenes=32}const XA={type:"change"};class X extends i.EventDispatcher{ui;stats;static#A;constructor(){if(X.#A!==void 0)return X.#A;super(),X.#A=this}async activate(A){if(!this.isActive()){try{const I=await import("lil-gui");this.ui=new I.GUI({closeFolders:!0}),this.ui.close()}catch{console.error("lil-gui not found");return}try{const I=(await import("stats-gl")).default;this.stats=new I({trackGPU:!0}),document.body.appendChild(this.stats.dom),await this.stats.init(A)}catch{console.error("stats-gl not found");return}this.dispatchEvent(XA)}}dispose(){this.isActive()&&(this.ui&&(this.ui.destroy(),this.ui=void 0),this.stats&&(this.stats.dom.remove(),this.stats=void 0),this.dispatchEvent(XA))}isActive(){return this.ui!==void 0}}var JA=(C=>(C.INIT="init",C.READY="ready",C))(JA||{});class YI extends i.EventDispatcher{lastSortTime=0;maxSortTime=0;#A=!1;#I;#g;#Q;#C=!1;#B=0;#E=new X;#D=!1;#i=1;constructor(A,I){super(),this.#I=A,this.#g=I}dispose(){this.#A&&(this.#Q&&(this.#Q.postMessage({method:l.Dispose}),this.#Q.terminate(),this.#Q=void 0),this.#C=!1,this.#A=!1)}init(A){this.dispose(),this.#w();const I={splatCount:A,useSharedMemory:this.#g,dynamicMode:this.#I,maxScenes:hA.MaxScenes};this.#Q.postMessage({method:l.Init,payload:I})}addPositions(A,I,g){const Q={positions:A,offset:I,halfPrecision:g};this.#Q.postMessage({method:l.Positions,payload:Q})}setBounds(A,I){this.#i=Math.min(1,I.distanceTo(A)*.001);const g={min:A,max:I};this.#Q?.postMessage({method:l.Bounds,payload:g})}#w(){this.#Q=new SI,this.#Q.onmessage=this.#G.bind(this)}#G=A=>{switch(A.data.method){case l.Init:this.#A=!0,this.dispatchEvent({type:"init"});break;case l.Positions:const I=A.data.payload;this.#B=I.offset+I.length,this.#D=!0;break;case l.Sort:const g=A.data.payload;this.#C=!1,this.lastSortTime=g.time,this.#E.isActive()&&(this.maxSortTime=Math.max(this.maxSortTime,this.lastSortTime)),this.dispatchEvent({type:"ready",data:{indices:g.sortedIndices,renderCount:g.renderCount}});break}};update=(()=>{const A=new i.Vector3,I=new i.Vector3,g=new i.Vector3,Q=new i.Vector3,E=new i.Vector3;return D=>{if(this.#C||!this.#A)return;let w,o,G=!1,k=!1;Q.setFromMatrixPosition(D);let h=D.elements;if(g.set(h[8],h[9],h[10]).negate().normalize(),w=g.dot(A),o=E.copy(Q).sub(I).length(),!this.#D&&!this.#I&&(w<=.99&&(G=!0),o>=this.#i&&(k=!0),!G&&!k))return;this.#C=!0;const t={cameraPos:Q,cameraDir:g};this.#Q.postMessage({method:l.Sort,payload:t}),I.copy(Q),A.copy(g),this.#D=!1}})()}const sI="cHJlY2lzaW9uIGhpZ2hwIGZsb2F0O3ByZWNpc2lvbiBoaWdocCBpbnQ7cHJlY2lzaW9uIGhpZ2hwIHNhbXBsZXIyRDtwcmVjaXNpb24gaGlnaHAgdXNhbXBsZXIyRDsKI2RlZmluZSB2YXJ5aW5nIG91dAp1bmlmb3JtIG1hdDQgbW9kZWxWaWV3TWF0cml4LHByb2plY3Rpb25NYXRyaXg7aW4gdmVjMiBwb3NpdGlvbjtpbiBpbnQgdjt1bmlmb3JtIGhpZ2hwIHVzYW1wbGVyMkQgUzsKI2lmZGVmIFNUCnVuaWZvcm0gbG93cCB1c2FtcGxlcjJEIHg7Y29uc3QgdmVjNCBoPXZlYzQoMSwuODcsMCwuOSkscj12ZWM0KDAsLjYyMzUsLjg5M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Glvbi55KmopKncsQS56LDEpOwojaWZkZWYgVVNFX0ZPRwp2Rm9nRGVwdGg9LVQuejsKI2VuZGlmCn0=",cI=Object.freeze(Object.defineProperty({__proto__:null,code:sI},Symbol.toStringTag,{value:"Module"})),LI="cHJlY2lzaW9uIGhpZ2hwIGZsb2F0OwojZGVmaW5lIHZhcnlpbmcgaW4KdmFyeWluZyB2ZWM0IHZDb2xvcjt2YXJ5aW5nIHZlYzIgdlBvc2l0aW9uO3ZhcnlpbmcgZmxvYXQgdkRlcHRoOwojaW5jbHVkZSA8Zm9nX3BhcnNfZnJhZ21lbnQ+Cm91dCB2ZWM0IG91dENvbG9yO3ZvaWQgbWFpbigpe2Zsb2F0IHY9ZG90KHZQb3NpdGlvbix2UG9zaXRpb24pO2lmKHY+NC4pZGlzY2FyZDtvdXRDb2xvcj12ZWM0KHZDb2xvci54eXosZXhwKC12KSp2Q29sb3Iudyk7CiNkZWZpbmUgZ2xfRnJhZ0NvbG9yIG91dENvbG9yCgojaW5jbHVkZSA8Zm9nX2ZyYWdtZW50PgoKI3VuZGVmIGdsX0ZyYWdDb2xvcgpnbF9GcmFnRGVwdGg9dkRlcHRoO30=",KI=Object.freeze(Object.defineProperty({__proto__:null,code:LI},Symbol.toStringTag,{value:"Module"}));class SA extends i.RawShaderMaterial{get#A(){return this.uniforms.S.value}set#A(A){this.#A&&this.#A.dispose(),this.uniforms.S.value=A,this.uniformsNeedUpdate=!0}get#I(){return this.uniforms.x.value}set#I(A){this.#I&&this.#I.dispose(),this.uniforms.x.value=A,this.uniformsNeedUpdate=!0}get#g(){return this.uniforms.y.value}set#g(A){this.#g&&this.#g.dispose(),this.uniforms.y.value=A,this.uniformsNeedUpdate=!0}set basisViewport(A){this.uniforms.w.value.set(2/A.x,2/A.y),this.uniformsNeedUpdate=!0}set cameraNear(A){this.uniforms.z.value=A,this.uniformsNeedUpdate=!0}get cameraNear(){return this.uniforms.z.value}set cameraPosition(A){this.uniforms.f.value.copy(A),this.uniformsNeedUpdate=!0}get cameraPosition(){return this.uniforms.f.value}set dynamicMode(A){if(this.dynamicMode!==A){if(A){const I=[];for(let g=0;g<hA.MaxScenes;g++)I.push(new i.Matrix4);this.uniforms.m={value:I},this.defines.DM=1}else delete this.defines.DM;this.needsUpdate=!0}}get dynamicMode(){return this.defines.DM===1}set focalLength(A){this.uniforms.t.value.copy(A),this.uniformsNeedUpdate=!0}set fog(A){this.fog!==A&&(A?this.defines.USE_FOG=1:delete this.defines.USE_FOG,this.needsUpdate=!0)}get fog(){return this.defines.USE_FOG===1}set fogExp2(A){this.fogExp2!==A&&(A?this.defines.FOG_EXP2=1:delete this.defines.FOG_EXP2,this.needsUpdate=!0)}get fogExp2(){return this.defines.FOG_EXP2===1}set halfPrecisionPositions(A){this.halfPrecisionPositions!==A&&(A?this.defines.PHF=1:delete this.defines.PHF,this.needsUpdate=!0)}get halfPrecisionPositions(){return this.defines.PHF===1}get nativeAntialiasing(){return this.defines.NAA===1}set nativeAntialiasing(A){this.nativeAntialiasing!==A&&(A?this.defines.NAA=1:delete this.defines.NAA,this.needsUpdate=!0)}set useStates(A){this.useStates!==A&&(A?this.defines.ST=1:(this.#I!==void 0&&(this.#I.dispose(),this.#I=void 0),delete this.defines.ST),this.needsUpdate=!0)}get useStates(){return this.defines.ST===1}get stateBuffer(){return this.#I?.image.data}constructor(){const{uniforms:A,defines:I}=SA.#C();super({uniforms:A,defines:I,vertexShader:atob(aI.code),fragmentShader:atob(HI.code),transparent:!0,alphaTest:1,blending:i.NormalBlending,depthTest:!0,depthWrite:!1,side:i.FrontSide,glslVersion:i.GLSL3}),this.needsUpdate=!1}setTransform(A,I){const g=this.uniforms.m;g&&(g.value[I].copy(A),this.uniformsNeedUpdate=!0)}dispose(){super.dispose(),this.disposeTextures()}disposeTextures(){this.#A&&(this.#A.dispose(),this.#A=void 0),this.#I&&(this.#I.dispose(),this.#I=void 0),this.#g&&(this.#g.dispose(),this.#g=void 0)}buildTextures(A){this.disposeTextures();const I=1,g=1,Q=1,E=3,D=3,w=.5,o=4,G=E+Q+D+w;let k=A.getGaussianCount();const h=this.defines.DM===1,t=this.defines.ST===1,K=this.defines.PHF===1,L=new Uint32Array(k*D),Y=new(K?Uint16Array:Uint32Array)(k*E),p=new Uint32Array(k*Q);this.#Q(A,L,Y,p);const U=this.computeTextureInfo(k,o,G),a=new Uint32Array(U.dataLength),n=K?(F,M)=>{a[F]=Y[M]|Y[M+1]<<16,a[F+1]=Y[M+2]}:(F,M)=>{a[F]=Y[M],a[F+1]=Y[M+1],a[F+2]=Y[M+2]};for(let F=0;F<k;F++){const M=F*8,N=F*3;n(M,N),a[M+4]=L[N],a[M+5]=L[N+1],a[M+6]=L[N+2],a[M+7]=p[F]}const H=new i.DataTexture(a,U.width,U.height,i.RGBAIntegerFormat,i.UnsignedIntType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);if(H.internalFormat="RGBA32UI",H.needsUpdate=!0,this.#A=H,t){const F=this.computeTextureInfo(k,1,1),M=new Uint8Array(F.dataLength),N=new i.DataTexture(M,F.width,F.height,i.RedIntegerFormat,i.UnsignedByteType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);N.needsUpdate=!0,this.#I=N;const x=Math.floor(F.width/F.texelsPerSplat)-1,y=Math.floor(Math.log2(F.width/F.texelsPerSplat));(this.defines.STWOTPS!==x||this.defines.SETWOTPS!==y)&&(this.defines.STWOTPS=x,this.defines.SETWOTPS=y,this.needsUpdate=!0)}if(h){const F=this.computeTextureInfo(k,I,g),M=new Uint32Array(F.width*F.height*I);let N=0,x=0;for(let R=0;R<A.numClouds();++R){const YA=A.getCloudAt(R),fA=YA.buffer.getGaussianCount();for(let NA=x;NA<fA;++NA)M[NA]=N;++N,x+=YA.globalSplatOffset}const y=new i.DataTexture(M,F.width,F.height,i.RedIntegerFormat,i.UnsignedIntType,i.UVMapping,i.ClampToEdgeWrapping,i.ClampToEdgeWrapping,i.NearestFilter,i.NearestFilter,0);y.internalFormat="R32UI",y.needsUpdate=!0,this.#g=y}const J=Math.floor(U.width/U.texelsPerSplat)-1,W=Math.floor(Math.log2(U.width/U.texelsPerSplat));(this.defines.TWOTPS!==J||this.defines.ETWOTPS!==W||this.defines.TPS!==U.texelsPerSplat)&&(this.defines.TWOTPS=J,this.defines.ETWOTPS=W,this.defines.TPS=U.texelsPerSplat,this.needsUpdate=!0)}computeTextureInfo(A,I,g){const E=Math.ceil(g/I),D=E*I,w=A*E,o=A*D;let G=1;for(;G*G<w;)G*=2;G>8192&&(G=8192,console.warn("Maximum splats count reached. Limiting to %s splats.",A));const k=Math.max(Math.ceil(o/G/I),1);return{width:G,height:k,dataLength:G*k*I,texelsPerSplat:E,paddedElementsPerSplat:D}}invalidateState(){this.#I&&(this.#I.needsUpdate=!0,this.needsUpdate=!0)}fillSHIndices(A){const I=new Uint32Array(this.#A.image.data.buffer),g=A.length;for(let Q=0;Q<g;++Q)I[Q*8+3]|=A[Q]<<16;this.#A.needsUpdate=!0}#Q(A,I,g,Q){for(let E=0;E<A.numClouds();++E){const D=A.getCloudAt(E);I&&D.fillPendingCovariancesData(I),g&&D.fillPendingPositionsData(g),Q&&D.fillPendingColorsData(Q)}}static#C(){const A=mA.merge([{S:{value:null},R:{value:null},x:{value:null},y:{value:null},t:{value:new i.Vector2},w:{value:new i.Vector2},z:{value:.1},f:{value:new i.Vector3}},zA.fog]),I={MAX_SCENES:hA.MaxScenes,TWOTPS:1,ETWOTPS:1,TPS:1};return{uniforms:A,defines:I}}}const aI=cI,HI=KI,qI={type:"change"};class gA extends i.EventDispatcher{_uniforms;get uniforms(){return this._uniforms}_defines;get defines(){return this._defines}constructor(){super(),this._uniforms=[],this._defines=[]}dispose(){}init(A){}update(A,I){}dispatchChange(){this.dispatchEvent(qI)}}var V=(C=>(C.IDLE="idle",C.PLAYING="playing",C.COMPLETED="completed",C))(V||{});class QA extends gA{disposeOnComplete=!0;#A=V.IDLE;get state(){return this.#A}play(){this.#A==V.IDLE&&this.setState(V.PLAYING)}stop(){this.#A==V.PLAYING&&this.setState(V.IDLE)}setState(A){this.#A=A,this.dispatchEvent({type:"stateChanged",state:A})}}const dI={type:"refresh"};class oA extends i.Mesh{isGaussianSplattingGroup=!0;boundingBox=null;gaussianState;#A;#I=!1;#g;#Q;#C;#B;#E;#D;set fx(A){A instanceof gA&&(A=[A]),this.#G(this.#D,A),this.#D=A}get fx(){return this.#D}constructor(A){super(oA.#i(0),new SA),this.type="GaussianSplattingGroup",this.#C=(A?.useSharedMemory??!0)&&crossOriginIsolated,this.#Q=A?.dynamicMode??!1,this.#B=A?.useStates??!1,this.#A=new YI(this.#Q,this.#C),this.#A.addEventListener(JA.INIT,this.#J.bind(this)),this.#A.addEventListener(JA.READY,this.#S.bind(this)),this.frustumCulled=!1,this.#E=new i.Matrix4,this.#g=()=>{this.#o()}}add(...A){let I=0;if(this.children.length>0){const Q=this.children[this.children.length-1];I=Q.globalSplatOffset+Q.buffer.getGaussianCount()}const g=this.children.length;for(const Q of A)Q.isGaussianCloud&&(Q.globalSplatOffset=I,I+=Q.buffer.getGaussianCount(),super.add(Q));return g!==this.children.length&&(this.#I=!0),this}remove(...A){const I=this.children.length;for(const g of A)g.isGaussianCloud&&super.remove(g);return I!==this.children.length&&(this.#I=!0),this}removeCloudAt(A){if(A<0||A>=this.children.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.remove(this.getCloudAt(A)),this.#I=!0,this}getCloudAt(A){if(A<0||A>=this.children.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.children[A]}numClouds(){return this.children.length}getGaussianCount(){return this.children.reduce((A,I)=>A+I.buffer.getGaussianCount(),0)}computeBoundingBox(){this.boundingBox===null?this.boundingBox=new i.Box3:this.boundingBox.makeEmpty();for(const A of this.children){const I=A;I.boundingBox===null&&I.computeBoundingBox();const g=I.boundingBox.applyMatrix4(I.matrix);this.boundingBox.union(g)}}raycast(A,I){}updateMatrix(){super.updateMatrix(),this.#R()}static#i(A){const I=new i.InstancedBufferGeometry;I.setIndex([0,1,2,0,2,3]);const g=new i.BufferAttribute(new Float32Array([-2,-2,2,-2,2,2,2,2,-2,2,-2,-2]),3);I.setAttribute("position",g),I.boundingSphere=new i.Sphere(new i.Vector3,1),g.needsUpdate=!0;const Q=new Int32Array(A),E=new i.InstancedBufferAttribute(Q,1,!1);return E.setUsage(i.DynamicDrawUsage),E.gpuType=i.IntType,I.setAttribute("v",E),I.instanceCount=0,I}#w(){const A=this.getGaussianCount();this.geometry=oA.#i(A),this.material.dynamicMode=this.#Q,this.material.useStates=this.#B,this.material.halfPrecisionPositions=EA(),this.material.buildTextures(this),this.gaussianState=this.material.stateBuffer,this.fx&&this.#G(void 0,this.fx),this.#A.init(A)}#G(A,I){A=A??[],I=I??[];const g=A.filter(E=>!I.includes(E)),Q=I.filter(E=>!A.includes(E));if(this.material&&(Q.length>0||g.length>0)){for(const E of g){if(E.uniforms)for(const D of E.uniforms)delete this.material.uniforms[D];if(E.defines)for(const D of E.defines)delete this.material.defines[D];E.removeEventListener("change",this.#g),E instanceof QA&&E.removeEventListener("stateChanged",this.#g)}for(const E of Q)E.init(this.material),E.addEventListener("change",this.#g),E instanceof QA&&E.addEventListener("stateChanged",this.#g);this.material.needsUpdate=!0}}#o(){this.dispatchEvent(dI)}dispose(){this.#N(),this.#A.dispose(),this.#I=!0}invalidateState(){this.#B&&(this.material.invalidateState(),this.#o())}#N(){this.geometry.dispose(),this.material&&this.material.dispose()}#F(A,I){const g=this.geometry,Q=g.attributes.v;Q.set(A,0),Q.addUpdateRange(0,A.length),Q.needsUpdate=!0,g.instanceCount=I}#R(){const A=this.material;let I=!1;for(let g=0;g<this.children.length;g++){const Q=this.children[g];Q.matrixNeedsUpdate&&(Q.updateMatrix(),this.#Q&&A.setTransform(Q.matrix,g),I=!0)}I&&this.boundingBox!==null&&this.computeBoundingBox()}#k=(()=>{const A=new i.Vector2,I=new i.Vector2,g=new i.Vector2;return(Q,E)=>{Q.getSize(I);let D=Q.getPixelRatio();if(Q.xr.isPresenting&&(D*=window.devicePixelRatio/D),I.multiplyScalar(D),g.set(E.projectionMatrix.elements[0]*I.x*.5,E.projectionMatrix.elements[5]*I.y*.5),!g.equals(A)||this.#I){E instanceof i.PerspectiveCamera&&(E.aspect=I.x/I.y,E.updateProjectionMatrix()),A.copy(g);const w=this.material;w.basisViewport=I,w.focalLength=g}}})();#U=(()=>{let A=new i.Vector3;return I=>{const g=this.material;this.#E.copy(this.matrixWorld).invert().multiply(I.matrixWorld),A.setFromMatrixPosition(this.#E),(!A.equals(g.cameraPosition)||this.#I)&&(g.cameraPosition=A),I instanceof i.PerspectiveCamera&&(I.near!=g.cameraNear||this.#I)&&(g.cameraNear=I.near)}})();#M(A){if(this.fx)for(let I=this.fx.length-1;I>=0;--I){const g=this.fx[I];if(g instanceof QA&&g.state===V.COMPLETED&&g.disposeOnComplete){g.dispose();const Q=this.fx.concat();Q.splice(I,1),this.fx=Q}g.update(this,A)}}#y(A){const I=this.material;I.fog=A.fog!==null,I.fogExp2=A.fog!==null&&A.fog.isFogExp2}#h(){const A=EA()?Uint16Array:Float32Array,I=new A(this.getGaussianCount()*3);let g=0;for(const Q of this.children){const E=Q,D=E.buffer.getGaussianCount()*3,w=new A(r().buffer,E.buffer.getPositionsBufferPtr(),D);I.set(w,g),g+=D}return I}#J(A){this.#A.addPositions(this.#h(),0,EA()),this.computeBoundingBox(),this.#A.setBounds(this.boundingBox.min,this.boundingBox.max),this.#o()}#S(A){const I=A.data;this.#F(I.indices,I.renderCount),this.#o()}onBeforeRender(A,I,g){this.#I&&(this.dispose(),this.numClouds()>0&&this.#w()),this.children.length!==0&&(this.#U(g),this.#k(A,g),this.#M(g),this.#y(I),this.#A.update(this.#E),this.#I=!1)}}const nA=new i.Matrix4,wA=new i.Ray;class jA extends i.Object3D{isGaussianCloud=!0;buffer;centerRadiusStep;centerRadiusList;sceneCenter;globalSplatOffset=0;matrixNeedsUpdate=!0;boundingBox=null;#A=0;#I=0;#g=0;get gaussianState(){const A=this.parent;if(A&&A.gaussianState)return new Uint8Array(A.gaussianState.buffer,this.globalSplatOffset,this.buffer.getGaussianCount())}get metadata(){return JSON.parse(this.buffer.getMetadata())}constructor(A){super(),this.buffer=A,this.frustumCulled=!1,this.type="GaussianCloud",this.centerRadiusList=A.getCenterRadiusList(),this.centerRadiusStep=A.getCenterRadiusStep();const I=A.getSceneCenter();this.sceneCenter=new i.Vector3(I[0],I[1],I[2])}dispose(){this.buffer&&this.buffer.free()}computeBoundingBox(){this.boundingBox===null?this.boundingBox=new i.Box3:this.boundingBox.makeEmpty();let A=this.buffer.getBoundsMin(),I=this.buffer.getBoundsMax();this.boundingBox.set(new i.Vector3(A[0],A[1],A[2]),new i.Vector3(I[0],I[1],I[2]))}raycast(A,I){if(nA.copy(this.matrixWorld).invert(),wA.copy(A.ray).applyMatrix4(nA),this.boundingBox===null&&this.computeBoundingBox(),!wA.intersectsBox(this.boundingBox))return;const g=this.buffer.raycast(wA.origin,wA.direction,!1,A.firstHitOnly??!1);for(const Q of g)Q.distance>=A.near&&Q.distance<=A.far&&I.push({distance:Q.distance,point:new i.Vector3().set(Q.point.x,Q.point.y,Q.point.z).applyMatrix4(this.matrixWorld),object:this,instanceId:Q.index}),Q.point.free(),Q.free()}updateMatrix(){this.matrixNeedsUpdate&&(super.updateMatrix(),this.matrixNeedsUpdate=!1)}fillPendingPositionsData(A){const I=this.buffer.getLoadedPositionsCount();this.#Q(A,lA()/A.BYTES_PER_ELEMENT,this.#A,I,this.buffer.getPositionsBufferPtr()),this.#A=I}fillPendingColorsData(A){const I=this.buffer.getLoadedColorsCount();this.#Q(A,TA()/A.BYTES_PER_ELEMENT,this.#I,I,this.buffer.getColorsBufferPtr()),this.#I=I}fillPendingCovariancesData(A){const I=this.buffer.getLoadedCovariancesCount();this.#Q(A,ZA()/A.BYTES_PER_ELEMENT,this.#g,I,this.buffer.getCovariancesBufferPtr()),this.#g=I}#Q(A,I,g,Q,E){const D=Q-g;if(D>0){let w=Object.getPrototypeOf(A).constructor,o=new w(r().buffer,E+g*I,D*I);A.set(o,(this.globalSplatOffset+g)*I)}}invalidateState(){const A=this.parent;A&&A.invalidateState()}}var rA=(C=>(C[C.NONE=0]="NONE",C[C.SELECTED=1]="SELECTED",C[C.DELETED=2]="DELETED",C[C.HIDDEN=4]="HIDDEN",C[C.HOVERED=8]="HOVERED",C))(rA||{});class O extends i.Loader{static#A=[];static#I=!1;#g;constructor(A){super(A),this.#g=Math.min(navigator.hardwareConcurrency,4)}setWorkerLimit(A){return this.#g=A,this}async load(A,I,g,Q){if(O.#I){O.#A.push({url:A,onLoad:I,onProgress:g,onError:Q,loader:this});return}O.#I=!0,await bA(this.#g),WA(A,(E,D)=>{g&&g(new ProgressEvent("progress",{loaded:E,total:D}))}).then(E=>{O.#I=!1;let D=new jA(E);this.#Q(),I(D)}).catch(E=>{O.#I=!1,this.#Q(),Q&&Q(E)})}#Q(){if(O.#A.length>0){let A=O.#A.shift();A.loader.load(A.url,A.onLoad,A.onProgress,A.onError)}}}class tI extends gA{#A=.3;#I=!1;get value(){return this.#A}set value(A){A=Math.max(0,Math.min(1,A)),this.#A!=A&&(this.#A=A,this.#g=!0,this.dispatchChange())}get native(){return this.#I}set native(A){this.#I!=A&&(this.#I=A,this.#g=!0,this.dispatchChange())}#g=!0;constructor(){super(),this._uniforms.push("u"),this._defines.push("COVAA","NAA"),this.#Q()}#Q(){const A=new X;A.isActive()?(A.ui?.add(this,"value",0,1,.01).name("Antialias"),A.ui?.add(this,"native",!1).name("Native Antialias")):A.addEventListener("change",I=>{this.#Q()})}init(A){A.uniforms.u={value:this.#A},A.defines[this._defines[0]]=1}update(A,I){const g=A.material;this.#g&&(this.#I?(g.defines.NAA=1,g.needsUpdate=!0):(g.defines.NAA&&(delete g.defines.NAA,g.needsUpdate=!0),g.uniforms.u.value=this.#A,g.uniformsNeedUpdate=!0),this.#g=!1)}}class VI extends gA{#A=3;get maxDegree(){return this.#A}set maxDegree(A){this.#A!=A&&(this.#A=A,this.#B=!0,this.dispatchChange())}#I;#g;#Q;#C;#B=!0;#E=!1;constructor(){super(),this._uniforms.push("R"),this._defines.push("SH","SH1","SH2","SH3","SHCB16","TWOTPS_SH","TPS_SH","ETWOTPS_SH");for(let A=0;A<15;A++)this._defines.push(`SHL${A}`),this._defines.push(`SHH${A}`);this.#D()}#D(){const A=new X;A.isActive()?A.ui?.add(this,"maxDegree",0,3,1).name("SH degree"):A.addEventListener("change",I=>{this.#D()})}init(A){A.uniforms.R={value:void 0}}dispose(){this.#I&&(this.#I.dispose(),this.#I=void 0),this.#g&&(this.#g.dispose(),this.#g=void 0),this.#Q&&(this.#Q.dispose(),this.#Q=void 0),this.#C&&(this.#C.dispose(),this.#C=void 0)}update(A,I){const g=A.material;if(!this.#I&&!this.#g&&!this.#Q&&!this.#C&&(this.#E=A.children.some(Q=>{if(Q.isGaussianCloud){const E=Q;return E.buffer.getSHCBCount()==0&&E.buffer.getSHDegree()>0}return!1}),this.#E?(this.#G(A),g.uniforms.H={value:this.#g},g.uniforms.A={value:this.#Q},g.uniforms.B={value:this.#C},this.#B=!0):(this.#w(A),this.#i(A),g.uniforms.R={value:this.#I}),g.uniformsNeedUpdate=!0),this.#B){for(const Q of this._defines)delete g.defines[Q];if(this.#A>0){g.defines.SH=1,this.#E||(g.defines.SHCB16=1);for(let Q=0;Q<this.#A;Q++)g.defines[`SH${Q+1}`]=1}if(this.#E){const Q=this.#g.image.width,E=Q-1,D=Math.floor(Math.log2(Q));g.defines.TWOTPS_SH=E,g.defines.ETWOTPS_SH=D}g.needsUpdate=!0,this.#B=!1}}#i(A){const I=A.getGaussianCount();let g=0;const Q=new Uint16Array(I);for(let D=0,w=A.numClouds();D<w;++D){const o=A.getCloudAt(D),G=o.buffer.getGaussianCount(),k=new Uint16Array(r().buffer,o.buffer.getShCoeffsIndicesBufferPtr(),G);Q.set(k,g),g+=G}A.material.fillSHIndices(Q)}#w(A){let D=0;for(let h=0,t=A.numClouds();h<t;++h){const K=A.getCloudAt(h);D+=K.buffer.getSHCBCount()}const w=1024/4,o=new i.Vector2(1024,Math.max(Math.ceil(D/w)*4,1)),G=new Uint16Array(o.x*o.y*3);let k=0;for(let h=0,t=A.numClouds();h<t;++h){const K=A.getCloudAt(h),L=K.buffer.getSHCBCount(),Y=new Uint16Array(r().buffer,K.buffer.getShCoeffsCBBufferPtr(),L*45);for(let p=0;p<L;++p){const U=p+k,a=U%w,n=Math.floor(U/w);let H=U*45;for(let J=0;J<4;++J){const W=(n*4+J)*1024*3;for(let F=0;F<4;++F){const M=(a*4+F)*3,N=W+M;G[N]=Y[H++],G[N+1]=Y[H++],G[N+2]=Y[H++]}}}k+=L}this.#I=new i.DataTexture(G,o.x,o.y,i.RGBFormat,i.HalfFloatType),this.#I.internalFormat="RGB16F",this.#I.needsUpdate=!0}#G(A){let Q=A.getGaussianCount();const D=A.material.computeTextureInfo(Q,4,15),w=D.dataLength*4,o=new Uint8Array(w),G=new Uint8Array(w),k=new Uint8Array(w),h=Math.floor(.5*255);for(let K=0,L=A.numClouds();K<L;++K){const Y=A.getCloudAt(K),p=Y.buffer.getSHCBCount(),U=Y.buffer.getSHDegree(),n=((U+1)*(U+1)-1)*3,H=Y.buffer.getGaussianCount();if(U<3&&(k.fill(h,0,H*D.paddedElementsPerSplat),U<2&&(G.fill(h,0,H*D.paddedElementsPerSplat),U<1&&o.fill(h,0,H*D.paddedElementsPerSplat))),p==0){const J=new Uint8Array(r().buffer,Y.buffer.getShCoeffsBufferPtr(),H*n),W=U>1?15:12,F=U>2?15:12,M=U==3?15:12;let N=0;for(let x=0;x<H;++x)if(U>=1){const y=x*D.paddedElementsPerSplat;N=x*n;for(let R=0;R<W;R+=4,N+=4)o[y+R]=J[N+3],o[y+R+1]=J[N+2],o[y+R+2]=J[N+1],o[y+R+3]=J[N];if(U>=2){N--;for(let R=0;R<F;R+=4,N+=4)G[y+R]=J[N+3],G[y+R+1]=J[N+2],G[y+R+2]=J[N+1],G[y+R+3]=J[N];if(U==3){N--;for(let R=0;R<M;R+=4,N+=4)k[y+R]=J[N+3],k[y+R+1]=J[N+2],k[y+R+2]=J[N+1],k[y+R+3]=J[N]}else for(let R=F;R<D.paddedElementsPerSplat;++R)G[y+R]=h}else for(let R=W;R<D.paddedElementsPerSplat;++R)o[y+R]=h}}}const t=[o,G,k].map(K=>{const L=new i.DataTexture(new Uint32Array(K.buffer),D.width,D.height,i.RGBAIntegerFormat,i.UnsignedIntType);return L.internalFormat="RGBA32UI",L.needsUpdate=!0,L});this.#g=t[0],this.#Q=t[1],this.#C=t[2]}}class xI extends QA{sparseFadeFactor=.1;denseFadeFactor=.1;denseTimeDelay=3;speedFactor=.25;minimumPointSize=2;#A;#I=0;#g=0;#Q=0;#C=0;#B=0;#E=0;#D=0;#i=0;#w=0;constructor(){super(),this._uniforms.push("D","i","p","n"),this._defines.push("RFIA","RFIA_SS")}dispose(){super.dispose(),this.#A&&(this.#A.stop(),this.#A=void 0)}stop(){this.state==V.PLAYING&&(this.#I=0,this.#g=0,this.#Q=0,this.#C=0,this.#B=0,this.#E=0,this.#D=0,this.#i=0,this.#w=0,this.#A&&(this.#A.stop(),this.#A=void 0)),super.stop()}init(A){A.uniforms.D={value:new i.Vector2},A.uniforms.i={value:new i.Vector2},A.uniforms.p={value:new i.Vector2},A.uniforms.n={value:new i.Vector3},A.defines[this._defines[0]]=1}update(A,I){if(this.state!=V.PLAYING)return;const g=A.getCloudAt(0),Q=g.buffer,E=A.material;this.#A||(this.#A=new i.Clock,this.speedFactor=FA.clamp(this.speedFactor,.01,1),this.sparseFadeFactor=FA.clamp(this.sparseFadeFactor,0,.99),this.denseFadeFactor=FA.clamp(this.denseFadeFactor,0,.99),E.uniforms.n.value.copy(g.sceneCenter.clone()),E.defines[this._defines[1]]!=this.minimumPointSize&&(E.defines[this._defines[1]]=this.minimumPointSize,E.needsUpdate=!0));const D=Q.getMaximumRadius()*1.05;if(this.#I>=.99&&this.#g>=.99&&this.#B>=D&&this.#i>=D){this.#A.stop(),this.#A=void 0,this.setState(V.COMPLETED);return}const w=Math.max(Q.getCurrentRadius(),.001),o=this.#A.getElapsedTime();this.#I=this.#I*.9+w*.1,this.#g=this.#g*.95+w*.05,this.#Q=1/(this.#I-this.#g);let G=Math.max(this.#G(o)*D,.001);this.#C=G*(1+this.sparseFadeFactor),this.#B=G*(1-this.sparseFadeFactor),this.#E=1/(this.#C-this.#B),G=Math.max(this.#G(Math.max(o-this.denseTimeDelay,0))*D,.001),this.#D=G*(1+this.denseFadeFactor),this.#i=G*(1-this.denseFadeFactor),this.#w=1/(this.#D-this.#i),E.uniforms.i.value.set(this.#I,this.#Q),E.uniforms.p.value.set(this.#C,this.#E),E.uniforms.D.value.set(this.#D,this.#w),E.uniformsNeedUpdate=!0,this.dispatchChange()}#G(A){return Math.pow(A*this.speedFactor,2.5)}}new i.Matrix4,new i.Euler(0,0,0,"YXZ"),new i.Quaternion,new i.Vector3;const CA=32,GA=5;class TI{data;size;constructor(A,I=A.length*CA){this.data=A,this.size=I}get(A){if(A<0||A>=this.size)return!1;const I=A>>>GA,g=A&CA-1;return(this.data[I]>>>g&1)!==0}set(A,I){if(A<0||A>=this.size)return;const g=A>>>GA,Q=A&CA-1;I?this.data[g]|=1<<Q:this.data[g]&=~(1<<Q)}has(A){if(A<0||A>=this.size)return!1;const I=A>>>GA,g=A&CA-1;return(this.data[I]&1<<g)!==0}getIndicesArray(){return Array.from(this.indices())}*indices(){for(let A=0,I=this.data.length;A<I;A++){let g=this.data[A]|0;for(;g!==0;){const Q=g&-g,E=CA-1-Math.clz32(Q);yield A<<GA|E,g&=g-1}}}toString(){let A="";for(const I of this.indices()){for(;A.length<I;)A+="0";A+="1"}return A.padEnd(this.size,"0")}}const ZI=new i.Vector3(-1,-1,1),lI="0.1.42";export{QA as AnimationFx,tI as AntialiasingFx,TI as BitArray,gA as Fx,ZI as GLOBAL_SCALE,jA as GaussianCloud,O as GaussianCloudLoader,oA as GaussianSplattingGroup,rA as GaussianState,xI as RadialFadeInAnimationFx,VI as SphericalHarmonicsFx,V as StateFx,lI as version};